tring-chat 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
… ${
|
|
1
|
+
var $s=Object.defineProperty;var Ns=(d,_,m)=>_ in d?$s(d,_,{enumerable:!0,configurable:!0,writable:!0,value:m}):d[_]=m;var ee=(d,_,m)=>Ns(d,typeof _!="symbol"?_+"":_,m);(function(){const _=document.createElement("link").relList;if(_&&_.supports&&_.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))y(x);new MutationObserver(x=>{for(const B of x)if(B.type==="childList")for(const A of B.addedNodes)A.tagName==="LINK"&&A.rel==="modulepreload"&&y(A)}).observe(document,{childList:!0,subtree:!0});function m(x){const B={};return x.integrity&&(B.integrity=x.integrity),x.referrerPolicy&&(B.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?B.credentials="include":x.crossOrigin==="anonymous"?B.credentials="omit":B.credentials="same-origin",B}function y(x){if(x.ep)return;x.ep=!0;const B=m(x);fetch(x.href,B)}})();const Ws=16,Us={code:"Space",ctrl:!0};function zs(){const d=[];for(let _=1;_<=10;_++){const m=_===10?0:_;d.push({slot:_,code:`Digit${m}`,legend:String(m)})}for(let _=11;_<=Ws;_++){const m=_-10;d.push({slot:_,code:`Digit${m}`,ctrl:!0,legend:`Ctrl+${m}`}),d.push({slot:_,code:`Digit${m}`,shift:!0,legend:`Shift+${m}`})}return d}const qi=zs(),js={KeyN:"next-done",KeyP:"projects",KeyC:"new-session",KeyR:"rename",KeyX:"kill",KeyM:"mark-seen",KeyO:"orchestrator",Escape:"close"};function Ki(d,_){return _.code===d.code&&_.ctrlKey===!!d.ctrl&&_.shiftKey===!!d.shift&&!_.altKey&&!_.metaKey}function oi(d){return Ki(Us,d)}function qs(d){for(const _ of qi)if(Ki(_,d))return _.slot;return null}function Ks(d){return d.ctrlKey||d.altKey||d.metaKey?null:js[d.code]??null}const Vs="\x1B\r";function Gs(d){return d.code!=="Enter"&&d.code!=="NumpadEnter"?!1:(d.ctrlKey||d.shiftKey)&&!d.altKey&&!d.metaKey}function Xs(d,_){return!_&&d.code==="KeyV"&&d.ctrlKey&&!d.shiftKey&&!d.altKey&&!d.metaKey}function ai(d){return qi.filter(_=>_.slot===d).map(_=>_.legend).join(" / ")}function Ys(d){const _=d.indexOf(0);return _<0?null:{id:new TextDecoder().decode(d.subarray(0,_)),data:d.subarray(_+1)}}const wi="tring.token";function Js(d,_,m){const y=new URLSearchParams(d).get("token");if(y){try{_.setItem(wi,y)}catch{}try{m==null||m()}catch{}return y}try{return _.getItem(wi)??void 0}catch{return}}const Pt=location.origin,Xe=Js(location.search,localStorage,()=>{const d=new URL(location.href);d.searchParams.delete("token"),history.replaceState(null,"",`${d.pathname}${d.search}${d.hash}`)});async function Ot(d){const _=await fetch(`${Pt}${d}`,{headers:Xe?{authorization:`Bearer ${Xe}`}:{}}),m=await _.json().catch(()=>({}));if(!_.ok)throw new Error(m.error??`request failed (${_.status})`);return m}async function Zs(d,_){const m=await fetch(`${Pt}${d}`,{method:"POST",headers:{...Xe?{authorization:`Bearer ${Xe}`}:{},"content-type":"application/json"},body:JSON.stringify({})}),y=await m.json().catch(()=>({}));if(!m.ok)throw new Error(y.error??`request failed (${m.status})`);return y}async function Qs(d){const _=d instanceof File?`?name=${encodeURIComponent(d.name)}`:"",m=await fetch(`${Pt}/api/upload${_}`,{method:"POST",headers:{...Xe?{authorization:`Bearer ${Xe}`}:{},"content-type":d.type||"application/octet-stream"},body:d}),y=await m.json().catch(()=>({}));if(!m.ok||!y.path)throw new Error(y.error??`upload failed (${m.status})`);return y.path}class er{constructor(_,m=Xe){ee(this,"ws",null);ee(this,"retry",0);ee(this,"closed",!1);this.h=_,this.token=m}connect(){const _=Pt.replace(/^http/,"ws"),m=new WebSocket(_);m.binaryType="arraybuffer",this.ws=m,m.onopen=()=>{this.retry=0,this.send({type:"hello",...this.token?{token:this.token}:{}}),this.h.onOpen()},m.onmessage=y=>{if(y.data instanceof ArrayBuffer){const x=Ys(new Uint8Array(y.data));x&&this.h.onOutput(x.id,x.data);return}this.h.onMessage(JSON.parse(String(y.data)))},m.onclose=()=>{this.ws=null,this.h.onClose(),!this.closed&&(this.retry=Math.min(this.retry+1,8),setTimeout(()=>this.connect(),Math.min(200*this.retry,2e3)))}}send(_){var m;((m=this.ws)==null?void 0:m.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(_))}dispose(){var _;this.closed=!0,(_=this.ws)==null||_.close()}}const tr=1e5,Le=d=>typeof d=="string"&&d.trim()?d:void 0;function Ie(d,_=tr){return d.length<=_?d:`${d.slice(0,_)}
|
|
2
|
+
… ${d.length-_} more characters`}function ir(d){if(d.kind==="reply")return{heading:"Finished — waiting for you",body:Ie(d.message??""),mono:!1};if(d.kind==="question")return{heading:"Question",body:"",mono:!1};const _=d.input??{},m=d.tool??"tool",y=Le(_.description),x=Le(_.file_path)??Le(_.notebook_path)??Le(_.path);switch(m){case"Bash":return{heading:"Run a command",tool:m,body:Ie(Le(_.command)??""),mono:!0,...y?{note:y}:{}};case"Edit":case"MultiEdit":return{heading:"Edit a file",tool:m,body:Ie(sr(_,x)),mono:!0};case"Write":return{heading:"Write a file",tool:m,body:Ie(`${x??""}
|
|
3
3
|
|
|
4
|
-
${Le(
|
|
4
|
+
${Le(_.content)??""}`),mono:!0};case"NotebookEdit":return{heading:"Edit a notebook",tool:m,body:Ie(x??""),mono:!0};case"WebFetch":return{heading:"Fetch a web page",tool:m,body:Ie(Le(_.url)??""),mono:!0,...Le(_.prompt)?{note:Le(_.prompt)}:{}};case"WebSearch":return{heading:"Search the web",tool:m,body:Ie(Le(_.query)??""),mono:!1};case"ExitPlanMode":return{heading:"Approve the plan",tool:m,body:Ie(Le(_.plan)??""),mono:!1}}return{heading:m.startsWith("mcp__")?`Use ${m.split("__")[1]??"an MCP"} tool`:`Use ${m}`,tool:m,body:Ie(JSON.stringify(_,null,2)),mono:!0,...y?{note:y}:{}}}function sr(d,_){const y=(Array.isArray(d.edits)?d.edits:[d]).map(x=>{const B=Le(x.old_string)??"",A=Le(x.new_string)??"";return[...B.split(`
|
|
5
5
|
`).map(t=>`- ${t}`),...A.split(`
|
|
6
6
|
`).map(t=>`+ ${t}`)].join(`
|
|
7
|
-
`)});return[
|
|
7
|
+
`)});return[_??"",...y].join(`
|
|
8
8
|
|
|
9
|
-
`)}function
|
|
9
|
+
`)}function yi(d,_,m){var x;const y={};for(const[B,A]of d.entries()){const t=[..._.get(B)??[]],a=(x=m.get(B))==null?void 0:x.trim();if(a&&t.push(a),t.length===0)return null;y[A.question]=A.multiSelect?t.join(", "):t[t.length-1]}return y}function $t(d){const _=Math.max(0,Math.round(d/1e3));return _<60?`${_}s`:_<3600?`${Math.floor(_/60)}m`:`${Math.floor(_/3600)}h`}const Vi=/^\s{0,3}(`{3,}|~{3,})\s*([\w+-]*)/,Gi=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,Xi=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/,Gt=/^(\s*)[-*+]\s+(.*)$/,Xt=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,Dt=/^\s{0,3}>\s?(.*)$/,Yi=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,Yt=d=>d.includes("|")&&d.trim().length>1;function Ei(d){let _=d.trim();return _.startsWith("|")&&(_=_.slice(1)),_.endsWith("|")&&!_.endsWith("\\|")&&(_=_.slice(0,-1)),_.split(new RegExp("(?<!\\\\)\\|")).map(m=>m.trim().replace(/\\\|/g,"|"))}function rr(d,_){return Vi.test(d)||Gi.test(d)||Xi.test(d)||Gt.test(d)||Xt.test(d)||Dt.test(d)||Yt(d)&&_!==void 0&&Yi.test(_)}function nr(d){const _=d.replace(/\r\n?/g,`
|
|
10
10
|
`).split(`
|
|
11
|
-
`),m=[];let y=0;for(;y<
|
|
12
|
-
`)});continue}const A=
|
|
13
|
-
`))});continue}const t=
|
|
14
|
-
`))})}return m}const
|
|
15
|
-
`).forEach((y,k)=>{k>0&&u.append(document.createElement("br")),y&&u.append(document.createTextNode(y))})}function Ot(u,p="md"){const m=document.createElement("div");m.className=p;for(const y of Vs(u))switch(y.t){case"heading":{const k=document.createElement(`h${Math.min(6,y.level+2)}`);Pe(k,y.children),m.append(k);break}case"para":{const k=document.createElement("p");Pe(k,y.children),m.append(k);break}case"quote":{const k=document.createElement("blockquote");Pe(k,y.children),m.append(k);break}case"code":{const k=document.createElement("pre"),O=document.createElement("code");O.textContent=y.text,y.lang&&(k.dataset.lang=y.lang),k.append(O),m.append(k);break}case"hr":m.append(document.createElement("hr"));break;case"list":{const k=document.createElement(y.ordered?"ol":"ul");y.ordered&&y.start!==1&&k.setAttribute("start",String(y.start));for(const O of y.items){const A=document.createElement("li");O.depth&&(A.style.marginLeft=`${O.depth*1.2}em`),Pe(A,O.children),k.append(A)}m.append(k);break}case"table":{const k=document.createElement("div");k.className="md-table";const O=document.createElement("table"),A=document.createElement("thead"),t=document.createElement("tr");for(const h of y.head){const c=document.createElement("th");Pe(c,h),t.append(c)}A.append(t);const a=document.createElement("tbody");for(const h of y.rows){const c=document.createElement("tr");for(const s of h){const l=document.createElement("td");Pe(l,s),c.append(l)}a.append(c)}O.append(A,a),k.append(O),m.append(k);break}}return m}const Pt="tring.orchestrator",Zs=350;function Q(u,p,m){const y=document.createElement(u);return p&&(y.className=p),m!==void 0&&(y.textContent=m),y}function Ee(u,p,m,y){const k=Q("button",`btn ${p}`,u);return k.type="button",y&&(k.title=y),k.onclick=O=>{O.stopPropagation(),m()},k}class $i{constructor(p,m){te(this,"el",Q("div","inbox"));te(this,"list",Q("div","inbox-list"));te(this,"empty",Q("div","inbox-empty"));te(this,"banner",Q("div","inbox-banner"));te(this,"autoBox",Q("input"));te(this,"agentBox",Q("input"));te(this,"agentNote",Q("div","inbox-banner agent-note"));te(this,"history",Q("details","inbox-history"));te(this,"historyList",Q("ol","inbox-history-list"));te(this,"historySummary",Q("summary"));te(this,"cards",new Map);te(this,"items",[]);te(this,"shown",!1);te(this,"armedAt",0);te(this,"ticker",null);this.cb=m,this.el.hidden=!0,this.el.tabIndex=-1;const y=Q("div","inbox-head");y.append(Q("span","inbox-title","Orchestrator"),Q("span","inbox-hint","a allow · d deny · t answer in terminal · o open · 1–9 pick · ↑↓ move · Ctrl+Space then o to leave")),this.autoBox.type="checkbox",this.autoBox.onchange=()=>this.cb.onAuto(this.autoBox.checked);const k=Q("label","inbox-auto");k.title="A small Claude model approves routine permission prompts (tests, builds, edits inside the project). Pushes, deletes, sudo, secrets, publishing, MCP tools, plans and questions always come to you. It never denies.",k.append(this.autoBox,Q("span",void 0,"AI approves routine prompts")),this.agentBox.type="checkbox",this.agentBox.onchange=()=>this.cb.onAgent({enabled:this.agentBox.checked});const O=Q("label","inbox-auto inbox-agent");O.title="A Claude Code session of its own in the centre. Tell it what you want; it reads every tile (status, branch, screen, changes), prompts the agents in them and starts new ones. Permission prompts stay here, with you.",O.append(this.agentBox,Q("span",void 0,"Agent")),y.append(O,k),this.history.hidden=!0,this.history.append(this.historySummary,this.historyList),this.banner.hidden=!0,this.agentNote.hidden=!0,this.el.append(y,this.agentNote,this.banner,this.history,this.list,this.empty),this.el.addEventListener("keydown",A=>this.onKey(A)),p.append(this.el)}get isOpen(){return this.shown}static wanted(){try{return localStorage.getItem(Pt)==="1"}catch{return!1}}open(p=!0){this.shown=!0,this.el.hidden=!1;try{localStorage.setItem(Pt,"1")}catch{}this.render(),this.checkHooks(),this.ticker??(this.ticker=setInterval(()=>this.paintAges(),5e3)),p&&this.focusCard(0,!1)}setBeside(p){this.el.classList.toggle("beside",p)}setAgent(p){this.agentBox.checked=p.enabled;const m=p.enabled&&(p.error!==null||p.id===null||p.status==="exited");if(this.agentNote.hidden=!m,!!m){if(p.error){this.agentNote.replaceChildren(Q("span",void 0,`The orchestrator agent could not start: ${p.error}`));return}this.agentNote.replaceChildren(Q("span",void 0,p.id?"The orchestrator agent’s Claude has exited.":"The orchestrator agent is starting…"),...p.id?[Ee("Start again","primary",()=>this.cb.onAgent({restart:"resume"}),"Reopen the same conversation"),Ee("New conversation","",()=>this.cb.onAgent({restart:"fresh"}))]:[])}}close(){this.shown=!1,this.el.hidden=!0;try{localStorage.setItem(Pt,"0")}catch{}this.ticker&&clearInterval(this.ticker),this.ticker=null}countFor(p){return this.items.filter(m=>m.sessionId===p).length}get count(){return this.items.length}setItems(p){const m=new Set(this.items.map(k=>k.id)),y=this.focusedCardId();return this.items=p,this.render(),this.shown&&y&&!this.cards.has(y)?this.focusCard(0,!0):this.shown&&!y&&document.activeElement===this.el&&this.focusCard(0,!0),p.filter(k=>!m.has(k.id))}setAuto(p,m){this.autoBox.checked=p,this.history.hidden=m.length===0;const y=m.filter(k=>k.verdict==="allow").length;this.historySummary.textContent=`AI decisions: ${y} approved for you, ${m.length-y} left for you`,this.historyList.replaceChildren(...m.map(k=>{const O=Q("li",`hist-${k.verdict}`),A=this.cb.label(k.sessionId);return O.append(Q("span","hist-verdict",k.verdict==="allow"?"approved":"asked you"),Q("span","hist-who",A?`${A.slot} ${A.name}`:"closed session"),Q("code","hist-what",k.what||k.tool),Q("span","hist-reason",k.reason),Q("span","hist-age",Bt(Date.now()-k.at))),O}))}repaint(){for(const p of this.cards.values())p.paintHeader()}render(){const p=document.activeElement,m=p instanceof HTMLElement&&this.list.contains(p)?p:null,y=new Set(this.items.map(O=>O.id));for(const[O,A]of this.cards)y.has(O)||(A.root.remove(),this.cards.delete(O));let k=null;for(const O of this.items){let A=this.cards.get(O.id);A||(A=this.build(O),this.cards.set(O.id,A));const t=k?k.nextSibling:this.list.firstChild;t!==A.root&&this.list.insertBefore(A.root,t),k=A.root}m&&m.isConnected&&document.activeElement!==m&&m.focus({preventScroll:!0}),this.empty.hidden=this.items.length>0,this.empty.textContent="Nothing is waiting on you. Cards appear here when an agent asks for permission, asks a question, or finishes."}async checkHooks(){try{const p=await this.cb.hooks();if(this.banner.hidden=p.installed,p.installed)return;this.banner.replaceChildren(Q("span",void 0,`Claude Code hooks are not installed, so agents cannot reach this inbox. They go in ${p.path} and do nothing outside tring.`),Ee("Install hooks","primary",()=>{this.cb.installHooks().then(()=>this.checkHooks(),m=>{this.banner.replaceChildren(Q("span",void 0,`Could not install: ${m.message}`))})}),Q("span","inbox-note","Restart running claude sessions to pick them up."))}catch{this.banner.hidden=!0}}focusedCardId(){const p=document.activeElement;for(const[m,y]of this.cards)if(y.root.contains(p))return m;return null}focusCard(p,m){const y=[...this.cards.values()][Math.max(0,Math.min(p,this.cards.size-1))];m&&(this.armedAt=performance.now()+Zs),y?y.root.focus({preventScroll:!1}):this.el.focus()}paintAges(){for(const p of this.cards.values()){const m=p.root.querySelector(".card-age");m&&(m.textContent=Bt(Date.now()-p.item.createdAt))}}onKey(p){if(p.ctrlKey||p.metaKey||p.altKey)return;const m=p.target,y=m.tagName==="TEXTAREA"||m.tagName==="INPUT",k=[...this.cards.keys()],O=k.indexOf(this.focusedCardId()??"");if(!y&&(p.key==="ArrowDown"||p.key==="j")){p.preventDefault(),this.focusCard(O+1,!1);return}if(!y&&(p.key==="ArrowUp"||p.key==="k")){p.preventDefault(),this.focusCard(Math.max(0,O-1),!1);return}if(!(O<0)){if(performance.now()<this.armedAt){p.preventDefault();return}this.cards.get(k[O]).key(p)&&p.preventDefault()}}build(p){const m=zs(p),y=Q("section",`card card-${p.kind}`);y.tabIndex=0;const k=Q("header","card-head"),O=Q("span","card-slot"),A=Q("span","card-name"),t=Q("span","card-where"),a=Q("span","card-heading",m.heading),h=Q("span","card-age",Bt(Date.now()-p.createdAt));k.append(O,A,t,a,h);const c=()=>{const o=this.cb.label(p.sessionId);O.textContent=o?String(o.slot):"?",A.textContent=(o==null?void 0:o.name)??"session",t.textContent=o!=null&&o.elsewhere?`in ${o.elsewhere}`:"",o!=null&&o.color?y.style.setProperty("--tint",o.color):y.style.removeProperty("--tint")};c(),y.append(k);const s=(o,e)=>this.cb.onAnswer(p.id,o,e),l=()=>this.cb.onOpen(p.sessionId),f=Q("div","card-actions");let v=()=>!1;if(p.kind==="permission"){m.note&&y.append(Q("p","card-note",m.note)),y.append(m.mono?Q("pre","card-body",m.body):Ot(m.body,"card-body md")),m.tool&&y.append(Q("div","card-tool",m.tool));const o=Q("input","card-reason");o.placeholder="Why not? (optional, Enter to deny)",o.hidden=!0;const e=()=>{if(o.hidden){o.hidden=!1,o.focus();return}s("deny",{message:o.value})};o.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),s("deny",{message:o.value})),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),o.hidden=!0,y.focus())}),f.append(Ee("Allow","primary",()=>s("allow"),"a"),Ee("Deny","danger",e,"d"),Ee("Answer in terminal","",()=>s("terminal"),"t"),Ee("Open","",l,"o")),y.append(f,o),v=r=>r.target!==y?!1:r.key==="a"?(s("allow"),!0):r.key==="d"?(e(),!0):r.key==="t"?(s("terminal"),!0):r.key==="o"?(l(),!0):!1}if(p.kind==="question"){const o=p.questions??[],e=new Map,r=new Map,i=Ee("Send answers","primary",()=>n()),n=()=>{const b=pi(o,e,r);b&&s("allow",{answers:b})},d=()=>{i.disabled=pi(o,e,r)===null},C=o.length===1&&!o[0].multiSelect,g=[];for(const[b,_]of o.entries()){const S=Q("div","card-question");_.header&&S.append(Q("span","card-chip",_.header)),S.append(Ot(_.question,"card-ask md"));const w=Q("div","card-options");for(const[L,x]of _.options.entries()){const T=Q("button","option");T.type="button",T.append(Q("b",void 0,`${L+1}`),Q("span",void 0,x.label)),x.description&&T.append(Q("small",void 0,x.description)),T.onclick=F=>{F.stopPropagation();const $=e.get(b)??new Set;_.multiSelect?$.has(x.label)?$.delete(x.label):$.add(x.label):($.clear(),$.add(x.label)),e.set(b,$),Array.from(w.querySelectorAll(".option")).forEach((N,H)=>{N.classList.toggle("picked",$.has(_.options[H].label))}),d(),C&&n()},b===0&&g.push(T),w.append(T)}const R=Q("input","card-other");R.placeholder="Or type your own answer",R.addEventListener("input",()=>{r.set(b,R.value),d()}),R.addEventListener("keydown",L=>{L.key==="Enter"&&(L.preventDefault(),L.stopPropagation(),n()),L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),y.focus())}),S.append(w,R),y.append(S)}d(),f.append(...C?[]:[i],Ee("Answer in terminal","",()=>s("terminal"),"t"),Ee("Open","",l,"o")),y.append(f),v=b=>{if(b.target!==y)return!1;const _=Number(b.key);return _>=1&&_<=9&&g[_-1]?(g[_-1].click(),!0):b.key==="t"?(s("terminal"),!0):b.key==="o"?(l(),!0):b.key==="Enter"&&!C?(n(),!0):!1}}if(p.kind==="reply"){y.append(Ot(m.body,"card-message md"));const o=Q("textarea","card-reply");o.rows=2,o.placeholder="Reply… (Enter sends, Shift+Enter for a new line)";const e=()=>{const r=o.value.trim();r&&this.cb.onReply(p.id,r)};o.addEventListener("keydown",r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),r.stopPropagation(),e()),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),y.focus())}),f.append(Ee("Send","primary",e),Ee("Dismiss","",()=>s("terminal"),"x"),Ee("Open","",l,"o")),y.append(o,f),v=r=>r.target!==y?!1:r.key==="Enter"||r.key==="r"?(o.focus(),!0):r.key==="x"?(s("terminal"),!0):r.key==="o"?(l(),!0):!1}return{item:p,root:y,paintHeader:c,key:v}}}var Qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ni={exports:{}};(function(u,p){(function(m,y){u.exports=y()})(globalThis,()=>(()=>{var m={4567:function(A,t,a){var h=this&&this.__decorate||function(i,n,d,C){var g,b=arguments.length,_=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,d):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(i,n,d,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(_=(b<3?g(_):b>3?g(n,d,_):g(n,d))||_);return b>3&&_&&Object.defineProperty(n,d,_),_},c=this&&this.__param||function(i,n){return function(d,C){n(d,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const s=a(9042),l=a(9924),f=a(844),v=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends f.Disposable{constructor(i,n,d,C){super(),this._terminal=i,this._coreBrowserService=d,this._renderService=C,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 g=0;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);if(this._topBoundaryFocusListener=g=>this._handleBoundaryFocus(g,0),this._bottomBoundaryFocusListener=g=>this._handleBoundaryFocus(g,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 l.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(g=>this._handleResize(g.rows))),this.register(this._terminal.onRender(g=>this._refreshRows(g.start,g.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(g=>this._handleChar(g))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
16
|
-
`))),this.register(this._terminal.onA11yTab(g=>this._handleTab(g))),this.register(this._terminal.onKey(g=>this._handleKey(g.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,
|
|
17
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=s.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,n){this._liveRegionDebouncer.refresh(i,n,this._terminal.rows)}_renderRows(i,n){const d=this._terminal.buffer,C=d.lines.length.toString();for(let g=i;g<=n;g++){const b=d.lines.get(d.ydisp+g),_=[],S=(b==null?void 0:b.translateToString(!0,void 0,void 0,_))||"",w=(d.ydisp+g+1).toString(),R=this._rowElements[g];R&&(S.length===0?(R.innerText=" ",this._rowColumns.set(R,[0,1])):(R.textContent=S,this._rowColumns.set(R,_)),R.setAttribute("aria-posinset",w),R.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,n){const d=i.target,C=this._rowElements[n===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(n===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==C)return;let g,b;if(n===0?(g=d,b=this._rowElements.pop(),this._rowContainer.removeChild(b)):(g=this._rowElements.shift(),b=d,this._rowContainer.removeChild(g)),g.removeEventListener("focus",this._topBoundaryFocusListener),b.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){const _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{const _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var S;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let n={node:i.anchorNode,offset:i.anchorOffset},d={node:i.focusNode,offset:i.focusOffset};if((n.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===d.node&&n.offset>d.offset)&&([n,d]=[d,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;const C=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:C,offset:((S=C.textContent)==null?void 0:S.length)??0}),!this._rowContainer.contains(d.node))return;const g=({node:w,offset:R})=>{const L=w instanceof Text?w.parentNode:w;let x=parseInt(L==null?void 0:L.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;const T=this._rowColumns.get(L);if(!T)return console.warn("columns is null. Race condition?"),null;let F=R<T.length?T[R]:T.slice(-1)[0]+1;return F>=this._terminal.cols&&(++x,F=0),{row:x,column:F}},b=g(n),_=g(d);if(b&&_){if(b.row>_.row||b.row===_.row&&b.column>=_.column)throw new Error("invalid range");this._terminal.select(b.column,b.row,(_.row-b.row)*this._terminal.cols-b.column+_.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=r=h([c(1,o.IInstantiationService),c(2,v.ICoreBrowserService),c(3,v.IRenderService)],r)},3614:(A,t)=>{function a(l){return l.replace(/\r?\n/g,"\r")}function h(l,f){return f?"\x1B[200~"+l+"\x1B[201~":l}function c(l,f,v,o){l=h(l=a(l),v.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(l,!0),f.value=""}function s(l,f,v){const o=v.getBoundingClientRect(),e=l.clientX-o.left-10,r=l.clientY-o.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${e}px`,f.style.top=`${r}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(l,f){l.clipboardData&&l.clipboardData.setData("text/plain",f.selectionText),l.preventDefault()},t.handlePasteEvent=function(l,f,v,o){l.stopPropagation(),l.clipboardData&&c(l.clipboardData.getData("text/plain"),f,v,o)},t.paste=c,t.moveTextAreaUnderMouseCursor=s,t.rightClickHandler=function(l,f,v,o,e){s(l,f,v),e&&o.rightClickSelect(l),f.value=o.selectionText,f.select()}},7239:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=a(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(c,s,l){this._css.set(c,s,l)}getCss(c,s){return this._css.get(c,s)}setColor(c,s,l){this._color.set(c,s,l)}getColor(c,s){return this._color.get(c,s)}clear(){this._color.clear(),this._css.clear()}}},3656:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,c,s){a.addEventListener(h,c,s);let l=!1;return{dispose:()=>{l||(l=!0,a.removeEventListener(h,c,s))}}}},3551:function(A,t,a){var h=this&&this.__decorate||function(r,i,n,d){var C,g=arguments.length,b=g<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(r,i,n,d);else for(var _=r.length-1;_>=0;_--)(C=r[_])&&(b=(g<3?C(b):g>3?C(i,n,b):C(i,n))||b);return g>3&&b&&Object.defineProperty(i,n,b),b},c=this&&this.__param||function(r,i){return function(n,d){i(n,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const s=a(3656),l=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(r,i,n,d,C){super(),this._element=r,this._mouseService=i,this._renderService=n,this._bufferService=d,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new l.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new l.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)(()=>{var g;this._lastMouseEvent=void 0,(g=this._activeProviderReplies)==null||g.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,s.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,s.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const n=r.composedPath();for(let d=0;d<n.length;d++){const C=n[d];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,i){var d,C;this._activeProviderReplies&&i||((d=this._activeProviderReplies)==null||d.forEach(g=>{g==null||g.forEach(b=>{b.link.dispose&&b.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=r.y);let n=!1;for(const[g,b]of this._linkProviderService.linkProviders.entries())i?(C=this._activeProviderReplies)!=null&&C.get(g)&&(n=this._checkLinkProviderResult(g,r,n)):b.provideLinks(r.y,_=>{var w,R;if(this._isMouseOut)return;const S=_==null?void 0:_.map(L=>({link:L}));(w=this._activeProviderReplies)==null||w.set(g,S),n=this._checkLinkProviderResult(g,r,n),((R=this._activeProviderReplies)==null?void 0:R.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)})}_removeIntersectingLinks(r,i){const n=new Set;for(let d=0;d<i.size;d++){const C=i.get(d);if(C)for(let g=0;g<C.length;g++){const b=C[g],_=b.link.range.start.y<r?0:b.link.range.start.x,S=b.link.range.end.y>r?this._bufferService.cols:b.link.range.end.x;for(let w=_;w<=S;w++){if(n.has(w)){C.splice(g--,1);break}n.add(w)}}}}_checkLinkProviderResult(r,i,n){var g;if(!this._activeProviderReplies)return n;const d=this._activeProviderReplies.get(r);let C=!1;for(let b=0;b<r;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(C=!0);if(!C&&d){const b=d.find(_=>this._linkAtPosition(_.link,i));b&&(n=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let b=0;b<this._activeProviderReplies.size;b++){const _=(g=this._activeProviderReplies.get(b))==null?void 0:g.find(S=>this._linkAtPosition(S.link,i));if(_){n=!0,this._handleNewLink(_);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._currentLink)return;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,i){this._currentLink&&this._lastMouseEvent&&(!r||!i||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(r.link,i)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>{var n,d;return(d=(n=this._currentLink)==null?void 0:n.state)==null?void 0:d.decorations.pointerCursor},set:n=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,d;return(d=(n=this._currentLink)==null?void 0:n.state)==null?void 0:d.decorations.underline},set:n=>{var d,C,g;(d=this._currentLink)!=null&&d.state&&((g=(C=this._currentLink)==null?void 0:C.state)==null?void 0:g.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;const d=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(d,C),this._lastMouseEvent)){const g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._askForLink(g,!1)}})))}_linkHover(r,i,n){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(r,i){const n=r.range,d=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-d-1,n.end.x,n.end.y-d-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(r,i,n){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(r,i){const n=r.range.start.y*this._bufferService.cols+r.range.start.x,d=r.range.end.y*this._bufferService.cols+r.range.end.x,C=i.y*this._bufferService.cols+i.x;return n<=C&&C<=d}_positionFromMouseEvent(r,i,n){const d=n.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,n,d,C){return{x1:r,y1:i,x2:n,y2:d,cols:this._bufferService.cols,fg:C}}};t.Linkifier=e=h([c(1,o.IMouseService),c(2,o.IRenderService),c(3,v.IBufferService),c(4,o.ILinkProviderService)],e)},9042:(A,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(A,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,d=arguments.length,C=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,e,r,i);else for(var g=o.length-1;g>=0;g--)(n=o[g])&&(C=(d<3?n(C):d>3?n(e,r,C):n(e,r))||C);return d>3&&C&&Object.defineProperty(e,r,C),C},c=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const s=a(511),l=a(2585);let f=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){var S;const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],n=this._optionsService.rawOptions.linkHandler,d=new s.CellData,C=r.getTrimmedLength();let g=-1,b=-1,_=!1;for(let w=0;w<C;w++)if(b!==-1||r.hasContent(w)){if(r.loadCell(w,d),d.hasExtendedAttrs()&&d.extended.urlId){if(b===-1){b=w,g=d.extended.urlId;continue}_=d.extended.urlId!==g}else b!==-1&&(_=!0);if(_||b!==-1&&w===C-1){const R=(S=this._oscLinkService.getLinkData(g))==null?void 0:S.uri;if(R){const L={start:{x:b+1,y:o},end:{x:w+(_||w!==C-1?0:1),y:o}};let x=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{const T=new URL(R);["http:","https:"].includes(T.protocol)||(x=!0)}catch{x=!0}x||i.push({text:R,range:L,activate:(T,F)=>n?n.activate(T,F,L):v(0,F),hover:(T,F)=>{var $;return($=n==null?void 0:n.hover)==null?void 0:$.call(n,T,F,L)},leave:(T,F)=>{var $;return($=n==null?void 0:n.leave)==null?void 0:$.call(n,T,F,L)}})}_=!1,d.hasExtendedAttrs()&&d.extended.urlId?(b=w,g=d.extended.urlId):(b=-1,g=-1)}}e(i)}};function v(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
18
|
-
|
|
19
|
-
WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=f=h([c(0,l.IBufferService),c(1,l.IOptionsService),c(2,l.IOscLinkService)],f)},6193:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,h,c){this._rowCount=c,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),c=a(3656),s=a(3551),l=a(9042),f=a(3730),v=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),n=a(428),d=a(4269),C=a(5114),g=a(8934),b=a(3230),_=a(9312),S=a(4725),w=a(6731),R=a(8055),L=a(8969),x=a(8460),T=a(844),F=a(6114),$=a(8437),N=a(2584),H=a(7399),E=a(5941),M=a(9074),B=a(2585),P=a(5435),U=a(4567),q=a(779);class Y extends L.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(I={}){super(I),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new T.MutableDisposable),this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new x.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new x.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new x.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new x.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new x.EventEmitter),this._onBlur=this.register(new x.EventEmitter),this._onA11yCharEmitter=this.register(new x.EventEmitter),this._onA11yTabEmitter=this.register(new x.EventEmitter),this._onWillOpen=this.register(new x.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(S.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((D,j)=>this.refresh(D,j))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(D=>this._reportWindowsOptions(D))),this.register(this._inputHandler.onColor(D=>this._handleColorEvent(D))),this.register((0,x.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,x.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(D=>this._afterResize(D.cols,D.rows))),this.register((0,T.toDisposable)(()=>{var D,j;this._customKeyEventHandler=void 0,(j=(D=this.element)==null?void 0:D.parentNode)==null||j.removeChild(this.element)}))}_handleColorEvent(I){if(this._themeService)for(const D of I){let j,W="";switch(D.index){case 256:j="foreground",W="10";break;case 257:j="background",W="11";break;case 258:j="cursor",W="12";break;default:j="ansi",W="4;"+D.index}switch(D.type){case 0:const V=R.color.toColorRGB(j==="ansi"?this._themeService.colors.ansi[D.index]:this._themeService.colors[j]);this.coreService.triggerDataEvent(`${N.C0.ESC}]${W};${(0,E.toRgbString)(V)}${N.C1_ESCAPED.ST}`);break;case 1:if(j==="ansi")this._themeService.modifyColors(K=>K.ansi[D.index]=R.channels.toColor(...D.color));else{const K=j;this._themeService.modifyColors(ee=>ee[K]=R.channels.toColor(...D.color))}break;case 2:this._themeService.restoreColor(D.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(N.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var I;return(I=this.textarea)==null?void 0:I.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(N.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 I=this.buffer.ybase+this.buffer.y,D=this.buffer.lines.get(I);if(!D)return;const j=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,V=D.getWidth(j),K=this._renderService.dimensions.css.cell.width*V,ee=this.buffer.y*this._renderService.dimensions.css.cell.height,J=j*this._renderService.dimensions.css.cell.width;this.textarea.style.left=J+"px",this.textarea.style.top=ee+"px",this.textarea.style.width=K+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,c.addDisposableDomListener)(this.element,"copy",D=>{this.hasSelection()&&(0,h.copyHandler)(D,this._selectionService)}));const I=D=>(0,h.handlePasteEvent)(D,this.textarea,this.coreService,this.optionsService);this.register((0,c.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,c.addDisposableDomListener)(this.element,"paste",I)),F.isFirefox?this.register((0,c.addDisposableDomListener)(this.element,"mousedown",D=>{D.button===2&&(0,h.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,c.addDisposableDomListener)(this.element,"contextmenu",D=>{(0,h.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),F.isLinux&&this.register((0,c.addDisposableDomListener)(this.element,"auxclick",D=>{D.button===1&&(0,h.moveTextAreaUnderMouseCursor)(D,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,c.addDisposableDomListener)(this.textarea,"keyup",I=>this._keyUp(I),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keydown",I=>this._keyDown(I),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keypress",I=>this._keyPress(I),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionupdate",I=>this._compositionHelper.compositionupdate(I))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,c.addDisposableDomListener)(this.textarea,"input",I=>this._inputEvent(I),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(I){var j;if(!I)throw new Error("Terminal requires a parent element.");if(I.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((j=this.element)==null?void 0:j.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=I.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"),I.appendChild(this.element);const D=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),D.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,c.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),D.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",l.promptLabel),F.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(C.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,c.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,c.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(w.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(b.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(D);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(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(_.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,c.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const I=this,D=this.element;function j(K){const ee=I._mouseService.getMouseReportCoords(K,I.screenElement);if(!ee)return!1;let J,he;switch(K.overrideType||K.type){case"mousemove":he=32,K.buttons===void 0?(J=3,K.button!==void 0&&(J=K.button<3?K.button:3)):J=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":he=0,J=K.button<3?K.button:3;break;case"mousedown":he=1,J=K.button<3?K.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(K)===!1||I.viewport.getLinesScrolled(K)===0)return!1;he=K.deltaY<0?0:1,J=4;break;default:return!1}return!(he===void 0||J===void 0||J>4)&&I.coreMouseService.triggerMouseEvent({col:ee.col,row:ee.row,x:ee.x,y:ee.y,button:J,action:he,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:K=>(j(K),K.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(K)),wheel:K=>(j(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&j(K)},mousemove:K=>{K.buttons||j(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&K?W.mousemove||(D.addEventListener("mousemove",V.mousemove),W.mousemove=V.mousemove):(D.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&K?W.wheel||(D.addEventListener("wheel",V.wheel,{passive:!1}),W.wheel=V.wheel):(D.removeEventListener("wheel",W.wheel),W.wheel=null),2&K?W.mouseup||(W.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&K?W.mousedrag||(W.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,c.addDisposableDomListener)(D,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return j(K),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(K)})),this.register((0,c.addDisposableDomListener)(D,"wheel",K=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const ee=this.viewport.getLinesScrolled(K);if(ee===0)return;const J=N.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let he="";for(let ge=0;ge<Math.abs(ee);ge++)he+=J;return this.coreService.triggerDataEvent(he,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,c.addDisposableDomListener)(D,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,c.addDisposableDomListener)(D,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(I,D){var j;(j=this._renderService)==null||j.refreshRows(I,D)}updateCursorStyle(I){var D;(D=this._selectionService)!=null&&D.shouldColumnSelect(I)?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(I,D,j=0){var W;j===1?(super.scrollLines(I,D,j),this.refresh(0,this.rows-1)):(W=this.viewport)==null||W.scrollLines(I)}paste(I){(0,h.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const D=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),D}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,D,j){this._selectionService.setSelection(I,D,j)}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 I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,D){var j;(j=this._selectionService)==null||j.selectLines(I,D)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const D=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!D&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;D||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const j=(0,H.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),j.type===3||j.type===2){const W=this.rows-1;return this.scrollLines(j.type===2?-W:W),this.cancel(I,!0)}return j.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(j.cancel&&this.cancel(I,!0),!j.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(j.key!==N.C0.ETX&&j.key!==N.C0.CR||(this.textarea.value=""),this._onKey.fire({key:j.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(j.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,D){const j=I.isMac&&!this.options.macOptionIsMeta&&D.altKey&&!D.ctrlKey&&!D.metaKey||I.isWindows&&D.altKey&&D.ctrlKey&&!D.metaKey||I.isWindows&&D.getModifierState("AltGraph");return D.type==="keypress"?j:j&&(!D.keyCode||D.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||(function(D){return D.keyCode===16||D.keyCode===17||D.keyCode===18}(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let D;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)D=I.charCode;else if(I.which===null||I.which===void 0)D=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;D=I.which}return!(!D||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(D=String.fromCharCode(D),this._onKey.fire({key:D,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(D,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const D=I.data;return this.coreService.triggerDataEvent(D,!0),this.cancel(I),!0}return!1}resize(I,D){I!==this.cols||D!==this.rows?super.resize(I,D):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,D){var j,W;(j=this._charSizeService)==null||j.measure(),(W=this.viewport)==null||W.syncScrollArea(!0)}clear(){var I;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 D=1;D<this.rows;D++)this.buffer.lines.push(this.buffer.getBlankLine($.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(I=this.viewport)==null||I.reset(),this.refresh(0,this.rows-1)}}reset(){var D,j;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)==null||D.reset(),this._decorationService.reset(),(j=this.viewport)==null||j.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){var I;(I=this._renderService)==null||I.clearTextureAtlas()}_reportFocus(){var I;(I=this.element)!=null&&I.classList.contains("focus")?this.coreService.triggerDataEvent(N.C0.ESC+"[I"):this.coreService.triggerDataEvent(N.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const D=this._renderService.dimensions.css.canvas.width.toFixed(0),j=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${N.C0.ESC}[4;${j};${D}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${N.C0.ESC}[6;${V};${W}t`)}}cancel(I,D){if(this.options.cancelEvents||D)return I.preventDefault(),I.stopPropagation(),!1}}t.Terminal=Y},9924:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,c){this._rowCount=c,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const l=s-this._lastRefreshMs,f=this._debounceThresholdMS-l;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(A,t,a){var h=this&&this.__decorate||function(r,i,n,d){var C,g=arguments.length,b=g<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(r,i,n,d);else for(var _=r.length-1;_>=0;_--)(C=r[_])&&(b=(g<3?C(b):g>3?C(i,n,b):C(i,n))||b);return g>3&&b&&Object.defineProperty(i,n,b),b},c=this&&this.__param||function(r,i){return function(n,d){i(n,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=a(3656),l=a(4725),f=a(8460),v=a(844),o=a(2585);let e=t.Viewport=class extends v.Disposable{constructor(r,i,n,d,C,g,b,_){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=n,this._optionsService=d,this._charSizeService=C,this._renderService=g,this._coreBrowserService=b,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(S=>this._activeBuffer=S.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(S=>this._renderDimensions=S)),this._handleThemeChange(_.colors),this.register(_.onChangeColors(S=>this._handleThemeChange(S))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(r){this._viewportElement.style.backgroundColor=r.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(r){if(r)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(r,i){const n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&n<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);return i!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){var _;let n,d="";const C=[],g=i??this._bufferService.buffer.lines.length,b=this._bufferService.buffer.lines;for(let S=r;S<g;S++){const w=b.get(S);if(!w)continue;const R=(_=b.get(S+1))==null?void 0:_.isWrapped;if(d+=w.translateToString(!R),!R||S===b.length-1){const L=document.createElement("div");L.textContent=d,C.push(L),d.length>0&&(n=L),d=""}}return{bufferElements:C,cursorElement:n}}getLinesScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const n=this._optionsService.rawOptions.fastScrollModifier;return n==="alt"&&i.altKey||n==="ctrl"&&i.ctrlKey||n==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}};t.Viewport=e=h([c(2,o.IBufferService),c(3,o.IOptionsService),c(4,l.ICharSizeService),c(5,l.IRenderService),c(6,l.ICoreBrowserService),c(7,l.IThemeService)],e)},3107:function(A,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,d=arguments.length,C=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,e,r,i);else for(var g=o.length-1;g>=0;g--)(n=o[g])&&(C=(d<3?n(C):d>3?n(e,r,C):n(e,r))||C);return d>3&&C&&Object.defineProperty(e,r,C),C},c=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const s=a(4725),l=a(844),f=a(2585);let v=t.BufferDecorationRenderer=class extends l.Disposable{constructor(o,e,r,i,n){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(d=>this._removeDecoration(d))),this.register((0,l.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=o==null?void 0:o.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const r=o.options.x??0;return r&&r>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose(()=>{this._decorationElements.delete(o),r.remove()})),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=v=h([c(1,f.IBufferService),c(2,s.ICoreBrowserService),c(3,f.IDecorationService),c(4,s.IRenderService)],v)},5871:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,c){return h>=a.startBufferLine-this._linePadding[c||"full"]&&h<=a.endBufferLine+this._linePadding[c||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(A,t,a){var h=this&&this.__decorate||function(n,d,C,g){var b,_=arguments.length,S=_<3?d:g===null?g=Object.getOwnPropertyDescriptor(d,C):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,d,C,g);else for(var w=n.length-1;w>=0;w--)(b=n[w])&&(S=(_<3?b(S):_>3?b(d,C,S):b(d,C))||S);return _>3&&S&&Object.defineProperty(d,C,S),S},c=this&&this.__param||function(n,d){return function(C,g){d(C,g,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const s=a(5871),l=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},r={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(n,d,C,g,b,_,S){var R;super(),this._viewportElement=n,this._screenElement=d,this._bufferService=C,this._decorationService=g,this._renderService=b,this._optionsService=_,this._coreBrowserService=S,this._colorZoneStore=new s.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(R=this._viewportElement.parentElement)==null||R.insertBefore(this._canvas,this._viewportElement);const w=this._canvas.getContext("2d");if(!w)throw new Error("Ctx cannot be null");this._ctx=w,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,f.toDisposable)(()=>{var L;(L=this._canvas)==null||L.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const n=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=n,e.center=d,e.right=n,this._refreshDrawHeightConstants(),r.full=0,r.left=0,r.center=e.left,r.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const n=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(n,12),6)*this._coreBrowserService.dpr);o.left=d,o.center=d,o.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const n=this._colorZoneStore.zones;for(const d of n)d.position!=="full"&&this._renderColorZone(d);for(const d of n)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(n){this._ctx.fillStyle=n.color,this._ctx.fillRect(r[n.position||"full"],Math.round((this._canvas.height-1)*(n.startBufferLine/this._bufferService.buffers.active.lines.length)-o[n.position||"full"]/2),e[n.position||"full"],Math.round((this._canvas.height-1)*((n.endBufferLine-n.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[n.position||"full"]))}_queueRefresh(n,d){this._shouldUpdateDimensions=n||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=i=h([c(2,v.IBufferService),c(3,v.IDecorationService),c(4,l.IRenderService),c(5,v.IOptionsService),c(6,l.ICoreBrowserService)],i)},2950:function(A,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,d=arguments.length,C=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,e,r,i);else for(var g=o.length-1;g>=0;g--)(n=o[g])&&(C=(d<3?n(C):d>3?n(e,r,C):n(e,r))||C);return d>3&&C&&Object.defineProperty(e,r,C),C},c=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const s=a(4725),l=a(2585),f=a(2584);let v=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,n,d){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=n,this._renderService=d,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${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),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=v=h([c(2,l.IBufferService),c(3,l.IOptionsService),c(4,l.ICoreService),c(5,s.IRenderService)],v)},9806:(A,t)=>{function a(h,c,s){const l=s.getBoundingClientRect(),f=h.getComputedStyle(s),v=parseInt(f.getPropertyValue("padding-left")),o=parseInt(f.getPropertyValue("padding-top"));return[c.clientX-l.left-v,c.clientY-l.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,c,s,l,f,v,o,e,r){if(!v)return;const i=a(h,c,s);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),l+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),f),i):void 0}},9504:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function c(e,r,i,n){const d=e-s(e,i),C=r-s(r,i),g=Math.abs(d-C)-function(b,_,S){let w=0;const R=b-s(b,S),L=_-s(_,S);for(let x=0;x<Math.abs(R-L);x++){const T=l(b,_)==="A"?-1:1,F=S.buffer.lines.get(R+T*x);F!=null&&F.isWrapped&&w++}return w}(e,r,i);return o(g,v(l(e,r),n))}function s(e,r){let i=0,n=r.buffer.lines.get(e),d=n==null?void 0:n.isWrapped;for(;d&&e>=0&&e<r.rows;)i++,n=r.buffer.lines.get(--e),d=n==null?void 0:n.isWrapped;return i}function l(e,r){return e>r?"A":"B"}function f(e,r,i,n,d,C){let g=e,b=r,_="";for(;g!==i||b!==n;)g+=d?1:-1,d&&g>C.cols-1?(_+=C.buffer.translateBufferLineToString(b,!1,e,g),g=0,e=0,b++):!d&&g<0&&(_+=C.buffer.translateBufferLineToString(b,!1,0,e+1),g=C.cols-1,e=g,b--);return _+C.buffer.translateBufferLineToString(b,!1,e,g)}function v(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=r;return i}t.moveToCellSequence=function(e,r,i,n){const d=i.buffer.x,C=i.buffer.y;if(!i.buffer.hasScrollback)return function(_,S,w,R,L,x){return c(S,R,L,x).length===0?"":o(f(_,S,_,S-s(S,L),!1,L).length,v("D",x))}(d,C,0,r,i,n)+c(C,r,i,n)+function(_,S,w,R,L,x){let T;T=c(S,R,L,x).length>0?R-s(R,L):S;const F=R,$=function(N,H,E,M,B,P){let U;return U=c(E,M,B,P).length>0?M-s(M,B):H,N<E&&U<=M||N>=E&&U<M?"C":"D"}(_,S,w,R,L,x);return o(f(_,T,w,F,$==="C",L).length,v($,x))}(d,C,e,r,i,n);let g;if(C===r)return g=d>e?"D":"C",o(Math.abs(d-e),v(g,n));g=C>r?"D":"C";const b=Math.abs(C-r);return o(function(_,S){return S.cols-_}(C>r?e:d,i)+(b-1)*i.cols+1+((C>r?d:e)-1),v(g,n))}},1296:function(A,t,a){var h=this&&this.__decorate||function(x,T,F,$){var N,H=arguments.length,E=H<3?T:$===null?$=Object.getOwnPropertyDescriptor(T,F):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(x,T,F,$);else for(var M=x.length-1;M>=0;M--)(N=x[M])&&(E=(H<3?N(E):H>3?N(T,F,E):N(T,F))||E);return H>3&&E&&Object.defineProperty(T,F,E),E},c=this&&this.__param||function(x,T){return function(F,$){T(F,$,x)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=a(3787),l=a(2550),f=a(2223),v=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),n=a(844),d=a(2585),C="xterm-dom-renderer-owner-",g="xterm-rows",b="xterm-fg-",_="xterm-bg-",S="xterm-focus",w="xterm-selection";let R=1,L=t.DomRenderer=class extends n.Disposable{constructor(x,T,F,$,N,H,E,M,B,P,U,q,Y){super(),this._terminal=x,this._document=T,this._element=F,this._screenElement=$,this._viewportElement=N,this._helperContainer=H,this._linkifier2=E,this._charSizeService=B,this._optionsService=P,this._bufferService=U,this._coreBrowserService=q,this._themeService=Y,this._terminalClass=R++,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(g),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(w),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,v.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(G=>this._injectCss(G))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(G=>this._handleLinkHover(G))),this.register(this._linkifier2.onHideLinkUnderline(G=>this._handleLinkLeave(G))),this.register((0,n.toDisposable)(()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new l.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 x=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*x,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*x),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/x),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/x),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 F of this._rowElements)F.style.width=`${this.dimensions.css.canvas.width}px`,F.style.height=`${this.dimensions.css.cell.height}px`,F.style.lineHeight=`${this.dimensions.css.cell.height}px`,F.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const T=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=T,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(x){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let T=`${this._terminalSelector} .${g} { color: ${x.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;T+=`${this._terminalSelector} .${g} .xterm-dim { color: ${r.color.multiplyOpacity(x.foreground,.5).css};}`,T+=`${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 F=`blink_underline_${this._terminalClass}`,$=`blink_bar_${this._terminalClass}`,N=`blink_block_${this._terminalClass}`;T+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,T+=`@keyframes ${$} { 50% { box-shadow: none; }}`,T+=`@keyframes ${N} { 0% { background-color: ${x.cursor.css}; color: ${x.cursorAccent.css}; } 50% { background-color: inherit; color: ${x.cursor.css}; }}`,T+=`${this._terminalSelector} .${g}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${g}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${g}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${x.cursor.css}; color: ${x.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${x.cursor.css} !important; color: ${x.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${x.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${x.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${x.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,T+=`${this._terminalSelector} .${w} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${w} div { position: absolute; background-color: ${x.selectionBackgroundOpaque.css};}${this._terminalSelector} .${w} div { position: absolute; background-color: ${x.selectionInactiveBackgroundOpaque.css};}`;for(const[H,E]of x.ansi.entries())T+=`${this._terminalSelector} .${b}${H} { color: ${E.css}; }${this._terminalSelector} .${b}${H}.xterm-dim { color: ${r.color.multiplyOpacity(E,.5).css}; }${this._terminalSelector} .${_}${H} { background-color: ${E.css}; }`;T+=`${this._terminalSelector} .${b}${f.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(x.background).css}; }${this._terminalSelector} .${b}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(x.background),.5).css}; }${this._terminalSelector} .${_}${f.INVERTED_DEFAULT_COLOR} { background-color: ${x.foreground.css}; }`,this._themeStyleElement.textContent=T}_setDefaultSpacing(){const x=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${x}px`,this._rowFactory.defaultSpacing=x}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(x,T){for(let F=this._rowElements.length;F<=T;F++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>T;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(x,T){this._refreshRowElements(x,T),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(S),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(S),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(x,T,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(x,T,F),this.renderRows(0,this._bufferService.rows-1),!x||!T)return;this._selectionRenderModel.update(this._terminal,x,T,F);const $=this._selectionRenderModel.viewportStartRow,N=this._selectionRenderModel.viewportEndRow,H=this._selectionRenderModel.viewportCappedStartRow,E=this._selectionRenderModel.viewportCappedEndRow;if(H>=this._bufferService.rows||E<0)return;const M=this._document.createDocumentFragment();if(F){const B=x[0]>T[0];M.appendChild(this._createSelectionElement(H,B?T[0]:x[0],B?x[0]:T[0],E-H+1))}else{const B=$===H?x[0]:0,P=H===N?T[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(H,B,P));const U=E-H-1;if(M.appendChild(this._createSelectionElement(H+1,0,this._bufferService.cols,U)),H!==E){const q=N===E?T[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(E,0,q))}}this._selectionContainer.appendChild(M)}_createSelectionElement(x,T,F,$=1){const N=this._document.createElement("div"),H=T*this.dimensions.css.cell.width;let E=this.dimensions.css.cell.width*(F-T);return H+E>this.dimensions.css.canvas.width&&(E=this.dimensions.css.canvas.width-H),N.style.height=$*this.dimensions.css.cell.height+"px",N.style.top=x*this.dimensions.css.cell.height+"px",N.style.left=`${H}px`,N.style.width=`${E}px`,N}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 x of this._rowElements)x.replaceChildren()}renderRows(x,T){const F=this._bufferService.buffer,$=F.ybase+F.y,N=Math.min(F.x,this._bufferService.cols-1),H=this._optionsService.rawOptions.cursorBlink,E=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=x;B<=T;B++){const P=B+F.ydisp,U=this._rowElements[B],q=F.lines.get(P);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,P,P===$,E,M,N,H,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(x){this._setCellUnderline(x.x1,x.x2,x.y1,x.y2,x.cols,!0)}_handleLinkLeave(x){this._setCellUnderline(x.x1,x.x2,x.y1,x.y2,x.cols,!1)}_setCellUnderline(x,T,F,$,N,H){F<0&&(x=0),$<0&&(T=0);const E=this._bufferService.rows-1;F=Math.max(Math.min(F,E),0),$=Math.max(Math.min($,E),0),N=Math.min(N,this._bufferService.cols);const M=this._bufferService.buffer,B=M.ybase+M.y,P=Math.min(M.x,N-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let G=F;G<=$;++G){const I=G+M.ydisp,D=this._rowElements[G],j=M.lines.get(I);if(!D||!j)break;D.replaceChildren(...this._rowFactory.createRow(j,I,I===B,q,Y,P,U,this.dimensions.css.cell.width,this._widthCache,H?G===F?x:0:-1,H?(G===$?T:N)-1:-1))}}};t.DomRenderer=L=h([c(7,d.IInstantiationService),c(8,e.ICharSizeService),c(9,d.IOptionsService),c(10,d.IBufferService),c(11,e.ICoreBrowserService),c(12,e.IThemeService)],L)},3787:function(A,t,a){var h=this&&this.__decorate||function(g,b,_,S){var w,R=arguments.length,L=R<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(g,b,_,S);else for(var x=g.length-1;x>=0;x--)(w=g[x])&&(L=(R<3?w(L):R>3?w(b,_,L):w(b,_))||L);return R>3&&L&&Object.defineProperty(b,_,L),L},c=this&&this.__param||function(g,b){return function(_,S){b(_,S,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=a(2223),l=a(643),f=a(511),v=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),n=a(3734);let d=t.DomRendererRowFactory=class{constructor(g,b,_,S,w,R,L){this._document=g,this._characterJoinerService=b,this._optionsService=_,this._coreBrowserService=S,this._coreService=w,this._decorationService=R,this._themeService=L,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(g,b,_){this._selectionStart=g,this._selectionEnd=b,this._columnSelectMode=_}createRow(g,b,_,S,w,R,L,x,T,F,$){const N=[],H=this._characterJoinerService.getJoinedCharacters(b),E=this._themeService.colors;let M,B=g.getNoBgTrimmedLength();_&&B<R+1&&(B=R+1);let P=0,U="",q=0,Y=0,G=0,I=!1,D=0,j=!1,W=0;const V=[],K=F!==-1&&$!==-1;for(let ee=0;ee<B;ee++){g.loadCell(ee,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let he=!1,ge=ee,Z=this._workCell;if(H.length>0&&ee===H[0][0]){he=!0;const ie=H.shift();Z=new r.JoinedCellData(this._workCell,g.translateToString(!0,ie[0],ie[1]),ie[1]-ie[0]),ge=ie[1]-1,J=Z.getWidth()}const Re=this._isCellInSelection(ee,b),Ze=_&&ee===R,ae=K&&ee>=F&&ee<=$;let se=!1;this._decorationService.forEachDecorationAtCell(ee,b,void 0,ie=>{se=!0});let re=Z.getChars()||l.WHITESPACE_CELL_CHAR;if(re===" "&&(Z.isUnderline()||Z.isOverline())&&(re=" "),W=J*x-T.get(re,Z.isBold(),Z.isItalic()),M){if(P&&(Re&&j||!Re&&!j&&Z.bg===q)&&(Re&&j&&E.selectionForeground||Z.fg===Y)&&Z.extended.ext===G&&ae===I&&W===D&&!Ze&&!he&&!se){Z.isInvisible()?U+=l.WHITESPACE_CELL_CHAR:U+=re,P++;continue}P&&(M.textContent=U),M=this._document.createElement("span"),P=0,U=""}else M=this._document.createElement("span");if(q=Z.bg,Y=Z.fg,G=Z.extended.ext,I=ae,D=W,j=Re,he&&R>=ee&&R<=ge&&(R=ee),!this._coreService.isCursorHidden&&Ze&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&V.push("xterm-cursor-blink"),V.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(w)switch(w){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(Z.isBold()&&V.push("xterm-bold"),Z.isItalic()&&V.push("xterm-italic"),Z.isDim()&&V.push("xterm-dim"),U=Z.isInvisible()?l.WHITESPACE_CELL_CHAR:Z.getChars()||l.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(V.push(`xterm-underline-${Z.extended.underlineStyle}`),U===" "&&(U=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${n.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ie=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ie<8&&(ie+=8),M.style.textDecorationColor=E.ansi[ie].css}Z.isOverline()&&(V.push("xterm-overline"),U===" "&&(U=" ")),Z.isStrikethrough()&&V.push("xterm-strikethrough"),ae&&(M.style.textDecoration="underline");let X=Z.getFgColor(),oe=Z.getFgColorMode(),fe=Z.getBgColor(),de=Z.getBgColorMode();const Me=!!Z.isInverse();if(Me){const ie=X;X=fe,fe=ie;const nt=oe;oe=de,de=nt}let be,xe,ve,le=!1;switch(this._decorationService.forEachDecorationAtCell(ee,b,void 0,ie=>{ie.options.layer!=="top"&&le||(ie.backgroundColorRGB&&(de=50331648,fe=ie.backgroundColorRGB.rgba>>8&16777215,be=ie.backgroundColorRGB),ie.foregroundColorRGB&&(oe=50331648,X=ie.foregroundColorRGB.rgba>>8&16777215,xe=ie.foregroundColorRGB),le=ie.options.layer==="top")}),!le&&Re&&(be=this._coreBrowserService.isFocused?E.selectionBackgroundOpaque:E.selectionInactiveBackgroundOpaque,fe=be.rgba>>8&16777215,de=50331648,le=!0,E.selectionForeground&&(oe=50331648,X=E.selectionForeground.rgba>>8&16777215,xe=E.selectionForeground)),le&&V.push("xterm-decoration-top"),de){case 16777216:case 33554432:ve=E.ansi[fe],V.push(`xterm-bg-${fe}`);break;case 50331648:ve=o.channels.toColor(fe>>16,fe>>8&255,255&fe),this._addStyle(M,`background-color:#${C((fe>>>0).toString(16),"0",6)}`);break;default:Me?(ve=E.foreground,V.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):ve=E.background}switch(be||Z.isDim()&&(be=o.color.multiplyOpacity(ve,.5)),oe){case 16777216:case 33554432:Z.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(M,ve,E.ansi[X],Z,be,void 0)||V.push(`xterm-fg-${X}`);break;case 50331648:const ie=o.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(M,ve,ie,Z,be,xe)||this._addStyle(M,`color:#${C(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,ve,E.foreground,Z,be,xe)||Me&&V.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}V.length&&(M.className=V.join(" "),V.length=0),Ze||he||se?M.textContent=U:P++,W!==this.defaultSpacing&&(M.style.letterSpacing=`${W}px`),N.push(M),ee=ge}return M&&P&&(M.textContent=U),N}_applyMinimumContrast(g,b,_,S,w,R){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(S.getCode()))return!1;const L=this._getContrastCache(S);let x;if(w||R||(x=L.getColor(b.rgba,_.rgba)),x===void 0){const T=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);x=o.color.ensureContrastRatio(w||b,R||_,T),L.setColor((w||b).rgba,(R||_).rgba,x??null)}return!!x&&(this._addStyle(g,`color:${x.css}`),!0)}_getContrastCache(g){return g.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(g,b){g.setAttribute("style",`${g.getAttribute("style")||""}${b};`)}_isCellInSelection(g,b){const _=this._selectionStart,S=this._selectionEnd;return!(!_||!S)&&(this._columnSelectMode?_[0]<=S[0]?g>=_[0]&&b>=_[1]&&g<S[0]&&b<=S[1]:g<_[0]&&b>=_[1]&&g>=S[0]&&b<=S[1]:b>_[1]&&b<S[1]||_[1]===S[1]&&b===_[1]&&g>=_[0]&&g<S[0]||_[1]<S[1]&&b===S[1]&&g<S[0]||_[1]<S[1]&&b===_[1]&&g>=_[0])}};function C(g,b,_){for(;g.length<_;)g=b+g;return g}t.DomRendererRowFactory=d=h([c(1,e.ICharacterJoinerService),c(2,v.IOptionsService),c(3,e.ICoreBrowserService),c(4,v.ICoreService),c(5,v.IDecorationService),c(6,e.IThemeService)],d)},2550:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const c=a.createElement("span");c.classList.add("xterm-char-measure-element");const s=a.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const l=a.createElement("span");l.classList.add("xterm-char-measure-element"),l.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=[c,s,l,f],this._container.appendChild(c),this._container.appendChild(s),this._container.appendChild(l),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,c,s){a===this._font&&h===this._fontSize&&c===this._weight&&s===this._weightBold||(this._font=a,this._fontSize=h,this._weight=c,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${c}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${c}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(a,h,c){let s=0;if(!h&&!c&&a.length===1&&(s=a.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const v=this._measure(a,0);return v>0&&(this._flat[s]=v),v}let l=a;h&&(l+="B"),c&&(l+="I");let f=this._holey.get(l);if(f===void 0){let v=0;h&&(v|=1),c&&(v|=2),f=this._measure(a,v),f>0&&this._holey.set(l,f)}return f}_measure(a,h){const c=this._measureElements[h];return c.textContent=a.repeat(32),c.offsetWidth/32}}},2223:(A,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:(A,t)=>{function a(c){return 57508<=c&&c<=57558}function h(c){return c>=128512&&c<=128591||c>=127744&&c<=128511||c>=128640&&c<=128767||c>=9728&&c<=9983||c>=9984&&c<=10175||c>=65024&&c<=65039||c>=129280&&c<=129535||c>=127462&&c<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},t.isEmoji=h,t.allowRescaling=function(c,s,l,f){return s===1&&l>Math.ceil(1.5*f)&&c!==void 0&&c>255&&!h(c)&&!a(c)&&!function(v){return 57344<=v&&v<=63743}(c)},t.treatGlyphAsBackgroundColor=function(c){return a(c)||function(s){return 9472<=s&&s<=9631}(c)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(c,s,l=0){return(c-(2*Math.round(s)-l))%(2*Math.round(s))}},6052:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(c,s,l,f=!1){if(this.selectionStart=s,this.selectionEnd=l,!s||!l||s[0]===l[0]&&s[1]===l[1])return void this.clear();const v=c.buffers.active.ydisp,o=s[1]-v,e=l[1]-v,r=Math.max(o,0),i=Math.min(e,c.rows-1);r>=c.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=l[0])}isCellSelected(c,s,l){return!!this.hasSelection&&(l-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&l>=this.viewportCappedStartRow&&s<this.endCol&&l<=this.viewportCappedEndRow:s<this.startCol&&l>=this.viewportCappedStartRow&&s>=this.endCol&&l<=this.viewportCappedEndRow:l>this.viewportStartRow&&l<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&l===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(A,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(A,t,a){var h=this&&this.__decorate||function(i,n,d,C){var g,b=arguments.length,_=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,d):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(i,n,d,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(_=(b<3?g(_):b>3?g(n,d,_):g(n,d))||_);return b>3&&_&&Object.defineProperty(n,d,_),_},c=this&&this.__param||function(i,n){return function(d,C){n(d,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const s=a(2585),l=a(8460),f=a(844);let v=t.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,n,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new l.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new r(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,n,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=v=h([c(2,s.IOptionsService)],v);class o extends f.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(n,d){n!==void 0&&n>0&&d!==void 0&&d>0&&(this._result.width=n,this._result.height=d)}}class e extends o{constructor(n,d,C){super(),this._document=n,this._parentElement=d,this._optionsService=C,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class r extends o{constructor(n){super(),this._optionsService=n,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const n=this._ctx.measureText("W");return this._validateAndSet(n.width,n.fontBoundingBoxAscent+n.fontBoundingBoxDescent),this._result}}},4269:function(A,t,a){var h=this&&this.__decorate||function(r,i,n,d){var C,g=arguments.length,b=g<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(r,i,n,d);else for(var _=r.length-1;_>=0;_--)(C=r[_])&&(b=(g<3?C(b):g>3?C(i,n,b):C(i,n))||b);return g>3&&b&&Object.defineProperty(i,n,b),b},c=this&&this.__param||function(r,i){return function(n,d){i(n,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=a(3734),l=a(643),f=a(511),v=a(2585);class o extends s.AttributeData{constructor(i,n,d){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=n,this._width=d}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class Wi{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(i){const n={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(n),n.id}deregister(i){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===i)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const n=this._bufferService.buffer.lines.get(i);if(!n||n.length===0)return[];const d=[],C=n.translateToString(!0);let g=0,b=0,_=0,S=n.getFg(0),w=n.getBg(0);for(let R=0;R<n.getTrimmedLength();R++)if(n.loadCell(R,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==w){if(R-g>1){const L=this._getJoinedRanges(C,_,b,n,g);for(let x=0;x<L.length;x++)d.push(L[x])}g=R,_=b,S=this._workCell.fg,w=this._workCell.bg}b+=this._workCell.getChars().length||l.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-g>1){const R=this._getJoinedRanges(C,_,b,n,g);for(let L=0;L<R.length;L++)d.push(R[L])}return d}_getJoinedRanges(i,n,d,C,g){const b=i.substring(n,d);let _=[];try{_=this._characterJoiners[0].handler(b)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{const w=this._characterJoiners[S].handler(b);for(let R=0;R<w.length;R++)Wi._mergeRanges(_,w[R])}catch(w){console.error(w)}return this._stringRangesToCellRanges(_,C,g),_}_stringRangesToCellRanges(i,n,d){let C=0,g=!1,b=0,_=i[C];if(_){for(let S=d;S<this._bufferService.cols;S++){const w=n.getWidth(S),R=n.getString(S).length||l.WHITESPACE_CELL_CHAR.length;if(w!==0){if(!g&&_[0]<=b&&(_[0]=S,g=!0),_[1]<=b){if(_[1]=S,_=i[++C],!_)break;_[0]<=b?(_[0]=S,g=!0):g=!1}b+=R}}_&&(_[1]=this._bufferService.cols)}}static _mergeRanges(i,n){let d=!1;for(let C=0;C<i.length;C++){const g=i[C];if(d){if(n[1]<=g[0])return i[C-1][1]=n[1],i;if(n[1]<=g[1])return i[C-1][1]=Math.max(n[1],g[1]),i.splice(C,1),i;i.splice(C,1),C--}else{if(n[1]<=g[0])return i.splice(C,0,n),i;if(n[1]<=g[1])return g[0]=Math.min(n[0],g[0]),i;n[0]<g[1]&&(g[0]=Math.min(n[0],g[0]),d=!0)}}return d?i[i.length-1][1]=n[1]:i.push(n),i}};t.CharacterJoinerService=e=h([c(0,v.IBufferService)],e)},5114:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),c=a(8460),s=a(3656);class l extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(this._window),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new c.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,c.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=l;class f extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,s.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class c extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(l){return this.linkProviders.push(l),{dispose:()=>{const f=this.linkProviders.indexOf(l);f!==-1&&this.linkProviders.splice(f,1)}}}}t.LinkProviderService=c},8934:function(A,t,a){var h=this&&this.__decorate||function(v,o,e,r){var i,n=arguments.length,d=n<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(v,o,e,r);else for(var C=v.length-1;C>=0;C--)(i=v[C])&&(d=(n<3?i(d):n>3?i(o,e,d):i(o,e))||d);return n>3&&d&&Object.defineProperty(o,e,d),d},c=this&&this.__param||function(v,o){return function(e,r){o(e,r,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=a(4725),l=a(9806);let f=t.MouseService=class{constructor(v,o){this._renderService=v,this._charSizeService=o}getCoords(v,o,e,r,i){return(0,l.getCoords)(window,v,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(v,o){const e=(0,l.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([c(0,s.IRenderService),c(1,s.ICharSizeService)],f)},3230:function(A,t,a){var h=this&&this.__decorate||function(i,n,d,C){var g,b=arguments.length,_=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,d):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(i,n,d,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(_=(b<3?g(_):b>3?g(n,d,_):g(n,d))||_);return b>3&&_&&Object.defineProperty(n,d,_),_},c=this&&this.__param||function(i,n){return function(d,C){n(d,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const s=a(6193),l=a(4725),f=a(8460),v=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends v.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,n,d,C,g,b,_,S){super(),this._rowCount=i,this._charSizeService=C,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 s.RenderDebouncer((w,R)=>this._renderRows(w,R),_),this.register(this._renderDebouncer),this.register(_.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(b.onResize(()=>this._fullRefresh())),this.register(b.buffers.onBufferActivate(()=>{var w;return(w=this._renderer.value)==null?void 0:w.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(g.onDecorationRegistered(()=>this._fullRefresh())),this.register(g.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(b.cols,b.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(b.buffer.y,b.buffer.y,!0))),this.register(S.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(_.window,n),this.register(_.onWindowChange(w=>this._registerIntersectionObserver(w,n)))}_registerIntersectionObserver(i,n){if("IntersectionObserver"in i){const d=new i.IntersectionObserver(C=>this._handleIntersectionChange(C[C.length-1]),{threshold:0});d.observe(n),this._observerDisposable.value=(0,v.toDisposable)(()=>d.disconnect())}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,n,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,n,this._rowCount))}_renderRows(i,n){this._renderer.value&&(i=Math.min(i,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(i,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:n}),this._onRender.fire({start:i,end:n}),this._isNextRenderRedrawOnly=!0)}resize(i,n){this._rowCount=n,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw(n=>this.refreshRows(n.start,n.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,n;this._renderer.value&&((n=(i=this._renderer.value).clearTextureAtlas)==null||n.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(i,n)}):this._renderer.value.handleResize(i,n),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,n,d){var C;this._selectionState.start=i,this._selectionState.end=n,this._selectionState.columnSelectMode=d,(C=this._renderer.value)==null||C.handleSelectionChanged(i,n,d)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=r=h([c(2,e.IOptionsService),c(3,l.ICharSizeService),c(4,e.IDecorationService),c(5,e.IBufferService),c(6,l.ICoreBrowserService),c(7,l.IThemeService)],r)},9312:function(A,t,a){var h=this&&this.__decorate||function(_,S,w,R){var L,x=arguments.length,T=x<3?S:R===null?R=Object.getOwnPropertyDescriptor(S,w):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,S,w,R);else for(var F=_.length-1;F>=0;F--)(L=_[F])&&(T=(x<3?L(T):x>3?L(S,w,T):L(S,w))||T);return x>3&&T&&Object.defineProperty(S,w,T),T},c=this&&this.__param||function(_,S){return function(w,R){S(w,R,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=a(9806),l=a(9504),f=a(456),v=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),n=a(511),d=a(2585),C=" ",g=new RegExp(C,"g");let b=t.SelectionService=class extends e.Disposable{constructor(_,S,w,R,L,x,T,F,$){super(),this._element=_,this._screenElement=S,this._linkifier=w,this._bufferService=R,this._coreService=L,this._mouseService=x,this._optionsService=T,this._renderService=F,this._coreBrowserService=$,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new n.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=N=>this._handleMouseMove(N),this._mouseUpListener=N=>this._handleMouseUp(N),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(N=>this._handleTrim(N)),this.register(this._bufferService.buffers.onBufferActivate(N=>this._handleBufferActivate(N))),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 _=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!_||!S||_[0]===S[0]&&_[1]===S[1])}get selectionText(){const _=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!_||!S)return"";const w=this._bufferService.buffer,R=[];if(this._activeSelectionMode===3){if(_[0]===S[0])return"";const L=_[0]<S[0]?_[0]:S[0],x=_[0]<S[0]?S[0]:_[0];for(let T=_[1];T<=S[1];T++){const F=w.translateBufferLineToString(T,!0,L,x);R.push(F)}}else{const L=_[1]===S[1]?S[0]:void 0;R.push(w.translateBufferLineToString(_[1],!0,_[0],L));for(let x=_[1]+1;x<=S[1]-1;x++){const T=w.lines.get(x),F=w.translateBufferLineToString(x,!0);T!=null&&T.isWrapped?R[R.length-1]+=F:R.push(F)}if(_[1]!==S[1]){const x=w.lines.get(S[1]),T=w.translateBufferLineToString(S[1],!0,0,S[0]);x&&x.isWrapped?R[R.length-1]+=T:R.push(T)}}return R.map(L=>L.replace(g," ")).join(r.isWindows?`\r
|
|
11
|
+
`),m=[];let y=0;for(;y<_.length;){const x=_[y];if(!x.trim()){y++;continue}const B=Vi.exec(x);if(B){const l=B[1],s=[];for(y++;y<_.length&&!_[y].trim().startsWith(l);)s.push(_[y++]);y++,m.push({t:"code",lang:B[2]??"",text:s.join(`
|
|
12
|
+
`)});continue}const A=Gi.exec(x);if(A){m.push({t:"heading",level:A[1].length,children:Oe(A[2])}),y++;continue}if(Xi.test(x)){m.push({t:"hr"}),y++;continue}if(Yt(x)&&y+1<_.length&&Yi.test(_[y+1])){const l=Ei(x).map(Oe),s=[];for(y+=2;y<_.length&&Yt(_[y])&&_[y].trim();)s.push(Ei(_[y]).map(Oe)),y++;m.push({t:"table",head:l,rows:s});continue}if(Dt.test(x)){const l=[];for(;y<_.length&&Dt.test(_[y]);)l.push(Dt.exec(_[y++])[1]);m.push({t:"quote",children:Oe(l.join(`
|
|
13
|
+
`))});continue}const t=Gt.exec(x),a=Xt.exec(x);if(t||a){const l=!t,s=[],c=a?Number(a[2]):1;for(;y<_.length;){const p=_[y],v=Gt.exec(p),o=v?null:Xt.exec(p),e=v??o;if(e){const r=e[1].replace(/\t/g," ").length,i=v?v[2]:o[3];s.push({depth:Math.min(3,Math.floor(r/2)),children:Oe(i)}),y++;continue}if(p.trim()&&/^\s{2,}/.test(p)&&s.length){s[s.length-1].children.push({t:"text",text:" "},...Oe(p.trim())),y++;continue}break}m.push({t:"list",ordered:l,start:c,items:s});continue}const h=[x];for(y++;y<_.length&&_[y].trim()&&!rr(_[y],_[y+1]);)h.push(_[y++]);m.push({t:"para",children:Oe(h.join(`
|
|
14
|
+
`))})}return m}const or=/^https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"*_~]/;function Oe(d){const _=[];let m="";const y=()=>{m&&(_.push({t:"text",text:m}),m="")};let x=0;for(;x<d.length;){const B=d[x],A=d.slice(x);if(B==="\\"&&x+1<d.length&&/[\\`*_~[\]()#|>-]/.test(d[x+1])){m+=d[x+1],x+=2;continue}if(B==="`"){const a=/^`+/.exec(A)[0],h=d.indexOf(a,x+a.length);if(h>0){y(),_.push({t:"code",text:d.slice(x+a.length,h).replace(/^ (.*) $/,"$1")}),x=h+a.length;continue}m+=a,x+=a.length;continue}if(B==="["){const a=/^\[([^\]]+)\]\(\s*([^)\s]+)(?:\s+"[^"]*")?\s*\)/.exec(A);if(a){y(),_.push({t:"link",href:a[2],children:Oe(a[1])}),x+=a[0].length;continue}}if(B==="h"&&(x===0||!/\w/.test(d[x-1]))){const a=or.exec(A);if(a){y(),_.push({t:"link",href:a[0],children:[{t:"text",text:a[0]}]}),x+=a[0].length;continue}}const t=ar(d,x);if(t){y(),_.push({t:t.t,children:Oe(t.inner)}),x=t.end;continue}m+=B,x++}return y(),_}function ar(d,_){for(const[m,y]of[["**","strong"],["__","strong"],["~~","del"],["*","em"],["_","em"]]){if(!d.startsWith(m,_))continue;const x=_+m.length;if(x>=d.length||/\s/.test(d[x])||m[0]==="_"&&_>0&&/\w/.test(d[_-1]))return null;let B=x;for(;;){let A=d.indexOf(m,B+1);if(A<0)return null;if(m.length===2)for(;d[A+2]===m[0];)A++;const t=d[A+m.length],a=m.length===1&&(d[A+1]===m||d[A-1]===m),h=m[0]!=="_"||t===void 0||!/\w/.test(t);if(!/\s/.test(d[A-1])&&!a&&h)return{t:y,inner:d.slice(x,A),end:A+m.length};B=A}}return null}function hr(d){try{const _=new URL(d);return _.protocol==="http:"||_.protocol==="https:"?_.href:null}catch{return null}}function Fe(d,_){for(const m of _){if(m.t==="text"){lr(d,m.text);continue}if(m.t==="code"){const B=document.createElement("code");B.textContent=m.text,d.append(B);continue}if(m.t==="link"){const B=hr(m.href);if(!B){Fe(d,m.children);continue}const A=document.createElement("a");A.href=B,A.target="_blank",A.rel="noopener noreferrer",Fe(A,m.children),d.append(A);continue}const y=m.t==="strong"?"strong":m.t==="em"?"em":"del",x=document.createElement(y);Fe(x,m.children),d.append(x)}}function lr(d,_){_.split(`
|
|
15
|
+
`).forEach((y,x)=>{x>0&&d.append(document.createElement("br")),y&&d.append(document.createTextNode(y))})}function Nt(d,_="md"){const m=document.createElement("div");m.className=_;for(const y of nr(d))switch(y.t){case"heading":{const x=document.createElement(`h${Math.min(6,y.level+2)}`);Fe(x,y.children),m.append(x);break}case"para":{const x=document.createElement("p");Fe(x,y.children),m.append(x);break}case"quote":{const x=document.createElement("blockquote");Fe(x,y.children),m.append(x);break}case"code":{const x=document.createElement("pre"),B=document.createElement("code");B.textContent=y.text,y.lang&&(x.dataset.lang=y.lang),x.append(B),m.append(x);break}case"hr":m.append(document.createElement("hr"));break;case"list":{const x=document.createElement(y.ordered?"ol":"ul");y.ordered&&y.start!==1&&x.setAttribute("start",String(y.start));for(const B of y.items){const A=document.createElement("li");B.depth&&(A.style.marginLeft=`${B.depth*1.2}em`),Fe(A,B.children),x.append(A)}m.append(x);break}case"table":{const x=document.createElement("div");x.className="md-table";const B=document.createElement("table"),A=document.createElement("thead"),t=document.createElement("tr");for(const h of y.head){const l=document.createElement("th");Fe(l,h),t.append(l)}A.append(t);const a=document.createElement("tbody");for(const h of y.rows){const l=document.createElement("tr");for(const s of h){const c=document.createElement("td");Fe(c,s),l.append(c)}a.append(l)}B.append(A,a),x.append(B),m.append(x);break}}return m}const cr=240,dr=320,ur=90,_r=160,fr=11;function Li(d,_,m,y){const x=Math.max(m,_-y-fr);return Math.round(Math.min(Math.max(d,m),x))}const xi="tring.inboxWidth",ki="tring.inboxHeight",pr=420,Wt="tring.orchestrator",gr=350;function J(d,_,m){const y=document.createElement(d);return _&&(y.className=_),m!==void 0&&(y.textContent=m),y}function Ee(d,_,m,y){const x=J("button",`btn ${_}`,d);return x.type="button",y&&(x.title=y),x.onclick=B=>{B.stopPropagation(),m()},x}function Ri(d){const _=J("button","card-more","Show all");_.type="button",_.hidden=!0;const m=()=>{d.classList.contains("expanded")||(_.hidden=d.scrollHeight<=d.clientHeight+2)};return _.onclick=y=>{y.stopPropagation();const x=d.classList.toggle("expanded");_.textContent=x?"Show less":"Show all",x||m()},requestAnimationFrame(m),new ResizeObserver(m).observe(d),[d,_]}class gt{constructor(_,m){ee(this,"el",J("div","inbox"));ee(this,"list",J("div","inbox-list"));ee(this,"empty",J("div","inbox-empty"));ee(this,"banner",J("div","inbox-banner"));ee(this,"autoBox",J("input"));ee(this,"agentBox",J("input"));ee(this,"agentNote",J("div","inbox-banner agent-note"));ee(this,"handle",J("div","inbox-handle"));ee(this,"width",gt.saved(xi)??pr);ee(this,"height",gt.saved(ki));ee(this,"history",J("details","inbox-history"));ee(this,"historyList",J("ol","inbox-history-list"));ee(this,"historySummary",J("summary"));ee(this,"cards",new Map);ee(this,"items",[]);ee(this,"shown",!1);ee(this,"armedAt",0);ee(this,"ticker",null);this.cell=_,this.cb=m,this.el.hidden=!0,this.el.tabIndex=-1;const y=J("div","inbox-head");y.append(J("span","inbox-title","Orchestrator"),J("span","inbox-hint","a allow · d deny · t answer in terminal · o open · 1–9 pick · ↑↓ move · Ctrl+Space then o to leave")),this.autoBox.type="checkbox",this.autoBox.onchange=()=>this.cb.onAuto(this.autoBox.checked);const x=J("label","inbox-auto");x.title="A small Claude model approves routine permission prompts (tests, builds, edits inside the project). Pushes, deletes, sudo, secrets, publishing, MCP tools, plans and questions always come to you. It never denies.",x.append(this.autoBox,J("span",void 0,"AI approves routine prompts")),this.agentBox.type="checkbox",this.agentBox.onchange=()=>this.cb.onAgent({enabled:this.agentBox.checked});const B=J("label","inbox-auto inbox-agent");B.title="A Claude Code session of its own in the centre. Tell it what you want; it reads every tile (status, branch, screen, changes), prompts the agents in them and starts new ones. Permission prompts stay here, with you.",B.append(this.agentBox,J("span",void 0,"Agent")),y.append(B,x),this.history.hidden=!0,this.history.append(this.historySummary,this.historyList),this.banner.hidden=!0,this.agentNote.hidden=!0,this.el.append(y,this.agentNote,this.banner,this.history,this.list,this.empty),this.el.addEventListener("keydown",A=>this.onKey(A)),this.handle.hidden=!0,this.handle.title="Drag to resize",_.append(this.handle,this.el),this.bindResize()}get isOpen(){return this.shown}static wanted(){try{return localStorage.getItem(Wt)==="1"}catch{return!1}}open(_=!0){this.shown=!0,this.el.hidden=!1;try{localStorage.setItem(Wt,"1")}catch{}this.render(),this.checkHooks(),this.ticker??(this.ticker=setInterval(()=>this.paintAges(),5e3)),_&&this.focusCard(0,!1)}setBeside(_){this.el.classList.toggle("beside",_),this.handle.hidden=!_,this.applySize()}stacked(){return getComputedStyle(this.cell).flexDirection.startsWith("column")}applySize(){if(!this.el.classList.contains("beside")){this.el.style.removeProperty("flex-basis");return}const _=this.stacked()?this.height:this.width;_?this.el.style.flexBasis=`${_}px`:this.el.style.removeProperty("flex-basis"),this.handle.classList.toggle("across",this.stacked())}static saved(_){try{const m=Number(localStorage.getItem(_));return Number.isFinite(m)&&m>0?m:null}catch{return null}}bindResize(){let _=0,m=!1;this.handle.addEventListener("pointerdown",x=>{x.preventDefault(),m=this.stacked();const B=this.el.getBoundingClientRect();_=m?B.top:B.right,this.handle.setPointerCapture(x.pointerId),this.handle.classList.add("dragging")}),this.handle.addEventListener("pointermove",x=>{this.handle.hasPointerCapture(x.pointerId)&&(m?(this.height=Li(x.clientY-_,this.cell.clientHeight,ur,_r),this.el.style.flexBasis=`${this.height}px`):(this.width=Li(_-x.clientX,this.cell.clientWidth,cr,dr),this.el.style.flexBasis=`${this.width}px`))});const y=x=>{var B,A;if(this.handle.hasPointerCapture(x.pointerId)){this.handle.releasePointerCapture(x.pointerId),this.handle.classList.remove("dragging");try{m&&this.height&&localStorage.setItem(ki,String(this.height)),m||localStorage.setItem(xi,String(this.width))}catch{}(A=(B=this.cb).onLayout)==null||A.call(B)}};this.handle.addEventListener("pointerup",y),this.handle.addEventListener("pointercancel",y)}setAgent(_){this.agentBox.checked=_.enabled;const m=_.enabled&&(_.error!==null||_.id===null||_.status==="exited");if(this.agentNote.hidden=!m,!!m){if(_.error){this.agentNote.replaceChildren(J("span",void 0,`The orchestrator agent could not start: ${_.error}`));return}this.agentNote.replaceChildren(J("span",void 0,_.id?"The orchestrator agent’s Claude has exited.":"The orchestrator agent is starting…"),..._.id?[Ee("Start again","primary",()=>this.cb.onAgent({restart:"resume"}),"Reopen the same conversation"),Ee("New conversation","",()=>this.cb.onAgent({restart:"fresh"}))]:[])}}close(){this.shown=!1,this.el.hidden=!0;try{localStorage.setItem(Wt,"0")}catch{}this.ticker&&clearInterval(this.ticker),this.ticker=null}countFor(_){return this.items.filter(m=>m.sessionId===_).length}get count(){return this.items.length}setItems(_){const m=new Set(this.items.map(x=>x.id)),y=this.focusedCardId();return this.items=_,this.render(),this.shown&&y&&!this.cards.has(y)?this.focusCard(0,!0):this.shown&&!y&&document.activeElement===this.el&&this.focusCard(0,!0),_.filter(x=>!m.has(x.id))}setAuto(_,m){this.autoBox.checked=_,this.history.hidden=m.length===0;const y=m.filter(x=>x.verdict==="allow").length;this.historySummary.textContent=`AI decisions: ${y} approved for you, ${m.length-y} left for you`,this.historyList.replaceChildren(...m.map(x=>{const B=J("li",`hist-${x.verdict}`),A=this.cb.label(x.sessionId);return B.append(J("span","hist-verdict",x.verdict==="allow"?"approved":"asked you"),J("span","hist-who",A?`${A.slot} ${A.name}`:"closed session"),J("code","hist-what",x.what||x.tool),J("span","hist-reason",x.reason),J("span","hist-age",$t(Date.now()-x.at))),B}))}repaint(){for(const _ of this.cards.values())_.paintHeader()}render(){const _=document.activeElement,m=_ instanceof HTMLElement&&this.list.contains(_)?_:null,y=new Set(this.items.map(B=>B.id));for(const[B,A]of this.cards)y.has(B)||(A.root.remove(),this.cards.delete(B));let x=null;for(const B of this.items){let A=this.cards.get(B.id);A||(A=this.build(B),this.cards.set(B.id,A));const t=x?x.nextSibling:this.list.firstChild;t!==A.root&&this.list.insertBefore(A.root,t),x=A.root}m&&m.isConnected&&document.activeElement!==m&&m.focus({preventScroll:!0}),this.empty.hidden=this.items.length>0,this.empty.textContent="Nothing is waiting on you. Cards appear here when an agent asks for permission, asks a question, or finishes."}async checkHooks(){try{const _=await this.cb.hooks();if(this.banner.hidden=_.installed,_.installed)return;this.banner.replaceChildren(J("span",void 0,`Claude Code hooks are not installed, so agents cannot reach this inbox. They go in ${_.path} and do nothing outside tring.`),Ee("Install hooks","primary",()=>{this.cb.installHooks().then(()=>this.checkHooks(),m=>{this.banner.replaceChildren(J("span",void 0,`Could not install: ${m.message}`))})}),J("span","inbox-note","Restart running claude sessions to pick them up."))}catch{this.banner.hidden=!0}}focusedCardId(){const _=document.activeElement;for(const[m,y]of this.cards)if(y.root.contains(_))return m;return null}focusCard(_,m){const y=[...this.cards.values()][Math.max(0,Math.min(_,this.cards.size-1))];m&&(this.armedAt=performance.now()+gr),y?y.root.focus({preventScroll:!1}):this.el.focus()}paintAges(){for(const _ of this.cards.values()){const m=_.root.querySelector(".card-age");m&&(m.textContent=$t(Date.now()-_.item.createdAt))}}onKey(_){if(_.ctrlKey||_.metaKey||_.altKey)return;const m=_.target,y=m.tagName==="TEXTAREA"||m.tagName==="INPUT",x=[...this.cards.keys()],B=x.indexOf(this.focusedCardId()??"");if(!y&&(_.key==="ArrowDown"||_.key==="j")){_.preventDefault(),this.focusCard(B+1,!1);return}if(!y&&(_.key==="ArrowUp"||_.key==="k")){_.preventDefault(),this.focusCard(Math.max(0,B-1),!1);return}if(!(B<0)){if(performance.now()<this.armedAt){_.preventDefault();return}this.cards.get(x[B]).key(_)&&_.preventDefault()}}build(_){const m=ir(_),y=J("section",`card card-${_.kind}`);y.tabIndex=0;const x=J("header","card-head"),B=J("span","card-slot"),A=J("span","card-name"),t=J("span","card-where"),a=J("span","card-heading",m.heading),h=J("span","card-age",$t(Date.now()-_.createdAt));x.append(B,A,t,a,h);const l=()=>{const o=this.cb.label(_.sessionId);B.textContent=o?String(o.slot):"?",A.textContent=(o==null?void 0:o.name)??"session",t.textContent=o!=null&&o.elsewhere?`in ${o.elsewhere}`:"",o!=null&&o.color?y.style.setProperty("--tint",o.color):y.style.removeProperty("--tint")};l(),y.append(x);const s=(o,e)=>this.cb.onAnswer(_.id,o,e),c=()=>this.cb.onOpen(_.sessionId),p=J("div","card-actions");let v=()=>!1;if(_.kind==="permission"){m.note&&y.append(J("p","card-note",m.note)),y.append(...Ri(m.mono?J("pre","card-body",m.body):Nt(m.body,"card-body md"))),m.tool&&y.append(J("div","card-tool",m.tool));const o=J("input","card-reason");o.placeholder="Why not? (optional, Enter to deny)",o.hidden=!0;const e=()=>{if(o.hidden){o.hidden=!1,o.focus();return}s("deny",{message:o.value})};o.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),s("deny",{message:o.value})),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),o.hidden=!0,y.focus())}),p.append(Ee("Allow","primary",()=>s("allow"),"a"),Ee("Deny","danger",e,"d"),Ee("Answer in terminal","",()=>s("terminal"),"t"),Ee("Open","",c,"o")),y.append(p,o),v=r=>r.target!==y?!1:r.key==="a"?(s("allow"),!0):r.key==="d"?(e(),!0):r.key==="t"?(s("terminal"),!0):r.key==="o"?(c(),!0):!1}if(_.kind==="question"){const o=_.questions??[],e=new Map,r=new Map,i=Ee("Send answers","primary",()=>n()),n=()=>{const b=yi(o,e,r);b&&s("allow",{answers:b})},u=()=>{i.disabled=yi(o,e,r)===null},C=o.length===1&&!o[0].multiSelect,g=[];for(const[b,f]of o.entries()){const S=J("div","card-question");f.header&&S.append(J("span","card-chip",f.header)),S.append(Nt(f.question,"card-ask md"));const w=J("div","card-options");for(const[L,k]of f.options.entries()){const T=J("button","option");T.type="button",T.append(J("b",void 0,`${L+1}`),J("span",void 0,k.label)),k.description&&T.append(J("small",void 0,k.description)),T.onclick=F=>{F.stopPropagation();const $=e.get(b)??new Set;f.multiSelect?$.has(k.label)?$.delete(k.label):$.add(k.label):($.clear(),$.add(k.label)),e.set(b,$),Array.from(w.querySelectorAll(".option")).forEach((N,H)=>{N.classList.toggle("picked",$.has(f.options[H].label))}),u(),C&&n()},b===0&&g.push(T),w.append(T)}const R=J("input","card-other");R.placeholder="Or type your own answer",R.addEventListener("input",()=>{r.set(b,R.value),u()}),R.addEventListener("keydown",L=>{L.key==="Enter"&&(L.preventDefault(),L.stopPropagation(),n()),L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),y.focus())}),S.append(w,R),y.append(S)}u(),p.append(...C?[]:[i],Ee("Answer in terminal","",()=>s("terminal"),"t"),Ee("Open","",c,"o")),y.append(p),v=b=>{if(b.target!==y)return!1;const f=Number(b.key);return f>=1&&f<=9&&g[f-1]?(g[f-1].click(),!0):b.key==="t"?(s("terminal"),!0):b.key==="o"?(c(),!0):b.key==="Enter"&&!C?(n(),!0):!1}}if(_.kind==="reply"){y.append(...Ri(Nt(m.body,"card-message md")));const o=J("textarea","card-reply");o.rows=2,o.placeholder="Reply… (Enter sends, Shift+Enter for a new line)";const e=()=>{const r=o.value.trim();r&&this.cb.onReply(_.id,r)};o.addEventListener("keydown",r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),r.stopPropagation(),e()),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),y.focus())}),p.append(Ee("Send","primary",e),Ee("Dismiss","",()=>s("terminal"),"x"),Ee("Open","",c,"o")),y.append(o,p),v=r=>r.target!==y?!1:r.key==="Enter"||r.key==="r"?(o.focus(),!0):r.key==="x"?(s("terminal"),!0):r.key==="o"?(c(),!0):!1}return{item:_,root:y,paintHeader:l,key:v}}}var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ji={exports:{}};(function(d,_){(function(m,y){d.exports=y()})(globalThis,()=>(()=>{var m={4567:function(A,t,a){var h=this&&this.__decorate||function(i,n,u,C){var g,b=arguments.length,f=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,u):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,u,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(f=(b<3?g(f):b>3?g(n,u,f):g(n,u))||f);return b>3&&f&&Object.defineProperty(n,u,f),f},l=this&&this.__param||function(i,n){return function(u,C){n(u,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const s=a(9042),c=a(9924),p=a(844),v=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends p.Disposable{constructor(i,n,u,C){super(),this._terminal=i,this._coreBrowserService=u,this._renderService=C,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 g=0;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);if(this._topBoundaryFocusListener=g=>this._handleBoundaryFocus(g,0),this._bottomBoundaryFocusListener=g=>this._handleBoundaryFocus(g,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(g=>this._handleResize(g.rows))),this.register(this._terminal.onRender(g=>this._refreshRows(g.start,g.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(g=>this._handleChar(g))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
16
|
+
`))),this.register(this._terminal.onA11yTab(g=>this._handleTab(g))),this.register(this._terminal.onKey(g=>this._handleKey(g.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,p.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let n=0;n<i;n++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
|
|
17
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=s.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,n){this._liveRegionDebouncer.refresh(i,n,this._terminal.rows)}_renderRows(i,n){const u=this._terminal.buffer,C=u.lines.length.toString();for(let g=i;g<=n;g++){const b=u.lines.get(u.ydisp+g),f=[],S=(b==null?void 0:b.translateToString(!0,void 0,void 0,f))||"",w=(u.ydisp+g+1).toString(),R=this._rowElements[g];R&&(S.length===0?(R.innerText=" ",this._rowColumns.set(R,[0,1])):(R.textContent=S,this._rowColumns.set(R,f)),R.setAttribute("aria-posinset",w),R.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,n){const u=i.target,C=this._rowElements[n===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(n===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==C)return;let g,b;if(n===0?(g=u,b=this._rowElements.pop(),this._rowContainer.removeChild(b)):(g=this._rowElements.shift(),b=u,this._rowContainer.removeChild(g)),g.removeEventListener("focus",this._topBoundaryFocusListener),b.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){const f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{const f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var S;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let n={node:i.anchorNode,offset:i.anchorOffset},u={node:i.focusNode,offset:i.focusOffset};if((n.node.compareDocumentPosition(u.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===u.node&&n.offset>u.offset)&&([n,u]=[u,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;const C=this._rowElements.slice(-1)[0];if(u.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(u={node:C,offset:((S=C.textContent)==null?void 0:S.length)??0}),!this._rowContainer.contains(u.node))return;const g=({node:w,offset:R})=>{const L=w instanceof Text?w.parentNode:w;let k=parseInt(L==null?void 0:L.getAttribute("aria-posinset"),10)-1;if(isNaN(k))return console.warn("row is invalid. Race condition?"),null;const T=this._rowColumns.get(L);if(!T)return console.warn("columns is null. Race condition?"),null;let F=R<T.length?T[R]:T.slice(-1)[0]+1;return F>=this._terminal.cols&&(++k,F=0),{row:k,column:F}},b=g(n),f=g(u);if(b&&f){if(b.row>f.row||b.row===f.row&&b.column>=f.column)throw new Error("invalid range");this._terminal.select(b.column,b.row,(f.row-b.row)*this._terminal.cols-b.column+f.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=r=h([l(1,o.IInstantiationService),l(2,v.ICoreBrowserService),l(3,v.IRenderService)],r)},3614:(A,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,p){return p?"\x1B[200~"+c+"\x1B[201~":c}function l(c,p,v,o){c=h(c=a(c),v.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(c,!0),p.value=""}function s(c,p,v){const o=v.getBoundingClientRect(),e=c.clientX-o.left-10,r=c.clientY-o.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${e}px`,p.style.top=`${r}px`,p.style.zIndex="1000",p.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=h,t.copyHandler=function(c,p){c.clipboardData&&c.clipboardData.setData("text/plain",p.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,p,v,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),p,v,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=s,t.rightClickHandler=function(c,p,v,o,e){s(c,p,v),e&&o.rightClickSelect(c),p.value=o.selectionText,p.select()}},7239:(A,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,s,c){this._css.set(l,s,c)}getCss(l,s){return this._css.get(l,s)}setColor(l,s,c){this._color.set(l,s,c)}getColor(l,s){return this._color.get(l,s)}clear(){this._color.clear(),this._css.clear()}}},3656:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,s){a.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,s))}}}},3551:function(A,t,a){var h=this&&this.__decorate||function(r,i,n,u){var C,g=arguments.length,b=g<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,n):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(r,i,n,u);else for(var f=r.length-1;f>=0;f--)(C=r[f])&&(b=(g<3?C(b):g>3?C(i,n,b):C(i,n))||b);return g>3&&b&&Object.defineProperty(i,n,b),b},l=this&&this.__param||function(r,i){return function(n,u){i(n,u,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const s=a(3656),c=a(8460),p=a(844),v=a(2585),o=a(4725);let e=t.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(r,i,n,u,C){super(),this._element=r,this._mouseService=i,this._renderService=n,this._bufferService=u,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.toDisposable)(()=>{var g;this._lastMouseEvent=void 0,(g=this._activeProviderReplies)==null||g.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,s.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,s.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const n=r.composedPath();for(let u=0;u<n.length;u++){const C=n[u];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,i){var u,C;this._activeProviderReplies&&i||((u=this._activeProviderReplies)==null||u.forEach(g=>{g==null||g.forEach(b=>{b.link.dispose&&b.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=r.y);let n=!1;for(const[g,b]of this._linkProviderService.linkProviders.entries())i?(C=this._activeProviderReplies)!=null&&C.get(g)&&(n=this._checkLinkProviderResult(g,r,n)):b.provideLinks(r.y,f=>{var w,R;if(this._isMouseOut)return;const S=f==null?void 0:f.map(L=>({link:L}));(w=this._activeProviderReplies)==null||w.set(g,S),n=this._checkLinkProviderResult(g,r,n),((R=this._activeProviderReplies)==null?void 0:R.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)})}_removeIntersectingLinks(r,i){const n=new Set;for(let u=0;u<i.size;u++){const C=i.get(u);if(C)for(let g=0;g<C.length;g++){const b=C[g],f=b.link.range.start.y<r?0:b.link.range.start.x,S=b.link.range.end.y>r?this._bufferService.cols:b.link.range.end.x;for(let w=f;w<=S;w++){if(n.has(w)){C.splice(g--,1);break}n.add(w)}}}}_checkLinkProviderResult(r,i,n){var g;if(!this._activeProviderReplies)return n;const u=this._activeProviderReplies.get(r);let C=!1;for(let b=0;b<r;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(C=!0);if(!C&&u){const b=u.find(f=>this._linkAtPosition(f.link,i));b&&(n=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let b=0;b<this._activeProviderReplies.size;b++){const f=(g=this._activeProviderReplies.get(b))==null?void 0:g.find(S=>this._linkAtPosition(S.link,i));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._currentLink)return;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,i){this._currentLink&&this._lastMouseEvent&&(!r||!i||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(r.link,i)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>{var n,u;return(u=(n=this._currentLink)==null?void 0:n.state)==null?void 0:u.decorations.pointerCursor},set:n=>{var u;(u=this._currentLink)!=null&&u.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,u;return(u=(n=this._currentLink)==null?void 0:n.state)==null?void 0:u.decorations.underline},set:n=>{var u,C,g;(u=this._currentLink)!=null&&u.state&&((g=(C=this._currentLink)==null?void 0:C.state)==null?void 0:g.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;const u=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(u,C),this._lastMouseEvent)){const g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._askForLink(g,!1)}})))}_linkHover(r,i,n){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&&r.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(r,i){const n=r.range,u=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-u-1,n.end.x,n.end.y-u-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(r,i,n){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&&r.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(r,i){const n=r.range.start.y*this._bufferService.cols+r.range.start.x,u=r.range.end.y*this._bufferService.cols+r.range.end.x,C=i.y*this._bufferService.cols+i.x;return n<=C&&C<=u}_positionFromMouseEvent(r,i,n){const u=n.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,n,u,C){return{x1:r,y1:i,x2:n,y2:u,cols:this._bufferService.cols,fg:C}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,v.IBufferService),l(4,o.ILinkProviderService)],e)},9042:(A,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(A,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,u=arguments.length,C=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,e,r,i);else for(var g=o.length-1;g>=0;g--)(n=o[g])&&(C=(u<3?n(C):u>3?n(e,r,C):n(e,r))||C);return u>3&&C&&Object.defineProperty(e,r,C),C},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const s=a(511),c=a(2585);let p=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){var S;const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],n=this._optionsService.rawOptions.linkHandler,u=new s.CellData,C=r.getTrimmedLength();let g=-1,b=-1,f=!1;for(let w=0;w<C;w++)if(b!==-1||r.hasContent(w)){if(r.loadCell(w,u),u.hasExtendedAttrs()&&u.extended.urlId){if(b===-1){b=w,g=u.extended.urlId;continue}f=u.extended.urlId!==g}else b!==-1&&(f=!0);if(f||b!==-1&&w===C-1){const R=(S=this._oscLinkService.getLinkData(g))==null?void 0:S.uri;if(R){const L={start:{x:b+1,y:o},end:{x:w+(f||w!==C-1?0:1),y:o}};let k=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{const T=new URL(R);["http:","https:"].includes(T.protocol)||(k=!0)}catch{k=!0}k||i.push({text:R,range:L,activate:(T,F)=>n?n.activate(T,F,L):v(0,F),hover:(T,F)=>{var $;return($=n==null?void 0:n.hover)==null?void 0:$.call(n,T,F,L)},leave:(T,F)=>{var $;return($=n==null?void 0:n.leave)==null?void 0:$.call(n,T,F,L)}})}f=!1,u.hasExtendedAttrs()&&u.extended.urlId?(b=w,g=u.extended.urlId):(b=-1,g=-1)}}e(i)}};function v(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
18
|
+
|
|
19
|
+
WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=p=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],p)},6193:(A,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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),s=a(3551),c=a(9042),p=a(3730),v=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),n=a(428),u=a(4269),C=a(5114),g=a(8934),b=a(3230),f=a(9312),S=a(4725),w=a(6731),R=a(8055),L=a(8969),k=a(8460),T=a(844),F=a(6114),$=a(8437),N=a(2584),H=a(7399),E=a(5941),M=a(9074),I=a(2585),P=a(5435),U=a(4567),q=a(779);class Y extends L.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(O={}){super(O),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new T.MutableDisposable),this._onCursorMove=this.register(new k.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new k.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new k.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new k.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new k.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new k.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new k.EventEmitter),this._onBlur=this.register(new k.EventEmitter),this._onA11yCharEmitter=this.register(new k.EventEmitter),this._onA11yTabEmitter=this.register(new k.EventEmitter),this._onWillOpen=this.register(new k.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(I.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(S.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((D,z)=>this.refresh(D,z))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(D=>this._reportWindowsOptions(D))),this.register(this._inputHandler.onColor(D=>this._handleColorEvent(D))),this.register((0,k.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,k.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,k.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(D=>this._afterResize(D.cols,D.rows))),this.register((0,T.toDisposable)(()=>{var D,z;this._customKeyEventHandler=void 0,(z=(D=this.element)==null?void 0:D.parentNode)==null||z.removeChild(this.element)}))}_handleColorEvent(O){if(this._themeService)for(const D of O){let z,W="";switch(D.index){case 256:z="foreground",W="10";break;case 257:z="background",W="11";break;case 258:z="cursor",W="12";break;default:z="ansi",W="4;"+D.index}switch(D.type){case 0:const V=R.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[D.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${N.C0.ESC}]${W};${(0,E.toRgbString)(V)}${N.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors(K=>K.ansi[D.index]=R.channels.toColor(...D.color));else{const K=z;this._themeService.modifyColors(te=>te[K]=R.channels.toColor(...D.color))}break;case 2:this._themeService.restoreColor(D.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(O){O?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(O){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(N.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var O;return(O=this.textarea)==null?void 0:O.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(N.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 O=this.buffer.ybase+this.buffer.y,D=this.buffer.lines.get(O);if(!D)return;const z=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,V=D.getWidth(z),K=this._renderService.dimensions.css.cell.width*V,te=this.buffer.y*this._renderService.dimensions.css.cell.height,Z=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Z+"px",this.textarea.style.top=te+"px",this.textarea.style.width=K+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",D=>{this.hasSelection()&&(0,h.copyHandler)(D,this._selectionService)}));const O=D=>(0,h.handlePasteEvent)(D,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",O)),this.register((0,l.addDisposableDomListener)(this.element,"paste",O)),F.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",D=>{D.button===2&&(0,h.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",D=>{(0,h.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),F.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",D=>{D.button===1&&(0,h.moveTextAreaUnderMouseCursor)(D,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",O=>this._keyUp(O),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",O=>this._keyDown(O),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",O=>this._keyPress(O),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",O=>this._compositionHelper.compositionupdate(O))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,l.addDisposableDomListener)(this.textarea,"input",O=>this._inputEvent(O),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(O){var z;if(!O)throw new Error("Terminal requires a parent element.");if(O.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=O.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"),O.appendChild(this.element);const D=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),D.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),D.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),F.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(C.CoreBrowserService,this.textarea,O.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(w.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(u.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(b.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(D);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(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const O=this,D=this.element;function z(K){const te=O._mouseService.getMouseReportCoords(K,O.screenElement);if(!te)return!1;let Z,he;switch(K.overrideType||K.type){case"mousemove":he=32,K.buttons===void 0?(Z=3,K.button!==void 0&&(Z=K.button<3?K.button:3)):Z=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":he=0,Z=K.button<3?K.button:3;break;case"mousedown":he=1,Z=K.button<3?K.button:3;break;case"wheel":if(O._customWheelEventHandler&&O._customWheelEventHandler(K)===!1||O.viewport.getLinesScrolled(K)===0)return!1;he=K.deltaY<0?0:1,Z=4;break;default:return!1}return!(he===void 0||Z===void 0||Z>4)&&O.coreMouseService.triggerMouseEvent({col:te.col,row:te.row,x:te.x,y:te.y,button:Z,action:he,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:K=>(z(K),K.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(K)),wheel:K=>(z(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&z(K)},mousemove:K=>{K.buttons||z(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&K?W.mousemove||(D.addEventListener("mousemove",V.mousemove),W.mousemove=V.mousemove):(D.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&K?W.wheel||(D.addEventListener("wheel",V.wheel,{passive:!1}),W.wheel=V.wheel):(D.removeEventListener("wheel",W.wheel),W.wheel=null),2&K?W.mouseup||(W.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&K?W.mousedrag||(W.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(D,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return z(K),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(K)})),this.register((0,l.addDisposableDomListener)(D,"wheel",K=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const te=this.viewport.getLinesScrolled(K);if(te===0)return;const Z=N.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let he="";for(let pe=0;pe<Math.abs(te);pe++)he+=Z;return this.coreService.triggerDataEvent(he,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(D,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,l.addDisposableDomListener)(D,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(O,D){var z;(z=this._renderService)==null||z.refreshRows(O,D)}updateCursorStyle(O){var D;(D=this._selectionService)!=null&&D.shouldColumnSelect(O)?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(O,D,z=0){var W;z===1?(super.scrollLines(O,D,z),this.refresh(0,this.rows-1)):(W=this.viewport)==null||W.scrollLines(O)}paste(O){(0,h.paste)(O,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(O){this._customKeyEventHandler=O}attachCustomWheelEventHandler(O){this._customWheelEventHandler=O}registerLinkProvider(O){return this._linkProviderService.registerLinkProvider(O)}registerCharacterJoiner(O){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const D=this._characterJoinerService.register(O);return this.refresh(0,this.rows-1),D}deregisterCharacterJoiner(O){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(O)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(O){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+O)}registerDecoration(O){return this._decorationService.registerDecoration(O)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(O,D,z){this._selectionService.setSelection(O,D,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 O;(O=this._selectionService)==null||O.clearSelection()}selectAll(){var O;(O=this._selectionService)==null||O.selectAll()}selectLines(O,D){var z;(z=this._selectionService)==null||z.selectLines(O,D)}_keyDown(O){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1)return!1;const D=this.browser.isMac&&this.options.macOptionIsMeta&&O.altKey;if(!D&&!this._compositionHelper.keydown(O))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;D||O.key!=="Dead"&&O.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,H.evaluateKeyboardEvent)(O,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(O),z.type===3||z.type===2){const W=this.rows-1;return this.scrollLines(z.type===2?-W:W),this.cancel(O,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,O)||(z.cancel&&this.cancel(O,!0),!z.key||!!(O.key&&!O.ctrlKey&&!O.altKey&&!O.metaKey&&O.key.length===1&&O.key.charCodeAt(0)>=65&&O.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==N.C0.ETX&&z.key!==N.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:O}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||O.altKey||O.ctrlKey?this.cancel(O,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(O,D){const z=O.isMac&&!this.options.macOptionIsMeta&&D.altKey&&!D.ctrlKey&&!D.metaKey||O.isWindows&&D.altKey&&D.ctrlKey&&!D.metaKey||O.isWindows&&D.getModifierState("AltGraph");return D.type==="keypress"?z:z&&(!D.keyCode||D.keyCode>47)}_keyUp(O){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1||(function(D){return D.keyCode===16||D.keyCode===17||D.keyCode===18}(O)||this.focus(),this.updateCursorStyle(O),this._keyPressHandled=!1)}_keyPress(O){let D;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1)return!1;if(this.cancel(O),O.charCode)D=O.charCode;else if(O.which===null||O.which===void 0)D=O.keyCode;else{if(O.which===0||O.charCode===0)return!1;D=O.which}return!(!D||(O.altKey||O.ctrlKey||O.metaKey)&&!this._isThirdLevelShift(this.browser,O)||(D=String.fromCharCode(D),this._onKey.fire({key:D,domEvent:O}),this._showCursor(),this.coreService.triggerDataEvent(D,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(O){if(O.data&&O.inputType==="insertText"&&(!O.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const D=O.data;return this.coreService.triggerDataEvent(D,!0),this.cancel(O),!0}return!1}resize(O,D){O!==this.cols||D!==this.rows?super.resize(O,D):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(O,D){var z,W;(z=this._charSizeService)==null||z.measure(),(W=this.viewport)==null||W.syncScrollArea(!0)}clear(){var O;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 D=1;D<this.rows;D++)this.buffer.lines.push(this.buffer.getBlankLine($.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(O=this.viewport)==null||O.reset(),this.refresh(0,this.rows-1)}}reset(){var D,z;this.options.rows=this.rows,this.options.cols=this.cols;const O=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)==null||D.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=O,this.refresh(0,this.rows-1)}clearTextureAtlas(){var O;(O=this._renderService)==null||O.clearTextureAtlas()}_reportFocus(){var O;(O=this.element)!=null&&O.classList.contains("focus")?this.coreService.triggerDataEvent(N.C0.ESC+"[I"):this.coreService.triggerDataEvent(N.C0.ESC+"[O")}_reportWindowsOptions(O){if(this._renderService)switch(O){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const D=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${N.C0.ESC}[4;${z};${D}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${N.C0.ESC}[6;${V};${W}t`)}}cancel(O,D){if(this.options.cancelEvents||D)return O.preventDefault(),O.stopPropagation(),!1}}t.Terminal=Y},9924:(A,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 s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=s-this._lastRefreshMs,p=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(A,t,a){var h=this&&this.__decorate||function(r,i,n,u){var C,g=arguments.length,b=g<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,n):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(r,i,n,u);else for(var f=r.length-1;f>=0;f--)(C=r[f])&&(b=(g<3?C(b):g>3?C(i,n,b):C(i,n))||b);return g>3&&b&&Object.defineProperty(i,n,b),b},l=this&&this.__param||function(r,i){return function(n,u){i(n,u,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=a(3656),c=a(4725),p=a(8460),v=a(844),o=a(2585);let e=t.Viewport=class extends v.Disposable{constructor(r,i,n,u,C,g,b,f){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=n,this._optionsService=u,this._charSizeService=C,this._renderService=g,this._coreBrowserService=b,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(S=>this._activeBuffer=S.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(S=>this._renderDimensions=S)),this._handleThemeChange(f.colors),this.register(f.onChangeColors(S=>this._handleThemeChange(S))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(r){this._viewportElement.style.backgroundColor=r.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(r){if(r)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(r,i){const n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&n<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);return i!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){var f;let n,u="";const C=[],g=i??this._bufferService.buffer.lines.length,b=this._bufferService.buffer.lines;for(let S=r;S<g;S++){const w=b.get(S);if(!w)continue;const R=(f=b.get(S+1))==null?void 0:f.isWrapped;if(u+=w.translateToString(!R),!R||S===b.length-1){const L=document.createElement("div");L.textContent=u,C.push(L),u.length>0&&(n=L),u=""}}return{bufferElements:C,cursorElement:n}}getLinesScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const n=this._optionsService.rawOptions.fastScrollModifier;return n==="alt"&&i.altKey||n==="ctrl"&&i.ctrlKey||n==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}};t.Viewport=e=h([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(A,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,u=arguments.length,C=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,e,r,i);else for(var g=o.length-1;g>=0;g--)(n=o[g])&&(C=(u<3?n(C):u>3?n(e,r,C):n(e,r))||C);return u>3&&C&&Object.defineProperty(e,r,C),C},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const s=a(4725),c=a(844),p=a(2585);let v=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,r,i,n){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(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 r=o.options.x??0;return r&&r>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose(()=>{this._decorationElements.delete(o),r.remove()})),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=v=h([l(1,p.IBufferService),l(2,s.ICoreBrowserService),l(3,p.IDecorationService),l(4,s.IRenderService)],v)},5871:(A,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(A,t,a){var h=this&&this.__decorate||function(n,u,C,g){var b,f=arguments.length,S=f<3?u:g===null?g=Object.getOwnPropertyDescriptor(u,C):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,u,C,g);else for(var w=n.length-1;w>=0;w--)(b=n[w])&&(S=(f<3?b(S):f>3?b(u,C,S):b(u,C))||S);return f>3&&S&&Object.defineProperty(u,C,S),S},l=this&&this.__param||function(n,u){return function(C,g){u(C,g,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const s=a(5871),c=a(4725),p=a(844),v=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(n,u,C,g,b,f,S){var R;super(),this._viewportElement=n,this._screenElement=u,this._bufferService=C,this._decorationService=g,this._renderService=b,this._optionsService=f,this._coreBrowserService=S,this._colorZoneStore=new s.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(R=this._viewportElement.parentElement)==null||R.insertBefore(this._canvas,this._viewportElement);const w=this._canvas.getContext("2d");if(!w)throw new Error("Ctx cannot be null");this._ctx=w,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.toDisposable)(()=>{var L;(L=this._canvas)==null||L.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const n=Math.floor(this._canvas.width/3),u=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=n,e.center=u,e.right=n,this._refreshDrawHeightConstants(),r.full=0,r.left=0,r.center=e.left,r.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const n=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(n,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 n=this._colorZoneStore.zones;for(const u of n)u.position!=="full"&&this._renderColorZone(u);for(const u of n)u.position==="full"&&this._renderColorZone(u);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(n){this._ctx.fillStyle=n.color,this._ctx.fillRect(r[n.position||"full"],Math.round((this._canvas.height-1)*(n.startBufferLine/this._bufferService.buffers.active.lines.length)-o[n.position||"full"]/2),e[n.position||"full"],Math.round((this._canvas.height-1)*((n.endBufferLine-n.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[n.position||"full"]))}_queueRefresh(n,u){this._shouldUpdateDimensions=n||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(A,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,u=arguments.length,C=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,e,r,i);else for(var g=o.length-1;g>=0;g--)(n=o[g])&&(C=(u<3?n(C):u>3?n(e,r,C):n(e,r))||C);return u>3&&C&&Object.defineProperty(e,r,C),C},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const s=a(4725),c=a(2585),p=a(2584);let v=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,n,u){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=n,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 r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const u=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"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,s.IRenderService)],v)},9806:(A,t)=>{function a(h,l,s){const c=s.getBoundingClientRect(),p=h.getComputedStyle(s),v=parseInt(p.getPropertyValue("padding-left")),o=parseInt(p.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,s,c,p,v,o,e,r){if(!v)return;const i=a(h,l,s);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),p),i):void 0}},9504:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,r,i,n){const u=e-s(e,i),C=r-s(r,i),g=Math.abs(u-C)-function(b,f,S){let w=0;const R=b-s(b,S),L=f-s(f,S);for(let k=0;k<Math.abs(R-L);k++){const T=c(b,f)==="A"?-1:1,F=S.buffer.lines.get(R+T*k);F!=null&&F.isWrapped&&w++}return w}(e,r,i);return o(g,v(c(e,r),n))}function s(e,r){let i=0,n=r.buffer.lines.get(e),u=n==null?void 0:n.isWrapped;for(;u&&e>=0&&e<r.rows;)i++,n=r.buffer.lines.get(--e),u=n==null?void 0:n.isWrapped;return i}function c(e,r){return e>r?"A":"B"}function p(e,r,i,n,u,C){let g=e,b=r,f="";for(;g!==i||b!==n;)g+=u?1:-1,u&&g>C.cols-1?(f+=C.buffer.translateBufferLineToString(b,!1,e,g),g=0,e=0,b++):!u&&g<0&&(f+=C.buffer.translateBufferLineToString(b,!1,0,e+1),g=C.cols-1,e=g,b--);return f+C.buffer.translateBufferLineToString(b,!1,e,g)}function v(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=r;return i}t.moveToCellSequence=function(e,r,i,n){const u=i.buffer.x,C=i.buffer.y;if(!i.buffer.hasScrollback)return function(f,S,w,R,L,k){return l(S,R,L,k).length===0?"":o(p(f,S,f,S-s(S,L),!1,L).length,v("D",k))}(u,C,0,r,i,n)+l(C,r,i,n)+function(f,S,w,R,L,k){let T;T=l(S,R,L,k).length>0?R-s(R,L):S;const F=R,$=function(N,H,E,M,I,P){let U;return U=l(E,M,I,P).length>0?M-s(M,I):H,N<E&&U<=M||N>=E&&U<M?"C":"D"}(f,S,w,R,L,k);return o(p(f,T,w,F,$==="C",L).length,v($,k))}(u,C,e,r,i,n);let g;if(C===r)return g=u>e?"D":"C",o(Math.abs(u-e),v(g,n));g=C>r?"D":"C";const b=Math.abs(C-r);return o(function(f,S){return S.cols-f}(C>r?e:u,i)+(b-1)*i.cols+1+((C>r?u:e)-1),v(g,n))}},1296:function(A,t,a){var h=this&&this.__decorate||function(k,T,F,$){var N,H=arguments.length,E=H<3?T:$===null?$=Object.getOwnPropertyDescriptor(T,F):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(k,T,F,$);else for(var M=k.length-1;M>=0;M--)(N=k[M])&&(E=(H<3?N(E):H>3?N(T,F,E):N(T,F))||E);return H>3&&E&&Object.defineProperty(T,F,E),E},l=this&&this.__param||function(k,T){return function(F,$){T(F,$,k)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=a(3787),c=a(2550),p=a(2223),v=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),n=a(844),u=a(2585),C="xterm-dom-renderer-owner-",g="xterm-rows",b="xterm-fg-",f="xterm-bg-",S="xterm-focus",w="xterm-selection";let R=1,L=t.DomRenderer=class extends n.Disposable{constructor(k,T,F,$,N,H,E,M,I,P,U,q,Y){super(),this._terminal=k,this._document=T,this._element=F,this._screenElement=$,this._viewportElement=N,this._helperContainer=H,this._linkifier2=E,this._charSizeService=I,this._optionsService=P,this._bufferService=U,this._coreBrowserService=q,this._themeService=Y,this._terminalClass=R++,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(g),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(w),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,v.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(G=>this._injectCss(G))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(G=>this._handleLinkHover(G))),this.register(this._linkifier2.onHideLinkUnderline(G=>this._handleLinkLeave(G))),this.register((0,n.toDisposable)(()=>{this._element.classList.remove(C+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 k=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*k,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*k),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/k),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/k),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 F of this._rowElements)F.style.width=`${this.dimensions.css.canvas.width}px`,F.style.height=`${this.dimensions.css.cell.height}px`,F.style.lineHeight=`${this.dimensions.css.cell.height}px`,F.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const T=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=T,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(k){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let T=`${this._terminalSelector} .${g} { color: ${k.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;T+=`${this._terminalSelector} .${g} .xterm-dim { color: ${r.color.multiplyOpacity(k.foreground,.5).css};}`,T+=`${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 F=`blink_underline_${this._terminalClass}`,$=`blink_bar_${this._terminalClass}`,N=`blink_block_${this._terminalClass}`;T+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,T+=`@keyframes ${$} { 50% { box-shadow: none; }}`,T+=`@keyframes ${N} { 0% { background-color: ${k.cursor.css}; color: ${k.cursorAccent.css}; } 50% { background-color: inherit; color: ${k.cursor.css}; }}`,T+=`${this._terminalSelector} .${g}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${g}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${g}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${k.cursor.css}; color: ${k.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${k.cursor.css} !important; color: ${k.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${k.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${k.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${k.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,T+=`${this._terminalSelector} .${w} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${w} div { position: absolute; background-color: ${k.selectionBackgroundOpaque.css};}${this._terminalSelector} .${w} div { position: absolute; background-color: ${k.selectionInactiveBackgroundOpaque.css};}`;for(const[H,E]of k.ansi.entries())T+=`${this._terminalSelector} .${b}${H} { color: ${E.css}; }${this._terminalSelector} .${b}${H}.xterm-dim { color: ${r.color.multiplyOpacity(E,.5).css}; }${this._terminalSelector} .${f}${H} { background-color: ${E.css}; }`;T+=`${this._terminalSelector} .${b}${p.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(k.background).css}; }${this._terminalSelector} .${b}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(k.background),.5).css}; }${this._terminalSelector} .${f}${p.INVERTED_DEFAULT_COLOR} { background-color: ${k.foreground.css}; }`,this._themeStyleElement.textContent=T}_setDefaultSpacing(){const k=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${k}px`,this._rowFactory.defaultSpacing=k}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(k,T){for(let F=this._rowElements.length;F<=T;F++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>T;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(k,T){this._refreshRowElements(k,T),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(S),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(S),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(k,T,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(k,T,F),this.renderRows(0,this._bufferService.rows-1),!k||!T)return;this._selectionRenderModel.update(this._terminal,k,T,F);const $=this._selectionRenderModel.viewportStartRow,N=this._selectionRenderModel.viewportEndRow,H=this._selectionRenderModel.viewportCappedStartRow,E=this._selectionRenderModel.viewportCappedEndRow;if(H>=this._bufferService.rows||E<0)return;const M=this._document.createDocumentFragment();if(F){const I=k[0]>T[0];M.appendChild(this._createSelectionElement(H,I?T[0]:k[0],I?k[0]:T[0],E-H+1))}else{const I=$===H?k[0]:0,P=H===N?T[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(H,I,P));const U=E-H-1;if(M.appendChild(this._createSelectionElement(H+1,0,this._bufferService.cols,U)),H!==E){const q=N===E?T[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(E,0,q))}}this._selectionContainer.appendChild(M)}_createSelectionElement(k,T,F,$=1){const N=this._document.createElement("div"),H=T*this.dimensions.css.cell.width;let E=this.dimensions.css.cell.width*(F-T);return H+E>this.dimensions.css.canvas.width&&(E=this.dimensions.css.canvas.width-H),N.style.height=$*this.dimensions.css.cell.height+"px",N.style.top=k*this.dimensions.css.cell.height+"px",N.style.left=`${H}px`,N.style.width=`${E}px`,N}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 k of this._rowElements)k.replaceChildren()}renderRows(k,T){const F=this._bufferService.buffer,$=F.ybase+F.y,N=Math.min(F.x,this._bufferService.cols-1),H=this._optionsService.rawOptions.cursorBlink,E=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let I=k;I<=T;I++){const P=I+F.ydisp,U=this._rowElements[I],q=F.lines.get(P);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,P,P===$,E,M,N,H,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!0)}_handleLinkLeave(k){this._setCellUnderline(k.x1,k.x2,k.y1,k.y2,k.cols,!1)}_setCellUnderline(k,T,F,$,N,H){F<0&&(k=0),$<0&&(T=0);const E=this._bufferService.rows-1;F=Math.max(Math.min(F,E),0),$=Math.max(Math.min($,E),0),N=Math.min(N,this._bufferService.cols);const M=this._bufferService.buffer,I=M.ybase+M.y,P=Math.min(M.x,N-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let G=F;G<=$;++G){const O=G+M.ydisp,D=this._rowElements[G],z=M.lines.get(O);if(!D||!z)break;D.replaceChildren(...this._rowFactory.createRow(z,O,O===I,q,Y,P,U,this.dimensions.css.cell.width,this._widthCache,H?G===F?k:0:-1,H?(G===$?T:N)-1:-1))}}};t.DomRenderer=L=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)],L)},3787:function(A,t,a){var h=this&&this.__decorate||function(g,b,f,S){var w,R=arguments.length,L=R<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,f):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(g,b,f,S);else for(var k=g.length-1;k>=0;k--)(w=g[k])&&(L=(R<3?w(L):R>3?w(b,f,L):w(b,f))||L);return R>3&&L&&Object.defineProperty(b,f,L),L},l=this&&this.__param||function(g,b){return function(f,S){b(f,S,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=a(2223),c=a(643),p=a(511),v=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),n=a(3734);let u=t.DomRendererRowFactory=class{constructor(g,b,f,S,w,R,L){this._document=g,this._characterJoinerService=b,this._optionsService=f,this._coreBrowserService=S,this._coreService=w,this._decorationService=R,this._themeService=L,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(g,b,f){this._selectionStart=g,this._selectionEnd=b,this._columnSelectMode=f}createRow(g,b,f,S,w,R,L,k,T,F,$){const N=[],H=this._characterJoinerService.getJoinedCharacters(b),E=this._themeService.colors;let M,I=g.getNoBgTrimmedLength();f&&I<R+1&&(I=R+1);let P=0,U="",q=0,Y=0,G=0,O=!1,D=0,z=!1,W=0;const V=[],K=F!==-1&&$!==-1;for(let te=0;te<I;te++){g.loadCell(te,this._workCell);let Z=this._workCell.getWidth();if(Z===0)continue;let he=!1,pe=te,Q=this._workCell;if(H.length>0&&te===H[0][0]){he=!0;const ie=H.shift();Q=new r.JoinedCellData(this._workCell,g.translateToString(!0,ie[0],ie[1]),ie[1]-ie[0]),pe=ie[1]-1,Z=Q.getWidth()}const De=this._isCellInSelection(te,b),st=f&&te===R,ae=K&&te>=F&&te<=$;let se=!1;this._decorationService.forEachDecorationAtCell(te,b,void 0,ie=>{se=!0});let re=Q.getChars()||c.WHITESPACE_CELL_CHAR;if(re===" "&&(Q.isUnderline()||Q.isOverline())&&(re=" "),W=Z*k-T.get(re,Q.isBold(),Q.isItalic()),M){if(P&&(De&&z||!De&&!z&&Q.bg===q)&&(De&&z&&E.selectionForeground||Q.fg===Y)&&Q.extended.ext===G&&ae===O&&W===D&&!st&&!he&&!se){Q.isInvisible()?U+=c.WHITESPACE_CELL_CHAR:U+=re,P++;continue}P&&(M.textContent=U),M=this._document.createElement("span"),P=0,U=""}else M=this._document.createElement("span");if(q=Q.bg,Y=Q.fg,G=Q.extended.ext,O=ae,D=W,z=De,he&&R>=te&&R<=pe&&(R=te),!this._coreService.isCursorHidden&&st&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&V.push("xterm-cursor-blink"),V.push(S==="bar"?"xterm-cursor-bar":S==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(w)switch(w){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(Q.isBold()&&V.push("xterm-bold"),Q.isItalic()&&V.push("xterm-italic"),Q.isDim()&&V.push("xterm-dim"),U=Q.isInvisible()?c.WHITESPACE_CELL_CHAR:Q.getChars()||c.WHITESPACE_CELL_CHAR,Q.isUnderline()&&(V.push(`xterm-underline-${Q.extended.underlineStyle}`),U===" "&&(U=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${n.AttributeData.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let ie=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&ie<8&&(ie+=8),M.style.textDecorationColor=E.ansi[ie].css}Q.isOverline()&&(V.push("xterm-overline"),U===" "&&(U=" ")),Q.isStrikethrough()&&V.push("xterm-strikethrough"),ae&&(M.style.textDecoration="underline");let X=Q.getFgColor(),oe=Q.getFgColorMode(),fe=Q.getBgColor(),ue=Q.getBgColorMode();const Be=!!Q.isInverse();if(Be){const ie=X;X=fe,fe=ie;const ct=oe;oe=ue,ue=ct}let be,Ae,ge,ce=!1;switch(this._decorationService.forEachDecorationAtCell(te,b,void 0,ie=>{ie.options.layer!=="top"&&ce||(ie.backgroundColorRGB&&(ue=50331648,fe=ie.backgroundColorRGB.rgba>>8&16777215,be=ie.backgroundColorRGB),ie.foregroundColorRGB&&(oe=50331648,X=ie.foregroundColorRGB.rgba>>8&16777215,Ae=ie.foregroundColorRGB),ce=ie.options.layer==="top")}),!ce&&De&&(be=this._coreBrowserService.isFocused?E.selectionBackgroundOpaque:E.selectionInactiveBackgroundOpaque,fe=be.rgba>>8&16777215,ue=50331648,ce=!0,E.selectionForeground&&(oe=50331648,X=E.selectionForeground.rgba>>8&16777215,Ae=E.selectionForeground)),ce&&V.push("xterm-decoration-top"),ue){case 16777216:case 33554432:ge=E.ansi[fe],V.push(`xterm-bg-${fe}`);break;case 50331648:ge=o.channels.toColor(fe>>16,fe>>8&255,255&fe),this._addStyle(M,`background-color:#${C((fe>>>0).toString(16),"0",6)}`);break;default:Be?(ge=E.foreground,V.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):ge=E.background}switch(be||Q.isDim()&&(be=o.color.multiplyOpacity(ge,.5)),oe){case 16777216:case 33554432:Q.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(M,ge,E.ansi[X],Q,be,void 0)||V.push(`xterm-fg-${X}`);break;case 50331648:const ie=o.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(M,ge,ie,Q,be,Ae)||this._addStyle(M,`color:#${C(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,ge,E.foreground,Q,be,Ae)||Be&&V.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}V.length&&(M.className=V.join(" "),V.length=0),st||he||se?M.textContent=U:P++,W!==this.defaultSpacing&&(M.style.letterSpacing=`${W}px`),N.push(M),te=pe}return M&&P&&(M.textContent=U),N}_applyMinimumContrast(g,b,f,S,w,R){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(S.getCode()))return!1;const L=this._getContrastCache(S);let k;if(w||R||(k=L.getColor(b.rgba,f.rgba)),k===void 0){const T=this._optionsService.rawOptions.minimumContrastRatio/(S.isDim()?2:1);k=o.color.ensureContrastRatio(w||b,R||f,T),L.setColor((w||b).rgba,(R||f).rgba,k??null)}return!!k&&(this._addStyle(g,`color:${k.css}`),!0)}_getContrastCache(g){return g.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(g,b){g.setAttribute("style",`${g.getAttribute("style")||""}${b};`)}_isCellInSelection(g,b){const f=this._selectionStart,S=this._selectionEnd;return!(!f||!S)&&(this._columnSelectMode?f[0]<=S[0]?g>=f[0]&&b>=f[1]&&g<S[0]&&b<=S[1]:g<f[0]&&b>=f[1]&&g>=S[0]&&b<=S[1]:b>f[1]&&b<S[1]||f[1]===S[1]&&b===f[1]&&g>=f[0]&&g<S[0]||f[1]<S[1]&&b===S[1]&&g<S[0]||f[1]<S[1]&&b===f[1]&&g>=f[0])}};function C(g,b,f){for(;g.length<f;)g=b+g;return g}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:(A,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 s=a.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const p=a.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[l,s,c,p],this._container.appendChild(l),this._container.appendChild(s),this._container.appendChild(c),this._container.appendChild(p),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,h,l,s){a===this._font&&h===this._fontSize&&l===this._weight&&s===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(a,h,l){let s=0;if(!h&&!l&&a.length===1&&(s=a.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const v=this._measure(a,0);return v>0&&(this._flat[s]=v),v}let c=a;h&&(c+="B"),l&&(c+="I");let p=this._holey.get(c);if(p===void 0){let v=0;h&&(v|=1),l&&(v|=2),p=this._measure(a,v),p>0&&this._holey.set(c,p)}return p}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(A,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:(A,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,s,c,p){return s===1&&c>Math.ceil(1.5*p)&&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(s){return 9472<=s&&s<=9631}(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},6052:(A,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,s,c,p=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const v=l.buffers.active.ydisp,o=s[1]-v,e=c[1]-v,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(A,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(A,t,a){var h=this&&this.__decorate||function(i,n,u,C){var g,b=arguments.length,f=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,u):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,u,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(f=(b<3?g(f):b>3?g(n,u,f):g(n,u))||f);return b>3&&f&&Object.defineProperty(n,u,f),f},l=this&&this.__param||function(i,n){return function(u,C){n(u,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const s=a(2585),c=a(8460),p=a(844);let v=t.CharSizeService=class extends p.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,n,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 r(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,n,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=v=h([l(2,s.IOptionsService)],v);class o extends p.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(n,u){n!==void 0&&n>0&&u!==void 0&&u>0&&(this._result.width=n,this._result.height=u)}}class e extends o{constructor(n,u,C){super(),this._document=n,this._parentElement=u,this._optionsService=C,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class r extends o{constructor(n){super(),this._optionsService=n,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const 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 n=this._ctx.measureText("W");return this._validateAndSet(n.width,n.fontBoundingBoxAscent+n.fontBoundingBoxDescent),this._result}}},4269:function(A,t,a){var h=this&&this.__decorate||function(r,i,n,u){var C,g=arguments.length,b=g<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,n):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(r,i,n,u);else for(var f=r.length-1;f>=0;f--)(C=r[f])&&(b=(g<3?C(b):g>3?C(i,n,b):C(i,n))||b);return g>3&&b&&Object.defineProperty(i,n,b),b},l=this&&this.__param||function(r,i){return function(n,u){i(n,u,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=a(3734),c=a(643),p=a(511),v=a(2585);class o extends s.AttributeData{constructor(i,n,u){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=n,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 Zi{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.CellData}register(i){const n={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(n),n.id}deregister(i){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===i)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const n=this._bufferService.buffer.lines.get(i);if(!n||n.length===0)return[];const u=[],C=n.translateToString(!0);let g=0,b=0,f=0,S=n.getFg(0),w=n.getBg(0);for(let R=0;R<n.getTrimmedLength();R++)if(n.loadCell(R,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==S||this._workCell.bg!==w){if(R-g>1){const L=this._getJoinedRanges(C,f,b,n,g);for(let k=0;k<L.length;k++)u.push(L[k])}g=R,f=b,S=this._workCell.fg,w=this._workCell.bg}b+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-g>1){const R=this._getJoinedRanges(C,f,b,n,g);for(let L=0;L<R.length;L++)u.push(R[L])}return u}_getJoinedRanges(i,n,u,C,g){const b=i.substring(n,u);let f=[];try{f=this._characterJoiners[0].handler(b)}catch(S){console.error(S)}for(let S=1;S<this._characterJoiners.length;S++)try{const w=this._characterJoiners[S].handler(b);for(let R=0;R<w.length;R++)Zi._mergeRanges(f,w[R])}catch(w){console.error(w)}return this._stringRangesToCellRanges(f,C,g),f}_stringRangesToCellRanges(i,n,u){let C=0,g=!1,b=0,f=i[C];if(f){for(let S=u;S<this._bufferService.cols;S++){const w=n.getWidth(S),R=n.getString(S).length||c.WHITESPACE_CELL_CHAR.length;if(w!==0){if(!g&&f[0]<=b&&(f[0]=S,g=!0),f[1]<=b){if(f[1]=S,f=i[++C],!f)break;f[0]<=b?(f[0]=S,g=!0):g=!1}b+=R}}f&&(f[1]=this._bufferService.cols)}}static _mergeRanges(i,n){let u=!1;for(let C=0;C<i.length;C++){const g=i[C];if(u){if(n[1]<=g[0])return i[C-1][1]=n[1],i;if(n[1]<=g[1])return i[C-1][1]=Math.max(n[1],g[1]),i.splice(C,1),i;i.splice(C,1),C--}else{if(n[1]<=g[0])return i.splice(C,0,n),i;if(n[1]<=g[1])return g[0]=Math.min(n[0],g[0]),i;n[0]<g[1]&&(g[0]=Math.min(n[0],g[0]),u=!0)}}return u?i[i.length-1][1]=n[1]:i.push(n),i}};t.CharacterJoinerService=e=h([l(0,v.IBufferService)],e)},5114:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),s=a(3656);class c extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=c;class p extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,s.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const p=this.linkProviders.indexOf(c);p!==-1&&this.linkProviders.splice(p,1)}}}}t.LinkProviderService=l},8934:function(A,t,a){var h=this&&this.__decorate||function(v,o,e,r){var i,n=arguments.length,u=n<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(v,o,e,r);else for(var C=v.length-1;C>=0;C--)(i=v[C])&&(u=(n<3?i(u):n>3?i(o,e,u):i(o,e))||u);return n>3&&u&&Object.defineProperty(o,e,u),u},l=this&&this.__param||function(v,o){return function(e,r){o(e,r,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=a(4725),c=a(9806);let p=t.MouseService=class{constructor(v,o){this._renderService=v,this._charSizeService=o}getCoords(v,o,e,r,i){return(0,c.getCoords)(window,v,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(v,o){const e=(0,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=p=h([l(0,s.IRenderService),l(1,s.ICharSizeService)],p)},3230:function(A,t,a){var h=this&&this.__decorate||function(i,n,u,C){var g,b=arguments.length,f=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,u):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,u,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(f=(b<3?g(f):b>3?g(n,u,f):g(n,u))||f);return b>3&&f&&Object.defineProperty(n,u,f),f},l=this&&this.__param||function(i,n){return function(u,C){n(u,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const s=a(6193),c=a(4725),p=a(8460),v=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends v.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,n,u,C,g,b,f,S){super(),this._rowCount=i,this._charSizeService=C,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 p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new s.RenderDebouncer((w,R)=>this._renderRows(w,R),f),this.register(this._renderDebouncer),this.register(f.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(b.onResize(()=>this._fullRefresh())),this.register(b.buffers.onBufferActivate(()=>{var w;return(w=this._renderer.value)==null?void 0:w.clear()})),this.register(u.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(g.onDecorationRegistered(()=>this._fullRefresh())),this.register(g.onDecorationRemoved(()=>this._fullRefresh())),this.register(u.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(b.cols,b.rows),this._fullRefresh()})),this.register(u.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(b.buffer.y,b.buffer.y,!0))),this.register(S.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(f.window,n),this.register(f.onWindowChange(w=>this._registerIntersectionObserver(w,n)))}_registerIntersectionObserver(i,n){if("IntersectionObserver"in i){const u=new i.IntersectionObserver(C=>this._handleIntersectionChange(C[C.length-1]),{threshold:0});u.observe(n),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,n,u=!1){this._isPaused?this._needsFullRefresh=!0:(u||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,n,this._rowCount))}_renderRows(i,n){this._renderer.value&&(i=Math.min(i,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(i,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:n}),this._onRender.fire({start:i,end:n}),this._isNextRenderRedrawOnly=!0)}resize(i,n){this._rowCount=n,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw(n=>this.refreshRows(n.start,n.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,n;this._renderer.value&&((n=(i=this._renderer.value).clearTextureAtlas)==null||n.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var u;return(u=this._renderer.value)==null?void 0:u.handleResize(i,n)}):this._renderer.value.handleResize(i,n),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,n,u){var C;this._selectionState.start=i,this._selectionState.end=n,this._selectionState.columnSelectMode=u,(C=this._renderer.value)==null||C.handleSelectionChanged(i,n,u)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=r=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],r)},9312:function(A,t,a){var h=this&&this.__decorate||function(f,S,w,R){var L,k=arguments.length,T=k<3?S:R===null?R=Object.getOwnPropertyDescriptor(S,w):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(f,S,w,R);else for(var F=f.length-1;F>=0;F--)(L=f[F])&&(T=(k<3?L(T):k>3?L(S,w,T):L(S,w))||T);return k>3&&T&&Object.defineProperty(S,w,T),T},l=this&&this.__param||function(f,S){return function(w,R){S(w,R,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=a(9806),c=a(9504),p=a(456),v=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),n=a(511),u=a(2585),C=" ",g=new RegExp(C,"g");let b=t.SelectionService=class extends e.Disposable{constructor(f,S,w,R,L,k,T,F,$){super(),this._element=f,this._screenElement=S,this._linkifier=w,this._bufferService=R,this._coreService=L,this._mouseService=k,this._optionsService=T,this._renderService=F,this._coreBrowserService=$,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new n.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=N=>this._handleMouseMove(N),this._mouseUpListener=N=>this._handleMouseUp(N),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(N=>this._handleTrim(N)),this.register(this._bufferService.buffers.onBufferActivate(N=>this._handleBufferActivate(N))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const f=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;return!(!f||!S||f[0]===S[0]&&f[1]===S[1])}get selectionText(){const f=this._model.finalSelectionStart,S=this._model.finalSelectionEnd;if(!f||!S)return"";const w=this._bufferService.buffer,R=[];if(this._activeSelectionMode===3){if(f[0]===S[0])return"";const L=f[0]<S[0]?f[0]:S[0],k=f[0]<S[0]?S[0]:f[0];for(let T=f[1];T<=S[1];T++){const F=w.translateBufferLineToString(T,!0,L,k);R.push(F)}}else{const L=f[1]===S[1]?S[0]:void 0;R.push(w.translateBufferLineToString(f[1],!0,f[0],L));for(let k=f[1]+1;k<=S[1]-1;k++){const T=w.lines.get(k),F=w.translateBufferLineToString(k,!0);T!=null&&T.isWrapped?R[R.length-1]+=F:R.push(F)}if(f[1]!==S[1]){const k=w.lines.get(S[1]),T=w.translateBufferLineToString(S[1],!0,0,S[0]);k&&k.isWrapped?R[R.length-1]+=T:R.push(T)}}return R.map(L=>L.replace(g," ")).join(r.isWindows?`\r
|
|
20
20
|
`:`
|
|
21
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(_){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),r.isLinux&&_&&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(_){const S=this._getMouseBufferCoords(_),w=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!!(w&&R&&S)&&this._areCoordsInSelection(S,w,R)}isCellInSelection(_,S){const w=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!(!w||!R)&&this._areCoordsInSelection([_,S],w,R)}_areCoordsInSelection(_,S,w){return _[1]>S[1]&&_[1]<w[1]||S[1]===w[1]&&_[1]===S[1]&&_[0]>=S[0]&&_[0]<w[0]||S[1]<w[1]&&_[1]===w[1]&&_[0]<w[0]||S[1]<w[1]&&_[1]===S[1]&&_[0]>=S[0]}_selectWordAtCursor(_,S){var L,x;const w=(x=(L=this._linkifier.currentLink)==null?void 0:L.link)==null?void 0:x.range;if(w)return this._model.selectionStart=[w.start.x-1,w.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(w,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const R=this._getMouseBufferCoords(_);return!!R&&(this._selectWordAt(R,S),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(_,S){this._model.clearSelection(),_=Math.max(_,0),S=Math.min(S,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,_],this._model.selectionEnd=[this._bufferService.cols,S],this.refresh(),this._onSelectionChange.fire()}_handleTrim(_){this._model.handleTrim(_)&&this.refresh()}_getMouseBufferCoords(_){const S=this._mouseService.getCoords(_,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(_){let S=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,_,this._screenElement)[1];const w=this._renderService.dimensions.css.canvas.height;return S>=0&&S<=w?0:(S>w&&(S-=w),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(_){return r.isMac?_.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:_.shiftKey}handleMouseDown(_){if(this._mouseDownTimeStamp=_.timeStamp,(_.button!==2||!this.hasSelection)&&_.button===0){if(!this._enabled){if(!this.shouldForceSelection(_))return;_.stopPropagation()}_.preventDefault(),this._dragScrollAmount=0,this._enabled&&_.shiftKey?this._handleIncrementalClick(_):_.detail===1?this._handleSingleClick(_):_.detail===2?this._handleDoubleClick(_):_.detail===3&&this._handleTripleClick(_),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(_){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(_))}_handleSingleClick(_){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(_)?3:0,this._model.selectionStart=this._getMouseBufferCoords(_),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(_){this._selectWordAtCursor(_,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(_){const S=this._getMouseBufferCoords(_);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(_){return _.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(_){if(_.stopImmediatePropagation(),!this._model.selectionStart)return;const S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(_),!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(_),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const w=this._bufferService.buffer;if(this._model.selectionEnd[1]<w.lines.length){const R=w.lines.get(this._model.selectionEnd[1]);R&&R.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}S&&S[0]===this._model.selectionEnd[0]&&S[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 _=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(_.ydisp+this._bufferService.rows,_.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=_.ydisp),this.refresh()}}_handleMouseUp(_){const S=_.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&_.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const w=this._mouseService.getCoords(_,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(w&&w[0]!==void 0&&w[1]!==void 0){const R=(0,l.moveToCellSequence)(w[0]-1,w[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(R,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const _=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,w=!(!_||!S||_[0]===S[0]&&_[1]===S[1]);w?_&&S&&(this._oldSelectionStart&&this._oldSelectionEnd&&_[0]===this._oldSelectionStart[0]&&_[1]===this._oldSelectionStart[1]&&S[0]===this._oldSelectionEnd[0]&&S[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(_,S,w)):this._oldHasSelection&&this._fireOnSelectionChange(_,S,w)}_fireOnSelectionChange(_,S,w){this._oldSelectionStart=_,this._oldSelectionEnd=S,this._oldHasSelection=w,this._onSelectionChange.fire()}_handleBufferActivate(_){this.clearSelection(),this._trimListener.dispose(),this._trimListener=_.activeBuffer.lines.onTrim(S=>this._handleTrim(S))}_convertViewportColToCharacterIndex(_,S){let w=S;for(let R=0;S>=R;R++){const L=_.loadCell(R,this._workCell).getChars().length;this._workCell.getWidth()===0?w--:L>1&&S!==R&&(w+=L-1)}return w}setSelection(_,S,w){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[_,S],this._model.selectionStartLength=w,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(_){this._isClickInSelection(_)||(this._selectWordAtCursor(_,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(_,S,w=!0,R=!0){if(_[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,x=L.lines.get(_[1]);if(!x)return;const T=L.translateBufferLineToString(_[1],!1);let F=this._convertViewportColToCharacterIndex(x,_[0]),$=F;const N=_[0]-F;let H=0,E=0,M=0,B=0;if(T.charAt(F)===" "){for(;F>0&&T.charAt(F-1)===" ";)F--;for(;$<T.length&&T.charAt($+1)===" ";)$++}else{let q=_[0],Y=_[0];x.getWidth(q)===0&&(H++,q--),x.getWidth(Y)===2&&(E++,Y++);const G=x.getString(Y).length;for(G>1&&(B+=G-1,$+=G-1);q>0&&F>0&&!this._isCharWordSeparator(x.loadCell(q-1,this._workCell));){x.loadCell(q-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?(H++,q--):I>1&&(M+=I-1,F-=I-1),F--,q--}for(;Y<x.length&&$+1<T.length&&!this._isCharWordSeparator(x.loadCell(Y+1,this._workCell));){x.loadCell(Y+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(E++,Y++):I>1&&(B+=I-1,$+=I-1),$++,Y++}}$++;let P=F+N-H+M,U=Math.min(this._bufferService.cols,$-F+H+E-M-B);if(S||T.slice(F,$).trim()!==""){if(w&&P===0&&x.getCodePoint(0)!==32){const q=L.lines.get(_[1]-1);if(q&&x.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,_[1]-1],!1,!0,!1);if(Y){const G=this._bufferService.cols-Y.start;P-=G,U+=G}}}if(R&&P+U===this._bufferService.cols&&x.getCodePoint(this._bufferService.cols-1)!==32){const q=L.lines.get(_[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const Y=this._getWordAt([0,_[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:P,length:U}}}_selectWordAt(_,S){const w=this._getWordAt(_,S);if(w){for(;w.start<0;)w.start+=this._bufferService.cols,_[1]--;this._model.selectionStart=[w.start,_[1]],this._model.selectionStartLength=w.length}}_selectToWordAt(_){const S=this._getWordAt(_,!0);if(S){let w=_[1];for(;S.start<0;)S.start+=this._bufferService.cols,w--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,w++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,w]}}_isCharWordSeparator(_){return _.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(_.getChars())>=0}_selectLineAt(_){const S=this._bufferService.buffer.getWrappedRangeForLine(_),w={start:{x:0,y:S.first},end:{x:this._bufferService.cols-1,y:S.last}};this._model.selectionStart=[0,S.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(w,this._bufferService.cols)}};t.SelectionService=b=h([c(3,d.IBufferService),c(4,d.ICoreService),c(5,v.IMouseService),c(6,d.IOptionsService),c(7,v.IRenderService),c(8,v.ICoreBrowserService)],b)},4725:(A,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(A,t,a){var h=this&&this.__decorate||function(b,_,S,w){var R,L=arguments.length,x=L<3?_:w===null?w=Object.getOwnPropertyDescriptor(_,S):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(b,_,S,w);else for(var T=b.length-1;T>=0;T--)(R=b[T])&&(x=(L<3?R(x):L>3?R(_,S,x):R(_,S))||x);return L>3&&x&&Object.defineProperty(_,S,x),x},c=this&&this.__param||function(b,_){return function(S,w){_(S,w,b)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const s=a(7239),l=a(8055),f=a(8460),v=a(844),o=a(2585),e=l.css.toColor("#ffffff"),r=l.css.toColor("#000000"),i=l.css.toColor("#ffffff"),n=l.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const b=[l.css.toColor("#2e3436"),l.css.toColor("#cc0000"),l.css.toColor("#4e9a06"),l.css.toColor("#c4a000"),l.css.toColor("#3465a4"),l.css.toColor("#75507b"),l.css.toColor("#06989a"),l.css.toColor("#d3d7cf"),l.css.toColor("#555753"),l.css.toColor("#ef2929"),l.css.toColor("#8ae234"),l.css.toColor("#fce94f"),l.css.toColor("#729fcf"),l.css.toColor("#ad7fa8"),l.css.toColor("#34e2e2"),l.css.toColor("#eeeeec")],_=[0,95,135,175,215,255];for(let S=0;S<216;S++){const w=_[S/36%6|0],R=_[S/6%6|0],L=_[S%6];b.push({css:l.channels.toCss(w,R,L),rgba:l.channels.toRgba(w,R,L)})}for(let S=0;S<24;S++){const w=8+10*S;b.push({css:l.channels.toCss(w,w,w),rgba:l.channels.toRgba(w,w,w)})}return b})());let C=t.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(b){super(),this._optionsService=b,this._contrastCache=new s.ColorContrastCache,this._halfContrastCache=new s.ColorContrastCache,this._onChangeColors=this.register(new f.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:n,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:l.color.blend(r,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:l.color.blend(r,d),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(b={}){const _=this._colors;if(_.foreground=g(b.foreground,e),_.background=g(b.background,r),_.cursor=g(b.cursor,i),_.cursorAccent=g(b.cursorAccent,n),_.selectionBackgroundTransparent=g(b.selectionBackground,d),_.selectionBackgroundOpaque=l.color.blend(_.background,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundTransparent=g(b.selectionInactiveBackground,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundOpaque=l.color.blend(_.background,_.selectionInactiveBackgroundTransparent),_.selectionForeground=b.selectionForeground?g(b.selectionForeground,l.NULL_COLOR):void 0,_.selectionForeground===l.NULL_COLOR&&(_.selectionForeground=void 0),l.color.isOpaque(_.selectionBackgroundTransparent)&&(_.selectionBackgroundTransparent=l.color.opacity(_.selectionBackgroundTransparent,.3)),l.color.isOpaque(_.selectionInactiveBackgroundTransparent)&&(_.selectionInactiveBackgroundTransparent=l.color.opacity(_.selectionInactiveBackgroundTransparent,.3)),_.ansi=t.DEFAULT_ANSI_COLORS.slice(),_.ansi[0]=g(b.black,t.DEFAULT_ANSI_COLORS[0]),_.ansi[1]=g(b.red,t.DEFAULT_ANSI_COLORS[1]),_.ansi[2]=g(b.green,t.DEFAULT_ANSI_COLORS[2]),_.ansi[3]=g(b.yellow,t.DEFAULT_ANSI_COLORS[3]),_.ansi[4]=g(b.blue,t.DEFAULT_ANSI_COLORS[4]),_.ansi[5]=g(b.magenta,t.DEFAULT_ANSI_COLORS[5]),_.ansi[6]=g(b.cyan,t.DEFAULT_ANSI_COLORS[6]),_.ansi[7]=g(b.white,t.DEFAULT_ANSI_COLORS[7]),_.ansi[8]=g(b.brightBlack,t.DEFAULT_ANSI_COLORS[8]),_.ansi[9]=g(b.brightRed,t.DEFAULT_ANSI_COLORS[9]),_.ansi[10]=g(b.brightGreen,t.DEFAULT_ANSI_COLORS[10]),_.ansi[11]=g(b.brightYellow,t.DEFAULT_ANSI_COLORS[11]),_.ansi[12]=g(b.brightBlue,t.DEFAULT_ANSI_COLORS[12]),_.ansi[13]=g(b.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),_.ansi[14]=g(b.brightCyan,t.DEFAULT_ANSI_COLORS[14]),_.ansi[15]=g(b.brightWhite,t.DEFAULT_ANSI_COLORS[15]),b.extendedAnsi){const S=Math.min(_.ansi.length-16,b.extendedAnsi.length);for(let w=0;w<S;w++)_.ansi[w+16]=g(b.extendedAnsi[w],t.DEFAULT_ANSI_COLORS[w+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(b){this._restoreColor(b),this._onChangeColors.fire(this.colors)}_restoreColor(b){if(b!==void 0)switch(b){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[b]=this._restoreColors.ansi[b]}else for(let _=0;_<this._restoreColors.ansi.length;++_)this._colors.ansi[_]=this._restoreColors.ansi[_]}modifyColors(b){b(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(b,_){if(b!==void 0)try{return l.css.toColor(b)}catch{}return _}t.ThemeService=C=h([c(0,o.IOptionsService)],C)},6349:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),c=a(844);class s extends c.Disposable{constructor(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 r=v-1;r>=0;r--)this.set(f+r+o,this.get(f+r));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=s},1439:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,c=5){if(typeof h!="object")return h;const s=Array.isArray(h)?[]:{};for(const l in h)s[l]=c<=1?h[l]:h[l]&&a(h[l],c-1);return s}},8055:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,c=0,s=0;var l,f,v,o,e;function r(n){const d=n.toString(16);return d.length<2?"0"+d:d}function i(n,d){return n<d?(d+.05)/(n+.05):(n+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(n){n.toCss=function(d,C,g,b){return b!==void 0?`#${r(d)}${r(C)}${r(g)}${r(b)}`:`#${r(d)}${r(C)}${r(g)}`},n.toRgba=function(d,C,g,b=255){return(d<<24|C<<16|g<<8|b)>>>0},n.toColor=function(d,C,g,b){return{css:n.toCss(d,C,g,b),rgba:n.toRgba(d,C,g,b)}}}(l||(t.channels=l={})),function(n){function d(C,g){return s=Math.round(255*g),[a,h,c]=e.toChannels(C.rgba),{css:l.toCss(a,h,c,s),rgba:l.toRgba(a,h,c,s)}}n.blend=function(C,g){if(s=(255&g.rgba)/255,s===1)return{css:g.css,rgba:g.rgba};const b=g.rgba>>24&255,_=g.rgba>>16&255,S=g.rgba>>8&255,w=C.rgba>>24&255,R=C.rgba>>16&255,L=C.rgba>>8&255;return a=w+Math.round((b-w)*s),h=R+Math.round((_-R)*s),c=L+Math.round((S-L)*s),{css:l.toCss(a,h,c),rgba:l.toRgba(a,h,c)}},n.isOpaque=function(C){return(255&C.rgba)==255},n.ensureContrastRatio=function(C,g,b){const _=e.ensureContrastRatio(C.rgba,g.rgba,b);if(_)return l.toColor(_>>24&255,_>>16&255,_>>8&255)},n.opaque=function(C){const g=(255|C.rgba)>>>0;return[a,h,c]=e.toChannels(g),{css:l.toCss(a,h,c),rgba:g}},n.opacity=d,n.multiplyOpacity=function(C,g){return s=255&C.rgba,d(C,s*g/255)},n.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}}(f||(t.color=f={})),function(n){let d,C;try{const g=document.createElement("canvas");g.width=1,g.height=1;const b=g.getContext("2d",{willReadFrequently:!0});b&&(d=b,d.globalCompositeOperation="copy",C=d.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),c=parseInt(g.slice(3,4).repeat(2),16),l.toColor(a,h,c);case 5:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),c=parseInt(g.slice(3,4).repeat(2),16),s=parseInt(g.slice(4,5).repeat(2),16),l.toColor(a,h,c,s);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}const b=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(b)return a=parseInt(b[1]),h=parseInt(b[2]),c=parseInt(b[3]),s=Math.round(255*(b[5]===void 0?1:parseFloat(b[5]))),l.toColor(a,h,c,s);if(!d||!C)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=C,d.fillStyle=g,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,c,s]=d.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:l.toRgba(a,h,c,s),css:g}}}(v||(t.css=v={})),function(n){function d(C,g,b){const _=C/255,S=g/255,w=b/255;return .2126*(_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4))+.7152*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}n.relativeLuminance=function(C){return d(C>>16&255,C>>8&255,255&C)},n.relativeLuminance2=d}(o||(t.rgb=o={})),function(n){function d(g,b,_){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,x=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));for(;F<_&&(L>0||x>0||T>0);)L-=Math.max(0,Math.ceil(.1*L)),x-=Math.max(0,Math.ceil(.1*x)),T-=Math.max(0,Math.ceil(.1*T)),F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));return(L<<24|x<<16|T<<8|255)>>>0}function C(g,b,_){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,x=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));for(;F<_&&(L<255||x<255||T<255);)L=Math.min(255,L+Math.ceil(.1*(255-L))),x=Math.min(255,x+Math.ceil(.1*(255-x))),T=Math.min(255,T+Math.ceil(.1*(255-T))),F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));return(L<<24|x<<16|T<<8|255)>>>0}n.blend=function(g,b){if(s=(255&b)/255,s===1)return b;const _=b>>24&255,S=b>>16&255,w=b>>8&255,R=g>>24&255,L=g>>16&255,x=g>>8&255;return a=R+Math.round((_-R)*s),h=L+Math.round((S-L)*s),c=x+Math.round((w-x)*s),l.toRgba(a,h,c)},n.ensureContrastRatio=function(g,b,_){const S=o.relativeLuminance(g>>8),w=o.relativeLuminance(b>>8);if(i(S,w)<_){if(w<S){const x=d(g,b,_),T=i(S,o.relativeLuminance(x>>8));if(T<_){const F=C(g,b,_);return T>i(S,o.relativeLuminance(F>>8))?x:F}return x}const R=C(g,b,_),L=i(S,o.relativeLuminance(R>>8));if(L<_){const x=d(g,b,_);return L>i(S,o.relativeLuminance(x>>8))?R:x}return R}},n.reduceLuminance=d,n.increaseLuminance=C,n.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),c=a(2585),s=a(4348),l=a(7866),f=a(744),v=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),n=a(7994),d=a(9282),C=a(5435),g=a(5981),b=a(2660);let _=!1;class S extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event(R=>{var L;(L=this._onScrollApi)==null||L.fire(R.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(R){for(const L in R)this.optionsService.options[L]=R[L]}constructor(R){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new s.InstantiationService,this.optionsService=this.register(new v.OptionsService(R)),this._instantiationService.setService(c.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(f.BufferService)),this._instantiationService.setService(c.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(l.LogService)),this._instantiationService.setService(c.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(c.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(r.CoreMouseService)),this._instantiationService.setService(c.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(c.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(n.CharsetService),this._instantiationService.setService(c.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b.OscLinkService),this._instantiationService.setService(c.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.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(L=>{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(L=>{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 g.WriteBuffer((L,x)=>this._inputHandler.parse(L,x))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(R,L){this._writeBuffer.write(R,L)}writeSync(R,L){this._logService.logLevel<=c.LogLevelEnum.WARN&&!_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),_=!0),this._writeBuffer.writeSync(R,L)}input(R,L=!0){this.coreService.triggerDataEvent(R,L)}resize(R,L){isNaN(R)||isNaN(L)||(R=Math.max(R,f.MINIMUM_COLS),L=Math.max(L,f.MINIMUM_ROWS),this._bufferService.resize(R,L))}scroll(R,L=!1){this._bufferService.scroll(R,L)}scrollLines(R,L,x){this._bufferService.scrollLines(R,L,x)}scrollPages(R){this.scrollLines(R*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(R){const L=R-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(R,L){return this._inputHandler.registerEscHandler(R,L)}registerDcsHandler(R,L){return this._inputHandler.registerDcsHandler(R,L)}registerCsiHandler(R,L){return this._inputHandler.registerCsiHandler(R,L)}registerOscHandler(R,L){return this._inputHandler.registerOscHandler(R,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let R=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?R=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(R=!0),R?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const R=[];R.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),R.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const L of R)L.dispose()})}}}t.CoreTerminal=S},8460:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const c=[];for(let s=0;s<this._listeners.length;s++)c.push(this._listeners[s]);for(let s=0;s<c.length;s++)c[s].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(c=>h.fire(c))},t.runAndSubscribe=function(a,h){return h(void 0),a(c=>h(c))}},5435:function(A,t,a){var h=this&&this.__decorate||function(H,E,M,B){var P,U=arguments.length,q=U<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,M):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(H,E,M,B);else for(var Y=H.length-1;Y>=0;Y--)(P=H[Y])&&(q=(U<3?P(q):U>3?P(E,M,q):P(E,M))||q);return U>3&&q&&Object.defineProperty(E,M,q),q},c=this&&this.__param||function(H,E){return function(M,B){E(M,B,H)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const s=a(2584),l=a(7116),f=a(2015),v=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),n=a(511),d=a(3734),C=a(2585),g=a(1480),b=a(6242),_=a(6351),S=a(5941),w={"(":0,")":1,"*":2,"+":3,"-":1,".":2},R=131072;function L(H,E){if(H>24)return E.setWinLines||!1;switch(H){case 1:return!!E.restoreWin;case 2:return!!E.minimizeWin;case 3:return!!E.setWinPosition;case 4:return!!E.setWinSizePixels;case 5:return!!E.raiseWin;case 6:return!!E.lowerWin;case 7:return!!E.refreshWin;case 8:return!!E.setWinSizeChars;case 9:return!!E.maximizeWin;case 10:return!!E.fullscreenWin;case 11:return!!E.getWinState;case 13:return!!E.getWinPosition;case 14:return!!E.getWinSizePixels;case 15:return!!E.getScreenSizePixels;case 16:return!!E.getCellSizePixels;case 18:return!!E.getWinSizeChars;case 19:return!!E.getScreenSizeChars;case 20:return!!E.getIconTitle;case 21:return!!E.getWinTitle;case 22:return!!E.pushTitle;case 23:return!!E.popTitle;case 24:return!!E.setWinLines}return!1}var x;(function(H){H[H.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",H[H.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(x||(t.WindowsOptionsReportType=x={}));let T=0;class F extends v.Disposable{getAttrData(){return this._curAttrData}constructor(E,M,B,P,U,q,Y,G,I=new f.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=M,this._coreService=B,this._logService=P,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=Y,this._unicodeService=G,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new n.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new r.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new r.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new r.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new r.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new r.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new r.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new r.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new r.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new r.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new r.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new r.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(D=>this._activeBuffer=D.activeBuffer)),this._parser.setCsiHandlerFallback((D,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:j.toArray()})}),this._parser.setEscHandlerFallback(D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})}),this._parser.setExecuteHandlerFallback(D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})}),this._parser.setOscHandlerFallback((D,j,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:j,data:W})}),this._parser.setDcsHandlerFallback((D,j,W)=>{j==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:j,payload:W})}),this._parser.setPrintHandler((D,j,W)=>this.print(D,j,W)),this._parser.registerCsiHandler({final:"@"},D=>this.insertChars(D)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},D=>this.scrollLeft(D)),this._parser.registerCsiHandler({final:"A"},D=>this.cursorUp(D)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},D=>this.scrollRight(D)),this._parser.registerCsiHandler({final:"B"},D=>this.cursorDown(D)),this._parser.registerCsiHandler({final:"C"},D=>this.cursorForward(D)),this._parser.registerCsiHandler({final:"D"},D=>this.cursorBackward(D)),this._parser.registerCsiHandler({final:"E"},D=>this.cursorNextLine(D)),this._parser.registerCsiHandler({final:"F"},D=>this.cursorPrecedingLine(D)),this._parser.registerCsiHandler({final:"G"},D=>this.cursorCharAbsolute(D)),this._parser.registerCsiHandler({final:"H"},D=>this.cursorPosition(D)),this._parser.registerCsiHandler({final:"I"},D=>this.cursorForwardTab(D)),this._parser.registerCsiHandler({final:"J"},D=>this.eraseInDisplay(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},D=>this.eraseInDisplay(D,!0)),this._parser.registerCsiHandler({final:"K"},D=>this.eraseInLine(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},D=>this.eraseInLine(D,!0)),this._parser.registerCsiHandler({final:"L"},D=>this.insertLines(D)),this._parser.registerCsiHandler({final:"M"},D=>this.deleteLines(D)),this._parser.registerCsiHandler({final:"P"},D=>this.deleteChars(D)),this._parser.registerCsiHandler({final:"S"},D=>this.scrollUp(D)),this._parser.registerCsiHandler({final:"T"},D=>this.scrollDown(D)),this._parser.registerCsiHandler({final:"X"},D=>this.eraseChars(D)),this._parser.registerCsiHandler({final:"Z"},D=>this.cursorBackwardTab(D)),this._parser.registerCsiHandler({final:"`"},D=>this.charPosAbsolute(D)),this._parser.registerCsiHandler({final:"a"},D=>this.hPositionRelative(D)),this._parser.registerCsiHandler({final:"b"},D=>this.repeatPrecedingCharacter(D)),this._parser.registerCsiHandler({final:"c"},D=>this.sendDeviceAttributesPrimary(D)),this._parser.registerCsiHandler({prefix:">",final:"c"},D=>this.sendDeviceAttributesSecondary(D)),this._parser.registerCsiHandler({final:"d"},D=>this.linePosAbsolute(D)),this._parser.registerCsiHandler({final:"e"},D=>this.vPositionRelative(D)),this._parser.registerCsiHandler({final:"f"},D=>this.hVPosition(D)),this._parser.registerCsiHandler({final:"g"},D=>this.tabClear(D)),this._parser.registerCsiHandler({final:"h"},D=>this.setMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"h"},D=>this.setModePrivate(D)),this._parser.registerCsiHandler({final:"l"},D=>this.resetMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"l"},D=>this.resetModePrivate(D)),this._parser.registerCsiHandler({final:"m"},D=>this.charAttributes(D)),this._parser.registerCsiHandler({final:"n"},D=>this.deviceStatus(D)),this._parser.registerCsiHandler({prefix:"?",final:"n"},D=>this.deviceStatusPrivate(D)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},D=>this.softReset(D)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},D=>this.setCursorStyle(D)),this._parser.registerCsiHandler({final:"r"},D=>this.setScrollRegion(D)),this._parser.registerCsiHandler({final:"s"},D=>this.saveCursor(D)),this._parser.registerCsiHandler({final:"t"},D=>this.windowOptions(D)),this._parser.registerCsiHandler({final:"u"},D=>this.restoreCursor(D)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},D=>this.insertColumns(D)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},D=>this.deleteColumns(D)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},D=>this.selectProtected(D)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},D=>this.requestMode(D,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},D=>this.requestMode(D,!1)),this._parser.setExecuteHandler(s.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(s.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(s.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(s.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(s.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(s.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(s.C1.IND,()=>this.index()),this._parser.setExecuteHandler(s.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(s.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new b.OscHandler(D=>(this.setTitle(D),this.setIconName(D),!0))),this._parser.registerOscHandler(1,new b.OscHandler(D=>this.setIconName(D))),this._parser.registerOscHandler(2,new b.OscHandler(D=>this.setTitle(D))),this._parser.registerOscHandler(4,new b.OscHandler(D=>this.setOrReportIndexedColor(D))),this._parser.registerOscHandler(8,new b.OscHandler(D=>this.setHyperlink(D))),this._parser.registerOscHandler(10,new b.OscHandler(D=>this.setOrReportFgColor(D))),this._parser.registerOscHandler(11,new b.OscHandler(D=>this.setOrReportBgColor(D))),this._parser.registerOscHandler(12,new b.OscHandler(D=>this.setOrReportCursorColor(D))),this._parser.registerOscHandler(104,new b.OscHandler(D=>this.restoreIndexedColor(D))),this._parser.registerOscHandler(110,new b.OscHandler(D=>this.restoreFgColor(D))),this._parser.registerOscHandler(111,new b.OscHandler(D=>this.restoreBgColor(D))),this._parser.registerOscHandler(112,new b.OscHandler(D=>this.restoreCursorColor(D))),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 D in l.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},()=>this.selectCharset("("+D)),this._parser.registerEscHandler({intermediates:")",final:D},()=>this.selectCharset(")"+D)),this._parser.registerEscHandler({intermediates:"*",final:D},()=>this.selectCharset("*"+D)),this._parser.registerEscHandler({intermediates:"+",final:D},()=>this.selectCharset("+"+D)),this._parser.registerEscHandler({intermediates:"-",final:D},()=>this.selectCharset("-"+D)),this._parser.registerEscHandler({intermediates:".",final:D},()=>this.selectCharset("."+D)),this._parser.registerEscHandler({intermediates:"/",final:D},()=>this.selectCharset("/"+D));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(D=>(this._logService.error("Parsing error: ",D),D)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new _.DcsHandler((D,j)=>this.requestStatusString(D,j)))}_preserveStack(E,M,B,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=B,this._parseStack.position=P}_logSlowResolvingAsync(E){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([E,new Promise((M,B)=>setTimeout(()=>B("#SLOW_TIMEOUT"),5e3))]).catch(M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,M){let B,P=this._activeBuffer.x,U=this._activeBuffer.y,q=0;const Y=this._parseStack.paused;if(Y){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(B),B;P=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>R&&(q=this._parseStack.position+R)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,D=>String.fromCharCode(D)).join("")}"`),typeof E=="string"?E.split("").map(D=>D.charCodeAt(0)):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<R&&(this._parseBuffer=new Uint32Array(Math.min(E.length,R))),Y||this._dirtyRowTracker.clearRange(),E.length>R)for(let D=q;D<E.length;D+=R){const j=D+R<E.length?D+R:E.length,W=typeof E=="string"?this._stringDecoder.decode(E.substring(D,j),this._parseBuffer):this._utf8Decoder.decode(E.subarray(D,j),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,W))return this._preserveStack(P,U,W,D),this._logSlowResolvingAsync(B),B}else if(!Y){const D=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,D))return this._preserveStack(P,U,D,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===P&&this._activeBuffer.y===U||this._onCursorMove.fire();const G=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(G,this._bufferService.rows-1))}print(E,M,B){let P,U;const q=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,j=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-M>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,j);let V=this._parser.precedingJoinState;for(let K=M;K<B;++K){if(P=E[K],P<127&&q){const ge=q[String.fromCharCode(P)];ge&&(P=ge.charCodeAt(0))}const ee=this._unicodeService.charProperties(P,V);U=g.UnicodeService.extractWidth(ee);const J=g.UnicodeService.extractShouldJoin(ee),he=J?g.UnicodeService.extractWidth(V):0;if(V=ee,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-he>G){if(I){const ge=W;let Z=this._activeBuffer.x-he;for(this._activeBuffer.x=he,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&W instanceof e.BufferLine&&W.copyCellsFrom(ge,Z,0,he,!1);Z<G;)ge.setCellFromCodepoint(Z++,0,1,j)}else if(this._activeBuffer.x=G-1,U===2)continue}if(J&&this._activeBuffer.x){const ge=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-ge,P,U);for(let Z=U-he;--Z>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}else if(D&&(W.insertCells(this._activeBuffer.x,U-he,this._activeBuffer.getNullCell(j)),W.getWidth(G-1)===2&&W.setCellFromCodepoint(G-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,j)),W.setCellFromCodepoint(this._activeBuffer.x++,P,U,j),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}this._parser.precedingJoinState=V,this._activeBuffer.x<G&&B-M>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,j),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,M){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,M):this._parser.registerCsiHandler(E,B=>!L(B.params[0],this._optionsService.rawOptions.windowOptions)||M(B))}registerDcsHandler(E,M){return this._parser.registerDcsHandler(E,new _.DcsHandler(M))}registerEscHandler(E,M){return this._parser.registerEscHandler(E,M)}registerOscHandler(E,M){return this._parser.registerOscHandler(E,new b.OscHandler(M))}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 E;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&&((E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&E.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,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(E,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=E,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+M)}cursorUp(E){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){const M=E.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=E.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=E.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){const M=E.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,M,B,P=!1,U=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);q.replaceCells(M,B,this._activeBuffer.getNullCell(this._eraseAttrData()),U),P&&(q.isWrapped=!1)}_resetBufferLine(E,M=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),B.isWrapped=!1)}eraseInDisplay(E,M=!1){let B;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);B<this._bufferService.rows;B++)this._resetBufferLine(B,M);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,M),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,M);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(E,M=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let M=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;M--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(E){this._restrictCursor();let M=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;M--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let M=E.params[0]||1;for(;M--;)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(E){let M=E.params[0]||1;for(;M--;)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(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){const M=this._parser.precedingJoinState;if(!M)return!0;const B=E.params[0]||1,P=g.UnicodeService.extractWidth(M),U=this._activeBuffer.x-P,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(q.length*B);let G=0;for(let D=0;D<q.length;){const j=q.codePointAt(D)||0;Y[G++]=j,D+=j>65535?2:1}let I=G;for(let D=1;D<B;++D)Y.copyWithin(I,0,G),I+=G;return this.print(Y,0,I),!0}sendDeviceAttributesPrimary(E){return E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(E){return E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let M=0;M<E.length;M++)switch(E.params[M]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let M=0;M<E.length;M++)switch(E.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,l.DEFAULT_CHARSET),this._charsetService.setgCharset(1,l.DEFAULT_CHARSET),this._charsetService.setgCharset(2,l.DEFAULT_CHARSET),this._charsetService.setgCharset(3,l.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(E){for(let M=0;M<E.length;M++)switch(E.params[M]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let M=0;M<E.length;M++)switch(E.params[M]){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(),E.params[M]===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(E,M){const B=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:Y,cols:G}=this._bufferService,{active:I,alt:D}=Y,j=this._optionsService.rawOptions,W=J=>J?1:2,V=E.params[0];return K=V,ee=M?V===2?4:V===4?W(q.modes.insertMode):V===12?3:V===20?W(j.convertEol):0:V===1?W(B.applicationCursorKeys):V===3?j.windowOptions.setWinLines?G===80?2:G===132?1:0:0:V===6?W(B.origin):V===7?W(B.wraparound):V===8?3:V===9?W(P==="X10"):V===12?W(j.cursorBlink):V===25?W(!q.isCursorHidden):V===45?W(B.reverseWraparound):V===66?W(B.applicationKeypad):V===67?4:V===1e3?W(P==="VT200"):V===1002?W(P==="DRAG"):V===1003?W(P==="ANY"):V===1004?W(B.sendFocus):V===1005?4:V===1006?W(U==="SGR"):V===1015?4:V===1016?W(U==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?W(I===D):V===2004?W(B.bracketedPasteMode):0,q.triggerDataEvent(`${s.C0.ESC}[${M?"":"?"}${K};${ee}$y`),!0;var K,ee}_updateAttrColor(E,M,B,P,U){return M===2?(E|=50331648,E&=-16777216,E|=d.AttributeData.fromColorRGB([B,P,U])):M===5&&(E&=-50331904,E|=33554432|255&B),E}_extractColor(E,M,B){const P=[0,0,-1,0,0,0];let U=0,q=0;do{if(P[q+U]=E.params[M+q],E.hasSubParams(M+q)){const Y=E.getSubParams(M+q);let G=0;do P[1]===5&&(U=1),P[q+G+1+U]=Y[G];while(++G<Y.length&&G+q+1+U<P.length);break}if(P[1]===5&&q+U>=2||P[1]===2&&q+U>=5)break;P[1]&&(U=1)}while(++q+M<E.length&&q+U<P.length);for(let Y=2;Y<P.length;++Y)P[Y]===-1&&(P[Y]=0);switch(P[0]){case 38:B.fg=this._updateAttrColor(B.fg,P[1],P[3],P[4],P[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,P[1],P[3],P[4],P[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,P[1],P[3],P[4],P[5])}return q}_processUnderline(E,M){M.extended=M.extended.clone(),(!~E||E>5)&&(E=1),M.extended.underlineStyle=E,M.fg|=268435456,E===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(E){E.fg=e.DEFAULT_ATTR_DATA.fg,E.bg=e.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=E.length;let B;const P=this._curAttrData;for(let U=0;U<M;U++)B=E.params[U],B>=30&&B<=37?(P.fg&=-50331904,P.fg|=16777216|B-30):B>=40&&B<=47?(P.bg&=-50331904,P.bg|=16777216|B-40):B>=90&&B<=97?(P.fg&=-50331904,P.fg|=16777224|B-90):B>=100&&B<=107?(P.bg&=-50331904,P.bg|=16777224|B-100):B===0?this._processSGR0(P):B===1?P.fg|=134217728:B===3?P.bg|=67108864:B===4?(P.fg|=268435456,this._processUnderline(E.hasSubParams(U)?E.getSubParams(U)[0]:1,P)):B===5?P.fg|=536870912:B===7?P.fg|=67108864:B===8?P.fg|=1073741824:B===9?P.fg|=2147483648:B===2?P.bg|=134217728:B===21?this._processUnderline(2,P):B===22?(P.fg&=-134217729,P.bg&=-134217729):B===23?P.bg&=-67108865:B===24?(P.fg&=-268435457,this._processUnderline(0,P)):B===25?P.fg&=-536870913:B===27?P.fg&=-67108865:B===28?P.fg&=-1073741825:B===29?P.fg&=2147483647:B===39?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):B===49?(P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?U+=this._extractColor(E,U,P):B===53?P.bg|=1073741824:B===55?P.bg&=-1073741825:B===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):B===100?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${s.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[${M};${B}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){const M=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[?${M};${B}R`)}return!0}softReset(E){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(E){const M=E.params[0]||1;switch(M){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 B=M%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(E){const M=E.params[0]||1;let B;return(E.length<2||(B=E.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(E){if(!L(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(x.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(x.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${s.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){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(E){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(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){const M=[],B=E.split(";");for(;B.length>1;){const P=B.shift(),U=B.shift();if(/^\d+$/.exec(P)){const q=parseInt(P);if(N(q))if(U==="?")M.push({type:0,index:q});else{const Y=(0,S.parseColor)(U);Y&&M.push({type:1,index:q,color:Y})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(E){const M=E.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(E,M){this._getCurrentLinkId()&&this._finishHyperlink();const B=E.split(":");let P;const U=B.findIndex(q=>q.startsWith("id="));return U!==-1&&(P=B[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,M){const B=E.split(";");for(let P=0;P<B.length&&!(M>=this._specialColors.length);++P,++M)if(B[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const U=(0,S.parseColor)(B[P]);U&&this._onColor.fire([{type:1,index:this._specialColors[M],color:U}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;const M=[],B=E.split(";");for(let P=0;P<B.length;++P)if(/^\d+$/.exec(B[P])){const U=parseInt(B[P]);N(U)&&M.push({type:2,index:U})}return M.length&&this._onColor.fire(M),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){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,l.DEFAULT_CHARSET),!0}selectCharset(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(w[E[0]],l.CHARSETS[E[1]]||l.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 E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,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(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){const E=new n.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M<this._bufferService.rows;++M){const B=this._activeBuffer.ybase+this._activeBuffer.y+M,P=this._activeBuffer.lines.get(B);P&&(P.fill(E),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,M){const B=this._bufferService.buffer,P=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${s.C0.ESC}${U}${s.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,M){this._dirtyRowTracker.markRangeDirty(E,M)}}t.InputHandler=F;let $=class{constructor(H){this._bufferService=H,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(H){H<this.start?this.start=H:H>this.end&&(this.end=H)}markRangeDirty(H,E){H>E&&(T=H,H=E,E=T),H<this.start&&(this.start=H),E>this.end&&(this.end=E)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function N(H){return 0<=H&&H<256}$=h([c(0,C.IBufferService)],$)},844:(A,t)=>{function a(h){for(const c of h)c.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const c=this._disposables.indexOf(h);c!==-1&&this._disposables.splice(c,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var c;this._isDisposed||h===this._value||((c=this._value)==null||c.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(c,s,l){this._data[c]||(this._data[c]={}),this._data[c][s]=l}get(c,s){return this._data[c]?this._data[c][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,c,s,l,f){this._data.get(h,c)||this._data.set(h,c,new a),this._data.get(h,c).set(s,l,f)}get(h,c,s,l){var f;return(f=this._data.get(h,c))==null?void 0:f.get(s,l)}clear(){this._data.clear()}}},6114:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const c=a.match(/Version\/(\d+)/);return c===null||c.length<2?0:parseInt(c[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(a=this._search(this._getKey(h)),this._array.splice(a,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const c=this._getKey(h);if(c===void 0||(a=this._search(c),a===-1)||this._getKey(this._array[a])!==c)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===c);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,c){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do c(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let c=0,s=this._array.length-1;for(;s>=c;){let l=c+s>>1;const f=this._getKey(this._array[l]);if(f>h)s=l-1;else{if(!(f<h)){for(;l>0&&this._getKey(this._array[l-1])===h;)l--;return l}c=l+1}}return c}}},7226:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class c{constructor(){this._tasks=[],this._i=0}enqueue(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(),r=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),r=f.timeRemaining(),1.5*o>r)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=r}this.clear()}}class s extends c{_requestCallback(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=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(l){return requestIdleCallback(l)}_cancelCallback(l){cancelIdleCallback(l)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(l){this._queue.clear(),this._queue.enqueue(l)}flush(){this._queue.flush()}}},9282:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(c){const s=c.buffer.lines.get(c.buffer.ybase+c.buffer.y-1),l=s==null?void 0:s.get(c.cols-1),f=c.buffer.lines.get(c.buffer.ybase+c.buffer.y);f&&l&&(f.isWrapped=l[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&l[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,l=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=l}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),c=a(7226),s=a(3734),l=a(8437),f=a(4634),v=a(511),o=a(643),e=a(4863),r=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,n,d){this._hasScrollback=i,this._optionsService=n,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=l.DEFAULT_ATTR_DATA.clone(),this.savedCharset=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new c.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,n){return new l.BufferLine(this._bufferService.cols,this.getNullCell(i),n)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const n=i+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=l.DEFAULT_ATTR_DATA);let n=this._rows;for(;n--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,n){const d=this.getNullCell(l.DEFAULT_ATTR_DATA);let C=0;const g=this._getCorrectBufferLength(n);if(g>this.lines.maxLength&&(this.lines.maxLength=g),this.lines.length>0){if(this._cols<i)for(let _=0;_<this.lines.length;_++)C+=+this.lines.get(_).resize(i,d);let b=0;if(this._rows<n)for(let _=this._rows;_<n;_++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new l.BufferLine(i,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+b+1?(this.ybase--,b++,this.ydisp>0&&this.ydisp--):this.lines.push(new l.BufferLine(i,d)));else for(let _=this._rows;_>n;_--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(g<this.lines.maxLength){const _=this.lines.length-g;_>0&&(this.lines.trimStart(_),this.ybase=Math.max(this.ybase-_,0),this.ydisp=Math.max(this.ydisp-_,0),this.savedY=Math.max(this.savedY-_,0)),this.lines.maxLength=g}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,n-1),b&&(this.y+=b),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(i,n),this._cols>i))for(let b=0;b<this.lines.length;b++)C+=+this.lines.get(b).resize(i,d);this._cols=i,this._rows=n,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,n){this._cols!==i&&(i>this._cols?this._reflowLarger(i,n):this._reflowSmaller(i,n))}_reflowLarger(i,n){const d=(0,f.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(l.DEFAULT_ATTR_DATA));if(d.length>0){const C=(0,f.reflowLargerCreateNewLayout)(this.lines,d);(0,f.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(i,n,C.countRemoved)}}_reflowLargerAdjustViewport(i,n,d){const C=this.getNullCell(l.DEFAULT_ATTR_DATA);let g=d;for(;g-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new l.BufferLine(i,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(i,n){const d=this.getNullCell(l.DEFAULT_ATTR_DATA),C=[];let g=0;for(let b=this.lines.length-1;b>=0;b--){let _=this.lines.get(b);if(!_||!_.isWrapped&&_.getTrimmedLength()<=i)continue;const S=[_];for(;_.isWrapped&&b>0;)_=this.lines.get(--b),S.unshift(_);const w=this.ybase+this.y;if(w>=b&&w<b+S.length)continue;const R=S[S.length-1].getTrimmedLength(),L=(0,f.reflowSmallerGetNewLineLengths)(S,this._cols,i),x=L.length-S.length;let T;T=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+x):Math.max(0,this.lines.length-this.lines.maxLength+x);const F=[];for(let B=0;B<x;B++){const P=this.getBlankLine(l.DEFAULT_ATTR_DATA,!0);F.push(P)}F.length>0&&(C.push({start:b+S.length+g,newLines:F}),g+=F.length),S.push(...F);let $=L.length-1,N=L[$];N===0&&($--,N=L[$]);let H=S.length-x-1,E=R;for(;H>=0;){const B=Math.min(E,N);if(S[$]===void 0)break;if(S[$].copyCellsFrom(S[H],E-B,N-B,B,!0),N-=B,N===0&&($--,N=L[$]),E-=B,E===0){H--;const P=Math.max(H,0);E=(0,f.getWrappedLineTrimmedLength)(S,P,this._cols)}}for(let B=0;B<S.length;B++)L[B]<i&&S[B].setCell(L[B],d);let M=x-T;for(;M-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+g)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+x,this.ybase+n-1)}if(C.length>0){const b=[],_=[];for(let $=0;$<this.lines.length;$++)_.push(this.lines.get($));const S=this.lines.length;let w=S-1,R=0,L=C[R];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+g);let x=0;for(let $=Math.min(this.lines.maxLength-1,S+g-1);$>=0;$--)if(L&&L.start>w+x){for(let N=L.newLines.length-1;N>=0;N--)this.lines.set($--,L.newLines[N]);$++,b.push({index:w+1,amount:L.newLines.length}),x+=L.newLines.length,L=C[++R]}else this.lines.set($,_[w--]);let T=0;for(let $=b.length-1;$>=0;$--)b[$].index+=T,this.lines.onInsertEmitter.fire(b[$]),T+=b[$].amount;const F=Math.max(0,S+g-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(i,n,d=0,C){const g=this.lines.get(i);return g?g.translateToString(n,d,C):""}getWrappedRangeForLine(i){let n=i,d=i;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:n,last:d}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let n=0;n<this.markers.length;n++)this.markers[n].line===i&&(this.markers[n].dispose(),this.markers.splice(n--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const n=new e.Marker(i);return this.markers.push(n),n.register(this.lines.onTrim(d=>{n.line-=d,n.line<0&&n.dispose()})),n.register(this.lines.onInsert(d=>{n.line>=d.index&&(n.line+=d.amount)})),n.register(this.lines.onDelete(d=>{n.line>=d.index&&n.line<d.index+d.amount&&n.dispose(),n.line>d.index&&(n.line-=d.amount)})),n.register(n.onDispose(()=>this._removeMarker(n))),n}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),c=a(511),s=a(643),l=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let f=0;class v{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const n=r||c.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]);for(let d=0;d<e;++d)this.setCell(d,n);this.length=e}get(e){const r=this._data[3*e+0],i=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:i?(0,l.stringFromCodePoint)(i):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,r){this._data[3*e+1]=r[s.CHAR_DATA_ATTR_INDEX],r[s.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[s.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[s.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?(0,l.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return f=3*e,r.content=this._data[f+0],r.fg=this._data[f+1],r.bg=this._data[f+2],2097152&r.content&&(r.combinedData=this._combined[e]),268435456&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,i,n){268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}addCodepointToCell(e,r,i){let n=this._data[3*e+0];2097152&n?this._combined[e]+=(0,l.stringFromCodePoint)(r):2097151&n?(this._combined[e]=(0,l.stringFromCodePoint)(2097151&n)+(0,l.stringFromCodePoint)(r),n&=-2097152,n|=2097152):n=r|4194304,i&&(n&=-12582913,n|=i<<22),this._data[3*e+0]=n}insertCells(e,r,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length-e){const n=new c.CellData;for(let d=this.length-e-r-1;d>=0;--d)this.setCell(e+r+d,this.loadCell(e+d,n));for(let d=0;d<r;++d)this.setCell(e+d,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,r,i){if(e%=this.length,r<this.length-e){const n=new c.CellData;for(let d=0;d<this.length-e-r;++d)this.setCell(e+d,this.loadCell(e+r+d,n));for(let d=this.length-r;d<this.length;++d)this.setCell(d,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,r,i,n=!1){if(n)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.setCell(e++,i)}resize(e,r){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<e;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);const n=Object.keys(this._combined);for(let C=0;C<n.length;C++){const g=parseInt(n[C],10);g>=e&&delete this._combined[g]}const d=Object.keys(this._extendedAttrs);for(let C=0;C<d.length;C++){const g=parseInt(d[C],10);g>=e&&delete this._extendedAttrs[g]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,r=!1){if(r)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(const r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){const e=new v(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const r in this._combined)e._combined[r]=this._combined[r];for(const r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,r,i,n,d){const C=e._data;if(d)for(let b=n-1;b>=0;b--){for(let _=0;_<3;_++)this._data[3*(i+b)+_]=C[3*(r+b)+_];268435456&C[3*(r+b)+2]&&(this._extendedAttrs[i+b]=e._extendedAttrs[r+b])}else for(let b=0;b<n;b++){for(let _=0;_<3;_++)this._data[3*(i+b)+_]=C[3*(r+b)+_];268435456&C[3*(r+b)+2]&&(this._extendedAttrs[i+b]=e._extendedAttrs[r+b])}const g=Object.keys(e._combined);for(let b=0;b<g.length;b++){const _=parseInt(g[b],10);_>=r&&(this._combined[_-r+i]=e._combined[_])}}translateToString(e,r,i,n){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let d="";for(;r<i;){const C=this._data[3*r+0],g=2097151&C,b=2097152&C?this._combined[r]:g?(0,l.stringFromCodePoint)(g):s.WHITESPACE_CELL_CHAR;if(d+=b,n)for(let _=0;_<b.length;++_)n.push(r);r+=C>>22||1}return n&&n.push(r),d}}t.BufferLine=v},4841:(A,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:(A,t)=>{function a(h,c,s){if(c===h.length-1)return h[c].getTrimmedLength();const l=!h[c].hasContent(s-1)&&h[c].getWidth(s-1)===1,f=h[c+1].getWidth(0)===2;return l&&f?s-1:s}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,c,s,l,f){const v=[];for(let o=0;o<h.length-1;o++){let e=o,r=h.get(++e);if(!r.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&r.isWrapped;)i.push(r),r=h.get(++e);if(l>=o&&l<e){o+=i.length-1;continue}let n=0,d=a(i,n,c),C=1,g=0;for(;C<i.length;){const _=a(i,C,c),S=_-g,w=s-d,R=Math.min(S,w);i[n].copyCellsFrom(i[C],g,d,R,!1),d+=R,d===s&&(n++,d=0),g+=R,g===_&&(C++,g=0),d===0&&n!==0&&i[n-1].getWidth(s-1)===2&&(i[n].copyCellsFrom(i[n-1],s-1,d++,1,!1),i[n-1].setCell(s-1,f))}i[n].replaceCells(d,s,f);let b=0;for(let _=i.length-1;_>0&&(_>n||i[_].getTrimmedLength()===0);_--)b++;b>0&&(v.push(o+i.length-b),v.push(b)),o+=i.length-1}return v},t.reflowLargerCreateNewLayout=function(h,c){const s=[];let l=0,f=c[l],v=0;for(let o=0;o<h.length;o++)if(f===o){const e=c[++l];h.onDeleteEmitter.fire({index:o-v,amount:e}),o+=e-1,v+=e,f=c[++l]}else s.push(o);return{layout:s,countRemoved:v}},t.reflowLargerApplyNewLayout=function(h,c){const s=[];for(let l=0;l<c.length;l++)s.push(h.get(c[l]));for(let l=0;l<s.length;l++)h.set(l,s[l]);h.length=c.length},t.reflowSmallerGetNewLineLengths=function(h,c,s){const l=[],f=h.map((r,i)=>a(h,i,c)).reduce((r,i)=>r+i);let v=0,o=0,e=0;for(;e<f;){if(f-e<s){l.push(f-e);break}v+=s;const r=a(h,o,c);v>r&&(v-=r,o++);const i=h[o].getWidth(v-1)===2;i&&v--;const n=i?s-1:s;l.push(n),e+=n}return l},t.getWrappedLineTrimmedLength=a},5295:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),c=a(844),s=a(9092);class l extends c.Disposable{constructor(v,o){super(),this._optionsService=v,this._bufferService=o,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(v,o){this._normal.resize(v,o),this._alt.resize(v,o),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}t.BufferSet=l},511:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),c=a(643),s=a(3734);class l extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const o=new l;return o.setFromCharData(v),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(v){this.fg=v[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[c.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[c.CHAR_DATA_CHAR_INDEX].length===2){const e=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|v[c.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[c.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=l},643:(A,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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),c=a(844);class s{get id(){return this._id}constructor(f){this.line=f,this.isDisposed=!1,this._disposables=[],this._id=s._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,c.disposeArray)(this._disposables),this._disposables.length=0)}register(f){return this._disposables.push(f),f}}t.Marker=s,s._nextId=1},7116:(A,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:(A,t)=>{var a,h,c;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(s){s.NUL="\0",s.SOH="",s.STX="",s.ETX="",s.EOT="",s.ENQ="",s.ACK="",s.BEL="\x07",s.BS="\b",s.HT=" ",s.LF=`
|
|
22
|
-
`,s.VT="\v",s.FF="\f",s.CR="\r",s.SO="",s.SI="",s.DLE="",s.DC1="",s.DC2="",s.DC3="",s.DC4="",s.NAK="",s.SYN="",s.ETB="",s.CAN="",s.EM="",s.SUB="",s.ESC="\x1B",s.FS="",s.GS="",s.RS="",s.US="",s.SP=" ",s.DEL=""}(a||(t.C0=a={})),function(s){s.PAD="",s.HOP="",s.BPH="",s.NBH="",s.IND="",s.NEL="
",s.SSA="",s.ESA="",s.HTS="",s.HTJ="",s.VTS="",s.PLD="",s.PLU="",s.RI="",s.SS2="",s.SS3="",s.DCS="",s.PU1="",s.PU2="",s.STS="",s.CCH="",s.MW="",s.SPA="",s.EPA="",s.SOS="",s.SGCI="",s.SCI="",s.CSI="",s.ST="",s.OSC="",s.PM="",s.APC=""}(h||(t.C1=h={})),function(s){s.ST=`${a.ESC}\\`}(c||(t.C1_ESCAPED=c={}))},7399:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),c={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(s,l,f,v){const o={type:0,cancel:!1,key:void 0},e=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?o.key=l?h.C0.ESC+"OA":h.C0.ESC+"[A":s.key==="UIKeyInputLeftArrow"?o.key=l?h.C0.ESC+"OD":h.C0.ESC+"[D":s.key==="UIKeyInputRightArrow"?o.key=l?h.C0.ESC+"OC":h.C0.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(o.key=l?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=s.ctrlKey?"\b":h.C0.DEL,s.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(s.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=s.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,s.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(f?"b":"[1;5D"))):o.key=l?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(f?"f":"[1;5C"))):o.key=l?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",f||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=l?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",f||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=l?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:s.shiftKey||s.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":l?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":l?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:s.shiftKey?o.type=2:s.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:s.shiftKey?o.type=3:s.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!s.ctrlKey||s.shiftKey||s.altKey||s.metaKey)if(f&&!v||!s.altKey||s.metaKey)!f||s.altKey||s.ctrlKey||s.shiftKey||!s.metaKey?s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?o.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(o.key=h.C0.US),s.key==="@"&&(o.key=h.C0.NUL)):s.keyCode===65&&(o.type=1);else{const r=c[s.keyCode],i=r==null?void 0:r[s.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(s.keyCode>=65&&s.keyCode<=90){const n=s.ctrlKey?s.keyCode-64:s.keyCode+32;let d=String.fromCharCode(n);s.shiftKey&&(d=d.toUpperCase()),o.key=h.C0.ESC+d}else if(s.keyCode===32)o.key=h.C0.ESC+(s.ctrlKey?h.C0.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let n=s.code.slice(3,4);s.shiftKey||(n=n.toLowerCase()),o.key=h.C0.ESC+n,o.cancel=!0}}else s.keyCode>=65&&s.keyCode<=90?o.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?o.key=h.C0.NUL:s.keyCode>=51&&s.keyCode<=55?o.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?o.key=h.C0.DEL:s.keyCode===219?o.key=h.C0.ESC:s.keyCode===220?o.key=h.C0.FS:s.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,c=a.length){let s="";for(let l=h;l<c;++l){let f=a[l];f>65535?(f-=65536,s+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):s+=String.fromCharCode(f)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const c=a.length;if(!c)return 0;let s=0,l=0;if(this._interim){const f=a.charCodeAt(l++);56320<=f&&f<=57343?h[s++]=1024*(this._interim-55296)+f-56320+65536:(h[s++]=this._interim,h[s++]=f),this._interim=0}for(let f=l;f<c;++f){const v=a.charCodeAt(f);if(55296<=v&&v<=56319){if(++f>=c)return this._interim=v,s;const o=a.charCodeAt(f);56320<=o&&o<=57343?h[s++]=1024*(v-55296)+o-56320+65536:(h[s++]=v,h[s++]=o)}else v!==65279&&(h[s++]=v)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const c=a.length;if(!c)return 0;let s,l,f,v,o=0,e=0,r=0;if(this.interim[0]){let d=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let g,b=0;for(;(g=63&this.interim[++b])&&b<4;)C<<=6,C|=g;const _=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=_-b;for(;r<S;){if(r>=c)return 0;if(g=a[r++],(192&g)!=128){r--,d=!0;break}this.interim[b++]=g,C<<=6,C|=63&g}d||(_===2?C<128?r--:h[o++]=C:_===3?C<2048||C>=55296&&C<=57343||C===65279||(h[o++]=C):C<65536||C>1114111||(h[o++]=C)),this.interim.fill(0)}const i=c-4;let n=r;for(;n<c;){for(;!(!(n<i)||128&(s=a[n])||128&(l=a[n+1])||128&(f=a[n+2])||128&(v=a[n+3]));)h[o++]=s,h[o++]=l,h[o++]=f,h[o++]=v,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=c)return this.interim[0]=s,o;if(l=a[n++],(192&l)!=128){n--;continue}if(e=(31&s)<<6|63&l,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=c)return this.interim[0]=s,o;if(l=a[n++],(192&l)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=l,o;if(f=a[n++],(192&f)!=128){n--;continue}if(e=(15&s)<<12|(63&l)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=c)return this.interim[0]=s,o;if(l=a[n++],(192&l)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=l,o;if(f=a[n++],(192&f)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=l,this.interim[2]=f,o;if(v=a[n++],(192&v)!=128){n--;continue}if(e=(7&s)<<18|(63&l)<<12|(63&f)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),c=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let l;t.UnicodeV6=class{constructor(){if(this.version="6",!l){l=new Uint8Array(65536),l.fill(1),l[0]=0,l.fill(0,1,32),l.fill(0,127,160),l.fill(2,4352,4448),l[9001]=2,l[9002]=2,l.fill(2,11904,42192),l[12351]=1,l.fill(2,44032,55204),l.fill(2,63744,64256),l.fill(2,65040,65050),l.fill(2,65072,65136),l.fill(2,65280,65377),l.fill(2,65504,65511);for(let f=0;f<c.length;++f)l.fill(0,c[f][0],c[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?l[f]:function(v,o){let e,r=0,i=o.length-1;if(v<o[0][0]||v>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,v>o[e][1])r=e+1;else{if(!(v<o[e][0]))return!0;i=e-1}return!1}(f,s)?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 r=h.UnicodeService.extractWidth(v);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),c=a(844);class s extends c.Disposable{constructor(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],r=this._action(e,v);if(r){const n=d=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(o,d);return void r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(n)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=s},5941:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function c(s,l){const f=s.toString(16),v=f.length<2?"0"+f:f;switch(l){case 4:return f[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}t.parseColor=function(s){if(!s)return;let l=s.toLowerCase();if(l.indexOf("rgb:")===0){l=l.slice(4);const f=a.exec(l);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(l.indexOf("#")===0&&(l=l.slice(1),h.exec(l)&&[3,6,9,12].includes(l.length))){const f=l.length/3,v=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(l.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(s,l=16){const[f,v,o]=s;return`rgb:${c(f,l)}/${c(v,l)}/${c(o,l)}`}},5770:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),c=a(8742),s=a(5770),l=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=l,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}registerHandler(v,o){this._handlers[v]===void 0&&(this._handlers[v]=[]);const e=this._handlers[v];return e.push(o),{dispose:()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=l,this._ident=0}hook(v,o){if(this.reset(),this._ident=v,this._active=this._handlers[v]||l,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(v,o,e){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(v,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(v,o,e))}unhook(v,o=!0){if(this._active.length){let e=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;r>=0&&(e=this._active[r].unhook(v),e!==!0);r--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,e;r--}for(;r>=0;r--)if(e=this._active[r].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",v);this._active=l,this._ident=0}};const f=new c.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>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let o=!1;if(this._hitLimit)o=!1;else if(v&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=f,this._data="",this._hitLimit=!1,e));return this._params=f,this._data="",this._hitLimit=!1,o}}},2015:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=a(844),c=a(8742),s=a(6242),l=a(6351);class f{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,n,d){this.table[i<<8|r]=n<<4|d}addMany(r,i,n,d){for(let C=0;C<r.length;C++)this.table[i<<8|r[C]]=n<<4|d}}t.TransitionTable=f;const v=160;t.VT500_TRANSITION_TABLE=function(){const e=new f(4095),r=Array.apply(null,Array(256)).map((b,_)=>_),i=(b,_)=>r.slice(b,_),n=i(32,127),d=i(0,24);d.push(25),d.push.apply(d,i(28,32));const C=i(0,14);let g;for(g in e.setDefault(1,0),e.addMany(n,0,2,0),C)e.addMany([24,26,153,154],g,3,0),e.addMany(i(128,144),g,3,0),e.addMany(i(144,152),g,3,0),e.add(156,g,0,0),e.add(27,g,11,1),e.add(157,g,4,8),e.addMany([152,158,159],g,0,7),e.add(155,g,11,3),e.add(144,g,11,9);return e.addMany(d,0,3,0),e.addMany(d,1,3,1),e.add(127,1,0,1),e.addMany(d,8,0,8),e.addMany(d,3,3,3),e.add(127,3,0,3),e.addMany(d,4,3,4),e.add(127,4,0,4),e.addMany(d,6,3,6),e.addMany(d,5,3,5),e.add(127,5,0,5),e.addMany(d,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(d,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(d,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(d,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(d,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(d,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(d,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(v,0,2,0),e.add(v,8,5,8),e.add(v,6,0,6),e.add(v,11,0,11),e.add(v,13,13,13),e}();class o extends h.Disposable{constructor(r=t.VT500_TRANSITION_TABLE){super(),this._transitions=r,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new c.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,d)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new s.OscParser),this._dcsParser=this.register(new l.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(r,i=[64,126]){let n=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=r.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<r.intermediates.length;++C){const g=r.intermediates.charCodeAt(C);if(32>g||g>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=g}}if(r.final.length!==1)throw new Error("final must be a single byte");const d=r.final.charCodeAt(0);if(i[0]>d||d>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=d,n}identToString(r){const i=[];for(;r;)i.push(String.fromCharCode(255&r)),r>>=8;return i.reverse().join("")}setPrintHandler(r){this._printHandler=r}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(r,i){const n=this._identifier(r,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);const d=this._escHandlers[n];return d.push(i),{dispose:()=>{const C=d.indexOf(i);C!==-1&&d.splice(C,1)}}}clearEscHandler(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]}setEscHandlerFallback(r){this._escHandlerFb=r}setExecuteHandler(r,i){this._executeHandlers[r.charCodeAt(0)]=i}clearExecuteHandler(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]}setExecuteHandlerFallback(r){this._executeHandlerFb=r}registerCsiHandler(r,i){const n=this._identifier(r);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);const d=this._csiHandlers[n];return d.push(i),{dispose:()=>{const C=d.indexOf(i);C!==-1&&d.splice(C,1)}}}clearCsiHandler(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]}setCsiHandlerFallback(r){this._csiHandlerFb=r}registerDcsHandler(r,i){return this._dcsParser.registerHandler(this._identifier(r),i)}clearDcsHandler(r){this._dcsParser.clearHandler(this._identifier(r))}setDcsHandlerFallback(r){this._dcsParser.setHandlerFallback(r)}registerOscHandler(r,i){return this._oscParser.registerHandler(r,i)}clearOscHandler(r){this._oscParser.clearHandler(r)}setOscHandlerFallback(r){this._oscParser.setHandlerFallback(r)}setErrorHandler(r){this._errorHandler=r}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(r,i,n,d,C){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=d,this._parseStack.chunkPos=C}parse(r,i,n){let d,C=0,g=0,b=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,b=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const _=this._parseStack.handlers;let S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&S>-1){for(;S>=0&&(d=_[S](this._params),d!==!0);S--)if(d instanceof Promise)return this._parseStack.handlerPos=S,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&S>-1){for(;S>=0&&(d=_[S](),d!==!0);S--)if(d instanceof Promise)return this._parseStack.handlerPos=S,d}this._parseStack.handlers=[];break;case 6:if(C=r[this._parseStack.chunkPos],d=this._dcsParser.unhook(C!==24&&C!==26,n),d)return d;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=r[this._parseStack.chunkPos],d=this._oscParser.end(C!==24&&C!==26,n),d)return d;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,b=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let _=b;_<i;++_){switch(C=r[_],g=this._transitions.table[this.currentState<<8|(C<160?C:v)],g>>4){case 2:for(let x=_+1;;++x){if(x>=i||(C=r[x])<32||C>126&&C<v){this._printHandler(r,_,x),_=x-1;break}if(++x>=i||(C=r[x])<32||C>126&&C<v){this._printHandler(r,_,x),_=x-1;break}if(++x>=i||(C=r[x])<32||C>126&&C<v){this._printHandler(r,_,x),_=x-1;break}if(++x>=i||(C=r[x])<32||C>126&&C<v){this._printHandler(r,_,x),_=x-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:_,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const S=this._csiHandlers[this._collect<<8|C];let w=S?S.length-1:-1;for(;w>=0&&(d=S[w](this._params),d!==!0);w--)if(d instanceof Promise)return this._preserveStack(3,S,w,g,_),d;w<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++_<i&&(C=r[_])>47&&C<60);_--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:const R=this._escHandlers[this._collect<<8|C];let L=R?R.length-1:-1;for(;L>=0&&(d=R[L](),d!==!0);L--)if(d instanceof Promise)return this._preserveStack(4,R,L,g,_),d;L<0&&this._escHandlerFb(this._collect<<8|C),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|C,this._params);break;case 13:for(let x=_+1;;++x)if(x>=i||(C=r[x])===24||C===26||C===27||C>127&&C<v){this._dcsParser.put(r,_,x),_=x-1;break}break;case 14:if(d=this._dcsParser.unhook(C!==24&&C!==26),d)return this._preserveStack(6,[],0,g,_),d;C===27&&(g|=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 x=_+1;;x++)if(x>=i||(C=r[x])<32||C>127&&C<v){this._oscParser.put(r,_,x),_=x-1;break}break;case 6:if(d=this._oscParser.end(C!==24&&C!==26),d)return this._preserveStack(5,[],0,g,_),d;C===27&&(g|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&g}}}t.EscapeSequenceParser=o},6242:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),c=a(482),s=[];t.OscParser=class{constructor(){this._state=0,this._active=s,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(l,f){this._handlers[l]===void 0&&(this._handlers[l]=[]);const v=this._handlers[l];return v.push(f),{dispose:()=>{const o=v.indexOf(f);o!==-1&&v.splice(o,1)}}}clearHandler(l){this._handlers[l]&&delete this._handlers[l]}setHandlerFallback(l){this._handlerFb=l}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=s}reset(){if(this._state===2)for(let l=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;l>=0;--l)this._active[l].end(!1);this._stack.paused=!1,this._active=s,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||s,this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].start();else this._handlerFb(this._id,"START")}_put(l,f,v){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(l,f,v);else this._handlerFb(this._id,"PUT",(0,c.utf32ToString)(l,f,v))}start(){this.reset(),this._state=1}put(l,f,v){if(this._state!==3){if(this._state===1)for(;f<v;){const o=l[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(l,f,v)}}end(l,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(l),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",l);this._active=s,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(l){this._handler=l,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(l,f,v){this._hitLimit||(this._data+=(0,c.utf32ToString)(l,f,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(l){let f=!1;if(this._hitLimit)f=!1;else if(l&&(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:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(s){const l=new h;if(!s.length)return l;for(let f=Array.isArray(s[0])?1:0;f<s.length;++f){const v=s[f];if(Array.isArray(v))for(let o=0;o<v.length;++o)l.addSubParam(v[o]);else l.addParam(v)}return l}constructor(s=32,l=32){if(this.maxLength=s,this.maxSubParamsLength=l,l>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(l),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const s=new h(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){const s=[];for(let l=0;l<this.length;++l){s.push(this.params[l]);const f=this._subParamsIdx[l]>>8,v=255&this._subParamsIdx[l];v-f>0&&s.push(Array.prototype.slice.call(this._subParams,f,v))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>a?a:s}}addSubParam(s){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>a?a:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(255&this._subParamsIdx[s])-(this._subParamsIdx[s]>>8)>0}getSubParams(s){const l=this._subParamsIdx[s]>>8,f=255&this._subParamsIdx[s];return f-l>0?this._subParams.subarray(l,f):null}getSubParamsAll(){const s={};for(let l=0;l<this.length;++l){const f=this._subParamsIdx[l]>>8,v=255&this._subParamsIdx[l];v-f>0&&(s[l]=this._subParams.slice(f,v))}return s}addDigit(s){let l;if(this._rejectDigits||!(l=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const f=this._digitIsSub?this._subParams:this.params,v=f[l-1];f[l-1]=~v?Math.min(10*v+s,a):s}}t.Params=h},5741:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,h){const c={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(c),h.dispose=()=>this._wrappedAddonDispose(c),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let c=0;c<this._addons.length;c++)if(this._addons[c]===a){h=c;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),c=a(511);t.BufferApiView=class{constructor(s,l){this._buffer=s,this.type=l}init(s){return this._buffer=s,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(s){const l=this._buffer.lines.get(s);if(l)return new h.BufferLineApiView(l)}getNullCell(){return new c.CellData}}},3785:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(c){this._line=c}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(c,s){if(!(c<0||c>=this._line.length))return s?(this._line.loadCell(c,s),s):this._line.loadCell(c,new h.CellData)}translateToString(c,s,l){return this._line.translateToString(c,s,l)}}},8285:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),c=a(8460),s=a(844);class l extends s.Disposable{constructor(v){super(),this._core=v,this._onBufferChange=this.register(new c.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=l},7975:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,c=>h(c.toArray()))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,(c,s)=>h(c,s.toArray()))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(A,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(A,t,a){var h=this&&this.__decorate||function(e,r,i,n){var d,C=arguments.length,g=C<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,r,i,n);else for(var b=e.length-1;b>=0;b--)(d=e[b])&&(g=(C<3?d(g):C>3?d(r,i,g):d(r,i))||g);return C>3&&g&&Object.defineProperty(r,i,g),g},c=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const s=a(8460),l=a(844),f=a(5295),v=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends l.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new f.BufferSet(e,this))}resize(e,r){this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){const i=this.buffer;let n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=i.getBlankLine(e,r),this._cachedBlankLine=n),n.isWrapped=r;const d=i.ybase+i.scrollTop,C=i.ybase+i.scrollBottom;if(i.scrollTop===0){const g=i.lines.isFull;C===i.lines.length-1?g?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(C+1,0,n.clone()),g?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const g=C-d+1;i.lines.shiftElements(d+1,g-1,-1),i.lines.set(C,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,r,i){const n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const d=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),d!==n.ydisp&&(r||this._onScroll.fire(n.ydisp))}};t.BufferService=o=h([c(0,v.IOptionsService)],o)},7994:(A,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(A,t,a){var h=this&&this.__decorate||function(n,d,C,g){var b,_=arguments.length,S=_<3?d:g===null?g=Object.getOwnPropertyDescriptor(d,C):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,d,C,g);else for(var w=n.length-1;w>=0;w--)(b=n[w])&&(S=(_<3?b(S):_>3?b(d,C,S):b(d,C))||S);return _>3&&S&&Object.defineProperty(d,C,S),S},c=this&&this.__param||function(n,d){return function(C,g){d(C,g,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const s=a(2585),l=a(8460),f=a(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:n=>n.button!==4&&n.action===1&&(n.ctrl=!1,n.alt=!1,n.shift=!1,!0)},VT200:{events:19,restrict:n=>n.action!==32},DRAG:{events:23,restrict:n=>n.action!==32||n.button!==3},ANY:{events:31,restrict:n=>!0}};function o(n,d){let C=(n.ctrl?16:0)|(n.shift?4:0)|(n.alt?8:0);return n.button===4?(C|=64,C|=n.action):(C|=3&n.button,4&n.button&&(C|=64),8&n.button&&(C|=128),n.action===32?C|=32:n.action!==0||d||(C|=3)),C}const e=String.fromCharCode,r={DEFAULT:n=>{const d=[o(n,!1)+32,n.col+32,n.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${e(d[0])}${e(d[1])}${e(d[2])}`},SGR:n=>{const d=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.col};${n.row}${d}`},SGR_PIXELS:n=>{const d=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.x};${n.y}${d}`}};let i=t.CoreMouseService=class extends f.Disposable{constructor(n,d){super(),this._bufferService=n,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new l.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const C of Object.keys(v))this.addProtocol(C,v[C]);for(const C of Object.keys(r))this.addEncoding(C,r[C]);this.reset()}addProtocol(n,d){this._protocols[n]=d}addEncoding(n,d){this._encodings[n]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(n){if(!this._protocols[n])throw new Error(`unknown protocol "${n}"`);this._activeProtocol=n,this._onProtocolChange.fire(this._protocols[n].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(n){if(!this._encodings[n])throw new Error(`unknown encoding "${n}"`);this._activeEncoding=n}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(n){if(n.col<0||n.col>=this._bufferService.cols||n.row<0||n.row>=this._bufferService.rows||n.button===4&&n.action===32||n.button===3&&n.action!==32||n.button!==4&&(n.action===2||n.action===3)||(n.col++,n.row++,n.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,n,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(n))return!1;const d=this._encodings[this._activeEncoding](n);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=n,!0}explainEvents(n){return{down:!!(1&n),up:!!(2&n),drag:!!(4&n),move:!!(8&n),wheel:!!(16&n)}}_equalEvents(n,d,C){if(C){if(n.x!==d.x||n.y!==d.y)return!1}else if(n.col!==d.col||n.row!==d.row)return!1;return n.button===d.button&&n.action===d.action&&n.ctrl===d.ctrl&&n.alt===d.alt&&n.shift===d.shift}};t.CoreMouseService=i=h([c(0,s.IBufferService),c(1,s.ICoreService)],i)},6975:function(A,t,a){var h=this&&this.__decorate||function(i,n,d,C){var g,b=arguments.length,_=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,d):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(i,n,d,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(_=(b<3?g(_):b>3?g(n,d,_):g(n,d))||_);return b>3&&_&&Object.defineProperty(n,d,_),_},c=this&&this.__param||function(i,n){return function(d,C){n(d,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const s=a(1439),l=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 r=t.CoreService=class extends f.Disposable{constructor(i,n,d){super(),this._bufferService=i,this._logService=n,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new l.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new l.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new l.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new l.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}reset(){this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}triggerDataEvent(i,n=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),n&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(C=>C.charCodeAt(0))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,()=>i.split("").map(n=>n.charCodeAt(0))),this._onBinary.fire(i))}};t.CoreService=r=h([c(0,v.IBufferService),c(1,v.ILogService),c(2,v.IOptionsService)],r)},9074:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),c=a(8460),s=a(844),l=a(6106);let f=0,v=0;class o extends s.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new l.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new c.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new c.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,s.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const n=new e(i);if(n){const d=n.marker.onDispose(()=>n.dispose());n.onDispose(()=>{n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),d.dispose())}),this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,n,d){let C=0,g=0;for(const b of this._decorations.getKeyIterator(n))C=b.options.x??0,g=C+(b.options.width??1),i>=C&&i<g&&(!d||(b.options.layer??"bottom")===d)&&(yield b)}forEachDecorationAtCell(i,n,d,C){this._decorations.forEachByKey(n,g=>{f=g.options.x??0,v=f+(g.options.width??1),i>=f&&i<v&&(!d||(g.options.layer??"bottom")===d)&&C(g)})}}t.DecorationService=o;class e extends s.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new c.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),c=a(8343);class s{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=s,t.InstantiationService=class{constructor(){this._services=new s,this._services.set(h.IInstantiationService,this)}setService(l,f){this._services.set(l,f)}getService(l){return this._services.get(l)}createInstance(l,...f){const v=(0,c.getServiceDependencies)(l).sort((r,i)=>r.index-i.index),o=[];for(const r of v){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${l.name} depends on UNKNOWN service ${r.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 ${l.name} at position ${e+1} conflicts with ${f.length} static arguments`);return new l(...f,...o)}}},7866:function(A,t,a){var h=this&&this.__decorate||function(e,r,i,n){var d,C=arguments.length,g=C<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,r,i,n);else for(var b=e.length-1;b>=0;b--)(d=e[b])&&(g=(C<3?d(g):C>3?d(r,i,g):d(r,i))||g);return C>3&&g&&Object.defineProperty(r,i,g),g},c=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(844),l=a(2585),f={trace:l.LogLevelEnum.TRACE,debug:l.LogLevelEnum.DEBUG,info:l.LogLevelEnum.INFO,warn:l.LogLevelEnum.WARN,error:l.LogLevelEnum.ERROR,off:l.LogLevelEnum.OFF};let v,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=l.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 r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=l.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=l.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=l.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=l.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=l.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([c(0,l.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(...d){if(v.logLevel!==l.LogLevelEnum.TRACE)return n.apply(this,d);v.trace(`GlyphRenderer#${n.name}(${d.map(g=>JSON.stringify(g)).join(", ")})`);const C=n.apply(this,d);return v.trace(`GlyphRenderer#${n.name} return`,C),C}}},7302:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),c=a(844),s=a(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:s.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const l=["normal","bold","100","200","300","400","500","600","700","800","900"];class f extends c.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const r in o)if(r in e)try{const i=o[r];e[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,c.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(r=>{r===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(r=>{o.indexOf(r)!==-1&&e()})}_setupOptions(){const o=r=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},e=(r,i)=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(const r in this.rawOptions){const i={get:o.bind(this,r),set:e.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(r){return r==="block"||r==="underline"||r==="bar"}(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=l.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(A,t,a){var h=this&&this.__decorate||function(f,v,o,e){var r,i=arguments.length,n=i<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(f,v,o,e);else for(var d=f.length-1;d>=0;d--)(r=f[d])&&(n=(i<3?r(n):i>3?r(v,o,n):r(v,o))||n);return i>3&&n&&Object.defineProperty(v,o,n),n},c=this&&this.__param||function(f,v){return function(o,e){v(o,e,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const s=a(2585);let l=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 d=v.addMarker(v.ybase+v.y),C={data:f,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(C,d)),this._dataByLinkId.set(C.id,C),C.id}const o=f,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,v.ybase+v.y),r.id;const i=v.addMarker(v.ybase+v.y),n={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(n,i)),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(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=l=h([c(0,s.IBufferService)],l)},8343:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(c){return c[h]||[]},t.createDecorator=function(c){if(t.serviceRegistry.has(c))return t.serviceRegistry.get(c);const s=function(l,f,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(s,l,v)};return s.toString=()=>c,t.serviceRegistry.set(c,s),s}},2585:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(8343);var c;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(c||(t.LogLevelEnum=c={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),c=a(225);class s{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,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 c.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 r=0;r<e;++r){let i=f.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return v+this.wcwidth(i);const C=f.charCodeAt(r);56320<=C&&C<=57343?i=1024*(i-55296)+C-56320+65536:v+=this.wcwidth(C)}const n=this.charProperties(i,o);let d=s.extractWidth(n);s.extractShouldJoin(n)&&(d-=s.extractWidth(o)),v+=d,o=n}return v}charProperties(f,v){return this._activeProvider.charProperties(f,v)}}t.UnicodeService=s}},y={};function k(A){var t=y[A];if(t!==void 0)return t.exports;var a=y[A]={exports:{}};return m[A].call(a.exports,a,a.exports,k),a.exports}var O={};return(()=>{var A=O;Object.defineProperty(A,"__esModule",{value:!0}),A.Terminal=void 0;const t=k(9042),a=k(3236),h=k(844),c=k(5741),s=k(8285),l=k(7975),f=k(7090),v=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};const i=d=>this._core.options[d],n=(d,C)=>{this._checkReadonlyOptions(d),this._core.options[d]=C};for(const d in this._core.options){const C={get:i.bind(this,d),set:n.bind(this,d)};Object.defineProperty(this._publicOptions,d,C)}}_checkReadonlyOptions(r){if(v.includes(r))throw new Error(`Option "${r}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const r=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:r.applicationCursorKeys,applicationKeypadMode:r.applicationKeypad,bracketedPasteMode:r.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:r.origin,reverseWraparoundMode:r.reverseWraparound,sendFocusMode:r.sendFocus,wraparoundMode:r.wraparound}}get options(){return this._publicOptions}set options(r){for(const i in r)this._publicOptions[i]=r[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(r,i=!0){this._core.input(r,i)}resize(r,i){this._verifyIntegers(r,i),this._core.resize(r,i)}open(r){this._core.open(r)}attachCustomKeyEventHandler(r){this._core.attachCustomKeyEventHandler(r)}attachCustomWheelEventHandler(r){this._core.attachCustomWheelEventHandler(r)}registerLinkProvider(r){return this._core.registerLinkProvider(r)}registerCharacterJoiner(r){return this._checkProposedApi(),this._core.registerCharacterJoiner(r)}deregisterCharacterJoiner(r){this._checkProposedApi(),this._core.deregisterCharacterJoiner(r)}registerMarker(r=0){return this._verifyIntegers(r),this._core.registerMarker(r)}registerDecoration(r){return this._checkProposedApi(),this._verifyPositiveIntegers(r.x??0,r.width??0,r.height??0),this._core.registerDecoration(r)}hasSelection(){return this._core.hasSelection()}select(r,i,n){this._verifyIntegers(r,i,n),this._core.select(r,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(r,i){this._verifyIntegers(r,i),this._core.selectLines(r,i)}dispose(){super.dispose()}scrollLines(r){this._verifyIntegers(r),this._core.scrollLines(r)}scrollPages(r){this._verifyIntegers(r),this._core.scrollPages(r)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(r){this._verifyIntegers(r),this._core.scrollToLine(r)}clear(){this._core.clear()}write(r,i){this._core.write(r,i)}writeln(r,i){this._core.write(r),this._core.write(`\r
|
|
23
|
-
`,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}A.Terminal=o})(),
|
|
21
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(f){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),r.isLinux&&f&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(f){const S=this._getMouseBufferCoords(f),w=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!!(w&&R&&S)&&this._areCoordsInSelection(S,w,R)}isCellInSelection(f,S){const w=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!(!w||!R)&&this._areCoordsInSelection([f,S],w,R)}_areCoordsInSelection(f,S,w){return f[1]>S[1]&&f[1]<w[1]||S[1]===w[1]&&f[1]===S[1]&&f[0]>=S[0]&&f[0]<w[0]||S[1]<w[1]&&f[1]===w[1]&&f[0]<w[0]||S[1]<w[1]&&f[1]===S[1]&&f[0]>=S[0]}_selectWordAtCursor(f,S){var L,k;const w=(k=(L=this._linkifier.currentLink)==null?void 0:L.link)==null?void 0:k.range;if(w)return this._model.selectionStart=[w.start.x-1,w.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(w,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const R=this._getMouseBufferCoords(f);return!!R&&(this._selectWordAt(R,S),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(f,S){this._model.clearSelection(),f=Math.max(f,0),S=Math.min(S,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,f],this._model.selectionEnd=[this._bufferService.cols,S],this.refresh(),this._onSelectionChange.fire()}_handleTrim(f){this._model.handleTrim(f)&&this.refresh()}_getMouseBufferCoords(f){const S=this._mouseService.getCoords(f,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(S)return S[0]--,S[1]--,S[1]+=this._bufferService.buffer.ydisp,S}_getMouseEventScrollAmount(f){let S=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,f,this._screenElement)[1];const w=this._renderService.dimensions.css.canvas.height;return S>=0&&S<=w?0:(S>w&&(S-=w),S=Math.min(Math.max(S,-50),50),S/=50,S/Math.abs(S)+Math.round(14*S))}shouldForceSelection(f){return r.isMac?f.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:f.shiftKey}handleMouseDown(f){if(this._mouseDownTimeStamp=f.timeStamp,(f.button!==2||!this.hasSelection)&&f.button===0){if(!this._enabled){if(!this.shouldForceSelection(f))return;f.stopPropagation()}f.preventDefault(),this._dragScrollAmount=0,this._enabled&&f.shiftKey?this._handleIncrementalClick(f):f.detail===1?this._handleSingleClick(f):f.detail===2?this._handleDoubleClick(f):f.detail===3&&this._handleTripleClick(f),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(f){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(f))}_handleSingleClick(f){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(f)?3:0,this._model.selectionStart=this._getMouseBufferCoords(f),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const S=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);S&&S.length!==this._model.selectionStart[0]&&S.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(f){this._selectWordAtCursor(f,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(f){const S=this._getMouseBufferCoords(f);S&&(this._activeSelectionMode=2,this._selectLineAt(S[1]))}shouldColumnSelect(f){return f.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(f){if(f.stopImmediatePropagation(),!this._model.selectionStart)return;const S=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(f),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(f),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const w=this._bufferService.buffer;if(this._model.selectionEnd[1]<w.lines.length){const R=w.lines.get(this._model.selectionEnd[1]);R&&R.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}S&&S[0]===this._model.selectionEnd[0]&&S[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const f=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(f.ydisp+this._bufferService.rows,f.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=f.ydisp),this.refresh()}}_handleMouseUp(f){const S=f.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&S<500&&f.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const w=this._mouseService.getCoords(f,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(w&&w[0]!==void 0&&w[1]!==void 0){const R=(0,c.moveToCellSequence)(w[0]-1,w[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(R,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const f=this._model.finalSelectionStart,S=this._model.finalSelectionEnd,w=!(!f||!S||f[0]===S[0]&&f[1]===S[1]);w?f&&S&&(this._oldSelectionStart&&this._oldSelectionEnd&&f[0]===this._oldSelectionStart[0]&&f[1]===this._oldSelectionStart[1]&&S[0]===this._oldSelectionEnd[0]&&S[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(f,S,w)):this._oldHasSelection&&this._fireOnSelectionChange(f,S,w)}_fireOnSelectionChange(f,S,w){this._oldSelectionStart=f,this._oldSelectionEnd=S,this._oldHasSelection=w,this._onSelectionChange.fire()}_handleBufferActivate(f){this.clearSelection(),this._trimListener.dispose(),this._trimListener=f.activeBuffer.lines.onTrim(S=>this._handleTrim(S))}_convertViewportColToCharacterIndex(f,S){let w=S;for(let R=0;S>=R;R++){const L=f.loadCell(R,this._workCell).getChars().length;this._workCell.getWidth()===0?w--:L>1&&S!==R&&(w+=L-1)}return w}setSelection(f,S,w){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[f,S],this._model.selectionStartLength=w,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(f){this._isClickInSelection(f)||(this._selectWordAtCursor(f,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(f,S,w=!0,R=!0){if(f[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,k=L.lines.get(f[1]);if(!k)return;const T=L.translateBufferLineToString(f[1],!1);let F=this._convertViewportColToCharacterIndex(k,f[0]),$=F;const N=f[0]-F;let H=0,E=0,M=0,I=0;if(T.charAt(F)===" "){for(;F>0&&T.charAt(F-1)===" ";)F--;for(;$<T.length&&T.charAt($+1)===" ";)$++}else{let q=f[0],Y=f[0];k.getWidth(q)===0&&(H++,q--),k.getWidth(Y)===2&&(E++,Y++);const G=k.getString(Y).length;for(G>1&&(I+=G-1,$+=G-1);q>0&&F>0&&!this._isCharWordSeparator(k.loadCell(q-1,this._workCell));){k.loadCell(q-1,this._workCell);const O=this._workCell.getChars().length;this._workCell.getWidth()===0?(H++,q--):O>1&&(M+=O-1,F-=O-1),F--,q--}for(;Y<k.length&&$+1<T.length&&!this._isCharWordSeparator(k.loadCell(Y+1,this._workCell));){k.loadCell(Y+1,this._workCell);const O=this._workCell.getChars().length;this._workCell.getWidth()===2?(E++,Y++):O>1&&(I+=O-1,$+=O-1),$++,Y++}}$++;let P=F+N-H+M,U=Math.min(this._bufferService.cols,$-F+H+E-M-I);if(S||T.slice(F,$).trim()!==""){if(w&&P===0&&k.getCodePoint(0)!==32){const q=L.lines.get(f[1]-1);if(q&&k.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,f[1]-1],!1,!0,!1);if(Y){const G=this._bufferService.cols-Y.start;P-=G,U+=G}}}if(R&&P+U===this._bufferService.cols&&k.getCodePoint(this._bufferService.cols-1)!==32){const q=L.lines.get(f[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const Y=this._getWordAt([0,f[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:P,length:U}}}_selectWordAt(f,S){const w=this._getWordAt(f,S);if(w){for(;w.start<0;)w.start+=this._bufferService.cols,f[1]--;this._model.selectionStart=[w.start,f[1]],this._model.selectionStartLength=w.length}}_selectToWordAt(f){const S=this._getWordAt(f,!0);if(S){let w=f[1];for(;S.start<0;)S.start+=this._bufferService.cols,w--;if(!this._model.areSelectionValuesReversed())for(;S.start+S.length>this._bufferService.cols;)S.length-=this._bufferService.cols,w++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?S.start:S.start+S.length,w]}}_isCharWordSeparator(f){return f.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(f.getChars())>=0}_selectLineAt(f){const S=this._bufferService.buffer.getWrappedRangeForLine(f),w={start:{x:0,y:S.first},end:{x:this._bufferService.cols-1,y:S.last}};this._model.selectionStart=[0,S.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(w,this._bufferService.cols)}};t.SelectionService=b=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)],b)},4725:(A,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(A,t,a){var h=this&&this.__decorate||function(b,f,S,w){var R,L=arguments.length,k=L<3?f:w===null?w=Object.getOwnPropertyDescriptor(f,S):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(b,f,S,w);else for(var T=b.length-1;T>=0;T--)(R=b[T])&&(k=(L<3?R(k):L>3?R(f,S,k):R(f,S))||k);return L>3&&k&&Object.defineProperty(f,S,k),k},l=this&&this.__param||function(b,f){return function(S,w){f(S,w,b)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const s=a(7239),c=a(8055),p=a(8460),v=a(844),o=a(2585),e=c.css.toColor("#ffffff"),r=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),n=c.css.toColor("#000000"),u={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const b=[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")],f=[0,95,135,175,215,255];for(let S=0;S<216;S++){const w=f[S/36%6|0],R=f[S/6%6|0],L=f[S%6];b.push({css:c.channels.toCss(w,R,L),rgba:c.channels.toRgba(w,R,L)})}for(let S=0;S<24;S++){const w=8+10*S;b.push({css:c.channels.toCss(w,w,w),rgba:c.channels.toRgba(w,w,w)})}return b})());let C=t.ThemeService=class extends v.Disposable{get colors(){return this._colors}constructor(b){super(),this._optionsService=b,this._contrastCache=new s.ColorContrastCache,this._halfContrastCache=new s.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:n,selectionForeground:void 0,selectionBackgroundTransparent:u,selectionBackgroundOpaque:c.color.blend(r,u),selectionInactiveBackgroundTransparent:u,selectionInactiveBackgroundOpaque:c.color.blend(r,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(b={}){const f=this._colors;if(f.foreground=g(b.foreground,e),f.background=g(b.background,r),f.cursor=g(b.cursor,i),f.cursorAccent=g(b.cursorAccent,n),f.selectionBackgroundTransparent=g(b.selectionBackground,u),f.selectionBackgroundOpaque=c.color.blend(f.background,f.selectionBackgroundTransparent),f.selectionInactiveBackgroundTransparent=g(b.selectionInactiveBackground,f.selectionBackgroundTransparent),f.selectionInactiveBackgroundOpaque=c.color.blend(f.background,f.selectionInactiveBackgroundTransparent),f.selectionForeground=b.selectionForeground?g(b.selectionForeground,c.NULL_COLOR):void 0,f.selectionForeground===c.NULL_COLOR&&(f.selectionForeground=void 0),c.color.isOpaque(f.selectionBackgroundTransparent)&&(f.selectionBackgroundTransparent=c.color.opacity(f.selectionBackgroundTransparent,.3)),c.color.isOpaque(f.selectionInactiveBackgroundTransparent)&&(f.selectionInactiveBackgroundTransparent=c.color.opacity(f.selectionInactiveBackgroundTransparent,.3)),f.ansi=t.DEFAULT_ANSI_COLORS.slice(),f.ansi[0]=g(b.black,t.DEFAULT_ANSI_COLORS[0]),f.ansi[1]=g(b.red,t.DEFAULT_ANSI_COLORS[1]),f.ansi[2]=g(b.green,t.DEFAULT_ANSI_COLORS[2]),f.ansi[3]=g(b.yellow,t.DEFAULT_ANSI_COLORS[3]),f.ansi[4]=g(b.blue,t.DEFAULT_ANSI_COLORS[4]),f.ansi[5]=g(b.magenta,t.DEFAULT_ANSI_COLORS[5]),f.ansi[6]=g(b.cyan,t.DEFAULT_ANSI_COLORS[6]),f.ansi[7]=g(b.white,t.DEFAULT_ANSI_COLORS[7]),f.ansi[8]=g(b.brightBlack,t.DEFAULT_ANSI_COLORS[8]),f.ansi[9]=g(b.brightRed,t.DEFAULT_ANSI_COLORS[9]),f.ansi[10]=g(b.brightGreen,t.DEFAULT_ANSI_COLORS[10]),f.ansi[11]=g(b.brightYellow,t.DEFAULT_ANSI_COLORS[11]),f.ansi[12]=g(b.brightBlue,t.DEFAULT_ANSI_COLORS[12]),f.ansi[13]=g(b.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),f.ansi[14]=g(b.brightCyan,t.DEFAULT_ANSI_COLORS[14]),f.ansi[15]=g(b.brightWhite,t.DEFAULT_ANSI_COLORS[15]),b.extendedAnsi){const S=Math.min(f.ansi.length-16,b.extendedAnsi.length);for(let w=0;w<S;w++)f.ansi[w+16]=g(b.extendedAnsi[w],t.DEFAULT_ANSI_COLORS[w+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(b){this._restoreColor(b),this._onChangeColors.fire(this.colors)}_restoreColor(b){if(b!==void 0)switch(b){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[b]=this._restoreColors.ansi[b]}else for(let f=0;f<this._restoreColors.ansi.length;++f)this._colors.ansi[f]=this._restoreColors.ansi[f]}modifyColors(b){b(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(b,f){if(b!==void 0)try{return c.css.toColor(b)}catch{}return f}t.ThemeService=C=h([l(0,o.IOptionsService)],C)},6349:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class s extends l.Disposable{constructor(p){super(),this._maxLength=p,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(p){if(this._maxLength===p)return;const v=new Array(p);for(let o=0;o<Math.min(p,this.length);o++)v[o]=this._array[this._getCyclicIndex(o)];this._array=v,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let v=this._length;v<p;v++)this._array[v]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,v){this._array[this._getCyclicIndex(p)]=v}push(p){this._array[this._getCyclicIndex(this._length)]=p,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(p,v,...o){if(v){for(let e=p;e<this._length-v;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+v)];this._length-=v,this.onDeleteEmitter.fire({index:p,amount:v})}for(let e=this._length-1;e>=p;e--)this._array[this._getCyclicIndex(e+o.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<o.length;e++)this._array[this._getCyclicIndex(p+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:p,amount:o.length}),this._length+o.length>this._maxLength){const e=this._length+o.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=o.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,v,o){if(!(v<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let r=v-1;r>=0;r--)this.set(p+r+o,this.get(p+r));const e=p+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(p+e+o,this.get(p+e))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}t.CircularList=s},1439:(A,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 s=Array.isArray(h)?[]:{};for(const c in h)s[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return s}},8055:(A,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,s=0;var c,p,v,o,e;function r(n){const u=n.toString(16);return u.length<2?"0"+u:u}function i(n,u){return n<u?(u+.05)/(n+.05):(n+.05)/(u+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(n){n.toCss=function(u,C,g,b){return b!==void 0?`#${r(u)}${r(C)}${r(g)}${r(b)}`:`#${r(u)}${r(C)}${r(g)}`},n.toRgba=function(u,C,g,b=255){return(u<<24|C<<16|g<<8|b)>>>0},n.toColor=function(u,C,g,b){return{css:n.toCss(u,C,g,b),rgba:n.toRgba(u,C,g,b)}}}(c||(t.channels=c={})),function(n){function u(C,g){return s=Math.round(255*g),[a,h,l]=e.toChannels(C.rgba),{css:c.toCss(a,h,l,s),rgba:c.toRgba(a,h,l,s)}}n.blend=function(C,g){if(s=(255&g.rgba)/255,s===1)return{css:g.css,rgba:g.rgba};const b=g.rgba>>24&255,f=g.rgba>>16&255,S=g.rgba>>8&255,w=C.rgba>>24&255,R=C.rgba>>16&255,L=C.rgba>>8&255;return a=w+Math.round((b-w)*s),h=R+Math.round((f-R)*s),l=L+Math.round((S-L)*s),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},n.isOpaque=function(C){return(255&C.rgba)==255},n.ensureContrastRatio=function(C,g,b){const f=e.ensureContrastRatio(C.rgba,g.rgba,b);if(f)return c.toColor(f>>24&255,f>>16&255,f>>8&255)},n.opaque=function(C){const g=(255|C.rgba)>>>0;return[a,h,l]=e.toChannels(g),{css:c.toCss(a,h,l),rgba:g}},n.opacity=u,n.multiplyOpacity=function(C,g){return s=255&C.rgba,u(C,s*g/255)},n.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}}(p||(t.color=p={})),function(n){let u,C;try{const g=document.createElement("canvas");g.width=1,g.height=1;const b=g.getContext("2d",{willReadFrequently:!0});b&&(u=b,u.globalCompositeOperation="copy",C=u.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),l=parseInt(g.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),l=parseInt(g.slice(3,4).repeat(2),16),s=parseInt(g.slice(4,5).repeat(2),16),c.toColor(a,h,l,s);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}const b=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(b)return a=parseInt(b[1]),h=parseInt(b[2]),l=parseInt(b[3]),s=Math.round(255*(b[5]===void 0?1:parseFloat(b[5]))),c.toColor(a,h,l,s);if(!u||!C)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=C,u.fillStyle=g,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,h,l,s]=u.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,s),css:g}}}(v||(t.css=v={})),function(n){function u(C,g,b){const f=C/255,S=g/255,w=b/255;return .2126*(f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4))+.7152*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}n.relativeLuminance=function(C){return u(C>>16&255,C>>8&255,255&C)},n.relativeLuminance2=u}(o||(t.rgb=o={})),function(n){function u(g,b,f){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,k=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));for(;F<f&&(L>0||k>0||T>0);)L-=Math.max(0,Math.ceil(.1*L)),k-=Math.max(0,Math.ceil(.1*k)),T-=Math.max(0,Math.ceil(.1*T)),F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));return(L<<24|k<<16|T<<8|255)>>>0}function C(g,b,f){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,k=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));for(;F<f&&(L<255||k<255||T<255);)L=Math.min(255,L+Math.ceil(.1*(255-L))),k=Math.min(255,k+Math.ceil(.1*(255-k))),T=Math.min(255,T+Math.ceil(.1*(255-T))),F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));return(L<<24|k<<16|T<<8|255)>>>0}n.blend=function(g,b){if(s=(255&b)/255,s===1)return b;const f=b>>24&255,S=b>>16&255,w=b>>8&255,R=g>>24&255,L=g>>16&255,k=g>>8&255;return a=R+Math.round((f-R)*s),h=L+Math.round((S-L)*s),l=k+Math.round((w-k)*s),c.toRgba(a,h,l)},n.ensureContrastRatio=function(g,b,f){const S=o.relativeLuminance(g>>8),w=o.relativeLuminance(b>>8);if(i(S,w)<f){if(w<S){const k=u(g,b,f),T=i(S,o.relativeLuminance(k>>8));if(T<f){const F=C(g,b,f);return T>i(S,o.relativeLuminance(F>>8))?k:F}return k}const R=C(g,b,f),L=i(S,o.relativeLuminance(R>>8));if(L<f){const k=u(g,b,f);return L>i(S,o.relativeLuminance(k>>8))?R:k}return R}},n.reduceLuminance=u,n.increaseLuminance=C,n.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),s=a(4348),c=a(7866),p=a(744),v=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),n=a(7994),u=a(9282),C=a(5435),g=a(5981),b=a(2660);let f=!1;class S extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event(R=>{var L;(L=this._onScrollApi)==null||L.fire(R.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(R){for(const L in R)this.optionsService.options[L]=R[L]}constructor(R){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new s.InstantiationService,this.optionsService=this.register(new v.OptionsService(R)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(r.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(n.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.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(L=>{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(L=>{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 g.WriteBuffer((L,k)=>this._inputHandler.parse(L,k))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(R,L){this._writeBuffer.write(R,L)}writeSync(R,L){this._logService.logLevel<=l.LogLevelEnum.WARN&&!f&&(this._logService.warn("writeSync is unreliable and will be removed soon."),f=!0),this._writeBuffer.writeSync(R,L)}input(R,L=!0){this.coreService.triggerDataEvent(R,L)}resize(R,L){isNaN(R)||isNaN(L)||(R=Math.max(R,p.MINIMUM_COLS),L=Math.max(L,p.MINIMUM_ROWS),this._bufferService.resize(R,L))}scroll(R,L=!1){this._bufferService.scroll(R,L)}scrollLines(R,L,k){this._bufferService.scrollLines(R,L,k)}scrollPages(R){this.scrollLines(R*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(R){const L=R-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(R,L){return this._inputHandler.registerEscHandler(R,L)}registerDcsHandler(R,L){return this._inputHandler.registerDcsHandler(R,L)}registerCsiHandler(R,L){return this._inputHandler.registerCsiHandler(R,L)}registerOscHandler(R,L){return this._inputHandler.registerOscHandler(R,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let R=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?R=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(R=!0),R?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const R=[];R.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),R.push(this.registerCsiHandler({final:"H"},()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const L of R)L.dispose()})}}}t.CoreTerminal=S},8460:(A,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 s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,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(A,t,a){var h=this&&this.__decorate||function(H,E,M,I){var P,U=arguments.length,q=U<3?E:I===null?I=Object.getOwnPropertyDescriptor(E,M):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(H,E,M,I);else for(var Y=H.length-1;Y>=0;Y--)(P=H[Y])&&(q=(U<3?P(q):U>3?P(E,M,q):P(E,M))||q);return U>3&&q&&Object.defineProperty(E,M,q),q},l=this&&this.__param||function(H,E){return function(M,I){E(M,I,H)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const s=a(2584),c=a(7116),p=a(2015),v=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),n=a(511),u=a(3734),C=a(2585),g=a(1480),b=a(6242),f=a(6351),S=a(5941),w={"(":0,")":1,"*":2,"+":3,"-":1,".":2},R=131072;function L(H,E){if(H>24)return E.setWinLines||!1;switch(H){case 1:return!!E.restoreWin;case 2:return!!E.minimizeWin;case 3:return!!E.setWinPosition;case 4:return!!E.setWinSizePixels;case 5:return!!E.raiseWin;case 6:return!!E.lowerWin;case 7:return!!E.refreshWin;case 8:return!!E.setWinSizeChars;case 9:return!!E.maximizeWin;case 10:return!!E.fullscreenWin;case 11:return!!E.getWinState;case 13:return!!E.getWinPosition;case 14:return!!E.getWinSizePixels;case 15:return!!E.getScreenSizePixels;case 16:return!!E.getCellSizePixels;case 18:return!!E.getWinSizeChars;case 19:return!!E.getScreenSizeChars;case 20:return!!E.getIconTitle;case 21:return!!E.getWinTitle;case 22:return!!E.pushTitle;case 23:return!!E.popTitle;case 24:return!!E.setWinLines}return!1}var k;(function(H){H[H.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",H[H.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(k||(t.WindowsOptionsReportType=k={}));let T=0;class F extends v.Disposable{getAttrData(){return this._curAttrData}constructor(E,M,I,P,U,q,Y,G,O=new p.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=M,this._coreService=I,this._logService=P,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=Y,this._unicodeService=G,this._parser=O,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new n.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new r.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new r.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new r.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new r.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new r.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new r.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new r.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new r.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new r.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new r.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new r.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(D=>this._activeBuffer=D.activeBuffer)),this._parser.setCsiHandlerFallback((D,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:z.toArray()})}),this._parser.setEscHandlerFallback(D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})}),this._parser.setExecuteHandlerFallback(D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})}),this._parser.setOscHandlerFallback((D,z,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:z,data:W})}),this._parser.setDcsHandlerFallback((D,z,W)=>{z==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:z,payload:W})}),this._parser.setPrintHandler((D,z,W)=>this.print(D,z,W)),this._parser.registerCsiHandler({final:"@"},D=>this.insertChars(D)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},D=>this.scrollLeft(D)),this._parser.registerCsiHandler({final:"A"},D=>this.cursorUp(D)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},D=>this.scrollRight(D)),this._parser.registerCsiHandler({final:"B"},D=>this.cursorDown(D)),this._parser.registerCsiHandler({final:"C"},D=>this.cursorForward(D)),this._parser.registerCsiHandler({final:"D"},D=>this.cursorBackward(D)),this._parser.registerCsiHandler({final:"E"},D=>this.cursorNextLine(D)),this._parser.registerCsiHandler({final:"F"},D=>this.cursorPrecedingLine(D)),this._parser.registerCsiHandler({final:"G"},D=>this.cursorCharAbsolute(D)),this._parser.registerCsiHandler({final:"H"},D=>this.cursorPosition(D)),this._parser.registerCsiHandler({final:"I"},D=>this.cursorForwardTab(D)),this._parser.registerCsiHandler({final:"J"},D=>this.eraseInDisplay(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},D=>this.eraseInDisplay(D,!0)),this._parser.registerCsiHandler({final:"K"},D=>this.eraseInLine(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},D=>this.eraseInLine(D,!0)),this._parser.registerCsiHandler({final:"L"},D=>this.insertLines(D)),this._parser.registerCsiHandler({final:"M"},D=>this.deleteLines(D)),this._parser.registerCsiHandler({final:"P"},D=>this.deleteChars(D)),this._parser.registerCsiHandler({final:"S"},D=>this.scrollUp(D)),this._parser.registerCsiHandler({final:"T"},D=>this.scrollDown(D)),this._parser.registerCsiHandler({final:"X"},D=>this.eraseChars(D)),this._parser.registerCsiHandler({final:"Z"},D=>this.cursorBackwardTab(D)),this._parser.registerCsiHandler({final:"`"},D=>this.charPosAbsolute(D)),this._parser.registerCsiHandler({final:"a"},D=>this.hPositionRelative(D)),this._parser.registerCsiHandler({final:"b"},D=>this.repeatPrecedingCharacter(D)),this._parser.registerCsiHandler({final:"c"},D=>this.sendDeviceAttributesPrimary(D)),this._parser.registerCsiHandler({prefix:">",final:"c"},D=>this.sendDeviceAttributesSecondary(D)),this._parser.registerCsiHandler({final:"d"},D=>this.linePosAbsolute(D)),this._parser.registerCsiHandler({final:"e"},D=>this.vPositionRelative(D)),this._parser.registerCsiHandler({final:"f"},D=>this.hVPosition(D)),this._parser.registerCsiHandler({final:"g"},D=>this.tabClear(D)),this._parser.registerCsiHandler({final:"h"},D=>this.setMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"h"},D=>this.setModePrivate(D)),this._parser.registerCsiHandler({final:"l"},D=>this.resetMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"l"},D=>this.resetModePrivate(D)),this._parser.registerCsiHandler({final:"m"},D=>this.charAttributes(D)),this._parser.registerCsiHandler({final:"n"},D=>this.deviceStatus(D)),this._parser.registerCsiHandler({prefix:"?",final:"n"},D=>this.deviceStatusPrivate(D)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},D=>this.softReset(D)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},D=>this.setCursorStyle(D)),this._parser.registerCsiHandler({final:"r"},D=>this.setScrollRegion(D)),this._parser.registerCsiHandler({final:"s"},D=>this.saveCursor(D)),this._parser.registerCsiHandler({final:"t"},D=>this.windowOptions(D)),this._parser.registerCsiHandler({final:"u"},D=>this.restoreCursor(D)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},D=>this.insertColumns(D)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},D=>this.deleteColumns(D)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},D=>this.selectProtected(D)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},D=>this.requestMode(D,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},D=>this.requestMode(D,!1)),this._parser.setExecuteHandler(s.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(s.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(s.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(s.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(s.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(s.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(s.C1.IND,()=>this.index()),this._parser.setExecuteHandler(s.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(s.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new b.OscHandler(D=>(this.setTitle(D),this.setIconName(D),!0))),this._parser.registerOscHandler(1,new b.OscHandler(D=>this.setIconName(D))),this._parser.registerOscHandler(2,new b.OscHandler(D=>this.setTitle(D))),this._parser.registerOscHandler(4,new b.OscHandler(D=>this.setOrReportIndexedColor(D))),this._parser.registerOscHandler(8,new b.OscHandler(D=>this.setHyperlink(D))),this._parser.registerOscHandler(10,new b.OscHandler(D=>this.setOrReportFgColor(D))),this._parser.registerOscHandler(11,new b.OscHandler(D=>this.setOrReportBgColor(D))),this._parser.registerOscHandler(12,new b.OscHandler(D=>this.setOrReportCursorColor(D))),this._parser.registerOscHandler(104,new b.OscHandler(D=>this.restoreIndexedColor(D))),this._parser.registerOscHandler(110,new b.OscHandler(D=>this.restoreFgColor(D))),this._parser.registerOscHandler(111,new b.OscHandler(D=>this.restoreBgColor(D))),this._parser.registerOscHandler(112,new b.OscHandler(D=>this.restoreCursorColor(D))),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 D in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},()=>this.selectCharset("("+D)),this._parser.registerEscHandler({intermediates:")",final:D},()=>this.selectCharset(")"+D)),this._parser.registerEscHandler({intermediates:"*",final:D},()=>this.selectCharset("*"+D)),this._parser.registerEscHandler({intermediates:"+",final:D},()=>this.selectCharset("+"+D)),this._parser.registerEscHandler({intermediates:"-",final:D},()=>this.selectCharset("-"+D)),this._parser.registerEscHandler({intermediates:".",final:D},()=>this.selectCharset("."+D)),this._parser.registerEscHandler({intermediates:"/",final:D},()=>this.selectCharset("/"+D));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(D=>(this._logService.error("Parsing error: ",D),D)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new f.DcsHandler((D,z)=>this.requestStatusString(D,z)))}_preserveStack(E,M,I,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=I,this._parseStack.position=P}_logSlowResolvingAsync(E){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([E,new Promise((M,I)=>setTimeout(()=>I("#SLOW_TIMEOUT"),5e3))]).catch(M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,M){let I,P=this._activeBuffer.x,U=this._activeBuffer.y,q=0;const Y=this._parseStack.paused;if(Y){if(I=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(I),I;P=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>R&&(q=this._parseStack.position+R)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,D=>String.fromCharCode(D)).join("")}"`),typeof E=="string"?E.split("").map(D=>D.charCodeAt(0)):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<R&&(this._parseBuffer=new Uint32Array(Math.min(E.length,R))),Y||this._dirtyRowTracker.clearRange(),E.length>R)for(let D=q;D<E.length;D+=R){const z=D+R<E.length?D+R:E.length,W=typeof E=="string"?this._stringDecoder.decode(E.substring(D,z),this._parseBuffer):this._utf8Decoder.decode(E.subarray(D,z),this._parseBuffer);if(I=this._parser.parse(this._parseBuffer,W))return this._preserveStack(P,U,W,D),this._logSlowResolvingAsync(I),I}else if(!Y){const D=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(I=this._parser.parse(this._parseBuffer,D))return this._preserveStack(P,U,D,0),this._logSlowResolvingAsync(I),I}this._activeBuffer.x===P&&this._activeBuffer.y===U||this._onCursorMove.fire();const G=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),O=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);O<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(O,this._bufferService.rows-1),Math.min(G,this._bufferService.rows-1))}print(E,M,I){let P,U;const q=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,O=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,z=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&I-M>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let V=this._parser.precedingJoinState;for(let K=M;K<I;++K){if(P=E[K],P<127&&q){const pe=q[String.fromCharCode(P)];pe&&(P=pe.charCodeAt(0))}const te=this._unicodeService.charProperties(P,V);U=g.UnicodeService.extractWidth(te);const Z=g.UnicodeService.extractShouldJoin(te),he=Z?g.UnicodeService.extractWidth(V):0;if(V=te,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-he>G){if(O){const pe=W;let Q=this._activeBuffer.x-he;for(this._activeBuffer.x=he,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&W instanceof e.BufferLine&&W.copyCellsFrom(pe,Q,0,he,!1);Q<G;)pe.setCellFromCodepoint(Q++,0,1,z)}else if(this._activeBuffer.x=G-1,U===2)continue}if(Z&&this._activeBuffer.x){const pe=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-pe,P,U);for(let Q=U-he;--Q>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(D&&(W.insertCells(this._activeBuffer.x,U-he,this._activeBuffer.getNullCell(z)),W.getWidth(G-1)===2&&W.setCellFromCodepoint(G-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,z)),W.setCellFromCodepoint(this._activeBuffer.x++,P,U,z),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=V,this._activeBuffer.x<G&&I-M>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,M){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,M):this._parser.registerCsiHandler(E,I=>!L(I.params[0],this._optionsService.rawOptions.windowOptions)||M(I))}registerDcsHandler(E,M){return this._parser.registerDcsHandler(E,new f.DcsHandler(M))}registerEscHandler(E,M){return this._parser.registerEscHandler(E,M)}registerOscHandler(E,M){return this._parser.registerOscHandler(E,new b.OscHandler(M))}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 E;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&&((E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&E.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,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(E,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=E,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+M)}cursorUp(E){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){const M=E.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=E.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=E.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){const M=E.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,M,I,P=!1,U=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);q.replaceCells(M,I,this._activeBuffer.getNullCell(this._eraseAttrData()),U),P&&(q.isWrapped=!1)}_resetBufferLine(E,M=!1){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);I&&(I.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),I.isWrapped=!1)}eraseInDisplay(E,M=!1){let I;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(I=this._activeBuffer.y,this._dirtyRowTracker.markDirty(I),this._eraseInBufferLine(I++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);I<this._bufferService.rows;I++)this._resetBufferLine(I,M);this._dirtyRowTracker.markDirty(I);break;case 1:for(I=this._activeBuffer.y,this._dirtyRowTracker.markDirty(I),this._eraseInBufferLine(I,0,this._activeBuffer.x+1,!0,M),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(I+1).isWrapped=!1);I--;)this._resetBufferLine(I,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(I=this._bufferService.rows,this._dirtyRowTracker.markDirty(I-1);I--;)this._resetBufferLine(I,M);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(E,M=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let M=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;M--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(I,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(E){this._restrictCursor();let M=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;M--;)this._activeBuffer.lines.splice(I,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let M=E.params[0]||1;for(;M--;)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(E){let M=E.params[0]||1;for(;M--;)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(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);P.deleteCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);P.insertCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);P.insertCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=E.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);P.deleteCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){const M=this._parser.precedingJoinState;if(!M)return!0;const I=E.params[0]||1,P=g.UnicodeService.extractWidth(M),U=this._activeBuffer.x-P,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(q.length*I);let G=0;for(let D=0;D<q.length;){const z=q.codePointAt(D)||0;Y[G++]=z,D+=z>65535?2:1}let O=G;for(let D=1;D<I;++D)Y.copyWithin(O,0,G),O+=G;return this.print(Y,0,O),!0}sendDeviceAttributesPrimary(E){return E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(E){return E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let M=0;M<E.length;M++)switch(E.params[M]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let M=0;M<E.length;M++)switch(E.params[M]){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(E){for(let M=0;M<E.length;M++)switch(E.params[M]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let M=0;M<E.length;M++)switch(E.params[M]){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(),E.params[M]===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(E,M){const I=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:Y,cols:G}=this._bufferService,{active:O,alt:D}=Y,z=this._optionsService.rawOptions,W=Z=>Z?1:2,V=E.params[0];return K=V,te=M?V===2?4:V===4?W(q.modes.insertMode):V===12?3:V===20?W(z.convertEol):0:V===1?W(I.applicationCursorKeys):V===3?z.windowOptions.setWinLines?G===80?2:G===132?1:0:0:V===6?W(I.origin):V===7?W(I.wraparound):V===8?3:V===9?W(P==="X10"):V===12?W(z.cursorBlink):V===25?W(!q.isCursorHidden):V===45?W(I.reverseWraparound):V===66?W(I.applicationKeypad):V===67?4:V===1e3?W(P==="VT200"):V===1002?W(P==="DRAG"):V===1003?W(P==="ANY"):V===1004?W(I.sendFocus):V===1005?4:V===1006?W(U==="SGR"):V===1015?4:V===1016?W(U==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?W(O===D):V===2004?W(I.bracketedPasteMode):0,q.triggerDataEvent(`${s.C0.ESC}[${M?"":"?"}${K};${te}$y`),!0;var K,te}_updateAttrColor(E,M,I,P,U){return M===2?(E|=50331648,E&=-16777216,E|=u.AttributeData.fromColorRGB([I,P,U])):M===5&&(E&=-50331904,E|=33554432|255&I),E}_extractColor(E,M,I){const P=[0,0,-1,0,0,0];let U=0,q=0;do{if(P[q+U]=E.params[M+q],E.hasSubParams(M+q)){const Y=E.getSubParams(M+q);let G=0;do P[1]===5&&(U=1),P[q+G+1+U]=Y[G];while(++G<Y.length&&G+q+1+U<P.length);break}if(P[1]===5&&q+U>=2||P[1]===2&&q+U>=5)break;P[1]&&(U=1)}while(++q+M<E.length&&q+U<P.length);for(let Y=2;Y<P.length;++Y)P[Y]===-1&&(P[Y]=0);switch(P[0]){case 38:I.fg=this._updateAttrColor(I.fg,P[1],P[3],P[4],P[5]);break;case 48:I.bg=this._updateAttrColor(I.bg,P[1],P[3],P[4],P[5]);break;case 58:I.extended=I.extended.clone(),I.extended.underlineColor=this._updateAttrColor(I.extended.underlineColor,P[1],P[3],P[4],P[5])}return q}_processUnderline(E,M){M.extended=M.extended.clone(),(!~E||E>5)&&(E=1),M.extended.underlineStyle=E,M.fg|=268435456,E===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(E){E.fg=e.DEFAULT_ATTR_DATA.fg,E.bg=e.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=E.length;let I;const P=this._curAttrData;for(let U=0;U<M;U++)I=E.params[U],I>=30&&I<=37?(P.fg&=-50331904,P.fg|=16777216|I-30):I>=40&&I<=47?(P.bg&=-50331904,P.bg|=16777216|I-40):I>=90&&I<=97?(P.fg&=-50331904,P.fg|=16777224|I-90):I>=100&&I<=107?(P.bg&=-50331904,P.bg|=16777224|I-100):I===0?this._processSGR0(P):I===1?P.fg|=134217728:I===3?P.bg|=67108864:I===4?(P.fg|=268435456,this._processUnderline(E.hasSubParams(U)?E.getSubParams(U)[0]:1,P)):I===5?P.fg|=536870912:I===7?P.fg|=67108864:I===8?P.fg|=1073741824:I===9?P.fg|=2147483648:I===2?P.bg|=134217728:I===21?this._processUnderline(2,P):I===22?(P.fg&=-134217729,P.bg&=-134217729):I===23?P.bg&=-67108865:I===24?(P.fg&=-268435457,this._processUnderline(0,P)):I===25?P.fg&=-536870913:I===27?P.fg&=-67108865:I===28?P.fg&=-1073741825:I===29?P.fg&=2147483647:I===39?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):I===49?(P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):I===38||I===48||I===58?U+=this._extractColor(E,U,P):I===53?P.bg|=1073741824:I===55?P.bg&=-1073741825:I===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):I===100?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",I);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${s.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,I=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[${M};${I}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){const M=this._activeBuffer.y+1,I=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[?${M};${I}R`)}return!0}softReset(E){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(E){const M=E.params[0]||1;switch(M){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 I=M%2==1;return this._optionsService.options.cursorBlink=I,!0}setScrollRegion(E){const M=E.params[0]||1;let I;return(E.length<2||(I=E.params[1])>this._bufferService.rows||I===0)&&(I=this._bufferService.rows),I>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=I-1,this._setCursor(0,0)),!0}windowOptions(E){if(!L(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(k.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(k.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${s.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){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(E){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(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){const M=[],I=E.split(";");for(;I.length>1;){const P=I.shift(),U=I.shift();if(/^\d+$/.exec(P)){const q=parseInt(P);if(N(q))if(U==="?")M.push({type:0,index:q});else{const Y=(0,S.parseColor)(U);Y&&M.push({type:1,index:q,color:Y})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(E){const M=E.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(E,M){this._getCurrentLinkId()&&this._finishHyperlink();const I=E.split(":");let P;const U=I.findIndex(q=>q.startsWith("id="));return U!==-1&&(P=I[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,M){const I=E.split(";");for(let P=0;P<I.length&&!(M>=this._specialColors.length);++P,++M)if(I[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const U=(0,S.parseColor)(I[P]);U&&this._onColor.fire([{type:1,index:this._specialColors[M],color:U}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;const M=[],I=E.split(";");for(let P=0;P<I.length;++P)if(/^\d+$/.exec(I[P])){const U=parseInt(I[P]);N(U)&&M.push({type:2,index:U})}return M.length&&this._onColor.fire(M),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){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(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(w[E[0]],c.CHARSETS[E[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 E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,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(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){const E=new n.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M<this._bufferService.rows;++M){const I=this._activeBuffer.ybase+this._activeBuffer.y+M,P=this._activeBuffer.lines.get(I);P&&(P.fill(E),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,M){const I=this._bufferService.buffer,P=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${s.C0.ESC}${U}${s.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${I.scrollTop+1};${I.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,M){this._dirtyRowTracker.markRangeDirty(E,M)}}t.InputHandler=F;let $=class{constructor(H){this._bufferService=H,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(H){H<this.start?this.start=H:H>this.end&&(this.end=H)}markRangeDirty(H,E){H>E&&(T=H,H=E,E=T),H<this.start&&(this.start=H),E>this.end&&(this.end=E)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function N(H){return 0<=H&&H<256}$=h([l(0,C.IBufferService)],$)},844:(A,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:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,s,c){this._data[l]||(this._data[l]={}),this._data[l][s]=c}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,s,c,p){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(s,c,p)}get(h,l,s,c){var p;return(p=this._data.get(h,l))==null?void 0:p.get(s,c)}clear(){this._data.clear()}}},6114:(A,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:(A,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,s=this._array.length-1;for(;s>=l;){let c=l+s>>1;const p=this._getKey(this._array[c]);if(p>h)s=c-1;else{if(!(p<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(p){this._idleCallback=void 0;let v=0,o=0,e=p.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),r=p.timeRemaining(),1.5*o>r)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=r}this.clear()}}class s extends l{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const v=Date.now()+p;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(l){const s=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=s==null?void 0:s.get(l.cols-1),p=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);p&&c&&(p.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,c=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),s=a(3734),c=a(8437),p=a(4634),v=a(511),o=a(643),e=a(4863),r=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,n,u){this._hasScrollback=i,this._optionsService=n,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=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,n){return new c.BufferLine(this._bufferService.cols,this.getNullCell(i),n)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const n=i+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.DEFAULT_ATTR_DATA);let n=this._rows;for(;n--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,n){const u=this.getNullCell(c.DEFAULT_ATTR_DATA);let C=0;const g=this._getCorrectBufferLength(n);if(g>this.lines.maxLength&&(this.lines.maxLength=g),this.lines.length>0){if(this._cols<i)for(let f=0;f<this.lines.length;f++)C+=+this.lines.get(f).resize(i,u);let b=0;if(this._rows<n)for(let f=this._rows;f<n;f++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new c.BufferLine(i,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+b+1?(this.ybase--,b++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,u)));else for(let f=this._rows;f>n;f--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(g<this.lines.maxLength){const f=this.lines.length-g;f>0&&(this.lines.trimStart(f),this.ybase=Math.max(this.ybase-f,0),this.ydisp=Math.max(this.ydisp-f,0),this.savedY=Math.max(this.savedY-f,0)),this.lines.maxLength=g}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,n-1),b&&(this.y+=b),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(i,n),this._cols>i))for(let b=0;b<this.lines.length;b++)C+=+this.lines.get(b).resize(i,u);this._cols=i,this._rows=n,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,n){this._cols!==i&&(i>this._cols?this._reflowLarger(i,n):this._reflowSmaller(i,n))}_reflowLarger(i,n){const u=(0,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(u.length>0){const C=(0,p.reflowLargerCreateNewLayout)(this.lines,u);(0,p.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(i,n,C.countRemoved)}}_reflowLargerAdjustViewport(i,n,u){const C=this.getNullCell(c.DEFAULT_ATTR_DATA);let g=u;for(;g-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new c.BufferLine(i,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(i,n){const u=this.getNullCell(c.DEFAULT_ATTR_DATA),C=[];let g=0;for(let b=this.lines.length-1;b>=0;b--){let f=this.lines.get(b);if(!f||!f.isWrapped&&f.getTrimmedLength()<=i)continue;const S=[f];for(;f.isWrapped&&b>0;)f=this.lines.get(--b),S.unshift(f);const w=this.ybase+this.y;if(w>=b&&w<b+S.length)continue;const R=S[S.length-1].getTrimmedLength(),L=(0,p.reflowSmallerGetNewLineLengths)(S,this._cols,i),k=L.length-S.length;let T;T=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+k):Math.max(0,this.lines.length-this.lines.maxLength+k);const F=[];for(let I=0;I<k;I++){const P=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);F.push(P)}F.length>0&&(C.push({start:b+S.length+g,newLines:F}),g+=F.length),S.push(...F);let $=L.length-1,N=L[$];N===0&&($--,N=L[$]);let H=S.length-k-1,E=R;for(;H>=0;){const I=Math.min(E,N);if(S[$]===void 0)break;if(S[$].copyCellsFrom(S[H],E-I,N-I,I,!0),N-=I,N===0&&($--,N=L[$]),E-=I,E===0){H--;const P=Math.max(H,0);E=(0,p.getWrappedLineTrimmedLength)(S,P,this._cols)}}for(let I=0;I<S.length;I++)L[I]<i&&S[I].setCell(L[I],u);let M=k-T;for(;M-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+g)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+k,this.ybase+n-1)}if(C.length>0){const b=[],f=[];for(let $=0;$<this.lines.length;$++)f.push(this.lines.get($));const S=this.lines.length;let w=S-1,R=0,L=C[R];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+g);let k=0;for(let $=Math.min(this.lines.maxLength-1,S+g-1);$>=0;$--)if(L&&L.start>w+k){for(let N=L.newLines.length-1;N>=0;N--)this.lines.set($--,L.newLines[N]);$++,b.push({index:w+1,amount:L.newLines.length}),k+=L.newLines.length,L=C[++R]}else this.lines.set($,f[w--]);let T=0;for(let $=b.length-1;$>=0;$--)b[$].index+=T,this.lines.onInsertEmitter.fire(b[$]),T+=b[$].amount;const F=Math.max(0,S+g-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(i,n,u=0,C){const g=this.lines.get(i);return g?g.translateToString(n,u,C):""}getWrappedRangeForLine(i){let n=i,u=i;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:n,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 n=0;n<this.markers.length;n++)this.markers[n].line===i&&(this.markers[n].dispose(),this.markers.splice(n--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const n=new e.Marker(i);return this.markers.push(n),n.register(this.lines.onTrim(u=>{n.line-=u,n.line<0&&n.dispose()})),n.register(this.lines.onInsert(u=>{n.line>=u.index&&(n.line+=u.amount)})),n.register(this.lines.onDelete(u=>{n.line>=u.index&&n.line<u.index+u.amount&&n.dispose(),n.line>u.index&&(n.line-=u.amount)})),n.register(n.onDispose(()=>this._removeMarker(n))),n}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),l=a(511),s=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let p=0;class v{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const n=r||l.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]);for(let u=0;u<e;++u)this.setCell(u,n);this.length=e}get(e){const r=this._data[3*e+0],i=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,r){this._data[3*e+1]=r[s.CHAR_DATA_ATTR_INDEX],r[s.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[s.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[s.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?(0,c.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return p=3*e,r.content=this._data[p+0],r.fg=this._data[p+1],r.bg=this._data[p+2],2097152&r.content&&(r.combinedData=this._combined[e]),268435456&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,i,n){268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}addCodepointToCell(e,r,i){let n=this._data[3*e+0];2097152&n?this._combined[e]+=(0,c.stringFromCodePoint)(r):2097151&n?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&n)+(0,c.stringFromCodePoint)(r),n&=-2097152,n|=2097152):n=r|4194304,i&&(n&=-12582913,n|=i<<22),this._data[3*e+0]=n}insertCells(e,r,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length-e){const n=new l.CellData;for(let u=this.length-e-r-1;u>=0;--u)this.setCell(e+r+u,this.loadCell(e+u,n));for(let u=0;u<r;++u)this.setCell(e+u,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,r,i){if(e%=this.length,r<this.length-e){const n=new l.CellData;for(let u=0;u<this.length-e-r;++u)this.setCell(e+u,this.loadCell(e+r+u,n));for(let u=this.length-r;u<this.length;++u)this.setCell(u,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,r,i,n=!1){if(n)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.setCell(e++,i)}resize(e,r){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<e;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);const n=Object.keys(this._combined);for(let C=0;C<n.length;C++){const g=parseInt(n[C],10);g>=e&&delete this._combined[g]}const u=Object.keys(this._extendedAttrs);for(let C=0;C<u.length;C++){const g=parseInt(u[C],10);g>=e&&delete this._extendedAttrs[g]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,r=!1){if(r)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(const r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){const e=new v(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const r in this._combined)e._combined[r]=this._combined[r];for(const r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,r,i,n,u){const C=e._data;if(u)for(let b=n-1;b>=0;b--){for(let f=0;f<3;f++)this._data[3*(i+b)+f]=C[3*(r+b)+f];268435456&C[3*(r+b)+2]&&(this._extendedAttrs[i+b]=e._extendedAttrs[r+b])}else for(let b=0;b<n;b++){for(let f=0;f<3;f++)this._data[3*(i+b)+f]=C[3*(r+b)+f];268435456&C[3*(r+b)+2]&&(this._extendedAttrs[i+b]=e._extendedAttrs[r+b])}const g=Object.keys(e._combined);for(let b=0;b<g.length;b++){const f=parseInt(g[b],10);f>=r&&(this._combined[f-r+i]=e._combined[f])}}translateToString(e,r,i,n){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let u="";for(;r<i;){const C=this._data[3*r+0],g=2097151&C,b=2097152&C?this._combined[r]:g?(0,c.stringFromCodePoint)(g):s.WHITESPACE_CELL_CHAR;if(u+=b,n)for(let f=0;f<b.length;++f)n.push(r);r+=C>>22||1}return n&&n.push(r),u}}t.BufferLine=v},4841:(A,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:(A,t)=>{function a(h,l,s){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(s-1)&&h[l].getWidth(s-1)===1,p=h[l+1].getWidth(0)===2;return c&&p?s-1:s}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,s,c,p){const v=[];for(let o=0;o<h.length-1;o++){let e=o,r=h.get(++e);if(!r.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&r.isWrapped;)i.push(r),r=h.get(++e);if(c>=o&&c<e){o+=i.length-1;continue}let n=0,u=a(i,n,l),C=1,g=0;for(;C<i.length;){const f=a(i,C,l),S=f-g,w=s-u,R=Math.min(S,w);i[n].copyCellsFrom(i[C],g,u,R,!1),u+=R,u===s&&(n++,u=0),g+=R,g===f&&(C++,g=0),u===0&&n!==0&&i[n-1].getWidth(s-1)===2&&(i[n].copyCellsFrom(i[n-1],s-1,u++,1,!1),i[n-1].setCell(s-1,p))}i[n].replaceCells(u,s,p);let b=0;for(let f=i.length-1;f>0&&(f>n||i[f].getTrimmedLength()===0);f--)b++;b>0&&(v.push(o+i.length-b),v.push(b)),o+=i.length-1}return v},t.reflowLargerCreateNewLayout=function(h,l){const s=[];let c=0,p=l[c],v=0;for(let o=0;o<h.length;o++)if(p===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-v,amount:e}),o+=e-1,v+=e,p=l[++c]}else s.push(o);return{layout:s,countRemoved:v}},t.reflowLargerApplyNewLayout=function(h,l){const s=[];for(let c=0;c<l.length;c++)s.push(h.get(l[c]));for(let c=0;c<s.length;c++)h.set(c,s[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,s){const c=[],p=h.map((r,i)=>a(h,i,l)).reduce((r,i)=>r+i);let v=0,o=0,e=0;for(;e<p;){if(p-e<s){c.push(p-e);break}v+=s;const r=a(h,o,l);v>r&&(v-=r,o++);const i=h[o].getWidth(v-1)===2;i&&v--;const n=i?s-1:s;c.push(n),e+=n}return c},t.getWrappedLineTrimmedLength=a},5295:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),l=a(844),s=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 s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(v,o){this._normal.resize(v,o),this._alt.resize(v,o),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}t.BufferSet=c},511:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),s=a(3734);class c extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(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 r=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-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:(A,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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),l=a(844);class s{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=s._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(p){return this._disposables.push(p),p}}t.Marker=s,s._nextId=1},7116:(A,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:(A,t)=>{var a,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(s){s.NUL="\0",s.SOH="",s.STX="",s.ETX="",s.EOT="",s.ENQ="",s.ACK="",s.BEL="\x07",s.BS="\b",s.HT=" ",s.LF=`
|
|
22
|
+
`,s.VT="\v",s.FF="\f",s.CR="\r",s.SO="",s.SI="",s.DLE="",s.DC1="",s.DC2="",s.DC3="",s.DC4="",s.NAK="",s.SYN="",s.ETB="",s.CAN="",s.EM="",s.SUB="",s.ESC="\x1B",s.FS="",s.GS="",s.RS="",s.US="",s.SP=" ",s.DEL=""}(a||(t.C0=a={})),function(s){s.PAD="",s.HOP="",s.BPH="",s.NBH="",s.IND="",s.NEL="
",s.SSA="",s.ESA="",s.HTS="",s.HTJ="",s.VTS="",s.PLD="",s.PLU="",s.RI="",s.SS2="",s.SS3="",s.DCS="",s.PU1="",s.PU2="",s.STS="",s.CCH="",s.MW="",s.SPA="",s.EPA="",s.SOS="",s.SGCI="",s.SCI="",s.CSI="",s.ST="",s.OSC="",s.PM="",s.APC=""}(h||(t.C1=h={})),function(s){s.ST=`${a.ESC}\\`}(l||(t.C1_ESCAPED=l={}))},7399:(A,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(s,c,p,v){const o={type:0,cancel:!1,key:void 0},e=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":s.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":s.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=s.ctrlKey?"\b":h.C0.DEL,s.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(s.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=s.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,s.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(p?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(p?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",p||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",p||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:s.shiftKey||s.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":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:s.shiftKey?o.type=2:s.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:s.shiftKey?o.type=3:s.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!s.ctrlKey||s.shiftKey||s.altKey||s.metaKey)if(p&&!v||!s.altKey||s.metaKey)!p||s.altKey||s.ctrlKey||s.shiftKey||!s.metaKey?s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?o.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(o.key=h.C0.US),s.key==="@"&&(o.key=h.C0.NUL)):s.keyCode===65&&(o.type=1);else{const r=l[s.keyCode],i=r==null?void 0:r[s.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(s.keyCode>=65&&s.keyCode<=90){const n=s.ctrlKey?s.keyCode-64:s.keyCode+32;let u=String.fromCharCode(n);s.shiftKey&&(u=u.toUpperCase()),o.key=h.C0.ESC+u}else if(s.keyCode===32)o.key=h.C0.ESC+(s.ctrlKey?h.C0.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let n=s.code.slice(3,4);s.shiftKey||(n=n.toLowerCase()),o.key=h.C0.ESC+n,o.cancel=!0}}else s.keyCode>=65&&s.keyCode<=90?o.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?o.key=h.C0.NUL:s.keyCode>=51&&s.keyCode<=55?o.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?o.key=h.C0.DEL:s.keyCode===219?o.key=h.C0.ESC:s.keyCode===220?o.key=h.C0.FS:s.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(A,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 s="";for(let c=h;c<l;++c){let p=a[c];p>65535?(p-=65536,s+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):s+=String.fromCharCode(p)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let s=0,c=0;if(this._interim){const p=a.charCodeAt(c++);56320<=p&&p<=57343?h[s++]=1024*(this._interim-55296)+p-56320+65536:(h[s++]=this._interim,h[s++]=p),this._interim=0}for(let p=c;p<l;++p){const v=a.charCodeAt(p);if(55296<=v&&v<=56319){if(++p>=l)return this._interim=v,s;const o=a.charCodeAt(p);56320<=o&&o<=57343?h[s++]=1024*(v-55296)+o-56320+65536:(h[s++]=v,h[s++]=o)}else v!==65279&&(h[s++]=v)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let s,c,p,v,o=0,e=0,r=0;if(this.interim[0]){let u=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let g,b=0;for(;(g=63&this.interim[++b])&&b<4;)C<<=6,C|=g;const f=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=f-b;for(;r<S;){if(r>=l)return 0;if(g=a[r++],(192&g)!=128){r--,u=!0;break}this.interim[b++]=g,C<<=6,C|=63&g}u||(f===2?C<128?r--:h[o++]=C:f===3?C<2048||C>=55296&&C<=57343||C===65279||(h[o++]=C):C<65536||C>1114111||(h[o++]=C)),this.interim.fill(0)}const i=l-4;let n=r;for(;n<l;){for(;!(!(n<i)||128&(s=a[n])||128&(c=a[n+1])||128&(p=a[n+2])||128&(v=a[n+3]));)h[o++]=s,h[o++]=c,h[o++]=p,h[o++]=v,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(e=(31&s)<<6|63&c,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(p=a[n++],(192&p)!=128){n--;continue}if(e=(15&s)<<12|(63&c)<<6|63&p,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(p=a[n++],(192&p)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,this.interim[2]=p,o;if(v=a[n++],(192&v)!=128){n--;continue}if(e=(7&s)<<18|(63&c)<<12|(63&p)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(A,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]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let p=0;p<l.length;++p)c.fill(0,l[p][0],l[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?c[p]:function(v,o){let e,r=0,i=o.length-1;if(v<o[0][0]||v>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,v>o[e][1])r=e+1;else{if(!(v<o[e][0]))return!0;i=e-1}return!1}(p,s)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,v){let o=this.wcwidth(p),e=o===0&&v!==0;if(e){const r=h.UnicodeService.extractWidth(v);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),l=a(844);class s extends l.Disposable{constructor(p){super(),this._action=p,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(p,v){if(v!==void 0&&this._syncCalls>v)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,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+=p.length,this._writeBuffer.push(p),this._callbacks.push(v),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(v)}_innerWrite(p=0,v=!0){const o=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],r=this._action(e,v);if(r){const n=u=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(o,u);return void r.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(n)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=s},5941:(A,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(s,c){const p=s.toString(16),v=p.length<2?"0"+p:p;switch(c){case 4:return p[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}t.parseColor=function(s){if(!s)return;let c=s.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const p=a.exec(c);if(p){const v=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/v*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/v*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/v*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const p=c.length/3,v=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(p*o,p*o+p),16);v[o]=p===1?e<<4:p===2?e:p===3?e>>4:e>>8}return v}},t.toRgbString=function(s,c=16){const[p,v,o]=s;return`rgb:${l(p,c)}/${l(v,c)}/${l(o,c)}`}},5770:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),l=a(8742),s=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 r=e.indexOf(o);r!==-1&&e.splice(r,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=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 r=this._active.length-1;r>=0;r--)this._active[r].put(v,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(v,o,e))}unhook(v,o=!0){if(this._active.length){let e=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;r>=0&&(e=this._active[r].unhook(v),e!==!0);r--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,e;r--}for(;r>=0;r--)if(e=this._active[r].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",v);this._active=c,this._ident=0}};const p=new l.Params;p.addParam(0),t.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=p,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():p,this._data="",this._hitLimit=!1}put(v,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,o,e),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let o=!1;if(this._hitLimit)o=!1;else if(v&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=p,this._data="",this._hitLimit=!1,e));return this._params=p,this._data="",this._hitLimit=!1,o}}},2015:(A,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),s=a(6242),c=a(6351);class p{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,n,u){this.table[i<<8|r]=n<<4|u}addMany(r,i,n,u){for(let C=0;C<r.length;C++)this.table[i<<8|r[C]]=n<<4|u}}t.TransitionTable=p;const v=160;t.VT500_TRANSITION_TABLE=function(){const e=new p(4095),r=Array.apply(null,Array(256)).map((b,f)=>f),i=(b,f)=>r.slice(b,f),n=i(32,127),u=i(0,24);u.push(25),u.push.apply(u,i(28,32));const C=i(0,14);let g;for(g in e.setDefault(1,0),e.addMany(n,0,2,0),C)e.addMany([24,26,153,154],g,3,0),e.addMany(i(128,144),g,3,0),e.addMany(i(144,152),g,3,0),e.add(156,g,0,0),e.add(27,g,11,1),e.add(157,g,4,8),e.addMany([152,158,159],g,0,7),e.add(155,g,11,3),e.add(144,g,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(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(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(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(v,0,2,0),e.add(v,8,5,8),e.add(v,6,0,6),e.add(v,11,0,11),e.add(v,13,13,13),e}();class o extends h.Disposable{constructor(r=t.VT500_TRANSITION_TABLE){super(),this._transitions=r,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,u)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new s.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(r,i=[64,126]){let n=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=r.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<r.intermediates.length;++C){const g=r.intermediates.charCodeAt(C);if(32>g||g>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=g}}if(r.final.length!==1)throw new Error("final must be a single byte");const u=r.final.charCodeAt(0);if(i[0]>u||u>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=u,n}identToString(r){const i=[];for(;r;)i.push(String.fromCharCode(255&r)),r>>=8;return i.reverse().join("")}setPrintHandler(r){this._printHandler=r}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(r,i){const n=this._identifier(r,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);const u=this._escHandlers[n];return u.push(i),{dispose:()=>{const C=u.indexOf(i);C!==-1&&u.splice(C,1)}}}clearEscHandler(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]}setEscHandlerFallback(r){this._escHandlerFb=r}setExecuteHandler(r,i){this._executeHandlers[r.charCodeAt(0)]=i}clearExecuteHandler(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]}setExecuteHandlerFallback(r){this._executeHandlerFb=r}registerCsiHandler(r,i){const n=this._identifier(r);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);const u=this._csiHandlers[n];return u.push(i),{dispose:()=>{const C=u.indexOf(i);C!==-1&&u.splice(C,1)}}}clearCsiHandler(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]}setCsiHandlerFallback(r){this._csiHandlerFb=r}registerDcsHandler(r,i){return this._dcsParser.registerHandler(this._identifier(r),i)}clearDcsHandler(r){this._dcsParser.clearHandler(this._identifier(r))}setDcsHandlerFallback(r){this._dcsParser.setHandlerFallback(r)}registerOscHandler(r,i){return this._oscParser.registerHandler(r,i)}clearOscHandler(r){this._oscParser.clearHandler(r)}setOscHandlerFallback(r){this._oscParser.setHandlerFallback(r)}setErrorHandler(r){this._errorHandler=r}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(r,i,n,u,C){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=u,this._parseStack.chunkPos=C}parse(r,i,n){let u,C=0,g=0,b=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,b=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const f=this._parseStack.handlers;let S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&S>-1){for(;S>=0&&(u=f[S](this._params),u!==!0);S--)if(u instanceof Promise)return this._parseStack.handlerPos=S,u}this._parseStack.handlers=[];break;case 4:if(n===!1&&S>-1){for(;S>=0&&(u=f[S](),u!==!0);S--)if(u instanceof Promise)return this._parseStack.handlerPos=S,u}this._parseStack.handlers=[];break;case 6:if(C=r[this._parseStack.chunkPos],u=this._dcsParser.unhook(C!==24&&C!==26,n),u)return u;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=r[this._parseStack.chunkPos],u=this._oscParser.end(C!==24&&C!==26,n),u)return u;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,b=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let f=b;f<i;++f){switch(C=r[f],g=this._transitions.table[this.currentState<<8|(C<160?C:v)],g>>4){case 2:for(let k=f+1;;++k){if(k>=i||(C=r[k])<32||C>126&&C<v){this._printHandler(r,f,k),f=k-1;break}if(++k>=i||(C=r[k])<32||C>126&&C<v){this._printHandler(r,f,k),f=k-1;break}if(++k>=i||(C=r[k])<32||C>126&&C<v){this._printHandler(r,f,k),f=k-1;break}if(++k>=i||(C=r[k])<32||C>126&&C<v){this._printHandler(r,f,k),f=k-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const S=this._csiHandlers[this._collect<<8|C];let w=S?S.length-1:-1;for(;w>=0&&(u=S[w](this._params),u!==!0);w--)if(u instanceof Promise)return this._preserveStack(3,S,w,g,f),u;w<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++f<i&&(C=r[f])>47&&C<60);f--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:const R=this._escHandlers[this._collect<<8|C];let L=R?R.length-1:-1;for(;L>=0&&(u=R[L](),u!==!0);L--)if(u instanceof Promise)return this._preserveStack(4,R,L,g,f),u;L<0&&this._escHandlerFb(this._collect<<8|C),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|C,this._params);break;case 13:for(let k=f+1;;++k)if(k>=i||(C=r[k])===24||C===26||C===27||C>127&&C<v){this._dcsParser.put(r,f,k),f=k-1;break}break;case 14:if(u=this._dcsParser.unhook(C!==24&&C!==26),u)return this._preserveStack(6,[],0,g,f),u;C===27&&(g|=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 k=f+1;;k++)if(k>=i||(C=r[k])<32||C>127&&C<v){this._oscParser.put(r,f,k),f=k-1;break}break;case 6:if(u=this._oscParser.end(C!==24&&C!==26),u)return this._preserveStack(5,[],0,g,f),u;C===27&&(g|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&g}}}t.EscapeSequenceParser=o},6242:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),s=[];t.OscParser=class{constructor(){this._state=0,this._active=s,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,p){this._handlers[c]===void 0&&(this._handlers[c]=[]);const v=this._handlers[c];return v.push(p),{dispose:()=>{const o=v.indexOf(p);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=s}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=s,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||s,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,p,v){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,p,v);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,p,v))}start(){this.reset(),this._state=1}put(c,p,v){if(this._state!==3){if(this._state===1)for(;p<v;){const o=c[p++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&v-p>0&&this._put(c,p,v)}}end(c,p=!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=p,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=s,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,p,v){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,p,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let p=!1;if(this._hitLimit)p=!1;else if(c&&(p=this._handler(this._data),p instanceof Promise))return p.then(v=>(this._data="",this._hitLimit=!1,v));return this._data="",this._hitLimit=!1,p}}},8742:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(s){const c=new h;if(!s.length)return c;for(let p=Array.isArray(s[0])?1:0;p<s.length;++p){const v=s[p];if(Array.isArray(v))for(let o=0;o<v.length;++o)c.addSubParam(v[o]);else c.addParam(v)}return c}constructor(s=32,c=32){if(this.maxLength=s,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const s=new h(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){const s=[];for(let c=0;c<this.length;++c){s.push(this.params[c]);const p=this._subParamsIdx[c]>>8,v=255&this._subParamsIdx[c];v-p>0&&s.push(Array.prototype.slice.call(this._subParams,p,v))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>a?a:s}}addSubParam(s){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>a?a:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(255&this._subParamsIdx[s])-(this._subParamsIdx[s]>>8)>0}getSubParams(s){const c=this._subParamsIdx[s]>>8,p=255&this._subParamsIdx[s];return p-c>0?this._subParams.subarray(c,p):null}getSubParamsAll(){const s={};for(let c=0;c<this.length;++c){const p=this._subParamsIdx[c]>>8,v=255&this._subParamsIdx[c];v-p>0&&(s[c]=this._subParams.slice(p,v))}return s}addDigit(s){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const p=this._digitIsSub?this._subParams:this.params,v=p[c-1];p[c-1]=~v?Math.min(10*v+s,a):s}}t.Params=h},5741:(A,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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=a(511);t.BufferApiView=class{constructor(s,c){this._buffer=s,this.type=c}init(s){return this._buffer=s,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(s){const c=this._buffer.lines.get(s);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(A,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,s){if(!(l<0||l>=this._line.length))return s?(this._line.loadCell(l,s),s):this._line.loadCell(l,new h.CellData)}translateToString(l,s,c){return this._line.translateToString(l,s,c)}}},8285:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),s=a(844);class c extends s.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:(A,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,s)=>h(l,s.toArray()))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(A,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(A,t,a){var h=this&&this.__decorate||function(e,r,i,n){var u,C=arguments.length,g=C<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,r,i,n);else for(var b=e.length-1;b>=0;b--)(u=e[b])&&(g=(C<3?u(g):C>3?u(r,i,g):u(r,i))||g);return C>3&&g&&Object.defineProperty(r,i,g),g},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const s=a(8460),c=a(844),p=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 s.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(e,this))}resize(e,r){this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){const i=this.buffer;let n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=i.getBlankLine(e,r),this._cachedBlankLine=n),n.isWrapped=r;const u=i.ybase+i.scrollTop,C=i.ybase+i.scrollBottom;if(i.scrollTop===0){const g=i.lines.isFull;C===i.lines.length-1?g?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(C+1,0,n.clone()),g?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const g=C-u+1;i.lines.shiftElements(u+1,g-1,-1),i.lines.set(C,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,r,i){const n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const u=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),u!==n.ydisp&&(r||this._onScroll.fire(n.ydisp))}};t.BufferService=o=h([l(0,v.IOptionsService)],o)},7994:(A,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(A,t,a){var h=this&&this.__decorate||function(n,u,C,g){var b,f=arguments.length,S=f<3?u:g===null?g=Object.getOwnPropertyDescriptor(u,C):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(n,u,C,g);else for(var w=n.length-1;w>=0;w--)(b=n[w])&&(S=(f<3?b(S):f>3?b(u,C,S):b(u,C))||S);return f>3&&S&&Object.defineProperty(u,C,S),S},l=this&&this.__param||function(n,u){return function(C,g){u(C,g,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const s=a(2585),c=a(8460),p=a(844),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:n=>n.button!==4&&n.action===1&&(n.ctrl=!1,n.alt=!1,n.shift=!1,!0)},VT200:{events:19,restrict:n=>n.action!==32},DRAG:{events:23,restrict:n=>n.action!==32||n.button!==3},ANY:{events:31,restrict:n=>!0}};function o(n,u){let C=(n.ctrl?16:0)|(n.shift?4:0)|(n.alt?8:0);return n.button===4?(C|=64,C|=n.action):(C|=3&n.button,4&n.button&&(C|=64),8&n.button&&(C|=128),n.action===32?C|=32:n.action!==0||u||(C|=3)),C}const e=String.fromCharCode,r={DEFAULT:n=>{const u=[o(n,!1)+32,n.col+32,n.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${e(u[0])}${e(u[1])}${e(u[2])}`},SGR:n=>{const u=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.col};${n.row}${u}`},SGR_PIXELS:n=>{const u=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.x};${n.y}${u}`}};let i=t.CoreMouseService=class extends p.Disposable{constructor(n,u){super(),this._bufferService=n,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 C of Object.keys(v))this.addProtocol(C,v[C]);for(const C of Object.keys(r))this.addEncoding(C,r[C]);this.reset()}addProtocol(n,u){this._protocols[n]=u}addEncoding(n,u){this._encodings[n]=u}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(n){if(!this._protocols[n])throw new Error(`unknown protocol "${n}"`);this._activeProtocol=n,this._onProtocolChange.fire(this._protocols[n].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(n){if(!this._encodings[n])throw new Error(`unknown encoding "${n}"`);this._activeEncoding=n}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(n){if(n.col<0||n.col>=this._bufferService.cols||n.row<0||n.row>=this._bufferService.rows||n.button===4&&n.action===32||n.button===3&&n.action!==32||n.button!==4&&(n.action===2||n.action===3)||(n.col++,n.row++,n.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,n,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(n))return!1;const u=this._encodings[this._activeEncoding](n);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!0)),this._lastEvent=n,!0}explainEvents(n){return{down:!!(1&n),up:!!(2&n),drag:!!(4&n),move:!!(8&n),wheel:!!(16&n)}}_equalEvents(n,u,C){if(C){if(n.x!==u.x||n.y!==u.y)return!1}else if(n.col!==u.col||n.row!==u.row)return!1;return n.button===u.button&&n.action===u.action&&n.ctrl===u.ctrl&&n.alt===u.alt&&n.shift===u.shift}};t.CoreMouseService=i=h([l(0,s.IBufferService),l(1,s.ICoreService)],i)},6975:function(A,t,a){var h=this&&this.__decorate||function(i,n,u,C){var g,b=arguments.length,f=b<3?n:C===null?C=Object.getOwnPropertyDescriptor(n,u):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,n,u,C);else for(var S=i.length-1;S>=0;S--)(g=i[S])&&(f=(b<3?g(f):b>3?g(n,u,f):g(n,u))||f);return b>3&&f&&Object.defineProperty(n,u,f),f},l=this&&this.__param||function(i,n){return function(u,C){n(u,C,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const s=a(1439),c=a(8460),p=a(844),v=a(2585),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let r=t.CoreService=class extends p.Disposable{constructor(i,n,u){super(),this._bufferService=i,this._logService=n,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,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}reset(){this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}triggerDataEvent(i,n=!1){if(this._optionsService.rawOptions.disableStdin)return;const u=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),n&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(C=>C.charCodeAt(0))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,()=>i.split("").map(n=>n.charCodeAt(0))),this._onBinary.fire(i))}};t.CoreService=r=h([l(0,v.IBufferService),l(1,v.ILogService),l(2,v.IOptionsService)],r)},9074:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),s=a(844),c=a(6106);let p=0,v=0;class o extends s.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,s.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const n=new e(i);if(n){const u=n.marker.onDispose(()=>n.dispose());n.onDispose(()=>{n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),u.dispose())}),this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,n,u){let C=0,g=0;for(const b of this._decorations.getKeyIterator(n))C=b.options.x??0,g=C+(b.options.width??1),i>=C&&i<g&&(!u||(b.options.layer??"bottom")===u)&&(yield b)}forEachDecorationAtCell(i,n,u,C){this._decorations.forEachByKey(n,g=>{p=g.options.x??0,v=p+(g.options.width??1),i>=p&&i<v&&(!u||(g.options.layer??"bottom")===u)&&C(g)})}}t.DecorationService=o;class e extends s.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new 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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class s{constructor(...p){this._entries=new Map;for(const[v,o]of p)this.set(v,o)}set(p,v){const o=this._entries.get(p);return this._entries.set(p,v),o}forEach(p){for(const[v,o]of this._entries.entries())p(v,o)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}t.ServiceCollection=s,t.InstantiationService=class{constructor(){this._services=new s,this._services.set(h.IInstantiationService,this)}setService(c,p){this._services.set(c,p)}getService(c){return this._services.get(c)}createInstance(c,...p){const v=(0,l.getServiceDependencies)(c).sort((r,i)=>r.index-i.index),o=[];for(const r of v){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${r.id}.`);o.push(i)}const e=v.length>0?v[0].index:p.length;if(p.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${p.length} static arguments`);return new c(...p,...o)}}},7866:function(A,t,a){var h=this&&this.__decorate||function(e,r,i,n){var u,C=arguments.length,g=C<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,r,i,n);else for(var b=e.length-1;b>=0;b--)(u=e[b])&&(g=(C<3?u(g):C>3?u(r,i,g):u(r,i))||g);return C>3&&g&&Object.defineProperty(r,i,g),g},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(844),c=a(2585),p={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let v,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),v=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(...u){if(v.logLevel!==c.LogLevelEnum.TRACE)return n.apply(this,u);v.trace(`GlyphRenderer#${n.name}(${u.map(g=>JSON.stringify(g)).join(", ")})`);const C=n.apply(this,u);return v.trace(`GlyphRenderer#${n.name} return`,C),C}}},7302:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),s=a(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:s.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class p extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const r in o)if(r in e)try{const i=o[r];e[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(r=>{r===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(r=>{o.indexOf(r)!==-1&&e()})}_setupOptions(){const o=r=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},e=(r,i)=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(const r in this.rawOptions){const i={get:o.bind(this,r),set:e.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(r){return r==="block"||r==="underline"||r==="bar"}(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[o];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${o} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${o} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=p},2660:function(A,t,a){var h=this&&this.__decorate||function(p,v,o,e){var r,i=arguments.length,n=i<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(p,v,o,e);else for(var u=p.length-1;u>=0;u--)(r=p[u])&&(n=(i<3?r(n):i>3?r(v,o,n):r(v,o))||n);return i>3&&n&&Object.defineProperty(v,o,n),n},l=this&&this.__param||function(p,v){return function(o,e){v(o,e,p)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const s=a(2585);let c=t.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){const v=this._bufferService.buffer;if(p.id===void 0){const u=v.addMarker(v.ybase+v.y),C={data:p,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(C,u)),this._dataByLinkId.set(C.id,C),C.id}const o=p,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,v.ybase+v.y),r.id;const i=v.addMarker(v.ybase+v.y),n={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(n,i)),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(p,v){const o=this._dataByLinkId.get(p);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(p){var v;return(v=this._dataByLinkId.get(p))==null?void 0:v.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,v){const o=p.lines.indexOf(v);o!==-1&&(p.lines.splice(o,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};t.OscLinkService=c=h([l(0,s.IBufferService)],c)},8343:(A,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 s=function(c,p,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(s,c,v)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},2585:(A,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(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=a(225);class s{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,v,o=!1){return(16777215&p)<<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 p=new l.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let v=0,o=0;const e=p.length;for(let r=0;r<e;++r){let i=p.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return v+this.wcwidth(i);const C=p.charCodeAt(r);56320<=C&&C<=57343?i=1024*(i-55296)+C-56320+65536:v+=this.wcwidth(C)}const n=this.charProperties(i,o);let u=s.extractWidth(n);s.extractShouldJoin(n)&&(u-=s.extractWidth(o)),v+=u,o=n}return v}charProperties(p,v){return this._activeProvider.charProperties(p,v)}}t.UnicodeService=s}},y={};function x(A){var t=y[A];if(t!==void 0)return t.exports;var a=y[A]={exports:{}};return m[A].call(a.exports,a,a.exports,x),a.exports}var B={};return(()=>{var A=B;Object.defineProperty(A,"__esModule",{value:!0}),A.Terminal=void 0;const t=x(9042),a=x(3236),h=x(844),l=x(5741),s=x(8285),c=x(7975),p=x(7090),v=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=u=>this._core.options[u],n=(u,C)=>{this._checkReadonlyOptions(u),this._core.options[u]=C};for(const u in this._core.options){const C={get:i.bind(this,u),set:n.bind(this,u)};Object.defineProperty(this._publicOptions,u,C)}}_checkReadonlyOptions(r){if(v.includes(r))throw new Error(`Option "${r}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new p.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const r=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:r.applicationCursorKeys,applicationKeypadMode:r.applicationKeypad,bracketedPasteMode:r.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:r.origin,reverseWraparoundMode:r.reverseWraparound,sendFocusMode:r.sendFocus,wraparoundMode:r.wraparound}}get options(){return this._publicOptions}set options(r){for(const i in r)this._publicOptions[i]=r[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(r,i=!0){this._core.input(r,i)}resize(r,i){this._verifyIntegers(r,i),this._core.resize(r,i)}open(r){this._core.open(r)}attachCustomKeyEventHandler(r){this._core.attachCustomKeyEventHandler(r)}attachCustomWheelEventHandler(r){this._core.attachCustomWheelEventHandler(r)}registerLinkProvider(r){return this._core.registerLinkProvider(r)}registerCharacterJoiner(r){return this._checkProposedApi(),this._core.registerCharacterJoiner(r)}deregisterCharacterJoiner(r){this._checkProposedApi(),this._core.deregisterCharacterJoiner(r)}registerMarker(r=0){return this._verifyIntegers(r),this._core.registerMarker(r)}registerDecoration(r){return this._checkProposedApi(),this._verifyPositiveIntegers(r.x??0,r.width??0,r.height??0),this._core.registerDecoration(r)}hasSelection(){return this._core.hasSelection()}select(r,i,n){this._verifyIntegers(r,i,n),this._core.select(r,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(r,i){this._verifyIntegers(r,i),this._core.selectLines(r,i)}dispose(){super.dispose()}scrollLines(r){this._verifyIntegers(r),this._core.scrollLines(r)}scrollPages(r){this._verifyIntegers(r),this._core.scrollPages(r)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(r){this._verifyIntegers(r),this._core.scrollToLine(r)}clear(){this._core.clear()}write(r,i){this._core.write(r,i)}writeln(r,i){this._core.write(r),this._core.write(`\r
|
|
23
|
+
`,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}A.Terminal=o})(),B})())})(Ji);var mr=Ji.exports,Qi={exports:{}};(function(d,_){(function(m,y){d.exports=y()})(self,()=>(()=>{var m={};return(()=>{var y=m;Object.defineProperty(y,"__esModule",{value:!0}),y.FitAddon=void 0,y.FitAddon=class{activate(x){this._terminal=x}dispose(){}fit(){const x=this.proposeDimensions();if(!x||!this._terminal||isNaN(x.cols)||isNaN(x.rows))return;const B=this._terminal._core;this._terminal.rows===x.rows&&this._terminal.cols===x.cols||(B._renderService.clear(),this._terminal.resize(x.cols,x.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const x=this._terminal._core,B=x._renderService.dimensions;if(B.css.cell.width===0||B.css.cell.height===0)return;const A=this._terminal.options.scrollback===0?0:x.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),s=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-A;return{cols:Math.max(2,Math.floor(c/B.css.cell.width)),rows:Math.max(1,Math.floor(s/B.css.cell.height))}}}})(),m})())})(Qi);var Sr=Qi.exports,es={exports:{}};(function(d,_){(function(m,y){d.exports=y()})(self,()=>(()=>{var m={965:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),s=a(855),c=a(859),p=a(381),v=11,o=v*Float32Array.BYTES_PER_ELEMENT;let e,r=0,i=0,n=0;class u extends c.Disposable{constructor(g,b,f,S){super(),this._terminal=g,this._gl=b,this._dimensions=f,this._optionsService=S,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const w=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(w.getParameter(w.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(w.getParameter(w.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,p.createProgram)(w,`#version 300 es
|
|
24
24
|
layout (location = 0) in vec2 a_unitquad;
|
|
25
25
|
layout (location = 1) in vec2 a_cellpos;
|
|
26
26
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -54,7 +54,7 @@ void main() {
|
|
|
54
54
|
if (v_texpage == 0) {
|
|
55
55
|
outColor = texture(u_texture[0], v_texcoord);
|
|
56
56
|
} ${N}
|
|
57
|
-
}`}(
|
|
57
|
+
}`}(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)(()=>w.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=w.createVertexArray(),w.bindVertexArray(this._vertexArrayObject);const R=new Float32Array([0,0,1,0,0,1,1,1]),L=w.createBuffer();this.register((0,c.toDisposable)(()=>w.deleteBuffer(L))),w.bindBuffer(w.ARRAY_BUFFER,L),w.bufferData(w.ARRAY_BUFFER,R,w.STATIC_DRAW),w.enableVertexAttribArray(0),w.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const k=new Uint8Array([0,1,2,3]),T=w.createBuffer();this.register((0,c.toDisposable)(()=>w.deleteBuffer(T))),w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,T),w.bufferData(w.ELEMENT_ARRAY_BUFFER,k,w.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(w.createBuffer()),this.register((0,c.toDisposable)(()=>w.deleteBuffer(this._attributesBuffer))),w.bindBuffer(w.ARRAY_BUFFER,this._attributesBuffer),w.enableVertexAttribArray(2),w.vertexAttribPointer(2,2,w.FLOAT,!1,o,0),w.vertexAttribDivisor(2,1),w.enableVertexAttribArray(3),w.vertexAttribPointer(3,2,w.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(3,1),w.enableVertexAttribArray(4),w.vertexAttribPointer(4,1,w.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(4,1),w.enableVertexAttribArray(5),w.vertexAttribPointer(5,2,w.FLOAT,!1,o,5*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(5,1),w.enableVertexAttribArray(6),w.vertexAttribPointer(6,2,w.FLOAT,!1,o,7*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(6,1),w.enableVertexAttribArray(1),w.vertexAttribPointer(1,2,w.FLOAT,!1,o,9*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(1,1),w.useProgram(this._program);const F=new Int32Array(l.TextureAtlas.maxAtlasPages);for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++)F[$]=$;w.uniform1iv(this._textureLocation,F),w.uniformMatrix4fv(this._projectionLocation,!1,p.PROJECTION_MATRIX),this._atlasTextures=[];for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++){const N=new p.GLTexture((0,h.throwIfFalsy)(w.createTexture()));this.register((0,c.toDisposable)(()=>w.deleteTexture(N.texture))),w.activeTexture(w.TEXTURE0+$),w.bindTexture(w.TEXTURE_2D,N.texture),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE),w.texImage2D(w.TEXTURE_2D,0,w.RGBA,1,1,0,w.RGBA,w.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[$]=N}w.enable(w.BLEND),w.blendFunc(w.SRC_ALPHA,w.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(g,b,f,S,w,R,L,k,T){this._updateCell(this._vertices.attributes,g,b,f,S,w,R,L,k,T)}_updateCell(g,b,f,S,w,R,L,k,T,F){r=(f*this._terminal.cols+b)*v,S!==s.NULL_CELL_CODE&&S!==void 0?this._atlas&&(e=k&&k.length>1?this._atlas.getRasterizedGlyphCombinedChar(k,w,R,L,!1):this._atlas.getRasterizedGlyph(S,w,R,L,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),w!==F&&e.offset.x>i?(n=e.offset.x-i,g[r]=-(e.offset.x-n)+this._dimensions.device.char.left,g[r+1]=-e.offset.y+this._dimensions.device.char.top,g[r+2]=(e.size.x-n)/this._dimensions.device.canvas.width,g[r+3]=e.size.y/this._dimensions.device.canvas.height,g[r+4]=e.texturePage,g[r+5]=e.texturePositionClipSpace.x+n/this._atlas.pages[e.texturePage].canvas.width,g[r+6]=e.texturePositionClipSpace.y,g[r+7]=e.sizeClipSpace.x-n/this._atlas.pages[e.texturePage].canvas.width,g[r+8]=e.sizeClipSpace.y):(g[r]=-e.offset.x+this._dimensions.device.char.left,g[r+1]=-e.offset.y+this._dimensions.device.char.top,g[r+2]=e.size.x/this._dimensions.device.canvas.width,g[r+3]=e.size.y/this._dimensions.device.canvas.height,g[r+4]=e.texturePage,g[r+5]=e.texturePositionClipSpace.x,g[r+6]=e.texturePositionClipSpace.y,g[r+7]=e.sizeClipSpace.x,g[r+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(S,T,e.size.x,this._dimensions.device.cell.width)&&(g[r+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):g.fill(0,r,r+v-1-2)}clear(){const g=this._terminal,b=g.cols*g.rows*v;this._vertices.count!==b?this._vertices.attributes=new Float32Array(b):this._vertices.attributes.fill(0);let f=0;for(;f<this._vertices.attributesBuffers.length;f++)this._vertices.count!==b?this._vertices.attributesBuffers[f]=new Float32Array(b):this._vertices.attributesBuffers[f].fill(0);this._vertices.count=b,f=0;for(let S=0;S<g.rows;S++)for(let w=0;w<g.cols;w++)this._vertices.attributes[f+9]=w/g.cols,this._vertices.attributes[f+10]=S/g.rows,f+=v}handleResize(){const g=this._gl;g.useProgram(this._program),g.viewport(0,0,g.canvas.width,g.canvas.height),g.uniform2f(this._resolutionLocation,g.canvas.width,g.canvas.height),this.clear()}render(g){if(!this._atlas)return;const b=this._gl;b.useProgram(this._program),b.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const f=this._vertices.attributesBuffers[this._activeBuffer];let S=0;for(let w=0;w<g.lineLengths.length;w++){const R=w*this._terminal.cols*v,L=this._vertices.attributes.subarray(R,R+g.lineLengths[w]*v);f.set(L,S),S+=L.length}b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.bufferData(b.ARRAY_BUFFER,f.subarray(0,S),b.STREAM_DRAW);for(let w=0;w<this._atlas.pages.length;w++)this._atlas.pages[w].version!==this._atlasTextures[w].version&&this._bindAtlasPageTexture(b,this._atlas,w);b.drawElementsInstanced(b.TRIANGLE_STRIP,4,b.UNSIGNED_BYTE,0,S/v)}setAtlas(g){this._atlas=g;for(const b of this._atlasTextures)b.version=-1}_bindAtlasPageTexture(g,b,f){g.activeTexture(g.TEXTURE0+f),g.bindTexture(g.TEXTURE_2D,this._atlasTextures[f].texture),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texImage2D(g.TEXTURE_2D,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,b.pages[f].canvas),g.generateMipmap(g.TEXTURE_2D),this._atlasTextures[f].version=b.pages[f].version}setDimensions(g){this._dimensions=g}}t.GlyphRenderer=u},742:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=a(374),l=a(859),s=a(310),c=a(381),p=8*Float32Array.BYTES_PER_ELEMENT;class v{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,r=0,i=0,n=0,u=0,C=0;class g extends l.Disposable{constructor(f,S,w,R){super(),this._terminal=f,this._gl=S,this._dimensions=w,this._themeService=R,this._vertices=new v,this._verticesCursor=new v;const L=this._gl;this._program=(0,h.throwIfFalsy)((0,c.createProgram)(L,`#version 300 es
|
|
58
58
|
layout (location = 0) in vec2 a_position;
|
|
59
59
|
layout (location = 1) in vec2 a_size;
|
|
60
60
|
layout (location = 2) in vec4 a_color;
|
|
@@ -77,7 +77,7 @@ out vec4 outColor;
|
|
|
77
77
|
|
|
78
78
|
void main() {
|
|
79
79
|
outColor = v_color;
|
|
80
|
-
}`)),this.register((0,c.toDisposable)(()=>L.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(L.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=L.createVertexArray(),L.bindVertexArray(this._vertexArrayObject);const x=new Float32Array([0,0,1,0,0,1,1,1]),T=L.createBuffer();this.register((0,c.toDisposable)(()=>L.deleteBuffer(T))),L.bindBuffer(L.ARRAY_BUFFER,T),L.bufferData(L.ARRAY_BUFFER,x,L.STATIC_DRAW),L.enableVertexAttribArray(3),L.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const F=new Uint8Array([0,1,2,3]),$=L.createBuffer();this.register((0,c.toDisposable)(()=>L.deleteBuffer($))),L.bindBuffer(L.ELEMENT_ARRAY_BUFFER,$),L.bufferData(L.ELEMENT_ARRAY_BUFFER,F,L.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(L.createBuffer()),this.register((0,c.toDisposable)(()=>L.deleteBuffer(this._attributesBuffer))),L.bindBuffer(L.ARRAY_BUFFER,this._attributesBuffer),L.enableVertexAttribArray(0),L.vertexAttribPointer(0,2,L.FLOAT,!1,f,0),L.vertexAttribDivisor(0,1),L.enableVertexAttribArray(1),L.vertexAttribPointer(1,2,L.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(1,1),L.enableVertexAttribArray(2),L.vertexAttribPointer(2,4,L.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(2,1),this._updateCachedColors(R.colors),this.register(this._themeService.onChangeColors(N=>{this._updateCachedColors(N),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(_){const S=this._gl;S.useProgram(this._program),S.bindVertexArray(this._vertexArrayObject),S.uniformMatrix4fv(this._projectionLocation,!1,l.PROJECTION_MATRIX),S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.bufferData(S.ARRAY_BUFFER,_.attributes,S.DYNAMIC_DRAW),S.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,S.UNSIGNED_BYTE,0,_.count)}handleResize(){this._updateViewportRectangle()}setDimensions(_){this._dimensions=_}_updateCachedColors(_){this._bgFloat=this._colorToFloat32Array(_.background),this._cursorFloat=this._colorToFloat32Array(_.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(_){const S=this._terminal,w=this._vertices;let R,L,x,T,F,$,N,H,E,M,B,P=1;for(R=0;R<S.rows;R++){for(x=-1,T=0,F=0,$=!1,L=0;L<S.cols;L++)N=(R*S.cols+L)*s.RENDER_MODEL_INDICIES_PER_CELL,H=_.cells[N+s.RENDER_MODEL_BG_OFFSET],E=_.cells[N+s.RENDER_MODEL_FG_OFFSET],M=!!(67108864&E),(H!==T||E!==F&&($||M))&&((T!==0||$&&F!==0)&&(B=8*P++,this._updateRectangle(w,B,F,T,x,L,R)),x=L,T=H,F=E,$=M);(T!==0||$&&F!==0)&&(B=8*P++,this._updateRectangle(w,B,F,T,x,S.cols,R))}w.count=P}updateCursor(_){const S=this._verticesCursor,w=_.cursor;if(!w||w.style==="block")return void(S.count=0);let R,L=0;w.style!=="bar"&&w.style!=="outline"||(R=8*L++,this._addRectangleFloat(S.attributes,R,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.style==="bar"?w.dpr*w.cursorWidth:w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),w.style!=="underline"&&w.style!=="outline"||(R=8*L++,this._addRectangleFloat(S.attributes,R,w.x*this._dimensions.device.cell.width,(w.y+1)*this._dimensions.device.cell.height-w.dpr,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat)),w.style==="outline"&&(R=8*L++,this._addRectangleFloat(S.attributes,R,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat),R=8*L++,this._addRectangleFloat(S.attributes,R,(w.x+w.width)*this._dimensions.device.cell.width-w.dpr,w.y*this._dimensions.device.cell.height,w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.count=L}_updateRectangle(_,S,w,R,L,x,T){if(67108864&w)switch(50331648&w){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&w].rgba;break;case 50331648:o=(16777215&w)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&R){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&R].rgba;break;case 50331648:o=(16777215&R)<<8;break;default:o=this._themeService.colors.background.rgba}_.attributes.length<S+4&&(_.attributes=(0,l.expandFloat32Array)(_.attributes,this._terminal.rows*this._terminal.cols*8)),e=L*this._dimensions.device.cell.width,r=T*this._dimensions.device.cell.height,i=(o>>24&255)/255,n=(o>>16&255)/255,d=(o>>8&255)/255,C=1,this._addRectangle(_.attributes,S,e,r,(x-L)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,n,d,C)}_addRectangle(_,S,w,R,L,x,T,F,$,N){_[S]=w/this._dimensions.device.canvas.width,_[S+1]=R/this._dimensions.device.canvas.height,_[S+2]=L/this._dimensions.device.canvas.width,_[S+3]=x/this._dimensions.device.canvas.height,_[S+4]=T,_[S+5]=F,_[S+6]=$,_[S+7]=N}_addRectangleFloat(_,S,w,R,L,x,T){_[S]=w/this._dimensions.device.canvas.width,_[S+1]=R/this._dimensions.device.canvas.height,_[S+2]=L/this._dimensions.device.canvas.width,_[S+3]=x/this._dimensions.device.canvas.height,_[S+4]=T[0],_[S+5]=T[1],_[S+6]=T[2],_[S+7]=T[3]}_colorToFloat32Array(_){return new Float32Array([(_.rgba>>24&255)/255,(_.rgba>>16&255)/255,(_.rgba>>8&255)/255,(255&_.rgba)/255])}}t.RectangleRenderer=g},310:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(c,s){const l=c*s*t.RENDER_MODEL_INDICIES_PER_CELL;l!==this.cells.length&&(this.cells=new Uint32Array(l),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),c=a(274),s=a(627),l=a(457),f=a(56),v=a(374),o=a(345),e=a(859),r=a(147),i=a(782),n=a(855),d=a(965),C=a(742),g=a(310),b=a(733);class _ extends e.Disposable{constructor(L,x,T,F,$,N,H,E,M){super(),this._terminal=L,this._characterJoinerService=x,this._charSizeService=T,this._coreBrowserService=F,this._coreService=$,this._decorationService=N,this._optionsService=H,this._themeService=E,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new g.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new c.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new b.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,H,this._themeService)],this.dimensions=(0,v.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(H.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const B={antialias:!1,depth:!1,preserveDrawingBuffer:M};if(this._gl=this._canvas.getContext("webgl2",B),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",P=>{console.log("webglcontextlost event received"),P.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(P)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",P=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(P,U)=>this._setCanvasDevicePixelDimensions(P,U)),this.register(this._coreBrowserService.onWindowChange(P=>{this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,P,(U,q)=>this._setCanvasDevicePixelDimensions(U,q))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var P;for(const U of this._renderLayers)U.dispose();(P=this._canvas.parentElement)==null||P.removeChild(this._canvas),(0,s.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var L;return(L=this._charAtlas)==null?void 0:L.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(L,x){var T,F,$,N;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const H of this._renderLayers)H.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`,(T=this._rectangleRenderer.value)==null||T.setDimensions(this.dimensions),(F=this._rectangleRenderer.value)==null||F.handleResize(),($=this._glyphRenderer.value)==null||$.setDimensions(this.dimensions),(N=this._glyphRenderer.value)==null||N.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var L;for(const x of this._renderLayers)x.handleBlur(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.pause(),this._requestRedrawViewport()}handleFocus(){var L;for(const x of this._renderLayers)x.handleFocus(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.resume(),this._requestRedrawViewport()}handleSelectionChanged(L,x,T){for(const F of this._renderLayers)F.handleSelectionChanged(this._terminal,L,x,T);this._model.selection.update(this._core,L,x,T),this._requestRedrawViewport()}handleCursorMove(){var L;for(const x of this._renderLayers)x.handleCursorMove(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new C.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new d.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var x;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const L=(0,s.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==L&&(this._onChangeTextureAtlas.fire(L.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(L.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(L.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=L,this._charAtlas.warmUp(),(x=this._glyphRenderer.value)==null||x.setAtlas(this._charAtlas)}_clearModel(L){var x;this._model.clear(),L&&((x=this._glyphRenderer.value)==null||x.clear())}clearTextureAtlas(){var L;(L=this._charAtlas)==null||L.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var L;this._clearModel(!0);for(const x of this._renderLayers)x.reset(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(L){return-1}deregisterCharacterJoiner(L){return!1}renderRows(L,x){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 T of this._renderLayers)T.handleGridChanged(this._terminal,L,x);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(L,x),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 l.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(L,x){const T=this._core;let F,$,N,H,E,M,B,P,U,q,Y,G,I,D,j=this._workCell;L=w(L,T.rows-1,0),x=w(x,T.rows-1,0);const W=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=W-T.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,T.cols-1);let ee=-1;const J=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let he=!1;for($=L;$<=x;$++)for(N=$+T.buffer.ydisp,H=T.buffer.lines.get(N),this._model.lineLengths[$]=0,E=this._characterJoinerService.getJoinedCharacters(N),I=0;I<T.cols;I++)if(F=this._cellColorResolver.result.bg,H.loadCell(I,j),I===0&&(F=this._cellColorResolver.result.bg),M=!1,B=I,E.length>0&&I===E[0][0]&&(M=!0,P=E.shift(),j=new S(j,H.translateToString(!0,P[0],P[1]),P[1]-P[0]),B=P[1]-1),U=j.getChars(),q=j.getCode(),G=($*T.cols+I)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(j,I,N,this.dimensions.device.cell.width),J&&N===W&&(I===K&&(this._model.cursor={x:K,y:V,width:j.getWidth(),style:this._coreBrowserService.isFocused?T.options.cursorStyle||"block":T.options.cursorInactiveStyle,cursorWidth:T.options.cursorWidth,dpr:this._devicePixelRatio},ee=K+j.getWidth()-1),I>=K&&I<=ee&&(this._coreBrowserService.isFocused&&(T.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&T.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),q!==n.NULL_CELL_CODE&&(this._model.lineLengths[$]=I+1),(this._model.cells[G]!==q||this._model.cells[G+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[G+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[G+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(he=!0,U.length>1&&(q|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[G]=q,this._model.cells[G+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[G+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[G+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=j.getWidth(),this._glyphRenderer.value.updateCell(I,$,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,Y,F),M))for(j=this._workCell,I++;I<B;I++)D=($*T.cols+I)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(I,$,n.NULL_CELL_CODE,0,0,0,n.NULL_CELL_CHAR,0,0),this._model.cells[D]=n.NULL_CELL_CODE,this._model.cells[D+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[D+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[D+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;he&&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(L,x){this._canvas.width===L&&this._canvas.height===x||(this._canvas.width=L,this._canvas.height=x,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const L=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:L,end:L})}}t.WebglRenderer=_;class S extends r.AttributeData{constructor(L,x,T){super(),this.content=0,this.combinedData="",this.fg=L.fg,this.bg=L.bg,this.combinedData=x,this._width=T}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(L){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function w(R,L,x=0){return Math.max(Math.min(R,L),x)}t.JoinedCellData=S},381:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=a(374);function c(s,l,f){const v=(0,h.throwIfFalsy)(s.createShader(l));if(s.shaderSource(v,f),s.compileShader(v),s.getShaderParameter(v,s.COMPILE_STATUS))return v;console.error(s.getShaderInfoLog(v)),s.deleteShader(v)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,l,f){const v=(0,h.throwIfFalsy)(s.createProgram());if(s.attachShader(v,(0,h.throwIfFalsy)(c(s,s.VERTEX_SHADER,l))),s.attachShader(v,(0,h.throwIfFalsy)(c(s,s.FRAGMENT_SHADER,f))),s.linkProgram(v),s.getProgramParameter(v,s.LINK_STATUS))return v;console.error(s.getProgramInfoLog(v)),s.deleteProgram(v)},t.createShader=c,t.expandFloat32Array=function(s,l){const f=Math.min(2*s.length,l),v=new Float32Array(f);for(let o=0;o<s.length;o++)v[o]=s[o];return v},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),c=a(237),s=a(374),l=a(859);class f extends l.Disposable{constructor(o,e,r,i,n,d,C,g){super(),this._container=e,this._alpha=n,this._coreBrowserService=d,this._optionsService=C,this._themeService=g,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(b=>{this._refreshCharAtlas(o,b),this.reset(o)})),this.register((0,l.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=c.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=f},733:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),c=a(237),s=a(592);class l extends s.BaseRenderLayer{constructor(v,o,e,r,i,n,d){super(e,v,"link",o,!0,i,n,d),this.register(r.onShowLinkUnderline(C=>this._handleShowLinkUnderline(C))),this.register(r.onHideLinkUnderline(C=>this._handleHideLinkUnderline(C)))}resize(v,o){super.resize(v,o),this._state=void 0}reset(v){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const v=this._state.y2-this._state.y1-1;v>0&&this._clearCells(0,this._state.y1+1,this._state.cols,v),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(v){if(v.fg===c.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:v.fg!==void 0&&(0,h.is256Color)(v.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[v.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,v.y1===v.y2)this._fillBottomLineAtCells(v.x1,v.y1,v.x2-v.x1);else{this._fillBottomLineAtCells(v.x1,v.y1,v.cols-v.x1);for(let o=v.y1+1;o<v.y2;o++)this._fillBottomLineAtCells(0,o,v.cols);this._fillBottomLineAtCells(0,v.y2,v.x2)}this._state=v}_handleHideLinkUnderline(v){this._clearCurrentLink()}}t.LinkRenderLayer=l},820:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,c,s){a.addEventListener(h,c,s);let l=!1;return{dispose:()=>{l||(l=!0,a.removeEventListener(h,c,s))}}}},274:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),c=a(160),s=a(374);let l,f=0,v=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(n,d,C,g,b,_){this._terminal=n,this._optionService=d,this._selectionRenderModel=C,this._decorationService=g,this._coreBrowserService=b,this._themeService=_,this.result={fg:0,bg:0,ext:0}}resolve(n,d,C,g){if(this.result.bg=n.bg,this.result.fg=n.fg,this.result.ext=268435456&n.bg?n.extended.ext:0,v=0,f=0,e=!1,o=!1,r=!1,l=this._themeService.colors,i=0,n.getCode()!==h.NULL_CELL_CODE&&n.extended.underlineStyle===4){const b=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=d*g%(2*Math.round(b))}if(this._decorationService.forEachDecorationAtCell(d,C,"bottom",b=>{b.backgroundColorRGB&&(v=b.backgroundColorRGB.rgba>>8&16777215,e=!0),b.foregroundColorRGB&&(f=b.foregroundColorRGB.rgba>>8&16777215,o=!0)}),r=this._selectionRenderModel.isCellSelected(this._terminal,d,C),r){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:v=(16777215&this.result.fg)<<8|255;break;default:v=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:v=(16777215&this.result.bg)<<8|255}v=c.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?l.selectionBackgroundOpaque:l.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else v=(this._coreBrowserService.isFocused?l.selectionBackgroundOpaque:l.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,l.selectionForeground&&(f=l.selectionForeground.rgba>>8&16777215,o=!0),(0,s.treatGlyphAsBackgroundColor)(n.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))f=(this._coreBrowserService.isFocused?l.selectionBackgroundOpaque:l.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=c.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?l.selectionBackgroundOpaque:l.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(d,C,"top",b=>{b.backgroundColorRGB&&(v=b.backgroundColorRGB.rgba>>8&16777215,e=!0),b.foregroundColorRGB&&(f=b.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(v=r?-16777216&n.bg&-134217729|v|50331648:-16777216&n.bg|v|50331648),o&&(f=-16777216&n.fg&-67108865|f|50331648),67108864&this.result.fg&&(e&&!o&&(f=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&l.background.rgba>>8|50331648,o=!0),!e&&o&&(v=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&l.foreground.rgba>>8|50331648,e=!0)),l=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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),c=a(197),s=[];t.acquireTextureAtlas=function(l,f,v,o,e,r,i,n){const d=(0,c.generateConfig)(o,e,r,i,f,v,n);for(let b=0;b<s.length;b++){const _=s[b],S=_.ownedBy.indexOf(l);if(S>=0){if((0,c.configEquals)(_.config,d))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),s.splice(b,1)):_.ownedBy.splice(S,1);break}}for(let b=0;b<s.length;b++){const _=s[b];if((0,c.configEquals)(_.config,d))return _.ownedBy.push(l),_.atlas}const C=l._core,g={atlas:new h.TextureAtlas(document,d,C.unicodeService),config:d,ownedBy:[l]};return s.push(g),g.atlas},t.removeTerminalFromCache=function(l){for(let f=0;f<s.length;f++){const v=s[f].ownedBy.indexOf(l);if(v!==-1){s[f].ownedBy.length===1?(s[f].atlas.dispose(),s.splice(f,1)):s[f].ownedBy.splice(v,1);break}}}},197:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(c,s,l,f,v,o,e){const r={foreground:o.foreground,background:o.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:v.customGlyphs,devicePixelRatio:e,letterSpacing:v.letterSpacing,lineHeight:v.lineHeight,deviceCellWidth:c,deviceCellHeight:s,deviceCharWidth:l,deviceCharHeight:f,fontFamily:v.fontFamily,fontSize:v.fontSize,fontWeight:v.fontWeight,fontWeightBold:v.fontWeightBold,allowTransparency:v.allowTransparency,drawBoldTextInBrightColors:v.drawBoldTextInBrightColors,minimumContrastRatio:v.minimumContrastRatio,colors:r}},t.configEquals=function(c,s){for(let l=0;l<c.colors.ansi.length;l++)if(c.colors.ansi[l].rgba!==s.colors.ansi[l].rgba)return!1;return c.devicePixelRatio===s.devicePixelRatio&&c.customGlyphs===s.customGlyphs&&c.lineHeight===s.lineHeight&&c.letterSpacing===s.letterSpacing&&c.fontFamily===s.fontFamily&&c.fontSize===s.fontSize&&c.fontWeight===s.fontWeight&&c.fontWeightBold===s.fontWeightBold&&c.allowTransparency===s.allowTransparency&&c.deviceCharWidth===s.deviceCharWidth&&c.deviceCharHeight===s.deviceCharHeight&&c.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&c.minimumContrastRatio===s.minimumContrastRatio&&c.colors.foreground.rgba===s.colors.foreground.rgba&&c.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(c){return(50331648&c)==16777216||(50331648&c)==33554432}},237:(A,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:(A,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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const c={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,r,i,n,d,C,g){const b=t.blockElementDefinitions[e];if(b)return function(R,L,x,T,F,$){for(let N=0;N<L.length;N++){const H=L[N],E=F/8,M=$/8;R.fillRect(x+H.x*E,T+H.y*M,H.w*E,H.h*M)}}(o,b,r,i,n,d),!0;const _=c[e];if(_)return function(R,L,x,T,F,$){let N=s.get(L);N||(N=new Map,s.set(L,N));const H=R.fillStyle;if(typeof H!="string")throw new Error(`Unexpected fillStyle type "${H}"`);let E=N.get(H);if(!E){const M=L[0].length,B=L.length,P=R.canvas.ownerDocument.createElement("canvas");P.width=M,P.height=B;const U=(0,h.throwIfFalsy)(P.getContext("2d")),q=new ImageData(M,B);let Y,G,I,D;if(H.startsWith("#"))Y=parseInt(H.slice(1,3),16),G=parseInt(H.slice(3,5),16),I=parseInt(H.slice(5,7),16),D=H.length>7&&parseInt(H.slice(7,9),16)||1;else{if(!H.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${H}" when drawing pattern glyph`);[Y,G,I,D]=H.substring(5,H.length-1).split(",").map(j=>parseFloat(j))}for(let j=0;j<B;j++)for(let W=0;W<M;W++)q.data[4*(j*M+W)]=Y,q.data[4*(j*M+W)+1]=G,q.data[4*(j*M+W)+2]=I,q.data[4*(j*M+W)+3]=L[j][W]*(255*D);U.putImageData(q,0,0),E=(0,h.throwIfFalsy)(R.createPattern(P,null)),N.set(H,E)}R.fillStyle=E,R.fillRect(x,T,F,$)}(o,_,r,i,n,d),!0;const S=t.boxDrawingDefinitions[e];if(S)return function(R,L,x,T,F,$,N){R.strokeStyle=R.fillStyle;for(const[H,E]of Object.entries(L)){let M;R.beginPath(),R.lineWidth=N*Number.parseInt(H),M=typeof E=="function"?E(.15,.15/$*F):E;for(const B of M.split(" ")){const P=B[0],U=f[P];if(!U){console.error(`Could not find drawing instructions for "${P}"`);continue}const q=B.substring(1).split(",");q[0]&&q[1]&&U(R,v(q,F,$,x,T,!0,N))}R.stroke(),R.closePath()}}(o,S,r,i,n,d,g),!0;const w=t.powerlineDefinitions[e];return!!w&&(function(R,L,x,T,F,$,N,H){const E=new Path2D;E.rect(x,T,F,$),R.clip(E),R.beginPath();const M=N/12;R.lineWidth=H*M;for(const B of L.d.split(" ")){const P=B[0],U=f[P];if(!U){console.error(`Could not find drawing instructions for "${P}"`);continue}const q=B.substring(1).split(",");q[0]&&q[1]&&U(R,v(q,F,$,x,T,!1,H,(L.leftPadding??0)*(M/2),(L.rightPadding??0)*(M/2)))}L.type===1?(R.strokeStyle=R.fillStyle,R.stroke()):R.fill(),R.closePath()}(o,w,r,i,n,d,C,g),!0)};const s=new Map;function l(o,e,r=0){return Math.max(Math.min(o,e),r)}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,r,i,n,d,C,g=0,b=0){const _=o.map(S=>parseFloat(S)||parseInt(S));if(_.length<2)throw new Error("Too few arguments for instruction");for(let S=0;S<_.length;S+=2)_[S]*=e-g*C-b*C,d&&_[S]!==0&&(_[S]=l(Math.round(_[S]+.5)-.5,e,0)),_[S]+=i+g*C;for(let S=1;S<_.length;S+=2)_[S]*=r,d&&_[S]!==0&&(_[S]=l(Math.round(_[S]+.5)-.5,r,0)),_[S]+=n;return _}},56:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(c,s,l){let f=new s.ResizeObserver(v=>{const o=v.find(i=>i.target===c);if(!o)return;if(!("devicePixelContentBoxSize"in o))return f==null||f.disconnect(),void(f=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&l(e,r)});try{f.observe(c,{box:["device-pixel-content-box"]})}catch{f.disconnect(),f=void 0}return(0,h.toDisposable)(()=>f==null?void 0:f.disconnect())}},374:(A,t)=>{function a(c){return 57508<=c&&c<=57558}function h(c){return c>=128512&&c<=128591||c>=127744&&c<=128511||c>=128640&&c<=128767||c>=9728&&c<=9983||c>=9984&&c<=10175||c>=65024&&c<=65039||c>=129280&&c<=129535||c>=127462&&c<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},t.isEmoji=h,t.allowRescaling=function(c,s,l,f){return s===1&&l>Math.ceil(1.5*f)&&c!==void 0&&c>255&&!h(c)&&!a(c)&&!function(v){return 57344<=v&&v<=63743}(c)},t.treatGlyphAsBackgroundColor=function(c){return a(c)||function(s){return 9472<=s&&s<=9631}(c)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(c,s,l=0){return(c-(2*Math.round(s)-l))%(2*Math.round(s))}},296:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(c,s,l,f=!1){if(this.selectionStart=s,this.selectionEnd=l,!s||!l||s[0]===l[0]&&s[1]===l[1])return void this.clear();const v=c.buffers.active.ydisp,o=s[1]-v,e=l[1]-v,r=Math.max(o,0),i=Math.min(e,c.rows-1);r>=c.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=l[0])}isCellSelected(c,s,l){return!!this.hasSelection&&(l-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&l>=this.viewportCappedStartRow&&s<this.endCol&&l<=this.viewportCappedEndRow:s<this.startCol&&l>=this.viewportCappedStartRow&&s>=this.endCol&&l<=this.viewportCappedEndRow:l>this.viewportStartRow&&l<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&l===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),c=a(860),s=a(374),l=a(160),f=a(345),v=a(485),o=a(385),e=a(147),r=a(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let n;class d{get pages(){return this._pages}constructor(S,w,R){this._document=S,this._config=w,this._unicodeService=R,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=b(S,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,s.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const S of this.pages)S.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const S=new o.IdleTaskQueue;for(let w=33;w<126;w++)S.enqueue(()=>{if(!this._cacheMap.get(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const R=this._drawToCache(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,R)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const S of this._pages)S.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(d.maxAtlasPages&&this._pages.length>=Math.max(4,d.maxAtlasPages)){const w=this._pages.filter(N=>2*N.canvas.width<=(d.maxTextureSize||4096)).sort((N,H)=>H.canvas.width!==N.canvas.width?H.canvas.width-N.canvas.width:H.percentageUsed-N.percentageUsed);let R=-1,L=0;for(let N=0;N<w.length;N++)if(w[N].canvas.width!==L)R=N,L=w[N].canvas.width;else if(N-R==3)break;const x=w.slice(R,R+4),T=x.map(N=>N.glyphs[0].texturePage).sort((N,H)=>N>H?1:-1),F=this.pages.length-x.length,$=this._mergePages(x,F);$.version++;for(let N=T.length-1;N>=0;N--)this._deletePage(T[N]);this.pages.push($),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire($.canvas)}const S=new C(this._document,this._textureSize);return this._pages.push(S),this._activePages.push(S),this._onAddTextureAtlasCanvas.fire(S.canvas),S}_mergePages(S,w){const R=2*S[0].canvas.width,L=new C(this._document,R,S);for(const[x,T]of S.entries()){const F=x*T.canvas.width%R,$=Math.floor(x/2)*T.canvas.height;L.ctx.drawImage(T.canvas,F,$);for(const H of T.glyphs)H.texturePage=w,H.sizeClipSpace.x=H.size.x/R,H.sizeClipSpace.y=H.size.y/R,H.texturePosition.x+=F,H.texturePosition.y+=$,H.texturePositionClipSpace.x=H.texturePosition.x/R,H.texturePositionClipSpace.y=H.texturePosition.y/R;this._onRemoveTextureAtlasCanvas.fire(T.canvas);const N=this._activePages.indexOf(T);N!==-1&&this._activePages.splice(N,1)}return L}_deletePage(S){this._pages.splice(S,1);for(let w=S;w<this._pages.length;w++){const R=this._pages[w];for(const L of R.glyphs)L.texturePage--;R.version++}}getRasterizedGlyphCombinedChar(S,w,R,L,x){return this._getFromCacheMap(this._cacheMapCombined,S,w,R,L,x)}getRasterizedGlyph(S,w,R,L,x){return this._getFromCacheMap(this._cacheMap,S,w,R,L,x)}_getFromCacheMap(S,w,R,L,x,T=!1){return n=S.get(w,R,L,x),n||(n=this._drawToCache(w,R,L,x,T),S.set(w,R,L,x,n)),n}_getColorFromAnsiIndex(S){if(S>=this._config.colors.ansi.length)throw new Error("No color found for idx "+S);return this._config.colors.ansi[S]}_getBackgroundColor(S,w,R,L){if(this._config.allowTransparency)return l.NULL_COLOR;let x;switch(S){case 16777216:case 33554432:x=this._getColorFromAnsiIndex(w);break;case 50331648:const T=e.AttributeData.toColorRGB(w);x=l.channels.toColor(T[0],T[1],T[2]);break;default:x=R?l.color.opaque(this._config.colors.foreground):this._config.colors.background}return x}_getForegroundColor(S,w,R,L,x,T,F,$,N,H){const E=this._getMinimumContrastColor(S,w,R,L,x,T,F,N,$,H);if(E)return E;let M;switch(x){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&N&&T<8&&(T+=8),M=this._getColorFromAnsiIndex(T);break;case 50331648:const B=e.AttributeData.toColorRGB(T);M=l.channels.toColor(B[0],B[1],B[2]);break;default:M=F?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(M=l.color.opaque(M)),$&&(M=l.color.multiplyOpacity(M,h.DIM_OPACITY)),M}_resolveBackgroundRgba(S,w,R){switch(S){case 16777216:case 33554432:return this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;default:return R?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(S,w,R,L){switch(S){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&L&&w<8&&(w+=8),this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;default:return R?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(S,w,R,L,x,T,F,$,N,H){if(this._config.minimumContrastRatio===1||H)return;const E=this._getContrastCache(N),M=E.getColor(S,L);if(M!==void 0)return M||void 0;const B=this._resolveBackgroundRgba(w,R,F),P=this._resolveForegroundRgba(x,T,F,$),U=l.rgba.ensureContrastRatio(B,P,this._config.minimumContrastRatio/(N?2:1));if(!U)return void E.setColor(S,L,null);const q=l.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return E.setColor(S,L,q),q}_getContrastCache(S){return S?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(S,w,R,L,x=!1){const T=typeof S=="number"?String.fromCharCode(S):S,F=Math.min(this._config.deviceCellWidth*Math.max(T.length,2)+4,this._textureSize);this._tmpCanvas.width<F&&(this._tmpCanvas.width=F);const $=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<$&&(this._tmpCanvas.height=$),this._tmpCtx.save(),this._workAttributeData.fg=R,this._workAttributeData.bg=w,this._workAttributeData.extended.ext=L,this._workAttributeData.isInvisible())return i;const N=!!this._workAttributeData.isBold(),H=!!this._workAttributeData.isInverse(),E=!!this._workAttributeData.isDim(),M=!!this._workAttributeData.isItalic(),B=!!this._workAttributeData.isUnderline(),P=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),G=this._workAttributeData.getBgColor(),I=this._workAttributeData.getBgColorMode();if(H){const X=q;q=G,G=X;const oe=Y;Y=I,I=oe}const D=this._getBackgroundColor(I,G,H,E);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=D.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const j=N?this._config.fontWeightBold:this._config.fontWeight,W=M?"italic":"";this._tmpCtx.font=`${W} ${j} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const V=T.length===1&&(0,s.isPowerlineGlyph)(T.charCodeAt(0)),K=T.length===1&&(0,s.isRestrictedPowerlineGlyph)(T.charCodeAt(0)),ee=this._getForegroundColor(w,I,G,R,Y,q,H,E,N,(0,s.treatGlyphAsBackgroundColor)(T.charCodeAt(0)));this._tmpCtx.fillStyle=ee.css;const J=K?0:4;let he=!1;this._config.customGlyphs!==!1&&(he=(0,c.tryDrawCustomChar)(this._tmpCtx,T,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let ge,Z=!V;if(ge=typeof S=="number"?this._unicodeService.wcwidth(S):this._unicodeService.getStringCellWidth(S),B){this._tmpCtx.save();const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),oe=X%2==1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Z=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Z=!1;let ve=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ve<8&&(ve+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ve).css}this._tmpCtx.beginPath();const fe=J,de=Math.ceil(J+this._config.deviceCharHeight)-oe-(x?2*X:0),Me=de+X,be=de+2*X;let xe=this._workAttributeData.getUnderlineVariantOffset();for(let ve=0;ve<ge;ve++){this._tmpCtx.save();const le=fe+ve*this._config.deviceCellWidth,ie=fe+(ve+1)*this._config.deviceCellWidth,nt=le+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(le,de),this._tmpCtx.lineTo(ie,de),this._tmpCtx.moveTo(le,be),this._tmpCtx.lineTo(ie,be);break;case 3:const St=X<=1?be:Math.ceil(J+this._config.deviceCharHeight-X/2)-oe,Ct=X<=1?de:Math.ceil(J+this._config.deviceCharHeight+X/2)-oe,di=new Path2D;di.rect(le,de,this._config.deviceCellWidth,be-de),this._tmpCtx.clip(di),this._tmpCtx.moveTo(le-this._config.deviceCellWidth/2,Me),this._tmpCtx.bezierCurveTo(le-this._config.deviceCellWidth/2,Ct,le,Ct,le,Me),this._tmpCtx.bezierCurveTo(le,St,nt,St,nt,Me),this._tmpCtx.bezierCurveTo(nt,Ct,ie,Ct,ie,Me),this._tmpCtx.bezierCurveTo(ie,St,ie+this._config.deviceCellWidth/2,St,ie+this._config.deviceCellWidth/2,Me);break;case 4:const bt=xe===0?0:xe>=X?2*X-xe:X-xe;xe>=X||bt===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(le+bt,de),this._tmpCtx.lineTo(ie,de)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(le,de),this._tmpCtx.lineTo(le+bt,de),this._tmpCtx.moveTo(le+bt+X,de),this._tmpCtx.lineTo(ie,de)),xe=(0,s.computeNextVariantOffset)(ie-le,X,xe);break;case 5:const Es=.6,Ls=.3,Tt=ie-le,ui=Math.floor(Es*Tt),_i=Math.floor(Ls*Tt),xs=Tt-ui-_i;this._tmpCtx.setLineDash([ui,_i,xs]),this._tmpCtx.moveTo(le,de),this._tmpCtx.lineTo(ie,de);break;default:this._tmpCtx.moveTo(le,de),this._tmpCtx.lineTo(ie,de)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!he&&this._config.fontSize>=12&&!this._config.allowTransparency&&T!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ve=this._tmpCtx.measureText(T);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ve&&ve.actualBoundingBoxDescent>0){this._tmpCtx.save();const le=new Path2D;le.rect(fe,de-Math.ceil(X/2),this._config.deviceCellWidth*ge,be-de+Math.ceil(X/2)),this._tmpCtx.clip(le),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=D.css,this._tmpCtx.strokeText(T,J,J+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),oe=X%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+oe),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*ge,J+oe),this._tmpCtx.stroke()}if(he||this._tmpCtx.fillText(T,J,J+this._config.deviceCharHeight),T==="_"&&!this._config.allowTransparency){let X=g(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),D,ee,Z);if(X)for(let oe=1;oe<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=D.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(T,J,J+this._config.deviceCharHeight-oe),X=g(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),D,ee,Z),X);oe++);}if(P){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),oe=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+Math.floor(this._config.deviceCharHeight/2)-oe),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*ge,J+Math.floor(this._config.deviceCharHeight/2)-oe),this._tmpCtx.stroke()}this._tmpCtx.restore();const Re=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Ze;if(Ze=this._config.allowTransparency?function(X){for(let oe=0;oe<X.data.length;oe+=4)if(X.data[oe+3]>0)return!1;return!0}(Re):g(Re,D,ee,Z),Ze)return i;const ae=this._findGlyphBoundingBox(Re,this._workBoundingBox,F,K,he,J);let se,re;for(;;){if(this._activePages.length===0){const X=this._createNewPage();se=X,re=X.currentRow,re.height=ae.size.y;break}se=this._activePages[this._activePages.length-1],re=se.currentRow;for(const X of this._activePages)ae.size.y<=X.currentRow.height&&(se=X,re=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const oe of this._activePages[X].fixedRows)oe.height<=re.height&&ae.size.y<=oe.height&&(se=this._activePages[X],re=oe);if(re.y+ae.size.y>=se.canvas.height||re.height>ae.size.y+2){let X=!1;if(se.currentRow.y+se.currentRow.height+ae.size.y>=se.canvas.height){let oe;for(const fe of this._activePages)if(fe.currentRow.y+fe.currentRow.height+ae.size.y<fe.canvas.height){oe=fe;break}if(oe)se=oe;else if(d.maxAtlasPages&&this._pages.length>=d.maxAtlasPages&&re.y+ae.size.y<=se.canvas.height&&re.height>=ae.size.y&&re.x+ae.size.x<=se.canvas.width)X=!0;else{const fe=this._createNewPage();se=fe,re=fe.currentRow,re.height=ae.size.y,X=!0}}X||(se.currentRow.height>0&&se.fixedRows.push(se.currentRow),re={x:0,y:se.currentRow.y+se.currentRow.height,height:ae.size.y},se.fixedRows.push(re),se.currentRow={x:0,y:re.y+re.height,height:0})}if(re.x+ae.size.x<=se.canvas.width)break;re===se.currentRow?(re.x=0,re.y+=re.height,re.height=0):se.fixedRows.splice(se.fixedRows.indexOf(re),1)}return ae.texturePage=this._pages.indexOf(se),ae.texturePosition.x=re.x,ae.texturePosition.y=re.y,ae.texturePositionClipSpace.x=re.x/se.canvas.width,ae.texturePositionClipSpace.y=re.y/se.canvas.height,ae.sizeClipSpace.x/=se.canvas.width,ae.sizeClipSpace.y/=se.canvas.height,re.height=Math.max(re.height,ae.size.y),re.x+=ae.size.x,se.ctx.putImageData(Re,ae.texturePosition.x-this._workBoundingBox.left,ae.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ae.size.x,ae.size.y),se.addGlyph(ae),se.version++,ae}_findGlyphBoundingBox(S,w,R,L,x,T){w.top=0;const F=L?this._config.deviceCellHeight:this._tmpCanvas.height,$=L?this._config.deviceCellWidth:R;let N=!1;for(let H=0;H<F;H++){for(let E=0;E<$;E++){const M=H*this._tmpCanvas.width*4+4*E+3;if(S.data[M]!==0){w.top=H,N=!0;break}}if(N)break}w.left=0,N=!1;for(let H=0;H<T+$;H++){for(let E=0;E<F;E++){const M=E*this._tmpCanvas.width*4+4*H+3;if(S.data[M]!==0){w.left=H,N=!0;break}}if(N)break}w.right=$,N=!1;for(let H=T+$-1;H>=T;H--){for(let E=0;E<F;E++){const M=E*this._tmpCanvas.width*4+4*H+3;if(S.data[M]!==0){w.right=H,N=!0;break}}if(N)break}w.bottom=F,N=!1;for(let H=F-1;H>=0;H--){for(let E=0;E<$;E++){const M=H*this._tmpCanvas.width*4+4*E+3;if(S.data[M]!==0){w.bottom=H,N=!0;break}}if(N)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:w.right-w.left+1,y:w.bottom-w.top+1},sizeClipSpace:{x:w.right-w.left+1,y:w.bottom-w.top+1},offset:{x:-w.left+T+(L||x?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-w.top+T+(L||x?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=d;class C{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(S){this._glyphs.push(S),this._usedPixels+=S.size.x*S.size.y}constructor(S,w,R){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],R)for(const L of R)this._glyphs.push(...L.glyphs),this._usedPixels+=L._usedPixels;this.canvas=b(S,w,w),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(_,S,w,R){const L=S.rgba>>>24,x=S.rgba>>>16&255,T=S.rgba>>>8&255,F=w.rgba>>>24,$=w.rgba>>>16&255,N=w.rgba>>>8&255,H=Math.floor((Math.abs(L-F)+Math.abs(x-$)+Math.abs(T-N))/12);let E=!0;for(let M=0;M<_.data.length;M+=4)_.data[M]===L&&_.data[M+1]===x&&_.data[M+2]===T||R&&Math.abs(_.data[M]-L)+Math.abs(_.data[M+1]-x)+Math.abs(_.data[M+2]-T)<H?_.data[M+3]=0:E=!1;return E}function b(_,S,w){const R=_.createElement("canvas");return R.width=S,R.height=w,R}},160:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,c=0,s=0;var l,f,v,o,e;function r(n){const d=n.toString(16);return d.length<2?"0"+d:d}function i(n,d){return n<d?(d+.05)/(n+.05):(n+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(n){n.toCss=function(d,C,g,b){return b!==void 0?`#${r(d)}${r(C)}${r(g)}${r(b)}`:`#${r(d)}${r(C)}${r(g)}`},n.toRgba=function(d,C,g,b=255){return(d<<24|C<<16|g<<8|b)>>>0},n.toColor=function(d,C,g,b){return{css:n.toCss(d,C,g,b),rgba:n.toRgba(d,C,g,b)}}}(l||(t.channels=l={})),function(n){function d(C,g){return s=Math.round(255*g),[a,h,c]=e.toChannels(C.rgba),{css:l.toCss(a,h,c,s),rgba:l.toRgba(a,h,c,s)}}n.blend=function(C,g){if(s=(255&g.rgba)/255,s===1)return{css:g.css,rgba:g.rgba};const b=g.rgba>>24&255,_=g.rgba>>16&255,S=g.rgba>>8&255,w=C.rgba>>24&255,R=C.rgba>>16&255,L=C.rgba>>8&255;return a=w+Math.round((b-w)*s),h=R+Math.round((_-R)*s),c=L+Math.round((S-L)*s),{css:l.toCss(a,h,c),rgba:l.toRgba(a,h,c)}},n.isOpaque=function(C){return(255&C.rgba)==255},n.ensureContrastRatio=function(C,g,b){const _=e.ensureContrastRatio(C.rgba,g.rgba,b);if(_)return l.toColor(_>>24&255,_>>16&255,_>>8&255)},n.opaque=function(C){const g=(255|C.rgba)>>>0;return[a,h,c]=e.toChannels(g),{css:l.toCss(a,h,c),rgba:g}},n.opacity=d,n.multiplyOpacity=function(C,g){return s=255&C.rgba,d(C,s*g/255)},n.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}}(f||(t.color=f={})),function(n){let d,C;try{const g=document.createElement("canvas");g.width=1,g.height=1;const b=g.getContext("2d",{willReadFrequently:!0});b&&(d=b,d.globalCompositeOperation="copy",C=d.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),c=parseInt(g.slice(3,4).repeat(2),16),l.toColor(a,h,c);case 5:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),c=parseInt(g.slice(3,4).repeat(2),16),s=parseInt(g.slice(4,5).repeat(2),16),l.toColor(a,h,c,s);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}const b=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(b)return a=parseInt(b[1]),h=parseInt(b[2]),c=parseInt(b[3]),s=Math.round(255*(b[5]===void 0?1:parseFloat(b[5]))),l.toColor(a,h,c,s);if(!d||!C)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=C,d.fillStyle=g,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,c,s]=d.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:l.toRgba(a,h,c,s),css:g}}}(v||(t.css=v={})),function(n){function d(C,g,b){const _=C/255,S=g/255,w=b/255;return .2126*(_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4))+.7152*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}n.relativeLuminance=function(C){return d(C>>16&255,C>>8&255,255&C)},n.relativeLuminance2=d}(o||(t.rgb=o={})),function(n){function d(g,b,_){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,x=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));for(;F<_&&(L>0||x>0||T>0);)L-=Math.max(0,Math.ceil(.1*L)),x-=Math.max(0,Math.ceil(.1*x)),T-=Math.max(0,Math.ceil(.1*T)),F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));return(L<<24|x<<16|T<<8|255)>>>0}function C(g,b,_){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,x=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));for(;F<_&&(L<255||x<255||T<255);)L=Math.min(255,L+Math.ceil(.1*(255-L))),x=Math.min(255,x+Math.ceil(.1*(255-x))),T=Math.min(255,T+Math.ceil(.1*(255-T))),F=i(o.relativeLuminance2(L,x,T),o.relativeLuminance2(S,w,R));return(L<<24|x<<16|T<<8|255)>>>0}n.blend=function(g,b){if(s=(255&b)/255,s===1)return b;const _=b>>24&255,S=b>>16&255,w=b>>8&255,R=g>>24&255,L=g>>16&255,x=g>>8&255;return a=R+Math.round((_-R)*s),h=L+Math.round((S-L)*s),c=x+Math.round((w-x)*s),l.toRgba(a,h,c)},n.ensureContrastRatio=function(g,b,_){const S=o.relativeLuminance(g>>8),w=o.relativeLuminance(b>>8);if(i(S,w)<_){if(w<S){const x=d(g,b,_),T=i(S,o.relativeLuminance(x>>8));if(T<_){const F=C(g,b,_);return T>i(S,o.relativeLuminance(F>>8))?x:F}return x}const R=C(g,b,_),L=i(S,o.relativeLuminance(R>>8));if(L<_){const x=d(g,b,_);return L>i(S,o.relativeLuminance(x>>8))?R:x}return R}},n.reduceLuminance=d,n.increaseLuminance=C,n.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},345:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const c=[];for(let s=0;s<this._listeners.length;s++)c.push(this._listeners[s]);for(let s=0;s<c.length;s++)c[s].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(c=>h.fire(c))},t.runAndSubscribe=function(a,h){return h(void 0),a(c=>h(c))}},859:(A,t)=>{function a(h){for(const c of h)c.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const c=this._disposables.indexOf(h);c!==-1&&this._disposables.splice(c,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var c;this._isDisposed||h===this._value||((c=this._value)==null||c.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},485:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(c,s,l){this._data[c]||(this._data[c]={}),this._data[c][s]=l}get(c,s){return this._data[c]?this._data[c][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,c,s,l,f){this._data.get(h,c)||this._data.set(h,c,new a),this._data.get(h,c).set(s,l,f)}get(h,c,s,l){var f;return(f=this._data.get(h,c))==null?void 0:f.get(s,l)}clear(){this._data.clear()}}},399:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const c=a.match(/Version\/(\d+)/);return c===null||c.length<2?0:parseInt(c[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class c{constructor(){this._tasks=[],this._i=0}enqueue(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(),r=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),r=f.timeRemaining(),1.5*o>r)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=r}this.clear()}}class s extends c{_requestCallback(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=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(l){return requestIdleCallback(l)}_cancelCallback(l){cancelIdleCallback(l)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(l){this._queue.clear(),this._queue.enqueue(l)}flush(){this._queue.flush()}}},147:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,l=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=l}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),c=a(855),s=a(147);class l extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(v){const o=new l;return o.setFromCharData(v),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(v){this.fg=v[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[c.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[c.CHAR_DATA_CHAR_INDEX].length===2){const e=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|v[c.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[c.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=l},855:(A,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:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,c=a.length){let s="";for(let l=h;l<c;++l){let f=a[l];f>65535?(f-=65536,s+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):s+=String.fromCharCode(f)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const c=a.length;if(!c)return 0;let s=0,l=0;if(this._interim){const f=a.charCodeAt(l++);56320<=f&&f<=57343?h[s++]=1024*(this._interim-55296)+f-56320+65536:(h[s++]=this._interim,h[s++]=f),this._interim=0}for(let f=l;f<c;++f){const v=a.charCodeAt(f);if(55296<=v&&v<=56319){if(++f>=c)return this._interim=v,s;const o=a.charCodeAt(f);56320<=o&&o<=57343?h[s++]=1024*(v-55296)+o-56320+65536:(h[s++]=v,h[s++]=o)}else v!==65279&&(h[s++]=v)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const c=a.length;if(!c)return 0;let s,l,f,v,o=0,e=0,r=0;if(this.interim[0]){let d=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let g,b=0;for(;(g=63&this.interim[++b])&&b<4;)C<<=6,C|=g;const _=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=_-b;for(;r<S;){if(r>=c)return 0;if(g=a[r++],(192&g)!=128){r--,d=!0;break}this.interim[b++]=g,C<<=6,C|=63&g}d||(_===2?C<128?r--:h[o++]=C:_===3?C<2048||C>=55296&&C<=57343||C===65279||(h[o++]=C):C<65536||C>1114111||(h[o++]=C)),this.interim.fill(0)}const i=c-4;let n=r;for(;n<c;){for(;!(!(n<i)||128&(s=a[n])||128&(l=a[n+1])||128&(f=a[n+2])||128&(v=a[n+3]));)h[o++]=s,h[o++]=l,h[o++]=f,h[o++]=v,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=c)return this.interim[0]=s,o;if(l=a[n++],(192&l)!=128){n--;continue}if(e=(31&s)<<6|63&l,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=c)return this.interim[0]=s,o;if(l=a[n++],(192&l)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=l,o;if(f=a[n++],(192&f)!=128){n--;continue}if(e=(15&s)<<12|(63&l)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=c)return this.interim[0]=s,o;if(l=a[n++],(192&l)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=l,o;if(f=a[n++],(192&f)!=128){n--;continue}if(n>=c)return this.interim[0]=s,this.interim[1]=l,this.interim[2]=f,o;if(v=a[n++],(192&v)!=128){n--;continue}if(e=(7&s)<<18|(63&l)<<12|(63&f)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(A,t,a){var h=this&&this.__decorate||function(e,r,i,n){var d,C=arguments.length,g=C<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,r,i,n);else for(var b=e.length-1;b>=0;b--)(d=e[b])&&(g=(C<3?d(g):C>3?d(r,i,g):d(r,i))||g);return C>3&&g&&Object.defineProperty(r,i,g),g},c=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(859),l=a(97),f={trace:l.LogLevelEnum.TRACE,debug:l.LogLevelEnum.DEBUG,info:l.LogLevelEnum.INFO,warn:l.LogLevelEnum.WARN,error:l.LogLevelEnum.ERROR,off:l.LogLevelEnum.OFF};let v,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=l.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 r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=l.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=l.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=l.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=l.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=l.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([c(0,l.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(...d){if(v.logLevel!==l.LogLevelEnum.TRACE)return n.apply(this,d);v.trace(`GlyphRenderer#${n.name}(${d.map(g=>JSON.stringify(g)).join(", ")})`);const C=n.apply(this,d);return v.trace(`GlyphRenderer#${n.name} return`,C),C}}},726:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(c){return c[h]||[]},t.createDecorator=function(c){if(t.serviceRegistry.has(c))return t.serviceRegistry.get(c);const s=function(l,f,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(s,l,v)};return s.toString=()=>c,t.serviceRegistry.set(c,s),s}},97:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(726);var c;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(c||(t.LogLevelEnum=c={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},y={};function k(A){var t=y[A];if(t!==void 0)return t.exports;var a=y[A]={exports:{}};return m[A].call(a.exports,a,a.exports,k),a.exports}var O={};return(()=>{var A=O;Object.defineProperty(A,"__esModule",{value:!0}),A.WebglAddon=void 0;const t=k(345),a=k(859),h=k(399),c=k(666),s=k(776);class l extends a.Disposable{constructor(v){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=v,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(v){const o=v._core;if(!v.element)return void this.register(o.onWillOpen(()=>this.activate(v)));this._terminal=v;const e=o.coreService,r=o.optionsService,i=o,n=i._renderService,d=i._characterJoinerService,C=i._charSizeService,g=i._coreBrowserService,b=i._decorationService,_=i._logService,S=i._themeService;(0,s.setTraceLogger)(_),this._renderer=this.register(new c.WebglRenderer(v,d,C,g,e,b,r,S,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const w=this._terminal._core._renderService;w.setRenderer(this._terminal._core._createRenderer()),w.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()}}A.WebglAddon=l})(),O})())})(ji);var ir=ji.exports,zi={exports:{}};(function(u,p){(function(m,y){u.exports=y()})(Qs,()=>(()=>{var m={433:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV11=void 0;const h=a(938),c=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],s=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],l=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],f=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let v;function o(e,r){let i,n=0,d=r.length-1;if(e<r[0][0]||e>r[d][1])return!1;for(;d>=n;)if(i=n+d>>1,e>r[i][1])n=i+1;else{if(!(e<r[i][0]))return!0;d=i-1}return!1}t.UnicodeV11=class{constructor(){if(this.version="11",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160);for(let e=0;e<c.length;++e)v.fill(0,c[e][0],c[e][1]+1);for(let e=0;e<l.length;++e)v.fill(2,l[e][0],l[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?v[e]:o(e,s)?0:o(e,f)?2:1}charProperties(e,r){let i=this.wcwidth(e),n=i===0&&r!==0;if(n){const d=h.UnicodeService.extractWidth(r);d===0?n=!1:d>i&&(i=d)}return h.UnicodeService.createPropertyValue(0,i,n)}}},345:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const c=[];for(let s=0;s<this._listeners.length;s++)c.push(this._listeners[s]);for(let s=0;s<c.length;s++)c[s].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(c=>h.fire(c))},t.runAndSubscribe=function(a,h){return h(void 0),a(c=>h(c))}},490:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(938),c=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let l;t.UnicodeV6=class{constructor(){if(this.version="6",!l){l=new Uint8Array(65536),l.fill(1),l[0]=0,l.fill(0,1,32),l.fill(0,127,160),l.fill(2,4352,4448),l[9001]=2,l[9002]=2,l.fill(2,11904,42192),l[12351]=1,l.fill(2,44032,55204),l.fill(2,63744,64256),l.fill(2,65040,65050),l.fill(2,65072,65136),l.fill(2,65280,65377),l.fill(2,65504,65511);for(let f=0;f<c.length;++f)l.fill(0,c[f][0],c[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?l[f]:function(v,o){let e,r=0,i=o.length-1;if(v<o[0][0]||v>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,v>o[e][1])r=e+1;else{if(!(v<o[e][0]))return!0;i=e-1}return!1}(f,s)?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 r=h.UnicodeService.extractWidth(v);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},938:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(345),c=a(490);class s{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,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 c.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 r=0;r<e;++r){let i=f.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return v+this.wcwidth(i);const C=f.charCodeAt(r);56320<=C&&C<=57343?i=1024*(i-55296)+C-56320+65536:v+=this.wcwidth(C)}const n=this.charProperties(i,o);let d=s.extractWidth(n);s.extractShouldJoin(n)&&(d-=s.extractWidth(o)),v+=d,o=n}return v}charProperties(f,v){return this._activeProvider.charProperties(f,v)}}t.UnicodeService=s}},y={};function k(A){var t=y[A];if(t!==void 0)return t.exports;var a=y[A]={exports:{}};return m[A](a,a.exports,k),a.exports}var O={};return(()=>{var A=O;Object.defineProperty(A,"__esModule",{value:!0}),A.Unicode11Addon=void 0;const t=k(433);A.Unicode11Addon=class{activate(a){a.unicode.register(new t.UnicodeV11)}dispose(){}}})(),O})())})(zi);var sr=zi.exports;const rr={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},nr=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],It=[0,95,135,175,215,255];function vi(u,p){if(u<0)return p;if(u<16)return nr[u]??p;if(u<232){const m=u-16,y=It[Math.floor(m/36)%6],k=It[Math.floor(m/6)%6],O=It[m%6];return`rgb(${y},${k},${O})`}if(u<256){const m=8+(u-232)*10;return`rgb(${m},${m},${m})`}return`#${(u&16777215).toString(16).padStart(6,"0")}`}function or(u,p){let m=!1,y=!1,k=!1;const O=()=>{k||(k=!0,setTimeout(A,0))},A=()=>{if(k=!1,!m){if(y){y=!1,O();return}u.value!==""&&(u.value="")}},t=()=>{y=!0};u.addEventListener("keydown",t),u.addEventListener("input",t),u.addEventListener("compositionstart",()=>{m=!0}),u.addEventListener("compositionend",()=>{m=!1,y=!0,O()}),p(O)}const mi="\x1Bc",ar=/Mac|iPhone|iPad/.test(navigator.platform);class hr{constructor(p){te(this,"term");te(this,"fit",new tr.FitAddon);te(this,"onInput",null);te(this,"shouldSendKey",null);te(this,"onSelect",null);te(this,"webglLosses",0);this.term=new er.Terminal({theme:rr,fontFamily:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!0,macOptionClickForcesSelection:!0,scrollback:5e3}),this.term.loadAddon(this.fit),this.term.loadAddon(new sr.Unicode11Addon),this.term.unicode.activeVersion="11",this.term.open(p),this.loadWebgl(),this.term.onData(m=>{var y;return(y=this.onInput)==null?void 0:y.call(this,m)}),this.term.textarea&&or(this.term.textarea,m=>this.term.onData(m)),this.term.attachCustomKeyEventHandler(m=>{var y,k;return((y=this.shouldSendKey)==null?void 0:y.call(this,m))===!1||m.type==="keydown"&&Fs(m,ar)?!1:m.type==="keydown"&&Is(m)?(m.preventDefault(),(k=this.onInput)==null||k.call(this,Ps),!1):!0}),this.bindTouchScroll(p),this.bindCopyOnSelect(p),this.fitNow()}loadWebgl(){let p;try{p=new ir.WebglAddon,this.term.loadAddon(p)}catch{return}p.onContextLoss(()=>{p.dispose(),++this.webglLosses<3&&this.loadWebgl(),this.term.refresh(0,this.term.rows-1)})}bindTouchScroll(p){let m=0,y=0;p.addEventListener("touchstart",k=>{k.touches.length===1&&(m=k.touches[0].clientY,y=0)},{capture:!0,passive:!0}),p.addEventListener("touchmove",k=>{if(k.touches.length!==1||!this.wantsWheel())return;k.preventDefault(),k.stopPropagation();const O=k.touches[0];y+=(m-O.clientY)/this.rowHeight(),m=O.clientY;const A=Math.trunc(y);if(A===0)return;y-=A;const t=p.querySelector(".xterm-screen");if(!t)return;const a={deltaY:Math.sign(A),deltaMode:WheelEvent.DOM_DELTA_LINE,clientX:O.clientX,clientY:O.clientY,bubbles:!0,cancelable:!0};for(let h=0;h<Math.abs(A);h++)t.dispatchEvent(new WheelEvent("wheel",a))},{capture:!0,passive:!1})}bindCopyOnSelect(p){p.addEventListener("mouseup",()=>{queueMicrotask(()=>{var y;const m=this.term.getSelection();m&&((y=this.onSelect)==null||y.call(this,m))})})}wantsWheel(){return this.term.modes.mouseTrackingMode!=="none"||this.term.buffer.active.type==="alternate"}rowHeight(){var y;const p=(y=this.term.element)==null?void 0:y.querySelector(".xterm-screen"),m=p&&this.term.rows>0?p.clientHeight/this.term.rows:0;return m>0?m:16}replay(p){this.term.write(mi+p)}write(p){this.term.write(p)}paste(p){this.term.paste(p)}clear(){this.term.write(mi)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}}function cr(u){const p=[];let m=0,y=0,k=!1;for(const O of u.split(`
|
|
81
|
-
`)){const A=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(O);if(A){m=Number(A[1]),y=Number(A[2]),k=!0,p.push({kind:"hunk",text:O});continue}k&&(O.startsWith("+")?p.push({kind:"add",old:null,new:y++,text:O.slice(1)}):O.startsWith("-")?p.push({kind:"del",old:m++,new:null,text:O.slice(1)}):O.startsWith(" ")&&p.push({kind:"ctx",old:m++,new:y++,text:O.slice(1)}))}return p}const qi=240;function lr(u,p){return Math.round(Math.max(qi,Math.min(u,p*.75)))}const dr=2e3,Ki="tring.diffPanel",Si=420;function we(u,p){const m=document.createElement("div");return m.className=u,p!==void 0&&(m.textContent=p),m}function Be(u,p){const m=document.createElement("span");return m.className=u,m.textContent=p,m}function ur(){try{const u=JSON.parse(localStorage.getItem(Ki)??"{}");return{width:typeof u.width=="number"?u.width:Si,open:u.open===!0}}catch{return{width:Si,open:!1}}}class _r{constructor(p,m){te(this,"el",we("diff-panel"));te(this,"handle",we("diff-handle"));te(this,"title",Be("diff-title",""));te(this,"plus",Be("diff-plus",""));te(this,"minus",Be("diff-minus",""));te(this,"scroll",we("diff-scroll"));te(this,"sessionId",null);te(this,"timer",null);te(this,"inflight",!1);te(this,"last","");te(this,"width");te(this,"opened");this.cell=p,this.onLayout=m;const y=we("diff-head"),k=document.createElement("button");k.type="button",k.className="diff-close",k.textContent="✕",k.title="Close diff viewer",k.onclick=()=>this.close(),y.append(this.title,this.plus,this.minus,k),this.el.append(y,this.scroll),p.append(this.handle,this.el);const O=ur();this.width=Math.max(qi,O.width),this.opened=O.open,this.bindResize(),this.paint(),this.opened&&this.startPolling()}get isOpen(){return this.opened}open(){this.opened||(this.opened=!0,this.paint(),this.save(),this.onLayout(),this.startPolling())}close(){this.opened&&(this.opened=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.paint(),this.save(),this.onLayout())}toggle(){this.opened?this.close():this.open()}setSession(p){p!==this.sessionId&&(this.sessionId=p,this.last="",this.note(p?"loading…":"no session"),this.opened&&this.tick())}paint(){this.el.hidden=!this.opened,this.handle.hidden=!this.opened,this.el.style.width=`${this.width}px`}save(){try{localStorage.setItem(Ki,JSON.stringify({width:this.width,open:this.opened}))}catch{}}startPolling(){this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>void this.tick(),dr),this.tick()}async tick(){const p=this.sessionId;if(!(!p||this.inflight||!this.opened)){this.inflight=!0;try{const m=await Dt(`/api/sessions/${encodeURIComponent(p)}/diff`);if(p!==this.sessionId||!this.opened)return;const y=JSON.stringify(m);if(y===this.last)return;this.last=y,this.render(m)}catch(m){if(p!==this.sessionId)return;this.last="",this.note(m.message)}finally{this.inflight=!1}}}note(p){this.title.textContent="",this.plus.textContent="",this.minus.textContent="",this.scroll.replaceChildren(we("diff-note",p))}render(p){if("error"in p)return this.note(p.error);const{files:m}=p;let y=0,k=0;for(const a of m)y+=a.added,k+=a.removed;if(this.title.textContent=`${m.length} file${m.length===1?"":"s"} changed`,this.plus.textContent=`+${y}`,this.minus.textContent=`-${k}`,m.length===0){this.scroll.replaceChildren(we("diff-note","no uncommitted changes"));return}const O=we("diff-files"),A=we("diff-body");for(const a of m){const h=this.fileSection(a),c=document.createElement("button");c.type="button",c.className="diff-file-row",c.append(Be("path",a.path),Be("diff-plus",`+${a.added}`),Be("diff-minus",`-${a.removed}`)),c.onclick=()=>h.scrollIntoView({block:"start"}),O.append(c),A.append(h)}p.truncated&&O.append(we("diff-note","some diffs are over the 1 MB limit and not shown"));const t=this.scroll.scrollTop;this.scroll.replaceChildren(O,A),this.scroll.scrollTop=t}fileSection(p){const m=we("diff-file");if(m.append(we("diff-file-head",p.path)),p.note)return m.append(we("diff-note",p.note)),m;for(const y of cr(p.patch)){if(y.kind==="hunk"){m.append(we("dl dl-hunk",y.text));continue}const k=we(`dl dl-${y.kind}`);k.append(Be("ln",y.old===null?"":String(y.old)),Be("ln",y.new===null?"":String(y.new)),Be("tx",y.text)),m.append(k)}return m}bindResize(){let p=0;this.handle.addEventListener("pointerdown",y=>{y.preventDefault(),p=this.el.getBoundingClientRect().right,this.handle.setPointerCapture(y.pointerId),this.handle.classList.add("dragging")}),this.handle.addEventListener("pointermove",y=>{this.handle.hasPointerCapture(y.pointerId)&&(this.width=lr(p-y.clientX,this.cell.clientWidth),this.el.style.width=`${this.width}px`)});const m=y=>{this.handle.hasPointerCapture(y.pointerId)&&(this.handle.releasePointerCapture(y.pointerId),this.handle.classList.remove("dragging"),this.save(),this.onLayout())};this.handle.addEventListener("pointerup",m),this.handle.addEventListener("pointercancel",m)}}function fr(u,p){if(!u)return null;const m=p.find(k=>k.id===u.id);if(m)return m.slot===u.slot?u:{id:m.id,slot:m.slot};const y=p.find(k=>k.slot===u.slot);return y?{id:y.id,slot:y.slot}:null}const Vi=/^image\/(png|jpeg|gif|webp)$/;function pr(u){return/\s/.test(u)?`"${u}"`:u}function gr(u){for(const p of["dragover","drop"])u.addEventListener(p,m=>m.preventDefault())}function vr(u,p){let m=0;const y=O=>{u.classList.toggle("dropping",O)},k=O=>{var A;return Array.from(((A=O.dataTransfer)==null?void 0:A.types)??[]).includes("Files")};u.addEventListener("dragenter",O=>{k(O)&&(O.preventDefault(),m++,y(!0))}),u.addEventListener("dragover",O=>{k(O)&&(O.preventDefault(),O.dataTransfer&&(O.dataTransfer.dropEffect="copy"))}),u.addEventListener("dragleave",()=>{m=Math.max(0,m-1),m===0&&y(!1)}),u.addEventListener("drop",O=>{var A;k(O)&&(O.preventDefault(),m=0,y(!1),Sr(Array.from(((A=O.dataTransfer)==null?void 0:A.files)??[]),p))})}function mr(u){const p=document.createElement("input");return p.type="file",p.multiple=!0,p.hidden=!0,p.addEventListener("change",()=>{const m=Array.from(p.files??[]);p.value="",m.length>0&&u(m)}),document.body.append(p),()=>p.click()}async function Sr(u,p){if(u.length===0)return p.onError("nothing to drop");await pt(u,p)}async function pt(u,p){if(!p.ready()){p.onError("focus a session first — the file goes into its prompt");return}const m=[];for(const y of u)try{m.push(pr(await p.upload(y)))}catch(k){p.onError(k.message);break}m.length>0&&p.insert(m.join(" ")+" ")}function Cr(u){const p=u,m=p.SpeechRecognition??p.webkitSpeechRecognition;return m?()=>new m:null}function Ft(u,p){return u?p?p.toLowerCase().startsWith(u.toLowerCase())?p:`${u} ${p}`:u:p}function br(u){var y;let p="",m="";for(const k of Array.from(u)){const O=((y=k[0])==null?void 0:y.transcript.trim())??"";k.isFinal?p=Ft(p,O):m=Ft(m,O)}return Ft(p,m)}function wr(u){switch(u){case"aborted":return null;case"no-speech":return"no speech heard — tap the mic and talk";case"not-allowed":return"the microphone was refused — voice input needs https and microphone permission";case"service-not-allowed":return"speech recognition is turned off on this device";case"audio-capture":return"no microphone available";case"network":return"speech recognition needs a network connection";case"language-not-supported":return"speech recognition does not support this language";default:return`speech recognition failed (${u})`}}class yr{constructor(p,m,y){te(this,"rec",null);this.make=p,this.cb=m,this.lang=y}get listening(){return this.rec!==null}toggle(){this.rec?this.rec.stop():this.start()}cancel(){const p=this.rec;p&&(this.rec=null,p.abort(),this.cb.onListening(!1))}start(){const p=this.make();p.lang=this.lang,p.continuous=!0,p.interimResults=!0;let m="";p.addEventListener("result",y=>{m=br(y.results),this.cb.onHeard(m)}),p.addEventListener("error",y=>{const k=wr(y.error);k&&this.cb.onError(k)}),p.addEventListener("end",()=>{this.rec===p&&(this.rec=null,this.cb.onListening(!1),m&&this.cb.onText(m))});try{p.start()}catch(y){this.cb.onError(`speech recognition failed (${y.message})`);return}this.rec=p,this.cb.onListening(!0),this.cb.onHeard("")}}const Er=6;function Lr(u,p){let m=null,y=null;const k=h=>Number(h.dataset.slot),O=(h,c)=>{var l;const s=((l=document.elementFromPoint(h,c))==null?void 0:l.closest(".tile[data-slot]"))??null;return s&&u.contains(s)?s:null},A=h=>{h!==y&&(y==null||y.classList.remove("drop-target"),y=h,y==null||y.classList.add("drop-target"))},t=()=>{m==null||m.from.classList.remove("dragging"),document.body.classList.remove("tile-dragging"),A(null),m=null},a=()=>{const h=c=>{c.stopPropagation(),c.preventDefault()};window.addEventListener("click",h,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",h,{capture:!0}),0)};u.addEventListener("pointerdown",h=>{if(h.button!==0||!(h.target instanceof Element)||h.target.closest(".tile-action"))return;const c=h.target.closest(".tile[data-slot]");if(!c)return;const s=p.sessionAt(k(c));s&&(m={id:s,from:c,pointer:h.pointerId,x:h.clientX,y:h.clientY,active:!1})}),window.addEventListener("pointermove",h=>{if(!m||h.pointerId!==m.pointer)return;if(!m.active){if(Math.hypot(h.clientX-m.x,h.clientY-m.y)<Er)return;m.active=!0,m.from.classList.add("dragging"),document.body.classList.add("tile-dragging")}const c=O(h.clientX,h.clientY);A(c&&c!==m.from?c:null)}),window.addEventListener("pointerup",h=>{if(!m||h.pointerId!==m.pointer)return;const{id:c,active:s}=m,l=y;t(),s&&(a(),l&&p.onMove(c,k(l)))}),window.addEventListener("pointercancel",t),window.addEventListener("keydown",h=>{h.key!=="Escape"||!(m!=null&&m.active)||(h.stopPropagation(),h.preventDefault(),t())},{capture:!0})}function Gi(u){return Array.from(u??[]).filter(p=>Vi.test(p.type))}function xr(u,p){u.addEventListener("paste",m=>{var k;const y=Gi((k=m.clipboardData)==null?void 0:k.files);y.length!==0&&(m.preventDefault(),m.stopPropagation(),pt(y,p))},{capture:!0})}async function kr(u){const p=[];let m="";for(const y of u){const k=y.types.find(O=>Vi.test(O));k?p.push(await y.getType(k)):y.types.includes("text/plain")&&(m+=await(await y.getType("text/plain")).text())}return{images:p,text:m}}async function Rr(u){if(!u.ready()){u.onError("focus a session first — the paste goes into its prompt");return}let p;try{p=await navigator.clipboard.read()}catch{u.fallback();return}const{images:m,text:y}=await kr(p);m.length>0?await pt(m,u):y?u.insert(y):u.onError("nothing on the clipboard to paste")}function Xi(u,p,m){var t,a;let y=Math.max(0,p);for(;y>0&&((t=u.getLine(y))!=null&&t.isWrapped);)y--;let k=Math.min(u.length,m);for(;k<u.length&&((a=u.getLine(k))!=null&&a.isWrapped);)k++;const O=[];let A=null;for(let h=y;h<k;h++){const c=u.getLine(h);if(!c)continue;const s=c.translateToString(!1);c.isWrapped&&A!==null?A+=s:(A!==null&&O.push(A.trimEnd()),A=s)}return A!==null&&O.push(A.trimEnd()),O}function Ar(u,p){const m=Xi(u,u.viewportY,u.viewportY+p);for(;m.length>0&&m[m.length-1]==="";)m.pop();return m.join(`
|
|
82
|
-
`)}const
|
|
83
|
-
`))}async function Yi(u){var y;try{if((y=navigator.clipboard)!=null&&y.writeText)return await navigator.clipboard.writeText(u),!0}catch{}const p=document.createElement("textarea");p.value=u,p.setAttribute("readonly",""),p.style.position="fixed",p.style.opacity="0",document.body.append(p),p.select();let m=!1;try{m=document.execCommand("copy")}catch{m=!1}return p.remove(),m}const Ci="#071411",Pr="#dceee7";class Ir{constructor(p){te(this,"ctx");te(this,"last",null);this.canvas=p,this.ctx=p.getContext("2d",{alpha:!1})}paint(p=this.last){if(!this.ctx||!p)return;this.last=p;const m=window.devicePixelRatio||1,y=this.canvas.clientWidth,k=this.canvas.clientHeight;if(y===0||k===0)return;(this.canvas.width!==Math.round(y*m)||this.canvas.height!==Math.round(k*m))&&(this.canvas.width=Math.round(y*m),this.canvas.height=Math.round(k*m));const O=this.ctx;O.setTransform(m,0,0,m,0,0),O.fillStyle=Ci,O.fillRect(0,0,y,k);const A=y/Math.max(p.cols,1),t=Math.max(A/.6,1),a=k/Math.max(p.rows.length,1);O.textBaseline="top",O.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<p.rows.length;h++){const c=p.rows[h];if(!c)continue;let s=0;for(const l of c){const f=l.text.length*A;l.bg>=0&&(O.fillStyle=vi(l.bg,Ci),O.fillRect(s,h*a,f,a)),l.text.trim()!==""&&(O.fillStyle=vi(l.fg,Pr),O.fillText(l.text,s,h*a)),s+=f}}}refresh(){this.last&&this.paint(this.last)}}const lt=[4,8,12,16],bi=16;function Ji(u){return u<12?Fr(u/2):Hr(u/4+1)}function Fr(u){const p=new Map;for(let m=1;m<=u;m++)p.set(m,{row:1,col:m});for(let m=0;m<u;m++)p.set(u+1+m,{row:3,col:u-m});return{cols:u,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${u+1}`,cells:p}}function Hr(u){const p=[];for(let m=1;m<=u;m++)p.push({row:1,col:m});for(let m=2;m<=u-1;m++)p.push({row:m,col:u});for(let m=u;m>=1;m--)p.push({row:u,col:m});for(let m=u-1;m>=2;m--)p.push({row:m,col:1});return{cols:u,rows:u,rowTemplate:`repeat(${u}, 1fr)`,focus:`2 / 2 / ${u} / ${u}`,cells:new Map(p.map((m,y)=>[y+1,m]))}}const Zi="tring.ring";let Qi=$r();function $r(){try{const u=Number(localStorage.getItem(Zi));return Nr(u)?u:bi}catch{return bi}}function Nr(u){return lt.includes(u)}function dt(){return Qi}function Wr(u){Qi=u;try{localStorage.setItem(Zi,String(u))}catch{}}function Ur(u,p,m){const y=Ji(m);u.style.gridTemplateColumns=`repeat(${y.cols}, 1fr)`,u.style.gridTemplateRows=y.rowTemplate,p.style.gridArea=y.focus}function jr(u,p,m){const y=Ji(m).cells.get(p);y&&(u.style.gridRow=String(y.row),u.style.gridColumn=String(y.col))}const es="tring.sound";let wt=null,ei=zr();function zr(){try{return localStorage.getItem(es)!=="off"}catch{return!0}}function ot(){return ei}function qr(u){ei=u;try{localStorage.setItem(es,u?"on":"off")}catch{}u&&ti()}async function ti(){try{return wt??(wt=new AudioContext),wt.state==="suspended"&&await wt.resume(),wt}catch{return null}}document.addEventListener("pointerdown",()=>void ti(),{once:!0});function wi(u,p,m,y,k){const O=u.createOscillator(),A=u.createGain();O.type="sine",O.frequency.setValueAtTime(m,p),A.gain.setValueAtTime(0,p),A.gain.linearRampToValueAtTime(y,p+.004),A.gain.exponentialRampToValueAtTime(1e-4,p+k),O.connect(A).connect(u.destination),O.start(p),O.stop(p+k)}function yi(){ei&&ti().then(u=>{if(!u)return;const p=u.currentTime;for(const m of[0,.085])wi(u,p+m,1568,.13,.55),wi(u,p+m,2349,.05,.4)})}const ts="tring.usage",is="tring.usage.view",ss=(u,p)=>{try{const m=localStorage.getItem(u);return m===null?p:JSON.parse(m)}catch{return p}},rs=(u,p)=>{try{localStorage.setItem(u,JSON.stringify(p))}catch{}};let ii=ss(ts,!1);const zt=()=>ii;function Kr(u){ii=u,rs(ts,u)}const Vr=()=>ii&&ss(is,!1),ns=u=>rs(is,u),Gr=()=>Dt("/api/usage");function at(u){return u>=1e9?`${(u/1e9).toFixed(1)}B`:u>=1e6?`${(u/1e6).toFixed(1)}M`:u>=1e3?`${Math.round(u/1e3)}k`:String(u)}const Ei=u=>`$${u.toFixed(2)}`,Li=u=>new Date(u).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function ce(u,p,m){const y=document.createElement(u);return p&&(y.className=p),m!==void 0&&(y.textContent=m),y}function os(u,p,m=!0){const y=Math.min(100,u/p*100),k=ce("div","meter"),O=ce("i");return O.style.width=`${y}%`,m&&(y>=90?O.classList.add("hot"):y>=75&&O.classList.add("warm")),k.append(O),k.setAttribute("role","progressbar"),k.setAttribute("aria-valuenow",String(Math.round(y))),k}function qt(u,p,m){u.replaceChildren();const y=ce("div","usage");if(m){y.append(ce("h2",void 0,"Claude usage")),y.append(ce("p","hint",m)),u.append(y);return}if(!p){y.append(ce("p","hint","asking Claude Code…")),u.append(y);return}if(p.limits.length>0){for(const A of p.limits)y.append(Xr(A));y.append(ce("p","source","from Claude Code’s own /usage"))}else{const A=p.window;y.append(xi("5-hour window",`${at(A.tokens)} tokens`,A.resetsAt?`resets ${Li(A.resetsAt)}`:"nothing running")),y.append(xi("This week",`${at(p.week.tokens)} tokens`,"rolling 7 days")),y.append(ce("p","source",`${p.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const k=ce("div","utotals"),O=(A,t)=>{const a=ce("div","ucell");return a.append(ce("b",void 0,t),ce("span",void 0,A)),a};if(k.append(O("tokens today",at(p.today.tokens))),k.append(O("today, est.",Ei(p.today.cost))),k.append(O("this week, est.",Ei(p.week.cost))),k.append(O("cache reads, 7d",at(p.week.cacheReadTokens))),y.append(k),p.projects.length>0){y.append(ce("h3",void 0,"By project, last 7 days"));const A=p.projects[0].tokens,t=ce("div","uprojects");for(const a of p.projects.slice(0,8)){const h=ce("div","uproject");h.append(ce("span","nm",a.name)),h.append(os(a.tokens,A,!1)),h.append(ce("span","tag",at(a.tokens))),t.append(h)}y.append(t)}y.append(ce("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${Li(p.scannedAt)}.`)),u.append(y)}function Xr(u){const p=ce("div","urow"),m=ce("div","uhead");if(m.append(ce("span","ulabel",u.label)),m.append(ce("span","upct",`${u.percent}%`)),p.append(m),p.append(os(u.percent,100)),u.resets){const y=ce("div","ufoot");y.append(ce("span","unote",`resets ${u.resets}`)),p.append(y)}return p}function xi(u,p,m){const y=ce("div","urow"),k=ce("div","uhead");k.append(ce("span","ulabel",u)),k.append(ce("span","upct",p)),y.append(k);const O=ce("div","ufoot");return O.append(ce("span","unote",m)),y.append(O),y}function Yr(u,p,m,y,k,O=!1,A={open:!1,count:0}){u.replaceChildren();const t=document.createElement("div");t.className="logo",t.title="tring";for(let s=0;s<9;s++)t.append(document.createElement("i"));u.append(t);for(const s of p){const l=s.sessions.filter(o=>o.status==="done").length,f=document.createElement("button");f.className="tab"+(!O&&s.id===m?" active":""),f.title=s.root;const v=document.createElement("span");if(v.className="nm",v.textContent=s.name,f.append(v),l>0){const o=document.createElement("span");o.className="badge",o.textContent=String(l),f.append(o)}f.onclick=()=>y.onSelect(s.id),f.oncontextmenu=o=>{o.preventDefault(),y.onContext(s.id,{x:o.clientX,y:o.clientY})},u.append(f)}if(zt()){const s=document.createElement("button");s.className="tab pinned"+(O?" active":""),s.title="Claude usage";const l=document.createElement("span");l.className="nm",l.textContent="Usage",s.append(l),s.onclick=()=>y.onUsage(),u.append(s)}{const s=document.createElement("button");s.className="tab pinned"+(A.open?" active":""),s.title="Orchestrator — every agent waiting on you (Ctrl+Space, o)";const l=document.createElement("span");if(l.className="nm",l.textContent="Orchestrator",s.append(l),A.count>0){const f=document.createElement("span");f.className="badge asking",f.textContent=String(A.count),s.append(f)}s.onclick=()=>y.onInbox(),u.append(s)}const a=document.createElement("button");a.className="add",a.textContent="+",a.title="New project",a.onclick=()=>y.onAdd(),u.append(a);const h=document.createElement("button");h.className="iconbtn"+(ot()?" on":""),h.innerHTML=Zr(ot()),h.title=ot()?"Sound on — click to mute":"Sound off — click to unmute",h.setAttribute("aria-label",h.title),h.setAttribute("aria-pressed",String(ot())),h.onclick=()=>{qr(!ot()),y.onSoundToggle()},h.style.marginLeft=k?"0":"auto",u.append(h);const c=document.createElement("button");if(c.className="iconbtn",c.innerHTML=Jr(),c.title="Settings",c.setAttribute("aria-label",c.title),c.onclick=()=>y.onSettings(),u.append(c),k){const s=document.createElement("button");s.className="update",s.textContent=`v${k.latest} available`,s.title=`You are on ${k.current}`,s.onclick=()=>y.onUpdate(k),u.insertBefore(s,h)}}function Jr(){return as('<path d="M6.09 3.71 L6.43 1.18 L9.57 1.18 L9.91 3.71 L10.76 4.2 L13.12 3.23 L14.69 5.95 L12.67 7.51 L12.67 8.49 L14.69 10.05 L13.12 12.77 L10.76 11.8 L9.91 12.29 L9.57 14.82 L6.43 14.82 L6.09 12.29 L5.24 11.8 L2.88 12.77 L1.31 10.05 L3.33 8.49 L3.33 7.51 L1.31 5.95 L2.88 3.23 L5.24 4.2 Z"/><circle cx="8" cy="8" r="2.4"/>')}function as(u){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${u}</svg>`}function Zr(u){return as(`<path d="M8 2a3 3 0 0 1 3 3v3l1.4 2.1a.5.5 0 0 1-.4.8H4a.5.5 0 0 1-.4-.8L5 8V5a3 3 0 0 1 3-3z"/><path d="M6.6 12.6a1.5 1.5 0 0 0 2.8 0"/>${u?"":'<path d="M2.5 2.5l11 11"/>'}`)}const hs="(max-width: 720px)";function Qr(u){return u?{key:String(u.slot),name:u.name??u.title??"shell",status:u.status}:{key:"—",name:"pick a session",status:"idle"}}function en(u,p,m){const{done:y,listening:k}=p,O=p.override??Qr(p.focused),A=p.focused!==null||!!p.override,t=ki("nav"),a=document.createElement("button");a.className=`current st-${O.status}`,a.title="Switch session",a.setAttribute("aria-haspopup","dialog");const h=ct("key",O.key),c=ct("nm",O.name),s=ct("tag",A?O.status:"");a.append(h,c,s,tn()),a.onclick=()=>m.onOpen(),t.append(a);const l=document.createElement("button");if(l.className="next",l.disabled=y===0,l.title=y>0?`Next finished session (${y})`:"No finished sessions",l.setAttribute("aria-label",l.title),l.innerHTML=Ve('<path d="M5 3l6 5-6 5"/>'),y>0&&l.append(ct("badge",String(y))),l.onclick=()=>m.onNext(),t.append(l),m.onInbox){const i=m.onInbox,n=p.inbox??{open:!1,count:0},d=document.createElement("button");d.className="inbox-btn"+(n.open?" on":""),d.title=n.open?"Leave orchestrator mode":`Orchestrator${n.count?` (${n.count} waiting)`:""}`,d.setAttribute("aria-label",d.title),d.setAttribute("aria-pressed",String(n.open)),d.innerHTML=Ve('<path d="M2 9.5l1.6-5.2a1 1 0 0 1 1-.7h6.8a1 1 0 0 1 1 .7L14 9.5V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z"/><path d="M2 9.5h3.5l1 1.5h3l1-1.5H14"/>'),n.count>0&&d.append(ct("badge asking",String(n.count))),d.onclick=()=>i(),t.append(d)}const f=ki("tools"),v=ht("esc","Escape",A?"Send Escape":"Focus a session to send Escape",!A);v.textContent="Esc",Ri(v),v.onclick=()=>m.onEsc(),f.append(v);const o=ht("paste","Paste",A?"Paste from the clipboard":"Focus a session to paste",!A);o.innerHTML=Ve('<rect x="4" y="3" width="8" height="11" rx="1.5"/><path d="M6 3V2h4v1M6.5 7h3M6.5 10h3"/>'),o.onclick=()=>m.onPaste(),f.append(o);const e=ht("attach","Attach",A?"Attach a photo or file":"Focus a session to attach a file",!A);if(e.innerHTML=Ve('<path d="M13 7.5l-5.3 5.3a3.2 3.2 0 0 1-4.5-4.5L8.8 2.7a2.1 2.1 0 0 1 3 3L6.3 11.2a1 1 0 0 1-1.5-1.5L9.5 5"/>'),e.onclick=()=>m.onAttach(),f.append(e),m.onMic){const i=m.onMic,n=ht("mic",k?"Stop listening":"Talk",k?"Stop listening and insert the words":A?"Talk: what you say is typed into the prompt":"Focus a session to talk",!A&&!k);n.classList.toggle("listening",k),n.setAttribute("aria-pressed",String(k)),n.innerHTML=Ve('<rect x="5.5" y="1.5" width="5" height="8" rx="2.5"/><path d="M3 7.5a5 5 0 0 0 10 0M8 12.5V15"/>'),Ri(n),n.onclick=()=>i(),f.append(n)}const r=ht("copy","Copy",A?"Copy text off the screen":"Focus a session to copy",!A);r.innerHTML=Ve('<rect x="6" y="6" width="8" height="8" rx="1.5"/><path d="M4 10H3.5A1.5 1.5 0 0 1 2 8.5v-5A1.5 1.5 0 0 1 3.5 2h5A1.5 1.5 0 0 1 10 3.5V4"/>'),r.onclick=()=>m.onCopy(),f.append(r),u.replaceChildren(t,f)}function ki(u){const p=document.createElement("div");return p.className=`row ${u}`,p}function ht(u,p,m,y){const k=document.createElement("button");return k.className=u,k.disabled=y,k.title=m,k.setAttribute("aria-label",p),k}function Ri(u){u.onmousedown=p=>p.preventDefault()}function ct(u,p){const m=document.createElement("span");return m.className=u,m.textContent=p,m}function tn(){const u=document.createElement("span");return u.className="chev",u.innerHTML=Ve('<path d="M4 6l4 4 4-4"/>'),u}function Ve(u){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${u}</svg>`}const Ne=document.getElementById("overlay");let Kt=null;function gt(){return!Ne.hidden}function ne(){Ne.hidden=!0,Ne.replaceChildren();const u=Kt;Kt=null,u==null||u()}function De(u,p={}){var m;Kt=p.onClosed??null,Ne.replaceChildren(u),Ne.hidden=!1,p.dismissible!==!1?Ne.onclick=y=>{y.target===Ne&&ne()}:Ne.onclick=null,(m=u.querySelector("input, button"))==null||m.focus()}function z(u,p,m){const y=document.createElement(u);return p&&(y.className=p),m!==void 0&&(y.textContent=m),y}function cs(u){const p=z("div","browser"),m=z("div","crumb"),y=z("div","dirlist");p.append(m,y);let k=!1;async function O(A){if(!k){k=!0,y.replaceChildren(z("div","dirnote","loading…"));try{const t=A?`?path=${encodeURIComponent(A)}`:"",a=await Dt(`/api/fs${t}`);if(u.value=a.path,m.replaceChildren(),a.parent){const h=z("button","up","↑ "+a.parent);h.type="button",h.onclick=()=>void O(a.parent),m.append(h)}else m.append(z("span","dirnote",a.path));y.replaceChildren(),a.entries.length===0&&y.append(z("div","dirnote","no subdirectories"));for(const h of a.entries){const c=z("button",void 0,h.name);c.type="button",c.onclick=()=>void O(h.path),y.append(c)}}catch(t){y.replaceChildren(z("div","dirnote",t.message))}finally{k=!1}}}return u.addEventListener("change",()=>void O(u.value.trim()||void 0)),O(u.value.trim()||void 0),p}function sn(u,p,m,y){const k=z("div","panel picker");k.append(z("h2",void 0,u?u.name:"No project")),k.append(z("p","hint",`${m} session${m===1?"":"s"} finished across all projects`));const O=z("div","rows"),A=new Map;for(const l of(u==null?void 0:u.sessions)??[])A.set(l.slot,l);const t=window.matchMedia(hs).matches;for(let l=1;l<=dt();l++){const f=A.get(l),v=z("button",`row st-${(f==null?void 0:f.status)??"idle"}`);(f==null?void 0:f.status)==="busy"&&v.classList.add("dim"),f||v.classList.add("dim"),v.append(z("span","key",t?String(l):Qt(l))),v.append(z("span","nm",f?f.name??f.title??f.cwd.split("/").pop()??"shell":"— empty")),f&&v.append(z("span","tag",f.status)),v.onclick=()=>{ne(),y.onPickSlot(l)},O.append(v)}k.append(O);const a=z("div","picker-actions"),h=z("button","btn","Next finished");h.type="button",h.disabled=m===0,h.onclick=()=>{ne(),y.onNextDone()};const c=z("button","btn","New session");c.type="button",c.onclick=()=>{ne(),y.onNewSession()},a.append(h,c),k.append(a);const s=z("div","legend");s.innerHTML="<b>n</b> next finished <b>p</b> projects <b>c</b> new session <b>r</b> rename <b>x</b> kill <b>m</b> mark seen <b>o</b> orchestrator <b>esc</b> close",k.append(s),De(k),k.dataset.projects=String(p.length)}function rn(u,p){const m=z("div","panel");m.append(z("h2",void 0,"Projects")),m.append(z("p","hint",`Each project owns its own ${dt()} slots.`));const y=z("div","rows");u.forEach((k,O)=>{const A=k.sessions.filter(a=>a.status==="done").length,t=z("button","row st-done");t.append(z("span","key",O<9?String(O+1):"—")),t.append(z("span","nm",k.name)),t.append(z("span","tag",A>0?`${A} done`:k.root)),t.onclick=()=>{ne(),p(k.id)},y.append(t)}),m.append(y),De(m)}function ls(u,p){const m=z("div","panel");m.append(z("h2",void 0,u.title)),m.append(z("p","hint",u.blocking?"A project is a name and a root directory. New sessions start there.":"New sessions in this project start in its root directory."));const y=z("form"),k=z("input");k.value=u.name??"",k.placeholder="api-service",k.required=!0;const O=z("label","field");O.append(z("span",void 0,"Project name"),k);const A=z("input");A.value=u.root??"",A.placeholder="/home/you/code/api-service",A.required=!0,A.disabled=!!u.rootLocked;const t=z("label","field");t.append(z("span",void 0,u.rootLocked?"Root directory (fixed after creation)":"Root directory"),A),y.append(O,t),u.rootLocked||y.append(cs(A));const a=z("div","actions");if(u.onDelete){const c=z("button","btn danger","Delete project");c.type="button",c.onclick=()=>{var s;ne(),(s=u.onDelete)==null||s.call(u)},a.append(c),a.style.justifyContent="space-between"}if(!u.blocking){const c=z("button","btn","Cancel");c.type="button",c.onclick=()=>ne(),a.append(c)}const h=z("button","btn primary",u.onDelete?"Save":"Create");h.type="submit",a.append(h),y.append(a),y.onsubmit=c=>{c.preventDefault(),!(!k.value.trim()||!A.value.trim())&&(ne(),p(k.value.trim(),A.value.trim()))},m.append(y),De(m,{dismissible:!u.blocking}),k.focus(),k.select()}function nn(u,p){const m=z("div","panel");m.append(z("h2",void 0,`New session in slot ${u.slot}`)),m.append(z("p","hint","Defaults to the project root."));const y=z("form"),k=(s,l,f)=>{const v=z("input");v.value=l,v.placeholder=f;const o=z("label","field");return o.append(z("span",void 0,s),v),y.append(o),v},O=k("Working directory",u.cwd,u.cwd);y.append(cs(O));const A=k("Command (optional)","","claude"),t=k("Name (optional)","","agent"),a=z("div","actions"),h=z("button","btn","Cancel");h.type="button",h.onclick=()=>ne();const c=z("button","btn primary","Start");c.type="submit",a.append(h,c),y.append(a),y.onsubmit=s=>{s.preventDefault(),ne(),p({cwd:O.value.trim()||u.cwd,command:A.value.trim()||null,name:t.value.trim()||null})},m.append(y),De(m)}const on=["#f87171","#b91c1c","#fb923c","#c2410c","#fbbf24","#b45309","#a3e635","#4d7c0f","#4ade80","#15803d","#2dd4bf","#0f766e","#22d3ee","#0e7490","#60a5fa","#1d4ed8","#818cf8","#4338ca","#c084fc","#7e22ce","#f472b6","#be185d","#94a3b8","#475569"];function an(u,p,m,y){const k=z("div","panel");k.append(z("h2",void 0,`Slot ${u.slot}`)),k.append(z("p","hint",u.cwd));const O=z("form"),A=z("input");A.value=u.name??"",A.placeholder=u.title??"shell";const t=z("label","field");t.append(z("span",void 0,"Name"),A),O.append(t);let a=u.color;const h=z("div","swatches"),c=()=>{for(const i of Array.from(h.children))i.classList.toggle("active",i.dataset.color===(a??""))},s=(i,n)=>{const d=z("button","swatch");d.type="button",d.dataset.color=i??"",d.title=n,d.setAttribute("aria-label",n),i?d.style.setProperty("--tint",i):d.classList.add("none"),d.onclick=()=>{a=i,c()},h.append(d)};s(null,"No colour");for(const i of on)s(i,i);c();const l=z("div","field");l.append(z("span",void 0,"Border colour"),h),O.append(l);const f=z("div","actions"),v=z("button","btn danger","Delete");v.type="button",v.onclick=()=>{ne(),m()};const o=z("button","btn diff-toggle",y.open?"Hide diff viewer":"Diff viewer");o.type="button",o.style.marginRight="auto",o.onclick=()=>{ne(),y.onToggle()};const e=z("button","btn","Cancel");e.type="button",e.onclick=()=>ne();const r=z("button","btn primary","Save");r.type="submit",f.append(v,o,e,r),O.append(f),O.onsubmit=i=>{i.preventDefault(),ne(),p({name:A.value.trim(),color:a})},k.append(O),De(k),A.focus(),A.select()}function hn(u,p){const m=z("div","panel");m.append(z("h2",void 0,"Settings"));let y=u.ring;const k=z("div","field ring-size");k.append(z("span",void 0,"Terminals around the focus"));const O=z("div","choices");for(const s of lt){const l=z("button","choice"+(s===y?" active":""));l.type="button",l.append(z("b",void 0,String(s))),l.append(z("span",void 0,s<12?"wide centre":"full ring")),l.onclick=()=>{y=s;for(const f of Array.from(O.children))f.classList.remove("active");l.classList.add("active")},O.append(l)}k.append(O),m.append(k),m.append(z("p","hint ring-size","Slots stay where they are. Shrinking needs the slots above the new size to be empty first, so nothing is killed or hidden behind your back."));const A=z("label","field toggle"),t=z("input");t.type="checkbox",t.checked=u.usage,A.append(t,z("span",void 0,"Enable Claude usage monitoring")),m.append(A),m.append(z("p","hint","The tab asks Claude Code for the real numbers with `claude -p /usage`, which it answers locally and bills nothing. Nothing is read from your credentials, and nothing leaves this machine."));const a=z("div","actions"),h=z("button","btn","Cancel");h.type="button",h.onclick=()=>ne();const c=z("button","btn primary","Save");c.onclick=()=>{ne(),p({ring:y,usage:t.checked})},a.append(h,c),m.append(a),De(m)}function cn(u,p){const m=z("div","panel");m.append(z("h2",void 0,`tring ${p} is available`)),m.append(z("p","hint",`You are running ${u}. Update with:`));const y=z("pre","cmd","npm i -g tring-chat");m.append(y),m.append(z("p","hint","Running sessions are not affected until you restart the daemon."));const k=z("div","actions"),O=z("button","btn","Copy command");O.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{O.textContent="Copied"},()=>{O.textContent="Copy failed"})};const A=z("button","btn primary","Close");A.onclick=()=>ne(),k.append(O,A),m.append(k),De(m)}function ds(u,p,m){const y=z("div","panel");y.append(z("h2",void 0,u)),y.append(z("p","hint",p));const k=z("div","actions"),O=z("button","btn","Cancel");O.onclick=()=>ne();const A=z("button","btn primary","Confirm");A.onclick=()=>{ne(),m()},k.append(O,A),y.append(k),De(y)}function ln(u){const p=z("div","panel paste-sheet");p.append(z("h2",void 0,"Paste")),p.append(z("p","hint","The clipboard could not be read directly. Long-press the box and paste: text is typed into the terminal, an image goes in as a path."));const m=z("textarea","paste-box");m.rows=4,m.placeholder="paste here",m.autocomplete="off",m.autocapitalize="off",m.spellcheck=!1,m.addEventListener("paste",A=>{var a;const t=Gi((a=A.clipboardData)==null?void 0:a.files);t.length!==0&&(A.preventDefault(),ne(),u.onImages(t))}),p.append(m);const y=z("div","actions"),k=z("button","btn","Cancel");k.onclick=()=>ne();const O=z("button","btn primary","Insert");O.onclick=()=>{const A=m.value;ne(),A&&u.onText(A)},y.append(k,O),p.append(y),De(p),m.focus()}function dn(u,p){const m=z("div","panel copy-sheet");m.append(z("h2",void 0,"Copy"));const y=(a,h,c="btn")=>{const s=z("button",c,a);return s.type="button",s.onclick=()=>{p(h).then(l=>{s.textContent=l?"Copied":"Copy failed",setTimeout(()=>{s.textContent=a},1500)})},s};if(u.links.length>0){m.append(z("p","hint","Links on screen, the latest first."));const a=z("div","links");for(const h of u.links){const c=z("div","link");c.append(z("span","url",h),y("Copy",h)),a.append(c)}m.append(a)}m.append(z("p","hint",u.text?"The screen as text. Long-press to select part of it, or copy all of it.":"Nothing on the screen yet."));const k=z("pre","copy-box",u.text);m.append(k);const O=z("div","actions"),A=z("button","btn","Close");A.onclick=()=>ne();const t=y("Copy screen",u.text,"btn primary");t.disabled=u.text==="",O.append(A,t),m.append(O),De(m)}const un=document.getElementById("bar"),Ht=document.getElementById("switcher"),We=document.getElementById("ring"),ut=document.getElementById("usage");let ye=[],Ie=null,ue=null,Qe=null,kt=null,Ai="",$t=!1,me=null,Vt=null,je="ring",Lt=null;const si=window.matchMedia(hs),_t=new Map,xt=new Map,Gt=new Map,Rt=new Map;let Xt=null,Yt=null;const ke=document.createElement("div");ke.className="focus-cell";const ri=document.createElement("div");ri.className="term-host";ke.append(ri);const et=new _r(ke,()=>vt()),_e=new hr(ri),Se=new $i(ke,{label:u=>{const p=He(u);if(!p)return null;const m=ye.find(y=>y.id===p.projectId);return{name:p.name??p.title??"shell",slot:p.slot,color:p.color,elsewhere:p.projectId!==Ie?(m==null?void 0:m.name)??"another project":null}},onAnswer:(u,p,m)=>pe.send({type:"answer",itemId:u,decision:p,...m}),onReply:(u,p)=>pe.send({type:"reply",itemId:u,text:p}),onOpen:u=>wn(u),hooks:()=>Dt("/api/hooks"),installHooks:async()=>{await Ns("/api/hooks")},onAuto:u=>pe.send({type:"autoAnswer",enabled:u}),onAgent:u=>pe.send({type:"agent",...u})});let Di=!1,Fe={enabled:!1,id:null,status:null,error:null},Mi=null;const st=()=>Se.isOpen&&Fe.enabled&&Fe.id!==null,$e=()=>st()?Fe.id:ue,pe=new Us({onOpen:()=>{Mt(),yn()},onClose:()=>Ke("daemon disconnected — reconnecting"),onOutput:(u,p)=>{u===$e()&&_e.write(p)},onMessage:pn});_e.onInput=u=>{const p=$e();p&&pe.send({type:"input",id:p,data:u})};gr(window);const tt={upload:Ws,ready:()=>$e()!==null,insert:u=>{_e.paste(u),_e.focus()},onError:Ke};vr(ke,tt);Lr(We,{sessionAt:u=>{var p;return(p=Ye(u))==null?void 0:p.id},onMove:(u,p)=>pe.send({type:"move",id:u,slot:p})});xr(ke,tt);const _n=mr(u=>{fn(u)});async function fn(u){const[p]=u,m=Ke(u.length===1&&p?`uploading ${p.name}…`:`uploading ${u.length} files…`);await pt(u,tt),Ae===m&&Mt()}const it=document.createElement("div");it.className="heard";it.hidden=!0;it.setAttribute("aria-live","polite");ke.append(it);const Ti=Cr(window),Ce=Ti&&new yr(Ti,{onListening:u=>{it.hidden=!u,ze()},onHeard:u=>{it.textContent=u||"listening… tap the mic again to finish"},onText:u=>{$e()&&_e.paste(u+" ")},onError:Ke},navigator.language);_e.shouldSendKey=u=>!gt()&&!Zt(u);_e.onSelect=u=>{Yi(u).then(p=>{p||Ke("could not copy the selection"),_e.focus()})};const ni=()=>ye.find(u=>u.id===Ie)??null,Xe=()=>{var u;return((u=ni())==null?void 0:u.sessions)??[]},Ye=u=>Xe().find(p=>p.slot===u),He=u=>ye.flatMap(p=>p.sessions).find(p=>p.id===u);function rt(){const u=Math.max(0,...Xe().map(p=>p.slot));return lt.find(p=>p>=u&&p>=dt())??lt[lt.length-1]}const us=()=>ye.reduce((u,p)=>u+p.sessions.filter(m=>m.status==="done").length,0);function pn(u){var p,m;switch(u.type){case"state":{ye=u.projects,Vt=u.update??Vt;const y=new Set(ye.flatMap(k=>k.sessions).map(k=>k.id));for(const k of xt.keys())y.has(k)||xt.delete(k);Ie=u.activeProjectId??((p=ye[0])==null?void 0:p.id)??null,_s(),En(),Rn(),kn(),Vr()&&ms(),Dn();break}case"status":{const y=He(u.id),k=y==null?void 0:y.status;y&&(y.status=u.status,y.since=u.since,y.title=u.title),u.status==="done"&&k!=="done"&&u.notable&&yi(),Ue();break}case"screen":u.id===$e()&&_e.replay(u.ansi);break;case"snapshot":{xt.set(u.id,u.snapshot),(m=_t.get(u.id))==null||m.paint(u.snapshot);break}case"exit":Ue();break;case"error":Ke(u.message);break;case"autoAnswer":Se.setAuto(u.enabled,u.history);break;case"agent":Fe=u.agent,Se.setAgent(Fe),hi(),ze();break;case"inbox":{const y=Se.setItems(u.items);Di&&y.length>0&&yi(),Di=!0,Ue();break}}}const gn=()=>({onSelect:u=>ft(u),onAdd:()=>Ss(!1),onContext:u=>An(u),onUpdate:u=>cn(u.current,u.latest),onSoundToggle:()=>Ue(),onSettings:()=>Ln(),onUsage:()=>ms(),onInbox:()=>oi()}),Je=()=>Yr(un,ye,Ie,gn(),Vt,je==="usage",{open:Se.isOpen,count:Se.count});function _s(){Je(),vn(),Ue()}function vn(){const u=rt(),p=`${Ie}|${u}|`+Xe().map(m=>`${m.slot}:${m.id}`).sort().join(",");if(p!==Ai){Ai=p,Ur(We,ke,u);for(const m of Array.from(We.children))m!==ke&&m.remove();ke.parentElement!==We&&We.append(ke),Gt.clear(),_t.clear();for(let m=1;m<=u;m++){const y=Ye(m),k=document.createElement("div");if(k.className="tile",k.tabIndex=0,k.onmousedown=O=>O.preventDefault(),jr(k,m,u),k.dataset.slot=String(m),!y)k.classList.add("empty"),k.textContent=`+ ${Qt(m)}`,k.onclick=()=>li(m);else{const O=document.createElement("canvas");k.append(O);const A=new Ir(O);_t.set(y.id,A);const t=xt.get(y.id);t&&A.paint(t);const a=document.createElement("div");a.className="label";const h=yt("slot-badge");h.textContent=String(m),a.append(h,yt("big-nm")),k.append(a);const c=document.createElement("div");c.className="meta";const s=document.createElement("span");s.className="key",s.textContent=String(m),c.append(s,yt("nm"),yt("cwd")),k.append(c),k.onclick=()=>qe(y.id),k.oncontextmenu=f=>{f.preventDefault(),Cs(y.id)};const l=document.createElement("button");l.className="tile-action",l.onclick=f=>{f.stopPropagation(),pe.send({type:"respawn",id:y.id})},k.append(l),fs(k,y)}Gt.set(m,k),We.append(k)}requestAnimationFrame(()=>vt())}}const yt=u=>{const p=document.createElement("span");return p.className=u,p};function fs(u,p){if(u.classList.remove("st-idle","st-busy","st-done","st-exited","viewing","asking"),u.style.removeProperty("--tint"),!p)return;u.classList.add(`st-${p.status}`),p.id===ue&&u.classList.add("viewing"),Se.countFor(p.id)>0&&u.classList.add("asking"),p.color&&u.style.setProperty("--tint",p.color);const m=p.name??p.title??"shell",y=u.querySelector(".nm");y&&(y.textContent=m);const k=u.querySelector(".big-nm");k&&(k.textContent=m);const O=u.querySelector(".cwd");O&&(O.textContent=p.cwd.split("/").filter(Boolean).pop()??""),u.title=`${Qt(p.slot)} — ${p.cwd}`;const A=u.querySelector(".tile-action"),t=mn(p);A&&(A.hidden=!t,t&&(A.textContent=t.label,A.title=t.title))}function mn(u){return u.status==="exited"?{label:"↻",title:u.command?`Restart: ${u.command}`:`Restart shell (exit ${u.exitCode??"?"})`}:u.command&&u.status==="idle"?{label:"▸",title:`Run: ${u.command}`}:null}function Ue(){for(let p=1;p<=rt();p++){const m=Gt.get(p);m&&fs(m,Ye(p))}Je(),ze(),Se.repaint();const u=us();document.title=u>0?`(${u}) tring`:"tring"}let Nt="";function ze(){if(Ht.hidden=!si.matches||je!=="ring",Ht.hidden){Nt="",Ce==null||Ce.cancel();return}const u=ue?He(ue)??null:null,p=Xe().filter(A=>A.status==="done").length,m=(Ce==null?void 0:Ce.listening)??!1,y={open:Se.isOpen,count:Se.count},k=st()?{key:"◆",name:"Orchestrator",status:Fe.status??"idle"}:null,O=`${u==null?void 0:u.id}|${u==null?void 0:u.status}|${u==null?void 0:u.name}|${u==null?void 0:u.title}|${p}|${m}|${y.open}|${y.count}|${k==null?void 0:k.status}`;O!==Nt&&(Nt=O,en(Ht,{focused:u,done:p,listening:m,inbox:y,override:k},{onOpen:ws,onNext:ci,onEsc:Sn,onPaste:Cn,onAttach:_n,onCopy:bn,onMic:Ce?()=>Ce.toggle():void 0,onInbox:oi}))}function Sn(){const u=$e();u&&pe.send({type:"input",id:u,data:"\x1B"})}function Cn(){Rr({...tt,fallback:()=>ln({onText:tt.insert,onImages:u=>{pt(u,tt)}})})}function bn(){if(!$e())return;const u=_e.term.buffer.active;dn({text:Ar(u,_e.term.rows),links:Or(u)},Yi)}function vt(){const{cols:u,rows:p}=_e.fitNow();ue&&pe.send({type:"resize",cols:u,rows:p});for(const m of _t.values())m.refresh()}function qe(u,p=!1){mt(),!p&&Se.isOpen&&ai(),gs(u),ue&&!Se.isOpen&&_e.focus()}function oi(){Se.isOpen?ai():ps()}function ps(){mt(),Se.open(!(Fe.enabled&&Fe.id)),hi(),Je(),ze()}function ai(){Se.close(),hi(),Je(),ze(),ue&&_e.focus()}function hi(){const u=st()?Fe.id:null;ke.classList.toggle("agent-view",u!==null),Se.setBeside(u!==null),u!==Mi&&(Mi=u,Ce==null||Ce.cancel(),_e.clear(),requestAnimationFrame(()=>{const{cols:p,rows:m}=_e.fitNow();pe.send({type:"focus",id:$e(),cols:p,rows:m});for(const y of _t.values())y.refresh();u&&_e.focus()}))}function wn(u){const p=He(u);if(p){if(ai(),p.projectId!==Ie){Rt.set(p.projectId,p.id),ft(p.projectId);return}qe(p.id)}}function gs(u){if(u&&u===ue)return;if(st()){const k=u?He(u):void 0;ue&&(kt=ue),ue=(k==null?void 0:k.id)??null,Qe=(k==null?void 0:k.slot)??null,et.setSession(ue),k&&Rt.set(k.projectId,k.id),Ue();return}Ce==null||Ce.cancel();const p=u?He(u):void 0;if(ue&&(kt=ue),ue=(p==null?void 0:p.id)??null,Qe=(p==null?void 0:p.slot)??null,et.setSession(ue),!p){_e.clear(),Ue();return}Rt.set(p.projectId,p.id);const{cols:m,rows:y}=_e.fitNow();pe.send({type:"focus",id:p.id,cols:m,rows:y}),_e.focus(),Ue()}function yn(){const u=$e();if(!u)return;const{cols:p,rows:m}=_e.fitNow();pe.send({type:"focus",id:u,cols:p,rows:m})}function En(){if(ue===null||Qe===null)return;const u=fr({id:ue,slot:Qe},Xe());if(u&&u.id===ue){Qe=u.slot;return}gs((u==null?void 0:u.id)??null)}function vs(u){const p=Ye(u);p?qe(p.id):li(u)}function ms(){je!=="usage"&&(je="usage",We.hidden=!0,ut.hidden=!1,qt(ut,null,null),Jt(),Lt=setInterval(()=>void Jt(),3e4),ns(!0),Je(),ze())}function mt(){je!=="ring"&&(je="ring",Lt&&clearInterval(Lt),Lt=null,ut.hidden=!0,We.hidden=!1,ns(!1),Je(),ze(),requestAnimationFrame(()=>vt()))}async function Jt(){if(je==="usage")try{qt(ut,await Gr(),null)}catch(u){qt(ut,null,u.message)}}function Ln(){hn({ring:dt(),usage:zt()},u=>{u.usage!==zt()&&(Kr(u.usage),u.usage||mt()),u.ring!==dt()?xn(u.ring):(Je(),Jt())})}function xn(u){Wr(u),_s();const p=rt();p!==u?Ke(`slots above ${u} are still in use — the ring stays at ${p} until they are closed`):Mt()}function ft(u){mt(),u!==Ie&&(Ie=u,Ce==null||Ce.cancel(),ue=null,Qe=null,et.setSession(null),st()||_e.clear(),Xt=u,pe.send({type:"activateProject",projectId:u}))}function kn(){const u=Yt;if(u===null)return;const p=Ye(u);p&&(Yt=null,qe(p.id,!0))}function Rn(){const u=Xt;if(!u||u!==Ie)return;Xt=null;const p=Rt.get(u);p&&Xe().some(m=>m.id===p)&&qe(p,!0)}function ci(){var k;const u=Xe(),p=Ye(((k=He(ue??""))==null?void 0:k.slot)??0),m=(p==null?void 0:p.slot)??0,y=rt();for(let O=1;O<=y;O++){const A=(m+O-1)%y+1,t=u.find(a=>a.slot===A);if((t==null?void 0:t.status)==="done")return qe(t.id)}}function li(u){const p=ni();p&&nn({cwd:p.root,slot:u},m=>{si.matches&&(Yt=u),pe.send({type:"create",projectId:p.id,slot:u,cwd:m.cwd,...m.command?{command:m.command}:{},...m.name?{name:m.name}:{}})})}function Ss(u){ls({title:u?"Create your first project":"New project",root:"",blocking:u},(p,m)=>pe.send({type:"createProject",name:p,root:m}))}function Cs(u){const p=He(u);p&&an(p,m=>{m.name!==(p.name??"")&&pe.send({type:"rename",id:u,name:m.name}),m.color!==p.color&&pe.send({type:"color",id:u,color:m.color})},()=>bs(p),{open:et.isOpen,onToggle:()=>{et.isOpen||qe(u),et.toggle()}})}function bs(u){ds("Delete session",`Slot ${u.slot} — ${u.cwd}. The slot goes back to empty.`,()=>pe.send({type:"kill",id:u.id}))}function An(u){const p=ye.find(m=>m.id===u);p&&ls({title:"Project settings",name:p.name,root:p.root,rootLocked:!0,onDelete:()=>{const m=p.sessions.length;ds(`Delete ${p.name}?`,m>0?`This kills ${m} session${m===1?"":"s"} in this project.`:"This project has no running sessions.",()=>pe.send({type:"deleteProject",projectId:u}))}},m=>pe.send({type:"renameProject",projectId:u,name:m}))}function Dn(){if(ye.length>0){$t=!1;return}$t||gt()||($t=!0,Ss(!0))}document.addEventListener("keydown",u=>{if(gt())return Mn(u);Zt(u)&&(u.preventDefault(),ws())});document.addEventListener("click",u=>{if(!(gt()||je!=="ring")){if(st()){Se.el.contains(u.target)||_e.focus();return}!ue||Se.isOpen||_e.focus()}});function ws(){gt()||(mt(),me="picker",sn(ni(),ye,us(),{onPickSlot:u=>{me=null,vs(u)},onPickProject:u=>{me=null,ft(u)},onNextDone:()=>{me=null,ci()},onNewSession:()=>{me=null,ys()}}))}function ys(){const u=rt(),p=[...Array(u)].map((m,y)=>y+1).find(m=>!Ye(m));p?li(p):Ke(`all ${u} slots are full`)}function Mn(u){if(me===null)return;if(me==="projects"){const k=Number(u.key);if(k>=1&&k<=9&&ye[k-1]){u.preventDefault();const O=ye[k-1];ne(),me=null,ft(O.id);return}}const p=Bs(u);if(p!==null&&p<=rt()&&me==="picker"){u.preventDefault(),ne(),me=null,vs(p);return}if(Zt(u)||u.code==="Space"){u.preventDefault(),ne(),me=null,kt&&qe(kt);return}const m=Os(u);if(!m)return;u.preventDefault();const y=ue?He(ue):void 0;switch(m){case"close":ne(),me=null;break;case"next-done":ne(),me=null,ci();break;case"projects":ne(),me="projects",rn(ye,k=>{me=null,ft(k)});break;case"new-session":ne(),me=null,ys();break;case"rename":if(!y)break;ne(),me=null,Cs(y.id);break;case"kill":if(!y)break;ne(),me=null,bs(y);break;case"orchestrator":ne(),me=null,oi();break;case"mark-seen":y&&pe.send({type:"ack",id:y.id}),ne(),me=null;break}}let Ae=null;function Ke(u){return Mt(),Ae=document.createElement("div"),Ae.id="toast",Ae.textContent=u,document.body.append(Ae),Ae}function Mt(){Ae==null||Ae.remove(),Ae=null}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});window.addEventListener("resize",()=>vt());si.addEventListener("change",()=>{ze(),requestAnimationFrame(()=>vt())});$i.wanted()&&ps();pe.connect();
|
|
80
|
+
}`)),this.register((0,l.toDisposable)(()=>L.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(L.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=L.createVertexArray(),L.bindVertexArray(this._vertexArrayObject);const k=new Float32Array([0,0,1,0,0,1,1,1]),T=L.createBuffer();this.register((0,l.toDisposable)(()=>L.deleteBuffer(T))),L.bindBuffer(L.ARRAY_BUFFER,T),L.bufferData(L.ARRAY_BUFFER,k,L.STATIC_DRAW),L.enableVertexAttribArray(3),L.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const F=new Uint8Array([0,1,2,3]),$=L.createBuffer();this.register((0,l.toDisposable)(()=>L.deleteBuffer($))),L.bindBuffer(L.ELEMENT_ARRAY_BUFFER,$),L.bufferData(L.ELEMENT_ARRAY_BUFFER,F,L.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(L.createBuffer()),this.register((0,l.toDisposable)(()=>L.deleteBuffer(this._attributesBuffer))),L.bindBuffer(L.ARRAY_BUFFER,this._attributesBuffer),L.enableVertexAttribArray(0),L.vertexAttribPointer(0,2,L.FLOAT,!1,p,0),L.vertexAttribDivisor(0,1),L.enableVertexAttribArray(1),L.vertexAttribPointer(1,2,L.FLOAT,!1,p,2*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(1,1),L.enableVertexAttribArray(2),L.vertexAttribPointer(2,4,L.FLOAT,!1,p,4*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(2,1),this._updateCachedColors(R.colors),this.register(this._themeService.onChangeColors(N=>{this._updateCachedColors(N),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(f){const S=this._gl;S.useProgram(this._program),S.bindVertexArray(this._vertexArrayObject),S.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.bufferData(S.ARRAY_BUFFER,f.attributes,S.DYNAMIC_DRAW),S.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,S.UNSIGNED_BYTE,0,f.count)}handleResize(){this._updateViewportRectangle()}setDimensions(f){this._dimensions=f}_updateCachedColors(f){this._bgFloat=this._colorToFloat32Array(f.background),this._cursorFloat=this._colorToFloat32Array(f.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(f){const S=this._terminal,w=this._vertices;let R,L,k,T,F,$,N,H,E,M,I,P=1;for(R=0;R<S.rows;R++){for(k=-1,T=0,F=0,$=!1,L=0;L<S.cols;L++)N=(R*S.cols+L)*s.RENDER_MODEL_INDICIES_PER_CELL,H=f.cells[N+s.RENDER_MODEL_BG_OFFSET],E=f.cells[N+s.RENDER_MODEL_FG_OFFSET],M=!!(67108864&E),(H!==T||E!==F&&($||M))&&((T!==0||$&&F!==0)&&(I=8*P++,this._updateRectangle(w,I,F,T,k,L,R)),k=L,T=H,F=E,$=M);(T!==0||$&&F!==0)&&(I=8*P++,this._updateRectangle(w,I,F,T,k,S.cols,R))}w.count=P}updateCursor(f){const S=this._verticesCursor,w=f.cursor;if(!w||w.style==="block")return void(S.count=0);let R,L=0;w.style!=="bar"&&w.style!=="outline"||(R=8*L++,this._addRectangleFloat(S.attributes,R,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.style==="bar"?w.dpr*w.cursorWidth:w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),w.style!=="underline"&&w.style!=="outline"||(R=8*L++,this._addRectangleFloat(S.attributes,R,w.x*this._dimensions.device.cell.width,(w.y+1)*this._dimensions.device.cell.height-w.dpr,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat)),w.style==="outline"&&(R=8*L++,this._addRectangleFloat(S.attributes,R,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat),R=8*L++,this._addRectangleFloat(S.attributes,R,(w.x+w.width)*this._dimensions.device.cell.width-w.dpr,w.y*this._dimensions.device.cell.height,w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.count=L}_updateRectangle(f,S,w,R,L,k,T){if(67108864&w)switch(50331648&w){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&w].rgba;break;case 50331648:o=(16777215&w)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&R){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&R].rgba;break;case 50331648:o=(16777215&R)<<8;break;default:o=this._themeService.colors.background.rgba}f.attributes.length<S+4&&(f.attributes=(0,c.expandFloat32Array)(f.attributes,this._terminal.rows*this._terminal.cols*8)),e=L*this._dimensions.device.cell.width,r=T*this._dimensions.device.cell.height,i=(o>>24&255)/255,n=(o>>16&255)/255,u=(o>>8&255)/255,C=1,this._addRectangle(f.attributes,S,e,r,(k-L)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,n,u,C)}_addRectangle(f,S,w,R,L,k,T,F,$,N){f[S]=w/this._dimensions.device.canvas.width,f[S+1]=R/this._dimensions.device.canvas.height,f[S+2]=L/this._dimensions.device.canvas.width,f[S+3]=k/this._dimensions.device.canvas.height,f[S+4]=T,f[S+5]=F,f[S+6]=$,f[S+7]=N}_addRectangleFloat(f,S,w,R,L,k,T){f[S]=w/this._dimensions.device.canvas.width,f[S+1]=R/this._dimensions.device.canvas.height,f[S+2]=L/this._dimensions.device.canvas.width,f[S+3]=k/this._dimensions.device.canvas.height,f[S+4]=T[0],f[S+5]=T[1],f[S+6]=T[2],f[S+7]=T[3]}_colorToFloat32Array(f){return new Float32Array([(f.rgba>>24&255)/255,(f.rgba>>16&255)/255,(f.rgba>>8&255)/255,(255&f.rgba)/255])}}t.RectangleRenderer=g},310:(A,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,s){const c=l*s*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),s=a(627),c=a(457),p=a(56),v=a(374),o=a(345),e=a(859),r=a(147),i=a(782),n=a(855),u=a(965),C=a(742),g=a(310),b=a(733);class f extends e.Disposable{constructor(L,k,T,F,$,N,H,E,M){super(),this._terminal=L,this._characterJoinerService=k,this._charSizeService=T,this._coreBrowserService=F,this._coreService=$,this._decorationService=N,this._optionsService=H,this._themeService=E,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new g.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 b.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,H,this._themeService)],this.dimensions=(0,v.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(H.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const I={antialias:!1,depth:!1,preserveDrawingBuffer:M};if(this._gl=this._canvas.getContext("webgl2",I),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",P=>{console.log("webglcontextlost event received"),P.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(P)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",P=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(P,U)=>this._setCanvasDevicePixelDimensions(P,U)),this.register(this._coreBrowserService.onWindowChange(P=>{this._observerDisposable.value=(0,p.observeDevicePixelDimensions)(this._canvas,P,(U,q)=>this._setCanvasDevicePixelDimensions(U,q))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var P;for(const U of this._renderLayers)U.dispose();(P=this._canvas.parentElement)==null||P.removeChild(this._canvas),(0,s.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var L;return(L=this._charAtlas)==null?void 0:L.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(L,k){var T,F,$,N;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const H of this._renderLayers)H.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`,(T=this._rectangleRenderer.value)==null||T.setDimensions(this.dimensions),(F=this._rectangleRenderer.value)==null||F.handleResize(),($=this._glyphRenderer.value)==null||$.setDimensions(this.dimensions),(N=this._glyphRenderer.value)==null||N.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var L;for(const k of this._renderLayers)k.handleBlur(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.pause(),this._requestRedrawViewport()}handleFocus(){var L;for(const k of this._renderLayers)k.handleFocus(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.resume(),this._requestRedrawViewport()}handleSelectionChanged(L,k,T){for(const F of this._renderLayers)F.handleSelectionChanged(this._terminal,L,k,T);this._model.selection.update(this._core,L,k,T),this._requestRedrawViewport()}handleCursorMove(){var L;for(const k of this._renderLayers)k.handleCursorMove(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new C.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 k;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const L=(0,s.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==L&&(this._onChangeTextureAtlas.fire(L.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(L.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(L.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=L,this._charAtlas.warmUp(),(k=this._glyphRenderer.value)==null||k.setAtlas(this._charAtlas)}_clearModel(L){var k;this._model.clear(),L&&((k=this._glyphRenderer.value)==null||k.clear())}clearTextureAtlas(){var L;(L=this._charAtlas)==null||L.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var L;this._clearModel(!0);for(const k of this._renderLayers)k.reset(this._terminal);(L=this._cursorBlinkStateManager.value)==null||L.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(L){return-1}deregisterCharacterJoiner(L){return!1}renderRows(L,k){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 T of this._renderLayers)T.handleGridChanged(this._terminal,L,k);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(L,k),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(L,k){const T=this._core;let F,$,N,H,E,M,I,P,U,q,Y,G,O,D,z=this._workCell;L=w(L,T.rows-1,0),k=w(k,T.rows-1,0);const W=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=W-T.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,T.cols-1);let te=-1;const Z=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let he=!1;for($=L;$<=k;$++)for(N=$+T.buffer.ydisp,H=T.buffer.lines.get(N),this._model.lineLengths[$]=0,E=this._characterJoinerService.getJoinedCharacters(N),O=0;O<T.cols;O++)if(F=this._cellColorResolver.result.bg,H.loadCell(O,z),O===0&&(F=this._cellColorResolver.result.bg),M=!1,I=O,E.length>0&&O===E[0][0]&&(M=!0,P=E.shift(),z=new S(z,H.translateToString(!0,P[0],P[1]),P[1]-P[0]),I=P[1]-1),U=z.getChars(),q=z.getCode(),G=($*T.cols+O)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(z,O,N,this.dimensions.device.cell.width),Z&&N===W&&(O===K&&(this._model.cursor={x:K,y:V,width:z.getWidth(),style:this._coreBrowserService.isFocused?T.options.cursorStyle||"block":T.options.cursorInactiveStyle,cursorWidth:T.options.cursorWidth,dpr:this._devicePixelRatio},te=K+z.getWidth()-1),O>=K&&O<=te&&(this._coreBrowserService.isFocused&&(T.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&T.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),q!==n.NULL_CELL_CODE&&(this._model.lineLengths[$]=O+1),(this._model.cells[G]!==q||this._model.cells[G+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[G+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[G+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(he=!0,U.length>1&&(q|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[G]=q,this._model.cells[G+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[G+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[G+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=z.getWidth(),this._glyphRenderer.value.updateCell(O,$,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,Y,F),M))for(z=this._workCell,O++;O<I;O++)D=($*T.cols+O)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(O,$,n.NULL_CELL_CODE,0,0,0,n.NULL_CELL_CHAR,0,0),this._model.cells[D]=n.NULL_CELL_CODE,this._model.cells[D+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[D+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[D+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;he&&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(L,k){this._canvas.width===L&&this._canvas.height===k||(this._canvas.width=L,this._canvas.height=k,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const L=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:L,end:L})}}t.WebglRenderer=f;class S extends r.AttributeData{constructor(L,k,T){super(),this.content=0,this.combinedData="",this.fg=L.fg,this.bg=L.bg,this.combinedData=k,this._width=T}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(L){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function w(R,L,k=0){return Math.max(Math.min(R,L),k)}t.JoinedCellData=S},381:(A,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(s,c,p){const v=(0,h.throwIfFalsy)(s.createShader(c));if(s.shaderSource(v,p),s.compileShader(v),s.getShaderParameter(v,s.COMPILE_STATUS))return v;console.error(s.getShaderInfoLog(v)),s.deleteShader(v)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,c,p){const v=(0,h.throwIfFalsy)(s.createProgram());if(s.attachShader(v,(0,h.throwIfFalsy)(l(s,s.VERTEX_SHADER,c))),s.attachShader(v,(0,h.throwIfFalsy)(l(s,s.FRAGMENT_SHADER,p))),s.linkProgram(v),s.getProgramParameter(v,s.LINK_STATUS))return v;console.error(s.getProgramInfoLog(v)),s.deleteProgram(v)},t.createShader=l,t.expandFloat32Array=function(s,c){const p=Math.min(2*s.length,c),v=new Float32Array(p);for(let o=0;o<s.length;o++)v[o]=s[o];return v},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),s=a(374),c=a(859);class p extends c.Disposable{constructor(o,e,r,i,n,u,C,g){super(),this._container=e,this._alpha=n,this._coreBrowserService=u,this._optionsService=C,this._themeService=g,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(b=>{this._refreshCharAtlas(o,b),this.reset(o)})),this.register((0,c.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=p},733:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),s=a(592);class c extends s.BaseRenderLayer{constructor(v,o,e,r,i,n,u){super(e,v,"link",o,!0,i,n,u),this.register(r.onShowLinkUnderline(C=>this._handleShowLinkUnderline(C))),this.register(r.onHideLinkUnderline(C=>this._handleHideLinkUnderline(C)))}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:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,s){a.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,s))}}}},274:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),s=a(374);let c,p=0,v=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(n,u,C,g,b,f){this._terminal=n,this._optionService=u,this._selectionRenderModel=C,this._decorationService=g,this._coreBrowserService=b,this._themeService=f,this.result={fg:0,bg:0,ext:0}}resolve(n,u,C,g){if(this.result.bg=n.bg,this.result.fg=n.fg,this.result.ext=268435456&n.bg?n.extended.ext:0,v=0,p=0,e=!1,o=!1,r=!1,c=this._themeService.colors,i=0,n.getCode()!==h.NULL_CELL_CODE&&n.extended.underlineStyle===4){const b=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=u*g%(2*Math.round(b))}if(this._decorationService.forEachDecorationAtCell(u,C,"bottom",b=>{b.backgroundColorRGB&&(v=b.backgroundColorRGB.rgba>>8&16777215,e=!0),b.foregroundColorRGB&&(p=b.foregroundColorRGB.rgba>>8&16777215,o=!0)}),r=this._selectionRenderModel.isCellSelected(this._terminal,u,C),r){if(67108864&this.result.fg||50331648&this.result.bg){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&&(p=c.selectionForeground.rgba>>8&16777215,o=!0),(0,s.treatGlyphAsBackgroundColor)(n.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))p=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:p=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:p=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:p=(16777215&this.result.fg)<<8|255;break;default:p=this._themeService.colors.foreground.rgba}p=l.rgba.blend(p,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(u,C,"top",b=>{b.backgroundColorRGB&&(v=b.backgroundColorRGB.rgba>>8&16777215,e=!0),b.foregroundColorRGB&&(p=b.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(v=r?-16777216&n.bg&-134217729|v|50331648:-16777216&n.bg|v|50331648),o&&(p=-16777216&n.fg&-67108865|p|50331648),67108864&this.result.fg&&(e&&!o&&(p=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648,o=!0),!e&&o&&(v=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648,e=!0)),c=void 0,this.result.bg=e?v:this.result.bg,this.result.fg=o?p:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),s=[];t.acquireTextureAtlas=function(c,p,v,o,e,r,i,n){const u=(0,l.generateConfig)(o,e,r,i,p,v,n);for(let b=0;b<s.length;b++){const f=s[b],S=f.ownedBy.indexOf(c);if(S>=0){if((0,l.configEquals)(f.config,u))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),s.splice(b,1)):f.ownedBy.splice(S,1);break}}for(let b=0;b<s.length;b++){const f=s[b];if((0,l.configEquals)(f.config,u))return f.ownedBy.push(c),f.atlas}const C=c._core,g={atlas:new h.TextureAtlas(document,u,C.unicodeService),config:u,ownedBy:[c]};return s.push(g),g.atlas},t.removeTerminalFromCache=function(c){for(let p=0;p<s.length;p++){const v=s[p].ownedBy.indexOf(c);if(v!==-1){s[p].ownedBy.length===1?(s[p].atlas.dispose(),s.splice(p,1)):s[p].ownedBy.splice(v,1);break}}}},197:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,s,c,p,v,o,e){const r={foreground:o.foreground,background:o.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:v.customGlyphs,devicePixelRatio:e,letterSpacing:v.letterSpacing,lineHeight:v.lineHeight,deviceCellWidth:l,deviceCellHeight:s,deviceCharWidth:c,deviceCharHeight:p,fontFamily:v.fontFamily,fontSize:v.fontSize,fontWeight:v.fontWeight,fontWeightBold:v.fontWeightBold,allowTransparency:v.allowTransparency,drawBoldTextInBrightColors:v.drawBoldTextInBrightColors,minimumContrastRatio:v.minimumContrastRatio,colors:r}},t.configEquals=function(l,s){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==s.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===s.devicePixelRatio&&l.customGlyphs===s.customGlyphs&&l.lineHeight===s.lineHeight&&l.letterSpacing===s.letterSpacing&&l.fontFamily===s.fontFamily&&l.fontSize===s.fontSize&&l.fontWeight===s.fontWeight&&l.fontWeightBold===s.fontWeightBold&&l.allowTransparency===s.allowTransparency&&l.deviceCharWidth===s.deviceCharWidth&&l.deviceCharHeight===s.deviceCharHeight&&l.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&l.minimumContrastRatio===s.minimumContrastRatio&&l.colors.foreground.rgba===s.colors.foreground.rgba&&l.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(A,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:(A,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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,r,i,n,u,C,g){const b=t.blockElementDefinitions[e];if(b)return function(R,L,k,T,F,$){for(let N=0;N<L.length;N++){const H=L[N],E=F/8,M=$/8;R.fillRect(k+H.x*E,T+H.y*M,H.w*E,H.h*M)}}(o,b,r,i,n,u),!0;const f=l[e];if(f)return function(R,L,k,T,F,$){let N=s.get(L);N||(N=new Map,s.set(L,N));const H=R.fillStyle;if(typeof H!="string")throw new Error(`Unexpected fillStyle type "${H}"`);let E=N.get(H);if(!E){const M=L[0].length,I=L.length,P=R.canvas.ownerDocument.createElement("canvas");P.width=M,P.height=I;const U=(0,h.throwIfFalsy)(P.getContext("2d")),q=new ImageData(M,I);let Y,G,O,D;if(H.startsWith("#"))Y=parseInt(H.slice(1,3),16),G=parseInt(H.slice(3,5),16),O=parseInt(H.slice(5,7),16),D=H.length>7&&parseInt(H.slice(7,9),16)||1;else{if(!H.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${H}" when drawing pattern glyph`);[Y,G,O,D]=H.substring(5,H.length-1).split(",").map(z=>parseFloat(z))}for(let z=0;z<I;z++)for(let W=0;W<M;W++)q.data[4*(z*M+W)]=Y,q.data[4*(z*M+W)+1]=G,q.data[4*(z*M+W)+2]=O,q.data[4*(z*M+W)+3]=L[z][W]*(255*D);U.putImageData(q,0,0),E=(0,h.throwIfFalsy)(R.createPattern(P,null)),N.set(H,E)}R.fillStyle=E,R.fillRect(k,T,F,$)}(o,f,r,i,n,u),!0;const S=t.boxDrawingDefinitions[e];if(S)return function(R,L,k,T,F,$,N){R.strokeStyle=R.fillStyle;for(const[H,E]of Object.entries(L)){let M;R.beginPath(),R.lineWidth=N*Number.parseInt(H),M=typeof E=="function"?E(.15,.15/$*F):E;for(const I of M.split(" ")){const P=I[0],U=p[P];if(!U){console.error(`Could not find drawing instructions for "${P}"`);continue}const q=I.substring(1).split(",");q[0]&&q[1]&&U(R,v(q,F,$,k,T,!0,N))}R.stroke(),R.closePath()}}(o,S,r,i,n,u,g),!0;const w=t.powerlineDefinitions[e];return!!w&&(function(R,L,k,T,F,$,N,H){const E=new Path2D;E.rect(k,T,F,$),R.clip(E),R.beginPath();const M=N/12;R.lineWidth=H*M;for(const I of L.d.split(" ")){const P=I[0],U=p[P];if(!U){console.error(`Could not find drawing instructions for "${P}"`);continue}const q=I.substring(1).split(",");q[0]&&q[1]&&U(R,v(q,F,$,k,T,!1,H,(L.leftPadding??0)*(M/2),(L.rightPadding??0)*(M/2)))}L.type===1?(R.strokeStyle=R.fillStyle,R.stroke()):R.fill(),R.closePath()}(o,w,r,i,n,u,C,g),!0)};const s=new Map;function c(o,e,r=0){return Math.max(Math.min(o,e),r)}const p={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function v(o,e,r,i,n,u,C,g=0,b=0){const f=o.map(S=>parseFloat(S)||parseInt(S));if(f.length<2)throw new Error("Too few arguments for instruction");for(let S=0;S<f.length;S+=2)f[S]*=e-g*C-b*C,u&&f[S]!==0&&(f[S]=c(Math.round(f[S]+.5)-.5,e,0)),f[S]+=i+g*C;for(let S=1;S<f.length;S+=2)f[S]*=r,u&&f[S]!==0&&(f[S]=c(Math.round(f[S]+.5)-.5,r,0)),f[S]+=n;return f}},56:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,s,c){let p=new s.ResizeObserver(v=>{const o=v.find(i=>i.target===l);if(!o)return;if(!("devicePixelContentBoxSize"in o))return p==null||p.disconnect(),void(p=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&c(e,r)});try{p.observe(l,{box:["device-pixel-content-box"]})}catch{p.disconnect(),p=void 0}return(0,h.toDisposable)(()=>p==null?void 0:p.disconnect())}},374:(A,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,s,c,p){return s===1&&c>Math.ceil(1.5*p)&&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(s){return 9472<=s&&s<=9631}(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},296:(A,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,s,c,p=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const v=l.buffers.active.ydisp,o=s[1]-v,e=c[1]-v,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),s=a(374),c=a(160),p=a(345),v=a(485),o=a(385),e=a(147),r=a(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let n;class u{get pages(){return this._pages}constructor(S,w,R){this._document=S,this._config=w,this._unicodeService=R,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 p.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new p.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=b(S,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,s.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const S of this.pages)S.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const S=new o.IdleTaskQueue;for(let w=33;w<126;w++)S.enqueue(()=>{if(!this._cacheMap.get(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const R=this._drawToCache(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,R)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const S of this._pages)S.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(u.maxAtlasPages&&this._pages.length>=Math.max(4,u.maxAtlasPages)){const w=this._pages.filter(N=>2*N.canvas.width<=(u.maxTextureSize||4096)).sort((N,H)=>H.canvas.width!==N.canvas.width?H.canvas.width-N.canvas.width:H.percentageUsed-N.percentageUsed);let R=-1,L=0;for(let N=0;N<w.length;N++)if(w[N].canvas.width!==L)R=N,L=w[N].canvas.width;else if(N-R==3)break;const k=w.slice(R,R+4),T=k.map(N=>N.glyphs[0].texturePage).sort((N,H)=>N>H?1:-1),F=this.pages.length-k.length,$=this._mergePages(k,F);$.version++;for(let N=T.length-1;N>=0;N--)this._deletePage(T[N]);this.pages.push($),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire($.canvas)}const S=new C(this._document,this._textureSize);return this._pages.push(S),this._activePages.push(S),this._onAddTextureAtlasCanvas.fire(S.canvas),S}_mergePages(S,w){const R=2*S[0].canvas.width,L=new C(this._document,R,S);for(const[k,T]of S.entries()){const F=k*T.canvas.width%R,$=Math.floor(k/2)*T.canvas.height;L.ctx.drawImage(T.canvas,F,$);for(const H of T.glyphs)H.texturePage=w,H.sizeClipSpace.x=H.size.x/R,H.sizeClipSpace.y=H.size.y/R,H.texturePosition.x+=F,H.texturePosition.y+=$,H.texturePositionClipSpace.x=H.texturePosition.x/R,H.texturePositionClipSpace.y=H.texturePosition.y/R;this._onRemoveTextureAtlasCanvas.fire(T.canvas);const N=this._activePages.indexOf(T);N!==-1&&this._activePages.splice(N,1)}return L}_deletePage(S){this._pages.splice(S,1);for(let w=S;w<this._pages.length;w++){const R=this._pages[w];for(const L of R.glyphs)L.texturePage--;R.version++}}getRasterizedGlyphCombinedChar(S,w,R,L,k){return this._getFromCacheMap(this._cacheMapCombined,S,w,R,L,k)}getRasterizedGlyph(S,w,R,L,k){return this._getFromCacheMap(this._cacheMap,S,w,R,L,k)}_getFromCacheMap(S,w,R,L,k,T=!1){return n=S.get(w,R,L,k),n||(n=this._drawToCache(w,R,L,k,T),S.set(w,R,L,k,n)),n}_getColorFromAnsiIndex(S){if(S>=this._config.colors.ansi.length)throw new Error("No color found for idx "+S);return this._config.colors.ansi[S]}_getBackgroundColor(S,w,R,L){if(this._config.allowTransparency)return c.NULL_COLOR;let k;switch(S){case 16777216:case 33554432:k=this._getColorFromAnsiIndex(w);break;case 50331648:const T=e.AttributeData.toColorRGB(w);k=c.channels.toColor(T[0],T[1],T[2]);break;default:k=R?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return k}_getForegroundColor(S,w,R,L,k,T,F,$,N,H){const E=this._getMinimumContrastColor(S,w,R,L,k,T,F,N,$,H);if(E)return E;let M;switch(k){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&N&&T<8&&(T+=8),M=this._getColorFromAnsiIndex(T);break;case 50331648:const I=e.AttributeData.toColorRGB(T);M=c.channels.toColor(I[0],I[1],I[2]);break;default:M=F?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(M=c.color.opaque(M)),$&&(M=c.color.multiplyOpacity(M,h.DIM_OPACITY)),M}_resolveBackgroundRgba(S,w,R){switch(S){case 16777216:case 33554432:return this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;default:return R?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(S,w,R,L){switch(S){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&L&&w<8&&(w+=8),this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;default:return R?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(S,w,R,L,k,T,F,$,N,H){if(this._config.minimumContrastRatio===1||H)return;const E=this._getContrastCache(N),M=E.getColor(S,L);if(M!==void 0)return M||void 0;const I=this._resolveBackgroundRgba(w,R,F),P=this._resolveForegroundRgba(k,T,F,$),U=c.rgba.ensureContrastRatio(I,P,this._config.minimumContrastRatio/(N?2:1));if(!U)return void E.setColor(S,L,null);const q=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return E.setColor(S,L,q),q}_getContrastCache(S){return S?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(S,w,R,L,k=!1){const T=typeof S=="number"?String.fromCharCode(S):S,F=Math.min(this._config.deviceCellWidth*Math.max(T.length,2)+4,this._textureSize);this._tmpCanvas.width<F&&(this._tmpCanvas.width=F);const $=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<$&&(this._tmpCanvas.height=$),this._tmpCtx.save(),this._workAttributeData.fg=R,this._workAttributeData.bg=w,this._workAttributeData.extended.ext=L,this._workAttributeData.isInvisible())return i;const N=!!this._workAttributeData.isBold(),H=!!this._workAttributeData.isInverse(),E=!!this._workAttributeData.isDim(),M=!!this._workAttributeData.isItalic(),I=!!this._workAttributeData.isUnderline(),P=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),G=this._workAttributeData.getBgColor(),O=this._workAttributeData.getBgColorMode();if(H){const X=q;q=G,G=X;const oe=Y;Y=O,O=oe}const D=this._getBackgroundColor(O,G,H,E);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=D.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const z=N?this._config.fontWeightBold:this._config.fontWeight,W=M?"italic":"";this._tmpCtx.font=`${W} ${z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const V=T.length===1&&(0,s.isPowerlineGlyph)(T.charCodeAt(0)),K=T.length===1&&(0,s.isRestrictedPowerlineGlyph)(T.charCodeAt(0)),te=this._getForegroundColor(w,O,G,R,Y,q,H,E,N,(0,s.treatGlyphAsBackgroundColor)(T.charCodeAt(0)));this._tmpCtx.fillStyle=te.css;const Z=K?0:4;let he=!1;this._config.customGlyphs!==!1&&(he=(0,l.tryDrawCustomChar)(this._tmpCtx,T,Z,Z,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let pe,Q=!V;if(pe=typeof S=="number"?this._unicodeService.wcwidth(S):this._unicodeService.getStringCellWidth(S),I){this._tmpCtx.save();const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),oe=X%2==1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Q=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Q=!1;let ge=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ge<8&&(ge+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ge).css}this._tmpCtx.beginPath();const fe=Z,ue=Math.ceil(Z+this._config.deviceCharHeight)-oe-(k?2*X:0),Be=ue+X,be=ue+2*X;let Ae=this._workAttributeData.getUnderlineVariantOffset();for(let ge=0;ge<pe;ge++){this._tmpCtx.save();const ce=fe+ge*this._config.deviceCellWidth,ie=fe+(ge+1)*this._config.deviceCellWidth,ct=ce+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ce,ue),this._tmpCtx.lineTo(ie,ue),this._tmpCtx.moveTo(ce,be),this._tmpCtx.lineTo(ie,be);break;case 3:const Et=X<=1?be:Math.ceil(Z+this._config.deviceCharHeight-X/2)-oe,Lt=X<=1?ue:Math.ceil(Z+this._config.deviceCharHeight+X/2)-oe,Si=new Path2D;Si.rect(ce,ue,this._config.deviceCellWidth,be-ue),this._tmpCtx.clip(Si),this._tmpCtx.moveTo(ce-this._config.deviceCellWidth/2,Be),this._tmpCtx.bezierCurveTo(ce-this._config.deviceCellWidth/2,Lt,ce,Lt,ce,Be),this._tmpCtx.bezierCurveTo(ce,Et,ct,Et,ct,Be),this._tmpCtx.bezierCurveTo(ct,Lt,ie,Lt,ie,Be),this._tmpCtx.bezierCurveTo(ie,Et,ie+this._config.deviceCellWidth/2,Et,ie+this._config.deviceCellWidth/2,Be);break;case 4:const xt=Ae===0?0:Ae>=X?2*X-Ae:X-Ae;Ae>=X||xt===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ce+xt,ue),this._tmpCtx.lineTo(ie,ue)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ce,ue),this._tmpCtx.lineTo(ce+xt,ue),this._tmpCtx.moveTo(ce+xt+X,ue),this._tmpCtx.lineTo(ie,ue)),Ae=(0,s.computeNextVariantOffset)(ie-ce,X,Ae);break;case 5:const Os=.6,Fs=.3,Ht=ie-ce,Ci=Math.floor(Os*Ht),bi=Math.floor(Fs*Ht),Hs=Ht-Ci-bi;this._tmpCtx.setLineDash([Ci,bi,Hs]),this._tmpCtx.moveTo(ce,ue),this._tmpCtx.lineTo(ie,ue);break;default:this._tmpCtx.moveTo(ce,ue),this._tmpCtx.lineTo(ie,ue)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!he&&this._config.fontSize>=12&&!this._config.allowTransparency&&T!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ge=this._tmpCtx.measureText(T);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ge&&ge.actualBoundingBoxDescent>0){this._tmpCtx.save();const ce=new Path2D;ce.rect(fe,ue-Math.ceil(X/2),this._config.deviceCellWidth*pe,be-ue+Math.ceil(X/2)),this._tmpCtx.clip(ce),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=D.css,this._tmpCtx.strokeText(T,Z,Z+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),oe=X%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Z,Z+oe),this._tmpCtx.lineTo(Z+this._config.deviceCharWidth*pe,Z+oe),this._tmpCtx.stroke()}if(he||this._tmpCtx.fillText(T,Z,Z+this._config.deviceCharHeight),T==="_"&&!this._config.allowTransparency){let X=g(this._tmpCtx.getImageData(Z,Z,this._config.deviceCellWidth,this._config.deviceCellHeight),D,te,Q);if(X)for(let oe=1;oe<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=D.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(T,Z,Z+this._config.deviceCharHeight-oe),X=g(this._tmpCtx.getImageData(Z,Z,this._config.deviceCellWidth,this._config.deviceCellHeight),D,te,Q),X);oe++);}if(P){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),oe=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Z,Z+Math.floor(this._config.deviceCharHeight/2)-oe),this._tmpCtx.lineTo(Z+this._config.deviceCharWidth*pe,Z+Math.floor(this._config.deviceCharHeight/2)-oe),this._tmpCtx.stroke()}this._tmpCtx.restore();const De=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let st;if(st=this._config.allowTransparency?function(X){for(let oe=0;oe<X.data.length;oe+=4)if(X.data[oe+3]>0)return!1;return!0}(De):g(De,D,te,Q),st)return i;const ae=this._findGlyphBoundingBox(De,this._workBoundingBox,F,K,he,Z);let se,re;for(;;){if(this._activePages.length===0){const X=this._createNewPage();se=X,re=X.currentRow,re.height=ae.size.y;break}se=this._activePages[this._activePages.length-1],re=se.currentRow;for(const X of this._activePages)ae.size.y<=X.currentRow.height&&(se=X,re=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const oe of this._activePages[X].fixedRows)oe.height<=re.height&&ae.size.y<=oe.height&&(se=this._activePages[X],re=oe);if(re.y+ae.size.y>=se.canvas.height||re.height>ae.size.y+2){let X=!1;if(se.currentRow.y+se.currentRow.height+ae.size.y>=se.canvas.height){let oe;for(const fe of this._activePages)if(fe.currentRow.y+fe.currentRow.height+ae.size.y<fe.canvas.height){oe=fe;break}if(oe)se=oe;else if(u.maxAtlasPages&&this._pages.length>=u.maxAtlasPages&&re.y+ae.size.y<=se.canvas.height&&re.height>=ae.size.y&&re.x+ae.size.x<=se.canvas.width)X=!0;else{const fe=this._createNewPage();se=fe,re=fe.currentRow,re.height=ae.size.y,X=!0}}X||(se.currentRow.height>0&&se.fixedRows.push(se.currentRow),re={x:0,y:se.currentRow.y+se.currentRow.height,height:ae.size.y},se.fixedRows.push(re),se.currentRow={x:0,y:re.y+re.height,height:0})}if(re.x+ae.size.x<=se.canvas.width)break;re===se.currentRow?(re.x=0,re.y+=re.height,re.height=0):se.fixedRows.splice(se.fixedRows.indexOf(re),1)}return ae.texturePage=this._pages.indexOf(se),ae.texturePosition.x=re.x,ae.texturePosition.y=re.y,ae.texturePositionClipSpace.x=re.x/se.canvas.width,ae.texturePositionClipSpace.y=re.y/se.canvas.height,ae.sizeClipSpace.x/=se.canvas.width,ae.sizeClipSpace.y/=se.canvas.height,re.height=Math.max(re.height,ae.size.y),re.x+=ae.size.x,se.ctx.putImageData(De,ae.texturePosition.x-this._workBoundingBox.left,ae.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ae.size.x,ae.size.y),se.addGlyph(ae),se.version++,ae}_findGlyphBoundingBox(S,w,R,L,k,T){w.top=0;const F=L?this._config.deviceCellHeight:this._tmpCanvas.height,$=L?this._config.deviceCellWidth:R;let N=!1;for(let H=0;H<F;H++){for(let E=0;E<$;E++){const M=H*this._tmpCanvas.width*4+4*E+3;if(S.data[M]!==0){w.top=H,N=!0;break}}if(N)break}w.left=0,N=!1;for(let H=0;H<T+$;H++){for(let E=0;E<F;E++){const M=E*this._tmpCanvas.width*4+4*H+3;if(S.data[M]!==0){w.left=H,N=!0;break}}if(N)break}w.right=$,N=!1;for(let H=T+$-1;H>=T;H--){for(let E=0;E<F;E++){const M=E*this._tmpCanvas.width*4+4*H+3;if(S.data[M]!==0){w.right=H,N=!0;break}}if(N)break}w.bottom=F,N=!1;for(let H=F-1;H>=0;H--){for(let E=0;E<$;E++){const M=H*this._tmpCanvas.width*4+4*E+3;if(S.data[M]!==0){w.bottom=H,N=!0;break}}if(N)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:w.right-w.left+1,y:w.bottom-w.top+1},sizeClipSpace:{x:w.right-w.left+1,y:w.bottom-w.top+1},offset:{x:-w.left+T+(L||k?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-w.top+T+(L||k?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=u;class C{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(S){this._glyphs.push(S),this._usedPixels+=S.size.x*S.size.y}constructor(S,w,R){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],R)for(const L of R)this._glyphs.push(...L.glyphs),this._usedPixels+=L._usedPixels;this.canvas=b(S,w,w),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(f,S,w,R){const L=S.rgba>>>24,k=S.rgba>>>16&255,T=S.rgba>>>8&255,F=w.rgba>>>24,$=w.rgba>>>16&255,N=w.rgba>>>8&255,H=Math.floor((Math.abs(L-F)+Math.abs(k-$)+Math.abs(T-N))/12);let E=!0;for(let M=0;M<f.data.length;M+=4)f.data[M]===L&&f.data[M+1]===k&&f.data[M+2]===T||R&&Math.abs(f.data[M]-L)+Math.abs(f.data[M+1]-k)+Math.abs(f.data[M+2]-T)<H?f.data[M+3]=0:E=!1;return E}function b(f,S,w){const R=f.createElement("canvas");return R.width=S,R.height=w,R}},160:(A,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,s=0;var c,p,v,o,e;function r(n){const u=n.toString(16);return u.length<2?"0"+u:u}function i(n,u){return n<u?(u+.05)/(n+.05):(n+.05)/(u+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(n){n.toCss=function(u,C,g,b){return b!==void 0?`#${r(u)}${r(C)}${r(g)}${r(b)}`:`#${r(u)}${r(C)}${r(g)}`},n.toRgba=function(u,C,g,b=255){return(u<<24|C<<16|g<<8|b)>>>0},n.toColor=function(u,C,g,b){return{css:n.toCss(u,C,g,b),rgba:n.toRgba(u,C,g,b)}}}(c||(t.channels=c={})),function(n){function u(C,g){return s=Math.round(255*g),[a,h,l]=e.toChannels(C.rgba),{css:c.toCss(a,h,l,s),rgba:c.toRgba(a,h,l,s)}}n.blend=function(C,g){if(s=(255&g.rgba)/255,s===1)return{css:g.css,rgba:g.rgba};const b=g.rgba>>24&255,f=g.rgba>>16&255,S=g.rgba>>8&255,w=C.rgba>>24&255,R=C.rgba>>16&255,L=C.rgba>>8&255;return a=w+Math.round((b-w)*s),h=R+Math.round((f-R)*s),l=L+Math.round((S-L)*s),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},n.isOpaque=function(C){return(255&C.rgba)==255},n.ensureContrastRatio=function(C,g,b){const f=e.ensureContrastRatio(C.rgba,g.rgba,b);if(f)return c.toColor(f>>24&255,f>>16&255,f>>8&255)},n.opaque=function(C){const g=(255|C.rgba)>>>0;return[a,h,l]=e.toChannels(g),{css:c.toCss(a,h,l),rgba:g}},n.opacity=u,n.multiplyOpacity=function(C,g){return s=255&C.rgba,u(C,s*g/255)},n.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}}(p||(t.color=p={})),function(n){let u,C;try{const g=document.createElement("canvas");g.width=1,g.height=1;const b=g.getContext("2d",{willReadFrequently:!0});b&&(u=b,u.globalCompositeOperation="copy",C=u.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),l=parseInt(g.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(g.slice(1,2).repeat(2),16),h=parseInt(g.slice(2,3).repeat(2),16),l=parseInt(g.slice(3,4).repeat(2),16),s=parseInt(g.slice(4,5).repeat(2),16),c.toColor(a,h,l,s);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}const b=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(b)return a=parseInt(b[1]),h=parseInt(b[2]),l=parseInt(b[3]),s=Math.round(255*(b[5]===void 0?1:parseFloat(b[5]))),c.toColor(a,h,l,s);if(!u||!C)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=C,u.fillStyle=g,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,h,l,s]=u.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,s),css:g}}}(v||(t.css=v={})),function(n){function u(C,g,b){const f=C/255,S=g/255,w=b/255;return .2126*(f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4))+.7152*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}n.relativeLuminance=function(C){return u(C>>16&255,C>>8&255,255&C)},n.relativeLuminance2=u}(o||(t.rgb=o={})),function(n){function u(g,b,f){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,k=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));for(;F<f&&(L>0||k>0||T>0);)L-=Math.max(0,Math.ceil(.1*L)),k-=Math.max(0,Math.ceil(.1*k)),T-=Math.max(0,Math.ceil(.1*T)),F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));return(L<<24|k<<16|T<<8|255)>>>0}function C(g,b,f){const S=g>>24&255,w=g>>16&255,R=g>>8&255;let L=b>>24&255,k=b>>16&255,T=b>>8&255,F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));for(;F<f&&(L<255||k<255||T<255);)L=Math.min(255,L+Math.ceil(.1*(255-L))),k=Math.min(255,k+Math.ceil(.1*(255-k))),T=Math.min(255,T+Math.ceil(.1*(255-T))),F=i(o.relativeLuminance2(L,k,T),o.relativeLuminance2(S,w,R));return(L<<24|k<<16|T<<8|255)>>>0}n.blend=function(g,b){if(s=(255&b)/255,s===1)return b;const f=b>>24&255,S=b>>16&255,w=b>>8&255,R=g>>24&255,L=g>>16&255,k=g>>8&255;return a=R+Math.round((f-R)*s),h=L+Math.round((S-L)*s),l=k+Math.round((w-k)*s),c.toRgba(a,h,l)},n.ensureContrastRatio=function(g,b,f){const S=o.relativeLuminance(g>>8),w=o.relativeLuminance(b>>8);if(i(S,w)<f){if(w<S){const k=u(g,b,f),T=i(S,o.relativeLuminance(k>>8));if(T<f){const F=C(g,b,f);return T>i(S,o.relativeLuminance(F>>8))?k:F}return k}const R=C(g,b,f),L=i(S,o.relativeLuminance(R>>8));if(L<f){const k=u(g,b,f);return L>i(S,o.relativeLuminance(k>>8))?R:k}return R}},n.reduceLuminance=u,n.increaseLuminance=C,n.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},345:(A,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 s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,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:(A,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:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,s,c){this._data[l]||(this._data[l]={}),this._data[l][s]=c}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,s,c,p){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(s,c,p)}get(h,l,s,c){var p;return(p=this._data.get(h,l))==null?void 0:p.get(s,c)}clear(){this._data.clear()}}},399:(A,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:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(p){this._idleCallback=void 0;let v=0,o=0,e=p.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),r=p.timeRemaining(),1.5*o>r)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=r}this.clear()}}class s extends l{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const v=Date.now()+p;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},147:(A,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,c=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),s=a(147);class c extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(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 r=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-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:(A,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:(A,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 s="";for(let c=h;c<l;++c){let p=a[c];p>65535?(p-=65536,s+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):s+=String.fromCharCode(p)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let s=0,c=0;if(this._interim){const p=a.charCodeAt(c++);56320<=p&&p<=57343?h[s++]=1024*(this._interim-55296)+p-56320+65536:(h[s++]=this._interim,h[s++]=p),this._interim=0}for(let p=c;p<l;++p){const v=a.charCodeAt(p);if(55296<=v&&v<=56319){if(++p>=l)return this._interim=v,s;const o=a.charCodeAt(p);56320<=o&&o<=57343?h[s++]=1024*(v-55296)+o-56320+65536:(h[s++]=v,h[s++]=o)}else v!==65279&&(h[s++]=v)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let s,c,p,v,o=0,e=0,r=0;if(this.interim[0]){let u=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let g,b=0;for(;(g=63&this.interim[++b])&&b<4;)C<<=6,C|=g;const f=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=f-b;for(;r<S;){if(r>=l)return 0;if(g=a[r++],(192&g)!=128){r--,u=!0;break}this.interim[b++]=g,C<<=6,C|=63&g}u||(f===2?C<128?r--:h[o++]=C:f===3?C<2048||C>=55296&&C<=57343||C===65279||(h[o++]=C):C<65536||C>1114111||(h[o++]=C)),this.interim.fill(0)}const i=l-4;let n=r;for(;n<l;){for(;!(!(n<i)||128&(s=a[n])||128&(c=a[n+1])||128&(p=a[n+2])||128&(v=a[n+3]));)h[o++]=s,h[o++]=c,h[o++]=p,h[o++]=v,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(e=(31&s)<<6|63&c,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(p=a[n++],(192&p)!=128){n--;continue}if(e=(15&s)<<12|(63&c)<<6|63&p,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(p=a[n++],(192&p)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,this.interim[2]=p,o;if(v=a[n++],(192&v)!=128){n--;continue}if(e=(7&s)<<18|(63&c)<<12|(63&p)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(A,t,a){var h=this&&this.__decorate||function(e,r,i,n){var u,C=arguments.length,g=C<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(e,r,i,n);else for(var b=e.length-1;b>=0;b--)(u=e[b])&&(g=(C<3?u(g):C>3?u(r,i,g):u(r,i))||g);return C>3&&g&&Object.defineProperty(r,i,g),g},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(859),c=a(97),p={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let v,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),v=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(...u){if(v.logLevel!==c.LogLevelEnum.TRACE)return n.apply(this,u);v.trace(`GlyphRenderer#${n.name}(${u.map(g=>JSON.stringify(g)).join(", ")})`);const C=n.apply(this,u);return v.trace(`GlyphRenderer#${n.name} return`,C),C}}},726:(A,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 s=function(c,p,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(s,c,v)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},97:(A,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(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},y={};function x(A){var t=y[A];if(t!==void 0)return t.exports;var a=y[A]={exports:{}};return m[A].call(a.exports,a,a.exports,x),a.exports}var B={};return(()=>{var A=B;Object.defineProperty(A,"__esModule",{value:!0}),A.WebglAddon=void 0;const t=x(345),a=x(859),h=x(399),l=x(666),s=x(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,r=o.optionsService,i=o,n=i._renderService,u=i._characterJoinerService,C=i._charSizeService,g=i._coreBrowserService,b=i._decorationService,f=i._logService,S=i._themeService;(0,s.setTraceLogger)(f),this._renderer=this.register(new l.WebglRenderer(v,u,C,g,e,b,r,S,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const w=this._terminal._core._renderService;w.setRenderer(this._terminal._core._createRenderer()),w.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()}}A.WebglAddon=c})(),B})())})(es);var Cr=es.exports,ts={exports:{}};(function(d,_){(function(m,y){d.exports=y()})(vr,()=>(()=>{var m={433:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV11=void 0;const h=a(938),l=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],s=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],c=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],p=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let v;function o(e,r){let i,n=0,u=r.length-1;if(e<r[0][0]||e>r[u][1])return!1;for(;u>=n;)if(i=n+u>>1,e>r[i][1])n=i+1;else{if(!(e<r[i][0]))return!0;u=i-1}return!1}t.UnicodeV11=class{constructor(){if(this.version="11",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160);for(let e=0;e<l.length;++e)v.fill(0,l[e][0],l[e][1]+1);for(let e=0;e<c.length;++e)v.fill(2,c[e][0],c[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?v[e]:o(e,s)?0:o(e,p)?2:1}charProperties(e,r){let i=this.wcwidth(e),n=i===0&&r!==0;if(n){const u=h.UnicodeService.extractWidth(r);u===0?n=!1:u>i&&(i=u)}return h.UnicodeService.createPropertyValue(0,i,n)}}},345:(A,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 s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,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))}},490:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(938),l=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let p=0;p<l.length;++p)c.fill(0,l[p][0],l[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?c[p]:function(v,o){let e,r=0,i=o.length-1;if(v<o[0][0]||v>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,v>o[e][1])r=e+1;else{if(!(v<o[e][0]))return!0;i=e-1}return!1}(p,s)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,v){let o=this.wcwidth(p),e=o===0&&v!==0;if(e){const r=h.UnicodeService.extractWidth(v);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},938:(A,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(345),l=a(490);class s{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,v,o=!1){return(16777215&p)<<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 p=new l.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let v=0,o=0;const e=p.length;for(let r=0;r<e;++r){let i=p.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return v+this.wcwidth(i);const C=p.charCodeAt(r);56320<=C&&C<=57343?i=1024*(i-55296)+C-56320+65536:v+=this.wcwidth(C)}const n=this.charProperties(i,o);let u=s.extractWidth(n);s.extractShouldJoin(n)&&(u-=s.extractWidth(o)),v+=u,o=n}return v}charProperties(p,v){return this._activeProvider.charProperties(p,v)}}t.UnicodeService=s}},y={};function x(A){var t=y[A];if(t!==void 0)return t.exports;var a=y[A]={exports:{}};return m[A](a,a.exports,x),a.exports}var B={};return(()=>{var A=B;Object.defineProperty(A,"__esModule",{value:!0}),A.Unicode11Addon=void 0;const t=x(433);A.Unicode11Addon=class{activate(a){a.unicode.register(new t.UnicodeV11)}dispose(){}}})(),B})())})(ts);var br=ts.exports;const wr={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},yr=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],Ut=[0,95,135,175,215,255];function Ai(d,_){if(d<0)return _;if(d<16)return yr[d]??_;if(d<232){const m=d-16,y=Ut[Math.floor(m/36)%6],x=Ut[Math.floor(m/6)%6],B=Ut[m%6];return`rgb(${y},${x},${B})`}if(d<256){const m=8+(d-232)*10;return`rgb(${m},${m},${m})`}return`#${(d&16777215).toString(16).padStart(6,"0")}`}function Er(d,_){let m=!1,y=!1,x=!1;const B=()=>{x||(x=!0,setTimeout(A,0))},A=()=>{if(x=!1,!m){if(y){y=!1,B();return}d.value!==""&&(d.value="")}},t=()=>{y=!0};d.addEventListener("keydown",t),d.addEventListener("input",t),d.addEventListener("compositionstart",()=>{m=!0}),d.addEventListener("compositionend",()=>{m=!1,y=!0,B()}),_(B)}const Di="\x1Bc",Lr=/Mac|iPhone|iPad/.test(navigator.platform);class xr{constructor(_){ee(this,"term");ee(this,"fit",new Sr.FitAddon);ee(this,"onInput",null);ee(this,"shouldSendKey",null);ee(this,"onSelect",null);ee(this,"webglLosses",0);this.term=new mr.Terminal({theme:wr,fontFamily:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!0,macOptionClickForcesSelection:!0,scrollback:5e3}),this.term.loadAddon(this.fit),this.term.loadAddon(new br.Unicode11Addon),this.term.unicode.activeVersion="11",this.term.open(_),this.loadWebgl(),this.term.onData(m=>{var y;return(y=this.onInput)==null?void 0:y.call(this,m)}),this.term.textarea&&Er(this.term.textarea,m=>this.term.onData(m)),this.term.attachCustomKeyEventHandler(m=>{var y,x;return((y=this.shouldSendKey)==null?void 0:y.call(this,m))===!1||m.type==="keydown"&&Xs(m,Lr)?!1:m.type==="keydown"&&Gs(m)?(m.preventDefault(),(x=this.onInput)==null||x.call(this,Vs),!1):!0}),this.bindTouchScroll(_),this.bindCopyOnSelect(_),this.fitNow()}loadWebgl(){let _;try{_=new Cr.WebglAddon,this.term.loadAddon(_)}catch{return}_.onContextLoss(()=>{_.dispose(),++this.webglLosses<3&&this.loadWebgl(),this.term.refresh(0,this.term.rows-1)})}bindTouchScroll(_){let m=0,y=0;_.addEventListener("touchstart",x=>{x.touches.length===1&&(m=x.touches[0].clientY,y=0)},{capture:!0,passive:!0}),_.addEventListener("touchmove",x=>{if(x.touches.length!==1||!this.wantsWheel())return;x.preventDefault(),x.stopPropagation();const B=x.touches[0];y+=(m-B.clientY)/this.rowHeight(),m=B.clientY;const A=Math.trunc(y);if(A===0)return;y-=A;const t=_.querySelector(".xterm-screen");if(!t)return;const a={deltaY:Math.sign(A),deltaMode:WheelEvent.DOM_DELTA_LINE,clientX:B.clientX,clientY:B.clientY,bubbles:!0,cancelable:!0};for(let h=0;h<Math.abs(A);h++)t.dispatchEvent(new WheelEvent("wheel",a))},{capture:!0,passive:!1})}bindCopyOnSelect(_){_.addEventListener("mouseup",()=>{queueMicrotask(()=>{var y;const m=this.term.getSelection();m&&((y=this.onSelect)==null||y.call(this,m))})})}wantsWheel(){return this.term.modes.mouseTrackingMode!=="none"||this.term.buffer.active.type==="alternate"}rowHeight(){var y;const _=(y=this.term.element)==null?void 0:y.querySelector(".xterm-screen"),m=_&&this.term.rows>0?_.clientHeight/this.term.rows:0;return m>0?m:16}replay(_){this.term.write(Di+_)}write(_){this.term.write(_)}paste(_){this.term.paste(_)}clear(){this.term.write(Di)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}proposed(){try{const _=this.fit.proposeDimensions();return _&&_.cols>0&&_.rows>0?{cols:_.cols,rows:_.rows}:null}catch{return null}}adopt(_,m){_<1||m<1||_===this.term.cols&&m===this.term.rows||this.term.resize(_,m)}}function kr(d){const _=[];let m=0,y=0,x=!1;for(const B of d.split(`
|
|
81
|
+
`)){const A=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(B);if(A){m=Number(A[1]),y=Number(A[2]),x=!0,_.push({kind:"hunk",text:B});continue}x&&(B.startsWith("+")?_.push({kind:"add",old:null,new:y++,text:B.slice(1)}):B.startsWith("-")?_.push({kind:"del",old:m++,new:null,text:B.slice(1)}):B.startsWith(" ")&&_.push({kind:"ctx",old:m++,new:y++,text:B.slice(1)}))}return _}const is=240;function Rr(d,_){return Math.round(Math.max(is,Math.min(d,_*.75)))}const Ar=2e3,ss="tring.diffPanel",Mi=420;function we(d,_){const m=document.createElement("div");return m.className=d,_!==void 0&&(m.textContent=_),m}function Pe(d,_){const m=document.createElement("span");return m.className=d,m.textContent=_,m}function Dr(){try{const d=JSON.parse(localStorage.getItem(ss)??"{}");return{width:typeof d.width=="number"?d.width:Mi,open:d.open===!0}}catch{return{width:Mi,open:!1}}}class Mr{constructor(_,m){ee(this,"el",we("diff-panel"));ee(this,"handle",we("diff-handle"));ee(this,"title",Pe("diff-title",""));ee(this,"plus",Pe("diff-plus",""));ee(this,"minus",Pe("diff-minus",""));ee(this,"scroll",we("diff-scroll"));ee(this,"sessionId",null);ee(this,"timer",null);ee(this,"inflight",!1);ee(this,"last","");ee(this,"width");ee(this,"opened");this.cell=_,this.onLayout=m;const y=we("diff-head"),x=document.createElement("button");x.type="button",x.className="diff-close",x.textContent="✕",x.title="Close diff viewer",x.onclick=()=>this.close(),y.append(this.title,this.plus,this.minus,x),this.el.append(y,this.scroll),_.append(this.handle,this.el);const B=Dr();this.width=Math.max(is,B.width),this.opened=B.open,this.bindResize(),this.paint(),this.opened&&this.startPolling()}get isOpen(){return this.opened}open(){this.opened||(this.opened=!0,this.paint(),this.save(),this.onLayout(),this.startPolling())}close(){this.opened&&(this.opened=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.paint(),this.save(),this.onLayout())}toggle(){this.opened?this.close():this.open()}setSession(_){_!==this.sessionId&&(this.sessionId=_,this.last="",this.note(_?"loading…":"no session"),this.opened&&this.tick())}paint(){this.el.hidden=!this.opened,this.handle.hidden=!this.opened,this.el.style.width=`${this.width}px`}save(){try{localStorage.setItem(ss,JSON.stringify({width:this.width,open:this.opened}))}catch{}}startPolling(){this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>void this.tick(),Ar),this.tick()}async tick(){const _=this.sessionId;if(!(!_||this.inflight||!this.opened)){this.inflight=!0;try{const m=await Ot(`/api/sessions/${encodeURIComponent(_)}/diff`);if(_!==this.sessionId||!this.opened)return;const y=JSON.stringify(m);if(y===this.last)return;this.last=y,this.render(m)}catch(m){if(_!==this.sessionId)return;this.last="",this.note(m.message)}finally{this.inflight=!1}}}note(_){this.title.textContent="",this.plus.textContent="",this.minus.textContent="",this.scroll.replaceChildren(we("diff-note",_))}render(_){if("error"in _)return this.note(_.error);const{files:m}=_;let y=0,x=0;for(const a of m)y+=a.added,x+=a.removed;if(this.title.textContent=`${m.length} file${m.length===1?"":"s"} changed`,this.plus.textContent=`+${y}`,this.minus.textContent=`-${x}`,m.length===0){this.scroll.replaceChildren(we("diff-note","no uncommitted changes"));return}const B=we("diff-files"),A=we("diff-body");for(const a of m){const h=this.fileSection(a),l=document.createElement("button");l.type="button",l.className="diff-file-row",l.append(Pe("path",a.path),Pe("diff-plus",`+${a.added}`),Pe("diff-minus",`-${a.removed}`)),l.onclick=()=>h.scrollIntoView({block:"start"}),B.append(l),A.append(h)}_.truncated&&B.append(we("diff-note","some diffs are over the 1 MB limit and not shown"));const t=this.scroll.scrollTop;this.scroll.replaceChildren(B,A),this.scroll.scrollTop=t}fileSection(_){const m=we("diff-file");if(m.append(we("diff-file-head",_.path)),_.note)return m.append(we("diff-note",_.note)),m;for(const y of kr(_.patch)){if(y.kind==="hunk"){m.append(we("dl dl-hunk",y.text));continue}const x=we(`dl dl-${y.kind}`);x.append(Pe("ln",y.old===null?"":String(y.old)),Pe("ln",y.new===null?"":String(y.new)),Pe("tx",y.text)),m.append(x)}return m}bindResize(){let _=0;this.handle.addEventListener("pointerdown",y=>{y.preventDefault(),_=this.el.getBoundingClientRect().right,this.handle.setPointerCapture(y.pointerId),this.handle.classList.add("dragging")}),this.handle.addEventListener("pointermove",y=>{this.handle.hasPointerCapture(y.pointerId)&&(this.width=Rr(_-y.clientX,this.cell.clientWidth),this.el.style.width=`${this.width}px`)});const m=y=>{this.handle.hasPointerCapture(y.pointerId)&&(this.handle.releasePointerCapture(y.pointerId),this.handle.classList.remove("dragging"),this.save(),this.onLayout())};this.handle.addEventListener("pointerup",m),this.handle.addEventListener("pointercancel",m)}}function Tr(d,_){if(!d)return null;const m=_.find(x=>x.id===d.id);if(m)return m.slot===d.slot?d:{id:m.id,slot:m.slot};const y=_.find(x=>x.slot===d.slot);return y?{id:y.id,slot:y.slot}:null}const rs=/^image\/(png|jpeg|gif|webp)$/;function Br(d){return/\s/.test(d)?`"${d}"`:d}function Ir(d){for(const _ of["dragover","drop"])d.addEventListener(_,m=>m.preventDefault())}function Pr(d,_){let m=0;const y=B=>{d.classList.toggle("dropping",B)},x=B=>{var A;return Array.from(((A=B.dataTransfer)==null?void 0:A.types)??[]).includes("Files")};d.addEventListener("dragenter",B=>{x(B)&&(B.preventDefault(),m++,y(!0))}),d.addEventListener("dragover",B=>{x(B)&&(B.preventDefault(),B.dataTransfer&&(B.dataTransfer.dropEffect="copy"))}),d.addEventListener("dragleave",()=>{m=Math.max(0,m-1),m===0&&y(!1)}),d.addEventListener("drop",B=>{var A;x(B)&&(B.preventDefault(),m=0,y(!1),Fr(Array.from(((A=B.dataTransfer)==null?void 0:A.files)??[]),_))})}function Or(d){const _=document.createElement("input");return _.type="file",_.multiple=!0,_.hidden=!0,_.addEventListener("change",()=>{const m=Array.from(_.files??[]);_.value="",m.length>0&&d(m)}),document.body.append(_),()=>_.click()}async function Fr(d,_){if(d.length===0)return _.onError("nothing to drop");await bt(d,_)}async function bt(d,_){if(!_.ready()){_.onError("focus a session first — the file goes into its prompt");return}const m=[];for(const y of d)try{m.push(Br(await _.upload(y)))}catch(x){_.onError(x.message);break}m.length>0&&_.insert(m.join(" ")+" ")}function Hr(d){const _=d,m=_.SpeechRecognition??_.webkitSpeechRecognition;return m?()=>new m:null}function zt(d,_){return d?_?_.toLowerCase().startsWith(d.toLowerCase())?_:`${d} ${_}`:d:_}function $r(d){var y;let _="",m="";for(const x of Array.from(d)){const B=((y=x[0])==null?void 0:y.transcript.trim())??"";x.isFinal?_=zt(_,B):m=zt(m,B)}return zt(_,m)}function Nr(d){switch(d){case"aborted":return null;case"no-speech":return"no speech heard — tap the mic and talk";case"not-allowed":return"the microphone was refused — voice input needs https and microphone permission";case"service-not-allowed":return"speech recognition is turned off on this device";case"audio-capture":return"no microphone available";case"network":return"speech recognition needs a network connection";case"language-not-supported":return"speech recognition does not support this language";default:return`speech recognition failed (${d})`}}class Wr{constructor(_,m,y){ee(this,"rec",null);this.make=_,this.cb=m,this.lang=y}get listening(){return this.rec!==null}toggle(){this.rec?this.rec.stop():this.start()}cancel(){const _=this.rec;_&&(this.rec=null,_.abort(),this.cb.onListening(!1))}start(){const _=this.make();_.lang=this.lang,_.continuous=!0,_.interimResults=!0;let m="";_.addEventListener("result",y=>{m=$r(y.results),this.cb.onHeard(m)}),_.addEventListener("error",y=>{const x=Nr(y.error);x&&this.cb.onError(x)}),_.addEventListener("end",()=>{this.rec===_&&(this.rec=null,this.cb.onListening(!1),m&&this.cb.onText(m))});try{_.start()}catch(y){this.cb.onError(`speech recognition failed (${y.message})`);return}this.rec=_,this.cb.onListening(!0),this.cb.onHeard("")}}const Ur=6;function zr(d,_){let m=null,y=null;const x=h=>Number(h.dataset.slot),B=(h,l)=>{var c;const s=((c=document.elementFromPoint(h,l))==null?void 0:c.closest(".tile[data-slot]"))??null;return s&&d.contains(s)?s:null},A=h=>{h!==y&&(y==null||y.classList.remove("drop-target"),y=h,y==null||y.classList.add("drop-target"))},t=()=>{m==null||m.from.classList.remove("dragging"),document.body.classList.remove("tile-dragging"),A(null),m=null},a=()=>{const h=l=>{l.stopPropagation(),l.preventDefault()};window.addEventListener("click",h,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",h,{capture:!0}),0)};d.addEventListener("pointerdown",h=>{if(h.button!==0||!(h.target instanceof Element)||h.target.closest(".tile-action"))return;const l=h.target.closest(".tile[data-slot]");if(!l)return;const s=_.sessionAt(x(l));s&&(m={id:s,from:l,pointer:h.pointerId,x:h.clientX,y:h.clientY,active:!1})}),window.addEventListener("pointermove",h=>{if(!m||h.pointerId!==m.pointer)return;if(!m.active){if(Math.hypot(h.clientX-m.x,h.clientY-m.y)<Ur)return;m.active=!0,m.from.classList.add("dragging"),document.body.classList.add("tile-dragging")}const l=B(h.clientX,h.clientY);A(l&&l!==m.from?l:null)}),window.addEventListener("pointerup",h=>{if(!m||h.pointerId!==m.pointer)return;const{id:l,active:s}=m,c=y;t(),s&&(a(),c&&_.onMove(l,x(c)))}),window.addEventListener("pointercancel",t),window.addEventListener("keydown",h=>{h.key!=="Escape"||!(m!=null&&m.active)||(h.stopPropagation(),h.preventDefault(),t())},{capture:!0})}function ns(d){return Array.from(d??[]).filter(_=>rs.test(_.type))}function jr(d,_){d.addEventListener("paste",m=>{var x;const y=ns((x=m.clipboardData)==null?void 0:x.files);y.length!==0&&(m.preventDefault(),m.stopPropagation(),bt(y,_))},{capture:!0})}async function qr(d){const _=[];let m="";for(const y of d){const x=y.types.find(B=>rs.test(B));x?_.push(await y.getType(x)):y.types.includes("text/plain")&&(m+=await(await y.getType("text/plain")).text())}return{images:_,text:m}}async function Kr(d){if(!d.ready()){d.onError("focus a session first — the paste goes into its prompt");return}let _;try{_=await navigator.clipboard.read()}catch{d.fallback();return}const{images:m,text:y}=await qr(_);m.length>0?await bt(m,d):y?d.insert(y):d.onError("nothing on the clipboard to paste")}function os(d,_,m){var t,a;let y=Math.max(0,_);for(;y>0&&((t=d.getLine(y))!=null&&t.isWrapped);)y--;let x=Math.min(d.length,m);for(;x<d.length&&((a=d.getLine(x))!=null&&a.isWrapped);)x++;const B=[];let A=null;for(let h=y;h<x;h++){const l=d.getLine(h);if(!l)continue;const s=l.translateToString(!1);l.isWrapped&&A!==null?A+=s:(A!==null&&B.push(A.trimEnd()),A=s)}return A!==null&&B.push(A.trimEnd()),B}function Vr(d,_){const m=os(d,d.viewportY,d.viewportY+_);for(;m.length>0&&m[m.length-1]==="";)m.pop();return m.join(`
|
|
82
|
+
`)}const Gr=/https?:\/\/[^\s<>"'`]+/g,Xr=/[.,;:!?)\]}'"]+$/;function Yr(d){const _=new Set;for(const m of d.match(Gr)??[]){const y=m.replace(Xr,"");y.length>8&&_.add(y)}return[..._]}const Jr=300;function Zr(d,_=Jr){const m=os(d,d.length-_,d.length);return Yr(m.reverse().join(`
|
|
83
|
+
`))}async function as(d){var y;try{if((y=navigator.clipboard)!=null&&y.writeText)return await navigator.clipboard.writeText(d),!0}catch{}const _=document.createElement("textarea");_.value=d,_.setAttribute("readonly",""),_.style.position="fixed",_.style.opacity="0",document.body.append(_),_.select();let m=!1;try{m=document.execCommand("copy")}catch{m=!1}return _.remove(),m}const Ti="#071411",Qr="#dceee7";class en{constructor(_){ee(this,"ctx");ee(this,"last",null);this.canvas=_,this.ctx=_.getContext("2d",{alpha:!1})}paint(_=this.last){if(!this.ctx||!_)return;this.last=_;const m=window.devicePixelRatio||1,y=this.canvas.clientWidth,x=this.canvas.clientHeight;if(y===0||x===0)return;(this.canvas.width!==Math.round(y*m)||this.canvas.height!==Math.round(x*m))&&(this.canvas.width=Math.round(y*m),this.canvas.height=Math.round(x*m));const B=this.ctx;B.setTransform(m,0,0,m,0,0),B.fillStyle=Ti,B.fillRect(0,0,y,x);const A=y/Math.max(_.cols,1),t=Math.max(A/.6,1),a=x/Math.max(_.rows.length,1);B.textBaseline="top",B.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<_.rows.length;h++){const l=_.rows[h];if(!l)continue;let s=0;for(const c of l){const p=c.text.length*A;c.bg>=0&&(B.fillStyle=Ai(c.bg,Ti),B.fillRect(s,h*a,p,a)),c.text.trim()!==""&&(B.fillStyle=Ai(c.fg,Qr),B.fillText(c.text,s,h*a)),s+=p}}}refresh(){this.last&&this.paint(this.last)}}const pt=[4,8,12,16],Bi=16;function hs(d){return d<12?tn(d/2):sn(d/4+1)}function tn(d){const _=new Map;for(let m=1;m<=d;m++)_.set(m,{row:1,col:m});for(let m=0;m<d;m++)_.set(d+1+m,{row:3,col:d-m});return{cols:d,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${d+1}`,cells:_}}function sn(d){const _=[];for(let m=1;m<=d;m++)_.push({row:1,col:m});for(let m=2;m<=d-1;m++)_.push({row:m,col:d});for(let m=d;m>=1;m--)_.push({row:d,col:m});for(let m=d-1;m>=2;m--)_.push({row:m,col:1});return{cols:d,rows:d,rowTemplate:`repeat(${d}, 1fr)`,focus:`2 / 2 / ${d} / ${d}`,cells:new Map(_.map((m,y)=>[y+1,m]))}}const ls="tring.ring";let cs=rn();function rn(){try{const d=Number(localStorage.getItem(ls));return nn(d)?d:Bi}catch{return Bi}}function nn(d){return pt.includes(d)}function vt(){return cs}function on(d){cs=d;try{localStorage.setItem(ls,String(d))}catch{}}function an(d,_,m){const y=hs(m);d.style.gridTemplateColumns=`repeat(${y.cols}, 1fr)`,d.style.gridTemplateRows=y.rowTemplate,_.style.gridArea=y.focus}function hn(d,_,m){const y=hs(m).cells.get(_);y&&(d.style.gridRow=String(y.row),d.style.gridColumn=String(y.col))}const ds="tring.sound";let kt=null,hi=ln();function ln(){try{return localStorage.getItem(ds)!=="off"}catch{return!0}}function dt(){return hi}function cn(d){hi=d;try{localStorage.setItem(ds,d?"on":"off")}catch{}d&&li()}async function li(){try{return kt??(kt=new AudioContext),kt.state==="suspended"&&await kt.resume(),kt}catch{return null}}document.addEventListener("pointerdown",()=>void li(),{once:!0});function Ii(d,_,m,y,x){const B=d.createOscillator(),A=d.createGain();B.type="sine",B.frequency.setValueAtTime(m,_),A.gain.setValueAtTime(0,_),A.gain.linearRampToValueAtTime(y,_+.004),A.gain.exponentialRampToValueAtTime(1e-4,_+x),B.connect(A).connect(d.destination),B.start(_),B.stop(_+x)}function Pi(){hi&&li().then(d=>{if(!d)return;const _=d.currentTime;for(const m of[0,.085])Ii(d,_+m,1568,.13,.55),Ii(d,_+m,2349,.05,.4)})}const us="tring.usage",_s="tring.usage.view",fs=(d,_)=>{try{const m=localStorage.getItem(d);return m===null?_:JSON.parse(m)}catch{return _}},ps=(d,_)=>{try{localStorage.setItem(d,JSON.stringify(_))}catch{}};let ci=fs(us,!1);const Jt=()=>ci;function dn(d){ci=d,ps(us,d)}const un=()=>ci&&fs(_s,!1),gs=d=>ps(_s,d),_n=()=>Ot("/api/usage");function ut(d){return d>=1e9?`${(d/1e9).toFixed(1)}B`:d>=1e6?`${(d/1e6).toFixed(1)}M`:d>=1e3?`${Math.round(d/1e3)}k`:String(d)}const Oi=d=>`$${d.toFixed(2)}`,Fi=d=>new Date(d).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function le(d,_,m){const y=document.createElement(d);return _&&(y.className=_),m!==void 0&&(y.textContent=m),y}function vs(d,_,m=!0){const y=Math.min(100,d/_*100),x=le("div","meter"),B=le("i");return B.style.width=`${y}%`,m&&(y>=90?B.classList.add("hot"):y>=75&&B.classList.add("warm")),x.append(B),x.setAttribute("role","progressbar"),x.setAttribute("aria-valuenow",String(Math.round(y))),x}function Zt(d,_,m){d.replaceChildren();const y=le("div","usage");if(m){y.append(le("h2",void 0,"Claude usage")),y.append(le("p","hint",m)),d.append(y);return}if(!_){y.append(le("p","hint","asking Claude Code…")),d.append(y);return}if(_.limits.length>0){for(const A of _.limits)y.append(fn(A));y.append(le("p","source","from Claude Code’s own /usage"))}else{const A=_.window;y.append(Hi("5-hour window",`${ut(A.tokens)} tokens`,A.resetsAt?`resets ${Fi(A.resetsAt)}`:"nothing running")),y.append(Hi("This week",`${ut(_.week.tokens)} tokens`,"rolling 7 days")),y.append(le("p","source",`${_.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const x=le("div","utotals"),B=(A,t)=>{const a=le("div","ucell");return a.append(le("b",void 0,t),le("span",void 0,A)),a};if(x.append(B("tokens today",ut(_.today.tokens))),x.append(B("today, est.",Oi(_.today.cost))),x.append(B("this week, est.",Oi(_.week.cost))),x.append(B("cache reads, 7d",ut(_.week.cacheReadTokens))),y.append(x),_.projects.length>0){y.append(le("h3",void 0,"By project, last 7 days"));const A=_.projects[0].tokens,t=le("div","uprojects");for(const a of _.projects.slice(0,8)){const h=le("div","uproject");h.append(le("span","nm",a.name)),h.append(vs(a.tokens,A,!1)),h.append(le("span","tag",ut(a.tokens))),t.append(h)}y.append(t)}y.append(le("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${Fi(_.scannedAt)}.`)),d.append(y)}function fn(d){const _=le("div","urow"),m=le("div","uhead");if(m.append(le("span","ulabel",d.label)),m.append(le("span","upct",`${d.percent}%`)),_.append(m),_.append(vs(d.percent,100)),d.resets){const y=le("div","ufoot");y.append(le("span","unote",`resets ${d.resets}`)),_.append(y)}return _}function Hi(d,_,m){const y=le("div","urow"),x=le("div","uhead");x.append(le("span","ulabel",d)),x.append(le("span","upct",_)),y.append(x);const B=le("div","ufoot");return B.append(le("span","unote",m)),y.append(B),y}function pn(d,_,m,y,x,B=!1,A={open:!1,count:0}){d.replaceChildren();const t=document.createElement("div");t.className="logo",t.title="tring";for(let s=0;s<9;s++)t.append(document.createElement("i"));d.append(t);for(const s of _){const c=s.sessions.filter(o=>o.status==="done").length,p=document.createElement("button");p.className="tab"+(!B&&s.id===m?" active":""),p.title=s.root;const v=document.createElement("span");if(v.className="nm",v.textContent=s.name,p.append(v),c>0){const o=document.createElement("span");o.className="badge",o.textContent=String(c),p.append(o)}p.onclick=()=>y.onSelect(s.id),p.oncontextmenu=o=>{o.preventDefault(),y.onContext(s.id,{x:o.clientX,y:o.clientY})},d.append(p)}if(Jt()){const s=document.createElement("button");s.className="tab pinned"+(B?" active":""),s.title="Claude usage";const c=document.createElement("span");c.className="nm",c.textContent="Usage",s.append(c),s.onclick=()=>y.onUsage(),d.append(s)}{const s=document.createElement("button");s.className="tab pinned"+(A.open?" active":""),s.title="Orchestrator — every agent waiting on you (Ctrl+Space, o)";const c=document.createElement("span");if(c.className="nm",c.textContent="Orchestrator",s.append(c),A.count>0){const p=document.createElement("span");p.className="badge asking",p.textContent=String(A.count),s.append(p)}s.onclick=()=>y.onInbox(),d.append(s)}const a=document.createElement("button");a.className="add",a.textContent="+",a.title="New project",a.onclick=()=>y.onAdd(),d.append(a);const h=document.createElement("button");h.className="iconbtn"+(dt()?" on":""),h.innerHTML=vn(dt()),h.title=dt()?"Sound on — click to mute":"Sound off — click to unmute",h.setAttribute("aria-label",h.title),h.setAttribute("aria-pressed",String(dt())),h.onclick=()=>{cn(!dt()),y.onSoundToggle()},h.style.marginLeft=x?"0":"auto",d.append(h);const l=document.createElement("button");if(l.className="iconbtn",l.innerHTML=gn(),l.title="Settings",l.setAttribute("aria-label",l.title),l.onclick=()=>y.onSettings(),d.append(l),x){const s=document.createElement("button");s.className="update",s.textContent=`v${x.latest} available`,s.title=`You are on ${x.current}`,s.onclick=()=>y.onUpdate(x),d.insertBefore(s,h)}}function gn(){return ms('<path d="M6.09 3.71 L6.43 1.18 L9.57 1.18 L9.91 3.71 L10.76 4.2 L13.12 3.23 L14.69 5.95 L12.67 7.51 L12.67 8.49 L14.69 10.05 L13.12 12.77 L10.76 11.8 L9.91 12.29 L9.57 14.82 L6.43 14.82 L6.09 12.29 L5.24 11.8 L2.88 12.77 L1.31 10.05 L3.33 8.49 L3.33 7.51 L1.31 5.95 L2.88 3.23 L5.24 4.2 Z"/><circle cx="8" cy="8" r="2.4"/>')}function ms(d){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${d}</svg>`}function vn(d){return ms(`<path d="M8 2a3 3 0 0 1 3 3v3l1.4 2.1a.5.5 0 0 1-.4.8H4a.5.5 0 0 1-.4-.8L5 8V5a3 3 0 0 1 3-3z"/><path d="M6.6 12.6a1.5 1.5 0 0 0 2.8 0"/>${d?"":'<path d="M2.5 2.5l11 11"/>'}`)}const Ss="(max-width: 720px)";function mn(d){return d?{key:String(d.slot),name:d.name??d.title??"shell",status:d.status}:{key:"—",name:"pick a session",status:"idle"}}function Sn(d,_,m){const{done:y,listening:x}=_,B=_.override??mn(_.focused),A=_.focused!==null||!!_.override,t=$i("nav"),a=document.createElement("button");a.className=`current st-${B.status}`,a.title="Switch session",a.setAttribute("aria-haspopup","dialog");const h=ft("key",B.key),l=ft("nm",B.name),s=ft("tag",A?B.status:"");a.append(h,l,s,Cn()),a.onclick=()=>m.onOpen(),t.append(a);const c=document.createElement("button");if(c.className="next",c.disabled=y===0,c.title=y>0?`Next finished session (${y})`:"No finished sessions",c.setAttribute("aria-label",c.title),c.innerHTML=Ge('<path d="M5 3l6 5-6 5"/>'),y>0&&c.append(ft("badge",String(y))),c.onclick=()=>m.onNext(),t.append(c),m.onInbox){const i=m.onInbox,n=_.inbox??{open:!1,count:0},u=document.createElement("button");u.className="inbox-btn"+(n.open?" on":""),u.title=n.open?"Leave orchestrator mode":`Orchestrator${n.count?` (${n.count} waiting)`:""}`,u.setAttribute("aria-label",u.title),u.setAttribute("aria-pressed",String(n.open)),u.innerHTML=Ge('<path d="M2 9.5l1.6-5.2a1 1 0 0 1 1-.7h6.8a1 1 0 0 1 1 .7L14 9.5V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z"/><path d="M2 9.5h3.5l1 1.5h3l1-1.5H14"/>'),n.count>0&&u.append(ft("badge asking",String(n.count))),u.onclick=()=>i(),t.append(u)}const p=$i("tools"),v=_t("esc","Escape",A?"Send Escape":"Focus a session to send Escape",!A);v.textContent="Esc",Ni(v),v.onclick=()=>m.onEsc(),p.append(v);const o=_t("paste","Paste",A?"Paste from the clipboard":"Focus a session to paste",!A);o.innerHTML=Ge('<rect x="4" y="3" width="8" height="11" rx="1.5"/><path d="M6 3V2h4v1M6.5 7h3M6.5 10h3"/>'),o.onclick=()=>m.onPaste(),p.append(o);const e=_t("attach","Attach",A?"Attach a photo or file":"Focus a session to attach a file",!A);if(e.innerHTML=Ge('<path d="M13 7.5l-5.3 5.3a3.2 3.2 0 0 1-4.5-4.5L8.8 2.7a2.1 2.1 0 0 1 3 3L6.3 11.2a1 1 0 0 1-1.5-1.5L9.5 5"/>'),e.onclick=()=>m.onAttach(),p.append(e),m.onMic){const i=m.onMic,n=_t("mic",x?"Stop listening":"Talk",x?"Stop listening and insert the words":A?"Talk: what you say is typed into the prompt":"Focus a session to talk",!A&&!x);n.classList.toggle("listening",x),n.setAttribute("aria-pressed",String(x)),n.innerHTML=Ge('<rect x="5.5" y="1.5" width="5" height="8" rx="2.5"/><path d="M3 7.5a5 5 0 0 0 10 0M8 12.5V15"/>'),Ni(n),n.onclick=()=>i(),p.append(n)}const r=_t("copy","Copy",A?"Copy text off the screen":"Focus a session to copy",!A);r.innerHTML=Ge('<rect x="6" y="6" width="8" height="8" rx="1.5"/><path d="M4 10H3.5A1.5 1.5 0 0 1 2 8.5v-5A1.5 1.5 0 0 1 3.5 2h5A1.5 1.5 0 0 1 10 3.5V4"/>'),r.onclick=()=>m.onCopy(),p.append(r),d.replaceChildren(t,p)}function $i(d){const _=document.createElement("div");return _.className=`row ${d}`,_}function _t(d,_,m,y){const x=document.createElement("button");return x.className=d,x.disabled=y,x.title=m,x.setAttribute("aria-label",_),x}function Ni(d){d.onmousedown=_=>_.preventDefault()}function ft(d,_){const m=document.createElement("span");return m.className=d,m.textContent=_,m}function Cn(){const d=document.createElement("span");return d.className="chev",d.innerHTML=Ge('<path d="M4 6l4 4 4-4"/>'),d}function Ge(d){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${d}</svg>`}const We=document.getElementById("overlay");let Qt=null;function wt(){return!We.hidden}function ne(){We.hidden=!0,We.replaceChildren();const d=Qt;Qt=null,d==null||d()}function Te(d,_={}){var m;Qt=_.onClosed??null,We.replaceChildren(d),We.hidden=!1,_.dismissible!==!1?We.onclick=y=>{y.target===We&&ne()}:We.onclick=null,(m=d.querySelector("input, button"))==null||m.focus()}function j(d,_,m){const y=document.createElement(d);return _&&(y.className=_),m!==void 0&&(y.textContent=m),y}function Cs(d){const _=j("div","browser"),m=j("div","crumb"),y=j("div","dirlist");_.append(m,y);let x=!1;async function B(A){if(!x){x=!0,y.replaceChildren(j("div","dirnote","loading…"));try{const t=A?`?path=${encodeURIComponent(A)}`:"",a=await Ot(`/api/fs${t}`);if(d.value=a.path,m.replaceChildren(),a.parent){const h=j("button","up","↑ "+a.parent);h.type="button",h.onclick=()=>void B(a.parent),m.append(h)}else m.append(j("span","dirnote",a.path));y.replaceChildren(),a.entries.length===0&&y.append(j("div","dirnote","no subdirectories"));for(const h of a.entries){const l=j("button",void 0,h.name);l.type="button",l.onclick=()=>void B(h.path),y.append(l)}}catch(t){y.replaceChildren(j("div","dirnote",t.message))}finally{x=!1}}}return d.addEventListener("change",()=>void B(d.value.trim()||void 0)),B(d.value.trim()||void 0),_}function bn(d,_,m,y){const x=j("div","panel picker");x.append(j("h2",void 0,d?d.name:"No project")),x.append(j("p","hint",`${m} session${m===1?"":"s"} finished across all projects`));const B=j("div","rows"),A=new Map;for(const c of(d==null?void 0:d.sessions)??[])A.set(c.slot,c);const t=window.matchMedia(Ss).matches;for(let c=1;c<=vt();c++){const p=A.get(c),v=j("button",`row st-${(p==null?void 0:p.status)??"idle"}`);(p==null?void 0:p.status)==="busy"&&v.classList.add("dim"),p||v.classList.add("dim"),v.append(j("span","key",t?String(c):ai(c))),v.append(j("span","nm",p?p.name??p.title??p.cwd.split("/").pop()??"shell":"— empty")),p&&v.append(j("span","tag",p.status)),v.onclick=()=>{ne(),y.onPickSlot(c)},B.append(v)}x.append(B);const a=j("div","picker-actions"),h=j("button","btn","Next finished");h.type="button",h.disabled=m===0,h.onclick=()=>{ne(),y.onNextDone()};const l=j("button","btn","New session");l.type="button",l.onclick=()=>{ne(),y.onNewSession()},a.append(h,l),x.append(a);const s=j("div","legend");s.innerHTML="<b>n</b> next finished <b>p</b> projects <b>c</b> new session <b>r</b> rename <b>x</b> kill <b>m</b> mark seen <b>o</b> orchestrator <b>esc</b> close",x.append(s),Te(x),x.dataset.projects=String(_.length)}function wn(d,_){const m=j("div","panel");m.append(j("h2",void 0,"Projects")),m.append(j("p","hint",`Each project owns its own ${vt()} slots.`));const y=j("div","rows");d.forEach((x,B)=>{const A=x.sessions.filter(a=>a.status==="done").length,t=j("button","row st-done");t.append(j("span","key",B<9?String(B+1):"—")),t.append(j("span","nm",x.name)),t.append(j("span","tag",A>0?`${A} done`:x.root)),t.onclick=()=>{ne(),_(x.id)},y.append(t)}),m.append(y),Te(m)}function bs(d,_){const m=j("div","panel");m.append(j("h2",void 0,d.title)),m.append(j("p","hint",d.blocking?"A project is a name and a root directory. New sessions start there.":"New sessions in this project start in its root directory."));const y=j("form"),x=j("input");x.value=d.name??"",x.placeholder="api-service",x.required=!0;const B=j("label","field");B.append(j("span",void 0,"Project name"),x);const A=j("input");A.value=d.root??"",A.placeholder="/home/you/code/api-service",A.required=!0,A.disabled=!!d.rootLocked;const t=j("label","field");t.append(j("span",void 0,d.rootLocked?"Root directory (fixed after creation)":"Root directory"),A),y.append(B,t),d.rootLocked||y.append(Cs(A));const a=j("div","actions");if(d.onDelete){const l=j("button","btn danger","Delete project");l.type="button",l.onclick=()=>{var s;ne(),(s=d.onDelete)==null||s.call(d)},a.append(l),a.style.justifyContent="space-between"}if(!d.blocking){const l=j("button","btn","Cancel");l.type="button",l.onclick=()=>ne(),a.append(l)}const h=j("button","btn primary",d.onDelete?"Save":"Create");h.type="submit",a.append(h),y.append(a),y.onsubmit=l=>{l.preventDefault(),!(!x.value.trim()||!A.value.trim())&&(ne(),_(x.value.trim(),A.value.trim()))},m.append(y),Te(m,{dismissible:!d.blocking}),x.focus(),x.select()}function yn(d,_){const m=j("div","panel");m.append(j("h2",void 0,`New session in slot ${d.slot}`)),m.append(j("p","hint","Defaults to the project root."));const y=j("form"),x=(s,c,p)=>{const v=j("input");v.value=c,v.placeholder=p;const o=j("label","field");return o.append(j("span",void 0,s),v),y.append(o),v},B=x("Working directory",d.cwd,d.cwd);y.append(Cs(B));const A=x("Command (optional)","","claude"),t=x("Name (optional)","","agent"),a=j("div","actions"),h=j("button","btn","Cancel");h.type="button",h.onclick=()=>ne();const l=j("button","btn primary","Start");l.type="submit",a.append(h,l),y.append(a),y.onsubmit=s=>{s.preventDefault(),ne(),_({cwd:B.value.trim()||d.cwd,command:A.value.trim()||null,name:t.value.trim()||null})},m.append(y),Te(m)}const En=["#f87171","#b91c1c","#fb923c","#c2410c","#fbbf24","#b45309","#a3e635","#4d7c0f","#4ade80","#15803d","#2dd4bf","#0f766e","#22d3ee","#0e7490","#60a5fa","#1d4ed8","#818cf8","#4338ca","#c084fc","#7e22ce","#f472b6","#be185d","#94a3b8","#475569"];function Ln(d,_,m,y){const x=j("div","panel");x.append(j("h2",void 0,`Slot ${d.slot}`)),x.append(j("p","hint",d.cwd));const B=j("form"),A=j("input");A.value=d.name??"",A.placeholder=d.title??"shell";const t=j("label","field");t.append(j("span",void 0,"Name"),A),B.append(t);let a=d.color;const h=j("div","swatches"),l=()=>{for(const i of Array.from(h.children))i.classList.toggle("active",i.dataset.color===(a??""))},s=(i,n)=>{const u=j("button","swatch");u.type="button",u.dataset.color=i??"",u.title=n,u.setAttribute("aria-label",n),i?u.style.setProperty("--tint",i):u.classList.add("none"),u.onclick=()=>{a=i,l()},h.append(u)};s(null,"No colour");for(const i of En)s(i,i);l();const c=j("div","field");c.append(j("span",void 0,"Border colour"),h),B.append(c);const p=j("div","actions"),v=j("button","btn danger","Delete");v.type="button",v.onclick=()=>{ne(),m()};const o=j("button","btn diff-toggle",y.open?"Hide diff viewer":"Diff viewer");o.type="button",o.style.marginRight="auto",o.onclick=()=>{ne(),y.onToggle()};const e=j("button","btn","Cancel");e.type="button",e.onclick=()=>ne();const r=j("button","btn primary","Save");r.type="submit",p.append(v,o,e,r),B.append(p),B.onsubmit=i=>{i.preventDefault(),ne(),_({name:A.value.trim(),color:a})},x.append(B),Te(x),A.focus(),A.select()}function xn(d,_){const m=j("div","panel");m.append(j("h2",void 0,"Settings"));let y=d.ring;const x=j("div","field ring-size");x.append(j("span",void 0,"Terminals around the focus"));const B=j("div","choices");for(const s of pt){const c=j("button","choice"+(s===y?" active":""));c.type="button",c.append(j("b",void 0,String(s))),c.append(j("span",void 0,s<12?"wide centre":"full ring")),c.onclick=()=>{y=s;for(const p of Array.from(B.children))p.classList.remove("active");c.classList.add("active")},B.append(c)}x.append(B),m.append(x),m.append(j("p","hint ring-size","Slots stay where they are. Shrinking needs the slots above the new size to be empty first, so nothing is killed or hidden behind your back."));const A=j("label","field toggle"),t=j("input");t.type="checkbox",t.checked=d.usage,A.append(t,j("span",void 0,"Enable Claude usage monitoring")),m.append(A),m.append(j("p","hint","The tab asks Claude Code for the real numbers with `claude -p /usage`, which it answers locally and bills nothing. Nothing is read from your credentials, and nothing leaves this machine."));const a=j("div","actions"),h=j("button","btn","Cancel");h.type="button",h.onclick=()=>ne();const l=j("button","btn primary","Save");l.onclick=()=>{ne(),_({ring:y,usage:t.checked})},a.append(h,l),m.append(a),Te(m)}function kn(d,_){const m=j("div","panel");m.append(j("h2",void 0,`tring ${_} is available`)),m.append(j("p","hint",`You are running ${d}. Update with:`));const y=j("pre","cmd","npm i -g tring-chat");m.append(y),m.append(j("p","hint","Running sessions are not affected until you restart the daemon."));const x=j("div","actions"),B=j("button","btn","Copy command");B.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{B.textContent="Copied"},()=>{B.textContent="Copy failed"})};const A=j("button","btn primary","Close");A.onclick=()=>ne(),x.append(B,A),m.append(x),Te(m)}function ws(d,_,m){const y=j("div","panel");y.append(j("h2",void 0,d)),y.append(j("p","hint",_));const x=j("div","actions"),B=j("button","btn","Cancel");B.onclick=()=>ne();const A=j("button","btn primary","Confirm");A.onclick=()=>{ne(),m()},x.append(B,A),y.append(x),Te(y)}function Rn(d){const _=j("div","panel paste-sheet");_.append(j("h2",void 0,"Paste")),_.append(j("p","hint","The clipboard could not be read directly. Long-press the box and paste: text is typed into the terminal, an image goes in as a path."));const m=j("textarea","paste-box");m.rows=4,m.placeholder="paste here",m.autocomplete="off",m.autocapitalize="off",m.spellcheck=!1,m.addEventListener("paste",A=>{var a;const t=ns((a=A.clipboardData)==null?void 0:a.files);t.length!==0&&(A.preventDefault(),ne(),d.onImages(t))}),_.append(m);const y=j("div","actions"),x=j("button","btn","Cancel");x.onclick=()=>ne();const B=j("button","btn primary","Insert");B.onclick=()=>{const A=m.value;ne(),A&&d.onText(A)},y.append(x,B),_.append(y),Te(_),m.focus()}function An(d,_){const m=j("div","panel copy-sheet");m.append(j("h2",void 0,"Copy"));const y=(a,h,l="btn")=>{const s=j("button",l,a);return s.type="button",s.onclick=()=>{_(h).then(c=>{s.textContent=c?"Copied":"Copy failed",setTimeout(()=>{s.textContent=a},1500)})},s};if(d.links.length>0){m.append(j("p","hint","Links on screen, the latest first."));const a=j("div","links");for(const h of d.links){const l=j("div","link");l.append(j("span","url",h),y("Copy",h)),a.append(l)}m.append(a)}m.append(j("p","hint",d.text?"The screen as text. Long-press to select part of it, or copy all of it.":"Nothing on the screen yet."));const x=j("pre","copy-box",d.text);m.append(x);const B=j("div","actions"),A=j("button","btn","Close");A.onclick=()=>ne();const t=y("Copy screen",d.text,"btn primary");t.disabled=d.text==="",B.append(A,t),m.append(B),Te(m)}const Dn=document.getElementById("bar"),jt=document.getElementById("switcher"),Ue=document.getElementById("ring"),mt=document.getElementById("usage");let ye=[],He=null,_e=null,nt=null,Bt=null,Wi="",qt=!1,ve=null,ei=null,je="ring",Mt=null;const di=window.matchMedia(Ss),St=new Map,Tt=new Map,ti=new Map,It=new Map;let ii=null,si=null;const xe=document.createElement("div");xe.className="focus-cell";const Ye=document.createElement("div");Ye.className="term-host";xe.append(Ye);const ot=new Mr(xe,()=>Re()),de=new xr(Ye),Se=new gt(xe,{label:d=>{const _=Ne(d);if(!_)return null;const m=ye.find(y=>y.id===_.projectId);return{name:_.name??_.title??"shell",slot:_.slot,color:_.color,elsewhere:_.projectId!==He?(m==null?void 0:m.name)??"another project":null}},onAnswer:(d,_,m)=>me.send({type:"answer",itemId:d,decision:_,...m}),onReply:(d,_)=>me.send({type:"reply",itemId:d,text:_}),onOpen:d=>Nn(d),hooks:()=>Ot("/api/hooks"),installHooks:async()=>{await Zs("/api/hooks")},onAuto:d=>me.send({type:"autoAnswer",enabled:d}),onAgent:d=>me.send({type:"agent",...d}),onLayout:()=>Re()});let Ui=!1,$e={enabled:!1,id:null,status:null,error:null},zi=null;const Je=()=>Se.isOpen&&$e.enabled&&$e.id!==null;let Ze=!0,Rt=null,rt=null;const ke=()=>Je()?$e.id:_e,me=new er({onOpen:()=>{Ft(),Wn()},onClose:()=>Ve("daemon disconnected — reconnecting"),onOutput:(d,_)=>{d===ke()&&de.write(_)},onMessage:Bn});de.onInput=d=>{const _=ke();_&&me.send({type:"input",id:_,data:d})};Ir(window);const at={upload:Qs,ready:()=>ke()!==null,insert:d=>{de.paste(d),de.focus()},onError:Ve};Pr(xe,at);zr(Ue,{sessionAt:d=>{var _;return(_=et(d))==null?void 0:_.id},onMove:(d,_)=>me.send({type:"move",id:d,slot:_})});jr(xe,at);const Mn=Or(d=>{Tn(d)});async function Tn(d){const[_]=d,m=Ve(d.length===1&&_?`uploading ${_.name}…`:`uploading ${d.length} files…`);await bt(d,at),Me===m&&Ft()}const ht=document.createElement("div");ht.className="heard";ht.hidden=!0;ht.setAttribute("aria-live","polite");xe.append(ht);const ji=Hr(window),Ce=ji&&new Wr(ji,{onListening:d=>{ht.hidden=!d,qe()},onHeard:d=>{ht.textContent=d||"listening… tap the mic again to finish"},onText:d=>{ke()&&de.paste(d+" ")},onError:Ve},navigator.language);de.shouldSendKey=d=>!wt()&&!oi(d);de.onSelect=d=>{as(d).then(_=>{_||Ve("could not copy the selection"),de.focus()})};const ui=()=>ye.find(d=>d.id===He)??null,Qe=()=>{var d;return((d=ui())==null?void 0:d.sessions)??[]},et=d=>Qe().find(_=>_.slot===d),Ne=d=>ye.flatMap(_=>_.sessions).find(_=>_.id===d);function lt(){const d=Math.max(0,...Qe().map(_=>_.slot));return pt.find(_=>_>=d&&_>=vt())??pt[pt.length-1]}const ys=()=>ye.reduce((d,_)=>d+_.sessions.filter(m=>m.status==="done").length,0);function Bn(d){var _,m;switch(d.type){case"state":{ye=d.projects,ei=d.update??ei;const y=new Set(ye.flatMap(x=>x.sessions).map(x=>x.id));for(const x of Tt.keys())y.has(x)||Tt.delete(x);He=d.activeProjectId??((_=ye[0])==null?void 0:_.id)??null,Es(),Un(),Kn(),qn(),un()&&Ds(),Gn();break}case"status":{const y=Ne(d.id),x=y==null?void 0:y.status;y&&(y.status=d.status,y.since=d.since,y.title=d.title),d.status==="done"&&x!=="done"&&d.notable&&Pi(),ze();break}case"screen":d.id===ke()&&de.replay(d.ansi);break;case"size":if(d.id!==ke())break;if(Ze=d.mine,d.mine){const y=de.fitNow();(y.cols!==d.cols||y.rows!==d.rows)&&ri(y,!1)}else de.adopt(d.cols,d.rows);xs();break;case"snapshot":{Tt.set(d.id,d.snapshot),(m=St.get(d.id))==null||m.paint(d.snapshot);break}case"exit":ze();break;case"error":Ve(d.message);break;case"autoAnswer":Se.setAuto(d.enabled,d.history);break;case"agent":$e=d.agent,Se.setAgent($e),gi(),qe();break;case"inbox":{const y=Se.setItems(d.items);Ui&&y.length>0&&Pi(),Ui=!0,ze();break}}}const In=()=>({onSelect:d=>Ct(d),onAdd:()=>Ms(!1),onContext:d=>Vn(d),onUpdate:d=>kn(d.current,d.latest),onSoundToggle:()=>ze(),onSettings:()=>zn(),onUsage:()=>Ds(),onInbox:()=>fi()}),tt=()=>pn(Dn,ye,He,In(),ei,je==="usage",{open:Se.isOpen,count:Se.count});function Es(){tt(),Pn(),ze()}function Pn(){const d=lt(),_=`${He}|${d}|`+Qe().map(m=>`${m.slot}:${m.id}`).sort().join(",");if(_!==Wi){Wi=_,an(Ue,xe,d);for(const m of Array.from(Ue.children))m!==xe&&m.remove();xe.parentElement!==Ue&&Ue.append(xe),ti.clear(),St.clear();for(let m=1;m<=d;m++){const y=et(m),x=document.createElement("div");if(x.className="tile",x.tabIndex=0,x.onmousedown=B=>B.preventDefault(),hn(x,m,d),x.dataset.slot=String(m),!y)x.classList.add("empty"),x.textContent=`+ ${ai(m)}`,x.onclick=()=>mi(m);else{const B=document.createElement("canvas");x.append(B);const A=new en(B);St.set(y.id,A);const t=Tt.get(y.id);t&&A.paint(t);const a=document.createElement("div");a.className="label";const h=At("slot-badge");h.textContent=String(m),a.append(h,At("big-nm")),x.append(a);const l=document.createElement("div");l.className="meta";const s=document.createElement("span");s.className="key",s.textContent=String(m),l.append(s,At("nm"),At("cwd")),x.append(l),x.onclick=()=>Ke(y.id),x.oncontextmenu=p=>{p.preventDefault(),Ts(y.id)};const c=document.createElement("button");c.className="tile-action",c.onclick=p=>{p.stopPropagation(),me.send({type:"respawn",id:y.id})},x.append(c),Ls(x,y)}ti.set(m,x),Ue.append(x)}requestAnimationFrame(()=>Re())}}const At=d=>{const _=document.createElement("span");return _.className=d,_};function Ls(d,_){if(d.classList.remove("st-idle","st-busy","st-done","st-exited","viewing","asking"),d.style.removeProperty("--tint"),!_)return;d.classList.add(`st-${_.status}`),_.id===_e&&d.classList.add("viewing"),Se.countFor(_.id)>0&&d.classList.add("asking"),_.color&&d.style.setProperty("--tint",_.color);const m=_.name??_.title??"shell",y=d.querySelector(".nm");y&&(y.textContent=m);const x=d.querySelector(".big-nm");x&&(x.textContent=m);const B=d.querySelector(".cwd");B&&(B.textContent=_.cwd.split("/").filter(Boolean).pop()??""),d.title=`${ai(_.slot)} — ${_.cwd}`;const A=d.querySelector(".tile-action"),t=On(_);A&&(A.hidden=!t,t&&(A.textContent=t.label,A.title=t.title))}function On(d){return d.status==="exited"?{label:"↻",title:d.command?`Restart: ${d.command}`:`Restart shell (exit ${d.exitCode??"?"})`}:d.command&&d.status==="idle"?{label:"▸",title:`Run: ${d.command}`}:null}function ze(){for(let _=1;_<=lt();_++){const m=ti.get(_);m&&Ls(m,et(_))}tt(),qe(),Se.repaint();const d=ys();document.title=d>0?`(${d}) tring`:"tring"}let Kt="";function qe(){if(jt.hidden=!di.matches||je!=="ring",jt.hidden){Kt="",Ce==null||Ce.cancel();return}const d=_e?Ne(_e)??null:null,_=Qe().filter(A=>A.status==="done").length,m=(Ce==null?void 0:Ce.listening)??!1,y={open:Se.isOpen,count:Se.count},x=Je()?{key:"◆",name:"Orchestrator",status:$e.status??"idle"}:null,B=`${d==null?void 0:d.id}|${d==null?void 0:d.status}|${d==null?void 0:d.name}|${d==null?void 0:d.title}|${_}|${m}|${y.open}|${y.count}|${x==null?void 0:x.status}`;B!==Kt&&(Kt=B,Sn(jt,{focused:d,done:_,listening:m,inbox:y,override:x},{onOpen:Is,onNext:vi,onEsc:Fn,onPaste:Hn,onAttach:Mn,onCopy:$n,onMic:Ce?()=>Ce.toggle():void 0,onInbox:fi}))}function Fn(){const d=ke();d&&me.send({type:"input",id:d,data:"\x1B"})}function Hn(){Kr({...at,fallback:()=>Rn({onText:at.insert,onImages:d=>{bt(d,at)}})})}function $n(){if(!ke())return;const d=de.term.buffer.active;An({text:Vr(d,de.term.rows),links:Zr(d)},as)}function Re(d=!1){const _=ke();if(!Ze&&!d){const y=de.proposed();_&&y&&ri(y,!1);return}const m=de.fitNow();_&&ri(m,d);for(const y of St.values())y.refresh()}function ri(d,_){rt={...d,claim:_||((rt==null?void 0:rt.claim)??!1)},Rt&&clearTimeout(Rt);const m=()=>{Rt=null;const y=rt;rt=null,y&&ke()&&me.send({type:"resize",cols:y.cols,rows:y.rows,...y.claim?{claim:!0}:{}})};_?m():Rt=setTimeout(m,80)}function _i(d){const{cols:_,rows:m}=de.fitNow();Ze=!0,xs(),me.send({type:"focus",id:d,cols:_,rows:m})}const it=document.createElement("button");it.className="size-note";it.type="button";it.hidden=!0;it.textContent="Sized for another screen · click to fit here";it.onclick=d=>{d.stopPropagation(),Re(!0),de.focus()};xe.append(it);function xs(){it.hidden=Ze||!ke()}window.addEventListener("focus",()=>Re(!0));document.addEventListener("visibilitychange",()=>{document.hidden||Re(!0)});Ye.addEventListener("pointerdown",()=>{Ze||Re(!0)});Ye.addEventListener("keydown",()=>{Ze||Re(!0)},!0);Ye.addEventListener("paste",()=>{Ze||Re(!0)},!0);let Vt=0;new ResizeObserver(()=>{Vt||(Vt=requestAnimationFrame(()=>{Vt=0,Re()}))}).observe(Ye);function Ke(d,_=!1){yt(),!_&&Se.isOpen&&pi(),Rs(d),_e&&!Se.isOpen&&de.focus()}function fi(){Se.isOpen?pi():ks()}function ks(){yt(),Se.open(!($e.enabled&&$e.id)),gi(),tt(),qe()}function pi(){Se.close(),gi(),tt(),qe(),_e&&de.focus()}function gi(){const d=Je()?$e.id:null;xe.classList.toggle("agent-view",d!==null),Se.setBeside(d!==null),d!==zi&&(zi=d,Ce==null||Ce.cancel(),de.clear(),requestAnimationFrame(()=>{_i(ke());for(const _ of St.values())_.refresh();d&&de.focus()}))}function Nn(d){const _=Ne(d);if(_){if(pi(),_.projectId!==He){It.set(_.projectId,_.id),Ct(_.projectId);return}Ke(_.id)}}function Rs(d){if(d&&d===_e)return;if(Je()){const m=d?Ne(d):void 0;_e&&(Bt=_e),_e=(m==null?void 0:m.id)??null,nt=(m==null?void 0:m.slot)??null,ot.setSession(_e),m&&It.set(m.projectId,m.id),ze();return}Ce==null||Ce.cancel();const _=d?Ne(d):void 0;if(_e&&(Bt=_e),_e=(_==null?void 0:_.id)??null,nt=(_==null?void 0:_.slot)??null,ot.setSession(_e),!_){de.clear(),ze();return}It.set(_.projectId,_.id),_i(_.id),de.focus(),ze()}function Wn(){const d=ke();d&&_i(d)}function Un(){if(_e===null||nt===null)return;const d=Tr({id:_e,slot:nt},Qe());if(d&&d.id===_e){nt=d.slot;return}Rs((d==null?void 0:d.id)??null)}function As(d){const _=et(d);_?Ke(_.id):mi(d)}function Ds(){je!=="usage"&&(je="usage",Ue.hidden=!0,mt.hidden=!1,Zt(mt,null,null),ni(),Mt=setInterval(()=>void ni(),3e4),gs(!0),tt(),qe())}function yt(){je!=="ring"&&(je="ring",Mt&&clearInterval(Mt),Mt=null,mt.hidden=!0,Ue.hidden=!1,gs(!1),tt(),qe(),requestAnimationFrame(()=>Re()))}async function ni(){if(je==="usage")try{Zt(mt,await _n(),null)}catch(d){Zt(mt,null,d.message)}}function zn(){xn({ring:vt(),usage:Jt()},d=>{d.usage!==Jt()&&(dn(d.usage),d.usage||yt()),d.ring!==vt()?jn(d.ring):(tt(),ni())})}function jn(d){on(d),Es();const _=lt();_!==d?Ve(`slots above ${d} are still in use — the ring stays at ${_} until they are closed`):Ft()}function Ct(d){yt(),d!==He&&(He=d,Ce==null||Ce.cancel(),_e=null,nt=null,ot.setSession(null),Je()||de.clear(),ii=d,me.send({type:"activateProject",projectId:d}))}function qn(){const d=si;if(d===null)return;const _=et(d);_&&(si=null,Ke(_.id,!0))}function Kn(){const d=ii;if(!d||d!==He)return;ii=null;const _=It.get(d);_&&Qe().some(m=>m.id===_)&&Ke(_,!0)}function vi(){var x;const d=Qe(),_=et(((x=Ne(_e??""))==null?void 0:x.slot)??0),m=(_==null?void 0:_.slot)??0,y=lt();for(let B=1;B<=y;B++){const A=(m+B-1)%y+1,t=d.find(a=>a.slot===A);if((t==null?void 0:t.status)==="done")return Ke(t.id)}}function mi(d){const _=ui();_&&yn({cwd:_.root,slot:d},m=>{di.matches&&(si=d),me.send({type:"create",projectId:_.id,slot:d,cwd:m.cwd,...m.command?{command:m.command}:{},...m.name?{name:m.name}:{}})})}function Ms(d){bs({title:d?"Create your first project":"New project",root:"",blocking:d},(_,m)=>me.send({type:"createProject",name:_,root:m}))}function Ts(d){const _=Ne(d);_&&Ln(_,m=>{m.name!==(_.name??"")&&me.send({type:"rename",id:d,name:m.name}),m.color!==_.color&&me.send({type:"color",id:d,color:m.color})},()=>Bs(_),{open:ot.isOpen,onToggle:()=>{ot.isOpen||Ke(d),ot.toggle()}})}function Bs(d){ws("Delete session",`Slot ${d.slot} — ${d.cwd}. The slot goes back to empty.`,()=>me.send({type:"kill",id:d.id}))}function Vn(d){const _=ye.find(m=>m.id===d);_&&bs({title:"Project settings",name:_.name,root:_.root,rootLocked:!0,onDelete:()=>{const m=_.sessions.length;ws(`Delete ${_.name}?`,m>0?`This kills ${m} session${m===1?"":"s"} in this project.`:"This project has no running sessions.",()=>me.send({type:"deleteProject",projectId:d}))}},m=>me.send({type:"renameProject",projectId:d,name:m}))}function Gn(){if(ye.length>0){qt=!1;return}qt||wt()||(qt=!0,Ms(!0))}document.addEventListener("keydown",d=>{if(wt())return Xn(d);oi(d)&&(d.preventDefault(),Is())});document.addEventListener("click",d=>{if(!(wt()||je!=="ring")){if(Je()){Se.el.contains(d.target)||de.focus();return}!_e||Se.isOpen||de.focus()}});function Is(){wt()||(yt(),ve="picker",bn(ui(),ye,ys(),{onPickSlot:d=>{ve=null,As(d)},onPickProject:d=>{ve=null,Ct(d)},onNextDone:()=>{ve=null,vi()},onNewSession:()=>{ve=null,Ps()}}))}function Ps(){const d=lt(),_=[...Array(d)].map((m,y)=>y+1).find(m=>!et(m));_?mi(_):Ve(`all ${d} slots are full`)}function Xn(d){if(ve===null)return;if(ve==="projects"){const x=Number(d.key);if(x>=1&&x<=9&&ye[x-1]){d.preventDefault();const B=ye[x-1];ne(),ve=null,Ct(B.id);return}}const _=qs(d);if(_!==null&&_<=lt()&&ve==="picker"){d.preventDefault(),ne(),ve=null,As(_);return}if(oi(d)||d.code==="Space"){d.preventDefault(),ne(),ve=null,Bt&&Ke(Bt);return}const m=Ks(d);if(!m)return;d.preventDefault();const y=_e?Ne(_e):void 0;switch(m){case"close":ne(),ve=null;break;case"next-done":ne(),ve=null,vi();break;case"projects":ne(),ve="projects",wn(ye,x=>{ve=null,Ct(x)});break;case"new-session":ne(),ve=null,Ps();break;case"rename":if(!y)break;ne(),ve=null,Ts(y.id);break;case"kill":if(!y)break;ne(),ve=null,Bs(y);break;case"orchestrator":ne(),ve=null,fi();break;case"mark-seen":y&&me.send({type:"ack",id:y.id}),ne(),ve=null;break}}let Me=null;function Ve(d){return Ft(),Me=document.createElement("div"),Me.id="toast",Me.textContent=d,document.body.append(Me),Me}function Ft(){Me==null||Me.remove(),Me=null}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});window.addEventListener("resize",()=>Re(!0));di.addEventListener("change",()=>{qe(),Se.setBeside(Je()),requestAnimationFrame(()=>Re(!0))});gt.wanted()&&ks();me.connect();
|