diff --git a/package.json b/package.json index ce0fa1b..d2b22a8 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "dev": "nodemon src/app.js", "start": "open http://localhost:3000 && npm run dev HAXCMS_DISABLE_JWT_CHECKS", "build": "rm -rf dist && babel src --out-dir dist --copy-files --include-dotfiles && chmod 774 dist/local.js && chmod 774 dist/app.js && chmod 774 dist/cli.js", - "release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish" + "release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish", + "haxcms-nodejs-cli": "haxcms-nodejs-cli" }, "repository": { "type": "git", diff --git a/src/cli.js b/src/cli.js index 0987538..e8bb654 100644 --- a/src/cli.js +++ b/src/cli.js @@ -4,58 +4,27 @@ process.env.haxcms_middleware = "node-cli"; // HAXcms core settings const { HAXCMS } = require('./lib/HAXCMS.js'); -/** - * @todo need a configuration resolver of some kind - * if we are invoking stand alone, it'll need to install haxcms in place - * if it's in an existing HAXcms deploy, it should read off that _config / other multi-site directories - * if it's a HAXSite then it needs to supply config that works relative to that one - * This also influnces the entry index.html file - */ const RoutesMap = require('./lib/RoutesMap.js'); // process arguments from commandline appropriately -const args = process.argv; -args.shift(); -args.shift(); let body = {}; -let cliOp = 'listCalls'; -// 1st 2 args call the program itself -for (var i in args) { - let arg = args[i].split('='); - let param = arg[0].replace('--',''); - let value = arg[1]; - switch (param) { - case 'op': - cliOp = value; - break; - case "nodeTitle": - body.node = body.node || {}; - body.node.title = value; - break; - case "site": - body.site = { - name: value - }; - break; - // set everything else as parameters - default: - body[param] = value; - break; - } -} +let cliOp = null; const cli = { - post: (path, callback) => callback({ - route: { - path: path + post: (path, callback) => + callback( + { + route: { + path: path + }, + body: body, + method: "post" }, - body: body, - method: "post" - }, - { - query: {}, - send: (data) => console.log(data), - }), + { + query: {}, + send: (data) => console.log(data), + } + ), get: (path, callback) => callback({ route: { path: path @@ -91,4 +60,29 @@ for (var method in RoutesMap) { }); } } -} \ No newline at end of file +} + +// method to bridge api calls in similar manner given a site already loaded into scope +export function cliBridge(op, body = {}) { + let req = { + route: { + path: `${HAXCMS.basePath}${HAXCMS.systemRequestBase}${route}` + }, + body: body, + method: "post" + }; + let res = { + query: {}, + send: (data) => console.log(data), + }; + const rMethod = req.method.toLowerCase(); + if (HAXCMS.validateJWT(req, res)) { + // call the method + RoutesMap.RoutesMap[rMethod][op](req, res); + } + else { + console.error("route connection issue"); + } +} + +export { cli }; \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/d-d-d/lib/DDDStyles.js b/src/public/build/es6/node_modules/@haxtheweb/d-d-d/lib/DDDStyles.js index 708e346..d3709f6 100644 --- a/src/public/build/es6/node_modules/@haxtheweb/d-d-d/lib/DDDStyles.js +++ b/src/public/build/es6/node_modules/@haxtheweb/d-d-d/lib/DDDStyles.js @@ -1111,7 +1111,6 @@ import{css as d,html as a,unsafeCSS as t}from"../../../lit/index.js";import{Simp border-top-style: solid; margin: 0 auto; padding: 0; - transition:; } .h-invert { @@ -1477,16 +1476,6 @@ import{css as d,html as a,unsafeCSS as t}from"../../../lit/index.js";import{Simp content: "+"; margin-left: auto; text-align: right; - color: light-dark( - var( - --lowContrast-override, - var(--ddd-theme-primary, var(--ddd-theme-default-nittanyNavy)) - ), - var( - --lowContrast-override, - var(--ddd-theme-primary, var(--ddd-theme-default-linkLight)) - ) - ); font-weight: var(--ddd-font-weight-regular); font-size: var(--ddd-font-size-m); line-height: 1; diff --git a/src/public/build/es6/node_modules/@haxtheweb/la-tex/lib/latex2html5.js b/src/public/build/es6/node_modules/@haxtheweb/la-tex/lib/latex2html5.js index c561de1..79dbbd4 100644 --- a/src/public/build/es6/node_modules/@haxtheweb/la-tex/lib/latex2html5.js +++ b/src/public/build/es6/node_modules/@haxtheweb/la-tex/lib/latex2html5.js @@ -11,4 +11,4 @@ * @contributor David Ellis * @license MIT */ -var a=t("url"),s=t("child_process").spawn,u=t("fs");n.XMLHttpRequest=function(){var n,c,f=this,h=t("http"),d=t("https"),p={},g=!1,v={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},b={},_={},w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],M=["TRACE","TRACK","CONNECT"],E=!1,T=!1,S={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null,this.withCredentials=!1;this.open=function(t,e,n,i,a){if(this.abort(),T=!1,!function(t){return t&&-1===M.indexOf(t)}(t))throw new Error("SecurityError: Request method not allowed");p={method:t,url:e.toString(),async:"boolean"!=typeof n||n,user:i||null,password:a||null},setState(this.OPENED)},this.setDisableHeaderCheck=function(t){g=t},this.setRequestHeader=function(t,e){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(function(t){return g||t&&-1===w.indexOf(t.toLowerCase())}(t)){if(E)throw new Error("INVALID_STATE_ERR: send flag is true");t=_[t.toLowerCase()]||t,_[t.toLowerCase()]=t,b[t]=b[t]?b[t]+", "+e:e}else console.warn('Refused to set unsafe header "'+t+'"')},this.getResponseHeader=function(t){return"string"==typeof t&&this.readyState>this.OPENED&&c&&c.headers&&c.headers[t.toLowerCase()]&&!T?c.headers[t.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState"+e[1]+"":t})).join("\n"),n=document.createElement("ul");return n.className="math",n.innerHTML=e,n}},{}],112:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("div");return e.id="latex-macros",e.style.display="none",e.className="verbatim",e.innerHTML=a.default,e};var a=i(t("latex2js-macros"))},{"@babel/runtime/helpers/interopRequireDefault":6,"latex2js-macros":119}],113:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("span");return e.className="math",e.innerHTML=t.lines.join("\n"),e}},{}],114:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("span");return e.className="math nicebox",e.innerHTML=t.lines.join("\n"),e}},{}],115:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireWildcard"),a=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=u.psgraph.getSize.call(t),n=("width: ".concat(e.width,"px; height: ").concat(e.height,"px;"),"".concat(e.width,"px")),i="".concat(e.height,"px"),a=document.createElement("div");a.className="pspicture",a.style.width=n,a.style.height=i;var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n),f.setAttribute("height",i);var h=c.select(f);t.$el=a,u.psgraph.pspicture.call(t,h),a.appendChild(f);var d=t.env,p=t.plot,g=d.sliders;g&&g.length&&g.forEach((function(t){var e=t.latex,n=t.scalar,i=t.variable,c=t.value,f=t.min,g=t.max,v=document.createElement("label"),b=document.createTextNode(e),_=document.createElement("input");_.setAttribute("min",f*n),_.setAttribute("max",g*n),_.setAttribute("type","range"),_.setAttribute("value",c),v.appendChild(b),v.appendChild(_),a.appendChild(v),_.addEventListener("input",(function(t){!function onChange(t){var e=t.target.value/n;d.variables[i]=e,h.selectAll(".psplot").remove(),Object.entries(p).forEach((function(t){var e=(0,s.default)(t,2),n=e[0],i=e[1];n.match(/psplot/)&&i.forEach((function(t){var e=t.fn.call(t.env,t.match);u.psgraph[n]&&e&&h&&u.psgraph[n].call(e,h)}))}))}(t)}))}));return a};var s=a(t("@babel/runtime/helpers/slicedToArray")),u=t("latex2js-pstricks"),c=i(t("d3"))},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/interopRequireWildcard":7,"@babel/runtime/helpers/slicedToArray":10,d3:73,"latex2js-pstricks":121}],116:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){return document.createElement("input")}},{}],117:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("pre");return e.className="verbatim",e.innerHTML=t.lines.join("\n"),e}},{}],118:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=render,Object.defineProperty(n,"pspicture",{enumerable:!0,get:function get(){return u.default}}),Object.defineProperty(n,"nicebox",{enumerable:!0,get:function get(){return c.default}}),Object.defineProperty(n,"enumerate",{enumerable:!0,get:function get(){return f.default}}),Object.defineProperty(n,"verbatim",{enumerable:!0,get:function get(){return h.default}}),Object.defineProperty(n,"math",{enumerable:!0,get:function get(){return d.default}}),Object.defineProperty(n,"macros",{enumerable:!0,get:function get(){return p.default}}),n.init=void 0;var a=i(t("latex2js")),s=t("latex2js-mathjax"),u=i(t("./components/pspicture")),c=i(t("./components/nicebox")),f=i(t("./components/enumerate")),h=i(t("./components/verbatim")),d=(i(t("./components/slider")),i(t("./components/math"))),p=i(t("./components/macros")),g={pspicture:u.default,nicebox:c.default,enumerate:f.default,verbatim:h.default,math:d.default,macros:p.default};function render(t,e){var n=function done(){var n=(new a.default).parse(t),i=document.createElement("div");i.className="latex-container",n&&n.forEach&&n.forEach((function(t){g.hasOwnProperty(t.type)&&i.appendChild(g[t.type](t))})),e(i)};if((0,s.getMathJax)())return n();(0,s.loadMathJax)(n)}n.init=function init(){(0,s.loadMathJax)(),document.querySelectorAll("la-tex:not([hydrated])").forEach((function(t){render(t.innerHTML,(function(e){t.shadowRoot.querySelector(".wrapper").innerHTML="",t.shadowRoot.querySelector(".wrapper").appendChild(e),t.hydrated=!0}))}))}},{"./components/enumerate":111,"./components/macros":112,"./components/math":113,"./components/nicebox":114,"./components/pspicture":115,"./components/slider":116,"./components/verbatim":117,"@babel/runtime/helpers/interopRequireDefault":6,latex2js:126,"latex2js-mathjax":120}],119:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("@babel/runtime/helpers/taggedTemplateLiteral"));function _templateObject_67ec83207b7811efafde790a70668382(){var t=(0,a.default)(["\n $$\n % create the definition symbol\n def\bydef{stackrel{Delta}{=}}\n %defcircconv{otimes}\n defcircconv{circledast}\n\n \newcommand{qed}{mbox{ } Box}\n\n\n \newcommand{infint}{int_{-infty}^{infty}}\n\n % z transform\n \newcommand{ztp}{ ~~ mathop{mathcal{Z}}limits_{longleftrightarrow} ~~ }\n \newcommand{iztp}{ ~~ mathop{mathcal{Z}^{-1}}limits_{longleftrightarrow} ~~ }\n % fourier transform pair\n \newcommand{\ftp}{ ~~ mathop{mathcal{F}}limits_{longleftrightarrow} ~~ }\n \newcommand{iftp}{ ~~ mathop{mathcal{F}^{-1}}limits_{longleftrightarrow} ~~ }\n % laplace transform\n \newcommand{ltp}{ ~~ mathop{mathcal{L}}limits_{longleftrightarrow} ~~ }\n \newcommand{iltp}{ ~~ mathop{mathcal{L}^{-1}}limits_{longleftrightarrow} ~~ }\n\n \newcommand{\ftrans}[1]{ mathcal{F} left{#1\right} }\n \newcommand{iftrans}[1]{ mathcal{F}^{-1} left{#1\right} }\n \newcommand{ztrans}[1]{ mathcal{Z} left{#1\right} }\n \newcommand{iztrans}[1]{ mathcal{Z}^{-1} left{#1\right} }\n \newcommand{ltrans}[1]{ mathcal{L} left{#1\right} }\n \newcommand{iltrans}[1]{ mathcal{L}^{-1} left{#1\right} }\n\n\n % coordinate vector relative to a basis (linear algebra)\n \newcommand{cvrb}[2]{left[ \vec{#1} \right]_{#2} }\n % change of coordinate matrix (linear algebra)\n \newcommand{cocm}[2]{ mathop{P}limits_{#2 leftarrow #1} }\n % Transformed vector set\n \newcommand{\tset}[3]{{#1lr{\vec{#2}_1}, #1lr{\vec{#2}_2}, dots, #1lr{\vec{#2}_{#3}}}}\n % sum transformed vector set\n \newcommand{\tsetcsum}[4]{{#1}_1#2(\vec{#3}_1) + {#1}_2#2(\vec{#3}_2) + cdots + {#1}_{#4}#2(\vec{#3}_{#4})}\n \newcommand{\tsetcsumall}[4]{#2lr{{#1}_1\vec{#3}_1 + {#1}_2\vec{#3}_2 + cdots + {#1}_{#4}\vec{#3}_{#4}}}\n \newcommand{cvecsum}[3]{{#1}_1\vec{#2}_1 + {#1}_2\vec{#2}_2 + cdots + {#1}_{#3}\vec{#2}_{#3}}\n\n\n % function def\n \newcommand{\fndef}[3]{#1:#2 \to #3}\n % vector set\n \newcommand{\vset}[2]{{\vec{#1}_1, \vec{#1}_2, dots, \vec{#1}_{#2}}}\n % absolute value\n \newcommand{abs}[1]{left| #1 \right|}\n % vector norm\n \newcommand{\norm}[1]{left|left| #1 \right|\right|}\n % trans\n \newcommand{\trans}{mapsto}\n % evaluate integral\n \newcommand{evalint}[3]{left. #1 \right|_{#2}^{#3}}\n % slist\n \newcommand{slist}[2]{{#1}_{1},{#1}_{2},dots,{#1}_{#2}}\n\n % vectors\n \newcommand{\vc}[1]{\textbf{#1}}\n\n % real\n \newcommand{Real}[1]{{Re mit{e}left{{#1}\right}}}\n % imaginary\n \newcommand{Imag}[1]{{Im mit{m}left{{#1}\right}}}\n\n \newcommand{mcal}[1]{mathcal{#1}}\n \newcommand{\bb}[1]{mathbb{#1}}\n \newcommand{N}{mathbb{N}}\n \newcommand{Z}{mathbb{Z}}\n \newcommand{Q}{mathbb{Q}}\n \newcommand{R}{mathbb{R}}\n \newcommand{C}{mathbb{C}}\n \newcommand{I}{mathbb{I}}\n \newcommand{Th}[1]{mathopmathrm{Th(#1)}}\n \newcommand{intersect}{cap}\n \newcommand{\\union}{cup}\n \newcommand{intersectop}{\bigcap}\n \newcommand{\\unionop}{\bigcup}\n \newcommand{setdiff}{\backslash}\n \newcommand{iso}{cong}\n \newcommand{aut}[1]{mathop{mathrm{Aut(#1)}}}\n \newcommand{inn}[1]{mathop{mathrm{Inn(#1)}}}\n \newcommand{Ann}[1]{mathop{mathrm{Ann(#1)}}}\n \newcommand{dom}[1]{mathop{mathrm{dom} #1}}\n \newcommand{cod}[1]{mathop{mathrm{cod} #1}}\n \newcommand{id}{mathrm{id}}\n \newcommand{st}{ | }\n \newcommand{mbf}[1]{mathbf{#1}}\n \newcommand{enclose}[1]{leftlangle #1\right\rangle}\n \newcommand{lr}[1]{left( #1\right)}\n \newcommand{lrsq}[1]{left[ #1\right]}\n \newcommand{op}{mathrm{op}}\n \newcommand{dotarr}{dot{\rightarrow}}\n %Category Names:\n \newcommand{Grp}{mathbf{Grp}}\n \newcommand{Ab}{mathbf{Ab}}\n \newcommand{Set}{mathbf{Set}}\n \newcommand{Matr}{mathbf{Matr}}\n \newcommand{IntDom}{mathbf{IntDom}}\n \newcommand{Field}{mathbf{Field}}\n \newcommand{Vect}{mathbf{Vect}}\n\n \newcommand{\thm}[1]{\begin{theorem} #1 end{theorem}}\n \newcommand{clm}[1]{\begin{claim} #1 end{claim}}\n \newcommand{cor}[1]{\begin{corollary} #1 end{corollary}}\n \newcommand{ex}[1]{\begin{example} #1 end{example}}\n \newcommand{prf}[1]{\begin{proof} #1 end{proof}}\n \newcommand{prbm}[1]{\begin{problem} #1 end{problem}}\n \newcommand{soln}[1]{\begin{solution} #1 end{solution}}\n \newcommand{\rmk}[1]{\begin{remark} #1 end{remark}}\n \newcommand{defn}[1]{\begin{definition} #1 end{definition}}\n\n \newcommand{ifff}{LeftRightArrow}\n\n \x3c!-- For the set of reals and integers --\x3e\n \newcommand{\rr}{R}\n \newcommand{\reals}{R}\n \newcommand{ii}{Z}\n \newcommand{cc}{C}\n \newcommand{\nn}{N}\n \newcommand{\nats}{N}\n\n \x3c!-- For terms being indexed.\n Puts them in standard font face and creates an index entry.\n arg: The term being defined.\n \newcommand{pointer}[1]{#1index{#1}} --\x3e\n\n \x3c!-- For bold terms to be index, but defined elsewhere\n Puts them in bold face and creates an index entry.\n arg: The term being defined. --\x3e\n \newcommand{strong}[1]{\textbf{#1}}\n\n \x3c!-- For set names.\n Puts them in italics. In math mode, yields decent spacing.\n arg: The name of the set. --\x3e\n \newcommand{set}[1]{\textit{#1}}\n\n $$\n "],["\n $$\n % create the definition symbol\n \\def\\bydef{\\stackrel{\\Delta}{=}}\n %\\def\\circconv{\\otimes}\n \\def\\circconv{\\circledast}\n\n \\newcommand{\\qed}{\\mbox{ } \\Box}\n\n\n \\newcommand{\\infint}{\\int_{-\\infty}^{\\infty}}\n\n % z transform\n \\newcommand{\\ztp}{ ~~ \\mathop{\\mathcal{Z}}\\limits_{\\longleftrightarrow} ~~ }\n \\newcommand{\\iztp}{ ~~ \\mathop{\\mathcal{Z}^{-1}}\\limits_{\\longleftrightarrow} ~~ }\n % fourier transform pair\n \\newcommand{\\ftp}{ ~~ \\mathop{\\mathcal{F}}\\limits_{\\longleftrightarrow} ~~ }\n \\newcommand{\\iftp}{ ~~ \\mathop{\\mathcal{F}^{-1}}\\limits_{\\longleftrightarrow} ~~ }\n % laplace transform\n \\newcommand{\\ltp}{ ~~ \\mathop{\\mathcal{L}}\\limits_{\\longleftrightarrow} ~~ }\n \\newcommand{\\iltp}{ ~~ \\mathop{\\mathcal{L}^{-1}}\\limits_{\\longleftrightarrow} ~~ }\n\n \\newcommand{\\ftrans}[1]{ \\mathcal{F} \\left\\{#1\\right\\} }\n \\newcommand{\\iftrans}[1]{ \\mathcal{F}^{-1} \\left\\{#1\\right\\} }\n \\newcommand{\\ztrans}[1]{ \\mathcal{Z} \\left\\{#1\\right\\} }\n \\newcommand{\\iztrans}[1]{ \\mathcal{Z}^{-1} \\left\\{#1\\right\\} }\n \\newcommand{\\ltrans}[1]{ \\mathcal{L} \\left\\{#1\\right\\} }\n \\newcommand{\\iltrans}[1]{ \\mathcal{L}^{-1} \\left\\{#1\\right\\} }\n\n\n % coordinate vector relative to a basis (linear algebra)\n \\newcommand{\\cvrb}[2]{\\left[ \\vec{#1} \\right]_{#2} }\n % change of coordinate matrix (linear algebra)\n \\newcommand{\\cocm}[2]{ \\mathop{P}\\limits_{#2 \\leftarrow #1} }\n % Transformed vector set\n \\newcommand{\\tset}[3]{\\{#1\\lr{\\vec{#2}_1}, #1\\lr{\\vec{#2}_2}, \\dots, #1\\lr{\\vec{#2}_{#3}}\\}}\n % sum transformed vector set\n \\newcommand{\\tsetcsum}[4]{{#1}_1#2(\\vec{#3}_1) + {#1}_2#2(\\vec{#3}_2) + \\cdots + {#1}_{#4}#2(\\vec{#3}_{#4})}\n \\newcommand{\\tsetcsumall}[4]{#2\\lr{{#1}_1\\vec{#3}_1 + {#1}_2\\vec{#3}_2 + \\cdots + {#1}_{#4}\\vec{#3}_{#4}}}\n \\newcommand{\\cvecsum}[3]{{#1}_1\\vec{#2}_1 + {#1}_2\\vec{#2}_2 + \\cdots + {#1}_{#3}\\vec{#2}_{#3}}\n\n\n % function def\n \\newcommand{\\fndef}[3]{#1:#2 \\to #3}\n % vector set\n \\newcommand{\\vset}[2]{\\{\\vec{#1}_1, \\vec{#1}_2, \\dots, \\vec{#1}_{#2}\\}}\n % absolute value\n \\newcommand{\\abs}[1]{\\left| #1 \\right|}\n % vector norm\n \\newcommand{\\norm}[1]{\\left|\\left| #1 \\right|\\right|}\n % trans\n \\newcommand{\\trans}{\\mapsto}\n % evaluate integral\n \\newcommand{\\evalint}[3]{\\left. #1 \\right|_{#2}^{#3}}\n % slist\n \\newcommand{\\slist}[2]{{#1}_{1},{#1}_{2},\\dots,{#1}_{#2}}\n\n % vectors\n \\newcommand{\\vc}[1]{\\textbf{#1}}\n\n % real\n \\newcommand{\\Real}[1]{{\\Re \\mit{e}\\left\\{{#1}\\right\\}}}\n % imaginary\n \\newcommand{\\Imag}[1]{{\\Im \\mit{m}\\left\\{{#1}\\right\\}}}\n\n \\newcommand{\\mcal}[1]{\\mathcal{#1}}\n \\newcommand{\\bb}[1]{\\mathbb{#1}}\n \\newcommand{\\N}{\\mathbb{N}}\n \\newcommand{\\Z}{\\mathbb{Z}}\n \\newcommand{\\Q}{\\mathbb{Q}}\n \\newcommand{\\R}{\\mathbb{R}}\n \\newcommand{\\C}{\\mathbb{C}}\n \\newcommand{\\I}{\\mathbb{I}}\n \\newcommand{\\Th}[1]{\\mathop\\mathrm{Th(#1)}}\n \\newcommand{\\intersect}{\\cap}\n \\newcommand{\\\\union}{\\cup}\n \\newcommand{\\intersectop}{\\bigcap}\n \\newcommand{\\\\unionop}{\\bigcup}\n \\newcommand{\\setdiff}{\\backslash}\n \\newcommand{\\iso}{\\cong}\n \\newcommand{\\aut}[1]{\\mathop{\\mathrm{Aut(#1)}}}\n \\newcommand{\\inn}[1]{\\mathop{\\mathrm{Inn(#1)}}}\n \\newcommand{\\Ann}[1]{\\mathop{\\mathrm{Ann(#1)}}}\n \\newcommand{\\dom}[1]{\\mathop{\\mathrm{dom} #1}}\n \\newcommand{\\cod}[1]{\\mathop{\\mathrm{cod} #1}}\n \\newcommand{\\id}{\\mathrm{id}}\n \\newcommand{\\st}{\\ |\\ }\n \\newcommand{\\mbf}[1]{\\mathbf{#1}}\n \\newcommand{\\enclose}[1]{\\left\\langle #1\\right\\rangle}\n \\newcommand{\\lr}[1]{\\left( #1\\right)}\n \\newcommand{\\lrsq}[1]{\\left[ #1\\right]}\n \\newcommand{\\op}{\\mathrm{op}}\n \\newcommand{\\dotarr}{\\dot{\\rightarrow}}\n %Category Names:\n \\newcommand{\\Grp}{\\mathbf{Grp}}\n \\newcommand{\\Ab}{\\mathbf{Ab}}\n \\newcommand{\\Set}{\\mathbf{Set}}\n \\newcommand{\\Matr}{\\mathbf{Matr}}\n \\newcommand{\\IntDom}{\\mathbf{IntDom}}\n \\newcommand{\\Field}{\\mathbf{Field}}\n \\newcommand{\\Vect}{\\mathbf{Vect}}\n\n \\newcommand{\\thm}[1]{\\begin{theorem} #1 \\end{theorem}}\n \\newcommand{\\clm}[1]{\\begin{claim} #1 \\end{claim}}\n \\newcommand{\\cor}[1]{\\begin{corollary} #1 \\end{corollary}}\n \\newcommand{\\ex}[1]{\\begin{example} #1 \\end{example}}\n \\newcommand{\\prf}[1]{\\begin{proof} #1 \\end{proof}}\n \\newcommand{\\prbm}[1]{\\begin{problem} #1 \\end{problem}}\n \\newcommand{\\soln}[1]{\\begin{solution} #1 \\end{solution}}\n \\newcommand{\\rmk}[1]{\\begin{remark} #1 \\end{remark}}\n \\newcommand{\\defn}[1]{\\begin{definition} #1 \\end{definition}}\n\n \\newcommand{\\ifff}{\\LeftRightArrow}\n\n \x3c!-- For the set of reals and integers --\x3e\n \\newcommand{\\rr}{\\R}\n \\newcommand{\\reals}{\\R}\n \\newcommand{\\ii}{\\Z}\n \\newcommand{\\cc}{\\C}\n \\newcommand{\\nn}{\\N}\n \\newcommand{\\nats}{\\N}\n\n \x3c!-- For terms being indexed.\n Puts them in standard font face and creates an index entry.\n arg: The term being defined.\n \\newcommand{\\pointer}[1]{#1\\index{#1}} --\x3e\n\n \x3c!-- For bold terms to be index, but defined elsewhere\n Puts them in bold face and creates an index entry.\n arg: The term being defined. --\x3e\n \\newcommand{\\strong}[1]{\\textbf{#1}}\n\n \x3c!-- For set names.\n Puts them in italics. In math mode, yields decent spacing.\n arg: The name of the set. --\x3e\n \\newcommand{\\set}[1]{\\textit{#1}}\n\n $$\n "]);return _templateObject_67ec83207b7811efafde790a70668382=function _templateObject_67ec83207b7811efafde790a70668382(){return t},t}var s=String.raw(_templateObject_67ec83207b7811efafde790a70668382());n.default=s},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/taggedTemplateLiteral":11}],120:[function(t,e,n){(function(e){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.loadMathJax=n.getMathJax=n.DEFAULT_OPTIONS=n.DEFAULT_SCRIPT=void 0;var a=i(t("load-script")),s=e.env.MATHJAX_CDN||"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js";n.DEFAULT_SCRIPT=s;var u={TeX:{extensions:["AMSmath.js","AMSsymbols.js"]},extensions:["tex2jax.js"],showProcessingMessages:!1,jax:["input/TeX","output/HTML-CSS"],messageStyle:"none",showMathMenu:!1,showMathMenuMSIE:!1,tex2jax:{processEnvironments:!0,inlineMath:[["$","$"],["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],preview:"none",processEscapes:!0},"HTML-CSS":{linebreaks:{automatic:!0,width:"container"}}};n.DEFAULT_OPTIONS=u;n.getMathJax=function getMathJax(){return"undefined"==typeof MathJax?void 0:MathJax};n.loadMathJax=function loadMathJax(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u,i=function onLoad(){MathJax.Hub.Config(n),t()};if(!e)return i();(0,a.default)(e,i)}}).call(this,t("_process"))},{"@babel/runtime/helpers/interopRequireDefault":6,_process:100,"load-script":99}],121:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"pstricks",{enumerable:!0,get:function get(){return a.default}}),Object.defineProperty(n,"psgraph",{enumerable:!0,get:function get(){return s.default}}),n.default=void 0;var a=i(t("./lib/pstricks")),s=i(t("./lib/psgraph")),u={pstricks:a.default,psgraph:s.default};n.default=u},{"./lib/psgraph":122,"./lib/pstricks":123,"@babel/runtime/helpers/interopRequireDefault":6}],122:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireWildcard"),a=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var s=a(t("@babel/runtime/helpers/slicedToArray")),u=t("latex2js-utils"),c=i(t("d3"));function arrow(t,e,n,i){var a=Math.PI/6,s=n-t,u=i-e,c=Math.sqrt(s*s+u*u),f=Math.cos(a),h=Math.sin(a),d=8/c,p=n-(s*f-u*h)*d,g=i-(u*f+s*h)*d,v=[];return v.push("M"),v.push(n),v.push(i),v.push("L"),v.push(p),v.push(g),p=n-(s*(f=Math.cos(-a))-u*(h=Math.sin(-a)))*d,g=i-(u*f+s*h)*d,v.push(p),v.push(g),v.push("Z"),v.join(" ")}var f={getSize:function getSize(){this.env.scale=1;var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0)-20;return t<=this.env.w*this.env.xunit&&(this.env.scale=t/this.env.w/this.env.xunit),{width:this.env.w*this.env.xunit,height:this.env.h*this.env.yunit}},psframe:function psframe(t){t.append("svg:line").attr("x1",this.x1).attr("y1",this.y1).attr("x2",this.x2).attr("y2",this.y1).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1),t.append("svg:line").attr("x1",this.x2).attr("y1",this.y1).attr("x2",this.x2).attr("y2",this.y2).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1),t.append("svg:line").attr("x1",this.x2).attr("y1",this.y2).attr("x2",this.x1).attr("y2",this.y2).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1),t.append("svg:line").attr("x1",this.x1).attr("y1",this.y2).attr("x2",this.x1).attr("y2",this.y1).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1)},pscircle:function pscircle(t){t.append("svg:circle").attr("cx",this.cx).attr("cy",this.cy).attr("r",this.r).style("stroke","black").style("fill","none").style("stroke-width",2).style("stroke-opacity",1)},psplot:function psplot(t){var e=[];e.push("M"),"solid"===this.fillstyle?(e.push(this.data[0]),e.push(u.Y.call(this.global,0))):(e.push(this.data[0]),e.push(this.data[1])),e.push("L"),this.data.forEach((function(t){e.push(t)})),"solid"===this.fillstyle&&(e.push(this.data[this.data.length-2]),e.push(u.Y.call(this.global,0)),e.push("Z")),t.append("svg:path").attr("d",e.join(" ")).attr("class","psplot").style("stroke-width",this.linewidth).style("stroke-opacity",1).style("fill","none"===this.fillstyle?"none":this.fillcolor).style("stroke",this.linecolor)},pspolygon:function pspolygon(t){var e=[];e.push("M"),e.push(this.data[0]),e.push(this.data[1]),e.push("L"),this.data.forEach((function(t){e.push(t)})),e.push("Z"),t.append("svg:path").attr("d",e.join(" ")).style("stroke-width",this.linewidth).style("stroke-opacity",1).style("fill","none"===this.fillstyle?"none":this.fillcolor).style("stroke","black")},psarc:function psarc(t){var e=[];e.push("M"),e.push(this.cx),e.push(this.cy),e.push("L"),e.push(this.A.x),e.push(this.A.y),e.push("A"),e.push(this.A.x),e.push(this.A.y),e.push(0),e.push(0),e.push(0),e.push(this.B.x),e.push(this.B.y),t.append("svg:path").attr("d",e.join(" ")).style("stroke-width",2).style("stroke-opacity",1).style("fill","blue").style("stroke","black")},psaxes:function psaxes(t){var e=[this.bottomLeft[0],this.topRight[0]],n=[this.bottomLeft[1],this.topRight[1]],i=this.origin;function line(e,n,i,a){t.append("svg:path").attr("d","M "+e+" "+n+" L "+i+" "+a).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1)}var a=function xticks(){for(var t=e[0];t<=e[1];t+=this.dx)line(t,i[1]-5,t,i[1]+5)},s=function yticks(){for(var t=n[0];t<=n[1];t+=this.dy)line(i[0]-5,t,i[0]+5,t)};line(e[0],i[1],e[1],i[1]),line(i[0],n[0],i[0],n[1]),this.ticks.match(/all/)?(a(),s()):this.ticks.match(/x/)?a():this.ticks.match(/y/)&&s(),this.arrows[0]&&(t.append("path").attr("d",arrow(e[1],i[1],e[0],i[1])).style("fill","black").style("stroke","black"),t.append("path").attr("d",arrow(i[0],n[1],i[0],n[0])).style("fill","black").style("stroke","black")),this.arrows[1]&&(t.append("path").attr("d",arrow(e[0],i[1],e[1],i[1])).style("fill","black").style("stroke","black"),t.append("path").attr("d",arrow(i[0],n[0],i[0],n[1])).style("fill","black").style("stroke","black"))},psline:function psline(t){var e=this.linewidth,n=this.linecolor;this.linestyle.match(/dotted/)?function dotted(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):this.linestyle.match(/dashed/)?function dashed(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):function solid(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2),this.dots[0]&&t.append("svg:circle").attr("cx",this.x1).attr("cy",this.y1).attr("r",3).style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1),this.dots[1]&&t.append("svg:circle").attr("cx",this.x2).attr("cy",this.y2).attr("r",3).style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1);var i=this.x1,a=this.y1,s=this.x2,u=this.y2;this.arrows[0]&&t.append("path").attr("d",arrow(s,u,i,a)).style("fill",this.linecolor).style("stroke",this.linecolor),this.arrows[1]&&t.append("path").attr("d",arrow(i,a,s,u)).style("fill",this.linecolor).style("stroke",this.linecolor)},userline:function userline(t){var e=this.linewidth,n=this.linecolor;this.linestyle.match(/dotted/)?function dotted(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).attr("class","userline").style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):this.linestyle.match(/dashed/)?function dashed(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).attr("class","userline").style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):function solid(i,a,s,u){t.append("svg:path").attr("class","userline").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2),this.dots[0]&&t.append("svg:circle").attr("cx",this.x1).attr("cy",this.y1).attr("r",3).attr("class","userline").style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1),this.dots[1]&&t.append("svg:circle").attr("cx",this.x2).attr("cy",this.y2).attr("r",3).attr("class","userline").style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1);var i=this.x1,a=this.y1,s=this.x2,u=this.y2;this.arrows[0]&&t.append("path").attr("d",arrow(s,u,i,a)).attr("class","userline").style("fill",this.linecolor).style("stroke",this.linecolor),this.arrows[1]&&t.append("path").attr("d",arrow(i,a,s,u)).attr("class","userline").style("fill",this.linecolor).style("stroke",this.linecolor)},rput:function rput(t){var e=document.createElement("div"),n=this.x,i=this.y;e.innerHTML=this.text,e.className="math",e.style.visibility="hidden",e.style.position="absolute",e.style.top="".concat(i,"px"),e.style.left="".concat(n,"px"),t.appendChild(e);MathJax.Hub.Queue(["Typeset",MathJax.Hub,e],[function done(){var t=e.getBoundingClientRect(),a=t.width/2,s=t.height/2;e.style.visibility="visible",e.style.top="".concat(i-s,"px"),e.style.left="".concat(n-a,"px")}])},pspicture:function pspicture(t){var e=this,n=this.env,i=this.$el;Object.keys(this.plot).forEach((function(i){var a=e.plot[i];i.match(/rput/)||f.hasOwnProperty(i)&&a.forEach((function(e){e.data.global=n,f[i].call(e.data,t)}))})),t.on("touchmove",(function(){c.event.preventDefault(),userEvent(c.touches(this)[0])}),!1),t.on("mousemove",(function(){userEvent(c.mouse(this))}),!1);var a=this.plot;function userEvent(e){t.selectAll(".userline").remove(),t.selectAll(".psplot").remove();var i={};Object.entries(a||{}).forEach((function(t){var n=(0,s.default)(t,2),a=n[0],u=n[1];a.match(/uservariable/)&&u.forEach((function(t){t.env.userx=e[0],t.env.usery=e[1];var n=t.fn.call(t.env,t.match);i[t.data.name]=n.value}))})),Object.entries(a||{}).forEach((function(a){var u=(0,s.default)(a,2),c=u[0],h=u[1];c.match(/psplot/)&&h.forEach((function(e){Object.entries(i||{}).forEach((function(t){var n=(0,s.default)(t,2),i=n[0],a=n[1];e.env.variables[i]=a}));var a=e.fn.call(e.env,e.match);a.global={},Object.assign(a.global,n),f[c].call(a,t)})),c.match(/userline/)&&h.forEach((function(i){var a=i.fn.call(i.env,i.match);i.env.x2=e[0],i.env.y2=e[1],i.data.x2=i.env.x2,i.data.y2=i.env.y2,i.data.xExp2?(i.data.x2=a.userx2(e),i.data.x1=a.userx(e)):i.data.xExp&&(i.data.x2=a.userx(e)),i.data.yExp2?(i.data.y2=a.usery2(e),i.data.y1=a.usery(e)):i.data.yExp&&(i.data.y2=a.usery(e)),a.global={},Object.assign(a.global,n),Object.assign(a,i.data),f[c].call(a,t)}))}))}this.plot.rput.forEach((function(t){f.rput.call(t.data,i)}))}},h=f;n.default=h},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/interopRequireWildcard":7,"@babel/runtime/helpers/slicedToArray":10,d3:73,"latex2js-utils":125}],123:[function(require,module,exports){var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Functions=exports.Expressions=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_latex2jsUtils=require("latex2js-utils"),_latex2jsSettings=_interopRequireDefault(require("latex2js-settings")),Expressions={pspicture:/\\begin\{pspicture\}\(\s*(.*),(.*)\s*\)\(\s*(.*),(.*)\s*\)/,psframe:/\\psframe\(\s*(.*),(.*)\s*\)\(\s*(.*),(.*)\s*\)/,psplot:/\\psplot(\[[^\]]*\])?\{([^\}]*)\}\{([^\}]*)\}\{([^\}]*)\}/,psarc:new RegExp("\\\\psarc"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle),pscircle:/\\pscircle.*\(\s*(.*),(.*)\s*\)\{(.*)\}/,pspolygon:new RegExp("\\\\pspolygon"+_latex2jsUtils.RE.options+"(.*)"),psaxes:new RegExp("\\\\psaxes"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.coordsOpt+_latex2jsUtils.RE.coordsOpt),slider:new RegExp("\\\\slider"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle),psline:new RegExp("\\\\psline"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.coordsOpt),userline:new RegExp("\\\\userline"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.squiggleOpt+_latex2jsUtils.RE.squiggleOpt+_latex2jsUtils.RE.squiggleOpt+_latex2jsUtils.RE.squiggleOpt),uservariable:new RegExp("\\\\uservariable"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.squiggle),rput:/\\rput\((.*),(.*)\)\{(.*)\}/,psset:/\\psset\{(.*)\}/};exports.Expressions=Expressions;var Functions={slider:function slider(t){var e={scalar:1,min:Number(t[2]),max:Number(t[3]),variable:t[4],latex:t[5],value:Number(t[6])};return this.variables=this.variables||{},this.variables[e.variable]=e.value,this.sliders=this.sliders||[],this.sliders.push(e),t[1]&&Object.assign(e,(0,_latex2jsUtils.parseOptions)(t[1])),e},pspicture:function pspicture(t){var e={x0:Number(t[1]),y0:Number(t[2]),x1:Number(t[3]),y1:Number(t[4])},n={w:e.x1-e.x0,h:e.y1-e.y0};return Object.assign(this,e,n),Object.assign(e,n)},psframe:function psframe(t){return{x1:_latex2jsUtils.X.call(this,t[1]),y1:_latex2jsUtils.Y.call(this,t[2]),x2:_latex2jsUtils.X.call(this,t[3]),y2:_latex2jsUtils.Y.call(this,t[4])}},pscircle:function pscircle(t){return{cx:_latex2jsUtils.X.call(this,t[1]),cy:_latex2jsUtils.Y.call(this,t[2]),r:this.xunit*t[3]}},psaxes:function psaxes(t){var e={dx:1*this.xunit,dy:1*this.yunit,arrows:[0,0],dots:[0,0],ticks:"all"};if(t[1]){var n=(0,_latex2jsUtils.parseOptions)(t[1]);n.Dx&&(e.dx=Number(n.Dx)*this.xunit),n.Dy&&(e.dy=Number(n.Dy)*this.yunit)}var i=(0,_latex2jsUtils.parseArrows)(t[2]);return e.arrows=i.arrows,e.dots=i.dots,t[5]&&!t[8]?(e.origin=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[4])],e.bottomLeft=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[4])],e.topRight=[_latex2jsUtils.X.call(this,t[6]),_latex2jsUtils.Y.call(this,t[7])]):t[5]||t[8]?(e.origin=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[4])],e.bottomLeft=[_latex2jsUtils.X.call(this,t[6]),_latex2jsUtils.Y.call(this,t[7])],e.topRight=[_latex2jsUtils.X.call(this,t[9]),_latex2jsUtils.Y.call(this,t[10])]):(e.origin=[_latex2jsUtils.X.call(this,0),_latex2jsUtils.Y.call(this,0)],e.bottomLeft=[_latex2jsUtils.X.call(this,0),_latex2jsUtils.Y.call(this,0)],e.topRight=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[6])]),e},psplot:function psplot(m){var startX=_latex2jsUtils.evaluate.call(this,m[2]),endX=_latex2jsUtils.evaluate.call(this,m[3]),data=[],x,expression="";for(Object.entries(this.variables||{}).forEach((function(t){var e=(0,_slicedToArray2.default)(t,2),n=e[0],i=e[1];expression+="var "+n+" = "+i+";"})),expression+="with (Math){"+m[4]+"}",x=startX;x<=endX;x+=.005)data.push(_latex2jsUtils.X.call(this,x)),data.push(_latex2jsUtils.Y.call(this,eval(expression)));var obj={linecolor:"black",linestyle:"solid",fillstyle:"none",fillcolor:"none",linewidth:2};return m[1]&&Object.assign(obj,(0,_latex2jsUtils.parseOptions)(m[1])),obj.data=data,obj},pspolygon:function pspolygon(t){var e=this,n=t[2];if(n){var i=new RegExp(_latex2jsUtils.RE.coords,"g"),a=n.match(i),s=new RegExp(_latex2jsUtils.RE.coords),u=[];a.forEach((function(t){var n=s.exec(t);u.push(_latex2jsUtils.X.call(e,n[1])),u.push(_latex2jsUtils.Y.call(e,n[2]))}));var c={linecolor:"black",linestyle:"solid",fillstyle:"none",fillcolor:"black",linewidth:2,data:u};return t[1]&&Object.assign(c,(0,_latex2jsUtils.parseOptions)(t[1])),c}},psarc:function psarc(t){var e=(0,_latex2jsUtils.parseArrows)(t[2]),n={linecolor:"black",linestyle:"solid",fillstyle:"solid",fillcolor:"black",linewidth:2,arrows:e.arrows,dots:e.dots,cx:_latex2jsUtils.X.call(this,0),cy:_latex2jsUtils.Y.call(this,0)};return t[1]&&Object.assign(n,(0,_latex2jsUtils.parseOptions)(t[1])),t[3]&&(n.cx=_latex2jsUtils.X.call(this,t[3])),t[4]&&(n.cy=_latex2jsUtils.Y.call(this,t[4])),n.r=Number(t[5])*this.xunit,n.angleA=Number(t[6])*Math.PI/180,n.angleB=Number(t[7])*Math.PI/180,n.A={x:_latex2jsUtils.X.call(this,Number(t[5])*Math.cos(n.angleA)),y:_latex2jsUtils.Y.call(this,Number(t[5])*Math.sin(n.angleA))},n.B={x:_latex2jsUtils.X.call(this,Number(t[5])*Math.cos(n.angleB)),y:_latex2jsUtils.Y.call(this,Number(t[5])*Math.sin(n.angleB))},n},psline:function psline(t){var e=t[1],n=t[2],i=(0,_latex2jsUtils.parseArrows)(n),a={linecolor:"black",linestyle:"solid",fillstyle:"solid",fillcolor:"black",linewidth:2,arrows:i.arrows,dots:i.dots};return t[5]?(a.x1=_latex2jsUtils.X.call(this,t[3]),a.y1=_latex2jsUtils.Y.call(this,t[4]),a.x2=_latex2jsUtils.X.call(this,t[6]),a.y2=_latex2jsUtils.Y.call(this,t[7])):(a.x1=_latex2jsUtils.X.call(this,0),a.y1=_latex2jsUtils.Y.call(this,0),a.x2=_latex2jsUtils.X.call(this,t[3]),a.y2=_latex2jsUtils.Y.call(this,t[4])),e&&Object.assign(a,(0,_latex2jsUtils.parseOptions)(e)),"string"==typeof a.linewidth&&(a.linewidth=2),a},uservariable:function uservariable(m){var options=m[1],coords=[];this.userx&&this.usery?(coords.push(Number(this.userx)),coords.push(Number(this.usery))):(coords.push(_latex2jsUtils.X.call(this,m[3])),coords.push(_latex2jsUtils.Y.call(this,m[4])));var nx1=_latex2jsUtils.Xinv.call(this,coords[0]),ny1=_latex2jsUtils.Yinv.call(this,coords[1]),expx1="var x = "+nx1+";",expy1="var y = "+ny1+";",obj={name:m[2],x:_latex2jsUtils.X.call(this,m[3]),y:_latex2jsUtils.Y.call(this,m[4]),func:m[5],value:eval(expx1+expy1+m[5])};return obj},userline:function userline(m){var _this2=this,options=m[1],lineType=m[2],l=(0,_latex2jsUtils.parseArrows)(lineType),arrows=l.arrows,dots=l.dots,xExp=m[7],yExp=m[8];xExp&&(xExp="with (Math){"+xExp.replace(/^\{/,"").replace(/\}$/,"")+"}"),yExp&&(yExp="with (Math){"+yExp.replace(/^\{/,"").replace(/\}$/,"")+"}");var xExp2=m[9],yExp2=m[10];xExp2&&(xExp2="with (Math){"+xExp2.replace(/^\{/,"").replace(/\}$/,"")+"}"),yExp2&&(yExp2="with (Math){"+yExp2.replace(/^\{/,"").replace(/\}$/,"")+"}");var expression="";Object.entries(this.variables||{}).forEach((function(t){var e=(0,_slicedToArray2.default)(t,2),n=e[0],i=e[1];expression+="var "+n+" = "+i+";"}));var obj={x1:_latex2jsUtils.X.call(this,m[3]),y1:_latex2jsUtils.Y.call(this,m[4]),x2:_latex2jsUtils.X.call(this,m[5]),y2:_latex2jsUtils.Y.call(this,m[6]),xExp,yExp,xExp2,yExp2,userx:function userx(coords){var nx1=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny1=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx1="var x = "+nx1+";",expy1="var y = "+ny1+";";return _latex2jsUtils.X.call(_this2,eval(expression+expy1+expx1+xExp))},usery:function usery(coords){var nx2=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny2=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx2="var x = "+nx2+";",expy2="var y = "+ny2+";";return _latex2jsUtils.Y.call(_this2,eval(expression+expy2+expx2+yExp))},userx2:function userx2(coords){var nx3=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny3=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx3="var x = "+nx3+";",expy3="var y = "+ny3+";";return _latex2jsUtils.X.call(_this2,eval(expression+expy3+expx3+xExp2))},usery2:function usery2(coords){var nx4=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny4=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx4="var x = "+nx4+";",expy4="var y = "+ny4+";";return _latex2jsUtils.Y.call(_this2,eval(expression+expy4+expx4+yExp2))},linecolor:"black",linestyle:"solid",fillstyle:"solid",fillcolor:"black",linewidth:2,arrows,dots};return options&&Object.assign(obj,(0,_latex2jsUtils.parseOptions)(options)),"string"==typeof obj.linewidth&&(obj.linewidth=2),obj},rput:function rput(t){return{x:_latex2jsUtils.X.call(this,t[1]),y:_latex2jsUtils.Y.call(this,t[2]),text:t[3]}},psset:function psset(t){var e=t[1].split(",").map((function(t){return t.split("=")})),n={};return e.forEach((function(t){var e=t[0],i=t[1];Object.keys(_latex2jsSettings.default.Expressions).forEach((function(t){var a=_latex2jsSettings.default.Expressions[t];e.match(a)&&_latex2jsSettings.default.Functions[t](n,i)}))})),n}};exports.Functions=Functions;var _default={Expressions,Functions};exports.default=_default},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/slicedToArray":10,"latex2js-settings":124,"latex2js-utils":125}],124:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Functions=n.Expressions=void 0;var i=t("latex2js-utils"),a={fillcolor:/^fillcolor$/,fillstyle:/^fillstyle$/,linecolor:/^linecolor$/,linestyle:/^linestyle$/,unit:/^unit/,runit:/^runit/,xunit:/^xunit/,yunit:/^yunit/};n.Expressions=a;var s={fillcolor:function fillcolor(t,e){t.fillcolor=e},fillstyle:function fillstyle(t,e){t.fillstyle=e},linecolor:function linecolor(t,e){t.linecolor=e},linestyle:function linestyle(t,e){t.linestyle=e},unit:function unit(t,e){e=(0,i.convertUnits)(e),t.unit=e,t.runit=e,t.xunit=e,t.yunit=e},runit:function runit(t,e){e=(0,i.convertUnits)(e),t.runit=e},xunit:function xunit(t,e){e=(0,i.convertUnits)(e),t.xunit=e},yunit:function yunit(t,e){e=(0,i.convertUnits)(e),t.yunit=e}};n.Functions=s;var u={Expressions:a,Functions:s};n.default=u},{"latex2js-utils":125}],125:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.Yinv=exports.Y=exports.Xinv=exports.X=exports.evaluate=exports.parseArrows=exports.parseOptions=exports.RE=exports.convertUnits=exports.matchrepl=exports.simplerepl=void 0;var simplerepl=function simplerepl(t,e){return function(n,i){return i.replace(t,e)}};exports.simplerepl=simplerepl;var matchrepl=function matchrepl(t,e){return function(n,i){return Array.isArray(n)&&n.forEach((function(n){var a=n.match(t);i=i.replace(a.input,e(a))})),i}};exports.matchrepl=matchrepl;var convertUnits=function convertUnits(t){var e=null;return(e=t.match(/([^c]+)\s*cm/))?50*Number(e[1]):(e=t.match(/([^i]+)\s*in/))?20*Number(e[1]):(e=t.match(/(.*)/))?50*Number(e[1]):Number(t)};exports.convertUnits=convertUnits;var RE={options:"(\\[[^\\]]*\\])?",type:"(\\{[^\\}]*\\})?",squiggle:"\\{([^\\}]*)\\}",squiggleOpt:"(\\{[^\\}]*\\})?",coordsOpt:"(\\(\\s*([^\\)]*),([^\\)]*)\\s*\\))?",coords:"\\(\\s*([^\\)]*),([^\\)]*)\\s*\\)"};exports.RE=RE;var parseOptions=function parseOptions(t){var e=t.replace(/[\]\[]/g,"").split(","),n={};return e.forEach((function(t){var e=t.split("=");2==e.length&&(n[e[0].trim()]=e[1].trim())})),n};exports.parseOptions=parseOptions;var parseArrows=function parseArrows(t){var e=[0,0],n=[0,0];if(t){var i=t.match(/\{([^\-]*)?\-([^\-]*)?\}/);i&&(i[1]&&(i[1].match(/\*/)?n[0]=1:i[1].match(//)&&(e[1]=1)))}return{arrows:e,dots:n}};exports.parseArrows=parseArrows;var evaluate=function evaluate(exp){var _this=this,num=Number(exp);if(isNaN(num)){var expression="";return this.variables=this.variables||{},Object.keys(this.variables).map((function(t){var e=_this.variables[t];expression+="var "+t+" = "+e+";"})),expression+="with (Math){"+exp+"}",eval(expression)}return num};exports.evaluate=evaluate;var X=function X(t){return(this.w-(this.x1-Number(t)))*this.xunit};exports.X=X;var Xinv=function Xinv(t){return Number(t)/this.xunit-this.w+this.x1};exports.Xinv=Xinv;var Y=function Y(t){return(this.y1-Number(t))*this.yunit};exports.Y=Y;var Yinv=function Yinv(t){return this.y1-Number(t)/this.yunit};exports.Yinv=Yinv},{}],126:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("@babel/runtime/helpers/classCallCheck")),s=i(t("@babel/runtime/helpers/createClass")),u=i(t("./lib/text")),c=i(t("./lib/headers")),f=t("latex2js-pstricks"),h=i(t("./lib/environments")),d=i(t("./lib/ignore")),p=i(t("./lib/parser")),g=function(){function LaTeX2HTML5(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.default,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.default,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:f.pstricks,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(0,a.default)(this,LaTeX2HTML5),this.Text=e,this.Headers=n,this.Environments=i,this.Ignore=s,this.PSTricks=p,this.Views=g,this.Delimiters={},i.forEach((function(e){t.addEnvironment(e)}))}return(0,s.default)(LaTeX2HTML5,[{key:"addEnvironment",value:function addEnvironment(t){var e={begin:new RegExp("\\\\begin\\{"+t+"\\}"),end:new RegExp("\\\\end\\{"+t+"\\}")};this.Delimiters[t]=e}},{key:"addView",value:function addView(t,e){this.addEnvironment(t)}},{key:"addText",value:function addText(t,e,n){this.Text.Expressions[t]=e,this.Text.Functions[t]=n}},{key:"addHeaders",value:function addHeaders(t,e,n){var i={},a=t+"begin",s=t+"end";i[a]=new RegExp("\\\\begin\\{"+t+"\\}"),i[s]=new RegExp("\\\\end\\{"+t+"\\}"),Object.assign(this.Headers.Expressions,i);var u={};u[a]=function(){return e||""},u[s]=function(){return n||""},Object.assign(this.Headers.Functions,u)}},{key:"getParser",value:function getParser(){return new p.default(this)}},{key:"parse",value:function parse(t){var e=new p.default(this).parse(t);return e.forEach((function(t){if(!t.hasOwnProperty("type"))throw new Error("no type!")})),e}}]),LaTeX2HTML5}();n.default=g},{"./lib/environments":127,"./lib/headers":128,"./lib/ignore":129,"./lib/parser":130,"./lib/text":131,"@babel/runtime/helpers/classCallCheck":3,"@babel/runtime/helpers/createClass":4,"@babel/runtime/helpers/interopRequireDefault":6,"latex2js-pstricks":121}],127:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=["pspicture","verbatim","enumerate","print","nicebox"]},{}],128:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Functions=n.Expressions=void 0;var i={bq:/\\begin\{quotation\}/,claim:/\\begin\{claim\}/,corollary:/\\begin\{corollary\}/,definition:/\\begin\{definition\}/,endclaim:/\\end\{claim\}/,endcorallary:/\\end\{corallary\}/,enddefinition:/\\end\{definition\}/,endexample:/\\end\{example\}/,endproblem:/\\end\{problem\}/,endsolution:/\\end\{solution\}/,endtheorem:/\\end\{theorem\}/,eq:/\\end\{quotation\}/,example:/\\begin\{example\}/,problem:/\\begin\{problem\}/,proof:/\\begin\{proof\}/,qed:/\\end\{proof\}/,solution:/\\begin\{solution\}/,theorem:/\\begin\{theorem\}/};n.Expressions=i;var a={bq:function bq(){return'

'},claim:function claim(){return"

Claim

"},corollary:function corollary(){return"

Corollary

"},definition:function definition(){return"

Definition

"},endclaim:function endclaim(){return""},endcorollary:function endcorollary(){return""},enddefinition:function enddefinition(){return""},endexample:function endexample(){return""},endproblem:function endproblem(){return""},endsolution:function endsolution(){return""},endtheorem:function endtheorem(){return""},eq:function eq(){return"

"},example:function example(){return"

Example

"},problem:function problem(){return"

Problem

"},proof:function proof(){return"

Proof

"},qed:function qed(){return"$\\qed$"},solution:function solution(){return"

Solution

"},theorem:function theorem(){return"

Theorem

"}};n.Functions=a;var s={Expressions:i,Functions:a};n.default=s},{}],129:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=[/^\%/,/\\begin\{document\}/,/\\end\{document\}/,/\\begin\{interactive\}/,/\\end\{interactive\}/,/\\usepackage/,/\\documentclass/,/\\tableofcontents/,/\\author/,/\\date/,/\\maketitle/,/\\title/,/\\pagestyle/,/\\smallskip/,/\\medskip/,/\\bigskip/,/\\nobreak/,/\\begin\{center\}/,/\\end\{center\}/]},{}],130:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("@babel/runtime/helpers/slicedToArray")),s=i(t("@babel/runtime/helpers/defineProperty"));function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Parser(t){this.Ignore=t.Ignore,this.Delimiters=t.Delimiters,this.Text=t.Text,this.PSTricks=t.PSTricks,this.Headers=t.Headers,this.objects=[],this.environment=null,this.settings=this.PSTricks.Functions.psset.call(this,["","units=1cm,linecolor=black,linestyle=solid,fillstyle=none"])}Parser.prototype={parse:function parse(t){var e=this;if(!t)return{};var n=t.split("\n");return this.parseEnvText(n),this.parseEnv(n),this.objects.forEach((function(t){t.type.match(/pspicture/)&&(t.plot=e.parsePSTricks(t.lines,t.env))})),this.objects},newEnvironment:function newEnvironment(t){this.environment&&this.environment.lines.length&&(this.environment.settings=function _objectSpread(t){for(var e=1;e"))}))},parsePSExpression:function parsePSExpression(t,e,n,i,a){var s=t.match(e);return!!s&&(n[i].push({data:this.PSTricks.Functions[i].call(a,s),env:a,match:s,fn:this.PSTricks.Functions[i]}),!0)},parsePSVariables:function parsePSVariables(t,e,n,i,a){var s=t.match(e);if(s&&i.match(/uservariable/)){var u=this.PSTricks.Functions[i].call(a,s);a.variables=a.variables||{},a.variables[u.name]=u.value}},parsePSTricks:function parsePSTricks(t,e){var n=this,i={},s=Object.entries(this.PSTricks.Expressions);return s.forEach((function(t){var e=(0,a.default)(t,2),n=e[0];e[1];i[n]=[]})),t.forEach((function(t){s.forEach((function(s){var u=(0,a.default)(s,2),c=u[0],f=u[1];n.parsePSVariables(t,f,i,c,e),n.parsePSExpression(t,f,i,c,e)}))})),i},parseTextExpression:function parseTextExpression(t,e,n,i){var a=t.match(e);return a?this.Text.Functions[n].call(this,a,i):i},parseHeadersExpression:function parseHeadersExpression(t,e,n,i){return t.match(e)?this.Headers.Functions[n].call(this):i},parseText:function parseText(t){var e=this,n=t;return Object.entries(this.Text.Expressions).forEach((function(i){var s=(0,a.default)(i,2),u=s[0],c=s[1];n=e.parseTextExpression(t,c,u,n)})),Object.entries(this.Headers.Expressions).forEach((function(i){var s=(0,a.default)(i,2),u=s[0],c=s[1];n=e.parseHeadersExpression(t,c,u,n)})),n}};var u=Parser;n.default=u},{"@babel/runtime/helpers/defineProperty":5,"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/slicedToArray":10}],131:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Functions=n.Expressions=void 0;var i=t("latex2js-utils"),a={emph:/\\emph\{[^}]*\}/g,bf:/\{*\\bf [^}]*\}/g,rm:/\{*\\rm [^}]*\}/g,sl:/\{*\\sl [^}]*\}/g,it:/\{*\\it [^}]*\}/g,tt:/\{*\\tt [^}]*\}/g,mdash:/---/g,ndash:/--/g,openq:/``/g,closeq:/''/g,TeX:/\\TeX\\|\\TeX/g,LaTeX:/\\LaTeX\\|\\LaTeX/g,vspace:/\\vspace/g,cite:/\\cite\[\d+\]\{[^}]*\}/g,href:/\\href\{[^}]*\}\{[^}]*\}/g,img:/\\img\{[^}]*\}/g,set:/\\set\{[^}]*\}/g,youtube:/\\youtube\{[^}]*\}/g,euler:/Euler\^/g};n.Expressions=a;var s={cite:function cite(t,e){return t.forEach((function(t){var n=t.match(/\\cite\[(\d+)\]\{([^}]*)\}/),i=location.pathname.match(/\/books\/(\d+)\//),a=0;i&&(a=i[1]),e=e.replace(n.input,'[p'+n[1]+"]")})),e},img:(0,i.matchrepl)(/\\img\{([^}]*)\}/,(function(t){return'
'})),youtube:(0,i.matchrepl)(/\\youtube\{([^}]*)\}/,(function(t){return'
'})),href:(0,i.matchrepl)(/\\href\{([^}]*)\}\{([^}]*)\}/,(function(t){return''+t[2]+""})),set:(0,i.matchrepl)(/\\set\{([^}]*)\}/,(function(t){return""+t[1]+""})),euler:(0,i.simplerepl)(/Euler\^/,"exp"),emph:(0,i.matchrepl)(/\{([^}]*)\}/,(function(t){return""+t[1]+""})),bf:(0,i.matchrepl)(/\{*\\bf ([^}]*)\}/,(function(t){return""+t[1]+""})),rm:(0,i.matchrepl)(/\{*\\rm ([^}]*)\}/,(function(t){return''+t[1]+""})),sl:(0,i.matchrepl)(/\{*\\sl ([^}]*)\}/,(function(t){return""+t[1]+""})),it:(0,i.matchrepl)(/\{*\\it ([^}]*)\}/,(function(t){return""+t[1]+""})),tt:(0,i.matchrepl)(/\{*\\tt ([^}]*)\}/,(function(t){return''+t[1]+""})),ndash:(0,i.simplerepl)(/--/g,"–"),mdash:(0,i.simplerepl)(/---/g,"—"),openq:(0,i.simplerepl)(/``/g,"“"),closeq:(0,i.simplerepl)(/''/g,"”"),vspace:(0,i.simplerepl)(/\\vspace/g,"
"),TeX:(0,i.simplerepl)(/\\TeX\\|\\TeX/g,"$\\TeX$"),LaTeX:(0,i.simplerepl)(/\\LaTeX\\|\\LaTeX/g,"$\\LaTeX$")};n.Functions=s;var u={Expressions:a,Functions:s};n.default=u},{"latex2js-utils":125}]},{},[118])(118)})); \ No newline at end of file +var a=t("url"),s=t("child_process").spawn,u=t("fs");n.XMLHttpRequest=function(){var n,c,f=this,h=t("http"),d=t("https"),p={},g=!1,v={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},b={},_={},w=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],M=["TRACE","TRACK","CONNECT"],E=!1,T=!1,S={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null,this.withCredentials=!1;this.open=function(t,e,n,i,a){if(this.abort(),T=!1,!function(t){return t&&-1===M.indexOf(t)}(t))throw new Error("SecurityError: Request method not allowed");p={method:t,url:e.toString(),async:"boolean"!=typeof n||n,user:i||null,password:a||null},setState(this.OPENED)},this.setDisableHeaderCheck=function(t){g=t},this.setRequestHeader=function(t,e){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(function(t){return g||t&&-1===w.indexOf(t.toLowerCase())}(t)){if(E)throw new Error("INVALID_STATE_ERR: send flag is true");t=_[t.toLowerCase()]||t,_[t.toLowerCase()]=t,b[t]=b[t]?b[t]+", "+e:e}else console.warn('Refused to set unsafe header "'+t+'"')},this.getResponseHeader=function(t){return"string"==typeof t&&this.readyState>this.OPENED&&c&&c.headers&&c.headers[t.toLowerCase()]&&!T?c.headers[t.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState"+e[1]+"":t})).join("\n"),n=document.createElement("ul");return n.className="math",n.innerHTML=e,n}},{}],112:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("div");return e.id="latex-macros",e.style.display="none",e.className="verbatim",e.innerHTML=a.default,e};var a=i(t("latex2js-macros"))},{"@babel/runtime/helpers/interopRequireDefault":6,"latex2js-macros":119}],113:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("span");return e.className="math",e.innerHTML=t.lines.join("\n"),e}},{}],114:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("span");return e.className="math nicebox",e.innerHTML=t.lines.join("\n"),e}},{}],115:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireWildcard"),a=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=u.psgraph.getSize.call(t),n=("width: ".concat(e.width,"px; height: ").concat(e.height,"px;"),"".concat(e.width,"px")),i="".concat(e.height,"px"),a=document.createElement("div");a.className="pspicture",a.style.width=n,a.style.height=i;var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",n),f.setAttribute("height",i);var h=c.select(f);t.$el=a,u.psgraph.pspicture.call(t,h),a.appendChild(f);var d=t.env,p=t.plot,g=d.sliders;g&&g.length&&g.forEach((function(t){var e=t.latex,n=t.scalar,i=t.variable,c=t.value,f=t.min,g=t.max,v=document.createElement("label"),b=document.createTextNode(e),_=document.createElement("input");_.setAttribute("min",f*n),_.setAttribute("max",g*n),_.setAttribute("type","range"),_.setAttribute("value",c),v.appendChild(b),v.appendChild(_),a.appendChild(v),_.addEventListener("input",(function(t){!function onChange(t){var e=t.target.value/n;d.variables[i]=e,h.selectAll(".psplot").remove(),Object.entries(p).forEach((function(t){var e=(0,s.default)(t,2),n=e[0],i=e[1];n.match(/psplot/)&&i.forEach((function(t){var e=t.fn.call(t.env,t.match);u.psgraph[n]&&e&&h&&u.psgraph[n].call(e,h)}))}))}(t)}))}));return a};var s=a(t("@babel/runtime/helpers/slicedToArray")),u=t("latex2js-pstricks"),c=i(t("d3"))},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/interopRequireWildcard":7,"@babel/runtime/helpers/slicedToArray":10,d3:73,"latex2js-pstricks":121}],116:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){return document.createElement("input")}},{}],117:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function render(t){var e=document.createElement("pre");return e.className="verbatim",e.innerHTML=t.lines.join("\n"),e}},{}],118:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=render,Object.defineProperty(n,"pspicture",{enumerable:!0,get:function get(){return u.default}}),Object.defineProperty(n,"nicebox",{enumerable:!0,get:function get(){return c.default}}),Object.defineProperty(n,"enumerate",{enumerable:!0,get:function get(){return f.default}}),Object.defineProperty(n,"verbatim",{enumerable:!0,get:function get(){return h.default}}),Object.defineProperty(n,"math",{enumerable:!0,get:function get(){return d.default}}),Object.defineProperty(n,"macros",{enumerable:!0,get:function get(){return p.default}}),n.init=void 0;var a=i(t("latex2js")),s=t("latex2js-mathjax"),u=i(t("./components/pspicture")),c=i(t("./components/nicebox")),f=i(t("./components/enumerate")),h=i(t("./components/verbatim")),d=(i(t("./components/slider")),i(t("./components/math"))),p=i(t("./components/macros")),g={pspicture:u.default,nicebox:c.default,enumerate:f.default,verbatim:h.default,math:d.default,macros:p.default};function render(t,e){var n=function done(){var n=(new a.default).parse(t),i=document.createElement("div");i.className="latex-container",n&&n.forEach&&n.forEach((function(t){g.hasOwnProperty(t.type)&&i.appendChild(g[t.type](t))})),e(i)};if((0,s.getMathJax)())return n();(0,s.loadMathJax)(n)}n.init=function init(){(0,s.loadMathJax)(),document.querySelectorAll("la-tex:not([hydrated])").forEach((function(t){render(t.innerHTML,(function(e){t.shadowRoot.querySelector(".wrapper").innerHTML="",t.shadowRoot.querySelector(".wrapper").appendChild(e),t.hydrated=!0}))}))}},{"./components/enumerate":111,"./components/macros":112,"./components/math":113,"./components/nicebox":114,"./components/pspicture":115,"./components/slider":116,"./components/verbatim":117,"@babel/runtime/helpers/interopRequireDefault":6,latex2js:126,"latex2js-mathjax":120}],119:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("@babel/runtime/helpers/taggedTemplateLiteral"));function _templateObject_bda82fd08a6911ef92e7a36ece546115(){var t=(0,a.default)(["\n $$\n % create the definition symbol\n def\bydef{stackrel{Delta}{=}}\n %defcircconv{otimes}\n defcircconv{circledast}\n\n \newcommand{qed}{mbox{ } Box}\n\n\n \newcommand{infint}{int_{-infty}^{infty}}\n\n % z transform\n \newcommand{ztp}{ ~~ mathop{mathcal{Z}}limits_{longleftrightarrow} ~~ }\n \newcommand{iztp}{ ~~ mathop{mathcal{Z}^{-1}}limits_{longleftrightarrow} ~~ }\n % fourier transform pair\n \newcommand{\ftp}{ ~~ mathop{mathcal{F}}limits_{longleftrightarrow} ~~ }\n \newcommand{iftp}{ ~~ mathop{mathcal{F}^{-1}}limits_{longleftrightarrow} ~~ }\n % laplace transform\n \newcommand{ltp}{ ~~ mathop{mathcal{L}}limits_{longleftrightarrow} ~~ }\n \newcommand{iltp}{ ~~ mathop{mathcal{L}^{-1}}limits_{longleftrightarrow} ~~ }\n\n \newcommand{\ftrans}[1]{ mathcal{F} left{#1\right} }\n \newcommand{iftrans}[1]{ mathcal{F}^{-1} left{#1\right} }\n \newcommand{ztrans}[1]{ mathcal{Z} left{#1\right} }\n \newcommand{iztrans}[1]{ mathcal{Z}^{-1} left{#1\right} }\n \newcommand{ltrans}[1]{ mathcal{L} left{#1\right} }\n \newcommand{iltrans}[1]{ mathcal{L}^{-1} left{#1\right} }\n\n\n % coordinate vector relative to a basis (linear algebra)\n \newcommand{cvrb}[2]{left[ \vec{#1} \right]_{#2} }\n % change of coordinate matrix (linear algebra)\n \newcommand{cocm}[2]{ mathop{P}limits_{#2 leftarrow #1} }\n % Transformed vector set\n \newcommand{\tset}[3]{{#1lr{\vec{#2}_1}, #1lr{\vec{#2}_2}, dots, #1lr{\vec{#2}_{#3}}}}\n % sum transformed vector set\n \newcommand{\tsetcsum}[4]{{#1}_1#2(\vec{#3}_1) + {#1}_2#2(\vec{#3}_2) + cdots + {#1}_{#4}#2(\vec{#3}_{#4})}\n \newcommand{\tsetcsumall}[4]{#2lr{{#1}_1\vec{#3}_1 + {#1}_2\vec{#3}_2 + cdots + {#1}_{#4}\vec{#3}_{#4}}}\n \newcommand{cvecsum}[3]{{#1}_1\vec{#2}_1 + {#1}_2\vec{#2}_2 + cdots + {#1}_{#3}\vec{#2}_{#3}}\n\n\n % function def\n \newcommand{\fndef}[3]{#1:#2 \to #3}\n % vector set\n \newcommand{\vset}[2]{{\vec{#1}_1, \vec{#1}_2, dots, \vec{#1}_{#2}}}\n % absolute value\n \newcommand{abs}[1]{left| #1 \right|}\n % vector norm\n \newcommand{\norm}[1]{left|left| #1 \right|\right|}\n % trans\n \newcommand{\trans}{mapsto}\n % evaluate integral\n \newcommand{evalint}[3]{left. #1 \right|_{#2}^{#3}}\n % slist\n \newcommand{slist}[2]{{#1}_{1},{#1}_{2},dots,{#1}_{#2}}\n\n % vectors\n \newcommand{\vc}[1]{\textbf{#1}}\n\n % real\n \newcommand{Real}[1]{{Re mit{e}left{{#1}\right}}}\n % imaginary\n \newcommand{Imag}[1]{{Im mit{m}left{{#1}\right}}}\n\n \newcommand{mcal}[1]{mathcal{#1}}\n \newcommand{\bb}[1]{mathbb{#1}}\n \newcommand{N}{mathbb{N}}\n \newcommand{Z}{mathbb{Z}}\n \newcommand{Q}{mathbb{Q}}\n \newcommand{R}{mathbb{R}}\n \newcommand{C}{mathbb{C}}\n \newcommand{I}{mathbb{I}}\n \newcommand{Th}[1]{mathopmathrm{Th(#1)}}\n \newcommand{intersect}{cap}\n \newcommand{\\union}{cup}\n \newcommand{intersectop}{\bigcap}\n \newcommand{\\unionop}{\bigcup}\n \newcommand{setdiff}{\backslash}\n \newcommand{iso}{cong}\n \newcommand{aut}[1]{mathop{mathrm{Aut(#1)}}}\n \newcommand{inn}[1]{mathop{mathrm{Inn(#1)}}}\n \newcommand{Ann}[1]{mathop{mathrm{Ann(#1)}}}\n \newcommand{dom}[1]{mathop{mathrm{dom} #1}}\n \newcommand{cod}[1]{mathop{mathrm{cod} #1}}\n \newcommand{id}{mathrm{id}}\n \newcommand{st}{ | }\n \newcommand{mbf}[1]{mathbf{#1}}\n \newcommand{enclose}[1]{leftlangle #1\right\rangle}\n \newcommand{lr}[1]{left( #1\right)}\n \newcommand{lrsq}[1]{left[ #1\right]}\n \newcommand{op}{mathrm{op}}\n \newcommand{dotarr}{dot{\rightarrow}}\n %Category Names:\n \newcommand{Grp}{mathbf{Grp}}\n \newcommand{Ab}{mathbf{Ab}}\n \newcommand{Set}{mathbf{Set}}\n \newcommand{Matr}{mathbf{Matr}}\n \newcommand{IntDom}{mathbf{IntDom}}\n \newcommand{Field}{mathbf{Field}}\n \newcommand{Vect}{mathbf{Vect}}\n\n \newcommand{\thm}[1]{\begin{theorem} #1 end{theorem}}\n \newcommand{clm}[1]{\begin{claim} #1 end{claim}}\n \newcommand{cor}[1]{\begin{corollary} #1 end{corollary}}\n \newcommand{ex}[1]{\begin{example} #1 end{example}}\n \newcommand{prf}[1]{\begin{proof} #1 end{proof}}\n \newcommand{prbm}[1]{\begin{problem} #1 end{problem}}\n \newcommand{soln}[1]{\begin{solution} #1 end{solution}}\n \newcommand{\rmk}[1]{\begin{remark} #1 end{remark}}\n \newcommand{defn}[1]{\begin{definition} #1 end{definition}}\n\n \newcommand{ifff}{LeftRightArrow}\n\n \x3c!-- For the set of reals and integers --\x3e\n \newcommand{\rr}{R}\n \newcommand{\reals}{R}\n \newcommand{ii}{Z}\n \newcommand{cc}{C}\n \newcommand{\nn}{N}\n \newcommand{\nats}{N}\n\n \x3c!-- For terms being indexed.\n Puts them in standard font face and creates an index entry.\n arg: The term being defined.\n \newcommand{pointer}[1]{#1index{#1}} --\x3e\n\n \x3c!-- For bold terms to be index, but defined elsewhere\n Puts them in bold face and creates an index entry.\n arg: The term being defined. --\x3e\n \newcommand{strong}[1]{\textbf{#1}}\n\n \x3c!-- For set names.\n Puts them in italics. In math mode, yields decent spacing.\n arg: The name of the set. --\x3e\n \newcommand{set}[1]{\textit{#1}}\n\n $$\n "],["\n $$\n % create the definition symbol\n \\def\\bydef{\\stackrel{\\Delta}{=}}\n %\\def\\circconv{\\otimes}\n \\def\\circconv{\\circledast}\n\n \\newcommand{\\qed}{\\mbox{ } \\Box}\n\n\n \\newcommand{\\infint}{\\int_{-\\infty}^{\\infty}}\n\n % z transform\n \\newcommand{\\ztp}{ ~~ \\mathop{\\mathcal{Z}}\\limits_{\\longleftrightarrow} ~~ }\n \\newcommand{\\iztp}{ ~~ \\mathop{\\mathcal{Z}^{-1}}\\limits_{\\longleftrightarrow} ~~ }\n % fourier transform pair\n \\newcommand{\\ftp}{ ~~ \\mathop{\\mathcal{F}}\\limits_{\\longleftrightarrow} ~~ }\n \\newcommand{\\iftp}{ ~~ \\mathop{\\mathcal{F}^{-1}}\\limits_{\\longleftrightarrow} ~~ }\n % laplace transform\n \\newcommand{\\ltp}{ ~~ \\mathop{\\mathcal{L}}\\limits_{\\longleftrightarrow} ~~ }\n \\newcommand{\\iltp}{ ~~ \\mathop{\\mathcal{L}^{-1}}\\limits_{\\longleftrightarrow} ~~ }\n\n \\newcommand{\\ftrans}[1]{ \\mathcal{F} \\left\\{#1\\right\\} }\n \\newcommand{\\iftrans}[1]{ \\mathcal{F}^{-1} \\left\\{#1\\right\\} }\n \\newcommand{\\ztrans}[1]{ \\mathcal{Z} \\left\\{#1\\right\\} }\n \\newcommand{\\iztrans}[1]{ \\mathcal{Z}^{-1} \\left\\{#1\\right\\} }\n \\newcommand{\\ltrans}[1]{ \\mathcal{L} \\left\\{#1\\right\\} }\n \\newcommand{\\iltrans}[1]{ \\mathcal{L}^{-1} \\left\\{#1\\right\\} }\n\n\n % coordinate vector relative to a basis (linear algebra)\n \\newcommand{\\cvrb}[2]{\\left[ \\vec{#1} \\right]_{#2} }\n % change of coordinate matrix (linear algebra)\n \\newcommand{\\cocm}[2]{ \\mathop{P}\\limits_{#2 \\leftarrow #1} }\n % Transformed vector set\n \\newcommand{\\tset}[3]{\\{#1\\lr{\\vec{#2}_1}, #1\\lr{\\vec{#2}_2}, \\dots, #1\\lr{\\vec{#2}_{#3}}\\}}\n % sum transformed vector set\n \\newcommand{\\tsetcsum}[4]{{#1}_1#2(\\vec{#3}_1) + {#1}_2#2(\\vec{#3}_2) + \\cdots + {#1}_{#4}#2(\\vec{#3}_{#4})}\n \\newcommand{\\tsetcsumall}[4]{#2\\lr{{#1}_1\\vec{#3}_1 + {#1}_2\\vec{#3}_2 + \\cdots + {#1}_{#4}\\vec{#3}_{#4}}}\n \\newcommand{\\cvecsum}[3]{{#1}_1\\vec{#2}_1 + {#1}_2\\vec{#2}_2 + \\cdots + {#1}_{#3}\\vec{#2}_{#3}}\n\n\n % function def\n \\newcommand{\\fndef}[3]{#1:#2 \\to #3}\n % vector set\n \\newcommand{\\vset}[2]{\\{\\vec{#1}_1, \\vec{#1}_2, \\dots, \\vec{#1}_{#2}\\}}\n % absolute value\n \\newcommand{\\abs}[1]{\\left| #1 \\right|}\n % vector norm\n \\newcommand{\\norm}[1]{\\left|\\left| #1 \\right|\\right|}\n % trans\n \\newcommand{\\trans}{\\mapsto}\n % evaluate integral\n \\newcommand{\\evalint}[3]{\\left. #1 \\right|_{#2}^{#3}}\n % slist\n \\newcommand{\\slist}[2]{{#1}_{1},{#1}_{2},\\dots,{#1}_{#2}}\n\n % vectors\n \\newcommand{\\vc}[1]{\\textbf{#1}}\n\n % real\n \\newcommand{\\Real}[1]{{\\Re \\mit{e}\\left\\{{#1}\\right\\}}}\n % imaginary\n \\newcommand{\\Imag}[1]{{\\Im \\mit{m}\\left\\{{#1}\\right\\}}}\n\n \\newcommand{\\mcal}[1]{\\mathcal{#1}}\n \\newcommand{\\bb}[1]{\\mathbb{#1}}\n \\newcommand{\\N}{\\mathbb{N}}\n \\newcommand{\\Z}{\\mathbb{Z}}\n \\newcommand{\\Q}{\\mathbb{Q}}\n \\newcommand{\\R}{\\mathbb{R}}\n \\newcommand{\\C}{\\mathbb{C}}\n \\newcommand{\\I}{\\mathbb{I}}\n \\newcommand{\\Th}[1]{\\mathop\\mathrm{Th(#1)}}\n \\newcommand{\\intersect}{\\cap}\n \\newcommand{\\\\union}{\\cup}\n \\newcommand{\\intersectop}{\\bigcap}\n \\newcommand{\\\\unionop}{\\bigcup}\n \\newcommand{\\setdiff}{\\backslash}\n \\newcommand{\\iso}{\\cong}\n \\newcommand{\\aut}[1]{\\mathop{\\mathrm{Aut(#1)}}}\n \\newcommand{\\inn}[1]{\\mathop{\\mathrm{Inn(#1)}}}\n \\newcommand{\\Ann}[1]{\\mathop{\\mathrm{Ann(#1)}}}\n \\newcommand{\\dom}[1]{\\mathop{\\mathrm{dom} #1}}\n \\newcommand{\\cod}[1]{\\mathop{\\mathrm{cod} #1}}\n \\newcommand{\\id}{\\mathrm{id}}\n \\newcommand{\\st}{\\ |\\ }\n \\newcommand{\\mbf}[1]{\\mathbf{#1}}\n \\newcommand{\\enclose}[1]{\\left\\langle #1\\right\\rangle}\n \\newcommand{\\lr}[1]{\\left( #1\\right)}\n \\newcommand{\\lrsq}[1]{\\left[ #1\\right]}\n \\newcommand{\\op}{\\mathrm{op}}\n \\newcommand{\\dotarr}{\\dot{\\rightarrow}}\n %Category Names:\n \\newcommand{\\Grp}{\\mathbf{Grp}}\n \\newcommand{\\Ab}{\\mathbf{Ab}}\n \\newcommand{\\Set}{\\mathbf{Set}}\n \\newcommand{\\Matr}{\\mathbf{Matr}}\n \\newcommand{\\IntDom}{\\mathbf{IntDom}}\n \\newcommand{\\Field}{\\mathbf{Field}}\n \\newcommand{\\Vect}{\\mathbf{Vect}}\n\n \\newcommand{\\thm}[1]{\\begin{theorem} #1 \\end{theorem}}\n \\newcommand{\\clm}[1]{\\begin{claim} #1 \\end{claim}}\n \\newcommand{\\cor}[1]{\\begin{corollary} #1 \\end{corollary}}\n \\newcommand{\\ex}[1]{\\begin{example} #1 \\end{example}}\n \\newcommand{\\prf}[1]{\\begin{proof} #1 \\end{proof}}\n \\newcommand{\\prbm}[1]{\\begin{problem} #1 \\end{problem}}\n \\newcommand{\\soln}[1]{\\begin{solution} #1 \\end{solution}}\n \\newcommand{\\rmk}[1]{\\begin{remark} #1 \\end{remark}}\n \\newcommand{\\defn}[1]{\\begin{definition} #1 \\end{definition}}\n\n \\newcommand{\\ifff}{\\LeftRightArrow}\n\n \x3c!-- For the set of reals and integers --\x3e\n \\newcommand{\\rr}{\\R}\n \\newcommand{\\reals}{\\R}\n \\newcommand{\\ii}{\\Z}\n \\newcommand{\\cc}{\\C}\n \\newcommand{\\nn}{\\N}\n \\newcommand{\\nats}{\\N}\n\n \x3c!-- For terms being indexed.\n Puts them in standard font face and creates an index entry.\n arg: The term being defined.\n \\newcommand{\\pointer}[1]{#1\\index{#1}} --\x3e\n\n \x3c!-- For bold terms to be index, but defined elsewhere\n Puts them in bold face and creates an index entry.\n arg: The term being defined. --\x3e\n \\newcommand{\\strong}[1]{\\textbf{#1}}\n\n \x3c!-- For set names.\n Puts them in italics. In math mode, yields decent spacing.\n arg: The name of the set. --\x3e\n \\newcommand{\\set}[1]{\\textit{#1}}\n\n $$\n "]);return _templateObject_bda82fd08a6911ef92e7a36ece546115=function _templateObject_bda82fd08a6911ef92e7a36ece546115(){return t},t}var s=String.raw(_templateObject_bda82fd08a6911ef92e7a36ece546115());n.default=s},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/taggedTemplateLiteral":11}],120:[function(t,e,n){(function(e){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.loadMathJax=n.getMathJax=n.DEFAULT_OPTIONS=n.DEFAULT_SCRIPT=void 0;var a=i(t("load-script")),s=e.env.MATHJAX_CDN||"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js";n.DEFAULT_SCRIPT=s;var u={TeX:{extensions:["AMSmath.js","AMSsymbols.js"]},extensions:["tex2jax.js"],showProcessingMessages:!1,jax:["input/TeX","output/HTML-CSS"],messageStyle:"none",showMathMenu:!1,showMathMenuMSIE:!1,tex2jax:{processEnvironments:!0,inlineMath:[["$","$"],["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],preview:"none",processEscapes:!0},"HTML-CSS":{linebreaks:{automatic:!0,width:"container"}}};n.DEFAULT_OPTIONS=u;n.getMathJax=function getMathJax(){return"undefined"==typeof MathJax?void 0:MathJax};n.loadMathJax=function loadMathJax(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u,i=function onLoad(){MathJax.Hub.Config(n),t()};if(!e)return i();(0,a.default)(e,i)}}).call(this,t("_process"))},{"@babel/runtime/helpers/interopRequireDefault":6,_process:100,"load-script":99}],121:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"pstricks",{enumerable:!0,get:function get(){return a.default}}),Object.defineProperty(n,"psgraph",{enumerable:!0,get:function get(){return s.default}}),n.default=void 0;var a=i(t("./lib/pstricks")),s=i(t("./lib/psgraph")),u={pstricks:a.default,psgraph:s.default};n.default=u},{"./lib/psgraph":122,"./lib/pstricks":123,"@babel/runtime/helpers/interopRequireDefault":6}],122:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireWildcard"),a=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var s=a(t("@babel/runtime/helpers/slicedToArray")),u=t("latex2js-utils"),c=i(t("d3"));function arrow(t,e,n,i){var a=Math.PI/6,s=n-t,u=i-e,c=Math.sqrt(s*s+u*u),f=Math.cos(a),h=Math.sin(a),d=8/c,p=n-(s*f-u*h)*d,g=i-(u*f+s*h)*d,v=[];return v.push("M"),v.push(n),v.push(i),v.push("L"),v.push(p),v.push(g),p=n-(s*(f=Math.cos(-a))-u*(h=Math.sin(-a)))*d,g=i-(u*f+s*h)*d,v.push(p),v.push(g),v.push("Z"),v.join(" ")}var f={getSize:function getSize(){this.env.scale=1;var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0)-20;return t<=this.env.w*this.env.xunit&&(this.env.scale=t/this.env.w/this.env.xunit),{width:this.env.w*this.env.xunit,height:this.env.h*this.env.yunit}},psframe:function psframe(t){t.append("svg:line").attr("x1",this.x1).attr("y1",this.y1).attr("x2",this.x2).attr("y2",this.y1).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1),t.append("svg:line").attr("x1",this.x2).attr("y1",this.y1).attr("x2",this.x2).attr("y2",this.y2).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1),t.append("svg:line").attr("x1",this.x2).attr("y1",this.y2).attr("x2",this.x1).attr("y2",this.y2).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1),t.append("svg:line").attr("x1",this.x1).attr("y1",this.y2).attr("x2",this.x1).attr("y2",this.y1).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1)},pscircle:function pscircle(t){t.append("svg:circle").attr("cx",this.cx).attr("cy",this.cy).attr("r",this.r).style("stroke","black").style("fill","none").style("stroke-width",2).style("stroke-opacity",1)},psplot:function psplot(t){var e=[];e.push("M"),"solid"===this.fillstyle?(e.push(this.data[0]),e.push(u.Y.call(this.global,0))):(e.push(this.data[0]),e.push(this.data[1])),e.push("L"),this.data.forEach((function(t){e.push(t)})),"solid"===this.fillstyle&&(e.push(this.data[this.data.length-2]),e.push(u.Y.call(this.global,0)),e.push("Z")),t.append("svg:path").attr("d",e.join(" ")).attr("class","psplot").style("stroke-width",this.linewidth).style("stroke-opacity",1).style("fill","none"===this.fillstyle?"none":this.fillcolor).style("stroke",this.linecolor)},pspolygon:function pspolygon(t){var e=[];e.push("M"),e.push(this.data[0]),e.push(this.data[1]),e.push("L"),this.data.forEach((function(t){e.push(t)})),e.push("Z"),t.append("svg:path").attr("d",e.join(" ")).style("stroke-width",this.linewidth).style("stroke-opacity",1).style("fill","none"===this.fillstyle?"none":this.fillcolor).style("stroke","black")},psarc:function psarc(t){var e=[];e.push("M"),e.push(this.cx),e.push(this.cy),e.push("L"),e.push(this.A.x),e.push(this.A.y),e.push("A"),e.push(this.A.x),e.push(this.A.y),e.push(0),e.push(0),e.push(0),e.push(this.B.x),e.push(this.B.y),t.append("svg:path").attr("d",e.join(" ")).style("stroke-width",2).style("stroke-opacity",1).style("fill","blue").style("stroke","black")},psaxes:function psaxes(t){var e=[this.bottomLeft[0],this.topRight[0]],n=[this.bottomLeft[1],this.topRight[1]],i=this.origin;function line(e,n,i,a){t.append("svg:path").attr("d","M "+e+" "+n+" L "+i+" "+a).style("stroke-width",2).style("stroke","rgb(0,0,0)").style("stroke-opacity",1)}var a=function xticks(){for(var t=e[0];t<=e[1];t+=this.dx)line(t,i[1]-5,t,i[1]+5)},s=function yticks(){for(var t=n[0];t<=n[1];t+=this.dy)line(i[0]-5,t,i[0]+5,t)};line(e[0],i[1],e[1],i[1]),line(i[0],n[0],i[0],n[1]),this.ticks.match(/all/)?(a(),s()):this.ticks.match(/x/)?a():this.ticks.match(/y/)&&s(),this.arrows[0]&&(t.append("path").attr("d",arrow(e[1],i[1],e[0],i[1])).style("fill","black").style("stroke","black"),t.append("path").attr("d",arrow(i[0],n[1],i[0],n[0])).style("fill","black").style("stroke","black")),this.arrows[1]&&(t.append("path").attr("d",arrow(e[0],i[1],e[1],i[1])).style("fill","black").style("stroke","black"),t.append("path").attr("d",arrow(i[0],n[0],i[0],n[1])).style("fill","black").style("stroke","black"))},psline:function psline(t){var e=this.linewidth,n=this.linecolor;this.linestyle.match(/dotted/)?function dotted(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):this.linestyle.match(/dashed/)?function dashed(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):function solid(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2),this.dots[0]&&t.append("svg:circle").attr("cx",this.x1).attr("cy",this.y1).attr("r",3).style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1),this.dots[1]&&t.append("svg:circle").attr("cx",this.x2).attr("cy",this.y2).attr("r",3).style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1);var i=this.x1,a=this.y1,s=this.x2,u=this.y2;this.arrows[0]&&t.append("path").attr("d",arrow(s,u,i,a)).style("fill",this.linecolor).style("stroke",this.linecolor),this.arrows[1]&&t.append("path").attr("d",arrow(i,a,s,u)).style("fill",this.linecolor).style("stroke",this.linecolor)},userline:function userline(t){var e=this.linewidth,n=this.linecolor;this.linestyle.match(/dotted/)?function dotted(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).attr("class","userline").style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):this.linestyle.match(/dashed/)?function dashed(i,a,s,u){t.append("svg:path").attr("d","M "+i+" "+a+" L "+s+" "+u).attr("class","userline").style("stroke-width",e).style("stroke",n).style("stroke-dasharray","9,5").style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2):function solid(i,a,s,u){t.append("svg:path").attr("class","userline").attr("d","M "+i+" "+a+" L "+s+" "+u).style("stroke-width",e).style("stroke",n).style("stroke-opacity",1)}(this.x1,this.y1,this.x2,this.y2),this.dots[0]&&t.append("svg:circle").attr("cx",this.x1).attr("cy",this.y1).attr("r",3).attr("class","userline").style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1),this.dots[1]&&t.append("svg:circle").attr("cx",this.x2).attr("cy",this.y2).attr("r",3).attr("class","userline").style("stroke",this.linecolor).style("fill",this.linecolor).style("stroke-width",1).style("stroke-opacity",1);var i=this.x1,a=this.y1,s=this.x2,u=this.y2;this.arrows[0]&&t.append("path").attr("d",arrow(s,u,i,a)).attr("class","userline").style("fill",this.linecolor).style("stroke",this.linecolor),this.arrows[1]&&t.append("path").attr("d",arrow(i,a,s,u)).attr("class","userline").style("fill",this.linecolor).style("stroke",this.linecolor)},rput:function rput(t){var e=document.createElement("div"),n=this.x,i=this.y;e.innerHTML=this.text,e.className="math",e.style.visibility="hidden",e.style.position="absolute",e.style.top="".concat(i,"px"),e.style.left="".concat(n,"px"),t.appendChild(e);MathJax.Hub.Queue(["Typeset",MathJax.Hub,e],[function done(){var t=e.getBoundingClientRect(),a=t.width/2,s=t.height/2;e.style.visibility="visible",e.style.top="".concat(i-s,"px"),e.style.left="".concat(n-a,"px")}])},pspicture:function pspicture(t){var e=this,n=this.env,i=this.$el;Object.keys(this.plot).forEach((function(i){var a=e.plot[i];i.match(/rput/)||f.hasOwnProperty(i)&&a.forEach((function(e){e.data.global=n,f[i].call(e.data,t)}))})),t.on("touchmove",(function(){c.event.preventDefault(),userEvent(c.touches(this)[0])}),!1),t.on("mousemove",(function(){userEvent(c.mouse(this))}),!1);var a=this.plot;function userEvent(e){t.selectAll(".userline").remove(),t.selectAll(".psplot").remove();var i={};Object.entries(a||{}).forEach((function(t){var n=(0,s.default)(t,2),a=n[0],u=n[1];a.match(/uservariable/)&&u.forEach((function(t){t.env.userx=e[0],t.env.usery=e[1];var n=t.fn.call(t.env,t.match);i[t.data.name]=n.value}))})),Object.entries(a||{}).forEach((function(a){var u=(0,s.default)(a,2),c=u[0],h=u[1];c.match(/psplot/)&&h.forEach((function(e){Object.entries(i||{}).forEach((function(t){var n=(0,s.default)(t,2),i=n[0],a=n[1];e.env.variables[i]=a}));var a=e.fn.call(e.env,e.match);a.global={},Object.assign(a.global,n),f[c].call(a,t)})),c.match(/userline/)&&h.forEach((function(i){var a=i.fn.call(i.env,i.match);i.env.x2=e[0],i.env.y2=e[1],i.data.x2=i.env.x2,i.data.y2=i.env.y2,i.data.xExp2?(i.data.x2=a.userx2(e),i.data.x1=a.userx(e)):i.data.xExp&&(i.data.x2=a.userx(e)),i.data.yExp2?(i.data.y2=a.usery2(e),i.data.y1=a.usery(e)):i.data.yExp&&(i.data.y2=a.usery(e)),a.global={},Object.assign(a.global,n),Object.assign(a,i.data),f[c].call(a,t)}))}))}this.plot.rput.forEach((function(t){f.rput.call(t.data,i)}))}},h=f;n.default=h},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/interopRequireWildcard":7,"@babel/runtime/helpers/slicedToArray":10,d3:73,"latex2js-utils":125}],123:[function(require,module,exports){var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Functions=exports.Expressions=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_latex2jsUtils=require("latex2js-utils"),_latex2jsSettings=_interopRequireDefault(require("latex2js-settings")),Expressions={pspicture:/\\begin\{pspicture\}\(\s*(.*),(.*)\s*\)\(\s*(.*),(.*)\s*\)/,psframe:/\\psframe\(\s*(.*),(.*)\s*\)\(\s*(.*),(.*)\s*\)/,psplot:/\\psplot(\[[^\]]*\])?\{([^\}]*)\}\{([^\}]*)\}\{([^\}]*)\}/,psarc:new RegExp("\\\\psarc"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle),pscircle:/\\pscircle.*\(\s*(.*),(.*)\s*\)\{(.*)\}/,pspolygon:new RegExp("\\\\pspolygon"+_latex2jsUtils.RE.options+"(.*)"),psaxes:new RegExp("\\\\psaxes"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.coordsOpt+_latex2jsUtils.RE.coordsOpt),slider:new RegExp("\\\\slider"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.squiggle),psline:new RegExp("\\\\psline"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.coordsOpt),userline:new RegExp("\\\\userline"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.type+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.squiggleOpt+_latex2jsUtils.RE.squiggleOpt+_latex2jsUtils.RE.squiggleOpt+_latex2jsUtils.RE.squiggleOpt),uservariable:new RegExp("\\\\uservariable"+_latex2jsUtils.RE.options+_latex2jsUtils.RE.squiggle+_latex2jsUtils.RE.coords+_latex2jsUtils.RE.squiggle),rput:/\\rput\((.*),(.*)\)\{(.*)\}/,psset:/\\psset\{(.*)\}/};exports.Expressions=Expressions;var Functions={slider:function slider(t){var e={scalar:1,min:Number(t[2]),max:Number(t[3]),variable:t[4],latex:t[5],value:Number(t[6])};return this.variables=this.variables||{},this.variables[e.variable]=e.value,this.sliders=this.sliders||[],this.sliders.push(e),t[1]&&Object.assign(e,(0,_latex2jsUtils.parseOptions)(t[1])),e},pspicture:function pspicture(t){var e={x0:Number(t[1]),y0:Number(t[2]),x1:Number(t[3]),y1:Number(t[4])},n={w:e.x1-e.x0,h:e.y1-e.y0};return Object.assign(this,e,n),Object.assign(e,n)},psframe:function psframe(t){return{x1:_latex2jsUtils.X.call(this,t[1]),y1:_latex2jsUtils.Y.call(this,t[2]),x2:_latex2jsUtils.X.call(this,t[3]),y2:_latex2jsUtils.Y.call(this,t[4])}},pscircle:function pscircle(t){return{cx:_latex2jsUtils.X.call(this,t[1]),cy:_latex2jsUtils.Y.call(this,t[2]),r:this.xunit*t[3]}},psaxes:function psaxes(t){var e={dx:1*this.xunit,dy:1*this.yunit,arrows:[0,0],dots:[0,0],ticks:"all"};if(t[1]){var n=(0,_latex2jsUtils.parseOptions)(t[1]);n.Dx&&(e.dx=Number(n.Dx)*this.xunit),n.Dy&&(e.dy=Number(n.Dy)*this.yunit)}var i=(0,_latex2jsUtils.parseArrows)(t[2]);return e.arrows=i.arrows,e.dots=i.dots,t[5]&&!t[8]?(e.origin=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[4])],e.bottomLeft=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[4])],e.topRight=[_latex2jsUtils.X.call(this,t[6]),_latex2jsUtils.Y.call(this,t[7])]):t[5]||t[8]?(e.origin=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[4])],e.bottomLeft=[_latex2jsUtils.X.call(this,t[6]),_latex2jsUtils.Y.call(this,t[7])],e.topRight=[_latex2jsUtils.X.call(this,t[9]),_latex2jsUtils.Y.call(this,t[10])]):(e.origin=[_latex2jsUtils.X.call(this,0),_latex2jsUtils.Y.call(this,0)],e.bottomLeft=[_latex2jsUtils.X.call(this,0),_latex2jsUtils.Y.call(this,0)],e.topRight=[_latex2jsUtils.X.call(this,t[3]),_latex2jsUtils.Y.call(this,t[6])]),e},psplot:function psplot(m){var startX=_latex2jsUtils.evaluate.call(this,m[2]),endX=_latex2jsUtils.evaluate.call(this,m[3]),data=[],x,expression="";for(Object.entries(this.variables||{}).forEach((function(t){var e=(0,_slicedToArray2.default)(t,2),n=e[0],i=e[1];expression+="var "+n+" = "+i+";"})),expression+="with (Math){"+m[4]+"}",x=startX;x<=endX;x+=.005)data.push(_latex2jsUtils.X.call(this,x)),data.push(_latex2jsUtils.Y.call(this,eval(expression)));var obj={linecolor:"black",linestyle:"solid",fillstyle:"none",fillcolor:"none",linewidth:2};return m[1]&&Object.assign(obj,(0,_latex2jsUtils.parseOptions)(m[1])),obj.data=data,obj},pspolygon:function pspolygon(t){var e=this,n=t[2];if(n){var i=new RegExp(_latex2jsUtils.RE.coords,"g"),a=n.match(i),s=new RegExp(_latex2jsUtils.RE.coords),u=[];a.forEach((function(t){var n=s.exec(t);u.push(_latex2jsUtils.X.call(e,n[1])),u.push(_latex2jsUtils.Y.call(e,n[2]))}));var c={linecolor:"black",linestyle:"solid",fillstyle:"none",fillcolor:"black",linewidth:2,data:u};return t[1]&&Object.assign(c,(0,_latex2jsUtils.parseOptions)(t[1])),c}},psarc:function psarc(t){var e=(0,_latex2jsUtils.parseArrows)(t[2]),n={linecolor:"black",linestyle:"solid",fillstyle:"solid",fillcolor:"black",linewidth:2,arrows:e.arrows,dots:e.dots,cx:_latex2jsUtils.X.call(this,0),cy:_latex2jsUtils.Y.call(this,0)};return t[1]&&Object.assign(n,(0,_latex2jsUtils.parseOptions)(t[1])),t[3]&&(n.cx=_latex2jsUtils.X.call(this,t[3])),t[4]&&(n.cy=_latex2jsUtils.Y.call(this,t[4])),n.r=Number(t[5])*this.xunit,n.angleA=Number(t[6])*Math.PI/180,n.angleB=Number(t[7])*Math.PI/180,n.A={x:_latex2jsUtils.X.call(this,Number(t[5])*Math.cos(n.angleA)),y:_latex2jsUtils.Y.call(this,Number(t[5])*Math.sin(n.angleA))},n.B={x:_latex2jsUtils.X.call(this,Number(t[5])*Math.cos(n.angleB)),y:_latex2jsUtils.Y.call(this,Number(t[5])*Math.sin(n.angleB))},n},psline:function psline(t){var e=t[1],n=t[2],i=(0,_latex2jsUtils.parseArrows)(n),a={linecolor:"black",linestyle:"solid",fillstyle:"solid",fillcolor:"black",linewidth:2,arrows:i.arrows,dots:i.dots};return t[5]?(a.x1=_latex2jsUtils.X.call(this,t[3]),a.y1=_latex2jsUtils.Y.call(this,t[4]),a.x2=_latex2jsUtils.X.call(this,t[6]),a.y2=_latex2jsUtils.Y.call(this,t[7])):(a.x1=_latex2jsUtils.X.call(this,0),a.y1=_latex2jsUtils.Y.call(this,0),a.x2=_latex2jsUtils.X.call(this,t[3]),a.y2=_latex2jsUtils.Y.call(this,t[4])),e&&Object.assign(a,(0,_latex2jsUtils.parseOptions)(e)),"string"==typeof a.linewidth&&(a.linewidth=2),a},uservariable:function uservariable(m){var options=m[1],coords=[];this.userx&&this.usery?(coords.push(Number(this.userx)),coords.push(Number(this.usery))):(coords.push(_latex2jsUtils.X.call(this,m[3])),coords.push(_latex2jsUtils.Y.call(this,m[4])));var nx1=_latex2jsUtils.Xinv.call(this,coords[0]),ny1=_latex2jsUtils.Yinv.call(this,coords[1]),expx1="var x = "+nx1+";",expy1="var y = "+ny1+";",obj={name:m[2],x:_latex2jsUtils.X.call(this,m[3]),y:_latex2jsUtils.Y.call(this,m[4]),func:m[5],value:eval(expx1+expy1+m[5])};return obj},userline:function userline(m){var _this2=this,options=m[1],lineType=m[2],l=(0,_latex2jsUtils.parseArrows)(lineType),arrows=l.arrows,dots=l.dots,xExp=m[7],yExp=m[8];xExp&&(xExp="with (Math){"+xExp.replace(/^\{/,"").replace(/\}$/,"")+"}"),yExp&&(yExp="with (Math){"+yExp.replace(/^\{/,"").replace(/\}$/,"")+"}");var xExp2=m[9],yExp2=m[10];xExp2&&(xExp2="with (Math){"+xExp2.replace(/^\{/,"").replace(/\}$/,"")+"}"),yExp2&&(yExp2="with (Math){"+yExp2.replace(/^\{/,"").replace(/\}$/,"")+"}");var expression="";Object.entries(this.variables||{}).forEach((function(t){var e=(0,_slicedToArray2.default)(t,2),n=e[0],i=e[1];expression+="var "+n+" = "+i+";"}));var obj={x1:_latex2jsUtils.X.call(this,m[3]),y1:_latex2jsUtils.Y.call(this,m[4]),x2:_latex2jsUtils.X.call(this,m[5]),y2:_latex2jsUtils.Y.call(this,m[6]),xExp,yExp,xExp2,yExp2,userx:function userx(coords){var nx1=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny1=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx1="var x = "+nx1+";",expy1="var y = "+ny1+";";return _latex2jsUtils.X.call(_this2,eval(expression+expy1+expx1+xExp))},usery:function usery(coords){var nx2=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny2=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx2="var x = "+nx2+";",expy2="var y = "+ny2+";";return _latex2jsUtils.Y.call(_this2,eval(expression+expy2+expx2+yExp))},userx2:function userx2(coords){var nx3=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny3=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx3="var x = "+nx3+";",expy3="var y = "+ny3+";";return _latex2jsUtils.X.call(_this2,eval(expression+expy3+expx3+xExp2))},usery2:function usery2(coords){var nx4=_latex2jsUtils.Xinv.call(_this2,coords[0]),ny4=_latex2jsUtils.Yinv.call(_this2,coords[1]),expx4="var x = "+nx4+";",expy4="var y = "+ny4+";";return _latex2jsUtils.Y.call(_this2,eval(expression+expy4+expx4+yExp2))},linecolor:"black",linestyle:"solid",fillstyle:"solid",fillcolor:"black",linewidth:2,arrows,dots};return options&&Object.assign(obj,(0,_latex2jsUtils.parseOptions)(options)),"string"==typeof obj.linewidth&&(obj.linewidth=2),obj},rput:function rput(t){return{x:_latex2jsUtils.X.call(this,t[1]),y:_latex2jsUtils.Y.call(this,t[2]),text:t[3]}},psset:function psset(t){var e=t[1].split(",").map((function(t){return t.split("=")})),n={};return e.forEach((function(t){var e=t[0],i=t[1];Object.keys(_latex2jsSettings.default.Expressions).forEach((function(t){var a=_latex2jsSettings.default.Expressions[t];e.match(a)&&_latex2jsSettings.default.Functions[t](n,i)}))})),n}};exports.Functions=Functions;var _default={Expressions,Functions};exports.default=_default},{"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/slicedToArray":10,"latex2js-settings":124,"latex2js-utils":125}],124:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Functions=n.Expressions=void 0;var i=t("latex2js-utils"),a={fillcolor:/^fillcolor$/,fillstyle:/^fillstyle$/,linecolor:/^linecolor$/,linestyle:/^linestyle$/,unit:/^unit/,runit:/^runit/,xunit:/^xunit/,yunit:/^yunit/};n.Expressions=a;var s={fillcolor:function fillcolor(t,e){t.fillcolor=e},fillstyle:function fillstyle(t,e){t.fillstyle=e},linecolor:function linecolor(t,e){t.linecolor=e},linestyle:function linestyle(t,e){t.linestyle=e},unit:function unit(t,e){e=(0,i.convertUnits)(e),t.unit=e,t.runit=e,t.xunit=e,t.yunit=e},runit:function runit(t,e){e=(0,i.convertUnits)(e),t.runit=e},xunit:function xunit(t,e){e=(0,i.convertUnits)(e),t.xunit=e},yunit:function yunit(t,e){e=(0,i.convertUnits)(e),t.yunit=e}};n.Functions=s;var u={Expressions:a,Functions:s};n.default=u},{"latex2js-utils":125}],125:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.Yinv=exports.Y=exports.Xinv=exports.X=exports.evaluate=exports.parseArrows=exports.parseOptions=exports.RE=exports.convertUnits=exports.matchrepl=exports.simplerepl=void 0;var simplerepl=function simplerepl(t,e){return function(n,i){return i.replace(t,e)}};exports.simplerepl=simplerepl;var matchrepl=function matchrepl(t,e){return function(n,i){return Array.isArray(n)&&n.forEach((function(n){var a=n.match(t);i=i.replace(a.input,e(a))})),i}};exports.matchrepl=matchrepl;var convertUnits=function convertUnits(t){var e=null;return(e=t.match(/([^c]+)\s*cm/))?50*Number(e[1]):(e=t.match(/([^i]+)\s*in/))?20*Number(e[1]):(e=t.match(/(.*)/))?50*Number(e[1]):Number(t)};exports.convertUnits=convertUnits;var RE={options:"(\\[[^\\]]*\\])?",type:"(\\{[^\\}]*\\})?",squiggle:"\\{([^\\}]*)\\}",squiggleOpt:"(\\{[^\\}]*\\})?",coordsOpt:"(\\(\\s*([^\\)]*),([^\\)]*)\\s*\\))?",coords:"\\(\\s*([^\\)]*),([^\\)]*)\\s*\\)"};exports.RE=RE;var parseOptions=function parseOptions(t){var e=t.replace(/[\]\[]/g,"").split(","),n={};return e.forEach((function(t){var e=t.split("=");2==e.length&&(n[e[0].trim()]=e[1].trim())})),n};exports.parseOptions=parseOptions;var parseArrows=function parseArrows(t){var e=[0,0],n=[0,0];if(t){var i=t.match(/\{([^\-]*)?\-([^\-]*)?\}/);i&&(i[1]&&(i[1].match(/\*/)?n[0]=1:i[1].match(//)&&(e[1]=1)))}return{arrows:e,dots:n}};exports.parseArrows=parseArrows;var evaluate=function evaluate(exp){var _this=this,num=Number(exp);if(isNaN(num)){var expression="";return this.variables=this.variables||{},Object.keys(this.variables).map((function(t){var e=_this.variables[t];expression+="var "+t+" = "+e+";"})),expression+="with (Math){"+exp+"}",eval(expression)}return num};exports.evaluate=evaluate;var X=function X(t){return(this.w-(this.x1-Number(t)))*this.xunit};exports.X=X;var Xinv=function Xinv(t){return Number(t)/this.xunit-this.w+this.x1};exports.Xinv=Xinv;var Y=function Y(t){return(this.y1-Number(t))*this.yunit};exports.Y=Y;var Yinv=function Yinv(t){return this.y1-Number(t)/this.yunit};exports.Yinv=Yinv},{}],126:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("@babel/runtime/helpers/classCallCheck")),s=i(t("@babel/runtime/helpers/createClass")),u=i(t("./lib/text")),c=i(t("./lib/headers")),f=t("latex2js-pstricks"),h=i(t("./lib/environments")),d=i(t("./lib/ignore")),p=i(t("./lib/parser")),g=function(){function LaTeX2HTML5(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.default,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.default,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:f.pstricks,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(0,a.default)(this,LaTeX2HTML5),this.Text=e,this.Headers=n,this.Environments=i,this.Ignore=s,this.PSTricks=p,this.Views=g,this.Delimiters={},i.forEach((function(e){t.addEnvironment(e)}))}return(0,s.default)(LaTeX2HTML5,[{key:"addEnvironment",value:function addEnvironment(t){var e={begin:new RegExp("\\\\begin\\{"+t+"\\}"),end:new RegExp("\\\\end\\{"+t+"\\}")};this.Delimiters[t]=e}},{key:"addView",value:function addView(t,e){this.addEnvironment(t)}},{key:"addText",value:function addText(t,e,n){this.Text.Expressions[t]=e,this.Text.Functions[t]=n}},{key:"addHeaders",value:function addHeaders(t,e,n){var i={},a=t+"begin",s=t+"end";i[a]=new RegExp("\\\\begin\\{"+t+"\\}"),i[s]=new RegExp("\\\\end\\{"+t+"\\}"),Object.assign(this.Headers.Expressions,i);var u={};u[a]=function(){return e||""},u[s]=function(){return n||""},Object.assign(this.Headers.Functions,u)}},{key:"getParser",value:function getParser(){return new p.default(this)}},{key:"parse",value:function parse(t){var e=new p.default(this).parse(t);return e.forEach((function(t){if(!t.hasOwnProperty("type"))throw new Error("no type!")})),e}}]),LaTeX2HTML5}();n.default=g},{"./lib/environments":127,"./lib/headers":128,"./lib/ignore":129,"./lib/parser":130,"./lib/text":131,"@babel/runtime/helpers/classCallCheck":3,"@babel/runtime/helpers/createClass":4,"@babel/runtime/helpers/interopRequireDefault":6,"latex2js-pstricks":121}],127:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=["pspicture","verbatim","enumerate","print","nicebox"]},{}],128:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Functions=n.Expressions=void 0;var i={bq:/\\begin\{quotation\}/,claim:/\\begin\{claim\}/,corollary:/\\begin\{corollary\}/,definition:/\\begin\{definition\}/,endclaim:/\\end\{claim\}/,endcorallary:/\\end\{corallary\}/,enddefinition:/\\end\{definition\}/,endexample:/\\end\{example\}/,endproblem:/\\end\{problem\}/,endsolution:/\\end\{solution\}/,endtheorem:/\\end\{theorem\}/,eq:/\\end\{quotation\}/,example:/\\begin\{example\}/,problem:/\\begin\{problem\}/,proof:/\\begin\{proof\}/,qed:/\\end\{proof\}/,solution:/\\begin\{solution\}/,theorem:/\\begin\{theorem\}/};n.Expressions=i;var a={bq:function bq(){return'

'},claim:function claim(){return"

Claim

"},corollary:function corollary(){return"

Corollary

"},definition:function definition(){return"

Definition

"},endclaim:function endclaim(){return""},endcorollary:function endcorollary(){return""},enddefinition:function enddefinition(){return""},endexample:function endexample(){return""},endproblem:function endproblem(){return""},endsolution:function endsolution(){return""},endtheorem:function endtheorem(){return""},eq:function eq(){return"

"},example:function example(){return"

Example

"},problem:function problem(){return"

Problem

"},proof:function proof(){return"

Proof

"},qed:function qed(){return"$\\qed$"},solution:function solution(){return"

Solution

"},theorem:function theorem(){return"

Theorem

"}};n.Functions=a;var s={Expressions:i,Functions:a};n.default=s},{}],129:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;n.default=[/^\%/,/\\begin\{document\}/,/\\end\{document\}/,/\\begin\{interactive\}/,/\\end\{interactive\}/,/\\usepackage/,/\\documentclass/,/\\tableofcontents/,/\\author/,/\\date/,/\\maketitle/,/\\title/,/\\pagestyle/,/\\smallskip/,/\\medskip/,/\\bigskip/,/\\nobreak/,/\\begin\{center\}/,/\\end\{center\}/]},{}],130:[function(t,e,n){var i=t("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=i(t("@babel/runtime/helpers/slicedToArray")),s=i(t("@babel/runtime/helpers/defineProperty"));function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Parser(t){this.Ignore=t.Ignore,this.Delimiters=t.Delimiters,this.Text=t.Text,this.PSTricks=t.PSTricks,this.Headers=t.Headers,this.objects=[],this.environment=null,this.settings=this.PSTricks.Functions.psset.call(this,["","units=1cm,linecolor=black,linestyle=solid,fillstyle=none"])}Parser.prototype={parse:function parse(t){var e=this;if(!t)return{};var n=t.split("\n");return this.parseEnvText(n),this.parseEnv(n),this.objects.forEach((function(t){t.type.match(/pspicture/)&&(t.plot=e.parsePSTricks(t.lines,t.env))})),this.objects},newEnvironment:function newEnvironment(t){this.environment&&this.environment.lines.length&&(this.environment.settings=function _objectSpread(t){for(var e=1;e"))}))},parsePSExpression:function parsePSExpression(t,e,n,i,a){var s=t.match(e);return!!s&&(n[i].push({data:this.PSTricks.Functions[i].call(a,s),env:a,match:s,fn:this.PSTricks.Functions[i]}),!0)},parsePSVariables:function parsePSVariables(t,e,n,i,a){var s=t.match(e);if(s&&i.match(/uservariable/)){var u=this.PSTricks.Functions[i].call(a,s);a.variables=a.variables||{},a.variables[u.name]=u.value}},parsePSTricks:function parsePSTricks(t,e){var n=this,i={},s=Object.entries(this.PSTricks.Expressions);return s.forEach((function(t){var e=(0,a.default)(t,2),n=e[0];e[1];i[n]=[]})),t.forEach((function(t){s.forEach((function(s){var u=(0,a.default)(s,2),c=u[0],f=u[1];n.parsePSVariables(t,f,i,c,e),n.parsePSExpression(t,f,i,c,e)}))})),i},parseTextExpression:function parseTextExpression(t,e,n,i){var a=t.match(e);return a?this.Text.Functions[n].call(this,a,i):i},parseHeadersExpression:function parseHeadersExpression(t,e,n,i){return t.match(e)?this.Headers.Functions[n].call(this):i},parseText:function parseText(t){var e=this,n=t;return Object.entries(this.Text.Expressions).forEach((function(i){var s=(0,a.default)(i,2),u=s[0],c=s[1];n=e.parseTextExpression(t,c,u,n)})),Object.entries(this.Headers.Expressions).forEach((function(i){var s=(0,a.default)(i,2),u=s[0],c=s[1];n=e.parseHeadersExpression(t,c,u,n)})),n}};var u=Parser;n.default=u},{"@babel/runtime/helpers/defineProperty":5,"@babel/runtime/helpers/interopRequireDefault":6,"@babel/runtime/helpers/slicedToArray":10}],131:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Functions=n.Expressions=void 0;var i=t("latex2js-utils"),a={emph:/\\emph\{[^}]*\}/g,bf:/\{*\\bf [^}]*\}/g,rm:/\{*\\rm [^}]*\}/g,sl:/\{*\\sl [^}]*\}/g,it:/\{*\\it [^}]*\}/g,tt:/\{*\\tt [^}]*\}/g,mdash:/---/g,ndash:/--/g,openq:/``/g,closeq:/''/g,TeX:/\\TeX\\|\\TeX/g,LaTeX:/\\LaTeX\\|\\LaTeX/g,vspace:/\\vspace/g,cite:/\\cite\[\d+\]\{[^}]*\}/g,href:/\\href\{[^}]*\}\{[^}]*\}/g,img:/\\img\{[^}]*\}/g,set:/\\set\{[^}]*\}/g,youtube:/\\youtube\{[^}]*\}/g,euler:/Euler\^/g};n.Expressions=a;var s={cite:function cite(t,e){return t.forEach((function(t){var n=t.match(/\\cite\[(\d+)\]\{([^}]*)\}/),i=location.pathname.match(/\/books\/(\d+)\//),a=0;i&&(a=i[1]),e=e.replace(n.input,'[p'+n[1]+"]")})),e},img:(0,i.matchrepl)(/\\img\{([^}]*)\}/,(function(t){return'
'})),youtube:(0,i.matchrepl)(/\\youtube\{([^}]*)\}/,(function(t){return'
'})),href:(0,i.matchrepl)(/\\href\{([^}]*)\}\{([^}]*)\}/,(function(t){return''+t[2]+""})),set:(0,i.matchrepl)(/\\set\{([^}]*)\}/,(function(t){return""+t[1]+""})),euler:(0,i.simplerepl)(/Euler\^/,"exp"),emph:(0,i.matchrepl)(/\{([^}]*)\}/,(function(t){return""+t[1]+""})),bf:(0,i.matchrepl)(/\{*\\bf ([^}]*)\}/,(function(t){return""+t[1]+""})),rm:(0,i.matchrepl)(/\{*\\rm ([^}]*)\}/,(function(t){return''+t[1]+""})),sl:(0,i.matchrepl)(/\{*\\sl ([^}]*)\}/,(function(t){return""+t[1]+""})),it:(0,i.matchrepl)(/\{*\\it ([^}]*)\}/,(function(t){return""+t[1]+""})),tt:(0,i.matchrepl)(/\{*\\tt ([^}]*)\}/,(function(t){return''+t[1]+""})),ndash:(0,i.simplerepl)(/--/g,"–"),mdash:(0,i.simplerepl)(/---/g,"—"),openq:(0,i.simplerepl)(/``/g,"“"),closeq:(0,i.simplerepl)(/''/g,"”"),vspace:(0,i.simplerepl)(/\\vspace/g,"
"),TeX:(0,i.simplerepl)(/\\TeX\\|\\TeX/g,"$\\TeX$"),LaTeX:(0,i.simplerepl)(/\\LaTeX\\|\\LaTeX/g,"$\\LaTeX$")};n.Functions=s;var u={Expressions:a,Functions:s};n.default=u},{"latex2js-utils":125}]},{},[118])(118)})); \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/lib/loading.html b/src/public/build/es6/node_modules/@haxtheweb/web-container/lib/loading.html new file mode 100644 index 0000000..2aa8fc8 --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/lib/loading.html @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+

installing..

+
+
+ + + \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/lib/web-container.haxProperties.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/lib/web-container.haxProperties.json new file mode 100644 index 0000000..cac9c9d --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/lib/web-container.haxProperties.json @@ -0,0 +1,51 @@ +{ + "api": "1", + "canScale": true, + "canEditSource": true, + "type": "element", + "designSystem": { + "accent": true, + "primary": true, + "card": true, + "text": true, + "designTreatment": false + }, + "gizmo": { + "title": "web-container", + "description": "", + "icon": "icons:android", + "color": "purple", + "tags": [ + "Other" + ], + "handles": [], + "meta": { + "author": "haxtheweb" + } + }, + "settings": { + "configure": [ + { + "property": "title", + "title": "Title", + "description": "", + "inputMethod": "textfield", + "icon": "editor:title", + "required": true + } + ] + }, + "saveOptions": { + "wipeSlot": false, + "unsetAttributes": [] + }, + "demoSchema": [ + { + "tag": "web-container", + "properties": { + "title": "Sample property title" + }, + "content": "" + } + ] +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.ar.haxProperties.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.ar.haxProperties.json new file mode 100644 index 0000000..f92260f --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.ar.haxProperties.json @@ -0,0 +1,16 @@ +{ + "settings": { + "configure": [ + { + "title": "عنوان" + } + ] + }, + "demoSchema": [ + { + "properties": { + "title": "قيمة مخصصة" + } + } + ] +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.ar.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.ar.json new file mode 100644 index 0000000..1fc8f3d --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.ar.json @@ -0,0 +1,3 @@ +{ + "title": "عنوان" +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.es.haxProperties.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.es.haxProperties.json new file mode 100644 index 0000000..2b055c9 --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.es.haxProperties.json @@ -0,0 +1,16 @@ +{ + "settings": { + "configure": [ + { + "title": "Título" + } + ] + }, + "demoSchema": [ + { + "properties": { + "title": "Valor personalizado" + } + } + ] +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.es.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.es.json new file mode 100644 index 0000000..59c0b61 --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.es.json @@ -0,0 +1,3 @@ +{ + "title": "título" +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.hi.haxProperties.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.hi.haxProperties.json new file mode 100644 index 0000000..6b78fa7 --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.hi.haxProperties.json @@ -0,0 +1,16 @@ +{ + "settings": { + "configure": [ + { + "title": "शीर्षक" + } + ] + }, + "demoSchema": [ + { + "properties": { + "title": "कस्टम मूल्य" + } + } + ] +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.hi.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.hi.json new file mode 100644 index 0000000..3d4a982 --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.hi.json @@ -0,0 +1,3 @@ +{ + "title": "शीर्षक" +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.zh.haxProperties.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.zh.haxProperties.json new file mode 100644 index 0000000..78dada0 --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.zh.haxProperties.json @@ -0,0 +1,16 @@ +{ + "settings": { + "configure": [ + { + "title": "标题" + } + ] + }, + "demoSchema": [ + { + "properties": { + "title": "定制值" + } + } + ] +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.zh.json b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.zh.json new file mode 100644 index 0000000..cc8a97b --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/locales/web-container.zh.json @@ -0,0 +1,3 @@ +{ + "title": "标题" +} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@haxtheweb/web-container/web-container.js b/src/public/build/es6/node_modules/@haxtheweb/web-container/web-container.js new file mode 100644 index 0000000..04ffc6a --- /dev/null +++ b/src/public/build/es6/node_modules/@haxtheweb/web-container/web-container.js @@ -0,0 +1,247 @@ +/** + * Copyright 2024 haxtheweb + * @license Apache-2.0, see LICENSE for full text. + */ +import{LitElement as e,html as t,css as r}from"../../lit/index.js";import{DDDSuper as o}from"../d-d-d/d-d-d.js";import{I18NMixin as i}from"../i18n-manager/lib/I18NMixin.js";import{WebContainer as n}from"../../@webcontainer/api/dist/index.js";import{Terminal as s}from"../../@xterm/xterm/lib/xterm.mjs";import{FitAddon as a}from"../../@xterm/addon-fit/lib/addon-fit.mjs";const l={"index.js":{file:{contents:""}},"package.json":{file:{contents:'\n {\n "name": "hax-webcontainer",\n "type": "module",\n "dependencies": {\n "@haxtheweb/haxcms-nodejs": "latest",\n "nodemon": "latest"\n },\n "scripts": {\n "start": "npx @haxtheweb/haxcms-nodejs"\n }\n }'}}};export class webContainer extends(o(i(e))){static get tag(){return"web-container"}constructor(){super(),this.webcontainerInstance=null,this.t=this.t||{},this.t={...this.t,title:"Title"},this.registerLocalization({context:this,localesPath:new URL("./locales/web-container.ar.json",import.meta.url).href+"/../",locales:["ar","es","hi","zh"]}),globalThis.addEventListener("load",(async()=>{const e=new a,t=new s({convertEol:!0});t.loadAddon(e),t.open(this.shadowRoot.querySelector(".terminal")),e.fit(),this.webcontainerInstance=await n.boot(),await this.webcontainerInstance.mount(l),await this.installDependencies(),await this.startDevServer(),this.webcontainerInstance.on("server-ready",((e,t)=>{this.shadowRoot.querySelector("iframe").src=t}));const r=await this.startShell(t);globalThis.addEventListener("resize",(()=>{e.fit(),r.resize({cols:t.cols,rows:t.rows})}))}))}async installDependencies(){const e=await this.webcontainerInstance.spawn("npm",["install"]);return e.output.pipeTo(new WritableStream({write(e){console.log(e)}})),e.exit}async startDevServer(){await this.webcontainerInstance.spawn("npm",["run","start"])}async startShell(e){const t=await this.webcontainerInstance.spawn("jsh",{terminal:{cols:e.cols,rows:e.rows}});t.output.pipeTo(new WritableStream({write(t){e.write(t)}}));const r=t.input.getWriter();return e.onData((e=>{r.write(e)})),t}async writeIndexJS(e){await this.webcontainerInstance.fs.writeFile("/index.js",e)}static get properties(){return{...super.properties}}static get styles(){return[super.styles,r` + :host { + display: block; + color: var(--ddd-theme-primary); + background-color: var(--ddd-theme-accent); + font-family: var(--ddd-font-navigation); + } + iframe { + width: 100%; + border: none; + background-color: transparent; + } + + .terminal { + padding: 0; + margin: 0; + overflow: hidden; + } + /** + * Copyright (c) 2014 The xterm.js authors. All rights reserved. + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * https://github.com/chjj/term.js + * @license MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + * The original design remains. The terminal itself + * has been extended to include xterm CSI codes, among + * other features. + */ + + /** + * Default styles for xterm.js + */ + + .xterm { + cursor: text; + position: relative; + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; + } + + .xterm.focus, + .xterm:focus { + outline: none; + } + + .xterm .xterm-helpers { + position: absolute; + top: 0; + /** + * The z-index of the helpers must be higher than the canvases in order for + * IMEs to appear on top. + */ + z-index: 5; + } + + .xterm .xterm-helper-textarea { + padding: 0; + border: 0; + margin: 0; + /* Move textarea out of the screen to the far left, so that the cursor is not visible */ + position: absolute; + opacity: 0; + left: -9999em; + top: 0; + width: 0; + height: 0; + z-index: -5; + /** Prevent wrapping so the IME appears against the textarea at the correct position */ + white-space: nowrap; + overflow: hidden; + resize: none; + } + + .xterm .composition-view { + /* TODO: Composition position got messed up somewhere */ + background: #000; + color: #FFF; + display: none; + position: absolute; + white-space: nowrap; + z-index: 1; + } + + .xterm .composition-view.active { + display: block; + } + + .xterm .xterm-viewport { + /* On OS X this is required in order for the scroll bar to appear fully opaque */ + background-color: #000; + overflow-y: scroll; + cursor: default; + position: absolute; + right: 0; + left: 0; + top: 0; + bottom: 0; + } + + .xterm .xterm-screen { + position: relative; + } + + .xterm .xterm-screen canvas { + position: absolute; + left: 0; + top: 0; + } + + .xterm .xterm-scroll-area { + visibility: hidden; + } + + .xterm-char-measure-element { + display: inline-block; + visibility: hidden; + position: absolute; + top: 0; + left: -9999em; + line-height: normal; + } + + .xterm.enable-mouse-events { + /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */ + cursor: default; + } + + .xterm.xterm-cursor-pointer, + .xterm .xterm-cursor-pointer { + cursor: pointer; + } + + .xterm.column-select.focus { + /* Column selection mode */ + cursor: crosshair; + } + + .xterm .xterm-accessibility:not(.debug), + .xterm .xterm-message { + position: absolute; + left: 0; + top: 0; + bottom: 0; + right: 0; + z-index: 10; + color: transparent; + pointer-events: none; + } + + .xterm .xterm-accessibility-tree:not(.debug) *::selection { + color: transparent; + } + + .xterm .xterm-accessibility-tree { + user-select: text; + white-space: pre; + } + + .xterm .live-region { + position: absolute; + left: -9999px; + width: 1px; + height: 1px; + overflow: hidden; + } + + .xterm-dim { + /* Dim should not apply to background, so the opacity of the foreground color is applied + * explicitly in the generated class and reset to 1 here */ + opacity: 1 !important; + } + + .xterm-underline-1 { text-decoration: underline; } + .xterm-underline-2 { text-decoration: double underline; } + .xterm-underline-3 { text-decoration: wavy underline; } + .xterm-underline-4 { text-decoration: dotted underline; } + .xterm-underline-5 { text-decoration: dashed underline; } + + .xterm-overline { + text-decoration: overline; + } + + .xterm-overline.xterm-underline-1 { text-decoration: overline underline; } + .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; } + .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; } + .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; } + .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; } + + .xterm-strikethrough { + text-decoration: line-through; + } + + .xterm-screen .xterm-decoration-container .xterm-decoration { + z-index: 6; + position: absolute; + } + + .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { + z-index: 7; + } + + .xterm-decoration-overview-ruler { + z-index: 8; + position: absolute; + top: 0; + right: 0; + pointer-events: none; + } + + .xterm-decoration-top { + z-index: 2; + position: relative; + } + `]}render(){return t` +
+
+ +
+
+
`}static get haxProperties(){return new URL(`./lib/${this.tag}.haxProperties.json`,import.meta.url).href}}globalThis.customElements.define(webContainer.tag,webContainer); \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/entities.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/entities.js new file mode 100644 index 0000000..17bca46 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/entities.js @@ -0,0 +1 @@ +export{}; \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/index.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/index.js new file mode 100644 index 0000000..cfef51a --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/index.js @@ -0,0 +1 @@ +import{authState as e,assertAuthTokens as t}from"./internal/auth-state.js";import{formatFileSystemTree as r}from"./util.js";import{PreviewMessageType as n}from"./preview-message-types.js";import{Comlink as s}from"./vendor/index.js";import{auth as i}from"./internal/auth-state.js";import{addAccessTokenChangedListener as o}from"./internal/tokens.js";import{iframeSettings as a}from"./internal/iframe-url.js";import{isPreviewMessage as c}from"./utils.js";export const auth=i;export{n as PreviewMessageType};export*from"./utils.js";let l=null,h=null,u={};const d=new TextDecoder,w=new TextEncoder;export class WebContainer{_instance;_runtimeInfo;fs;static _instance=null;_tornDown=!1;_unsubscribeFromTokenChangedListener=()=>{};constructor(r,n,s){this._instance=r,this._runtimeInfo=s,this.fs=new FileSystemAPIClient(n);e.initialized&&(this._unsubscribeFromTokenChangedListener=o((t=>{this._instance.setCredentials({accessToken:t,editorOrigin:e.editorOrigin})})),(async()=>{await e.authComplete.promise,this._tornDown||(t(e.tokens),await this._instance.setCredentials({accessToken:e.tokens.access,editorOrigin:e.editorOrigin}))})().catch((e=>{console.error(e)})))}async spawn(e,t,r){let n,s=[];Array.isArray(t)?s=t:r=t;let i,o,a=new ReadableStream;if(!1!==r?.output){const e=function streamWithPush(){let e=null;const t=new ReadableStream({start(t){e=t}});return{stream:t,push:t=>{null!=t?e?.enqueue(t):(e?.close(),e=null)}}}();n=e.push,a=e.stream}const c=proxyListener(binaryListener(n)),l=proxyListener(binaryListener(i)),h=proxyListener(binaryListener(o)),u=await this._instance.run({command:e,args:s,cwd:r?.cwd,env:r?.env,terminal:r?.terminal},l,h,c);return new WebContainerProcessImpl(u,a,undefined,undefined)}on(e,t){if("preview-message"===e){const e=t;t=t=>{c(t)&&e(t)}}const{listener:r,subscribe:n}=function syncSubscription(e){let t=!1,unsubscribe=()=>{};const wrapped=(...r)=>{t||e(...r)};return{subscribe:e=>(e.then((e=>{unsubscribe=e,t&&unsubscribe()})),()=>{t=!0,unsubscribe()}),listener:wrapped}}(t);return n(this._instance.on(e,s.proxy(r)))}mount(e,t){const n=e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):w.encode(JSON.stringify(r(e)));return this._instance.loadFiles(s.transfer(n,[n.buffer]),{mountPoints:t?.mountPoint})}get path(){return this._runtimeInfo.path}get workdir(){return this._runtimeInfo.cwd}teardown(){if(this._tornDown)throw new Error("WebContainer already torn down");this._tornDown=!0,this._unsubscribeFromTokenChangedListener(),this.fs._teardown(),this._instance.teardown(),this._instance[s.releaseProxy](),WebContainer._instance===this&&(WebContainer._instance=null)}static async boot(t={}){const{workdirName:r}=t;if(window.crossOriginIsolated&&"none"===t.coep&&console.warn("A Cross-Origin-Embedder-Policy header is required in cross origin isolated environments.\nSet the 'coep' option to 'require-corp'."),r?.includes("/")||".."===r||"."===r)throw new Error("workdirName should be a valid folder name");for(e.bootCalled=!0;l;)await l;if(WebContainer._instance)throw new Error("Only a single WebContainer instance can be booted");const n=async function unsynchronizedBoot(e){const{serverPromise:t}=function serverFactory(e){if(null!=h)return e.coep!==u.coep&&(console.warn(`Attempting to boot WebContainer with 'coep: ${e.coep}'`),console.warn(`First boot had 'coep: ${u.coep}', new settings will not take effect!`)),{serverPromise:h};const t=document.createElement("iframe");t.style.display="none",t.setAttribute("allow","cross-origin-isolated");const r=a.url;e.coep&&r.searchParams.set("coep",e.coep);t.src=r.toString();const{origin:n}=r;return u={...e},h=new Promise((e=>{const onMessage=t=>{if(t.origin!==n)return;const{data:r}=t;"init"!==r.type?"warning"!==r.type||console[r.level].call(console,r.message):e(s.wrap(t.ports[0]))};window.addEventListener("message",onMessage)})),document.body.insertBefore(t,null),{serverPromise:h}}(e),r=await t,n=await r.build({host:window.location.host,version:"1.3.0",workdirName:e.workdirName,forwardPreviewErrors:e.forwardPreviewErrors}),i=await n.fs(),o=await n.runtimeInfo();return new WebContainer(n,i,o)}(t);l=n.catch((()=>{}));try{const e=await n;return WebContainer._instance=e,e}finally{l=null}}}export function configureAPIKey(t){if(e.bootCalled)throw new Error("`configureAPIKey` should always be called before `WebContainer.boot`");a.setQueryParam("client_id",t)}class DirEntImpl{name;_type;constructor(e,t){this.name=e,this._type=t}isFile(){return 1===this._type}isDirectory(){return 2===this._type}}class FSWatcher{_apiClient;_path;_options;_listener;_wrappedListener;_watcher;_closed=!1;constructor(e,t,r,n){this._apiClient=e,this._path=t,this._options=r,this._listener=n,this._apiClient._watchers.add(this),this._wrappedListener=(e,t)=>{this._listener&&!this._closed&&this._listener(e,t)},this._apiClient._fs.watch(this._path,this._options,proxyListener(this._wrappedListener)).then((e=>{this._watcher=e,this._closed&&this._teardown()})).catch(console.error)}close(){this._closed||(this._closed=!0,this._apiClient._watchers.delete(this),this._teardown())}_teardown(){this._watcher?.close().finally((()=>{this._watcher?.[s.releaseProxy]()}))}}class WebContainerProcessImpl{output;input;exit;_process;stdout;stderr;constructor(e,t,r,n){this.output=t,this._process=e,this.input=new WritableStream({write:e=>{this._getProcess()?.write(e).catch((()=>{}))}}),this.exit=this._onExit(),this.stdout=r,this.stderr=n}kill(){this._getProcess()?.kill()}resize(e){this._getProcess()?.resize(e)}async _onExit(){try{return await this._process.onExit}finally{this._process?.[s.releaseProxy](),this._process=null}}_getProcess(){return null==this._process&&console.warn("This process already exited"),this._process}}class FileSystemAPIClient{_fs;_watchers=new Set([]);constructor(e){this._fs=e}rm(...e){return this._fs.rm(...e)}async readFile(e,t){return await this._fs.readFile(e,t)}async rename(e,t){return await this._fs.rename(e,t)}async writeFile(e,t,r){if(t instanceof Uint8Array){const e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);t=s.transfer(new Uint8Array(e),[e])}await this._fs.writeFile(e,t,r)}async readdir(e,t){const r=await this._fs.readdir(e,t);if(function isStringArray(e){return"string"==typeof e[0]}(r))return r;if(function isTypedArrayCollection(e){return e[0]instanceof Uint8Array}(r))return r;return r.map((e=>new DirEntImpl(e.name,e["Symbol(type)"])))}async mkdir(e,t){return await this._fs.mkdir(e,t)}watch(e,t,r){return"function"==typeof t&&(r=t,t=null),new FSWatcher(this,e,t,r)}_teardown(){this._fs[s.releaseProxy]();for(const e of this._watchers)e.close()}}function binaryListener(e){if(null!=e)return t=>{t instanceof Uint8Array?e(d.decode(t)):null==t&&e(null)}}function proxyListener(e){if(null!=e)return s.proxy(e)} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/TypedEventTarget.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/TypedEventTarget.js new file mode 100644 index 0000000..b0a16ee --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/TypedEventTarget.js @@ -0,0 +1 @@ +export class TypedEventTarget{_bus=new EventTarget;listen(e){function wrappedListener(s){e(s.data)}return this._bus.addEventListener("message",wrappedListener),()=>this._bus.removeEventListener("message",wrappedListener)}fireEvent(e){this._bus.dispatchEvent(new MessageEvent("message",{data:e}))}} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/api-server.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/api-server.js new file mode 100644 index 0000000..17bca46 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/api-server.js @@ -0,0 +1 @@ +export{}; \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/auth-state.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/auth-state.js new file mode 100644 index 0000000..49d3c06 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/auth-state.js @@ -0,0 +1 @@ +import{Tokens as t,clearTokensInStorage as e}from"./tokens.js";import{SEARCH_PARAM_AUTH_CODE as a,SEARCH_PARAM_ERROR as o,STORAGE_CODE_VERIFIER_NAME as r,BROADCAST_CHANNEL_NAME as n,STORAGE_POPUP_NAME as i,SEARCH_PARAM_ERROR_DESCRIPTION as s}from"./constants.js";import{iframeSettings as u}from"./iframe-url.js";import{S256 as h,newCodeVerifier as d}from"./code.js";import{resettablePromise as l}from"./reset-promise.js";import{TypedEventTarget as c}from"./TypedEventTarget.js";export const authState={initialized:!1,bootCalled:!1,forwardAuth:!0,redirectUri:"",authComplete:l(),clientId:"",oauthScope:"",broadcastChannel:null,get editorOrigin(){return u.editorOrigin},tokens:null,cleanup:[]};const p=new c,f=new c;function broadcastMessage(t){authState.broadcastChannel&&(authState.broadcastChannel.postMessage(t),"true"===localStorage.getItem(i)&&"auth-logout"!==t.type&&(localStorage.removeItem(i),setTimeout((()=>{window.close()}))))}export const auth={init({editorOrigin:i,clientId:h,scope:d,forwardAuth:l,redirectUri:c}){if(authState.initialized)throw new Error("Init should only be called once");if(authState.bootCalled)throw new Error("`auth.init` should always be called before `WebContainer.boot`");authState.initialized=!0,authState.forwardAuth=l??!0,authState.redirectUri=c??defaultRedirectUri();let w=!0;if(authState.tokens=t.fromStorage(),authState.clientId=h,authState.oauthScope=d,authState.broadcastChannel=new BroadcastChannel(n),u.setQueryParam("client_id",h),i&&(u.editorOrigin=new URL(i).origin),f.listen((()=>authState.authComplete.reset())),authState.broadcastChannel.addEventListener("message",(async function onChannelMessage(e){const a=e.data;if("auth-complete"===a.type)return authState.tokens=t.fromStorage(),authState.tokens,await authState.tokens.activate(w,onFailedTokenRefresh),void authState.authComplete.resolve();if("auth-failed"===a.type)return void p.fireEvent(a);if("auth-logout"===a.type)return void f.fireEvent()})),authState.tokens){const t=authState.tokens;if(t.origin===authState.editorOrigin)return(async()=>{if(await t.activate(w,onFailedTokenRefresh))authState.authComplete.resolve();else{if(authState.tokens!==t)return;f.fireEvent()}})(),{status:"authorized"};e(),authState.tokens=null}const g=new URL(window.location.href),{searchParams:S}=g,updateURL=()=>window.history.replaceState({},document.title,g);if(S.has(o)){const t=S.get(o),e=S.get(s);return S.delete(o),S.delete(s),updateURL(),broadcastMessage({type:"auth-failed",error:t,description:e}),{status:"auth-failed",error:t,description:e}}if(S.has(a)){const e=S.get(a),o=authState.editorOrigin;S.delete(a),updateURL();const n=localStorage.getItem(r);if(!n)return{status:"need-auth"};localStorage.removeItem(r);let i=defaultRedirectUri();return t.fromAuthCode({editorOrigin:o,clientId:authState.clientId,authCode:e,codeVerifier:n,redirectUri:i}).then((async t=>{authState.tokens=t,assertAuthTokens(authState.tokens);if(!await authState.tokens.activate(w,onFailedTokenRefresh))throw new Error;authState.authComplete.resolve(),broadcastMessage({type:"auth-complete"})})).catch((t=>{console.error(t),f.fireEvent(),broadcastMessage({type:"auth-logout"})})),{status:"authorized"}}return{status:"need-auth"}},async startAuthFlow({popup:t}={}){if(!authState.initialized)throw new Error("auth.init must be called first");if(t){localStorage.setItem(i,"true");const t=500,e=620,a=window.screenLeft+(window.outerWidth-e)/2,o=window.screenTop+(window.outerHeight-t)/2;window.open(await generateOAuthRequest(),"_blank",`popup,width=${e},height=${t},left=${a},top=${o}`)}else window.location.href=await generateOAuthRequest()},async logout({ignoreRevokeError:t}={}){await(authState.tokens?.revoke(authState.clientId,t??!1)),f.fireEvent(),broadcastMessage({type:"auth-logout"})},loggedIn:()=>authState.authComplete.promise,on(t,e){switch(t){case"auth-failed":return p.listen(e);case"logged-out":return f.listen(e);default:throw new Error(`Unsupported event type '${t}'.`)}}};function onFailedTokenRefresh(){f.fireEvent(),broadcastMessage({type:"auth-logout"})}function defaultRedirectUri(){return window.location.href}async function generateOAuthRequest(){const t=d();localStorage.setItem(r,t);const e=await h(t),a=new URL("/oauth/authorize",authState.editorOrigin),{searchParams:o}=a;let n=defaultRedirectUri();return o.append("response_type","code"),o.append("client_id",authState.clientId),o.append("redirect_uri",n),o.append("scope",authState.oauthScope),o.append("code_challenge",e),o.append("code_challenge_method","S256"),a.toString()}export function assertAuthTokens(t){if(!t)throw new Error("Oops! Tokens is not defined when it always should be.")} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/code.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/code.js new file mode 100644 index 0000000..b210188 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/code.js @@ -0,0 +1 @@ +export async function S256(e){const r=(new TextEncoder).encode(e),n=new Uint8Array(await crypto.subtle.digest("SHA-256",r));return btoa(n.reduce(((e,r)=>e+String.fromCodePoint(r)),"")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}export function newCodeVerifier(){const e=new Uint8Array(96);crypto.getRandomValues(e);let r="";for(let n=0;n<32;++n)r+=nextFourChars(e[3*n+0],e[3*n+1],e[3*n+2]);return r}function nextFourChars(e,r,n){return[e>>2,(3&e)<<4|r>>4,15&r|(192&n)>>2,63&n].map(unreservedCharacters).join("")}function unreservedCharacters(e){let r;return r=e<26?e+65:e<52?e-26+97:e<62?e-52+48:62===e?30:45,String.fromCharCode(r)} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/constants.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/constants.js new file mode 100644 index 0000000..b155f44 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/constants.js @@ -0,0 +1 @@ +export const DEFAULT_EDITOR_ORIGIN="https://stackblitz.com";export const SEARCH_PARAM_AUTH_CODE="code";export const SEARCH_PARAM_ERROR="error";export const SEARCH_PARAM_ERROR_DESCRIPTION="error_description";export const BROADCAST_CHANNEL_NAME="__wc_api_bc__";export const STORAGE_TOKENS_NAME="__wc_api_tokens__";export const STORAGE_CODE_VERIFIER_NAME="__wc_api_verifier__";export const STORAGE_POPUP_NAME="__wc_api_popup__"; \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/iframe-url.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/iframe-url.js new file mode 100644 index 0000000..4315d1c --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/iframe-url.js @@ -0,0 +1 @@ +import{DEFAULT_EDITOR_ORIGIN as e}from"./constants.js";const r={};let t=null;export const iframeSettings={get editorOrigin(){return null==t&&(t=new URL(globalThis.WEBCONTAINER_API_IFRAME_URL??e).origin),t},set editorOrigin(e){t=new URL(e).origin},setQueryParam(e,t){r[e]=t},get url(){const e=new URL(this.editorOrigin);e.pathname="/headless";for(const t in r)e.searchParams.set(t,r[t]);return e.searchParams.set("version","1.3.0"),e}}; \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/reset-promise.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/reset-promise.js new file mode 100644 index 0000000..35e8bff --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/reset-promise.js @@ -0,0 +1 @@ +export function resettablePromise(){let e,r;function reset(){r=new Promise((r=>e=r))}return reset(),{get promise(){return r},resolve:r=>e(r),reset}} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/tokens.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/tokens.js new file mode 100644 index 0000000..d61e18f --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/internal/tokens.js @@ -0,0 +1 @@ +import{STORAGE_TOKENS_NAME as e}from"./constants.js";import{TypedEventTarget as t}from"./TypedEventTarget.js";const r=new Error;r.stack="";const o=new t;export class Tokens{origin;refresh;access;expires;_revoked=new AbortController;constructor(e,t,r,o){this.origin=e,this.refresh=t,this.access=r,this.expires=o}async activate(e,t){if(this._revoked.signal.aborted)throw new Error("Token revoked");return!(e&&this.expiressetTimeout(t,e)))} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/preview-message-types.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/preview-message-types.js new file mode 100644 index 0000000..100ac92 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/preview-message-types.js @@ -0,0 +1 @@ +export var PreviewMessageType;!function(e){e.UncaughtException="PREVIEW_UNCAUGHT_EXCEPTION",e.UnhandledRejection="PREVIEW_UNHANDLED_REJECTION",e.ConsoleError="PREVIEW_CONSOLE_ERROR"}(PreviewMessageType||(PreviewMessageType={})); \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/util.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/util.js new file mode 100644 index 0000000..8a38475 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/util.js @@ -0,0 +1 @@ +export function formatFileSystemTree(t){const n={d:{}};for(const e of Object.keys(t)){const o=t[e];if("file"in o){const t=o.file.contents,r="string"==typeof t?t:binaryString(t),i="string"==typeof t?{}:{b:!0};n.d[e]={f:{c:r,...i}};continue}const r=formatFileSystemTree(o.directory);n.d[e]=r}return n}function binaryString(t){let n="";for(const e of t)n+=String.fromCharCode(e);return n} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/utils.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/utils.js new file mode 100644 index 0000000..8c89b03 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/utils.js @@ -0,0 +1 @@ +export{reloadPreview}from"./utils/reload-preview.js";export{PreviewMessageType}from"./preview-message-types.js";export{isPreviewMessage}from"./utils/is-preview-message.js"; \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/utils/is-preview-message.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/utils/is-preview-message.js new file mode 100644 index 0000000..9c47798 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/utils/is-preview-message.js @@ -0,0 +1 @@ +import{PreviewMessageType as e}from"../preview-message-types.js";const n=[e.ConsoleError,e.UncaughtException,e.UnhandledRejection];export function isPreviewMessage(e){return null!=e&&"object"==typeof e&&!(!("type"in e)||!n.includes(e.type))} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/utils/reload-preview.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/utils/reload-preview.js new file mode 100644 index 0000000..67b3a12 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/utils/reload-preview.js @@ -0,0 +1 @@ +export function reloadPreview(e,t=200){const{port1:o,port2:n}=new MessageChannel;let s;const c=new Promise((e=>{s=e})),done=()=>{s(),n.close()},r=setTimeout((()=>{const t=e.src;e.src=t,done()}),t);return n.addEventListener("message",(e=>{const t=e.data;null!=t&&"object"==typeof t&&"LOCALSERVICE_WINDOW_RELOADED"===t.type&&(clearTimeout(r),done())})),e.contentWindow?.postMessage({type:"LOCALSERVICE_RELOAD_WINDOW",callback:o},"*",[o]),c} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@webcontainer/api/dist/vendor/index.js b/src/public/build/es6/node_modules/@webcontainer/api/dist/vendor/index.js new file mode 100644 index 0000000..cef64e0 --- /dev/null +++ b/src/public/build/es6/node_modules/@webcontainer/api/dist/vendor/index.js @@ -0,0 +1 @@ +var e=Object.defineProperty,t={};((t,r)=>{for(var n in r)e(t,n,{get:r[n],enumerable:!0})})(t,{createEndpoint:()=>n,expose:()=>expose,proxy:()=>proxy,proxyMarker:()=>r,releaseProxy:()=>a,transfer:()=>transfer,transferHandlers:()=>o,windowEndpoint:()=>windowEndpoint,wrap:()=>wrap});var r=Symbol("Comlink.proxy"),n=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),s=Symbol("Comlink.thrown"),isObject=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>isObject(e)&&e[r],serialize(e){const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize:e=>(e.start(),wrap(e))}],["throw",{canHandle:e=>isObject(e)&&s in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function expose(e,t=self){t.addEventListener("message",(function callback(r){if(!r||!r.data)return;const{id:n,type:a,path:o}=Object.assign({path:[]},r.data),i=(r.data.argumentList||[]).map(fromWireValue);let u;try{const t=o.slice(0,-1).reduce(((e,t)=>e[t]),e),n=o.reduce(((e,t)=>e[t]),e);switch(a){case 0:u=n;break;case 1:t[o.slice(-1)[0]]=fromWireValue(r.data.value),u=!0;break;case 2:u=n.apply(t,i);break;case 3:u=proxy(new n(...i));break;case 4:{const{port1:t,port2:r}=new MessageChannel;expose(e,r),u=transfer(t,[t])}break;case 5:u=void 0}}catch(e){u={value:e,[s]:0}}Promise.resolve(u).catch((e=>({value:e,[s]:0}))).then((e=>{const[r,s]=toWireValue(e);t.postMessage(Object.assign(Object.assign({},r),{id:n}),s),5===a&&(t.removeEventListener("message",callback),closeEndPoint(t))}))})),t.start&&t.start()}function closeEndPoint(e){(function isMessagePort(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function wrap(e,t){return createProxy(e,[],t)}function throwIfProxyReleased(e){if(e)throw new Error("Proxy has been released and is not useable")}function createProxy(e,t=[],r=function(){}){let s=!1;const o=new Proxy(r,{get(r,n){if(throwIfProxyReleased(s),n===a)return()=>requestResponseMessage(e,{type:5,path:t.map((e=>e.toString()))}).then((()=>{closeEndPoint(e),s=!0}));if("then"===n){if(0===t.length)return{then:()=>o};const r=requestResponseMessage(e,{type:0,path:t.map((e=>e.toString()))}).then(fromWireValue);return r.then.bind(r)}return createProxy(e,[...t,n])},set(r,n,a){throwIfProxyReleased(s);const[o,i]=toWireValue(a);return requestResponseMessage(e,{type:1,path:[...t,n].map((e=>e.toString())),value:o},i).then(fromWireValue)},apply(r,a,o){throwIfProxyReleased(s);const i=t[t.length-1];if(i===n)return requestResponseMessage(e,{type:4}).then(fromWireValue);if("bind"===i)return createProxy(e,t.slice(0,-1));const[u,c]=processArguments(o);return requestResponseMessage(e,{type:2,path:t.map((e=>e.toString())),argumentList:u},c).then(fromWireValue)},construct(r,n){throwIfProxyReleased(s);const[a,o]=processArguments(n);return requestResponseMessage(e,{type:3,path:t.map((e=>e.toString())),argumentList:a},o).then(fromWireValue)}});return o}function processArguments(e){const t=e.map(toWireValue);return[t.map((e=>e[0])),(r=t.map((e=>e[1])),Array.prototype.concat.apply([],r))];var r}var i=new WeakMap;function transfer(e,t){return i.set(e,t),e}function proxy(e){return Object.assign(e,{[r]:!0})}function windowEndpoint(e,t=self,r="*"){return{postMessage:(t,n)=>e.postMessage(t,r,n),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function toWireValue(e){for(const[t,r]of o)if(r.canHandle(e)){const[n,a]=r.serialize(e);return[{type:3,name:t,value:n},a]}return[{type:0,value:e},i.get(e)||[]]}function fromWireValue(e){switch(e.type){case 3:return o.get(e.name).deserialize(e.value);case 0:return e.value}}function requestResponseMessage(e,t,r){return new Promise((n=>{const a=function generateUUID(){return new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-")}();e.addEventListener("message",(function l(t){t.data&&t.data.id&&t.data.id===a&&(e.removeEventListener("message",l),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:a},t),r)}))}export{t as Comlink}; \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.js b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.js new file mode 100644 index 0000000..0680fc5 --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.js @@ -0,0 +1 @@ +var e,t;e=globalThis,t=()=>{return e=t={},Object.defineProperty(e,"__esModule",{value:!0}),e.FitAddon=void 0,e.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;const t=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),o=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),n=i-(parseInt(s.getPropertyValue("padding-top"))+parseInt(s.getPropertyValue("padding-bottom"))),l=o-(parseInt(s.getPropertyValue("padding-right"))+parseInt(s.getPropertyValue("padding-left")))-t;return{cols:Math.max(2,Math.floor(l/e.css.cell.width)),rows:Math.max(1,Math.floor(n/e.css.cell.height))}}},t;var e,t},"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t(); \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.js.map b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.js.map new file mode 100644 index 0000000..15f7b97 --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addon-fit.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAkB,SAAID,IAEtBD,EAAe,SAAIC,GACpB,CATD,CASGK,YAAY,I,mHCgBf,iBAGS,QAAAC,CAASC,GACdC,KAAKC,UAAYF,CACnB,CAEO,OAAAG,GAAiB,CAEjB,GAAAC,GACL,MAAMC,EAAOJ,KAAKK,oBAClB,IAAKD,IAASJ,KAAKC,WAAaK,MAAMF,EAAKG,OAASD,MAAMF,EAAKI,MAC7D,OAIF,MAAMC,EAAQT,KAAKC,UAAkBS,MAGjCV,KAAKC,UAAUO,OAASJ,EAAKI,MAAQR,KAAKC,UAAUM,OAASH,EAAKG,OACpEE,EAAKE,eAAeC,QACpBZ,KAAKC,UAAUY,OAAOT,EAAKG,KAAMH,EAAKI,MAE1C,CAEO,iBAAAH,GACL,IAAKL,KAAKC,UACR,OAGF,IAAKD,KAAKC,UAAUa,UAAYd,KAAKC,UAAUa,QAAQC,cACrD,OAIF,MACMX,EADQJ,KAAKC,UAAkBS,MACAC,eAAeK,WAEpD,GAA4B,IAAxBZ,EAAKa,IAAIC,KAAKC,OAAwC,IAAzBf,EAAKa,IAAIC,KAAKE,OAC7C,OAGF,MAAMC,EAAwD,IAAtCrB,KAAKC,UAAUqB,QAAQC,WAC3C,EACCvB,KAAKC,UAAUqB,QAAQE,eAAeL,OAAS,GAE9CM,EAAqBC,OAAOC,iBAAiB3B,KAAKC,UAAUa,QAAQC,eACpEa,EAAsBC,SAASJ,EAAmBK,iBAAiB,WACnEC,EAAqBC,KAAKC,IAAI,EAAGJ,SAASJ,EAAmBK,iBAAiB,WAC9EI,EAAeR,OAAOC,iBAAiB3B,KAAKC,UAAUa,SAStDqB,EAAkBP,GAPjBC,SAASK,EAAaJ,iBAAiB,gBACpCD,SAASK,EAAaJ,iBAAiB,oBAO3CM,EAAiBL,GANdF,SAASK,EAAaJ,iBAAiB,kBACxCD,SAASK,EAAaJ,iBAAiB,kBAKiBT,EAKhE,MAJiB,CACfd,KAAMyB,KAAKC,IAhEI,EAgEcD,KAAKK,MAAMD,EAAiBhC,EAAKa,IAAIC,KAAKC,QACvEX,KAAMwB,KAAKC,IAhEI,EAgEcD,KAAKK,MAAMF,EAAkB/B,EAAKa,IAAIC,KAAKE,SAG5E,E","sources":["webpack://FitAddon/webpack/universalModuleDefinition","webpack://FitAddon/./src/FitAddon.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FitAddon\"] = factory();\n\telse\n\t\troot[\"FitAddon\"] = factory();\n})(globalThis, () => {\nreturn ","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport type { Terminal, ITerminalAddon } from '@xterm/xterm';\nimport type { FitAddon as IFitApi } from '@xterm/addon-fit';\nimport { IRenderDimensions } from 'browser/renderer/shared/Types';\nimport { ViewportConstants } from 'browser/shared/Constants';\n\ninterface ITerminalDimensions {\n /**\n * The number of rows in the terminal.\n */\n rows: number;\n\n /**\n * The number of columns in the terminal.\n */\n cols: number;\n}\n\nconst MINIMUM_COLS = 2;\nconst MINIMUM_ROWS = 1;\n\nexport class FitAddon implements ITerminalAddon , IFitApi {\n private _terminal: Terminal | undefined;\n\n public activate(terminal: Terminal): void {\n this._terminal = terminal;\n }\n\n public dispose(): void {}\n\n public fit(): void {\n const dims = this.proposeDimensions();\n if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) {\n return;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n\n // Force a full render\n if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {\n core._renderService.clear();\n this._terminal.resize(dims.cols, dims.rows);\n }\n }\n\n public proposeDimensions(): ITerminalDimensions | undefined {\n if (!this._terminal) {\n return undefined;\n }\n\n if (!this._terminal.element || !this._terminal.element.parentElement) {\n return undefined;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n const dims: IRenderDimensions = core._renderService.dimensions;\n\n if (dims.css.cell.width === 0 || dims.css.cell.height === 0) {\n return undefined;\n }\n\n const scrollbarWidth = (this._terminal.options.scrollback === 0\n ? 0\n : (this._terminal.options.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));\n\n const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);\n const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));\n const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));\n const elementStyle = window.getComputedStyle(this._terminal.element);\n const elementPadding = {\n top: parseInt(elementStyle.getPropertyValue('padding-top')),\n bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),\n right: parseInt(elementStyle.getPropertyValue('padding-right')),\n left: parseInt(elementStyle.getPropertyValue('padding-left'))\n };\n const elementPaddingVer = elementPadding.top + elementPadding.bottom;\n const elementPaddingHor = elementPadding.right + elementPadding.left;\n const availableHeight = parentElementHeight - elementPaddingVer;\n const availableWidth = parentElementWidth - elementPaddingHor - scrollbarWidth;\n const geometry = {\n cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / dims.css.cell.width)),\n rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / dims.css.cell.height))\n };\n return geometry;\n }\n}\n"],"names":["root","factory","exports","module","define","amd","globalThis","activate","terminal","this","_terminal","dispose","fit","dims","proposeDimensions","isNaN","cols","rows","core","_core","_renderService","clear","resize","element","parentElement","dimensions","css","cell","width","height","scrollbarWidth","options","scrollback","overviewRuler","parentElementStyle","window","getComputedStyle","parentElementHeight","parseInt","getPropertyValue","parentElementWidth","Math","max","elementStyle","availableHeight","availableWidth","floor"],"sourceRoot":""} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.mjs b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.mjs new file mode 100644 index 0000000..24d4f61 --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.mjs @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. + * @license MIT + * + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * @license MIT + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + */ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var h=2,_=1,o=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let s=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),i=window.getComputedStyle(this._terminal.element),n={top:parseInt(i.getPropertyValue("padding-top")),bottom:parseInt(i.getPropertyValue("padding-bottom")),right:parseInt(i.getPropertyValue("padding-right")),left:parseInt(i.getPropertyValue("padding-left"))},m=n.top+n.bottom,d=n.right+n.left,c=l-m,p=a-d-s;return{cols:Math.max(h,Math.floor(p/t.css.cell.width)),rows:Math.max(_,Math.floor(c/t.css.cell.height))}}};export{o as FitAddon}; +//# sourceMappingURL=addon-fit.mjs.map diff --git a/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.mjs.map b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.mjs.map new file mode 100644 index 0000000..f6c8a48 --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/addon-fit/lib/addon-fit.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/FitAddon.ts"], + "sourcesContent": ["/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport type { Terminal, ITerminalAddon } from '@xterm/xterm';\nimport type { FitAddon as IFitApi } from '@xterm/addon-fit';\nimport { IRenderDimensions } from 'browser/renderer/shared/Types';\nimport { ViewportConstants } from 'browser/shared/Constants';\n\ninterface ITerminalDimensions {\n /**\n * The number of rows in the terminal.\n */\n rows: number;\n\n /**\n * The number of columns in the terminal.\n */\n cols: number;\n}\n\nconst MINIMUM_COLS = 2;\nconst MINIMUM_ROWS = 1;\n\nexport class FitAddon implements ITerminalAddon , IFitApi {\n private _terminal: Terminal | undefined;\n\n public activate(terminal: Terminal): void {\n this._terminal = terminal;\n }\n\n public dispose(): void {}\n\n public fit(): void {\n const dims = this.proposeDimensions();\n if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) {\n return;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n\n // Force a full render\n if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {\n core._renderService.clear();\n this._terminal.resize(dims.cols, dims.rows);\n }\n }\n\n public proposeDimensions(): ITerminalDimensions | undefined {\n if (!this._terminal) {\n return undefined;\n }\n\n if (!this._terminal.element || !this._terminal.element.parentElement) {\n return undefined;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n const dims: IRenderDimensions = core._renderService.dimensions;\n\n if (dims.css.cell.width === 0 || dims.css.cell.height === 0) {\n return undefined;\n }\n\n const scrollbarWidth = (this._terminal.options.scrollback === 0\n ? 0\n : (this._terminal.options.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));\n\n const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);\n const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));\n const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));\n const elementStyle = window.getComputedStyle(this._terminal.element);\n const elementPadding = {\n top: parseInt(elementStyle.getPropertyValue('padding-top')),\n bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),\n right: parseInt(elementStyle.getPropertyValue('padding-right')),\n left: parseInt(elementStyle.getPropertyValue('padding-left'))\n };\n const elementPaddingVer = elementPadding.top + elementPadding.bottom;\n const elementPaddingHor = elementPadding.right + elementPadding.left;\n const availableHeight = parentElementHeight - elementPaddingVer;\n const availableWidth = parentElementWidth - elementPaddingHor - scrollbarWidth;\n const geometry = {\n cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / dims.css.cell.width)),\n rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / dims.css.cell.height))\n };\n return geometry;\n }\n}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MA,EAAe,OACxDE,EAAoBF,EAAe,MAAQA,EAAe,KAC1DG,EAAkBN,EAAsBI,EACxCG,EAAiBN,EAAqBI,EAAoBP,EAKhE,MAJiB,CACf,KAAM,KAAK,IAAIN,EAAc,KAAK,MAAMe,EAAiBX,EAAK,IAAI,KAAK,KAAK,CAAC,EAC7E,KAAM,KAAK,IAAIH,EAAc,KAAK,MAAMa,EAAkBV,EAAK,IAAI,KAAK,MAAM,CAAC,CACjF,CAEF,CACF", + "names": ["MINIMUM_COLS", "MINIMUM_ROWS", "FitAddon", "terminal", "dims", "core", "scrollbarWidth", "parentElementStyle", "parentElementHeight", "parentElementWidth", "elementStyle", "elementPadding", "elementPaddingVer", "elementPaddingHor", "availableHeight", "availableWidth"] +} diff --git a/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.js b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.js new file mode 100644 index 0000000..7ad73e8 --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.js @@ -0,0 +1 @@ +!function(N,j){if("object"==typeof exports&&"object"==typeof module)module.exports=j();else if("function"==typeof define&&define.amd)define([],j);else{var X=j();for(var ie in X)("object"==typeof exports?exports:N)[ie]=X[ie]}}(globalThis,(()=>(()=>{var N={2840:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.AccessibilityManager=void 0;const le=X(7721),he=X(4292),ce=X(7150),_e=X(7098),me=X(6501),ve=X(7093);let Se=class extends ce.Disposable{constructor(N,j,X,ie){super(),this._terminal=N,this._coreBrowserService=X,this._renderService=ie,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";const se=this._coreBrowserService.mainDocument;this._accessibilityContainer=se.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=se.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;Nthis._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=se.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new he.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((N=>this._handleResize(N.rows)))),this._register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this._register(this._terminal.onScroll((()=>this._refreshRows()))),this._register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this._register(this._terminal.onLineFeed((()=>this._handleChar("\n")))),this._register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this._register(this._terminal.onKey((N=>this._handleKey(N.key)))),this._register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this._register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._register((0,ve.addDisposableListener)(se,"selectionchange",(()=>this._handleSelectionChange()))),this._register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRowsDimensions(),this._refreshRows(),this._register((0,ce.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(N){for(let j=0;j0?this._charsToConsume.shift()!==N&&(this._charsToAnnounce+=N):this._charsToAnnounce+=N,"\n"===N&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=le.tooMuchOutput.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(N){this._clearLiveRegion(),/\p{Control}/u.test(N)||this._charsToConsume.push(N)}_refreshRows(N,j){this._liveRegionDebouncer.refresh(N,j,this._terminal.rows)}_renderRows(N,j){const X=this._terminal.buffer,ie=X.lines.length.toString();for(let se=N;se<=j;se++){const N=X.lines.get(X.ydisp+se),j=[],le=N?.translateToString(!0,void 0,void 0,j)||"",he=(X.ydisp+se+1).toString(),ce=this._rowElements[se];ce&&(0===le.length?(ce.innerText=" ",this._rowColumns.set(ce,[0,1])):(ce.textContent=le,this._rowColumns.set(ce,j)),ce.setAttribute("aria-posinset",he),ce.setAttribute("aria-setsize",ie),this._alignRowWidth(ce))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(N,j){const X=N.target,ie=this._rowElements[0===j?1:this._rowElements.length-2];if(X.getAttribute("aria-posinset")===(0===j?"1":`${this._terminal.buffer.lines.length}`))return;if(N.relatedTarget!==ie)return;let se,le;if(0===j?(se=X,le=this._rowElements.pop(),this._rowContainer.removeChild(le)):(se=this._rowElements.shift(),le=X,this._rowContainer.removeChild(se)),se.removeEventListener("focus",this._topBoundaryFocusListener),le.removeEventListener("focus",this._bottomBoundaryFocusListener),0===j){const N=this._createAccessibilityTreeNode();this._rowElements.unshift(N),this._rowContainer.insertAdjacentElement("afterbegin",N)}else{const N=this._createAccessibilityTreeNode();this._rowElements.push(N),this._rowContainer.appendChild(N)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===j?-1:1),this._rowElements[0===j?1:this._rowElements.length-2].focus(),N.preventDefault(),N.stopImmediatePropagation()}_handleSelectionChange(){if(0===this._rowElements.length)return;const N=this._coreBrowserService.mainDocument.getSelection();if(!N)return;if(N.isCollapsed)return void(this._rowContainer.contains(N.anchorNode)&&this._terminal.clearSelection());if(!N.anchorNode||!N.focusNode)return void console.error("anchorNode and/or focusNode are null");let j={node:N.anchorNode,offset:N.anchorOffset},X={node:N.focusNode,offset:N.focusOffset};if((j.node.compareDocumentPosition(X.node)&Node.DOCUMENT_POSITION_PRECEDING||j.node===X.node&&j.offset>X.offset)&&([j,X]=[X,j]),j.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(j={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(j.node))return;const ie=this._rowElements.slice(-1)[0];if(X.node.compareDocumentPosition(ie)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(X={node:ie,offset:ie.textContent?.length??0}),!this._rowContainer.contains(X.node))return;const r=({node:N,offset:j})=>{const X=N instanceof Text?N.parentNode:N;let ie=parseInt(X?.getAttribute("aria-posinset"),10)-1;if(isNaN(ie))return console.warn("row is invalid. Race condition?"),null;const se=this._rowColumns.get(X);if(!se)return console.warn("columns is null. Race condition?"),null;let le=j=this._terminal.cols&&(++ie,le=0),{row:ie,column:le}},se=r(j),le=r(X);if(se&&le){if(se.row>le.row||se.row===le.row&&se.column>=le.column)throw new Error("invalid range");this._terminal.select(se.column,se.row,(le.row-se.row)*this._terminal.cols-se.column+le.column)}}_handleResize(N){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let N=this._rowContainer.children.length;NN;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const N=this._coreBrowserService.mainDocument.createElement("div");return N.setAttribute("role","listitem"),N.tabIndex=-1,this._refreshRowDimensions(N),N}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let N=0;N{function i(N){return N.replace(/\r?\n/g,"\r")}function s(N,j){return j?"[200~"+N+"[201~":N}function r(N,j,X,ie){N=s(N=i(N),X.decPrivateModes.bracketedPasteMode&&!0!==ie.rawOptions.ignoreBracketedPasteMode),X.triggerDataEvent(N,!0),j.value=""}function n(N,j,X){const ie=X.getBoundingClientRect(),se=N.clientX-ie.left-10,le=N.clientY-ie.top-10;j.style.width="20px",j.style.height="20px",j.style.left=`${se}px`,j.style.top=`${le}px`,j.style.zIndex="1000",j.focus()}Object.defineProperty(j,"__esModule",{value:!0}),j.prepareTextForTerminal=i,j.bracketTextForPaste=s,j.copyHandler=function(N,j){N.clipboardData&&N.clipboardData.setData("text/plain",j.selectionText),N.preventDefault()},j.handlePasteEvent=function(N,j,X,ie){N.stopPropagation(),N.clipboardData&&r(N.clipboardData.getData("text/plain"),j,X,ie)},j.paste=r,j.moveTextAreaUnderMouseCursor=n,j.rightClickHandler=function(N,j,X,ie,se){n(N,j,X),se&&ie.rightClickSelect(N),j.value=ie.selectionText,j.select()}},7174:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ColorContrastCache=void 0;const ie=X(7710);j.ColorContrastCache=class{constructor(){this._color=new ie.TwoKeyMap,this._css=new ie.TwoKeyMap}setCss(N,j,X){this._css.set(N,j,X)}getCss(N,j){return this._css.get(N,j)}setColor(N,j,X){this._color.set(N,j,X)}getColor(N,j){return this._color.get(N,j)}clear(){this._color.clear(),this._css.clear()}}},1718:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.CoreBrowserTerminal=void 0;const ie=X(7861),se=X(7721),le=X(3285),he=X(4017),ce=X(4196),_e=X(9925),me=X(3618),ve=X(3955),Se=X(4792),be=X(945),Ce=X(9574),ye=X(9820),we=X(9784),Ee=X(5783),De=X(2079),Le=X(7098),Ae=X(9078),Re=X(4103),Te=X(5777),ke=X(701),Me=X(6107),Oe=X(3534),Ie=X(706),Pe=X(8693),xe=X(4720),Be=X(6501),Ne=X(2486),Ue=X(2840),Fe=X(8906),We=X(802),He=X(7093),Ke=X(7150);class x extends Te.CoreTerminal{get linkifier(){return this._linkifier.value}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(N={}){super(N),this._linkifier=this._register(new Ke.MutableDisposable),this.browser=ke,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ke.MutableDisposable),this._onCursorMove=this._register(new We.Emitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new We.Emitter),this.onKey=this._onKey.event,this._onRender=this._register(new We.Emitter),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new We.Emitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new We.Emitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new We.Emitter),this.onBell=this._onBell.event,this._onFocus=this._register(new We.Emitter),this._onBlur=this._register(new We.Emitter),this._onA11yCharEmitter=this._register(new We.Emitter),this._onA11yTabEmitter=this._register(new We.Emitter),this._onWillOpen=this._register(new We.Emitter),this._setup(),this._decorationService=this._instantiationService.createInstance(xe.DecorationService),this._instantiationService.setService(Be.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ye.LinkProviderService),this._instantiationService.setService(Le.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(le.OscLinkProvider)),this._register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this._register(this._inputHandler.onRequestRefreshRows((N=>this.refresh(N?.start??0,N?.end??this.rows-1)))),this._register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this._register(this._inputHandler.onRequestReset((()=>this.reset()))),this._register(this._inputHandler.onRequestWindowsOptionsReport((N=>this._reportWindowsOptions(N)))),this._register(this._inputHandler.onColor((N=>this._handleColorEvent(N)))),this._register(We.Event.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(We.Event.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(We.Event.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(We.Event.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize((N=>this._afterResize(N.cols,N.rows)))),this._register((0,Ke.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(N){if(this._themeService)for(const j of N){let N,X="";switch(j.index){case 256:N="foreground",X="10";break;case 257:N="background",X="11";break;case 258:N="cursor",X="12";break;default:N="ansi",X="4;"+j.index}switch(j.type){case 0:const ie=Re.color.toColorRGB("ansi"===N?this._themeService.colors.ansi[j.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${Oe.C0.ESC}]${X};${(0,Pe.toRgbString)(ie)}${Oe.C1_ESCAPED.ST}`);break;case 1:if("ansi"===N)this._themeService.modifyColors((N=>N.ansi[j.index]=Re.channels.toColor(...j.color)));else{const X=N;this._themeService.modifyColors((N=>N[X]=Re.channels.toColor(...j.color)))}break;case 2:this._themeService.restoreColor(j.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(N){N?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ue.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(N){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Oe.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Oe.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 N=this.buffer.ybase+this.buffer.y,j=this.buffer.lines.get(N);if(!j)return;const X=Math.min(this.buffer.x,this.cols-1),ie=this._renderService.dimensions.css.cell.height,se=j.getWidth(X),le=this._renderService.dimensions.css.cell.width*se,he=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=X*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=he+"px",this.textarea.style.width=le+"px",this.textarea.style.height=ie+"px",this.textarea.style.lineHeight=ie+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register((0,He.addDisposableListener)(this.element,"copy",(N=>{this.hasSelection()&&(0,ie.copyHandler)(N,this._selectionService)})));const e=N=>(0,ie.handlePasteEvent)(N,this.textarea,this.coreService,this.optionsService);this._register((0,He.addDisposableListener)(this.textarea,"paste",e)),this._register((0,He.addDisposableListener)(this.element,"paste",e)),ke.isFirefox?this._register((0,He.addDisposableListener)(this.element,"mousedown",(N=>{2===N.button&&(0,ie.rightClickHandler)(N,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this._register((0,He.addDisposableListener)(this.element,"contextmenu",(N=>{(0,ie.rightClickHandler)(N,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),ke.isLinux&&this._register((0,He.addDisposableListener)(this.element,"auxclick",(N=>{1===N.button&&(0,ie.moveTextAreaUnderMouseCursor)(N,this.textarea,this.screenElement)})))}_bindKeys(){this._register((0,He.addDisposableListener)(this.textarea,"keyup",(N=>this._keyUp(N)),!0)),this._register((0,He.addDisposableListener)(this.textarea,"keydown",(N=>this._keyDown(N)),!0)),this._register((0,He.addDisposableListener)(this.textarea,"keypress",(N=>this._keyPress(N)),!0)),this._register((0,He.addDisposableListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this._register((0,He.addDisposableListener)(this.textarea,"compositionupdate",(N=>this._compositionHelper.compositionupdate(N)))),this._register((0,He.addDisposableListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this._register((0,He.addDisposableListener)(this.textarea,"input",(N=>this._inputEvent(N)),!0)),this._register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(N){if(!N)throw new Error("Terminal requires a parent element.");if(N.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=N.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"),N.appendChild(this.element);const j=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),j.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register((0,He.addDisposableListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),j.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",se.promptLabel.get()),ke.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(Ce.CoreBrowserService,this.textarea,N.ownerDocument.defaultView??window,this._document??"undefined"!=typeof window?window.document:null)),this._instantiationService.setService(Le.ICoreBrowserService,this._coreBrowserService),this._register((0,He.addDisposableListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this._register((0,He.addDisposableListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Se.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(Le.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(Ae.ThemeService),this._instantiationService.setService(Le.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(be.CharacterJoinerService),this._instantiationService.setService(Le.ICharacterJoinerService,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ee.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(Le.IRenderService,this._renderService),this._register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(me.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(we.MouseService),this._instantiationService.setService(Le.IMouseService,this._mouseService);const X=this._linkifier.value=this._register(this._instantiationService.createInstance(Fe.Linkifier,this.screenElement));this.element.appendChild(j);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(he.Viewport,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines((N=>{super.scrollLines(N,!1),this.refresh(0,this.rows-1)}))),this._selectionService=this._register(this._instantiationService.createInstance(De.SelectionService,this.element,this.screenElement,X)),this._instantiationService.setService(Le.ISelectionService,this._selectionService),this._register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this._register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this._register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this._register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this._register(this._onScroll.event((()=>this._selectionService.refresh()))),this._register(this._instantiationService.createInstance(ce.BufferDecorationRenderer,this.screenElement)),this._register((0,He.addDisposableListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ue.AccessibilityManager,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ve.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const N=this,j=this.element;function i(j){const X=N._mouseService.getMouseReportCoords(j,N.screenElement);if(!X)return!1;let ie,se;switch(j.overrideType||j.type){case"mousemove":se=32,void 0===j.buttons?(ie=3,void 0!==j.button&&(ie=j.button<3?j.button:3)):ie=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":se=0,ie=j.button<3?j.button:3;break;case"mousedown":se=1,ie=j.button<3?j.button:3;break;case"wheel":if(N._customWheelEventHandler&&!1===N._customWheelEventHandler(j))return!1;const X=j.deltaY;if(0===X)return!1;se=X<0?0:1,ie=4;break;default:return!1}return!(void 0===se||void 0===ie||ie>4)&&N.coreMouseService.triggerMouseEvent({col:X.col,row:X.row,x:X.x,y:X.y,button:ie,action:se,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}const X={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ie={mouseup:N=>(i(N),N.buttons||(this._document.removeEventListener("mouseup",X.mouseup),X.mousedrag&&this._document.removeEventListener("mousemove",X.mousedrag)),this.cancel(N)),wheel:N=>(i(N),this.cancel(N,!0)),mousedrag:N=>{N.buttons&&i(N)},mousemove:N=>{N.buttons||i(N)}};this._register(this.coreMouseService.onProtocolChange((N=>{N?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(N)),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&N?X.mousemove||(j.addEventListener("mousemove",ie.mousemove),X.mousemove=ie.mousemove):(j.removeEventListener("mousemove",X.mousemove),X.mousemove=null),16&N?X.wheel||(j.addEventListener("wheel",ie.wheel,{passive:!1}),X.wheel=ie.wheel):(j.removeEventListener("wheel",X.wheel),X.wheel=null),2&N?X.mouseup||(X.mouseup=ie.mouseup):(this._document.removeEventListener("mouseup",X.mouseup),X.mouseup=null),4&N?X.mousedrag||(X.mousedrag=ie.mousedrag):(this._document.removeEventListener("mousemove",X.mousedrag),X.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register((0,He.addDisposableListener)(j,"mousedown",(N=>{if(N.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(N))return i(N),X.mouseup&&this._document.addEventListener("mouseup",X.mouseup),X.mousedrag&&this._document.addEventListener("mousemove",X.mousedrag),this.cancel(N)}))),this._register((0,He.addDisposableListener)(j,"wheel",(N=>{if(!X.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(N))return!1;if(!this.buffer.hasScrollback){if(0===N.deltaY)return!1;const j=Oe.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(N.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(j,!0),this.cancel(N,!0)}}}),{passive:!1}))}refresh(N,j){this._renderService?.refreshRows(N,j)}updateCursorStyle(N){this._selectionService?.shouldColumnSelect(N)?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(N,j){this._viewport?this._viewport.scrollLines(N):super.scrollLines(N,j),this.refresh(0,this.rows-1)}scrollPages(N){this.scrollLines(N*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(N){N&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(N){const j=N-this._bufferService.buffer.ydisp;0!==j&&this.scrollLines(j)}paste(N){(0,ie.paste)(N,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(N){this._customKeyEventHandler=N}attachCustomWheelEventHandler(N){this._customWheelEventHandler=N}registerLinkProvider(N){return this._linkProviderService.registerLinkProvider(N)}registerCharacterJoiner(N){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const j=this._characterJoinerService.register(N);return this.refresh(0,this.rows-1),j}deregisterCharacterJoiner(N){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(N)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(N){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+N)}registerDecoration(N){return this._decorationService.registerDecoration(N)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(N,j,X){this._selectionService.setSelection(N,j,X)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(N,j){this._selectionService?.selectLines(N,j)}_keyDown(N){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(N))return!1;const j=this.browser.isMac&&this.options.macOptionIsMeta&&N.altKey;if(!j&&!this._compositionHelper.keydown(N))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;j||"Dead"!==N.key&&"AltGraph"!==N.key||(this._unprocessedDeadKey=!0);const X=(0,Ie.evaluateKeyboardEvent)(N,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(N),3===X.type||2===X.type){const j=this.rows-1;return this.scrollLines(2===X.type?-j:j),this.cancel(N,!0)}return 1===X.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,N)||(X.cancel&&this.cancel(N,!0),!X.key||!!(N.key&&!N.ctrlKey&&!N.altKey&&!N.metaKey&&1===N.key.length&&N.key.charCodeAt(0)>=65&&N.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(X.key!==Oe.C0.ETX&&X.key!==Oe.C0.CR||(this.textarea.value=""),this._onKey.fire({key:X.key,domEvent:N}),this._showCursor(),this.coreService.triggerDataEvent(X.key,!0),!this.optionsService.rawOptions.screenReaderMode||N.altKey||N.ctrlKey?this.cancel(N,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(N,j){const X=N.isMac&&!this.options.macOptionIsMeta&&j.altKey&&!j.ctrlKey&&!j.metaKey||N.isWindows&&j.altKey&&j.ctrlKey&&!j.metaKey||N.isWindows&&j.getModifierState("AltGraph");return"keypress"===j.type?X:X&&(!j.keyCode||j.keyCode>47)}_keyUp(N){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(N)||(function(N){return 16===N.keyCode||17===N.keyCode||18===N.keyCode}(N)||this.focus(),this.updateCursorStyle(N),this._keyPressHandled=!1)}_keyPress(N){let j;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(N))return!1;if(this.cancel(N),N.charCode)j=N.charCode;else if(null===N.which||void 0===N.which)j=N.keyCode;else{if(0===N.which||0===N.charCode)return!1;j=N.which}return!(!j||(N.altKey||N.ctrlKey||N.metaKey)&&!this._isThirdLevelShift(this.browser,N)||(j=String.fromCharCode(j),this._onKey.fire({key:j,domEvent:N}),this._showCursor(),this.coreService.triggerDataEvent(j,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(N){if(N.data&&"insertText"===N.inputType&&(!N.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const j=N.data;return this.coreService.triggerDataEvent(j,!0),this.cancel(N),!0}return!1}resize(N,j){N!==this.cols||j!==this.rows?super.resize(N,j):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(N,j){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){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 N=1;N=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.Linkifier=void 0;const le=X(7150),he=X(6501),ce=X(7098),_e=X(802),me=X(7093);let ve=class extends le.Disposable{get currentLink(){return this._currentLink}constructor(N,j,X,ie,se){super(),this._element=N,this._mouseService=j,this._renderService=X,this._bufferService=ie,this._linkProviderService=se,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e.Emitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e.Emitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register((0,le.toDisposable)((()=>{(0,le.dispose)(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this._register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this._register((0,me.addDisposableListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this._register((0,me.addDisposableListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register((0,me.addDisposableListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register((0,me.addDisposableListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(N){this._lastMouseEvent=N;const j=this._positionFromMouseEvent(N,this._element,this._mouseService);if(!j)return;this._isMouseOut=!1;const X=N.composedPath();for(let N=0;N{N?.forEach((N=>{N.link.dispose&&N.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=N.y);let X=!1;for(const[ie,se]of this._linkProviderService.linkProviders.entries())if(j){const j=this._activeProviderReplies?.get(ie);j&&(X=this._checkLinkProviderResult(ie,N,X))}else se.provideLinks(N.y,(j=>{if(this._isMouseOut)return;const se=j?.map((N=>({link:N})));this._activeProviderReplies?.set(ie,se),X=this._checkLinkProviderResult(ie,N,X),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(N.y,this._activeProviderReplies)}))}_removeIntersectingLinks(N,j){const X=new Set;for(let ie=0;ieN?this._bufferService.cols:ie.link.range.end.x;for(let N=le;N<=he;N++){if(X.has(N)){se.splice(j--,1);break}X.add(N)}}}}_checkLinkProviderResult(N,j,X){if(!this._activeProviderReplies)return X;const ie=this._activeProviderReplies.get(N);let se=!1;for(let j=0;jthis._linkAtPosition(N.link,j)));N&&(X=!0,this._handleNewLink(N))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!X)for(let N=0;Nthis._linkAtPosition(N.link,j)));if(ie){X=!0,this._handleNewLink(ie);break}}return X}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(N){if(!this._currentLink)return;const j=this._positionFromMouseEvent(N,this._element,this._mouseService);var X,ie;j&&this._mouseDownLink&&(X=this._mouseDownLink.link,ie=this._currentLink.link,X.text===ie.text&&X.range.start.x===ie.range.start.x&&X.range.start.y===ie.range.start.y&&X.range.end.x===ie.range.end.x&&X.range.end.y===ie.range.end.y)&&this._linkAtPosition(this._currentLink.link,j)&&this._currentLink.link.activate(N,this._currentLink.link.text)}_clearCurrentLink(N,j){this._currentLink&&this._lastMouseEvent&&(!N||!j||this._currentLink.link.range.start.y>=N&&this._currentLink.link.range.end.y<=j)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,le.dispose)(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(N){if(!this._lastMouseEvent)return;const j=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);j&&this._linkAtPosition(N.link,j)&&(this._currentLink=N,this._currentLink.state={decorations:{underline:void 0===N.link.decorations||N.link.decorations.underline,pointerCursor:void 0===N.link.decorations||N.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,N.link,this._lastMouseEvent),N.link.decorations={},Object.defineProperties(N.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:N=>{this._currentLink?.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:()=>this._currentLink?.state?.decorations.underline,set:j=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==j&&(this._currentLink.state.decorations.underline=j,this._currentLink.state.isHovered&&this._fireUnderlineEvent(N.link,j))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((N=>{if(!this._currentLink)return;const j=0===N.start?0:N.start+1+this._bufferService.buffer.ydisp,X=this._bufferService.buffer.ydisp+1+N.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=X&&(this._clearCurrentLink(j,X),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(N,j,X){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(j,!0),this._currentLink.state.decorations.pointerCursor&&N.classList.add("xterm-cursor-pointer")),j.hover&&j.hover(X,j.text)}_fireUnderlineEvent(N,j){const X=N.range,ie=this._bufferService.buffer.ydisp,se=this._createLinkUnderlineEvent(X.start.x-1,X.start.y-ie-1,X.end.x,X.end.y-ie-1,void 0);(j?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(se)}_linkLeave(N,j,X){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(j,!1),this._currentLink.state.decorations.pointerCursor&&N.classList.remove("xterm-cursor-pointer")),j.leave&&j.leave(X,j.text)}_linkAtPosition(N,j){const X=N.range.start.y*this._bufferService.cols+N.range.start.x,ie=N.range.end.y*this._bufferService.cols+N.range.end.x,se=j.y*this._bufferService.cols+j.x;return X<=se&&se<=ie}_positionFromMouseEvent(N,j,X){const ie=X.getCoords(N,j,this._bufferService.cols,this._bufferService.rows);if(ie)return{x:ie[0],y:ie[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(N,j,X,ie,se){return{x1:N,y1:j,x2:X,y2:ie,cols:this._bufferService.cols,fg:se}}};j.Linkifier=ve,j.Linkifier=ve=ie([se(1,ce.IMouseService),se(2,ce.IRenderService),se(3,he.IBufferService),se(4,ce.ILinkProviderService)],ve)},7721:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.tooMuchOutput=j.promptLabel=void 0;let X="Terminal input";const ie={get:()=>X,set:N=>X=N};j.promptLabel=ie;let se="Too much output to announce, navigate to rows manually to read";const le={get:()=>se,set:N=>se=N};j.tooMuchOutput=le},3285:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.OscLinkProvider=void 0;const le=X(3055),he=X(6501);let ce=class{constructor(N,j,X){this._bufferService=N,this._optionsService=j,this._oscLinkService=X}provideLinks(N,j){const X=this._bufferService.buffer.lines.get(N-1);if(!X)return void j(void 0);const ie=[],se=this._optionsService.rawOptions.linkHandler,he=new le.CellData,ce=X.getTrimmedLength();let _e=-1,me=-1,ve=!1;for(let j=0;jse?se.activate(N,j,le):l(0,j),hover:(N,j)=>se?.hover?.(N,j,le),leave:(N,j)=>se?.leave?.(N,j,le)})}ve=!1,he.hasExtendedAttrs()&&he.extended.urlId?(me=j,_e=he.extended.urlId):(me=-1,_e=-1)}}j(ie)}};function l(N,j){if(confirm(`Do you want to navigate to ${j}?\n\nWARNING: This link could potentially be dangerous`)){const N=window.open();if(N){try{N.opener=null}catch{}N.location.href=j}else console.warn("Opening link blocked as opener could not be cleared")}}j.OscLinkProvider=ce,j.OscLinkProvider=ce=ie([se(0,he.IBufferService),se(1,he.IOptionsService),se(2,he.IOscLinkService)],ce)},4852:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.RenderDebouncer=void 0,j.RenderDebouncer=class{constructor(N,j){this._renderCallback=N,this._coreBrowserService=j,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(N){return this._refreshCallbacks.push(N),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(N,j,X){this._rowCount=X,N=void 0!==N?N:0,j=void 0!==j?j:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,N):N,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,j):j,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const N=Math.max(this._rowStart,0),j=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(N,j),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const N of this._refreshCallbacks)N(0);this._refreshCallbacks=[]}}},4292:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.TimeBasedDebouncer=void 0,j.TimeBasedDebouncer=class{constructor(N,j=1e3){this._renderCallback=N,this._debounceThresholdMS=j,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(N,j,X){this._rowCount=X,N=void 0!==N?N:0,j=void 0!==j?j:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,N):N,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,j):j;const ie=Date.now();if(ie-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=ie,this._innerRefresh();else if(!this._additionalRefreshRequested){const N=ie-this._lastRefreshMs,j=this._debounceThresholdMS-N;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),j)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const N=Math.max(this._rowStart,0),j=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(N,j)}}},9302:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.DEFAULT_ANSI_COLORS=void 0;const ie=X(4103);j.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const N=[ie.css.toColor("#2e3436"),ie.css.toColor("#cc0000"),ie.css.toColor("#4e9a06"),ie.css.toColor("#c4a000"),ie.css.toColor("#3465a4"),ie.css.toColor("#75507b"),ie.css.toColor("#06989a"),ie.css.toColor("#d3d7cf"),ie.css.toColor("#555753"),ie.css.toColor("#ef2929"),ie.css.toColor("#8ae234"),ie.css.toColor("#fce94f"),ie.css.toColor("#729fcf"),ie.css.toColor("#ad7fa8"),ie.css.toColor("#34e2e2"),ie.css.toColor("#eeeeec")],j=[0,95,135,175,215,255];for(let X=0;X<216;X++){const se=j[X/36%6|0],le=j[X/6%6|0],he=j[X%6];N.push({css:ie.channels.toCss(se,le,he),rgba:ie.channels.toRgba(se,le,he)})}for(let j=0;j<24;j++){const X=8+10*j;N.push({css:ie.channels.toCss(X,X,X),rgba:ie.channels.toRgba(X,X,X)})}return N})())},4017:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.Viewport=void 0;const le=X(7098),he=X(7150),ce=X(6501),_e=X(7093),me=X(8234),ve=X(802),Se=X(9881);let be=class extends he.Disposable{constructor(N,j,X,ie,se,le,ce,be){super(),this._bufferService=X,this._optionsService=ce,this._renderService=be,this._onRequestScrollLines=this._register(new ve.Emitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;const Ce=this._register(new Se.Scrollable({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:N=>(0,_e.scheduleAtNextAnimationFrame)(ie.window,N)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",(()=>{Ce.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)}))),this._scrollableElement=this._register(new me.SmoothScrollableElement(j,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},Ce)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],(()=>this._scrollableElement.updateOptions(this._getChangeOptions())))),this._register(se.onProtocolChange((N=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&N)})}))),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ve.Event.runAndSubscribe(le.onChangeColors,(()=>{this._scrollableElement.getDomNode().style.backgroundColor=le.colors.background.css}))),N.appendChild(this._scrollableElement.getDomNode()),this._register((0,he.toDisposable)((()=>this._scrollableElement.getDomNode().remove()))),this._styleElement=ie.mainDocument.createElement("style"),j.appendChild(this._styleElement),this._register((0,he.toDisposable)((()=>this._styleElement.remove()))),this._register(ve.Event.runAndSubscribe(le.onChangeColors,(()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${le.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${le.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${le.colors.scrollbarSliderActiveBackground.css};`,"}"].join("\n")}))),this._register(this._bufferService.onResize((()=>this._queueSync()))),this._register(this._bufferService.buffers.onBufferActivate((()=>this._queueSync()))),this._register(this._bufferService.onScroll((()=>this._sync()))),this._register(this._scrollableElement.onScroll((N=>this._handleScroll(N))))}scrollLines(N){const j=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:j.scrollTop+N*this._renderService.dimensions.css.cell.height})}scrollToLine(N,j){j&&(this._latestYDisp=N),this._scrollableElement.setScrollPosition({reuseAnimation:!j,scrollTop:N*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}_queueSync(N){void 0!==N&&(this._latestYDisp=N),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback((()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)})))}_sync(N=this._bufferService.buffer.ydisp){this._renderService&&!this._isSyncing&&(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,N!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:N*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(N){if(!this._renderService)return;if(this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;const j=Math.round(N.scrollTop/this._renderService.dimensions.css.cell.height),X=j-this._bufferService.buffer.ydisp;0!==X&&(this._latestYDisp=j,this._onRequestScrollLines.fire(X)),this._isHandlingScroll=!1}};j.Viewport=be,j.Viewport=be=ie([se(2,ce.IBufferService),se(3,le.ICoreBrowserService),se(4,ce.ICoreMouseService),se(5,le.IThemeService),se(6,ce.IOptionsService),se(7,le.IRenderService)],be)},4196:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.BufferDecorationRenderer=void 0;const le=X(7098),he=X(7150),ce=X(6501);let _e=class extends he.Disposable{constructor(N,j,X,ie,se){super(),this._screenElement=N,this._bufferService=j,this._coreBrowserService=X,this._decorationService=ie,this._renderService=se,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((N=>this._removeDecoration(N)))),this._register((0,he.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const N of this._decorationService.decorations)this._renderDecoration(N);this._dimensionsChanged=!1}_renderDecoration(N){this._refreshStyle(N),this._dimensionsChanged&&this._refreshXPosition(N)}_createElement(N){const j=this._coreBrowserService.mainDocument.createElement("div");j.classList.add("xterm-decoration"),j.classList.toggle("xterm-decoration-top-layer","top"===N?.options?.layer),j.style.width=`${Math.round((N.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,j.style.height=(N.options.height||1)*this._renderService.dimensions.css.cell.height+"px",j.style.top=(N.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",j.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const X=N.options.x??0;return X&&X>this._bufferService.cols&&(j.style.display="none"),this._refreshXPosition(N,j),j}_refreshStyle(N){const j=N.marker.line-this._bufferService.buffers.active.ydisp;if(j<0||j>=this._bufferService.rows)N.element&&(N.element.style.display="none",N.onRenderEmitter.fire(N.element));else{let X=this._decorationElements.get(N);X||(X=this._createElement(N),N.element=X,this._decorationElements.set(N,X),this._container.appendChild(X),N.onDispose((()=>{this._decorationElements.delete(N),X.remove()}))),X.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(X.style.width=`${Math.round((N.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,X.style.height=(N.options.height||1)*this._renderService.dimensions.css.cell.height+"px",X.style.top=j*this._renderService.dimensions.css.cell.height+"px",X.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),N.onRenderEmitter.fire(X)}}_refreshXPosition(N,j=N.element){if(!j)return;const X=N.options.x??0;"right"===(N.options.anchor||"left")?j.style.right=X?X*this._renderService.dimensions.css.cell.width+"px":"":j.style.left=X?X*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(N){this._decorationElements.get(N)?.remove(),this._decorationElements.delete(N),N.dispose()}};j.BufferDecorationRenderer=_e,j.BufferDecorationRenderer=_e=ie([se(1,ce.IBufferService),se(2,le.ICoreBrowserService),se(3,ce.IDecorationService),se(4,le.IRenderService)],_e)},957:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ColorZoneStore=void 0,j.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(N){if(N.options.overviewRulerOptions){for(const j of this._zones)if(j.color===N.options.overviewRulerOptions.color&&j.position===N.options.overviewRulerOptions.position){if(this._lineIntersectsZone(j,N.marker.line))return;if(this._lineAdjacentToZone(j,N.marker.line,N.options.overviewRulerOptions.position))return void this._addLineToZone(j,N.marker.line)}if(this._zonePoolIndex=N.startBufferLine&&j<=N.endBufferLine}_lineAdjacentToZone(N,j,X){return j>=N.startBufferLine-this._linePadding[X||"full"]&&j<=N.endBufferLine+this._linePadding[X||"full"]}_addLineToZone(N,j){N.startBufferLine=Math.min(N.startBufferLine,j),N.endBufferLine=Math.max(N.endBufferLine,j)}}},9925:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.OverviewRulerRenderer=void 0;const le=X(957),he=X(7098),ce=X(7150),_e=X(6501),me={full:0,left:0,center:0,right:0},ve={full:0,left:0,center:0,right:0},Se={full:0,left:0,center:0,right:0};let be=class extends ce.Disposable{get _width(){return this._optionsService.options.overviewRuler?.width||0}constructor(N,j,X,ie,se,he,_e,me){super(),this._viewportElement=N,this._screenElement=j,this._bufferService=X,this._decorationService=ie,this._renderService=se,this._optionsService=he,this._themeService=_e,this._coreBrowserService=me,this._colorZoneStore=new le.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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register((0,ce.toDisposable)((()=>this._canvas?.remove())));const ve=this._canvas.getContext("2d");if(!ve)throw new Error("Ctx cannot be null");this._ctx=ve,this._register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this._register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0)))),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())}))),this._register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this._register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",(()=>this._queueRefresh(!0)))),this._register(this._themeService.onChangeColors((()=>this._queueRefresh()))),this._queueRefresh(!0)}_refreshDrawConstants(){const N=Math.floor((this._canvas.width-1)/3),j=Math.ceil((this._canvas.width-1)/3);ve.full=this._canvas.width,ve.left=N,ve.center=j,ve.right=N,this._refreshDrawHeightConstants(),Se.full=1,Se.left=1,Se.center=1+ve.left,Se.right=1+ve.left+ve.center}_refreshDrawHeightConstants(){me.full=Math.round(2*this._coreBrowserService.dpr);const N=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(N,12),6)*this._coreBrowserService.dpr);me.left=j,me.center=j,me.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*me.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*me.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*me.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*me.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 N of this._decorationService.decorations)this._colorZoneStore.addDecoration(N);this._ctx.lineWidth=1,this._renderRulerOutline();const N=this._colorZoneStore.zones;for(const j of N)"full"!==j.position&&this._renderColorZone(j);for(const j of N)"full"===j.position&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(N){this._ctx.fillStyle=N.color,this._ctx.fillRect(Se[N.position||"full"],Math.round((this._canvas.height-1)*(N.startBufferLine/this._bufferService.buffers.active.lines.length)-me[N.position||"full"]/2),ve[N.position||"full"],Math.round((this._canvas.height-1)*((N.endBufferLine-N.startBufferLine)/this._bufferService.buffers.active.lines.length)+me[N.position||"full"]))}_queueRefresh(N,j){this._shouldUpdateDimensions=N||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};j.OverviewRulerRenderer=be,j.OverviewRulerRenderer=be=ie([se(2,_e.IBufferService),se(3,_e.IDecorationService),se(4,he.IRenderService),se(5,_e.IOptionsService),se(6,he.IThemeService),se(7,he.ICoreBrowserService)],be)},3618:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.CompositionHelper=void 0;const le=X(7098),he=X(6501),ce=X(3534);let _e=class{get isComposing(){return this._isComposing}constructor(N,j,X,ie,se,le){this._textarea=N,this._compositionView=j,this._bufferService=X,this._optionsService=ie,this._coreService=se,this._renderService=le,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(N){this._compositionView.textContent=N.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(N){if(this._isComposing||this._isSendingComposition){if(229===N.keyCode)return!1;if(16===N.keyCode||17===N.keyCode||18===N.keyCode)return!1;this._finalizeComposition(!1)}return 229!==N.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(N){if(this._compositionView.classList.remove("active"),this._isComposing=!1,N){const N={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let j;this._isSendingComposition=!1,N.start+=this._dataAlreadySent.length,j=this._isComposing?this._textarea.value.substring(N.start,this._compositionPosition.start):this._textarea.value.substring(N.start),j.length>0&&this._coreService.triggerDataEvent(j,!0)}}),0)}else{this._isSendingComposition=!1;const N=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(N,!0)}}_handleAnyTextareaChanges(){const N=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const j=this._textarea.value,X=j.replace(N,"");this._dataAlreadySent=X,j.length>N.length?this._coreService.triggerDataEvent(X,!0):j.lengththis.updateCompositionElements(!0)),0)}}};j.CompositionHelper=_e,j.CompositionHelper=_e=ie([se(2,he.IBufferService),se(3,he.IOptionsService),se(4,he.ICoreService),se(5,le.IRenderService)],_e)},5251:(N,j)=>{function i(N,j,X){const ie=X.getBoundingClientRect(),se=N.getComputedStyle(X),le=parseInt(se.getPropertyValue("padding-left")),he=parseInt(se.getPropertyValue("padding-top"));return[j.clientX-ie.left-le,j.clientY-ie.top-he]}Object.defineProperty(j,"__esModule",{value:!0}),j.getCoordsRelativeToElement=i,j.getCoords=function(N,j,X,ie,se,le,he,ce,_e){if(!le)return;const me=i(N,j,X);return me?(me[0]=Math.ceil((me[0]+(_e?he/2:0))/he),me[1]=Math.ceil(me[1]/ce),me[0]=Math.min(Math.max(me[0],1),ie+(_e?1:0)),me[1]=Math.min(Math.max(me[1],1),se),me):void 0}},9686:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.moveToCellSequence=function(N,j,X,ie){const se=X.buffer.x,le=X.buffer.y;if(!X.buffer.hasScrollback)return function(N,j,X,ie,se,le){return 0===r(j,ie,se,le).length?"":h(a(N,j,N,j-n(j,se),!1,se).length,l("D",le))}(se,le,0,j,X,ie)+r(le,j,X,ie)+function(N,j,X,ie,se,le){let he;he=r(j,ie,se,le).length>0?ie-n(ie,se):j;const ce=ie,_e=function(N,j,X,ie,se,le){let he;return he=r(X,ie,se,le).length>0?ie-n(ie,se):j,N=X&&heN?"D":"C",h(Math.abs(se-N),l(he,ie));he=le>j?"D":"C";const ce=Math.abs(le-j);return h(function(N,j){return j.cols-N}(le>j?N:se,X)+(ce-1)*X.cols+1+((le>j?se:N)-1),l(he,ie))};const ie=X(3534);function r(N,j,X,ie){const se=N-n(N,X),le=j-n(j,X),he=Math.abs(se-le)-function(N,j,X){let ie=0;const se=N-n(N,X),le=j-n(j,X);for(let he=0;he=0&&Nj?"A":"B"}function a(N,j,X,ie,se,le){let he=N,ce=j,_e="";for(;he!==X||ce!==ie;)he+=se?1:-1,se&&he>le.cols-1?(_e+=le.buffer.translateBufferLineToString(ce,!1,N,he),he=0,N=0,ce++):!se&&he<0&&(_e+=le.buffer.translateBufferLineToString(ce,!1,0,N+1),he=le.cols-1,N=he,ce--);return _e+le.buffer.translateBufferLineToString(ce,!1,N,he)}function l(N,j){const X=j?"O":"[";return ie.C0.ESC+X+N}function h(N,j){N=Math.floor(N);let X="";for(let ie=0;ie=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.DomRenderer=void 0;const le=X(1433),he=X(2744),ce=X(9176),_e=X(6181),me=X(2274),ve=X(7098),Se=X(4103),be=X(7150),Ce=X(6501),ye=X(802),we="xterm-dom-renderer-owner-",Ee="xterm-rows",De="xterm-fg-",Le="xterm-bg-",Ae="xterm-focus",Re="xterm-selection";let Te=1,ke=class extends be.Disposable{constructor(N,j,X,ie,se,ce,ve,Se,Ce,De,Le,Ae,ke){super(),this._terminal=N,this._document=j,this._element=X,this._screenElement=ie,this._viewportElement=se,this._helperContainer=ce,this._linkifier2=ve,this._charSizeService=Ce,this._optionsService=De,this._bufferService=Le,this._coreBrowserService=Ae,this._themeService=ke,this._terminalClass=Te++,this._rowElements=[],this._selectionRenderModel=(0,me.createSelectionRenderModel)(),this.onRequestRedraw=this._register(new ye.Emitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ee),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(Re),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,_e.createRenderDimensions)(),this._updateDimensions(),this._register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this._register(this._themeService.onChangeColors((N=>this._injectCss(N)))),this._injectCss(this._themeService.colors),this._rowFactory=Se.createInstance(le.DomRendererRowFactory,document),this._element.classList.add(we+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline((N=>this._handleLinkHover(N)))),this._register(this._linkifier2.onHideLinkUnderline((N=>this._handleLinkLeave(N)))),this._register((0,be.toDisposable)((()=>{this._element.classList.remove(we+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new he.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 N=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*N,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*N),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/N),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/N),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 N of this._rowElements)N.style.width=`${this.dimensions.css.canvas.width}px`,N.style.height=`${this.dimensions.css.cell.height}px`,N.style.lineHeight=`${this.dimensions.css.cell.height}px`,N.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const j=`${this._terminalSelector} .${Ee} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=j,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(N){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let j=`${this._terminalSelector} .${Ee} { color: ${N.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;j+=`${this._terminalSelector} .${Ee} .xterm-dim { color: ${Se.color.multiplyOpacity(N.foreground,.5).css};}`,j+=`${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 X=`blink_underline_${this._terminalClass}`,ie=`blink_bar_${this._terminalClass}`,se=`blink_block_${this._terminalClass}`;j+=`@keyframes ${X} { 50% { border-bottom-style: hidden; }}`,j+=`@keyframes ${ie} { 50% { box-shadow: none; }}`,j+=`@keyframes ${se} { 0% { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css}; } 50% { background-color: inherit; color: ${N.cursor.css}; }}`,j+=`${this._terminalSelector} .${Ee}.${Ae} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${Ee}.${Ae} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${ie} 1s step-end infinite;}${this._terminalSelector} .${Ee}.${Ae} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${se} 1s step-end infinite;}${this._terminalSelector} .${Ee} .xterm-cursor.xterm-cursor-block { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css};}${this._terminalSelector} .${Ee} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${N.cursor.css} !important; color: ${N.cursorAccent.css} !important;}${this._terminalSelector} .${Ee} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${N.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ee} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${N.cursor.css} inset;}${this._terminalSelector} .${Ee} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${N.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,j+=`${this._terminalSelector} .${Re} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Re} div { position: absolute; background-color: ${N.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Re} div { position: absolute; background-color: ${N.selectionInactiveBackgroundOpaque.css};}`;for(const[X,ie]of N.ansi.entries())j+=`${this._terminalSelector} .${De}${X} { color: ${ie.css}; }${this._terminalSelector} .${De}${X}.xterm-dim { color: ${Se.color.multiplyOpacity(ie,.5).css}; }${this._terminalSelector} .${Le}${X} { background-color: ${ie.css}; }`;j+=`${this._terminalSelector} .${De}${ce.INVERTED_DEFAULT_COLOR} { color: ${Se.color.opaque(N.background).css}; }${this._terminalSelector} .${De}${ce.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${Se.color.multiplyOpacity(Se.color.opaque(N.background),.5).css}; }${this._terminalSelector} .${Le}${ce.INVERTED_DEFAULT_COLOR} { background-color: ${N.foreground.css}; }`,this._themeStyleElement.textContent=j}_setDefaultSpacing(){const N=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${N}px`,this._rowFactory.defaultSpacing=N}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(N,j){for(let N=this._rowElements.length;N<=j;N++){const N=this._document.createElement("div");this._rowContainer.appendChild(N),this._rowElements.push(N)}for(;this._rowElements.length>j;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(N,j){this._refreshRowElements(N,j),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(Ae),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ae),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(N,j,X){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(N,j,X),this.renderRows(0,this._bufferService.rows-1),!N||!j)return;if(this._selectionRenderModel.update(this._terminal,N,j,X),!this._selectionRenderModel.hasSelection)return;const ie=this._selectionRenderModel.viewportStartRow,se=this._selectionRenderModel.viewportEndRow,le=this._selectionRenderModel.viewportCappedStartRow,he=this._selectionRenderModel.viewportCappedEndRow,ce=this._document.createDocumentFragment();if(X){const X=N[0]>j[0];ce.appendChild(this._createSelectionElement(le,X?j[0]:N[0],X?N[0]:j[0],he-le+1))}else{const X=ie===le?N[0]:0,_e=le===se?j[0]:this._bufferService.cols;ce.appendChild(this._createSelectionElement(le,X,_e));const me=he-le-1;if(ce.appendChild(this._createSelectionElement(le+1,0,this._bufferService.cols,me)),le!==he){const N=se===he?j[0]:this._bufferService.cols;ce.appendChild(this._createSelectionElement(he,0,N))}}this._selectionContainer.appendChild(ce)}_createSelectionElement(N,j,X,ie=1){const se=this._document.createElement("div"),le=j*this.dimensions.css.cell.width;let he=this.dimensions.css.cell.width*(X-j);return le+he>this.dimensions.css.canvas.width&&(he=this.dimensions.css.canvas.width-le),se.style.height=ie*this.dimensions.css.cell.height+"px",se.style.top=N*this.dimensions.css.cell.height+"px",se.style.left=`${le}px`,se.style.width=`${he}px`,se}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 N of this._rowElements)N.replaceChildren()}renderRows(N,j){const X=this._bufferService.buffer,ie=X.ybase+X.y,se=Math.min(X.x,this._bufferService.cols-1),le=this._optionsService.rawOptions.cursorBlink,he=this._optionsService.rawOptions.cursorStyle,ce=this._optionsService.rawOptions.cursorInactiveStyle;for(let _e=N;_e<=j;_e++){const N=_e+X.ydisp,j=this._rowElements[_e],me=X.lines.get(N);if(!j||!me)break;j.replaceChildren(...this._rowFactory.createRow(me,N,N===ie,he,ce,se,le,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${we}${this._terminalClass}`}_handleLinkHover(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!0)}_handleLinkLeave(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!1)}_setCellUnderline(N,j,X,ie,se,le){X<0&&(N=0),ie<0&&(j=0);const he=this._bufferService.rows-1;X=Math.max(Math.min(X,he),0),ie=Math.max(Math.min(ie,he),0),se=Math.min(se,this._bufferService.cols);const ce=this._bufferService.buffer,_e=ce.ybase+ce.y,me=Math.min(ce.x,se-1),ve=this._optionsService.rawOptions.cursorBlink,Se=this._optionsService.rawOptions.cursorStyle,be=this._optionsService.rawOptions.cursorInactiveStyle;for(let he=X;he<=ie;++he){const Ce=he+ce.ydisp,ye=this._rowElements[he],we=ce.lines.get(Ce);if(!ye||!we)break;ye.replaceChildren(...this._rowFactory.createRow(we,Ce,Ce===_e,Se,be,me,ve,this.dimensions.css.cell.width,this._widthCache,le?he===X?N:0:-1,le?(he===ie?j:se)-1:-1))}}};j.DomRenderer=ke,j.DomRenderer=ke=ie([se(7,Ce.IInstantiationService),se(8,ve.ICharSizeService),se(9,Ce.IOptionsService),se(10,Ce.IBufferService),se(11,ve.ICoreBrowserService),se(12,ve.IThemeService)],ke)},1433:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.DomRendererRowFactory=void 0;const le=X(9176),he=X(8938),ce=X(3055),_e=X(6501),me=X(4103),ve=X(7098),Se=X(945),be=X(6181),Ce=X(5451);let ye=class{constructor(N,j,X,ie,se,le,he){this._document=N,this._characterJoinerService=j,this._optionsService=X,this._coreBrowserService=ie,this._coreService=se,this._decorationService=le,this._themeService=he,this._workCell=new ce.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,j,X){this._selectionStart=N,this._selectionEnd=j,this._columnSelectMode=X}createRow(N,j,X,ie,se,ce,_e,ve,be,ye,we){const Ee=[],De=this._characterJoinerService.getJoinedCharacters(j),Le=this._themeService.colors;let Ae,Re=N.getNoBgTrimmedLength();X&&Re0&&We===De[0][0]){He=!0;const j=De.shift();ze=new Se.JoinedCellData(this._workCell,N.translateToString(!0,j[0],j[1]),j[1]-j[0]),Ke=j[1]-1,Re=ze.getWidth()}const je=this._isCellInSelection(We,j),$e=X&&We===ce,Ve=Fe&&We>=ye&&We<=we;let Ge=!1;this._decorationService.forEachDecorationAtCell(We,j,void 0,(N=>{Ge=!0}));let qe=ze.getChars()||he.WHITESPACE_CELL_CHAR;if(" "===qe&&(ze.isUnderline()||ze.isOverline())&&(qe=" "),Ne=Re*ve-be.get(qe,ze.isBold(),ze.isItalic()),Ae){if(Te&&(je&&Be||!je&&!Be&&ze.bg===Me)&&(je&&Be&&Le.selectionForeground||ze.fg===Oe)&&ze.extended.ext===Ie&&Ve===Pe&&Ne===xe&&!$e&&!He&&!Ge){ze.isInvisible()?ke+=he.WHITESPACE_CELL_CHAR:ke+=qe,Te++;continue}Te&&(Ae.textContent=ke),Ae=this._document.createElement("span"),Te=0,ke=""}else Ae=this._document.createElement("span");if(Me=ze.bg,Oe=ze.fg,Ie=ze.extended.ext,Pe=Ve,xe=Ne,Be=je,He&&ce>=We&&ce<=Ke&&(ce=We),!this._coreService.isCursorHidden&&$e&&this._coreService.isCursorInitialized)if(Ue.push("xterm-cursor"),this._coreBrowserService.isFocused)_e&&Ue.push("xterm-cursor-blink"),Ue.push("bar"===ie?"xterm-cursor-bar":"underline"===ie?"xterm-cursor-underline":"xterm-cursor-block");else if(se)switch(se){case"outline":Ue.push("xterm-cursor-outline");break;case"block":Ue.push("xterm-cursor-block");break;case"bar":Ue.push("xterm-cursor-bar");break;case"underline":Ue.push("xterm-cursor-underline")}if(ze.isBold()&&Ue.push("xterm-bold"),ze.isItalic()&&Ue.push("xterm-italic"),ze.isDim()&&Ue.push("xterm-dim"),ke=ze.isInvisible()?he.WHITESPACE_CELL_CHAR:ze.getChars()||he.WHITESPACE_CELL_CHAR,ze.isUnderline()&&(Ue.push(`xterm-underline-${ze.extended.underlineStyle}`)," "===ke&&(ke=" "),!ze.isUnderlineColorDefault()))if(ze.isUnderlineColorRGB())Ae.style.textDecorationColor=`rgb(${Ce.AttributeData.toColorRGB(ze.getUnderlineColor()).join(",")})`;else{let N=ze.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ze.isBold()&&N<8&&(N+=8),Ae.style.textDecorationColor=Le.ansi[N].css}ze.isOverline()&&(Ue.push("xterm-overline")," "===ke&&(ke=" ")),ze.isStrikethrough()&&Ue.push("xterm-strikethrough"),Ve&&(Ae.style.textDecoration="underline");let Xe=ze.getFgColor(),Ye=ze.getFgColorMode(),Ze=ze.getBgColor(),Qe=ze.getBgColorMode();const Je=!!ze.isInverse();if(Je){const N=Xe;Xe=Ze,Ze=N;const j=Ye;Ye=Qe,Qe=j}let et,tt,it,st=!1;switch(this._decorationService.forEachDecorationAtCell(We,j,void 0,(N=>{"top"!==N.options.layer&&st||(N.backgroundColorRGB&&(Qe=50331648,Ze=N.backgroundColorRGB.rgba>>8&16777215,et=N.backgroundColorRGB),N.foregroundColorRGB&&(Ye=50331648,Xe=N.foregroundColorRGB.rgba>>8&16777215,tt=N.foregroundColorRGB),st="top"===N.options.layer)})),!st&&je&&(et=this._coreBrowserService.isFocused?Le.selectionBackgroundOpaque:Le.selectionInactiveBackgroundOpaque,Ze=et.rgba>>8&16777215,Qe=50331648,st=!0,Le.selectionForeground&&(Ye=50331648,Xe=Le.selectionForeground.rgba>>8&16777215,tt=Le.selectionForeground)),st&&Ue.push("xterm-decoration-top"),Qe){case 16777216:case 33554432:it=Le.ansi[Ze],Ue.push(`xterm-bg-${Ze}`);break;case 50331648:it=me.channels.toColor(Ze>>16,Ze>>8&255,255&Ze),this._addStyle(Ae,`background-color:#${p((Ze>>>0).toString(16),"0",6)}`);break;default:Je?(it=Le.foreground,Ue.push(`xterm-bg-${le.INVERTED_DEFAULT_COLOR}`)):it=Le.background}switch(et||ze.isDim()&&(et=me.color.multiplyOpacity(it,.5)),Ye){case 16777216:case 33554432:ze.isBold()&&Xe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Xe+=8),this._applyMinimumContrast(Ae,it,Le.ansi[Xe],ze,et,void 0)||Ue.push(`xterm-fg-${Xe}`);break;case 50331648:const N=me.channels.toColor(Xe>>16&255,Xe>>8&255,255&Xe);this._applyMinimumContrast(Ae,it,N,ze,et,tt)||this._addStyle(Ae,`color:#${p(Xe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(Ae,it,Le.foreground,ze,et,tt)||Je&&Ue.push(`xterm-fg-${le.INVERTED_DEFAULT_COLOR}`)}Ue.length&&(Ae.className=Ue.join(" "),Ue.length=0),$e||He||Ge?Ae.textContent=ke:Te++,Ne!==this.defaultSpacing&&(Ae.style.letterSpacing=`${Ne}px`),Ee.push(Ae),We=Ke}return Ae&&Te&&(Ae.textContent=ke),Ee}_applyMinimumContrast(N,j,X,ie,se,le){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,be.treatGlyphAsBackgroundColor)(ie.getCode()))return!1;const he=this._getContrastCache(ie);let ce;if(se||le||(ce=he.getColor(j.rgba,X.rgba)),void 0===ce){const N=this._optionsService.rawOptions.minimumContrastRatio/(ie.isDim()?2:1);ce=me.color.ensureContrastRatio(se||j,le||X,N),he.setColor((se||j).rgba,(le||X).rgba,ce??null)}return!!ce&&(this._addStyle(N,`color:${ce.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,j){N.setAttribute("style",`${N.getAttribute("style")||""}${j};`)}_isCellInSelection(N,j){const X=this._selectionStart,ie=this._selectionEnd;return!(!X||!ie)&&(this._columnSelectMode?X[0]<=ie[0]?N>=X[0]&&j>=X[1]&&N=X[1]&&N>=ie[0]&&j<=ie[1]:j>X[1]&&j=X[0]&&N=X[0])}};function p(N,j,X){for(;N.length{Object.defineProperty(j,"__esModule",{value:!0}),j.WidthCache=void 0,j.WidthCache=class{constructor(N,j){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=N.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 X=N.createElement("span");X.classList.add("xterm-char-measure-element");const ie=N.createElement("span");ie.classList.add("xterm-char-measure-element"),ie.style.fontWeight="bold";const se=N.createElement("span");se.classList.add("xterm-char-measure-element"),se.style.fontStyle="italic";const le=N.createElement("span");le.classList.add("xterm-char-measure-element"),le.style.fontWeight="bold",le.style.fontStyle="italic",this._measureElements=[X,ie,se,le],this._container.appendChild(X),this._container.appendChild(ie),this._container.appendChild(se),this._container.appendChild(le),j.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(N,j,X,ie){N===this._font&&j===this._fontSize&&X===this._weight&&ie===this._weightBold||(this._font=N,this._fontSize=j,this._weight=X,this._weightBold=ie,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${X}`,this._measureElements[1].style.fontWeight=`${ie}`,this._measureElements[2].style.fontWeight=`${X}`,this._measureElements[3].style.fontWeight=`${ie}`,this.clear())}get(N,j,X){let ie=0;if(!j&&!X&&1===N.length&&(ie=N.charCodeAt(0))<256){if(-9999!==this._flat[ie])return this._flat[ie];const j=this._measure(N,0);return j>0&&(this._flat[ie]=j),j}let se=N;j&&(se+="B"),X&&(se+="I");let le=this._holey.get(se);if(void 0===le){let ie=0;j&&(ie|=1),X&&(ie|=2),le=this._measure(N,ie),le>0&&this._holey.set(se,le)}return le}_measure(N,j){const X=this._measureElements[j];return X.textContent=N.repeat(32),X.offsetWidth/32}}},9176:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.TEXT_BASELINE=j.DIM_OPACITY=j.INVERTED_DEFAULT_COLOR=void 0;const ie=X(701);j.INVERTED_DEFAULT_COLOR=257,j.DIM_OPACITY=.5,j.TEXT_BASELINE=ie.isFirefox||ie.isLegacyEdge?"bottom":"ideographic"},6181:(N,j)=>{function i(N){return 57508<=N&&N<=57558}function s(N){return N>=128512&&N<=128591||N>=127744&&N<=128511||N>=128640&&N<=128767||N>=9728&&N<=9983||N>=9984&&N<=10175||N>=65024&&N<=65039||N>=129280&&N<=129535||N>=127462&&N<=127487}Object.defineProperty(j,"__esModule",{value:!0}),j.throwIfFalsy=function(N){if(!N)throw new Error("value must not be falsy");return N},j.isPowerlineGlyph=i,j.isRestrictedPowerlineGlyph=function(N){return 57520<=N&&N<=57527},j.isEmoji=s,j.allowRescaling=function(N,j,X,ie){return 1===j&&X>Math.ceil(1.5*ie)&&void 0!==N&&N>255&&!s(N)&&!i(N)&&!function(N){return 57344<=N&&N<=63743}(N)},j.treatGlyphAsBackgroundColor=function(N){return i(N)||function(N){return 9472<=N&&N<=9631}(N)},j.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}}}},j.computeNextVariantOffset=function(N,j,X=0){return(N-(2*Math.round(j)-X))%(2*Math.round(j))}},2274:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.createSelectionRenderModel=function(){return new i};class i{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(N,j,X,ie=!1){if(this.selectionStart=j,this.selectionEnd=X,!j||!X||j[0]===X[0]&&j[1]===X[1])return void this.clear();const se=N.buffers.active.ydisp,le=j[1]-se,he=X[1]-se,ce=Math.max(le,0),_e=Math.min(he,N.rows-1);ce>=N.rows||_e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=ie,this.viewportStartRow=le,this.viewportEndRow=he,this.viewportCappedStartRow=ce,this.viewportCappedEndRow=_e,this.startCol=j[0],this.endCol=X[0])}isCellSelected(N,j,X){return!!this.hasSelection&&(X-=N.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?j>=this.startCol&&X>=this.viewportCappedStartRow&&j=this.viewportCappedStartRow&&j>=this.endCol&&X<=this.viewportCappedEndRow:X>this.viewportStartRow&&X=this.startCol&&j=this.startCol)}}},5959:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.SelectionModel=void 0,j.SelectionModel=class{constructor(N){this._bufferService=N,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 N=this.selectionStart[0]+this.selectionStartLength;return N>this._bufferService.cols?N%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(N/this._bufferService.cols)-1]:[N%this._bufferService.cols,this.selectionStart[1]+Math.floor(N/this._bufferService.cols)]:[N,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const N=this.selectionStart[0]+this.selectionStartLength;return N>this._bufferService.cols?[N%this._bufferService.cols,this.selectionStart[1]+Math.floor(N/this._bufferService.cols)]:[Math.max(N,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const N=this.selectionStart,j=this.selectionEnd;return!(!N||!j)&&(N[1]>j[1]||N[1]===j[1]&&N[0]>j[0])}handleTrim(N){return this.selectionStart&&(this.selectionStart[1]-=N),this.selectionEnd&&(this.selectionEnd[1]-=N),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},4792:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.CharSizeService=void 0;const le=X(6501),he=X(7150),ce=X(802);let _e=class extends he.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(N,j,X){super(),this._optionsService=X,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ce.Emitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new d(this._optionsService))}catch{this._measureStrategy=this._register(new c(N,j,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const N=this._measureStrategy.measure();N.width===this.width&&N.height===this.height||(this.width=N.width,this.height=N.height,this._onCharSizeChange.fire())}};j.CharSizeService=_e,j.CharSizeService=_e=ie([se(2,le.IOptionsService)],_e);class h extends he.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(N,j){void 0!==N&&N>0&&void 0!==j&&j>0&&(this._result.width=N,this._result.height=j)}}class c extends h{constructor(N,j,X){super(),this._document=N,this._parentElement=j,this._optionsService=X,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 d extends h{constructor(N){super(),this._optionsService=N,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))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}}},945:function(N,j,X){var ie,se=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},le=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.CharacterJoinerService=j.JoinedCellData=void 0;const he=X(5451),ce=X(8938),_e=X(3055),me=X(6501);class c extends he.AttributeData{constructor(N,j,X){super(),this.content=0,this.combinedData="",this.fg=N.fg,this.bg=N.bg,this.combinedData=j,this._width=X}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(N){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}j.JoinedCellData=c;let ve=ie=class{constructor(N){this._bufferService=N,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _e.CellData}register(N){const j={id:this._nextCharacterJoinerId++,handler:N};return this._characterJoiners.push(j),j.id}deregister(N){for(let j=0;j1){const N=this._getJoinedRanges(ie,he,le,j,se);for(let j=0;j1){const N=this._getJoinedRanges(ie,he,le,j,se);for(let j=0;j{Object.defineProperty(j,"__esModule",{value:!0}),j.CoreBrowserService=void 0;const ie=X(802),se=X(7093),le=X(7150);class o extends le.Disposable{constructor(N,j,X){super(),this._textarea=N,this._window=j,this.mainDocument=X,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new a(this._window)),this._onDprChange=this._register(new ie.Emitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ie.Emitter),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange((N=>this._screenDprMonitor.setWindow(N)))),this._register(ie.Event.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register((0,se.addDisposableListener)(this._textarea,"focus",(()=>this._isFocused=!0))),this._register((0,se.addDisposableListener)(this._textarea,"blur",(()=>this._isFocused=!1)))}get window(){return this._window}set window(N){this._window!==N&&(this._window=N,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}j.CoreBrowserService=o;class a extends le.Disposable{constructor(N){super(),this._parentWindow=N,this._windowResizeListener=this._register(new le.MutableDisposable),this._onDprChange=this._register(new ie.Emitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register((0,le.toDisposable)((()=>this.clearListener())))}setWindow(N){this._parentWindow=N,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,se.addDisposableListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}}},9820:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.LinkProviderService=void 0;const ie=X(7150);class r extends ie.Disposable{constructor(){super(),this.linkProviders=[],this._register((0,ie.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(N){return this.linkProviders.push(N),{dispose:()=>{const j=this.linkProviders.indexOf(N);-1!==j&&this.linkProviders.splice(j,1)}}}}j.LinkProviderService=r},9784:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.MouseService=void 0;const le=X(7098),he=X(5251);let ce=class{constructor(N,j){this._renderService=N,this._charSizeService=j}getCoords(N,j,X,ie,se){return(0,he.getCoords)(window,N,j,X,ie,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,se)}getMouseReportCoords(N,j){const X=(0,he.getCoordsRelativeToElement)(window,N,j);if(this._charSizeService.hasValidSize)return X[0]=Math.min(Math.max(X[0],0),this._renderService.dimensions.css.canvas.width-1),X[1]=Math.min(Math.max(X[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(X[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(X[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(X[0]),y:Math.floor(X[1])}}};j.MouseService=ce,j.MouseService=ce=ie([se(0,le.IRenderService),se(1,le.ICharSizeService)],ce)},5783:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.RenderService=void 0;const le=X(4852),he=X(7098),ce=X(7150),_e=X(6168),me=X(6501),ve=X(802);let Se=class extends ce.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(N,j,X,ie,se,he,me,Se){super(),this._rowCount=N,this._charSizeService=ie,this._renderer=this._register(new ce.MutableDisposable),this._pausedResizeTask=new _e.DebouncedIdleTask,this._observerDisposable=this._register(new ce.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 ve.Emitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ve.Emitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ve.Emitter),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ve.Emitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new le.RenderDebouncer(((N,j)=>this._renderRows(N,j)),me),this._register(this._renderDebouncer),this._register(me.onDprChange((()=>this.handleDevicePixelRatioChange()))),this._register(he.onResize((()=>this._fullRefresh()))),this._register(he.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this._register(X.onOptionChange((()=>this._handleOptionsChanged()))),this._register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this._register(se.onDecorationRegistered((()=>this._fullRefresh()))),this._register(se.onDecorationRemoved((()=>this._fullRefresh()))),this._register(X.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(he.cols,he.rows),this._fullRefresh()}))),this._register(X.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(he.buffer.y,he.buffer.y,!0)))),this._register(Se.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(me.window,j),this._register(me.onWindowChange((N=>this._registerIntersectionObserver(N,j))))}_registerIntersectionObserver(N,j){if("IntersectionObserver"in N){const X=new N.IntersectionObserver((N=>this._handleIntersectionChange(N[N.length-1])),{threshold:0});X.observe(j),this._observerDisposable.value=(0,ce.toDisposable)((()=>X.disconnect()))}}_handleIntersectionChange(N){this._isPaused=void 0===N.isIntersecting?0===N.intersectionRatio:!N.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(N,j,X=!1){this._isPaused?this._needsFullRefresh=!0:(X||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(N,j,this._rowCount))}_renderRows(N,j){this._renderer.value&&(N=Math.min(N,this._rowCount-1),j=Math.min(j,this._rowCount-1),this._renderer.value.renderRows(N,j),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:N,end:j}),this._onRender.fire({start:N,end:j}),this._isNextRenderRedrawOnly=!0)}resize(N,j){this._rowCount=j,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(N){this._renderer.value=N,this._renderer.value&&(this._renderer.value.onRequestRedraw((N=>this.refreshRows(N.start,N.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(N){return this._renderDebouncer.addRefreshCallback(N)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(N,j){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(N,j))):this._renderer.value.handleResize(N,j),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(N,j,X){this._selectionState.start=N,this._selectionState.end=j,this._selectionState.columnSelectMode=X,this._renderer.value?.handleSelectionChanged(N,j,X)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};j.RenderService=Se,j.RenderService=Se=ie([se(2,me.IOptionsService),se(3,he.ICharSizeService),se(4,me.IDecorationService),se(5,me.IBufferService),se(6,he.ICoreBrowserService),se(7,he.IThemeService)],Se)},2079:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.SelectionService=void 0;const le=X(5251),he=X(9686),ce=X(5959),_e=X(7098),me=X(7150),ve=X(701),Se=X(9384),be=X(3055),Ce=X(6501),ye=X(802),we=String.fromCharCode(160),Ee=new RegExp(we,"g");let De=class extends me.Disposable{constructor(N,j,X,ie,se,le,he,_e,ve){super(),this._element=N,this._screenElement=j,this._linkifier=X,this._bufferService=ie,this._coreService=se,this._mouseService=le,this._optionsService=he,this._renderService=_e,this._coreBrowserService=ve,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new be.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ye.Emitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ye.Emitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ye.Emitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ye.Emitter),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 ce.SelectionModel(this._bufferService),this._activeSelectionMode=0,this._register((0,me.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 N=this._model.finalSelectionStart,j=this._model.finalSelectionEnd;return!(!N||!j||N[0]===j[0]&&N[1]===j[1])}get selectionText(){const N=this._model.finalSelectionStart,j=this._model.finalSelectionEnd;if(!N||!j)return"";const X=this._bufferService.buffer,ie=[];if(3===this._activeSelectionMode){if(N[0]===j[0])return"";const se=N[0]N.replace(Ee," "))).join(ve.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(N){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),ve.isLinux&&N&&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:3===this._activeSelectionMode})}_isClickInSelection(N){const j=this._getMouseBufferCoords(N),X=this._model.finalSelectionStart,ie=this._model.finalSelectionEnd;return!!(X&&ie&&j)&&this._areCoordsInSelection(j,X,ie)}isCellInSelection(N,j){const X=this._model.finalSelectionStart,ie=this._model.finalSelectionEnd;return!(!X||!ie)&&this._areCoordsInSelection([N,j],X,ie)}_areCoordsInSelection(N,j,X){return N[1]>j[1]&&N[1]=j[0]&&N[0]=j[0]}_selectWordAtCursor(N,j){const X=this._linkifier.currentLink?.link?.range;if(X)return this._model.selectionStart=[X.start.x-1,X.start.y-1],this._model.selectionStartLength=(0,Se.getRangeLength)(X,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const ie=this._getMouseBufferCoords(N);return!!ie&&(this._selectWordAt(ie,j),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(N,j){this._model.clearSelection(),N=Math.max(N,0),j=Math.min(j,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,N],this._model.selectionEnd=[this._bufferService.cols,j],this.refresh(),this._onSelectionChange.fire()}_handleTrim(N){this._model.handleTrim(N)&&this.refresh()}_getMouseBufferCoords(N){const j=this._mouseService.getCoords(N,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(j)return j[0]--,j[1]--,j[1]+=this._bufferService.buffer.ydisp,j}_getMouseEventScrollAmount(N){let j=(0,le.getCoordsRelativeToElement)(this._coreBrowserService.window,N,this._screenElement)[1];const X=this._renderService.dimensions.css.canvas.height;return j>=0&&j<=X?0:(j>X&&(j-=X),j=Math.min(Math.max(j,-50),50),j/=50,j/Math.abs(j)+Math.round(14*j))}shouldForceSelection(N){return ve.isMac?N.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:N.shiftKey}handleMouseDown(N){if(this._mouseDownTimeStamp=N.timeStamp,(2!==N.button||!this.hasSelection)&&0===N.button){if(!this._enabled){if(!this.shouldForceSelection(N))return;N.stopPropagation()}N.preventDefault(),this._dragScrollAmount=0,this._enabled&&N.shiftKey?this._handleIncrementalClick(N):1===N.detail?this._handleSingleClick(N):2===N.detail?this._handleDoubleClick(N):3===N.detail&&this._handleTripleClick(N),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(N){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(N))}_handleSingleClick(N){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(N)?3:0,this._model.selectionStart=this._getMouseBufferCoords(N),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const j=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);j&&j.length!==this._model.selectionStart[0]&&0===j.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(N){this._selectWordAtCursor(N,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(N){const j=this._getMouseBufferCoords(N);j&&(this._activeSelectionMode=2,this._selectLineAt(j[1]))}shouldColumnSelect(N){return N.altKey&&!(ve.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(N){if(N.stopImmediatePropagation(),!this._model.selectionStart)return;const j=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(N),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const X=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(N.ydisp+this._bufferService.rows,N.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=N.ydisp),this.refresh()}}_handleMouseUp(N){const j=N.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&j<500&&N.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const j=this._mouseService.getCoords(N,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(j&&void 0!==j[0]&&void 0!==j[1]){const N=(0,he.moveToCellSequence)(j[0]-1,j[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(N,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const N=this._model.finalSelectionStart,j=this._model.finalSelectionEnd,X=!(!N||!j||N[0]===j[0]&&N[1]===j[1]);X?N&&j&&(this._oldSelectionStart&&this._oldSelectionEnd&&N[0]===this._oldSelectionStart[0]&&N[1]===this._oldSelectionStart[1]&&j[0]===this._oldSelectionEnd[0]&&j[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(N,j,X)):this._oldHasSelection&&this._fireOnSelectionChange(N,j,X)}_fireOnSelectionChange(N,j,X){this._oldSelectionStart=N,this._oldSelectionEnd=j,this._oldHasSelection=X,this._onSelectionChange.fire()}_handleBufferActivate(N){this.clearSelection(),this._trimListener.dispose(),this._trimListener=N.activeBuffer.lines.onTrim((N=>this._handleTrim(N)))}_convertViewportColToCharacterIndex(N,j){let X=j;for(let ie=0;j>=ie;ie++){const se=N.loadCell(ie,this._workCell).getChars().length;0===this._workCell.getWidth()?X--:se>1&&j!==ie&&(X+=se-1)}return X}setSelection(N,j,X){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[N,j],this._model.selectionStartLength=X,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(N){this._isClickInSelection(N)||(this._selectWordAtCursor(N,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(N,j,X=!0,ie=!0){if(N[0]>=this._bufferService.cols)return;const se=this._bufferService.buffer,le=se.lines.get(N[1]);if(!le)return;const he=se.translateBufferLineToString(N[1],!1);let ce=this._convertViewportColToCharacterIndex(le,N[0]),_e=ce;const me=N[0]-ce;let ve=0,Se=0,be=0,Ce=0;if(" "===he.charAt(ce)){for(;ce>0&&" "===he.charAt(ce-1);)ce--;for(;_e1&&(Ce+=ie-1,_e+=ie-1);j>0&&ce>0&&!this._isCharWordSeparator(le.loadCell(j-1,this._workCell));){le.loadCell(j-1,this._workCell);const N=this._workCell.getChars().length;0===this._workCell.getWidth()?(ve++,j--):N>1&&(be+=N-1,ce-=N-1),ce--,j--}for(;X1&&(Ce+=N-1,_e+=N-1),_e++,X++}}_e++;let ye=ce+me-ve+be,we=Math.min(this._bufferService.cols,_e-ce+ve+Se-be-Ce);if(j||""!==he.slice(ce,_e).trim()){if(X&&0===ye&&32!==le.getCodePoint(0)){const j=se.lines.get(N[1]-1);if(j&&le.isWrapped&&32!==j.getCodePoint(this._bufferService.cols-1)){const j=this._getWordAt([this._bufferService.cols-1,N[1]-1],!1,!0,!1);if(j){const N=this._bufferService.cols-j.start;ye-=N,we+=N}}}if(ie&&ye+we===this._bufferService.cols&&32!==le.getCodePoint(this._bufferService.cols-1)){const j=se.lines.get(N[1]+1);if(j?.isWrapped&&32!==j.getCodePoint(0)){const j=this._getWordAt([0,N[1]+1],!1,!1,!0);j&&(we+=j.length)}}return{start:ye,length:we}}}_selectWordAt(N,j){const X=this._getWordAt(N,j);if(X){for(;X.start<0;)X.start+=this._bufferService.cols,N[1]--;this._model.selectionStart=[X.start,N[1]],this._model.selectionStartLength=X.length}}_selectToWordAt(N){const j=this._getWordAt(N,!0);if(j){let X=N[1];for(;j.start<0;)j.start+=this._bufferService.cols,X--;if(!this._model.areSelectionValuesReversed())for(;j.start+j.length>this._bufferService.cols;)j.length-=this._bufferService.cols,X++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?j.start:j.start+j.length,X]}}_isCharWordSeparator(N){return 0!==N.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(N.getChars())>=0}_selectLineAt(N){const j=this._bufferService.buffer.getWrappedRangeForLine(N),X={start:{x:0,y:j.first},end:{x:this._bufferService.cols-1,y:j.last}};this._model.selectionStart=[0,j.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,Se.getRangeLength)(X,this._bufferService.cols)}};j.SelectionService=De,j.SelectionService=De=ie([se(3,Ce.IBufferService),se(4,Ce.ICoreService),se(5,_e.IMouseService),se(6,Ce.IOptionsService),se(7,_e.IRenderService),se(8,_e.ICoreBrowserService)],De)},7098:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ILinkProviderService=j.IThemeService=j.ICharacterJoinerService=j.ISelectionService=j.IRenderService=j.IMouseService=j.ICoreBrowserService=j.ICharSizeService=void 0;const ie=X(6201);j.ICharSizeService=(0,ie.createDecorator)("CharSizeService"),j.ICoreBrowserService=(0,ie.createDecorator)("CoreBrowserService"),j.IMouseService=(0,ie.createDecorator)("MouseService"),j.IRenderService=(0,ie.createDecorator)("RenderService"),j.ISelectionService=(0,ie.createDecorator)("SelectionService"),j.ICharacterJoinerService=(0,ie.createDecorator)("CharacterJoinerService"),j.IThemeService=(0,ie.createDecorator)("ThemeService"),j.ILinkProviderService=(0,ie.createDecorator)("LinkProviderService")},9078:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.ThemeService=void 0;const le=X(7174),he=X(9302),ce=X(4103),_e=X(7150),me=X(6501),ve=X(802),Se=ce.css.toColor("#ffffff"),be=ce.css.toColor("#000000"),Ce=ce.css.toColor("#ffffff"),ye=be,we={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Ee=Se;let De=class extends _e.Disposable{get colors(){return this._colors}constructor(N){super(),this._optionsService=N,this._contrastCache=new le.ColorContrastCache,this._halfContrastCache=new le.ColorContrastCache,this._onChangeColors=this._register(new ve.Emitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Se,background:be,cursor:Ce,cursorAccent:ye,selectionForeground:void 0,selectionBackgroundTransparent:we,selectionBackgroundOpaque:ce.color.blend(be,we),selectionInactiveBackgroundTransparent:we,selectionInactiveBackgroundOpaque:ce.color.blend(be,we),scrollbarSliderBackground:ce.color.opacity(Se,.2),scrollbarSliderHoverBackground:ce.color.opacity(Se,.4),scrollbarSliderActiveBackground:ce.color.opacity(Se,.5),overviewRulerBorder:Se,ansi:he.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(N={}){const j=this._colors;if(j.foreground=v(N.foreground,Se),j.background=v(N.background,be),j.cursor=v(N.cursor,Ce),j.cursorAccent=v(N.cursorAccent,ye),j.selectionBackgroundTransparent=v(N.selectionBackground,we),j.selectionBackgroundOpaque=ce.color.blend(j.background,j.selectionBackgroundTransparent),j.selectionInactiveBackgroundTransparent=v(N.selectionInactiveBackground,j.selectionBackgroundTransparent),j.selectionInactiveBackgroundOpaque=ce.color.blend(j.background,j.selectionInactiveBackgroundTransparent),j.selectionForeground=N.selectionForeground?v(N.selectionForeground,ce.NULL_COLOR):void 0,j.selectionForeground===ce.NULL_COLOR&&(j.selectionForeground=void 0),ce.color.isOpaque(j.selectionBackgroundTransparent)){const N=.3;j.selectionBackgroundTransparent=ce.color.opacity(j.selectionBackgroundTransparent,N)}if(ce.color.isOpaque(j.selectionInactiveBackgroundTransparent)){const N=.3;j.selectionInactiveBackgroundTransparent=ce.color.opacity(j.selectionInactiveBackgroundTransparent,N)}if(j.scrollbarSliderBackground=v(N.scrollbarSliderBackground,ce.color.opacity(j.foreground,.2)),j.scrollbarSliderHoverBackground=v(N.scrollbarSliderHoverBackground,ce.color.opacity(j.foreground,.4)),j.scrollbarSliderActiveBackground=v(N.scrollbarSliderActiveBackground,ce.color.opacity(j.foreground,.5)),j.overviewRulerBorder=v(N.overviewRulerBorder,Ee),j.ansi=he.DEFAULT_ANSI_COLORS.slice(),j.ansi[0]=v(N.black,he.DEFAULT_ANSI_COLORS[0]),j.ansi[1]=v(N.red,he.DEFAULT_ANSI_COLORS[1]),j.ansi[2]=v(N.green,he.DEFAULT_ANSI_COLORS[2]),j.ansi[3]=v(N.yellow,he.DEFAULT_ANSI_COLORS[3]),j.ansi[4]=v(N.blue,he.DEFAULT_ANSI_COLORS[4]),j.ansi[5]=v(N.magenta,he.DEFAULT_ANSI_COLORS[5]),j.ansi[6]=v(N.cyan,he.DEFAULT_ANSI_COLORS[6]),j.ansi[7]=v(N.white,he.DEFAULT_ANSI_COLORS[7]),j.ansi[8]=v(N.brightBlack,he.DEFAULT_ANSI_COLORS[8]),j.ansi[9]=v(N.brightRed,he.DEFAULT_ANSI_COLORS[9]),j.ansi[10]=v(N.brightGreen,he.DEFAULT_ANSI_COLORS[10]),j.ansi[11]=v(N.brightYellow,he.DEFAULT_ANSI_COLORS[11]),j.ansi[12]=v(N.brightBlue,he.DEFAULT_ANSI_COLORS[12]),j.ansi[13]=v(N.brightMagenta,he.DEFAULT_ANSI_COLORS[13]),j.ansi[14]=v(N.brightCyan,he.DEFAULT_ANSI_COLORS[14]),j.ansi[15]=v(N.brightWhite,he.DEFAULT_ANSI_COLORS[15]),N.extendedAnsi){const X=Math.min(j.ansi.length-16,N.extendedAnsi.length);for(let ie=0;ie{Object.defineProperty(j,"__esModule",{value:!0}),j.CircularList=void 0;const ie=X(7150),se=X(802);class n extends ie.Disposable{constructor(N){super(),this._maxLength=N,this.onDeleteEmitter=this._register(new se.Emitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new se.Emitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new se.Emitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(N){if(this._maxLength===N)return;const j=new Array(N);for(let X=0;Xthis._length)for(let j=this._length;j=N;j--)this._array[this._getCyclicIndex(j+X.length)]=this._array[this._getCyclicIndex(j)];for(let j=0;jthis._maxLength){const N=this._length+X.length-this._maxLength;this._startIndex+=N,this._length=this._maxLength,this.onTrimEmitter.fire(N)}else this._length+=X.length}trimStart(N){N>this._length&&(N=this._length),this._startIndex+=N,this._length-=N,this.onTrimEmitter.fire(N)}shiftElements(N,j,X){if(!(j<=0)){if(N<0||N>=this._length)throw new Error("start argument out of range");if(N+X<0)throw new Error("Cannot shift elements in list beyond index 0");if(X>0){for(let ie=j-1;ie>=0;ie--)this.set(N+ie+X,this.get(N+ie));const ie=N+j+X-this._length;if(ie>0)for(this._length+=ie;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let ie=0;ie{Object.defineProperty(j,"__esModule",{value:!0}),j.clone=function e(N,j=5){if("object"!=typeof N)return N;const X=Array.isArray(N)?[]:{};for(const ie in N)X[ie]=j<=1?N[ie]:N[ie]&&e(N[ie],j-1);return X}},4103:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.rgba=j.rgb=j.css=j.color=j.channels=j.NULL_COLOR=void 0,j.toPaddedHex=d,j.contrastRatio=u;let X=0,ie=0,se=0,le=0;var he,ce,_e,me,ve;function d(N){const j=N.toString(16);return j.length<2?"0"+j:j}function u(N,j){return N>>0},N.toColor=function(j,X,ie,se){return{css:N.toCss(j,X,ie,se),rgba:N.toRgba(j,X,ie,se)}}}(he||(j.channels=he={})),function(N){function t(N,j){return le=Math.round(255*j),[X,ie,se]=ve.toChannels(N.rgba),{css:he.toCss(X,ie,se,le),rgba:he.toRgba(X,ie,se,le)}}N.blend=function(N,j){if(le=(255&j.rgba)/255,1===le)return{css:j.css,rgba:j.rgba};const ce=j.rgba>>24&255,_e=j.rgba>>16&255,me=j.rgba>>8&255,ve=N.rgba>>24&255,Se=N.rgba>>16&255,be=N.rgba>>8&255;return X=ve+Math.round((ce-ve)*le),ie=Se+Math.round((_e-Se)*le),se=be+Math.round((me-be)*le),{css:he.toCss(X,ie,se),rgba:he.toRgba(X,ie,se)}},N.isOpaque=function(N){return!(255&~N.rgba)},N.ensureContrastRatio=function(N,j,X){const ie=ve.ensureContrastRatio(N.rgba,j.rgba,X);if(ie)return he.toColor(ie>>24&255,ie>>16&255,ie>>8&255)},N.opaque=function(N){const j=(255|N.rgba)>>>0;return[X,ie,se]=ve.toChannels(j),{css:he.toCss(X,ie,se),rgba:j}},N.opacity=t,N.multiplyOpacity=function(N,j){return le=255&N.rgba,t(N,le*j/255)},N.toColorRGB=function(N){return[N.rgba>>24&255,N.rgba>>16&255,N.rgba>>8&255]}}(ce||(j.color=ce={})),function(N){let j,ce;try{const N=document.createElement("canvas");N.width=1,N.height=1;const X=N.getContext("2d",{willReadFrequently:!0});X&&(j=X,j.globalCompositeOperation="copy",ce=j.createLinearGradient(0,0,1,1))}catch{}N.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return X=parseInt(N.slice(1,2).repeat(2),16),ie=parseInt(N.slice(2,3).repeat(2),16),se=parseInt(N.slice(3,4).repeat(2),16),he.toColor(X,ie,se);case 5:return X=parseInt(N.slice(1,2).repeat(2),16),ie=parseInt(N.slice(2,3).repeat(2),16),se=parseInt(N.slice(3,4).repeat(2),16),le=parseInt(N.slice(4,5).repeat(2),16),he.toColor(X,ie,se,le);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const _e=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(_e)return X=parseInt(_e[1]),ie=parseInt(_e[2]),se=parseInt(_e[3]),le=Math.round(255*(void 0===_e[5]?1:parseFloat(_e[5]))),he.toColor(X,ie,se,le);if(!j||!ce)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=ce,j.fillStyle=N,"string"!=typeof j.fillStyle)throw new Error("css.toColor: Unsupported css format");if(j.fillRect(0,0,1,1),[X,ie,se,le]=j.getImageData(0,0,1,1).data,255!==le)throw new Error("css.toColor: Unsupported css format");return{rgba:he.toRgba(X,ie,se,le),css:N}}}(_e||(j.css=_e={})),function(N){function t(N,j,X){const ie=N/255,se=j/255,le=X/255;return.2126*(ie<=.03928?ie/12.92:Math.pow((ie+.055)/1.055,2.4))+.7152*(se<=.03928?se/12.92:Math.pow((se+.055)/1.055,2.4))+.0722*(le<=.03928?le/12.92:Math.pow((le+.055)/1.055,2.4))}N.relativeLuminance=function(N){return t(N>>16&255,N>>8&255,255&N)},N.relativeLuminance2=t}(me||(j.rgb=me={})),function(N){function t(N,j,X){const ie=N>>24&255,se=N>>16&255,le=N>>8&255;let he=j>>24&255,ce=j>>16&255,_e=j>>8&255,ve=u(me.relativeLuminance2(he,ce,_e),me.relativeLuminance2(ie,se,le));for(;ve0||ce>0||_e>0);)he-=Math.max(0,Math.ceil(.1*he)),ce-=Math.max(0,Math.ceil(.1*ce)),_e-=Math.max(0,Math.ceil(.1*_e)),ve=u(me.relativeLuminance2(he,ce,_e),me.relativeLuminance2(ie,se,le));return(he<<24|ce<<16|_e<<8|255)>>>0}function a(N,j,X){const ie=N>>24&255,se=N>>16&255,le=N>>8&255;let he=j>>24&255,ce=j>>16&255,_e=j>>8&255,ve=u(me.relativeLuminance2(he,ce,_e),me.relativeLuminance2(ie,se,le));for(;ve>>0}N.blend=function(N,j){if(le=(255&j)/255,1===le)return j;const ce=j>>24&255,_e=j>>16&255,me=j>>8&255,ve=N>>24&255,Se=N>>16&255,be=N>>8&255;return X=ve+Math.round((ce-ve)*le),ie=Se+Math.round((_e-Se)*le),se=be+Math.round((me-be)*le),he.toRgba(X,ie,se)},N.ensureContrastRatio=function(N,j,X){const ie=me.relativeLuminance(N>>8),se=me.relativeLuminance(j>>8);if(u(ie,se)>8));if(leu(ie,me.relativeLuminance(he>>8))?se:he}return se}const le=a(N,j,X),he=u(ie,me.relativeLuminance(le>>8));if(heu(ie,me.relativeLuminance(se>>8))?le:se}return le}},N.reduceLuminance=t,N.increaseLuminance=a,N.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}}(ve||(j.rgba=ve={}))},5777:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.CoreTerminal=void 0;const ie=X(6501),se=X(6025),le=X(7276),he=X(9640),ce=X(56),_e=X(4071),me=X(7792),ve=X(6415),Se=X(5746),be=X(5882),Ce=X(2486),ye=X(3562),we=X(8811),Ee=X(802),De=X(7150);let Le=!1;class S extends De.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Ee.Emitter),this._onScroll.event((N=>{this._onScrollApi?.fire(N.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(N){for(const j in N)this.optionsService.options[j]=N[j]}constructor(N){super(),this._windowsWrappingHeuristics=this._register(new De.MutableDisposable),this._onBinary=this._register(new Ee.Emitter),this.onBinary=this._onBinary.event,this._onData=this._register(new Ee.Emitter),this.onData=this._onData.event,this._onLineFeed=this._register(new Ee.Emitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Ee.Emitter),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Ee.Emitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Ee.Emitter),this._instantiationService=new se.InstantiationService,this.optionsService=this._register(new ce.OptionsService(N)),this._instantiationService.setService(ie.IOptionsService,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(he.BufferService)),this._instantiationService.setService(ie.IBufferService,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(le.LogService)),this._instantiationService.setService(ie.ILogService,this._logService),this.coreService=this._register(this._instantiationService.createInstance(_e.CoreService)),this._instantiationService.setService(ie.ICoreService,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(me.CoreMouseService)),this._instantiationService.setService(ie.ICoreMouseService,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ve.UnicodeService)),this._instantiationService.setService(ie.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Se.CharsetService),this._instantiationService.setService(ie.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(we.OscLinkService),this._instantiationService.setService(ie.IOscLinkService,this._oscLinkService),this._inputHandler=this._register(new Ce.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ee.Event.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ee.Event.forward(this._bufferService.onResize,this._onResize)),this._register(Ee.Event.forward(this.coreService.onData,this._onData)),this._register(Ee.Event.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom(!0)))),this._register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this._register(this._bufferService.onScroll((()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this._register(new ye.WriteBuffer(((N,j)=>this._inputHandler.parse(N,j)))),this._register(Ee.Event.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(N,j){this._writeBuffer.write(N,j)}writeSync(N,j){this._logService.logLevel<=ie.LogLevelEnum.WARN&&!Le&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Le=!0),this._writeBuffer.writeSync(N,j)}input(N,j=!0){this.coreService.triggerDataEvent(N,j)}resize(N,j){isNaN(N)||isNaN(j)||(N=Math.max(N,he.MINIMUM_COLS),j=Math.max(j,he.MINIMUM_ROWS),this._bufferService.resize(N,j))}scroll(N,j=!1){this._bufferService.scroll(N,j)}scrollLines(N,j){this._bufferService.scrollLines(N,j)}scrollPages(N){this.scrollLines(N*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(N){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(N){const j=N-this._bufferService.buffer.ydisp;0!==j&&this.scrollLines(j)}registerEscHandler(N,j){return this._inputHandler.registerEscHandler(N,j)}registerDcsHandler(N,j){return this._inputHandler.registerDcsHandler(N,j)}registerCsiHandler(N,j){return this._inputHandler.registerCsiHandler(N,j)}registerOscHandler(N,j){return this._inputHandler.registerOscHandler(N,j)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let N=!1;const j=this.optionsService.rawOptions.windowsPty;j&&void 0!==j.buildNumber&&void 0!==j.buildNumber?N=!!("conpty"===j.backend&&j.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(N=!0),N?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const N=[];N.push(this.onLineFeed(be.updateWindowsModeWrappedState.bind(null,this._bufferService))),N.push(this.registerCsiHandler({final:"H"},(()=>((0,be.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,De.toDisposable)((()=>{for(const j of N)j.dispose()}))}}}j.CoreTerminal=S},2486:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.InputHandler=j.WindowsOptionsReportType=void 0,j.isValidColorIndex=A;const le=X(3534),he=X(6760),ce=X(6717),_e=X(7150),me=X(726),ve=X(6107),Se=X(8938),be=X(3055),Ce=X(5451),ye=X(6501),we=X(6415),Ee=X(1346),De=X(9823),Le=X(8693),Ae=X(802),Re={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Te=131072;function y(N,j){if(N>24)return j.setWinLines||!1;switch(N){case 1:return!!j.restoreWin;case 2:return!!j.minimizeWin;case 3:return!!j.setWinPosition;case 4:return!!j.setWinSizePixels;case 5:return!!j.raiseWin;case 6:return!!j.lowerWin;case 7:return!!j.refreshWin;case 8:return!!j.setWinSizeChars;case 9:return!!j.maximizeWin;case 10:return!!j.fullscreenWin;case 11:return!!j.getWinState;case 13:return!!j.getWinPosition;case 14:return!!j.getWinSizePixels;case 15:return!!j.getScreenSizePixels;case 16:return!!j.getCellSizePixels;case 18:return!!j.getWinSizeChars;case 19:return!!j.getScreenSizeChars;case 20:return!!j.getIconTitle;case 21:return!!j.getWinTitle;case 22:return!!j.pushTitle;case 23:return!!j.popTitle;case 24:return!!j.setWinLines}return!1}var ke;!function(N){N[N.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",N[N.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(ke||(j.WindowsOptionsReportType=ke={}));let Me=0;class D extends _e.Disposable{getAttrData(){return this._curAttrData}constructor(N,j,X,ie,se,_e,Se,be,Ce=new ce.EscapeSequenceParser){super(),this._bufferService=N,this._charsetService=j,this._coreService=X,this._logService=ie,this._optionsService=se,this._oscLinkService=_e,this._coreMouseService=Se,this._unicodeService=be,this._parser=Ce,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new me.StringToUtf32,this._utf8Decoder=new me.Utf8ToUtf32,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ve.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=ve.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this._register(new Ae.Emitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Ae.Emitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Ae.Emitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Ae.Emitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Ae.Emitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Ae.Emitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Ae.Emitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Ae.Emitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Ae.Emitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Ae.Emitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Ae.Emitter),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Ae.Emitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Ae.Emitter),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 Oe(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((N=>this._activeBuffer=N.activeBuffer))),this._parser.setCsiHandlerFallback(((N,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(N),params:j.toArray()})})),this._parser.setEscHandlerFallback((N=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(N)})})),this._parser.setExecuteHandlerFallback((N=>{this._logService.debug("Unknown EXECUTE code: ",{code:N})})),this._parser.setOscHandlerFallback(((N,j,X)=>{this._logService.debug("Unknown OSC code: ",{identifier:N,action:j,data:X})})),this._parser.setDcsHandlerFallback(((N,j,X)=>{"HOOK"===j&&(X=X.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(N),action:j,payload:X})})),this._parser.setPrintHandler(((N,j,X)=>this.print(N,j,X))),this._parser.registerCsiHandler({final:"@"},(N=>this.insertChars(N))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(N=>this.scrollLeft(N))),this._parser.registerCsiHandler({final:"A"},(N=>this.cursorUp(N))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(N=>this.scrollRight(N))),this._parser.registerCsiHandler({final:"B"},(N=>this.cursorDown(N))),this._parser.registerCsiHandler({final:"C"},(N=>this.cursorForward(N))),this._parser.registerCsiHandler({final:"D"},(N=>this.cursorBackward(N))),this._parser.registerCsiHandler({final:"E"},(N=>this.cursorNextLine(N))),this._parser.registerCsiHandler({final:"F"},(N=>this.cursorPrecedingLine(N))),this._parser.registerCsiHandler({final:"G"},(N=>this.cursorCharAbsolute(N))),this._parser.registerCsiHandler({final:"H"},(N=>this.cursorPosition(N))),this._parser.registerCsiHandler({final:"I"},(N=>this.cursorForwardTab(N))),this._parser.registerCsiHandler({final:"J"},(N=>this.eraseInDisplay(N,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(N=>this.eraseInDisplay(N,!0))),this._parser.registerCsiHandler({final:"K"},(N=>this.eraseInLine(N,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(N=>this.eraseInLine(N,!0))),this._parser.registerCsiHandler({final:"L"},(N=>this.insertLines(N))),this._parser.registerCsiHandler({final:"M"},(N=>this.deleteLines(N))),this._parser.registerCsiHandler({final:"P"},(N=>this.deleteChars(N))),this._parser.registerCsiHandler({final:"S"},(N=>this.scrollUp(N))),this._parser.registerCsiHandler({final:"T"},(N=>this.scrollDown(N))),this._parser.registerCsiHandler({final:"X"},(N=>this.eraseChars(N))),this._parser.registerCsiHandler({final:"Z"},(N=>this.cursorBackwardTab(N))),this._parser.registerCsiHandler({final:"`"},(N=>this.charPosAbsolute(N))),this._parser.registerCsiHandler({final:"a"},(N=>this.hPositionRelative(N))),this._parser.registerCsiHandler({final:"b"},(N=>this.repeatPrecedingCharacter(N))),this._parser.registerCsiHandler({final:"c"},(N=>this.sendDeviceAttributesPrimary(N))),this._parser.registerCsiHandler({prefix:">",final:"c"},(N=>this.sendDeviceAttributesSecondary(N))),this._parser.registerCsiHandler({final:"d"},(N=>this.linePosAbsolute(N))),this._parser.registerCsiHandler({final:"e"},(N=>this.vPositionRelative(N))),this._parser.registerCsiHandler({final:"f"},(N=>this.hVPosition(N))),this._parser.registerCsiHandler({final:"g"},(N=>this.tabClear(N))),this._parser.registerCsiHandler({final:"h"},(N=>this.setMode(N))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(N=>this.setModePrivate(N))),this._parser.registerCsiHandler({final:"l"},(N=>this.resetMode(N))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(N=>this.resetModePrivate(N))),this._parser.registerCsiHandler({final:"m"},(N=>this.charAttributes(N))),this._parser.registerCsiHandler({final:"n"},(N=>this.deviceStatus(N))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(N=>this.deviceStatusPrivate(N))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(N=>this.softReset(N))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(N=>this.setCursorStyle(N))),this._parser.registerCsiHandler({final:"r"},(N=>this.setScrollRegion(N))),this._parser.registerCsiHandler({final:"s"},(N=>this.saveCursor(N))),this._parser.registerCsiHandler({final:"t"},(N=>this.windowOptions(N))),this._parser.registerCsiHandler({final:"u"},(N=>this.restoreCursor(N))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(N=>this.insertColumns(N))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(N=>this.deleteColumns(N))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(N=>this.selectProtected(N))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(N=>this.requestMode(N,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(N=>this.requestMode(N,!1))),this._parser.setExecuteHandler(le.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(le.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(le.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(le.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(le.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(le.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(le.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(le.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(le.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(le.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(le.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(le.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new Ee.OscHandler((N=>(this.setTitle(N),this.setIconName(N),!0)))),this._parser.registerOscHandler(1,new Ee.OscHandler((N=>this.setIconName(N)))),this._parser.registerOscHandler(2,new Ee.OscHandler((N=>this.setTitle(N)))),this._parser.registerOscHandler(4,new Ee.OscHandler((N=>this.setOrReportIndexedColor(N)))),this._parser.registerOscHandler(8,new Ee.OscHandler((N=>this.setHyperlink(N)))),this._parser.registerOscHandler(10,new Ee.OscHandler((N=>this.setOrReportFgColor(N)))),this._parser.registerOscHandler(11,new Ee.OscHandler((N=>this.setOrReportBgColor(N)))),this._parser.registerOscHandler(12,new Ee.OscHandler((N=>this.setOrReportCursorColor(N)))),this._parser.registerOscHandler(104,new Ee.OscHandler((N=>this.restoreIndexedColor(N)))),this._parser.registerOscHandler(110,new Ee.OscHandler((N=>this.restoreFgColor(N)))),this._parser.registerOscHandler(111,new Ee.OscHandler((N=>this.restoreBgColor(N)))),this._parser.registerOscHandler(112,new Ee.OscHandler((N=>this.restoreCursorColor(N)))),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 N in he.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:N},(()=>this.selectCharset("("+N))),this._parser.registerEscHandler({intermediates:")",final:N},(()=>this.selectCharset(")"+N))),this._parser.registerEscHandler({intermediates:"*",final:N},(()=>this.selectCharset("*"+N))),this._parser.registerEscHandler({intermediates:"+",final:N},(()=>this.selectCharset("+"+N))),this._parser.registerEscHandler({intermediates:"-",final:N},(()=>this.selectCharset("-"+N))),this._parser.registerEscHandler({intermediates:".",final:N},(()=>this.selectCharset("."+N))),this._parser.registerEscHandler({intermediates:"/",final:N},(()=>this.selectCharset("/"+N)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((N=>(this._logService.error("Parsing error: ",N),N))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new De.DcsHandler(((N,j)=>this.requestStatusString(N,j))))}_preserveStack(N,j,X,ie){this._parseStack.paused=!0,this._parseStack.cursorStartX=N,this._parseStack.cursorStartY=j,this._parseStack.decodedLength=X,this._parseStack.position=ie}_logSlowResolvingAsync(N){this._logService.logLevel<=ye.LogLevelEnum.WARN&&Promise.race([N,new Promise(((N,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((N=>{if("#SLOW_TIMEOUT"!==N)throw N;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(N,j){let X,ie=this._activeBuffer.x,se=this._activeBuffer.y,le=0;const he=this._parseStack.paused;if(he){if(X=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,j))return this._logSlowResolvingAsync(X),X;ie=this._parseStack.cursorStartX,se=this._parseStack.cursorStartY,this._parseStack.paused=!1,N.length>Te&&(le=this._parseStack.position+Te)}if(this._logService.logLevel<=ye.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+("string"==typeof N?` "${N}"`:` "${Array.prototype.map.call(N,(N=>String.fromCharCode(N))).join("")}"`),"string"==typeof N?N.split("").map((N=>N.charCodeAt(0))):N),this._parseBuffer.lengthTe)for(let j=le;j0&&2===ye.getWidth(this._activeBuffer.x-1)&&ye.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Ce);let Ee=this._parser.precedingJoinState;for(let De=j;Dece)if(_e){const N=ye;let j=this._activeBuffer.x-Le;for(this._activeBuffer.x=Le,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),ye=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Le>0&&ye instanceof ve.BufferLine&&ye.copyCellsFrom(N,j,0,Le,!1);j=0;)ye.setCellFromCodepoint(this._activeBuffer.x++,0,0,Ce)}else if(be&&(ye.insertCells(this._activeBuffer.x,se-Le,this._activeBuffer.getNullCell(Ce)),2===ye.getWidth(ce-1)&&ye.setCellFromCodepoint(ce-1,Se.NULL_CELL_CODE,Se.NULL_CELL_WIDTH,Ce)),ye.setCellFromCodepoint(this._activeBuffer.x++,ie,se,Ce),se>0)for(;--se;)ye.setCellFromCodepoint(this._activeBuffer.x++,0,0,Ce)}this._parser.precedingJoinState=Ee,this._activeBuffer.x0&&0===ye.getWidth(this._activeBuffer.x)&&!ye.hasContent(this._activeBuffer.x)&&ye.setCellFromCodepoint(this._activeBuffer.x,0,1,Ce),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(N,j){return"t"!==N.final||N.prefix||N.intermediates?this._parser.registerCsiHandler(N,j):this._parser.registerCsiHandler(N,(N=>!y(N.params[0],this._optionsService.rawOptions.windowOptions)||j(N)))}registerDcsHandler(N,j){return this._parser.registerDcsHandler(N,new De.DcsHandler(j))}registerEscHandler(N,j){return this._parser.registerEscHandler(N,j)}registerOscHandler(N,j){return this._parser.registerOscHandler(N,new Ee.OscHandler(j))}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(){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(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);N.hasWidth(this._activeBuffer.x)&&!N.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const N=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-N),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(N=this._bufferService.cols-1){this._activeBuffer.x=Math.min(N,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(N,j){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=N,this._activeBuffer.y=this._activeBuffer.scrollTop+j):(this._activeBuffer.x=N,this._activeBuffer.y=j),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(N,j){this._restrictCursor(),this._setCursor(this._activeBuffer.x+N,this._activeBuffer.y+j)}cursorUp(N){const j=this._activeBuffer.y-this._activeBuffer.scrollTop;return j>=0?this._moveCursor(0,-Math.min(j,N.params[0]||1)):this._moveCursor(0,-(N.params[0]||1)),!0}cursorDown(N){const j=this._activeBuffer.scrollBottom-this._activeBuffer.y;return j>=0?this._moveCursor(0,Math.min(j,N.params[0]||1)):this._moveCursor(0,N.params[0]||1),!0}cursorForward(N){return this._moveCursor(N.params[0]||1,0),!0}cursorBackward(N){return this._moveCursor(-(N.params[0]||1),0),!0}cursorNextLine(N){return this.cursorDown(N),this._activeBuffer.x=0,!0}cursorPrecedingLine(N){return this.cursorUp(N),this._activeBuffer.x=0,!0}cursorCharAbsolute(N){return this._setCursor((N.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(N){return this._setCursor(N.length>=2?(N.params[1]||1)-1:0,(N.params[0]||1)-1),!0}charPosAbsolute(N){return this._setCursor((N.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(N){return this._moveCursor(N.params[0]||1,0),!0}linePosAbsolute(N){return this._setCursor(this._activeBuffer.x,(N.params[0]||1)-1),!0}vPositionRelative(N){return this._moveCursor(0,N.params[0]||1),!0}hVPosition(N){return this.cursorPosition(N),!0}tabClear(N){const j=N.params[0];return 0===j?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===j&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(N){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=N.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(N){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=N.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(N){const j=N.params[0];return 1===j&&(this._curAttrData.bg|=536870912),2!==j&&0!==j||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(N,j,X,ie=!1,se=!1){const le=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);le.replaceCells(j,X,this._activeBuffer.getNullCell(this._eraseAttrData()),se),ie&&(le.isWrapped=!1)}_resetBufferLine(N,j=!1){const X=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);X&&(X.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),j),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+N),X.isWrapped=!1)}eraseInDisplay(N,j=!1){let X;switch(this._restrictCursor(this._bufferService.cols),N.params[0]){case 0:for(X=this._activeBuffer.y,this._dirtyRowTracker.markDirty(X),this._eraseInBufferLine(X++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,j);X=this._bufferService.cols&&(this._activeBuffer.lines.get(X+1).isWrapped=!1);X--;)this._resetBufferLine(X,j);this._dirtyRowTracker.markDirty(0);break;case 2:for(X=this._bufferService.rows,this._dirtyRowTracker.markDirty(X-1);X--;)this._resetBufferLine(X,j);this._dirtyRowTracker.markDirty(0);break;case 3:const N=this._activeBuffer.lines.length-this._bufferService.rows;N>0&&(this._activeBuffer.lines.trimStart(N),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-N,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-N,0),this._onScroll.fire(0))}return!0}eraseInLine(N,j=!1){switch(this._restrictCursor(this._bufferService.cols),N.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,j);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,j);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,j)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(N){this._restrictCursor();let j=N.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let _e=ce;for(let N=1;N0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(le.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(le.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(N){return N.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(le.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(le.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(N.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(le.C0.ESC+"[>83;40003;0c")),!0}_is(N){return 0===(this._optionsService.rawOptions.termName+"").indexOf(N)}setMode(N){for(let j=0;jN?1:2,be=N.params[0];return Ce=be,ye=j?2===be?4:4===be?u(he.modes.insertMode):12===be?3:20===be?u(Se.convertEol):0:1===be?u(X.applicationCursorKeys):3===be?Se.windowOptions.setWinLines?80===_e?2:132===_e?1:0:0:6===be?u(X.origin):7===be?u(X.wraparound):8===be?3:9===be?u("X10"===ie):12===be?u(Se.cursorBlink):25===be?u(!he.isCursorHidden):45===be?u(X.reverseWraparound):66===be?u(X.applicationKeypad):67===be?4:1e3===be?u("VT200"===ie):1002===be?u("DRAG"===ie):1003===be?u("ANY"===ie):1004===be?u(X.sendFocus):1005===be?4:1006===be?u("SGR"===se):1015===be?4:1016===be?u("SGR_PIXELS"===se):1048===be?1:47===be||1047===be||1049===be?u(me===ve):2004===be?u(X.bracketedPasteMode):0,he.triggerDataEvent(`${le.C0.ESC}[${j?"":"?"}${Ce};${ye}$y`),!0;var Ce,ye}_updateAttrColor(N,j,X,ie,se){return 2===j?(N|=50331648,N&=-16777216,N|=Ce.AttributeData.fromColorRGB([X,ie,se])):5===j&&(N&=-50331904,N|=33554432|255&X),N}_extractColor(N,j,X){const ie=[0,0,-1,0,0,0];let se=0,le=0;do{if(ie[le+se]=N.params[j+le],N.hasSubParams(j+le)){const X=N.getSubParams(j+le);let he=0;do{5===ie[1]&&(se=1),ie[le+he+1+se]=X[he]}while(++he=2||2===ie[1]&&le+se>=5)break;ie[1]&&(se=1)}while(++le+j5)&&(N=1),j.extended.underlineStyle=N,j.fg|=268435456,0===N&&(j.fg&=-268435457),j.updateExtended()}_processSGR0(N){N.fg=ve.DEFAULT_ATTR_DATA.fg,N.bg=ve.DEFAULT_ATTR_DATA.bg,N.extended=N.extended.clone(),N.extended.underlineStyle=0,N.extended.underlineColor&=-67108864,N.updateExtended()}charAttributes(N){if(1===N.length&&0===N.params[0])return this._processSGR0(this._curAttrData),!0;const j=N.length;let X;const ie=this._curAttrData;for(let se=0;se=30&&X<=37?(ie.fg&=-50331904,ie.fg|=16777216|X-30):X>=40&&X<=47?(ie.bg&=-50331904,ie.bg|=16777216|X-40):X>=90&&X<=97?(ie.fg&=-50331904,ie.fg|=16777224|X-90):X>=100&&X<=107?(ie.bg&=-50331904,ie.bg|=16777224|X-100):0===X?this._processSGR0(ie):1===X?ie.fg|=134217728:3===X?ie.bg|=67108864:4===X?(ie.fg|=268435456,this._processUnderline(N.hasSubParams(se)?N.getSubParams(se)[0]:1,ie)):5===X?ie.fg|=536870912:7===X?ie.fg|=67108864:8===X?ie.fg|=1073741824:9===X?ie.fg|=2147483648:2===X?ie.bg|=134217728:21===X?this._processUnderline(2,ie):22===X?(ie.fg&=-134217729,ie.bg&=-134217729):23===X?ie.bg&=-67108865:24===X?(ie.fg&=-268435457,this._processUnderline(0,ie)):25===X?ie.fg&=-536870913:27===X?ie.fg&=-67108865:28===X?ie.fg&=-1073741825:29===X?ie.fg&=2147483647:39===X?(ie.fg&=-67108864,ie.fg|=16777215&ve.DEFAULT_ATTR_DATA.fg):49===X?(ie.bg&=-67108864,ie.bg|=16777215&ve.DEFAULT_ATTR_DATA.bg):38===X||48===X||58===X?se+=this._extractColor(N,se,ie):53===X?ie.bg|=1073741824:55===X?ie.bg&=-1073741825:59===X?(ie.extended=ie.extended.clone(),ie.extended.underlineColor=-1,ie.updateExtended()):100===X?(ie.fg&=-67108864,ie.fg|=16777215&ve.DEFAULT_ATTR_DATA.fg,ie.bg&=-67108864,ie.bg|=16777215&ve.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",X);return!0}deviceStatus(N){switch(N.params[0]){case 5:this._coreService.triggerDataEvent(`${le.C0.ESC}[0n`);break;case 6:const N=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.C0.ESC}[${N};${j}R`)}return!0}deviceStatusPrivate(N){if(6===N.params[0]){const N=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.C0.ESC}[?${N};${j}R`)}return!0}softReset(N){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ve.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(N){const j=N.params[0]||1;switch(j){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 X=j%2==1;return this._optionsService.options.cursorBlink=X,!0}setScrollRegion(N){const j=N.params[0]||1;let X;return(N.length<2||(X=N.params[1])>this._bufferService.rows||0===X)&&(X=this._bufferService.rows),X>j&&(this._activeBuffer.scrollTop=j-1,this._activeBuffer.scrollBottom=X-1,this._setCursor(0,0)),!0}windowOptions(N){if(!y(N.params[0],this._optionsService.rawOptions.windowOptions))return!0;const j=N.length>1?N.params[1]:0;switch(N.params[0]){case 14:2!==j&&this._onRequestWindowsOptionsReport.fire(ke.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(ke.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${le.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==j&&2!==j||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==j&&1!==j||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==j&&2!==j||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==j&&1!==j||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(N){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(N){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(N){return this._windowTitle=N,this._onTitleChange.fire(N),!0}setIconName(N){return this._iconName=N,!0}setOrReportIndexedColor(N){const j=[],X=N.split(";");for(;X.length>1;){const N=X.shift(),ie=X.shift();if(/^\d+$/.exec(N)){const X=parseInt(N);if(A(X))if("?"===ie)j.push({type:0,index:X});else{const N=(0,Le.parseColor)(ie);N&&j.push({type:1,index:X,color:N})}}}return j.length&&this._onColor.fire(j),!0}setHyperlink(N){const j=N.indexOf(";");if(-1===j)return!0;const X=N.slice(0,j).trim(),ie=N.slice(j+1);return ie?this._createHyperlink(X,ie):!X.trim()&&this._finishHyperlink()}_createHyperlink(N,j){this._getCurrentLinkId()&&this._finishHyperlink();const X=N.split(":");let ie;const se=X.findIndex((N=>N.startsWith("id=")));return-1!==se&&(ie=X[se].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:ie,uri:j}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(N,j){const X=N.split(";");for(let N=0;N=this._specialColors.length);++N,++j)if("?"===X[N])this._onColor.fire([{type:0,index:this._specialColors[j]}]);else{const ie=(0,Le.parseColor)(X[N]);ie&&this._onColor.fire([{type:1,index:this._specialColors[j],color:ie}])}return!0}setOrReportFgColor(N){return this._setOrReportSpecialColor(N,0)}setOrReportBgColor(N){return this._setOrReportSpecialColor(N,1)}setOrReportCursorColor(N){return this._setOrReportSpecialColor(N,2)}restoreIndexedColor(N){if(!N)return this._onColor.fire([{type:2}]),!0;const j=[],X=N.split(";");for(let N=0;N=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 N=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,N,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=ve.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=ve.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(N){return this._charsetService.setgLevel(N),!0}screenAlignmentPattern(){const N=new be.CellData;N.content=1<<22|"E".charCodeAt(0),N.fg=this._curAttrData.fg,N.bg=this._curAttrData.bg,this._setCursor(0,0);for(let j=0;j(this._coreService.triggerDataEvent(`${le.C0.ESC}${N}${le.C0.ESC}\\`),!0))('"q'===N?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===N?'P1$r61;1"p':"r"===N?`P1$r${X.scrollTop+1};${X.scrollBottom+1}r`:"m"===N?"P1$r0m":" q"===N?`P1$r${{block:2,underline:4,bar:6}[ie.cursorStyle]-(ie.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(N,j){this._dirtyRowTracker.markRangeDirty(N,j)}}j.InputHandler=D;let Oe=class{constructor(N){this._bufferService=N,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(N){Nthis.end&&(this.end=N)}markRangeDirty(N,j){N>j&&(Me=N,N=j,j=Me),Nthis.end&&(this.end=j)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function A(N){return 0<=N&&N<256}Oe=ie([se(0,ye.IBufferService)],Oe)},7710:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.FourKeyMap=j.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(N,j,X){this._data[N]||(this._data[N]={}),this._data[N][j]=X}get(N,j){return this._data[N]?this._data[N][j]:void 0}clear(){this._data={}}}j.TwoKeyMap=i,j.FourKeyMap=class{constructor(){this._data=new i}set(N,j,X,ie,se){this._data.get(N,j)||this._data.set(N,j,new i),this._data.get(N,j).set(X,ie,se)}get(N,j,X,ie){return this._data.get(N,j)?.get(X,ie)}clear(){this._data.clear()}}},701:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.isChromeOS=j.isLinux=j.isWindows=j.isIphone=j.isIpad=j.isMac=j.isSafari=j.isLegacyEdge=j.isFirefox=j.isNode=void 0,j.getSafariVersion=function(){if(!j.isSafari)return 0;const N=X.match(/Version\/(\d+)/);return null===N||N.length<2?0:parseInt(N[1])},j.isNode="undefined"!=typeof process&&"title"in process;const X=j.isNode?"node":navigator.userAgent,ie=j.isNode?"node":navigator.platform;j.isFirefox=X.includes("Firefox"),j.isLegacyEdge=X.includes("Edge"),j.isSafari=/^((?!chrome|android).)*safari/i.test(X),j.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ie),j.isIpad="iPad"===ie,j.isIphone="iPhone"===ie,j.isWindows=["Windows","Win16","Win32","WinCE"].includes(ie),j.isLinux=ie.indexOf("Linux")>=0,j.isChromeOS=/\bCrOS\b/.test(X)},3087:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.SortedList=void 0;const ie=X(6168);let se=0;j.SortedList=class{constructor(N){this._getKey=N,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ie.IdleTaskQueue,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ie.IdleTaskQueue,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(N){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue((()=>this._flushInserted())),this._insertedValues.push(N)}_flushInserted(){const N=this._insertedValues.sort(((N,j)=>this._getKey(N)-this._getKey(j)));let j=0,X=0;const ie=new Array(this._array.length+this._insertedValues.length);for(let se=0;se=this._array.length||this._getKey(N[j])<=this._getKey(this._array[X])?(ie[se]=N[j],j++):ie[se]=this._array[X++];this._array=ie,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(N){if(this._flushCleanupInserted(),0===this._array.length)return!1;const j=this._getKey(N);if(void 0===j)return!1;if(se=this._search(j),-1===se)return!1;if(this._getKey(this._array[se])!==j)return!1;do{if(this._array[se]===N)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue((()=>this._flushDeleted())),this._deletedIndices.push(se),!0}while(++seN-j));let j=0;const X=new Array(this._array.length-N.length);let ie=0;for(let se=0;se0&&this._flushDeletedTask.flush()}*getKeyIterator(N){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(se=this._search(N),!(se<0||se>=this._array.length)&&this._getKey(this._array[se])===N))do{yield this._array[se]}while(++se=this._array.length)&&this._getKey(this._array[se])===N))do{j(this._array[se])}while(++se=j;){let ie=j+X>>1;const se=this._getKey(this._array[ie]);if(se>N)X=ie-1;else{if(!(se0&&this._getKey(this._array[ie-1])===N;)ie--;return ie}j=ie+1}}return j}}},6168:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.DebouncedIdleTask=j.IdleTaskQueue=j.PriorityTaskQueue=void 0;const ie=X(701);class r{constructor(){this._tasks=[],this._i=0}enqueue(N){this._tasks.push(N),this._start()}flush(){for(;this._ise)return ie-j<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(ie-j))}ms`),void this._start();ie=se}this.clear()}}class n extends r{_requestCallback(N){return setTimeout((()=>N(this._createDeadline(16))))}_cancelCallback(N){clearTimeout(N)}_createDeadline(N){const j=Date.now()+N;return{timeRemaining:()=>Math.max(0,j-Date.now())}}}j.PriorityTaskQueue=n,j.IdleTaskQueue=!ie.isNode&&"requestIdleCallback"in window?class extends r{_requestCallback(N){return requestIdleCallback(N)}_cancelCallback(N){cancelIdleCallback(N)}}:n,j.DebouncedIdleTask=class{constructor(){this._queue=new j.IdleTaskQueue}set(N){this._queue.clear(),this._queue.enqueue(N)}flush(){this._queue.flush()}}},5882:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.updateWindowsModeWrappedState=function(N){const j=N.buffer.lines.get(N.buffer.ybase+N.buffer.y-1),X=j?.get(N.cols-1),se=N.buffer.lines.get(N.buffer.ybase+N.buffer.y);se&&X&&(se.isWrapped=X[ie.CHAR_DATA_CODE_INDEX]!==ie.NULL_CELL_CODE&&X[ie.CHAR_DATA_CODE_INDEX]!==ie.WHITESPACE_CELL_CODE)};const ie=X(8938)},5451:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ExtendedAttrs=j.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new s}static toColorRGB(N){return[N>>>16&255,N>>>8&255,255&N]}static fromColorRGB(N){return(255&N[0])<<16|(255&N[1])<<8|255&N[2]}clone(){const N=new i;return N.fg=this.fg,N.bg=this.bg,N.extended=this.extended.clone(),N}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?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)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}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):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}j.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(N){this._ext=N}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(N){this._ext&=-469762049,this._ext|=N<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(N){this._ext&=-67108864,this._ext|=67108863&N}get urlId(){return this._urlId}set urlId(N){this._urlId=N}get underlineVariantOffset(){const N=(3758096384&this._ext)>>29;return N<0?4294967288^N:N}set underlineVariantOffset(N){this._ext&=536870911,this._ext|=N<<29&3758096384}constructor(N=0,j=0){this._ext=0,this._urlId=0,this._ext=N,this._urlId=j}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}j.ExtendedAttrs=s},1073:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.Buffer=j.MAX_BUFFER_SIZE=void 0;const ie=X(5639),se=X(6168),le=X(5451),he=X(6107),ce=X(732),_e=X(3055),me=X(8938),ve=X(8158),Se=X(6760);j.MAX_BUFFER_SIZE=4294967295,j.Buffer=class{constructor(N,j,X){this._hasScrollback=N,this._optionsService=j,this._bufferService=X,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=he.DEFAULT_ATTR_DATA.clone(),this.savedCharset=Se.DEFAULT_CHARSET,this.markers=[],this._nullCell=_e.CellData.fromCharData([0,me.NULL_CELL_CHAR,me.NULL_CELL_WIDTH,me.NULL_CELL_CODE]),this._whitespaceCell=_e.CellData.fromCharData([0,me.WHITESPACE_CELL_CHAR,me.WHITESPACE_CELL_WIDTH,me.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new se.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new ie.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(N){return N?(this._nullCell.fg=N.fg,this._nullCell.bg=N.bg,this._nullCell.extended=N.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new le.ExtendedAttrs),this._nullCell}getWhitespaceCell(N){return N?(this._whitespaceCell.fg=N.fg,this._whitespaceCell.bg=N.bg,this._whitespaceCell.extended=N.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new le.ExtendedAttrs),this._whitespaceCell}getBlankLine(N,j){return new he.BufferLine(this._bufferService.cols,this.getNullCell(N),j)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const N=this.ybase+this.y-this.ydisp;return N>=0&&Nj.MAX_BUFFER_SIZE?j.MAX_BUFFER_SIZE:X}fillViewportRows(N){if(0===this.lines.length){void 0===N&&(N=he.DEFAULT_ATTR_DATA);let j=this._rows;for(;j--;)this.lines.push(this.getBlankLine(N))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new ie.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(N,j){const X=this.getNullCell(he.DEFAULT_ATTR_DATA);let ie=0;const se=this._getCorrectBufferLength(j);if(se>this.lines.maxLength&&(this.lines.maxLength=se),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+le+1?(this.ybase--,le++,this.ydisp>0&&this.ydisp--):this.lines.push(new he.BufferLine(N,X)));else for(let N=this._rows;N>j;N--)this.lines.length>j+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(se0&&(this.lines.trimStart(N),this.ybase=Math.max(this.ybase-N,0),this.ydisp=Math.max(this.ydisp-N,0),this.savedY=Math.max(this.savedY-N,0)),this.lines.maxLength=se}this.x=Math.min(this.x,N-1),this.y=Math.min(this.y,j-1),le&&(this.y+=le),this.savedX=Math.min(this.savedX,N-1),this.scrollTop=0}if(this.scrollBottom=j-1,this._isReflowEnabled&&(this._reflow(N,j),this._cols>N))for(let j=0;j.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let N=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,N=!1);let j=0;for(;this._memoryCleanupPosition100)return!0;return N}get _isReflowEnabled(){const N=this._optionsService.rawOptions.windowsPty;return N&&N.buildNumber?this._hasScrollback&&"conpty"===N.backend&&N.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(N,j){this._cols!==N&&(N>this._cols?this._reflowLarger(N,j):this._reflowSmaller(N,j))}_reflowLarger(N,j){const X=(0,ce.reflowLargerGetLinesToRemove)(this.lines,this._cols,N,this.ybase+this.y,this.getNullCell(he.DEFAULT_ATTR_DATA));if(X.length>0){const ie=(0,ce.reflowLargerCreateNewLayout)(this.lines,X);(0,ce.reflowLargerApplyNewLayout)(this.lines,ie.layout),this._reflowLargerAdjustViewport(N,j,ie.countRemoved)}}_reflowLargerAdjustViewport(N,j,X){const ie=this.getNullCell(he.DEFAULT_ATTR_DATA);let se=X;for(;se-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;le--){let _e=this.lines.get(le);if(!_e||!_e.isWrapped&&_e.getTrimmedLength()<=N)continue;const me=[_e];for(;_e.isWrapped&&le>0;)_e=this.lines.get(--le),me.unshift(_e);const ve=this.ybase+this.y;if(ve>=le&&ve0&&(ie.push({start:le+me.length+se,newLines:we}),se+=we.length),me.push(...we);let Ee=be.length-1,De=be[Ee];0===De&&(Ee--,De=be[Ee]);let Le=me.length-Ce-1,Ae=Se;for(;Le>=0;){const N=Math.min(Ae,De);if(void 0===me[Ee])break;if(me[Ee].copyCellsFrom(me[Le],Ae-N,De-N,N,!0),De-=N,0===De&&(Ee--,De=be[Ee]),Ae-=N,0===Ae){Le--;const N=Math.max(Le,0);Ae=(0,ce.getWrappedLineTrimmedLength)(me,N,this._cols)}}for(let j=0;j0;)0===this.ybase?this.y0){const N=[],j=[];for(let N=0;N=0;me--)if(ce&&ce.start>le+_e){for(let N=ce.newLines.length-1;N>=0;N--)this.lines.set(me--,ce.newLines[N]);me++,N.push({index:le+1,amount:ce.newLines.length}),_e+=ce.newLines.length,ce=ie[++he]}else this.lines.set(me,j[le--]);let me=0;for(let j=N.length-1;j>=0;j--)N[j].index+=me,this.lines.onInsertEmitter.fire(N[j]),me+=N[j].amount;const ve=Math.max(0,X+se-this.lines.maxLength);ve>0&&this.lines.onTrimEmitter.fire(ve)}}translateBufferLineToString(N,j,X=0,ie){const se=this.lines.get(N);return se?se.translateToString(j,X,ie):""}getWrappedRangeForLine(N){let j=N,X=N;for(;j>0&&this.lines.get(j).isWrapped;)j--;for(;X+10;);return N>=this._cols?this._cols-1:N<0?0:N}nextStop(N){for(null==N&&(N=this.x);!this.tabs[++N]&&N=this._cols?this._cols-1:N<0?0:N}clearMarkers(N){this._isClearing=!0;for(let j=0;j{j.line-=N,j.line<0&&j.dispose()}))),j.register(this.lines.onInsert((N=>{j.line>=N.index&&(j.line+=N.amount)}))),j.register(this.lines.onDelete((N=>{j.line>=N.index&&j.lineN.index&&(j.line-=N.amount)}))),j.register(j.onDispose((()=>this._removeMarker(j)))),j}_removeMarker(N){this._isClearing||this.markers.splice(this.markers.indexOf(N),1)}}},6107:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.BufferLine=j.DEFAULT_ATTR_DATA=void 0;const ie=X(5451),se=X(3055),le=X(8938),he=X(726);j.DEFAULT_ATTR_DATA=Object.freeze(new ie.AttributeData);let ce=0;class l{constructor(N,j,X=!1){this.isWrapped=X,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*N);const ie=j||se.CellData.fromCharData([0,le.NULL_CELL_CHAR,le.NULL_CELL_WIDTH,le.NULL_CELL_CODE]);for(let j=0;j>22,2097152&j?this._combined[N].charCodeAt(this._combined[N].length-1):X]}set(N,j){this._data[3*N+1]=j[le.CHAR_DATA_ATTR_INDEX],j[le.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[N]=j[1],this._data[3*N+0]=2097152|N|j[le.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*N+0]=j[le.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|j[le.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(N){return this._data[3*N+0]>>22}hasWidth(N){return 12582912&this._data[3*N+0]}getFg(N){return this._data[3*N+1]}getBg(N){return this._data[3*N+2]}hasContent(N){return 4194303&this._data[3*N+0]}getCodePoint(N){const j=this._data[3*N+0];return 2097152&j?this._combined[N].charCodeAt(this._combined[N].length-1):2097151&j}isCombined(N){return 2097152&this._data[3*N+0]}getString(N){const j=this._data[3*N+0];return 2097152&j?this._combined[N]:2097151&j?(0,he.stringFromCodePoint)(2097151&j):""}isProtected(N){return 536870912&this._data[3*N+2]}loadCell(N,j){return ce=3*N,j.content=this._data[ce+0],j.fg=this._data[ce+1],j.bg=this._data[ce+2],2097152&j.content&&(j.combinedData=this._combined[N]),268435456&j.bg&&(j.extended=this._extendedAttrs[N]),j}setCell(N,j){2097152&j.content&&(this._combined[N]=j.combinedData),268435456&j.bg&&(this._extendedAttrs[N]=j.extended),this._data[3*N+0]=j.content,this._data[3*N+1]=j.fg,this._data[3*N+2]=j.bg}setCellFromCodepoint(N,j,X,ie){268435456&ie.bg&&(this._extendedAttrs[N]=ie.extended),this._data[3*N+0]=j|X<<22,this._data[3*N+1]=ie.fg,this._data[3*N+2]=ie.bg}addCodepointToCell(N,j,X){let ie=this._data[3*N+0];2097152&ie?this._combined[N]+=(0,he.stringFromCodePoint)(j):2097151&ie?(this._combined[N]=(0,he.stringFromCodePoint)(2097151&ie)+(0,he.stringFromCodePoint)(j),ie&=-2097152,ie|=2097152):ie=j|1<<22,X&&(ie&=-12582913,ie|=X<<22),this._data[3*N+0]=ie}insertCells(N,j,X){if((N%=this.length)&&2===this.getWidth(N-1)&&this.setCellFromCodepoint(N-1,0,1,X),j=0;--X)this.setCell(N+j+X,this.loadCell(N+X,ie));for(let ie=0;iethis.length){if(this._data.buffer.byteLength>=4*X)this._data=new Uint32Array(this._data.buffer,0,X);else{const N=new Uint32Array(X);N.set(this._data),this._data=N}for(let X=this.length;X=N&&delete this._combined[ie]}const ie=Object.keys(this._extendedAttrs);for(let j=0;j=N&&delete this._extendedAttrs[X]}}return this.length=N,4*X*2=0;--N)if(4194303&this._data[3*N+0])return N+(this._data[3*N+0]>>22);return 0}getNoBgTrimmedLength(){for(let N=this.length-1;N>=0;--N)if(4194303&this._data[3*N+0]||50331648&this._data[3*N+2])return N+(this._data[3*N+0]>>22);return 0}copyCellsFrom(N,j,X,ie,se){const le=N._data;if(se)for(let se=ie-1;se>=0;se--){for(let N=0;N<3;N++)this._data[3*(X+se)+N]=le[3*(j+se)+N];268435456&le[3*(j+se)+2]&&(this._extendedAttrs[X+se]=N._extendedAttrs[j+se])}else for(let se=0;se=j&&(this._combined[se-j+X]=N._combined[se])}}translateToString(N,j,X,ie){j=j??0,X=X??this.length,N&&(X=Math.min(X,this.getTrimmedLength())),ie&&(ie.length=0);let se="";for(;j>22||1}return ie&&ie.push(j),se}}j.BufferLine=l},9384:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.getRangeLength=function(N,j){if(N.start.y>N.end.y)throw new Error(`Buffer range end (${N.end.x}, ${N.end.y}) cannot be before start (${N.start.x}, ${N.start.y})`);return j*(N.end.y-N.start.y)+(N.end.x-N.start.x+1)}},732:(N,j)=>{function i(N,j,X){if(j===N.length-1)return N[j].getTrimmedLength();const ie=!N[j].hasContent(X-1)&&1===N[j].getWidth(X-1),se=2===N[j+1].getWidth(0);return ie&&se?X-1:X}Object.defineProperty(j,"__esModule",{value:!0}),j.reflowLargerGetLinesToRemove=function(N,j,X,ie,se){const le=[];for(let he=0;he=he&&ie0&&(N>ve||0===me[N].getTrimmedLength());N--)ye++;ye>0&&(le.push(he+me.length-ye),le.push(ye)),he+=me.length-1}return le},j.reflowLargerCreateNewLayout=function(N,j){const X=[];let ie=0,se=j[ie],le=0;for(let he=0;hei(N,ie,j))).reduce(((N,j)=>N+j));let le=0,he=0,ce=0;for(;ce_e&&(le-=_e,he++);const me=2===N[he].getWidth(le-1);me&&le--;const ve=me?X-1:X;ie.push(ve),ce+=ve}return ie},j.getWrappedLineTrimmedLength=i},4097:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.BufferSet=void 0;const ie=X(7150),se=X(1073),le=X(802);class o extends ie.Disposable{constructor(N,j){super(),this._optionsService=N,this._bufferService=j,this._onBufferActivate=this._register(new le.Emitter),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 se.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new se.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(N){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(N),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(N,j){this._normal.resize(N,j),this._alt.resize(N,j),this.setupTabStops(N)}setupTabStops(N){this._normal.setupTabStops(N),this._alt.setupTabStops(N)}}j.BufferSet=o},3055:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.CellData=void 0;const ie=X(726),se=X(8938),le=X(5451);class o extends le.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new le.ExtendedAttrs,this.combinedData=""}static fromCharData(N){const j=new o;return j.setFromCharData(N),j}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,ie.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(N){this.fg=N[se.CHAR_DATA_ATTR_INDEX],this.bg=0;let j=!1;if(N[se.CHAR_DATA_CHAR_INDEX].length>2)j=!0;else if(2===N[se.CHAR_DATA_CHAR_INDEX].length){const X=N[se.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=X&&X<=56319){const ie=N[se.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=ie&&ie<=57343?this.content=1024*(X-55296)+ie-56320+65536|N[se.CHAR_DATA_WIDTH_INDEX]<<22:j=!0}else j=!0}else this.content=N[se.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|N[se.CHAR_DATA_WIDTH_INDEX]<<22;j&&(this.combinedData=N[se.CHAR_DATA_CHAR_INDEX],this.content=2097152|N[se.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}j.CellData=o},8938:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.WHITESPACE_CELL_CODE=j.WHITESPACE_CELL_WIDTH=j.WHITESPACE_CELL_CHAR=j.NULL_CELL_CODE=j.NULL_CELL_WIDTH=j.NULL_CELL_CHAR=j.CHAR_DATA_CODE_INDEX=j.CHAR_DATA_WIDTH_INDEX=j.CHAR_DATA_CHAR_INDEX=j.CHAR_DATA_ATTR_INDEX=j.DEFAULT_EXT=j.DEFAULT_ATTR=j.DEFAULT_COLOR=void 0,j.DEFAULT_COLOR=0,j.DEFAULT_ATTR=j.DEFAULT_COLOR<<9|256,j.DEFAULT_EXT=0,j.CHAR_DATA_ATTR_INDEX=0,j.CHAR_DATA_CHAR_INDEX=1,j.CHAR_DATA_WIDTH_INDEX=2,j.CHAR_DATA_CODE_INDEX=3,j.NULL_CELL_CHAR="",j.NULL_CELL_WIDTH=1,j.NULL_CELL_CODE=0,j.WHITESPACE_CELL_CHAR=" ",j.WHITESPACE_CELL_WIDTH=1,j.WHITESPACE_CELL_CODE=32},8158:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.Marker=void 0;const ie=X(802),se=X(7150);class n{get id(){return this._id}constructor(N){this.line=N,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new ie.Emitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,se.dispose)(this._disposables),this._disposables.length=0)}register(N){return this._disposables.push(N),N}}j.Marker=n,n._nextId=1},6760:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.DEFAULT_CHARSET=j.CHARSETS=void 0,j.CHARSETS={},j.DEFAULT_CHARSET=j.CHARSETS.B,j.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:"≥","{":"π","|":"≠","}":"£","~":"·"},j.CHARSETS.A={"#":"£"},j.CHARSETS.B=void 0,j.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},j.CHARSETS.C=j.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},j.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},j.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},j.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},j.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},j.CHARSETS.E=j.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},j.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},j.CHARSETS.H=j.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},j.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},3534:(N,j)=>{var X,ie,se;Object.defineProperty(j,"__esModule",{value:!0}),j.C1_ESCAPED=j.C1=j.C0=void 0,function(N){N.NUL="\0",N.SOH="",N.STX="",N.ETX="",N.EOT="",N.ENQ="",N.ACK="",N.BEL="",N.BS="\b",N.HT="\t",N.LF="\n",N.VT="\v",N.FF="\f",N.CR="\r",N.SO="",N.SI="",N.DLE="",N.DC1="",N.DC2="",N.DC3="",N.DC4="",N.NAK="",N.SYN="",N.ETB="",N.CAN="",N.EM="",N.SUB="",N.ESC="",N.FS="",N.GS="",N.RS="",N.US="",N.SP=" ",N.DEL=""}(X||(j.C0=X={})),function(N){N.PAD="€",N.HOP="",N.BPH="‚",N.NBH="ƒ",N.IND="„",N.NEL="…",N.SSA="†",N.ESA="‡",N.HTS="ˆ",N.HTJ="‰",N.VTS="Š",N.PLD="‹",N.PLU="Œ",N.RI="",N.SS2="Ž",N.SS3="",N.DCS="",N.PU1="‘",N.PU2="’",N.STS="“",N.CCH="”",N.MW="•",N.SPA="–",N.EPA="—",N.SOS="˜",N.SGCI="™",N.SCI="š",N.CSI="›",N.ST="œ",N.OSC="",N.PM="ž",N.APC="Ÿ"}(ie||(j.C1=ie={})),function(N){N.ST=`${X.ESC}\\`}(se||(j.C1_ESCAPED=se={}))},706:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.evaluateKeyboardEvent=function(N,j,X,le){const he={type:0,cancel:!1,key:void 0},ce=(N.shiftKey?1:0)|(N.altKey?2:0)|(N.ctrlKey?4:0)|(N.metaKey?8:0);switch(N.keyCode){case 0:"UIKeyInputUpArrow"===N.key?he.key=j?ie.C0.ESC+"OA":ie.C0.ESC+"[A":"UIKeyInputLeftArrow"===N.key?he.key=j?ie.C0.ESC+"OD":ie.C0.ESC+"[D":"UIKeyInputRightArrow"===N.key?he.key=j?ie.C0.ESC+"OC":ie.C0.ESC+"[C":"UIKeyInputDownArrow"===N.key&&(he.key=j?ie.C0.ESC+"OB":ie.C0.ESC+"[B");break;case 8:he.key=N.ctrlKey?"\b":ie.C0.DEL,N.altKey&&(he.key=ie.C0.ESC+he.key);break;case 9:if(N.shiftKey){he.key=ie.C0.ESC+"[Z";break}he.key=ie.C0.HT,he.cancel=!0;break;case 13:he.key=N.altKey?ie.C0.ESC+ie.C0.CR:ie.C0.CR,he.cancel=!0;break;case 27:he.key=ie.C0.ESC,N.altKey&&(he.key=ie.C0.ESC+ie.C0.ESC),he.cancel=!0;break;case 37:if(N.metaKey)break;ce?(he.key=ie.C0.ESC+"[1;"+(ce+1)+"D",he.key===ie.C0.ESC+"[1;3D"&&(he.key=ie.C0.ESC+(X?"b":"[1;5D"))):he.key=j?ie.C0.ESC+"OD":ie.C0.ESC+"[D";break;case 39:if(N.metaKey)break;ce?(he.key=ie.C0.ESC+"[1;"+(ce+1)+"C",he.key===ie.C0.ESC+"[1;3C"&&(he.key=ie.C0.ESC+(X?"f":"[1;5C"))):he.key=j?ie.C0.ESC+"OC":ie.C0.ESC+"[C";break;case 38:if(N.metaKey)break;ce?(he.key=ie.C0.ESC+"[1;"+(ce+1)+"A",X||he.key!==ie.C0.ESC+"[1;3A"||(he.key=ie.C0.ESC+"[1;5A")):he.key=j?ie.C0.ESC+"OA":ie.C0.ESC+"[A";break;case 40:if(N.metaKey)break;ce?(he.key=ie.C0.ESC+"[1;"+(ce+1)+"B",X||he.key!==ie.C0.ESC+"[1;3B"||(he.key=ie.C0.ESC+"[1;5B")):he.key=j?ie.C0.ESC+"OB":ie.C0.ESC+"[B";break;case 45:N.shiftKey||N.ctrlKey||(he.key=ie.C0.ESC+"[2~");break;case 46:he.key=ce?ie.C0.ESC+"[3;"+(ce+1)+"~":ie.C0.ESC+"[3~";break;case 36:he.key=ce?ie.C0.ESC+"[1;"+(ce+1)+"H":j?ie.C0.ESC+"OH":ie.C0.ESC+"[H";break;case 35:he.key=ce?ie.C0.ESC+"[1;"+(ce+1)+"F":j?ie.C0.ESC+"OF":ie.C0.ESC+"[F";break;case 33:N.shiftKey?he.type=2:N.ctrlKey?he.key=ie.C0.ESC+"[5;"+(ce+1)+"~":he.key=ie.C0.ESC+"[5~";break;case 34:N.shiftKey?he.type=3:N.ctrlKey?he.key=ie.C0.ESC+"[6;"+(ce+1)+"~":he.key=ie.C0.ESC+"[6~";break;case 112:he.key=ce?ie.C0.ESC+"[1;"+(ce+1)+"P":ie.C0.ESC+"OP";break;case 113:he.key=ce?ie.C0.ESC+"[1;"+(ce+1)+"Q":ie.C0.ESC+"OQ";break;case 114:he.key=ce?ie.C0.ESC+"[1;"+(ce+1)+"R":ie.C0.ESC+"OR";break;case 115:he.key=ce?ie.C0.ESC+"[1;"+(ce+1)+"S":ie.C0.ESC+"OS";break;case 116:he.key=ce?ie.C0.ESC+"[15;"+(ce+1)+"~":ie.C0.ESC+"[15~";break;case 117:he.key=ce?ie.C0.ESC+"[17;"+(ce+1)+"~":ie.C0.ESC+"[17~";break;case 118:he.key=ce?ie.C0.ESC+"[18;"+(ce+1)+"~":ie.C0.ESC+"[18~";break;case 119:he.key=ce?ie.C0.ESC+"[19;"+(ce+1)+"~":ie.C0.ESC+"[19~";break;case 120:he.key=ce?ie.C0.ESC+"[20;"+(ce+1)+"~":ie.C0.ESC+"[20~";break;case 121:he.key=ce?ie.C0.ESC+"[21;"+(ce+1)+"~":ie.C0.ESC+"[21~";break;case 122:he.key=ce?ie.C0.ESC+"[23;"+(ce+1)+"~":ie.C0.ESC+"[23~";break;case 123:he.key=ce?ie.C0.ESC+"[24;"+(ce+1)+"~":ie.C0.ESC+"[24~";break;default:if(!N.ctrlKey||N.shiftKey||N.altKey||N.metaKey)if(X&&!le||!N.altKey||N.metaKey)!X||N.altKey||N.ctrlKey||N.shiftKey||!N.metaKey?N.key&&!N.ctrlKey&&!N.altKey&&!N.metaKey&&N.keyCode>=48&&1===N.key.length?he.key=N.key:N.key&&N.ctrlKey&&("_"===N.key&&(he.key=ie.C0.US),"@"===N.key&&(he.key=ie.C0.NUL)):65===N.keyCode&&(he.type=1);else{const j=se[N.keyCode],X=j?.[N.shiftKey?1:0];if(X)he.key=ie.C0.ESC+X;else if(N.keyCode>=65&&N.keyCode<=90){const j=N.ctrlKey?N.keyCode-64:N.keyCode+32;let X=String.fromCharCode(j);N.shiftKey&&(X=X.toUpperCase()),he.key=ie.C0.ESC+X}else if(32===N.keyCode)he.key=ie.C0.ESC+(N.ctrlKey?ie.C0.NUL:" ");else if("Dead"===N.key&&N.code.startsWith("Key")){let j=N.code.slice(3,4);N.shiftKey||(j=j.toLowerCase()),he.key=ie.C0.ESC+j,he.cancel=!0}}else N.keyCode>=65&&N.keyCode<=90?he.key=String.fromCharCode(N.keyCode-64):32===N.keyCode?he.key=ie.C0.NUL:N.keyCode>=51&&N.keyCode<=55?he.key=String.fromCharCode(N.keyCode-51+27):56===N.keyCode?he.key=ie.C0.DEL:219===N.keyCode?he.key=ie.C0.ESC:220===N.keyCode?he.key=ie.C0.FS:221===N.keyCode&&(he.key=ie.C0.GS)}return he};const ie=X(3534),se={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:["'",'"']}},726:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.Utf8ToUtf32=j.StringToUtf32=void 0,j.stringFromCodePoint=function(N){return N>65535?(N-=65536,String.fromCharCode(55296+(N>>10))+String.fromCharCode(N%1024+56320)):String.fromCharCode(N)},j.utf32ToString=function(N,j=0,X=N.length){let ie="";for(let se=j;se65535?(j-=65536,ie+=String.fromCharCode(55296+(j>>10))+String.fromCharCode(j%1024+56320)):ie+=String.fromCharCode(j)}return ie},j.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(N,j){const X=N.length;if(!X)return 0;let ie=0,se=0;if(this._interim){const X=N.charCodeAt(se++);56320<=X&&X<=57343?j[ie++]=1024*(this._interim-55296)+X-56320+65536:(j[ie++]=this._interim,j[ie++]=X),this._interim=0}for(let le=se;le=X)return this._interim=se,ie;const he=N.charCodeAt(le);56320<=he&&he<=57343?j[ie++]=1024*(se-55296)+he-56320+65536:(j[ie++]=se,j[ie++]=he)}else 65279!==se&&(j[ie++]=se)}return ie}},j.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(N,j){const X=N.length;if(!X)return 0;let ie,se,le,he,ce=0,_e=0,me=0;if(this.interim[0]){let ie=!1,se=this.interim[0];se&=192==(224&se)?31:224==(240&se)?15:7;let le,he=0;for(;(le=63&this.interim[++he])&&he<4;)se<<=6,se|=le;const _e=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,ve=_e-he;for(;me=X)return 0;if(le=N[me++],128!=(192&le)){me--,ie=!0;break}this.interim[he++]=le,se<<=6,se|=63&le}ie||(2===_e?se<128?me--:j[ce++]=se:3===_e?se<2048||se>=55296&&se<=57343||65279===se||(j[ce++]=se):se<65536||se>1114111||(j[ce++]=se)),this.interim.fill(0)}const ve=X-4;let Se=me;for(;Se=X)return this.interim[0]=ie,ce;if(se=N[Se++],128!=(192&se)){Se--;continue}if(_e=(31&ie)<<6|63&se,_e<128){Se--;continue}j[ce++]=_e}else if(224==(240&ie)){if(Se>=X)return this.interim[0]=ie,ce;if(se=N[Se++],128!=(192&se)){Se--;continue}if(Se>=X)return this.interim[0]=ie,this.interim[1]=se,ce;if(le=N[Se++],128!=(192&le)){Se--;continue}if(_e=(15&ie)<<12|(63&se)<<6|63&le,_e<2048||_e>=55296&&_e<=57343||65279===_e)continue;j[ce++]=_e}else if(240==(248&ie)){if(Se>=X)return this.interim[0]=ie,ce;if(se=N[Se++],128!=(192&se)){Se--;continue}if(Se>=X)return this.interim[0]=ie,this.interim[1]=se,ce;if(le=N[Se++],128!=(192&le)){Se--;continue}if(Se>=X)return this.interim[0]=ie,this.interim[1]=se,this.interim[2]=le,ce;if(he=N[Se++],128!=(192&he)){Se--;continue}if(_e=(7&ie)<<18|(63&se)<<12|(63&le)<<6|63&he,_e<65536||_e>1114111)continue;j[ce++]=_e}}return ce}}},7428:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.UnicodeV6=void 0;const ie=X(6415),se=[[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]],le=[[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 he;j.UnicodeV6=class{constructor(){if(this.version="6",!he){he=new Uint8Array(65536),he.fill(1),he[0]=0,he.fill(0,1,32),he.fill(0,127,160),he.fill(2,4352,4448),he[9001]=2,he[9002]=2,he.fill(2,11904,42192),he[12351]=1,he.fill(2,44032,55204),he.fill(2,63744,64256),he.fill(2,65040,65050),he.fill(2,65072,65136),he.fill(2,65280,65377),he.fill(2,65504,65511);for(let N=0;Nj[se][1])return!1;for(;se>=ie;)if(X=ie+se>>1,N>j[X][1])ie=X+1;else{if(!(N=131072&&N<=196605||N>=196608&&N<=262141?2:1}charProperties(N,j){let X=this.wcwidth(N),se=0===X&&0!==j;if(se){const N=ie.UnicodeService.extractWidth(j);0===N?se=!1:N>X&&(X=N)}return ie.UnicodeService.createPropertyValue(0,X,se)}}},3562:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.WriteBuffer=void 0;const ie=X(7150),se=X(802);class n extends ie.Disposable{constructor(N){super(),this._action=N,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new se.Emitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(N,j){if(void 0!==j&&this._syncCalls>j)return void(this._syncCalls=0);if(this._pendingData+=N.length,this._writeBuffer.push(N),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let X;for(this._isSyncWriting=!0;X=this._writeBuffer.shift();){this._action(X);const N=this._callbacks.shift();N&&N()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(N,j){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+=N.length,this._writeBuffer.push(N),this._callbacks.push(j),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=N.length,this._writeBuffer.push(N),this._callbacks.push(j)}_innerWrite(N=0,j=!0){const X=N||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const N=this._writeBuffer[this._bufferOffset],ie=this._action(N,j);if(ie){const e=N=>Date.now()-X>=12?setTimeout((()=>this._innerWrite(0,N))):this._innerWrite(X,N);return void ie.catch((N=>(queueMicrotask((()=>{throw N})),Promise.resolve(!1)))).then(e)}const se=this._callbacks[this._bufferOffset];if(se&&se(),this._bufferOffset++,this._pendingData-=N.length,Date.now()-X>=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()}}j.WriteBuffer=n},8693:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.parseColor=function(N){if(!N)return;let j=N.toLowerCase();if(0===j.indexOf("rgb:")){j=j.slice(4);const N=X.exec(j);if(N){const j=N[1]?15:N[4]?255:N[7]?4095:65535;return[Math.round(parseInt(N[1]||N[4]||N[7]||N[10],16)/j*255),Math.round(parseInt(N[2]||N[5]||N[8]||N[11],16)/j*255),Math.round(parseInt(N[3]||N[6]||N[9]||N[12],16)/j*255)]}}else if(0===j.indexOf("#")&&(j=j.slice(1),ie.exec(j)&&[3,6,9,12].includes(j.length))){const N=j.length/3,X=[0,0,0];for(let ie=0;ie<3;++ie){const se=parseInt(j.slice(N*ie,N*ie+N),16);X[ie]=1===N?se<<4:2===N?se:3===N?se>>4:se>>8}return X}},j.toRgbString=function(N,j=16){const[X,ie,se]=N;return`rgb:${r(X,j)}/${r(ie,j)}/${r(se,j)}`};const X=/^([\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})$/,ie=/^[\da-f]+$/;function r(N,j){const X=N.toString(16),ie=X.length<2?"0"+X:X;switch(j){case 4:return X[0];case 8:return ie;case 12:return(ie+ie).slice(0,3);default:return ie+ie}}},1263:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.PAYLOAD_LIMIT=void 0,j.PAYLOAD_LIMIT=1e7},9823:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.DcsHandler=j.DcsParser=void 0;const ie=X(726),se=X(7262),le=X(1263),he=[];j.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=he,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=he}registerHandler(N,j){void 0===this._handlers[N]&&(this._handlers[N]=[]);const X=this._handlers[N];return X.push(j),{dispose:()=>{const N=X.indexOf(j);-1!==N&&X.splice(N,1)}}}clearHandler(N){this._handlers[N]&&delete this._handlers[N]}setHandlerFallback(N){this._handlerFb=N}reset(){if(this._active.length)for(let N=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;N>=0;--N)this._active[N].unhook(!1);this._stack.paused=!1,this._active=he,this._ident=0}hook(N,j){if(this.reset(),this._ident=N,this._active=this._handlers[N]||he,this._active.length)for(let N=this._active.length-1;N>=0;N--)this._active[N].hook(j);else this._handlerFb(this._ident,"HOOK",j)}put(N,j,X){if(this._active.length)for(let ie=this._active.length-1;ie>=0;ie--)this._active[ie].put(N,j,X);else this._handlerFb(this._ident,"PUT",(0,ie.utf32ToString)(N,j,X))}unhook(N,j=!0){if(this._active.length){let X=!1,ie=this._active.length-1,se=!1;if(this._stack.paused&&(ie=this._stack.loopPosition-1,X=j,se=this._stack.fallThrough,this._stack.paused=!1),!se&&!1===X){for(;ie>=0&&(X=this._active[ie].unhook(N),!0!==X);ie--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=ie,this._stack.fallThrough=!1,X;ie--}for(;ie>=0;ie--)if(X=this._active[ie].unhook(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=ie,this._stack.fallThrough=!0,X}else this._handlerFb(this._ident,"UNHOOK",N);this._active=he,this._ident=0}};const ce=new se.Params;ce.addParam(0),j.DcsHandler=class{constructor(N){this._handler=N,this._data="",this._params=ce,this._hitLimit=!1}hook(N){this._params=N.length>1||N.params[0]?N.clone():ce,this._data="",this._hitLimit=!1}put(N,j,X){this._hitLimit||(this._data+=(0,ie.utf32ToString)(N,j,X),this._data.length>le.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(N){let j=!1;if(this._hitLimit)j=!1;else if(N&&(j=this._handler(this._data,this._params),j instanceof Promise))return j.then((N=>(this._params=ce,this._data="",this._hitLimit=!1,N)));return this._params=ce,this._data="",this._hitLimit=!1,j}}},6717:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.EscapeSequenceParser=j.VT500_TRANSITION_TABLE=j.TransitionTable=void 0;const ie=X(7150),se=X(7262),le=X(1346),he=X(9823);class a{constructor(N){this.table=new Uint8Array(N)}setDefault(N,j){this.table.fill(N<<4|j)}add(N,j,X,ie){this.table[j<<8|N]=X<<4|ie}addMany(N,j,X,ie){for(let se=0;sej)),i=(N,X)=>j.slice(N,X),X=i(32,127),ie=i(0,24);ie.push(25),ie.push.apply(ie,i(28,32));const se=i(0,14);let le;for(le in N.setDefault(1,0),N.addMany(X,0,2,0),se)N.addMany([24,26,153,154],le,3,0),N.addMany(i(128,144),le,3,0),N.addMany(i(144,152),le,3,0),N.add(156,le,0,0),N.add(27,le,11,1),N.add(157,le,4,8),N.addMany([152,158,159],le,0,7),N.add(155,le,11,3),N.add(144,le,11,9);return N.addMany(ie,0,3,0),N.addMany(ie,1,3,1),N.add(127,1,0,1),N.addMany(ie,8,0,8),N.addMany(ie,3,3,3),N.add(127,3,0,3),N.addMany(ie,4,3,4),N.add(127,4,0,4),N.addMany(ie,6,3,6),N.addMany(ie,5,3,5),N.add(127,5,0,5),N.addMany(ie,2,3,2),N.add(127,2,0,2),N.add(93,1,4,8),N.addMany(X,8,5,8),N.add(127,8,5,8),N.addMany([156,27,24,26,7],8,6,0),N.addMany(i(28,32),8,0,8),N.addMany([88,94,95],1,0,7),N.addMany(X,7,0,7),N.addMany(ie,7,0,7),N.add(156,7,0,0),N.add(127,7,0,7),N.add(91,1,11,3),N.addMany(i(64,127),3,7,0),N.addMany(i(48,60),3,8,4),N.addMany([60,61,62,63],3,9,4),N.addMany(i(48,60),4,8,4),N.addMany(i(64,127),4,7,0),N.addMany([60,61,62,63],4,0,6),N.addMany(i(32,64),6,0,6),N.add(127,6,0,6),N.addMany(i(64,127),6,0,0),N.addMany(i(32,48),3,9,5),N.addMany(i(32,48),5,9,5),N.addMany(i(48,64),5,0,6),N.addMany(i(64,127),5,7,0),N.addMany(i(32,48),4,9,5),N.addMany(i(32,48),1,9,2),N.addMany(i(32,48),2,9,2),N.addMany(i(48,127),2,10,0),N.addMany(i(48,80),1,10,0),N.addMany(i(81,88),1,10,0),N.addMany([89,90,92],1,10,0),N.addMany(i(96,127),1,10,0),N.add(80,1,11,9),N.addMany(ie,9,0,9),N.add(127,9,0,9),N.addMany(i(28,32),9,0,9),N.addMany(i(32,48),9,9,12),N.addMany(i(48,60),9,8,10),N.addMany([60,61,62,63],9,9,10),N.addMany(ie,11,0,11),N.addMany(i(32,128),11,0,11),N.addMany(i(28,32),11,0,11),N.addMany(ie,10,0,10),N.add(127,10,0,10),N.addMany(i(28,32),10,0,10),N.addMany(i(48,60),10,8,10),N.addMany([60,61,62,63],10,0,11),N.addMany(i(32,48),10,9,12),N.addMany(ie,12,0,12),N.add(127,12,0,12),N.addMany(i(28,32),12,0,12),N.addMany(i(32,48),12,9,12),N.addMany(i(48,64),12,0,11),N.addMany(i(64,127),12,12,13),N.addMany(i(64,127),10,12,13),N.addMany(i(64,127),9,12,13),N.addMany(ie,13,13,13),N.addMany(X,13,13,13),N.add(127,13,0,13),N.addMany([27,156,24,26],13,14,0),N.add(ce,0,2,0),N.add(ce,8,5,8),N.add(ce,6,0,6),N.add(ce,11,0,11),N.add(ce,13,13,13),N}();class h extends ie.Disposable{constructor(N=j.VT500_TRANSITION_TABLE){super(),this._transitions=N,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new se.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(N,j,X)=>{},this._executeHandlerFb=N=>{},this._csiHandlerFb=(N,j)=>{},this._escHandlerFb=N=>{},this._errorHandlerFb=N=>N,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register((0,ie.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this._register(new le.OscParser),this._dcsParser=this._register(new he.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(N,j=[64,126]){let X=0;if(N.prefix){if(N.prefix.length>1)throw new Error("only one byte as prefix supported");if(X=N.prefix.charCodeAt(0),X&&60>X||X>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(N.intermediates){if(N.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let j=0;jie||ie>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");X<<=8,X|=ie}}if(1!==N.final.length)throw new Error("final must be a single byte");const ie=N.final.charCodeAt(0);if(j[0]>ie||ie>j[1])throw new Error(`final must be in range ${j[0]} .. ${j[1]}`);return X<<=8,X|=ie,X}identToString(N){const j=[];for(;N;)j.push(String.fromCharCode(255&N)),N>>=8;return j.reverse().join("")}setPrintHandler(N){this._printHandler=N}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(N,j){const X=this._identifier(N,[48,126]);void 0===this._escHandlers[X]&&(this._escHandlers[X]=[]);const ie=this._escHandlers[X];return ie.push(j),{dispose:()=>{const N=ie.indexOf(j);-1!==N&&ie.splice(N,1)}}}clearEscHandler(N){this._escHandlers[this._identifier(N,[48,126])]&&delete this._escHandlers[this._identifier(N,[48,126])]}setEscHandlerFallback(N){this._escHandlerFb=N}setExecuteHandler(N,j){this._executeHandlers[N.charCodeAt(0)]=j}clearExecuteHandler(N){this._executeHandlers[N.charCodeAt(0)]&&delete this._executeHandlers[N.charCodeAt(0)]}setExecuteHandlerFallback(N){this._executeHandlerFb=N}registerCsiHandler(N,j){const X=this._identifier(N);void 0===this._csiHandlers[X]&&(this._csiHandlers[X]=[]);const ie=this._csiHandlers[X];return ie.push(j),{dispose:()=>{const N=ie.indexOf(j);-1!==N&&ie.splice(N,1)}}}clearCsiHandler(N){this._csiHandlers[this._identifier(N)]&&delete this._csiHandlers[this._identifier(N)]}setCsiHandlerFallback(N){this._csiHandlerFb=N}registerDcsHandler(N,j){return this._dcsParser.registerHandler(this._identifier(N),j)}clearDcsHandler(N){this._dcsParser.clearHandler(this._identifier(N))}setDcsHandlerFallback(N){this._dcsParser.setHandlerFallback(N)}registerOscHandler(N,j){return this._oscParser.registerHandler(N,j)}clearOscHandler(N){this._oscParser.clearHandler(N)}setOscHandlerFallback(N){this._oscParser.setHandlerFallback(N)}setErrorHandler(N){this._errorHandler=N}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(N,j,X,ie,se){this._parseStack.state=N,this._parseStack.handlers=j,this._parseStack.handlerPos=X,this._parseStack.transition=ie,this._parseStack.chunkPos=se}parse(N,j,X){let ie,se=0,le=0,he=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,he=this._parseStack.chunkPos+1;else{if(void 0===X||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const j=this._parseStack.handlers;let le=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===X&&le>-1)for(;le>=0&&(ie=j[le](this._params),!0!==ie);le--)if(ie instanceof Promise)return this._parseStack.handlerPos=le,ie;this._parseStack.handlers=[];break;case 4:if(!1===X&&le>-1)for(;le>=0&&(ie=j[le](),!0!==ie);le--)if(ie instanceof Promise)return this._parseStack.handlerPos=le,ie;this._parseStack.handlers=[];break;case 6:if(se=N[this._parseStack.chunkPos],ie=this._dcsParser.unhook(24!==se&&26!==se,X),ie)return ie;27===se&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(se=N[this._parseStack.chunkPos],ie=this._oscParser.end(24!==se&&26!==se,X),ie)return ie;27===se&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,he=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let X=he;X>4){case 2:for(let ie=X+1;;++ie){if(ie>=j||(se=N[ie])<32||se>126&&se=j||(se=N[ie])<32||se>126&&se=j||(se=N[ie])<32||se>126&&se=j||(se=N[ie])<32||se>126&&se=0&&(ie=he[_e](this._params),!0!==ie);_e--)if(ie instanceof Promise)return this._preserveStack(3,he,_e,le,X),ie;_e<0&&this._csiHandlerFb(this._collect<<8|se,this._params),this.precedingJoinState=0;break;case 8:do{switch(se){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(se-48)}}while(++X47&&se<60);X--;break;case 9:this._collect<<=8,this._collect|=se;break;case 10:const me=this._escHandlers[this._collect<<8|se];let ve=me?me.length-1:-1;for(;ve>=0&&(ie=me[ve](),!0!==ie);ve--)if(ie instanceof Promise)return this._preserveStack(4,me,ve,le,X),ie;ve<0&&this._escHandlerFb(this._collect<<8|se),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|se,this._params);break;case 13:for(let ie=X+1;;++ie)if(ie>=j||24===(se=N[ie])||26===se||27===se||se>127&&se=j||(se=N[ie])<32||se>127&&se{Object.defineProperty(j,"__esModule",{value:!0}),j.OscHandler=j.OscParser=void 0;const ie=X(1263),se=X(726),le=[];j.OscParser=class{constructor(){this._state=0,this._active=le,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(N,j){void 0===this._handlers[N]&&(this._handlers[N]=[]);const X=this._handlers[N];return X.push(j),{dispose:()=>{const N=X.indexOf(j);-1!==N&&X.splice(N,1)}}}clearHandler(N){this._handlers[N]&&delete this._handlers[N]}setHandlerFallback(N){this._handlerFb=N}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=le}reset(){if(2===this._state)for(let N=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;N>=0;--N)this._active[N].end(!1);this._stack.paused=!1,this._active=le,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||le,this._active.length)for(let N=this._active.length-1;N>=0;N--)this._active[N].start();else this._handlerFb(this._id,"START")}_put(N,j,X){if(this._active.length)for(let ie=this._active.length-1;ie>=0;ie--)this._active[ie].put(N,j,X);else this._handlerFb(this._id,"PUT",(0,se.utf32ToString)(N,j,X))}start(){this.reset(),this._state=1}put(N,j,X){if(3!==this._state){if(1===this._state)for(;j0&&this._put(N,j,X)}}end(N,j=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let X=!1,ie=this._active.length-1,se=!1;if(this._stack.paused&&(ie=this._stack.loopPosition-1,X=j,se=this._stack.fallThrough,this._stack.paused=!1),!se&&!1===X){for(;ie>=0&&(X=this._active[ie].end(N),!0!==X);ie--)if(X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=ie,this._stack.fallThrough=!1,X;ie--}for(;ie>=0;ie--)if(X=this._active[ie].end(!1),X instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=ie,this._stack.fallThrough=!0,X}else this._handlerFb(this._id,"END",N);this._active=le,this._id=-1,this._state=0}}},j.OscHandler=class{constructor(N){this._handler=N,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(N,j,X){this._hitLimit||(this._data+=(0,se.utf32ToString)(N,j,X),this._data.length>ie.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(N){let j=!1;if(this._hitLimit)j=!1;else if(N&&(j=this._handler(this._data),j instanceof Promise))return j.then((N=>(this._data="",this._hitLimit=!1,N)));return this._data="",this._hitLimit=!1,j}}},7262:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.Params=void 0;const X=2147483647;class s{static fromArray(N){const j=new s;if(!N.length)return j;for(let X=Array.isArray(N[0])?1:0;X256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(N),this.length=0,this._subParams=new Int32Array(j),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(N),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const N=new s(this.maxLength,this.maxSubParamsLength);return N.params.set(this.params),N.length=this.length,N._subParams.set(this._subParams),N._subParamsLength=this._subParamsLength,N._subParamsIdx.set(this._subParamsIdx),N._rejectDigits=this._rejectDigits,N._rejectSubDigits=this._rejectSubDigits,N._digitIsSub=this._digitIsSub,N}toArray(){const N=[];for(let j=0;j>8,ie=255&this._subParamsIdx[j];ie-X>0&&N.push(Array.prototype.slice.call(this._subParams,X,ie))}return N}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(N){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(N<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=N>X?X:N}}addSubParam(N){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(N<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=N>X?X:N,this._subParamsIdx[this.length-1]++}}hasSubParams(N){return(255&this._subParamsIdx[N])-(this._subParamsIdx[N]>>8)>0}getSubParams(N){const j=this._subParamsIdx[N]>>8,X=255&this._subParamsIdx[N];return X-j>0?this._subParams.subarray(j,X):null}getSubParamsAll(){const N={};for(let j=0;j>8,ie=255&this._subParamsIdx[j];ie-X>0&&(N[j]=this._subParams.slice(X,ie))}return N}addDigit(N){let j;if(this._rejectDigits||!(j=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const ie=this._digitIsSub?this._subParams:this.params,se=ie[j-1];ie[j-1]=~se?Math.min(10*se+N,X):N}}j.Params=s},3027:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.AddonManager=void 0,j.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let N=this._addons.length-1;N>=0;N--)this._addons[N].instance.dispose()}loadAddon(N,j){const X={instance:j,dispose:j.dispose,isDisposed:!1};this._addons.push(X),j.dispose=()=>this._wrappedAddonDispose(X),j.activate(N)}_wrappedAddonDispose(N){if(N.isDisposed)return;let j=-1;for(let X=0;X{Object.defineProperty(j,"__esModule",{value:!0}),j.BufferApiView=void 0;const ie=X(793),se=X(3055);j.BufferApiView=class{constructor(N,j){this._buffer=N,this.type=j}init(N){return this._buffer=N,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(N){const j=this._buffer.lines.get(N);if(j)return new ie.BufferLineApiView(j)}getNullCell(){return new se.CellData}}},793:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.BufferLineApiView=void 0;const ie=X(3055);j.BufferLineApiView=class{constructor(N){this._line=N}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(N,j){if(!(N<0||N>=this._line.length))return j?(this._line.loadCell(N,j),j):this._line.loadCell(N,new ie.CellData)}translateToString(N,j,X){return this._line.translateToString(N,j,X)}}},5101:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.BufferNamespaceApi=void 0;const ie=X(3235),se=X(7150),le=X(802);class o extends se.Disposable{constructor(N){super(),this._core=N,this._onBufferChange=this._register(new le.Emitter),this.onBufferChange=this._onBufferChange.event,this._normal=new ie.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new ie.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)}}j.BufferNamespaceApi=o},6097:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ParserApi=void 0,j.ParserApi=class{constructor(N){this._core=N}registerCsiHandler(N,j){return this._core.registerCsiHandler(N,(N=>j(N.toArray())))}addCsiHandler(N,j){return this.registerCsiHandler(N,j)}registerDcsHandler(N,j){return this._core.registerDcsHandler(N,((N,X)=>j(N,X.toArray())))}addDcsHandler(N,j){return this.registerDcsHandler(N,j)}registerEscHandler(N,j){return this._core.registerEscHandler(N,j)}addEscHandler(N,j){return this.registerEscHandler(N,j)}registerOscHandler(N,j){return this._core.registerOscHandler(N,j)}addOscHandler(N,j){return this.registerOscHandler(N,j)}}},4335:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.UnicodeApi=void 0,j.UnicodeApi=class{constructor(N){this._core=N}register(N){this._core.unicodeService.register(N)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(N){this._core.unicodeService.activeVersion=N}}},9640:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.BufferService=j.MINIMUM_ROWS=j.MINIMUM_COLS=void 0;const le=X(7150),he=X(4097),ce=X(6501),_e=X(802);j.MINIMUM_COLS=2,j.MINIMUM_ROWS=1;let me=class extends le.Disposable{get buffer(){return this.buffers.active}constructor(N){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e.Emitter),this.onResize=this._onResize.event,this._onScroll=this._register(new _e.Emitter),this.onScroll=this._onScroll.event,this.cols=Math.max(N.rawOptions.cols||0,j.MINIMUM_COLS),this.rows=Math.max(N.rawOptions.rows||0,j.MINIMUM_ROWS),this.buffers=this._register(new he.BufferSet(N,this))}resize(N,j){this.cols=N,this.rows=j,this.buffers.resize(N,j),this._onResize.fire({cols:N,rows:j})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(N,j=!1){const X=this.buffer;let ie;ie=this._cachedBlankLine,ie&&ie.length===this.cols&&ie.getFg(0)===N.fg&&ie.getBg(0)===N.bg||(ie=X.getBlankLine(N,j),this._cachedBlankLine=ie),ie.isWrapped=j;const se=X.ybase+X.scrollTop,le=X.ybase+X.scrollBottom;if(0===X.scrollTop){const N=X.lines.isFull;le===X.lines.length-1?N?X.lines.recycle().copyFrom(ie):X.lines.push(ie.clone()):X.lines.splice(le+1,0,ie.clone()),N?this.isUserScrolling&&(X.ydisp=Math.max(X.ydisp-1,0)):(X.ybase++,this.isUserScrolling||X.ydisp++)}else{const N=le-se+1;X.lines.shiftElements(se+1,N-1,-1),X.lines.set(le,ie.clone())}this.isUserScrolling||(X.ydisp=X.ybase),this._onScroll.fire(X.ydisp)}scrollLines(N,j){const X=this.buffer;if(N<0){if(0===X.ydisp)return;this.isUserScrolling=!0}else N+X.ydisp>=X.ybase&&(this.isUserScrolling=!1);const ie=X.ydisp;X.ydisp=Math.max(Math.min(X.ydisp+N,X.ybase),0),ie!==X.ydisp&&(j||this._onScroll.fire(X.ydisp))}};j.BufferService=me,j.BufferService=me=ie([se(0,ce.IOptionsService)],me)},5746:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.CharsetService=void 0,j.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(N){this.glevel=N,this.charset=this._charsets[N]}setgCharset(N,j){this._charsets[N]=j,this.glevel===N&&(this.charset=j)}}},7792:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.CoreMouseService=void 0;const le=X(6501),he=X(7150),ce=X(802),_e={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:N=>4!==N.button&&1===N.action&&(N.ctrl=!1,N.alt=!1,N.shift=!1,!0)},VT200:{events:19,restrict:N=>32!==N.action},DRAG:{events:23,restrict:N=>32!==N.action||3!==N.button},ANY:{events:31,restrict:N=>!0}};function h(N,j){let X=(N.ctrl?16:0)|(N.shift?4:0)|(N.alt?8:0);return 4===N.button?(X|=64,X|=N.action):(X|=3&N.button,4&N.button&&(X|=64),8&N.button&&(X|=128),32===N.action?X|=32:0!==N.action||j||(X|=3)),X}const me=String.fromCharCode,ve={DEFAULT:N=>{const j=[h(N,!1)+32,N.col+32,N.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`${me(j[0])}${me(j[1])}${me(j[2])}`},SGR:N=>{const j=0===N.action&&4!==N.button?"m":"M";return`[<${h(N,!0)};${N.col};${N.row}${j}`},SGR_PIXELS:N=>{const j=0===N.action&&4!==N.button?"m":"M";return`[<${h(N,!0)};${N.x};${N.y}${j}`}};let Se=class extends he.Disposable{constructor(N,j){super(),this._bufferService=N,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this._register(new ce.Emitter),this.onProtocolChange=this._onProtocolChange.event;for(const N of Object.keys(_e))this.addProtocol(N,_e[N]);for(const N of Object.keys(ve))this.addEncoding(N,ve[N]);this.reset()}addProtocol(N,j){this._protocols[N]=j}addEncoding(N,j){this._encodings[N]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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)return!1;if(4===N.button&&32===N.action)return!1;if(3===N.button&&32!==N.action)return!1;if(4!==N.button&&(2===N.action||3===N.action))return!1;if(N.col++,N.row++,32===N.action&&this._lastEvent&&this._equalEvents(this._lastEvent,N,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(N))return!1;const j=this._encodings[this._activeEncoding](N);return j&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!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,j,X){if(X){if(N.x!==j.x)return!1;if(N.y!==j.y)return!1}else{if(N.col!==j.col)return!1;if(N.row!==j.row)return!1}return N.button===j.button&&N.action===j.action&&N.ctrl===j.ctrl&&N.alt===j.alt&&N.shift===j.shift}};j.CoreMouseService=Se,j.CoreMouseService=Se=ie([se(0,le.IBufferService),se(1,le.ICoreService)],Se)},4071:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.CoreService=void 0;const le=X(7453),he=X(7150),ce=X(6501),_e=X(802),me=Object.freeze({insertMode:!1}),ve=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let Se=class extends he.Disposable{constructor(N,j,X){super(),this._bufferService=N,this._logService=j,this._optionsService=X,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e.Emitter),this.onData=this._onData.event,this._onUserInput=this._register(new _e.Emitter),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e.Emitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e.Emitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,le.clone)(me),this.decPrivateModes=(0,le.clone)(ve)}reset(){this.modes=(0,le.clone)(me),this.decPrivateModes=(0,le.clone)(ve)}triggerDataEvent(N,j=!1){if(this._optionsService.rawOptions.disableStdin)return;const X=this._bufferService.buffer;j&&this._optionsService.rawOptions.scrollOnUserInput&&X.ybase!==X.ydisp&&this._onRequestScrollToBottom.fire(),j&&this._onUserInput.fire(),this._logService.debug(`sending data "${N}"`,(()=>N.split("").map((N=>N.charCodeAt(0))))),this._onData.fire(N)}triggerBinaryEvent(N){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${N}"`,(()=>N.split("").map((N=>N.charCodeAt(0))))),this._onBinary.fire(N))}};j.CoreService=Se,j.CoreService=Se=ie([se(0,ce.IBufferService),se(1,ce.ILogService),se(2,ce.IOptionsService)],Se)},4720:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.DecorationService=void 0;const ie=X(4103),se=X(7150),le=X(3087),he=X(802);let ce=0,_e=0;class h extends se.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new le.SortedList((N=>N?.marker.line)),this._onDecorationRegistered=this._register(new he.Emitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new he.Emitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register((0,se.toDisposable)((()=>this.reset())))}registerDecoration(N){if(N.marker.isDisposed)return;const j=new c(N);if(j){const N=j.marker.onDispose((()=>j.dispose())),X=j.onDispose((()=>{X.dispose(),j&&(this._decorations.delete(j)&&this._onDecorationRemoved.fire(j),N.dispose())}));this._decorations.insert(j),this._onDecorationRegistered.fire(j)}return j}reset(){for(const N of this._decorations.values())N.dispose();this._decorations.clear()}*getDecorationsAtCell(N,j,X){let ie=0,se=0;for(const le of this._decorations.getKeyIterator(j))ie=le.options.x??0,se=ie+(le.options.width??1),N>=ie&&N{ce=j.options.x??0,_e=ce+(j.options.width??1),N>=ce&&N<_e&&(!X||(j.options.layer??"bottom")===X)&&ie(j)}))}}j.DecorationService=h;class c extends se.DisposableStore{get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=ie.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=ie.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(N){super(),this.options=N,this.onRenderEmitter=this.add(new he.Emitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new he.Emitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=N.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},6025:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.InstantiationService=j.ServiceCollection=void 0;const ie=X(6501),se=X(6201);class n{constructor(...N){this._entries=new Map;for(const[j,X]of N)this.set(j,X)}set(N,j){const X=this._entries.get(N);return this._entries.set(N,j),X}forEach(N){for(const[j,X]of this._entries.entries())N(j,X)}has(N){return this._entries.has(N)}get(N){return this._entries.get(N)}}j.ServiceCollection=n,j.InstantiationService=class{constructor(){this._services=new n,this._services.set(ie.IInstantiationService,this)}setService(N,j){this._services.set(N,j)}getService(N){return this._services.get(N)}createInstance(N,...j){const X=(0,se.getServiceDependencies)(N).sort(((N,j)=>N.index-j.index)),ie=[];for(const j of X){const X=this._services.get(j.id);if(!X)throw new Error(`[createInstance] ${N.name} depends on UNKNOWN service ${j.id}.`);ie.push(X)}const le=X.length>0?X[0].index:j.length;if(j.length!==le)throw new Error(`[createInstance] First service dependency of ${N.name} at position ${le+1} conflicts with ${j.length} static arguments`);return new N(...[...j,...ie])}}},7276:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.LogService=void 0,j.setTraceLogger=function(N){_e=N},j.traceCall=function(N,j,X){if("function"!=typeof X.value)throw new Error("not supported");const ie=X.value;X.value=function(...N){if(_e.logLevel!==he.LogLevelEnum.TRACE)return ie.apply(this,N);_e.trace(`GlyphRenderer#${ie.name}(${N.map((N=>JSON.stringify(N))).join(", ")})`);const j=ie.apply(this,N);return _e.trace(`GlyphRenderer#${ie.name} return`,j),j}};const le=X(7150),he=X(6501),ce={trace:he.LogLevelEnum.TRACE,debug:he.LogLevelEnum.DEBUG,info:he.LogLevelEnum.INFO,warn:he.LogLevelEnum.WARN,error:he.LogLevelEnum.ERROR,off:he.LogLevelEnum.OFF};let _e,me=class extends le.Disposable{get logLevel(){return this._logLevel}constructor(N){super(),this._optionsService=N,this._logLevel=he.LogLevelEnum.OFF,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),_e=this}_updateLogLevel(){this._logLevel=ce[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(N){for(let j=0;j{Object.defineProperty(j,"__esModule",{value:!0}),j.OptionsService=j.DEFAULT_OPTIONS=void 0;const ie=X(7150),se=X(701),le=X(802);j.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:se.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}};const he=["normal","bold","100","200","300","400","500","600","700","800","900"];class a extends ie.Disposable{constructor(N){super(),this._onOptionChange=this._register(new le.Emitter),this.onOptionChange=this._onOptionChange.event;const X={...j.DEFAULT_OPTIONS};for(const j in N)if(j in X)try{const ie=N[j];X[j]=this._sanitizeAndValidateOption(j,ie)}catch(N){console.error(N)}this.rawOptions=X,this.options={...X},this._setupOptions(),this._register((0,ie.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(N,j){return this.onOptionChange((X=>{X===N&&j(this.rawOptions[N])}))}onMultipleOptionChange(N,j){return this.onOptionChange((X=>{-1!==N.indexOf(X)&&j()}))}_setupOptions(){const e=N=>{if(!(N in j.DEFAULT_OPTIONS))throw new Error(`No option with key "${N}"`);return this.rawOptions[N]},i=(N,X)=>{if(!(N in j.DEFAULT_OPTIONS))throw new Error(`No option with key "${N}"`);X=this._sanitizeAndValidateOption(N,X),this.rawOptions[N]!==X&&(this.rawOptions[N]=X,this._onOptionChange.fire(N))};for(const N in this.rawOptions){const j={get:e.bind(this,N),set:i.bind(this,N)};Object.defineProperty(this.options,N,j)}}_sanitizeAndValidateOption(N,X){switch(N){case"cursorStyle":if(X||(X=j.DEFAULT_OPTIONS[N]),!function(N){return"block"===N||"underline"===N||"bar"===N}(X))throw new Error(`"${X}" is not a valid value for ${N}`);break;case"wordSeparator":X||(X=j.DEFAULT_OPTIONS[N]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof X&&1<=X&&X<=1e3)break;X=he.includes(X)?X:j.DEFAULT_OPTIONS[N];break;case"cursorWidth":X=Math.floor(X);case"lineHeight":case"tabStopWidth":if(X<1)throw new Error(`${N} cannot be less than 1, value: ${X}`);break;case"minimumContrastRatio":X=Math.max(1,Math.min(21,Math.round(10*X)/10));break;case"scrollback":if((X=Math.min(X,4294967295))<0)throw new Error(`${N} cannot be less than 0, value: ${X}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(X<=0)throw new Error(`${N} cannot be less than or equal to 0, value: ${X}`);break;case"rows":case"cols":if(!X&&0!==X)throw new Error(`${N} must be numeric, value: ${X}`);break;case"windowsPty":X=X??{}}return X}}j.OptionsService=a},8811:function(N,j,X){var ie=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},se=this&&this.__param||function(N,j){return function(X,ie){j(X,ie,N)}};Object.defineProperty(j,"__esModule",{value:!0}),j.OscLinkService=void 0;const le=X(6501);let he=class{constructor(N){this._bufferService=N,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(N){const j=this._bufferService.buffer;if(void 0===N.id){const X=j.addMarker(j.ybase+j.y),ie={data:N,id:this._nextId++,lines:[X]};return X.onDispose((()=>this._removeMarkerFromLink(ie,X))),this._dataByLinkId.set(ie.id,ie),ie.id}const X=N,ie=this._getEntryIdKey(X),se=this._entriesWithId.get(ie);if(se)return this.addLineToLink(se.id,j.ybase+j.y),se.id;const le=j.addMarker(j.ybase+j.y),he={id:this._nextId++,key:this._getEntryIdKey(X),data:X,lines:[le]};return le.onDispose((()=>this._removeMarkerFromLink(he,le))),this._entriesWithId.set(he.key,he),this._dataByLinkId.set(he.id,he),he.id}addLineToLink(N,j){const X=this._dataByLinkId.get(N);if(X&&X.lines.every((N=>N.line!==j))){const N=this._bufferService.buffer.addMarker(j);X.lines.push(N),N.onDispose((()=>this._removeMarkerFromLink(X,N)))}}getLinkData(N){return this._dataByLinkId.get(N)?.data}_getEntryIdKey(N){return`${N.id};;${N.uri}`}_removeMarkerFromLink(N,j){const X=N.lines.indexOf(j);-1!==X&&(N.lines.splice(X,1),0===N.lines.length&&(void 0!==N.data.id&&this._entriesWithId.delete(N.key),this._dataByLinkId.delete(N.id)))}};j.OscLinkService=he,j.OscLinkService=he=ie([se(0,le.IBufferService)],he)},6201:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.serviceRegistry=void 0,j.getServiceDependencies=function(N){return N[ie]||[]},j.createDecorator=function(N){if(j.serviceRegistry.has(N))return j.serviceRegistry.get(N);const r=function(N,j,se){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(N,j,se){j[X]===j?j[ie].push({id:N,index:se}):(j[ie]=[{id:N,index:se}],j[X]=j)}(r,N,se)};return r.toString=()=>N,j.serviceRegistry.set(N,r),r};const X="di$target",ie="di$dependencies";j.serviceRegistry=new Map},6501:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.IDecorationService=j.IUnicodeService=j.IOscLinkService=j.IOptionsService=j.ILogService=j.LogLevelEnum=j.IInstantiationService=j.ICharsetService=j.ICoreService=j.ICoreMouseService=j.IBufferService=void 0;const ie=X(6201);var se;j.IBufferService=(0,ie.createDecorator)("BufferService"),j.ICoreMouseService=(0,ie.createDecorator)("CoreMouseService"),j.ICoreService=(0,ie.createDecorator)("CoreService"),j.ICharsetService=(0,ie.createDecorator)("CharsetService"),j.IInstantiationService=(0,ie.createDecorator)("InstantiationService"),function(N){N[N.TRACE=0]="TRACE",N[N.DEBUG=1]="DEBUG",N[N.INFO=2]="INFO",N[N.WARN=3]="WARN",N[N.ERROR=4]="ERROR",N[N.OFF=5]="OFF"}(se||(j.LogLevelEnum=se={})),j.ILogService=(0,ie.createDecorator)("LogService"),j.IOptionsService=(0,ie.createDecorator)("OptionsService"),j.IOscLinkService=(0,ie.createDecorator)("OscLinkService"),j.IUnicodeService=(0,ie.createDecorator)("UnicodeService"),j.IDecorationService=(0,ie.createDecorator)("DecorationService")},6415:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.UnicodeService=void 0;const ie=X(7428),se=X(802);class n{static extractShouldJoin(N){return!!(1&N)}static extractWidth(N){return N>>1&3}static extractCharKind(N){return N>>3}static createPropertyValue(N,j,X=!1){return(16777215&N)<<3|(3&j)<<1|(X?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new se.Emitter,this.onChange=this._onChange.event;const N=new ie.UnicodeV6;this.register(N),this._active=N.version,this._activeProvider=N}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(N){if(!this._providers[N])throw new Error(`unknown Unicode version "${N}"`);this._active=N,this._activeProvider=this._providers[N],this._onChange.fire(N)}register(N){this._providers[N.version]=N}wcwidth(N){return this._activeProvider.wcwidth(N)}getStringCellWidth(N){let j=0,X=0;const ie=N.length;for(let se=0;se=ie)return j+this.wcwidth(le);const X=N.charCodeAt(se);56320<=X&&X<=57343?le=1024*(le-55296)+X-56320+65536:j+=this.wcwidth(X)}const he=this.charProperties(le,X);let ce=n.extractWidth(he);n.extractShouldJoin(he)&&(ce-=n.extractWidth(X)),j+=ce,X=he}return j}charProperties(N,j){return this._activeProvider.charProperties(N,j)}}j.UnicodeService=n},4333:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.isAndroid=j.isElectron=j.isWebkitWebView=j.isSafari=j.isChrome=j.isWebKit=j.isFirefox=j.onDidChangeFullscreen=j.onDidChangeZoomLevel=void 0,j.addMatchMediaChangeListener=o,j.setZoomLevel=function(N,j){n.INSTANCE.setZoomLevel(N,j)},j.getZoomLevel=function(N){return n.INSTANCE.getZoomLevel(N)},j.getZoomFactor=function(N){return n.INSTANCE.getZoomFactor(N)},j.setZoomFactor=function(N,j){n.INSTANCE.setZoomFactor(N,j)},j.setFullscreen=function(N,j){n.INSTANCE.setFullscreen(N,j)},j.isFullscreen=function(N){return n.INSTANCE.isFullscreen(N)},j.isStandalone=function(){return he},j.isWCOEnabled=function(){return navigator?.windowControlsOverlay?.visible},j.getWCOBoundingRect=function(){return navigator?.windowControlsOverlay?.getTitlebarAreaRect()};const ie=X(4693),se=X(802);class n{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se.Emitter,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se.Emitter,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}static{this.INSTANCE=new n}getZoomLevel(N){return this.mapWindowIdToZoomLevel.get(this.getWindowId(N))??0}setZoomLevel(N,j){if(this.getZoomLevel(j)===N)return;const X=this.getWindowId(j);this.mapWindowIdToZoomLevel.set(X,N),this._onDidChangeZoomLevel.fire(X)}getZoomFactor(N){return this.mapWindowIdToZoomFactor.get(this.getWindowId(N))??1}setZoomFactor(N,j){this.mapWindowIdToZoomFactor.set(this.getWindowId(j),N)}setFullscreen(N,j){if(this.isFullscreen(j)===N)return;const X=this.getWindowId(j);this.mapWindowIdToFullScreen.set(X,N),this._onDidChangeFullscreen.fire(X)}isFullscreen(N){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(N))}getWindowId(N){return N.vscodeWindowId}}function o(N,j,X){"string"==typeof j&&(j=N.matchMedia(j)),j.addEventListener("change",X)}j.onDidChangeZoomLevel=n.INSTANCE.onDidChangeZoomLevel,j.onDidChangeFullscreen=n.INSTANCE.onDidChangeFullscreen;const le="object"==typeof navigator?navigator.userAgent:"";j.isFirefox=le.indexOf("Firefox")>=0,j.isWebKit=le.indexOf("AppleWebKit")>=0,j.isChrome=le.indexOf("Chrome")>=0,j.isSafari=!j.isChrome&&le.indexOf("Safari")>=0,j.isWebkitWebView=!j.isChrome&&!j.isSafari&&j.isWebKit,j.isElectron=le.indexOf("Electron/")>=0,j.isAndroid=le.indexOf("Android")>=0;let he=!1;if("function"==typeof ie.mainWindow.matchMedia){const N=ie.mainWindow.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),j=ie.mainWindow.matchMedia("(display-mode: fullscreen)");he=N.matches,o(ie.mainWindow,N,(({matches:N})=>{he&&j.matches||(he=N)}))}},7745:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.BrowserFeatures=j.KeyboardSupport=void 0;const he=le(X(4333)),ce=X(4693),_e=le(X(8163));var me;!function(N){N[N.Always=0]="Always",N[N.FullScreen=1]="FullScreen",N[N.None=2]="None"}(me||(j.KeyboardSupport=me={}));const ve="object"==typeof navigator?navigator:{};j.BrowserFeatures={clipboard:{writeText:_e.isNative||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(ve&&ve.clipboard&&ve.clipboard.writeText),readText:_e.isNative||!!(ve&&ve.clipboard&&ve.clipboard.readText)},keyboard:_e.isNative||he.isStandalone()?me.Always:ve.keyboard||he.isSafari?me.FullScreen:me.None,touch:"ontouchstart"in ce.mainWindow||ve.maxTouchPoints>0,pointerEvents:ce.mainWindow.PointerEvent&&("ontouchstart"in ce.mainWindow||navigator.maxTouchPoints>0)}},7093:function(N,j,X){var ie,se=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),le=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),he=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&se(j,N,X);return le(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.SafeTriangle=j.DragAndDropObserver=j.ModifierKeyEmitter=j.DetectedFullscreenMode=j.Namespace=j.EventHelper=j.EventType=j.sharedMutationObserver=j.Dimension=j.WindowIntervalTimer=j.scheduleAtNextAnimationFrame=j.runAtThisOrScheduleAtNextAnimationFrame=j.WindowIdleValue=j.addStandardDisposableGenericMouseUpListener=j.addStandardDisposableGenericMouseDownListener=j.addStandardDisposableListener=j.onDidUnregisterWindow=j.onWillUnregisterWindow=j.onDidRegisterWindow=j.hasWindow=j.getWindowById=j.getWindowId=j.getWindowsCount=j.getWindows=j.getDocument=j.getWindow=j.registerWindow=void 0,j.clearNode=function(N){for(;N.firstChild;)N.firstChild.remove()},j.clearNodeRecursively=function e(N){for(;N.firstChild;){const j=N.firstChild;j.remove(),e(j)}},j.addDisposableListener=C,j.addDisposableGenericMouseDownListener=w,j.addDisposableGenericMouseMoveListener=function(N,X,ie){return C(N,Ee.isIOS&&_e.BrowserFeatures.pointerEvents?j.EventType.POINTER_MOVE:j.EventType.MOUSE_MOVE,X,ie)},j.addDisposableGenericMouseUpListener=E,j.runWhenWindowIdle=function(N,j,X){return(0,Se._runWhenIdle)(N,j,X)},j.disposableWindowInterval=function(N,j,X,ie){let se=0;const le=N.setInterval((()=>{se++,("number"==typeof ie&&se>=ie||!0===j())&&he.dispose()}),X),he=(0,we.toDisposable)((()=>{N.clearInterval(le)}));return he},j.measure=function(N,X){return(0,j.scheduleAtNextAnimationFrame)(N,X,1e4)},j.modify=function(N,X){return(0,j.scheduleAtNextAnimationFrame)(N,X,-1e4)},j.addDisposableThrottledListener=function(N,j,X,ie,se){return new T(N,j,X,ie,se)},j.getComputedStyle=k,j.getClientArea=function e(N,X){const ie=(0,j.getWindow)(N),se=ie.document;if(N!==se.body)return new O(N.clientWidth,N.clientHeight);if(Ee.isIOS&&ie?.visualViewport)return new O(ie.visualViewport.width,ie.visualViewport.height);if(ie?.innerWidth&&ie.innerHeight)return new O(ie.innerWidth,ie.innerHeight);if(se.body&&se.body.clientWidth&&se.body.clientHeight)return new O(se.body.clientWidth,se.body.clientHeight);if(se.documentElement&&se.documentElement.clientWidth&&se.documentElement.clientHeight)return new O(se.documentElement.clientWidth,se.documentElement.clientHeight);if(X)return e(X);throw new Error("Unable to figure out browser width and height")},j.getTopLeftOffset=I,j.size=function(N,j,X){"number"==typeof j&&(N.style.width=`${j}px`),"number"==typeof X&&(N.style.height=`${X}px`)},j.position=function(N,j,X,ie,se,le="absolute"){"number"==typeof j&&(N.style.top=`${j}px`),"number"==typeof X&&(N.style.right=`${X}px`),"number"==typeof ie&&(N.style.bottom=`${ie}px`),"number"==typeof se&&(N.style.left=`${se}px`),N.style.position=le},j.getDomNodePagePosition=function(N){const X=N.getBoundingClientRect(),ie=(0,j.getWindow)(N);return{left:X.left+ie.scrollX,top:X.top+ie.scrollY,width:X.width,height:X.height}},j.getDomNodeZoomLevel=function(N){let j=N,X=1;do{const N=k(j).zoom;null!=N&&"1"!==N&&(X*=N),j=j.parentElement}while(null!==j&&j!==j.ownerDocument.documentElement);return X},j.getTotalWidth=P,j.getContentWidth=function(N){const j=M.getBorderLeftWidth(N)+M.getBorderRightWidth(N),X=M.getPaddingLeft(N)+M.getPaddingRight(N);return N.offsetWidth-j-X},j.getTotalScrollWidth=x,j.getContentHeight=function(N){const j=M.getBorderTopWidth(N)+M.getBorderBottomWidth(N),X=M.getPaddingTop(N)+M.getPaddingBottom(N);return N.offsetHeight-j-X},j.getTotalHeight=function(N){const j=M.getMarginTop(N)+M.getMarginBottom(N);return N.offsetHeight+j},j.getLargestChildWidth=function(N,j){const X=j.map((j=>Math.max(x(j),P(j))+function(N,j){if(null===N)return 0;const X=I(N),ie=I(j);return X.left-ie.left}(j,N)||0));return Math.max(...X)},j.isAncestor=B,j.setParentFlowTo=function(N,j){N.dataset[Re]=j.id},j.isAncestorUsingFlowTo=function(N,j){let X=N;for(;X;){if(X===j)return!0;if(Q(X)){const N=U(X);if(N){X=N;continue}}X=X.parentNode}return!1},j.findParentWithClass=F,j.hasParentWithClass=function(N,j,X){return!!F(N,j,X)},j.isShadowRoot=W,j.isInShadowDOM=function(N){return!!H(N)},j.getShadowRoot=H,j.getActiveElement=K,j.isActiveElement=function(N){return K()===N},j.isAncestorOfActiveElement=function(N){return B(K(),N)},j.isActiveDocument=function(N){return N.ownerDocument===z()},j.getActiveDocument=z,j.getActiveWindow=function(){const N=z();return N.defaultView?.window??Le.mainWindow},j.isGlobalStylesheet=function(N){return Te.has(N)},j.createStyleSheet2=function(){return new $},j.createStyleSheet=V,j.cloneGlobalStylesheets=function(N){const j=new we.DisposableStore;for(const[X,ie]of Te)j.add(G(X,ie,N));return j},j.createMetaElement=function(N=Le.mainWindow.document.head){return q("meta",N)},j.createLinkElement=function(N=Le.mainWindow.document.head){return q("link",N)},j.createCSSRule=function e(N,j,X=Y()){if(X&&j){X.sheet?.insertRule(`${N} {${j}}`,0);for(const ie of Te.get(X)??[])e(N,j,ie)}},j.removeCSSRulesContainingSelector=function e(N,j=Y()){if(!j)return;const X=Z(j),ie=[];for(let j=0;j=0;N--)j.sheet?.deleteRule(ie[N]);for(const X of Te.get(j)??[])e(N,X)},j.isHTMLElement=Q,j.isHTMLAnchorElement=function(N){return N instanceof HTMLAnchorElement||N instanceof(0,j.getWindow)(N).HTMLAnchorElement},j.isHTMLSpanElement=function(N){return N instanceof HTMLSpanElement||N instanceof(0,j.getWindow)(N).HTMLSpanElement},j.isHTMLTextAreaElement=function(N){return N instanceof HTMLTextAreaElement||N instanceof(0,j.getWindow)(N).HTMLTextAreaElement},j.isHTMLInputElement=function(N){return N instanceof HTMLInputElement||N instanceof(0,j.getWindow)(N).HTMLInputElement},j.isHTMLButtonElement=function(N){return N instanceof HTMLButtonElement||N instanceof(0,j.getWindow)(N).HTMLButtonElement},j.isHTMLDivElement=function(N){return N instanceof HTMLDivElement||N instanceof(0,j.getWindow)(N).HTMLDivElement},j.isSVGElement=function(N){return N instanceof SVGElement||N instanceof(0,j.getWindow)(N).SVGElement},j.isMouseEvent=function(N){return N instanceof MouseEvent||N instanceof(0,j.getWindow)(N).MouseEvent},j.isKeyboardEvent=function(N){return N instanceof KeyboardEvent||N instanceof(0,j.getWindow)(N).KeyboardEvent},j.isPointerEvent=function(N){return N instanceof PointerEvent||N instanceof(0,j.getWindow)(N).PointerEvent},j.isDragEvent=function(N){return N instanceof DragEvent||N instanceof(0,j.getWindow)(N).DragEvent},j.isEventLike=function(N){const j=N;return!(!j||"function"!=typeof j.preventDefault||"function"!=typeof j.stopPropagation)},j.saveParentsScrollTop=function(N){const j=[];for(let X=0;N&&N.nodeType===N.ELEMENT_NODE;X++)j[X]=N.scrollTop,N=N.parentNode;return j},j.restoreParentsScrollTop=function(N,j){for(let X=0;N&&N.nodeType===N.ELEMENT_NODE;X++)N.scrollTop!==j[X]&&(N.scrollTop=j[X]),N=N.parentNode},j.trackFocus=function(N){return new ee(N)},j.after=function(N,j){return N.after(j),j},j.append=te,j.prepend=function(N,j){return N.insertBefore(j,N.firstChild),j},j.reset=function(N,...j){N.innerText="",te(N,...j)},j.$=ne,j.join=function(N,j){const X=[];return N.forEach(((N,ie)=>{ie>0&&(j instanceof Node?X.push(j.cloneNode()):X.push(document.createTextNode(j))),X.push(N)})),X},j.setVisibility=function(N,...j){N?oe(...j):ae(...j)},j.show=oe,j.hide=ae,j.removeTabIndexAndUpdateFocus=function(N){if(N&&N.hasAttribute("tabIndex")){if(N.ownerDocument.activeElement===N){const j=function(N){for(;N&&N.nodeType===N.ELEMENT_NODE;){if(Q(N)&&N.hasAttribute("tabIndex"))return N;N=N.parentNode}return null}(N.parentElement);j?.focus()}N.removeAttribute("tabindex")}},j.finalHandler=function(N){return j=>{j.preventDefault(),j.stopPropagation(),N(j)}},j.domContentLoaded=function(N){return new Promise((j=>{if("complete"===N.document.readyState||N.document&&null!==N.document.body)j(void 0);else{const i=()=>{N.window.removeEventListener("DOMContentLoaded",i,!1),j()};N.window.addEventListener("DOMContentLoaded",i,!1)}}))},j.computeScreenAwareSize=function(N,j){const X=N.devicePixelRatio*j;return Math.max(1,Math.floor(X))/N.devicePixelRatio},j.windowOpenNoOpener=function(N){Le.mainWindow.open(N,"_blank","noopener")},j.windowOpenPopup=function(N){const j=Math.floor(Le.mainWindow.screenLeft+Le.mainWindow.innerWidth/2-Ie/2),X=Math.floor(Le.mainWindow.screenTop+Le.mainWindow.innerHeight/2-Pe/2);Le.mainWindow.open(N,"_blank",`width=${Ie},height=${Pe},top=${X},left=${j}`)},j.windowOpenWithSuccess=function(N,j=!0){const X=Le.mainWindow.open();return!!X&&(j&&(X.opener=null),X.location.href=N,!0)},j.animate=function(N,X){const s=()=>{X(),ie=(0,j.scheduleAtNextAnimationFrame)(N,s)};let ie=(0,j.scheduleAtNextAnimationFrame)(N,s);return(0,we.toDisposable)((()=>ie.dispose()))},j.asCSSPropertyValue=function(N){return`'${N.replace(/'/g,"%27")}'`},j.asCssValueWithDefault=function e(N,j){if(void 0!==N){const X=N.match(/^\s*var\((.+)\)$/);if(X){const N=X[1].split(",",2);return 2===N.length&&(j=e(N[1].trim(),j)),`var(${N[0]}, ${j})`}return N}return j},j.detectFullscreen=function(N){return N.document.fullscreenElement||N.document.webkitFullscreenElement||N.document.webkitIsFullScreen?{mode:xe.DOCUMENT,guess:!1}:N.innerHeight===N.screen.height?{mode:xe.BROWSER,guess:!1}:(Ee.isMacintosh||Ee.isLinux)&&N.outerHeight===N.screen.height&&N.outerWidth===N.screen.width?{mode:xe.BROWSER,guess:!0}:null},j.multibyteAwareBtoa=function(N){return btoa(function(N){const j=new Uint16Array(N.length);for(let X=0;X0&&(he.className=ce.join(" "));const _e={};if(se.groups.name&&(_e[se.groups.name]=he),ie)for(const N of ie)Q(N)?he.appendChild(N):"string"==typeof N?he.append(N):"root"in N&&(Object.assign(_e,N),he.appendChild(N.root));for(const[N,j]of Object.entries(X))if("className"!==N)if("style"===N)for(const[N,X]of Object.entries(j))he.style.setProperty(fe(N),"number"==typeof X?X+"px":""+X);else"tabIndex"===N?he.tabIndex=j:he.setAttribute(fe(N),j.toString());return _e.root=he,_e},j.svgElem=function(N,...j){let X,ie;Array.isArray(j[0])?(X={},ie=j[0]):(X=j[0]||{},ie=j[1]);const se=Be.exec(N);if(!se||!se.groups)throw new Error("Bad use of h");const le=se.groups.tag||"div",he=document.createElementNS("http://www.w3.org/2000/svg",le);se.groups.id&&(he.id=se.groups.id);const ce=[];if(se.groups.class)for(const N of se.groups.class.split("."))""!==N&&ce.push(N);if(void 0!==X.className)for(const N of X.className.split("."))""!==N&&ce.push(N);ce.length>0&&(he.className=ce.join(" "));const _e={};if(se.groups.name&&(_e[se.groups.name]=he),ie)for(const N of ie)Q(N)?he.appendChild(N):"string"==typeof N?he.append(N):"root"in N&&(Object.assign(_e,N),he.appendChild(N.root));for(const[N,j]of Object.entries(X))if("className"!==N)if("style"===N)for(const[N,X]of Object.entries(j))he.style.setProperty(fe(N),"number"==typeof X?X+"px":""+X);else"tabIndex"===N?he.tabIndex=j:he.setAttribute(fe(N),j.toString());return _e.root=he,_e},j.copyAttributes=pe,j.trackAttributes=function(N,X,ie){pe(N,X,ie);const se=new we.DisposableStore;return se.add(j.sharedMutationObserver.observe(N,se,{attributes:!0,attributeFilter:ie})((j=>{for(const ie of j)"attributes"===ie.type&&ie.attributeName&&ge(N,X,ie.attributeName)}))),se};const ce=he(X(4333)),_e=X(7745),me=X(5394),ve=X(5964),Se=X(1758),be=X(9807),Ce=he(X(802)),ye=X(7883),we=X(7150),Ee=he(X(8163)),De=X(6304),Le=X(4693),Ae=X(7704);ie=function(){const N=new Map;(0,Le.ensureCodeWindow)(Le.mainWindow,1);const X={window:Le.mainWindow,disposables:new we.DisposableStore};N.set(Le.mainWindow.vscodeWindowId,X);const ie=new Ce.Emitter,se=new Ce.Emitter,le=new Ce.Emitter;return{onDidRegisterWindow:ie.event,onWillUnregisterWindow:le.event,onDidUnregisterWindow:se.event,registerWindow(X){if(N.has(X.vscodeWindowId))return we.Disposable.None;const he=new we.DisposableStore,ce={window:X,disposables:he.add(new we.DisposableStore)};return N.set(X.vscodeWindowId,ce),he.add((0,we.toDisposable)((()=>{N.delete(X.vscodeWindowId),se.fire(X)}))),he.add(C(X,j.EventType.BEFORE_UNLOAD,(()=>{le.fire(X)}))),ie.fire(ce),he},getWindows:()=>N.values(),getWindowsCount:()=>N.size,getWindowId:N=>N.vscodeWindowId,hasWindow:j=>N.has(j),getWindowById:function(j,ie){return("number"==typeof j?N.get(j):void 0)??(ie?X:void 0)},getWindow(N){const j=N;if(j?.ownerDocument?.defaultView)return j.ownerDocument.defaultView.window;const X=N;return X?.view?X.view.window:Le.mainWindow},getDocument(N){const X=N;return(0,j.getWindow)(X).document}}}(),j.registerWindow=ie.registerWindow,j.getWindow=ie.getWindow,j.getDocument=ie.getDocument,j.getWindows=ie.getWindows,j.getWindowsCount=ie.getWindowsCount,j.getWindowId=ie.getWindowId,j.getWindowById=ie.getWindowById,j.hasWindow=ie.hasWindow,j.onDidRegisterWindow=ie.onDidRegisterWindow,j.onWillUnregisterWindow=ie.onWillUnregisterWindow,j.onDidUnregisterWindow=ie.onDidUnregisterWindow;class b{constructor(N,j,X,ie){this._node=N,this._type=j,this._handler=X,this._options=ie||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function C(N,j,X,ie){return new b(N,j,X,ie)}function y(N,j){return function(X){return j(new ve.StandardMouseEvent(N,X))}}function w(N,X,ie){return C(N,Ee.isIOS&&_e.BrowserFeatures.pointerEvents?j.EventType.POINTER_DOWN:j.EventType.MOUSE_DOWN,X,ie)}function E(N,X,ie){return C(N,Ee.isIOS&&_e.BrowserFeatures.pointerEvents?j.EventType.POINTER_UP:j.EventType.MOUSE_UP,X,ie)}j.addStandardDisposableListener=function(N,X,ie,se){let le=ie;return"click"===X||"mousedown"===X||"contextmenu"===X?le=y((0,j.getWindow)(N),ie):"keydown"!==X&&"keypress"!==X&&"keyup"!==X||(le=function(N){return function(j){return N(new me.StandardKeyboardEvent(j))}}(ie)),C(N,X,le,se)},j.addStandardDisposableGenericMouseDownListener=function(N,X,ie){return w(N,y((0,j.getWindow)(N),X),ie)},j.addStandardDisposableGenericMouseUpListener=function(N,X,ie){return E(N,y((0,j.getWindow)(N),X),ie)};class D extends Se.AbstractIdleValue{constructor(N,j){super(N,j)}}j.WindowIdleValue=D;class L extends Se.IntervalTimer{constructor(N){super(),this.defaultTarget=N&&(0,j.getWindow)(N)}cancelAndSet(N,j,X){return super.cancelAndSet(N,j,X??this.defaultTarget)}}j.WindowIntervalTimer=L;class A{constructor(N,j=0){this._runner=N,this.priority=j,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(N){(0,be.onUnexpectedError)(N)}}static sort(N,j){return j.priority-N.priority}}!function(){const N=new Map,X=new Map,ie=new Map,se=new Map;j.scheduleAtNextAnimationFrame=(le,he,ce=0)=>{const _e=(0,j.getWindowId)(le),me=new A(he,ce);let ve=N.get(_e);return ve||(ve=[],N.set(_e,ve)),ve.push(me),ie.get(_e)||(ie.set(_e,!0),le.requestAnimationFrame((()=>(j=>{ie.set(j,!1);const le=N.get(j)??[];for(X.set(j,le),N.set(j,[]),se.set(j,!0);le.length>0;)le.sort(A.sort),le.shift().execute();se.set(j,!1)})(_e)))),me},j.runAtThisOrScheduleAtNextAnimationFrame=(N,ie,le)=>{const he=(0,j.getWindowId)(N);if(se.get(he)){const N=new A(ie,le);let j=X.get(he);return j||(j=[],X.set(he,j)),j.push(N),N}return(0,j.scheduleAtNextAnimationFrame)(N,ie,le)}}();const R=function(N,j){return j};class T extends we.Disposable{constructor(N,j,X,ie=R,se=8){super();let le=null,he=0;const ce=this._register(new Se.TimeoutTimer),l=()=>{he=(new Date).getTime(),X(le),le=null};this._register(C(N,j,(N=>{le=ie(le,N);const j=(new Date).getTime()-he;j>=se?(ce.cancel(),l()):ce.setIfNotSet(l,se-j)})))}}function k(N){return(0,j.getWindow)(N).getComputedStyle(N,null)}class M{static convertToPixels(N,j){return parseFloat(j)||0}static getDimension(N,j,X){const ie=k(N),se=ie?ie.getPropertyValue(j):"0";return M.convertToPixels(N,se)}static getBorderLeftWidth(N){return M.getDimension(N,"border-left-width","borderLeftWidth")}static getBorderRightWidth(N){return M.getDimension(N,"border-right-width","borderRightWidth")}static getBorderTopWidth(N){return M.getDimension(N,"border-top-width","borderTopWidth")}static getBorderBottomWidth(N){return M.getDimension(N,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(N){return M.getDimension(N,"padding-left","paddingLeft")}static getPaddingRight(N){return M.getDimension(N,"padding-right","paddingRight")}static getPaddingTop(N){return M.getDimension(N,"padding-top","paddingTop")}static getPaddingBottom(N){return M.getDimension(N,"padding-bottom","paddingBottom")}static getMarginLeft(N){return M.getDimension(N,"margin-left","marginLeft")}static getMarginTop(N){return M.getDimension(N,"margin-top","marginTop")}static getMarginRight(N){return M.getDimension(N,"margin-right","marginRight")}static getMarginBottom(N){return M.getDimension(N,"margin-bottom","marginBottom")}}class O{static{this.None=new O(0,0)}constructor(N,j){this.width=N,this.height=j}with(N=this.width,j=this.height){return N!==this.width||j!==this.height?new O(N,j):this}static is(N){return"object"==typeof N&&"number"==typeof N.height&&"number"==typeof N.width}static lift(N){return N instanceof O?N:new O(N.width,N.height)}static equals(N,j){return N===j||!(!N||!j)&&N.width===j.width&&N.height===j.height}}function I(N){let j=N.offsetParent,X=N.offsetTop,ie=N.offsetLeft;for(;null!==(N=N.parentNode)&&N!==N.ownerDocument.body&&N!==N.ownerDocument.documentElement;){X-=N.scrollTop;const se=W(N)?null:k(N);se&&(ie-="rtl"!==se.direction?N.scrollLeft:-N.scrollLeft),N===j&&(ie+=M.getBorderLeftWidth(N),X+=M.getBorderTopWidth(N),X+=N.offsetTop,ie+=N.offsetLeft,j=N.offsetParent)}return{left:ie,top:X}}function P(N){const j=M.getMarginLeft(N)+M.getMarginRight(N);return N.offsetWidth+j}function x(N){const j=M.getMarginLeft(N)+M.getMarginRight(N);return N.scrollWidth+j}function B(N,j){return Boolean(j?.contains(N))}j.Dimension=O;const Re="parentFlowToElementId";function U(N){const j=N.dataset[Re];return"string"==typeof j?N.ownerDocument.getElementById(j):null}function F(N,j,X){for(;N&&N.nodeType===N.ELEMENT_NODE;){if(N.classList.contains(j))return N;if(X)if("string"==typeof X){if(N.classList.contains(X))return null}else if(N===X)return null;N=N.parentNode}return null}function W(N){return N&&!!N.host&&!!N.mode}function H(N){for(;N.parentNode;){if(N===N.ownerDocument?.body)return null;N=N.parentNode}return W(N)?N:null}function K(){let N=z().activeElement;for(;N?.shadowRoot;)N=N.shadowRoot.activeElement;return N}function z(){return(0,j.getWindowsCount)()<=1?Le.mainWindow.document:Array.from((0,j.getWindows)()).map((({window:N})=>N.document)).find((N=>N.hasFocus()))??Le.mainWindow.document}const Te=new Map;class ${constructor(){this._currentCssStyle="",this._styleSheet=void 0}setStyle(N){N!==this._currentCssStyle&&(this._currentCssStyle=N,this._styleSheet?this._styleSheet.innerText=N:this._styleSheet=V(Le.mainWindow.document.head,(j=>j.innerText=N)))}dispose(){this._styleSheet&&(this._styleSheet.remove(),this._styleSheet=void 0)}}function V(N=Le.mainWindow.document.head,X,ie){const se=document.createElement("style");if(se.type="text/css",se.media="screen",X?.(se),N.appendChild(se),ie&&ie.add((0,we.toDisposable)((()=>se.remove()))),N===Le.mainWindow.document.head){const N=new Set;Te.set(se,N);for(const{window:X,disposables:le}of(0,j.getWindows)()){if(X===Le.mainWindow)continue;const j=le.add(G(se,N,X));ie?.add(j)}}return se}function G(N,X,ie){const se=new we.DisposableStore,le=N.cloneNode(!0);ie.document.head.appendChild(le),se.add((0,we.toDisposable)((()=>le.remove())));for(const j of Z(N))le.sheet?.insertRule(j.cssText,le.sheet?.cssRules.length);return se.add(j.sharedMutationObserver.observe(N,se,{childList:!0})((()=>{le.textContent=N.textContent}))),X.add(le),se.add((0,we.toDisposable)((()=>X.delete(le)))),se}function q(N,j=Le.mainWindow.document.head){const X=document.createElement(N);return j.appendChild(X),X}j.sharedMutationObserver=new class{constructor(){this.mutationObservers=new Map}observe(N,j,X){let ie=this.mutationObservers.get(N);ie||(ie=new Map,this.mutationObservers.set(N,ie));const se=(0,De.hash)(X);let le=ie.get(se);if(le)le.users+=1;else{const he=new Ce.Emitter,ce=new MutationObserver((N=>he.fire(N)));ce.observe(N,X);const _e=le={users:1,observer:ce,onDidMutate:he.event};j.add((0,we.toDisposable)((()=>{_e.users-=1,0===_e.users&&(he.dispose(),ce.disconnect(),ie?.delete(se),0===ie?.size&&this.mutationObservers.delete(N))}))),ie.set(se,le)}return le.onDidMutate}};let ke=null;function Y(){return ke||(ke=V()),ke}function Z(N){return N?.sheet?.rules?N.sheet.rules:N?.sheet?.cssRules?N.sheet.cssRules:[]}function J(N){return"string"==typeof N.selectorText}function Q(N){return N instanceof HTMLElement||N instanceof(0,j.getWindow)(N).HTMLElement}j.EventType={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:ce.isWebKit?"webkitAnimationStart":"animationstart",ANIMATION_END:ce.isWebKit?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:ce.isWebKit?"webkitAnimationIteration":"animationiteration"},j.EventHelper={stop:(N,j)=>(N.preventDefault(),j&&N.stopPropagation(),N)};class ee extends we.Disposable{static hasFocusWithin(N){if(Q(N)){const j=H(N);return B(j?j.activeElement:N.ownerDocument.activeElement,N)}{const j=N;return B(j.document.activeElement,j.document)}}constructor(N){super(),this._onDidFocus=this._register(new Ce.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new Ce.Emitter),this.onDidBlur=this._onDidBlur.event;let X=ee.hasFocusWithin(N),ie=!1;const r=()=>{ie=!1,X||(X=!0,this._onDidFocus.fire())},n=()=>{X&&(ie=!0,(Q(N)?(0,j.getWindow)(N):N).setTimeout((()=>{ie&&(ie=!1,X=!1,this._onDidBlur.fire())}),0))};this._refreshStateHandler=()=>{ee.hasFocusWithin(N)!==X&&(X?n():r())},this._register(C(N,j.EventType.FOCUS,r,!0)),this._register(C(N,j.EventType.BLUR,n,!0)),Q(N)&&(this._register(C(N,j.EventType.FOCUS_IN,(()=>this._refreshStateHandler()))),this._register(C(N,j.EventType.FOCUS_OUT,(()=>this._refreshStateHandler()))))}refreshState(){this._refreshStateHandler()}}function te(N,...j){if(N.append(...j),1===j.length&&"string"!=typeof j[0])return j[0]}const Me=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var Oe;function re(N,j,X,...ie){const se=Me.exec(j);if(!se)throw new Error("Bad use of emmet");const le=se[1]||"div";let he;return he=N!==Oe.HTML?document.createElementNS(N,le):document.createElement(le),se[3]&&(he.id=se[3]),se[4]&&(he.className=se[4].replace(/\./g," ").trim()),X&&Object.entries(X).forEach((([N,j])=>{void 0!==j&&(/^on\w+$/.test(N)?he[N]=j:"selected"===N?j&&he.setAttribute(N,"true"):he.setAttribute(N,j))})),he.append(...ie),he}function ne(N,j,...X){return re(Oe.HTML,N,j,...X)}function oe(...N){for(const j of N)j.style.display="",j.removeAttribute("aria-hidden")}function ae(...N){for(const j of N)j.style.display="none",j.setAttribute("aria-hidden","true")}!function(N){N.HTML="http://www.w3.org/1999/xhtml",N.SVG="http://www.w3.org/2000/svg"}(Oe||(j.Namespace=Oe={})),ne.SVG=function(N,j,...X){return re(Oe.SVG,N,j,...X)};const Ie=780,Pe=640;var xe;!function(N){N[N.DOCUMENT=1]="DOCUMENT",N[N.BROWSER=2]="BROWSER"}(xe||(j.DetectedFullscreenMode=xe={}));class de extends Ce.Emitter{constructor(){super(),this._subscriptions=new we.DisposableStore,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(Ce.Event.runAndSubscribe(j.onDidRegisterWindow,(({window:N,disposables:j})=>this.registerListeners(N,j)),{window:Le.mainWindow,disposables:this._subscriptions}))}registerListeners(N,j){j.add(C(N,"keydown",(N=>{if(N.defaultPrevented)return;const j=new me.StandardKeyboardEvent(N);if(j.keyCode!==ye.KeyCode.Alt||!N.repeat){if(N.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(N.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(N.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(N.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else{if(j.keyCode===ye.KeyCode.Alt)return;this._keyStatus.lastKeyPressed=void 0}this._keyStatus.altKey=N.altKey,this._keyStatus.ctrlKey=N.ctrlKey,this._keyStatus.metaKey=N.metaKey,this._keyStatus.shiftKey=N.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=N,this.fire(this._keyStatus))}}),!0)),j.add(C(N,"keyup",(N=>{N.defaultPrevented||(!N.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!N.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!N.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!N.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=N.altKey,this._keyStatus.ctrlKey=N.ctrlKey,this._keyStatus.metaKey=N.metaKey,this._keyStatus.shiftKey=N.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=N,this.fire(this._keyStatus)))}),!0)),j.add(C(N.document.body,"mousedown",(()=>{this._keyStatus.lastKeyPressed=void 0}),!0)),j.add(C(N.document.body,"mouseup",(()=>{this._keyStatus.lastKeyPressed=void 0}),!0)),j.add(C(N.document.body,"mousemove",(N=>{N.buttons&&(this._keyStatus.lastKeyPressed=void 0)}),!0)),j.add(C(N,"blur",(()=>{this.resetKeyStatus()})))}get keyStatus(){return this._keyStatus}get isModifierPressed(){return this._keyStatus.altKey||this._keyStatus.ctrlKey||this._keyStatus.metaKey||this._keyStatus.shiftKey}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return de.instance||(de.instance=new de),de.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}j.ModifierKeyEmitter=de;class ue extends we.Disposable{constructor(N,j){super(),this.element=N,this.callbacks=j,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(C(this.element,j.EventType.DRAG_START,(N=>{this.callbacks.onDragStart?.(N)}))),this.callbacks.onDrag&&this._register(C(this.element,j.EventType.DRAG,(N=>{this.callbacks.onDrag?.(N)}))),this._register(C(this.element,j.EventType.DRAG_ENTER,(N=>{this.counter++,this.dragStartTime=N.timeStamp,this.callbacks.onDragEnter?.(N)}))),this._register(C(this.element,j.EventType.DRAG_OVER,(N=>{N.preventDefault(),this.callbacks.onDragOver?.(N,N.timeStamp-this.dragStartTime)}))),this._register(C(this.element,j.EventType.DRAG_LEAVE,(N=>{this.counter--,0===this.counter&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(N))}))),this._register(C(this.element,j.EventType.DRAG_END,(N=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(N)}))),this._register(C(this.element,j.EventType.DROP,(N=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(N)})))}}j.DragAndDropObserver=ue;const Be=/(?[\w\-]+)?(?:#(?[\w\-]+))?(?(?:\.(?:[\w\-]+))*)(?:@(?(?:[\w\_])+))?/;function fe(N){return N.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function pe(N,j,X){for(const{name:ie,value:se}of N.attributes)X&&!X.includes(ie)||j.setAttribute(ie,se)}function ge(N,j,X){const ie=N.getAttribute(X);ie?j.setAttribute(X,ie):j.removeAttribute(X)}j.SafeTriangle=class{constructor(N,j,X){this.originX=N,this.originY=j,this.triangles=[];const{top:ie,left:se,right:le,bottom:he}=X.getBoundingClientRect(),ce=this.triangles;let _e=0;ce[_e++]=se,ce[_e++]=ie,ce[_e++]=le,ce[_e++]=ie,ce[_e++]=se,ce[_e++]=ie,ce[_e++]=se,ce[_e++]=he,ce[_e++]=le,ce[_e++]=ie,ce[_e++]=le,ce[_e++]=he,ce[_e++]=se,ce[_e++]=he,ce[_e++]=le,ce[_e++]=he}contains(N,j){const{triangles:X,originX:ie,originY:se}=this;for(let le=0;le<4;le++)if((0,Ae.isPointWithinTriangle)(N,j,ie,se,X[2*le],X[2*le+1],X[2*le+2],X[2*le+3]))return!0;return!1}}},9675:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.FastDomNode=void 0,j.createFastDomNode=function(N){return new i(N)};class i{constructor(N){this.domNode=N,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(N){const j=s(N);this._maxWidth!==j&&(this._maxWidth=j,this.domNode.style.maxWidth=this._maxWidth)}setWidth(N){const j=s(N);this._width!==j&&(this._width=j,this.domNode.style.width=this._width)}setHeight(N){const j=s(N);this._height!==j&&(this._height=j,this.domNode.style.height=this._height)}setTop(N){const j=s(N);this._top!==j&&(this._top=j,this.domNode.style.top=this._top)}setLeft(N){const j=s(N);this._left!==j&&(this._left=j,this.domNode.style.left=this._left)}setBottom(N){const j=s(N);this._bottom!==j&&(this._bottom=j,this.domNode.style.bottom=this._bottom)}setRight(N){const j=s(N);this._right!==j&&(this._right=j,this.domNode.style.right=this._right)}setPaddingTop(N){const j=s(N);this._paddingTop!==j&&(this._paddingTop=j,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(N){const j=s(N);this._paddingLeft!==j&&(this._paddingLeft=j,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(N){const j=s(N);this._paddingBottom!==j&&(this._paddingBottom=j,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(N){const j=s(N);this._paddingRight!==j&&(this._paddingRight=j,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(N){this._fontFamily!==N&&(this._fontFamily=N,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(N){this._fontWeight!==N&&(this._fontWeight=N,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(N){const j=s(N);this._fontSize!==j&&(this._fontSize=j,this.domNode.style.fontSize=this._fontSize)}setFontStyle(N){this._fontStyle!==N&&(this._fontStyle=N,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(N){this._fontFeatureSettings!==N&&(this._fontFeatureSettings=N,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(N){this._fontVariationSettings!==N&&(this._fontVariationSettings=N,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(N){this._textDecoration!==N&&(this._textDecoration=N,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(N){const j=s(N);this._lineHeight!==j&&(this._lineHeight=j,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(N){const j=s(N);this._letterSpacing!==j&&(this._letterSpacing=j,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(N){this._className!==N&&(this._className=N,this.domNode.className=this._className)}toggleClassName(N,j){this.domNode.classList.toggle(N,j),this._className=this.domNode.className}setDisplay(N){this._display!==N&&(this._display=N,this.domNode.style.display=this._display)}setPosition(N){this._position!==N&&(this._position=N,this.domNode.style.position=this._position)}setVisibility(N){this._visibility!==N&&(this._visibility=N,this.domNode.style.visibility=this._visibility)}setColor(N){this._color!==N&&(this._color=N,this.domNode.style.color=this._color)}setBackgroundColor(N){this._backgroundColor!==N&&(this._backgroundColor=N,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(N){this._layerHint!==N&&(this._layerHint=N,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(N){this._boxShadow!==N&&(this._boxShadow=N,this.domNode.style.boxShadow=N)}setContain(N){this._contain!==N&&(this._contain=N,this.domNode.style.contain=this._contain)}setAttribute(N,j){this.domNode.setAttribute(N,j)}removeAttribute(N){this.domNode.removeAttribute(N)}appendChild(N){this.domNode.appendChild(N.domNode)}removeChild(N){this.domNode.removeChild(N.domNode)}}function s(N){return"number"==typeof N?`${N}px`:N}j.FastDomNode=i},8328:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.GlobalPointerMoveMonitor=void 0;const he=le(X(7093)),ce=X(7150);j.GlobalPointerMoveMonitor=class{constructor(){this._hooks=new ce.DisposableStore,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(N,j){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;const X=this._onStopCallback;this._onStopCallback=null,N&&X&&X(j)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(N,j,X,ie,se){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=ie,this._onStopCallback=se;let le=N;try{N.setPointerCapture(j),this._hooks.add((0,ce.toDisposable)((()=>{try{N.releasePointerCapture(j)}catch(N){}})))}catch(j){le=he.getWindow(N)}this._hooks.add(he.addDisposableListener(le,he.EventType.POINTER_MOVE,(N=>{N.buttons===X?(N.preventDefault(),this._pointerMoveCallback(N)):this.stopMonitoring(!0)}))),this._hooks.add(he.addDisposableListener(le,he.EventType.POINTER_UP,(N=>this.stopMonitoring(!0))))}}},6609:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.IframeUtils=void 0,j.parentOriginHash=async function(N,j){if(!crypto.subtle)throw new Error("'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");const X=JSON.stringify({parentOrigin:N,salt:j}),ie=(new TextEncoder).encode(X);return function(N){const j=Array.from(new Uint8Array(N)).map((N=>N.toString(16).padStart(2,"0"))).join("");return BigInt(`0x${j}`).toString(32).padStart(52,"0")}(await crypto.subtle.digest("sha-256",ie))};const X=new WeakMap;function s(N){if(!N.parent||N.parent===N)return null;try{const j=N.location,X=N.parent.location;if("null"!==j.origin&&"null"!==X.origin&&j.origin!==X.origin)return null}catch(N){return null}return N.parent}j.IframeUtils=class{static getSameOriginWindowChain(N){let j=X.get(N);if(!j){j=[],X.set(N,j);let ie,se=N;do{ie=s(se),ie?j.push({window:new WeakRef(se),iframeElement:se.frameElement||null}):j.push({window:new WeakRef(se),iframeElement:null}),se=ie}while(se)}return j.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(N,j){if(!j||N===j)return{top:0,left:0};let X=0,ie=0;const se=this.getSameOriginWindowChain(N);for(const N of se){const se=N.window.deref();if(X+=se?.scrollY??0,ie+=se?.scrollX??0,se===j)break;if(!N.iframeElement)break;const le=N.iframeElement.getBoundingClientRect();X+=le.top,ie+=le.left}return{top:X,left:ie}}}},5394:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.StandardKeyboardEvent=void 0,j.printKeyboardEvent=function(N){const j=[];return N.ctrlKey&&j.push("ctrl"),N.shiftKey&&j.push("shift"),N.altKey&&j.push("alt"),N.metaKey&&j.push("meta"),`modifiers: [${j.join(",")}], code: ${N.code}, keyCode: ${N.keyCode}, key: ${N.key}`},j.printStandardKeyboardEvent=function(N){const j=[];return N.ctrlKey&&j.push("ctrl"),N.shiftKey&&j.push("shift"),N.altKey&&j.push("alt"),N.metaKey&&j.push("meta"),`modifiers: [${j.join(",")}], code: ${N.code}, keyCode: ${N.keyCode} ('${ce.KeyCodeUtils.toString(N.keyCode)}')`};const he=le(X(4333)),ce=X(7883),_e=X(2811),me=le(X(8163)),ve=me.isMacintosh?ce.KeyMod.WinCtrl:ce.KeyMod.CtrlCmd,Se=ce.KeyMod.Alt,be=ce.KeyMod.Shift,Ce=me.isMacintosh?ce.KeyMod.CtrlCmd:ce.KeyMod.WinCtrl;j.StandardKeyboardEvent=class{constructor(N){this._standardKeyboardEventBrand=!0;const j=N;this.browserEvent=j,this.target=j.target,this.ctrlKey=j.ctrlKey,this.shiftKey=j.shiftKey,this.altKey=j.altKey,this.metaKey=j.metaKey,this.altGraphKey=j.getModifierState?.("AltGraph"),this.keyCode=function(N){if(N.charCode){const j=String.fromCharCode(N.charCode).toUpperCase();return ce.KeyCodeUtils.fromString(j)}const j=N.keyCode;if(3===j)return ce.KeyCode.PauseBreak;if(he.isFirefox)switch(j){case 59:return ce.KeyCode.Semicolon;case 60:if(me.isLinux)return ce.KeyCode.IntlBackslash;break;case 61:return ce.KeyCode.Equal;case 107:return ce.KeyCode.NumpadAdd;case 109:return ce.KeyCode.NumpadSubtract;case 173:return ce.KeyCode.Minus;case 224:if(me.isMacintosh)return ce.KeyCode.Meta}else if(he.isWebKit){if(me.isMacintosh&&93===j)return ce.KeyCode.Meta;if(!me.isMacintosh&&92===j)return ce.KeyCode.Meta}return ce.EVENT_KEY_CODE_MAP[j]||ce.KeyCode.Unknown}(j),this.code=j.code,this.ctrlKey=this.ctrlKey||this.keyCode===ce.KeyCode.Ctrl,this.altKey=this.altKey||this.keyCode===ce.KeyCode.Alt,this.shiftKey=this.shiftKey||this.keyCode===ce.KeyCode.Shift,this.metaKey=this.metaKey||this.keyCode===ce.KeyCode.Meta,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(N){return this._asKeybinding===N}_computeKeybinding(){let N=ce.KeyCode.Unknown;this.keyCode!==ce.KeyCode.Ctrl&&this.keyCode!==ce.KeyCode.Shift&&this.keyCode!==ce.KeyCode.Alt&&this.keyCode!==ce.KeyCode.Meta&&(N=this.keyCode);let j=0;return this.ctrlKey&&(j|=ve),this.altKey&&(j|=Se),this.shiftKey&&(j|=be),this.metaKey&&(j|=Ce),j|=N,j}_computeKeyCodeChord(){let N=ce.KeyCode.Unknown;return this.keyCode!==ce.KeyCode.Ctrl&&this.keyCode!==ce.KeyCode.Shift&&this.keyCode!==ce.KeyCode.Alt&&this.keyCode!==ce.KeyCode.Meta&&(N=this.keyCode),new _e.KeyCodeChord(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,N)}}},5964:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.StandardWheelEvent=j.DragMouseEvent=j.StandardMouseEvent=void 0;const he=le(X(4333)),ce=X(6609),_e=le(X(8163));class h{constructor(N,j){this.timestamp=Date.now(),this.browserEvent=j,this.leftButton=0===j.button,this.middleButton=1===j.button,this.rightButton=2===j.button,this.buttons=j.buttons,this.target=j.target,this.detail=j.detail||1,"dblclick"===j.type&&(this.detail=2),this.ctrlKey=j.ctrlKey,this.shiftKey=j.shiftKey,this.altKey=j.altKey,this.metaKey=j.metaKey,"number"==typeof j.pageX?(this.posx=j.pageX,this.posy=j.pageY):(this.posx=j.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=j.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);const X=ce.IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(N,j.view);this.posx-=X.left,this.posy-=X.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}}j.StandardMouseEvent=h,j.DragMouseEvent=class extends h{constructor(N,j){super(N,j),this.dataTransfer=j.dataTransfer}},j.StandardWheelEvent=class{constructor(N,j=0,X=0){this.browserEvent=N||null,this.target=N?N.target||N.targetNode||N.srcElement:null,this.deltaY=X,this.deltaX=j;let ie=!1;if(he.isChrome){const N=navigator.userAgent.match(/Chrome\/(\d+)/);ie=(N?parseInt(N[1]):123)<=122}if(N){const j=N,X=N,se=N.view?.devicePixelRatio||1;if(void 0!==j.wheelDeltaY)this.deltaY=ie?j.wheelDeltaY/(120*se):j.wheelDeltaY/120;else if(void 0!==X.VERTICAL_AXIS&&X.axis===X.VERTICAL_AXIS)this.deltaY=-X.detail/3;else if("wheel"===N.type){const j=N;j.deltaMode===j.DOM_DELTA_LINE?he.isFirefox&&!_e.isMacintosh?this.deltaY=-N.deltaY/3:this.deltaY=-N.deltaY:this.deltaY=-N.deltaY/40}if(void 0!==j.wheelDeltaX)he.isSafari&&_e.isWindows?this.deltaX=-j.wheelDeltaX/120:this.deltaX=ie?j.wheelDeltaX/(120*se):j.wheelDeltaX/120;else if(void 0!==X.HORIZONTAL_AXIS&&X.axis===X.HORIZONTAL_AXIS)this.deltaX=-N.detail/3;else if("wheel"===N.type){const j=N;j.deltaMode===j.DOM_DELTA_LINE?he.isFirefox&&!_e.isMacintosh?this.deltaX=-N.deltaX/3:this.deltaX=-N.deltaX:this.deltaX=-N.deltaX/40}0===this.deltaY&&0===this.deltaX&&N.wheelDelta&&(this.deltaY=ie?N.wheelDelta/(120*se):N.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}}},8594:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__decorate||function(N,j,X,ie){var se,le=arguments.length,he=le<3?j:null===ie?ie=Object.getOwnPropertyDescriptor(j,X):ie;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)he=Reflect.decorate(N,j,X,ie);else for(var ce=N.length-1;ce>=0;ce--)(se=N[ce])&&(he=(le<3?se(he):le>3?se(j,X,he):se(j,X))||he);return le>3&&he&&Object.defineProperty(j,X,he),he},he=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.Gesture=j.EventType=void 0;const ce=he(X(7093)),_e=X(4693),me=he(X(3058)),ve=X(4838),Se=X(802),be=X(7150),Ce=X(6317);var ye;!function(N){N.Tap="-xterm-gesturetap",N.Change="-xterm-gesturechange",N.Start="-xterm-gesturestart",N.End="-xterm-gesturesend",N.Contextmenu="-xterm-gesturecontextmenu"}(ye||(j.EventType=ye={}));class p extends be.Disposable{static{this.SCROLL_FRICTION=-.005}static{this.HOLD_DELAY=700}static{this.CLEAR_TAP_COUNT_TIME=400}constructor(){super(),this.dispatched=!1,this.targets=new Ce.LinkedList,this.ignoreTargets=new Ce.LinkedList,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Se.Event.runAndSubscribe(ce.onDidRegisterWindow,(({window:N,disposables:j})=>{j.add(ce.addDisposableListener(N.document,"touchstart",(N=>this.onTouchStart(N)),{passive:!1})),j.add(ce.addDisposableListener(N.document,"touchend",(j=>this.onTouchEnd(N,j)))),j.add(ce.addDisposableListener(N.document,"touchmove",(N=>this.onTouchMove(N)),{passive:!1}))}),{window:_e.mainWindow,disposables:this._store}))}static addTarget(N){if(!p.isTouchDevice())return be.Disposable.None;p.INSTANCE||(p.INSTANCE=(0,be.markAsSingleton)(new p));const j=p.INSTANCE.targets.push(N);return(0,be.toDisposable)(j)}static ignoreTarget(N){if(!p.isTouchDevice())return be.Disposable.None;p.INSTANCE||(p.INSTANCE=(0,be.markAsSingleton)(new p));const j=p.INSTANCE.ignoreTargets.push(N);return(0,be.toDisposable)(j)}static isTouchDevice(){return"ontouchstart"in _e.mainWindow||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(N){const j=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let X=0,ie=N.targetTouches.length;X=p.HOLD_DELAY&&Math.abs(he.initialPageX-me.tail(he.rollingPageX))<30&&Math.abs(he.initialPageY-me.tail(he.rollingPageY))<30){const N=this.newGestureEvent(ye.Contextmenu,he.initialTarget);N.pageX=me.tail(he.rollingPageX),N.pageY=me.tail(he.rollingPageY),this.dispatchEvent(N)}else if(1===ie){const j=me.tail(he.rollingPageX),ie=me.tail(he.rollingPageY),se=me.tail(he.rollingTimestamps)-he.rollingTimestamps[0],le=j-he.rollingPageX[0],ce=ie-he.rollingPageY[0],_e=[...this.targets].filter((N=>he.initialTarget instanceof Node&&N.contains(he.initialTarget)));this.inertia(N,_e,X,Math.abs(le)/se,le>0?1:-1,j,Math.abs(ce)/se,ce>0?1:-1,ie)}this.dispatchEvent(this.newGestureEvent(ye.End,he.initialTarget)),delete this.activeTouches[le.identifier]}this.dispatched&&(j.preventDefault(),j.stopPropagation(),this.dispatched=!1)}newGestureEvent(N,j){const X=document.createEvent("CustomEvent");return X.initEvent(N,!1,!0),X.initialTarget=j,X.tapCount=0,X}dispatchEvent(N){if(N.type===ye.Tap){const j=(new Date).getTime();let X=0;X=j-this._lastSetTapCountTime>p.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=j,N.tapCount=X}else N.type!==ye.Change&&N.type!==ye.Contextmenu||(this._lastSetTapCountTime=0);if(N.initialTarget instanceof Node){for(const j of this.ignoreTargets)if(j.contains(N.initialTarget))return;const j=[];for(const X of this.targets)if(X.contains(N.initialTarget)){let ie=0,se=N.initialTarget;for(;se&&se!==X;)ie++,se=se.parentElement;j.push([ie,X])}j.sort(((N,j)=>N[0]-j[0]));for(const[X,ie]of j)ie.dispatchEvent(N),this.dispatched=!0}}inertia(N,j,X,ie,se,le,he,_e,me){this.handle=ce.scheduleAtNextAnimationFrame(N,(()=>{const ce=Date.now(),ve=ce-X;let Se=0,be=0,Ce=!0;ie+=p.SCROLL_FRICTION*ve,he+=p.SCROLL_FRICTION*ve,ie>0&&(Ce=!1,Se=se*ie*ve),he>0&&(Ce=!1,be=_e*he*ve);const we=this.newGestureEvent(ye.Change);we.translationX=Se,we.translationY=be,j.forEach((N=>N.dispatchEvent(we))),Ce||this.inertia(N,j,ce,ie,se,le+Se,he,_e,me+be)}))}onTouchMove(N){const j=Date.now();for(let X=0,ie=N.changedTouches.length;X3&&(se.rollingPageX.shift(),se.rollingPageY.shift(),se.rollingTimestamps.shift()),se.rollingPageX.push(ie.pageX),se.rollingPageY.push(ie.pageY),se.rollingTimestamps.push(j)}this.dispatched&&(N.preventDefault(),N.stopPropagation(),this.dispatched=!1)}}j.Gesture=p,le([ve.memoize],p,"isTouchDevice",null)},8801:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.AbstractScrollbar=void 0;const he=le(X(7093)),ce=X(9675),_e=X(8328),me=X(8974),ve=X(79),Se=X(8286),be=le(X(8163));class _ extends Se.Widget{constructor(N){super(),this._lazyRender=N.lazyRender,this._host=N.host,this._scrollable=N.scrollable,this._scrollByPage=N.scrollByPage,this._scrollbarState=N.scrollbarState,this._visibilityController=this._register(new ve.ScrollbarVisibilityController(N.visibility,"visible scrollbar "+N.extraScrollbarClassName,"invisible scrollbar "+N.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new _e.GlobalPointerMoveMonitor),this._shouldRender=!0,this.domNode=(0,ce.createFastDomNode)(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(he.addDisposableListener(this.domNode.domNode,he.EventType.POINTER_DOWN,(N=>this._domNodePointerDown(N))))}_createArrow(N){const j=this._register(new me.ScrollbarArrow(N));this.domNode.domNode.appendChild(j.bgDomNode),this.domNode.domNode.appendChild(j.domNode)}_createSlider(N,j,X,ie){this.slider=(0,ce.createFastDomNode)(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(N),this.slider.setLeft(j),"number"==typeof X&&this.slider.setWidth(X),"number"==typeof ie&&this.slider.setHeight(ie),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(he.addDisposableListener(this.slider.domNode,he.EventType.POINTER_DOWN,(N=>{0===N.button&&(N.preventDefault(),this._sliderPointerDown(N))}))),this.onclick(this.slider.domNode,(N=>{N.leftButton&&N.stopPropagation()}))}_onElementSize(N){return this._scrollbarState.setVisibleSize(N)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(N){return this._scrollbarState.setScrollSize(N)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(N){return this._scrollbarState.setScrollPosition(N)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(N){N.target===this.domNode.domNode&&this._onPointerDown(N)}delegatePointerDown(N){const j=this.domNode.domNode.getClientRects()[0].top,X=j+this._scrollbarState.getSliderPosition(),ie=j+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),se=this._sliderPointerPosition(N);X<=se&&se<=ie?0===N.button&&(N.preventDefault(),this._sliderPointerDown(N)):this._onPointerDown(N)}_onPointerDown(N){let j,X;if(N.target===this.domNode.domNode&&"number"==typeof N.offsetX&&"number"==typeof N.offsetY)j=N.offsetX,X=N.offsetY;else{const ie=he.getDomNodePagePosition(this.domNode.domNode);j=N.pageX-ie.left,X=N.pageY-ie.top}const ie=this._pointerDownRelativePosition(j,X);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(ie):this._scrollbarState.getDesiredScrollPositionFromOffset(ie)),0===N.button&&(N.preventDefault(),this._sliderPointerDown(N))}_sliderPointerDown(N){if(!(N.target&&N.target instanceof Element))return;const j=this._sliderPointerPosition(N),X=this._sliderOrthogonalPointerPosition(N),ie=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(N.target,N.pointerId,N.buttons,(N=>{const se=this._sliderOrthogonalPointerPosition(N),le=Math.abs(se-X);if(be.isWindows&&le>140)return void this._setDesiredScrollPositionNow(ie.getScrollPosition());const he=this._sliderPointerPosition(N)-j;this._setDesiredScrollPositionNow(ie.getDesiredScrollPositionFromDelta(he))}),(()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()})),this._host.onDragStart()}_setDesiredScrollPositionNow(N){const j={};this.writeScrollPosition(j,N),this._scrollable.setScrollPositionNow(j)}updateScrollbarSize(N){this._updateScrollbarSize(N),this._scrollbarState.setScrollbarSize(N),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}j.AbstractScrollbar=_},151:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.HorizontalScrollbar=void 0;const ie=X(8801),se=X(8245),le=X(9881);class o extends ie.AbstractScrollbar{constructor(N,j,X){const ie=N.getScrollDimensions(),he=N.getCurrentScrollPosition();if(super({lazyRender:j.lazyRender,host:X,scrollbarState:new se.ScrollbarState(j.horizontalHasArrows?j.arrowSize:0,j.horizontal===le.ScrollbarVisibility.Hidden?0:j.horizontalScrollbarSize,j.vertical===le.ScrollbarVisibility.Hidden?0:j.verticalScrollbarSize,ie.width,ie.scrollWidth,he.scrollLeft),visibility:j.horizontal,extraScrollbarClassName:"horizontal",scrollable:N,scrollByPage:j.scrollByPage}),j.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((j.horizontalScrollbarSize-j.horizontalSliderSize)/2),0,void 0,j.horizontalSliderSize)}_updateSlider(N,j){this.slider.setWidth(N),this.slider.setLeft(j)}_renderDomNode(N,j){this.domNode.setWidth(N),this.domNode.setHeight(j),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(N){return this._shouldRender=this._onElementScrollSize(N.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(N.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(N.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(N,j){return N}_sliderPointerPosition(N){return N.pageX}_sliderOrthogonalPointerPosition(N){return N.pageY}_updateScrollbarSize(N){this.slider.setHeight(N)}writeScrollPosition(N,j){N.scrollLeft=j}updateOptions(N){this.updateScrollbarSize(N.horizontal===le.ScrollbarVisibility.Hidden?0:N.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(N.vertical===le.ScrollbarVisibility.Hidden?0:N.verticalScrollbarSize),this._visibilityController.setVisibility(N.horizontal),this._scrollByPage=N.scrollByPage}}j.HorizontalScrollbar=o},8234:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.DomScrollableElement=j.SmoothScrollableElement=j.ScrollableElement=j.AbstractScrollableElement=j.MouseWheelClassifier=void 0;const he=X(4333),ce=le(X(7093)),_e=X(9675),me=X(5964),ve=X(151),Se=X(5473),be=X(8286),Ce=X(1758),ye=X(802),we=X(7150),Ee=le(X(8163)),De=X(9881);class v{constructor(N,j,X){this.timestamp=N,this.deltaX=j,this.deltaY=X,this.score=0}}class S{static{this.INSTANCE=new S}constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let N=1,j=0,X=1,ie=this._rear;for(;;){const se=ie===this._front?N:Math.pow(2,-X);if(N-=se,j+=this._memory[ie].score*se,ie===this._front)break;ie=(this._capacity+ie-1)%this._capacity,X++}return j<=.5}acceptStandardWheelEvent(N){if(he.isChrome){const j=ce.getWindow(N.browserEvent),X=(0,he.getZoomFactor)(j);this.accept(Date.now(),N.deltaX*X,N.deltaY*X)}else this.accept(Date.now(),N.deltaX,N.deltaY)}accept(N,j,X){let ie=null;const se=new v(N,j,X);-1===this._front&&-1===this._rear?(this._memory[0]=se,this._front=0,this._rear=0):(ie=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=se),se.score=this._computeScore(se,ie)}_computeScore(N,j){if(Math.abs(N.deltaX)>0&&Math.abs(N.deltaY)>0)return 1;let X=.5;if(this._isAlmostInt(N.deltaX)&&this._isAlmostInt(N.deltaY)||(X+=.25),j){const ie=Math.abs(N.deltaX),se=Math.abs(N.deltaY),le=Math.abs(j.deltaX),he=Math.abs(j.deltaY),ce=Math.max(Math.min(ie,le),1),_e=Math.max(Math.min(se,he),1),me=Math.max(ie,le),ve=Math.max(se,he);me%ce==0&&ve%_e==0&&(X-=.5)}return Math.min(Math.max(X,0),1)}_isAlmostInt(N){return Math.abs(Math.round(N)-N)<.01}}j.MouseWheelClassifier=S;class b extends be.Widget{get options(){return this._options}constructor(N,j,X){super(),this._onScroll=this._register(new ye.Emitter),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ye.Emitter),this.onWillScroll=this._onWillScroll.event,this._options=function(N){const j={lazyRender:void 0!==N.lazyRender&&N.lazyRender,className:void 0!==N.className?N.className:"",useShadows:void 0===N.useShadows||N.useShadows,handleMouseWheel:void 0===N.handleMouseWheel||N.handleMouseWheel,flipAxes:void 0!==N.flipAxes&&N.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:void 0!==N.consumeMouseWheelIfScrollbarIsNeeded&&N.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:void 0!==N.alwaysConsumeMouseWheel&&N.alwaysConsumeMouseWheel,scrollYToX:void 0!==N.scrollYToX&&N.scrollYToX,mouseWheelScrollSensitivity:void 0!==N.mouseWheelScrollSensitivity?N.mouseWheelScrollSensitivity:1,fastScrollSensitivity:void 0!==N.fastScrollSensitivity?N.fastScrollSensitivity:5,scrollPredominantAxis:void 0===N.scrollPredominantAxis||N.scrollPredominantAxis,mouseWheelSmoothScroll:void 0===N.mouseWheelSmoothScroll||N.mouseWheelSmoothScroll,arrowSize:void 0!==N.arrowSize?N.arrowSize:11,listenOnDomNode:void 0!==N.listenOnDomNode?N.listenOnDomNode:null,horizontal:void 0!==N.horizontal?N.horizontal:De.ScrollbarVisibility.Auto,horizontalScrollbarSize:void 0!==N.horizontalScrollbarSize?N.horizontalScrollbarSize:10,horizontalSliderSize:void 0!==N.horizontalSliderSize?N.horizontalSliderSize:0,horizontalHasArrows:void 0!==N.horizontalHasArrows&&N.horizontalHasArrows,vertical:void 0!==N.vertical?N.vertical:De.ScrollbarVisibility.Auto,verticalScrollbarSize:void 0!==N.verticalScrollbarSize?N.verticalScrollbarSize:10,verticalHasArrows:void 0!==N.verticalHasArrows&&N.verticalHasArrows,verticalSliderSize:void 0!==N.verticalSliderSize?N.verticalSliderSize:0,scrollByPage:void 0!==N.scrollByPage&&N.scrollByPage};return j.horizontalSliderSize=void 0!==N.horizontalSliderSize?N.horizontalSliderSize:j.horizontalScrollbarSize,j.verticalSliderSize=void 0!==N.verticalSliderSize?N.verticalSliderSize:j.verticalScrollbarSize,Ee.isMacintosh&&(j.className+=" mac"),j}(j),this._scrollable=X,this._register(this._scrollable.onScroll((N=>{this._onWillScroll.fire(N),this._onDidScroll(N),this._onScroll.fire(N)})));const ie={onMouseWheel:N=>this._onMouseWheel(N),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Se.VerticalScrollbar(this._scrollable,this._options,ie)),this._horizontalScrollbar=this._register(new ve.HorizontalScrollbar(this._scrollable,this._options,ie)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(N),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=(0,_e.createFastDomNode)(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=(0,_e.createFastDomNode)(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=(0,_e.createFastDomNode)(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,(N=>this._onMouseOver(N))),this.onmouseleave(this._listenOnDomNode,(N=>this._onMouseLeave(N))),this._hideTimeout=this._register(new Ce.TimeoutTimer),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=(0,we.dispose)(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(N){this._verticalScrollbar.delegatePointerDown(N)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(N){this._scrollable.setScrollDimensions(N,!1)}updateClassName(N){this._options.className=N,Ee.isMacintosh&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(N){void 0!==N.handleMouseWheel&&(this._options.handleMouseWheel=N.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),void 0!==N.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=N.mouseWheelScrollSensitivity),void 0!==N.fastScrollSensitivity&&(this._options.fastScrollSensitivity=N.fastScrollSensitivity),void 0!==N.scrollPredominantAxis&&(this._options.scrollPredominantAxis=N.scrollPredominantAxis),void 0!==N.horizontal&&(this._options.horizontal=N.horizontal),void 0!==N.vertical&&(this._options.vertical=N.vertical),void 0!==N.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=N.horizontalScrollbarSize),void 0!==N.verticalScrollbarSize&&(this._options.verticalScrollbarSize=N.verticalScrollbarSize),void 0!==N.scrollByPage&&(this._options.scrollByPage=N.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(N){this._revealOnScroll=N}delegateScrollFromMouseWheelEvent(N){this._onMouseWheel(new me.StandardWheelEvent(N))}_setListeningToMouseWheel(N){if(this._mouseWheelToDispose.length>0!==N&&(this._mouseWheelToDispose=(0,we.dispose)(this._mouseWheelToDispose),N)){const e=N=>{this._onMouseWheel(new me.StandardWheelEvent(N))};this._mouseWheelToDispose.push(ce.addDisposableListener(this._listenOnDomNode,ce.EventType.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(N){if(N.browserEvent?.defaultPrevented)return;const j=S.INSTANCE;j.acceptStandardWheelEvent(N);let X=!1;if(N.deltaY||N.deltaX){let ie=N.deltaY*this._options.mouseWheelScrollSensitivity,se=N.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&se+ie===0?se=ie=0:Math.abs(ie)>=Math.abs(se)?se=0:ie=0),this._options.flipAxes&&([ie,se]=[se,ie]);const le=!Ee.isMacintosh&&N.browserEvent&&N.browserEvent.shiftKey;!this._options.scrollYToX&&!le||se||(se=ie,ie=0),N.browserEvent&&N.browserEvent.altKey&&(se*=this._options.fastScrollSensitivity,ie*=this._options.fastScrollSensitivity);const he=this._scrollable.getFutureScrollPosition();let ce={};if(ie){const N=50*ie,j=he.scrollTop-(N<0?Math.floor(N):Math.ceil(N));this._verticalScrollbar.writeScrollPosition(ce,j)}if(se){const N=50*se,j=he.scrollLeft-(N<0?Math.floor(N):Math.ceil(N));this._horizontalScrollbar.writeScrollPosition(ce,j)}ce=this._scrollable.validateScrollPosition(ce),(he.scrollLeft!==ce.scrollLeft||he.scrollTop!==ce.scrollTop)&&(this._options.mouseWheelSmoothScroll&&j.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(ce):this._scrollable.setScrollPositionNow(ce),X=!0)}let ie=X;!ie&&this._options.alwaysConsumeMouseWheel&&(ie=!0),!ie&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(ie=!0),ie&&(N.preventDefault(),N.stopPropagation())}_onDidScroll(N){this._shouldRender=this._horizontalScrollbar.onDidScroll(N)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(N)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const N=this._scrollable.getCurrentScrollPosition(),j=N.scrollTop>0,X=N.scrollLeft>0,ie=X?" left":"",se=j?" top":"",le=X||j?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${ie}`),this._topShadowDomNode.setClassName(`shadow${se}`),this._topLeftShadowDomNode.setClassName(`shadow${le}${se}${ie}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(N){this._mouseIsOver=!1,this._hide()}_onMouseOver(N){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet((()=>this._hide()),500)}}j.AbstractScrollableElement=b,j.ScrollableElement=class extends b{constructor(N,j){(j=j||{}).mouseWheelSmoothScroll=!1;const X=new De.Scrollable({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:j=>ce.scheduleAtNextAnimationFrame(ce.getWindow(N),j)});super(N,j,X),this._register(X)}setScrollPosition(N){this._scrollable.setScrollPositionNow(N)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},j.SmoothScrollableElement=class extends b{constructor(N,j,X){super(N,j,X)}setScrollPosition(N){N.reuseAnimation?this._scrollable.setScrollPositionSmooth(N,N.reuseAnimation):this._scrollable.setScrollPositionNow(N)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},j.DomScrollableElement=class extends b{constructor(N,j){(j=j||{}).mouseWheelSmoothScroll=!1;const X=new De.Scrollable({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:j=>ce.scheduleAtNextAnimationFrame(ce.getWindow(N),j)});super(N,j,X),this._register(X),this._element=N,this._register(this.onScroll((N=>{N.scrollTopChanged&&(this._element.scrollTop=N.scrollTop),N.scrollLeftChanged&&(this._element.scrollLeft=N.scrollLeft)}))),this.scanDomNode()}setScrollPosition(N){this._scrollable.setScrollPositionNow(N)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}},8974:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.ScrollbarArrow=j.ARROW_IMG_SIZE=void 0;const he=X(8328),ce=X(8286),_e=X(1758),me=le(X(7093));j.ARROW_IMG_SIZE=11;class c extends ce.Widget{constructor(N){super(),this._onActivate=N.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=N.bgWidth+"px",this.bgDomNode.style.height=N.bgHeight+"px",void 0!==N.top&&(this.bgDomNode.style.top="0px"),void 0!==N.left&&(this.bgDomNode.style.left="0px"),void 0!==N.bottom&&(this.bgDomNode.style.bottom="0px"),void 0!==N.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=N.className,this.domNode.style.position="absolute",this.domNode.style.width=j.ARROW_IMG_SIZE+"px",this.domNode.style.height=j.ARROW_IMG_SIZE+"px",void 0!==N.top&&(this.domNode.style.top=N.top+"px"),void 0!==N.left&&(this.domNode.style.left=N.left+"px"),void 0!==N.bottom&&(this.domNode.style.bottom=N.bottom+"px"),void 0!==N.right&&(this.domNode.style.right=N.right+"px"),this._pointerMoveMonitor=this._register(new he.GlobalPointerMoveMonitor),this._register(me.addStandardDisposableListener(this.bgDomNode,me.EventType.POINTER_DOWN,(N=>this._arrowPointerDown(N)))),this._register(me.addStandardDisposableListener(this.domNode,me.EventType.POINTER_DOWN,(N=>this._arrowPointerDown(N)))),this._pointerdownRepeatTimer=this._register(new me.WindowIntervalTimer),this._pointerdownScheduleRepeatTimer=this._register(new _e.TimeoutTimer)}_arrowPointerDown(N){N.target&&N.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet((()=>{this._pointerdownRepeatTimer.cancelAndSet((()=>this._onActivate()),1e3/24,me.getWindow(N))}),200),this._pointerMoveMonitor.startMonitoring(N.target,N.pointerId,N.buttons,(N=>{}),(()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()})),N.preventDefault())}}j.ScrollbarArrow=c},8245:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ScrollbarState=void 0;class i{constructor(N,j,X,ie,se,le){this._scrollbarSize=Math.round(j),this._oppositeScrollbarSize=Math.round(X),this._arrowSize=Math.round(N),this._visibleSize=ie,this._scrollSize=se,this._scrollPosition=le,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new i(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(N){const j=Math.round(N);return this._visibleSize!==j&&(this._visibleSize=j,this._refreshComputedValues(),!0)}setScrollSize(N){const j=Math.round(N);return this._scrollSize!==j&&(this._scrollSize=j,this._refreshComputedValues(),!0)}setScrollPosition(N){const j=Math.round(N);return this._scrollPosition!==j&&(this._scrollPosition=j,this._refreshComputedValues(),!0)}setScrollbarSize(N){this._scrollbarSize=Math.round(N)}setOppositeScrollbarSize(N){this._oppositeScrollbarSize=Math.round(N)}static _computeValues(N,j,X,ie,se){const le=Math.max(0,X-N),he=Math.max(0,le-2*j),ce=ie>0&&ie>X;if(!ce)return{computedAvailableSize:Math.round(le),computedIsNeeded:ce,computedSliderSize:Math.round(he),computedSliderRatio:0,computedSliderPosition:0};const _e=Math.round(Math.max(20,Math.floor(X*he/ie))),me=(he-_e)/(ie-X),ve=se*me;return{computedAvailableSize:Math.round(le),computedIsNeeded:ce,computedSliderSize:Math.round(_e),computedSliderRatio:me,computedSliderPosition:Math.round(ve)}}_refreshComputedValues(){const N=i._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=N.computedAvailableSize,this._computedIsNeeded=N.computedIsNeeded,this._computedSliderSize=N.computedSliderSize,this._computedSliderRatio=N.computedSliderRatio,this._computedSliderPosition=N.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(N){if(!this._computedIsNeeded)return 0;const j=N-this._arrowSize-this._computedSliderSize/2;return Math.round(j/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(N){if(!this._computedIsNeeded)return 0;const j=N-this._arrowSize;let X=this._scrollPosition;return j{Object.defineProperty(j,"__esModule",{value:!0}),j.ScrollbarVisibilityController=void 0;const ie=X(1758),se=X(7150),le=X(9881);class o extends se.Disposable{constructor(N,j,X){super(),this._visibility=N,this._visibleClassName=j,this._invisibleClassName=X,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new ie.TimeoutTimer)}setVisibility(N){this._visibility!==N&&(this._visibility=N,this._updateShouldBeVisible())}setShouldBeVisible(N){this._rawShouldBeVisible=N,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility!==le.ScrollbarVisibility.Hidden&&(this._visibility===le.ScrollbarVisibility.Visible||this._rawShouldBeVisible)}_updateShouldBeVisible(){const N=this._applyVisibilitySetting();this._shouldBeVisible!==N&&(this._shouldBeVisible=N,this.ensureVisibility())}setIsNeeded(N){this._isNeeded!==N&&(this._isNeeded=N,this.ensureVisibility())}setDomNode(N){this._domNode=N,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet((()=>{this._domNode?.setClassName(this._visibleClassName)}),0))}_hide(N){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(N?" fade":"")))}}j.ScrollbarVisibilityController=o},5473:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.VerticalScrollbar=void 0;const ie=X(8801),se=X(8245),le=X(9881);class o extends ie.AbstractScrollbar{constructor(N,j,X){const ie=N.getScrollDimensions(),he=N.getCurrentScrollPosition();if(super({lazyRender:j.lazyRender,host:X,scrollbarState:new se.ScrollbarState(j.verticalHasArrows?j.arrowSize:0,j.vertical===le.ScrollbarVisibility.Hidden?0:j.verticalScrollbarSize,0,ie.height,ie.scrollHeight,he.scrollTop),visibility:j.vertical,extraScrollbarClassName:"vertical",scrollable:N,scrollByPage:j.scrollByPage}),j.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((j.verticalScrollbarSize-j.verticalSliderSize)/2),j.verticalSliderSize,void 0)}_updateSlider(N,j){this.slider.setHeight(N),this.slider.setTop(j)}_renderDomNode(N,j){this.domNode.setWidth(j),this.domNode.setHeight(N),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(N){return this._shouldRender=this._onElementScrollSize(N.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(N.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(N.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(N,j){return j}_sliderPointerPosition(N){return N.pageY}_sliderOrthogonalPointerPosition(N){return N.pageX}_updateScrollbarSize(N){this.slider.setWidth(N)}writeScrollPosition(N,j){N.scrollTop=j}updateOptions(N){this.updateScrollbarSize(N.vertical===le.ScrollbarVisibility.Hidden?0:N.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(N.vertical),this._scrollByPage=N.scrollByPage}}j.VerticalScrollbar=o},8286:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.Widget=void 0;const he=le(X(7093)),ce=X(5394),_e=X(5964),me=X(8594),ve=X(7150);class d extends ve.Disposable{onclick(N,j){this._register(he.addDisposableListener(N,he.EventType.CLICK,(X=>j(new _e.StandardMouseEvent(he.getWindow(N),X)))))}onmousedown(N,j){this._register(he.addDisposableListener(N,he.EventType.MOUSE_DOWN,(X=>j(new _e.StandardMouseEvent(he.getWindow(N),X)))))}onmouseover(N,j){this._register(he.addDisposableListener(N,he.EventType.MOUSE_OVER,(X=>j(new _e.StandardMouseEvent(he.getWindow(N),X)))))}onmouseleave(N,j){this._register(he.addDisposableListener(N,he.EventType.MOUSE_LEAVE,(X=>j(new _e.StandardMouseEvent(he.getWindow(N),X)))))}onkeydown(N,j){this._register(he.addDisposableListener(N,he.EventType.KEY_DOWN,(N=>j(new ce.StandardKeyboardEvent(N)))))}onkeyup(N,j){this._register(he.addDisposableListener(N,he.EventType.KEY_UP,(N=>j(new ce.StandardKeyboardEvent(N)))))}oninput(N,j){this._register(he.addDisposableListener(N,he.EventType.INPUT,j))}onblur(N,j){this._register(he.addDisposableListener(N,he.EventType.BLUR,j))}onfocus(N,j){this._register(he.addDisposableListener(N,he.EventType.FOCUS,j))}onchange(N,j){this._register(he.addDisposableListener(N,he.EventType.CHANGE,j))}ignoreGesture(N){return me.Gesture.ignoreTarget(N)}}j.Widget=d},4693:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.mainWindow=void 0,j.ensureCodeWindow=function(N,j){},j.mainWindow="object"==typeof window?window:globalThis},3058:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.Permutation=j.CallbackIterable=j.ArrayQueue=j.booleanComparator=j.numberComparator=j.CompareResult=void 0,j.tail=function(N,j=0){return N[N.length-(1+j)]},j.tail2=function(N){if(0===N.length)throw new Error("Invalid tail call");return[N.slice(0,N.length-1),N[N.length-1]]},j.equals=function(N,j,X=(N,j)=>N===j){if(N===j)return!0;if(!N||!j)return!1;if(N.length!==j.length)return!1;for(let ie=0,se=N.length;ieX(N[ie],j)))},j.binarySearch2=n,j.quickSelect=function e(N,j,X){if((N|=0)>=j.length)throw new TypeError("invalid index");const ie=j[Math.floor(j.length*Math.random())],se=[],le=[],he=[];for(const N of j){const j=X(N,ie);j<0?se.push(N):j>0?le.push(N):he.push(N)}return N{(async()=>{const he=N.length,ce=N.slice(0,X).sort(j);for(let _e=X,me=Math.min(X+se,he);_eX&&await new Promise((N=>setTimeout(N))),le&&le.isCancellationRequested)throw new ie.CancellationError;a(N,j,ce,_e,me)}return ce})().then(he,ce)}))},j.coalesce=function(N){return N.filter((N=>!!N))},j.coalesceInPlace=function(N){let j=0;for(let X=0;X0},j.distinct=function(N,j=N=>N){const X=new Set;return N.filter((N=>{const ie=j(N);return!X.has(ie)&&(X.add(ie),!0)}))},j.uniqueFilter=function(N){const j=new Set;return X=>{const ie=N(X);return!j.has(ie)&&(j.add(ie),!0)}},j.firstOrDefault=function(N,j){return N.length>0?N[0]:j},j.lastOrDefault=function(N,j){return N.length>0?N[N.length-1]:j},j.commonPrefixLength=function(N,j,X=(N,j)=>N===j){let ie=0;for(let se=0,le=Math.min(N.length,j.length);sej;N--)ie.push(N);return ie},j.index=function(N,j,X){return N.reduce(((N,ie)=>(N[j(ie)]=X?X(ie):ie,N)),Object.create(null))},j.insert=function(N,j){return N.push(j),()=>l(N,j)},j.remove=l,j.arrayInsert=function(N,j,X){const ie=N.slice(0,j),se=N.slice(j);return ie.concat(X,se)},j.shuffle=function(N,j){let X;if("number"==typeof j){let N=j;X=()=>{const j=179426549*Math.sin(N++);return j-Math.floor(j)}}else X=Math.random;for(let j=N.length-1;j>0;j-=1){const ie=Math.floor(X()*(j+1)),se=N[j];N[j]=N[ie],N[ie]=se}},j.pushToStart=function(N,j){const X=N.indexOf(j);X>-1&&(N.splice(X,1),N.unshift(j))},j.pushToEnd=function(N,j){const X=N.indexOf(j);X>-1&&(N.splice(X,1),N.push(j))},j.pushMany=function(N,j){for(const X of j)N.push(X)},j.mapArrayOrNot=function(N,j){return Array.isArray(N)?N.map(j):j(N)},j.asArray=function(N){return Array.isArray(N)?N:[N]},j.getRandomElement=function(N){return N[Math.floor(Math.random()*N.length)]},j.insertInto=h,j.splice=function(N,j,X,ie){const se=c(N,j);let le=N.splice(se,X);return void 0===le&&(le=[]),h(N,se,ie),le},j.compareBy=function(N,j){return(X,ie)=>j(N(X),N(ie))},j.tieBreakComparators=function(...N){return(j,X)=>{for(const ie of N){const N=ie(j,X);if(!le.isNeitherLessOrGreaterThan(N))return N}return le.neitherLessOrGreaterThan}},j.reverseOrder=function(N){return(j,X)=>-N(j,X)};const ie=X(9807),se=X(8297);function n(N,j){let X=0,ie=N-1;for(;X<=ie;){const N=(X+ie)/2|0,se=j(N);if(se<0)X=N+1;else{if(!(se>0))return N;ie=N-1}}return-(X+1)}function o(N,j,X){const ie=[];function r(N,j,X){if(0===j&&0===X.length)return;const se=ie[ie.length-1];se&&se.start+se.deleteCount===N?(se.deleteCount+=j,se.toInsert.push(...X)):ie.push({start:N,deleteCount:j,toInsert:X})}let se=0,le=0;for(;;){if(se===N.length){r(se,0,j.slice(le));break}if(le===j.length){r(se,N.length-se,[]);break}const ie=N[se],he=j[le],ce=X(ie,he);0===ce?(se+=1,le+=1):ce<0?(r(se,1,[]),se+=1):ce>0&&(r(se,0,[he]),le+=1)}return ie}function a(N,j,X,ie,le){for(const he=X.length;iej(le,N)<0));X.splice(N,0,le)}}}function l(N,j){const X=N.indexOf(j);if(X>-1)return N.splice(X,1),j}function h(N,j,X){const ie=c(N,j),se=N.length,le=X.length;N.length=se+le;for(let j=se-1;j>=ie;j--)N[j+le]=N[j];for(let j=0;j0},N.isNeitherLessOrGreaterThan=function(N){return 0===N},N.greaterThan=1,N.lessThan=-1,N.neitherLessOrGreaterThan=0}(le||(j.CompareResult=le={})),j.numberComparator=(N,j)=>N-j,j.booleanComparator=(N,X)=>(0,j.numberComparator)(N?1:0,X?1:0),j.ArrayQueue=class{constructor(N){this.items=N,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(N){let j=this.firstIdx;for(;j=0&&N(this.items[j]);)j--;const X=j===this.lastIdx?null:this.items.slice(j+1,this.lastIdx+1);return this.lastIdx=j,X}peek(){if(0!==this.length)return this.items[this.firstIdx]}peekLast(){if(0!==this.length)return this.items[this.lastIdx]}dequeue(){const N=this.items[this.firstIdx];return this.firstIdx++,N}removeLast(){const N=this.items[this.lastIdx];return this.lastIdx--,N}takeCount(N){const j=this.items.slice(this.firstIdx,this.firstIdx+N);return this.firstIdx+=N,j}};class u{static{this.empty=new u((N=>{}))}constructor(N){this.iterate=N}forEach(N){this.iterate((j=>(N(j),!0)))}toArray(){const N=[];return this.iterate((j=>(N.push(j),!0))),N}filter(N){return new u((j=>this.iterate((X=>!N(X)||j(X)))))}map(N){return new u((j=>this.iterate((X=>j(N(X))))))}some(N){let j=!1;return this.iterate((X=>(j=N(X),!j))),j}findFirst(N){let j;return this.iterate((X=>!N(X)||(j=X,!1))),j}findLast(N){let j;return this.iterate((X=>(N(X)&&(j=X),!0))),j}findLastMaxBy(N){let j,X=!0;return this.iterate((ie=>((X||le.isGreaterThan(N(ie,j)))&&(X=!1,j=ie),!0))),j}}j.CallbackIterable=u;class _{constructor(N){this._indexMap=N}static createSortPermutation(N,j){const X=Array.from(N.keys()).sort(((X,ie)=>j(N[X],N[ie])));return new _(X)}apply(N){return N.map(((j,X)=>N[this._indexMap[X]]))}inverse(){const N=this._indexMap.slice();for(let j=0;j{function i(N,j,X=N.length-1){for(let ie=X;ie>=0;ie--)if(j(N[ie]))return ie;return-1}function s(N,j,X=0,ie=N.length){let se=X,le=ie;for(;se=0&&(X=se)}return X},j.findFirstMin=function(N,j){return o(N,((N,X)=>-j(N,X)))},j.findMaxIdx=function(N,j){if(0===N.length)return-1;let X=0;for(let ie=1;ie0&&(X=ie);return X},j.mapFindFirst=function(N,j){for(const X of N){const N=j(X);if(void 0!==N)return N}};class n{static{this.assertInvariants=!1}constructor(N){this._array=N,this._findLastMonotonousLastIdx=0}findLastMonotonous(N){if(n.assertInvariants){if(this._prevFindLastPredicate)for(const j of this._array)if(this._prevFindLastPredicate(j)&&!N(j))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.");this._prevFindLastPredicate=N}const j=s(this._array,N,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=j+1,-1===j?void 0:this._array[j]}}function o(N,j){if(0===N.length)return;let X=N[0];for(let ie=1;ie0&&(X=se)}return X}j.MonotonousArray=n},1758:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.AsyncIterableSource=j.CancelableAsyncIterableObject=j.AsyncIterableObject=j.LazyStatefulPromise=j.StatefulPromise=j.Promises=j.DeferredPromise=j.IntervalCounter=j.TaskSequentializer=j.GlobalIdleValue=j.AbstractIdleValue=j._runWhenIdle=j.runWhenGlobalIdle=j.ThrottledWorker=j.RunOnceWorker=j.ProcessTimeRunOnceScheduler=j.RunOnceScheduler=j.IntervalTimer=j.TimeoutTimer=j.LimitedQueue=j.Queue=j.Limiter=j.AutoOpenBarrier=j.Barrier=j.ThrottledDelayer=j.Delayer=j.SequencerByKey=j.Sequencer=j.Throttler=void 0,j.isThenable=c,j.createCancelablePromise=d,j.raceCancellation=function(N,j,X){return new Promise(((ie,se)=>{const le=j.onCancellationRequested((()=>{le.dispose(),ie(X)}));N.then(ie,se).finally((()=>le.dispose()))}))},j.raceCancellationError=function(N,j){return new Promise(((X,ie)=>{const le=j.onCancellationRequested((()=>{le.dispose(),ie(new se.CancellationError)}));N.then(X,ie).finally((()=>le.dispose()))}))},j.raceCancellablePromises=async function(N){let j=-1;const X=N.map(((N,X)=>N.then((N=>(j=X,N)))));try{return await Promise.race(X)}finally{N.forEach(((N,X)=>{X!==j&&N.cancel()}))}},j.raceTimeout=function(N,j,X){let ie;const se=setTimeout((()=>{ie?.(void 0),X?.()}),j);return Promise.race([N.finally((()=>clearTimeout(se))),new Promise((N=>ie=N))])},j.asPromise=function(N){return new Promise(((j,X)=>{const ie=N();c(ie)?ie.then(j,X):j(ie)}))},j.promiseWithResolvers=u,j.timeout=g,j.disposableTimeout=function(N,j=0,X){const ie=setTimeout((()=>{N(),X&&se.dispose()}),j),se=(0,he.toDisposable)((()=>{clearTimeout(ie),X?.deleteAndLeak(se)}));return X?.add(se),se},j.sequence=function(N){const j=[];let X=0;const ie=N.length;return Promise.resolve(null).then((function r(se){null!=se&&j.push(se);const le=X!!N,X=null){let ie=0;const se=N.length,n=()=>{if(ie>=se)return Promise.resolve(X);const le=N[ie++];return Promise.resolve(le()).then((N=>j(N)?Promise.resolve(N):n()))};return n()},j.firstParallel=function(N,j=N=>!!N,X=null){if(0===N.length)return Promise.resolve(X);let ie=N.length;const r=()=>{ie=-1;for(const j of N)j.cancel?.()};return new Promise(((se,le)=>{for(const he of N)he.then((N=>{--ie>=0&&j(N)?(r(),se(N)):0===ie&&se(X)})).catch((N=>{--ie>=0&&(r(),le(N))}))}))},j.retry=async function(N,j,X){let ie;for(let se=0;se{const ie=j.token.onCancellationRequested((()=>{ie.dispose(),j.dispose(),N.reject(new se.CancellationError)}));try{for await(const ie of X){if(j.token.isCancellationRequested)return;N.emitOne(ie)}ie.dispose(),j.dispose()}catch(X){ie.dispose(),j.dispose(),N.reject(X)}}))};const ie=X(8447),se=X(9807),le=X(802),he=X(7150),ce=X(8163),_e=X(5015),me=X(626);function c(N){return!!N&&"function"==typeof N.then}function d(N){const j=new ie.CancellationTokenSource,X=N(j.token),le=new Promise(((N,ie)=>{const le=j.token.onCancellationRequested((()=>{le.dispose(),ie(new se.CancellationError)}));Promise.resolve(X).then((X=>{le.dispose(),j.dispose(),N(X)}),(N=>{le.dispose(),j.dispose(),ie(N)}))}));return new class{cancel(){j.cancel(),j.dispose()}then(N,j){return le.then(N,j)}catch(N){return this.then(void 0,N)}finally(N){return le.finally(N)}}}function u(){let N,j;return{promise:new Promise(((X,ie)=>{N=X,j=ie})),resolve:N,reject:j}}class _{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(N){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=N,!this.queuedPromise){const e=()=>{if(this.queuedPromise=null,this.isDisposed)return;const N=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,N};this.queuedPromise=new Promise((N=>{this.activePromise.then(e,e).then(N)}))}return new Promise(((N,j)=>{this.queuedPromise.then(N,j)}))}return this.activePromise=N(),new Promise(((N,j)=>{this.activePromise.then((j=>{this.activePromise=null,N(j)}),(N=>{this.activePromise=null,j(N)}))}))}dispose(){this.isDisposed=!0}}j.Throttler=_,j.Sequencer=class{constructor(){this.current=Promise.resolve(null)}queue(N){return this.current=this.current.then((()=>N()),(()=>N()))}},j.SequencerByKey=class{constructor(){this.promiseMap=new Map}queue(N,j){const X=(this.promiseMap.get(N)??Promise.resolve()).catch((()=>{})).then(j).finally((()=>{this.promiseMap.get(N)===X&&this.promiseMap.delete(N)}));return this.promiseMap.set(N,X),X}};class f{constructor(N){this.defaultDelay=N,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(N,j=this.defaultDelay){this.task=N,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(((N,j)=>{this.doResolve=N,this.doReject=j})).then((()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const N=this.task;return this.task=null,N()}})));const i=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=j===_e.MicrotaskDelay?(N=>{let j=!0;return queueMicrotask((()=>{j&&(j=!1,N())})),{isTriggered:()=>j,dispose:()=>{j=!1}}})(i):((N,j)=>{let X=!0;const ie=setTimeout((()=>{X=!1,j()}),N);return{isTriggered:()=>X,dispose:()=>{clearTimeout(ie),X=!1}}})(j,i),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new se.CancellationError),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}}j.Delayer=f,j.ThrottledDelayer=class{constructor(N){this.delayer=new f(N),this.throttler=new _}trigger(N,j){return this.delayer.trigger((()=>this.throttler.queue(N)),j)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}};class p{constructor(){this._isOpen=!1,this._promise=new Promise(((N,j)=>{this._completePromise=N}))}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}}function g(N,j){return j?new Promise(((X,ie)=>{const le=setTimeout((()=>{he.dispose(),X()}),N),he=j.onCancellationRequested((()=>{clearTimeout(le),he.dispose(),ie(new se.CancellationError)}))})):d((j=>g(N,j)))}j.Barrier=p,j.AutoOpenBarrier=class extends p{constructor(N){super(),this._timeout=setTimeout((()=>this.open()),N)}open(){clearTimeout(this._timeout),super.open()}};class m{constructor(N){this._size=0,this._isDisposed=!1,this.maxDegreeOfParalellism=N,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new le.Emitter}whenIdle(){return this.size>0?le.Event.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(N){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise(((j,X)=>{this.outstandingPromises.push({factory:N,c:j,e:X}),this.consume()}))}consume(){for(;this.outstandingPromises.length&&this.runningPromisesthis.consumed()),(()=>this.consumed()))}}consumed(){this._isDisposed||(this.runningPromises--,0==--this._size&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}}j.Limiter=m,j.Queue=class extends m{constructor(){super(1)}},j.LimitedQueue=class{constructor(){this.sequentializer=new C,this.tasks=0}queue(N){return this.sequentializer.isRunning()?this.sequentializer.queue((()=>this.sequentializer.run(this.tasks++,N()))):this.sequentializer.run(this.tasks++,N())}},j.TimeoutTimer=class{constructor(N,j){this._isDisposed=!1,this._token=-1,"function"==typeof N&&"number"==typeof j&&this.setIfNotSet(N,j)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(N,j){if(this._isDisposed)throw new se.BugIndicatingError("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout((()=>{this._token=-1,N()}),j)}setIfNotSet(N,j){if(this._isDisposed)throw new se.BugIndicatingError("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout((()=>{this._token=-1,N()}),j))}},j.IntervalTimer=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(N,j,X=globalThis){if(this.isDisposed)throw new se.BugIndicatingError("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();const ie=X.setInterval((()=>{N()}),j);this.disposable=(0,he.toDisposable)((()=>{X.clearInterval(ie),this.disposable=void 0}))}dispose(){this.cancel(),this.isDisposed=!0}};class v{constructor(N,j){this.timeoutToken=-1,this.runner=N,this.timeout=j,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(N=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,N)}get delay(){return this.timeout}set delay(N){this.timeout=N}isScheduled(){return-1!==this.timeoutToken}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner?.()}}j.RunOnceScheduler=v,j.ProcessTimeRunOnceScheduler=class{constructor(N,j){j%1e3!=0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${j}ms is not a multiple of 1000ms.`),this.runner=N,this.timeout=j,this.counter=0,this.intervalToken=-1,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=-1)}schedule(N=this.timeout){N%1e3!=0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${N}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(N/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return-1!==this.intervalToken}onInterval(){this.counter--,this.counter>0||(clearInterval(this.intervalToken),this.intervalToken=-1,this.runner?.())}},j.RunOnceWorker=class extends v{constructor(N,j){super(N,j),this.units=[]}work(N){this.units.push(N),this.isScheduled()||this.schedule()}doRun(){const N=this.units;this.units=[],this.runner?.(N)}dispose(){this.units=[],super.dispose()}};class S extends he.Disposable{constructor(N,j){super(),this.options=N,this.handler=j,this.pendingWork=[],this.throttler=this._register(new he.MutableDisposable),this.disposed=!1}get pending(){return this.pendingWork.length}work(N){if(this.disposed)return!1;if("number"==typeof this.options.maxBufferedWork)if(this.throttler.value){if(this.pending+N.length>this.options.maxBufferedWork)return!1}else if(this.pending+N.length-this.options.maxWorkChunkSize>this.options.maxBufferedWork)return!1;for(const j of N)this.pendingWork.push(j);return this.throttler.value||this.doWork(),!0}doWork(){this.handler(this.pendingWork.splice(0,this.options.maxWorkChunkSize)),this.pendingWork.length>0&&(this.throttler.value=new v((()=>{this.throttler.clear(),this.doWork()}),this.options.throttleDelay),this.throttler.value.schedule())}dispose(){super.dispose(),this.disposed=!0}}j.ThrottledWorker=S,"function"!=typeof globalThis.requestIdleCallback||"function"!=typeof globalThis.cancelIdleCallback?j._runWhenIdle=(N,j)=>{(0,ce.setTimeout0)((()=>{if(X)return;const N=Date.now()+15,ie={didTimeout:!0,timeRemaining:()=>Math.max(0,N-Date.now())};j(Object.freeze(ie))}));let X=!1;return{dispose(){X||(X=!0)}}}:j._runWhenIdle=(N,j,X)=>{const ie=N.requestIdleCallback(j,"number"==typeof X?{timeout:X}:void 0);let se=!1;return{dispose(){se||(se=!0,N.cancelIdleCallback(ie))}}},j.runWhenGlobalIdle=N=>(0,j._runWhenIdle)(globalThis,N);class b{constructor(N,X){this._didRun=!1,this._executor=()=>{try{this._value=X()}catch(N){this._error=N}finally{this._didRun=!0}},this._handle=(0,j._runWhenIdle)(N,(()=>this._executor()))}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}}j.AbstractIdleValue=b,j.GlobalIdleValue=class extends b{constructor(N){super(globalThis,N)}};class C{isRunning(N){return"number"==typeof N?this._running?.taskId===N:!!this._running}get running(){return this._running?.promise}cancelRunning(){this._running?.cancel()}run(N,j,X){return this._running={taskId:N,cancel:()=>X?.(),promise:j},j.then((()=>this.doneRunning(N)),(()=>this.doneRunning(N))),j}doneRunning(N){this._running&&N===this._running.taskId&&(this._running=void 0,this.runQueued())}runQueued(){if(this._queued){const N=this._queued;this._queued=void 0,N.run().then(N.promiseResolve,N.promiseReject)}}queue(N){if(this._queued)this._queued.run=N;else{const{promise:j,resolve:X,reject:ie}=u();this._queued={run:N,promise:j,promiseResolve:X,promiseReject:ie}}return this._queued.promise}hasQueued(){return!!this._queued}async join(){return this._queued?.promise??this._running?.promise}}var ve,Se,be;j.TaskSequentializer=C,j.IntervalCounter=class{constructor(N,j=()=>Date.now()){this.interval=N,this.nowFn=j,this.lastIncrementTime=0,this.value=0}increment(){const N=this.nowFn();return N-this.lastIncrementTime>this.interval&&(this.lastIncrementTime=N,this.value=0),this.value++,this.value}},function(N){N[N.Resolved=0]="Resolved",N[N.Rejected=1]="Rejected"}(ve||(ve={}));class D{get isRejected(){return this.outcome?.outcome===ve.Rejected}get isResolved(){return this.outcome?.outcome===ve.Resolved}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===ve.Resolved?this.outcome?.value:void 0}constructor(){this.p=new Promise(((N,j)=>{this.completeCallback=N,this.errorCallback=j}))}complete(N){return new Promise((j=>{this.completeCallback(N),this.outcome={outcome:ve.Resolved,value:N},j()}))}error(N){return new Promise((j=>{this.errorCallback(N),this.outcome={outcome:ve.Rejected,value:N},j()}))}cancel(){return this.error(new se.CancellationError)}}j.DeferredPromise=D,function(N){N.settled=async function(N){let j;const X=await Promise.all(N.map((N=>N.then((N=>N),(N=>{j||(j=N)})))));if(void 0!==j)throw j;return X},N.withAsyncBody=function(N){return new Promise((async(j,X)=>{try{await N(j,X)}catch(N){X(N)}}))}}(Se||(j.Promises=Se={}));class L{get value(){return this._value}get error(){return this._error}get isResolved(){return this._isResolved}constructor(N){this._value=void 0,this._error=void 0,this._isResolved=!1,this.promise=N.then((N=>(this._value=N,this._isResolved=!0,N)),(N=>{throw this._error=N,this._isResolved=!0,N}))}requireValue(){if(!this._isResolved)throw new se.BugIndicatingError("Promise is not resolved yet");if(this._error)throw this._error;return this._value}}j.StatefulPromise=L,j.LazyStatefulPromise=class{constructor(N){this._compute=N,this._promise=new me.Lazy((()=>new L(this._compute())))}requireValue(){return this._promise.value.requireValue()}getPromise(){return this._promise.value.promise}get currentValue(){return this._promise.rawValue?.value}},function(N){N[N.Initial=0]="Initial",N[N.DoneOK=1]="DoneOK",N[N.DoneError=2]="DoneError"}(be||(be={}));class A{static fromArray(N){return new A((j=>{j.emitMany(N)}))}static fromPromise(N){return new A((async j=>{j.emitMany(await N)}))}static fromPromises(N){return new A((async j=>{await Promise.all(N.map((async N=>j.emitOne(await N))))}))}static merge(N){return new A((async j=>{await Promise.all(N.map((async N=>{for await(const X of N)j.emitOne(X)})))}))}static{this.EMPTY=A.fromArray([])}constructor(N,j){this._state=be.Initial,this._results=[],this._error=null,this._onReturn=j,this._onStateChanged=new le.Emitter,queueMicrotask((async()=>{const j={emitOne:N=>this.emitOne(N),emitMany:N=>this.emitMany(N),reject:N=>this.reject(N)};try{await Promise.resolve(N(j)),this.resolve()}catch(N){this.reject(N)}finally{j.emitOne=void 0,j.emitMany=void 0,j.reject=void 0}}))}[Symbol.asyncIterator](){let N=0;return{next:async()=>{for(;;){if(this._state===be.DoneError)throw this._error;if(N(this._onReturn?.(),{done:!0,value:void 0})}}static map(N,j){return new A((async X=>{for await(const ie of N)X.emitOne(j(ie))}))}map(N){return A.map(this,N)}static filter(N,j){return new A((async X=>{for await(const ie of N)j(ie)&&X.emitOne(ie)}))}filter(N){return A.filter(this,N)}static coalesce(N){return A.filter(N,(N=>!!N))}coalesce(){return A.coalesce(this)}static async toPromise(N){const j=[];for await(const X of N)j.push(X);return j}toPromise(){return A.toPromise(this)}emitOne(N){this._state===be.Initial&&(this._results.push(N),this._onStateChanged.fire())}emitMany(N){this._state===be.Initial&&(this._results=this._results.concat(N),this._onStateChanged.fire())}resolve(){this._state===be.Initial&&(this._state=be.DoneOK,this._onStateChanged.fire())}reject(N){this._state===be.Initial&&(this._state=be.DoneError,this._error=N,this._onStateChanged.fire())}}j.AsyncIterableObject=A;class R extends A{constructor(N,j){super(j),this._source=N}cancel(){this._source.cancel()}}j.CancelableAsyncIterableObject=R,j.AsyncIterableSource=class{constructor(N){let j,X;this._deferred=new D,this._asyncIterable=new A((N=>{if(!j)return X&&N.emitMany(X),this._errorFn=j=>N.reject(j),this._emitFn=j=>N.emitOne(j),this._deferred.p;N.reject(j)}),N),this._emitFn=N=>{X||(X=[]),X.push(N)},this._errorFn=N=>{j||(j=N)}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(N){this._errorFn(N),this._deferred.complete()}emitOne(N){this._emitFn(N)}}},8447:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.CancellationTokenSource=j.CancellationToken=void 0,j.cancelOnDispose=function(N){const j=new a;return N.add({dispose(){j.cancel()}}),j.token};const ie=X(802),se=Object.freeze((function(N,j){const X=setTimeout(N.bind(j),0);return{dispose(){clearTimeout(X)}}}));var le;!function(N){N.isCancellationToken=function(j){return j===N.None||j===N.Cancelled||j instanceof o||!(!j||"object"!=typeof j)&&"boolean"==typeof j.isCancellationRequested&&"function"==typeof j.onCancellationRequested},N.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ie.Event.None}),N.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:se})}(le||(j.CancellationToken=le={}));class o{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?se:(this._emitter||(this._emitter=new ie.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}class a{constructor(N){this._token=void 0,this._parentListener=void 0,this._parentListener=N&&N.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new o),this._token}cancel(){this._token?this._token instanceof o&&this._token.cancel():this._token=le.Cancelled}dispose(N=!1){N&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof o&&this._token.dispose():this._token=le.None}}j.CancellationTokenSource=a},4869:(N,j)=>{var X;Object.defineProperty(j,"__esModule",{value:!0}),j.CharCode=void 0,function(N){N[N.Null=0]="Null",N[N.Backspace=8]="Backspace",N[N.Tab=9]="Tab",N[N.LineFeed=10]="LineFeed",N[N.CarriageReturn=13]="CarriageReturn",N[N.Space=32]="Space",N[N.ExclamationMark=33]="ExclamationMark",N[N.DoubleQuote=34]="DoubleQuote",N[N.Hash=35]="Hash",N[N.DollarSign=36]="DollarSign",N[N.PercentSign=37]="PercentSign",N[N.Ampersand=38]="Ampersand",N[N.SingleQuote=39]="SingleQuote",N[N.OpenParen=40]="OpenParen",N[N.CloseParen=41]="CloseParen",N[N.Asterisk=42]="Asterisk",N[N.Plus=43]="Plus",N[N.Comma=44]="Comma",N[N.Dash=45]="Dash",N[N.Period=46]="Period",N[N.Slash=47]="Slash",N[N.Digit0=48]="Digit0",N[N.Digit1=49]="Digit1",N[N.Digit2=50]="Digit2",N[N.Digit3=51]="Digit3",N[N.Digit4=52]="Digit4",N[N.Digit5=53]="Digit5",N[N.Digit6=54]="Digit6",N[N.Digit7=55]="Digit7",N[N.Digit8=56]="Digit8",N[N.Digit9=57]="Digit9",N[N.Colon=58]="Colon",N[N.Semicolon=59]="Semicolon",N[N.LessThan=60]="LessThan",N[N.Equals=61]="Equals",N[N.GreaterThan=62]="GreaterThan",N[N.QuestionMark=63]="QuestionMark",N[N.AtSign=64]="AtSign",N[N.A=65]="A",N[N.B=66]="B",N[N.C=67]="C",N[N.D=68]="D",N[N.E=69]="E",N[N.F=70]="F",N[N.G=71]="G",N[N.H=72]="H",N[N.I=73]="I",N[N.J=74]="J",N[N.K=75]="K",N[N.L=76]="L",N[N.M=77]="M",N[N.N=78]="N",N[N.O=79]="O",N[N.P=80]="P",N[N.Q=81]="Q",N[N.R=82]="R",N[N.S=83]="S",N[N.T=84]="T",N[N.U=85]="U",N[N.V=86]="V",N[N.W=87]="W",N[N.X=88]="X",N[N.Y=89]="Y",N[N.Z=90]="Z",N[N.OpenSquareBracket=91]="OpenSquareBracket",N[N.Backslash=92]="Backslash",N[N.CloseSquareBracket=93]="CloseSquareBracket",N[N.Caret=94]="Caret",N[N.Underline=95]="Underline",N[N.BackTick=96]="BackTick",N[N.a=97]="a",N[N.b=98]="b",N[N.c=99]="c",N[N.d=100]="d",N[N.e=101]="e",N[N.f=102]="f",N[N.g=103]="g",N[N.h=104]="h",N[N.i=105]="i",N[N.j=106]="j",N[N.k=107]="k",N[N.l=108]="l",N[N.m=109]="m",N[N.n=110]="n",N[N.o=111]="o",N[N.p=112]="p",N[N.q=113]="q",N[N.r=114]="r",N[N.s=115]="s",N[N.t=116]="t",N[N.u=117]="u",N[N.v=118]="v",N[N.w=119]="w",N[N.x=120]="x",N[N.y=121]="y",N[N.z=122]="z",N[N.OpenCurlyBrace=123]="OpenCurlyBrace",N[N.Pipe=124]="Pipe",N[N.CloseCurlyBrace=125]="CloseCurlyBrace",N[N.Tilde=126]="Tilde",N[N.NoBreakSpace=160]="NoBreakSpace",N[N.U_Combining_Grave_Accent=768]="U_Combining_Grave_Accent",N[N.U_Combining_Acute_Accent=769]="U_Combining_Acute_Accent",N[N.U_Combining_Circumflex_Accent=770]="U_Combining_Circumflex_Accent",N[N.U_Combining_Tilde=771]="U_Combining_Tilde",N[N.U_Combining_Macron=772]="U_Combining_Macron",N[N.U_Combining_Overline=773]="U_Combining_Overline",N[N.U_Combining_Breve=774]="U_Combining_Breve",N[N.U_Combining_Dot_Above=775]="U_Combining_Dot_Above",N[N.U_Combining_Diaeresis=776]="U_Combining_Diaeresis",N[N.U_Combining_Hook_Above=777]="U_Combining_Hook_Above",N[N.U_Combining_Ring_Above=778]="U_Combining_Ring_Above",N[N.U_Combining_Double_Acute_Accent=779]="U_Combining_Double_Acute_Accent",N[N.U_Combining_Caron=780]="U_Combining_Caron",N[N.U_Combining_Vertical_Line_Above=781]="U_Combining_Vertical_Line_Above",N[N.U_Combining_Double_Vertical_Line_Above=782]="U_Combining_Double_Vertical_Line_Above",N[N.U_Combining_Double_Grave_Accent=783]="U_Combining_Double_Grave_Accent",N[N.U_Combining_Candrabindu=784]="U_Combining_Candrabindu",N[N.U_Combining_Inverted_Breve=785]="U_Combining_Inverted_Breve",N[N.U_Combining_Turned_Comma_Above=786]="U_Combining_Turned_Comma_Above",N[N.U_Combining_Comma_Above=787]="U_Combining_Comma_Above",N[N.U_Combining_Reversed_Comma_Above=788]="U_Combining_Reversed_Comma_Above",N[N.U_Combining_Comma_Above_Right=789]="U_Combining_Comma_Above_Right",N[N.U_Combining_Grave_Accent_Below=790]="U_Combining_Grave_Accent_Below",N[N.U_Combining_Acute_Accent_Below=791]="U_Combining_Acute_Accent_Below",N[N.U_Combining_Left_Tack_Below=792]="U_Combining_Left_Tack_Below",N[N.U_Combining_Right_Tack_Below=793]="U_Combining_Right_Tack_Below",N[N.U_Combining_Left_Angle_Above=794]="U_Combining_Left_Angle_Above",N[N.U_Combining_Horn=795]="U_Combining_Horn",N[N.U_Combining_Left_Half_Ring_Below=796]="U_Combining_Left_Half_Ring_Below",N[N.U_Combining_Up_Tack_Below=797]="U_Combining_Up_Tack_Below",N[N.U_Combining_Down_Tack_Below=798]="U_Combining_Down_Tack_Below",N[N.U_Combining_Plus_Sign_Below=799]="U_Combining_Plus_Sign_Below",N[N.U_Combining_Minus_Sign_Below=800]="U_Combining_Minus_Sign_Below",N[N.U_Combining_Palatalized_Hook_Below=801]="U_Combining_Palatalized_Hook_Below",N[N.U_Combining_Retroflex_Hook_Below=802]="U_Combining_Retroflex_Hook_Below",N[N.U_Combining_Dot_Below=803]="U_Combining_Dot_Below",N[N.U_Combining_Diaeresis_Below=804]="U_Combining_Diaeresis_Below",N[N.U_Combining_Ring_Below=805]="U_Combining_Ring_Below",N[N.U_Combining_Comma_Below=806]="U_Combining_Comma_Below",N[N.U_Combining_Cedilla=807]="U_Combining_Cedilla",N[N.U_Combining_Ogonek=808]="U_Combining_Ogonek",N[N.U_Combining_Vertical_Line_Below=809]="U_Combining_Vertical_Line_Below",N[N.U_Combining_Bridge_Below=810]="U_Combining_Bridge_Below",N[N.U_Combining_Inverted_Double_Arch_Below=811]="U_Combining_Inverted_Double_Arch_Below",N[N.U_Combining_Caron_Below=812]="U_Combining_Caron_Below",N[N.U_Combining_Circumflex_Accent_Below=813]="U_Combining_Circumflex_Accent_Below",N[N.U_Combining_Breve_Below=814]="U_Combining_Breve_Below",N[N.U_Combining_Inverted_Breve_Below=815]="U_Combining_Inverted_Breve_Below",N[N.U_Combining_Tilde_Below=816]="U_Combining_Tilde_Below",N[N.U_Combining_Macron_Below=817]="U_Combining_Macron_Below",N[N.U_Combining_Low_Line=818]="U_Combining_Low_Line",N[N.U_Combining_Double_Low_Line=819]="U_Combining_Double_Low_Line",N[N.U_Combining_Tilde_Overlay=820]="U_Combining_Tilde_Overlay",N[N.U_Combining_Short_Stroke_Overlay=821]="U_Combining_Short_Stroke_Overlay",N[N.U_Combining_Long_Stroke_Overlay=822]="U_Combining_Long_Stroke_Overlay",N[N.U_Combining_Short_Solidus_Overlay=823]="U_Combining_Short_Solidus_Overlay",N[N.U_Combining_Long_Solidus_Overlay=824]="U_Combining_Long_Solidus_Overlay",N[N.U_Combining_Right_Half_Ring_Below=825]="U_Combining_Right_Half_Ring_Below",N[N.U_Combining_Inverted_Bridge_Below=826]="U_Combining_Inverted_Bridge_Below",N[N.U_Combining_Square_Below=827]="U_Combining_Square_Below",N[N.U_Combining_Seagull_Below=828]="U_Combining_Seagull_Below",N[N.U_Combining_X_Above=829]="U_Combining_X_Above",N[N.U_Combining_Vertical_Tilde=830]="U_Combining_Vertical_Tilde",N[N.U_Combining_Double_Overline=831]="U_Combining_Double_Overline",N[N.U_Combining_Grave_Tone_Mark=832]="U_Combining_Grave_Tone_Mark",N[N.U_Combining_Acute_Tone_Mark=833]="U_Combining_Acute_Tone_Mark",N[N.U_Combining_Greek_Perispomeni=834]="U_Combining_Greek_Perispomeni",N[N.U_Combining_Greek_Koronis=835]="U_Combining_Greek_Koronis",N[N.U_Combining_Greek_Dialytika_Tonos=836]="U_Combining_Greek_Dialytika_Tonos",N[N.U_Combining_Greek_Ypogegrammeni=837]="U_Combining_Greek_Ypogegrammeni",N[N.U_Combining_Bridge_Above=838]="U_Combining_Bridge_Above",N[N.U_Combining_Equals_Sign_Below=839]="U_Combining_Equals_Sign_Below",N[N.U_Combining_Double_Vertical_Line_Below=840]="U_Combining_Double_Vertical_Line_Below",N[N.U_Combining_Left_Angle_Below=841]="U_Combining_Left_Angle_Below",N[N.U_Combining_Not_Tilde_Above=842]="U_Combining_Not_Tilde_Above",N[N.U_Combining_Homothetic_Above=843]="U_Combining_Homothetic_Above",N[N.U_Combining_Almost_Equal_To_Above=844]="U_Combining_Almost_Equal_To_Above",N[N.U_Combining_Left_Right_Arrow_Below=845]="U_Combining_Left_Right_Arrow_Below",N[N.U_Combining_Upwards_Arrow_Below=846]="U_Combining_Upwards_Arrow_Below",N[N.U_Combining_Grapheme_Joiner=847]="U_Combining_Grapheme_Joiner",N[N.U_Combining_Right_Arrowhead_Above=848]="U_Combining_Right_Arrowhead_Above",N[N.U_Combining_Left_Half_Ring_Above=849]="U_Combining_Left_Half_Ring_Above",N[N.U_Combining_Fermata=850]="U_Combining_Fermata",N[N.U_Combining_X_Below=851]="U_Combining_X_Below",N[N.U_Combining_Left_Arrowhead_Below=852]="U_Combining_Left_Arrowhead_Below",N[N.U_Combining_Right_Arrowhead_Below=853]="U_Combining_Right_Arrowhead_Below",N[N.U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below=854]="U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below",N[N.U_Combining_Right_Half_Ring_Above=855]="U_Combining_Right_Half_Ring_Above",N[N.U_Combining_Dot_Above_Right=856]="U_Combining_Dot_Above_Right",N[N.U_Combining_Asterisk_Below=857]="U_Combining_Asterisk_Below",N[N.U_Combining_Double_Ring_Below=858]="U_Combining_Double_Ring_Below",N[N.U_Combining_Zigzag_Above=859]="U_Combining_Zigzag_Above",N[N.U_Combining_Double_Breve_Below=860]="U_Combining_Double_Breve_Below",N[N.U_Combining_Double_Breve=861]="U_Combining_Double_Breve",N[N.U_Combining_Double_Macron=862]="U_Combining_Double_Macron",N[N.U_Combining_Double_Macron_Below=863]="U_Combining_Double_Macron_Below",N[N.U_Combining_Double_Tilde=864]="U_Combining_Double_Tilde",N[N.U_Combining_Double_Inverted_Breve=865]="U_Combining_Double_Inverted_Breve",N[N.U_Combining_Double_Rightwards_Arrow_Below=866]="U_Combining_Double_Rightwards_Arrow_Below",N[N.U_Combining_Latin_Small_Letter_A=867]="U_Combining_Latin_Small_Letter_A",N[N.U_Combining_Latin_Small_Letter_E=868]="U_Combining_Latin_Small_Letter_E",N[N.U_Combining_Latin_Small_Letter_I=869]="U_Combining_Latin_Small_Letter_I",N[N.U_Combining_Latin_Small_Letter_O=870]="U_Combining_Latin_Small_Letter_O",N[N.U_Combining_Latin_Small_Letter_U=871]="U_Combining_Latin_Small_Letter_U",N[N.U_Combining_Latin_Small_Letter_C=872]="U_Combining_Latin_Small_Letter_C",N[N.U_Combining_Latin_Small_Letter_D=873]="U_Combining_Latin_Small_Letter_D",N[N.U_Combining_Latin_Small_Letter_H=874]="U_Combining_Latin_Small_Letter_H",N[N.U_Combining_Latin_Small_Letter_M=875]="U_Combining_Latin_Small_Letter_M",N[N.U_Combining_Latin_Small_Letter_R=876]="U_Combining_Latin_Small_Letter_R",N[N.U_Combining_Latin_Small_Letter_T=877]="U_Combining_Latin_Small_Letter_T",N[N.U_Combining_Latin_Small_Letter_V=878]="U_Combining_Latin_Small_Letter_V",N[N.U_Combining_Latin_Small_Letter_X=879]="U_Combining_Latin_Small_Letter_X",N[N.LINE_SEPARATOR=8232]="LINE_SEPARATOR",N[N.PARAGRAPH_SEPARATOR=8233]="PARAGRAPH_SEPARATOR",N[N.NEXT_LINE=133]="NEXT_LINE",N[N.U_CIRCUMFLEX=94]="U_CIRCUMFLEX",N[N.U_GRAVE_ACCENT=96]="U_GRAVE_ACCENT",N[N.U_DIAERESIS=168]="U_DIAERESIS",N[N.U_MACRON=175]="U_MACRON",N[N.U_ACUTE_ACCENT=180]="U_ACUTE_ACCENT",N[N.U_CEDILLA=184]="U_CEDILLA",N[N.U_MODIFIER_LETTER_LEFT_ARROWHEAD=706]="U_MODIFIER_LETTER_LEFT_ARROWHEAD",N[N.U_MODIFIER_LETTER_RIGHT_ARROWHEAD=707]="U_MODIFIER_LETTER_RIGHT_ARROWHEAD",N[N.U_MODIFIER_LETTER_UP_ARROWHEAD=708]="U_MODIFIER_LETTER_UP_ARROWHEAD",N[N.U_MODIFIER_LETTER_DOWN_ARROWHEAD=709]="U_MODIFIER_LETTER_DOWN_ARROWHEAD",N[N.U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING=722]="U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING",N[N.U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING=723]="U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING",N[N.U_MODIFIER_LETTER_UP_TACK=724]="U_MODIFIER_LETTER_UP_TACK",N[N.U_MODIFIER_LETTER_DOWN_TACK=725]="U_MODIFIER_LETTER_DOWN_TACK",N[N.U_MODIFIER_LETTER_PLUS_SIGN=726]="U_MODIFIER_LETTER_PLUS_SIGN",N[N.U_MODIFIER_LETTER_MINUS_SIGN=727]="U_MODIFIER_LETTER_MINUS_SIGN",N[N.U_BREVE=728]="U_BREVE",N[N.U_DOT_ABOVE=729]="U_DOT_ABOVE",N[N.U_RING_ABOVE=730]="U_RING_ABOVE",N[N.U_OGONEK=731]="U_OGONEK",N[N.U_SMALL_TILDE=732]="U_SMALL_TILDE",N[N.U_DOUBLE_ACUTE_ACCENT=733]="U_DOUBLE_ACUTE_ACCENT",N[N.U_MODIFIER_LETTER_RHOTIC_HOOK=734]="U_MODIFIER_LETTER_RHOTIC_HOOK",N[N.U_MODIFIER_LETTER_CROSS_ACCENT=735]="U_MODIFIER_LETTER_CROSS_ACCENT",N[N.U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR=741]="U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR",N[N.U_MODIFIER_LETTER_HIGH_TONE_BAR=742]="U_MODIFIER_LETTER_HIGH_TONE_BAR",N[N.U_MODIFIER_LETTER_MID_TONE_BAR=743]="U_MODIFIER_LETTER_MID_TONE_BAR",N[N.U_MODIFIER_LETTER_LOW_TONE_BAR=744]="U_MODIFIER_LETTER_LOW_TONE_BAR",N[N.U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR=745]="U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR",N[N.U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK=746]="U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK",N[N.U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK=747]="U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK",N[N.U_MODIFIER_LETTER_UNASPIRATED=749]="U_MODIFIER_LETTER_UNASPIRATED",N[N.U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD=751]="U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD",N[N.U_MODIFIER_LETTER_LOW_UP_ARROWHEAD=752]="U_MODIFIER_LETTER_LOW_UP_ARROWHEAD",N[N.U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD=753]="U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD",N[N.U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD=754]="U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD",N[N.U_MODIFIER_LETTER_LOW_RING=755]="U_MODIFIER_LETTER_LOW_RING",N[N.U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT=756]="U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT",N[N.U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT=757]="U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT",N[N.U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT=758]="U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT",N[N.U_MODIFIER_LETTER_LOW_TILDE=759]="U_MODIFIER_LETTER_LOW_TILDE",N[N.U_MODIFIER_LETTER_RAISED_COLON=760]="U_MODIFIER_LETTER_RAISED_COLON",N[N.U_MODIFIER_LETTER_BEGIN_HIGH_TONE=761]="U_MODIFIER_LETTER_BEGIN_HIGH_TONE",N[N.U_MODIFIER_LETTER_END_HIGH_TONE=762]="U_MODIFIER_LETTER_END_HIGH_TONE",N[N.U_MODIFIER_LETTER_BEGIN_LOW_TONE=763]="U_MODIFIER_LETTER_BEGIN_LOW_TONE",N[N.U_MODIFIER_LETTER_END_LOW_TONE=764]="U_MODIFIER_LETTER_END_LOW_TONE",N[N.U_MODIFIER_LETTER_SHELF=765]="U_MODIFIER_LETTER_SHELF",N[N.U_MODIFIER_LETTER_OPEN_SHELF=766]="U_MODIFIER_LETTER_OPEN_SHELF",N[N.U_MODIFIER_LETTER_LOW_LEFT_ARROW=767]="U_MODIFIER_LETTER_LOW_LEFT_ARROW",N[N.U_GREEK_LOWER_NUMERAL_SIGN=885]="U_GREEK_LOWER_NUMERAL_SIGN",N[N.U_GREEK_TONOS=900]="U_GREEK_TONOS",N[N.U_GREEK_DIALYTIKA_TONOS=901]="U_GREEK_DIALYTIKA_TONOS",N[N.U_GREEK_KORONIS=8125]="U_GREEK_KORONIS",N[N.U_GREEK_PSILI=8127]="U_GREEK_PSILI",N[N.U_GREEK_PERISPOMENI=8128]="U_GREEK_PERISPOMENI",N[N.U_GREEK_DIALYTIKA_AND_PERISPOMENI=8129]="U_GREEK_DIALYTIKA_AND_PERISPOMENI",N[N.U_GREEK_PSILI_AND_VARIA=8141]="U_GREEK_PSILI_AND_VARIA",N[N.U_GREEK_PSILI_AND_OXIA=8142]="U_GREEK_PSILI_AND_OXIA",N[N.U_GREEK_PSILI_AND_PERISPOMENI=8143]="U_GREEK_PSILI_AND_PERISPOMENI",N[N.U_GREEK_DASIA_AND_VARIA=8157]="U_GREEK_DASIA_AND_VARIA",N[N.U_GREEK_DASIA_AND_OXIA=8158]="U_GREEK_DASIA_AND_OXIA",N[N.U_GREEK_DASIA_AND_PERISPOMENI=8159]="U_GREEK_DASIA_AND_PERISPOMENI",N[N.U_GREEK_DIALYTIKA_AND_VARIA=8173]="U_GREEK_DIALYTIKA_AND_VARIA",N[N.U_GREEK_DIALYTIKA_AND_OXIA=8174]="U_GREEK_DIALYTIKA_AND_OXIA",N[N.U_GREEK_VARIA=8175]="U_GREEK_VARIA",N[N.U_GREEK_OXIA=8189]="U_GREEK_OXIA",N[N.U_GREEK_DASIA=8190]="U_GREEK_DASIA",N[N.U_IDEOGRAPHIC_FULL_STOP=12290]="U_IDEOGRAPHIC_FULL_STOP",N[N.U_LEFT_CORNER_BRACKET=12300]="U_LEFT_CORNER_BRACKET",N[N.U_RIGHT_CORNER_BRACKET=12301]="U_RIGHT_CORNER_BRACKET",N[N.U_LEFT_BLACK_LENTICULAR_BRACKET=12304]="U_LEFT_BLACK_LENTICULAR_BRACKET",N[N.U_RIGHT_BLACK_LENTICULAR_BRACKET=12305]="U_RIGHT_BLACK_LENTICULAR_BRACKET",N[N.U_OVERLINE=8254]="U_OVERLINE",N[N.UTF8_BOM=65279]="UTF8_BOM",N[N.U_FULLWIDTH_SEMICOLON=65307]="U_FULLWIDTH_SEMICOLON",N[N.U_FULLWIDTH_COMMA=65292]="U_FULLWIDTH_COMMA"}(X||(j.CharCode=X={}))},9087:(N,j)=>{var X;Object.defineProperty(j,"__esModule",{value:!0}),j.SetWithKey=void 0,j.groupBy=function(N,j){const X=Object.create(null);for(const ie of N){const N=j(ie);let se=X[N];se||(se=X[N]=[]),se.push(ie)}return X},j.diffSets=function(N,j){const X=[],ie=[];for(const ie of N)j.has(ie)||X.push(ie);for(const X of j)N.has(X)||ie.push(X);return{removed:X,added:ie}},j.diffMaps=function(N,j){const X=[],ie=[];for(const[ie,se]of N)j.has(ie)||X.push(se);for(const[X,se]of j)N.has(X)||ie.push(se);return{removed:X,added:ie}},j.intersection=function(N,j){const X=new Set;for(const ie of j)N.has(ie)&&X.add(ie);return X};class s{static{X=Symbol.toStringTag}constructor(N,j){this.toKey=j,this._map=new Map,this[X]="SetWithKey";for(const j of N)this.add(j)}get size(){return this._map.size}add(N){const j=this.toKey(N);return this._map.set(j,N),this}delete(N){return this._map.delete(this.toKey(N))}has(N){return this._map.has(this.toKey(N))}*entries(){for(const N of this._map.values())yield[N,N]}keys(){return this.values()}*values(){for(const N of this._map.values())yield N}clear(){this._map.clear()}forEach(N,j){this._map.forEach((X=>N.call(j,X,X,this)))}[Symbol.iterator](){return this.values()}}j.SetWithKey=s},4838:(N,j)=>{function i(N){return(j,X,ie)=>{let se=null,le=null;if("function"==typeof ie.value?(se="value",le=ie.value):"function"==typeof ie.get&&(se="get",le=ie.get),!le)throw new Error("not supported");ie[se]=N(le,X)}}Object.defineProperty(j,"__esModule",{value:!0}),j.memoize=function(N,j,X){let ie=null,se=null;if("function"==typeof X.value?(ie="value",se=X.value,0!==se.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof X.get&&(ie="get",se=X.get),!se)throw new Error("not supported");const le=`$memoize$${j}`;X[ie]=function(...N){return this.hasOwnProperty(le)||Object.defineProperty(this,le,{configurable:!1,enumerable:!1,writable:!1,value:se.apply(this,N)}),this[le]}},j.debounce=function(N,j,X){return i(((ie,se)=>{const le=`$debounce$${se}`,he=`$debounce$result$${se}`;return function(...se){this[he]||(this[he]=X?X():void 0),clearTimeout(this[le]),j&&(this[he]=j(this[he],...se),se=[this[he]]),this[le]=setTimeout((()=>{ie.apply(this,se),this[he]=X?X():void 0}),N)}}))},j.throttle=function(N,j,X){return i(((ie,se)=>{const le=`$throttle$timer$${se}`,he=`$throttle$result$${se}`,ce=`$throttle$lastRun$${se}`,_e=`$throttle$pending$${se}`;return function(...se){if(this[he]||(this[he]=X?X():void 0),null!==this[ce]&&void 0!==this[ce]||(this[ce]=-Number.MAX_VALUE),j&&(this[he]=j(this[he],...se)),this[_e])return;const me=this[ce]+N;me<=Date.now()?(this[ce]=Date.now(),ie.apply(this,[this[he]]),this[he]=X?X():void 0):(this[_e]=!0,this[le]=setTimeout((()=>{this[_e]=!1,this[ce]=Date.now(),ie.apply(this,[this[he]]),this[he]=X?X():void 0}),me-Date.now()))}}))}},9807:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.BugIndicatingError=j.ErrorNoTelemetry=j.ExpectedError=j.NotSupportedError=j.NotImplementedError=j.ReadonlyError=j.CancellationError=j.errorHandler=j.ErrorHandler=void 0,j.setUnexpectedErrorHandler=function(N){j.errorHandler.setUnexpectedErrorHandler(N)},j.isSigPipeError=function(N){if(!N||"object"!=typeof N)return!1;const j=N;return"EPIPE"===j.code&&"WRITE"===j.syscall?.toUpperCase()},j.onUnexpectedError=function(N){r(N)||j.errorHandler.onUnexpectedError(N)},j.onUnexpectedExternalError=function(N){r(N)||j.errorHandler.onUnexpectedExternalError(N)},j.transformErrorForSerialization=function(N){if(N instanceof Error){const{name:j,message:X}=N;return{$isError:!0,name:j,message:X,stack:N.stacktrace||N.stack,noTelemetry:c.isErrorNoTelemetry(N)}}return N},j.transformErrorFromSerialization=function(N){let j;return N.noTelemetry?j=new c:(j=new Error,j.name=N.name),j.message=N.message,j.stack=N.stack,j},j.isCancellationError=r,j.canceled=function(){const N=new Error(X);return N.name=N.message,N},j.illegalArgument=function(N){return N?new Error(`Illegal argument: ${N}`):new Error("Illegal argument")},j.illegalState=function(N){return N?new Error(`Illegal state: ${N}`):new Error("Illegal state")},j.getErrorMessage=function(N){return N?N.message?N.message:N.stack?N.stack.split("\n")[0]:String(N):"Error"};class i{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(N){setTimeout((()=>{if(N.stack){if(c.isErrorNoTelemetry(N))throw new c(N.message+"\n\n"+N.stack);throw new Error(N.message+"\n\n"+N.stack)}throw N}),0)}}addListener(N){return this.listeners.push(N),()=>{this._removeListener(N)}}emit(N){this.listeners.forEach((j=>{j(N)}))}_removeListener(N){this.listeners.splice(this.listeners.indexOf(N),1)}setUnexpectedErrorHandler(N){this.unexpectedErrorHandler=N}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(N){this.unexpectedErrorHandler(N),this.emit(N)}onUnexpectedExternalError(N){this.unexpectedErrorHandler(N)}}j.ErrorHandler=i,j.errorHandler=new i;const X="Canceled";function r(N){return N instanceof n||N instanceof Error&&N.name===X&&N.message===X}class n extends Error{constructor(){super(X),this.name=this.message}}j.CancellationError=n;class o extends TypeError{constructor(N){super(N?`${N} is read-only and cannot be changed`:"Cannot change read-only property")}}j.ReadonlyError=o;class a extends Error{constructor(N){super("NotImplemented"),N&&(this.message=N)}}j.NotImplementedError=a;class l extends Error{constructor(N){super("NotSupported"),N&&(this.message=N)}}j.NotSupportedError=l;class h extends Error{constructor(){super(...arguments),this.isExpected=!0}}j.ExpectedError=h;class c extends Error{constructor(N){super(N),this.name="CodeExpectedError"}static fromError(N){if(N instanceof c)return N;const j=new c;return j.message=N.message,j.stack=N.stack,j}static isErrorNoTelemetry(N){return"CodeExpectedError"===N.name}}j.ErrorNoTelemetry=c;class d extends Error{constructor(N){super(N||"An unexpected bug occurred."),Object.setPrototypeOf(this,d.prototype)}}j.BugIndicatingError=d},802:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ValueWithChangeEvent=j.Relay=j.EventBufferer=j.DynamicListEventMultiplexer=j.EventMultiplexer=j.MicrotaskEmitter=j.DebounceEmitter=j.PauseableEmitter=j.AsyncEmitter=j.createEventDeliveryQueue=j.Emitter=j.ListenerRefusalError=j.ListenerLeakError=j.EventProfiling=j.Event=void 0,j.setGlobalLeakWarningThreshold=function(N){const j=me;return me=N,{dispose(){me=j}}};const ie=X(9807),se=X(8841),le=X(7150),he=X(6317),ce=X(9725);var _e;!function(N){function t(N){return(j,X=null,ie)=>{let se,le=!1;return se=N((N=>{if(!le)return se?se.dispose():le=!0,j.call(X,N)}),null,ie),le&&se.dispose(),se}}function i(N,j,X){return r(((X,ie=null,se)=>N((N=>X.call(ie,j(N))),null,se)),X)}function s(N,j,X){return r(((X,ie=null,se)=>N((N=>j(N)&&X.call(ie,N)),null,se)),X)}function r(N,j){let X;const ie=new m({onWillAddFirstListener(){X=N(ie.fire,ie)},onDidRemoveLastListener(){X?.dispose()}});return j?.add(ie),ie.event}function o(N,j,X=100,ie=!1,se=!1,le,he){let ce,_e,me,ve,Se=0;const be=new m({leakWarningThreshold:le,onWillAddFirstListener(){ce=N((N=>{Se++,_e=j(_e,N),ie&&!me&&(be.fire(_e),_e=void 0),ve=()=>{const N=_e;_e=void 0,me=void 0,(!ie||Se>1)&&be.fire(N),Se=0},"number"==typeof X?(clearTimeout(me),me=setTimeout(ve,X)):void 0===me&&(me=0,queueMicrotask(ve))}))},onWillRemoveListener(){se&&Se>0&&ve?.()},onDidRemoveLastListener(){ve=void 0,ce.dispose()}});return he?.add(be),be.event}N.None=()=>le.Disposable.None,N.defer=function(N,j){return o(N,(()=>{}),0,void 0,!0,void 0,j)},N.once=t,N.map=i,N.forEach=function(N,j,X){return r(((X,ie=null,se)=>N((N=>{j(N),X.call(ie,N)}),null,se)),X)},N.filter=s,N.signal=function(N){return N},N.any=function(...N){return(j,X=null,ie)=>{return se=(0,le.combinedDisposable)(...N.map((N=>N((N=>j.call(X,N)))))),(he=ie)instanceof Array?he.push(se):he&&he.add(se),se;var se,he}},N.reduce=function(N,j,X,ie){let se=X;return i(N,(N=>(se=j(se,N),se)),ie)},N.debounce=o,N.accumulate=function(j,X=0,ie){return N.debounce(j,((N,j)=>N?(N.push(j),N):[j]),X,void 0,!0,void 0,ie)},N.latch=function(N,j=(N,j)=>N===j,X){let ie,se=!0;return s(N,(N=>{const X=se||!j(N,ie);return se=!1,ie=N,X}),X)},N.split=function(j,X,ie){return[N.filter(j,X,ie),N.filter(j,(N=>!X(N)),ie)]},N.buffer=function(N,j=!1,X=[],ie){let se=X.slice(),le=N((N=>{se?se.push(N):he.fire(N)}));ie&&ie.add(le);const o=()=>{se?.forEach((N=>he.fire(N))),se=null},he=new m({onWillAddFirstListener(){le||(le=N((N=>he.fire(N))),ie&&ie.add(le))},onDidAddFirstListener(){se&&(j?setTimeout(o):o())},onDidRemoveLastListener(){le&&le.dispose(),le=null}});return ie&&ie.add(he),he.event},N.chain=function(N,X){return(ie,se,le)=>{const he=X(new l);return N((function(N){const X=he.evaluate(N);X!==j&&ie.call(se,X)}),void 0,le)}};const j=Symbol("HaltChainable");class l{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push((j=>(N(j),j))),this}filter(N){return this.steps.push((X=>N(X)?X:j)),this}reduce(N,j){let X=j;return this.steps.push((j=>(X=N(X,j),X))),this}latch(N=(N,j)=>N===j){let X,ie=!0;return this.steps.push((se=>{const le=ie||!N(se,X);return ie=!1,X=se,le?se:j})),this}evaluate(N){for(const X of this.steps)if((N=X(N))===j)break;return N}}N.fromNodeEventEmitter=function(N,j,X=N=>N){const s=(...N)=>ie.fire(X(...N)),ie=new m({onWillAddFirstListener:()=>N.on(j,s),onDidRemoveLastListener:()=>N.removeListener(j,s)});return ie.event},N.fromDOMEventEmitter=function(N,j,X=N=>N){const s=(...N)=>ie.fire(X(...N)),ie=new m({onWillAddFirstListener:()=>N.addEventListener(j,s),onDidRemoveLastListener:()=>N.removeEventListener(j,s)});return ie.event},N.toPromise=function(N){return new Promise((j=>t(N)(j)))},N.fromPromise=function(N){const j=new m;return N.then((N=>{j.fire(N)}),(()=>{j.fire(void 0)})).finally((()=>{j.dispose()})),j.event},N.forward=function(N,j){return N((N=>j.fire(N)))},N.runAndSubscribe=function(N,j,X){return j(X),N((N=>j(N)))};class h{constructor(N,j){this._observable=N,this._counter=0,this._hasChanged=!1;const X={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new m(X),j&&j.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,j){this._hasChanged=!0}endUpdate(N){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}N.fromObservable=function(N,j){return new h(N,j).emitter.event},N.fromObservableLight=function(N){return(j,X,ie)=>{let se=0,he=!1;const ce={beginUpdate(){se++},endUpdate(){se--,0===se&&(N.reportChanges(),he&&(he=!1,j.call(X)))},handlePossibleChange(){},handleChange(){he=!0}};N.addObserver(ce),N.reportChanges();const _e={dispose(){N.removeObserver(ce)}};return ie instanceof le.DisposableStore?ie.add(_e):Array.isArray(ie)&&ie.push(_e),_e}}}(_e||(j.Event=_e={}));class h{static{this.all=new Set}static{this._idPool=0}constructor(N){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${N}_${h._idPool++}`,h.all.add(this)}start(N){this._stopWatch=new ce.StopWatch,this.listenerCount=N}stop(){if(this._stopWatch){const N=this._stopWatch.elapsed();this.durations.push(N),this.elapsedOverall+=N,this.invocationCount+=1,this._stopWatch=void 0}}}j.EventProfiling=h;let me=-1;class d{static{this._idPool=1}constructor(N,j,X=(d._idPool++).toString(16).padStart(3,"0")){this._errorHandler=N,this.threshold=j,this.name=X,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(N,j){const X=this.threshold;if(X<=0||j{const j=this._stacks.get(N.value)||0;this._stacks.set(N.value,j-1)}}getMostFrequentStack(){if(!this._stacks)return;let N,j=0;for(const[X,ie]of this._stacks)(!N||j0||this._options?.leakWarningThreshold?new d(N?.onListenerError??ie.onUnexpectedError,this._options?.leakWarningThreshold??me):void 0,this._perfMon=this._options?._profName?new h(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(N,j,X)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const N=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(N);const j=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],X=new f(`${N}. HINT: Stack shows most frequent listener (${j[1]}-times)`,j[0]);return(this._options?.onListenerError||ie.onUnexpectedError)(X),le.Disposable.None}if(this._disposed)return le.Disposable.None;j&&(N=N.bind(j));const se=new g(N);let he;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(se.stack=u.create(),he=this._leakageMon.check(se.stack,this._size+1)),this._listeners?this._listeners instanceof g?(this._deliveryQueue??=new v,this._listeners=[this._listeners,se]):this._listeners.push(se):(this._options?.onWillAddFirstListener?.(this),this._listeners=se,this._options?.onDidAddFirstListener?.(this)),this._size++;const ce=(0,le.toDisposable)((()=>{he?.(),this._removeListener(se)}));return X instanceof le.DisposableStore?X.add(ce):Array.isArray(X)&&X.push(ce),ce},this._event}_removeListener(N){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),void(this._size=0);const j=this._listeners,X=j.indexOf(N);if(-1===X)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,j[X]=void 0;const ie=this._deliveryQueue.current===this;if(2*this._size<=j.length){let N=0;for(let X=0;X0}}j.Emitter=m,j.createEventDeliveryQueue=()=>new v;class v{constructor(){this.i=-1,this.end=0}enqueue(N,j,X){this.i=0,this.end=X,this.current=N,this.value=j}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}j.AsyncEmitter=class extends m{async fireAsync(N,j,X){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new he.LinkedList),((N,j)=>{if(N instanceof g)j(N);else for(let X=0;Xthis._asyncDeliveryQueue.push([j.value,N])));this._asyncDeliveryQueue.size>0&&!j.isCancellationRequested;){const[se,le]=this._asyncDeliveryQueue.shift(),he=[],ce={...le,token:j,waitUntil:N=>{if(Object.isFrozen(he))throw new Error("waitUntil can NOT be called asynchronous");X&&(N=X(N,se)),he.push(N)}};try{se(ce)}catch(N){(0,ie.onUnexpectedError)(N);continue}Object.freeze(he),await Promise.allSettled(he).then((N=>{for(const j of N)"rejected"===j.status&&(0,ie.onUnexpectedError)(j.reason)}))}}};class S extends m{get isPaused(){return 0!==this._isPaused}constructor(N){super(N),this._isPaused=0,this._eventQueue=new he.LinkedList,this._mergeFn=N?.merge}pause(){this._isPaused++}resume(){if(0!==this._isPaused&&0==--this._isPaused)if(this._mergeFn){if(this._eventQueue.size>0){const N=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(N))}}else for(;!this._isPaused&&0!==this._eventQueue.size;)super.fire(this._eventQueue.shift())}fire(N){this._size&&(0!==this._isPaused?this._eventQueue.push(N):super.fire(N))}}j.PauseableEmitter=S,j.DebounceEmitter=class extends S{constructor(N){super(N),this._delay=N.delay??100}fire(N){this._handle||(this.pause(),this._handle=setTimeout((()=>{this._handle=void 0,this.resume()}),this._delay)),super.fire(N)}},j.MicrotaskEmitter=class extends m{constructor(N){super(N),this._queuedEvents=[],this._mergeFn=N?.merge}fire(N){this.hasListeners()&&(this._queuedEvents.push(N),1===this._queuedEvents.length&&queueMicrotask((()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach((N=>super.fire(N))),this._queuedEvents=[]})))}};class b{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new m({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(N){const j={event:N,listener:null};return this.events.push(j),this.hasListeners&&this.hook(j),(0,le.toDisposable)((0,se.createSingleCallFunction)((()=>{this.hasListeners&&this.unhook(j);const N=this.events.indexOf(j);this.events.splice(N,1)})))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach((N=>this.hook(N)))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach((N=>this.unhook(N)))}hook(N){N.listener=N.event((N=>this.emitter.fire(N)))}unhook(N){N.listener?.dispose(),N.listener=null}dispose(){this.emitter.dispose();for(const N of this.events)N.listener?.dispose();this.events=[]}}j.EventMultiplexer=b,j.DynamicListEventMultiplexer=class{constructor(N,j,X,ie){this._store=new le.DisposableStore;const se=this._store.add(new b),he=this._store.add(new le.DisposableMap);function a(N){he.set(N,se.add(ie(N)))}for(const j of N)a(j);this._store.add(j((N=>{a(N)}))),this._store.add(X((N=>{he.deleteAndDispose(N)}))),this.event=se.event}dispose(){this._store.dispose()}},j.EventBufferer=class{constructor(){this.data=[]}wrapEvent(N,j,X){return(ie,se,le)=>N((N=>{const le=this.data[this.data.length-1];if(!j)return void(le?le.buffers.push((()=>ie.call(se,N))):ie.call(se,N));const he=le;he?(he.items??=[],he.items.push(N),0===he.buffers.length&&le.buffers.push((()=>{he.reducedResult??=X?he.items.reduce(j,X):he.items.reduce(j),ie.call(se,he.reducedResult)}))):ie.call(se,j(X,N))}),void 0,le)}bufferEvents(N){const j={buffers:new Array};this.data.push(j);const X=N();return this.data.pop(),j.buffers.forEach((N=>N())),X}},j.Relay=class{constructor(){this.listening=!1,this.inputEvent=_e.None,this.inputEventListener=le.Disposable.None,this.emitter=new m({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(N){this.inputEvent=N,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=N(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},j.ValueWithChangeEvent=class{static const(N){return new C(N)}constructor(N){this._value=N,this._onDidChange=new m,this.onDidChange=this._onDidChange.event}get value(){return this._value}set value(N){N!==this._value&&(this._value=N,this._onDidChange.fire(void 0))}};class C{constructor(N){this.value=N,this.onDidChange=_e.None}}},8841:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.createSingleCallFunction=function(N,j){const X=this;let ie,se=!1;return function(){if(se)return ie;if(se=!0,j)try{ie=N.apply(X,arguments)}finally{j()}else ie=N.apply(X,arguments);return ie}}},6304:function(N,j,X){var ie=this&&this.__createBinding||(Object.create?function(N,j,X,ie){void 0===ie&&(ie=X);var se=Object.getOwnPropertyDescriptor(j,X);se&&!("get"in se?!j.__esModule:se.writable||se.configurable)||(se={enumerable:!0,get:function(){return j[X]}}),Object.defineProperty(N,ie,se)}:function(N,j,X,ie){void 0===ie&&(ie=X),N[ie]=j[X]}),se=this&&this.__setModuleDefault||(Object.create?function(N,j){Object.defineProperty(N,"default",{enumerable:!0,value:j})}:function(N,j){N.default=j}),le=this&&this.__importStar||function(N){if(N&&N.__esModule)return N;var j={};if(null!=N)for(var X in N)"default"!==X&&Object.prototype.hasOwnProperty.call(N,X)&&ie(j,N,X);return se(j,N),j};Object.defineProperty(j,"__esModule",{value:!0}),j.StringSHA1=j.Hasher=void 0,j.hash=function(N){return a(N,0)},j.doHash=a,j.numberHash=l,j.stringHash=h,j.toHexString=_;const he=le(X(1316));function a(N,j){switch(typeof N){case"object":return null===N?l(349,j):Array.isArray(N)?(X=N,ie=l(104579,ie=j),X.reduce(((N,j)=>a(j,N)),ie)):function(N,j){return j=l(181387,j),Object.keys(N).sort().reduce(((j,X)=>(j=h(X,j),a(N[X],j))),j)}(N,j);case"string":return h(N,j);case"boolean":return function(N,j){return l(N?433:863,j)}(N,j);case"number":return l(N,j);case"undefined":return l(937,j);default:return l(617,j)}var X,ie}function l(N,j){return(j<<5)-j+N|0}function h(N,j){j=l(149417,j);for(let X=0,ie=N.length;X>>ie)>>>0}function u(N,j=0,X=N.byteLength,ie=0){for(let se=0;seN.toString(16).padStart(2,"0"))).join(""):function(N,j,X="0"){for(;N.length>>0).toString(16),j/4)}j.Hasher=class{constructor(){this._value=0}get value(){return this._value}hash(N){return this._value=a(N,this._value),this._value}},function(N){N[N.BLOCK_SIZE=64]="BLOCK_SIZE",N[N.UNICODE_REPLACEMENT=65533]="UNICODE_REPLACEMENT"}(ce||(ce={}));class f{static{this._bigBlock32=new DataView(new ArrayBuffer(320))}constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(ce.BLOCK_SIZE+3),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(N){const j=N.length;if(0===j)return;const X=this._buff;let ie,se,le=this._buffLen,_e=this._leftoverHighSurrogate;for(0!==_e?(ie=_e,se=-1,_e=0):(ie=N.charCodeAt(0),se=0);;){let me=ie;if(he.isHighSurrogate(ie)){if(!(se+1>>6,N[j++]=128|(63&X)>>>0):X<65536?(N[j++]=224|(61440&X)>>>12,N[j++]=128|(4032&X)>>>6,N[j++]=128|(63&X)>>>0):(N[j++]=240|(1835008&X)>>>18,N[j++]=128|(258048&X)>>>12,N[j++]=128|(4032&X)>>>6,N[j++]=128|(63&X)>>>0),j>=ce.BLOCK_SIZE&&(this._step(),j-=ce.BLOCK_SIZE,this._totalLen+=ce.BLOCK_SIZE,N[0]=N[ce.BLOCK_SIZE+0],N[1]=N[ce.BLOCK_SIZE+1],N[2]=N[ce.BLOCK_SIZE+2]),j}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,ce.UNICODE_REPLACEMENT)),this._totalLen+=this._buffLen,this._wrapUp()),_(this._h0)+_(this._h1)+_(this._h2)+_(this._h3)+_(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,u(this._buff,this._buffLen),this._buffLen>56&&(this._step(),u(this._buff));const N=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(N/4294967296),!1),this._buffDV.setUint32(60,N%4294967296,!1),this._step()}_step(){const N=f._bigBlock32,j=this._buffDV;for(let X=0;X<64;X+=4)N.setUint32(X,j.getUint32(X,!1),!1);for(let j=64;j<320;j+=4)N.setUint32(j,d(N.getUint32(j-12,!1)^N.getUint32(j-32,!1)^N.getUint32(j-56,!1)^N.getUint32(j-64,!1),1),!1);let X,ie,se,le=this._h0,he=this._h1,ce=this._h2,_e=this._h3,me=this._h4;for(let j=0;j<80;j++)j<20?(X=he&ce|~he&_e,ie=1518500249):j<40?(X=he^ce^_e,ie=1859775393):j<60?(X=he&ce|he&_e|ce&_e,ie=2400959708):(X=he^ce^_e,ie=3395469782),se=d(le,5)+X+me+ie+N.getUint32(4*j,!1)&4294967295,me=_e,_e=ce,ce=d(he,30),he=le,le=se;this._h0=this._h0+le&4294967295,this._h1=this._h1+he&4294967295,this._h2=this._h2+ce&4294967295,this._h3=this._h3+_e&4294967295,this._h4=this._h4+me&4294967295}}j.StringSHA1=f},4218:(N,j)=>{var X;Object.defineProperty(j,"__esModule",{value:!0}),j.Iterable=void 0,function(N){function t(N){return N&&"object"==typeof N&&"function"==typeof N[Symbol.iterator]}N.is=t;const j=Object.freeze([]);function*s(N){yield N}N.empty=function(){return j},N.single=s,N.wrap=function(N){return t(N)?N:s(N)},N.from=function(N){return N||j},N.reverse=function*(N){for(let j=N.length-1;j>=0;j--)yield N[j]},N.isEmpty=function(N){return!N||!0===N[Symbol.iterator]().next().done},N.first=function(N){return N[Symbol.iterator]().next().value},N.some=function(N,j){let X=0;for(const ie of N)if(j(ie,X++))return!0;return!1},N.find=function(N,j){for(const X of N)if(j(X))return X},N.filter=function*(N,j){for(const X of N)j(X)&&(yield X)},N.map=function*(N,j){let X=0;for(const ie of N)yield j(ie,X++)},N.flatMap=function*(N,j){let X=0;for(const ie of N)yield*j(ie,X++)},N.concat=function*(...N){for(const j of N)yield*j},N.reduce=function(N,j,X){let ie=X;for(const X of N)ie=j(ie,X);return ie},N.slice=function*(N,j,X=N.length){for(j<0&&(j+=N.length),X<0?X+=N.length:X>N.length&&(X=N.length);jse}]},N.asyncToArray=async function(N){const j=[];for await(const X of N)j.push(X);return Promise.resolve(j)}}(X||(j.Iterable=X={}))},7883:(N,j)=>{var X,ie;Object.defineProperty(j,"__esModule",{value:!0}),j.KeyMod=j.KeyCodeUtils=j.ScanCodeUtils=j.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE=j.EVENT_KEY_CODE_MAP=j.ScanCode=j.KeyCode=void 0,j.KeyChord=function(N,j){return(N|(65535&j)<<16>>>0)>>>0},function(N){N[N.DependsOnKbLayout=-1]="DependsOnKbLayout",N[N.Unknown=0]="Unknown",N[N.Backspace=1]="Backspace",N[N.Tab=2]="Tab",N[N.Enter=3]="Enter",N[N.Shift=4]="Shift",N[N.Ctrl=5]="Ctrl",N[N.Alt=6]="Alt",N[N.PauseBreak=7]="PauseBreak",N[N.CapsLock=8]="CapsLock",N[N.Escape=9]="Escape",N[N.Space=10]="Space",N[N.PageUp=11]="PageUp",N[N.PageDown=12]="PageDown",N[N.End=13]="End",N[N.Home=14]="Home",N[N.LeftArrow=15]="LeftArrow",N[N.UpArrow=16]="UpArrow",N[N.RightArrow=17]="RightArrow",N[N.DownArrow=18]="DownArrow",N[N.Insert=19]="Insert",N[N.Delete=20]="Delete",N[N.Digit0=21]="Digit0",N[N.Digit1=22]="Digit1",N[N.Digit2=23]="Digit2",N[N.Digit3=24]="Digit3",N[N.Digit4=25]="Digit4",N[N.Digit5=26]="Digit5",N[N.Digit6=27]="Digit6",N[N.Digit7=28]="Digit7",N[N.Digit8=29]="Digit8",N[N.Digit9=30]="Digit9",N[N.KeyA=31]="KeyA",N[N.KeyB=32]="KeyB",N[N.KeyC=33]="KeyC",N[N.KeyD=34]="KeyD",N[N.KeyE=35]="KeyE",N[N.KeyF=36]="KeyF",N[N.KeyG=37]="KeyG",N[N.KeyH=38]="KeyH",N[N.KeyI=39]="KeyI",N[N.KeyJ=40]="KeyJ",N[N.KeyK=41]="KeyK",N[N.KeyL=42]="KeyL",N[N.KeyM=43]="KeyM",N[N.KeyN=44]="KeyN",N[N.KeyO=45]="KeyO",N[N.KeyP=46]="KeyP",N[N.KeyQ=47]="KeyQ",N[N.KeyR=48]="KeyR",N[N.KeyS=49]="KeyS",N[N.KeyT=50]="KeyT",N[N.KeyU=51]="KeyU",N[N.KeyV=52]="KeyV",N[N.KeyW=53]="KeyW",N[N.KeyX=54]="KeyX",N[N.KeyY=55]="KeyY",N[N.KeyZ=56]="KeyZ",N[N.Meta=57]="Meta",N[N.ContextMenu=58]="ContextMenu",N[N.F1=59]="F1",N[N.F2=60]="F2",N[N.F3=61]="F3",N[N.F4=62]="F4",N[N.F5=63]="F5",N[N.F6=64]="F6",N[N.F7=65]="F7",N[N.F8=66]="F8",N[N.F9=67]="F9",N[N.F10=68]="F10",N[N.F11=69]="F11",N[N.F12=70]="F12",N[N.F13=71]="F13",N[N.F14=72]="F14",N[N.F15=73]="F15",N[N.F16=74]="F16",N[N.F17=75]="F17",N[N.F18=76]="F18",N[N.F19=77]="F19",N[N.F20=78]="F20",N[N.F21=79]="F21",N[N.F22=80]="F22",N[N.F23=81]="F23",N[N.F24=82]="F24",N[N.NumLock=83]="NumLock",N[N.ScrollLock=84]="ScrollLock",N[N.Semicolon=85]="Semicolon",N[N.Equal=86]="Equal",N[N.Comma=87]="Comma",N[N.Minus=88]="Minus",N[N.Period=89]="Period",N[N.Slash=90]="Slash",N[N.Backquote=91]="Backquote",N[N.BracketLeft=92]="BracketLeft",N[N.Backslash=93]="Backslash",N[N.BracketRight=94]="BracketRight",N[N.Quote=95]="Quote",N[N.OEM_8=96]="OEM_8",N[N.IntlBackslash=97]="IntlBackslash",N[N.Numpad0=98]="Numpad0",N[N.Numpad1=99]="Numpad1",N[N.Numpad2=100]="Numpad2",N[N.Numpad3=101]="Numpad3",N[N.Numpad4=102]="Numpad4",N[N.Numpad5=103]="Numpad5",N[N.Numpad6=104]="Numpad6",N[N.Numpad7=105]="Numpad7",N[N.Numpad8=106]="Numpad8",N[N.Numpad9=107]="Numpad9",N[N.NumpadMultiply=108]="NumpadMultiply",N[N.NumpadAdd=109]="NumpadAdd",N[N.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",N[N.NumpadSubtract=111]="NumpadSubtract",N[N.NumpadDecimal=112]="NumpadDecimal",N[N.NumpadDivide=113]="NumpadDivide",N[N.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",N[N.ABNT_C1=115]="ABNT_C1",N[N.ABNT_C2=116]="ABNT_C2",N[N.AudioVolumeMute=117]="AudioVolumeMute",N[N.AudioVolumeUp=118]="AudioVolumeUp",N[N.AudioVolumeDown=119]="AudioVolumeDown",N[N.BrowserSearch=120]="BrowserSearch",N[N.BrowserHome=121]="BrowserHome",N[N.BrowserBack=122]="BrowserBack",N[N.BrowserForward=123]="BrowserForward",N[N.MediaTrackNext=124]="MediaTrackNext",N[N.MediaTrackPrevious=125]="MediaTrackPrevious",N[N.MediaStop=126]="MediaStop",N[N.MediaPlayPause=127]="MediaPlayPause",N[N.LaunchMediaPlayer=128]="LaunchMediaPlayer",N[N.LaunchMail=129]="LaunchMail",N[N.LaunchApp2=130]="LaunchApp2",N[N.Clear=131]="Clear",N[N.MAX_VALUE=132]="MAX_VALUE"}(X||(j.KeyCode=X={})),function(N){N[N.DependsOnKbLayout=-1]="DependsOnKbLayout",N[N.None=0]="None",N[N.Hyper=1]="Hyper",N[N.Super=2]="Super",N[N.Fn=3]="Fn",N[N.FnLock=4]="FnLock",N[N.Suspend=5]="Suspend",N[N.Resume=6]="Resume",N[N.Turbo=7]="Turbo",N[N.Sleep=8]="Sleep",N[N.WakeUp=9]="WakeUp",N[N.KeyA=10]="KeyA",N[N.KeyB=11]="KeyB",N[N.KeyC=12]="KeyC",N[N.KeyD=13]="KeyD",N[N.KeyE=14]="KeyE",N[N.KeyF=15]="KeyF",N[N.KeyG=16]="KeyG",N[N.KeyH=17]="KeyH",N[N.KeyI=18]="KeyI",N[N.KeyJ=19]="KeyJ",N[N.KeyK=20]="KeyK",N[N.KeyL=21]="KeyL",N[N.KeyM=22]="KeyM",N[N.KeyN=23]="KeyN",N[N.KeyO=24]="KeyO",N[N.KeyP=25]="KeyP",N[N.KeyQ=26]="KeyQ",N[N.KeyR=27]="KeyR",N[N.KeyS=28]="KeyS",N[N.KeyT=29]="KeyT",N[N.KeyU=30]="KeyU",N[N.KeyV=31]="KeyV",N[N.KeyW=32]="KeyW",N[N.KeyX=33]="KeyX",N[N.KeyY=34]="KeyY",N[N.KeyZ=35]="KeyZ",N[N.Digit1=36]="Digit1",N[N.Digit2=37]="Digit2",N[N.Digit3=38]="Digit3",N[N.Digit4=39]="Digit4",N[N.Digit5=40]="Digit5",N[N.Digit6=41]="Digit6",N[N.Digit7=42]="Digit7",N[N.Digit8=43]="Digit8",N[N.Digit9=44]="Digit9",N[N.Digit0=45]="Digit0",N[N.Enter=46]="Enter",N[N.Escape=47]="Escape",N[N.Backspace=48]="Backspace",N[N.Tab=49]="Tab",N[N.Space=50]="Space",N[N.Minus=51]="Minus",N[N.Equal=52]="Equal",N[N.BracketLeft=53]="BracketLeft",N[N.BracketRight=54]="BracketRight",N[N.Backslash=55]="Backslash",N[N.IntlHash=56]="IntlHash",N[N.Semicolon=57]="Semicolon",N[N.Quote=58]="Quote",N[N.Backquote=59]="Backquote",N[N.Comma=60]="Comma",N[N.Period=61]="Period",N[N.Slash=62]="Slash",N[N.CapsLock=63]="CapsLock",N[N.F1=64]="F1",N[N.F2=65]="F2",N[N.F3=66]="F3",N[N.F4=67]="F4",N[N.F5=68]="F5",N[N.F6=69]="F6",N[N.F7=70]="F7",N[N.F8=71]="F8",N[N.F9=72]="F9",N[N.F10=73]="F10",N[N.F11=74]="F11",N[N.F12=75]="F12",N[N.PrintScreen=76]="PrintScreen",N[N.ScrollLock=77]="ScrollLock",N[N.Pause=78]="Pause",N[N.Insert=79]="Insert",N[N.Home=80]="Home",N[N.PageUp=81]="PageUp",N[N.Delete=82]="Delete",N[N.End=83]="End",N[N.PageDown=84]="PageDown",N[N.ArrowRight=85]="ArrowRight",N[N.ArrowLeft=86]="ArrowLeft",N[N.ArrowDown=87]="ArrowDown",N[N.ArrowUp=88]="ArrowUp",N[N.NumLock=89]="NumLock",N[N.NumpadDivide=90]="NumpadDivide",N[N.NumpadMultiply=91]="NumpadMultiply",N[N.NumpadSubtract=92]="NumpadSubtract",N[N.NumpadAdd=93]="NumpadAdd",N[N.NumpadEnter=94]="NumpadEnter",N[N.Numpad1=95]="Numpad1",N[N.Numpad2=96]="Numpad2",N[N.Numpad3=97]="Numpad3",N[N.Numpad4=98]="Numpad4",N[N.Numpad5=99]="Numpad5",N[N.Numpad6=100]="Numpad6",N[N.Numpad7=101]="Numpad7",N[N.Numpad8=102]="Numpad8",N[N.Numpad9=103]="Numpad9",N[N.Numpad0=104]="Numpad0",N[N.NumpadDecimal=105]="NumpadDecimal",N[N.IntlBackslash=106]="IntlBackslash",N[N.ContextMenu=107]="ContextMenu",N[N.Power=108]="Power",N[N.NumpadEqual=109]="NumpadEqual",N[N.F13=110]="F13",N[N.F14=111]="F14",N[N.F15=112]="F15",N[N.F16=113]="F16",N[N.F17=114]="F17",N[N.F18=115]="F18",N[N.F19=116]="F19",N[N.F20=117]="F20",N[N.F21=118]="F21",N[N.F22=119]="F22",N[N.F23=120]="F23",N[N.F24=121]="F24",N[N.Open=122]="Open",N[N.Help=123]="Help",N[N.Select=124]="Select",N[N.Again=125]="Again",N[N.Undo=126]="Undo",N[N.Cut=127]="Cut",N[N.Copy=128]="Copy",N[N.Paste=129]="Paste",N[N.Find=130]="Find",N[N.AudioVolumeMute=131]="AudioVolumeMute",N[N.AudioVolumeUp=132]="AudioVolumeUp",N[N.AudioVolumeDown=133]="AudioVolumeDown",N[N.NumpadComma=134]="NumpadComma",N[N.IntlRo=135]="IntlRo",N[N.KanaMode=136]="KanaMode",N[N.IntlYen=137]="IntlYen",N[N.Convert=138]="Convert",N[N.NonConvert=139]="NonConvert",N[N.Lang1=140]="Lang1",N[N.Lang2=141]="Lang2",N[N.Lang3=142]="Lang3",N[N.Lang4=143]="Lang4",N[N.Lang5=144]="Lang5",N[N.Abort=145]="Abort",N[N.Props=146]="Props",N[N.NumpadParenLeft=147]="NumpadParenLeft",N[N.NumpadParenRight=148]="NumpadParenRight",N[N.NumpadBackspace=149]="NumpadBackspace",N[N.NumpadMemoryStore=150]="NumpadMemoryStore",N[N.NumpadMemoryRecall=151]="NumpadMemoryRecall",N[N.NumpadMemoryClear=152]="NumpadMemoryClear",N[N.NumpadMemoryAdd=153]="NumpadMemoryAdd",N[N.NumpadMemorySubtract=154]="NumpadMemorySubtract",N[N.NumpadClear=155]="NumpadClear",N[N.NumpadClearEntry=156]="NumpadClearEntry",N[N.ControlLeft=157]="ControlLeft",N[N.ShiftLeft=158]="ShiftLeft",N[N.AltLeft=159]="AltLeft",N[N.MetaLeft=160]="MetaLeft",N[N.ControlRight=161]="ControlRight",N[N.ShiftRight=162]="ShiftRight",N[N.AltRight=163]="AltRight",N[N.MetaRight=164]="MetaRight",N[N.BrightnessUp=165]="BrightnessUp",N[N.BrightnessDown=166]="BrightnessDown",N[N.MediaPlay=167]="MediaPlay",N[N.MediaRecord=168]="MediaRecord",N[N.MediaFastForward=169]="MediaFastForward",N[N.MediaRewind=170]="MediaRewind",N[N.MediaTrackNext=171]="MediaTrackNext",N[N.MediaTrackPrevious=172]="MediaTrackPrevious",N[N.MediaStop=173]="MediaStop",N[N.Eject=174]="Eject",N[N.MediaPlayPause=175]="MediaPlayPause",N[N.MediaSelect=176]="MediaSelect",N[N.LaunchMail=177]="LaunchMail",N[N.LaunchApp2=178]="LaunchApp2",N[N.LaunchApp1=179]="LaunchApp1",N[N.SelectTask=180]="SelectTask",N[N.LaunchScreenSaver=181]="LaunchScreenSaver",N[N.BrowserSearch=182]="BrowserSearch",N[N.BrowserHome=183]="BrowserHome",N[N.BrowserBack=184]="BrowserBack",N[N.BrowserForward=185]="BrowserForward",N[N.BrowserStop=186]="BrowserStop",N[N.BrowserRefresh=187]="BrowserRefresh",N[N.BrowserFavorites=188]="BrowserFavorites",N[N.ZoomToggle=189]="ZoomToggle",N[N.MailReply=190]="MailReply",N[N.MailForward=191]="MailForward",N[N.MailSend=192]="MailSend",N[N.MAX_VALUE=193]="MAX_VALUE"}(ie||(j.ScanCode=ie={}));class r{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(N,j){this._keyCodeToStr[N]=j,this._strToKeyCode[j.toLowerCase()]=N}keyCodeToStr(N){return this._keyCodeToStr[N]}strToKeyCode(N){return this._strToKeyCode[N.toLowerCase()]||X.Unknown}}const se=new r,le=new r,he=new r;j.EVENT_KEY_CODE_MAP=new Array(230),j.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE={};const ce=[],_e=Object.create(null),me=Object.create(null);var ve,Se;j.ScanCodeUtils={lowerCaseToEnum:N=>me[N]||ie.None,toEnum:N=>_e[N]||ie.None,toString:N=>ce[N]||"None"},function(N){N.toString=function(N){return se.keyCodeToStr(N)},N.fromString=function(N){return se.strToKeyCode(N)},N.toUserSettingsUS=function(N){return le.keyCodeToStr(N)},N.toUserSettingsGeneral=function(N){return he.keyCodeToStr(N)},N.fromUserSettings=function(N){return le.strToKeyCode(N)||he.strToKeyCode(N)},N.toElectronAccelerator=function(N){if(N>=X.Numpad0&&N<=X.NumpadDivide)return null;switch(N){case X.UpArrow:return"Up";case X.DownArrow:return"Down";case X.LeftArrow:return"Left";case X.RightArrow:return"Right"}return se.keyCodeToStr(N)}}(ve||(j.KeyCodeUtils=ve={})),function(N){N[N.CtrlCmd=2048]="CtrlCmd",N[N.Shift=1024]="Shift",N[N.Alt=512]="Alt",N[N.WinCtrl=256]="WinCtrl"}(Se||(j.KeyMod=Se={}))},2811:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.ResolvedKeybinding=j.ResolvedChord=j.Keybinding=j.ScanCodeChord=j.KeyCodeChord=void 0,j.decodeKeybinding=function(N,j){if("number"==typeof N){if(0===N)return null;const X=(65535&N)>>>0,ie=(4294901760&N)>>>16;return new c(0!==ie?[a(X,j),a(ie,j)]:[a(X,j)])}{const X=[];for(let ie=0;ie{Object.defineProperty(j,"__esModule",{value:!0}),j.Lazy=void 0,j.Lazy=class{constructor(N){this.executor=N,this._didRun=!1}get hasValue(){return this._didRun}get value(){if(!this._didRun)try{this._value=this.executor()}catch(N){this._error=N}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}},7150:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.DisposableMap=j.ImmortalReference=j.AsyncReferenceCollection=j.ReferenceCollection=j.SafeDisposable=j.RefCountedDisposable=j.MandatoryMutableDisposable=j.MutableDisposable=j.Disposable=j.DisposableStore=j.DisposableTracker=void 0,j.setDisposableTracker=function(N){_e=N},j.trackDisposable=c,j.markAsDisposed=d,j.markAsSingleton=function(N){return _e?.markAsSingleton(N),N},j.isDisposable=_,j.dispose=f,j.disposeIfDisposable=function(N){for(const j of N)_(j)&&j.dispose();return[]},j.combinedDisposable=function(...N){const j=p((()=>f(N)));return function(N,j){if(_e)for(const X of N)_e.setParent(X,j)}(N,j),j},j.toDisposable=p,j.disposeOnReturn=function(N){const j=new g;try{N(j)}finally{j.dispose()}};const ie=X(3058),se=X(9087),le=X(2608),he=X(8841),ce=X(4218);let _e=null;class h{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(N){let j=this.livingDisposables.get(N);return j||(j={parent:null,source:null,isSingleton:!1,value:N,idx:h.idx++},this.livingDisposables.set(N,j)),j}trackDisposable(N){const j=this.getDisposableData(N);j.source||(j.source=(new Error).stack)}setParent(N,j){this.getDisposableData(N).parent=j}markAsDisposed(N){this.livingDisposables.delete(N)}markAsSingleton(N){this.getDisposableData(N).isSingleton=!0}getRootParent(N,j){const X=j.get(N);if(X)return X;const ie=N.parent?this.getRootParent(this.getDisposableData(N.parent),j):N;return j.set(N,ie),ie}getTrackedDisposables(){const N=new Map;return[...this.livingDisposables.entries()].filter((([,j])=>null!==j.source&&!this.getRootParent(j,N).isSingleton)).flatMap((([N])=>N))}computeLeakingDisposables(N=10,j){let X;if(j)X=j;else{const N=new Map,j=[...this.livingDisposables.values()].filter((j=>null!==j.source&&!this.getRootParent(j,N).isSingleton));if(0===j.length)return;const ie=new Set(j.map((N=>N.value)));if(X=j.filter((N=>!(N.parent&&ie.has(N.parent)))),0===X.length)throw new Error("There are cyclic diposable chains!")}if(!X)return;function o(N){const j=N.source.split("\n").map((N=>N.trim().replace("at ",""))).filter((N=>""!==N));return function(N,j){for(;N.length>0&&j.some((j=>"string"==typeof j?j===N[0]:N[0].match(j)));)N.shift()}(j,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),j.reverse()}const he=new le.SetMap;for(const N of X){const j=o(N);for(let X=0;X<=j.length;X++)he.add(j.slice(0,X).join("\n"),N)}X.sort((0,ie.compareBy)((N=>N.idx),ie.numberComparator));let ce="",_e=0;for(const j of X.slice(0,N)){_e++;const N=o(j),ie=[];for(let j=0;jo(N)[j])),(N=>N));delete _e[N[j]];for(const[N,j]of Object.entries(_e))ie.unshift(` - stacktraces of ${j.length} other leaks continue with ${N}`);ie.unshift(le)}ce+=`\n\n\n==================== Leaking disposable ${_e}/${X.length}: ${j.value.constructor.name} ====================\n${ie.join("\n")}\n============================================================\n\n`}return X.length>N&&(ce+=`\n\n\n... and ${X.length-N} more leaking disposables\n\n`),{leaks:X,details:ce}}}function c(N){return _e?.trackDisposable(N),N}function d(N){_e?.markAsDisposed(N)}function u(N,j){_e?.setParent(N,j)}function _(N){return"object"==typeof N&&null!==N&&"function"==typeof N.dispose&&0===N.dispose.length}function f(N){if(ce.Iterable.is(N)){const j=[];for(const X of N)if(X)try{X.dispose()}catch(N){j.push(N)}if(1===j.length)throw j[0];if(j.length>1)throw new AggregateError(j,"Encountered errors while disposing of store");return Array.isArray(N)?[]:N}if(N)return N.dispose(),N}function p(N){const j=c({dispose:(0,he.createSingleCallFunction)((()=>{d(j),N()}))});return j}j.DisposableTracker=h;class g{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,c(this)}dispose(){this._isDisposed||(d(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{f(this._toDispose)}finally{this._toDispose.clear()}}add(N){if(!N)return N;if(N===this)throw new Error("Cannot register a disposable on itself!");return u(N,this),this._isDisposed?g.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(N),N}delete(N){if(N){if(N===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(N),N.dispose()}}deleteAndLeak(N){N&&this._toDispose.has(N)&&(this._toDispose.delete(N),u(N,null))}}j.DisposableStore=g;class m{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new g,c(this),u(this._store,this)}dispose(){d(this),this._store.dispose()}_register(N){if(N===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(N)}}j.Disposable=m;class v{constructor(){this._isDisposed=!1,c(this)}get value(){return this._isDisposed?void 0:this._value}set value(N){this._isDisposed||N===this._value||(this._value?.dispose(),N&&u(N,this),this._value=N)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,d(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){const N=this._value;return this._value=void 0,N&&u(N,null),N}}j.MutableDisposable=v,j.MandatoryMutableDisposable=class{constructor(N){this._disposable=new v,this._isDisposed=!1,this._disposable.value=N}get value(){return this._disposable.value}set value(N){this._isDisposed||N===this._disposable.value||(this._disposable.value=N)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},j.RefCountedDisposable=class{constructor(N){this._disposable=N,this._counter=1}acquire(){return this._counter++,this}release(){return 0==--this._counter&&this._disposable.dispose(),this}},j.SafeDisposable=class{constructor(){this.dispose=()=>{},this.unset=()=>{},this.isset=()=>!1,c(this)}set(N){let j=N;return this.unset=()=>j=void 0,this.isset=()=>void 0!==j,this.dispose=()=>{j&&(j(),j=void 0,d(this))},this}},j.ReferenceCollection=class{constructor(){this.references=new Map}acquire(N,...j){let X=this.references.get(N);X||(X={counter:0,object:this.createReferencedObject(N,...j)},this.references.set(N,X));const{object:ie}=X,se=(0,he.createSingleCallFunction)((()=>{0==--X.counter&&(this.destroyReferencedObject(N,X.object),this.references.delete(N))}));return X.counter++,{object:ie,dispose:se}}},j.AsyncReferenceCollection=class{constructor(N){this.referenceCollection=N}async acquire(N,...j){const X=this.referenceCollection.acquire(N,...j);try{return{object:await X.object,dispose:()=>X.dispose()}}catch(N){throw X.dispose(),N}}},j.ImmortalReference=class{constructor(N){this.object=N}dispose(){}};class S{constructor(){this._store=new Map,this._isDisposed=!1,c(this)}dispose(){d(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{f(this._store.values())}finally{this._store.clear()}}has(N){return this._store.has(N)}get size(){return this._store.size}get(N){return this._store.get(N)}set(N,j,X=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),X||this._store.get(N)?.dispose(),this._store.set(N,j)}deleteAndDispose(N){this._store.get(N)?.dispose(),this._store.delete(N)}deleteAndLeak(N){const j=this._store.get(N);return this._store.delete(N),j}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}j.DisposableMap=S},6317:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.LinkedList=void 0;class i{static{this.Undefined=new i(void 0)}constructor(N){this.element=N,this.next=i.Undefined,this.prev=i.Undefined}}class s{constructor(){this._first=i.Undefined,this._last=i.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===i.Undefined}clear(){let N=this._first;for(;N!==i.Undefined;){const j=N.next;N.prev=i.Undefined,N.next=i.Undefined,N=j}this._first=i.Undefined,this._last=i.Undefined,this._size=0}unshift(N){return this._insert(N,!1)}push(N){return this._insert(N,!0)}_insert(N,j){const X=new i(N);if(this._first===i.Undefined)this._first=X,this._last=X;else if(j){const N=this._last;this._last=X,X.prev=N,N.next=X}else{const N=this._first;this._first=X,X.next=N,N.prev=X}this._size+=1;let ie=!1;return()=>{ie||(ie=!0,this._remove(X))}}shift(){if(this._first!==i.Undefined){const N=this._first.element;return this._remove(this._first),N}}pop(){if(this._last!==i.Undefined){const N=this._last.element;return this._remove(this._last),N}}_remove(N){if(N.prev!==i.Undefined&&N.next!==i.Undefined){const j=N.prev;j.next=N.next,N.next.prev=j}else N.prev===i.Undefined&&N.next===i.Undefined?(this._first=i.Undefined,this._last=i.Undefined):N.next===i.Undefined?(this._last=this._last.prev,this._last.next=i.Undefined):N.prev===i.Undefined&&(this._first=this._first.next,this._first.prev=i.Undefined);this._size-=1}*[Symbol.iterator](){let N=this._first;for(;N!==i.Undefined;)yield N.element,N=N.next}}j.LinkedList=s},2608:(N,j)=>{var X;Object.defineProperty(j,"__esModule",{value:!0}),j.SetMap=j.BidirectionalMap=j.CounterSet=j.Touch=void 0,j.getOrSet=function(N,j,X){let ie=N.get(j);return void 0===ie&&(ie=X,N.set(j,ie)),ie},j.mapToString=function(N){const j=[];return N.forEach(((N,X)=>{j.push(`${X} => ${N}`)})),`Map(${N.size}) {${j.join(", ")}}`},j.setToString=function(N){const j=[];return N.forEach((N=>{j.push(N)})),`Set(${N.size}) {${j.join(", ")}}`},j.mapsStrictEqualIgnoreOrder=function(N,j){if(N===j)return!0;if(N.size!==j.size)return!1;for(const[X,ie]of N)if(!j.has(X)||j.get(X)!==ie)return!1;for(const[X]of j)if(!N.has(X))return!1;return!0},function(N){N[N.None=0]="None",N[N.AsOld=1]="AsOld",N[N.AsNew=2]="AsNew"}(X||(j.Touch=X={})),j.CounterSet=class{constructor(){this.map=new Map}add(N){return this.map.set(N,(this.map.get(N)||0)+1),this}delete(N){let j=this.map.get(N)||0;return 0!==j&&(j--,0===j?this.map.delete(N):this.map.set(N,j),!0)}has(N){return this.map.has(N)}},j.BidirectionalMap=class{constructor(N){if(this._m1=new Map,this._m2=new Map,N)for(const[j,X]of N)this.set(j,X)}clear(){this._m1.clear(),this._m2.clear()}set(N,j){this._m1.set(N,j),this._m2.set(j,N)}get(N){return this._m1.get(N)}getKey(N){return this._m2.get(N)}delete(N){const j=this._m1.get(N);return void 0!==j&&(this._m1.delete(N),this._m2.delete(j),!0)}forEach(N,j){this._m1.forEach(((X,ie)=>{N.call(j,X,ie,this)}))}keys(){return this._m1.keys()}values(){return this._m1.values()}},j.SetMap=class{constructor(){this.map=new Map}add(N,j){let X=this.map.get(N);X||(X=new Set,this.map.set(N,X)),X.add(j)}delete(N,j){const X=this.map.get(N);X&&(X.delete(j),0===X.size&&this.map.delete(N))}forEach(N,j){const X=this.map.get(N);X&&X.forEach(j)}get(N){return this.map.get(N)||new Set}}},7704:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.SlidingWindowAverage=j.MovingAverage=j.Counter=void 0,j.clamp=function(N,j,X){return Math.min(Math.max(N,j),X)},j.rot=function(N,j){return(j+N%j)%j},j.isPointWithinTriangle=function(N,j,X,ie,se,le,he,ce){const _e=he-X,me=ce-ie,ve=se-X,Se=le-ie,be=N-X,Ce=j-ie,ye=_e*_e+me*me,we=_e*ve+me*Se,Ee=_e*be+me*Ce,De=ve*ve+Se*Se,Le=ve*be+Se*Ce,Ae=1/(ye*De-we*we),Re=(De*Ee-we*Le)*Ae,Te=(ye*Le-we*Ee)*Ae;return Re>=0&&Te>=0&&Re+Te<1},j.Counter=class{constructor(){this._next=0}getNext(){return this._next++}},j.MovingAverage=class{constructor(){this._n=1,this._val=0}update(N){return this._val=this._val+(N-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}},j.SlidingWindowAverage=class{constructor(N){this._n=0,this._val=0,this._values=[],this._index=0,this._sum=0,this._values=new Array(N),this._values.fill(0,0,N)}update(N){const j=this._values[this._index];return this._values[this._index]=N,this._index=(this._index+1)%this._values.length,this._sum-=j,this._sum+=N,this._n{Object.defineProperty(j,"__esModule",{value:!0}),j.isAndroid=j.isEdge=j.isSafari=j.isFirefox=j.isChrome=j.OS=j.OperatingSystem=j.setTimeout0=j.setTimeout0IsFaster=j.translationsConfigFile=j.platformLocale=j.locale=j.Language=j.language=j.userAgent=j.platform=j.isCI=j.isMobile=j.isIOS=j.webWorkerOrigin=j.isWebWorker=j.isWeb=j.isElectron=j.isNative=j.isLinuxSnap=j.isLinux=j.isMacintosh=j.isWindows=j.Platform=j.LANGUAGE_DEFAULT=void 0,j.PlatformToString=function(N){switch(N){case Te.Web:return"Web";case Te.Mac:return"Mac";case Te.Linux:return"Linux";case Te.Windows:return"Windows"}},j.isLittleEndian=function(){if(!Pe){Pe=!0;const N=new Uint8Array(2);N[0]=1,N[1]=2;const j=new Uint16Array(N.buffer);Ie=513===j[0]}return Ie},j.isBigSurOrNewer=function(N){return parseFloat(N)>=20},j.LANGUAGE_DEFAULT="en";let X,ie,se,le=!1,he=!1,ce=!1,_e=!1,me=!1,ve=!1,Se=!1,be=!1,Ce=!1,ye=!1,we=j.LANGUAGE_DEFAULT,Ee=j.LANGUAGE_DEFAULT;const De=globalThis;let Le;void 0!==De.vscode&&void 0!==De.vscode.process?Le=De.vscode.process:"undefined"!=typeof process&&"string"==typeof process?.versions?.node&&(Le=process);const Ae="string"==typeof Le?.versions?.electron,Re=Ae&&"renderer"===Le?.type;if("object"==typeof Le){le="win32"===Le.platform,he="darwin"===Le.platform,ce="linux"===Le.platform,_e=ce&&!!Le.env.SNAP&&!!Le.env.SNAP_REVISION,Se=Ae,Ce=!!Le.env.CI||!!Le.env.BUILD_ARTIFACTSTAGINGDIRECTORY,X=j.LANGUAGE_DEFAULT,we=j.LANGUAGE_DEFAULT;const se=Le.env.VSCODE_NLS_CONFIG;if(se)try{const N=JSON.parse(se);X=N.userLocale,Ee=N.osLocale,we=N.resolvedLanguage||j.LANGUAGE_DEFAULT,ie=N.languagePack?.translationsConfigFile}catch(N){}me=!0}else"object"!=typeof navigator||Re?console.error("Unable to resolve platform."):(se=navigator.userAgent,le=se.indexOf("Windows")>=0,he=se.indexOf("Macintosh")>=0,be=(se.indexOf("Macintosh")>=0||se.indexOf("iPad")>=0||se.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ce=se.indexOf("Linux")>=0,ye=se?.indexOf("Mobi")>=0,ve=!0,we=globalThis._VSCODE_NLS_LANGUAGE||j.LANGUAGE_DEFAULT,X=navigator.language.toLowerCase(),Ee=X);var Te;!function(N){N[N.Web=0]="Web",N[N.Mac=1]="Mac",N[N.Linux=2]="Linux",N[N.Windows=3]="Windows"}(Te||(j.Platform=Te={}));let ke=Te.Web;var Me,Oe;he?ke=Te.Mac:le?ke=Te.Windows:ce&&(ke=Te.Linux),j.isWindows=le,j.isMacintosh=he,j.isLinux=ce,j.isLinuxSnap=_e,j.isNative=me,j.isElectron=Se,j.isWeb=ve,j.isWebWorker=ve&&"function"==typeof De.importScripts,j.webWorkerOrigin=j.isWebWorker?De.origin:void 0,j.isIOS=be,j.isMobile=ye,j.isCI=Ce,j.platform=ke,j.userAgent=se,j.language=we,function(N){N.value=function(){return j.language},N.isDefaultVariant=function(){return 2===j.language.length?"en"===j.language:j.language.length>=3&&"e"===j.language[0]&&"n"===j.language[1]&&"-"===j.language[2]},N.isDefault=function(){return"en"===j.language}}(Me||(j.Language=Me={})),j.locale=X,j.platformLocale=Ee,j.translationsConfigFile=ie,j.setTimeout0IsFaster="function"==typeof De.postMessage&&!De.importScripts,j.setTimeout0=(()=>{if(j.setTimeout0IsFaster){const N=[];De.addEventListener("message",(j=>{if(j.data&&j.data.vscodeScheduleAsyncWork)for(let X=0,ie=N.length;X{const ie=++j;N.push({id:ie,callback:X}),De.postMessage({vscodeScheduleAsyncWork:ie},"*")}}return N=>setTimeout(N)})(),function(N){N[N.Windows=1]="Windows",N[N.Macintosh=2]="Macintosh",N[N.Linux=3]="Linux"}(Oe||(j.OperatingSystem=Oe={})),j.OS=he||be?Oe.Macintosh:le?Oe.Windows:Oe.Linux;let Ie=!0,Pe=!1;j.isChrome=!!(j.userAgent&&j.userAgent.indexOf("Chrome")>=0),j.isFirefox=!!(j.userAgent&&j.userAgent.indexOf("Firefox")>=0),j.isSafari=!!(!j.isChrome&&j.userAgent&&j.userAgent.indexOf("Safari")>=0),j.isEdge=!!(j.userAgent&&j.userAgent.indexOf("Edg/")>=0),j.isAndroid=!!(j.userAgent&&j.userAgent.indexOf("Android")>=0)},9881:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.SmoothScrollingOperation=j.SmoothScrollingUpdate=j.Scrollable=j.ScrollState=j.ScrollbarVisibility=void 0;const ie=X(802),se=X(7150);var le;!function(N){N[N.Auto=1]="Auto",N[N.Hidden=2]="Hidden",N[N.Visible=3]="Visible"}(le||(j.ScrollbarVisibility=le={}));class o{constructor(N,j,X,ie,se,le,he){this._forceIntegerValues=N,this._scrollStateBrand=void 0,this._forceIntegerValues&&(j|=0,X|=0,ie|=0,se|=0,le|=0,he|=0),this.rawScrollLeft=ie,this.rawScrollTop=he,j<0&&(j=0),ie+j>X&&(ie=X-j),ie<0&&(ie=0),se<0&&(se=0),he+se>le&&(he=le-se),he<0&&(he=0),this.width=j,this.scrollWidth=X,this.scrollLeft=ie,this.height=se,this.scrollHeight=le,this.scrollTop=he}equals(N){return this.rawScrollLeft===N.rawScrollLeft&&this.rawScrollTop===N.rawScrollTop&&this.width===N.width&&this.scrollWidth===N.scrollWidth&&this.scrollLeft===N.scrollLeft&&this.height===N.height&&this.scrollHeight===N.scrollHeight&&this.scrollTop===N.scrollTop}withScrollDimensions(N,j){return new o(this._forceIntegerValues,void 0!==N.width?N.width:this.width,void 0!==N.scrollWidth?N.scrollWidth:this.scrollWidth,j?this.rawScrollLeft:this.scrollLeft,void 0!==N.height?N.height:this.height,void 0!==N.scrollHeight?N.scrollHeight:this.scrollHeight,j?this.rawScrollTop:this.scrollTop)}withScrollPosition(N){return new o(this._forceIntegerValues,this.width,this.scrollWidth,void 0!==N.scrollLeft?N.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,void 0!==N.scrollTop?N.scrollTop:this.rawScrollTop)}createScrollEvent(N,j){const X=this.width!==N.width,ie=this.scrollWidth!==N.scrollWidth,se=this.scrollLeft!==N.scrollLeft,le=this.height!==N.height,he=this.scrollHeight!==N.scrollHeight,ce=this.scrollTop!==N.scrollTop;return{inSmoothScrolling:j,oldWidth:N.width,oldScrollWidth:N.scrollWidth,oldScrollLeft:N.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:N.height,oldScrollHeight:N.scrollHeight,oldScrollTop:N.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:X,scrollWidthChanged:ie,scrollLeftChanged:se,heightChanged:le,scrollHeightChanged:he,scrollTopChanged:ce}}}j.ScrollState=o;class a extends se.Disposable{constructor(N){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ie.Emitter),this.onScroll=this._onScroll.event,this._smoothScrollDuration=N.smoothScrollDuration,this._scheduleAtNextAnimationFrame=N.scheduleAtNextAnimationFrame,this._state=new o(N.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(N){this._smoothScrollDuration=N}validateScrollPosition(N){return this._state.withScrollPosition(N)}getScrollDimensions(){return this._state}setScrollDimensions(N,j){const X=this._state.withScrollDimensions(N,j);this._setState(X,Boolean(this._smoothScrolling)),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(N){const j=this._state.withScrollPosition(N);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(j,!1)}setScrollPositionSmooth(N,j){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(N);if(this._smoothScrolling){N={scrollLeft:void 0===N.scrollLeft?this._smoothScrolling.to.scrollLeft:N.scrollLeft,scrollTop:void 0===N.scrollTop?this._smoothScrolling.to.scrollTop:N.scrollTop};const X=this._state.withScrollPosition(N);if(this._smoothScrolling.to.scrollLeft===X.scrollLeft&&this._smoothScrolling.to.scrollTop===X.scrollTop)return;let ie;ie=j?new c(this._smoothScrolling.from,X,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,X,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=ie}else{const j=this._state.withScrollPosition(N);this._smoothScrolling=c.start(this._state,j,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame((()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())}))}hasPendingScrollAnimation(){return Boolean(this._smoothScrolling)}_performSmoothScrolling(){if(!this._smoothScrolling)return;const N=this._smoothScrolling.tick(),j=this._state.withScrollPosition(N);return this._setState(j,!0),this._smoothScrolling?N.isDone?(this._smoothScrolling.dispose(),void(this._smoothScrolling=null)):void(this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame((()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())}))):void 0}_setState(N,j){const X=this._state;X.equals(N)||(this._state=N,this._onScroll.fire(this._state.createScrollEvent(X,j)))}}j.Scrollable=a;class l{constructor(N,j,X){this.scrollLeft=N,this.scrollTop=j,this.isDone=X}}function h(N,j){const X=j-N;return function(j){return N+X*(1-(ie=1-j,Math.pow(ie,3)));var ie}}j.SmoothScrollingUpdate=l;class c{constructor(N,j,X,ie){this.from=N,this.to=j,this.duration=ie,this.startTime=X,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(N,j,X){if(Math.abs(N-j)>2.5*X){let he,ce;return N{Object.defineProperty(j,"__esModule",{value:!0}),j.StopWatch=void 0;const X=globalThis.performance&&"function"==typeof globalThis.performance.now;class s{static create(N){return new s(N)}constructor(N){this._now=X&&!1===N?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}}j.StopWatch=s},1316:(N,j,X)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.noBreakWhitespace=j.CodePointIterator=void 0,j.isFalsyOrWhitespace=function(N){return!N||"string"!=typeof N||0===N.trim().length},j.format=function(N,...j){return 0===j.length?N:N.replace(le,(function(N,X){const ie=parseInt(X,10);return isNaN(ie)||ie<0||ie>=j.length?N:j[ie]}))},j.format2=function(N,j){return 0===Object.keys(j).length?N:N.replace(he,((N,X)=>j[X]??N))},j.htmlAttributeEncodeValue=function(N){return N.replace(/[<>"'&]/g,(N=>{switch(N){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}return N}))},j.escape=function(N){return N.replace(/[<>&]/g,(function(N){switch(N){case"<":return"<";case">":return">";case"&":return"&";default:return N}}))},j.escapeRegExpCharacters=a,j.count=function(N,j){let X=0,ie=N.indexOf(j);for(;-1!==ie;)X++,ie=N.indexOf(j,ie+j.length);return X},j.truncate=function(N,j,X="…"){return N.length<=j?N:`${N.substr(0,j)}${X}`},j.truncateMiddle=function(N,j,X="…"){if(N.length<=j)return N;const ie=Math.ceil(j/2)-X.length/2,se=Math.floor(j/2)-X.length/2;return`${N.substr(0,ie)}${X}${N.substr(N.length-se)}`},j.trim=function(N,j=" "){return h(l(N,j),j)},j.ltrim=l,j.rtrim=h,j.convertSimple2RegExpPattern=function(N){return N.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")},j.stripWildcards=function(N){return N.replace(/\*/g,"")},j.createRegExp=function(N,j,X={}){if(!N)throw new Error("Cannot create regex from empty string");j||(N=a(N)),X.wholeWord&&(/\B/.test(N.charAt(0))||(N="\\b"+N),/\B/.test(N.charAt(N.length-1))||(N+="\\b"));let ie="";return X.global&&(ie+="g"),X.matchCase||(ie+="i"),X.multiline&&(ie+="m"),X.unicode&&(ie+="u"),new RegExp(N,ie)},j.regExpLeadsToEndlessLoop=function(N){return"^"!==N.source&&"^$"!==N.source&&"$"!==N.source&&"^\\s*$"!==N.source&&!(!N.exec("")||0!==N.lastIndex)},j.splitLines=function(N){return N.split(/\r\n|\r|\n/)},j.splitLinesIncludeSeparators=function(N){const j=[],X=N.split(/(\r\n|\r|\n)/);for(let N=0;N=0;X--){const j=N.charCodeAt(X);if(j!==ie.CharCode.Space&&j!==ie.CharCode.Tab)return X}return-1},j.replaceAsync=function(N,j,X){const ie=[];let se=0;for(const le of N.matchAll(j)){if(ie.push(N.slice(se,le.index)),void 0===le.index)throw new Error("match.index should be defined");se=le.index+le[0].length,ie.push(X(le[0],...le.slice(1),le.index,N,le.groups))}return ie.push(N.slice(se)),Promise.all(ie).then((N=>N.join("")))},j.compare=function(N,j){return Nj?1:0},j.compareSubstring=c,j.compareIgnoreCase=function(N,j){return d(N,j,0,N.length,0,j.length)},j.compareSubstringIgnoreCase=d,j.isAsciiDigit=function(N){return N>=ie.CharCode.Digit0&&N<=ie.CharCode.Digit9},j.isLowerAsciiLetter=u,j.isUpperAsciiLetter=function(N){return N>=ie.CharCode.A&&N<=ie.CharCode.Z},j.equalsIgnoreCase=function(N,j){return N.length===j.length&&0===d(N,j)},j.startsWithIgnoreCase=function(N,j){const X=j.length;return!(j.length>N.length)&&0===d(N,j,0,X)},j.commonPrefixLength=function(N,j){const X=Math.min(N.length,j.length);let ie;for(ie=0;iele)return 1}const he=ie-X,ce=le-se;return hece?1:0}function d(N,j,X=0,ie=N.length,se=0,le=j.length){for(;X=128||ce>=128)return c(N.toLowerCase(),j.toLowerCase(),X,ie,se,le);u(he)&&(he-=32),u(ce)&&(ce-=32);const _e=he-ce;if(0!==_e)return _e}const he=ie-X,ce=le-se;return hece?1:0}function u(N){return N>=ie.CharCode.a&&N<=ie.CharCode.z}function _(N){return 55296<=N&&N<=56319}function f(N){return 56320<=N&&N<=57343}function p(N,j){return j-56320+(N-55296<<10)+65536}function g(N,j,X){const ie=N.charCodeAt(X);if(_(ie)&&X+11){const ie=N.charCodeAt(j-2);if(_(ie))return p(ie,X)}return X}(this._str,this._offset);return this._offset-=N>=se.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN?2:1,N}nextCodePoint(){const N=g(this._str,this._len,this._offset);return this._offset+=N>=se.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN?2:1,N}eol(){return this._offset>=this._len}},j.noBreakWhitespace=" "},5015:(N,j)=>{Object.defineProperty(j,"__esModule",{value:!0}),j.MicrotaskDelay=void 0,j.MicrotaskDelay=Symbol("MicrotaskDelay")},8960:(N,j)=>{var X;Object.defineProperty(j,"__esModule",{value:!0}),j.Constants=void 0,j.toUint8=function(N){return N<0?0:N>X.MAX_UINT_8?X.MAX_UINT_8:0|N},j.toUint32=function(N){return N<0?0:N>X.MAX_UINT_32?X.MAX_UINT_32:0|N},function(N){N[N.MAX_SAFE_SMALL_INTEGER=1073741824]="MAX_SAFE_SMALL_INTEGER",N[N.MIN_SAFE_SMALL_INTEGER=-1073741824]="MIN_SAFE_SMALL_INTEGER",N[N.MAX_UINT_8=255]="MAX_UINT_8",N[N.MAX_UINT_16=65535]="MAX_UINT_16",N[N.MAX_UINT_32=4294967295]="MAX_UINT_32",N[N.UNICODE_SUPPLEMENTARY_PLANE_BEGIN=65536]="UNICODE_SUPPLEMENTARY_PLANE_BEGIN"}(X||(j.Constants=X={}))}},j={};function i(X){var ie=j[X];if(void 0!==ie)return ie.exports;var se=j[X]={exports:{}};return N[X].call(se.exports,se,se.exports,i),se.exports}var X={};return(()=>{var N=X;Object.defineProperty(N,"__esModule",{value:!0}),N.Terminal=void 0;const j=i(7721),ie=i(1718),se=i(7150),le=i(3027),he=i(5101),ce=i(6097),_e=i(4335),me=["cols","rows"];let ve=0;class u extends se.Disposable{constructor(N){super(),this._core=this._register(new ie.CoreBrowserTerminal(N)),this._addonManager=this._register(new le.AddonManager),this._publicOptions={...this._core.options};const t=N=>this._core.options[N],i=(N,j)=>{this._checkReadonlyOptions(N),this._core.options[N]=j};for(const N in this._core.options){const j={get:t.bind(this,N),set:i.bind(this,N)};Object.defineProperty(this._publicOptions,N,j)}}_checkReadonlyOptions(N){if(me.includes(N))throw new Error(`Option "${N}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new ce.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _e.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 he.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const N=this._core.coreService.decPrivateModes;let j="none";switch(this._core.coreMouseService.activeProtocol){case"X10":j="x10";break;case"VT200":j="vt200";break;case"DRAG":j="drag";break;case"ANY":j="any"}return{applicationCursorKeysMode:N.applicationCursorKeys,applicationKeypadMode:N.applicationKeypad,bracketedPasteMode:N.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:j,originMode:N.origin,reverseWraparoundMode:N.reverseWraparound,sendFocusMode:N.sendFocus,wraparoundMode:N.wraparound}}get options(){return this._publicOptions}set options(N){for(const j in N)this._publicOptions[j]=N[j]}blur(){this._core.blur()}focus(){this._core.focus()}input(N,j=!0){this._core.input(N,j)}resize(N,j){this._verifyIntegers(N,j),this._core.resize(N,j)}open(N){this._core.open(N)}attachCustomKeyEventHandler(N){this._core.attachCustomKeyEventHandler(N)}attachCustomWheelEventHandler(N){this._core.attachCustomWheelEventHandler(N)}registerLinkProvider(N){return this._core.registerLinkProvider(N)}registerCharacterJoiner(N){return this._checkProposedApi(),this._core.registerCharacterJoiner(N)}deregisterCharacterJoiner(N){this._checkProposedApi(),this._core.deregisterCharacterJoiner(N)}registerMarker(N=0){return this._verifyIntegers(N),this._core.registerMarker(N)}registerDecoration(N){return this._checkProposedApi(),this._verifyPositiveIntegers(N.x??0,N.width??0,N.height??0),this._core.registerDecoration(N)}hasSelection(){return this._core.hasSelection()}select(N,j,X){this._verifyIntegers(N,j,X),this._core.select(N,j,X)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(N,j){this._verifyIntegers(N,j),this._core.selectLines(N,j)}dispose(){super.dispose()}scrollLines(N){this._verifyIntegers(N),this._core.scrollLines(N)}scrollPages(N){this._verifyIntegers(N),this._core.scrollPages(N)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(N){this._verifyIntegers(N),this._core.scrollToLine(N)}clear(){this._core.clear()}write(N,j){this._core.write(N,j)}writeln(N,j){this._core.write(N),this._core.write("\r\n",j)}paste(N){this._core.paste(N)}refresh(N,j){this._verifyIntegers(N,j),this._core.refresh(N,j)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(N){this._addonManager.loadAddon(this,N)}static get strings(){return{get promptLabel(){return j.promptLabel.get()},set promptLabel(N){j.promptLabel.set(N)},get tooMuchOutput(){return j.tooMuchOutput.get()},set tooMuchOutput(N){j.tooMuchOutput.set(N)}}}_verifyIntegers(...N){for(ve of N)if(ve===1/0||isNaN(ve)||ve%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...N){for(ve of N)if(ve&&(ve===1/0||isNaN(ve)||ve%1!=0||ve<0))throw new Error("This API only accepts positive integers")}}N.Terminal=u})(),X})())); \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.js.map b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.js.map new file mode 100644 index 0000000..147916f --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"xterm.js","mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,EACvE,CACA,CATD,CASGC,YAAY,I,miBCJf,gBAEA,UACA,UACA,UAEA,UACA,UAaO,IAAMC,EAAN,cAAmC,EAAAC,WA4BxC,WAAAC,CACmBC,EACMC,EACF,EACL,GAEhBC,QALiB,KAAAF,UAAA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ACO,OAAA8uH,CAAQv4H,EAA2ByJ,GACxC7kB,KAAK0nE,MAAMjwB,MAAMr8B,GACjBpb,KAAK0nE,MAAMjwB,MAAM,OAAQ5yB,EAC3B,CACO,KAAAjb,CAAMwR,GACXpb,KAAK0nE,MAAM99D,MAAMwR,EACnB,CACO,OAAAtX,CAAQ/B,EAAeC,GAC5BhC,KAAKyzI,gBAAgB1xI,EAAOC,GAC5BhC,KAAK0nE,MAAM5jE,QAAQ/B,EAAOC,EAC5B,CACO,KAAAkN,GACLlP,KAAK0nE,MAAMx4D,OACb,CACO,iBAAAuP,GACLze,KAAK0nE,MAAMjpD,mBACb,CACO,SAAAooD,CAAU+sE,GACf5zI,KAAK2yI,cAAc9rE,UAAU7mE,KAAM4zI,EACrC,CACO,kBAAW3d,GAEhB,MAAO,CACL,eAAIhhH,GAAwB,OAAOzR,EAAQyR,YAAYvR,KAAO,EAC9D,eAAIuR,CAAY7K,GAAiB5G,EAAQyR,YAAYtQ,IAAIyF,EAAQ,EACjE,iBAAI3G,GAA0B,OAAOD,EAAQC,cAAcC,KAAO,EAClE,iBAAID,CAAc2G,GAAiB5G,EAAQC,cAAckB,IAAIyF,EAAQ,EAEzE,CAEQ,eAAAqpI,IAAmBzkF,GACzB,IAAKyjF,KAAUzjF,EACb,GAAIyjF,IAAWoB,KAAYlsI,MAAM8qI,IAAWA,EAAS,GAAM,EACzD,MAAM,IAAIhxI,MAAM,iCAGtB,CAEQ,uBAAAiyI,IAA2B1kF,GACjC,IAAKyjF,KAAUzjF,EACb,GAAIyjF,IAAWA,IAAWoB,KAAYlsI,MAAM8qI,IAAWA,EAAS,GAAM,GAAKA,EAAS,GAClF,MAAM,IAAIhxI,MAAM,0CAGtB,EAxPF,Y","sources":["webpack://@xterm/xterm/webpack/universalModuleDefinition","webpack://@xterm/xterm/./src/browser/AccessibilityManager.ts","webpack://@xterm/xterm/./src/browser/Clipboard.ts","webpack://@xterm/xterm/./src/browser/ColorContrastCache.ts","webpack://@xterm/xterm/./src/browser/CoreBrowserTerminal.ts","webpack://@xterm/xterm/./src/browser/Linkifier.ts","webpack://@xterm/xterm/./src/browser/LocalizableStrings.ts","webpack://@xterm/xterm/./src/browser/OscLinkProvider.ts","webpack://@xterm/xterm/./src/browser/RenderDebouncer.ts","webpack://@xterm/xterm/./src/browser/TimeBasedDebouncer.ts","webpack://@xterm/xterm/./src/browser/Types.ts","webpack://@xterm/xterm/./src/browser/Viewport.ts","webpack://@xterm/xterm/./src/browser/decorations/BufferDecorationRenderer.ts","webpack://@xterm/xterm/./src/browser/decorations/ColorZoneStore.ts","webpack://@xterm/xterm/./src/browser/decorations/OverviewRulerRenderer.ts","webpack://@xterm/xterm/./src/browser/input/CompositionHelper.ts","webpack://@xterm/xterm/./src/browser/input/Mouse.ts","webpack://@xterm/xterm/./src/browser/input/MoveToCell.ts","webpack://@xterm/xterm/./src/browser/renderer/dom/DomRenderer.ts","webpack://@xterm/xterm/./src/browser/renderer/dom/DomRendererRowFactory.ts","webpack://@xterm/xterm/./src/browser/renderer/dom/WidthCache.ts","webpack://@xterm/xterm/./src/browser/renderer/shared/Constants.ts","webpack://@xterm/xterm/./src/browser/renderer/shared/RendererUtils.ts","webpack://@xterm/xterm/./src/browser/renderer/shared/SelectionRenderModel.ts","webpack://@xterm/xterm/./src/browser/selection/SelectionModel.ts","webpack://@xterm/xterm/./src/browser/services/CharSizeService.ts","webpack://@xterm/xterm/./src/browser/services/CharacterJoinerService.ts","webpack://@xterm/xterm/./src/browser/services/CoreBrowserService.ts","webpack://@xterm/xterm/./src/browser/services/LinkProviderService.ts","webpack://@xterm/xterm/./src/browser/services/MouseService.ts","webpack://@xterm/xterm/./src/browser/services/RenderService.ts","webpack://@xterm/xterm/./src/browser/services/SelectionService.ts","webpack://@xterm/xterm/./src/browser/services/Services.ts","webpack://@xterm/xterm/./src/browser/services/ThemeService.ts","webpack://@xterm/xterm/./src/common/CircularList.ts","webpack://@xterm/xterm/./src/common/Clone.ts","webpack://@xterm/xterm/./src/common/Color.ts","webpack://@xterm/xterm/./src/common/CoreTerminal.ts","webpack://@xterm/xterm/./src/common/InputHandler.ts","webpack://@xterm/xterm/./src/common/MultiKeyMap.ts","webpack://@xterm/xterm/./src/common/Platform.ts","webpack://@xterm/xterm/./src/common/SortedList.ts","webpack://@xterm/xterm/./src/common/TaskQueue.ts","webpack://@xterm/xterm/./src/common/WindowsMode.ts","webpack://@xterm/xterm/./src/common/buffer/AttributeData.ts","webpack://@xterm/xterm/./src/common/buffer/Buffer.ts","webpack://@xterm/xterm/./src/common/buffer/BufferLine.ts","webpack://@xterm/xterm/./src/common/buffer/BufferRange.ts","webpack://@xterm/xterm/./src/common/buffer/BufferReflow.ts","webpack://@xterm/xterm/./src/common/buffer/BufferSet.ts","webpack://@xterm/xterm/./src/common/buffer/CellData.ts","webpack://@xterm/xterm/./src/common/buffer/Constants.ts","webpack://@xterm/xterm/./src/common/buffer/Marker.ts","webpack://@xterm/xterm/./src/common/data/Charsets.ts","webpack://@xterm/xterm/./src/common/data/EscapeSequences.ts","webpack://@xterm/xterm/./src/common/input/Keyboard.ts","webpack://@xterm/xterm/./src/common/input/TextDecoder.ts","webpack://@xterm/xterm/./src/common/input/UnicodeV6.ts","webpack://@xterm/xterm/./src/common/input/WriteBuffer.ts","webpack://@xterm/xterm/./src/common/input/XParseColor.ts","webpack://@xterm/xterm/./src/common/parser/Constants.ts","webpack://@xterm/xterm/./src/common/parser/DcsParser.ts","webpack://@xterm/xterm/./src/common/parser/EscapeSequenceParser.ts","webpack://@xterm/xterm/./src/common/parser/OscParser.ts","webpack://@xterm/xterm/./src/common/parser/Params.ts","webpack://@xterm/xterm/./src/common/public/AddonManager.ts","webpack://@xterm/xterm/./src/common/public/BufferApiView.ts","webpack://@xterm/xterm/./src/common/public/BufferLineApiView.ts","webpack://@xterm/xterm/./src/common/public/BufferNamespaceApi.ts","webpack://@xterm/xterm/./src/common/public/ParserApi.ts","webpack://@xterm/xterm/./src/common/public/UnicodeApi.ts","webpack://@xterm/xterm/./src/common/services/BufferService.ts","webpack://@xterm/xterm/./src/common/services/CharsetService.ts","webpack://@xterm/xterm/./src/common/services/CoreMouseService.ts","webpack://@xterm/xterm/./src/common/services/CoreService.ts","webpack://@xterm/xterm/./src/common/services/DecorationService.ts","webpack://@xterm/xterm/./src/common/services/InstantiationService.ts","webpack://@xterm/xterm/./src/common/services/LogService.ts","webpack://@xterm/xterm/./src/common/services/OptionsService.ts","webpack://@xterm/xterm/./src/common/services/OscLinkService.ts","webpack://@xterm/xterm/./src/common/services/ServiceRegistry.ts","webpack://@xterm/xterm/./src/common/services/Services.ts","webpack://@xterm/xterm/./src/common/services/UnicodeService.ts","webpack://@xterm/xterm/./out/vs/base/browser/browser.js","webpack://@xterm/xterm/./out/vs/base/browser/canIUse.js","webpack://@xterm/xterm/./out/vs/base/browser/dom.js","webpack://@xterm/xterm/./out/vs/base/browser/fastDomNode.js","webpack://@xterm/xterm/./out/vs/base/browser/globalPointerMoveMonitor.js","webpack://@xterm/xterm/./out/vs/base/browser/iframe.js","webpack://@xterm/xterm/./out/vs/base/browser/keyboardEvent.js","webpack://@xterm/xterm/./out/vs/base/browser/mouseEvent.js","webpack://@xterm/xterm/./out/vs/base/browser/touch.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/scrollbar/abstractScrollbar.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/scrollbar/horizontalScrollbar.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/scrollbar/scrollableElement.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/scrollbar/scrollbarArrow.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/scrollbar/scrollbarState.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/scrollbar/verticalScrollbar.js","webpack://@xterm/xterm/./out/vs/base/browser/ui/widget.js","webpack://@xterm/xterm/./out/vs/base/browser/window.js","webpack://@xterm/xterm/./out/vs/base/common/arrays.js","webpack://@xterm/xterm/./out/vs/base/common/arraysFind.js","webpack://@xterm/xterm/./out/vs/base/common/async.js","webpack://@xterm/xterm/./out/vs/base/common/cancellation.js","webpack://@xterm/xterm/./out/vs/base/common/charCode.js","webpack://@xterm/xterm/./out/vs/base/common/collections.js","webpack://@xterm/xterm/./out/vs/base/common/decorators.js","webpack://@xterm/xterm/./out/vs/base/common/errors.js","webpack://@xterm/xterm/./out/vs/base/common/event.js","webpack://@xterm/xterm/./out/vs/base/common/functional.js","webpack://@xterm/xterm/./out/vs/base/common/hash.js","webpack://@xterm/xterm/./out/vs/base/common/iterator.js","webpack://@xterm/xterm/./out/vs/base/common/keyCodes.js","webpack://@xterm/xterm/./out/vs/base/common/keybindings.js","webpack://@xterm/xterm/./out/vs/base/common/lazy.js","webpack://@xterm/xterm/./out/vs/base/common/lifecycle.js","webpack://@xterm/xterm/./out/vs/base/common/linkedList.js","webpack://@xterm/xterm/./out/vs/base/common/map.js","webpack://@xterm/xterm/./out/vs/base/common/numbers.js","webpack://@xterm/xterm/./out/vs/base/common/platform.js","webpack://@xterm/xterm/./out/vs/base/common/scrollable.js","webpack://@xterm/xterm/./out/vs/base/common/stopwatch.js","webpack://@xterm/xterm/./out/vs/base/common/strings.js","webpack://@xterm/xterm/./out/vs/base/common/symbols.js","webpack://@xterm/xterm/./out/vs/base/common/uint.js","webpack://@xterm/xterm/webpack/bootstrap","webpack://@xterm/xterm/./src/browser/public/Terminal.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(globalThis, () => {\nreturn ","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { ITerminal, IRenderDebouncer } from 'browser/Types';\nimport { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IInstantiationService } from 'common/services/Services';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nconst MAX_ROWS_TO_READ = 20;\n\nconst enum BoundaryPosition {\n TOP,\n BOTTOM\n}\n\n// Turn this on to unhide the accessibility tree and display it under\n// (instead of overlapping with) the terminal.\nconst DEBUG = false;\n\nexport class AccessibilityManager extends Disposable {\n private _debugRootContainer: HTMLElement | undefined;\n private _accessibilityContainer: HTMLElement;\n\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[];\n private _rowColumns: WeakMap = new WeakMap();\n\n private _liveRegion: HTMLElement;\n private _liveRegionLineCount: number = 0;\n private _liveRegionDebouncer: IRenderDebouncer;\n\n private _topBoundaryFocusListener: (e: FocusEvent) => void;\n private _bottomBoundaryFocusListener: (e: FocusEvent) => void;\n\n /**\n * This queue has a character pushed to it for keys that are pressed, if the\n * next character added to the terminal is equal to the key char then it is\n * not announced (added to live region) because it has already been announced\n * by the textarea event (which cannot be canceled). There are some race\n * condition cases if there is typing while data is streaming, but this covers\n * the main case of typing into the prompt and inputting the answer to a\n * question (Y/N, etc.).\n */\n private _charsToConsume: string[] = [];\n\n private _charsToAnnounce: string = '';\n\n constructor(\n private readonly _terminal: ITerminal,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n const doc = this._coreBrowserService.mainDocument;\n this._accessibilityContainer = doc.createElement('div');\n this._accessibilityContainer.classList.add('xterm-accessibility');\n\n this._rowContainer = doc.createElement('div');\n this._rowContainer.setAttribute('role', 'list');\n this._rowContainer.classList.add('xterm-accessibility-tree');\n this._rowElements = [];\n for (let i = 0; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n\n this._topBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.TOP);\n this._bottomBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.BOTTOM);\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._accessibilityContainer.appendChild(this._rowContainer);\n\n this._liveRegion = doc.createElement('div');\n this._liveRegion.classList.add('live-region');\n this._liveRegion.setAttribute('aria-live', 'assertive');\n this._accessibilityContainer.appendChild(this._liveRegion);\n this._liveRegionDebouncer = this._register(new TimeBasedDebouncer(this._renderRows.bind(this)));\n\n if (!this._terminal.element) {\n throw new Error('Cannot enable accessibility before Terminal.open');\n }\n\n if (DEBUG) {\n this._accessibilityContainer.classList.add('debug');\n this._rowContainer.classList.add('debug');\n\n // Use a `
` container so that the css will still apply.\n this._debugRootContainer = doc.createElement('div');\n this._debugRootContainer.classList.add('xterm');\n\n this._debugRootContainer.appendChild(doc.createTextNode('------start a11y------'));\n this._debugRootContainer.appendChild(this._accessibilityContainer);\n this._debugRootContainer.appendChild(doc.createTextNode('------end a11y------'));\n\n this._terminal.element.insertAdjacentElement('afterend', this._debugRootContainer);\n } else {\n this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityContainer);\n }\n\n this._register(this._terminal.onResize(e => this._handleResize(e.rows)));\n this._register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));\n this._register(this._terminal.onScroll(() => this._refreshRows()));\n // Line feed is an issue as the prompt won't be read out after a command is run\n this._register(this._terminal.onA11yChar(char => this._handleChar(char)));\n this._register(this._terminal.onLineFeed(() => this._handleChar('\\n')));\n this._register(this._terminal.onA11yTab(spaceCount => this._handleTab(spaceCount)));\n this._register(this._terminal.onKey(e => this._handleKey(e.key)));\n this._register(this._terminal.onBlur(() => this._clearLiveRegion()));\n this._register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));\n this._register(addDisposableListener(doc, 'selectionchange', () => this._handleSelectionChange()));\n this._register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions()));\n\n this._refreshRowsDimensions();\n this._refreshRows();\n this._register(toDisposable(() => {\n if (DEBUG) {\n this._debugRootContainer!.remove();\n } else {\n this._accessibilityContainer.remove();\n }\n this._rowElements.length = 0;\n }));\n }\n\n private _handleTab(spaceCount: number): void {\n for (let i = 0; i < spaceCount; i++) {\n this._handleChar(' ');\n }\n }\n\n private _handleChar(char: string): void {\n if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {\n if (this._charsToConsume.length > 0) {\n // Have the screen reader ignore the char if it was just input\n const shiftedChar = this._charsToConsume.shift();\n if (shiftedChar !== char) {\n this._charsToAnnounce += char;\n }\n } else {\n this._charsToAnnounce += char;\n }\n\n if (char === '\\n') {\n this._liveRegionLineCount++;\n if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {\n this._liveRegion.textContent += Strings.tooMuchOutput.get();\n }\n }\n }\n }\n\n private _clearLiveRegion(): void {\n this._liveRegion.textContent = '';\n this._liveRegionLineCount = 0;\n }\n\n private _handleKey(keyChar: string): void {\n this._clearLiveRegion();\n // Only add the char if there is no control character.\n if (!/\\p{Control}/u.test(keyChar)) {\n this._charsToConsume.push(keyChar);\n }\n }\n\n private _refreshRows(start?: number, end?: number): void {\n this._liveRegionDebouncer.refresh(start, end, this._terminal.rows);\n }\n\n private _renderRows(start: number, end: number): void {\n const buffer: IBuffer = this._terminal.buffer;\n const setSize = buffer.lines.length.toString();\n for (let i = start; i <= end; i++) {\n const line = buffer.lines.get(buffer.ydisp + i);\n const columns: number[] = [];\n const lineData = line?.translateToString(true, undefined, undefined, columns) || '';\n const posInSet = (buffer.ydisp + i + 1).toString();\n const element = this._rowElements[i];\n if (element) {\n if (lineData.length === 0) {\n element.innerText = '\\u00a0';\n this._rowColumns.set(element, [0, 1]);\n } else {\n element.textContent = lineData;\n this._rowColumns.set(element, columns);\n }\n element.setAttribute('aria-posinset', posInSet);\n element.setAttribute('aria-setsize', setSize);\n this._alignRowWidth(element);\n }\n }\n this._announceCharacters();\n }\n\n private _announceCharacters(): void {\n if (this._charsToAnnounce.length === 0) {\n return;\n }\n this._liveRegion.textContent += this._charsToAnnounce;\n this._charsToAnnounce = '';\n }\n\n private _handleBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {\n const boundaryElement = e.target as HTMLElement;\n const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];\n\n // Don't scroll if the buffer top has reached the end in that direction\n const posInSet = boundaryElement.getAttribute('aria-posinset');\n const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;\n if (posInSet === lastRowPos) {\n return;\n }\n\n // Don't scroll when the last focused item was not the second row (focus is going the other\n // direction)\n if (e.relatedTarget !== beforeBoundaryElement) {\n return;\n }\n\n // Remove old boundary element from array\n let topBoundaryElement: HTMLElement;\n let bottomBoundaryElement: HTMLElement;\n if (position === BoundaryPosition.TOP) {\n topBoundaryElement = boundaryElement;\n bottomBoundaryElement = this._rowElements.pop()!;\n this._rowContainer.removeChild(bottomBoundaryElement);\n } else {\n topBoundaryElement = this._rowElements.shift()!;\n bottomBoundaryElement = boundaryElement;\n this._rowContainer.removeChild(topBoundaryElement);\n }\n\n // Remove listeners from old boundary elements\n topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);\n bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Add new element to array/DOM\n if (position === BoundaryPosition.TOP) {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.unshift(newElement);\n this._rowContainer.insertAdjacentElement('afterbegin', newElement);\n } else {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.push(newElement);\n this._rowContainer.appendChild(newElement);\n }\n\n // Add listeners to new boundary elements\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Scroll up\n this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);\n\n // Focus new boundary before element\n this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();\n\n // Prevent the standard behavior\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n private _handleSelectionChange(): void {\n if (this._rowElements.length === 0) {\n return;\n }\n\n const selection = this._coreBrowserService.mainDocument.getSelection();\n if (!selection) {\n return;\n }\n\n if (selection.isCollapsed) {\n // Only do something when the anchorNode is inside the row container. This\n // behavior mirrors what we do with mouse --- if the mouse clicks\n // somewhere outside of the terminal, we don't clear the selection.\n if (this._rowContainer.contains(selection.anchorNode)) {\n this._terminal.clearSelection();\n }\n return;\n }\n\n if (!selection.anchorNode || !selection.focusNode) {\n console.error('anchorNode and/or focusNode are null');\n return;\n }\n\n // Sort the two selection points in document order.\n let begin = { node: selection.anchorNode, offset: selection.anchorOffset };\n let end = { node: selection.focusNode, offset: selection.focusOffset };\n if ((begin.node.compareDocumentPosition(end.node) & Node.DOCUMENT_POSITION_PRECEDING) || (begin.node === end.node && begin.offset > end.offset) ) {\n [begin, end] = [end, begin];\n }\n\n // Clamp begin/end to the inside of the row container.\n if (begin.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING)) {\n begin = { node: this._rowElements[0].childNodes[0], offset: 0 };\n }\n if (!this._rowContainer.contains(begin.node)) {\n // This happens when `begin` is below the last row.\n return;\n }\n const lastRowElement = this._rowElements.slice(-1)[0];\n if (end.node.compareDocumentPosition(lastRowElement) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING)) {\n end = {\n node: lastRowElement,\n offset: lastRowElement.textContent?.length ?? 0\n };\n }\n if (!this._rowContainer.contains(end.node)) {\n // This happens when `end` is above the first row.\n return;\n }\n\n const toRowColumn = ({ node, offset }: typeof begin): {row: number, column: number} | null => {\n // `node` is either the row element or the Text node inside it.\n const rowElement: any = node instanceof Text ? node.parentNode : node;\n let row = parseInt(rowElement?.getAttribute('aria-posinset'), 10) - 1;\n if (isNaN(row)) {\n console.warn('row is invalid. Race condition?');\n return null;\n }\n\n const columns = this._rowColumns.get(rowElement);\n if (!columns) {\n console.warn('columns is null. Race condition?');\n return null;\n }\n\n let column = offset < columns.length ? columns[offset] : columns.slice(-1)[0] + 1;\n if (column >= this._terminal.cols) {\n ++row;\n column = 0;\n }\n return {\n row,\n column\n };\n };\n\n const beginRowColumn = toRowColumn(begin);\n const endRowColumn = toRowColumn(end);\n\n if (!beginRowColumn || !endRowColumn) {\n return;\n }\n\n if (beginRowColumn.row > endRowColumn.row || (beginRowColumn.row === endRowColumn.row && beginRowColumn.column >= endRowColumn.column)) {\n // This should not happen unless we have some bugs.\n throw new Error('invalid range');\n }\n\n this._terminal.select(\n beginRowColumn.column,\n beginRowColumn.row,\n (endRowColumn.row - beginRowColumn.row) * this._terminal.cols - beginRowColumn.column + endRowColumn.column\n );\n }\n\n private _handleResize(rows: number): void {\n // Remove bottom boundary listener\n this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Grow rows as required\n for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n // Shrink rows as required\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n\n // Add bottom boundary listener\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n }\n\n private _createAccessibilityTreeNode(): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.setAttribute('role', 'listitem');\n element.tabIndex = -1;\n this._refreshRowDimensions(element);\n return element;\n }\n\n private _refreshRowsDimensions(): void {\n if (!this._renderService.dimensions.css.cell.height) {\n return;\n }\n Object.assign(this._accessibilityContainer.style, {\n width: `${this._renderService.dimensions.css.canvas.width}px`,\n fontSize: `${this._terminal.options.fontSize}px`\n });\n if (this._rowElements.length !== this._terminal.rows) {\n this._handleResize(this._terminal.rows);\n }\n for (let i = 0; i < this._terminal.rows; i++) {\n this._refreshRowDimensions(this._rowElements[i]);\n this._alignRowWidth(this._rowElements[i]);\n }\n }\n\n private _refreshRowDimensions(element: HTMLElement): void {\n element.style.height = `${this._renderService.dimensions.css.cell.height}px`;\n }\n\n /**\n * Scale the width of a row so that each of the character is (mostly) aligned\n * with the actual rendering. This will allow the screen reader to draw\n * selection outline at the correct position.\n *\n * On top of using the \"monospace\" font and correct font size, the scaling\n * here is necessary to handle characters that are not covered by the font\n * (e.g. CJK).\n */\n private _alignRowWidth(element: HTMLElement): void {\n element.style.transform = '';\n const width = element.getBoundingClientRect().width;\n const lastColumn = this._rowColumns.get(element)?.slice(-1)?.[0];\n if (!lastColumn) {\n return;\n }\n const targetWidth = lastColumn * this._renderService.dimensions.css.cell.width;\n element.style.transform = `scaleX(${targetWidth / width})`;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionService } from 'browser/services/Services';\nimport { ICoreService, IOptionsService } from 'common/services/Services';\n\n/**\n * Prepares text to be pasted into the terminal by normalizing the line endings\n * @param text The pasted text that needs processing before inserting into the terminal\n */\nexport function prepareTextForTerminal(text: string): string {\n return text.replace(/\\r?\\n/g, '\\r');\n}\n\n/**\n * Bracket text for paste, if necessary, as per https://cirw.in/blog/bracketed-paste\n * @param text The pasted text to bracket\n */\nexport function bracketTextForPaste(text: string, bracketedPasteMode: boolean): string {\n if (bracketedPasteMode) {\n return '\\x1b[200~' + text + '\\x1b[201~';\n }\n return text;\n}\n\n/**\n * Binds copy functionality to the given terminal.\n * @param ev The original copy event to be handled\n */\nexport function copyHandler(ev: ClipboardEvent, selectionService: ISelectionService): void {\n if (ev.clipboardData) {\n ev.clipboardData.setData('text/plain', selectionService.selectionText);\n }\n // Prevent or the original text will be copied.\n ev.preventDefault();\n}\n\n/**\n * Redirect the clipboard's data to the terminal's input handler.\n */\nexport function handlePasteEvent(ev: ClipboardEvent, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n ev.stopPropagation();\n if (ev.clipboardData) {\n const text = ev.clipboardData.getData('text/plain');\n paste(text, textarea, coreService, optionsService);\n }\n}\n\nexport function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n text = prepareTextForTerminal(text);\n text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode && optionsService.rawOptions.ignoreBracketedPasteMode !== true);\n coreService.triggerDataEvent(text, true);\n textarea.value = '';\n}\n\n/**\n * Moves the textarea under the mouse cursor and focuses it.\n * @param ev The original right click event to be handled.\n * @param textarea The terminal's textarea.\n */\nexport function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement): void {\n\n // Calculate textarea position relative to the screen element\n const pos = screenElement.getBoundingClientRect();\n const left = ev.clientX - pos.left - 10;\n const top = ev.clientY - pos.top - 10;\n\n // Bring textarea at the cursor position\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = `${left}px`;\n textarea.style.top = `${top}px`;\n textarea.style.zIndex = '1000';\n\n textarea.focus();\n}\n\n/**\n * Bind to right-click event and allow right-click copy and paste.\n */\nexport function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement, selectionService: ISelectionService, shouldSelectWord: boolean): void {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n\n // Get textarea ready to copy from the context menu\n textarea.value = selectionService.selectionText;\n textarea.select();\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColorContrastCache } from 'browser/Types';\nimport { IColor } from 'common/Types';\nimport { TwoKeyMap } from 'common/MultiKeyMap';\n\nexport class ColorContrastCache implements IColorContrastCache {\n private _color: TwoKeyMap = new TwoKeyMap();\n private _css: TwoKeyMap = new TwoKeyMap();\n\n public setCss(bg: number, fg: number, value: string | null): void {\n this._css.set(bg, fg, value);\n }\n\n public getCss(bg: number, fg: number): string | null | undefined {\n return this._css.get(bg, fg);\n }\n\n public setColor(bg: number, fg: number, value: IColor | null): void {\n this._color.set(bg, fg, value);\n }\n\n public getColor(bg: number, fg: number): IColor | null | undefined {\n return this._color.get(bg, fg);\n }\n\n public clear(): void {\n this._color.clear();\n this._css.clear();\n }\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker } from '@xterm/xterm';\nimport { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'browser/Clipboard';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { OscLinkProvider } from 'browser/OscLinkProvider';\nimport { CharacterJoinerHandler, CustomKeyEventHandler, CustomWheelEventHandler, IBrowser, IBufferRange, ICompositionHelper, ILinkifier2, ITerminal } from 'browser/Types';\nimport { Viewport } from 'browser/Viewport';\nimport { BufferDecorationRenderer } from 'browser/decorations/BufferDecorationRenderer';\nimport { OverviewRulerRenderer } from 'browser/decorations/OverviewRulerRenderer';\nimport { CompositionHelper } from 'browser/input/CompositionHelper';\nimport { DomRenderer } from 'browser/renderer/dom/DomRenderer';\nimport { IRenderer } from 'browser/renderer/shared/Types';\nimport { CharSizeService } from 'browser/services/CharSizeService';\nimport { CharacterJoinerService } from 'browser/services/CharacterJoinerService';\nimport { CoreBrowserService } from 'browser/services/CoreBrowserService';\nimport { LinkProviderService } from 'browser/services/LinkProviderService';\nimport { MouseService } from 'browser/services/MouseService';\nimport { RenderService } from 'browser/services/RenderService';\nimport { SelectionService } from 'browser/services/SelectionService';\nimport { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, ILinkProviderService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';\nimport { ThemeService } from 'browser/services/ThemeService';\nimport { channels, color } from 'common/Color';\nimport { CoreTerminal } from 'common/CoreTerminal';\nimport * as Browser from 'common/Platform';\nimport { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from 'common/Types';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IBuffer } from 'common/buffer/Types';\nimport { C0, C1_ESCAPED } from 'common/data/EscapeSequences';\nimport { evaluateKeyboardEvent } from 'common/input/Keyboard';\nimport { toRgbString } from 'common/input/XParseColor';\nimport { DecorationService } from 'common/services/DecorationService';\nimport { IDecorationService } from 'common/services/Services';\nimport { WindowsOptionsReportType } from '../common/InputHandler';\nimport { AccessibilityManager } from './AccessibilityManager';\nimport { Linkifier } from './Linkifier';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\nexport class CoreBrowserTerminal extends CoreTerminal implements ITerminal {\n public textarea: HTMLTextAreaElement | undefined;\n public element: HTMLElement | undefined;\n public screenElement: HTMLElement | undefined;\n\n private _document: Document | undefined;\n private _viewportElement: HTMLElement | undefined;\n private _helperContainer: HTMLElement | undefined;\n private _compositionView: HTMLElement | undefined;\n\n private readonly _linkifier: MutableDisposable = this._register(new MutableDisposable());\n public get linkifier(): ILinkifier2 | undefined { return this._linkifier.value; }\n private _overviewRulerRenderer: OverviewRulerRenderer | undefined;\n private _viewport: Viewport | undefined;\n\n public browser: IBrowser = Browser as any;\n\n private _customKeyEventHandler: CustomKeyEventHandler | undefined;\n private _customWheelEventHandler: CustomWheelEventHandler | undefined;\n\n // Browser services\n private _decorationService: DecorationService;\n private _linkProviderService: ILinkProviderService;\n\n // Optional browser services\n private _charSizeService: ICharSizeService | undefined;\n private _coreBrowserService: ICoreBrowserService | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _themeService: IThemeService | undefined;\n private _characterJoinerService: ICharacterJoinerService | undefined;\n private _selectionService: ISelectionService | undefined;\n\n /**\n * Records whether the keydown event has already been handled and triggered a data event, if so\n * the keypress event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyDownHandled: boolean = false;\n\n /**\n * Records whether a keydown event has occured since the last keyup event, i.e. whether a key\n * is currently \"pressed\".\n */\n private _keyDownSeen: boolean = false;\n\n /**\n * Records whether the keypress event has already been handled and triggered a data event, if so\n * the input event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyPressHandled: boolean = false;\n\n /**\n * Records whether there has been a keydown event for a dead key without a corresponding keydown\n * event for the composed/alternative character. If we cancel the keydown event for the dead key,\n * no events will be emitted for the final character.\n */\n private _unprocessedDeadKey: boolean = false;\n\n private _compositionHelper: ICompositionHelper | undefined;\n private _accessibilityManager: MutableDisposable = this._register(new MutableDisposable());\n\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onKey = this._register(new Emitter<{ key: string, domEvent: KeyboardEvent }>());\n public readonly onKey = this._onKey.event;\n private readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onBell = this._register(new Emitter());\n public readonly onBell = this._onBell.event;\n\n private _onFocus = this._register(new Emitter());\n public get onFocus(): Event { return this._onFocus.event; }\n private _onBlur = this._register(new Emitter());\n public get onBlur(): Event { return this._onBlur.event; }\n private _onA11yCharEmitter = this._register(new Emitter());\n public get onA11yChar(): Event { return this._onA11yCharEmitter.event; }\n private _onA11yTabEmitter = this._register(new Emitter());\n public get onA11yTab(): Event { return this._onA11yTabEmitter.event; }\n private _onWillOpen = this._register(new Emitter());\n public get onWillOpen(): Event { return this._onWillOpen.event; }\n\n constructor(\n options: Partial = {}\n ) {\n super(options);\n\n this._setup();\n\n this._decorationService = this._instantiationService.createInstance(DecorationService);\n this._instantiationService.setService(IDecorationService, this._decorationService);\n this._linkProviderService = this._instantiationService.createInstance(LinkProviderService);\n this._instantiationService.setService(ILinkProviderService, this._linkProviderService);\n this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(OscLinkProvider));\n\n // Setup InputHandler listeners\n this._register(this._inputHandler.onRequestBell(() => this._onBell.fire()));\n this._register(this._inputHandler.onRequestRefreshRows((e) => this.refresh(e?.start ?? 0, e?.end ?? (this.rows - 1))));\n this._register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));\n this._register(this._inputHandler.onRequestReset(() => this.reset()));\n this._register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));\n this._register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));\n this._register(Event.forward(this._inputHandler.onCursorMove, this._onCursorMove));\n this._register(Event.forward(this._inputHandler.onTitleChange, this._onTitleChange));\n this._register(Event.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));\n this._register(Event.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));\n\n // Setup listeners\n this._register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));\n\n this._register(toDisposable(() => {\n this._customKeyEventHandler = undefined;\n this.element?.parentNode?.removeChild(this.element);\n }));\n }\n\n /**\n * Handle color event from inputhandler for OSC 4|104 | 10|110 | 11|111 | 12|112.\n * An event from OSC 4|104 may contain multiple set or report requests, and multiple\n * or none restore requests (resetting all),\n * while an event from OSC 10|110 | 11|111 | 12|112 always contains a single request.\n */\n private _handleColorEvent(event: IColorEvent): void {\n if (!this._themeService) return;\n for (const req of event) {\n let acc: 'foreground' | 'background' | 'cursor' | 'ansi';\n let ident = '';\n switch (req.index) {\n case SpecialColorIndex.FOREGROUND: // OSC 10 | 110\n acc = 'foreground';\n ident = '10';\n break;\n case SpecialColorIndex.BACKGROUND: // OSC 11 | 111\n acc = 'background';\n ident = '11';\n break;\n case SpecialColorIndex.CURSOR: // OSC 12 | 112\n acc = 'cursor';\n ident = '12';\n break;\n default: // OSC 4 | 104\n // we can skip the [0..255] range check here (already done in inputhandler)\n acc = 'ansi';\n ident = '4;' + req.index;\n }\n switch (req.type) {\n case ColorRequestType.REPORT:\n const colorRgb = color.toColorRGB(acc === 'ansi'\n ? this._themeService.colors.ansi[req.index]\n : this._themeService.colors[acc]);\n this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(colorRgb)}${C1_ESCAPED.ST}`);\n break;\n case ColorRequestType.SET:\n if (acc === 'ansi') {\n this._themeService.modifyColors(colors => colors.ansi[req.index] = channels.toColor(...req.color));\n } else {\n const narrowedAcc = acc;\n this._themeService.modifyColors(colors => colors[narrowedAcc] = channels.toColor(...req.color));\n }\n break;\n case ColorRequestType.RESTORE:\n this._themeService.restoreColor(req.index);\n break;\n }\n }\n }\n\n protected _setup(): void {\n super._setup();\n\n this._customKeyEventHandler = undefined;\n }\n\n /**\n * Convenience property to active buffer.\n */\n public get buffer(): IBuffer {\n return this.buffers.active;\n }\n\n /**\n * Focus the terminal. Delegates focus handling to the terminal's DOM element.\n */\n public focus(): void {\n if (this.textarea) {\n this.textarea.focus({ preventScroll: true });\n }\n }\n\n private _handleScreenReaderModeOptionChange(value: boolean): void {\n if (value) {\n if (!this._accessibilityManager.value && this._renderService) {\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n } else {\n this._accessibilityManager.clear();\n }\n }\n\n /**\n * Binds the desired focus behavior on a given terminal object.\n */\n private _handleTextAreaFocus(ev: FocusEvent): void {\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n }\n this.element!.classList.add('focus');\n this._showCursor();\n this._onFocus.fire();\n }\n\n /**\n * Blur the terminal, calling the blur function on the terminal's underlying\n * textarea.\n */\n public blur(): void {\n return this.textarea?.blur();\n }\n\n /**\n * Binds the desired blur behavior on a given terminal object.\n */\n private _handleTextAreaBlur(): void {\n // Text can safely be removed on blur. Doing it earlier could interfere with\n // screen readers reading it out.\n this.textarea!.value = '';\n this.refresh(this.buffer.y, this.buffer.y);\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n this.element!.classList.remove('focus');\n this._onBlur.fire();\n }\n\n private _syncTextArea(): void {\n if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper!.isComposing || !this._renderService) {\n return;\n }\n const cursorY = this.buffer.ybase + this.buffer.y;\n const bufferLine = this.buffer.lines.get(cursorY);\n if (!bufferLine) {\n return;\n }\n const cursorX = Math.min(this.buffer.x, this.cols - 1);\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const width = bufferLine.getWidth(cursorX);\n const cellWidth = this._renderService.dimensions.css.cell.width * width;\n const cursorTop = this.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n this.textarea.style.left = cursorLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = cellWidth + 'px';\n this.textarea.style.height = cellHeight + 'px';\n this.textarea.style.lineHeight = cellHeight + 'px';\n this.textarea.style.zIndex = '-5';\n }\n\n /**\n * Initialize default behavior\n */\n private _initGlobal(): void {\n this._bindKeys();\n\n // Bind clipboard functionality\n this._register(addDisposableListener(this.element!, 'copy', (event: ClipboardEvent) => {\n // If mouse events are active it means the selection manager is disabled and\n // copy should be handled by the host program.\n if (!this.hasSelection()) {\n return;\n }\n copyHandler(event, this._selectionService!);\n }));\n const pasteHandlerWrapper = (event: ClipboardEvent): void => handlePasteEvent(event, this.textarea!, this.coreService, this.optionsService);\n this._register(addDisposableListener(this.textarea!, 'paste', pasteHandlerWrapper));\n this._register(addDisposableListener(this.element!, 'paste', pasteHandlerWrapper));\n\n // Handle right click context menus\n if (Browser.isFirefox) {\n // Firefox doesn't appear to fire the contextmenu event on right click\n this._register(addDisposableListener(this.element!, 'mousedown', (event: MouseEvent) => {\n if (event.button === 2) {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }\n }));\n } else {\n this._register(addDisposableListener(this.element!, 'contextmenu', (event: MouseEvent) => {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }));\n }\n\n // Move the textarea under the cursor when middle clicking on Linux to ensure\n // middle click to paste selection works. This only appears to work in Chrome\n // at the time is writing.\n if (Browser.isLinux) {\n // Use auxclick event over mousedown the latter doesn't seem to work. Note\n // that the regular click event doesn't fire for the middle mouse button.\n this._register(addDisposableListener(this.element!, 'auxclick', (event: MouseEvent) => {\n if (event.button === 1) {\n moveTextAreaUnderMouseCursor(event, this.textarea!, this.screenElement!);\n }\n }));\n }\n }\n\n /**\n * Apply key handling to the terminal\n */\n private _bindKeys(): void {\n this._register(addDisposableListener(this.textarea!, 'keyup', (ev: KeyboardEvent) => this._keyUp(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));\n this._register(addDisposableListener(this.textarea!, 'compositionstart', () => this._compositionHelper!.compositionstart()));\n this._register(addDisposableListener(this.textarea!, 'compositionupdate', (e: CompositionEvent) => this._compositionHelper!.compositionupdate(e)));\n this._register(addDisposableListener(this.textarea!, 'compositionend', () => this._compositionHelper!.compositionend()));\n this._register(addDisposableListener(this.textarea!, 'input', (ev: InputEvent) => this._inputEvent(ev), true));\n this._register(this.onRender(() => this._compositionHelper!.updateCompositionElements()));\n }\n\n /**\n * Opens the terminal within an element.\n *\n * @param parent The element to create the terminal within.\n */\n public open(parent: HTMLElement): void {\n if (!parent) {\n throw new Error('Terminal requires a parent element.');\n }\n\n if (!parent.isConnected) {\n this._logService.debug('Terminal.open was called on an element that was not attached to the DOM');\n }\n\n // If the terminal is already opened\n if (this.element?.ownerDocument.defaultView && this._coreBrowserService) {\n // Adjust the window if needed\n if (this.element.ownerDocument.defaultView !== this._coreBrowserService.window) {\n this._coreBrowserService.window = this.element.ownerDocument.defaultView;\n }\n return;\n }\n\n this._document = parent.ownerDocument;\n if (this.options.documentOverride && this.options.documentOverride instanceof Document) {\n this._document = this.optionsService.rawOptions.documentOverride as Document;\n }\n\n // Create main element container\n this.element = this._document.createElement('div');\n this.element.dir = 'ltr'; // xterm.css assumes LTR\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n parent.appendChild(this.element);\n\n // Performance: Use a document fragment to build the terminal\n // viewport and helper elements detached from the DOM\n const fragment = this._document.createDocumentFragment();\n this._viewportElement = this._document.createElement('div');\n this._viewportElement.classList.add('xterm-viewport');\n fragment.appendChild(this._viewportElement);\n\n this.screenElement = this._document.createElement('div');\n this.screenElement.classList.add('xterm-screen');\n this._register(addDisposableListener(this.screenElement, 'mousemove', (ev: MouseEvent) => this.updateCursorStyle(ev)));\n // Create the container that will hold helpers like the textarea for\n // capturing DOM Events. Then produce the helpers.\n this._helperContainer = this._document.createElement('div');\n this._helperContainer.classList.add('xterm-helpers');\n this.screenElement.appendChild(this._helperContainer);\n fragment.appendChild(this.screenElement);\n\n this.textarea = this._document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\n this.textarea.setAttribute('aria-label', Strings.promptLabel.get());\n if (!Browser.isChromeOS) {\n // ChromeVox on ChromeOS does not like this. See\n // https://issuetracker.google.com/issues/260170397\n this.textarea.setAttribute('aria-multiline', 'false');\n }\n this.textarea.setAttribute('autocorrect', 'off');\n this.textarea.setAttribute('autocapitalize', 'off');\n this.textarea.setAttribute('spellcheck', 'false');\n this.textarea.tabIndex = 0;\n\n // Register the core browser service before the generic textarea handlers are registered so it\n // handles them first. Otherwise the renderers may use the wrong focus state.\n this._coreBrowserService = this._register(this._instantiationService.createInstance(CoreBrowserService,\n this.textarea,\n parent.ownerDocument.defaultView ?? window,\n // Force unsafe null in node.js environment for tests\n this._document ?? (typeof window !== 'undefined') ? window.document : null as any\n ));\n this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);\n\n this._register(addDisposableListener(this.textarea, 'focus', (ev: FocusEvent) => this._handleTextAreaFocus(ev)));\n this._register(addDisposableListener(this.textarea, 'blur', () => this._handleTextAreaBlur()));\n this._helperContainer.appendChild(this.textarea);\n\n this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);\n this._instantiationService.setService(ICharSizeService, this._charSizeService);\n\n this._themeService = this._instantiationService.createInstance(ThemeService);\n this._instantiationService.setService(IThemeService, this._themeService);\n\n this._characterJoinerService = this._instantiationService.createInstance(CharacterJoinerService);\n this._instantiationService.setService(ICharacterJoinerService, this._characterJoinerService);\n\n this._renderService = this._register(this._instantiationService.createInstance(RenderService, this.rows, this.screenElement));\n this._instantiationService.setService(IRenderService, this._renderService);\n this._register(this._renderService.onRenderedViewportChange(e => this._onRender.fire(e)));\n this.onResize(e => this._renderService!.resize(e.cols, e.rows));\n\n this._compositionView = this._document.createElement('div');\n this._compositionView.classList.add('composition-view');\n this._compositionHelper = this._instantiationService.createInstance(CompositionHelper, this.textarea, this._compositionView);\n this._helperContainer.appendChild(this._compositionView);\n\n this._mouseService = this._instantiationService.createInstance(MouseService);\n this._instantiationService.setService(IMouseService, this._mouseService);\n\n const linkifier = this._linkifier.value = this._register(this._instantiationService.createInstance(Linkifier, this.screenElement));\n\n // Performance: Add viewport and helper elements from the fragment\n this.element.appendChild(fragment);\n\n try {\n this._onWillOpen.fire(this.element);\n }\n catch { /* fails to load addon for some reason */ }\n if (!this._renderService.hasRenderer()) {\n this._renderService.setRenderer(this._createRenderer());\n }\n\n this._register(this.onCursorMove(() => {\n this._renderService!.handleCursorMove();\n this._syncTextArea();\n }));\n this._register(this.onResize(() => this._renderService!.handleResize(this.cols, this.rows)));\n this._register(this.onBlur(() => this._renderService!.handleBlur()));\n this._register(this.onFocus(() => this._renderService!.handleFocus()));\n\n this._viewport = this._register(this._instantiationService.createInstance(Viewport, this.element, this.screenElement));\n this._register(this._viewport.onRequestScrollLines(e => {\n super.scrollLines(e, false);\n this.refresh(0, this.rows - 1);\n }));\n\n this._selectionService = this._register(this._instantiationService.createInstance(SelectionService,\n this.element,\n this.screenElement,\n linkifier\n ));\n this._instantiationService.setService(ISelectionService, this._selectionService);\n this._register(this._selectionService.onRequestScrollLines(e => this.scrollLines(e.amount, e.suppressScrollEvent)));\n this._register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire()));\n this._register(this._selectionService.onRequestRedraw(e => this._renderService!.handleSelectionChanged(e.start, e.end, e.columnSelectMode)));\n this._register(this._selectionService.onLinuxMouseSelection(text => {\n // If there's a new selection, put it into the textarea, focus and select it\n // in order to register it as a selection on the OS. This event is fired\n // only on Linux to enable middle click to paste selection.\n this.textarea!.value = text;\n this.textarea!.focus();\n this.textarea!.select();\n }));\n this._register(this._onScroll.event(() => this._selectionService!.refresh()));\n\n this._register(this._instantiationService.createInstance(BufferDecorationRenderer, this.screenElement));\n this._register(addDisposableListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.handleMouseDown(e)));\n\n // apply mouse event classes set by escape codes before terminal was attached\n if (this.coreMouseService.areMouseEventsActive) {\n this._selectionService.disable();\n this.element.classList.add('enable-mouse-events');\n } else {\n this._selectionService.enable();\n }\n\n if (this.options.screenReaderMode) {\n // Note that this must be done *after* the renderer is created in order to\n // ensure the correct order of the dprchange event\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n this._register(this.optionsService.onSpecificOptionChange('screenReaderMode', e => this._handleScreenReaderModeOptionChange(e)));\n\n if (this.options.overviewRuler.width) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n this.optionsService.onSpecificOptionChange('overviewRuler', value => {\n if (!this._overviewRulerRenderer && value && this._viewportElement && this.screenElement) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n });\n // Measure the character size\n this._charSizeService.measure();\n\n // Setup loop that draws to screen\n this.refresh(0, this.rows - 1);\n\n // Initialize global actions that need to be taken on the document.\n this._initGlobal();\n\n // Listen for mouse events and translate\n // them into terminal mouse protocols.\n this.bindMouse();\n }\n\n private _createRenderer(): IRenderer {\n return this._instantiationService.createInstance(DomRenderer, this, this._document!, this.element!, this.screenElement!, this._viewportElement!, this._helperContainer!, this.linkifier!);\n }\n\n /**\n * Bind certain mouse events to the terminal.\n * By default only 3 button + wheel up/down is ativated. For higher buttons\n * no mouse report will be created. Typically the standard actions will be active.\n *\n * There are several reasons not to enable support for higher buttons/wheel:\n * - Button 4 and 5 are typically used for history back and forward navigation,\n * there is no straight forward way to supress/intercept those standard actions.\n * - Support for higher buttons does not work in some platform/browser combinations.\n * - Left/right wheel was not tested.\n * - Emulators vary in mouse button support, typically only 3 buttons and\n * wheel up/down work reliable.\n *\n * TODO: Move mouse event code into its own file.\n */\n public bindMouse(): void {\n const self = this;\n const el = this.element!;\n\n // send event to CoreMouseService\n function sendEvent(ev: MouseEvent | WheelEvent): boolean {\n // get mouse coordinates\n const pos = self._mouseService!.getMouseReportCoords(ev, self.screenElement!);\n if (!pos) {\n return false;\n }\n\n let but: CoreMouseButton;\n let action: CoreMouseAction | undefined;\n switch ((ev as any).overrideType || ev.type) {\n case 'mousemove':\n action = CoreMouseAction.MOVE;\n if (ev.buttons === undefined) {\n // buttons is not supported on macOS, try to get a value from button instead\n but = CoreMouseButton.NONE;\n if (ev.button !== undefined) {\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n }\n } else {\n // according to MDN buttons only reports up to button 5 (AUX2)\n but = ev.buttons & 1 ? CoreMouseButton.LEFT :\n ev.buttons & 4 ? CoreMouseButton.MIDDLE :\n ev.buttons & 2 ? CoreMouseButton.RIGHT :\n CoreMouseButton.NONE; // fallback to NONE\n }\n break;\n case 'mouseup':\n action = CoreMouseAction.UP;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'mousedown':\n action = CoreMouseAction.DOWN;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'wheel':\n if (self._customWheelEventHandler && self._customWheelEventHandler(ev as WheelEvent) === false) {\n return false;\n }\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n action = deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN;\n but = CoreMouseButton.WHEEL;\n break;\n default:\n // dont handle other event types by accident\n return false;\n }\n\n // exit if we cannot determine valid button/action values\n // do nothing for higher buttons than wheel\n if (action === undefined || but === undefined || but > CoreMouseButton.WHEEL) {\n return false;\n }\n\n return self.coreMouseService.triggerMouseEvent({\n col: pos.col,\n row: pos.row,\n x: pos.x,\n y: pos.y,\n button: but,\n action,\n ctrl: ev.ctrlKey,\n alt: ev.altKey,\n shift: ev.shiftKey\n });\n }\n\n /**\n * Event listener state handling.\n * We listen to the onProtocolChange event of CoreMouseService and put\n * requested listeners in `requestedEvents`. With this the listeners\n * have all bits to do the event listener juggling.\n * Note: 'mousedown' currently is \"always on\" and not managed\n * by onProtocolChange.\n */\n const requestedEvents: { [key: string]: ((ev: MouseEvent | WheelEvent) => void) | null } = {\n mouseup: null,\n wheel: null,\n mousedrag: null,\n mousemove: null\n };\n const eventListeners: { [key: string]: (ev: any) => void | boolean } = {\n mouseup: (ev: MouseEvent) => {\n sendEvent(ev);\n if (!ev.buttons) {\n // if no other button is held remove global handlers\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }\n return this.cancel(ev);\n },\n wheel: (ev: WheelEvent) => {\n sendEvent(ev);\n return this.cancel(ev, true);\n },\n mousedrag: (ev: MouseEvent) => {\n // deal only with move while a button is held\n if (ev.buttons) {\n sendEvent(ev);\n }\n },\n mousemove: (ev: MouseEvent) => {\n // deal only with move without any button\n if (!ev.buttons) {\n sendEvent(ev);\n }\n }\n };\n this._register(this.coreMouseService.onProtocolChange(events => {\n // apply global changes on events\n if (events) {\n if (this.optionsService.rawOptions.logLevel === 'debug') {\n this._logService.debug('Binding to mouse events:', this.coreMouseService.explainEvents(events));\n }\n this.element!.classList.add('enable-mouse-events');\n this._selectionService!.disable();\n } else {\n this._logService.debug('Unbinding from mouse events.');\n this.element!.classList.remove('enable-mouse-events');\n this._selectionService!.enable();\n }\n\n // add/remove handlers from requestedEvents\n\n if (!(events & CoreMouseEventType.MOVE)) {\n el.removeEventListener('mousemove', requestedEvents.mousemove!);\n requestedEvents.mousemove = null;\n } else if (!requestedEvents.mousemove) {\n el.addEventListener('mousemove', eventListeners.mousemove);\n requestedEvents.mousemove = eventListeners.mousemove;\n }\n\n if (!(events & CoreMouseEventType.WHEEL)) {\n el.removeEventListener('wheel', requestedEvents.wheel!);\n requestedEvents.wheel = null;\n } else if (!requestedEvents.wheel) {\n el.addEventListener('wheel', eventListeners.wheel, { passive: false });\n requestedEvents.wheel = eventListeners.wheel;\n }\n\n if (!(events & CoreMouseEventType.UP)) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n requestedEvents.mouseup = null;\n } else if (!requestedEvents.mouseup) {\n requestedEvents.mouseup = eventListeners.mouseup;\n }\n\n if (!(events & CoreMouseEventType.DRAG)) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag!);\n requestedEvents.mousedrag = null;\n } else if (!requestedEvents.mousedrag) {\n requestedEvents.mousedrag = eventListeners.mousedrag;\n }\n }));\n // force initial onProtocolChange so we dont miss early mouse requests\n this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol;\n\n /**\n * \"Always on\" event listeners.\n */\n this._register(addDisposableListener(el, 'mousedown', (ev: MouseEvent) => {\n ev.preventDefault();\n this.focus();\n\n // Don't send the mouse button to the pty if mouse events are disabled or\n // if the selection manager is having selection forced (ie. a modifier is\n // held).\n if (!this.coreMouseService.areMouseEventsActive || this._selectionService!.shouldForceSelection(ev)) {\n return;\n }\n\n sendEvent(ev);\n\n // Register additional global handlers which should keep reporting outside\n // of the terminal element.\n // Note: Other emulators also do this for 'mousedown' while a button\n // is held, we currently limit 'mousedown' to the terminal only.\n if (requestedEvents.mouseup) {\n this._document!.addEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.addEventListener('mousemove', requestedEvents.mousedrag);\n }\n\n return this.cancel(ev);\n }));\n\n this._register(addDisposableListener(el, 'wheel', (ev: WheelEvent) => {\n // do nothing, if app side handles wheel itself\n if (requestedEvents.wheel) return;\n\n if (this._customWheelEventHandler && this._customWheelEventHandler(ev) === false) {\n return false;\n }\n\n if (!this.buffer.hasScrollback) {\n // Convert wheel events into up/down events when the buffer does not have scrollback, this\n // enables scrolling in apps hosted in the alt buffer such as vim or tmux even when mouse\n // events are not enabled.\n // This used implementation used get the actual lines/partial lines scrolled from the\n // viewport but since moving to the new viewport implementation has been simplified to\n // simply send a single up or down sequence.\n\n // Do nothing if there's no vertical scroll\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n\n // Construct and send sequences\n const sequence = C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? 'O' : '[') + (ev.deltaY < 0 ? 'A' : 'B');\n this.coreService.triggerDataEvent(sequence, true);\n return this.cancel(ev, true);\n }\n }, { passive: false }));\n }\n\n\n /**\n * Tells the renderer to refresh terminal content between two rows (inclusive) at the next\n * opportunity.\n * @param start The row to start from (between 0 and this.rows - 1).\n * @param end The row to end at (between start and this.rows - 1).\n */\n public refresh(start: number, end: number): void {\n this._renderService?.refreshRows(start, end);\n }\n\n /**\n * Change the cursor style for different selection modes\n */\n public updateCursorStyle(ev: KeyboardEvent | MouseEvent): void {\n if (this._selectionService?.shouldColumnSelect(ev)) {\n this.element!.classList.add('column-select');\n } else {\n this.element!.classList.remove('column-select');\n }\n }\n\n /**\n * Display the cursor element\n */\n private _showCursor(): void {\n if (!this.coreService.isCursorInitialized) {\n this.coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }\n\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n // All scrollLines methods need to go via the viewport in order to support smooth scroll\n if (this._viewport) {\n this._viewport.scrollLines(disp);\n } else {\n super.scrollLines(disp, suppressScrollEvent);\n }\n this.refresh(0, this.rows - 1);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll && this._viewport) {\n this._viewport.scrollToLine(this.buffer.ybase, true);\n } else {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n public paste(data: string): void {\n paste(data, this.textarea!, this.coreService, this.optionsService);\n }\n\n public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {\n this._customKeyEventHandler = customKeyEventHandler;\n }\n\n public attachCustomWheelEventHandler(customWheelEventHandler: CustomWheelEventHandler): void {\n this._customWheelEventHandler = customWheelEventHandler;\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._linkProviderService.registerLinkProvider(linkProvider);\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n const joinerId = this._characterJoinerService.register(handler);\n this.refresh(0, this.rows - 1);\n return joinerId;\n }\n\n public deregisterCharacterJoiner(joinerId: number): void {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n if (this._characterJoinerService.deregister(joinerId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n\n public get markers(): IMarker[] {\n return this.buffer.markers;\n }\n\n public registerMarker(cursorYOffset: number): IMarker {\n return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);\n }\n\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n return this._decorationService.registerDecoration(decorationOptions);\n }\n\n /**\n * Gets whether the terminal has an active selection.\n */\n public hasSelection(): boolean {\n return this._selectionService ? this._selectionService.hasSelection : false;\n }\n\n /**\n * Selects text within the terminal.\n * @param column The column the selection starts at..\n * @param row The row the selection starts at.\n * @param length The length of the selection.\n */\n public select(column: number, row: number, length: number): void {\n this._selectionService!.setSelection(column, row, length);\n }\n\n /**\n * Gets the terminal's current selection, this is useful for implementing copy\n * behavior outside of xterm.js.\n */\n public getSelection(): string {\n return this._selectionService ? this._selectionService.selectionText : '';\n }\n\n public getSelectionPosition(): IBufferRange | undefined {\n if (!this._selectionService || !this._selectionService.hasSelection) {\n return undefined;\n }\n\n return {\n start: {\n x: this._selectionService.selectionStart![0],\n y: this._selectionService.selectionStart![1]\n },\n end: {\n x: this._selectionService.selectionEnd![0],\n y: this._selectionService.selectionEnd![1]\n }\n };\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._selectionService?.clearSelection();\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._selectionService?.selectAll();\n }\n\n public selectLines(start: number, end: number): void {\n this._selectionService?.selectLines(start, end);\n }\n\n /**\n * Handle a keydown [KeyboardEvent].\n *\n * [KeyboardEvent]: https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n */\n protected _keyDown(event: KeyboardEvent): boolean | undefined {\n this._keyDownHandled = false;\n this._keyDownSeen = true;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {\n return false;\n }\n\n // Ignore composing with Alt key on Mac when macOptionIsMeta is enabled\n const shouldIgnoreComposition = this.browser.isMac && this.options.macOptionIsMeta && event.altKey;\n\n if (!shouldIgnoreComposition && !this._compositionHelper!.keydown(event)) {\n if (this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp) {\n this.scrollToBottom(true);\n }\n return false;\n }\n\n if (!shouldIgnoreComposition && (event.key === 'Dead' || event.key === 'AltGraph')) {\n this._unprocessedDeadKey = true;\n }\n\n const result = evaluateKeyboardEvent(event, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);\n\n this.updateCursorStyle(event);\n\n if (result.type === KeyboardResultType.PAGE_DOWN || result.type === KeyboardResultType.PAGE_UP) {\n const scrollCount = this.rows - 1;\n this.scrollLines(result.type === KeyboardResultType.PAGE_UP ? -scrollCount : scrollCount);\n return this.cancel(event, true);\n }\n\n if (result.type === KeyboardResultType.SELECT_ALL) {\n this.selectAll();\n }\n\n if (this._isThirdLevelShift(this.browser, event)) {\n return true;\n }\n\n if (result.cancel) {\n // The event is canceled at the end already, is this necessary?\n this.cancel(event, true);\n }\n\n if (!result.key) {\n return true;\n }\n\n // HACK: Process A-Z in the keypress event to fix an issue with macOS IMEs where lower case\n // letters cannot be input while caps lock is on.\n if (event.key && !event.ctrlKey && !event.altKey && !event.metaKey && event.key.length === 1) {\n if (event.key.charCodeAt(0) >= 65 && event.key.charCodeAt(0) <= 90) {\n return true;\n }\n }\n\n if (this._unprocessedDeadKey) {\n this._unprocessedDeadKey = false;\n return true;\n }\n\n // If ctrl+c or enter is being sent, clear out the textarea. This is done so that screen readers\n // will announce deleted characters. This will not work 100% of the time but it should cover\n // most scenarios.\n if (result.key === C0.ETX || result.key === C0.CR) {\n this.textarea!.value = '';\n }\n\n this._onKey.fire({ key: result.key, domEvent: event });\n this._showCursor();\n this.coreService.triggerDataEvent(result.key, true);\n\n // Cancel events when not in screen reader mode so events don't get bubbled up and handled by\n // other listeners. When screen reader mode is enabled, we don't cancel them (unless ctrl or alt\n // is also depressed) so that the cursor textarea can be updated, which triggers the screen\n // reader to read it.\n if (!this.optionsService.rawOptions.screenReaderMode || event.altKey || event.ctrlKey) {\n return this.cancel(event, true);\n }\n\n this._keyDownHandled = true;\n }\n\n private _isThirdLevelShift(browser: IBrowser, ev: KeyboardEvent): boolean {\n const thirdLevelKey =\n (browser.isMac && !this.options.macOptionIsMeta && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.altKey && ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.getModifierState('AltGraph'));\n\n if (ev.type === 'keypress') {\n return thirdLevelKey;\n }\n\n // Don't invoke for arrows, pageDown, home, backspace, etc. (on non-keypress events)\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n }\n\n protected _keyUp(ev: KeyboardEvent): void {\n this._keyDownSeen = false;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return;\n }\n\n if (!wasModifierKeyOnlyEvent(ev)) {\n this.focus();\n }\n\n this.updateCursorStyle(ev);\n this._keyPressHandled = false;\n }\n\n /**\n * Handle a keypress event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n * @param ev The keypress event to be handled.\n */\n protected _keyPress(ev: KeyboardEvent): boolean {\n let key;\n\n this._keyPressHandled = false;\n\n if (this._keyDownHandled) {\n return false;\n }\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return false;\n }\n\n this.cancel(ev);\n\n if (ev.charCode) {\n key = ev.charCode;\n } else if (ev.which === null || ev.which === undefined) {\n key = ev.keyCode;\n } else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n } else {\n return false;\n }\n\n if (!key || (\n (ev.altKey || ev.ctrlKey || ev.metaKey) && !this._isThirdLevelShift(this.browser, ev)\n )) {\n return false;\n }\n\n key = String.fromCharCode(key);\n\n this._onKey.fire({ key, domEvent: ev });\n this._showCursor();\n this.coreService.triggerDataEvent(key, true);\n\n this._keyPressHandled = true;\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n return true;\n }\n\n /**\n * Handle an input event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/Web/API/InputEvent\n * @param ev The input event to be handled.\n */\n protected _inputEvent(ev: InputEvent): boolean {\n // Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to\n // support reading out character input which can doubling up input characters\n // Based on these event traces: https://github.com/xtermjs/xterm.js/issues/3679\n if (ev.data && ev.inputType === 'insertText' && (!ev.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {\n if (this._keyPressHandled) {\n return false;\n }\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n const text = ev.data;\n this.coreService.triggerDataEvent(text, true);\n\n this.cancel(ev);\n return true;\n }\n\n return false;\n }\n\n /**\n * Resizes the terminal.\n *\n * @param x The number of columns to resize to.\n * @param y The number of rows to resize to.\n */\n public resize(x: number, y: number): void {\n if (x === this.cols && y === this.rows) {\n // Check if we still need to measure the char size (fixes #785).\n if (this._charSizeService && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n return;\n }\n\n super.resize(x, y);\n }\n\n private _afterResize(x: number, y: number): void {\n this._charSizeService?.measure();\n }\n\n /**\n * Clear the entire buffer, making the prompt line the new first line.\n */\n public clear(): void {\n if (this.buffer.ybase === 0 && this.buffer.y === 0) {\n // Don't clear if it's already clear\n return;\n }\n this.buffer.clearAllMarkers();\n this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);\n this.buffer.lines.length = 1;\n this.buffer.ydisp = 0;\n this.buffer.ybase = 0;\n this.buffer.y = 0;\n for (let i = 1; i < this.rows; i++) {\n this.buffer.lines.push(this.buffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n // IMPORTANT: Fire scroll event before viewport is reset. This ensures embedders get the clear\n // scroll event and that the viewport's state will be valid for immediate writes.\n this._onScroll.fire({ position: this.buffer.ydisp });\n this.refresh(0, this.rows - 1);\n }\n\n /**\n * Reset terminal.\n * Note: Calling this directly from JS is synchronous but does not clear\n * input buffers and does not reset the parser, thus the terminal will\n * continue to apply pending input data.\n * If you need in band reset (synchronous with input data) consider\n * using DECSTR (soft reset, CSI ! p) or RIS instead (hard reset, ESC c).\n */\n public reset(): void {\n /**\n * Since _setup handles a full terminal creation, we have to carry forward\n * a few things that should not reset.\n */\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n const customKeyEventHandler = this._customKeyEventHandler;\n\n this._setup();\n super.reset();\n this._selectionService?.reset();\n this._decorationService.reset();\n\n // reattach\n this._customKeyEventHandler = customKeyEventHandler;\n\n // do a full screen refresh\n this.refresh(0, this.rows - 1);\n }\n\n public clearTextureAtlas(): void {\n this._renderService?.clearTextureAtlas();\n }\n\n private _reportFocus(): void {\n if (this.element?.classList.contains('focus')) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n } else {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n }\n\n private _reportWindowsOptions(type: WindowsOptionsReportType): void {\n if (!this._renderService) {\n return;\n }\n\n switch (type) {\n case WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:\n const canvasWidth = this._renderService.dimensions.css.canvas.width.toFixed(0);\n const canvasHeight = this._renderService.dimensions.css.canvas.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[4;${canvasHeight};${canvasWidth}t`);\n break;\n case WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:\n const cellWidth = this._renderService.dimensions.css.cell.width.toFixed(0);\n const cellHeight = this._renderService.dimensions.css.cell.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[6;${cellHeight};${cellWidth}t`);\n break;\n }\n }\n\n // TODO: Remove cancel function and cancelEvents option\n public cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | undefined {\n if (!this.options.cancelEvents && !force) {\n return;\n }\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n}\n\n/**\n * Helpers\n */\n\nfunction wasModifierKeyOnlyEvent(ev: KeyboardEvent): boolean {\n return ev.keyCode === 16 || // Shift\n ev.keyCode === 17 || // Ctrl\n ev.keyCode === 18; // Alt\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';\nimport { Disposable, dispose, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { IBufferService } from 'common/services/Services';\nimport { ILinkProviderService, IMouseService, IRenderService } from './services/Services';\nimport { Emitter } from 'vs/base/common/event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nexport class Linkifier extends Disposable implements ILinkifier2 {\n public get currentLink(): ILinkWithState | undefined { return this._currentLink; }\n protected _currentLink: ILinkWithState | undefined;\n private _mouseDownLink: ILinkWithState | undefined;\n private _lastMouseEvent: MouseEvent | undefined;\n private _linkCacheDisposables: IDisposable[] = [];\n private _lastBufferCell: IBufferCellPosition | undefined;\n private _isMouseOut: boolean = true;\n private _wasResized: boolean = false;\n private _activeProviderReplies: Map | undefined;\n private _activeLine: number = -1;\n\n private readonly _onShowLinkUnderline = this._register(new Emitter());\n public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;\n private readonly _onHideLinkUnderline = this._register(new Emitter());\n public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;\n\n constructor(\n private readonly _element: HTMLElement,\n @IMouseService private readonly _mouseService: IMouseService,\n @IRenderService private readonly _renderService: IRenderService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ILinkProviderService private readonly _linkProviderService: ILinkProviderService\n ) {\n super();\n this._register(toDisposable(() => {\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n this._lastMouseEvent = undefined;\n // Clear out link providers as they could easily cause an embedder memory leak\n this._activeProviderReplies?.clear();\n }));\n // Listen to resize to catch the case where it's resized and the cursor is out of the viewport.\n this._register(this._bufferService.onResize(() => {\n this._clearCurrentLink();\n this._wasResized = true;\n }));\n this._register(addDisposableListener(this._element, 'mouseleave', () => {\n this._isMouseOut = true;\n this._clearCurrentLink();\n }));\n this._register(addDisposableListener(this._element, 'mousemove', this._handleMouseMove.bind(this)));\n this._register(addDisposableListener(this._element, 'mousedown', this._handleMouseDown.bind(this)));\n this._register(addDisposableListener(this._element, 'mouseup', this._handleMouseUp.bind(this)));\n }\n\n private _handleMouseMove(event: MouseEvent): void {\n this._lastMouseEvent = event;\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n this._isMouseOut = false;\n\n // Ignore the event if it's an embedder created hover widget\n const composedPath = event.composedPath() as HTMLElement[];\n for (let i = 0; i < composedPath.length; i++) {\n const target = composedPath[i];\n // Hit Terminal.element, break and continue\n if (target.classList.contains('xterm')) {\n break;\n }\n // It's a hover, don't respect hover event\n if (target.classList.contains('xterm-hover')) {\n return;\n }\n }\n\n if (!this._lastBufferCell || (position.x !== this._lastBufferCell.x || position.y !== this._lastBufferCell.y)) {\n this._handleHover(position);\n this._lastBufferCell = position;\n }\n }\n\n private _handleHover(position: IBufferCellPosition): void {\n // TODO: This currently does not cache link provider results across wrapped lines, activeLine\n // should be something like `activeRange: {startY, endY}`\n // Check if we need to clear the link\n if (this._activeLine !== position.y || this._wasResized) {\n this._clearCurrentLink();\n this._askForLink(position, false);\n this._wasResized = false;\n return;\n }\n\n // Check the if the link is in the mouse position\n const isCurrentLinkInPosition = this._currentLink && this._linkAtPosition(this._currentLink.link, position);\n if (!isCurrentLinkInPosition) {\n this._clearCurrentLink();\n this._askForLink(position, true);\n }\n }\n\n private _askForLink(position: IBufferCellPosition, useLineCache: boolean): void {\n if (!this._activeProviderReplies || !useLineCache) {\n this._activeProviderReplies?.forEach(reply => {\n reply?.forEach(linkWithState => {\n if (linkWithState.link.dispose) {\n linkWithState.link.dispose();\n }\n });\n });\n this._activeProviderReplies = new Map();\n this._activeLine = position.y;\n }\n let linkProvided = false;\n\n // There is no link cached, so ask for one\n for (const [i, linkProvider] of this._linkProviderService.linkProviders.entries()) {\n if (useLineCache) {\n const existingReply = this._activeProviderReplies?.get(i);\n // If there isn't a reply, the provider hasn't responded yet.\n\n // TODO: If there isn't a reply yet it means that the provider is still resolving. Ensuring\n // provideLinks isn't triggered again saves ILink.hover firing twice though. This probably\n // needs promises to get fixed\n if (existingReply) {\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n }\n } else {\n linkProvider.provideLinks(position.y, (links: ILink[] | undefined) => {\n if (this._isMouseOut) {\n return;\n }\n const linksWithState: ILinkWithState[] | undefined = links?.map(link => ({ link }));\n this._activeProviderReplies?.set(i, linksWithState);\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n\n // If all providers have responded, remove lower priority links that intersect ranges of\n // higher priority links\n if (this._activeProviderReplies?.size === this._linkProviderService.linkProviders.length) {\n this._removeIntersectingLinks(position.y, this._activeProviderReplies);\n }\n });\n }\n }\n }\n\n private _removeIntersectingLinks(y: number, replies: Map): void {\n const occupiedCells = new Set();\n for (let i = 0; i < replies.size; i++) {\n const providerReply = replies.get(i);\n if (!providerReply) {\n continue;\n }\n for (let i = 0; i < providerReply.length; i++) {\n const linkWithState = providerReply[i];\n const startX = linkWithState.link.range.start.y < y ? 0 : linkWithState.link.range.start.x;\n const endX = linkWithState.link.range.end.y > y ? this._bufferService.cols : linkWithState.link.range.end.x;\n for (let x = startX; x <= endX; x++) {\n if (occupiedCells.has(x)) {\n providerReply.splice(i--, 1);\n break;\n }\n occupiedCells.add(x);\n }\n }\n }\n }\n\n private _checkLinkProviderResult(index: number, position: IBufferCellPosition, linkProvided: boolean): boolean {\n if (!this._activeProviderReplies) {\n return linkProvided;\n }\n\n const links = this._activeProviderReplies.get(index);\n\n // Check if every provider before this one has come back undefined\n let hasLinkBefore = false;\n for (let j = 0; j < index; j++) {\n if (!this._activeProviderReplies.has(j) || this._activeProviderReplies.get(j)) {\n hasLinkBefore = true;\n }\n }\n\n // If all providers with higher priority came back undefined, then this provider's link for\n // the position should be used\n if (!hasLinkBefore && links) {\n const linkAtPosition = links.find(link => this._linkAtPosition(link.link, position));\n if (linkAtPosition) {\n linkProvided = true;\n this._handleNewLink(linkAtPosition);\n }\n }\n\n // Check if all the providers have responded\n if (this._activeProviderReplies.size === this._linkProviderService.linkProviders.length && !linkProvided) {\n // Respect the order of the link providers\n for (let j = 0; j < this._activeProviderReplies.size; j++) {\n const currentLink = this._activeProviderReplies.get(j)?.find(link => this._linkAtPosition(link.link, position));\n if (currentLink) {\n linkProvided = true;\n this._handleNewLink(currentLink);\n break;\n }\n }\n }\n\n return linkProvided;\n }\n\n private _handleMouseDown(): void {\n this._mouseDownLink = this._currentLink;\n }\n\n private _handleMouseUp(event: MouseEvent): void {\n if (!this._currentLink) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n\n if (this._mouseDownLink && linkEquals(this._mouseDownLink.link, this._currentLink.link) && this._linkAtPosition(this._currentLink.link, position)) {\n this._currentLink.link.activate(event, this._currentLink.link.text);\n }\n }\n\n private _clearCurrentLink(startRow?: number, endRow?: number): void {\n if (!this._currentLink || !this._lastMouseEvent) {\n return;\n }\n\n // If we have a start and end row, check that the link is within it\n if (!startRow || !endRow || (this._currentLink.link.range.start.y >= startRow && this._currentLink.link.range.end.y <= endRow)) {\n this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent);\n this._currentLink = undefined;\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n }\n }\n\n private _handleNewLink(linkWithState: ILinkWithState): void {\n if (!this._lastMouseEvent) {\n return;\n }\n\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);\n\n if (!position) {\n return;\n }\n\n // Trigger hover if the we have a link at the position\n if (this._linkAtPosition(linkWithState.link, position)) {\n this._currentLink = linkWithState;\n this._currentLink.state = {\n decorations: {\n underline: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.underline,\n pointerCursor: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.pointerCursor\n },\n isHovered: true\n };\n this._linkHover(this._element, linkWithState.link, this._lastMouseEvent);\n\n // Add listener for tracking decorations changes\n linkWithState.link.decorations = {} as ILinkDecorations;\n Object.defineProperties(linkWithState.link.decorations, {\n pointerCursor: {\n get: () => this._currentLink?.state?.decorations.pointerCursor,\n set: v => {\n if (this._currentLink?.state && this._currentLink.state.decorations.pointerCursor !== v) {\n this._currentLink.state.decorations.pointerCursor = v;\n if (this._currentLink.state.isHovered) {\n this._element.classList.toggle('xterm-cursor-pointer', v);\n }\n }\n }\n },\n underline: {\n get: () => this._currentLink?.state?.decorations.underline,\n set: v => {\n if (this._currentLink?.state && this._currentLink?.state?.decorations.underline !== v) {\n this._currentLink.state.decorations.underline = v;\n if (this._currentLink.state.isHovered) {\n this._fireUnderlineEvent(linkWithState.link, v);\n }\n }\n }\n }\n });\n\n // Listen to viewport changes to re-render the link under the cursor (only when the line the\n // link is on changes)\n this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {\n // Sanity check, this shouldn't happen in practice as this listener would be disposed\n if (!this._currentLink) {\n return;\n }\n // When start is 0 a scroll most likely occurred, make sure links above the fold also get\n // cleared.\n const start = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;\n const end = this._bufferService.buffer.ydisp + 1 + e.end;\n // Only clear the link if the viewport change happened on this line\n if (this._currentLink.link.range.start.y >= start && this._currentLink.link.range.end.y <= end) {\n this._clearCurrentLink(start, end);\n if (this._lastMouseEvent) {\n // re-eval previously active link after changes\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService!);\n if (position) {\n this._askForLink(position, false);\n }\n }\n }\n }));\n }\n }\n\n protected _linkHover(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = true;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, true);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.add('xterm-cursor-pointer');\n }\n }\n\n if (link.hover) {\n link.hover(event, link.text);\n }\n }\n\n private _fireUnderlineEvent(link: ILink, showEvent: boolean): void {\n const range = link.range;\n const scrollOffset = this._bufferService.buffer.ydisp;\n const event = this._createLinkUnderlineEvent(range.start.x - 1, range.start.y - scrollOffset - 1, range.end.x, range.end.y - scrollOffset - 1, undefined);\n const emitter = showEvent ? this._onShowLinkUnderline : this._onHideLinkUnderline;\n emitter.fire(event);\n }\n\n protected _linkLeave(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = false;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, false);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.remove('xterm-cursor-pointer');\n }\n }\n\n if (link.leave) {\n link.leave(event, link.text);\n }\n }\n\n /**\n * Check if the buffer position is within the link\n * @param link\n * @param position\n */\n private _linkAtPosition(link: ILink, position: IBufferCellPosition): boolean {\n const lower = link.range.start.y * this._bufferService.cols + link.range.start.x;\n const upper = link.range.end.y * this._bufferService.cols + link.range.end.x;\n const current = position.y * this._bufferService.cols + position.x;\n return (lower <= current && current <= upper);\n }\n\n /**\n * Get the buffer position from a mouse event\n * @param event\n */\n private _positionFromMouseEvent(event: MouseEvent, element: HTMLElement, mouseService: IMouseService): IBufferCellPosition | undefined {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }\n\n private _createLinkUnderlineEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {\n return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };\n }\n}\n\nfunction linkEquals(a: ILink, b: ILink): boolean {\n return (\n a.text === b.text &&\n a.range.start.x === b.range.start.x &&\n a.range.start.y === b.range.start.y &&\n a.range.end.x === b.range.end.x &&\n a.range.end.y === b.range.end.y\n );\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n// This file contains strings that get exported in the API so they can be localized\n\nlet promptLabelInternal = 'Terminal input';\nconst promptLabel = {\n get: () => promptLabelInternal,\n set: (value: string) => promptLabelInternal = value\n};\n\nlet tooMuchOutputInternal = 'Too much output to announce, navigate to rows manually to read';\nconst tooMuchOutput = {\n get: () => tooMuchOutputInternal,\n set: (value: string) => tooMuchOutputInternal = value\n};\n\nexport {\n promptLabel,\n tooMuchOutput\n};\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILink } from 'browser/Types';\nimport { ILinkProvider } from 'browser/services/Services';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService, IOptionsService, IOscLinkService } from 'common/services/Services';\n\nexport class OscLinkProvider implements ILinkProvider {\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IOscLinkService private readonly _oscLinkService: IOscLinkService\n ) {\n }\n\n public provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void {\n const line = this._bufferService.buffer.lines.get(y - 1);\n if (!line) {\n callback(undefined);\n return;\n }\n\n const result: ILink[] = [];\n const linkHandler = this._optionsService.rawOptions.linkHandler;\n const cell = new CellData();\n const lineLength = line.getTrimmedLength();\n let currentLinkId = -1;\n let currentStart = -1;\n let finishLink = false;\n for (let x = 0; x < lineLength; x++) {\n // Minor optimization, only check for content if there isn't a link in case the link ends with\n // a null cell\n if (currentStart === -1 && !line.hasContent(x)) {\n continue;\n }\n\n line.loadCell(x, cell);\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n if (currentStart === -1) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n continue;\n } else {\n finishLink = cell.extended.urlId !== currentLinkId;\n }\n } else {\n if (currentStart !== -1) {\n finishLink = true;\n }\n }\n\n if (finishLink || (currentStart !== -1 && x === lineLength - 1)) {\n const text = this._oscLinkService.getLinkData(currentLinkId)?.uri;\n if (text) {\n // These ranges are 1-based\n const range: IBufferRange = {\n start: {\n x: currentStart + 1,\n y\n },\n end: {\n // Offset end x if it's a link that ends on the last cell in the line\n x: x + (!finishLink && x === lineLength - 1 ? 1 : 0),\n y\n }\n };\n\n let ignoreLink = false;\n if (!linkHandler?.allowNonHttpProtocols) {\n try {\n const parsed = new URL(text);\n if (!['http:', 'https:'].includes(parsed.protocol)) {\n ignoreLink = true;\n }\n } catch (e) {\n // Ignore invalid URLs to prevent unexpected behaviors\n ignoreLink = true;\n }\n }\n\n if (!ignoreLink) {\n // OSC links always use underline and pointer decorations\n result.push({\n text,\n range,\n activate: (e, text) => (linkHandler ? linkHandler.activate(e, text, range) : defaultActivate(e, text)),\n hover: (e, text) => linkHandler?.hover?.(e, text, range),\n leave: (e, text) => linkHandler?.leave?.(e, text, range)\n });\n }\n }\n finishLink = false;\n\n // Clear link or start a new link if one starts immediately\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n } else {\n currentStart = -1;\n currentLinkId = -1;\n }\n }\n }\n\n // TODO: Handle fetching and returning other link ranges to underline other links with the same\n // id\n callback(result);\n }\n}\n\nfunction defaultActivate(e: MouseEvent, uri: string): void {\n const answer = confirm(`Do you want to navigate to ${uri}?\\n\\nWARNING: This link could potentially be dangerous`);\n if (answer) {\n const newWindow = window.open();\n if (newWindow) {\n try {\n newWindow.opener = null;\n } catch {\n // no-op, Electron can throw\n }\n newWindow.location.href = uri;\n } else {\n console.warn('Opening link blocked as opener could not be cleared');\n }\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { ICoreBrowserService } from 'browser/services/Services';\n\n/**\n * Debounces calls to render terminal rows using animation frames.\n */\nexport class RenderDebouncer implements IRenderDebouncerWithCallback {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n private _animationFrame: number | undefined;\n private _refreshCallbacks: FrameRequestCallback[] = [];\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _coreBrowserService: ICoreBrowserService\n ) {\n }\n\n public dispose(): void {\n if (this._animationFrame) {\n this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n this._refreshCallbacks.push(callback);\n if (!this._animationFrame) {\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n return this._animationFrame;\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart !== undefined ? rowStart : 0;\n rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n if (this._animationFrame) {\n return;\n }\n\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n\n private _innerRefresh(): void {\n this._animationFrame = undefined;\n\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n this._runRefreshCallbacks();\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n this._runRefreshCallbacks();\n }\n\n private _runRefreshCallbacks(): void {\n for (const callback of this._refreshCallbacks) {\n callback(0);\n }\n this._refreshCallbacks = [];\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nconst RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second\n\nimport { IRenderDebouncer } from 'browser/Types';\n\n/**\n * Debounces calls to update screen readers to update at most once configurable interval of time.\n */\nexport class TimeBasedDebouncer implements IRenderDebouncer {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n\n // The last moment that the Terminal was refreshed at\n private _lastRefreshMs = 0;\n // Whether a trailing refresh should be triggered due to a refresh request that was throttled\n private _additionalRefreshRequested = false;\n\n private _refreshTimeoutID: number | undefined;\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _debounceThresholdMS = RENDER_DEBOUNCE_THRESHOLD_MS\n ) {\n }\n\n public dispose(): void {\n if (this._refreshTimeoutID) {\n clearTimeout(this._refreshTimeoutID);\n }\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart !== undefined ? rowStart : 0;\n rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n // Only refresh if the time since last refresh is above a threshold, otherwise wait for\n // enough time to pass before refreshing again.\n const refreshRequestTime: number = Date.now();\n if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {\n // Enough time has lapsed since the last refresh; refresh immediately\n this._lastRefreshMs = refreshRequestTime;\n this._innerRefresh();\n } else if (!this._additionalRefreshRequested) {\n // This is the first additional request throttled; set up trailing refresh\n const elapsed = refreshRequestTime - this._lastRefreshMs;\n const waitPeriodBeforeTrailingRefresh = this._debounceThresholdMS - elapsed;\n this._additionalRefreshRequested = true;\n\n this._refreshTimeoutID = window.setTimeout(() => {\n this._lastRefreshMs = Date.now();\n this._innerRefresh();\n this._additionalRefreshRequested = false;\n this._refreshTimeoutID = undefined; // No longer need to clear the timeout\n }, waitPeriodBeforeTrailingRefresh);\n }\n }\n\n private _innerRefresh(): void {\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n }\n}\n\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm';\nimport { channels, css } from 'common/Color';\nimport type { Event } from 'vs/base/common/event';\n\n/**\n * A portion of the public API that are implemented identially internally and simply passed through.\n */\ntype InternalPassthroughApis = Omit;\n\nexport interface ITerminal extends InternalPassthroughApis, ICoreTerminal {\n screenElement: HTMLElement | undefined;\n browser: IBrowser;\n buffer: IBuffer;\n linkifier: ILinkifier2 | undefined;\n options: Required;\n\n onBlur: Event;\n onFocus: Event;\n onA11yChar: Event;\n onA11yTab: Event;\n onWillOpen: Event;\n\n cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | void;\n}\n\nexport type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;\nexport type CustomWheelEventHandler = (event: WheelEvent) => boolean;\n\nexport type LineData = CharData[];\n\nexport interface ICompositionHelper {\n readonly isComposing: boolean;\n compositionstart(): void;\n compositionupdate(ev: CompositionEvent): void;\n compositionend(): void;\n updateCompositionElements(dontRecurse?: boolean): void;\n keydown(ev: KeyboardEvent): boolean;\n}\n\nexport interface IBrowser {\n isNode: boolean;\n userAgent: string;\n platform: string;\n isFirefox: boolean;\n isMac: boolean;\n isIpad: boolean;\n isIphone: boolean;\n isWindows: boolean;\n}\n\nexport interface IColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n cursorAccent: IColor;\n selectionForeground: IColor | undefined;\n selectionBackgroundTransparent: IColor;\n /** The selection blended on top of background. */\n selectionBackgroundOpaque: IColor;\n selectionInactiveBackgroundTransparent: IColor;\n selectionInactiveBackgroundOpaque: IColor;\n scrollbarSliderBackground: IColor;\n scrollbarSliderHoverBackground: IColor;\n scrollbarSliderActiveBackground: IColor;\n overviewRulerBorder: IColor;\n ansi: IColor[];\n /** Maps original colors to colors that respect minimum contrast ratio. */\n contrastCache: IColorContrastCache;\n /** Maps original colors to colors that respect _half_ of the minimum contrast ratio. */\n halfContrastCache: IColorContrastCache;\n}\n\nexport type ReadonlyColorSet = Readonly> & { ansi: Readonly['ansi']> };\n\nexport interface IColorContrastCache {\n clear(): void;\n setCss(bg: number, fg: number, value: string | null): void;\n getCss(bg: number, fg: number): string | null | undefined;\n setColor(bg: number, fg: number, value: IColor | null): void;\n getColor(bg: number, fg: number): IColor | null | undefined;\n}\n\nexport interface IPartialColorSet {\n foreground: IColor;\n background: IColor;\n cursor?: IColor;\n cursorAccent?: IColor;\n selectionBackground?: IColor;\n ansi: IColor[];\n}\n\nexport interface IViewport extends IDisposable {\n scrollBarWidth: number;\n readonly onRequestScrollLines: Event<{ amount: number, suppressScrollEvent: boolean }>;\n syncScrollArea(immediate?: boolean, force?: boolean): void;\n getLinesScrolled(ev: WheelEvent): number;\n getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement };\n handleWheel(ev: WheelEvent): boolean;\n handleTouchStart(ev: TouchEvent): void;\n handleTouchMove(ev: TouchEvent): boolean;\n scrollLines(disp: number): void; // todo api name?\n reset(): void;\n}\n\nexport interface ILinkifierEvent {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n cols: number;\n fg: number | undefined;\n}\n\ninterface ILinkState {\n decorations: ILinkDecorations;\n isHovered: boolean;\n}\nexport interface ILinkWithState {\n link: ILink;\n state?: ILinkState;\n}\n\nexport interface ILinkifier2 extends IDisposable {\n onShowLinkUnderline: Event;\n onHideLinkUnderline: Event;\n readonly currentLink: ILinkWithState | undefined;\n}\n\nexport interface ILink {\n range: IBufferRange;\n text: string;\n decorations?: ILinkDecorations;\n activate(event: MouseEvent, text: string): void;\n hover?(event: MouseEvent, text: string): void;\n leave?(event: MouseEvent, text: string): void;\n dispose?(): void;\n}\n\nexport interface ILinkDecorations {\n pointerCursor: boolean;\n underline: boolean;\n}\n\nexport interface IBufferRange {\n start: IBufferCellPosition;\n end: IBufferCellPosition;\n}\n\nexport interface IBufferCellPosition {\n x: number;\n y: number;\n}\n\nexport type CharacterJoinerHandler = (text: string) => [number, number][];\n\nexport interface ICharacterJoiner {\n id: number;\n handler: CharacterJoinerHandler;\n}\n\nexport interface IRenderDebouncer extends IDisposable {\n refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void;\n}\n\nexport interface IRenderDebouncerWithCallback extends IRenderDebouncer {\n addRefreshCallback(callback: FrameRequestCallback): number;\n}\n\nexport interface IBufferElementProvider {\n provideBufferElements(): DocumentFragment | HTMLElement;\n}\n\n// An IIFE to generate DEFAULT_ANSI_COLORS.\nexport const DEFAULT_ANSI_COLORS = Object.freeze((() => {\n const colors = [\n // dark:\n css.toColor('#2e3436'),\n css.toColor('#cc0000'),\n css.toColor('#4e9a06'),\n css.toColor('#c4a000'),\n css.toColor('#3465a4'),\n css.toColor('#75507b'),\n css.toColor('#06989a'),\n css.toColor('#d3d7cf'),\n // bright:\n css.toColor('#555753'),\n css.toColor('#ef2929'),\n css.toColor('#8ae234'),\n css.toColor('#fce94f'),\n css.toColor('#729fcf'),\n css.toColor('#ad7fa8'),\n css.toColor('#34e2e2'),\n css.toColor('#eeeeec')\n ];\n\n // Fill in the remaining 240 ANSI colors.\n // Generate colors (16-231)\n const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];\n for (let i = 0; i < 216; i++) {\n const r = v[(i / 36) % 6 | 0];\n const g = v[(i / 6) % 6 | 0];\n const b = v[i % 6];\n colors.push({\n css: channels.toCss(r, g, b),\n rgba: channels.toRgba(r, g, b)\n });\n }\n\n // Generate greys (232-255)\n for (let i = 0; i < 24; i++) {\n const c = 8 + i * 10;\n colors.push({\n css: channels.toCss(c, c, c),\n rgba: channels.toRgba(c, c, c)\n });\n }\n\n return colors;\n})());\n","/**\n * Copyright (c) 2024 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { ViewportConstants } from 'browser/shared/Constants';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';\nimport { CoreMouseEventType } from 'common/Types';\nimport { scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';\nimport { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';\nimport type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';\n\nexport class Viewport extends Disposable {\n\n protected _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n private _scrollableElement: SmoothScrollableElement;\n private _styleElement: HTMLStyleElement;\n\n private _queuedAnimationFrame?: number;\n private _latestYDisp?: number;\n private _isSyncing: boolean = false;\n private _isHandlingScroll: boolean = false;\n private _suppressOnScrollHandler: boolean = false;\n\n constructor(\n element: HTMLElement,\n screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService,\n @ICoreMouseService coreMouseService: ICoreMouseService,\n @IThemeService themeService: IThemeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n const scrollable = this._register(new Scrollable({\n forceIntegerValues: false,\n smoothScrollDuration: this._optionsService.rawOptions.smoothScrollDuration,\n // This is used over `IRenderService.addRefreshCallback` since it can be canceled\n scheduleAtNextAnimationFrame: cb => scheduleAtNextAnimationFrame(coreBrowserService.window, cb)\n }));\n this._register(this._optionsService.onSpecificOptionChange('smoothScrollDuration', () => {\n scrollable.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration);\n }));\n\n this._scrollableElement = this._register(new SmoothScrollableElement(screenElement, {\n vertical: ScrollbarVisibility.Auto,\n horizontal: ScrollbarVisibility.Hidden,\n useShadows: false,\n mouseWheelSmoothScroll: true,\n ...this._getChangeOptions()\n }, scrollable));\n this._register(this._optionsService.onMultipleOptionChange([\n 'scrollSensitivity',\n 'fastScrollSensitivity',\n 'overviewRuler'\n ], () => this._scrollableElement.updateOptions(this._getChangeOptions())));\n // Don't handle mouse wheel if wheel events are supported by the current mouse prototcol\n this._register(coreMouseService.onProtocolChange(type => {\n this._scrollableElement.updateOptions({\n handleMouseWheel: !(type & CoreMouseEventType.WHEEL)\n });\n }));\n\n this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });\n this._register(Event.runAndSubscribe(themeService.onChangeColors, () => {\n this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;\n }));\n element.appendChild(this._scrollableElement.getDomNode());\n this._register(toDisposable(() => this._scrollableElement.getDomNode().remove()));\n\n this._styleElement = coreBrowserService.mainDocument.createElement('style');\n screenElement.appendChild(this._styleElement);\n this._register(toDisposable(() => this._styleElement.remove()));\n this._register(Event.runAndSubscribe(themeService.onChangeColors, () => {\n this._styleElement.textContent = [\n `.xterm .xterm-scrollable-element > .scrollbar > .slider {`,\n ` background: ${themeService.colors.scrollbarSliderBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,\n ` background: ${themeService.colors.scrollbarSliderHoverBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,\n ` background: ${themeService.colors.scrollbarSliderActiveBackground.css};`,\n `}`\n ].join('\\n');\n }));\n\n this._register(this._bufferService.onResize(() => this._queueSync()));\n this._register(this._bufferService.buffers.onBufferActivate(() => this._queueSync()));\n this._register(this._bufferService.onScroll(() => this._sync()));\n\n this._register(this._scrollableElement.onScroll(e => this._handleScroll(e)));\n }\n\n public scrollLines(disp: number): void {\n const pos = this._scrollableElement.getScrollPosition();\n this._scrollableElement.setScrollPosition({\n reuseAnimation: true,\n scrollTop: pos.scrollTop + disp * this._renderService.dimensions.css.cell.height\n });\n }\n\n public scrollToLine(line: number, disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll) {\n this._latestYDisp = line;\n }\n this._scrollableElement.setScrollPosition({\n reuseAnimation: !disableSmoothScroll,\n scrollTop: line * this._renderService.dimensions.css.cell.height\n });\n }\n\n private _getChangeOptions(): ScrollableElementChangeOptions {\n return {\n mouseWheelScrollSensitivity: this._optionsService.rawOptions.scrollSensitivity,\n fastScrollSensitivity: this._optionsService.rawOptions.fastScrollSensitivity,\n verticalScrollbarSize: this._optionsService.rawOptions.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH\n };\n }\n\n private _queueSync(ydisp?: number): void {\n // Update state\n if (ydisp !== undefined) {\n this._latestYDisp = ydisp;\n }\n\n // Don't queue more than one callback\n if (this._queuedAnimationFrame !== undefined) {\n return;\n }\n this._queuedAnimationFrame = this._renderService.addRefreshCallback(() => {\n this._queuedAnimationFrame = undefined;\n this._sync(this._latestYDisp);\n });\n }\n\n private _sync(ydisp: number = this._bufferService.buffer.ydisp): void {\n if (!this._renderService || this._isSyncing) {\n return;\n }\n this._isSyncing = true;\n\n // Ignore any onScroll event that happens as a result of dimensions changing as this should\n // never cause a scrollLines call, only setScrollPosition can do that.\n this._suppressOnScrollHandler = true;\n this._scrollableElement.setScrollDimensions({\n height: this._renderService.dimensions.css.canvas.height,\n scrollHeight: this._renderService.dimensions.css.cell.height * this._bufferService.buffer.lines.length\n });\n this._suppressOnScrollHandler = false;\n\n // If ydisp has been changed by some other copmonent (input/buffer), then stop animating smooth\n // scroll and scroll there immediately.\n if (ydisp !== this._latestYDisp) {\n this._scrollableElement.setScrollPosition({\n scrollTop: ydisp * this._renderService.dimensions.css.cell.height\n });\n }\n\n this._isSyncing = false;\n }\n\n private _handleScroll(e: ScrollEvent): void {\n if (!this._renderService) {\n return;\n }\n if (this._isHandlingScroll || this._suppressOnScrollHandler) {\n return;\n }\n this._isHandlingScroll = true;\n const newRow = Math.round(e.scrollTop / this._renderService.dimensions.css.cell.height);\n const diff = newRow - this._bufferService.buffer.ydisp;\n if (diff !== 0) {\n this._latestYDisp = newRow;\n this._onRequestScrollLines.fire(diff);\n }\n this._isHandlingScroll = false;\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services';\n\nexport class BufferDecorationRenderer extends Disposable {\n private readonly _container: HTMLElement;\n private readonly _decorationElements: Map = new Map();\n\n private _animationFrame: number | undefined;\n private _altBufferIsActive: boolean = false;\n private _dimensionsChanged: boolean = false;\n\n constructor(\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n this._container = document.createElement('div');\n this._container.classList.add('xterm-decoration-container');\n this._screenElement.appendChild(this._container);\n\n this._register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations()));\n this._register(this._renderService.onDimensionsChange(() => {\n this._dimensionsChanged = true;\n this._queueRefresh();\n }));\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt;\n }));\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh()));\n this._register(this._decorationService.onDecorationRemoved(decoration => this._removeDecoration(decoration)));\n this._register(toDisposable(() => {\n this._container.remove();\n this._decorationElements.clear();\n }));\n }\n\n private _queueRefresh(): void {\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._renderService.addRefreshCallback(() => {\n this._doRefreshDecorations();\n this._animationFrame = undefined;\n });\n }\n\n private _doRefreshDecorations(): void {\n for (const decoration of this._decorationService.decorations) {\n this._renderDecoration(decoration);\n }\n this._dimensionsChanged = false;\n }\n\n private _renderDecoration(decoration: IInternalDecoration): void {\n this._refreshStyle(decoration);\n if (this._dimensionsChanged) {\n this._refreshXPosition(decoration);\n }\n }\n\n private _createElement(decoration: IInternalDecoration): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.classList.add('xterm-decoration');\n element.classList.toggle('xterm-decoration-top-layer', decoration?.options?.layer === 'top');\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${(decoration.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n\n const x = decoration.options.x ?? 0;\n if (x && x > this._bufferService.cols) {\n // exceeded the container width, so hide\n element.style.display = 'none';\n }\n this._refreshXPosition(decoration, element);\n\n return element;\n }\n\n private _refreshStyle(decoration: IInternalDecoration): void {\n const line = decoration.marker.line - this._bufferService.buffers.active.ydisp;\n if (line < 0 || line >= this._bufferService.rows) {\n // outside of viewport\n if (decoration.element) {\n decoration.element.style.display = 'none';\n decoration.onRenderEmitter.fire(decoration.element);\n }\n } else {\n let element = this._decorationElements.get(decoration);\n if (!element) {\n element = this._createElement(decoration);\n decoration.element = element;\n this._decorationElements.set(decoration, element);\n this._container.appendChild(element);\n decoration.onDispose(() => {\n this._decorationElements.delete(decoration);\n element!.remove();\n });\n }\n element.style.display = this._altBufferIsActive ? 'none' : 'block';\n if (!this._altBufferIsActive) {\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${line * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n }\n decoration.onRenderEmitter.fire(element);\n }\n }\n\n private _refreshXPosition(decoration: IInternalDecoration, element: HTMLElement | undefined = decoration.element): void {\n if (!element) {\n return;\n }\n const x = decoration.options.x ?? 0;\n if ((decoration.options.anchor || 'left') === 'right') {\n element.style.right = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n } else {\n element.style.left = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n }\n }\n\n private _removeDecoration(decoration: IInternalDecoration): void {\n this._decorationElements.get(decoration)?.remove();\n this._decorationElements.delete(decoration);\n decoration.dispose();\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInternalDecoration } from 'common/services/Services';\n\nexport interface IColorZoneStore {\n readonly zones: IColorZone[];\n clear(): void;\n addDecoration(decoration: IInternalDecoration): void;\n /**\n * Sets the amount of padding in lines that will be added between zones, if new lines intersect\n * the padding they will be merged into the same zone.\n */\n setPadding(padding: { [position: string]: number }): void;\n}\n\nexport interface IColorZone {\n /** Color in a format supported by canvas' fillStyle. */\n color: string;\n position: 'full' | 'left' | 'center' | 'right' | undefined;\n startBufferLine: number;\n endBufferLine: number;\n}\n\ninterface IMinimalDecorationForColorZone {\n marker: Pick;\n options: Pick;\n}\n\nexport class ColorZoneStore implements IColorZoneStore {\n private _zones: IColorZone[] = [];\n\n // The zone pool is used to keep zone objects from being freed between clearing the color zone\n // store and fetching the zones. This helps reduce GC pressure since the color zones are\n // accumulated on potentially every scroll event.\n private _zonePool: IColorZone[] = [];\n private _zonePoolIndex = 0;\n\n private _linePadding: { [position: string]: number } = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n };\n\n public get zones(): IColorZone[] {\n // Trim the zone pool to free unused memory\n this._zonePool.length = Math.min(this._zonePool.length, this._zones.length);\n return this._zones;\n }\n\n public clear(): void {\n this._zones.length = 0;\n this._zonePoolIndex = 0;\n }\n\n public addDecoration(decoration: IMinimalDecorationForColorZone): void {\n if (!decoration.options.overviewRulerOptions) {\n return;\n }\n for (const z of this._zones) {\n if (z.color === decoration.options.overviewRulerOptions.color &&\n z.position === decoration.options.overviewRulerOptions.position) {\n if (this._lineIntersectsZone(z, decoration.marker.line)) {\n return;\n }\n if (this._lineAdjacentToZone(z, decoration.marker.line, decoration.options.overviewRulerOptions.position)) {\n this._addLineToZone(z, decoration.marker.line);\n return;\n }\n }\n }\n // Create using zone pool if possible\n if (this._zonePoolIndex < this._zonePool.length) {\n this._zonePool[this._zonePoolIndex].color = decoration.options.overviewRulerOptions.color;\n this._zonePool[this._zonePoolIndex].position = decoration.options.overviewRulerOptions.position;\n this._zonePool[this._zonePoolIndex].startBufferLine = decoration.marker.line;\n this._zonePool[this._zonePoolIndex].endBufferLine = decoration.marker.line;\n this._zones.push(this._zonePool[this._zonePoolIndex++]);\n return;\n }\n // Create\n this._zones.push({\n color: decoration.options.overviewRulerOptions.color,\n position: decoration.options.overviewRulerOptions.position,\n startBufferLine: decoration.marker.line,\n endBufferLine: decoration.marker.line\n });\n this._zonePool.push(this._zones[this._zones.length - 1]);\n this._zonePoolIndex++;\n }\n\n public setPadding(padding: { [position: string]: number }): void {\n this._linePadding = padding;\n }\n\n private _lineIntersectsZone(zone: IColorZone, line: number): boolean {\n return (\n line >= zone.startBufferLine &&\n line <= zone.endBufferLine\n );\n }\n\n private _lineAdjacentToZone(zone: IColorZone, line: number, position: IColorZone['position']): boolean {\n return (\n (line >= zone.startBufferLine - this._linePadding[position || 'full']) &&\n (line <= zone.endBufferLine + this._linePadding[position || 'full'])\n );\n }\n\n private _addLineToZone(zone: IColorZone, line: number): void {\n zone.startBufferLine = Math.min(zone.startBufferLine, line);\n zone.endBufferLine = Math.max(zone.endBufferLine, line);\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';\n\nconst enum Constants {\n OVERVIEW_RULER_BORDER_WIDTH = 1\n}\n\n// Helper objects to avoid excessive calculation and garbage collection during rendering. These are\n// static values for each render and can be accessed using the decoration position as the key.\nconst drawHeight = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawWidth = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawX = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\n\nexport class OverviewRulerRenderer extends Disposable {\n private readonly _canvas: HTMLCanvasElement;\n private readonly _ctx: CanvasRenderingContext2D;\n private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();\n private get _width(): number {\n return this._optionsService.options.overviewRuler?.width || 0;\n }\n private _animationFrame: number | undefined;\n\n private _shouldUpdateDimensions: boolean | undefined = true;\n private _shouldUpdateAnchor: boolean | undefined = true;\n private _lastKnownBufferLength: number = 0;\n\n private _containerHeight: number | undefined;\n\n constructor(\n private readonly _viewportElement: HTMLElement,\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IThemeService private readonly _themeService: IThemeService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n this._canvas = this._coreBrowserService.mainDocument.createElement('canvas');\n this._canvas.classList.add('xterm-decoration-overview-ruler');\n this._refreshCanvasDimensions();\n this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement);\n this._register(toDisposable(() => this._canvas?.remove()));\n\n const ctx = this._canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Ctx cannot be null');\n } else {\n this._ctx = ctx;\n }\n\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));\n this._register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));\n\n this._register(this._renderService.onRenderedViewportChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._canvas!.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';\n }));\n this._register(this._bufferService.onScroll(() => {\n if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {\n this._refreshDrawHeightConstants();\n this._refreshColorZonePadding();\n }\n }));\n\n // Container height changed\n this._register(this._renderService.onRender((): void => {\n if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {\n this._queueRefresh(true);\n this._containerHeight = this._screenElement.clientHeight;\n }\n }));\n\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));\n this._register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));\n this._register(this._themeService.onChangeColors(() => this._queueRefresh()));\n this._queueRefresh(true);\n }\n\n private _refreshDrawConstants(): void {\n // width\n const outerWidth = Math.floor((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n const innerWidth = Math.ceil((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n drawWidth.full = this._canvas.width;\n drawWidth.left = outerWidth;\n drawWidth.center = innerWidth;\n drawWidth.right = outerWidth;\n // height\n this._refreshDrawHeightConstants();\n // x\n drawX.full = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.left = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.center = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left;\n drawX.right = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left + drawWidth.center;\n }\n\n private _refreshDrawHeightConstants(): void {\n drawHeight.full = Math.round(2 * this._coreBrowserService.dpr);\n // Calculate actual pixels per line\n const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length;\n // Clamp actual pixels within a range\n const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * this._coreBrowserService.dpr);\n drawHeight.left = nonFullHeight;\n drawHeight.center = nonFullHeight;\n drawHeight.right = nonFullHeight;\n }\n\n private _refreshColorZonePadding(): void {\n this._colorZoneStore.setPadding({\n full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.full),\n left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.left),\n center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.center),\n right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.right)\n });\n this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length;\n }\n\n private _refreshCanvasDimensions(): void {\n this._canvas.style.width = `${this._width}px`;\n this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr);\n this._canvas.style.height = `${this._screenElement.clientHeight}px`;\n this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr);\n this._refreshDrawConstants();\n this._refreshColorZonePadding();\n }\n\n private _refreshDecorations(): void {\n if (this._shouldUpdateDimensions) {\n this._refreshCanvasDimensions();\n }\n this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\n this._colorZoneStore.clear();\n for (const decoration of this._decorationService.decorations) {\n this._colorZoneStore.addDecoration(decoration);\n }\n this._ctx.lineWidth = 1;\n this._renderRulerOutline();\n const zones = this._colorZoneStore.zones;\n for (const zone of zones) {\n if (zone.position !== 'full') {\n this._renderColorZone(zone);\n }\n }\n for (const zone of zones) {\n if (zone.position === 'full') {\n this._renderColorZone(zone);\n }\n }\n this._shouldUpdateDimensions = false;\n this._shouldUpdateAnchor = false;\n }\n\n private _renderRulerOutline(): void {\n this._ctx.fillStyle = this._themeService.colors.overviewRulerBorder.css;\n this._ctx.fillRect(0, 0, Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n if (this._optionsService.rawOptions.overviewRuler.showTopBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, 0, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, Constants.OVERVIEW_RULER_BORDER_WIDTH);\n }\n if (this._optionsService.rawOptions.overviewRuler.showBottomBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n }\n }\n\n private _renderColorZone(zone: IColorZone): void {\n this._ctx.fillStyle = zone.color;\n this._ctx.fillRect(\n /* x */ drawX[zone.position || 'full'],\n /* y */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n (zone.startBufferLine / this._bufferService.buffers.active.lines.length) - drawHeight[zone.position || 'full'] / 2\n ),\n /* w */ drawWidth[zone.position || 'full'],\n /* h */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n ((zone.endBufferLine - zone.startBufferLine) / this._bufferService.buffers.active.lines.length) + drawHeight[zone.position || 'full']\n )\n );\n }\n\n private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {\n this._shouldUpdateDimensions = updateCanvasDimensions || this._shouldUpdateDimensions;\n this._shouldUpdateAnchor = updateAnchor || this._shouldUpdateAnchor;\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {\n this._refreshDecorations();\n this._animationFrame = undefined;\n });\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderService } from 'browser/services/Services';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { C0 } from 'common/data/EscapeSequences';\n\ninterface IPosition {\n start: number;\n end: number;\n}\n\n/**\n * Encapsulates the logic for handling compositionstart, compositionupdate and compositionend\n * events, displaying the in-progress composition to the UI and forwarding the final composition\n * to the handler.\n */\nexport class CompositionHelper {\n /**\n * Whether input composition is currently happening, eg. via a mobile keyboard, speech input or\n * IME. This variable determines whether the compositionText should be displayed on the UI.\n */\n private _isComposing: boolean;\n public get isComposing(): boolean { return this._isComposing; }\n\n /**\n * The position within the input textarea's value of the current composition.\n */\n private _compositionPosition: IPosition;\n\n /**\n * Whether a composition is in the process of being sent, setting this to false will cancel any\n * in-progress composition.\n */\n private _isSendingComposition: boolean;\n\n /**\n * Data already sent due to keydown event.\n */\n private _dataAlreadySent: string;\n\n constructor(\n private readonly _textarea: HTMLTextAreaElement,\n private readonly _compositionView: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreService private readonly _coreService: ICoreService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n this._isComposing = false;\n this._isSendingComposition = false;\n this._compositionPosition = { start: 0, end: 0 };\n this._dataAlreadySent = '';\n }\n\n /**\n * Handles the compositionstart event, activating the composition view.\n */\n public compositionstart(): void {\n this._isComposing = true;\n this._compositionPosition.start = this._textarea.value.length;\n this._compositionView.textContent = '';\n this._dataAlreadySent = '';\n this._compositionView.classList.add('active');\n }\n\n /**\n * Handles the compositionupdate event, updating the composition view.\n * @param ev The event.\n */\n public compositionupdate(ev: Pick): void {\n this._compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(() => {\n this._compositionPosition.end = this._textarea.value.length;\n }, 0);\n }\n\n /**\n * Handles the compositionend event, hiding the composition view and sending the composition to\n * the handler.\n */\n public compositionend(): void {\n this._finalizeComposition(true);\n }\n\n /**\n * Handles the keydown event, routing any necessary events to the CompositionHelper functions.\n * @param ev The keydown event.\n * @returns Whether the Terminal should continue processing the keydown event.\n */\n public keydown(ev: KeyboardEvent): boolean {\n if (this._isComposing || this._isSendingComposition) {\n if (ev.keyCode === 229) {\n // Continue composing if the keyCode is the \"composition character\"\n return false;\n }\n if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n // Continue composing if the keyCode is a modifier key\n return false;\n }\n // Finish composition immediately. This is mainly here for the case where enter is\n // pressed and the handler needs to be triggered before the command is executed.\n this._finalizeComposition(false);\n }\n\n if (ev.keyCode === 229) {\n // If the \"composition character\" is used but gets to this point it means a non-composition\n // character (eg. numbers and punctuation) was pressed when the IME was active.\n this._handleAnyTextareaChanges();\n return false;\n }\n\n return true;\n }\n\n /**\n * Finalizes the composition, resuming regular input actions. This is called when a composition\n * is ending.\n * @param waitForPropagation Whether to wait for events to propagate before sending\n * the input. This should be false if a non-composition keystroke is entered before the\n * compositionend event is triggered, such as enter, so that the composition is sent before\n * the command is executed.\n */\n private _finalizeComposition(waitForPropagation: boolean): void {\n this._compositionView.classList.remove('active');\n this._isComposing = false;\n\n if (!waitForPropagation) {\n // Cancel any delayed composition send requests and send the input immediately.\n this._isSendingComposition = false;\n const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);\n this._coreService.triggerDataEvent(input, true);\n } else {\n // Make a deep copy of the composition position here as a new compositionstart event may\n // fire before the setTimeout executes.\n const currentCompositionPosition = {\n start: this._compositionPosition.start,\n end: this._compositionPosition.end\n };\n\n // Since composition* events happen before the changes take place in the textarea on most\n // browsers, use a setTimeout with 0ms time to allow the native compositionend event to\n // complete. This ensures the correct character is retrieved.\n // This solution was used because:\n // - The compositionend event's data property is unreliable, at least on Chromium\n // - The last compositionupdate event's data property does not always accurately describe\n // the character, a counter example being Korean where an ending consonsant can move to\n // the following character if the following input is a vowel.\n this._isSendingComposition = true;\n setTimeout(() => {\n // Ensure that the input has not already been sent\n if (this._isSendingComposition) {\n this._isSendingComposition = false;\n let input;\n // Add length of data already sent due to keydown event,\n // otherwise input characters can be duplicated. (Issue #3191)\n currentCompositionPosition.start += this._dataAlreadySent.length;\n if (this._isComposing) {\n // Use the start position of the new composition to get the string\n // if a new composition has started.\n input = this._textarea.value.substring(currentCompositionPosition.start, this._compositionPosition.start);\n } else {\n // Don't use the end position here in order to pick up any characters after the\n // composition has finished, for example when typing a non-composition character\n // (eg. 2) after a composition character.\n input = this._textarea.value.substring(currentCompositionPosition.start);\n }\n if (input.length > 0) {\n this._coreService.triggerDataEvent(input, true);\n }\n }\n }, 0);\n }\n }\n\n /**\n * Apply any changes made to the textarea after the current event chain is allowed to complete.\n * This should be called when not currently composing but a keydown event with the \"composition\n * character\" (229) is triggered, in order to allow non-composition text to be entered when an\n * IME is active.\n */\n private _handleAnyTextareaChanges(): void {\n const oldValue = this._textarea.value;\n setTimeout(() => {\n // Ignore if a composition has started since the timeout\n if (!this._isComposing) {\n const newValue = this._textarea.value;\n\n const diff = newValue.replace(oldValue, '');\n\n this._dataAlreadySent = diff;\n\n if (newValue.length > oldValue.length) {\n this._coreService.triggerDataEvent(diff, true);\n } else if (newValue.length < oldValue.length) {\n this._coreService.triggerDataEvent(`${C0.DEL}`, true);\n } else if ((newValue.length === oldValue.length) && (newValue !== oldValue)) {\n this._coreService.triggerDataEvent(newValue, true);\n }\n\n }\n }, 0);\n }\n\n /**\n * Positions the composition view on top of the cursor and the textarea just below it (so the\n * IME helper dialog is positioned correctly).\n * @param dontRecurse Whether to use setTimeout to recursively trigger another update, this is\n * necessary as the IME events across browsers are not consistently triggered.\n */\n public updateCompositionElements(dontRecurse?: boolean): void {\n if (!this._isComposing) {\n return;\n }\n\n if (this._bufferService.buffer.isCursorInViewport) {\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const cursorTop = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n this._compositionView.style.left = cursorLeft + 'px';\n this._compositionView.style.top = cursorTop + 'px';\n this._compositionView.style.height = cellHeight + 'px';\n this._compositionView.style.lineHeight = cellHeight + 'px';\n this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + 'px';\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n const compositionViewBounds = this._compositionView.getBoundingClientRect();\n this._textarea.style.left = cursorLeft + 'px';\n this._textarea.style.top = cursorTop + 'px';\n // Ensure the text area is at least 1x1, otherwise certain IMEs may break\n this._textarea.style.width = Math.max(compositionViewBounds.width, 1) + 'px';\n this._textarea.style.height = Math.max(compositionViewBounds.height, 1) + 'px';\n this._textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n\n if (!dontRecurse) {\n setTimeout(() => this.updateCompositionElements(true), 0);\n }\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function getCoordsRelativeToElement(window: Pick, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {\n const rect = element.getBoundingClientRect();\n const elementStyle = window.getComputedStyle(element);\n const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'));\n const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'));\n return [\n event.clientX - rect.left - leftPadding,\n event.clientY - rect.top - topPadding\n ];\n}\n\n/**\n * Gets coordinates within the terminal for a particular mouse event. The result\n * is returned as an array in the form [x, y] instead of an object as it's a\n * little faster and this function is used in some low level code.\n * @param window The window object the element belongs to.\n * @param event The mouse event.\n * @param element The terminal's container element.\n * @param colCount The number of columns in the terminal.\n * @param rowCount The number of rows n the terminal.\n * @param hasValidCharSize Whether there is a valid character size available.\n * @param cssCellWidth The cell width device pixel render dimensions.\n * @param cssCellHeight The cell height device pixel render dimensions.\n * @param isSelection Whether the request is for the selection or not. This will\n * apply an offset to the x value such that the left half of the cell will\n * select that cell and the right half will select the next cell.\n */\nexport function getCoords(window: Pick, event: Pick, element: HTMLElement, colCount: number, rowCount: number, hasValidCharSize: boolean, cssCellWidth: number, cssCellHeight: number, isSelection?: boolean): [number, number] | undefined {\n // Coordinates cannot be measured if there are no valid\n if (!hasValidCharSize) {\n return undefined;\n }\n\n const coords = getCoordsRelativeToElement(window, event, element);\n if (!coords) {\n return undefined;\n }\n\n coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);\n coords[1] = Math.ceil(coords[1] / cssCellHeight);\n\n // Ensure coordinates are within the terminal viewport. Note that selections\n // need an addition point of precision to cover the end point (as characters\n // cover half of one char and half of the next).\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0));\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount);\n\n return coords;\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { C0 } from 'common/data/EscapeSequences';\nimport { IBufferService } from 'common/services/Services';\n\nconst enum Direction {\n UP = 'A',\n DOWN = 'B',\n RIGHT = 'C',\n LEFT = 'D'\n}\n\n/**\n * Concatenates all the arrow sequences together.\n * Resets the starting row to an unwrapped row, moves to the requested row,\n * then moves to requested col.\n */\nexport function moveToCellSequence(targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startX = bufferService.buffer.x;\n const startY = bufferService.buffer.y;\n\n // The alt buffer should try to navigate between rows\n if (!bufferService.buffer.hasScrollback) {\n return resetStartingRow(startX, startY, targetX, targetY, bufferService, applicationCursor) +\n moveToRequestedRow(startY, targetY, bufferService, applicationCursor) +\n moveToRequestedCol(startX, startY, targetX, targetY, bufferService, applicationCursor);\n }\n\n // Only move horizontally for the normal buffer\n let direction;\n if (startY === targetY) {\n direction = startX > targetX ? Direction.LEFT : Direction.RIGHT;\n return repeat(Math.abs(startX - targetX), sequence(direction, applicationCursor));\n }\n direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;\n const rowDifference = Math.abs(startY - targetY);\n const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +\n (rowDifference - 1) * bufferService.cols + 1 /* wrap around 1 row */ +\n colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);\n return repeat(cellsToMove, sequence(direction, applicationCursor));\n}\n\n/**\n * Find the number of cols from a row beginning to a col.\n */\nfunction colsFromRowBeginning(currX: number, bufferService: IBufferService): number {\n return currX - 1;\n}\n\n/**\n * Find the number of cols from a col to row end.\n */\nfunction colsFromRowEnd(currX: number, bufferService: IBufferService): number {\n return bufferService.cols - currX;\n}\n\n/**\n * If the initial position of the cursor is on a row that is wrapped, move the\n * cursor up to the first row that is not wrapped to have accurate vertical\n * positioning.\n */\nfunction resetStartingRow(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length === 0) {\n return '';\n }\n return repeat(bufferLine(\n startX, startY, startX,\n startY - wrappedRowsForRow(startY, bufferService), false, bufferService\n ).length, sequence(Direction.LEFT, applicationCursor));\n}\n\n/**\n * Using the reset starting and ending row, move to the requested row,\n * ignoring wrapped rows\n */\nfunction moveToRequestedRow(startY: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n const rowsToMove = Math.abs(startRow - endRow) - wrappedRowsCount(startY, targetY, bufferService);\n\n return repeat(rowsToMove, sequence(verticalDirection(startY, targetY), applicationCursor));\n}\n\n/**\n * Move to the requested col on the ending row\n */\nfunction moveToRequestedCol(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n let startRow;\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n const endRow = targetY;\n const direction = horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor);\n\n return repeat(bufferLine(\n startX, startRow, targetX, endRow,\n direction === Direction.RIGHT, bufferService\n ).length, sequence(direction, applicationCursor));\n}\n\n/**\n * Utility functions\n */\n\n/**\n * Calculates the number of wrapped rows between the unwrapped starting and\n * ending rows. These rows need to ignored since the cursor skips over them.\n */\nfunction wrappedRowsCount(startY: number, targetY: number, bufferService: IBufferService): number {\n let wrappedRows = 0;\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n for (let i = 0; i < Math.abs(startRow - endRow); i++) {\n const direction = verticalDirection(startY, targetY) === Direction.UP ? -1 : 1;\n const line = bufferService.buffer.lines.get(startRow + (direction * i));\n if (line?.isWrapped) {\n wrappedRows++;\n }\n }\n\n return wrappedRows;\n}\n\n/**\n * Calculates the number of wrapped rows that make up a given row.\n * @param currentRow The row to determine how many wrapped rows make it up\n */\nfunction wrappedRowsForRow(currentRow: number, bufferService: IBufferService): number {\n let rowCount = 0;\n let line = bufferService.buffer.lines.get(currentRow);\n let lineWraps = line?.isWrapped;\n\n while (lineWraps && currentRow >= 0 && currentRow < bufferService.rows) {\n rowCount++;\n line = bufferService.buffer.lines.get(--currentRow);\n lineWraps = line?.isWrapped;\n }\n\n return rowCount;\n}\n\n/**\n * Direction determiners\n */\n\n/**\n * Determines if the right or left arrow is needed\n */\nfunction horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {\n let startRow;\n if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n if ((startX < targetX &&\n startRow <= targetY) || // down/right or same y/right\n (startX >= targetX &&\n startRow < targetY)) { // down/left or same y/left\n return Direction.RIGHT;\n }\n return Direction.LEFT;\n}\n\n/**\n * Determines if the up or down arrow is needed\n */\nfunction verticalDirection(startY: number, targetY: number): Direction {\n return startY > targetY ? Direction.UP : Direction.DOWN;\n}\n\n/**\n * Constructs the string of chars in the buffer from a starting row and col\n * to an ending row and col\n * @param startCol The starting column position\n * @param startRow The starting row position\n * @param endCol The ending column position\n * @param endRow The ending row position\n * @param forward Direction to move\n */\nfunction bufferLine(\n startCol: number,\n startRow: number,\n endCol: number,\n endRow: number,\n forward: boolean,\n bufferService: IBufferService\n): string {\n let currentCol = startCol;\n let currentRow = startRow;\n let bufferStr = '';\n\n while (currentCol !== endCol || currentRow !== endRow) {\n currentCol += forward ? 1 : -1;\n\n if (forward && currentCol > bufferService.cols - 1) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n currentCol = 0;\n startCol = 0;\n currentRow++;\n } else if (!forward && currentCol < 0) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, 0, startCol + 1\n );\n currentCol = bufferService.cols - 1;\n startCol = currentCol;\n currentRow--;\n }\n }\n\n return bufferStr + bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n}\n\n/**\n * Constructs the escape sequence for clicking an arrow\n * @param direction The direction to move\n */\nfunction sequence(direction: Direction, applicationCursor: boolean): string {\n const mod = applicationCursor ? 'O' : '[';\n return C0.ESC + mod + direction;\n}\n\n/**\n * Returns a string repeated a given number of times\n * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n * @param count The number of times to repeat the string\n * @param str The string that is to be repeated\n */\nfunction repeat(count: number, str: string): string {\n count = Math.floor(count);\n let rpt = '';\n for (let i = 0; i < count; i++) {\n rpt += str;\n }\n return rpt;\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { DomRendererRowFactory, RowCss } from 'browser/renderer/dom/DomRendererRowFactory';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';\nimport { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';\nimport { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';\nimport { color } from 'common/Color';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\n\nconst TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';\nconst ROW_CONTAINER_CLASS = 'xterm-rows';\nconst FG_CLASS_PREFIX = 'xterm-fg-';\nconst BG_CLASS_PREFIX = 'xterm-bg-';\nconst FOCUS_CLASS = 'xterm-focus';\nconst SELECTION_CLASS = 'xterm-selection';\n\nlet nextTerminalId = 1;\n\n/**\n * The standard renderer and fallback for when the webgl addon is slow. This is not meant to be\n * particularly fast and will even lack some features such as custom glyphs, hoever this is more\n * reliable as webgl may not work on some machines.\n */\nexport class DomRenderer extends Disposable implements IRenderer {\n private _rowFactory: DomRendererRowFactory;\n private _terminalClass: number = nextTerminalId++;\n\n private _themeStyleElement!: HTMLStyleElement;\n private _dimensionsStyleElement!: HTMLStyleElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[] = [];\n private _selectionContainer: HTMLElement;\n private _widthCache: WidthCache;\n private _selectionRenderModel: ISelectionRenderModel = createSelectionRenderModel();\n\n public dimensions: IRenderDimensions;\n\n public readonly onRequestRedraw = this._register(new Emitter()).event;\n\n constructor(\n private readonly _terminal: ITerminal,\n private readonly _document: Document,\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _viewportElement: HTMLElement,\n private readonly _helperContainer: HTMLElement,\n private readonly _linkifier2: ILinkifier2,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService private readonly _themeService: IThemeService\n ) {\n super();\n this._rowContainer = this._document.createElement('div');\n this._rowContainer.classList.add(ROW_CONTAINER_CLASS);\n this._rowContainer.style.lineHeight = 'normal';\n this._rowContainer.setAttribute('aria-hidden', 'true');\n this._refreshRowElements(this._bufferService.cols, this._bufferService.rows);\n this._selectionContainer = this._document.createElement('div');\n this._selectionContainer.classList.add(SELECTION_CLASS);\n this._selectionContainer.setAttribute('aria-hidden', 'true');\n\n this.dimensions = createRenderDimensions();\n this._updateDimensions();\n this._register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));\n\n this._register(this._themeService.onChangeColors(e => this._injectCss(e)));\n this._injectCss(this._themeService.colors);\n\n this._rowFactory = instantiationService.createInstance(DomRendererRowFactory, document);\n\n this._element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);\n this._screenElement.appendChild(this._rowContainer);\n this._screenElement.appendChild(this._selectionContainer);\n\n this._register(this._linkifier2.onShowLinkUnderline(e => this._handleLinkHover(e)));\n this._register(this._linkifier2.onHideLinkUnderline(e => this._handleLinkLeave(e)));\n\n this._register(toDisposable(() => {\n this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);\n\n // Outside influences such as React unmounts may manipulate the DOM before our disposal.\n // https://github.com/xtermjs/xterm.js/issues/2960\n this._rowContainer.remove();\n this._selectionContainer.remove();\n this._widthCache.dispose();\n this._themeStyleElement.remove();\n this._dimensionsStyleElement.remove();\n }));\n\n this._widthCache = new WidthCache(this._document, this._helperContainer);\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n private _updateDimensions(): void {\n const dpr = this._coreBrowserService.dpr;\n this.dimensions.device.char.width = this._charSizeService.width * dpr;\n this.dimensions.device.char.height = Math.ceil(this._charSizeService.height * dpr);\n this.dimensions.device.cell.width = this.dimensions.device.char.width + Math.round(this._optionsService.rawOptions.letterSpacing);\n this.dimensions.device.cell.height = Math.floor(this.dimensions.device.char.height * this._optionsService.rawOptions.lineHeight);\n this.dimensions.device.char.left = 0;\n this.dimensions.device.char.top = 0;\n this.dimensions.device.canvas.width = this.dimensions.device.cell.width * this._bufferService.cols;\n this.dimensions.device.canvas.height = this.dimensions.device.cell.height * this._bufferService.rows;\n this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / dpr);\n this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / dpr);\n this.dimensions.css.cell.width = this.dimensions.css.canvas.width / this._bufferService.cols;\n this.dimensions.css.cell.height = this.dimensions.css.canvas.height / this._bufferService.rows;\n\n for (const element of this._rowElements) {\n element.style.width = `${this.dimensions.css.canvas.width}px`;\n element.style.height = `${this.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this.dimensions.css.cell.height}px`;\n // Make sure rows don't overflow onto following row\n element.style.overflow = 'hidden';\n }\n\n if (!this._dimensionsStyleElement) {\n this._dimensionsStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._dimensionsStyleElement);\n }\n\n const styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} span {` +\n ` display: inline-block;` + // TODO: find workaround for inline-block (creates ~20% render penalty)\n ` height: 100%;` +\n ` vertical-align: top;` +\n `}`;\n\n this._dimensionsStyleElement.textContent = styles;\n\n this._selectionContainer.style.height = this._viewportElement.style.height;\n this._screenElement.style.width = `${this.dimensions.css.canvas.width}px`;\n this._screenElement.style.height = `${this.dimensions.css.canvas.height}px`;\n }\n\n private _injectCss(colors: ReadonlyColorSet): void {\n if (!this._themeStyleElement) {\n this._themeStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._themeStyleElement);\n }\n\n // Base CSS\n let styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +\n ` color: ${colors.foreground.css};` +\n ` font-family: ${this._optionsService.rawOptions.fontFamily};` +\n ` font-size: ${this._optionsService.rawOptions.fontSize}px;` +\n ` font-kerning: none;` +\n ` white-space: pre` +\n `}`;\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .xterm-dim {` +\n ` color: ${color.multiplyOpacity(colors.foreground, 0.5).css};` +\n `}`;\n // Text styles\n styles +=\n `${this._terminalSelector} span:not(.${RowCss.BOLD_CLASS}) {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeight};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.BOLD_CLASS} {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeightBold};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.ITALIC_CLASS} {` +\n ` font-style: italic;` +\n `}`;\n // Blink animation\n const blinkAnimationUnderlineId = `blink_underline_${this._terminalClass}`;\n const blinkAnimationBarId = `blink_bar_${this._terminalClass}`;\n const blinkAnimationBlockId = `blink_block_${this._terminalClass}`;\n styles +=\n `@keyframes ${blinkAnimationUnderlineId} {` +\n ` 50% {` +\n ` border-bottom-style: hidden;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBarId} {` +\n ` 50% {` +\n ` box-shadow: none;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBlockId} {` +\n ` 0% {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n ` }` +\n ` 50% {` +\n ` background-color: inherit;` +\n ` color: ${colors.cursor.css};` +\n ` }` +\n `}`;\n // Cursor\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` animation: ${blinkAnimationUnderlineId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` animation: ${blinkAnimationBarId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` animation: ${blinkAnimationBlockId} 1s step-end infinite;` +\n `}` +\n // !important helps fix an issue where the cursor will not render on top of the selection,\n // however it's very hard to fix this issue and retain the blink animation without the use of\n // !important. So this edge case fails when cursor blink is on.\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS}:not(.${RowCss.CURSOR_BLINK_CLASS}) {` +\n ` background-color: ${colors.cursor.css} !important;` +\n ` color: ${colors.cursorAccent.css} !important;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_OUTLINE_CLASS} {` +\n ` outline: 1px solid ${colors.cursor.css};` +\n ` outline-offset: -1px;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${colors.cursor.css} inset;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` border-bottom: 1px ${colors.cursor.css};` +\n ` border-bottom-style: solid;` +\n ` height: calc(100% - 1px);` +\n `}`;\n // Selection\n styles +=\n `${this._terminalSelector} .${SELECTION_CLASS} {` +\n ` position: absolute;` +\n ` top: 0;` +\n ` left: 0;` +\n ` z-index: 1;` +\n ` pointer-events: none;` +\n `}` +\n `${this._terminalSelector}.focus .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionBackgroundOpaque.css};` +\n `}` +\n `${this._terminalSelector} .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionInactiveBackgroundOpaque.css};` +\n `}`;\n // Colors\n for (const [i, c] of colors.ansi.entries()) {\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i} { color: ${c.css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(c, 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${i} { background-color: ${c.css}; }`;\n }\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { color: ${color.opaque(colors.background).css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(color.opaque(colors.background), 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { background-color: ${colors.foreground.css}; }`;\n\n this._themeStyleElement.textContent = styles;\n }\n\n /**\n * default letter spacing\n * Due to rounding issues in dimensions dpr calc glyph might render\n * slightly too wide or too narrow. The method corrects the stacking offsets\n * by applying a default letter-spacing for all chars.\n * The value gets passed to the row factory to avoid setting this value again\n * (render speedup is roughly 10%).\n */\n private _setDefaultSpacing(): void {\n // measure same char as in CharSizeService to get the base deviation\n const spacing = this.dimensions.css.cell.width - this._widthCache.get('W', false, false);\n this._rowContainer.style.letterSpacing = `${spacing}px`;\n this._rowFactory.defaultSpacing = spacing;\n }\n\n public handleDevicePixelRatioChange(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n private _refreshRowElements(cols: number, rows: number): void {\n // Add missing elements\n for (let i = this._rowElements.length; i <= rows; i++) {\n const row = this._document.createElement('div');\n this._rowContainer.appendChild(row);\n this._rowElements.push(row);\n }\n // Remove excess elements\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n }\n\n public handleResize(cols: number, rows: number): void {\n this._refreshRowElements(cols, rows);\n this._updateDimensions();\n this.handleSelectionChanged(this._selectionRenderModel.selectionStart, this._selectionRenderModel.selectionEnd, this._selectionRenderModel.columnSelectMode);\n }\n\n public handleCharSizeChanged(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n public handleBlur(): void {\n this._rowContainer.classList.remove(FOCUS_CLASS);\n this.renderRows(0, this._bufferService.rows - 1);\n }\n\n public handleFocus(): void {\n this._rowContainer.classList.add(FOCUS_CLASS);\n this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y);\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n // Remove all selections\n this._selectionContainer.replaceChildren();\n this._rowFactory.handleSelectionChanged(start, end, columnSelectMode);\n this.renderRows(0, this._bufferService.rows - 1);\n\n // Selection does not exist\n if (!start || !end) {\n return;\n }\n\n this._selectionRenderModel.update(this._terminal, start, end, columnSelectMode);\n if (!this._selectionRenderModel.hasSelection) {\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportStartRow = this._selectionRenderModel.viewportStartRow;\n const viewportEndRow = this._selectionRenderModel.viewportEndRow;\n const viewportCappedStartRow = this._selectionRenderModel.viewportCappedStartRow;\n const viewportCappedEndRow = this._selectionRenderModel.viewportCappedEndRow;\n\n // Create the selections\n const documentFragment = this._document.createDocumentFragment();\n\n if (columnSelectMode) {\n const isXFlipped = start[0] > end[0];\n documentFragment.appendChild(\n this._createSelectionElement(viewportCappedStartRow, isXFlipped ? end[0] : start[0], isXFlipped ? start[0] : end[0], viewportCappedEndRow - viewportCappedStartRow + 1)\n );\n } else {\n // Draw first row\n const startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n const endCol = viewportCappedStartRow === viewportEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n // Draw middle rows\n const middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount));\n // Draw final row\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n // Only draw viewportEndRow if it's not the same as viewporttartRow\n const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol));\n }\n }\n this._selectionContainer.appendChild(documentFragment);\n }\n\n /**\n * Creates a selection element at the specified position.\n * @param row The row of the selection.\n * @param colStart The start column.\n * @param colEnd The end columns.\n */\n private _createSelectionElement(row: number, colStart: number, colEnd: number, rowCount: number = 1): HTMLElement {\n const element = this._document.createElement('div');\n const left = colStart * this.dimensions.css.cell.width;\n let width = this.dimensions.css.cell.width * (colEnd - colStart);\n if (left + width > this.dimensions.css.canvas.width) {\n width = this.dimensions.css.canvas.width - left;\n }\n\n element.style.height = `${rowCount * this.dimensions.css.cell.height}px`;\n element.style.top = `${row * this.dimensions.css.cell.height}px`;\n element.style.left = `${left}px`;\n element.style.width = `${width}px`;\n return element;\n }\n\n public handleCursorMove(): void {\n // No-op, the cursor is drawn when rows are drawn\n }\n\n private _handleOptionsChanged(): void {\n // Force a refresh\n this._updateDimensions();\n // Refresh CSS\n this._injectCss(this._themeService.colors);\n // update spacing cache\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n public clear(): void {\n for (const e of this._rowElements) {\n /**\n * NOTE: This used to be `e.innerText = '';` but that doesn't work when using `jsdom` and\n * `@testing-library/react`\n *\n * references:\n * - https://github.com/testing-library/react-testing-library/issues/1146\n * - https://github.com/jsdom/jsdom/issues/1245\n */\n e.replaceChildren();\n }\n }\n\n public renderRows(start: number, end: number): void {\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, this._bufferService.cols - 1);\n const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n for (let y = start; y <= end; y++) {\n const row = y + buffer.ydisp;\n const rowElement = this._rowElements[y];\n const lineData = buffer.lines.get(row);\n if (!rowElement || !lineData) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n lineData,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n -1,\n -1\n )\n );\n }\n }\n\n private get _terminalSelector(): string {\n return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`;\n }\n\n private _handleLinkHover(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true);\n }\n\n private _handleLinkLeave(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, false);\n }\n\n private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {\n /**\n * NOTE: The linkifier may send out of viewport y-values if:\n * - negative y-value: the link started at a higher line\n * - y-value >= maxY: the link ends at a line below viewport\n *\n * For negative y-values we can simply adjust x = 0,\n * as higher up link start means, that everything from\n * (0,0) is a link under top-down-left-right char progression\n *\n * Additionally there might be a small chance of out-of-sync x|y-values\n * from a race condition of render updates vs. link event handler execution:\n * - (sync) resize: chances terminal buffer in sync, schedules render update async\n * - (async) link handler race condition: new buffer metrics, but still on old render state\n * - (async) render update: brings term metrics and render state back in sync\n */\n // clip coords into viewport\n if (y < 0) x = 0;\n if (y2 < 0) x2 = 0;\n const maxY = this._bufferService.rows - 1;\n y = Math.max(Math.min(y, maxY), 0);\n y2 = Math.max(Math.min(y2, maxY), 0);\n\n cols = Math.min(cols, this._bufferService.cols);\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, cols - 1);\n const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n // refresh rows within link range\n for (let i = y; i <= y2; ++i) {\n const row = i + buffer.ydisp;\n const rowElement = this._rowElements[i];\n const bufferline = buffer.lines.get(row);\n if (!rowElement || !bufferline) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n bufferline,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n enabled ? (i === y ? x : 0) : -1,\n enabled ? ((i === y2 ? x2 : cols) - 1) : -1\n )\n );\n }\n }\n}\n","/**\n * Copyright (c) 2018, 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, IColor } from 'common/Types';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { channels, color } from 'common/Color';\nimport { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { JoinedCellData } from 'browser/services/CharacterJoinerService';\nimport { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { IColorContrastCache } from 'browser/Types';\n\n\nexport const enum RowCss {\n BOLD_CLASS = 'xterm-bold',\n DIM_CLASS = 'xterm-dim',\n ITALIC_CLASS = 'xterm-italic',\n UNDERLINE_CLASS = 'xterm-underline',\n OVERLINE_CLASS = 'xterm-overline',\n STRIKETHROUGH_CLASS = 'xterm-strikethrough',\n CURSOR_CLASS = 'xterm-cursor',\n CURSOR_BLINK_CLASS = 'xterm-cursor-blink',\n CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block',\n CURSOR_STYLE_OUTLINE_CLASS = 'xterm-cursor-outline',\n CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar',\n CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline'\n}\n\n\nexport class DomRendererRowFactory {\n private _workCell: CellData = new CellData();\n\n private _selectionStart: [number, number] | undefined;\n private _selectionEnd: [number, number] | undefined;\n private _columnSelectMode: boolean = false;\n\n public defaultSpacing = 0;\n\n constructor(\n private readonly _document: Document,\n @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @ICoreService private readonly _coreService: ICoreService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IThemeService private readonly _themeService: IThemeService\n ) {}\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionStart = start;\n this._selectionEnd = end;\n this._columnSelectMode = columnSelectMode;\n }\n\n public createRow(\n lineData: IBufferLine,\n row: number,\n isCursorRow: boolean,\n cursorStyle: string | undefined,\n cursorInactiveStyle: string | undefined,\n cursorX: number,\n cursorBlink: boolean,\n cellWidth: number,\n widthCache: WidthCache,\n linkStart: number,\n linkEnd: number\n ): HTMLSpanElement[] {\n\n const elements: HTMLSpanElement[] = [];\n const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);\n const colors = this._themeService.colors;\n\n let lineLength = lineData.getNoBgTrimmedLength();\n if (isCursorRow && lineLength < cursorX + 1) {\n lineLength = cursorX + 1;\n }\n\n let charElement: HTMLSpanElement | undefined;\n let cellAmount = 0;\n let text = '';\n let oldBg = 0;\n let oldFg = 0;\n let oldExt = 0;\n let oldLinkHover: number | boolean = false;\n let oldSpacing = 0;\n let oldIsInSelection: boolean = false;\n let spacing = 0;\n const classes: string[] = [];\n\n const hasHover = linkStart !== -1 && linkEnd !== -1;\n\n for (let x = 0; x < lineLength; x++) {\n lineData.loadCell(x, this._workCell);\n let width = this._workCell.getWidth();\n\n // The character to the left is a wide character, drawing is owned by the char at x-1\n if (width === 0) {\n continue;\n }\n\n // If true, indicates that the current character(s) to draw were joined.\n let isJoined = false;\n let lastCharX = x;\n\n // Process any joined character ranges as needed. Because of how the\n // ranges are produced, we know that they are valid for the characters\n // and attributes of our input.\n let cell = this._workCell;\n if (joinedRanges.length > 0 && x === joinedRanges[0][0]) {\n isJoined = true;\n const range = joinedRanges.shift()!;\n\n // We already know the exact start and end column of the joined range,\n // so we get the string and width representing it directly\n cell = new JoinedCellData(\n this._workCell,\n lineData.translateToString(true, range[0], range[1]),\n range[1] - range[0]\n );\n\n // Skip over the cells occupied by this range in the loop\n lastCharX = range[1] - 1;\n\n // Recalculate width\n width = cell.getWidth();\n }\n\n const isInSelection = this._isCellInSelection(x, row);\n const isCursorCell = isCursorRow && x === cursorX;\n const isLinkHover = hasHover && x >= linkStart && x <= linkEnd;\n\n let isDecorated = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n isDecorated = true;\n });\n\n // get chars to render for this cell\n let chars = cell.getChars() || WHITESPACE_CELL_CHAR;\n if (chars === ' ' && (cell.isUnderline() || cell.isOverline())) {\n chars = '\\xa0';\n }\n\n // lookup char render width and calc spacing\n spacing = width * cellWidth - widthCache.get(chars, cell.isBold(), cell.isItalic());\n\n if (!charElement) {\n charElement = this._document.createElement('span');\n } else {\n /**\n * chars can only be merged on existing span if:\n * - existing span only contains mergeable chars (cellAmount != 0)\n * - bg did not change (or both are in selection)\n * - fg did not change (or both are in selection and selection fg is set)\n * - ext did not change\n * - underline from hover state did not change\n * - cell content renders to same letter-spacing\n * - cell is not cursor\n */\n if (\n cellAmount\n && (\n (isInSelection && oldIsInSelection)\n || (!isInSelection && !oldIsInSelection && cell.bg === oldBg)\n )\n && (\n (isInSelection && oldIsInSelection && colors.selectionForeground)\n || cell.fg === oldFg\n )\n && cell.extended.ext === oldExt\n && isLinkHover === oldLinkHover\n && spacing === oldSpacing\n && !isCursorCell\n && !isJoined\n && !isDecorated\n ) {\n // no span alterations, thus only account chars skipping all code below\n if (cell.isInvisible()) {\n text += WHITESPACE_CELL_CHAR;\n } else {\n text += chars;\n }\n cellAmount++;\n continue;\n } else {\n /**\n * cannot merge:\n * - apply left-over text to old span\n * - create new span, reset state holders cellAmount & text\n */\n if (cellAmount) {\n charElement.textContent = text;\n }\n charElement = this._document.createElement('span');\n cellAmount = 0;\n text = '';\n }\n }\n // preserve conditions for next merger eval round\n oldBg = cell.bg;\n oldFg = cell.fg;\n oldExt = cell.extended.ext;\n oldLinkHover = isLinkHover;\n oldSpacing = spacing;\n oldIsInSelection = isInSelection;\n\n if (isJoined) {\n // The DOM renderer colors the background of the cursor but for ligatures all cells are\n // joined. The workaround here is to show a cursor around the whole ligature so it shows up,\n // the cursor looks the same when on any character of the ligature though\n if (cursorX >= x && cursorX <= lastCharX) {\n cursorX = x;\n }\n }\n\n if (!this._coreService.isCursorHidden && isCursorCell && this._coreService.isCursorInitialized) {\n classes.push(RowCss.CURSOR_CLASS);\n if (this._coreBrowserService.isFocused) {\n if (cursorBlink) {\n classes.push(RowCss.CURSOR_BLINK_CLASS);\n }\n classes.push(\n cursorStyle === 'bar'\n ? RowCss.CURSOR_STYLE_BAR_CLASS\n : cursorStyle === 'underline'\n ? RowCss.CURSOR_STYLE_UNDERLINE_CLASS\n : RowCss.CURSOR_STYLE_BLOCK_CLASS\n );\n } else {\n if (cursorInactiveStyle) {\n switch (cursorInactiveStyle) {\n case 'outline':\n classes.push(RowCss.CURSOR_STYLE_OUTLINE_CLASS);\n break;\n case 'block':\n classes.push(RowCss.CURSOR_STYLE_BLOCK_CLASS);\n break;\n case 'bar':\n classes.push(RowCss.CURSOR_STYLE_BAR_CLASS);\n break;\n case 'underline':\n classes.push(RowCss.CURSOR_STYLE_UNDERLINE_CLASS);\n break;\n default:\n break;\n }\n }\n }\n }\n\n if (cell.isBold()) {\n classes.push(RowCss.BOLD_CLASS);\n }\n\n if (cell.isItalic()) {\n classes.push(RowCss.ITALIC_CLASS);\n }\n\n if (cell.isDim()) {\n classes.push(RowCss.DIM_CLASS);\n }\n\n if (cell.isInvisible()) {\n text = WHITESPACE_CELL_CHAR;\n } else {\n text = cell.getChars() || WHITESPACE_CELL_CHAR;\n }\n\n if (cell.isUnderline()) {\n classes.push(`${RowCss.UNDERLINE_CLASS}-${cell.extended.underlineStyle}`);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n if (!cell.isUnderlineColorDefault()) {\n if (cell.isUnderlineColorRGB()) {\n charElement.style.textDecorationColor = `rgb(${AttributeData.toColorRGB(cell.getUnderlineColor()).join(',')})`;\n } else {\n let fg = cell.getUnderlineColor();\n if (this._optionsService.rawOptions.drawBoldTextInBrightColors && cell.isBold() && fg < 8) {\n fg += 8;\n }\n charElement.style.textDecorationColor = colors.ansi[fg].css;\n }\n }\n }\n\n if (cell.isOverline()) {\n classes.push(RowCss.OVERLINE_CLASS);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n }\n\n if (cell.isStrikethrough()) {\n classes.push(RowCss.STRIKETHROUGH_CLASS);\n }\n\n // apply link hover underline late, effectively overrides any previous text-decoration\n // settings\n if (isLinkHover) {\n charElement.style.textDecoration = 'underline';\n }\n\n let fg = cell.getFgColor();\n let fgColorMode = cell.getFgColorMode();\n let bg = cell.getBgColor();\n let bgColorMode = cell.getBgColorMode();\n const isInverse = !!cell.isInverse();\n if (isInverse) {\n const temp = fg;\n fg = bg;\n bg = temp;\n const temp2 = fgColorMode;\n fgColorMode = bgColorMode;\n bgColorMode = temp2;\n }\n\n // Apply any decoration foreground/background overrides, this must happen after inverse has\n // been applied\n let bgOverride: IColor | undefined;\n let fgOverride: IColor | undefined;\n let isTop = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n if (d.options.layer !== 'top' && isTop) {\n return;\n }\n if (d.backgroundColorRGB) {\n bgColorMode = Attributes.CM_RGB;\n bg = d.backgroundColorRGB.rgba >> 8 & 0xFFFFFF;\n bgOverride = d.backgroundColorRGB;\n }\n if (d.foregroundColorRGB) {\n fgColorMode = Attributes.CM_RGB;\n fg = d.foregroundColorRGB.rgba >> 8 & 0xFFFFFF;\n fgOverride = d.foregroundColorRGB;\n }\n isTop = d.options.layer === 'top';\n });\n\n // Apply selection\n if (!isTop && isInSelection) {\n // If in the selection, force the element to be above the selection to improve contrast and\n // support opaque selections. The applies background is not actually needed here as\n // selection is drawn in a seperate container, the main purpose of this to ensuring minimum\n // contrast ratio\n bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque;\n bg = bgOverride.rgba >> 8 & 0xFFFFFF;\n bgColorMode = Attributes.CM_RGB;\n // Since an opaque selection is being rendered, the selection pretends to be a decoration to\n // ensure text is drawn above the selection.\n isTop = true;\n // Apply selection foreground if applicable\n if (colors.selectionForeground) {\n fgColorMode = Attributes.CM_RGB;\n fg = colors.selectionForeground.rgba >> 8 & 0xFFFFFF;\n fgOverride = colors.selectionForeground;\n }\n }\n\n // If it's a top decoration, render above the selection\n if (isTop) {\n classes.push('xterm-decoration-top');\n }\n\n // Background\n let resolvedBg: IColor;\n switch (bgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n resolvedBg = colors.ansi[bg];\n classes.push(`xterm-bg-${bg}`);\n break;\n case Attributes.CM_RGB:\n resolvedBg = channels.toColor(bg >> 16, bg >> 8 & 0xFF, bg & 0xFF);\n this._addStyle(charElement, `background-color:#${padStart((bg >>> 0).toString(16), '0', 6)}`);\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (isInverse) {\n resolvedBg = colors.foreground;\n classes.push(`xterm-bg-${INVERTED_DEFAULT_COLOR}`);\n } else {\n resolvedBg = colors.background;\n }\n }\n\n // If there is no background override by now it's the original color, so apply dim if needed\n if (!bgOverride) {\n if (cell.isDim()) {\n bgOverride = color.multiplyOpacity(resolvedBg, 0.5);\n }\n }\n\n // Foreground\n switch (fgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) {\n fg += 8;\n }\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.ansi[fg], cell, bgOverride, undefined)) {\n classes.push(`xterm-fg-${fg}`);\n }\n break;\n case Attributes.CM_RGB:\n const color = channels.toColor(\n (fg >> 16) & 0xFF,\n (fg >> 8) & 0xFF,\n (fg ) & 0xFF\n );\n if (!this._applyMinimumContrast(charElement, resolvedBg, color, cell, bgOverride, fgOverride)) {\n this._addStyle(charElement, `color:#${padStart(fg.toString(16), '0', 6)}`);\n }\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.foreground, cell, bgOverride, fgOverride)) {\n if (isInverse) {\n classes.push(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);\n }\n }\n }\n\n // apply CSS classes\n // slightly faster than using classList by omitting\n // checks for doubled entries (code above should not have doublets)\n if (classes.length) {\n charElement.className = classes.join(' ');\n classes.length = 0;\n }\n\n // exclude conditions for cell merging - never merge these\n if (!isCursorCell && !isJoined && !isDecorated) {\n cellAmount++;\n } else {\n charElement.textContent = text;\n }\n // apply letter-spacing rule\n if (spacing !== this.defaultSpacing) {\n charElement.style.letterSpacing = `${spacing}px`;\n }\n\n elements.push(charElement);\n x = lastCharX;\n }\n\n // postfix text of last merged span\n if (charElement && cellAmount) {\n charElement.textContent = text;\n }\n\n return elements;\n }\n\n private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor, cell: ICellData, bgOverride: IColor | undefined, fgOverride: IColor | undefined): boolean {\n if (this._optionsService.rawOptions.minimumContrastRatio === 1 || treatGlyphAsBackgroundColor(cell.getCode())) {\n return false;\n }\n\n // Try get from cache first, only use the cache when there are no decoration overrides\n const cache = this._getContrastCache(cell);\n let adjustedColor: IColor | undefined | null = undefined;\n if (!bgOverride && !fgOverride) {\n adjustedColor = cache.getColor(bg.rgba, fg.rgba);\n }\n\n // Calculate and store in cache\n if (adjustedColor === undefined) {\n // Dim cells only require half the contrast, otherwise they wouldn't be distinguishable from\n // non-dim cells\n const ratio = this._optionsService.rawOptions.minimumContrastRatio / (cell.isDim() ? 2 : 1);\n adjustedColor = color.ensureContrastRatio(bgOverride || bg, fgOverride || fg, ratio);\n cache.setColor((bgOverride || bg).rgba, (fgOverride || fg).rgba, adjustedColor ?? null);\n }\n\n if (adjustedColor) {\n this._addStyle(element, `color:${adjustedColor.css}`);\n return true;\n }\n\n return false;\n }\n\n private _getContrastCache(cell: ICellData): IColorContrastCache {\n if (cell.isDim()) {\n return this._themeService.colors.halfContrastCache;\n }\n return this._themeService.colors.contrastCache;\n }\n\n private _addStyle(element: HTMLElement, style: string): void {\n element.setAttribute('style', `${element.getAttribute('style') || ''}${style};`);\n }\n\n private _isCellInSelection(x: number, y: number): boolean {\n const start = this._selectionStart;\n const end = this._selectionEnd;\n if (!start || !end) {\n return false;\n }\n if (this._columnSelectMode) {\n if (start[0] <= end[0]) {\n return x >= start[0] && y >= start[1] &&\n x < end[0] && y <= end[1];\n }\n return x < start[0] && y >= start[1] &&\n x >= end[0] && y <= end[1];\n }\n return (y > start[1] && y < end[1]) ||\n (start[1] === end[1] && y === start[1] && x >= start[0] && x < end[0]) ||\n (start[1] < end[1] && y === end[1] && x < end[0]) ||\n (start[1] < end[1] && y === start[1] && x >= start[0]);\n }\n}\n\nfunction padStart(text: string, padChar: string, length: number): string {\n while (text.length < length) {\n text = padChar + text;\n }\n return text;\n}\n","/**\n * Copyright (c) 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { FontWeight } from 'common/services/Services';\n\n\nexport const enum WidthCacheSettings {\n /** sentinel for unset values in flat cache */\n FLAT_UNSET = -9999,\n /** size of flat cache, size-1 equals highest codepoint handled by flat */\n FLAT_SIZE = 256,\n /** char repeat for measuring */\n REPEAT = 32\n}\n\n\nconst enum FontVariant {\n REGULAR = 0,\n BOLD = 1,\n ITALIC = 2,\n BOLD_ITALIC = 3\n}\n\n\nexport class WidthCache implements IDisposable {\n // flat cache for regular variant up to CacheSettings.FLAT_SIZE\n // NOTE: ~4x faster access than holey (serving >>80% of terminal content)\n // It has a small memory footprint (only 1MB for full BMP caching),\n // still the sweet spot is not reached before touching 32k different codepoints,\n // thus we store the remaining <<20% of terminal data in a holey structure.\n protected _flat = new Float32Array(WidthCacheSettings.FLAT_SIZE);\n\n // holey cache for bold, italic and bold&italic for any string\n // FIXME: can grow really big over time (~8.5 MB for full BMP caching),\n // so a shared API across terminals is needed\n protected _holey: Map | undefined;\n\n private _font = '';\n private _fontSize = 0;\n private _weight: FontWeight = 'normal';\n private _weightBold: FontWeight = 'bold';\n private _container: HTMLDivElement;\n private _measureElements: HTMLSpanElement[] = [];\n\n constructor(_document: Document, _helperContainer: HTMLElement) {\n this._container = _document.createElement('div');\n this._container.classList.add('xterm-width-cache-measure-container');\n this._container.setAttribute('aria-hidden', 'true');\n // SP should stack in spans\n this._container.style.whiteSpace = 'pre';\n // avoid undercuts in non-monospace fonts from kerning\n this._container.style.fontKerning = 'none';\n\n const regular = _document.createElement('span');\n regular.classList.add('xterm-char-measure-element');\n\n const bold = _document.createElement('span');\n bold.classList.add('xterm-char-measure-element');\n bold.style.fontWeight = 'bold';\n\n const italic = _document.createElement('span');\n italic.classList.add('xterm-char-measure-element');\n italic.style.fontStyle = 'italic';\n\n const boldItalic = _document.createElement('span');\n boldItalic.classList.add('xterm-char-measure-element');\n boldItalic.style.fontWeight = 'bold';\n boldItalic.style.fontStyle = 'italic';\n\n // NOTE: must be in order of FontVariant\n this._measureElements = [regular, bold, italic, boldItalic];\n this._container.appendChild(regular);\n this._container.appendChild(bold);\n this._container.appendChild(italic);\n this._container.appendChild(boldItalic);\n\n _helperContainer.appendChild(this._container);\n\n this.clear();\n }\n\n public dispose(): void {\n this._container.remove(); // remove elements from DOM\n this._measureElements.length = 0; // release element refs\n this._holey = undefined; // free cache memory via GC\n }\n\n /**\n * Clear the width cache.\n */\n public clear(): void {\n this._flat.fill(WidthCacheSettings.FLAT_UNSET);\n // .clear() has some overhead, re-assign instead (>3 times faster)\n this._holey = new Map();\n }\n\n /**\n * Set the font for measuring.\n * Must be called for any changes on font settings.\n * Also clears the cache.\n */\n public setFont(font: string, fontSize: number, weight: FontWeight, weightBold: FontWeight): void {\n // skip if nothing changed\n if (font === this._font\n && fontSize === this._fontSize\n && weight === this._weight\n && weightBold === this._weightBold\n ) {\n return;\n }\n\n this._font = font;\n this._fontSize = fontSize;\n this._weight = weight;\n this._weightBold = weightBold;\n\n this._container.style.fontFamily = this._font;\n this._container.style.fontSize = `${this._fontSize}px`;\n this._measureElements[FontVariant.REGULAR].style.fontWeight = `${weight}`;\n this._measureElements[FontVariant.BOLD].style.fontWeight = `${weightBold}`;\n this._measureElements[FontVariant.ITALIC].style.fontWeight = `${weight}`;\n this._measureElements[FontVariant.BOLD_ITALIC].style.fontWeight = `${weightBold}`;\n\n this.clear();\n }\n\n /**\n * Get the render width for cell content `c` with current font settings.\n * `variant` denotes the font variant to be used.\n */\n public get(c: string, bold: boolean | number, italic: boolean | number): number {\n let cp = 0;\n if (!bold && !italic && c.length === 1 && (cp = c.charCodeAt(0)) < WidthCacheSettings.FLAT_SIZE) {\n if (this._flat[cp] !== WidthCacheSettings.FLAT_UNSET) {\n return this._flat[cp];\n }\n const width = this._measure(c, 0);\n if (width > 0) {\n this._flat[cp] = width;\n }\n return width;\n }\n let key = c;\n if (bold) key += 'B';\n if (italic) key += 'I';\n let width = this._holey!.get(key);\n if (width === undefined) {\n let variant = 0;\n if (bold) variant |= FontVariant.BOLD;\n if (italic) variant |= FontVariant.ITALIC;\n width = this._measure(c, variant);\n if (width > 0) {\n this._holey!.set(key, width);\n }\n }\n return width;\n }\n\n protected _measure(c: string, variant: FontVariant): number {\n const el = this._measureElements[variant];\n el.textContent = c.repeat(WidthCacheSettings.REPEAT);\n return el.offsetWidth / WidthCacheSettings.REPEAT;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isFirefox, isLegacyEdge } from 'common/Platform';\n\nexport const INVERTED_DEFAULT_COLOR = 257;\n\nexport const DIM_OPACITY = 0.5;\n// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge\n// would result in truncated text (Issue 3353). Using 'bottom' for Chrome would result in slightly\n// unaligned Powerline fonts (PR 3356#issuecomment-850928179).\nexport const TEXT_BASELINE: CanvasTextBaseline = isFirefox || isLegacyEdge ? 'bottom' : 'ideographic';\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDimensions, IRenderDimensions } from 'browser/renderer/shared/Types';\n\nexport function throwIfFalsy(value: T | undefined | null): T {\n if (!value) {\n throw new Error('value must not be falsy');\n }\n return value;\n}\n\nexport function isPowerlineGlyph(codepoint: number): boolean {\n // Only return true for Powerline symbols which require\n // different padding and should be excluded from minimum contrast\n // ratio standards\n return 0xE0A4 <= codepoint && codepoint <= 0xE0D6;\n}\n\nexport function isRestrictedPowerlineGlyph(codepoint: number): boolean {\n return 0xE0B0 <= codepoint && codepoint <= 0xE0B7;\n}\n\nfunction isNerdFontGlyph(codepoint: number): boolean {\n return 0xE000 <= codepoint && codepoint <= 0xF8FF;\n}\n\nfunction isBoxOrBlockGlyph(codepoint: number): boolean {\n return 0x2500 <= codepoint && codepoint <= 0x259F;\n}\n\nexport function isEmoji(codepoint: number): boolean {\n return (\n codepoint >= 0x1F600 && codepoint <= 0x1F64F || // Emoticons\n codepoint >= 0x1F300 && codepoint <= 0x1F5FF || // Misc Symbols and Pictographs\n codepoint >= 0x1F680 && codepoint <= 0x1F6FF || // Transport and Map\n codepoint >= 0x2600 && codepoint <= 0x26FF || // Misc symbols\n codepoint >= 0x2700 && codepoint <= 0x27BF || // Dingbats\n codepoint >= 0xFE00 && codepoint <= 0xFE0F || // Variation Selectors\n codepoint >= 0x1F900 && codepoint <= 0x1F9FF || // Supplemental Symbols and Pictographs\n codepoint >= 0x1F1E6 && codepoint <= 0x1F1FF\n );\n}\n\nexport function allowRescaling(codepoint: number | undefined, width: number, glyphSizeX: number, deviceCellWidth: number): boolean {\n return (\n // Is single cell width\n width === 1 &&\n // Glyph exceeds cell bounds, add 50% to avoid hurting readability by rescaling glyphs that\n // barely overlap\n glyphSizeX > Math.ceil(deviceCellWidth * 1.5) &&\n // Never rescale ascii\n codepoint !== undefined && codepoint > 0xFF &&\n // Never rescale emoji\n !isEmoji(codepoint) &&\n // Never rescale powerline or nerd fonts\n !isPowerlineGlyph(codepoint) && !isNerdFontGlyph(codepoint)\n );\n}\n\nexport function treatGlyphAsBackgroundColor(codepoint: number): boolean {\n return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);\n}\n\nexport function createRenderDimensions(): IRenderDimensions {\n return {\n css: {\n canvas: createDimension(),\n cell: createDimension()\n },\n device: {\n canvas: createDimension(),\n cell: createDimension(),\n char: {\n width: 0,\n height: 0,\n left: 0,\n top: 0\n }\n }\n };\n}\n\nfunction createDimension(): IDimensions {\n return {\n width: 0,\n height: 0\n };\n}\n\nexport function computeNextVariantOffset(cellWidth: number, lineWidth: number, currentOffset: number = 0): number {\n return (cellWidth - (Math.round(lineWidth) * 2 - currentOffset)) % (Math.round(lineWidth) * 2);\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminal } from 'browser/Types';\nimport { ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { Terminal } from '@xterm/xterm';\n\nclass SelectionRenderModel implements ISelectionRenderModel {\n public hasSelection!: boolean;\n public columnSelectMode!: boolean;\n public viewportStartRow!: number;\n public viewportEndRow!: number;\n public viewportCappedStartRow!: number;\n public viewportCappedEndRow!: number;\n public startCol!: number;\n public endCol!: number;\n public selectionStart: [number, number] | undefined;\n public selectionEnd: [number, number] | undefined;\n\n constructor() {\n this.clear();\n }\n\n public clear(): void {\n this.hasSelection = false;\n this.columnSelectMode = false;\n this.viewportStartRow = 0;\n this.viewportEndRow = 0;\n this.viewportCappedStartRow = 0;\n this.viewportCappedEndRow = 0;\n this.startCol = 0;\n this.endCol = 0;\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n }\n\n public update(terminal: ITerminal, start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean = false): void {\n this.selectionStart = start;\n this.selectionEnd = end;\n // Selection does not exist\n if (!start || !end || (start[0] === end[0] && start[1] === end[1])) {\n this.clear();\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportY = terminal.buffers.active.ydisp;\n const viewportStartRow = start[1] - viewportY;\n const viewportEndRow = end[1] - viewportY;\n const viewportCappedStartRow = Math.max(viewportStartRow, 0);\n const viewportCappedEndRow = Math.min(viewportEndRow, terminal.rows - 1);\n\n // No need to draw the selection\n if (viewportCappedStartRow >= terminal.rows || viewportCappedEndRow < 0) {\n this.clear();\n return;\n }\n\n this.hasSelection = true;\n this.columnSelectMode = columnSelectMode;\n this.viewportStartRow = viewportStartRow;\n this.viewportEndRow = viewportEndRow;\n this.viewportCappedStartRow = viewportCappedStartRow;\n this.viewportCappedEndRow = viewportCappedEndRow;\n this.startCol = start[0];\n this.endCol = end[0];\n }\n\n public isCellSelected(terminal: Terminal, x: number, y: number): boolean {\n if (!this.hasSelection) {\n return false;\n }\n y -= terminal.buffer.active.viewportY;\n if (this.columnSelectMode) {\n if (this.startCol <= this.endCol) {\n return x >= this.startCol && y >= this.viewportCappedStartRow &&\n x < this.endCol && y <= this.viewportCappedEndRow;\n }\n return x < this.startCol && y >= this.viewportCappedStartRow &&\n x >= this.endCol && y <= this.viewportCappedEndRow;\n }\n return (y > this.viewportStartRow && y < this.viewportEndRow) ||\n (this.viewportStartRow === this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportEndRow && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol);\n }\n}\n\nexport function createSelectionRenderModel(): ISelectionRenderModel {\n return new SelectionRenderModel();\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService } from 'common/services/Services';\n\n/**\n * Represents a selection within the buffer. This model only cares about column\n * and row coordinates, not wide characters.\n */\nexport class SelectionModel {\n /**\n * Whether select all is currently active.\n */\n public isSelectAllActive: boolean = false;\n\n /**\n * The minimal length of the selection from the start position. When double\n * clicking on a word, the word will be selected which makes the selection\n * start at the start of the word and makes this variable the length.\n */\n public selectionStartLength: number = 0;\n\n /**\n * The [x, y] position the selection starts at.\n */\n public selectionStart: [number, number] | undefined;\n\n /**\n * The [x, y] position the selection ends at.\n */\n public selectionEnd: [number, number] | undefined;\n\n constructor(\n private _bufferService: IBufferService\n ) {\n }\n\n /**\n * Clears the current selection.\n */\n public clearSelection(): void {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n }\n\n /**\n * The final selection start, taking into consideration select all.\n */\n public get finalSelectionStart(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n }\n\n /**\n * The final selection end, taking into consideration select all, double click\n * word selection and triple click line selection.\n */\n public get finalSelectionEnd(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];\n }\n\n if (!this.selectionStart) {\n return undefined;\n }\n\n // Use the selection start + length if the end doesn't exist or they're reversed\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n // Ensure the trailing EOL isn't included when the selection ends on the right edge\n if (startPlusLength % this._bufferService.cols === 0) {\n return [this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols) - 1];\n }\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [startPlusLength, this.selectionStart[1]];\n }\n\n // Ensure the the word/line is selected after a double/triple click\n if (this.selectionStartLength) {\n // Select the larger of the two when start and end are on the same line\n if (this.selectionEnd[1] === this.selectionStart[1]) {\n // Keep the whole wrapped word/line selected if the content wraps multiple lines\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [Math.max(startPlusLength, this.selectionEnd[0]), this.selectionEnd[1]];\n }\n }\n return this.selectionEnd;\n }\n\n /**\n * Returns whether the selection start and end are reversed.\n */\n public areSelectionValuesReversed(): boolean {\n const start = this.selectionStart;\n const end = this.selectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n * @returns Whether a refresh is necessary.\n */\n public handleTrim(amount: number): boolean {\n // Adjust the selection position based on the trimmed amount.\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n\n // The selection has moved off the buffer, clear it.\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n\n // If the selection start is trimmed, ensure the start column is 0.\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService } from 'common/services/Services';\nimport { ICharSizeService } from 'browser/services/Services';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\nexport class CharSizeService extends Disposable implements ICharSizeService {\n public serviceBrand: undefined;\n\n public width: number = 0;\n public height: number = 0;\n private _measureStrategy: IMeasureStrategy;\n\n public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }\n\n private readonly _onCharSizeChange = this._register(new Emitter());\n public readonly onCharSizeChange = this._onCharSizeChange.event;\n\n constructor(\n document: Document,\n parentElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n try {\n this._measureStrategy = this._register(new TextMetricsMeasureStrategy(this._optionsService));\n } catch {\n this._measureStrategy = this._register(new DomMeasureStrategy(document, parentElement, this._optionsService));\n }\n this._register(this._optionsService.onMultipleOptionChange(['fontFamily', 'fontSize'], () => this.measure()));\n }\n\n public measure(): void {\n const result = this._measureStrategy.measure();\n if (result.width !== this.width || result.height !== this.height) {\n this.width = result.width;\n this.height = result.height;\n this._onCharSizeChange.fire();\n }\n }\n}\n\ninterface IMeasureStrategy {\n measure(): Readonly;\n}\n\ninterface IMeasureResult {\n width: number;\n height: number;\n}\n\nconst enum DomMeasureStrategyConstants {\n REPEAT = 32\n}\n\nabstract class BaseMeasureStategy extends Disposable implements IMeasureStrategy {\n protected _result: IMeasureResult = { width: 0, height: 0 };\n\n protected _validateAndSet(width: number | undefined, height: number | undefined): void {\n // If values are 0 then the element is likely currently display:none, in which case we should\n // retain the previous value.\n if (width !== undefined && width > 0 && height !== undefined && height > 0) {\n this._result.width = width;\n this._result.height = height;\n }\n }\n\n public abstract measure(): Readonly;\n}\n\nclass DomMeasureStrategy extends BaseMeasureStategy {\n private _measureElement: HTMLElement;\n\n constructor(\n private _document: Document,\n private _parentElement: HTMLElement,\n private _optionsService: IOptionsService\n ) {\n super();\n this._measureElement = this._document.createElement('span');\n this._measureElement.classList.add('xterm-char-measure-element');\n this._measureElement.textContent = 'W'.repeat(DomMeasureStrategyConstants.REPEAT);\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._measureElement.style.whiteSpace = 'pre';\n this._measureElement.style.fontKerning = 'none';\n this._parentElement.appendChild(this._measureElement);\n }\n\n public measure(): Readonly {\n this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;\n\n // Note that this triggers a synchronous layout\n this._validateAndSet(Number(this._measureElement.offsetWidth) / DomMeasureStrategyConstants.REPEAT, Number(this._measureElement.offsetHeight));\n\n return this._result;\n }\n}\n\nclass TextMetricsMeasureStrategy extends BaseMeasureStategy {\n private _canvas: OffscreenCanvas;\n private _ctx: OffscreenCanvasRenderingContext2D;\n\n constructor(\n private _optionsService: IOptionsService\n ) {\n super();\n // This will throw if any required API is not supported\n this._canvas = new OffscreenCanvas(100, 100);\n this._ctx = this._canvas.getContext('2d')!;\n const a = this._ctx.measureText('W');\n if (!('width' in a && 'fontBoundingBoxAscent' in a && 'fontBoundingBoxDescent' in a)) {\n throw new Error('Required font metrics not supported');\n }\n }\n\n public measure(): Readonly {\n this._ctx.font = `${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;\n const metrics = this._ctx.measureText('W');\n this._validateAndSet(metrics.width, metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent);\n return this._result;\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, CharData } from 'common/Types';\nimport { ICharacterJoiner } from 'browser/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WHITESPACE_CELL_CHAR, Content } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService } from 'common/services/Services';\nimport { ICharacterJoinerService } from 'browser/services/Services';\n\nexport class JoinedCellData extends AttributeData implements ICellData {\n private _width: number;\n // .content carries no meaning for joined CellData, simply nullify it\n // thus we have to overload all other .content accessors\n public content: number = 0;\n public fg: number;\n public bg: number;\n public combinedData: string = '';\n\n constructor(firstCell: ICellData, chars: string, width: number) {\n super();\n this.fg = firstCell.fg;\n this.bg = firstCell.bg;\n this.combinedData = chars;\n this._width = width;\n }\n\n public isCombined(): number {\n // always mark joined cell data as combined\n return Content.IS_COMBINED_MASK;\n }\n\n public getWidth(): number {\n return this._width;\n }\n\n public getChars(): string {\n return this.combinedData;\n }\n\n public getCode(): number {\n // code always gets the highest possible fake codepoint (read as -1)\n // this is needed as code is used by caches as identifier\n return 0x1FFFFF;\n }\n\n public setFromCharData(value: CharData): void {\n throw new Error('not implemented');\n }\n\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n\nexport class CharacterJoinerService implements ICharacterJoinerService {\n public serviceBrand: undefined;\n\n private _characterJoiners: ICharacterJoiner[] = [];\n private _nextCharacterJoinerId: number = 0;\n private _workCell: CellData = new CellData();\n\n constructor(\n @IBufferService private _bufferService: IBufferService\n ) { }\n\n public register(handler: (text: string) => [number, number][]): number {\n const joiner: ICharacterJoiner = {\n id: this._nextCharacterJoinerId++,\n handler\n };\n\n this._characterJoiners.push(joiner);\n return joiner.id;\n }\n\n public deregister(joinerId: number): boolean {\n for (let i = 0; i < this._characterJoiners.length; i++) {\n if (this._characterJoiners[i].id === joinerId) {\n this._characterJoiners.splice(i, 1);\n return true;\n }\n }\n\n return false;\n }\n\n public getJoinedCharacters(row: number): [number, number][] {\n if (this._characterJoiners.length === 0) {\n return [];\n }\n\n const line = this._bufferService.buffer.lines.get(row);\n if (!line || line.length === 0) {\n return [];\n }\n\n const ranges: [number, number][] = [];\n const lineStr = line.translateToString(true);\n\n // Because some cells can be represented by multiple javascript characters,\n // we track the cell and the string indexes separately. This allows us to\n // translate the string ranges we get from the joiners back into cell ranges\n // for use when rendering\n let rangeStartColumn = 0;\n let currentStringIndex = 0;\n let rangeStartStringIndex = 0;\n let rangeAttrFG = line.getFg(0);\n let rangeAttrBG = line.getBg(0);\n\n for (let x = 0; x < line.getTrimmedLength(); x++) {\n line.loadCell(x, this._workCell);\n\n if (this._workCell.getWidth() === 0) {\n // If this character is of width 0, skip it.\n continue;\n }\n\n // End of range\n if (this._workCell.fg !== rangeAttrFG || this._workCell.bg !== rangeAttrBG) {\n // If we ended up with a sequence of more than one character,\n // look for ranges to join.\n if (x - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n // Reset our markers for a new range.\n rangeStartColumn = x;\n rangeStartStringIndex = currentStringIndex;\n rangeAttrFG = this._workCell.fg;\n rangeAttrBG = this._workCell.bg;\n }\n\n currentStringIndex += this._workCell.getChars().length || WHITESPACE_CELL_CHAR.length;\n }\n\n // Process any trailing ranges.\n if (this._bufferService.cols - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n return ranges;\n }\n\n /**\n * Given a segment of a line of text, find all ranges of text that should be\n * joined in a single rendering unit. Ranges are internally converted to\n * column ranges, rather than string ranges.\n * @param line String representation of the full line of text\n * @param startIndex Start position of the range to search in the string (inclusive)\n * @param endIndex End position of the range to search in the string (exclusive)\n */\n private _getJoinedRanges(line: string, startIndex: number, endIndex: number, lineData: IBufferLine, startCol: number): [number, number][] {\n const text = line.substring(startIndex, endIndex);\n // At this point we already know that there is at least one joiner so\n // we can just pull its value and assign it directly rather than\n // merging it into an empty array, which incurs unnecessary writes.\n let allJoinedRanges: [number, number][] = [];\n try {\n allJoinedRanges = this._characterJoiners[0].handler(text);\n } catch (error) {\n console.error(error);\n }\n for (let i = 1; i < this._characterJoiners.length; i++) {\n // We merge any overlapping ranges across the different joiners\n try {\n const joinerRanges = this._characterJoiners[i].handler(text);\n for (let j = 0; j < joinerRanges.length; j++) {\n CharacterJoinerService._mergeRanges(allJoinedRanges, joinerRanges[j]);\n }\n } catch (error) {\n console.error(error);\n }\n }\n this._stringRangesToCellRanges(allJoinedRanges, lineData, startCol);\n return allJoinedRanges;\n }\n\n /**\n * Modifies the provided ranges in-place to adjust for variations between\n * string length and cell width so that the range represents a cell range,\n * rather than the string range the joiner provides.\n * @param ranges String ranges containing start (inclusive) and end (exclusive) index\n * @param line Cell data for the relevant line in the terminal\n * @param startCol Offset within the line to start from\n */\n private _stringRangesToCellRanges(ranges: [number, number][], line: IBufferLine, startCol: number): void {\n let currentRangeIndex = 0;\n let currentRangeStarted = false;\n let currentStringIndex = 0;\n let currentRange = ranges[currentRangeIndex];\n\n // If we got through all of the ranges, stop searching\n if (!currentRange) {\n return;\n }\n\n for (let x = startCol; x < this._bufferService.cols; x++) {\n const width = line.getWidth(x);\n const length = line.getString(x).length || WHITESPACE_CELL_CHAR.length;\n\n // We skip zero-width characters when creating the string to join the text\n // so we do the same here\n if (width === 0) {\n continue;\n }\n\n // Adjust the start of the range\n if (!currentRangeStarted && currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n }\n\n // Adjust the end of the range\n if (currentRange[1] <= currentStringIndex) {\n currentRange[1] = x;\n\n // We're finished with this range, so we move to the next one\n currentRange = ranges[++currentRangeIndex];\n\n // If there are no more ranges left, stop searching\n if (!currentRange) {\n break;\n }\n\n // Ranges can be on adjacent characters. Because the end index of the\n // ranges are exclusive, this means that the index for the start of a\n // range can be the same as the end index of the previous range. To\n // account for the start of the next range, we check here just in case.\n if (currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n } else {\n currentRangeStarted = false;\n }\n }\n\n // Adjust the string index based on the character length to line up with\n // the column adjustment\n currentStringIndex += length;\n }\n\n // If there is still a range left at the end, it must extend all the way to\n // the end of the line.\n if (currentRange) {\n currentRange[1] = this._bufferService.cols;\n }\n }\n\n /**\n * Merges the range defined by the provided start and end into the list of\n * existing ranges. The merge is done in place on the existing range for\n * performance and is also returned.\n * @param ranges Existing range list\n * @param newRange Tuple of two numbers representing the new range to merge in.\n * @returns The ranges input with the new range merged in place\n */\n private static _mergeRanges(ranges: [number, number][], newRange: [number, number]): [number, number][] {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, newRange);\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRange[0], range[0]);\n return ranges;\n }\n\n if (newRange[0] < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRange[0], range[0]);\n inRange = true;\n }\n\n // Case 4: New range starts after the search range\n continue;\n } else {\n if (newRange[1] <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRange[1];\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRange[1], range[1]);\n ranges.splice(i, 1);\n return ranges;\n }\n\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRange[1];\n } else {\n // Case 9: New range starts after the last existing range\n ranges.push(newRange);\n }\n\n return ranges;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService } from './Services';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\nexport class CoreBrowserService extends Disposable implements ICoreBrowserService {\n public serviceBrand: undefined;\n\n private _isFocused = false;\n private _cachedIsFocused: boolean | undefined = undefined;\n private _screenDprMonitor = this._register(new ScreenDprMonitor(this._window));\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n private readonly _onWindowChange = this._register(new Emitter());\n public readonly onWindowChange = this._onWindowChange.event;\n\n constructor(\n private _textarea: HTMLTextAreaElement,\n private _window: Window & typeof globalThis,\n public readonly mainDocument: Document\n ) {\n super();\n\n // Monitor device pixel ratio\n this._register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));\n this._register(Event.forward(this._screenDprMonitor.onDprChange, this._onDprChange));\n\n this._register(addDisposableListener(this._textarea, 'focus', () => this._isFocused = true));\n this._register(addDisposableListener(this._textarea, 'blur', () => this._isFocused = false));\n }\n\n public get window(): Window & typeof globalThis {\n return this._window;\n }\n\n public set window(value: Window & typeof globalThis) {\n if (this._window !== value) {\n this._window = value;\n this._onWindowChange.fire(this._window);\n }\n }\n\n public get dpr(): number {\n return this.window.devicePixelRatio;\n }\n\n public get isFocused(): boolean {\n if (this._cachedIsFocused === undefined) {\n this._cachedIsFocused = this._isFocused && this._textarea.ownerDocument.hasFocus();\n queueMicrotask(() => this._cachedIsFocused = undefined);\n }\n return this._cachedIsFocused;\n }\n}\n\n\n/**\n * The screen device pixel ratio monitor allows listening for when the\n * window.devicePixelRatio value changes. This is done not with polling but with\n * the use of window.matchMedia to watch media queries. When the event fires,\n * the listener will be reattached using a different media query to ensure that\n * any further changes will _register.\n *\n * The listener should fire on both window zoom changes and switching to a\n * monitor with a different DPI.\n */\nclass ScreenDprMonitor extends Disposable {\n private _currentDevicePixelRatio: number;\n private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined;\n private _resolutionMediaMatchList: MediaQueryList | undefined;\n private _windowResizeListener = this._register(new MutableDisposable());\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n\n constructor(private _parentWindow: Window) {\n super();\n\n // Initialize listener and dpr value\n this._outerListener = () => this._setDprAndFireIfDiffers();\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._updateDpr();\n\n // Monitor active window resize\n this._setWindowResizeListener();\n\n // Setup additional disposables\n this._register(toDisposable(() => this.clearListener()));\n }\n\n\n public setWindow(parentWindow: Window): void {\n this._parentWindow = parentWindow;\n this._setWindowResizeListener();\n this._setDprAndFireIfDiffers();\n }\n\n private _setWindowResizeListener(): void {\n this._windowResizeListener.value = addDisposableListener(this._parentWindow, 'resize', () => this._setDprAndFireIfDiffers());\n }\n\n private _setDprAndFireIfDiffers(): void {\n if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) {\n this._onDprChange.fire(this._parentWindow.devicePixelRatio);\n }\n this._updateDpr();\n }\n\n private _updateDpr(): void {\n if (!this._outerListener) {\n return;\n }\n\n // Clear listeners for old DPR\n this._resolutionMediaMatchList?.removeListener(this._outerListener);\n\n // Add listeners for new DPR\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`);\n this._resolutionMediaMatchList.addListener(this._outerListener);\n }\n\n public clearListener(): void {\n if (!this._resolutionMediaMatchList || !this._outerListener) {\n return;\n }\n this._resolutionMediaMatchList.removeListener(this._outerListener);\n this._resolutionMediaMatchList = undefined;\n this._outerListener = undefined;\n }\n}\n","import { ILinkProvider, ILinkProviderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDisposable } from 'common/Types';\n\nexport class LinkProviderService extends Disposable implements ILinkProviderService {\n declare public serviceBrand: undefined;\n\n public readonly linkProviders: ILinkProvider[] = [];\n\n constructor() {\n super();\n this._register(toDisposable(() => this.linkProviders.length = 0));\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n this.linkProviders.push(linkProvider);\n return {\n dispose: () => {\n // Remove the link provider from the list\n const providerIndex = this.linkProviders.indexOf(linkProvider);\n\n if (providerIndex !== -1) {\n this.linkProviders.splice(providerIndex, 1);\n }\n }\n };\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharSizeService, IRenderService, IMouseService } from './Services';\nimport { getCoords, getCoordsRelativeToElement } from 'browser/input/Mouse';\n\nexport class MouseService implements IMouseService {\n public serviceBrand: undefined;\n\n constructor(\n @IRenderService private readonly _renderService: IRenderService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService\n ) {\n }\n\n public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {\n return getCoords(\n window,\n event,\n element,\n colCount,\n rowCount,\n this._charSizeService.hasValidSize,\n this._renderService.dimensions.css.cell.width,\n this._renderService.dimensions.css.cell.height,\n isSelection\n );\n }\n\n public getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined {\n const coords = getCoordsRelativeToElement(window, event, element);\n if (!this._charSizeService.hasValidSize) {\n return undefined;\n }\n coords[0] = Math.min(Math.max(coords[0], 0), this._renderService.dimensions.css.canvas.width - 1);\n coords[1] = Math.min(Math.max(coords[1], 0), this._renderService.dimensions.css.canvas.height - 1);\n return {\n col: Math.floor(coords[0] / this._renderService.dimensions.css.cell.width),\n row: Math.floor(coords[1] / this._renderService.dimensions.css.cell.height),\n x: Math.floor(coords[0]),\n y: Math.floor(coords[1])\n };\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { DebouncedIdleTask } from 'common/TaskQueue';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\ninterface ISelectionState {\n start: [number, number] | undefined;\n end: [number, number] | undefined;\n columnSelectMode: boolean;\n}\n\nexport class RenderService extends Disposable implements IRenderService {\n public serviceBrand: undefined;\n\n private _renderer: MutableDisposable = this._register(new MutableDisposable());\n private _renderDebouncer: IRenderDebouncerWithCallback;\n private _pausedResizeTask = new DebouncedIdleTask();\n private _observerDisposable = this._register(new MutableDisposable());\n\n private _isPaused: boolean = false;\n private _needsFullRefresh: boolean = false;\n private _isNextRenderRedrawOnly: boolean = true;\n private _needsSelectionRefresh: boolean = false;\n private _canvasWidth: number = 0;\n private _canvasHeight: number = 0;\n private _selectionState: ISelectionState = {\n start: undefined,\n end: undefined,\n columnSelectMode: false\n };\n\n private readonly _onDimensionsChange = this._register(new Emitter());\n public readonly onDimensionsChange = this._onDimensionsChange.event;\n private readonly _onRenderedViewportChange = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;\n private readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onRefreshRequest = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRefreshRequest = this._onRefreshRequest.event;\n\n public get dimensions(): IRenderDimensions { return this._renderer.value!.dimensions; }\n\n constructor(\n private _rowCount: number,\n screenElement: HTMLElement,\n @IOptionsService optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IDecorationService decorationService: IDecorationService,\n @IBufferService bufferService: IBufferService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService,\n @IThemeService themeService: IThemeService\n ) {\n super();\n\n this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end), coreBrowserService);\n this._register(this._renderDebouncer);\n\n this._register(coreBrowserService.onDprChange(() => this.handleDevicePixelRatioChange()));\n\n this._register(bufferService.onResize(() => this._fullRefresh()));\n this._register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear()));\n this._register(optionsService.onOptionChange(() => this._handleOptionsChanged()));\n this._register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged()));\n\n // Do a full refresh whenever any decoration is added or removed. This may not actually result\n // in changes but since decorations should be used sparingly or added/removed all in the same\n // frame this should have minimal performance impact.\n this._register(decorationService.onDecorationRegistered(() => this._fullRefresh()));\n this._register(decorationService.onDecorationRemoved(() => this._fullRefresh()));\n\n // Clear the renderer when the a change that could affect glyphs occurs\n this._register(optionsService.onMultipleOptionChange([\n 'customGlyphs',\n 'drawBoldTextInBrightColors',\n 'letterSpacing',\n 'lineHeight',\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'fontWeightBold',\n 'minimumContrastRatio',\n 'rescaleOverlappingGlyphs'\n ], () => {\n this.clear();\n this.handleResize(bufferService.cols, bufferService.rows);\n this._fullRefresh();\n }));\n\n // Refresh the cursor line when the cursor changes\n this._register(optionsService.onMultipleOptionChange([\n 'cursorBlink',\n 'cursorStyle'\n ], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, true)));\n\n this._register(themeService.onChangeColors(() => this._fullRefresh()));\n\n this._registerIntersectionObserver(coreBrowserService.window, screenElement);\n this._register(coreBrowserService.onWindowChange((w) => this._registerIntersectionObserver(w, screenElement)));\n }\n\n private _registerIntersectionObserver(w: Window & typeof globalThis, screenElement: HTMLElement): void {\n // Detect whether IntersectionObserver is detected and enable renderer pause\n // and resume based on terminal visibility if so\n if ('IntersectionObserver' in w) {\n const observer = new w.IntersectionObserver(e => this._handleIntersectionChange(e[e.length - 1]), { threshold: 0 });\n observer.observe(screenElement);\n this._observerDisposable.value = toDisposable(() => observer.disconnect());\n }\n }\n\n private _handleIntersectionChange(entry: IntersectionObserverEntry): void {\n this._isPaused = entry.isIntersecting === undefined ? (entry.intersectionRatio === 0) : !entry.isIntersecting;\n\n // Terminal was hidden on open\n if (!this._isPaused && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n\n if (!this._isPaused && this._needsFullRefresh) {\n this._pausedResizeTask.flush();\n this.refreshRows(0, this._rowCount - 1);\n this._needsFullRefresh = false;\n }\n }\n\n public refreshRows(start: number, end: number, isRedrawOnly: boolean = false): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n return;\n }\n if (!isRedrawOnly) {\n this._isNextRenderRedrawOnly = false;\n }\n this._renderDebouncer.refresh(start, end, this._rowCount);\n }\n\n private _renderRows(start: number, end: number): void {\n if (!this._renderer.value) {\n return;\n }\n\n // Since this is debounced, a resize event could have happened between the time a refresh was\n // requested and when this triggers. Clamp the values of start and end to ensure they're valid\n // given the current viewport state.\n start = Math.min(start, this._rowCount - 1);\n end = Math.min(end, this._rowCount - 1);\n\n // Render\n this._renderer.value.renderRows(start, end);\n\n // Update selection if needed\n if (this._needsSelectionRefresh) {\n this._renderer.value.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode);\n this._needsSelectionRefresh = false;\n }\n\n // Fire render event only if it was not a redraw\n if (!this._isNextRenderRedrawOnly) {\n this._onRenderedViewportChange.fire({ start, end });\n }\n this._onRender.fire({ start, end });\n this._isNextRenderRedrawOnly = true;\n }\n\n public resize(cols: number, rows: number): void {\n this._rowCount = rows;\n this._fireOnCanvasResize();\n }\n\n private _handleOptionsChanged(): void {\n if (!this._renderer.value) {\n return;\n }\n this.refreshRows(0, this._rowCount - 1);\n this._fireOnCanvasResize();\n }\n\n private _fireOnCanvasResize(): void {\n if (!this._renderer.value) {\n return;\n }\n // Don't fire the event if the dimensions haven't changed\n if (this._renderer.value.dimensions.css.canvas.width === this._canvasWidth && this._renderer.value.dimensions.css.canvas.height === this._canvasHeight) {\n return;\n }\n this._onDimensionsChange.fire(this._renderer.value.dimensions);\n }\n\n public hasRenderer(): boolean {\n return !!this._renderer.value;\n }\n\n public setRenderer(renderer: IRenderer): void {\n this._renderer.value = renderer;\n // If the value was not set, the terminal is being disposed so ignore it\n if (this._renderer.value) {\n this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));\n\n // Force a refresh\n this._needsSelectionRefresh = true;\n this._fullRefresh();\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n return this._renderDebouncer.addRefreshCallback(callback);\n }\n\n private _fullRefresh(): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n } else {\n this.refreshRows(0, this._rowCount - 1);\n }\n }\n\n public clearTextureAtlas(): void {\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.clearTextureAtlas?.();\n this._fullRefresh();\n }\n\n public handleDevicePixelRatioChange(): void {\n // Force char size measurement as DomMeasureStrategy(getBoundingClientRect) is not stable\n // when devicePixelRatio changes\n this._charSizeService.measure();\n\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.handleDevicePixelRatioChange();\n this.refreshRows(0, this._rowCount - 1);\n }\n\n public handleResize(cols: number, rows: number): void {\n if (!this._renderer.value) {\n return;\n }\n if (this._isPaused) {\n this._pausedResizeTask.set(() => this._renderer.value?.handleResize(cols, rows));\n } else {\n this._renderer.value.handleResize(cols, rows);\n }\n this._fullRefresh();\n }\n\n // TODO: Is this useful when we have onResize?\n public handleCharSizeChanged(): void {\n this._renderer.value?.handleCharSizeChanged();\n }\n\n public handleBlur(): void {\n this._renderer.value?.handleBlur();\n }\n\n public handleFocus(): void {\n this._renderer.value?.handleFocus();\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionState.start = start;\n this._selectionState.end = end;\n this._selectionState.columnSelectMode = columnSelectMode;\n this._renderer.value?.handleSelectionChanged(start, end, columnSelectMode);\n }\n\n public handleCursorMove(): void {\n this._renderer.value?.handleCursorMove();\n }\n\n public clear(): void {\n this._renderer.value?.clear();\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILinkifier2 } from 'browser/Types';\nimport { getCoordsRelativeToElement } from 'browser/input/Mouse';\nimport { moveToCellSequence } from 'browser/input/MoveToCell';\nimport { SelectionModel } from 'browser/selection/SelectionModel';\nimport { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport * as Browser from 'common/Platform';\nimport { IBufferLine, IDisposable } from 'common/Types';\nimport { getRangeLength } from 'common/buffer/BufferRange';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * The number of pixels the mouse needs to be above or below the viewport in\n * order to scroll at the maximum speed.\n */\nconst DRAG_SCROLL_MAX_THRESHOLD = 50;\n\n/**\n * The maximum scrolling speed\n */\nconst DRAG_SCROLL_MAX_SPEED = 15;\n\n/**\n * The number of milliseconds between drag scroll updates.\n */\nconst DRAG_SCROLL_INTERVAL = 50;\n\n/**\n * The maximum amount of time that can have elapsed for an alt click to move the\n * cursor.\n */\nconst ALT_CLICK_MOVE_CURSOR_TIME = 500;\n\nconst NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nconst ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\n\n/**\n * Represents a position of a word on a line.\n */\ninterface IWordPosition {\n start: number;\n length: number;\n}\n\n/**\n * A selection mode, this drives how the selection behaves on mouse move.\n */\nexport const enum SelectionMode {\n NORMAL,\n WORD,\n LINE,\n COLUMN\n}\n\n/**\n * A class that manages the selection of the terminal. With help from\n * SelectionModel, SelectionService handles with all logic associated with\n * dealing with the selection, including handling mouse interaction, wide\n * characters and fetching the actual text within the selection. Rendering is\n * not handled by the SelectionService but the onRedrawRequest event is fired\n * when the selection is ready to be redrawn (on an animation frame).\n */\nexport class SelectionService extends Disposable implements ISelectionService {\n public serviceBrand: undefined;\n\n protected _model: SelectionModel;\n\n /**\n * The amount to scroll every drag scroll update (depends on how far the mouse\n * drag is above or below the terminal).\n */\n private _dragScrollAmount: number = 0;\n\n /**\n * The current selection mode.\n */\n protected _activeSelectionMode: SelectionMode;\n\n /**\n * A setInterval timer that is active while the mouse is down whose callback\n * scrolls the viewport when necessary.\n */\n private _dragScrollIntervalTimer: number | undefined;\n\n /**\n * The animation frame ID used for refreshing the selection.\n */\n private _refreshAnimationFrame: number | undefined;\n\n /**\n * Whether selection is enabled.\n */\n private _enabled = true;\n\n private _mouseMoveListener: EventListener;\n private _mouseUpListener: EventListener;\n private _trimListener: IDisposable;\n private _workCell: CellData = new CellData();\n\n private _mouseDownTimeStamp: number = 0;\n private _oldHasSelection: boolean = false;\n private _oldSelectionStart: [number, number] | undefined = undefined;\n private _oldSelectionEnd: [number, number] | undefined = undefined;\n\n private readonly _onLinuxMouseSelection = this._register(new Emitter());\n public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;\n private readonly _onRedrawRequest = this._register(new Emitter());\n public readonly onRequestRedraw = this._onRedrawRequest.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _linkifier: ILinkifier2,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IMouseService private readonly _mouseService: IMouseService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n\n // Init listeners\n this._mouseMoveListener = event => this._handleMouseMove(event as MouseEvent);\n this._mouseUpListener = event => this._handleMouseUp(event as MouseEvent);\n this._coreService.onUserInput(() => {\n if (this.hasSelection) {\n this.clearSelection();\n }\n });\n this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._handleTrim(amount));\n this._register(this._bufferService.buffers.onBufferActivate(e => this._handleBufferActivate(e)));\n\n this.enable();\n\n this._model = new SelectionModel(this._bufferService);\n this._activeSelectionMode = SelectionMode.NORMAL;\n\n this._register(toDisposable(() => {\n this._removeMouseDownListeners();\n }));\n }\n\n public reset(): void {\n this.clearSelection();\n }\n\n /**\n * Disables the selection manager. This is useful for when terminal mouse\n * are enabled.\n */\n public disable(): void {\n this.clearSelection();\n this._enabled = false;\n }\n\n /**\n * Enable the selection manager.\n */\n public enable(): void {\n this._enabled = true;\n }\n\n public get selectionStart(): [number, number] | undefined { return this._model.finalSelectionStart; }\n public get selectionEnd(): [number, number] | undefined { return this._model.finalSelectionEnd; }\n\n /**\n * Gets whether there is an active text selection.\n */\n public get hasSelection(): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }\n\n /**\n * Gets the text currently selected.\n */\n public get selectionText(): string {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n\n const buffer = this._bufferService.buffer;\n const result: string[] = [];\n\n if (this._activeSelectionMode === SelectionMode.COLUMN) {\n // Ignore zero width selections\n if (start[0] === end[0]) {\n return '';\n }\n\n // For column selection it's not enough to rely on final selection's swapping of reversed\n // values, it also needs the x coordinates to swap independently of the y coordinate is needed\n const startCol = start[0] < end[0] ? start[0] : end[0];\n const endCol = start[0] < end[0] ? end[0] : start[0];\n for (let i = start[1]; i <= end[1]; i++) {\n const lineText = buffer.translateBufferLineToString(i, true, startCol, endCol);\n result.push(lineText);\n }\n } else {\n // Get first row\n const startRowEndCol = start[1] === end[1] ? end[0] : undefined;\n result.push(buffer.translateBufferLineToString(start[1], true, start[0], startRowEndCol));\n\n // Get middle rows\n for (let i = start[1] + 1; i <= end[1] - 1; i++) {\n const bufferLine = buffer.lines.get(i);\n const lineText = buffer.translateBufferLineToString(i, true);\n if (bufferLine?.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n\n // Get final row\n if (start[1] !== end[1]) {\n const bufferLine = buffer.lines.get(end[1]);\n const lineText = buffer.translateBufferLineToString(end[1], true, 0, end[0]);\n if (bufferLine && bufferLine!.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n }\n\n // Format string by replacing non-breaking space chars with regular spaces\n // and joining the array into a multi-line string.\n const formattedResult = result.map(line => {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isWindows ? '\\r\\n' : '\\n');\n\n return formattedResult;\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Queues a refresh, redrawing the selection on the next opportunity.\n * @param isLinuxMouseSelection Whether the selection should be registered as a new\n * selection on Linux.\n */\n public refresh(isLinuxMouseSelection?: boolean): void {\n // Queue the refresh for the renderer\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh());\n }\n\n // If the platform is Linux and the refresh call comes from a mouse event,\n // we need to update the selection for middle click to paste selection.\n if (Browser.isLinux && isLinuxMouseSelection) {\n const selectionText = this.selectionText;\n if (selectionText.length) {\n this._onLinuxMouseSelection.fire(this.selectionText);\n }\n }\n }\n\n /**\n * Fires the refresh event, causing consumers to pick it up and redraw the\n * selection state.\n */\n private _refresh(): void {\n this._refreshAnimationFrame = undefined;\n this._onRedrawRequest.fire({\n start: this._model.finalSelectionStart,\n end: this._model.finalSelectionEnd,\n columnSelectMode: this._activeSelectionMode === SelectionMode.COLUMN\n });\n }\n\n /**\n * Checks if the current click was inside the current selection\n * @param event The mouse event\n */\n private _isClickInSelection(event: MouseEvent): boolean {\n const coords = this._getMouseBufferCoords(event);\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n\n if (!start || !end || !coords) {\n return false;\n }\n\n return this._areCoordsInSelection(coords, start, end);\n }\n\n public isCellInSelection(x: number, y: number): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return this._areCoordsInSelection([x, y], start, end);\n }\n\n protected _areCoordsInSelection(coords: [number, number], start: [number, number], end: [number, number]): boolean {\n return (coords[1] > start[1] && coords[1] < end[1]) ||\n (start[1] === end[1] && coords[1] === start[1] && coords[0] >= start[0] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === end[1] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === start[1] && coords[0] >= start[0]);\n }\n\n /**\n * Selects word at the current mouse event coordinates.\n * @param event The mouse event.\n */\n private _selectWordAtCursor(event: MouseEvent, allowWhitespaceOnlySelection: boolean): boolean {\n // Check if there is a link under the cursor first and select that if so\n const range = this._linkifier.currentLink?.link?.range;\n if (range) {\n this._model.selectionStart = [range.start.x - 1, range.start.y - 1];\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n this._model.selectionEnd = undefined;\n return true;\n }\n\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._selectWordAt(coords, allowWhitespaceOnlySelection);\n this._model.selectionEnd = undefined;\n return true;\n }\n return false;\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._model.isSelectAllActive = true;\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n public selectLines(start: number, end: number): void {\n this._model.clearSelection();\n start = Math.max(start, 0);\n end = Math.min(end, this._bufferService.buffer.lines.length - 1);\n this._model.selectionStart = [0, start];\n this._model.selectionEnd = [this._bufferService.cols, end];\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n */\n private _handleTrim(amount: number): void {\n const needsRefresh = this._model.handleTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n }\n\n /**\n * Gets the 0-based [x, y] buffer coordinates of the current mouse event.\n * @param event The mouse event.\n */\n private _getMouseBufferCoords(event: MouseEvent): [number, number] | undefined {\n const coords = this._mouseService.getCoords(event, this._screenElement, this._bufferService.cols, this._bufferService.rows, true);\n if (!coords) {\n return undefined;\n }\n\n // Convert to 0-based\n coords[0]--;\n coords[1]--;\n\n // Convert viewport coords to buffer coords\n coords[1] += this._bufferService.buffer.ydisp;\n return coords;\n }\n\n /**\n * Gets the amount the viewport should be scrolled based on how far out of the\n * terminal the mouse is.\n * @param event The mouse event.\n */\n private _getMouseEventScrollAmount(event: MouseEvent): number {\n let offset = getCoordsRelativeToElement(this._coreBrowserService.window, event, this._screenElement)[1];\n const terminalHeight = this._renderService.dimensions.css.canvas.height;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\n }\n\n offset = Math.min(Math.max(offset, -DRAG_SCROLL_MAX_THRESHOLD), DRAG_SCROLL_MAX_THRESHOLD);\n offset /= DRAG_SCROLL_MAX_THRESHOLD;\n return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));\n }\n\n /**\n * Returns whether the selection manager should force selection, regardless of\n * whether the terminal is in mouse events mode.\n * @param event The mouse event.\n */\n public shouldForceSelection(event: MouseEvent): boolean {\n if (Browser.isMac) {\n return event.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection;\n }\n\n return event.shiftKey;\n }\n\n /**\n * Handles te mousedown event, setting up for a new selection.\n * @param event The mousedown event.\n */\n public handleMouseDown(event: MouseEvent): void {\n this._mouseDownTimeStamp = event.timeStamp;\n // If we have selection, we want the context menu on right click even if the\n // terminal is in mouse mode.\n if (event.button === 2 && this.hasSelection) {\n return;\n }\n\n // Only action the primary button\n if (event.button !== 0) {\n return;\n }\n\n // Allow selection when using a specific modifier key, even when disabled\n if (!this._enabled) {\n if (!this.shouldForceSelection(event)) {\n return;\n }\n\n // Don't send the mouse down event to the current process, we want to select\n event.stopPropagation();\n }\n\n // Tell the browser not to start a regular selection\n event.preventDefault();\n\n // Reset drag scroll state\n this._dragScrollAmount = 0;\n\n if (this._enabled && event.shiftKey) {\n this._handleIncrementalClick(event);\n } else {\n if (event.detail === 1) {\n this._handleSingleClick(event);\n } else if (event.detail === 2) {\n this._handleDoubleClick(event);\n } else if (event.detail === 3) {\n this._handleTripleClick(event);\n }\n }\n\n this._addMouseDownListeners();\n this.refresh(true);\n }\n\n /**\n * Adds listeners when mousedown is triggered.\n */\n private _addMouseDownListeners(): void {\n // Listen on the document so that dragging outside of viewport works\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n }\n this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), DRAG_SCROLL_INTERVAL);\n }\n\n /**\n * Removes the listeners that are registered when mousedown is triggered.\n */\n private _removeMouseDownListeners(): void {\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n }\n this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = undefined;\n }\n\n /**\n * Performs an incremental click, setting the selection end position to the mouse\n * position.\n * @param event The mouse event.\n */\n private _handleIncrementalClick(event: MouseEvent): void {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n }\n\n /**\n * Performs a single click, resetting relevant state and setting the selection\n * start position.\n * @param event The mouse event.\n */\n private _handleSingleClick(event: MouseEvent): void {\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;\n\n // Initialize the new selection\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (!this._model.selectionStart) {\n return;\n }\n this._model.selectionEnd = undefined;\n\n // Ensure the line exists\n const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);\n if (!line) {\n return;\n }\n\n // Return early if the click event is not in the buffer (eg. in scroll bar)\n if (line.length === this._model.selectionStart[0]) {\n return;\n }\n\n // If the mouse is over the second half of a wide character, adjust the\n // selection to cover the whole character\n if (line.hasWidth(this._model.selectionStart[0]) === 0) {\n this._model.selectionStart[0]++;\n }\n }\n\n /**\n * Performs a double click, selecting the current word.\n * @param event The mouse event.\n */\n private _handleDoubleClick(event: MouseEvent): void {\n if (this._selectWordAtCursor(event, true)) {\n this._activeSelectionMode = SelectionMode.WORD;\n }\n }\n\n /**\n * Performs a triple click, selecting the current line and activating line\n * select mode.\n * @param event The mouse event.\n */\n private _handleTripleClick(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n }\n\n /**\n * Returns whether the selection manager should operate in column select mode\n * @param event the mouse or keyboard event\n */\n public shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean {\n return event.altKey && !(Browser.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection);\n }\n\n /**\n * Handles the mousemove event when the mouse button is down, recording the\n * end of the selection and refreshing the selection.\n * @param event The mousemove event.\n */\n private _handleMouseMove(event: MouseEvent): void {\n // If the mousemove listener is active it means that a selection is\n // currently being made, we should stop propagation to prevent mouse events\n // to be sent to the pty.\n event.stopImmediatePropagation();\n\n // Do nothing if there is no selection start, this can happen if the first\n // click in the terminal is an incremental click\n if (!this._model.selectionStart) {\n return;\n }\n\n // Record the previous position so we know whether to redraw the selection\n // at the end.\n const previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n\n // Set the initial selection end based on the mouse coordinates\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (!this._model.selectionEnd) {\n this.refresh(true);\n return;\n }\n\n // Select the entire line if line select mode is active.\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n } else {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n } else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n\n // Determine the amount of scrolling that will happen.\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n } else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n }\n\n // If the character is a wide character include the cell to the right in the\n // selection. Note that selections at the very end of the line will never\n // have a character.\n const buffer = this._bufferService.buffer;\n if (this._model.selectionEnd[1] < buffer.lines.length) {\n const line = buffer.lines.get(this._model.selectionEnd[1]);\n if (line && line.hasWidth(this._model.selectionEnd[0]) === 0) {\n if (this._model.selectionEnd[0] < this._bufferService.cols) {\n this._model.selectionEnd[0]++;\n }\n }\n }\n\n // Only draw here if the selection changes.\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n }\n\n /**\n * The callback that occurs every DRAG_SCROLL_INTERVAL ms that does the\n * scrolling of the viewport.\n */\n private _dragScroll(): void {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n } else {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }\n\n /**\n * Handles the mouseup event, removing the mousedown listeners.\n * @param event The mouseup event.\n */\n private _handleMouseUp(event: MouseEvent): void {\n const timeElapsed = event.timeStamp - this._mouseDownTimeStamp;\n\n this._removeMouseDownListeners();\n\n if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME && event.altKey && this._optionsService.rawOptions.altClickMovesCursor) {\n if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {\n const coordinates = this._mouseService.getCoords(\n event,\n this._element,\n this._bufferService.cols,\n this._bufferService.rows,\n false\n );\n if (coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) {\n const sequence = moveToCellSequence(coordinates[0] - 1, coordinates[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);\n this._coreService.triggerDataEvent(sequence, true);\n }\n }\n } else {\n this._fireEventIfSelectionChanged();\n }\n }\n\n private _fireEventIfSelectionChanged(): void {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n const hasSelection = !!start && !!end && (start[0] !== end[0] || start[1] !== end[1]);\n\n if (!hasSelection) {\n if (this._oldHasSelection) {\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n return;\n }\n\n // Sanity check, these should not be undefined as there is a selection\n if (!start || !end) {\n return;\n }\n\n if (!this._oldSelectionStart || !this._oldSelectionEnd || (\n start[0] !== this._oldSelectionStart[0] || start[1] !== this._oldSelectionStart[1] ||\n end[0] !== this._oldSelectionEnd[0] || end[1] !== this._oldSelectionEnd[1])) {\n\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n }\n\n private _fireOnSelectionChange(start: [number, number] | undefined, end: [number, number] | undefined, hasSelection: boolean): void {\n this._oldSelectionStart = start;\n this._oldSelectionEnd = end;\n this._oldHasSelection = hasSelection;\n this._onSelectionChange.fire();\n }\n\n private _handleBufferActivate(e: {activeBuffer: IBuffer, inactiveBuffer: IBuffer}): void {\n this.clearSelection();\n // Only adjust the selection on trim, shiftElements is rarely used (only in\n // reverseIndex) and delete in a splice is only ever used when the same\n // number of elements was just added. Given this is could actually be\n // beneficial to leave the selection as is for these cases.\n this._trimListener.dispose();\n this._trimListener = e.activeBuffer.lines.onTrim(amount => this._handleTrim(amount));\n }\n\n /**\n * Converts a viewport column (0 to cols - 1) to the character index on the\n * buffer line, the latter takes into account wide and null characters.\n * @param bufferLine The buffer line to use.\n * @param x The x index in the buffer line to convert.\n */\n private _convertViewportColToCharacterIndex(bufferLine: IBufferLine, x: number): number {\n let charIndex = x;\n for (let i = 0; x >= i; i++) {\n const length = bufferLine.loadCell(i, this._workCell).getChars().length;\n if (this._workCell.getWidth() === 0) {\n // Wide characters aren't included in the line string so decrement the\n // index so the index is back on the wide character.\n charIndex--;\n } else if (length > 1 && x !== i) {\n // Emojis take up multiple characters, so adjust accordingly. For these\n // we don't want ot include the character at the column as we're\n // returning the start index in the string, not the end index.\n charIndex += length - 1;\n }\n }\n return charIndex;\n }\n\n public setSelection(col: number, row: number, length: number): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this._model.selectionStart = [col, row];\n this._model.selectionStartLength = length;\n this.refresh();\n this._fireEventIfSelectionChanged();\n }\n\n public rightClickSelect(ev: MouseEvent): void {\n if (!this._isClickInSelection(ev)) {\n if (this._selectWordAtCursor(ev, false)) {\n this.refresh(true);\n }\n this._fireEventIfSelectionChanged();\n }\n }\n\n /**\n * Gets positional information for the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean, followWrappedLinesAbove: boolean = true, followWrappedLinesBelow: boolean = true): IWordPosition | undefined {\n // Ensure coords are within viewport (eg. not within scroll bar)\n if (coords[0] >= this._bufferService.cols) {\n return undefined;\n }\n\n const buffer = this._bufferService.buffer;\n const bufferLine = buffer.lines.get(coords[1]);\n if (!bufferLine) {\n return undefined;\n }\n\n const line = buffer.translateBufferLineToString(coords[1], false);\n\n // Get actual index, taking into consideration wide characters\n let startIndex = this._convertViewportColToCharacterIndex(bufferLine, coords[0]);\n let endIndex = startIndex;\n\n // Record offset to be used later\n const charOffset = coords[0] - startIndex;\n let leftWideCharCount = 0;\n let rightWideCharCount = 0;\n let leftLongCharOffset = 0;\n let rightLongCharOffset = 0;\n\n if (line.charAt(startIndex) === ' ') {\n // Expand until non-whitespace is hit\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n } else {\n // Expand until whitespace is hit. This algorithm works by scanning left\n // and right from the starting position, keeping both the index format\n // (line) and the column format (bufferLine) in sync. When a wide\n // character is hit, it is recorded and the column index is adjusted.\n let startCol = coords[0];\n let endCol = coords[0];\n\n // Consider the initial position, skip it and increment the wide char\n // variable\n if (bufferLine.getWidth(startCol) === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine.getWidth(endCol) === 2) {\n rightWideCharCount++;\n endCol++;\n }\n\n // Adjust the end index for characters whose length are > 1 (emojis)\n const length = bufferLine.getString(endCol).length;\n if (length > 1) {\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n\n // Expand the string in both directions until a space is hit\n while (startCol > 0 && startIndex > 0 && !this._isCharWordSeparator(bufferLine.loadCell(startCol - 1, this._workCell))) {\n bufferLine.loadCell(startCol - 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 0) {\n // If the next character is a wide char, record it and skip the column\n leftWideCharCount++;\n startCol--;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n leftLongCharOffset += length - 1;\n startIndex -= length - 1;\n }\n startIndex--;\n startCol--;\n }\n while (endCol < bufferLine.length && endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine.loadCell(endCol + 1, this._workCell))) {\n bufferLine.loadCell(endCol + 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 2) {\n // If the next character is a wide char, record it and skip the column\n rightWideCharCount++;\n endCol++;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n endIndex++;\n endCol++;\n }\n }\n\n // Incremenet the end index so it is at the start of the next character\n endIndex++;\n\n // Calculate the start _column_, converting the the string indexes back to\n // column coordinates.\n let start =\n startIndex // The index of the selection's start char in the line string\n + charOffset // The difference between the initial char's column and index\n - leftWideCharCount // The number of wide chars left of the initial char\n + leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n\n // Calculate the length in _columns_, converting the the string indexes back\n // to column coordinates.\n let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols\n endIndex // The index of the selection's end char in the line string\n - startIndex // The index of the selection's start char in the line string\n + leftWideCharCount // The number of wide chars left of the initial char\n + rightWideCharCount // The number of wide chars right of the initial char (inclusive)\n - leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n - rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)\n\n if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {\n return undefined;\n }\n\n // Recurse upwards if the line is wrapped and the word wraps to the above line\n if (followWrappedLinesAbove) {\n if (start === 0 && bufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const previousBufferLine = buffer.lines.get(coords[1] - 1);\n if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);\n if (previousLineWordPosition) {\n const offset = this._bufferService.cols - previousLineWordPosition.start;\n start -= offset;\n length += offset;\n }\n }\n }\n }\n\n // Recurse downwards if the line is wrapped and the word wraps to the next line\n if (followWrappedLinesBelow) {\n if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const nextBufferLine = buffer.lines.get(coords[1] + 1);\n if (nextBufferLine?.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);\n if (nextLineWordPosition) {\n length += nextLineWordPosition.length;\n }\n }\n }\n }\n\n return { start, length };\n }\n\n /**\n * Selects the word at the coordinates specified.\n * @param coords The coordinates to get the word at.\n * @param allowWhitespaceOnlySelection If whitespace should be selected\n */\n protected _selectWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): void {\n const wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection);\n if (wordPosition) {\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n coords[1]--;\n }\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n }\n }\n\n /**\n * Sets the selection end to the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _selectToWordAt(coords: [number, number]): void {\n const wordPosition = this._getWordAt(coords, true);\n if (wordPosition) {\n let endRow = coords[1];\n\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n endRow--;\n }\n\n // Adjust wrapped length value, this only needs to happen when values are reversed as in that\n // case we're interested in the start of the word, not the end\n if (!this._model.areSelectionValuesReversed()) {\n while (wordPosition.start + wordPosition.length > this._bufferService.cols) {\n wordPosition.length -= this._bufferService.cols;\n endRow++;\n }\n }\n\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : wordPosition.start + wordPosition.length, endRow];\n }\n }\n\n /**\n * Gets whether the character is considered a word separator by the select\n * word logic.\n * @param cell The cell to check.\n */\n private _isCharWordSeparator(cell: CellData): boolean {\n // Zero width characters are never separators as they are always to the\n // right of wide characters\n if (cell.getWidth() === 0) {\n return false;\n }\n return this._optionsService.rawOptions.wordSeparator.indexOf(cell.getChars()) >= 0;\n }\n\n /**\n * Selects the line specified.\n * @param line The line index.\n */\n protected _selectLineAt(line: number): void {\n const wrappedRange = this._bufferService.buffer.getWrappedRangeForLine(line);\n const range: IBufferRange = {\n start: { x: 0, y: wrappedRange.first },\n end: { x: this._bufferService.cols - 1, y: wrappedRange.last }\n };\n this._model.selectionStart = [0, wrappedRange.first];\n this._model.selectionEnd = undefined;\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';\nimport { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { AllColorIndex, IDisposable } from 'common/Types';\nimport type { Event } from 'vs/base/common/event';\n\nexport const ICharSizeService = createDecorator('CharSizeService');\nexport interface ICharSizeService {\n serviceBrand: undefined;\n\n readonly width: number;\n readonly height: number;\n readonly hasValidSize: boolean;\n\n readonly onCharSizeChange: Event;\n\n measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator('CoreBrowserService');\nexport interface ICoreBrowserService {\n serviceBrand: undefined;\n\n readonly isFocused: boolean;\n\n readonly onDprChange: Event;\n readonly onWindowChange: Event;\n\n /**\n * Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.\n * requestAnimationFrame) should be invoked in the context of this window. This should be set when\n * the window hosting the xterm.js instance changes.\n */\n window: Window & typeof globalThis;\n /**\n * The document of the primary window to be used to create elements when working with multiple\n * windows. This is defined by the documentOverride setting.\n */\n readonly mainDocument: Document;\n /**\n * Helper for getting the devicePixelRatio of the parent window.\n */\n readonly dpr: number;\n}\n\nexport const IMouseService = createDecorator('MouseService');\nexport interface IMouseService {\n serviceBrand: undefined;\n\n getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined;\n getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined;\n}\n\nexport const IRenderService = createDecorator('RenderService');\nexport interface IRenderService extends IDisposable {\n serviceBrand: undefined;\n\n onDimensionsChange: Event;\n /**\n * Fires when buffer changes are rendered. This does not fire when only cursor\n * or selections are rendered.\n */\n onRenderedViewportChange: Event<{ start: number, end: number }>;\n /**\n * Fires on render\n */\n onRender: Event<{ start: number, end: number }>;\n onRefreshRequest: Event<{ start: number, end: number }>;\n\n dimensions: IRenderDimensions;\n\n addRefreshCallback(callback: FrameRequestCallback): number;\n\n refreshRows(start: number, end: number): void;\n clearTextureAtlas(): void;\n resize(cols: number, rows: number): void;\n hasRenderer(): boolean;\n setRenderer(renderer: IRenderer): void;\n handleDevicePixelRatioChange(): void;\n handleResize(cols: number, rows: number): void;\n handleCharSizeChanged(): void;\n handleBlur(): void;\n handleFocus(): void;\n handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void;\n handleCursorMove(): void;\n clear(): void;\n}\n\nexport const ISelectionService = createDecorator('SelectionService');\nexport interface ISelectionService {\n serviceBrand: undefined;\n\n readonly selectionText: string;\n readonly hasSelection: boolean;\n readonly selectionStart: [number, number] | undefined;\n readonly selectionEnd: [number, number] | undefined;\n\n readonly onLinuxMouseSelection: Event;\n readonly onRequestRedraw: Event;\n readonly onRequestScrollLines: Event;\n readonly onSelectionChange: Event;\n\n disable(): void;\n enable(): void;\n reset(): void;\n setSelection(row: number, col: number, length: number): void;\n selectAll(): void;\n selectLines(start: number, end: number): void;\n clearSelection(): void;\n rightClickSelect(event: MouseEvent): void;\n shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;\n shouldForceSelection(event: MouseEvent): boolean;\n refresh(isLinuxMouseSelection?: boolean): void;\n handleMouseDown(event: MouseEvent): void;\n isCellInSelection(x: number, y: number): boolean;\n}\n\nexport const ICharacterJoinerService = createDecorator('CharacterJoinerService');\nexport interface ICharacterJoinerService {\n serviceBrand: undefined;\n\n register(handler: (text: string) => [number, number][]): number;\n deregister(joinerId: number): boolean;\n getJoinedCharacters(row: number): [number, number][];\n}\n\nexport const IThemeService = createDecorator('ThemeService');\nexport interface IThemeService {\n serviceBrand: undefined;\n\n readonly colors: ReadonlyColorSet;\n\n readonly onChangeColors: Event;\n\n restoreColor(slot?: AllColorIndex): void;\n /**\n * Allows external modifying of colors in the theme, this is used instead of {@link colors} to\n * prevent accidental writes.\n */\n modifyColors(callback: (colors: IColorSet) => void): void;\n}\n\n\nexport const ILinkProviderService = createDecorator('LinkProviderService');\nexport interface ILinkProviderService extends IDisposable {\n serviceBrand: undefined;\n readonly linkProviders: ReadonlyArray;\n registerLinkProvider(linkProvider: ILinkProvider): IDisposable;\n}\nexport interface ILinkProvider {\n provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void;\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ColorContrastCache } from 'browser/ColorContrastCache';\nimport { IThemeService } from 'browser/services/Services';\nimport { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';\nimport { color, css, NULL_COLOR } from 'common/Color';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IOptionsService, ITheme } from 'common/services/Services';\nimport { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';\nimport { Emitter } from 'vs/base/common/event';\n\ninterface IRestoreColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n ansi: IColor[];\n}\n\n\nconst DEFAULT_FOREGROUND = css.toColor('#ffffff');\nconst DEFAULT_BACKGROUND = css.toColor('#000000');\nconst DEFAULT_CURSOR = css.toColor('#ffffff');\nconst DEFAULT_CURSOR_ACCENT = DEFAULT_BACKGROUND;\nconst DEFAULT_SELECTION = {\n css: 'rgba(255, 255, 255, 0.3)',\n rgba: 0xFFFFFF4D\n};\nconst DEFAULT_OVERVIEW_RULER_BORDER = DEFAULT_FOREGROUND;\n\nexport class ThemeService extends Disposable implements IThemeService {\n public serviceBrand: undefined;\n\n private _colors: IColorSet;\n private _contrastCache: IColorContrastCache = new ColorContrastCache();\n private _halfContrastCache: IColorContrastCache = new ColorContrastCache();\n private _restoreColors!: IRestoreColorSet;\n\n public get colors(): ReadonlyColorSet { return this._colors; }\n\n private readonly _onChangeColors = this._register(new Emitter());\n public readonly onChangeColors = this._onChangeColors.event;\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n\n this._colors = {\n foreground: DEFAULT_FOREGROUND,\n background: DEFAULT_BACKGROUND,\n cursor: DEFAULT_CURSOR,\n cursorAccent: DEFAULT_CURSOR_ACCENT,\n selectionForeground: undefined,\n selectionBackgroundTransparent: DEFAULT_SELECTION,\n selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,\n selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n scrollbarSliderBackground: color.opacity(DEFAULT_FOREGROUND, 0.2),\n scrollbarSliderHoverBackground: color.opacity(DEFAULT_FOREGROUND, 0.4),\n scrollbarSliderActiveBackground: color.opacity(DEFAULT_FOREGROUND, 0.5),\n overviewRulerBorder: DEFAULT_FOREGROUND,\n ansi: DEFAULT_ANSI_COLORS.slice(),\n contrastCache: this._contrastCache,\n halfContrastCache: this._halfContrastCache\n };\n this._updateRestoreColors();\n this._setTheme(this._optionsService.rawOptions.theme);\n\n this._register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));\n this._register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));\n }\n\n /**\n * Sets the terminal's theme.\n * @param theme The theme to use. If a partial theme is provided then default\n * colors will be used where colors are not defined.\n */\n private _setTheme(theme: ITheme = {}): void {\n const colors = this._colors;\n colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND);\n colors.background = parseColor(theme.background, DEFAULT_BACKGROUND);\n colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR);\n colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT);\n colors.selectionBackgroundTransparent = parseColor(theme.selectionBackground, DEFAULT_SELECTION);\n colors.selectionBackgroundOpaque = color.blend(colors.background, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundTransparent = parseColor(theme.selectionInactiveBackground, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundOpaque = color.blend(colors.background, colors.selectionInactiveBackgroundTransparent);\n colors.selectionForeground = theme.selectionForeground ? parseColor(theme.selectionForeground, NULL_COLOR) : undefined;\n if (colors.selectionForeground === NULL_COLOR) {\n colors.selectionForeground = undefined;\n }\n\n /**\n * If selection color is opaque, blend it with background with 0.3 opacity\n * Issue #2737\n */\n if (color.isOpaque(colors.selectionBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionBackgroundTransparent = color.opacity(colors.selectionBackgroundTransparent, opacity);\n }\n if (color.isOpaque(colors.selectionInactiveBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);\n }\n colors.scrollbarSliderBackground = parseColor(theme.scrollbarSliderBackground, color.opacity(colors.foreground, 0.2));\n colors.scrollbarSliderHoverBackground = parseColor(theme.scrollbarSliderHoverBackground, color.opacity(colors.foreground, 0.4));\n colors.scrollbarSliderActiveBackground = parseColor(theme.scrollbarSliderActiveBackground, color.opacity(colors.foreground, 0.5));\n colors.overviewRulerBorder = parseColor(theme.overviewRulerBorder, DEFAULT_OVERVIEW_RULER_BORDER);\n colors.ansi = DEFAULT_ANSI_COLORS.slice();\n colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);\n colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);\n colors.ansi[2] = parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);\n colors.ansi[3] = parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);\n colors.ansi[4] = parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);\n colors.ansi[5] = parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);\n colors.ansi[6] = parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);\n colors.ansi[7] = parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);\n colors.ansi[8] = parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);\n colors.ansi[9] = parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);\n colors.ansi[10] = parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);\n colors.ansi[11] = parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);\n colors.ansi[12] = parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);\n colors.ansi[13] = parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);\n colors.ansi[14] = parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);\n colors.ansi[15] = parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);\n if (theme.extendedAnsi) {\n const colorCount = Math.min(colors.ansi.length - 16, theme.extendedAnsi.length);\n for (let i = 0; i < colorCount; i++) {\n colors.ansi[i + 16] = parseColor(theme.extendedAnsi[i], DEFAULT_ANSI_COLORS[i + 16]);\n }\n }\n // Clear our the cache\n this._contrastCache.clear();\n this._halfContrastCache.clear();\n this._updateRestoreColors();\n this._onChangeColors.fire(this.colors);\n }\n\n public restoreColor(slot?: AllColorIndex): void {\n this._restoreColor(slot);\n this._onChangeColors.fire(this.colors);\n }\n\n private _restoreColor(slot: AllColorIndex | undefined): void {\n // unset slot restores all ansi colors\n if (slot === undefined) {\n for (let i = 0; i < this._restoreColors.ansi.length; ++i) {\n this._colors.ansi[i] = this._restoreColors.ansi[i];\n }\n return;\n }\n switch (slot) {\n case SpecialColorIndex.FOREGROUND:\n this._colors.foreground = this._restoreColors.foreground;\n break;\n case SpecialColorIndex.BACKGROUND:\n this._colors.background = this._restoreColors.background;\n break;\n case SpecialColorIndex.CURSOR:\n this._colors.cursor = this._restoreColors.cursor;\n break;\n default:\n this._colors.ansi[slot] = this._restoreColors.ansi[slot];\n }\n }\n\n public modifyColors(callback: (colors: IColorSet) => void): void {\n callback(this._colors);\n // Assume the change happened\n this._onChangeColors.fire(this.colors);\n }\n\n private _updateRestoreColors(): void {\n this._restoreColors = {\n foreground: this._colors.foreground,\n background: this._colors.background,\n cursor: this._colors.cursor,\n ansi: this._colors.ansi.slice()\n };\n }\n}\n\nfunction parseColor(\n cssString: string | undefined,\n fallback: IColor\n): IColor {\n if (cssString !== undefined) {\n try {\n return css.toColor(cssString);\n } catch {\n // no-op\n }\n }\n return fallback;\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICircularList } from 'common/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\nexport interface IInsertEvent {\n index: number;\n amount: number;\n}\n\nexport interface IDeleteEvent {\n index: number;\n amount: number;\n}\n\n/**\n * Represents a circular list; a list with a maximum size that wraps around when push is called,\n * overriding values at the start of the list.\n */\nexport class CircularList extends Disposable implements ICircularList {\n protected _array: (T | undefined)[];\n private _startIndex: number;\n private _length: number;\n\n public readonly onDeleteEmitter = this._register(new Emitter());\n public readonly onDelete = this.onDeleteEmitter.event;\n public readonly onInsertEmitter = this._register(new Emitter());\n public readonly onInsert = this.onInsertEmitter.event;\n public readonly onTrimEmitter = this._register(new Emitter());\n public readonly onTrim = this.onTrimEmitter.event;\n\n constructor(\n private _maxLength: number\n ) {\n super();\n this._array = new Array(this._maxLength);\n this._startIndex = 0;\n this._length = 0;\n }\n\n public get maxLength(): number {\n return this._maxLength;\n }\n\n public set maxLength(newMaxLength: number) {\n // There was no change in maxLength, return early.\n if (this._maxLength === newMaxLength) {\n return;\n }\n\n // Reconstruct array, starting at index 0. Only transfer values from the\n // indexes 0 to length.\n const newArray = new Array(newMaxLength);\n for (let i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._maxLength = newMaxLength;\n this._startIndex = 0;\n }\n\n public get length(): number {\n return this._length;\n }\n\n public set length(newLength: number) {\n if (newLength > this._length) {\n for (let i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n }\n\n /**\n * Gets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index of the value to get.\n * @returns The value corresponding to the index.\n */\n public get(index: number): T | undefined {\n return this._array[this._getCyclicIndex(index)];\n }\n\n /**\n * Sets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index to set.\n * @param value The value to set.\n */\n public set(index: number, value: T | undefined): void {\n this._array[this._getCyclicIndex(index)] = value;\n }\n\n /**\n * Pushes a new value onto the list, wrapping around to the start of the array, overriding index 0\n * if the maximum length is reached.\n * @param value The value to push onto the list.\n */\n public push(value: T): void {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this._maxLength) {\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n } else {\n this._length++;\n }\n }\n\n /**\n * Advance ringbuffer index and return current element for recycling.\n * Note: The buffer must be full for this method to work.\n * @throws When the buffer is not full.\n */\n public recycle(): T {\n if (this._length !== this._maxLength) {\n throw new Error('Can only recycle when the buffer is full');\n }\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n return this._array[this._getCyclicIndex(this._length - 1)]!;\n }\n\n /**\n * Ringbuffer is at max length.\n */\n public get isFull(): boolean {\n return this._length === this._maxLength;\n }\n\n /**\n * Removes and returns the last value on the list.\n * @returns The popped value.\n */\n public pop(): T | undefined {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n }\n\n /**\n * Deletes and/or inserts items at a particular index (in that order). Unlike\n * Array.prototype.splice, this operation does not return the deleted items as a new array in\n * order to save creating a new array. Note that this operation may shift all values in the list\n * in the worst case.\n * @param start The index to delete and/or insert.\n * @param deleteCount The number of elements to delete.\n * @param items The items to insert.\n */\n public splice(start: number, deleteCount: number, ...items: T[]): void {\n // Delete items\n if (deleteCount) {\n for (let i = start; i < this._length - deleteCount; i++) {\n this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];\n }\n this._length -= deleteCount;\n this.onDeleteEmitter.fire({ index: start, amount: deleteCount });\n }\n\n // Add items\n for (let i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (let i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (items.length) {\n this.onInsertEmitter.fire({ index: start, amount: items.length });\n }\n\n // Adjust length as needed\n if (this._length + items.length > this._maxLength) {\n const countToTrim = (this._length + items.length) - this._maxLength;\n this._startIndex += countToTrim;\n this._length = this._maxLength;\n this.onTrimEmitter.fire(countToTrim);\n } else {\n this._length += items.length;\n }\n }\n\n /**\n * Trims a number of items from the start of the list.\n * @param count The number of items to remove.\n */\n public trimStart(count: number): void {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.onTrimEmitter.fire(count);\n }\n\n public shiftElements(start: number, count: number, offset: number): void {\n if (count <= 0) {\n return;\n }\n if (start < 0 || start >= this._length) {\n throw new Error('start argument out of range');\n }\n if (start + offset < 0) {\n throw new Error('Cannot shift elements in list beyond index 0');\n }\n\n if (offset > 0) {\n for (let i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n const expandListBy = (start + count + offset) - this._length;\n if (expandListBy > 0) {\n this._length += expandListBy;\n while (this._length > this._maxLength) {\n this._length--;\n this._startIndex++;\n this.onTrimEmitter.fire(1);\n }\n }\n } else {\n for (let i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n }\n\n /**\n * Gets the cyclic index for the specified regular index. The cyclic index can then be used on the\n * backing array to get the element associated with the regular index.\n * @param index The regular index.\n * @returns The cyclic index.\n */\n private _getCyclicIndex(index: number): number {\n return (this._startIndex + index) % this._maxLength;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/*\n * A simple utility for cloning values\n */\nexport function clone(val: T, depth: number = 5): T {\n if (typeof val !== 'object') {\n return val;\n }\n\n // If we're cloning an array, use an array as the base, otherwise use an object\n const clonedObject: any = Array.isArray(val) ? [] : {};\n\n for (const key in val) {\n // Recursively clone eack item unless we're at the maximum depth\n clonedObject[key] = depth <= 1 ? val[key] : (val[key] && clone(val[key], depth - 1));\n }\n\n return clonedObject as T;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColor, IColorRGB } from 'common/Types';\n\nlet $r = 0;\nlet $g = 0;\nlet $b = 0;\nlet $a = 0;\n\nexport const NULL_COLOR: IColor = {\n css: '#00000000',\n rgba: 0\n};\n\n/**\n * Helper functions where the source type is \"channels\" (individual color channels as numbers).\n */\nexport namespace channels {\n export function toCss(r: number, g: number, b: number, a?: number): string {\n if (a !== undefined) {\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}${toPaddedHex(a)}`;\n }\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}`;\n }\n\n export function toRgba(r: number, g: number, b: number, a: number = 0xFF): number {\n // Note: The aggregated number is RGBA32 (BE), thus needs to be converted to ABGR32\n // on LE systems, before it can be used for direct 32-bit buffer writes.\n // >>> 0 forces an unsigned int\n return (r << 24 | g << 16 | b << 8 | a) >>> 0;\n }\n\n export function toColor(r: number, g: number, b: number, a?: number): IColor {\n return {\n css: channels.toCss(r, g, b, a),\n rgba: channels.toRgba(r, g, b, a)\n };\n }\n}\n\n/**\n * Helper functions where the source type is `IColor`.\n */\nexport namespace color {\n export function blend(bg: IColor, fg: IColor): IColor {\n $a = (fg.rgba & 0xFF) / 255;\n if ($a === 1) {\n return {\n css: fg.css,\n rgba: fg.rgba\n };\n }\n const fgR = (fg.rgba >> 24) & 0xFF;\n const fgG = (fg.rgba >> 16) & 0xFF;\n const fgB = (fg.rgba >> 8) & 0xFF;\n const bgR = (bg.rgba >> 24) & 0xFF;\n const bgG = (bg.rgba >> 16) & 0xFF;\n const bgB = (bg.rgba >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n const css = channels.toCss($r, $g, $b);\n const rgba = channels.toRgba($r, $g, $b);\n return { css, rgba };\n }\n\n export function isOpaque(color: IColor): boolean {\n return (color.rgba & 0xFF) === 0xFF;\n }\n\n export function ensureContrastRatio(bg: IColor, fg: IColor, ratio: number): IColor | undefined {\n const result = rgba.ensureContrastRatio(bg.rgba, fg.rgba, ratio);\n if (!result) {\n return undefined;\n }\n return channels.toColor(\n (result >> 24 & 0xFF),\n (result >> 16 & 0xFF),\n (result >> 8 & 0xFF)\n );\n }\n\n export function opaque(color: IColor): IColor {\n const rgbaColor = (color.rgba | 0xFF) >>> 0;\n [$r, $g, $b] = rgba.toChannels(rgbaColor);\n return {\n css: channels.toCss($r, $g, $b),\n rgba: rgbaColor\n };\n }\n\n export function opacity(color: IColor, opacity: number): IColor {\n $a = Math.round(opacity * 0xFF);\n [$r, $g, $b] = rgba.toChannels(color.rgba);\n return {\n css: channels.toCss($r, $g, $b, $a),\n rgba: channels.toRgba($r, $g, $b, $a)\n };\n }\n\n export function multiplyOpacity(color: IColor, factor: number): IColor {\n $a = color.rgba & 0xFF;\n return opacity(color, ($a * factor) / 0xFF);\n }\n\n export function toColorRGB(color: IColor): IColorRGB {\n return [(color.rgba >> 24) & 0xFF, (color.rgba >> 16) & 0xFF, (color.rgba >> 8) & 0xFF];\n }\n}\n\n/**\n * Helper functions where the source type is \"css\" (string: '#rgb', '#rgba', '#rrggbb',\n * '#rrggbbaa').\n */\nexport namespace css {\n // Attempt to set get the shared canvas context\n let $ctx: CanvasRenderingContext2D | undefined;\n let $litmusColor: CanvasGradient | undefined;\n try {\n // This is guaranteed to run in the first window, so document should be correct\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext('2d', {\n willReadFrequently: true\n });\n if (ctx) {\n $ctx = ctx;\n $ctx.globalCompositeOperation = 'copy';\n $litmusColor = $ctx.createLinearGradient(0, 0, 1, 1);\n }\n }\n catch {\n // noop\n }\n\n /**\n * Converts a css string to an IColor, this should handle all valid CSS color strings and will\n * throw if it's invalid. The ideal format to use is `#rrggbb[aa]` as it's the fastest to parse.\n *\n * Only `#rgb[a]`, `#rrggbb[aa]`, `rgb()` and `rgba()` formats are supported when run in a Node\n * environment.\n */\n export function toColor(css: string): IColor {\n // Formats: #rgb[a] and #rrggbb[aa]\n if (css.match(/#[\\da-f]{3,8}/i)) {\n switch (css.length) {\n case 4: { // #rgb\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n return channels.toColor($r, $g, $b);\n }\n case 5: { // #rgba\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n $a = parseInt(css.slice(4, 5).repeat(2), 16);\n return channels.toColor($r, $g, $b, $a);\n }\n case 7: // #rrggbb\n return {\n css,\n rgba: (parseInt(css.slice(1), 16) << 8 | 0xFF) >>> 0\n };\n case 9: // #rrggbbaa\n return {\n css,\n rgba: parseInt(css.slice(1), 16) >>> 0\n };\n }\n }\n\n // Formats: rgb() or rgba()\n const rgbaMatch = css.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);\n if (rgbaMatch) {\n $r = parseInt(rgbaMatch[1]);\n $g = parseInt(rgbaMatch[2]);\n $b = parseInt(rgbaMatch[3]);\n $a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);\n return channels.toColor($r, $g, $b, $a);\n }\n\n // Validate the context is available for canvas-based color parsing\n if (!$ctx || !$litmusColor) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Validate the color using canvas fillStyle\n // See https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles\n $ctx.fillStyle = $litmusColor;\n $ctx.fillStyle = css;\n if (typeof $ctx.fillStyle !== 'string') {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n $ctx.fillRect(0, 0, 1, 1);\n [$r, $g, $b, $a] = $ctx.getImageData(0, 0, 1, 1).data;\n\n // Validate the color is non-transparent as color hue gets lost when drawn to the canvas\n if ($a !== 0xFF) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Extract the color from the canvas' fillStyle property which exposes the color value in rgba()\n // format\n // See https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color\n return {\n rgba: channels.toRgba($r, $g, $b, $a),\n css\n };\n }\n}\n\n/**\n * Helper functions where the source type is \"rgb\" (number: 0xrrggbb).\n */\nexport namespace rgb {\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param rgb The color to use.\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance(rgb: number): number {\n return relativeLuminance2(\n (rgb >> 16) & 0xFF,\n (rgb >> 8 ) & 0xFF,\n (rgb ) & 0xFF);\n }\n\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param r The red channel (0x00 to 0xFF).\n * @param g The green channel (0x00 to 0xFF).\n * @param b The blue channel (0x00 to 0xFF).\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance2(r: number, g: number, b: number): number {\n const rs = r / 255;\n const gs = g / 255;\n const bs = b / 255;\n const rr = rs <= 0.03928 ? rs / 12.92 : Math.pow((rs + 0.055) / 1.055, 2.4);\n const rg = gs <= 0.03928 ? gs / 12.92 : Math.pow((gs + 0.055) / 1.055, 2.4);\n const rb = bs <= 0.03928 ? bs / 12.92 : Math.pow((bs + 0.055) / 1.055, 2.4);\n return rr * 0.2126 + rg * 0.7152 + rb * 0.0722;\n }\n}\n\n/**\n * Helper functions where the source type is \"rgba\" (number: 0xrrggbbaa).\n */\nexport namespace rgba {\n export function blend(bg: number, fg: number): number {\n $a = (fg & 0xFF) / 0xFF;\n if ($a === 1) {\n return fg;\n }\n const fgR = (fg >> 24) & 0xFF;\n const fgG = (fg >> 16) & 0xFF;\n const fgB = (fg >> 8) & 0xFF;\n const bgR = (bg >> 24) & 0xFF;\n const bgG = (bg >> 16) & 0xFF;\n const bgB = (bg >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n return channels.toRgba($r, $g, $b);\n }\n\n /**\n * Given a foreground color and a background color, either increase or reduce the luminance of the\n * foreground color until the specified contrast ratio is met. If pure white or black is hit\n * without the contrast ratio being met, go the other direction using the background color as the\n * foreground color and take either the first or second result depending on which has the higher\n * contrast ratio.\n *\n * `undefined` will be returned if the contrast ratio is already met.\n *\n * @param bgRgba The background color in rgba format.\n * @param fgRgba The foreground color in rgba format.\n * @param ratio The contrast ratio to achieve.\n */\n export function ensureContrastRatio(bgRgba: number, fgRgba: number, ratio: number): number | undefined {\n const bgL = rgb.relativeLuminance(bgRgba >> 8);\n const fgL = rgb.relativeLuminance(fgRgba >> 8);\n const cr = contrastRatio(bgL, fgL);\n if (cr < ratio) {\n if (fgL < bgL) {\n const resultA = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n const resultA = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n return undefined;\n }\n\n export function reduceLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to reducing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR > 0 || fgG > 0 || fgB > 0)) {\n // Reduce by 10% until the ratio is hit\n fgR -= Math.max(0, Math.ceil(fgR * 0.1));\n fgG -= Math.max(0, Math.ceil(fgG * 0.1));\n fgB -= Math.max(0, Math.ceil(fgB * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function increaseLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to increasing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR < 0xFF || fgG < 0xFF || fgB < 0xFF)) {\n // Increase by 10% until the ratio is hit\n fgR = Math.min(0xFF, fgR + Math.ceil((255 - fgR) * 0.1));\n fgG = Math.min(0xFF, fgG + Math.ceil((255 - fgG) * 0.1));\n fgB = Math.min(0xFF, fgB + Math.ceil((255 - fgB) * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function toChannels(value: number): [number, number, number, number] {\n return [(value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF];\n }\n}\n\nexport function toPaddedHex(c: number): string {\n const s = c.toString(16);\n return s.length < 2 ? '0' + s : s;\n}\n\n/**\n * Gets the contrast ratio between two relative luminance values.\n * @param l1 The first relative luminance.\n * @param l2 The first relative luminance.\n * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef\n */\nexport function contrastRatio(l1: number, l2: number): number {\n if (l1 < l2) {\n return (l2 + 0.05) / (l1 + 0.05);\n }\n return (l1 + 0.05) / (l2 + 0.05);\n}\n","/**\n * Copyright (c) 2014-2020 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from 'common/services/Services';\nimport { InstantiationService } from 'common/services/InstantiationService';\nimport { LogService } from 'common/services/LogService';\nimport { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';\nimport { OptionsService } from 'common/services/OptionsService';\nimport { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';\nimport { CoreService } from 'common/services/CoreService';\nimport { CoreMouseService } from 'common/services/CoreMouseService';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { CharsetService } from 'common/services/CharsetService';\nimport { updateWindowsModeWrappedState } from 'common/WindowsMode';\nimport { IFunctionIdentifier, IParams } from 'common/parser/Types';\nimport { IBufferSet } from 'common/buffer/Types';\nimport { InputHandler } from 'common/InputHandler';\nimport { WriteBuffer } from 'common/input/WriteBuffer';\nimport { OscLinkService } from 'common/services/OscLinkService';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\n// Only trigger this warning a single time per session\nlet hasWriteSyncWarnHappened = false;\n\nexport abstract class CoreTerminal extends Disposable implements ICoreTerminal {\n protected readonly _instantiationService: IInstantiationService;\n protected readonly _bufferService: IBufferService;\n protected readonly _logService: ILogService;\n protected readonly _charsetService: ICharsetService;\n protected readonly _oscLinkService: IOscLinkService;\n\n public readonly coreMouseService: ICoreMouseService;\n public readonly coreService: ICoreService;\n public readonly unicodeService: IUnicodeService;\n public readonly optionsService: IOptionsService;\n\n protected _inputHandler: InputHandler;\n private _writeBuffer: WriteBuffer;\n private _windowsWrappingHeuristics = this._register(new MutableDisposable());\n\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n protected _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n protected readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n /**\n * Internally we track the source of the scroll but this is meaningless outside the library so\n * it's filtered out.\n */\n protected _onScrollApi?: Emitter;\n protected _onScroll = this._register(new Emitter());\n public get onScroll(): Event {\n if (!this._onScrollApi) {\n this._onScrollApi = this._register(new Emitter());\n this._onScroll.event(ev => {\n this._onScrollApi?.fire(ev.position);\n });\n }\n return this._onScrollApi.event;\n }\n\n public get cols(): number { return this._bufferService.cols; }\n public get rows(): number { return this._bufferService.rows; }\n public get buffers(): IBufferSet { return this._bufferService.buffers; }\n public get options(): Required { return this.optionsService.options; }\n public set options(options: ITerminalOptions) {\n for (const key in options) {\n this.optionsService.options[key] = options[key];\n }\n }\n\n constructor(\n options: Partial\n ) {\n super();\n\n // Setup and initialize services\n this._instantiationService = new InstantiationService();\n this.optionsService = this._register(new OptionsService(options));\n this._instantiationService.setService(IOptionsService, this.optionsService);\n this._bufferService = this._register(this._instantiationService.createInstance(BufferService));\n this._instantiationService.setService(IBufferService, this._bufferService);\n this._logService = this._register(this._instantiationService.createInstance(LogService));\n this._instantiationService.setService(ILogService, this._logService);\n this.coreService = this._register(this._instantiationService.createInstance(CoreService));\n this._instantiationService.setService(ICoreService, this.coreService);\n this.coreMouseService = this._register(this._instantiationService.createInstance(CoreMouseService));\n this._instantiationService.setService(ICoreMouseService, this.coreMouseService);\n this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));\n this._instantiationService.setService(IUnicodeService, this.unicodeService);\n this._charsetService = this._instantiationService.createInstance(CharsetService);\n this._instantiationService.setService(ICharsetService, this._charsetService);\n this._oscLinkService = this._instantiationService.createInstance(OscLinkService);\n this._instantiationService.setService(IOscLinkService, this._oscLinkService);\n\n\n // Register input handler and handle/forward events\n this._inputHandler = this._register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));\n this._register(Event.forward(this._inputHandler.onLineFeed, this._onLineFeed));\n this._register(this._inputHandler);\n\n // Setup listeners\n this._register(Event.forward(this._bufferService.onResize, this._onResize));\n this._register(Event.forward(this.coreService.onData, this._onData));\n this._register(Event.forward(this.coreService.onBinary, this._onBinary));\n this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));\n this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));\n this._register(this.optionsService.onMultipleOptionChange(['windowsMode', 'windowsPty'], () => this._handleWindowsPtyOptionChange()));\n this._register(this._bufferService.onScroll(() => {\n this._onScroll.fire({ position: this._bufferService.buffer.ydisp });\n this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);\n }));\n // Setup WriteBuffer\n this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));\n this._register(Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._writeBuffer.write(data, callback);\n }\n\n /**\n * Write data to terminal synchonously.\n *\n * This method is unreliable with async parser handlers, thus should not\n * be used anymore. If you need blocking semantics on data input consider\n * `write` with a callback instead.\n *\n * @deprecated Unreliable, will be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n if (this._logService.logLevel <= LogLevelEnum.WARN && !hasWriteSyncWarnHappened) {\n this._logService.warn('writeSync is unreliable and will be removed soon.');\n hasWriteSyncWarnHappened = true;\n }\n this._writeBuffer.writeSync(data, maxSubsequentCalls);\n }\n\n public input(data: string, wasUserInput: boolean = true): void {\n this.coreService.triggerDataEvent(data, wasUserInput);\n }\n\n public resize(x: number, y: number): void {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n x = Math.max(x, MINIMUM_COLS);\n y = Math.max(y, MINIMUM_ROWS);\n\n this._bufferService.resize(x, y);\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n this._bufferService.scroll(eraseAttr, isWrapped);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used to avoid\n * unwanted events being handled by the viewport when the event was triggered from the viewport\n * originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n this._bufferService.scrollLines(disp, suppressScrollEvent);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n /** Add handler for ESC escape sequence. See xterm.d.ts for details. */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._inputHandler.registerEscHandler(id, callback);\n }\n\n /** Add handler for DCS escape sequence. See xterm.d.ts for details. */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerDcsHandler(id, callback);\n }\n\n /** Add handler for CSI escape sequence. See xterm.d.ts for details. */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerCsiHandler(id, callback);\n }\n\n /** Add handler for OSC escape sequence. See xterm.d.ts for details. */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._inputHandler.registerOscHandler(ident, callback);\n }\n\n protected _setup(): void {\n this._handleWindowsPtyOptionChange();\n }\n\n public reset(): void {\n this._inputHandler.reset();\n this._bufferService.reset();\n this._charsetService.reset();\n this.coreService.reset();\n this.coreMouseService.reset();\n }\n\n\n private _handleWindowsPtyOptionChange(): void {\n let value = false;\n const windowsPty = this.optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber !== undefined && windowsPty.buildNumber !== undefined) {\n value = !!(windowsPty.backend === 'conpty' && windowsPty.buildNumber < 21376);\n } else if (this.optionsService.rawOptions.windowsMode) {\n value = true;\n }\n if (value) {\n this._enableWindowsWrappingHeuristics();\n } else {\n this._windowsWrappingHeuristics.clear();\n }\n }\n\n protected _enableWindowsWrappingHeuristics(): void {\n if (!this._windowsWrappingHeuristics.value) {\n const disposables: IDisposable[] = [];\n disposables.push(this.onLineFeed(updateWindowsModeWrappedState.bind(null, this._bufferService)));\n disposables.push(this.registerCsiHandler({ final: 'H' }, () => {\n updateWindowsModeWrappedState(this._bufferService);\n return false;\n }));\n this._windowsWrappingHeuristics.value = toDisposable(() => {\n for (const d of disposables) {\n d.dispose();\n }\n });\n }\n }\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from 'common/Types';\nimport { C0, C1 } from 'common/data/EscapeSequences';\nimport { CHARSETS, DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from 'common/input/TextDecoder';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from 'common/parser/Types';\nimport { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { ICoreService, IBufferService, IOptionsService, ILogService, ICoreMouseService, ICharsetService, IUnicodeService, LogLevelEnum, IOscLinkService } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { OscHandler } from 'common/parser/OscParser';\nimport { DcsHandler } from 'common/parser/DcsParser';\nimport { IBuffer } from 'common/buffer/Types';\nimport { parseColor } from 'common/input/XParseColor';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * Map collect to glevel. Used in `selectCharset`.\n */\nconst GLEVEL: { [key: string]: number } = { '(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2 };\n\n/**\n * VT commands done by the parser - FIXME: move this to the parser?\n */\n// @vt: #Y ESC CSI \"Control Sequence Introducer\" \"ESC [\" \"Start of a CSI sequence.\"\n// @vt: #Y ESC OSC \"Operating System Command\" \"ESC ]\" \"Start of an OSC sequence.\"\n// @vt: #Y ESC DCS \"Device Control String\" \"ESC P\" \"Start of a DCS sequence.\"\n// @vt: #Y ESC ST \"String Terminator\" \"ESC \\\" \"Terminator used for string type sequences.\"\n// @vt: #Y ESC PM \"Privacy Message\" \"ESC ^\" \"Start of a privacy message.\"\n// @vt: #Y ESC APC \"Application Program Command\" \"ESC _\" \"Start of an APC sequence.\"\n// @vt: #Y C1 CSI \"Control Sequence Introducer\" \"\\x9B\" \"Start of a CSI sequence.\"\n// @vt: #Y C1 OSC \"Operating System Command\" \"\\x9D\" \"Start of an OSC sequence.\"\n// @vt: #Y C1 DCS \"Device Control String\" \"\\x90\" \"Start of a DCS sequence.\"\n// @vt: #Y C1 ST \"String Terminator\" \"\\x9C\" \"Terminator used for string type sequences.\"\n// @vt: #Y C1 PM \"Privacy Message\" \"\\x9E\" \"Start of a privacy message.\"\n// @vt: #Y C1 APC \"Application Program Command\" \"\\x9F\" \"Start of an APC sequence.\"\n// @vt: #Y C0 NUL \"Null\" \"\\0, \\x00\" \"NUL is ignored.\"\n// @vt: #Y C0 ESC \"Escape\" \"\\e, \\x1B\" \"Start of a sequence. Cancels any other sequence.\"\n\n/**\n * Document xterm VT features here that are currently unsupported\n */\n// @vt: #E[Supported via @xterm/addon-image.] DCS SIXEL \"SIXEL Graphics\" \"DCS Ps ; Ps ; Ps ; q \tPt ST\" \"Draw SIXEL image.\"\n// @vt: #N DCS DECUDK \"User Defined Keys\" \"DCS Ps ; Ps \\| Pt ST\" \"Definitions for user-defined keys.\"\n// @vt: #N DCS XTGETTCAP \"Request Terminfo String\" \"DCS + q Pt ST\" \"Request Terminfo String.\"\n// @vt: #N DCS XTSETTCAP \"Set Terminfo Data\" \"DCS + p Pt ST\" \"Set Terminfo Data.\"\n// @vt: #N OSC 1 \"Set Icon Name\" \"OSC 1 ; Pt BEL\" \"Set icon name.\"\n\n/**\n * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher.\n */\nconst MAX_PARSEBUFFER_LENGTH = 131072;\n\n/**\n * Limit length of title and icon name stacks.\n */\nconst STACK_LIMIT = 10;\n\n// map params to window option\nfunction paramToWindowOption(n: number, opts: IWindowOptions): boolean {\n if (n > 24) {\n return opts.setWinLines || false;\n }\n switch (n) {\n case 1: return !!opts.restoreWin;\n case 2: return !!opts.minimizeWin;\n case 3: return !!opts.setWinPosition;\n case 4: return !!opts.setWinSizePixels;\n case 5: return !!opts.raiseWin;\n case 6: return !!opts.lowerWin;\n case 7: return !!opts.refreshWin;\n case 8: return !!opts.setWinSizeChars;\n case 9: return !!opts.maximizeWin;\n case 10: return !!opts.fullscreenWin;\n case 11: return !!opts.getWinState;\n case 13: return !!opts.getWinPosition;\n case 14: return !!opts.getWinSizePixels;\n case 15: return !!opts.getScreenSizePixels;\n case 16: return !!opts.getCellSizePixels;\n case 18: return !!opts.getWinSizeChars;\n case 19: return !!opts.getScreenSizeChars;\n case 20: return !!opts.getIconTitle;\n case 21: return !!opts.getWinTitle;\n case 22: return !!opts.pushTitle;\n case 23: return !!opts.popTitle;\n case 24: return !!opts.setWinLines;\n }\n return false;\n}\n\nexport enum WindowsOptionsReportType {\n GET_WIN_SIZE_PIXELS = 0,\n GET_CELL_SIZE_PIXELS = 1\n}\n\n// create a warning log if an async handler takes longer than the limit (in ms)\nconst SLOW_ASYNC_LIMIT = 5000;\n\n// Work variables to avoid garbage collection\nlet $temp = 0;\n\n/**\n * The terminal's standard implementation of IInputHandler, this handles all\n * input from the Parser.\n *\n * Refer to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html to understand\n * each function's header comment.\n */\nexport class InputHandler extends Disposable implements IInputHandler {\n private _parseBuffer: Uint32Array = new Uint32Array(4096);\n private _stringDecoder: StringToUtf32 = new StringToUtf32();\n private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32();\n private _windowTitle = '';\n private _iconName = '';\n private _dirtyRowTracker: IDirtyRowTracker;\n protected _windowTitleStack: string[] = [];\n protected _iconNameStack: string[] = [];\n\n private _curAttrData: IAttributeData = DEFAULT_ATTR_DATA.clone();\n public getAttrData(): IAttributeData { return this._curAttrData; }\n private _eraseAttrDataInternal: IAttributeData = DEFAULT_ATTR_DATA.clone();\n\n private _activeBuffer: IBuffer;\n\n private readonly _onRequestBell = this._register(new Emitter());\n public readonly onRequestBell = this._onRequestBell.event;\n private readonly _onRequestRefreshRows = this._register(new Emitter<{ start: number, end: number } | undefined>());\n public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;\n private readonly _onRequestReset = this._register(new Emitter());\n public readonly onRequestReset = this._onRequestReset.event;\n private readonly _onRequestSendFocus = this._register(new Emitter());\n public readonly onRequestSendFocus = this._onRequestSendFocus.event;\n private readonly _onRequestSyncScrollBar = this._register(new Emitter());\n public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;\n private readonly _onRequestWindowsOptionsReport = this._register(new Emitter());\n public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;\n\n private readonly _onA11yChar = this._register(new Emitter());\n public readonly onA11yChar = this._onA11yChar.event;\n private readonly _onA11yTab = this._register(new Emitter());\n public readonly onA11yTab = this._onA11yTab.event;\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onColor = this._register(new Emitter());\n public readonly onColor = this._onColor.event;\n\n private _parseStack: IParseStack = {\n paused: false,\n cursorStartX: 0,\n cursorStartY: 0,\n decodedLength: 0,\n position: 0\n };\n\n constructor(\n private readonly _bufferService: IBufferService,\n private readonly _charsetService: ICharsetService,\n private readonly _coreService: ICoreService,\n private readonly _logService: ILogService,\n private readonly _optionsService: IOptionsService,\n private readonly _oscLinkService: IOscLinkService,\n private readonly _coreMouseService: ICoreMouseService,\n private readonly _unicodeService: IUnicodeService,\n private readonly _parser: IEscapeSequenceParser = new EscapeSequenceParser()\n ) {\n super();\n this._register(this._parser);\n this._dirtyRowTracker = new DirtyRowTracker(this._bufferService);\n\n // Track properties used in performance critical code manually to avoid using slow getters\n this._activeBuffer = this._bufferService.buffer;\n this._register(this._bufferService.buffers.onBufferActivate(e => this._activeBuffer = e.activeBuffer));\n\n /**\n * custom fallback handlers\n */\n this._parser.setCsiHandlerFallback((ident, params) => {\n this._logService.debug('Unknown CSI code: ', { identifier: this._parser.identToString(ident), params: params.toArray() });\n });\n this._parser.setEscHandlerFallback(ident => {\n this._logService.debug('Unknown ESC code: ', { identifier: this._parser.identToString(ident) });\n });\n this._parser.setExecuteHandlerFallback(code => {\n this._logService.debug('Unknown EXECUTE code: ', { code });\n });\n this._parser.setOscHandlerFallback((identifier, action, data) => {\n this._logService.debug('Unknown OSC code: ', { identifier, action, data });\n });\n this._parser.setDcsHandlerFallback((ident, action, payload) => {\n if (action === 'HOOK') {\n payload = payload.toArray();\n }\n this._logService.debug('Unknown DCS code: ', { identifier: this._parser.identToString(ident), action, payload });\n });\n\n /**\n * print handler\n */\n this._parser.setPrintHandler((data, start, end) => this.print(data, start, end));\n\n /**\n * CSI handler\n */\n this._parser.registerCsiHandler({ final: '@' }, params => this.insertChars(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: '@' }, params => this.scrollLeft(params));\n this._parser.registerCsiHandler({ final: 'A' }, params => this.cursorUp(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'A' }, params => this.scrollRight(params));\n this._parser.registerCsiHandler({ final: 'B' }, params => this.cursorDown(params));\n this._parser.registerCsiHandler({ final: 'C' }, params => this.cursorForward(params));\n this._parser.registerCsiHandler({ final: 'D' }, params => this.cursorBackward(params));\n this._parser.registerCsiHandler({ final: 'E' }, params => this.cursorNextLine(params));\n this._parser.registerCsiHandler({ final: 'F' }, params => this.cursorPrecedingLine(params));\n this._parser.registerCsiHandler({ final: 'G' }, params => this.cursorCharAbsolute(params));\n this._parser.registerCsiHandler({ final: 'H' }, params => this.cursorPosition(params));\n this._parser.registerCsiHandler({ final: 'I' }, params => this.cursorForwardTab(params));\n this._parser.registerCsiHandler({ final: 'J' }, params => this.eraseInDisplay(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'J' }, params => this.eraseInDisplay(params, true));\n this._parser.registerCsiHandler({ final: 'K' }, params => this.eraseInLine(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'K' }, params => this.eraseInLine(params, true));\n this._parser.registerCsiHandler({ final: 'L' }, params => this.insertLines(params));\n this._parser.registerCsiHandler({ final: 'M' }, params => this.deleteLines(params));\n this._parser.registerCsiHandler({ final: 'P' }, params => this.deleteChars(params));\n this._parser.registerCsiHandler({ final: 'S' }, params => this.scrollUp(params));\n this._parser.registerCsiHandler({ final: 'T' }, params => this.scrollDown(params));\n this._parser.registerCsiHandler({ final: 'X' }, params => this.eraseChars(params));\n this._parser.registerCsiHandler({ final: 'Z' }, params => this.cursorBackwardTab(params));\n this._parser.registerCsiHandler({ final: '`' }, params => this.charPosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'a' }, params => this.hPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'b' }, params => this.repeatPrecedingCharacter(params));\n this._parser.registerCsiHandler({ final: 'c' }, params => this.sendDeviceAttributesPrimary(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'c' }, params => this.sendDeviceAttributesSecondary(params));\n this._parser.registerCsiHandler({ final: 'd' }, params => this.linePosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'e' }, params => this.vPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'f' }, params => this.hVPosition(params));\n this._parser.registerCsiHandler({ final: 'g' }, params => this.tabClear(params));\n this._parser.registerCsiHandler({ final: 'h' }, params => this.setMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'h' }, params => this.setModePrivate(params));\n this._parser.registerCsiHandler({ final: 'l' }, params => this.resetMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'l' }, params => this.resetModePrivate(params));\n this._parser.registerCsiHandler({ final: 'm' }, params => this.charAttributes(params));\n this._parser.registerCsiHandler({ final: 'n' }, params => this.deviceStatus(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'n' }, params => this.deviceStatusPrivate(params));\n this._parser.registerCsiHandler({ intermediates: '!', final: 'p' }, params => this.softReset(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'q' }, params => this.setCursorStyle(params));\n this._parser.registerCsiHandler({ final: 'r' }, params => this.setScrollRegion(params));\n this._parser.registerCsiHandler({ final: 's' }, params => this.saveCursor(params));\n this._parser.registerCsiHandler({ final: 't' }, params => this.windowOptions(params));\n this._parser.registerCsiHandler({ final: 'u' }, params => this.restoreCursor(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '}' }, params => this.insertColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '~' }, params => this.deleteColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\"', final: 'q' }, params => this.selectProtected(params));\n this._parser.registerCsiHandler({ intermediates: '$', final: 'p' }, params => this.requestMode(params, true));\n this._parser.registerCsiHandler({ prefix: '?', intermediates: '$', final: 'p' }, params => this.requestMode(params, false));\n\n /**\n * execute handler\n */\n this._parser.setExecuteHandler(C0.BEL, () => this.bell());\n this._parser.setExecuteHandler(C0.LF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.VT, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.FF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn());\n this._parser.setExecuteHandler(C0.BS, () => this.backspace());\n this._parser.setExecuteHandler(C0.HT, () => this.tab());\n this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());\n this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());\n // FIXME: What do to with missing? Old code just added those to print.\n\n this._parser.setExecuteHandler(C1.IND, () => this.index());\n this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());\n this._parser.setExecuteHandler(C1.HTS, () => this.tabSet());\n\n /**\n * OSC handler\n */\n // 0 - icon name + title\n this._parser.registerOscHandler(0, new OscHandler(data => { this.setTitle(data); this.setIconName(data); return true; }));\n // 1 - icon name\n this._parser.registerOscHandler(1, new OscHandler(data => this.setIconName(data)));\n // 2 - title\n this._parser.registerOscHandler(2, new OscHandler(data => this.setTitle(data)));\n // 3 - set property X in the form \"prop=value\"\n // 4 - Change Color Number\n this._parser.registerOscHandler(4, new OscHandler(data => this.setOrReportIndexedColor(data)));\n // 5 - Change Special Color Number\n // 6 - Enable/disable Special Color Number c\n // 7 - current directory? (not in xterm spec, see https://gitlab.com/gnachman/iterm2/issues/3939)\n // 8 - create hyperlink (not in xterm spec, see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)\n this._parser.registerOscHandler(8, new OscHandler(data => this.setHyperlink(data)));\n // 10 - Change VT100 text foreground color to Pt.\n this._parser.registerOscHandler(10, new OscHandler(data => this.setOrReportFgColor(data)));\n // 11 - Change VT100 text background color to Pt.\n this._parser.registerOscHandler(11, new OscHandler(data => this.setOrReportBgColor(data)));\n // 12 - Change text cursor color to Pt.\n this._parser.registerOscHandler(12, new OscHandler(data => this.setOrReportCursorColor(data)));\n // 13 - Change mouse foreground color to Pt.\n // 14 - Change mouse background color to Pt.\n // 15 - Change Tektronix foreground color to Pt.\n // 16 - Change Tektronix background color to Pt.\n // 17 - Change highlight background color to Pt.\n // 18 - Change Tektronix cursor color to Pt.\n // 19 - Change highlight foreground color to Pt.\n // 46 - Change Log File to Pt.\n // 50 - Set Font to Pt.\n // 51 - reserved for Emacs shell.\n // 52 - Manipulate Selection Data.\n // 104 ; c - Reset Color Number c.\n this._parser.registerOscHandler(104, new OscHandler(data => this.restoreIndexedColor(data)));\n // 105 ; c - Reset Special Color Number c.\n // 106 ; c; f - Enable/disable Special Color Number c.\n // 110 - Reset VT100 text foreground color.\n this._parser.registerOscHandler(110, new OscHandler(data => this.restoreFgColor(data)));\n // 111 - Reset VT100 text background color.\n this._parser.registerOscHandler(111, new OscHandler(data => this.restoreBgColor(data)));\n // 112 - Reset text cursor color.\n this._parser.registerOscHandler(112, new OscHandler(data => this.restoreCursorColor(data)));\n // 113 - Reset mouse foreground color.\n // 114 - Reset mouse background color.\n // 115 - Reset Tektronix foreground color.\n // 116 - Reset Tektronix background color.\n // 117 - Reset highlight color.\n // 118 - Reset Tektronix cursor color.\n // 119 - Reset highlight foreground color.\n\n /**\n * ESC handlers\n */\n this._parser.registerEscHandler({ final: '7' }, () => this.saveCursor());\n this._parser.registerEscHandler({ final: '8' }, () => this.restoreCursor());\n this._parser.registerEscHandler({ final: 'D' }, () => this.index());\n this._parser.registerEscHandler({ final: 'E' }, () => this.nextLine());\n this._parser.registerEscHandler({ final: 'H' }, () => this.tabSet());\n this._parser.registerEscHandler({ final: 'M' }, () => this.reverseIndex());\n this._parser.registerEscHandler({ final: '=' }, () => this.keypadApplicationMode());\n this._parser.registerEscHandler({ final: '>' }, () => this.keypadNumericMode());\n this._parser.registerEscHandler({ final: 'c' }, () => this.fullReset());\n this._parser.registerEscHandler({ final: 'n' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: 'o' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '|' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '}' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: '~' }, () => this.setgLevel(1));\n this._parser.registerEscHandler({ intermediates: '%', final: '@' }, () => this.selectDefaultCharset());\n this._parser.registerEscHandler({ intermediates: '%', final: 'G' }, () => this.selectDefaultCharset());\n for (const flag in CHARSETS) {\n this._parser.registerEscHandler({ intermediates: '(', final: flag }, () => this.selectCharset('(' + flag));\n this._parser.registerEscHandler({ intermediates: ')', final: flag }, () => this.selectCharset(')' + flag));\n this._parser.registerEscHandler({ intermediates: '*', final: flag }, () => this.selectCharset('*' + flag));\n this._parser.registerEscHandler({ intermediates: '+', final: flag }, () => this.selectCharset('+' + flag));\n this._parser.registerEscHandler({ intermediates: '-', final: flag }, () => this.selectCharset('-' + flag));\n this._parser.registerEscHandler({ intermediates: '.', final: flag }, () => this.selectCharset('.' + flag));\n this._parser.registerEscHandler({ intermediates: '/', final: flag }, () => this.selectCharset('/' + flag)); // TODO: supported?\n }\n this._parser.registerEscHandler({ intermediates: '#', final: '8' }, () => this.screenAlignmentPattern());\n\n /**\n * error handler\n */\n this._parser.setErrorHandler((state: IParsingState) => {\n this._logService.error('Parsing error: ', state);\n return state;\n });\n\n /**\n * DCS handler\n */\n this._parser.registerDcsHandler({ intermediates: '$', final: 'q' }, new DcsHandler((data, params) => this.requestStatusString(data, params)));\n }\n\n /**\n * Async parse support.\n */\n private _preserveStack(cursorStartX: number, cursorStartY: number, decodedLength: number, position: number): void {\n this._parseStack.paused = true;\n this._parseStack.cursorStartX = cursorStartX;\n this._parseStack.cursorStartY = cursorStartY;\n this._parseStack.decodedLength = decodedLength;\n this._parseStack.position = position;\n }\n\n private _logSlowResolvingAsync(p: Promise): void {\n // log a limited warning about an async handler taking too long\n if (this._logService.logLevel <= LogLevelEnum.WARN) {\n Promise.race([p, new Promise((res, rej) => setTimeout(() => rej('#SLOW_TIMEOUT'), SLOW_ASYNC_LIMIT))])\n .catch(err => {\n if (err !== '#SLOW_TIMEOUT') {\n throw err;\n }\n console.warn(`async parser handler taking longer than ${SLOW_ASYNC_LIMIT} ms`);\n });\n }\n }\n\n private _getCurrentLinkId(): number {\n return this._curAttrData.extended.urlId;\n }\n\n /**\n * Parse call with async handler support.\n *\n * Whether the stack state got preserved for the next call, is indicated by the return value:\n * - undefined (void):\n * all handlers were sync, no stack save, continue normally with next chunk\n * - Promise\\:\n * execution stopped at async handler, stack saved, continue with same chunk and the promise\n * resolve value as `promiseResult` until the method returns `undefined`\n *\n * Note: This method should only be called by `Terminal.write` to ensure correct execution order\n * and proper continuation of async parser handlers.\n */\n public parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise {\n let result: void | Promise;\n let cursorStartX = this._activeBuffer.x;\n let cursorStartY = this._activeBuffer.y;\n let start = 0;\n const wasPaused = this._parseStack.paused;\n\n if (wasPaused) {\n // assumption: _parseBuffer never mutates between async calls\n if (result = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, promiseResult)) {\n this._logSlowResolvingAsync(result);\n return result;\n }\n cursorStartX = this._parseStack.cursorStartX;\n cursorStartY = this._parseStack.cursorStartY;\n this._parseStack.paused = false;\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n start = this._parseStack.position + MAX_PARSEBUFFER_LENGTH;\n }\n }\n\n // Log debug data, the log level gate is to prevent extra work in this hot path\n if (this._logService.logLevel <= LogLevelEnum.DEBUG) {\n this._logService.debug(`parsing data${typeof data === 'string' ? ` \"${data}\"` : ` \"${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}\"`}`, typeof data === 'string'\n ? data.split('').map(e => e.charCodeAt(0))\n : data\n );\n }\n\n // resize input buffer if needed\n if (this._parseBuffer.length < data.length) {\n if (this._parseBuffer.length < MAX_PARSEBUFFER_LENGTH) {\n this._parseBuffer = new Uint32Array(Math.min(data.length, MAX_PARSEBUFFER_LENGTH));\n }\n }\n\n // Clear the dirty row service so we know which lines changed as a result of parsing\n // Important: do not clear between async calls, otherwise we lost pending update information.\n if (!wasPaused) {\n this._dirtyRowTracker.clearRange();\n }\n\n // process big data in smaller chunks\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n for (let i = start; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {\n const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length;\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer)\n : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, i);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n } else {\n if (!wasPaused) {\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data, this._parseBuffer)\n : this._utf8Decoder.decode(data, this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, 0);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n }\n\n if (this._activeBuffer.x !== cursorStartX || this._activeBuffer.y !== cursorStartY) {\n this._onCursorMove.fire();\n }\n\n // Refresh any dirty rows accumulated as part of parsing, fire only for rows within the\n // _viewport_ which is relative to ydisp, not relative to ybase.\n const viewportEnd = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n const viewportStart = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n if (viewportStart < this._bufferService.rows) {\n this._onRequestRefreshRows.fire({\n start: Math.min(viewportStart, this._bufferService.rows - 1),\n end: Math.min(viewportEnd, this._bufferService.rows - 1)\n });\n }\n }\n\n public print(data: Uint32Array, start: number, end: number): void {\n let code: number;\n let chWidth: number;\n const charset = this._charsetService.charset;\n const screenReaderMode = this._optionsService.rawOptions.screenReaderMode;\n const cols = this._bufferService.cols;\n const wraparoundMode = this._coreService.decPrivateModes.wraparound;\n const insertMode = this._coreService.modes.insertMode;\n const curAttr = this._curAttrData;\n let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n // handle wide chars: reset start_cell-1 if we would overwrite the second cell of a wide char\n if (this._activeBuffer.x && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, curAttr);\n }\n\n let precedingJoinState = this._parser.precedingJoinState;\n for (let pos = start; pos < end; ++pos) {\n code = data[pos];\n\n // get charset replacement character\n // charset is only defined for ASCII, therefore we only\n // search for an replacement char if code < 127\n if (code < 127 && charset) {\n const ch = charset[String.fromCharCode(code)];\n if (ch) {\n code = ch.charCodeAt(0);\n }\n }\n\n const currentInfo = this._unicodeService.charProperties(code, precedingJoinState);\n chWidth = UnicodeService.extractWidth(currentInfo);\n const shouldJoin = UnicodeService.extractShouldJoin(currentInfo);\n const oldWidth = shouldJoin ? UnicodeService.extractWidth(precedingJoinState) : 0;\n precedingJoinState = currentInfo;\n\n if (screenReaderMode) {\n this._onA11yChar.fire(stringFromCodePoint(code));\n }\n if (this._getCurrentLinkId()) {\n this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y);\n }\n\n // goto next line if ch would overflow\n // NOTE: To avoid costly width checks here,\n // the terminal does not allow a cols < 2.\n if (this._activeBuffer.x + chWidth - oldWidth > cols) {\n // autowrap - DECAWM\n // automatically wraps to the beginning of the next line\n if (wraparoundMode) {\n const oldRow = bufferRow;\n let oldCol = this._activeBuffer.x - oldWidth;\n this._activeBuffer.x = oldWidth;\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData(), true);\n } else {\n if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n // The line already exists (eg. the initial viewport), mark it as a\n // wrapped line\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = true;\n }\n // row changed, get it again\n bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n if (oldWidth > 0 && bufferRow instanceof BufferLine) {\n // Combining character widens 1 column to 2.\n // Move old character to next line.\n bufferRow.copyCellsFrom(oldRow as BufferLine,\n oldCol, 0, oldWidth, false);\n }\n // clear left over cells to the right\n while (oldCol < cols) {\n oldRow.setCellFromCodepoint(oldCol++, 0, 1, curAttr);\n }\n } else {\n this._activeBuffer.x = cols - 1;\n if (chWidth === 2) {\n // FIXME: check for xterm behavior\n // What to do here? We got a wide char that does not fit into last cell\n continue;\n }\n }\n }\n\n // insert combining char at last cursor position\n // this._activeBuffer.x should never be 0 for a combining char\n // since they always follow a cell consuming char\n // therefore we can test for this._activeBuffer.x to avoid overflow left\n if (shouldJoin && this._activeBuffer.x) {\n const offset = bufferRow.getWidth(this._activeBuffer.x - 1) ? 1 : 2;\n // if empty cell after fullwidth, need to go 2 cells back\n // it is save to step 2 cells back here\n // since an empty cell is only set by fullwidth chars\n bufferRow.addCodepointToCell(this._activeBuffer.x - offset,\n code, chWidth);\n for (let delta = chWidth - oldWidth; --delta >= 0; ) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n continue;\n }\n\n // insert mode: move characters to right\n if (insertMode) {\n // right shift cells according to the width\n bufferRow.insertCells(this._activeBuffer.x, chWidth - oldWidth, this._activeBuffer.getNullCell(curAttr));\n // test last cell - since the last cell has only room for\n // a halfwidth char any fullwidth shifted there is lost\n // and will be set to empty cell\n if (bufferRow.getWidth(cols - 1) === 2) {\n bufferRow.setCellFromCodepoint(cols - 1, NULL_CELL_CODE, NULL_CELL_WIDTH, curAttr);\n }\n }\n\n // write current char to buffer and advance cursor\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, code, chWidth, curAttr);\n\n // fullwidth char - also set next cell to placeholder stub and advance cursor\n // for graphemes bigger than fullwidth we can simply loop to zero\n // we already made sure above, that this._activeBuffer.x + chWidth will not overflow right\n if (chWidth > 0) {\n while (--chWidth) {\n // other than a regular empty cell a cell following a wide char has no width\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n }\n }\n\n this._parser.precedingJoinState = precedingJoinState;\n\n // handle wide chars: reset cell to the right if it is second cell of a wide char\n if (this._activeBuffer.x < cols && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x) === 0 && !bufferRow.hasContent(this._activeBuffer.x)) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x, 0, 1, curAttr);\n }\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Forward registerCsiHandler from parser.\n */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n if (id.final === 't' && !id.prefix && !id.intermediates) {\n // security: always check whether window option is allowed\n return this._parser.registerCsiHandler(id, params => {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n return callback(params);\n });\n }\n return this._parser.registerCsiHandler(id, callback);\n }\n\n /**\n * Forward registerDcsHandler from parser.\n */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._parser.registerDcsHandler(id, new DcsHandler(callback));\n }\n\n /**\n * Forward registerEscHandler from parser.\n */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._parser.registerEscHandler(id, callback);\n }\n\n /**\n * Forward registerOscHandler from parser.\n */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._parser.registerOscHandler(ident, new OscHandler(callback));\n }\n\n /**\n * BEL\n * Bell (Ctrl-G).\n *\n * @vt: #Y C0 BEL \"Bell\" \"\\a, \\x07\" \"Ring the bell.\"\n * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`\n * and `ITerminalOptions.bellSound`.\n */\n public bell(): boolean {\n this._onRequestBell.fire();\n return true;\n }\n\n /**\n * LF\n * Line Feed or New Line (NL). (LF is Ctrl-J).\n *\n * @vt: #Y C0 LF \"Line Feed\" \"\\n, \\x0A\" \"Move the cursor one row down, scrolling if needed.\"\n * Scrolling is restricted to scroll margins and will only happen on the bottom line.\n *\n * @vt: #Y C0 VT \"Vertical Tabulation\" \"\\v, \\x0B\" \"Treated as LF.\"\n * @vt: #Y C0 FF \"Form Feed\" \"\\f, \\x0C\" \"Treated as LF.\"\n */\n public lineFeed(): boolean {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._optionsService.rawOptions.convertEol) {\n this._activeBuffer.x = 0;\n }\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n } else {\n // There was an explicit line feed (not just a carriage return), so clear the wrapped state of\n // the line. This is particularly important on conpty/Windows where revisiting lines to\n // reprint is common, especially on resize. Note that the windowsMode wrapped line heuristics\n // can mess with this so windowsMode should be disabled, which is recommended on Windows build\n // 21376 and above.\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (this._activeBuffer.x >= this._bufferService.cols) {\n this._activeBuffer.x--;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n this._onLineFeed.fire();\n return true;\n }\n\n /**\n * CR\n * Carriage Return (Ctrl-M).\n *\n * @vt: #Y C0 CR \"Carriage Return\" \"\\r, \\x0D\" \"Move the cursor to the beginning of the row.\"\n */\n public carriageReturn(): boolean {\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * BS\n * Backspace (Ctrl-H).\n *\n * @vt: #Y C0 BS \"Backspace\" \"\\b, \\x08\" \"Move the cursor one position to the left.\"\n * By default it is not possible to move the cursor past the leftmost position.\n * If `reverse wrap-around` (`CSI ? 45 h`) is set, a previous soft line wrap (DECAWM)\n * can be undone with BS within the scroll margins. In that case the cursor will wrap back\n * to the end of the previous row. Note that it is not possible to peek back into the scrollbuffer\n * with the cursor, thus at the home position (top-leftmost cell) this has no effect.\n */\n public backspace(): boolean {\n // reverse wrap-around is disabled\n if (!this._coreService.decPrivateModes.reverseWraparound) {\n this._restrictCursor();\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n }\n return true;\n }\n\n // reverse wrap-around is enabled\n // other than for normal operation mode, reverse wrap-around allows the cursor\n // to be at x=cols to be able to address the last cell of a row by BS\n this._restrictCursor(this._bufferService.cols);\n\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n } else {\n /**\n * reverse wrap-around handling:\n * Our implementation deviates from xterm on purpose. Details:\n * - only previous soft NLs can be reversed (isWrapped=true)\n * - only works within scrollborders (top/bottom, left/right not yet supported)\n * - cannot peek into scrollbuffer\n * - any cursor movement sequence keeps working as expected\n */\n if (this._activeBuffer.x === 0\n && this._activeBuffer.y > this._activeBuffer.scrollTop\n && this._activeBuffer.y <= this._activeBuffer.scrollBottom\n && this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)?.isWrapped) {\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n this._activeBuffer.y--;\n this._activeBuffer.x = this._bufferService.cols - 1;\n // find last taken cell - last cell can have 3 different states:\n // - hasContent(true) + hasWidth(1): narrow char - we are done\n // - hasWidth(0): second part of wide char - we are done\n // - hasContent(false) + hasWidth(1): empty cell due to early wrapping wide char, go one\n // cell further back\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n if (line.hasWidth(this._activeBuffer.x) && !line.hasContent(this._activeBuffer.x)) {\n this._activeBuffer.x--;\n // We do this only once, since width=1 + hasContent=false currently happens only once\n // before early wrapping of a wide char.\n // This needs to be fixed once we support graphemes taking more than 2 cells.\n }\n }\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * TAB\n * Horizontal Tab (HT) (Ctrl-I).\n *\n * @vt: #Y C0 HT \"Horizontal Tabulation\" \"\\t, \\x09\" \"Move the cursor to the next character tab stop.\"\n */\n public tab(): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n const originalX = this._activeBuffer.x;\n this._activeBuffer.x = this._activeBuffer.nextStop();\n if (this._optionsService.rawOptions.screenReaderMode) {\n this._onA11yTab.fire(this._activeBuffer.x - originalX);\n }\n return true;\n }\n\n /**\n * SO\n * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the\n * G1 character set.\n *\n * @vt: #P[Only limited ISO-2022 charset support.] C0 SO \"Shift Out\" \"\\x0E\" \"Switch to an alternative character set.\"\n */\n public shiftOut(): boolean {\n this._charsetService.setgLevel(1);\n return true;\n }\n\n /**\n * SI\n * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0\n * character set (the default).\n *\n * @vt: #Y C0 SI \"Shift In\" \"\\x0F\" \"Return to regular character set after Shift Out.\"\n */\n public shiftIn(): boolean {\n this._charsetService.setgLevel(0);\n return true;\n }\n\n /**\n * Restrict cursor to viewport size / scroll margin (origin mode).\n */\n private _restrictCursor(maxCol: number = this._bufferService.cols - 1): void {\n this._activeBuffer.x = Math.min(maxCol, Math.max(0, this._activeBuffer.x));\n this._activeBuffer.y = this._coreService.decPrivateModes.origin\n ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y))\n : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y));\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set absolute cursor position.\n */\n private _setCursor(x: number, y: number): void {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._coreService.decPrivateModes.origin) {\n this._activeBuffer.x = x;\n this._activeBuffer.y = this._activeBuffer.scrollTop + y;\n } else {\n this._activeBuffer.x = x;\n this._activeBuffer.y = y;\n }\n this._restrictCursor();\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set relative cursor position.\n */\n private _moveCursor(x: number, y: number): void {\n // for relative changes we have to make sure we are within 0 .. cols/rows - 1\n // before calculating the new position\n this._restrictCursor();\n this._setCursor(this._activeBuffer.x + x, this._activeBuffer.y + y);\n }\n\n /**\n * CSI Ps A\n * Cursor Up Ps Times (default = 1) (CUU).\n *\n * @vt: #Y CSI CUU \"Cursor Up\" \"CSI Ps A\" \"Move cursor `Ps` times up (default=1).\"\n * If the cursor would pass the top scroll margin, it will stop there.\n */\n public cursorUp(params: IParams): boolean {\n // stop at scrollTop\n const diffToTop = this._activeBuffer.y - this._activeBuffer.scrollTop;\n if (diffToTop >= 0) {\n this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));\n } else {\n this._moveCursor(0, -(params.params[0] || 1));\n }\n return true;\n }\n\n /**\n * CSI Ps B\n * Cursor Down Ps Times (default = 1) (CUD).\n *\n * @vt: #Y CSI CUD \"Cursor Down\" \"CSI Ps B\" \"Move cursor `Ps` times down (default=1).\"\n * If the cursor would pass the bottom scroll margin, it will stop there.\n */\n public cursorDown(params: IParams): boolean {\n // stop at scrollBottom\n const diffToBottom = this._activeBuffer.scrollBottom - this._activeBuffer.y;\n if (diffToBottom >= 0) {\n this._moveCursor(0, Math.min(diffToBottom, params.params[0] || 1));\n } else {\n this._moveCursor(0, params.params[0] || 1);\n }\n return true;\n }\n\n /**\n * CSI Ps C\n * Cursor Forward Ps Times (default = 1) (CUF).\n *\n * @vt: #Y CSI CUF \"Cursor Forward\" \"CSI Ps C\" \"Move cursor `Ps` times forward (default=1).\"\n */\n public cursorForward(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Ps D\n * Cursor Backward Ps Times (default = 1) (CUB).\n *\n * @vt: #Y CSI CUB \"Cursor Backward\" \"CSI Ps D\" \"Move cursor `Ps` times backward (default=1).\"\n */\n public cursorBackward(params: IParams): boolean {\n this._moveCursor(-(params.params[0] || 1), 0);\n return true;\n }\n\n /**\n * CSI Ps E\n * Cursor Next Line Ps Times (default = 1) (CNL).\n * Other than cursorDown (CUD) also set the cursor to first column.\n *\n * @vt: #Y CSI CNL \"Cursor Next Line\" \"CSI Ps E\" \"Move cursor `Ps` times down (default=1) and to the first column.\"\n * Same as CUD, additionally places the cursor at the first column.\n */\n public cursorNextLine(params: IParams): boolean {\n this.cursorDown(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps F\n * Cursor Previous Line Ps Times (default = 1) (CPL).\n * Other than cursorUp (CUU) also set the cursor to first column.\n *\n * @vt: #Y CSI CPL \"Cursor Backward\" \"CSI Ps F\" \"Move cursor `Ps` times up (default=1) and to the first column.\"\n * Same as CUU, additionally places the cursor at the first column.\n */\n public cursorPrecedingLine(params: IParams): boolean {\n this.cursorUp(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps G\n * Cursor Character Absolute [column] (default = [row,1]) (CHA).\n *\n * @vt: #Y CSI CHA \"Cursor Horizontal Absolute\" \"CSI Ps G\" \"Move cursor to `Ps`-th column of the active row (default=1).\"\n */\n public cursorCharAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps ; Ps H\n * Cursor Position [row;column] (default = [1,1]) (CUP).\n *\n * @vt: #Y CSI CUP \"Cursor Position\" \"CSI Ps ; Ps H\" \"Set cursor to position [`Ps`, `Ps`] (default = [1, 1]).\"\n * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins.\n * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport.\n * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`.\n */\n public cursorPosition(params: IParams): boolean {\n this._setCursor(\n // col\n (params.length >= 2) ? (params.params[1] || 1) - 1 : 0,\n // row\n (params.params[0] || 1) - 1\n );\n return true;\n }\n\n /**\n * CSI Pm ` Character Position Absolute\n * [column] (default = [row,1]) (HPA).\n * Currently same functionality as CHA.\n *\n * @vt: #Y CSI HPA \"Horizontal Position Absolute\" \"CSI Ps ` \" \"Same as CHA.\"\n */\n public charPosAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Pm a Character Position Relative\n * [columns] (default = [row,col+1]) (HPR)\n *\n * @vt: #Y CSI HPR \"Horizontal Position Relative\" \"CSI Ps a\" \"Same as CUF.\"\n */\n public hPositionRelative(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Pm d Vertical Position Absolute (VPA)\n * [row] (default = [1,column])\n *\n * @vt: #Y CSI VPA \"Vertical Position Absolute\" \"CSI Ps d\" \"Move cursor to `Ps`-th row (default=1).\"\n */\n public linePosAbsolute(params: IParams): boolean {\n this._setCursor(this._activeBuffer.x, (params.params[0] || 1) - 1);\n return true;\n }\n\n /**\n * CSI Pm e Vertical Position Relative (VPR)\n * [rows] (default = [row+1,column])\n * reuse CSI Ps B ?\n *\n * @vt: #Y CSI VPR \"Vertical Position Relative\" \"CSI Ps e\" \"Move cursor `Ps` times down (default=1).\"\n */\n public vPositionRelative(params: IParams): boolean {\n this._moveCursor(0, params.params[0] || 1);\n return true;\n }\n\n /**\n * CSI Ps ; Ps f\n * Horizontal and Vertical Position [row;column] (default =\n * [1,1]) (HVP).\n * Same as CUP.\n *\n * @vt: #Y CSI HVP \"Horizontal and Vertical Position\" \"CSI Ps ; Ps f\" \"Same as CUP.\"\n */\n public hVPosition(params: IParams): boolean {\n this.cursorPosition(params);\n return true;\n }\n\n /**\n * CSI Ps g Tab Clear (TBC).\n * Ps = 0 -> Clear Current Column (default).\n * Ps = 3 -> Clear All.\n * Potentially:\n * Ps = 2 -> Clear Stops on Line.\n * http://vt100.net/annarbor/aaa-ug/section6.html\n *\n * @vt: #Y CSI TBC \"Tab Clear\" \"CSI Ps g\" \"Clear tab stops at current position (0) or all (3) (default=0).\"\n * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported.\n */\n public tabClear(params: IParams): boolean {\n const param = params.params[0];\n if (param === 0) {\n delete this._activeBuffer.tabs[this._activeBuffer.x];\n } else if (param === 3) {\n this._activeBuffer.tabs = {};\n }\n return true;\n }\n\n /**\n * CSI Ps I\n * Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).\n *\n * @vt: #Y CSI CHT \"Cursor Horizontal Tabulation\" \"CSI Ps I\" \"Move cursor `Ps` times tabs forward (default=1).\"\n */\n public cursorForwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.nextStop();\n }\n return true;\n }\n\n /**\n * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).\n *\n * @vt: #Y CSI CBT \"Cursor Backward Tabulation\" \"CSI Ps Z\" \"Move cursor `Ps` tabs backward (default=1).\"\n */\n public cursorBackwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.prevStop();\n }\n return true;\n }\n\n /**\n * CSI Ps \" q Select Character Protection Attribute (DECSCA).\n *\n * @vt: #Y CSI DECSCA \"Select Character Protection Attribute\" \"CSI Ps \" q\" \"Whether DECSED and DECSEL can erase (0=default, 2) or not (1).\"\n */\n public selectProtected(params: IParams): boolean {\n const p = params.params[0];\n if (p === 1) this._curAttrData.bg |= BgFlags.PROTECTED;\n if (p === 2 || p === 0) this._curAttrData.bg &= ~BgFlags.PROTECTED;\n return true;\n }\n\n\n /**\n * Helper method to erase cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal.\n * @param y The row index relative to the viewport.\n * @param start The start x index of the range to be erased.\n * @param end The end x index of the range to be erased (exclusive).\n * @param clearWrap clear the isWrapped flag\n * @param respectProtect Whether to respect the protection attribute (DECSCA).\n */\n private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.replaceCells(\n start,\n end,\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n respectProtect\n );\n if (clearWrap) {\n line.isWrapped = false;\n }\n }\n\n /**\n * Helper method to reset cells in a terminal row. The cell gets replaced with the eraseChar of\n * the terminal and the isWrapped property is set to false.\n * @param y row index\n */\n private _resetBufferLine(y: number, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);\n if (line) {\n line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), respectProtect);\n this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + y);\n line.isWrapped = false;\n }\n }\n\n /**\n * CSI Ps J Erase in Display (ED).\n * Ps = 0 -> Erase Below (default).\n * Ps = 1 -> Erase Above.\n * Ps = 2 -> Erase All.\n * Ps = 3 -> Erase Saved Lines (xterm).\n * CSI ? Ps J\n * Erase in Display (DECSED).\n * Ps = 0 -> Selective Erase Below (default).\n * Ps = 1 -> Selective Erase Above.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI ED \"Erase In Display\" \"CSI Ps J\" \"Erase various parts of the viewport.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | ------------------------------------------------------------ |\n * | 0 | Erase from the cursor through the end of the viewport. |\n * | 1 | Erase from the beginning of the viewport through the cursor. |\n * | 2 | Erase complete viewport. |\n * | 3 | Erase scrollback. |\n *\n * @vt: #Y CSI DECSED \"Selective Erase In Display\" \"CSI ? Ps J\" \"Same as ED with respecting protection flag.\"\n */\n public eraseInDisplay(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n let j;\n switch (params.params[0]) {\n case 0:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n for (; j < this._bufferService.rows; j++) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(j);\n break;\n case 1:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n // Deleted front part of line and everything before. This line will no longer be wrapped.\n this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, respectProtect);\n if (this._activeBuffer.x + 1 >= this._bufferService.cols) {\n // Deleted entire previous line. This next line can no longer be wrapped.\n this._activeBuffer.lines.get(j + 1)!.isWrapped = false;\n }\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 2:\n j = this._bufferService.rows;\n this._dirtyRowTracker.markDirty(j - 1);\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 3:\n // Clear scrollback (everything not in viewport)\n const scrollBackSize = this._activeBuffer.lines.length - this._bufferService.rows;\n if (scrollBackSize > 0) {\n this._activeBuffer.lines.trimStart(scrollBackSize);\n this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - scrollBackSize, 0);\n this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - scrollBackSize, 0);\n // Force a scroll event to refresh viewport\n this._onScroll.fire(0);\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI Ps K Erase in Line (EL).\n * Ps = 0 -> Erase to Right (default).\n * Ps = 1 -> Erase to Left.\n * Ps = 2 -> Erase All.\n * CSI ? Ps K\n * Erase in Line (DECSEL).\n * Ps = 0 -> Selective Erase to Right (default).\n * Ps = 1 -> Selective Erase to Left.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI EL \"Erase In Line\" \"CSI Ps K\" \"Erase various parts of the active row.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | -------------------------------------------------------- |\n * | 0 | Erase from the cursor through the end of the row. |\n * | 1 | Erase from the beginning of the line through the cursor. |\n * | 2 | Erase complete line. |\n *\n * @vt: #Y CSI DECSEL \"Selective Erase In Line\" \"CSI ? Ps K\" \"Same as EL with respecting protecting flag.\"\n */\n public eraseInLine(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n switch (params.params[0]) {\n case 0:\n this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n break;\n case 1:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, respectProtect);\n break;\n case 2:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, respectProtect);\n break;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps L\n * Insert Ps Line(s) (default = 1) (IL).\n *\n * @vt: #Y CSI IL \"Insert Line\" \"CSI Ps L\" \"Insert `Ps` blank lines at active row (default=1).\"\n * For every inserted line at the scroll top one line at the scroll bottom gets removed.\n * The cursor is set to the first column.\n * IL has no effect if the cursor is outside the scroll margins.\n */\n public insertLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n const scrollBottomRowsOffset = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n const scrollBottomAbsolute = this._bufferService.rows - 1 + this._activeBuffer.ybase - scrollBottomRowsOffset + 1;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1L\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(scrollBottomAbsolute - 1, 1);\n this._activeBuffer.lines.splice(row, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps M\n * Delete Ps Line(s) (default = 1) (DL).\n *\n * @vt: #Y CSI DL \"Delete Line\" \"CSI Ps M\" \"Delete `Ps` lines at active row (default=1).\"\n * For every deleted line at the scroll top one blank line at the scroll bottom gets appended.\n * The cursor is set to the first column.\n * DL has no effect if the cursor is outside the scroll margins.\n */\n public deleteLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n let j: number;\n j = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n j = this._bufferService.rows - 1 + this._activeBuffer.ybase - j;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1M\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(row, 1);\n this._activeBuffer.lines.splice(j, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps @\n * Insert Ps (Blank) Character(s) (default = 1) (ICH).\n *\n * @vt: #Y CSI ICH \"Insert Characters\" \"CSI Ps @\" \"Insert `Ps` (blank) characters (default = 1).\"\n * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the\n * blank characters. Text between the cursor and right margin moves to the right. Characters moved\n * past the right margin are lost.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public insertChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.insertCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps P\n * Delete Ps Character(s) (default = 1) (DCH).\n *\n * @vt: #Y CSI DCH \"Delete Character\" \"CSI Ps P\" \"Delete `Ps` characters (default=1).\"\n * As characters are deleted, the remaining characters between the cursor and right margin move to\n * the left. Character attributes move with the characters. The terminal adds blank characters at\n * the right margin.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public deleteChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.deleteCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps S Scroll up Ps lines (default = 1) (SU).\n *\n * @vt: #Y CSI SU \"Scroll Up\" \"CSI Ps S\" \"Scroll `Ps` lines up (default=1).\"\n *\n *\n * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm)\n */\n public scrollUp(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps T Scroll down Ps lines (default = 1) (SD).\n *\n * @vt: #Y CSI SD \"Scroll Down\" \"CSI Ps T\" \"Scroll `Ps` lines down (default=1).\"\n */\n public scrollDown(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP @ Scroll left Ps columns (default = 1) (SL) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/00\n * Parameter default value: Pn = 1\n * SL causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the left; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always left shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SL \"Scroll Left\" \"CSI Ps SP @\" \"Scroll viewport `Ps` times to the left.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the left.\n * SL has no effect outside of the scroll margins.\n */\n public scrollLeft(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP A Scroll right Ps columns (default = 1) (SR) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/01\n * Parameter default value: Pn = 1\n * SR causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the right; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always right shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SR \"Scroll Right\" \"CSI Ps SP A\" \"Scroll viewport `Ps` times to the right.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the right.\n * Content at the right margin is lost.\n * SL has no effect outside of the scroll margins.\n */\n public scrollRight(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' }\n * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.\n *\n * @vt: #Y CSI DECIC \"Insert Columns\" \"CSI Ps ' }\" \"Insert `Ps` columns at cursor position.\"\n * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll\n * margins, moving content to the right. Content at the right margin is lost. DECIC has no effect\n * outside the scrolling margins.\n */\n public insertColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' ~\n * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.\n *\n * @vt: #Y CSI DECDC \"Delete Columns\" \"CSI Ps ' ~\" \"Delete `Ps` columns at cursor position.\"\n * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins,\n * moving content to the left. Blank columns are added at the right margin.\n * DECDC has no effect outside the scrolling margins.\n */\n public deleteColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps X\n * Erase Ps Character(s) (default = 1) (ECH).\n *\n * @vt: #Y CSI ECH \"Erase Character\" \"CSI Ps X\" \"Erase `Ps` characters from current cursor position to the right (default=1).\"\n * ED erases `Ps` characters from current cursor position to the right.\n * ED works inside or outside the scrolling margins.\n */\n public eraseChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.replaceCells(\n this._activeBuffer.x,\n this._activeBuffer.x + (params.params[0] || 1),\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps b Repeat the preceding graphic character Ps times (REP).\n * From ECMA 48 (@see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf)\n * Notation: (Pn)\n * Representation: CSI Pn 06/02\n * Parameter default value: Pn = 1\n * REP is used to indicate that the preceding character in the data stream,\n * if it is a graphic character (represented by one or more bit combinations) including SPACE,\n * is to be repeated n times, where n equals the value of Pn.\n * If the character preceding REP is a control function or part of a control function,\n * the effect of REP is not defined by this Standard.\n *\n * We extend xterm's behavior to allow repeating entire grapheme clusters.\n * This isn't 100% xterm-compatible, but it seems saner and more useful.\n * - text attrs are applied normally\n * - wrap around is respected\n * - any valid sequence resets the carried forward char\n *\n * Note: To get reset on a valid sequence working correctly without much runtime penalty, the\n * preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`.\n *\n * @vt: #Y CSI REP \"Repeat Preceding Character\" \"CSI Ps b\" \"Repeat preceding character `Ps` times (default=1).\"\n * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is\n * set. REP has no effect if the sequence does not follow a printable ASCII character\n * (NOOP for any other sequence in between or NON ASCII characters).\n */\n public repeatPrecedingCharacter(params: IParams): boolean {\n const joinState = this._parser.precedingJoinState;\n if (!joinState) {\n return true;\n }\n // call print to insert the chars and handle correct wrapping\n const length = params.params[0] || 1;\n const chWidth = UnicodeService.extractWidth(joinState);\n const x = this._activeBuffer.x - chWidth;\n const bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n const text = bufferRow.getString(x);\n const data = new Uint32Array(text.length * length);\n let idata = 0;\n for (let itext = 0; itext < text.length; ) {\n const ch = text.codePointAt(itext) || 0;\n data[idata++] = ch;\n itext += ch > 0xffff ? 2 : 1;\n }\n let tlength = idata;\n for (let i = 1; i < length; ++i) {\n data.copyWithin(tlength, 0, idata);\n tlength += idata;\n }\n this.print(data, 0, tlength);\n return true;\n }\n\n /**\n * CSI Ps c Send Device Attributes (Primary DA).\n * Ps = 0 or omitted -> request attributes from terminal. The\n * response depends on the decTerminalID resource setting.\n * -> CSI ? 1 ; 2 c (``VT100 with Advanced Video Option'')\n * -> CSI ? 1 ; 0 c (``VT101 with No Options'')\n * -> CSI ? 6 c (``VT102'')\n * -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')\n * The VT100-style response parameters do not mean anything by\n * themselves. VT220 parameters do, telling the host what fea-\n * tures the terminal supports:\n * Ps = 1 -> 132-columns.\n * Ps = 2 -> Printer.\n * Ps = 6 -> Selective erase.\n * Ps = 8 -> User-defined keys.\n * Ps = 9 -> National replacement character sets.\n * Ps = 1 5 -> Technical characters.\n * Ps = 2 2 -> ANSI color, e.g., VT525.\n * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode).\n *\n * @vt: #Y CSI DA1 \"Primary Device Attributes\" \"CSI c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesPrimary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n if (this._is('xterm') || this._is('rxvt-unicode') || this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?1;2c');\n } else if (this._is('linux')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?6c');\n }\n return true;\n }\n\n /**\n * CSI > Ps c\n * Send Device Attributes (Secondary DA).\n * Ps = 0 or omitted -> request the terminal's identification\n * code. The response depends on the decTerminalID resource set-\n * ting. It should apply only to VT220 and up, but xterm extends\n * this to VT100.\n * -> CSI > Pp ; Pv ; Pc c\n * where Pp denotes the terminal type\n * Pp = 0 -> ``VT100''.\n * Pp = 1 -> ``VT220''.\n * and Pv is the firmware version (for xterm, this was originally\n * the XFree86 patch number, starting with 95). In a DEC termi-\n * nal, Pc indicates the ROM cartridge registration number and is\n * always zero.\n * More information:\n * xterm/charproc.c - line 2012, for more information.\n * vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)\n *\n * @vt: #Y CSI DA2 \"Secondary Device Attributes\" \"CSI > c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesSecondary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n // xterm and urxvt\n // seem to spit this\n // out around ~370 times (?).\n if (this._is('xterm')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>0;276;0c');\n } else if (this._is('rxvt-unicode')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>85;95;0c');\n } else if (this._is('linux')) {\n // not supported by linux console.\n // linux console echoes parameters.\n this._coreService.triggerDataEvent(params.params[0] + 'c');\n } else if (this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>83;40003;0c');\n }\n return true;\n }\n\n /**\n * Evaluate if the current terminal is the given argument.\n * @param term The terminal name to evaluate\n */\n private _is(term: string): boolean {\n return (this._optionsService.rawOptions.termName + '').indexOf(term) === 0;\n }\n\n /**\n * CSI Pm h Set Mode (SM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Insert Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Automatic Newline (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI SM \"Set Mode\" \"CSI Pm h\" \"Set various terminal modes.\"\n * Supported param values by SM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Insert Mode (IRM). | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Automatic Newline (LNM). | #Y |\n */\n public setMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = true;\n break;\n case 20:\n this._optionsService.options.convertEol = true;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm h\n * DEC Private Mode Set (DECSET).\n * Ps = 1 -> Application Cursor Keys (DECCKM).\n * Ps = 2 -> Designate USASCII for character sets G0-G3\n * (DECANM), and set VT100 mode.\n * Ps = 3 -> 132 Column Mode (DECCOLM).\n * Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).\n * Ps = 5 -> Reverse Video (DECSCNM).\n * Ps = 6 -> Origin Mode (DECOM).\n * Ps = 7 -> Wraparound Mode (DECAWM).\n * Ps = 8 -> Auto-repeat Keys (DECARM).\n * Ps = 9 -> Send Mouse X & Y on button press. See the sec-\n * tion Mouse Tracking.\n * Ps = 1 0 -> Show toolbar (rxvt).\n * Ps = 1 2 -> Start Blinking Cursor (att610).\n * Ps = 1 8 -> Print form feed (DECPFF).\n * Ps = 1 9 -> Set print extent to full screen (DECPEX).\n * Ps = 2 5 -> Show Cursor (DECTCEM).\n * Ps = 3 0 -> Show scrollbar (rxvt).\n * Ps = 3 5 -> Enable font-shifting functions (rxvt).\n * Ps = 3 8 -> Enter Tektronix Mode (DECTEK).\n * Ps = 4 0 -> Allow 80 -> 132 Mode.\n * Ps = 4 1 -> more(1) fix (see curses resource).\n * Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-\n * RCM).\n * Ps = 4 4 -> Turn On Margin Bell.\n * Ps = 4 5 -> Reverse-wraparound Mode.\n * Ps = 4 6 -> Start Logging. This is normally disabled by a\n * compile-time option.\n * Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 6 6 -> Application keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends backspace (DECBKM).\n * Ps = 1 0 0 0 -> Send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Enable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).\n * Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Interpret \"meta\" key, sets eighth bit.\n * (enables the eightBitInput resource).\n * Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-\n * Lock keys. (This enables the numLock resource).\n * Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This\n * enables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete\n * key.\n * Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This\n * enables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Keep selection even if not highlighted.\n * (This enables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Enable Urgency window manager hint when\n * Control-G is received. (This enables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Enable raising of the window when Control-G\n * is received. (enables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate\n * Screen Buffer, clearing it first. (This may be disabled by\n * the titeInhibit resource). This combines the effects of the 1\n * 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based\n * applications rather than the 4 7 mode.\n * Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Set Sun function-key mode.\n * Ps = 1 0 5 2 -> Set HP function-key mode.\n * Ps = 1 0 5 3 -> Set SCO function-key mode.\n * Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Set VT220 keyboard emulation.\n * Ps = 2 0 0 4 -> Set bracketed paste mode.\n * Modes:\n * http: *vt100.net/docs/vt220-rm/chapter4.html\n *\n * @vt: #P[See below for supported modes.] CSI DECSET \"DEC Private Set Mode\" \"CSI ? Pm h\" \"Set various terminal attributes.\"\n * Supported param values by DECSET:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | --------|\n * | 1 | Application Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | #Y |\n * | 3 | 132 Column Mode (DECCOLM). | #Y |\n * | 6 | Origin Mode (DECOM). | #Y |\n * | 7 | Auto-wrap Mode (DECAWM). | #Y |\n * | 8 | Auto-repeat Keys (DECARM). Always on. | #N |\n * | 9 | X10 xterm mouse protocol. | #Y |\n * | 12 | Start Blinking Cursor. | #Y |\n * | 25 | Show Cursor (DECTCEM). | #Y |\n * | 45 | Reverse wrap-around. | #Y |\n * | 47 | Use Alternate Screen Buffer. | #Y |\n * | 66 | Application keypad (DECNKM). | #Y |\n * | 1000 | X11 xterm mouse protocol. | #Y |\n * | 1002 | Use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Use All Motion Mouse Tracking. | #Y |\n * | 1004 | Send FocusIn/FocusOut events | #Y |\n * | 1005 | Enable UTF-8 Mouse Mode. | #N |\n * | 1006 | Enable SGR Mouse Mode. | #Y |\n * | 1015 | Enable urxvt Mouse Mode. | #N |\n * | 1016 | Enable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Alternate Screen Buffer. | #Y |\n * | 1048 | Save cursor as in DECSC. | #Y |\n * | 1049 | Save cursor and switch to alternate buffer clearing it. | #P[Does not clear the alternate buffer.] |\n * | 2004 | Set bracketed paste mode. | #Y |\n *\n *\n * FIXME: implement DECSCNM, 1049 should clear altbuffer\n */\n public setModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = true;\n break;\n case 2:\n this._charsetService.setgCharset(0, DEFAULT_CHARSET);\n this._charsetService.setgCharset(1, DEFAULT_CHARSET);\n this._charsetService.setgCharset(2, DEFAULT_CHARSET);\n this._charsetService.setgCharset(3, DEFAULT_CHARSET);\n // set VT100 mode here\n break;\n case 3:\n /**\n * DECCOLM - 132 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(132, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = true;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = true;\n break;\n case 12:\n this._optionsService.options.cursorBlink = true;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = true;\n break;\n case 66:\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n // no release, no motion, no wheel, no modifiers.\n this._coreMouseService.activeProtocol = 'X10';\n break;\n case 1000: // vt200 mouse\n // no motion.\n this._coreMouseService.activeProtocol = 'VT200';\n break;\n case 1002: // button event mouse\n this._coreMouseService.activeProtocol = 'DRAG';\n break;\n case 1003: // any event mouse\n // any event - sends motion events,\n // even if there is no button held down.\n this._coreMouseService.activeProtocol = 'ANY';\n break;\n case 1004: // send focusin/focusout events\n // focusin: ^[[I\n // focusout: ^[[O\n this._coreService.decPrivateModes.sendFocus = true;\n this._onRequestSendFocus.fire();\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'SGR';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'SGR_PIXELS';\n break;\n case 25: // show cursor\n this._coreService.isCursorHidden = false;\n break;\n case 1048: // alt screen cursor\n this.saveCursor();\n break;\n case 1049: // alt screen buffer cursor\n this.saveCursor();\n // FALL-THROUGH\n case 47: // alt screen buffer\n case 1047: // alt screen buffer\n this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = true;\n break;\n }\n }\n return true;\n }\n\n\n /**\n * CSI Pm l Reset Mode (RM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Replace Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Normal Linefeed (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI RM \"Reset Mode\" \"CSI Pm l\" \"Set various terminal attributes.\"\n * Supported param values by RM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Replace Mode (IRM). (default) | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Normal Linefeed (LNM). | #Y |\n *\n *\n * FIXME: why is LNM commented out?\n */\n public resetMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = false;\n break;\n case 20:\n this._optionsService.options.convertEol = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm l\n * DEC Private Mode Reset (DECRST).\n * Ps = 1 -> Normal Cursor Keys (DECCKM).\n * Ps = 2 -> Designate VT52 mode (DECANM).\n * Ps = 3 -> 80 Column Mode (DECCOLM).\n * Ps = 4 -> Jump (Fast) Scroll (DECSCLM).\n * Ps = 5 -> Normal Video (DECSCNM).\n * Ps = 6 -> Normal Cursor Mode (DECOM).\n * Ps = 7 -> No Wraparound Mode (DECAWM).\n * Ps = 8 -> No Auto-repeat Keys (DECARM).\n * Ps = 9 -> Don't send Mouse X & Y on button press.\n * Ps = 1 0 -> Hide toolbar (rxvt).\n * Ps = 1 2 -> Stop Blinking Cursor (att610).\n * Ps = 1 8 -> Don't print form feed (DECPFF).\n * Ps = 1 9 -> Limit print to scrolling region (DECPEX).\n * Ps = 2 5 -> Hide Cursor (DECTCEM).\n * Ps = 3 0 -> Don't show scrollbar (rxvt).\n * Ps = 3 5 -> Disable font-shifting functions (rxvt).\n * Ps = 4 0 -> Disallow 80 -> 132 Mode.\n * Ps = 4 1 -> No more(1) fix (see curses resource).\n * Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-\n * NRCM).\n * Ps = 4 4 -> Turn Off Margin Bell.\n * Ps = 4 5 -> No Reverse-wraparound Mode.\n * Ps = 4 6 -> Stop Logging. (This is normally disabled by a\n * compile-time option).\n * Ps = 4 7 -> Use Normal Screen Buffer.\n * Ps = 6 6 -> Numeric keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends delete (DECBKM).\n * Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Disable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Don't scroll to bottom on tty output\n * (rxvt).\n * Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Don't interpret \"meta\" key. (This disables\n * the eightBitInput resource).\n * Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-\n * Lock keys. (This disables the numLock resource).\n * Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.\n * (This disables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad\n * Delete key.\n * Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.\n * (This disables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Do not keep selection when not highlighted.\n * (This disables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Disable Urgency window manager hint when\n * Control-G is received. (This disables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Disable raising of the window when Control-\n * G is received. (This disables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen\n * first if in the Alternate Screen. (This may be disabled by\n * the titeInhibit resource).\n * Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor\n * as in DECRC. (This may be disabled by the titeInhibit\n * resource). This combines the effects of the 1 0 4 7 and 1 0\n * 4 8 modes. Use this with terminfo-based applications rather\n * than the 4 7 mode.\n * Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Reset Sun function-key mode.\n * Ps = 1 0 5 2 -> Reset HP function-key mode.\n * Ps = 1 0 5 3 -> Reset SCO function-key mode.\n * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.\n * Ps = 2 0 0 4 -> Reset bracketed paste mode.\n *\n * @vt: #P[See below for supported modes.] CSI DECRST \"DEC Private Reset Mode\" \"CSI ? Pm l\" \"Reset various terminal attributes.\"\n * Supported param values by DECRST:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | ------- |\n * | 1 | Normal Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate VT52 mode (DECANM). | #N |\n * | 3 | 80 Column Mode (DECCOLM). | #B[Switches to old column width instead of 80.] |\n * | 6 | Normal Cursor Mode (DECOM). | #Y |\n * | 7 | No Wraparound Mode (DECAWM). | #Y |\n * | 8 | No Auto-repeat Keys (DECARM). | #N |\n * | 9 | Don't send Mouse X & Y on button press. | #Y |\n * | 12 | Stop Blinking Cursor. | #Y |\n * | 25 | Hide Cursor (DECTCEM). | #Y |\n * | 45 | No reverse wrap-around. | #Y |\n * | 47 | Use Normal Screen Buffer. | #Y |\n * | 66 | Numeric keypad (DECNKM). | #Y |\n * | 1000 | Don't send Mouse reports. | #Y |\n * | 1002 | Don't use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Don't use All Motion Mouse Tracking. | #Y |\n * | 1004 | Don't send FocusIn/FocusOut events. | #Y |\n * | 1005 | Disable UTF-8 Mouse Mode. | #N |\n * | 1006 | Disable SGR Mouse Mode. | #Y |\n * | 1015 | Disable urxvt Mouse Mode. | #N |\n * | 1016 | Disable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | #Y |\n * | 1048 | Restore cursor as in DECRC. | #Y |\n * | 1049 | Use Normal Screen Buffer and restore cursor. | #Y |\n * | 2004 | Reset bracketed paste mode. | #Y |\n *\n *\n * FIXME: DECCOLM is currently broken (already fixed in window options PR)\n */\n public resetModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = false;\n break;\n case 3:\n /**\n * DECCOLM - 80 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(80, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = false;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = false;\n break;\n case 12:\n this._optionsService.options.cursorBlink = false;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = false;\n break;\n case 66:\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n case 1000: // vt200 mouse\n case 1002: // button event mouse\n case 1003: // any event mouse\n this._coreMouseService.activeProtocol = 'NONE';\n break;\n case 1004: // send focusin/focusout events\n this._coreService.decPrivateModes.sendFocus = false;\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 25: // hide cursor\n this._coreService.isCursorHidden = true;\n break;\n case 1048: // alt screen cursor\n this.restoreCursor();\n break;\n case 1049: // alt screen buffer cursor\n // FALL-THROUGH\n case 47: // normal screen buffer\n case 1047: // normal screen buffer - clearing it first\n // Ensure the selection manager has the correct buffer\n this._bufferService.buffers.activateNormalBuffer();\n if (params.params[i] === 1049) {\n this.restoreCursor();\n }\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI Ps $ p Request ANSI Mode (DECRQM).\n *\n * Reports CSI Ps; Pm $ y (DECRPM), where Ps is the mode number as in SM/RM,\n * and Pm is the mode value:\n * 0 - not recognized\n * 1 - set\n * 2 - reset\n * 3 - permanently set\n * 4 - permanently reset\n *\n * @vt: #Y CSI DECRQM \"Request Mode\" \"CSI Ps $p\" \"Request mode state.\"\n * Returns a report as `CSI Ps; Pm $ y` (DECRPM), where `Ps` is the mode number as in SM/RM\n * or DECSET/DECRST, and `Pm` is the mode value:\n * - 0: not recognized\n * - 1: set\n * - 2: reset\n * - 3: permanently set\n * - 4: permanently reset\n *\n * For modes not understood xterm.js always returns `notRecognized`. In general this means,\n * that a certain operation mode is not implemented and cannot be used.\n *\n * Modes changing the active terminal buffer (47, 1047, 1049) are not subqueried\n * and only report, whether the alternate buffer is set.\n *\n * Mouse encodings and mouse protocols are handled mutual exclusive,\n * thus only one of each of those can be set at a given time.\n *\n * There is a chance, that some mode reports are not fully in line with xterm.js' behavior,\n * e.g. if the default implementation already exposes a certain behavior. If you find\n * discrepancies in the mode reports, please file a bug.\n */\n public requestMode(params: IParams, ansi: boolean): boolean {\n // return value as in DECRPM\n const enum V {\n NOT_RECOGNIZED = 0,\n SET = 1,\n RESET = 2,\n PERMANENTLY_SET = 3,\n PERMANENTLY_RESET = 4\n }\n\n // access helpers\n const dm = this._coreService.decPrivateModes;\n const { activeProtocol: mouseProtocol, activeEncoding: mouseEncoding } = this._coreMouseService;\n const cs = this._coreService;\n const { buffers, cols } = this._bufferService;\n const { active, alt } = buffers;\n const opts = this._optionsService.rawOptions;\n\n const f = (m: number, v: V): boolean => {\n cs.triggerDataEvent(`${C0.ESC}[${ansi ? '' : '?'}${m};${v}$y`);\n return true;\n };\n const b2v = (value: boolean): V => value ? V.SET : V.RESET;\n\n const p = params.params[0];\n\n if (ansi) {\n if (p === 2) return f(p, V.PERMANENTLY_RESET);\n if (p === 4) return f(p, b2v(cs.modes.insertMode));\n if (p === 12) return f(p, V.PERMANENTLY_SET);\n if (p === 20) return f(p, b2v(opts.convertEol));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n if (p === 1) return f(p, b2v(dm.applicationCursorKeys));\n if (p === 3) return f(p, opts.windowOptions.setWinLines ? (cols === 80 ? V.RESET : cols === 132 ? V.SET : V.NOT_RECOGNIZED) : V.NOT_RECOGNIZED);\n if (p === 6) return f(p, b2v(dm.origin));\n if (p === 7) return f(p, b2v(dm.wraparound));\n if (p === 8) return f(p, V.PERMANENTLY_SET);\n if (p === 9) return f(p, b2v(mouseProtocol === 'X10'));\n if (p === 12) return f(p, b2v(opts.cursorBlink));\n if (p === 25) return f(p, b2v(!cs.isCursorHidden));\n if (p === 45) return f(p, b2v(dm.reverseWraparound));\n if (p === 66) return f(p, b2v(dm.applicationKeypad));\n if (p === 67) return f(p, V.PERMANENTLY_RESET);\n if (p === 1000) return f(p, b2v(mouseProtocol === 'VT200'));\n if (p === 1002) return f(p, b2v(mouseProtocol === 'DRAG'));\n if (p === 1003) return f(p, b2v(mouseProtocol === 'ANY'));\n if (p === 1004) return f(p, b2v(dm.sendFocus));\n if (p === 1005) return f(p, V.PERMANENTLY_RESET);\n if (p === 1006) return f(p, b2v(mouseEncoding === 'SGR'));\n if (p === 1015) return f(p, V.PERMANENTLY_RESET);\n if (p === 1016) return f(p, b2v(mouseEncoding === 'SGR_PIXELS'));\n if (p === 1048) return f(p, V.SET); // xterm always returns SET here\n if (p === 47 || p === 1047 || p === 1049) return f(p, b2v(active === alt));\n if (p === 2004) return f(p, b2v(dm.bracketedPasteMode));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n /**\n * Helper to write color information packed with color mode.\n */\n private _updateAttrColor(color: number, mode: number, c1: number, c2: number, c3: number): number {\n if (mode === 2) {\n color |= Attributes.CM_RGB;\n color &= ~Attributes.RGB_MASK;\n color |= AttributeData.fromColorRGB([c1, c2, c3]);\n } else if (mode === 5) {\n color &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n color |= Attributes.CM_P256 | (c1 & 0xff);\n }\n return color;\n }\n\n /**\n * Helper to extract and apply color params/subparams.\n * Returns advance for params index.\n */\n private _extractColor(params: IParams, pos: number, attr: IAttributeData): number {\n // normalize params\n // meaning: [target, CM, ign, val, val, val]\n // RGB : [ 38/48, 2, ign, r, g, b]\n // P256 : [ 38/48, 5, ign, v, ign, ign]\n const accu = [0, 0, -1, 0, 0, 0];\n\n // alignment placeholder for non color space sequences\n let cSpace = 0;\n\n // return advance we took in params\n let advance = 0;\n\n do {\n accu[advance + cSpace] = params.params[pos + advance];\n if (params.hasSubParams(pos + advance)) {\n const subparams = params.getSubParams(pos + advance)!;\n let i = 0;\n do {\n if (accu[1] === 5) {\n cSpace = 1;\n }\n accu[advance + i + 1 + cSpace] = subparams[i];\n } while (++i < subparams.length && i + advance + 1 + cSpace < accu.length);\n break;\n }\n // exit early if can decide color mode with semicolons\n if ((accu[1] === 5 && advance + cSpace >= 2)\n || (accu[1] === 2 && advance + cSpace >= 5)) {\n break;\n }\n // offset colorSpace slot for semicolon mode\n if (accu[1]) {\n cSpace = 1;\n }\n } while (++advance + pos < params.length && advance + cSpace < accu.length);\n\n // set default values to 0\n for (let i = 2; i < accu.length; ++i) {\n if (accu[i] === -1) {\n accu[i] = 0;\n }\n }\n\n // apply colors\n switch (accu[0]) {\n case 38:\n attr.fg = this._updateAttrColor(attr.fg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 48:\n attr.bg = this._updateAttrColor(attr.bg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 58:\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = this._updateAttrColor(attr.extended.underlineColor, accu[1], accu[3], accu[4], accu[5]);\n }\n\n return advance;\n }\n\n /**\n * SGR 4 subparams:\n * 4:0 - equal to SGR 24 (turn off all underline)\n * 4:1 - equal to SGR 4 (single underline)\n * 4:2 - equal to SGR 21 (double underline)\n * 4:3 - curly underline\n * 4:4 - dotted underline\n * 4:5 - dashed underline\n */\n private _processUnderline(style: number, attr: IAttributeData): void {\n // treat extended attrs as immutable, thus always clone from old one\n // this is needed since the buffer only holds references to it\n attr.extended = attr.extended.clone();\n\n // default to 1 == single underline\n if (!~style || style > 5) {\n style = 1;\n }\n attr.extended.underlineStyle = style;\n attr.fg |= FgFlags.UNDERLINE;\n\n // 0 deactivates underline\n if (style === 0) {\n attr.fg &= ~FgFlags.UNDERLINE;\n }\n\n // update HAS_EXTENDED in BG\n attr.updateExtended();\n }\n\n private _processSGR0(attr: IAttributeData): void {\n attr.fg = DEFAULT_ATTR_DATA.fg;\n attr.bg = DEFAULT_ATTR_DATA.bg;\n attr.extended = attr.extended.clone();\n // Reset underline style and color. Note that we don't want to reset other\n // fields such as the url id.\n attr.extended.underlineStyle = UnderlineStyle.NONE;\n attr.extended.underlineColor &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.updateExtended();\n }\n\n /**\n * CSI Pm m Character Attributes (SGR).\n *\n * @vt: #P[See below for supported attributes.] CSI SGR \"Select Graphic Rendition\" \"CSI Pm m\" \"Set/Reset various text attributes.\"\n * SGR selects one or more character attributes at the same time. Multiple params (up to 32)\n * are applied in order from left to right. The changed attributes are applied to all new\n * characters received. If you move characters in the viewport by scrolling or any other means,\n * then the attributes move with the characters.\n *\n * Supported param values by SGR:\n *\n * | Param | Meaning | Support |\n * | --------- | -------------------------------------------------------- | ------- |\n * | 0 | Normal (default). Resets any other preceding SGR. | #Y |\n * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | #Y |\n * | 2 | Faint, decreased intensity. | #Y |\n * | 3 | Italic. | #Y |\n * | 4 | Underlined (see below for style support). | #Y |\n * | 5 | Slowly blinking. | #N |\n * | 6 | Rapidly blinking. | #N |\n * | 7 | Inverse. Flips foreground and background color. | #Y |\n * | 8 | Invisible (hidden). | #Y |\n * | 9 | Crossed-out characters (strikethrough). | #Y |\n * | 21 | Doubly underlined. | #Y |\n * | 22 | Normal (neither bold nor faint). | #Y |\n * | 23 | No italic. | #Y |\n * | 24 | Not underlined. | #Y |\n * | 25 | Steady (not blinking). | #Y |\n * | 27 | Positive (not inverse). | #Y |\n * | 28 | Visible (not hidden). | #Y |\n * | 29 | Not Crossed-out (strikethrough). | #Y |\n * | 30 | Foreground color: Black. | #Y |\n * | 31 | Foreground color: Red. | #Y |\n * | 32 | Foreground color: Green. | #Y |\n * | 33 | Foreground color: Yellow. | #Y |\n * | 34 | Foreground color: Blue. | #Y |\n * | 35 | Foreground color: Magenta. | #Y |\n * | 36 | Foreground color: Cyan. | #Y |\n * | 37 | Foreground color: White. | #Y |\n * | 38 | Foreground color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 39 | Foreground color: Default (original). | #Y |\n * | 40 | Background color: Black. | #Y |\n * | 41 | Background color: Red. | #Y |\n * | 42 | Background color: Green. | #Y |\n * | 43 | Background color: Yellow. | #Y |\n * | 44 | Background color: Blue. | #Y |\n * | 45 | Background color: Magenta. | #Y |\n * | 46 | Background color: Cyan. | #Y |\n * | 47 | Background color: White. | #Y |\n * | 48 | Background color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 49 | Background color: Default (original). | #Y |\n * | 53 | Overlined. | #Y |\n * | 55 | Not Overlined. | #Y |\n * | 58 | Underline color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y |\n * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y |\n *\n * Underline supports subparams to denote the style in the form `4 : x`:\n *\n * | x | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | No underline. Same as `SGR 24 m`. | #Y |\n * | 1 | Single underline. Same as `SGR 4 m`. | #Y |\n * | 2 | Double underline. | #Y |\n * | 3 | Curly underline. | #Y |\n * | 4 | Dotted underline. | #Y |\n * | 5 | Dashed underline. | #Y |\n * | other | Single underline. Same as `SGR 4 m`. | #Y |\n *\n * Extended colors are supported for foreground (Ps=38), background (Ps=48) and underline (Ps=58)\n * as follows:\n *\n * | Ps + 1 | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | Implementation defined. | #N |\n * | 1 | Transparent. | #N |\n * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | #Y |\n * | 3 | CMY color. | #N |\n * | 4 | CMYK color. | #N |\n * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | #Y |\n *\n *\n * FIXME: blinking is implemented in attrs, but not working in renderers?\n * FIXME: remove dead branch for p=100\n */\n public charAttributes(params: IParams): boolean {\n // Optimize a single SGR0.\n if (params.length === 1 && params.params[0] === 0) {\n this._processSGR0(this._curAttrData);\n return true;\n }\n\n const l = params.length;\n let p;\n const attr = this._curAttrData;\n\n for (let i = 0; i < l; i++) {\n p = params.params[i];\n if (p >= 30 && p <= 37) {\n // fg color 8\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 30);\n } else if (p >= 40 && p <= 47) {\n // bg color 8\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 40);\n } else if (p >= 90 && p <= 97) {\n // fg color 16\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 90) | 8;\n } else if (p >= 100 && p <= 107) {\n // bg color 16\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 100) | 8;\n } else if (p === 0) {\n // default\n this._processSGR0(attr);\n } else if (p === 1) {\n // bold text\n attr.fg |= FgFlags.BOLD;\n } else if (p === 3) {\n // italic text\n attr.bg |= BgFlags.ITALIC;\n } else if (p === 4) {\n // underlined text\n attr.fg |= FgFlags.UNDERLINE;\n this._processUnderline(params.hasSubParams(i) ? params.getSubParams(i)![0] : UnderlineStyle.SINGLE, attr);\n } else if (p === 5) {\n // blink\n attr.fg |= FgFlags.BLINK;\n } else if (p === 7) {\n // inverse and positive\n // test with: echo -e '\\e[31m\\e[42mhello\\e[7mworld\\e[27mhi\\e[m'\n attr.fg |= FgFlags.INVERSE;\n } else if (p === 8) {\n // invisible\n attr.fg |= FgFlags.INVISIBLE;\n } else if (p === 9) {\n // strikethrough\n attr.fg |= FgFlags.STRIKETHROUGH;\n } else if (p === 2) {\n // dimmed text\n attr.bg |= BgFlags.DIM;\n } else if (p === 21) {\n // double underline\n this._processUnderline(UnderlineStyle.DOUBLE, attr);\n } else if (p === 22) {\n // not bold nor faint\n attr.fg &= ~FgFlags.BOLD;\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 23) {\n // not italic\n attr.bg &= ~BgFlags.ITALIC;\n } else if (p === 24) {\n // not underlined\n attr.fg &= ~FgFlags.UNDERLINE;\n this._processUnderline(UnderlineStyle.NONE, attr);\n } else if (p === 25) {\n // not blink\n attr.fg &= ~FgFlags.BLINK;\n } else if (p === 27) {\n // not inverse\n attr.fg &= ~FgFlags.INVERSE;\n } else if (p === 28) {\n // not invisible\n attr.fg &= ~FgFlags.INVISIBLE;\n } else if (p === 29) {\n // not strikethrough\n attr.fg &= ~FgFlags.STRIKETHROUGH;\n } else if (p === 39) {\n // reset fg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 49) {\n // reset bg\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 38 || p === 48 || p === 58) {\n // fg color 256 and RGB\n i += this._extractColor(params, i, attr);\n } else if (p === 53) {\n // overline\n attr.bg |= BgFlags.OVERLINE;\n } else if (p === 55) {\n // not overline\n attr.bg &= ~BgFlags.OVERLINE;\n } else if (p === 59) {\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = -1;\n attr.updateExtended();\n } else if (p === 100) { // FIXME: dead branch, p=100 already handled above!\n // reset fg/bg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else {\n this._logService.debug('Unknown SGR attribute: %d.', p);\n }\n }\n return true;\n }\n\n /**\n * CSI Ps n Device Status Report (DSR).\n * Ps = 5 -> Status Report. Result (``OK'') is\n * CSI 0 n\n * Ps = 6 -> Report Cursor Position (CPR) [row;column].\n * Result is\n * CSI r ; c R\n * CSI ? Ps n\n * Device Status Report (DSR, DEC-specific).\n * Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI\n * ? r ; c R (assumes page is zero).\n * Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).\n * or CSI ? 1 1 n (not ready).\n * Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)\n * or CSI ? 2 1 n (locked).\n * Ps = 2 6 -> Report Keyboard status as\n * CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote key-\n * board ready and LK01 respectively.\n * Ps = 5 3 -> Report Locator status as\n * CSI ? 5 3 n Locator available, if compiled-in, or\n * CSI ? 5 0 n No Locator, if not.\n *\n * @vt: #Y CSI DSR \"Device Status Report\" \"CSI Ps n\" \"Request cursor position (CPR) with `Ps` = 6.\"\n */\n public deviceStatus(params: IParams): boolean {\n switch (params.params[0]) {\n case 5:\n // status report\n this._coreService.triggerDataEvent(`${C0.ESC}[0n`);\n break;\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[${y};${x}R`);\n break;\n }\n return true;\n }\n\n // @vt: #P[Only CPR is supported.] CSI DECDSR \"DEC Device Status Report\" \"CSI ? Ps n\" \"Only CPR is supported (same as DSR).\"\n public deviceStatusPrivate(params: IParams): boolean {\n // modern xterm doesnt seem to\n // respond to any of these except ?6, 6, and 5\n switch (params.params[0]) {\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${y};${x}R`);\n break;\n case 15:\n // no printer\n // this.handler(C0.ESC + '[?11n');\n break;\n case 25:\n // dont support user defined keys\n // this.handler(C0.ESC + '[?21n');\n break;\n case 26:\n // north american keyboard\n // this.handler(C0.ESC + '[?27;1;0;0n');\n break;\n case 53:\n // no dec locator/mouse\n // this.handler(C0.ESC + '[?50n');\n break;\n }\n return true;\n }\n\n /**\n * CSI ! p Soft terminal reset (DECSTR).\n * http://vt100.net/docs/vt220-rm/table4-10.html\n *\n * @vt: #Y CSI DECSTR \"Soft Terminal Reset\" \"CSI ! p\" \"Reset several terminal attributes to initial state.\"\n * There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full\n * terminal bootstrap, DECSTR only resets certain attributes. For most needs DECSTR should be\n * sufficient.\n *\n * The following terminal attributes are reset to default values:\n * - IRM is reset (dafault = false)\n * - scroll margins are reset (default = viewport size)\n * - erase attributes are reset to default\n * - charsets are reset\n * - DECSC data is reset to initial values\n * - DECOM is reset to absolute mode\n *\n *\n * FIXME: there are several more attributes missing (see VT520 manual)\n */\n public softReset(params: IParams): boolean {\n this._coreService.isCursorHidden = false;\n this._onRequestSyncScrollBar.fire();\n this._activeBuffer.scrollTop = 0;\n this._activeBuffer.scrollBottom = this._bufferService.rows - 1;\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._coreService.reset();\n this._charsetService.reset();\n\n // reset DECSC data\n this._activeBuffer.savedX = 0;\n this._activeBuffer.savedY = this._activeBuffer.ybase;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n\n // reset DECOM\n this._coreService.decPrivateModes.origin = false;\n return true;\n }\n\n /**\n * CSI Ps SP q Set cursor style (DECSCUSR, VT520).\n * Ps = 0 -> blinking block.\n * Ps = 1 -> blinking block (default).\n * Ps = 2 -> steady block.\n * Ps = 3 -> blinking underline.\n * Ps = 4 -> steady underline.\n * Ps = 5 -> blinking bar (xterm).\n * Ps = 6 -> steady bar (xterm).\n *\n * @vt: #Y CSI DECSCUSR \"Set Cursor Style\" \"CSI Ps SP q\" \"Set cursor style.\"\n * Supported cursor styles:\n * - empty, 0 or 1: steady block\n * - 2: blink block\n * - 3: steady underline\n * - 4: blink underline\n * - 5: steady bar\n * - 6: blink bar\n */\n public setCursorStyle(params: IParams): boolean {\n const param = params.params[0] || 1;\n switch (param) {\n case 1:\n case 2:\n this._optionsService.options.cursorStyle = 'block';\n break;\n case 3:\n case 4:\n this._optionsService.options.cursorStyle = 'underline';\n break;\n case 5:\n case 6:\n this._optionsService.options.cursorStyle = 'bar';\n break;\n }\n const isBlinking = param % 2 === 1;\n this._optionsService.options.cursorBlink = isBlinking;\n return true;\n }\n\n /**\n * CSI Ps ; Ps r\n * Set Scrolling Region [top;bottom] (default = full size of win-\n * dow) (DECSTBM).\n *\n * @vt: #Y CSI DECSTBM \"Set Top and Bottom Margin\" \"CSI Ps ; Ps r\" \"Set top and bottom margins of the viewport [top;bottom] (default = viewport size).\"\n */\n public setScrollRegion(params: IParams): boolean {\n const top = params.params[0] || 1;\n let bottom: number;\n\n if (params.length < 2 || (bottom = params.params[1]) > this._bufferService.rows || bottom === 0) {\n bottom = this._bufferService.rows;\n }\n\n if (bottom > top) {\n this._activeBuffer.scrollTop = top - 1;\n this._activeBuffer.scrollBottom = bottom - 1;\n this._setCursor(0, 0);\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps ; Ps t - Various window manipulations and reports (xterm)\n *\n * Note: Only those listed below are supported. All others are left to integrators and\n * need special treatment based on the embedding environment.\n *\n * Ps = 1 4 supported\n * Report xterm text area size in pixels.\n * Result is CSI 4 ; height ; width t\n * Ps = 14 ; 2 not implemented\n * Ps = 16 supported\n * Report xterm character cell size in pixels.\n * Result is CSI 6 ; height ; width t\n * Ps = 18 supported\n * Report the size of the text area in characters.\n * Result is CSI 8 ; height ; width t\n * Ps = 20 supported\n * Report xterm window's icon label.\n * Result is OSC L label ST\n * Ps = 21 supported\n * Report xterm window's title.\n * Result is OSC l label ST\n * Ps = 22 ; 0 -> Save xterm icon and window title on stack. supported\n * Ps = 22 ; 1 -> Save xterm icon title on stack. supported\n * Ps = 22 ; 2 -> Save xterm window title on stack. supported\n * Ps = 23 ; 0 -> Restore xterm icon and window title from stack. supported\n * Ps = 23 ; 1 -> Restore xterm icon title from stack. supported\n * Ps = 23 ; 2 -> Restore xterm window title from stack. supported\n * Ps >= 24 not implemented\n */\n public windowOptions(params: IParams): boolean {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n const second = (params.length > 1) ? params.params[1] : 0;\n switch (params.params[0]) {\n case 14: // GetWinSizePixels, returns CSI 4 ; height ; width t\n if (second !== 2) {\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_WIN_SIZE_PIXELS);\n }\n break;\n case 16: // GetCellSizePixels, returns CSI 6 ; height ; width t\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_CELL_SIZE_PIXELS);\n break;\n case 18: // GetWinSizeChars, returns CSI 8 ; height ; width t\n if (this._bufferService) {\n this._coreService.triggerDataEvent(`${C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);\n }\n break;\n case 22: // PushTitle\n if (second === 0 || second === 2) {\n this._windowTitleStack.push(this._windowTitle);\n if (this._windowTitleStack.length > STACK_LIMIT) {\n this._windowTitleStack.shift();\n }\n }\n if (second === 0 || second === 1) {\n this._iconNameStack.push(this._iconName);\n if (this._iconNameStack.length > STACK_LIMIT) {\n this._iconNameStack.shift();\n }\n }\n break;\n case 23: // PopTitle\n if (second === 0 || second === 2) {\n if (this._windowTitleStack.length) {\n this.setTitle(this._windowTitleStack.pop()!);\n }\n }\n if (second === 0 || second === 1) {\n if (this._iconNameStack.length) {\n this.setIconName(this._iconNameStack.pop()!);\n }\n }\n break;\n }\n return true;\n }\n\n\n /**\n * CSI s\n * ESC 7\n * Save cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCOSC \"Save Cursor\" \"CSI s\" \"Save cursor position, charmap and text attributes.\"\n * @vt: #Y ESC SC \"Save Cursor\" \"ESC 7\" \"Save cursor position, charmap and text attributes.\"\n */\n public saveCursor(params?: IParams): boolean {\n this._activeBuffer.savedX = this._activeBuffer.x;\n this._activeBuffer.savedY = this._activeBuffer.ybase + this._activeBuffer.y;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n return true;\n }\n\n\n /**\n * CSI u\n * ESC 8\n * Restore cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCORC \"Restore Cursor\" \"CSI u\" \"Restore cursor position, charmap and text attributes.\"\n * @vt: #Y ESC RC \"Restore Cursor\" \"ESC 8\" \"Restore cursor position, charmap and text attributes.\"\n */\n public restoreCursor(params?: IParams): boolean {\n this._activeBuffer.x = this._activeBuffer.savedX || 0;\n this._activeBuffer.y = Math.max(this._activeBuffer.savedY - this._activeBuffer.ybase, 0);\n this._curAttrData.fg = this._activeBuffer.savedCurAttrData.fg;\n this._curAttrData.bg = this._activeBuffer.savedCurAttrData.bg;\n this._charsetService.charset = (this as any)._savedCharset;\n if (this._activeBuffer.savedCharset) {\n this._charsetService.charset = this._activeBuffer.savedCharset;\n }\n this._restrictCursor();\n return true;\n }\n\n\n /**\n * OSC 2; ST (set window title)\n * Proxy to set window title.\n *\n * @vt: #P[Icon name is not exposed.] OSC 0 \"Set Windows Title and Icon Name\" \"OSC 0 ; Pt BEL\" \"Set window title and icon name.\"\n * Icon name is not supported. For Window Title see below.\n *\n * @vt: #Y OSC 2 \"Set Windows Title\" \"OSC 2 ; Pt BEL\" \"Set window title.\"\n * xterm.js does not manipulate the title directly, instead exposes changes via the event\n * `Terminal.onTitleChange`.\n */\n public setTitle(data: string): boolean {\n this._windowTitle = data;\n this._onTitleChange.fire(data);\n return true;\n }\n\n /**\n * OSC 1; ST\n * Note: Icon name is not exposed.\n */\n public setIconName(data: string): boolean {\n this._iconName = data;\n return true;\n }\n\n /**\n * OSC 4; ; ST (set ANSI color to )\n *\n * @vt: #Y OSC 4 \"Set ANSI color\" \"OSC 4 ; c ; spec BEL\" \"Change color number `c` to the color specified by `spec`.\"\n * `c` is the color index between 0 and 255. The color format of `spec` is derived from\n * `XParseColor` (see OSC 10 for supported formats). There may be multipe `c ; spec` pairs present\n * in the same instruction. If `spec` contains `?` the terminal returns a sequence with the\n * currently set color.\n */\n public setOrReportIndexedColor(data: string): boolean {\n const event: IColorEvent = [];\n const slots = data.split(';');\n while (slots.length > 1) {\n const idx = slots.shift() as string;\n const spec = slots.shift() as string;\n if (/^\\d+$/.exec(idx)) {\n const index = parseInt(idx);\n if (isValidColorIndex(index)) {\n if (spec === '?') {\n event.push({ type: ColorRequestType.REPORT, index });\n } else {\n const color = parseColor(spec);\n if (color) {\n event.push({ type: ColorRequestType.SET, index, color });\n }\n }\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 8 ; ; ST - create hyperlink\n * OSC 8 ; ; ST - finish hyperlink\n *\n * Test case:\n *\n * ```sh\n * printf '\\e]8;;http://example.com\\e\\\\This is a link\\e]8;;\\e\\\\\\n'\n * ```\n *\n * @vt: #Y OSC 8 \"Create hyperlink\" \"OSC 8 ; params ; uri BEL\" \"Create a hyperlink to `uri` using `params`.\"\n * `uri` is a hyperlink starting with `http://`, `https://`, `ftp://`, `file://` or `mailto://`. `params` is an\n * optional list of key=value assignments, separated by the : character.\n * Example: `id=xyz123:foo=bar:baz=quux`.\n * Currently only the id key is defined. Cells that share the same ID and URI share hover\n * feedback. Use `OSC 8 ; ; BEL` to finish the current hyperlink.\n */\n public setHyperlink(data: string): boolean {\n // Arg parsing is special cases to support unencoded semi-colons in the URIs (#4944)\n const idx = data.indexOf(';');\n if (idx === -1) {\n // malformed sequence, just return as handled\n return true;\n }\n const id = data.slice(0, idx).trim();\n const uri = data.slice(idx + 1);\n if (uri) {\n return this._createHyperlink(id, uri);\n }\n if (id.trim()) {\n return false;\n }\n return this._finishHyperlink();\n }\n\n private _createHyperlink(params: string, uri: string): boolean {\n // It's legal to open a new hyperlink without explicitly finishing the previous one\n if (this._getCurrentLinkId()) {\n this._finishHyperlink();\n }\n const parsedParams = params.split(':');\n let id: string | undefined;\n const idParamIndex = parsedParams.findIndex(e => e.startsWith('id='));\n if (idParamIndex !== -1) {\n id = parsedParams[idParamIndex].slice(3) || undefined;\n }\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id, uri });\n this._curAttrData.updateExtended();\n return true;\n }\n\n private _finishHyperlink(): boolean {\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = 0;\n this._curAttrData.updateExtended();\n return true;\n }\n\n // special colors - OSC 10 | 11 | 12\n private _specialColors = [SpecialColorIndex.FOREGROUND, SpecialColorIndex.BACKGROUND, SpecialColorIndex.CURSOR];\n\n /**\n * Apply colors requests for special colors in OSC 10 | 11 | 12.\n * Since these commands are stacking from multiple parameters,\n * we handle them in a loop with an entry offset to `_specialColors`.\n */\n private _setOrReportSpecialColor(data: string, offset: number): boolean {\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i, ++offset) {\n if (offset >= this._specialColors.length) break;\n if (slots[i] === '?') {\n this._onColor.fire([{ type: ColorRequestType.REPORT, index: this._specialColors[offset] }]);\n } else {\n const color = parseColor(slots[i]);\n if (color) {\n this._onColor.fire([{ type: ColorRequestType.SET, index: this._specialColors[offset], color }]);\n }\n }\n }\n return true;\n }\n\n /**\n * OSC 10 ; | ST - set or query default foreground color\n *\n * @vt: #Y OSC 10 \"Set or query default foreground color\" \"OSC 10 ; Pt BEL\" \"Set or query default foreground color.\"\n * To set the color, the following color specification formats are supported:\n * - `rgb://` for `, , ` in `h | hh | hhh | hhhh`, where\n * `h` is a single hexadecimal digit (case insignificant). The different widths scale\n * from 4 bit (`h`) to 16 bit (`hhhh`) and get converted to 8 bit (`hh`).\n * - `#RGB` - 4 bits per channel, expanded to `#R0G0B0`\n * - `#RRGGBB` - 8 bits per channel\n * - `#RRRGGGBBB` - 12 bits per channel, truncated to `#RRGGBB`\n * - `#RRRRGGGGBBBB` - 16 bits per channel, truncated to `#RRGGBB`\n *\n * **Note:** X11 named colors are currently unsupported.\n *\n * If `Pt` contains `?` instead of a color specification, the terminal\n * returns a sequence with the current default foreground color\n * (use that sequence to restore the color after changes).\n *\n * **Note:** Other than xterm, xterm.js does not support OSC 12 - 19.\n * Therefore stacking multiple `Pt` separated by `;` only works for the first two entries.\n */\n public setOrReportFgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 0);\n }\n\n /**\n * OSC 11 ; | ST - set or query default background color\n *\n * @vt: #Y OSC 11 \"Set or query default background color\" \"OSC 11 ; Pt BEL\" \"Same as OSC 10, but for default background.\"\n */\n public setOrReportBgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 1);\n }\n\n /**\n * OSC 12 ; | ST - set or query default cursor color\n *\n * @vt: #Y OSC 12 \"Set or query default cursor color\" \"OSC 12 ; Pt BEL\" \"Same as OSC 10, but for default cursor color.\"\n */\n public setOrReportCursorColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 2);\n }\n\n /**\n * OSC 104 ; ST - restore ANSI color \n *\n * @vt: #Y OSC 104 \"Reset ANSI color\" \"OSC 104 ; c BEL\" \"Reset color number `c` to themed color.\"\n * `c` is the color index between 0 and 255. This function restores the default color for `c` as\n * specified by the loaded theme. Any number of `c` parameters may be given.\n * If no parameters are given, the entire indexed color table will be reset.\n */\n public restoreIndexedColor(data: string): boolean {\n if (!data) {\n this._onColor.fire([{ type: ColorRequestType.RESTORE }]);\n return true;\n }\n const event: IColorEvent = [];\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i) {\n if (/^\\d+$/.exec(slots[i])) {\n const index = parseInt(slots[i]);\n if (isValidColorIndex(index)) {\n event.push({ type: ColorRequestType.RESTORE, index });\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 110 ST - restore default foreground color\n *\n * @vt: #Y OSC 110 \"Restore default foreground color\" \"OSC 110 BEL\" \"Restore default foreground to themed color.\"\n */\n public restoreFgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.FOREGROUND }]);\n return true;\n }\n\n /**\n * OSC 111 ST - restore default background color\n *\n * @vt: #Y OSC 111 \"Restore default background color\" \"OSC 111 BEL\" \"Restore default background to themed color.\"\n */\n public restoreBgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.BACKGROUND }]);\n return true;\n }\n\n /**\n * OSC 112 ST - restore default cursor color\n *\n * @vt: #Y OSC 112 \"Restore default cursor color\" \"OSC 112 BEL\" \"Restore default cursor to themed color.\"\n */\n public restoreCursorColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.CURSOR }]);\n return true;\n }\n\n /**\n * ESC E\n * C1.NEL\n * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)\n * Moves cursor to first position on next line.\n *\n * @vt: #Y C1 NEL \"Next Line\" \"\\x85\" \"Move the cursor to the beginning of the next row.\"\n * @vt: #Y ESC NEL \"Next Line\" \"ESC E\" \"Move the cursor to the beginning of the next row.\"\n */\n public nextLine(): boolean {\n this._activeBuffer.x = 0;\n this.index();\n return true;\n }\n\n /**\n * ESC =\n * DEC mnemonic: DECKPAM (https://vt100.net/docs/vt510-rm/DECKPAM.html)\n * Enables the numeric keypad to send application sequences to the host.\n */\n public keypadApplicationMode(): boolean {\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC >\n * DEC mnemonic: DECKPNM (https://vt100.net/docs/vt510-rm/DECKPNM.html)\n * Enables the keypad to send numeric characters to the host.\n */\n public keypadNumericMode(): boolean {\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC % @\n * ESC % G\n * Select default character set. UTF-8 is not supported (string are unicode anyways)\n * therefore ESC % G does the same.\n */\n public selectDefaultCharset(): boolean {\n this._charsetService.setgLevel(0);\n this._charsetService.setgCharset(0, DEFAULT_CHARSET); // US (default)\n return true;\n }\n\n /**\n * ESC ( C\n * Designate G0 Character Set, VT100, ISO 2022.\n * ESC ) C\n * Designate G1 Character Set (ISO 2022, VT100).\n * ESC * C\n * Designate G2 Character Set (ISO 2022, VT220).\n * ESC + C\n * Designate G3 Character Set (ISO 2022, VT220).\n * ESC - C\n * Designate G1 Character Set (VT300).\n * ESC . C\n * Designate G2 Character Set (VT300).\n * ESC / C\n * Designate G3 Character Set (VT300). C = A -> ISO Latin-1 Supplemental. - Supported?\n */\n public selectCharset(collectAndFlag: string): boolean {\n if (collectAndFlag.length !== 2) {\n this.selectDefaultCharset();\n return true;\n }\n if (collectAndFlag[0] === '/') {\n return true; // TODO: Is this supported?\n }\n this._charsetService.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] || DEFAULT_CHARSET);\n return true;\n }\n\n /**\n * ESC D\n * C1.IND\n * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)\n * Moves the cursor down one line in the same column.\n *\n * @vt: #Y C1 IND \"Index\" \"\\x84\" \"Move the cursor one line down scrolling if needed.\"\n * @vt: #Y ESC IND \"Index\" \"ESC D\" \"Move the cursor one line down scrolling if needed.\"\n */\n public index(): boolean {\n this._restrictCursor();\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * ESC H\n * C1.HTS\n * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html)\n * Sets a horizontal tab stop at the column position indicated by\n * the value of the active column when the terminal receives an HTS.\n *\n * @vt: #Y C1 HTS \"Horizontal Tabulation Set\" \"\\x88\" \"Places a tab stop at the current cursor position.\"\n * @vt: #Y ESC HTS \"Horizontal Tabulation Set\" \"ESC H\" \"Places a tab stop at the current cursor position.\"\n */\n public tabSet(): boolean {\n this._activeBuffer.tabs[this._activeBuffer.x] = true;\n return true;\n }\n\n /**\n * ESC M\n * C1.RI\n * DEC mnemonic: HTS\n * Moves the cursor up one line in the same column. If the cursor is at the top margin,\n * the page scrolls down.\n *\n * @vt: #Y ESC IR \"Reverse Index\" \"ESC M\" \"Move the cursor one line up scrolling if needed.\"\n */\n public reverseIndex(): boolean {\n this._restrictCursor();\n if (this._activeBuffer.y === this._activeBuffer.scrollTop) {\n // possibly move the code below to term.reverseScroll();\n // test: echo -ne '\\e[1;1H\\e[44m\\eM\\e[0m'\n // blankLine(true) is xterm/linux behavior\n const scrollRegionHeight = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;\n this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, scrollRegionHeight, 1);\n this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n } else {\n this._activeBuffer.y--;\n this._restrictCursor(); // quickfix to not run out of bounds\n }\n return true;\n }\n\n /**\n * ESC c\n * DEC mnemonic: RIS (https://vt100.net/docs/vt510-rm/RIS.html)\n * Reset to initial state.\n */\n public fullReset(): boolean {\n this._parser.reset();\n this._onRequestReset.fire();\n return true;\n }\n\n public reset(): void {\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._eraseAttrDataInternal = DEFAULT_ATTR_DATA.clone();\n }\n\n /**\n * back_color_erase feature for xterm.\n */\n private _eraseAttrData(): IAttributeData {\n this._eraseAttrDataInternal.bg &= ~(Attributes.CM_MASK | 0xFFFFFF);\n this._eraseAttrDataInternal.bg |= this._curAttrData.bg & ~0xFC000000;\n return this._eraseAttrDataInternal;\n }\n\n /**\n * ESC n\n * ESC o\n * ESC |\n * ESC }\n * ESC ~\n * DEC mnemonic: LS (https://vt100.net/docs/vt510-rm/LS.html)\n * When you use a locking shift, the character set remains in GL or GR until\n * you use another locking shift. (partly supported)\n */\n public setgLevel(level: number): boolean {\n this._charsetService.setgLevel(level);\n return true;\n }\n\n /**\n * ESC # 8\n * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html)\n * This control function fills the complete screen area with\n * a test pattern (E) used for adjusting screen alignment.\n *\n * @vt: #Y ESC DECALN \"Screen Alignment Pattern\" \"ESC # 8\" \"Fill viewport with a test pattern (E).\"\n */\n public screenAlignmentPattern(): boolean {\n // prepare cell data\n const cell = new CellData();\n cell.content = 1 << Content.WIDTH_SHIFT | 'E'.charCodeAt(0);\n cell.fg = this._curAttrData.fg;\n cell.bg = this._curAttrData.bg;\n\n\n this._setCursor(0, 0);\n for (let yOffset = 0; yOffset < this._bufferService.rows; ++yOffset) {\n const row = this._activeBuffer.ybase + this._activeBuffer.y + yOffset;\n const line = this._activeBuffer.lines.get(row);\n if (line) {\n line.fill(cell);\n line.isWrapped = false;\n }\n }\n this._dirtyRowTracker.markAllDirty();\n this._setCursor(0, 0);\n return true;\n }\n\n\n /**\n * DCS $ q Pt ST\n * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html)\n * Request Status String (DECRQSS), VT420 and up.\n * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html)\n *\n * @vt: #P[Limited support, see below.] DCS DECRQSS \"Request Selection or Setting\" \"DCS $ q Pt ST\" \"Request several terminal settings.\"\n * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the\n * corresponding CSI string, `ESC P 0 ST` for invalid requests.\n *\n * Supported requests and responses:\n *\n * | Type | Request | Response (`Pt`) |\n * | -------------------------------- | ----------------- | ----------------------------------------------------- |\n * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) |\n * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ps ; Ps r` |\n * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Ps SP q` |\n * | Protection Attribute (DECSCA) | `DCS $ q \" q ST` | `Ps \" q` (DECSCA 2 is reported as Ps = 0) |\n * | Conformance Level (DECSCL) | `DCS $ q \" p ST` | always reporting `61 ; 1 \" p` (DECSCL is unsupported) |\n *\n *\n * TODO:\n * - fix SGR report\n * - either check which conformance is better suited or remove the report completely\n * --> we are currently a mixture of all up to VT400 but dont follow anyone strictly\n */\n public requestStatusString(data: string, params: IParams): boolean {\n const f = (s: string): boolean => {\n this._coreService.triggerDataEvent(`${C0.ESC}${s}${C0.ESC}\\\\`);\n return true;\n };\n\n // access helpers\n const b = this._bufferService.buffer;\n const opts = this._optionsService.rawOptions;\n const STYLES: { [key: string]: number } = { 'block': 2, 'underline': 4, 'bar': 6 };\n\n if (data === '\"q') return f(`P1$r${this._curAttrData.isProtected() ? 1 : 0}\"q`);\n if (data === '\"p') return f(`P1$r61;1\"p`);\n if (data === 'r') return f(`P1$r${b.scrollTop + 1};${b.scrollBottom + 1}r`);\n // FIXME: report real SGR settings instead of 0m\n if (data === 'm') return f(`P1$r0m`);\n if (data === ' q') return f(`P1$r${STYLES[opts.cursorStyle] - (opts.cursorBlink ? 1 : 0)} q`);\n return f(`P0$r`);\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n this._dirtyRowTracker.markRangeDirty(y1, y2);\n }\n}\n\nexport interface IDirtyRowTracker {\n readonly start: number;\n readonly end: number;\n\n clearRange(): void;\n markDirty(y: number): void;\n markRangeDirty(y1: number, y2: number): void;\n markAllDirty(): void;\n}\n\nclass DirtyRowTracker implements IDirtyRowTracker {\n public start!: number;\n public end!: number;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n this.clearRange();\n }\n\n public clearRange(): void {\n this.start = this._bufferService.buffer.y;\n this.end = this._bufferService.buffer.y;\n }\n\n public markDirty(y: number): void {\n if (y < this.start) {\n this.start = y;\n } else if (y > this.end) {\n this.end = y;\n }\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n if (y1 > y2) {\n $temp = y1;\n y1 = y2;\n y2 = $temp;\n }\n if (y1 < this.start) {\n this.start = y1;\n }\n if (y2 > this.end) {\n this.end = y2;\n }\n }\n\n public markAllDirty(): void {\n this.markRangeDirty(0, this._bufferService.rows - 1);\n }\n}\n\nexport function isValidColorIndex(value: number): value is ColorIndex {\n return 0 <= value && value < 256;\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport class TwoKeyMap {\n private _data: { [bg: string | number]: { [fg: string | number]: TValue | undefined } | undefined } = {};\n\n public set(first: TFirst, second: TSecond, value: TValue): void {\n if (!this._data[first]) {\n this._data[first] = {};\n }\n this._data[first as string | number]![second] = value;\n }\n\n public get(first: TFirst, second: TSecond): TValue | undefined {\n return this._data[first as string | number] ? this._data[first as string | number]![second] : undefined;\n }\n\n public clear(): void {\n this._data = {};\n }\n}\n\nexport class FourKeyMap {\n private _data: TwoKeyMap> = new TwoKeyMap();\n\n public set(first: TFirst, second: TSecond, third: TThird, fourth: TFourth, value: TValue): void {\n if (!this._data.get(first, second)) {\n this._data.set(first, second, new TwoKeyMap());\n }\n this._data.get(first, second)!.set(third, fourth, value);\n }\n\n public get(first: TFirst, second: TSecond, third: TThird, fourth: TFourth): TValue | undefined {\n return this._data.get(first, second)?.get(third, fourth);\n }\n\n public clear(): void {\n this._data.clear();\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ninterface INavigator {\n userAgent: string;\n language: string;\n platform: string;\n}\n\n// We're declaring a navigator global here as we expect it in all runtimes (node and browser), but\n// we want this module to live in common.\ndeclare const navigator: INavigator;\ndeclare const process: unknown;\n\nexport const isNode = (typeof process !== 'undefined' && 'title' in (process as any)) ? true : false;\nconst userAgent = (isNode) ? 'node' : navigator.userAgent;\nconst platform = (isNode) ? 'node' : navigator.platform;\n\nexport const isFirefox = userAgent.includes('Firefox');\nexport const isLegacyEdge = userAgent.includes('Edge');\nexport const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);\nexport function getSafariVersion(): number {\n if (!isSafari) {\n return 0;\n }\n const majorVersion = userAgent.match(/Version\\/(\\d+)/);\n if (majorVersion === null || majorVersion.length < 2) {\n return 0;\n }\n return parseInt(majorVersion[1]);\n}\n\n// Find the users platform. We use this to interpret the meta key\n// and ISO third level shifts.\n// http://stackoverflow.com/q/19877924/577598\nexport const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform);\nexport const isIpad = platform === 'iPad';\nexport const isIphone = platform === 'iPhone';\nexport const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);\nexport const isLinux = platform.indexOf('Linux') >= 0;\n// Note that when this is true, isLinux will also be true.\nexport const isChromeOS = /\\bCrOS\\b/.test(userAgent);\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IdleTaskQueue } from 'common/TaskQueue';\n\n// Work variables to avoid garbage collection.\nlet i = 0;\n\n/**\n * A generic list that is maintained in sorted order and allows values with duplicate keys. Deferred\n * batch insertion and deletion is used to significantly reduce the time it takes to insert and\n * delete a large amount of items in succession. This list is based on binary search and as such\n * locating a key will take O(log n) amortized, this includes the by key iterator.\n */\nexport class SortedList {\n private _array: T[] = [];\n\n private readonly _insertedValues: T[] = [];\n private readonly _flushInsertedTask = new IdleTaskQueue();\n private _isFlushingInserted = false;\n\n private readonly _deletedIndices: number[] = [];\n private readonly _flushDeletedTask = new IdleTaskQueue();\n private _isFlushingDeleted = false;\n\n constructor(\n private readonly _getKey: (value: T) => number\n ) {\n }\n\n public clear(): void {\n this._array.length = 0;\n this._insertedValues.length = 0;\n this._flushInsertedTask.clear();\n this._isFlushingInserted = false;\n this._deletedIndices.length = 0;\n this._flushDeletedTask.clear();\n this._isFlushingDeleted = false;\n }\n\n public insert(value: T): void {\n this._flushCleanupDeleted();\n if (this._insertedValues.length === 0) {\n this._flushInsertedTask.enqueue(() => this._flushInserted());\n }\n this._insertedValues.push(value);\n }\n\n private _flushInserted(): void {\n const sortedAddedValues = this._insertedValues.sort((a, b) => this._getKey(a) - this._getKey(b));\n let sortedAddedValuesIndex = 0;\n let arrayIndex = 0;\n\n const newArray = new Array(this._array.length + this._insertedValues.length);\n\n for (let newArrayIndex = 0; newArrayIndex < newArray.length; newArrayIndex++) {\n if (arrayIndex >= this._array.length || this._getKey(sortedAddedValues[sortedAddedValuesIndex]) <= this._getKey(this._array[arrayIndex])) {\n newArray[newArrayIndex] = sortedAddedValues[sortedAddedValuesIndex];\n sortedAddedValuesIndex++;\n } else {\n newArray[newArrayIndex] = this._array[arrayIndex++];\n }\n }\n\n this._array = newArray;\n this._insertedValues.length = 0;\n }\n\n private _flushCleanupInserted(): void {\n if (!this._isFlushingInserted && this._insertedValues.length > 0) {\n this._flushInsertedTask.flush();\n }\n }\n\n public delete(value: T): boolean {\n this._flushCleanupInserted();\n if (this._array.length === 0) {\n return false;\n }\n const key = this._getKey(value);\n if (key === undefined) {\n return false;\n }\n i = this._search(key);\n if (i === -1) {\n return false;\n }\n if (this._getKey(this._array[i]) !== key) {\n return false;\n }\n do {\n if (this._array[i] === value) {\n if (this._deletedIndices.length === 0) {\n this._flushDeletedTask.enqueue(() => this._flushDeleted());\n }\n this._deletedIndices.push(i);\n return true;\n }\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n return false;\n }\n\n private _flushDeleted(): void {\n this._isFlushingDeleted = true;\n const sortedDeletedIndices = this._deletedIndices.sort((a, b) => a - b);\n let sortedDeletedIndicesIndex = 0;\n const newArray = new Array(this._array.length - sortedDeletedIndices.length);\n let newArrayIndex = 0;\n for (let i = 0; i < this._array.length; i++) {\n if (sortedDeletedIndices[sortedDeletedIndicesIndex] === i) {\n sortedDeletedIndicesIndex++;\n } else {\n newArray[newArrayIndex++] = this._array[i];\n }\n }\n this._array = newArray;\n this._deletedIndices.length = 0;\n this._isFlushingDeleted = false;\n }\n\n private _flushCleanupDeleted(): void {\n if (!this._isFlushingDeleted && this._deletedIndices.length > 0) {\n this._flushDeletedTask.flush();\n }\n }\n\n public *getKeyIterator(key: number): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n yield this._array[i];\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public forEachByKey(key: number, callback: (value: T) => void): void {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n callback(this._array[i]);\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public values(): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n // Duplicate the array to avoid issues when _array changes while iterating\n return [...this._array].values();\n }\n\n private _search(key: number): number {\n let min = 0;\n let max = this._array.length - 1;\n while (max >= min) {\n let mid = (min + max) >> 1;\n const midKey = this._getKey(this._array[mid]);\n if (midKey > key) {\n max = mid - 1;\n } else if (midKey < key) {\n min = mid + 1;\n } else {\n // key in list, walk to lowest duplicate\n while (mid > 0 && this._getKey(this._array[mid - 1]) === key) {\n mid--;\n }\n return mid;\n }\n }\n // key not in list\n // still return closest min (also used as insert position)\n return min;\n }\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isNode } from 'common/Platform';\n\ninterface ITaskQueue {\n /**\n * Adds a task to the queue which will run in a future idle callback.\n * To avoid perceivable stalls on the mainthread, tasks with heavy workload\n * should split their work into smaller pieces and return `true` to get\n * called again until the work is done (on falsy return value).\n */\n enqueue(task: () => boolean | void): void;\n\n /**\n * Flushes the queue, running all remaining tasks synchronously.\n */\n flush(): void;\n\n /**\n * Clears any remaining tasks from the queue, these will not be run.\n */\n clear(): void;\n}\n\ninterface ITaskDeadline {\n timeRemaining(): number;\n}\ntype CallbackWithDeadline = (deadline: ITaskDeadline) => void;\n\nabstract class TaskQueue implements ITaskQueue {\n private _tasks: (() => boolean | void)[] = [];\n private _idleCallback?: number;\n private _i = 0;\n\n protected abstract _requestCallback(callback: CallbackWithDeadline): number;\n protected abstract _cancelCallback(identifier: number): void;\n\n public enqueue(task: () => boolean | void): void {\n this._tasks.push(task);\n this._start();\n }\n\n public flush(): void {\n while (this._i < this._tasks.length) {\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n }\n this.clear();\n }\n\n public clear(): void {\n if (this._idleCallback) {\n this._cancelCallback(this._idleCallback);\n this._idleCallback = undefined;\n }\n this._i = 0;\n this._tasks.length = 0;\n }\n\n private _start(): void {\n if (!this._idleCallback) {\n this._idleCallback = this._requestCallback(this._process.bind(this));\n }\n }\n\n private _process(deadline: ITaskDeadline): void {\n this._idleCallback = undefined;\n let taskDuration = 0;\n let longestTask = 0;\n let lastDeadlineRemaining = deadline.timeRemaining();\n let deadlineRemaining = 0;\n while (this._i < this._tasks.length) {\n taskDuration = Date.now();\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n // other than performance.now, Date.now might not be stable (changes on wall clock changes),\n // this is not an issue here as a clock change during a short running task is very unlikely\n // in case it still happened and leads to negative duration, simply assume 1 msec\n taskDuration = Math.max(1, Date.now() - taskDuration);\n longestTask = Math.max(taskDuration, longestTask);\n // Guess the following task will take a similar time to the longest task in this batch, allow\n // additional room to try avoid exceeding the deadline\n deadlineRemaining = deadline.timeRemaining();\n if (longestTask * 1.5 > deadlineRemaining) {\n // Warn when the time exceeding the deadline is over 20ms, if this happens in practice the\n // task should be split into sub-tasks to ensure the UI remains responsive.\n if (lastDeadlineRemaining - taskDuration < -20) {\n console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(lastDeadlineRemaining - taskDuration))}ms`);\n }\n this._start();\n return;\n }\n lastDeadlineRemaining = deadlineRemaining;\n }\n this.clear();\n }\n}\n\n/**\n * A queue of that runs tasks over several tasks via setTimeout, trying to maintain above 60 frames\n * per second. The tasks will run in the order they are enqueued, but they will run some time later,\n * and care should be taken to ensure they're non-urgent and will not introduce race conditions.\n */\nexport class PriorityTaskQueue extends TaskQueue {\n protected _requestCallback(callback: CallbackWithDeadline): number {\n return setTimeout(() => callback(this._createDeadline(16)));\n }\n\n protected _cancelCallback(identifier: number): void {\n clearTimeout(identifier);\n }\n\n private _createDeadline(duration: number): ITaskDeadline {\n const end = Date.now() + duration;\n return {\n timeRemaining: () => Math.max(0, end - Date.now())\n };\n }\n}\n\nclass IdleTaskQueueInternal extends TaskQueue {\n protected _requestCallback(callback: IdleRequestCallback): number {\n return requestIdleCallback(callback);\n }\n\n protected _cancelCallback(identifier: number): void {\n cancelIdleCallback(identifier);\n }\n}\n\n/**\n * A queue of that runs tasks over several idle callbacks, trying to respect the idle callback's\n * deadline given by the environment. The tasks will run in the order they are enqueued, but they\n * will run some time later, and care should be taken to ensure they're non-urgent and will not\n * introduce race conditions.\n *\n * This reverts to a {@link PriorityTaskQueue} if the environment does not support idle callbacks.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdleTaskQueue = (!isNode && 'requestIdleCallback' in window) ? IdleTaskQueueInternal : PriorityTaskQueue;\n\n/**\n * An object that tracks a single debounced task that will run on the next idle frame. When called\n * multiple times, only the last set task will run.\n */\nexport class DebouncedIdleTask {\n private _queue: ITaskQueue;\n\n constructor() {\n this._queue = new IdleTaskQueue();\n }\n\n public set(task: () => boolean | void): void {\n this._queue.clear();\n this._queue.enqueue(task);\n }\n\n public flush(): void {\n this._queue.flush();\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';\nimport { IBufferService } from 'common/services/Services';\n\nexport function updateWindowsModeWrappedState(bufferService: IBufferService): void {\n // Winpty does not support wraparound mode which means that lines will never\n // be marked as wrapped. This causes issues for things like copying a line\n // retaining the wrapped new line characters or if consumers are listening\n // in on the data stream.\n //\n // The workaround for this is to listen to every incoming line feed and mark\n // the line as wrapped if the last character in the previous line is not a\n // space. This is certainly not without its problems, but generally on\n // Windows when text reaches the end of the terminal it's likely going to be\n // wrapped.\n const line = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y - 1);\n const lastChar = line?.get(bufferService.cols - 1);\n\n const nextLine = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y);\n if (nextLine && lastChar) {\n nextLine.isWrapped = (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';\nimport { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from 'common/buffer/Constants';\n\nexport class AttributeData implements IAttributeData {\n public static toColorRGB(value: number): IColorRGB {\n return [\n value >>> Attributes.RED_SHIFT & 255,\n value >>> Attributes.GREEN_SHIFT & 255,\n value & 255\n ];\n }\n\n public static fromColorRGB(value: IColorRGB): number {\n return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;\n }\n\n public clone(): IAttributeData {\n const newObj = new AttributeData();\n newObj.fg = this.fg;\n newObj.bg = this.bg;\n newObj.extended = this.extended.clone();\n return newObj;\n }\n\n // data\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n\n // flags\n public isInverse(): number { return this.fg & FgFlags.INVERSE; }\n public isBold(): number { return this.fg & FgFlags.BOLD; }\n public isUnderline(): number {\n if (this.hasExtendedAttrs() && this.extended.underlineStyle !== UnderlineStyle.NONE) {\n return 1;\n }\n return this.fg & FgFlags.UNDERLINE;\n }\n public isBlink(): number { return this.fg & FgFlags.BLINK; }\n public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }\n public isItalic(): number { return this.bg & BgFlags.ITALIC; }\n public isDim(): number { return this.bg & BgFlags.DIM; }\n public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }\n public isProtected(): number { return this.bg & BgFlags.PROTECTED; }\n public isOverline(): number { return this.bg & BgFlags.OVERLINE; }\n\n // color modes\n public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }\n public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }\n public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }\n public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }\n public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }\n\n // colors\n public getFgColor(): number {\n switch (this.fg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n public getBgColor(): number {\n switch (this.bg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n\n // extended attrs\n public hasExtendedAttrs(): number {\n return this.bg & BgFlags.HAS_EXTENDED;\n }\n public updateExtended(): void {\n if (this.extended.isEmpty()) {\n this.bg &= ~BgFlags.HAS_EXTENDED;\n } else {\n this.bg |= BgFlags.HAS_EXTENDED;\n }\n }\n public getUnderlineColor(): number {\n if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {\n switch (this.extended.underlineColor & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;\n default: return this.getFgColor();\n }\n }\n return this.getFgColor();\n }\n public getUnderlineColorMode(): number {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? this.extended.underlineColor & Attributes.CM_MASK\n : this.getFgColorMode();\n }\n public isUnderlineColorRGB(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB\n : this.isFgRGB();\n }\n public isUnderlineColorPalette(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16\n || (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256\n : this.isFgPalette();\n }\n public isUnderlineColorDefault(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === 0\n : this.isFgDefault();\n }\n public getUnderlineStyle(): UnderlineStyle {\n return this.fg & FgFlags.UNDERLINE\n ? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)\n : UnderlineStyle.NONE;\n }\n public getUnderlineVariantOffset(): number {\n return this.extended.underlineVariantOffset;\n }\n}\n\n\n/**\n * Extended attributes for a cell.\n * Holds information about different underline styles and color.\n */\nexport class ExtendedAttrs implements IExtendedAttrs {\n private _ext: number = 0;\n public get ext(): number {\n if (this._urlId) {\n return (\n (this._ext & ~ExtFlags.UNDERLINE_STYLE) |\n (this.underlineStyle << 26)\n );\n }\n return this._ext;\n }\n public set ext(value: number) { this._ext = value; }\n\n public get underlineStyle(): UnderlineStyle {\n // Always return the URL style if it has one\n if (this._urlId) {\n return UnderlineStyle.DASHED;\n }\n return (this._ext & ExtFlags.UNDERLINE_STYLE) >> 26;\n }\n public set underlineStyle(value: UnderlineStyle) {\n this._ext &= ~ExtFlags.UNDERLINE_STYLE;\n this._ext |= (value << 26) & ExtFlags.UNDERLINE_STYLE;\n }\n\n public get underlineColor(): number {\n return this._ext & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n public set underlineColor(value: number) {\n this._ext &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n this._ext |= value & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n\n private _urlId: number = 0;\n public get urlId(): number {\n return this._urlId;\n }\n public set urlId(value: number) {\n this._urlId = value;\n }\n\n public get underlineVariantOffset(): number {\n const val = (this._ext & ExtFlags.VARIANT_OFFSET) >> 29;\n if (val < 0) {\n return val ^ 0xFFFFFFF8;\n }\n return val;\n }\n public set underlineVariantOffset(value: number) {\n this._ext &= ~ExtFlags.VARIANT_OFFSET;\n this._ext |= (value << 29) & ExtFlags.VARIANT_OFFSET;\n }\n\n constructor(\n ext: number = 0,\n urlId: number = 0\n ) {\n this._ext = ext;\n this._urlId = urlId;\n }\n\n public clone(): IExtendedAttrs {\n return new ExtendedAttrs(this._ext, this._urlId);\n }\n\n /**\n * Convenient method to indicate whether the object holds no additional information,\n * that needs to be persistant in the buffer.\n */\n public isEmpty(): boolean {\n return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CircularList, IInsertEvent } from 'common/CircularList';\nimport { IdleTaskQueue } from 'common/TaskQueue';\nimport { IAttributeData, IBufferLine, ICellData, ICharset } from 'common/Types';\nimport { ExtendedAttrs } from 'common/buffer/AttributeData';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths } from 'common/buffer/BufferReflow';\nimport { CellData } from 'common/buffer/CellData';\nimport { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from 'common/buffer/Constants';\nimport { Marker } from 'common/buffer/Marker';\nimport { IBuffer } from 'common/buffer/Types';\nimport { DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\nexport const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1\n\n/**\n * This class represents a terminal buffer (an internal state of the terminal), where the\n * following information is stored (in high-level):\n * - text content of this particular buffer\n * - cursor position\n * - scroll position\n */\nexport class Buffer implements IBuffer {\n public lines: CircularList;\n public ydisp: number = 0;\n public ybase: number = 0;\n public y: number = 0;\n public x: number = 0;\n public scrollBottom: number;\n public scrollTop: number;\n public tabs: { [column: number]: boolean | undefined } = {};\n public savedY: number = 0;\n public savedX: number = 0;\n public savedCurAttrData = DEFAULT_ATTR_DATA.clone();\n public savedCharset: ICharset | undefined = DEFAULT_CHARSET;\n public markers: Marker[] = [];\n private _nullCell: ICellData = CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);\n private _cols: number;\n private _rows: number;\n private _isClearing: boolean = false;\n\n constructor(\n private _hasScrollback: boolean,\n private _optionsService: IOptionsService,\n private _bufferService: IBufferService\n ) {\n this._cols = this._bufferService.cols;\n this._rows = this._bufferService.rows;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n public getNullCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._nullCell.fg = attr.fg;\n this._nullCell.bg = attr.bg;\n this._nullCell.extended = attr.extended;\n } else {\n this._nullCell.fg = 0;\n this._nullCell.bg = 0;\n this._nullCell.extended = new ExtendedAttrs();\n }\n return this._nullCell;\n }\n\n public getWhitespaceCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._whitespaceCell.fg = attr.fg;\n this._whitespaceCell.bg = attr.bg;\n this._whitespaceCell.extended = attr.extended;\n } else {\n this._whitespaceCell.fg = 0;\n this._whitespaceCell.bg = 0;\n this._whitespaceCell.extended = new ExtendedAttrs();\n }\n return this._whitespaceCell;\n }\n\n public getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {\n return new BufferLine(this._bufferService.cols, this.getNullCell(attr), isWrapped);\n }\n\n public get hasScrollback(): boolean {\n return this._hasScrollback && this.lines.maxLength > this._rows;\n }\n\n public get isCursorInViewport(): boolean {\n const absoluteY = this.ybase + this.y;\n const relativeY = absoluteY - this.ydisp;\n return (relativeY >= 0 && relativeY < this._rows);\n }\n\n /**\n * Gets the correct buffer length based on the rows provided, the terminal's\n * scrollback and whether this buffer is flagged to have scrollback or not.\n * @param rows The terminal rows to use in the calculation.\n */\n private _getCorrectBufferLength(rows: number): number {\n if (!this._hasScrollback) {\n return rows;\n }\n\n const correctBufferLength = rows + this._optionsService.rawOptions.scrollback;\n\n return correctBufferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBufferLength;\n }\n\n /**\n * Fills the buffer's viewport with blank lines.\n */\n public fillViewportRows(fillAttr?: IAttributeData): void {\n if (this.lines.length === 0) {\n if (fillAttr === undefined) {\n fillAttr = DEFAULT_ATTR_DATA;\n }\n let i = this._rows;\n while (i--) {\n this.lines.push(this.getBlankLine(fillAttr));\n }\n }\n }\n\n /**\n * Clears the buffer to it's initial state, discarding all previous data.\n */\n public clear(): void {\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n this.x = 0;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n /**\n * Resizes the buffer, adjusting its data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n // store reference to null cell with default attrs\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n\n // count bufferlines with overly big memory to be cleaned afterwards\n let dirtyMemoryLines = 0;\n\n // Increase max length if needed before adjustments to allow space to fill\n // as required.\n const newMaxLength = this._getCorrectBufferLength(newRows);\n if (newMaxLength > this.lines.maxLength) {\n this.lines.maxLength = newMaxLength;\n }\n\n // if (this._cols > newCols) {\n // console.log('increase!');\n // }\n\n // The following adjustments should only happen if the buffer has been\n // initialized/filled.\n if (this.lines.length > 0) {\n // Deal with columns increasing (reducing needs to happen after reflow)\n if (this._cols < newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n\n // Resize rows in both directions as needed\n let addToY = 0;\n if (this._rows < newRows) {\n for (let y = this._rows; y < newRows; y++) {\n if (this.lines.length < newRows + this.ybase) {\n if (this._optionsService.rawOptions.windowsMode || this._optionsService.rawOptions.windowsPty.backend !== undefined || this._optionsService.rawOptions.windowsPty.buildNumber !== undefined) {\n // Just add the new missing rows on Windows as conpty reprints the screen with it's\n // view of the world. Once a line enters scrollback for conpty it remains there\n this.lines.push(new BufferLine(newCols, nullCell));\n } else {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n // There is room above the buffer and there are no empty elements below the line,\n // scroll up\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n // Viewport is at the top of the buffer, must increase downwards\n this.ydisp--;\n }\n } else {\n // Add a blank line if there is no buffer left at the top to scroll to, or if there\n // are blank lines after the cursor\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n }\n }\n }\n } else { // (this._rows >= newRows)\n for (let y = this._rows; y > newRows; y--) {\n if (this.lines.length > newRows + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n // The line is a blank line below the cursor, remove it\n this.lines.pop();\n } else {\n // The line is the cursor, scroll down\n this.ybase++;\n this.ydisp++;\n }\n }\n }\n }\n\n // Reduce max length if needed after adjustments, this is done after as it\n // would otherwise cut data from the bottom of the buffer.\n if (newMaxLength < this.lines.maxLength) {\n // Trim from the top of the buffer and adjust ybase and ydisp.\n const amountToTrim = this.lines.length - newMaxLength;\n if (amountToTrim > 0) {\n this.lines.trimStart(amountToTrim);\n this.ybase = Math.max(this.ybase - amountToTrim, 0);\n this.ydisp = Math.max(this.ydisp - amountToTrim, 0);\n this.savedY = Math.max(this.savedY - amountToTrim, 0);\n }\n this.lines.maxLength = newMaxLength;\n }\n\n // Make sure that the cursor stays on screen\n this.x = Math.min(this.x, newCols - 1);\n this.y = Math.min(this.y, newRows - 1);\n if (addToY) {\n this.y += addToY;\n }\n this.savedX = Math.min(this.savedX, newCols - 1);\n\n this.scrollTop = 0;\n }\n\n this.scrollBottom = newRows - 1;\n\n if (this._isReflowEnabled) {\n this._reflow(newCols, newRows);\n\n // Trim the end of the line off if cols shrunk\n if (this._cols > newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n }\n\n this._cols = newCols;\n this._rows = newRows;\n\n this._memoryCleanupQueue.clear();\n // schedule memory cleanup only, if more than 10% of the lines are affected\n if (dirtyMemoryLines > 0.1 * this.lines.length) {\n this._memoryCleanupPosition = 0;\n this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup());\n }\n }\n\n private _memoryCleanupQueue = new IdleTaskQueue();\n private _memoryCleanupPosition = 0;\n\n private _batchedMemoryCleanup(): boolean {\n let normalRun = true;\n if (this._memoryCleanupPosition >= this.lines.length) {\n // cleanup made it once through all lines, thus rescan in loop below to also catch shifted\n // lines, which should finish rather quick if there are no more cleanups pending\n this._memoryCleanupPosition = 0;\n normalRun = false;\n }\n let counted = 0;\n while (this._memoryCleanupPosition < this.lines.length) {\n counted += this.lines.get(this._memoryCleanupPosition++)!.cleanupMemory();\n // cleanup max 100 lines per batch\n if (counted > 100) {\n return true;\n }\n }\n // normal runs always need another rescan afterwards\n // if we made it here with normalRun=false, we are in a final run\n // and can end the cleanup task for sure\n return normalRun;\n }\n\n private get _isReflowEnabled(): boolean {\n const windowsPty = this._optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber) {\n return this._hasScrollback && windowsPty.backend === 'conpty' && windowsPty.buildNumber >= 21376;\n }\n return this._hasScrollback && !this._optionsService.rawOptions.windowsMode;\n }\n\n private _reflow(newCols: number, newRows: number): void {\n if (this._cols === newCols) {\n return;\n }\n\n // Iterate through rows, ignore the last one as it cannot be wrapped\n if (newCols > this._cols) {\n this._reflowLarger(newCols, newRows);\n } else {\n this._reflowSmaller(newCols, newRows);\n }\n }\n\n private _reflowLarger(newCols: number, newRows: number): void {\n const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA));\n if (toRemove.length > 0) {\n const newLayoutResult = reflowLargerCreateNewLayout(this.lines, toRemove);\n reflowLargerApplyNewLayout(this.lines, newLayoutResult.layout);\n this._reflowLargerAdjustViewport(newCols, newRows, newLayoutResult.countRemoved);\n }\n }\n\n private _reflowLargerAdjustViewport(newCols: number, newRows: number, countRemoved: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Adjust viewport based on number of items removed\n let viewportAdjustments = countRemoved;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y > 0) {\n this.y--;\n }\n if (this.lines.length < newRows) {\n // Add an extra row at the bottom of the viewport\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n } else {\n if (this.ydisp === this.ybase) {\n this.ydisp--;\n }\n this.ybase--;\n }\n }\n this.savedY = Math.max(this.savedY - countRemoved, 0);\n }\n\n private _reflowSmaller(newCols: number, newRows: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Gather all BufferLines that need to be inserted into the Buffer here so that they can be\n // batched up and only committed once\n const toInsert = [];\n let countToInsert = 0;\n // Go backwards as many lines may be trimmed and this will avoid considering them\n for (let y = this.lines.length - 1; y >= 0; y--) {\n // Check whether this line is a problem\n let nextLine = this.lines.get(y) as BufferLine;\n if (!nextLine || !nextLine.isWrapped && nextLine.getTrimmedLength() <= newCols) {\n continue;\n }\n\n // Gather wrapped lines and adjust y to be the starting line\n const wrappedLines: BufferLine[] = [nextLine];\n while (nextLine.isWrapped && y > 0) {\n nextLine = this.lines.get(--y) as BufferLine;\n wrappedLines.unshift(nextLine);\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n const absoluteY = this.ybase + this.y;\n if (absoluteY >= y && absoluteY < y + wrappedLines.length) {\n continue;\n }\n\n const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();\n const destLineLengths = reflowSmallerGetNewLineLengths(wrappedLines, this._cols, newCols);\n const linesToAdd = destLineLengths.length - wrappedLines.length;\n let trimmedLines: number;\n if (this.ybase === 0 && this.y !== this.lines.length - 1) {\n // If the top section of the buffer is not yet filled\n trimmedLines = Math.max(0, this.y - this.lines.maxLength + linesToAdd);\n } else {\n trimmedLines = Math.max(0, this.lines.length - this.lines.maxLength + linesToAdd);\n }\n\n // Add the new lines\n const newLines: BufferLine[] = [];\n for (let i = 0; i < linesToAdd; i++) {\n const newLine = this.getBlankLine(DEFAULT_ATTR_DATA, true) as BufferLine;\n newLines.push(newLine);\n }\n if (newLines.length > 0) {\n toInsert.push({\n // countToInsert here gets the actual index, taking into account other inserted items.\n // using this we can iterate through the list forwards\n start: y + wrappedLines.length + countToInsert,\n newLines\n });\n countToInsert += newLines.length;\n }\n wrappedLines.push(...newLines);\n\n // Copy buffer data to new locations, this needs to happen backwards to do in-place\n let destLineIndex = destLineLengths.length - 1; // Math.floor(cellsNeeded / newCols);\n let destCol = destLineLengths[destLineIndex]; // cellsNeeded % newCols;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n let srcLineIndex = wrappedLines.length - linesToAdd - 1;\n let srcCol = lastLineLength;\n while (srcLineIndex >= 0) {\n const cellsToCopy = Math.min(srcCol, destCol);\n if (wrappedLines[destLineIndex] === undefined) {\n // Sanity check that the line exists, this has been known to fail for an unknown reason\n // which would stop the reflow from happening if an exception would throw.\n break;\n }\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol - cellsToCopy, destCol - cellsToCopy, cellsToCopy, true);\n destCol -= cellsToCopy;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n srcCol -= cellsToCopy;\n if (srcCol === 0) {\n srcLineIndex--;\n const wrappedLinesIndex = Math.max(srcLineIndex, 0);\n srcCol = getWrappedLineTrimmedLength(wrappedLines, wrappedLinesIndex, this._cols);\n }\n }\n\n // Null out the end of the line ends if a wide character wrapped to the following line\n for (let i = 0; i < wrappedLines.length; i++) {\n if (destLineLengths[i] < newCols) {\n wrappedLines[i].setCell(destLineLengths[i], nullCell);\n }\n }\n\n // Adjust viewport as needed\n let viewportAdjustments = linesToAdd - trimmedLines;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y < newRows - 1) {\n this.y++;\n this.lines.pop();\n } else {\n this.ybase++;\n this.ydisp++;\n }\n } else {\n // Ensure ybase does not exceed its maximum value\n if (this.ybase < Math.min(this.lines.maxLength, this.lines.length + countToInsert) - newRows) {\n if (this.ybase === this.ydisp) {\n this.ydisp++;\n }\n this.ybase++;\n }\n }\n }\n this.savedY = Math.min(this.savedY + linesToAdd, this.ybase + newRows - 1);\n }\n\n // Rearrange lines in the buffer if there are any insertions, this is done at the end rather\n // than earlier so that it's a single O(n) pass through the buffer, instead of O(n^2) from many\n // costly calls to CircularList.splice.\n if (toInsert.length > 0) {\n // Record buffer insert events and then play them back backwards so that the indexes are\n // correct\n const insertEvents: IInsertEvent[] = [];\n\n // Record original lines so they don't get overridden when we rearrange the list\n const originalLines: BufferLine[] = [];\n for (let i = 0; i < this.lines.length; i++) {\n originalLines.push(this.lines.get(i) as BufferLine);\n }\n const originalLinesLength = this.lines.length;\n\n let originalLineIndex = originalLinesLength - 1;\n let nextToInsertIndex = 0;\n let nextToInsert = toInsert[nextToInsertIndex];\n this.lines.length = Math.min(this.lines.maxLength, this.lines.length + countToInsert);\n let countInsertedSoFar = 0;\n for (let i = Math.min(this.lines.maxLength - 1, originalLinesLength + countToInsert - 1); i >= 0; i--) {\n if (nextToInsert && nextToInsert.start > originalLineIndex + countInsertedSoFar) {\n // Insert extra lines here, adjusting i as needed\n for (let nextI = nextToInsert.newLines.length - 1; nextI >= 0; nextI--) {\n this.lines.set(i--, nextToInsert.newLines[nextI]);\n }\n i++;\n\n // Create insert events for later\n insertEvents.push({\n index: originalLineIndex + 1,\n amount: nextToInsert.newLines.length\n });\n\n countInsertedSoFar += nextToInsert.newLines.length;\n nextToInsert = toInsert[++nextToInsertIndex];\n } else {\n this.lines.set(i, originalLines[originalLineIndex--]);\n }\n }\n\n // Update markers\n let insertCountEmitted = 0;\n for (let i = insertEvents.length - 1; i >= 0; i--) {\n insertEvents[i].index += insertCountEmitted;\n this.lines.onInsertEmitter.fire(insertEvents[i]);\n insertCountEmitted += insertEvents[i].amount;\n }\n const amountToTrim = Math.max(0, originalLinesLength + countToInsert - this.lines.maxLength);\n if (amountToTrim > 0) {\n this.lines.onTrimEmitter.fire(amountToTrim);\n }\n }\n }\n\n /**\n * Translates a buffer line to a string, with optional start and end columns.\n * Wide characters will count as two columns in the resulting string. This\n * function is useful for getting the actual text underneath the raw selection\n * position.\n * @param lineIndex The absolute index of the line being translated.\n * @param trimRight Whether to trim whitespace to the right.\n * @param startCol The column to start at.\n * @param endCol The column to end at.\n */\n public translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol: number = 0, endCol?: number): string {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return '';\n }\n return line.translateToString(trimRight, startCol, endCol);\n }\n\n public getWrappedRangeForLine(y: number): { first: number, last: number } {\n let first = y;\n let last = y;\n // Scan upwards for wrapped lines\n while (first > 0 && this.lines.get(first)!.isWrapped) {\n first--;\n }\n // Scan downwards for wrapped lines\n while (last + 1 < this.lines.length && this.lines.get(last + 1)!.isWrapped) {\n last++;\n }\n return { first, last };\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n if (i !== null && i !== undefined) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n } else {\n this.tabs = {};\n i = 0;\n }\n\n for (; i < this._cols; i += this._optionsService.rawOptions.tabStopWidth) {\n this.tabs[i] = true;\n }\n }\n\n /**\n * Move the cursor to the previous tab stop from the given position (default is current).\n * @param x The position to move the cursor to the previous tab stop.\n */\n public prevStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[--x] && x > 0);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Move the cursor one tab stop forward from the given position (default is current).\n * @param x The position to move the cursor one tab stop forward.\n */\n public nextStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[++x] && x < this._cols);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Clears markers on single line.\n * @param y The line to clear.\n */\n public clearMarkers(y: number): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n if (this.markers[i].line === y) {\n this.markers[i].dispose();\n this.markers.splice(i--, 1);\n }\n }\n this._isClearing = false;\n }\n\n /**\n * Clears markers on all lines\n */\n public clearAllMarkers(): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n this.markers[i].dispose();\n }\n this.markers.length = 0;\n this._isClearing = false;\n }\n\n public addMarker(y: number): Marker {\n const marker = new Marker(y);\n this.markers.push(marker);\n marker.register(this.lines.onTrim(amount => {\n marker.line -= amount;\n // The marker should be disposed when the line is trimmed from the buffer\n if (marker.line < 0) {\n marker.dispose();\n }\n }));\n marker.register(this.lines.onInsert(event => {\n if (marker.line >= event.index) {\n marker.line += event.amount;\n }\n }));\n marker.register(this.lines.onDelete(event => {\n // Delete the marker if it's within the range\n if (marker.line >= event.index && marker.line < event.index + event.amount) {\n marker.dispose();\n }\n\n // Shift the marker if it's after the deleted range\n if (marker.line > event.index) {\n marker.line -= event.amount;\n }\n }));\n marker.register(marker.onDispose(() => this._removeMarker(marker)));\n return marker;\n }\n\n private _removeMarker(marker: Marker): void {\n if (!this._isClearing) {\n this.markers.splice(this.markers.indexOf(marker), 1);\n }\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { CellData } from 'common/buffer/CellData';\nimport { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\n\n/**\n * buffer memory layout:\n *\n * | uint32_t | uint32_t | uint32_t |\n * | `content` | `FG` | `BG` |\n * | wcwidth(2) comb(1) codepoint(21) | flags(8) R(8) G(8) B(8) | flags(8) R(8) G(8) B(8) |\n */\n\n\n/** typed array slots taken by one cell */\nconst CELL_SIZE = 3;\n\n/**\n * Cell member indices.\n *\n * Direct access:\n * `content = data[column * CELL_SIZE + Cell.CONTENT];`\n * `fg = data[column * CELL_SIZE + Cell.FG];`\n * `bg = data[column * CELL_SIZE + Cell.BG];`\n */\nconst enum Cell {\n CONTENT = 0,\n FG = 1, // currently simply holds all known attrs\n BG = 2 // currently unused\n}\n\nexport const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());\n\n// Work variables to avoid garbage collection\nlet $startIndex = 0;\n\n/** Factor when to cleanup underlying array buffer after shrinking. */\nconst CLEANUP_THRESHOLD = 2;\n\n/**\n * Typed array based bufferline implementation.\n *\n * There are 2 ways to insert data into the cell buffer:\n * - `setCellFromCodepoint` + `addCodepointToCell`\n * Use these for data that is already UTF32.\n * Used during normal input in `InputHandler` for faster buffer access.\n * - `setCell`\n * This method takes a CellData object and stores the data in the buffer.\n * Use `CellData.fromCharData` to create the CellData object (e.g. from JS string).\n *\n * To retrieve data from the buffer use either one of the primitive methods\n * (if only one particular value is needed) or `loadCell`. For `loadCell` in a loop\n * memory allocs / GC pressure can be greatly reduced by reusing the CellData object.\n */\nexport class BufferLine implements IBufferLine {\n protected _data: Uint32Array;\n protected _combined: {[index: number]: string} = {};\n protected _extendedAttrs: {[index: number]: IExtendedAttrs | undefined} = {};\n public length: number;\n\n constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {\n this._data = new Uint32Array(cols * CELL_SIZE);\n const cell = fillCellData || CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n for (let i = 0; i < cols; ++i) {\n this.setCell(i, cell);\n }\n this.length = cols;\n }\n\n /**\n * Get cell data CharData.\n * @deprecated\n */\n public get(index: number): CharData {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n return [\n this._data[index * CELL_SIZE + Cell.FG],\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index]\n : (cp) ? stringFromCodePoint(cp) : '',\n content >> Content.WIDTH_SHIFT,\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index].charCodeAt(this._combined[index].length - 1)\n : cp\n ];\n }\n\n /**\n * Set cell data from CharData.\n * @deprecated\n */\n public set(index: number, value: CharData): void {\n this._data[index * CELL_SIZE + Cell.FG] = value[CHAR_DATA_ATTR_INDEX];\n if (value[CHAR_DATA_CHAR_INDEX].length > 1) {\n this._combined[index] = value[1];\n this._data[index * CELL_SIZE + Cell.CONTENT] = index | Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n } else {\n this._data[index * CELL_SIZE + Cell.CONTENT] = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n\n /**\n * primitive getters\n * use these when only one value is needed, otherwise use `loadCell`\n */\n public getWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT;\n }\n\n /** Test whether content has width. */\n public hasWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.WIDTH_MASK;\n }\n\n /** Get FG cell component. */\n public getFg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.FG];\n }\n\n /** Get BG cell component. */\n public getBg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG];\n }\n\n /**\n * Test whether contains any chars.\n * Basically an empty has no content, but other cells might differ in FG/BG\n * from real empty cells.\n */\n public hasContent(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK;\n }\n\n /**\n * Get codepoint of the cell.\n * To be in line with `code` in CharData this either returns\n * a single UTF32 codepoint or the last codepoint of a combined string.\n */\n public getCodePoint(index: number): number {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index].charCodeAt(this._combined[index].length - 1);\n }\n return content & Content.CODEPOINT_MASK;\n }\n\n /** Test whether the cell contains a combined string. */\n public isCombined(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.IS_COMBINED_MASK;\n }\n\n /** Returns the string content of the cell. */\n public getString(index: number): string {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index];\n }\n if (content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(content & Content.CODEPOINT_MASK);\n }\n // return empty string for empty cells\n return '';\n }\n\n /** Get state of protected flag. */\n public isProtected(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG] & BgFlags.PROTECTED;\n }\n\n /**\n * Load data at `index` into `cell`. This is used to access cells in a way that's more friendly\n * to GC as it significantly reduced the amount of new objects/references needed.\n */\n public loadCell(index: number, cell: ICellData): ICellData {\n $startIndex = index * CELL_SIZE;\n cell.content = this._data[$startIndex + Cell.CONTENT];\n cell.fg = this._data[$startIndex + Cell.FG];\n cell.bg = this._data[$startIndex + Cell.BG];\n if (cell.content & Content.IS_COMBINED_MASK) {\n cell.combinedData = this._combined[index];\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n cell.extended = this._extendedAttrs[index]!;\n }\n return cell;\n }\n\n /**\n * Set data at `index` to `cell`.\n */\n public setCell(index: number, cell: ICellData): void {\n if (cell.content & Content.IS_COMBINED_MASK) {\n this._combined[index] = cell.combinedData;\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = cell.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = cell.content;\n this._data[index * CELL_SIZE + Cell.FG] = cell.fg;\n this._data[index * CELL_SIZE + Cell.BG] = cell.bg;\n }\n\n /**\n * Set cell data from input handler.\n * Since the input handler see the incoming chars as UTF32 codepoints,\n * it gets an optimized access method.\n */\n public setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void {\n if (attrs.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = attrs.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = codePoint | (width << Content.WIDTH_SHIFT);\n this._data[index * CELL_SIZE + Cell.FG] = attrs.fg;\n this._data[index * CELL_SIZE + Cell.BG] = attrs.bg;\n }\n\n /**\n * Add a codepoint to a cell from input handler.\n * During input stage combining chars with a width of 0 follow and stack\n * onto a leading char. Since we already set the attrs\n * by the previous `setDataFromCodePoint` call, we can omit it here.\n */\n public addCodepointToCell(index: number, codePoint: number, width: number): void {\n let content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n // we already have a combined string, simply add\n this._combined[index] += stringFromCodePoint(codePoint);\n } else {\n if (content & Content.CODEPOINT_MASK) {\n // normal case for combining chars:\n // - move current leading char + new one into combined string\n // - set combined flag\n this._combined[index] = stringFromCodePoint(content & Content.CODEPOINT_MASK) + stringFromCodePoint(codePoint);\n content &= ~Content.CODEPOINT_MASK; // set codepoint in buffer to 0\n content |= Content.IS_COMBINED_MASK;\n } else {\n // should not happen - we actually have no data in the cell yet\n // simply set the data in the cell buffer with a width of 1\n content = codePoint | (1 << Content.WIDTH_SHIFT);\n }\n }\n if (width) {\n content &= ~Content.WIDTH_MASK;\n content |= width << Content.WIDTH_SHIFT;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = content;\n }\n\n public insertCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n\n // handle fullwidth at pos: reset cell one to the left if pos is second cell of a wide char\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = this.length - pos - n - 1; i >= 0; --i) {\n this.setCell(pos + n + i, this.loadCell(pos + i, cell));\n }\n for (let i = 0; i < n; ++i) {\n this.setCell(pos + i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at line end: reset last cell if it is first cell of a wide char\n if (this.getWidth(this.length - 1) === 2) {\n this.setCellFromCodepoint(this.length - 1, 0, 1, fillCellData);\n }\n }\n\n public deleteCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = 0; i < this.length - pos - n; ++i) {\n this.setCell(pos + i, this.loadCell(pos + n + i, cell));\n }\n for (let i = this.length - n; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at pos:\n // - reset pos-1 if wide char\n // - reset pos if width==0 (previous second cell of a wide char)\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n if (this.getWidth(pos) === 0 && !this.hasContent(pos)) {\n this.setCellFromCodepoint(pos, 0, 1, fillCellData);\n }\n }\n\n public replaceCells(start: number, end: number, fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n if (start && this.getWidth(start - 1) === 2 && !this.isProtected(start - 1)) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n if (end < this.length && this.getWidth(end - 1) === 2 && !this.isProtected(end)) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n while (start < end && start < this.length) {\n if (!this.isProtected(start)) {\n this.setCell(start, fillCellData);\n }\n start++;\n }\n return;\n }\n\n // handle fullwidth at start: reset cell one to the left if start is second cell of a wide char\n if (start && this.getWidth(start - 1) === 2) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n // handle fullwidth at last cell + 1: reset to empty cell if it is second part of a wide char\n if (end < this.length && this.getWidth(end - 1) === 2) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n\n while (start < end && start < this.length) {\n this.setCell(start++, fillCellData);\n }\n }\n\n /**\n * Resize BufferLine to `cols` filling excess cells with `fillCellData`.\n * The underlying array buffer will not change if there is still enough space\n * to hold the new buffer line data.\n * Returns a boolean indicating, whether a `cleanupMemory` call would free\n * excess memory (true after shrinking > CLEANUP_THRESHOLD).\n */\n public resize(cols: number, fillCellData: ICellData): boolean {\n if (cols === this.length) {\n return this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n const uint32Cells = cols * CELL_SIZE;\n if (cols > this.length) {\n if (this._data.buffer.byteLength >= uint32Cells * 4) {\n // optimization: avoid alloc and data copy if buffer has enough room\n this._data = new Uint32Array(this._data.buffer, 0, uint32Cells);\n } else {\n // slow path: new alloc and full data copy\n const data = new Uint32Array(uint32Cells);\n data.set(this._data);\n this._data = data;\n }\n for (let i = this.length; i < cols; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n // optimization: just shrink the view on existing buffer\n this._data = this._data.subarray(0, uint32Cells);\n // Remove any cut off combined data\n const keys = Object.keys(this._combined);\n for (let i = 0; i < keys.length; i++) {\n const key = parseInt(keys[i], 10);\n if (key >= cols) {\n delete this._combined[key];\n }\n }\n // remove any cut off extended attributes\n const extKeys = Object.keys(this._extendedAttrs);\n for (let i = 0; i < extKeys.length; i++) {\n const key = parseInt(extKeys[i], 10);\n if (key >= cols) {\n delete this._extendedAttrs[key];\n }\n }\n }\n this.length = cols;\n return uint32Cells * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n\n /**\n * Cleanup underlying array buffer.\n * A cleanup will be triggered if the array buffer exceeds the actual used\n * memory by a factor of CLEANUP_THRESHOLD.\n * Returns 0 or 1 indicating whether a cleanup happened.\n */\n public cleanupMemory(): number {\n if (this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength) {\n const data = new Uint32Array(this._data.length);\n data.set(this._data);\n this._data = data;\n return 1;\n }\n return 0;\n }\n\n /** fill a line with fillCharData */\n public fill(fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n for (let i = 0; i < this.length; ++i) {\n if (!this.isProtected(i)) {\n this.setCell(i, fillCellData);\n }\n }\n return;\n }\n this._combined = {};\n this._extendedAttrs = {};\n for (let i = 0; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n /** alter to a full copy of line */\n public copyFrom(line: BufferLine): void {\n if (this.length !== line.length) {\n this._data = new Uint32Array(line._data);\n } else {\n // use high speed copy if lengths are equal\n this._data.set(line._data);\n }\n this.length = line.length;\n this._combined = {};\n for (const el in line._combined) {\n this._combined[el] = line._combined[el];\n }\n this._extendedAttrs = {};\n for (const el in line._extendedAttrs) {\n this._extendedAttrs[el] = line._extendedAttrs[el];\n }\n this.isWrapped = line.isWrapped;\n }\n\n /** create a new clone */\n public clone(): IBufferLine {\n const newLine = new BufferLine(0);\n newLine._data = new Uint32Array(this._data);\n newLine.length = this.length;\n for (const el in this._combined) {\n newLine._combined[el] = this._combined[el];\n }\n for (const el in this._extendedAttrs) {\n newLine._extendedAttrs[el] = this._extendedAttrs[el];\n }\n newLine.isWrapped = this.isWrapped;\n return newLine;\n }\n\n public getTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public getNoBgTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK) || (this._data[i * CELL_SIZE + Cell.BG] & Attributes.CM_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number, applyInReverse: boolean): void {\n const srcData = src._data;\n if (applyInReverse) {\n for (let cell = length - 1; cell >= 0; cell--) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n } else {\n for (let cell = 0; cell < length; cell++) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n }\n\n // Move any combined data over as needed, FIXME: repeat for extended attrs\n const srcCombinedKeys = Object.keys(src._combined);\n for (let i = 0; i < srcCombinedKeys.length; i++) {\n const key = parseInt(srcCombinedKeys[i], 10);\n if (key >= srcCol) {\n this._combined[key - srcCol + destCol] = src._combined[key];\n }\n }\n }\n\n /**\n * Translates the buffer line to a string.\n *\n * @param trimRight Whether to trim any empty cells on the right.\n * @param startCol The column to start the string (0-based inclusive).\n * @param endCol The column to end the string (0-based exclusive).\n * @param outColumns if specified, this array will be filled with column numbers such that\n * `returnedString[i]` is displayed at `outColumns[i]` column. `outColumns[returnedString.length]`\n * is where the character following `returnedString` will be displayed.\n *\n * When a single cell is translated to multiple UTF-16 code units (e.g. surrogate pair) in the\n * returned string, the corresponding entries in `outColumns` will have the same column number.\n */\n public translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string {\n startCol = startCol ?? 0;\n endCol = endCol ?? this.length;\n if (trimRight) {\n endCol = Math.min(endCol, this.getTrimmedLength());\n }\n if (outColumns) {\n outColumns.length = 0;\n }\n let result = '';\n while (startCol < endCol) {\n const content = this._data[startCol * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n const chars = (content & Content.IS_COMBINED_MASK) ? this._combined[startCol] : (cp) ? stringFromCodePoint(cp) : WHITESPACE_CELL_CHAR;\n result += chars;\n if (outColumns) {\n for (let i = 0; i < chars.length; ++i) {\n outColumns.push(startCol);\n }\n }\n startCol += (content >> Content.WIDTH_SHIFT) || 1; // always advance by at least 1\n }\n if (outColumns) {\n outColumns.push(startCol);\n }\n return result;\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange } from '@xterm/xterm';\n\nexport function getRangeLength(range: IBufferRange, bufferCols: number): number {\n if (range.start.y > range.end.y) {\n throw new Error(`Buffer range end (${range.end.x}, ${range.end.y}) cannot be before start (${range.start.x}, ${range.start.y})`);\n }\n return bufferCols * (range.end.y - range.start.y) + (range.end.x - range.start.x + 1);\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { BufferLine } from 'common/buffer/BufferLine';\nimport { CircularList } from 'common/CircularList';\nimport { IBufferLine, ICellData } from 'common/Types';\n\nexport interface INewLayoutResult {\n layout: number[];\n countRemoved: number;\n}\n\n/**\n * Evaluates and returns indexes to be removed after a reflow larger occurs. Lines will be removed\n * when a wrapped line unwraps.\n * @param lines The buffer lines.\n * @param oldCols The columns before resize\n * @param newCols The columns after resize.\n * @param bufferAbsoluteY The absolute y position of the cursor (baseY + cursorY).\n * @param nullCell The cell data to use when filling in empty cells.\n */\nexport function reflowLargerGetLinesToRemove(lines: CircularList, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData): number[] {\n // Gather all BufferLines that need to be removed from the Buffer here so that they can be\n // batched up and only committed once\n const toRemove: number[] = [];\n\n for (let y = 0; y < lines.length - 1; y++) {\n // Check if this row is wrapped\n let i = y;\n let nextLine = lines.get(++i) as BufferLine;\n if (!nextLine.isWrapped) {\n continue;\n }\n\n // Check how many lines it's wrapped for\n const wrappedLines: BufferLine[] = [lines.get(y) as BufferLine];\n while (i < lines.length && nextLine.isWrapped) {\n wrappedLines.push(nextLine);\n nextLine = lines.get(++i) as BufferLine;\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up wrapped\n // lines with the cursor\n if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {\n y += wrappedLines.length - 1;\n continue;\n }\n\n // Copy buffer data to new locations\n let destLineIndex = 0;\n let destCol = getWrappedLineTrimmedLength(wrappedLines, destLineIndex, oldCols);\n let srcLineIndex = 1;\n let srcCol = 0;\n while (srcLineIndex < wrappedLines.length) {\n const srcTrimmedTineLength = getWrappedLineTrimmedLength(wrappedLines, srcLineIndex, oldCols);\n const srcRemainingCells = srcTrimmedTineLength - srcCol;\n const destRemainingCells = newCols - destCol;\n const cellsToCopy = Math.min(srcRemainingCells, destRemainingCells);\n\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol, destCol, cellsToCopy, false);\n\n destCol += cellsToCopy;\n if (destCol === newCols) {\n destLineIndex++;\n destCol = 0;\n }\n srcCol += cellsToCopy;\n if (srcCol === srcTrimmedTineLength) {\n srcLineIndex++;\n srcCol = 0;\n }\n\n // Make sure the last cell isn't wide, if it is copy it to the current dest\n if (destCol === 0 && destLineIndex !== 0) {\n if (wrappedLines[destLineIndex - 1].getWidth(newCols - 1) === 2) {\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[destLineIndex - 1], newCols - 1, destCol++, 1, false);\n // Null out the end of the last row\n wrappedLines[destLineIndex - 1].setCell(newCols - 1, nullCell);\n }\n }\n }\n\n // Clear out remaining cells or fragments could remain;\n wrappedLines[destLineIndex].replaceCells(destCol, newCols, nullCell);\n\n // Work backwards and remove any rows at the end that only contain null cells\n let countToRemove = 0;\n for (let i = wrappedLines.length - 1; i > 0; i--) {\n if (i > destLineIndex || wrappedLines[i].getTrimmedLength() === 0) {\n countToRemove++;\n } else {\n break;\n }\n }\n\n if (countToRemove > 0) {\n toRemove.push(y + wrappedLines.length - countToRemove); // index\n toRemove.push(countToRemove);\n }\n\n y += wrappedLines.length - 1;\n }\n return toRemove;\n}\n\n/**\n * Creates and return the new layout for lines given an array of indexes to be removed.\n * @param lines The buffer lines.\n * @param toRemove The indexes to remove.\n */\nexport function reflowLargerCreateNewLayout(lines: CircularList, toRemove: number[]): INewLayoutResult {\n const layout: number[] = [];\n // First iterate through the list and get the actual indexes to use for rows\n let nextToRemoveIndex = 0;\n let nextToRemoveStart = toRemove[nextToRemoveIndex];\n let countRemovedSoFar = 0;\n for (let i = 0; i < lines.length; i++) {\n if (nextToRemoveStart === i) {\n const countToRemove = toRemove[++nextToRemoveIndex];\n\n // Tell markers that there was a deletion\n lines.onDeleteEmitter.fire({\n index: i - countRemovedSoFar,\n amount: countToRemove\n });\n\n i += countToRemove - 1;\n countRemovedSoFar += countToRemove;\n nextToRemoveStart = toRemove[++nextToRemoveIndex];\n } else {\n layout.push(i);\n }\n }\n return {\n layout,\n countRemoved: countRemovedSoFar\n };\n}\n\n/**\n * Applies a new layout to the buffer. This essentially does the same as many splice calls but it's\n * done all at once in a single iteration through the list since splice is very expensive.\n * @param lines The buffer lines.\n * @param newLayout The new layout to apply.\n */\nexport function reflowLargerApplyNewLayout(lines: CircularList, newLayout: number[]): void {\n // Record original lines so they don't get overridden when we rearrange the list\n const newLayoutLines: BufferLine[] = [];\n for (let i = 0; i < newLayout.length; i++) {\n newLayoutLines.push(lines.get(newLayout[i]) as BufferLine);\n }\n\n // Rearrange the list\n for (let i = 0; i < newLayoutLines.length; i++) {\n lines.set(i, newLayoutLines[i]);\n }\n lines.length = newLayout.length;\n}\n\n/**\n * Gets the new line lengths for a given wrapped line. The purpose of this function it to pre-\n * compute the wrapping points since wide characters may need to be wrapped onto the following line.\n * This function will return an array of numbers of where each line wraps to, the resulting array\n * will only contain the values `newCols` (when the line does not end with a wide character) and\n * `newCols - 1` (when the line does end with a wide character), except for the last value which\n * will contain the remaining items to fill the line.\n *\n * Calling this with a `newCols` value of `1` will lock up.\n *\n * @param wrappedLines The wrapped lines to evaluate.\n * @param oldCols The columns before resize.\n * @param newCols The columns after resize.\n */\nexport function reflowSmallerGetNewLineLengths(wrappedLines: BufferLine[], oldCols: number, newCols: number): number[] {\n const newLineLengths: number[] = [];\n const cellsNeeded = wrappedLines.map((l, i) => getWrappedLineTrimmedLength(wrappedLines, i, oldCols)).reduce((p, c) => p + c);\n\n // Use srcCol and srcLine to find the new wrapping point, use that to get the cellsAvailable and\n // linesNeeded\n let srcCol = 0;\n let srcLine = 0;\n let cellsAvailable = 0;\n while (cellsAvailable < cellsNeeded) {\n if (cellsNeeded - cellsAvailable < newCols) {\n // Add the final line and exit the loop\n newLineLengths.push(cellsNeeded - cellsAvailable);\n break;\n }\n srcCol += newCols;\n const oldTrimmedLength = getWrappedLineTrimmedLength(wrappedLines, srcLine, oldCols);\n if (srcCol > oldTrimmedLength) {\n srcCol -= oldTrimmedLength;\n srcLine++;\n }\n const endsWithWide = wrappedLines[srcLine].getWidth(srcCol - 1) === 2;\n if (endsWithWide) {\n srcCol--;\n }\n const lineLength = endsWithWide ? newCols - 1 : newCols;\n newLineLengths.push(lineLength);\n cellsAvailable += lineLength;\n }\n\n return newLineLengths;\n}\n\nexport function getWrappedLineTrimmedLength(lines: BufferLine[], i: number, cols: number): number {\n // If this is the last row in the wrapped line, get the actual trimmed length\n if (i === lines.length - 1) {\n return lines[i].getTrimmedLength();\n }\n // Detect whether the following line starts with a wide character and the end of the current line\n // is null, if so then we can be pretty sure the null character should be excluded from the line\n // length]\n const endsInNull = !(lines[i].hasContent(cols - 1)) && lines[i].getWidth(cols - 1) === 1;\n const followingLineStartsWithWide = lines[i + 1].getWidth(0) === 2;\n if (endsInNull && followingLineStartsWithWide) {\n return cols - 1;\n }\n return cols;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IAttributeData } from 'common/Types';\nimport { Buffer } from 'common/buffer/Buffer';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and\n * provides also utilities for working with them.\n */\nexport class BufferSet extends Disposable implements IBufferSet {\n private _normal!: Buffer;\n private _alt!: Buffer;\n private _activeBuffer!: Buffer;\n\n private readonly _onBufferActivate = this._register(new Emitter<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>());\n public readonly onBufferActivate = this._onBufferActivate.event;\n\n /**\n * Create a new BufferSet for the given terminal.\n */\n constructor(\n private readonly _optionsService: IOptionsService,\n private readonly _bufferService: IBufferService\n ) {\n super();\n this.reset();\n this._register(this._optionsService.onSpecificOptionChange('scrollback', () => this.resize(this._bufferService.cols, this._bufferService.rows)));\n this._register(this._optionsService.onSpecificOptionChange('tabStopWidth', () => this.setupTabStops()));\n }\n\n public reset(): void {\n this._normal = new Buffer(true, this._optionsService, this._bufferService);\n this._normal.fillViewportRows();\n\n // The alt buffer should never have scrollback.\n // See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer\n this._alt = new Buffer(false, this._optionsService, this._bufferService);\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n\n this.setupTabStops();\n }\n\n /**\n * Returns the alt Buffer of the BufferSet\n */\n public get alt(): Buffer {\n return this._alt;\n }\n\n /**\n * Returns the currently active Buffer of the BufferSet\n */\n public get active(): Buffer {\n return this._activeBuffer;\n }\n\n /**\n * Returns the normal Buffer of the BufferSet\n */\n public get normal(): Buffer {\n return this._normal;\n }\n\n /**\n * Sets the normal Buffer of the BufferSet as its currently active Buffer\n */\n public activateNormalBuffer(): void {\n if (this._activeBuffer === this._normal) {\n return;\n }\n this._normal.x = this._alt.x;\n this._normal.y = this._alt.y;\n // The alt buffer should always be cleared when we switch to the normal\n // buffer. This frees up memory since the alt buffer should always be new\n // when activated.\n this._alt.clearAllMarkers();\n this._alt.clear();\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n }\n\n /**\n * Sets the alt Buffer of the BufferSet as its currently active Buffer\n */\n public activateAltBuffer(fillAttr?: IAttributeData): void {\n if (this._activeBuffer === this._alt) {\n return;\n }\n // Since the alt buffer is always cleared when the normal buffer is\n // activated, we want to fill it when switching to it.\n this._alt.fillViewportRows(fillAttr);\n this._alt.x = this._normal.x;\n this._alt.y = this._normal.y;\n this._activeBuffer = this._alt;\n this._onBufferActivate.fire({\n activeBuffer: this._alt,\n inactiveBuffer: this._normal\n });\n }\n\n /**\n * Resizes both normal and alt buffers, adjusting their data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n this._normal.resize(newCols, newRows);\n this._alt.resize(newCols, newRows);\n this.setupTabStops(newCols);\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n this._normal.setupTabStops(i);\n this._alt.setupTabStops(i);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, ICellData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * CellData - represents a single Cell in the terminal buffer.\n */\nexport class CellData extends AttributeData implements ICellData {\n /** Helper to create CellData from CharData. */\n public static fromCharData(value: CharData): CellData {\n const obj = new CellData();\n obj.setFromCharData(value);\n return obj;\n }\n /** Primitives from terminal buffer. */\n public content = 0;\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n public combinedData = '';\n /** Whether cell contains a combined string. */\n public isCombined(): number {\n return this.content & Content.IS_COMBINED_MASK;\n }\n /** Width of the cell. */\n public getWidth(): number {\n return this.content >> Content.WIDTH_SHIFT;\n }\n /** JS string of the content. */\n public getChars(): string {\n if (this.content & Content.IS_COMBINED_MASK) {\n return this.combinedData;\n }\n if (this.content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);\n }\n return '';\n }\n /**\n * Codepoint of cell\n * Note this returns the UTF32 codepoint of single chars,\n * if content is a combined string it returns the codepoint\n * of the last char in string to be in line with code in CharData.\n */\n public getCode(): number {\n return (this.isCombined())\n ? this.combinedData.charCodeAt(this.combinedData.length - 1)\n : this.content & Content.CODEPOINT_MASK;\n }\n /** Set data from CharData */\n public setFromCharData(value: CharData): void {\n this.fg = value[CHAR_DATA_ATTR_INDEX];\n this.bg = 0;\n let combined = false;\n // surrogates and combined strings need special treatment\n if (value[CHAR_DATA_CHAR_INDEX].length > 2) {\n combined = true;\n }\n else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {\n const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);\n // if the 2-char string is a surrogate create single codepoint\n // everything else is combined\n if (0xD800 <= code && code <= 0xDBFF) {\n const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);\n if (0xDC00 <= second && second <= 0xDFFF) {\n this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n else {\n combined = true;\n }\n }\n else {\n combined = true;\n }\n }\n else {\n this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n if (combined) {\n this.combinedData = value[CHAR_DATA_CHAR_INDEX];\n this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n /** Get data as CharData. */\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport const DEFAULT_COLOR = 0;\nexport const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);\nexport const DEFAULT_EXT = 0;\n\nexport const CHAR_DATA_ATTR_INDEX = 0;\nexport const CHAR_DATA_CHAR_INDEX = 1;\nexport const CHAR_DATA_WIDTH_INDEX = 2;\nexport const CHAR_DATA_CODE_INDEX = 3;\n\n/**\n * Null cell - a real empty cell (containing nothing).\n * Note that code should always be 0 for a null cell as\n * several test condition of the buffer line rely on this.\n */\nexport const NULL_CELL_CHAR = '';\nexport const NULL_CELL_WIDTH = 1;\nexport const NULL_CELL_CODE = 0;\n\n/**\n * Whitespace cell.\n * This is meant as a replacement for empty cells when needed\n * during rendering lines to preserve correct aligment.\n */\nexport const WHITESPACE_CELL_CHAR = ' ';\nexport const WHITESPACE_CELL_WIDTH = 1;\nexport const WHITESPACE_CELL_CODE = 32;\n\n/**\n * Bitmasks for accessing data in `content`.\n */\nexport const enum Content {\n /**\n * bit 1..21 codepoint, max allowed in UTF32 is 0x10FFFF (21 bits taken)\n * read: `codepoint = content & Content.codepointMask;`\n * write: `content |= codepoint & Content.codepointMask;`\n * shortcut if precondition `codepoint <= 0x10FFFF` is met:\n * `content |= codepoint;`\n */\n CODEPOINT_MASK = 0x1FFFFF,\n\n /**\n * bit 22 flag indication whether a cell contains combined content\n * read: `isCombined = content & Content.isCombined;`\n * set: `content |= Content.isCombined;`\n * clear: `content &= ~Content.isCombined;`\n */\n IS_COMBINED_MASK = 0x200000, // 1 << 21\n\n /**\n * bit 1..22 mask to check whether a cell contains any string data\n * we need to check for codepoint and isCombined bits to see\n * whether a cell contains anything\n * read: `isEmpty = !(content & Content.hasContent)`\n */\n HAS_CONTENT_MASK = 0x3FFFFF,\n\n /**\n * bit 23..24 wcwidth value of cell, takes 2 bits (ranges from 0..2)\n * read: `width = (content & Content.widthMask) >> Content.widthShift;`\n * `hasWidth = content & Content.widthMask;`\n * as long as wcwidth is highest value in `content`:\n * `width = content >> Content.widthShift;`\n * write: `content |= (width << Content.widthShift) & Content.widthMask;`\n * shortcut if precondition `0 <= width <= 3` is met:\n * `content |= width << Content.widthShift;`\n */\n WIDTH_MASK = 0xC00000, // 3 << 22\n WIDTH_SHIFT = 22\n}\n\nexport const enum Attributes {\n /**\n * bit 1..8 blue in RGB, color in P256 and P16\n */\n BLUE_MASK = 0xFF,\n BLUE_SHIFT = 0,\n PCOLOR_MASK = 0xFF,\n PCOLOR_SHIFT = 0,\n\n /**\n * bit 9..16 green in RGB\n */\n GREEN_MASK = 0xFF00,\n GREEN_SHIFT = 8,\n\n /**\n * bit 17..24 red in RGB\n */\n RED_MASK = 0xFF0000,\n RED_SHIFT = 16,\n\n /**\n * bit 25..26 color mode: DEFAULT (0) | P16 (1) | P256 (2) | RGB (3)\n */\n CM_MASK = 0x3000000,\n CM_DEFAULT = 0,\n CM_P16 = 0x1000000,\n CM_P256 = 0x2000000,\n CM_RGB = 0x3000000,\n\n /**\n * bit 1..24 RGB room\n */\n RGB_MASK = 0xFFFFFF\n}\n\nexport const enum FgFlags {\n /**\n * bit 27..32\n */\n INVERSE = 0x4000000,\n BOLD = 0x8000000,\n UNDERLINE = 0x10000000,\n BLINK = 0x20000000,\n INVISIBLE = 0x40000000,\n STRIKETHROUGH = 0x80000000,\n}\n\nexport const enum BgFlags {\n /**\n * bit 27..32 (upper 2 unused)\n */\n ITALIC = 0x4000000,\n DIM = 0x8000000,\n HAS_EXTENDED = 0x10000000,\n PROTECTED = 0x20000000,\n OVERLINE = 0x40000000\n}\n\nexport const enum ExtFlags {\n /**\n * bit 27..29\n */\n UNDERLINE_STYLE = 0x1C000000,\n\n /**\n * bit 30..32\n *\n * An optional variant for the glyph, this can be used for example to offset underlines by a\n * number of pixels to create a perfect pattern.\n */\n VARIANT_OFFSET = 0xE0000000\n}\n\nexport const enum UnderlineStyle {\n NONE = 0,\n SINGLE = 1,\n DOUBLE = 2,\n CURLY = 3,\n DOTTED = 4,\n DASHED = 5\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable, IMarker } from 'common/Types';\nimport { Emitter } from 'vs/base/common/event';\nimport { dispose } from 'vs/base/common/lifecycle';\n\nexport class Marker implements IMarker {\n private static _nextId = 1;\n\n public isDisposed: boolean = false;\n private readonly _disposables: IDisposable[] = [];\n\n private readonly _id: number = Marker._nextId++;\n public get id(): number { return this._id; }\n\n private readonly _onDispose = this.register(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n constructor(\n public line: number\n ) {\n }\n\n public dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.line = -1;\n // Emit before super.dispose such that dispose listeners get a change to react\n this._onDispose.fire();\n dispose(this._disposables);\n this._disposables.length = 0;\n }\n\n public register(disposable: T): T {\n this._disposables.push(disposable);\n return disposable;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharset } from 'common/Types';\n\n/**\n * The character sets supported by the terminal. These enable several languages\n * to be represented within the terminal with only 8-bit encoding. See ISO 2022\n * for a discussion on character sets. Only VT100 character sets are supported.\n */\nexport const CHARSETS: { [key: string]: ICharset | undefined } = {};\n\n/**\n * The default character set, US.\n */\nexport const DEFAULT_CHARSET: ICharset | undefined = CHARSETS['B'];\n\n/**\n * DEC Special Character and Line Drawing Set.\n * Reference: http://vt100.net/docs/vt102-ug/table5-13.html\n * A lot of curses apps use this if they see TERM=xterm.\n * testing: echo -e '\\e(0a\\e(B'\n * The xterm output sometimes seems to conflict with the\n * reference above. xterm seems in line with the reference\n * when running vttest however.\n * The table below now uses xterm's output from vttest.\n */\nCHARSETS['0'] = {\n '`': '\\u25c6', // '◆'\n 'a': '\\u2592', // '▒'\n 'b': '\\u2409', // '␉' (HT)\n 'c': '\\u240c', // '␌' (FF)\n 'd': '\\u240d', // '␍' (CR)\n 'e': '\\u240a', // '␊' (LF)\n 'f': '\\u00b0', // '°'\n 'g': '\\u00b1', // '±'\n 'h': '\\u2424', // '␤' (NL)\n 'i': '\\u240b', // '␋' (VT)\n 'j': '\\u2518', // '┘'\n 'k': '\\u2510', // '┐'\n 'l': '\\u250c', // '┌'\n 'm': '\\u2514', // '└'\n 'n': '\\u253c', // '┼'\n 'o': '\\u23ba', // '⎺'\n 'p': '\\u23bb', // '⎻'\n 'q': '\\u2500', // '─'\n 'r': '\\u23bc', // '⎼'\n 's': '\\u23bd', // '⎽'\n 't': '\\u251c', // '├'\n 'u': '\\u2524', // '┤'\n 'v': '\\u2534', // '┴'\n 'w': '\\u252c', // '┬'\n 'x': '\\u2502', // '│'\n 'y': '\\u2264', // '≤'\n 'z': '\\u2265', // '≥'\n '{': '\\u03c0', // 'π'\n '|': '\\u2260', // '≠'\n '}': '\\u00a3', // '£'\n '~': '\\u00b7' // '·'\n};\n\n/**\n * British character set\n * ESC (A\n * Reference: http://vt100.net/docs/vt220-rm/table2-5.html\n */\nCHARSETS['A'] = {\n '#': '£'\n};\n\n/**\n * United States character set\n * ESC (B\n */\nCHARSETS['B'] = undefined;\n\n/**\n * Dutch character set\n * ESC (4\n * Reference: http://vt100.net/docs/vt220-rm/table2-6.html\n */\nCHARSETS['4'] = {\n '#': '£',\n '@': '¾',\n '[': 'ij',\n '\\\\': '½',\n ']': '|',\n '{': '¨',\n '|': 'f',\n '}': '¼',\n '~': '´'\n};\n\n/**\n * Finnish character set\n * ESC (C or ESC (5\n * Reference: http://vt100.net/docs/vt220-rm/table2-7.html\n */\nCHARSETS['C'] =\nCHARSETS['5'] = {\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * French character set\n * ESC (R\n * Reference: http://vt100.net/docs/vt220-rm/table2-8.html\n */\nCHARSETS['R'] = {\n '#': '£',\n '@': 'à',\n '[': '°',\n '\\\\': 'ç',\n ']': '§',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': '¨'\n};\n\n/**\n * French Canadian character set\n * ESC (Q\n * Reference: http://vt100.net/docs/vt220-rm/table2-9.html\n */\nCHARSETS['Q'] = {\n '@': 'à',\n '[': 'â',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n '`': 'ô',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': 'û'\n};\n\n/**\n * German character set\n * ESC (K\n * Reference: http://vt100.net/docs/vt220-rm/table2-10.html\n */\nCHARSETS['K'] = {\n '@': '§',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Ü',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'ß'\n};\n\n/**\n * Italian character set\n * ESC (Y\n * Reference: http://vt100.net/docs/vt220-rm/table2-11.html\n */\nCHARSETS['Y'] = {\n '#': '£',\n '@': '§',\n '[': '°',\n '\\\\': 'ç',\n ']': 'é',\n '`': 'ù',\n '{': 'à',\n '|': 'ò',\n '}': 'è',\n '~': 'ì'\n};\n\n/**\n * Norwegian/Danish character set\n * ESC (E or ESC (6\n * Reference: http://vt100.net/docs/vt220-rm/table2-12.html\n */\nCHARSETS['E'] =\nCHARSETS['6'] = {\n '@': 'Ä',\n '[': 'Æ',\n '\\\\': 'Ø',\n ']': 'Å',\n '^': 'Ü',\n '`': 'ä',\n '{': 'æ',\n '|': 'ø',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * Spanish character set\n * ESC (Z\n * Reference: http://vt100.net/docs/vt220-rm/table2-13.html\n */\nCHARSETS['Z'] = {\n '#': '£',\n '@': '§',\n '[': '¡',\n '\\\\': 'Ñ',\n ']': '¿',\n '{': '°',\n '|': 'ñ',\n '}': 'ç'\n};\n\n/**\n * Swedish character set\n * ESC (H or ESC (7\n * Reference: http://vt100.net/docs/vt220-rm/table2-14.html\n */\nCHARSETS['H'] =\nCHARSETS['7'] = {\n '@': 'É',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * Swiss character set\n * ESC (=\n * Reference: http://vt100.net/docs/vt220-rm/table2-15.html\n */\nCHARSETS['='] = {\n '#': 'ù',\n '@': 'à',\n '[': 'é',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n '_': 'è',\n '`': 'ô',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'û'\n};\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * C0 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C0 {\n /** Null (Caret = ^@, C = \\0) */\n export const NUL = '\\x00';\n /** Start of Heading (Caret = ^A) */\n export const SOH = '\\x01';\n /** Start of Text (Caret = ^B) */\n export const STX = '\\x02';\n /** End of Text (Caret = ^C) */\n export const ETX = '\\x03';\n /** End of Transmission (Caret = ^D) */\n export const EOT = '\\x04';\n /** Enquiry (Caret = ^E) */\n export const ENQ = '\\x05';\n /** Acknowledge (Caret = ^F) */\n export const ACK = '\\x06';\n /** Bell (Caret = ^G, C = \\a) */\n export const BEL = '\\x07';\n /** Backspace (Caret = ^H, C = \\b) */\n export const BS = '\\x08';\n /** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \\t) */\n export const HT = '\\x09';\n /** Line Feed (Caret = ^J, C = \\n) */\n export const LF = '\\x0a';\n /** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \\v) */\n export const VT = '\\x0b';\n /** Form Feed (Caret = ^L, C = \\f) */\n export const FF = '\\x0c';\n /** Carriage Return (Caret = ^M, C = \\r) */\n export const CR = '\\x0d';\n /** Shift Out (Caret = ^N) */\n export const SO = '\\x0e';\n /** Shift In (Caret = ^O) */\n export const SI = '\\x0f';\n /** Data Link Escape (Caret = ^P) */\n export const DLE = '\\x10';\n /** Device Control One (XON) (Caret = ^Q) */\n export const DC1 = '\\x11';\n /** Device Control Two (Caret = ^R) */\n export const DC2 = '\\x12';\n /** Device Control Three (XOFF) (Caret = ^S) */\n export const DC3 = '\\x13';\n /** Device Control Four (Caret = ^T) */\n export const DC4 = '\\x14';\n /** Negative Acknowledge (Caret = ^U) */\n export const NAK = '\\x15';\n /** Synchronous Idle (Caret = ^V) */\n export const SYN = '\\x16';\n /** End of Transmission Block (Caret = ^W) */\n export const ETB = '\\x17';\n /** Cancel (Caret = ^X) */\n export const CAN = '\\x18';\n /** End of Medium (Caret = ^Y) */\n export const EM = '\\x19';\n /** Substitute (Caret = ^Z) */\n export const SUB = '\\x1a';\n /** Escape (Caret = ^[, C = \\e) */\n export const ESC = '\\x1b';\n /** File Separator (Caret = ^\\) */\n export const FS = '\\x1c';\n /** Group Separator (Caret = ^]) */\n export const GS = '\\x1d';\n /** Record Separator (Caret = ^^) */\n export const RS = '\\x1e';\n /** Unit Separator (Caret = ^_) */\n export const US = '\\x1f';\n /** Space */\n export const SP = '\\x20';\n /** Delete (Caret = ^?) */\n export const DEL = '\\x7f';\n}\n\n/**\n * C1 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C1 {\n /** padding character */\n export const PAD = '\\x80';\n /** High Octet Preset */\n export const HOP = '\\x81';\n /** Break Permitted Here */\n export const BPH = '\\x82';\n /** No Break Here */\n export const NBH = '\\x83';\n /** Index */\n export const IND = '\\x84';\n /** Next Line */\n export const NEL = '\\x85';\n /** Start of Selected Area */\n export const SSA = '\\x86';\n /** End of Selected Area */\n export const ESA = '\\x87';\n /** Horizontal Tabulation Set */\n export const HTS = '\\x88';\n /** Horizontal Tabulation With Justification */\n export const HTJ = '\\x89';\n /** Vertical Tabulation Set */\n export const VTS = '\\x8a';\n /** Partial Line Down */\n export const PLD = '\\x8b';\n /** Partial Line Up */\n export const PLU = '\\x8c';\n /** Reverse Index */\n export const RI = '\\x8d';\n /** Single-Shift 2 */\n export const SS2 = '\\x8e';\n /** Single-Shift 3 */\n export const SS3 = '\\x8f';\n /** Device Control String */\n export const DCS = '\\x90';\n /** Private Use 1 */\n export const PU1 = '\\x91';\n /** Private Use 2 */\n export const PU2 = '\\x92';\n /** Set Transmit State */\n export const STS = '\\x93';\n /** Destructive backspace, intended to eliminate ambiguity about meaning of BS. */\n export const CCH = '\\x94';\n /** Message Waiting */\n export const MW = '\\x95';\n /** Start of Protected Area */\n export const SPA = '\\x96';\n /** End of Protected Area */\n export const EPA = '\\x97';\n /** Start of String */\n export const SOS = '\\x98';\n /** Single Graphic Character Introducer */\n export const SGCI = '\\x99';\n /** Single Character Introducer */\n export const SCI = '\\x9a';\n /** Control Sequence Introducer */\n export const CSI = '\\x9b';\n /** String Terminator */\n export const ST = '\\x9c';\n /** Operating System Command */\n export const OSC = '\\x9d';\n /** Privacy Message */\n export const PM = '\\x9e';\n /** Application Program Command */\n export const APC = '\\x9f';\n}\nexport namespace C1_ESCAPED {\n export const ST = `${C0.ESC}\\\\`;\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n// reg + shift key mappings for digits and special chars\nconst KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {\n // digits 0-9\n 48: ['0', ')'],\n 49: ['1', '!'],\n 50: ['2', '@'],\n 51: ['3', '#'],\n 52: ['4', '$'],\n 53: ['5', '%'],\n 54: ['6', '^'],\n 55: ['7', '&'],\n 56: ['8', '*'],\n 57: ['9', '('],\n\n // special chars\n 186: [';', ':'],\n 187: ['=', '+'],\n 188: [',', '<'],\n 189: ['-', '_'],\n 190: ['.', '>'],\n 191: ['/', '?'],\n 192: ['`', '~'],\n 219: ['[', '{'],\n 220: ['\\\\', '|'],\n 221: [']', '}'],\n 222: ['\\'', '\"']\n};\n\nexport function evaluateKeyboardEvent(\n ev: IKeyboardEvent,\n applicationCursorMode: boolean,\n isMac: boolean,\n macOptionIsMeta: boolean\n): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n // Whether to cancel event propagation (NOTE: this may not be needed since the event is\n // canceled at the end of keyDown\n cancel: false,\n // The new key even to emit\n key: undefined\n };\n const modifiers = (ev.shiftKey ? 1 : 0) | (ev.altKey ? 2 : 0) | (ev.ctrlKey ? 4 : 0) | (ev.metaKey ? 8 : 0);\n switch (ev.keyCode) {\n case 0:\n if (ev.key === 'UIKeyInputUpArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n }\n else if (ev.key === 'UIKeyInputLeftArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n }\n else if (ev.key === 'UIKeyInputRightArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n }\n else if (ev.key === 'UIKeyInputDownArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n }\n break;\n case 8:\n // backspace\n result.key = ev.ctrlKey ? '\\b' : C0.DEL; // ^H or ^?\n if (ev.altKey) {\n result.key = C0.ESC + result.key;\n }\n break;\n case 9:\n // tab\n if (ev.shiftKey) {\n result.key = C0.ESC + '[Z';\n break;\n }\n result.key = C0.HT;\n result.cancel = true;\n break;\n case 13:\n // return/enter\n result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;\n result.cancel = true;\n break;\n case 27:\n // escape\n result.key = C0.ESC;\n if (ev.altKey) {\n result.key = C0.ESC + C0.ESC;\n }\n result.cancel = true;\n break;\n case 37:\n // left-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'D';\n // HACK: Make Alt + left-arrow behave like Ctrl + left-arrow: move one word backwards\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3D') {\n result.key = C0.ESC + (isMac ? 'b' : '[1;5D');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n break;\n case 39:\n // right-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'C';\n // HACK: Make Alt + right-arrow behave like Ctrl + right-arrow: move one word forward\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3C') {\n result.key = C0.ESC + (isMac ? 'f' : '[1;5C');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n break;\n case 38:\n // up-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A';\n // HACK: Make Alt + up-arrow behave like Ctrl + up-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3A') {\n result.key = C0.ESC + '[1;5A';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n break;\n case 40:\n // down-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B';\n // HACK: Make Alt + down-arrow behave like Ctrl + down-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3B') {\n result.key = C0.ESC + '[1;5B';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n break;\n case 45:\n // insert\n if (!ev.shiftKey && !ev.ctrlKey) {\n // or + are used to\n // copy-paste on some systems.\n result.key = C0.ESC + '[2~';\n }\n break;\n case 46:\n // delete\n if (modifiers) {\n result.key = C0.ESC + '[3;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[3~';\n }\n break;\n case 36:\n // home\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'H';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OH';\n } else {\n result.key = C0.ESC + '[H';\n }\n break;\n case 35:\n // end\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'F';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OF';\n } else {\n result.key = C0.ESC + '[F';\n }\n break;\n case 33:\n // page up\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_UP;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[5;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[5~';\n }\n break;\n case 34:\n // page down\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_DOWN;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[6;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[6~';\n }\n break;\n case 112:\n // F1-F12\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'P';\n } else {\n result.key = C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n } else {\n result.key = C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'R';\n } else {\n result.key = C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'S';\n } else {\n result.key = C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = C0.ESC + '[15;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = C0.ESC + '[17;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = C0.ESC + '[18;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = C0.ESC + '[19;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = C0.ESC + '[20;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = C0.ESC + '[21;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = C0.ESC + '[23;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = C0.ESC + '[24;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[24~';\n }\n break;\n default:\n // a-z and space\n if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = String.fromCharCode(ev.keyCode - 64);\n } else if (ev.keyCode === 32) {\n result.key = C0.NUL;\n } else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n // escape, file sep, group sep, record sep, unit sep\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n } else if (ev.keyCode === 56) {\n result.key = C0.DEL;\n } else if (ev.keyCode === 219) {\n result.key = C0.ESC;\n } else if (ev.keyCode === 220) {\n result.key = C0.FS;\n } else if (ev.keyCode === 221) {\n result.key = C0.GS;\n }\n } else if ((!isMac || macOptionIsMeta) && ev.altKey && !ev.metaKey) {\n // On macOS this is a third level shift when !macOptionIsMeta. Use instead.\n const keyMapping = KEYCODE_KEY_MAPPINGS[ev.keyCode];\n const key = keyMapping?.[!ev.shiftKey ? 0 : 1];\n if (key) {\n result.key = C0.ESC + key;\n } else if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n const keyCode = ev.ctrlKey ? ev.keyCode - 64 : ev.keyCode + 32;\n let keyString = String.fromCharCode(keyCode);\n if (ev.shiftKey) {\n keyString = keyString.toUpperCase();\n }\n result.key = C0.ESC + keyString;\n } else if (ev.keyCode === 32) {\n result.key = C0.ESC + (ev.ctrlKey ? C0.NUL : ' ');\n } else if (ev.key === 'Dead' && ev.code.startsWith('Key')) {\n // Reference: https://github.com/xtermjs/xterm.js/issues/3725\n // Alt will produce a \"dead key\" (initate composition) with some\n // of the letters in US layout (e.g. N/E/U).\n // It's safe to match against Key* since no other `code` values begin with \"Key\".\n // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values#code_values_on_mac\n let keyString = ev.code.slice(3, 4);\n if (!ev.shiftKey) {\n keyString = keyString.toLowerCase();\n }\n result.key = C0.ESC + keyString;\n result.cancel = true;\n }\n } else if (isMac && !ev.altKey && !ev.ctrlKey && !ev.shiftKey && ev.metaKey) {\n if (ev.keyCode === 65) { // cmd + a\n result.type = KeyboardResultType.SELECT_ALL;\n }\n } else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.keyCode >= 48 && ev.key.length === 1) {\n // Include only keys that that result in a _single_ character; don't include num lock,\n // volume up, etc.\n result.key = ev.key;\n } else if (ev.key && ev.ctrlKey) {\n if (ev.key === '_') { // ^_\n result.key = C0.US;\n }\n if (ev.key === '@') { // ^ + shift + 2 = ^ + @\n result.key = C0.NUL;\n }\n }\n break;\n }\n\n return result;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Polyfill - Convert UTF32 codepoint into JS string.\n * Note: The built-in String.fromCodePoint happens to be much slower\n * due to additional sanity checks. We can avoid them since\n * we always operate on legal UTF32 (granted by the input decoders)\n * and use this faster version instead.\n */\nexport function stringFromCodePoint(codePoint: number): string {\n if (codePoint > 0xFFFF) {\n codePoint -= 0x10000;\n return String.fromCharCode((codePoint >> 10) + 0xD800) + String.fromCharCode((codePoint % 0x400) + 0xDC00);\n }\n return String.fromCharCode(codePoint);\n}\n\n/**\n * Convert UTF32 char codes into JS string.\n * Basically the same as `stringFromCodePoint` but for multiple codepoints\n * in a loop (which is a lot faster).\n */\nexport function utf32ToString(data: Uint32Array, start: number = 0, end: number = data.length): string {\n let result = '';\n for (let i = start; i < end; ++i) {\n let codepoint = data[i];\n if (codepoint > 0xFFFF) {\n // JS strings are encoded as UTF16, thus a non BMP codepoint gets converted into a surrogate\n // pair conversion rules:\n // - subtract 0x10000 from code point, leaving a 20 bit number\n // - add high 10 bits to 0xD800 --> first surrogate\n // - add low 10 bits to 0xDC00 --> second surrogate\n codepoint -= 0x10000;\n result += String.fromCharCode((codepoint >> 10) + 0xD800) + String.fromCharCode((codepoint % 0x400) + 0xDC00);\n } else {\n result += String.fromCharCode(codepoint);\n }\n }\n return result;\n}\n\n/**\n * StringToUtf32 - decodes UTF16 sequences into UTF32 codepoints.\n * To keep the decoder in line with JS strings it handles single surrogates as UCS2.\n */\nexport class StringToUtf32 {\n private _interim: number = 0;\n\n /**\n * Clears interim and resets decoder to clean state.\n */\n public clear(): void {\n this._interim = 0;\n }\n\n /**\n * Decode JS string to UTF32 codepoints.\n * The methods assumes stream input and will store partly transmitted\n * surrogate pairs and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided input data does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: string, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let startPos = 0;\n\n // handle leftover surrogate high\n if (this._interim) {\n const second = input.charCodeAt(startPos++);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (this._interim - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = this._interim;\n target[size++] = second;\n }\n this._interim = 0;\n }\n\n for (let i = startPos; i < length; ++i) {\n const code = input.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n this._interim = code;\n return size;\n }\n const second = input.charCodeAt(i);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = code;\n target[size++] = second;\n }\n continue;\n }\n if (code === 0xFEFF) {\n // BOM\n continue;\n }\n target[size++] = code;\n }\n return size;\n }\n}\n\n/**\n * Utf8Decoder - decodes UTF8 byte sequences into UTF32 codepoints.\n */\nexport class Utf8ToUtf32 {\n public interim: Uint8Array = new Uint8Array(3);\n\n /**\n * Clears interim bytes and resets decoder to clean state.\n */\n public clear(): void {\n this.interim.fill(0);\n }\n\n /**\n * Decodes UTF8 byte sequences in `input` to UTF32 codepoints in `target`.\n * The methods assumes stream input and will store partly transmitted bytes\n * and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided data chunk does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: Uint8Array, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let byte1: number;\n let byte2: number;\n let byte3: number;\n let byte4: number;\n let codepoint = 0;\n let startPos = 0;\n\n // handle leftover bytes\n if (this.interim[0]) {\n let discardInterim = false;\n let cp = this.interim[0];\n cp &= ((((cp & 0xE0) === 0xC0)) ? 0x1F : (((cp & 0xF0) === 0xE0)) ? 0x0F : 0x07);\n let pos = 0;\n let tmp: number;\n while ((tmp = this.interim[++pos] & 0x3F) && pos < 4) {\n cp <<= 6;\n cp |= tmp;\n }\n // missing bytes - read ahead from input\n const type = (((this.interim[0] & 0xE0) === 0xC0)) ? 2 : (((this.interim[0] & 0xF0) === 0xE0)) ? 3 : 4;\n const missing = type - pos;\n while (startPos < missing) {\n if (startPos >= length) {\n return 0;\n }\n tmp = input[startPos++];\n if ((tmp & 0xC0) !== 0x80) {\n // wrong continuation, discard interim bytes completely\n startPos--;\n discardInterim = true;\n break;\n } else {\n // need to save so we can continue short inputs in next call\n this.interim[pos++] = tmp;\n cp <<= 6;\n cp |= tmp & 0x3F;\n }\n }\n if (!discardInterim) {\n // final test is type dependent\n if (type === 2) {\n if (cp < 0x80) {\n // wrong starter byte\n startPos--;\n } else {\n target[size++] = cp;\n }\n } else if (type === 3) {\n if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF) || cp === 0xFEFF) {\n // illegal codepoint or BOM\n } else {\n target[size++] = cp;\n }\n } else {\n if (cp < 0x010000 || cp > 0x10FFFF) {\n // illegal codepoint\n } else {\n target[size++] = cp;\n }\n }\n }\n this.interim.fill(0);\n }\n\n // loop through input\n const fourStop = length - 4;\n let i = startPos;\n while (i < length) {\n /**\n * ASCII shortcut with loop unrolled to 4 consecutive ASCII chars.\n * This is a compromise between speed gain for ASCII\n * and penalty for non ASCII:\n * For best ASCII performance the char should be stored directly into target,\n * but even a single attempt to write to target and compare afterwards\n * penalizes non ASCII really bad (-50%), thus we load the char into byteX first,\n * which reduces ASCII performance by ~15%.\n * This trial for ASCII reduces non ASCII performance by ~10% which seems acceptible\n * compared to the gains.\n * Note that this optimization only takes place for 4 consecutive ASCII chars,\n * for any shorter it bails out. Worst case - all 4 bytes being read but\n * thrown away due to the last being a non ASCII char (-10% performance).\n */\n while (i < fourStop\n && !((byte1 = input[i]) & 0x80)\n && !((byte2 = input[i + 1]) & 0x80)\n && !((byte3 = input[i + 2]) & 0x80)\n && !((byte4 = input[i + 3]) & 0x80))\n {\n target[size++] = byte1;\n target[size++] = byte2;\n target[size++] = byte3;\n target[size++] = byte4;\n i += 4;\n }\n\n // reread byte1\n byte1 = input[i++];\n\n // 1 byte\n if (byte1 < 0x80) {\n target[size++] = byte1;\n\n // 2 bytes\n } else if ((byte1 & 0xE0) === 0xC0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x1F) << 6 | (byte2 & 0x3F);\n if (codepoint < 0x80) {\n // wrong starter byte\n i--;\n continue;\n }\n target[size++] = codepoint;\n\n // 3 bytes\n } else if ((byte1 & 0xF0) === 0xE0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F);\n if (codepoint < 0x0800 || (codepoint >= 0xD800 && codepoint <= 0xDFFF) || codepoint === 0xFEFF) {\n // illegal codepoint or BOM, no i-- here\n continue;\n }\n target[size++] = codepoint;\n\n // 4 bytes\n } else if ((byte1 & 0xF8) === 0xF0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n this.interim[2] = byte3;\n return size;\n }\n byte4 = input[i++];\n if ((byte4 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x07) << 18 | (byte2 & 0x3F) << 12 | (byte3 & 0x3F) << 6 | (byte4 & 0x3F);\n if (codepoint < 0x010000 || codepoint > 0x10FFFF) {\n // illegal codepoint, no i-- here\n continue;\n }\n target[size++] = codepoint;\n } else {\n // illegal byte, just skip\n }\n }\n return size;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\n\nconst BMP_COMBINING = [\n [0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489],\n [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2],\n [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603],\n [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670],\n [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED],\n [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A],\n [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902],\n [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D],\n [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981],\n [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD],\n [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C],\n [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D],\n [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC],\n [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD],\n [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C],\n [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D],\n [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0],\n [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48],\n [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC],\n [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD],\n [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D],\n [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6],\n [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E],\n [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC],\n [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35],\n [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E],\n [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97],\n [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030],\n [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039],\n [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F],\n [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753],\n [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD],\n [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD],\n [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922],\n [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B],\n [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34],\n [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42],\n [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF],\n [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063],\n [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F],\n [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B],\n [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F],\n [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB]\n];\nconst HIGH_COMBINING = [\n [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F],\n [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169],\n [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD],\n [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F],\n [0xE0100, 0xE01EF]\n];\n\n// BMP lookup table, lazy initialized during first addon loading\nlet table: Uint8Array;\n\nfunction bisearch(ucs: number, data: number[][]): boolean {\n let min = 0;\n let max = data.length - 1;\n let mid;\n if (ucs < data[0][0] || ucs > data[max][1]) {\n return false;\n }\n while (max >= min) {\n mid = (min + max) >> 1;\n if (ucs > data[mid][1]) {\n min = mid + 1;\n } else if (ucs < data[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n}\n\nexport class UnicodeV6 implements IUnicodeVersionProvider {\n public readonly version = '6';\n\n constructor() {\n // init lookup table once\n if (!table) {\n table = new Uint8Array(65536);\n table.fill(1);\n table[0] = 0;\n // control chars\n table.fill(0, 1, 32);\n table.fill(0, 0x7f, 0xa0);\n\n // apply wide char rules first\n // wide chars\n table.fill(2, 0x1100, 0x1160);\n table[0x2329] = 2;\n table[0x232a] = 2;\n table.fill(2, 0x2e80, 0xa4d0);\n table[0x303f] = 1; // wrongly in last line\n\n table.fill(2, 0xac00, 0xd7a4);\n table.fill(2, 0xf900, 0xfb00);\n table.fill(2, 0xfe10, 0xfe1a);\n table.fill(2, 0xfe30, 0xfe70);\n table.fill(2, 0xff00, 0xff61);\n table.fill(2, 0xffe0, 0xffe7);\n\n // apply combining last to ensure we overwrite\n // wrongly wide set chars:\n // the original algo evals combining first and falls\n // through to wide check so we simply do here the opposite\n // combining 0\n for (let r = 0; r < BMP_COMBINING.length; ++r) {\n table.fill(0, BMP_COMBINING[r][0], BMP_COMBINING[r][1] + 1);\n }\n }\n }\n\n public wcwidth(num: number): UnicodeCharWidth {\n if (num < 32) return 0;\n if (num < 127) return 1;\n if (num < 65536) return table[num] as UnicodeCharWidth;\n if (bisearch(num, HIGH_COMBINING)) return 0;\n if ((num >= 0x20000 && num <= 0x2fffd) || (num >= 0x30000 && num <= 0x3fffd)) return 2;\n return 1;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n let width = this.wcwidth(codepoint);\n let shouldJoin = width === 0 && preceding !== 0;\n if (shouldJoin) {\n const oldWidth = UnicodeService.extractWidth(preceding);\n if (oldWidth === 0) {\n shouldJoin = false;\n } else if (oldWidth > width) {\n width = oldWidth;\n }\n }\n return UnicodeService.createPropertyValue(0, width, shouldJoin);\n }\n}\n","\n/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\ndeclare const setTimeout: (handler: () => void, timeout?: number) => void;\n\n/**\n * Safety watermark to avoid memory exhaustion and browser engine crash on fast data input.\n * Enable flow control to avoid this limit and make sure that your backend correctly\n * propagates this to the underlying pty. (see docs for further instructions)\n * Since this limit is meant as a safety parachute to prevent browser crashs,\n * it is set to a very high number. Typically xterm.js gets unresponsive with\n * a 100 times lower number (>500 kB).\n */\nconst DISCARD_WATERMARK = 50000000; // ~50 MB\n\n/**\n * The max number of ms to spend on writes before allowing the renderer to\n * catch up with a 0ms setTimeout. A value of < 33 to keep us close to\n * 30fps, and a value of < 16 to try to run at 60fps. Of course, the real FPS\n * depends on the time it takes for the renderer to draw the frame.\n */\nconst WRITE_TIMEOUT_MS = 12;\n\n/**\n * Threshold of max held chunks in the write buffer, that were already processed.\n * This is a tradeoff between extensive write buffer shifts (bad runtime) and high\n * memory consumption by data thats not used anymore.\n */\nconst WRITE_BUFFER_LENGTH_THRESHOLD = 50;\n\nexport class WriteBuffer extends Disposable {\n private _writeBuffer: (string | Uint8Array)[] = [];\n private _callbacks: ((() => void) | undefined)[] = [];\n private _pendingData = 0;\n private _bufferOffset = 0;\n private _isSyncWriting = false;\n private _syncCalls = 0;\n private _didUserInput = false;\n\n private readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise) {\n super();\n }\n\n public handleUserInput(): void {\n this._didUserInput = true;\n }\n\n /**\n * @deprecated Unreliable, to be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n // stop writeSync recursions with maxSubsequentCalls argument\n // This is dangerous to use as it will lose the current data chunk\n // and return immediately.\n if (maxSubsequentCalls !== undefined && this._syncCalls > maxSubsequentCalls) {\n // comment next line if a whole loop block should only contain x `writeSync` calls\n // (total flat vs. deep nested limit)\n this._syncCalls = 0;\n return;\n }\n // append chunk to buffer\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(undefined);\n\n // increase recursion counter\n this._syncCalls++;\n // exit early if another writeSync loop is active\n if (this._isSyncWriting) {\n return;\n }\n this._isSyncWriting = true;\n\n // force sync processing on pending data chunks to avoid in-band data scrambling\n // does the same as innerWrite but without event loop\n // we have to do it here as single loop steps to not corrupt loop subject\n // by another writeSync call triggered from _action\n let chunk: string | Uint8Array | undefined;\n while (chunk = this._writeBuffer.shift()) {\n this._action(chunk);\n const cb = this._callbacks.shift();\n if (cb) cb();\n }\n // reset to avoid reprocessing of chunks with scheduled innerWrite call\n // stopping scheduled innerWrite by offset > length condition\n this._pendingData = 0;\n this._bufferOffset = 0x7FFFFFFF;\n\n // allow another writeSync to loop\n this._isSyncWriting = false;\n this._syncCalls = 0;\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n if (this._pendingData > DISCARD_WATERMARK) {\n throw new Error('write data discarded, use flow control to avoid losing data');\n }\n\n // schedule chunk processing for next event loop run\n if (!this._writeBuffer.length) {\n this._bufferOffset = 0;\n\n // If this is the first write call after the user has done some input,\n // parse it immediately to minimize input latency,\n // otherwise schedule for the next event\n if (this._didUserInput) {\n this._didUserInput = false;\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n this._innerWrite();\n return;\n }\n\n setTimeout(() => this._innerWrite());\n }\n\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n }\n\n /**\n * Inner write call, that enters the sliced chunk processing by timing.\n *\n * `lastTime` indicates, when the last _innerWrite call had started.\n * It is used to aggregate async handler execution under a timeout constraint\n * effectively lowering the redrawing needs, schematically:\n *\n * macroTask _innerWrite:\n * if (Date.now() - (lastTime | 0) < WRITE_TIMEOUT_MS):\n * schedule microTask _innerWrite(lastTime)\n * else:\n * schedule macroTask _innerWrite(0)\n *\n * overall execution order on task queues:\n *\n * macrotasks: [...] --> _innerWrite(0) --> [...] --> screenUpdate --> [...]\n * m t: |\n * i a: [...]\n * c s: |\n * r k: while < timeout:\n * o s: _innerWrite(timeout)\n *\n * `promiseResult` depicts the promise resolve value of an async handler.\n * This value gets carried forward through all saved stack states of the\n * paused parser for proper continuation.\n *\n * Note, for pure sync code `lastTime` and `promiseResult` have no meaning.\n */\n protected _innerWrite(lastTime: number = 0, promiseResult: boolean = true): void {\n const startTime = lastTime || Date.now();\n while (this._writeBuffer.length > this._bufferOffset) {\n const data = this._writeBuffer[this._bufferOffset];\n const result = this._action(data, promiseResult);\n if (result) {\n /**\n * If we get a promise as return value, we re-schedule the continuation\n * as thenable on the promise and exit right away.\n *\n * The exit here means, that we block input processing at the current active chunk,\n * the exact execution position within the chunk is preserved by the saved\n * stack content in InputHandler and EscapeSequenceParser.\n *\n * Resuming happens automatically from that saved stack state.\n * Also the resolved promise value is passed along the callstack to\n * `EscapeSequenceParser.parse` to correctly resume the stopped handler loop.\n *\n * Exceptions on async handlers will be logged to console async, but do not interrupt\n * the input processing (continues with next handler at the current input position).\n */\n\n /**\n * If a promise takes long to resolve, we should schedule continuation behind setTimeout.\n * This might already be too late, if our .then enters really late (executor + prev thens\n * took very long). This cannot be solved here for the handler itself (it is the handlers\n * responsibility to slice hard work), but we can at least schedule a screen update as we\n * gain control.\n */\n const continuation: (r: boolean) => void = (r: boolean) => Date.now() - startTime >= WRITE_TIMEOUT_MS\n ? setTimeout(() => this._innerWrite(0, r))\n : this._innerWrite(startTime, r);\n\n /**\n * Optimization considerations:\n * The continuation above favors FPS over throughput by eval'ing `startTime` on resolve.\n * This might schedule too many screen updates with bad throughput drops (in case a slow\n * resolving handler sliced its work properly behind setTimeout calls). We cannot spot\n * this condition here, also the renderer has no way to spot nonsense updates either.\n * FIXME: A proper fix for this would track the FPS at the renderer entry level separately.\n *\n * If favoring of FPS shows bad throughtput impact, use the following instead. It favors\n * throughput by eval'ing `startTime` upfront pulling at least one more chunk into the\n * current microtask queue (executed before setTimeout).\n */\n // const continuation: (r: boolean) => void = Date.now() - startTime >= WRITE_TIMEOUT_MS\n // ? r => setTimeout(() => this._innerWrite(0, r))\n // : r => this._innerWrite(startTime, r);\n\n // Handle exceptions synchronously to current band position, idea:\n // 1. spawn a single microtask which we allow to throw hard\n // 2. spawn a promise immediately resolving to `true`\n // (executed on the same queue, thus properly aligned before continuation happens)\n result.catch(err => {\n queueMicrotask(() => {throw err;});\n return Promise.resolve(false);\n }).then(continuation);\n return;\n }\n\n const cb = this._callbacks[this._bufferOffset];\n if (cb) cb();\n this._bufferOffset++;\n this._pendingData -= data.length;\n\n if (Date.now() - startTime >= WRITE_TIMEOUT_MS) {\n break;\n }\n }\n if (this._writeBuffer.length > this._bufferOffset) {\n // Allow renderer to catch up before processing the next batch\n // trim already processed chunks if we are above threshold\n if (this._bufferOffset > WRITE_BUFFER_LENGTH_THRESHOLD) {\n this._writeBuffer = this._writeBuffer.slice(this._bufferOffset);\n this._callbacks = this._callbacks.slice(this._bufferOffset);\n this._bufferOffset = 0;\n }\n setTimeout(() => this._innerWrite());\n } else {\n this._writeBuffer.length = 0;\n this._callbacks.length = 0;\n this._pendingData = 0;\n this._bufferOffset = 0;\n }\n this._onWriteParsed.fire();\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n\n// 'rgb:' rule - matching: r/g/b | rr/gg/bb | rrr/ggg/bbb | rrrr/gggg/bbbb (hex digits)\nconst RGB_REX = /^([\\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})$/;\n// '#...' rule - matching any hex digits\nconst HASH_REX = /^[\\da-f]+$/;\n\n/**\n * Parse color spec to RGB values (8 bit per channel).\n * See `man xparsecolor` for details about certain format specifications.\n *\n * Supported formats:\n * - rgb:// with , , in h | hh | hhh | hhhh\n * - #RGB, #RRGGBB, #RRRGGGBBB, #RRRRGGGGBBBB\n *\n * All other formats like rgbi: or device-independent string specifications\n * with float numbering are not supported.\n */\nexport function parseColor(data: string): [number, number, number] | undefined {\n if (!data) return;\n // also handle uppercases\n let low = data.toLowerCase();\n if (low.indexOf('rgb:') === 0) {\n // 'rgb:' specifier\n low = low.slice(4);\n const m = RGB_REX.exec(low);\n if (m) {\n const base = m[1] ? 15 : m[4] ? 255 : m[7] ? 4095 : 65535;\n return [\n Math.round(parseInt(m[1] || m[4] || m[7] || m[10], 16) / base * 255),\n Math.round(parseInt(m[2] || m[5] || m[8] || m[11], 16) / base * 255),\n Math.round(parseInt(m[3] || m[6] || m[9] || m[12], 16) / base * 255)\n ];\n }\n } else if (low.indexOf('#') === 0) {\n // '#' specifier\n low = low.slice(1);\n if (HASH_REX.exec(low) && [3, 6, 9, 12].includes(low.length)) {\n const adv = low.length / 3;\n const result: [number, number, number] = [0, 0, 0];\n for (let i = 0; i < 3; ++i) {\n const c = parseInt(low.slice(adv * i, adv * i + adv), 16);\n result[i] = adv === 1 ? c << 4 : adv === 2 ? c : adv === 3 ? c >> 4 : c >> 8;\n }\n return result;\n }\n }\n\n // Named colors are currently not supported due to the large addition to the xterm.js bundle size\n // they would add. In order to support named colors, we would need some way of optionally loading\n // additional payloads so startup/download time is not bloated (see #3530).\n}\n\n// pad hex output to requested bit width\nfunction pad(n: number, bits: number): string {\n const s = n.toString(16);\n const s2 = s.length < 2 ? '0' + s : s;\n switch (bits) {\n case 4:\n return s[0];\n case 8:\n return s2;\n case 12:\n return (s2 + s2).slice(0, 3);\n default:\n return s2 + s2;\n }\n}\n\n/**\n * Convert a given color to rgb:../../.. string of `bits` depth.\n */\nexport function toRgbString(color: [number, number, number], bits: number = 16): string {\n const [r, g, b] = color;\n return `rgb:${pad(r, bits)}/${pad(g, bits)}/${pad(b, bits)}`;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Internal states of EscapeSequenceParser.\n */\nexport const enum ParserState {\n GROUND = 0,\n ESCAPE = 1,\n ESCAPE_INTERMEDIATE = 2,\n CSI_ENTRY = 3,\n CSI_PARAM = 4,\n CSI_INTERMEDIATE = 5,\n CSI_IGNORE = 6,\n SOS_PM_APC_STRING = 7,\n OSC_STRING = 8,\n DCS_ENTRY = 9,\n DCS_PARAM = 10,\n DCS_IGNORE = 11,\n DCS_INTERMEDIATE = 12,\n DCS_PASSTHROUGH = 13\n}\n\n/**\n * Internal actions of EscapeSequenceParser.\n */\nexport const enum ParserAction {\n IGNORE = 0,\n ERROR = 1,\n PRINT = 2,\n EXECUTE = 3,\n OSC_START = 4,\n OSC_PUT = 5,\n OSC_END = 6,\n CSI_DISPATCH = 7,\n PARAM = 8,\n COLLECT = 9,\n ESC_DISPATCH = 10,\n CLEAR = 11,\n DCS_HOOK = 12,\n DCS_PUT = 13,\n DCS_UNHOOK = 14\n}\n\n/**\n * Internal states of OscParser.\n */\nexport const enum OscState {\n START = 0,\n ID = 1,\n PAYLOAD = 2,\n ABORT = 3\n}\n\n// payload limit for OSC and DCS\nexport const PAYLOAD_LIMIT = 10000000;\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { Params } from 'common/parser/Params';\nimport { PAYLOAD_LIMIT } from 'common/parser/Constants';\n\nconst EMPTY_HANDLERS: IDcsHandler[] = [];\n\nexport class DcsParser implements IDcsParser {\n private _handlers: IHandlerCollection = Object.create(null);\n private _active: IDcsHandler[] = EMPTY_HANDLERS;\n private _ident: number = 0;\n private _handlerFb: DcsFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public registerHandler(ident: number, handler: IDcsHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public reset(): void {\n // force cleanup leftover handlers\n if (this._active.length) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].unhook(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n\n public hook(ident: number, params: IParams): void {\n // always reset leftover handlers\n this.reset();\n this._ident = ident;\n this._active = this._handlers[ident] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._ident, 'HOOK', params);\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].hook(params);\n }\n }\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public unhook(success: boolean, promiseResult: boolean = true): void | Promise {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'UNHOOK', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers (fallThrough for async)\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n}\n\n// predefine empty params as [0] (ZDM)\nconst EMPTY_PARAMS = new Params();\nEMPTY_PARAMS.addParam(0);\n\n/**\n * Convenient class to create a DCS handler from a single callback function.\n * Note: The payload is currently limited to 50 MB (hardcoded).\n */\nexport class DcsHandler implements IDcsHandler {\n private _data = '';\n private _params: IParams = EMPTY_PARAMS;\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string, params: IParams) => boolean | Promise) { }\n\n public hook(params: IParams): void {\n // since we need to preserve params until `unhook`, we have to clone it\n // (only borrowed from parser and spans multiple parser states)\n // perf optimization:\n // clone only, if we have non empty params, otherwise stick with default\n this._params = (params.length > 1 || params.params[0]) ? params.clone() : EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public unhook(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data, this._params);\n if (ret instanceof Promise) {\n // need to hold data and params until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType } from 'common/parser/Types';\nimport { ParserState, ParserAction } from 'common/parser/Constants';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { Params } from 'common/parser/Params';\nimport { OscParser } from 'common/parser/OscParser';\nimport { DcsParser } from 'common/parser/DcsParser';\n\n/**\n * Table values are generated like this:\n * index: currentState << TableValue.INDEX_STATE_SHIFT | charCode\n * value: action << TableValue.TRANSITION_ACTION_SHIFT | nextState\n */\nconst enum TableAccess {\n TRANSITION_ACTION_SHIFT = 4,\n TRANSITION_STATE_MASK = 15,\n INDEX_STATE_SHIFT = 8\n}\n\n/**\n * Transition table for EscapeSequenceParser.\n */\nexport class TransitionTable {\n public table: Uint8Array;\n\n constructor(length: number) {\n this.table = new Uint8Array(length);\n }\n\n /**\n * Set default transition.\n * @param action default action\n * @param next default next state\n */\n public setDefault(action: ParserAction, next: ParserState): void {\n this.table.fill(action << TableAccess.TRANSITION_ACTION_SHIFT | next);\n }\n\n /**\n * Add a transition to the transition table.\n * @param code input character code\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public add(code: number, state: ParserState, action: ParserAction, next: ParserState): void {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | code] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n\n /**\n * Add transitions for multiple input character codes.\n * @param codes input character code array\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public addMany(codes: number[], state: ParserState, action: ParserAction, next: ParserState): void {\n for (let i = 0; i < codes.length; i++) {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | codes[i]] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n }\n}\n\n\n// Pseudo-character placeholder for printable non-ascii characters (unicode).\nconst NON_ASCII_PRINTABLE = 0xA0;\n\n\n/**\n * VT500 compatible transition table.\n * Taken from https://vt100.net/emu/dec_ansi_parser.\n */\nexport const VT500_TRANSITION_TABLE = (function (): TransitionTable {\n const table: TransitionTable = new TransitionTable(4095);\n\n // range macro for byte\n const BYTE_VALUES = 256;\n const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);\n const r = (start: number, end: number): number[] => blueprint.slice(start, end);\n\n // Default definitions.\n const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded\n const EXECUTABLES = r(0x00, 0x18);\n EXECUTABLES.push(0x19);\n EXECUTABLES.push.apply(EXECUTABLES, r(0x1c, 0x20));\n\n const states: number[] = r(ParserState.GROUND, ParserState.DCS_PASSTHROUGH + 1);\n let state: any;\n\n // set default transition\n table.setDefault(ParserAction.ERROR, ParserState.GROUND);\n // printables\n table.addMany(PRINTABLES, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n // global anywhere rules\n for (state in states) {\n table.addMany([0x18, 0x1a, 0x99, 0x9a], state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x80, 0x90), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x90, 0x98), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.add(0x9c, state, ParserAction.IGNORE, ParserState.GROUND); // ST as terminator\n table.add(0x1b, state, ParserAction.CLEAR, ParserState.ESCAPE); // ESC\n table.add(0x9d, state, ParserAction.OSC_START, ParserState.OSC_STRING); // OSC\n table.addMany([0x98, 0x9e, 0x9f], state, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9b, state, ParserAction.CLEAR, ParserState.CSI_ENTRY); // CSI\n table.add(0x90, state, ParserAction.CLEAR, ParserState.DCS_ENTRY); // DCS\n }\n // rules for executables and 7f\n table.addMany(EXECUTABLES, ParserState.GROUND, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(EXECUTABLES, ParserState.ESCAPE, ParserAction.EXECUTE, ParserState.ESCAPE);\n table.add(0x7f, ParserState.ESCAPE, ParserAction.IGNORE, ParserState.ESCAPE);\n table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n table.addMany(EXECUTABLES, ParserState.CSI_ENTRY, ParserAction.EXECUTE, ParserState.CSI_ENTRY);\n table.add(0x7f, ParserState.CSI_ENTRY, ParserAction.IGNORE, ParserState.CSI_ENTRY);\n table.addMany(EXECUTABLES, ParserState.CSI_PARAM, ParserAction.EXECUTE, ParserState.CSI_PARAM);\n table.add(0x7f, ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_PARAM);\n table.addMany(EXECUTABLES, ParserState.CSI_IGNORE, ParserAction.EXECUTE, ParserState.CSI_IGNORE);\n table.addMany(EXECUTABLES, ParserState.CSI_INTERMEDIATE, ParserAction.EXECUTE, ParserState.CSI_INTERMEDIATE);\n table.add(0x7f, ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.ESCAPE_INTERMEDIATE, ParserAction.EXECUTE, ParserState.ESCAPE_INTERMEDIATE);\n table.add(0x7f, ParserState.ESCAPE_INTERMEDIATE, ParserAction.IGNORE, ParserState.ESCAPE_INTERMEDIATE);\n // osc\n table.add(0x5d, ParserState.ESCAPE, ParserAction.OSC_START, ParserState.OSC_STRING);\n table.addMany(PRINTABLES, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(0x7f, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.addMany([0x9c, 0x1b, 0x18, 0x1a, 0x07], ParserState.OSC_STRING, ParserAction.OSC_END, ParserState.GROUND);\n table.addMany(r(0x1c, 0x20), ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n // sos/pm/apc does nothing\n table.addMany([0x58, 0x5e, 0x5f], ParserState.ESCAPE, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(PRINTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(EXECUTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9c, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.GROUND);\n table.add(0x7f, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n // csi entries\n table.add(0x5b, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.CSI_ENTRY);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_ENTRY, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_ENTRY, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_PARAM, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_PARAM, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x20, 0x40), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(0x7f, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.CSI_INTERMEDIATE, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_INTERMEDIATE, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_PARAM, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n // esc_intermediate\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE_INTERMEDIATE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x30, 0x7f), ParserState.ESCAPE_INTERMEDIATE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x50), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x51, 0x58), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany([0x59, 0x5a, 0x5c], ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x60, 0x7f), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n // dcs entry\n table.add(0x50, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.DCS_ENTRY);\n table.addMany(EXECUTABLES, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.add(0x7f, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x20, 0x30), ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_ENTRY, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_PARAM);\n table.addMany(EXECUTABLES, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x80), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(EXECUTABLES, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.add(0x7f, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_PARAM, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_PARAM, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.add(0x7f, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_INTERMEDIATE, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_INTERMEDIATE, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_PARAM, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_ENTRY, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(EXECUTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.addMany(PRINTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(0x7f, ParserState.DCS_PASSTHROUGH, ParserAction.IGNORE, ParserState.DCS_PASSTHROUGH);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.DCS_PASSTHROUGH, ParserAction.DCS_UNHOOK, ParserState.GROUND);\n // special handling of unicode chars\n table.add(NON_ASCII_PRINTABLE, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n table.add(NON_ASCII_PRINTABLE, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(NON_ASCII_PRINTABLE, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n return table;\n})();\n\n\n/**\n * EscapeSequenceParser.\n * This class implements the ANSI/DEC compatible parser described by\n * Paul Williams (https://vt100.net/emu/dec_ansi_parser).\n *\n * To implement custom ANSI compliant escape sequences it is not needed to\n * alter this parser, instead consider registering a custom handler.\n * For non ANSI compliant sequences change the transition table with\n * the optional `transitions` constructor argument and\n * reimplement the `parse` method.\n *\n * This parser is currently hardcoded to operate in ZDM (Zero Default Mode)\n * as suggested by the original parser, thus empty parameters are set to 0.\n * This this is not in line with the latest ECMA-48 specification\n * (ZDM was part of the early specs and got completely removed later on).\n *\n * Other than the original parser from vt100.net this parser supports\n * sub parameters in digital parameters separated by colons. Empty sub parameters\n * are set to -1 (no ZDM for sub parameters).\n *\n * About prefix and intermediate bytes:\n * This parser follows the assumptions of the vt100.net parser with these restrictions:\n * - only one prefix byte is allowed as first parameter byte, byte range 0x3c .. 0x3f\n * - max. two intermediates are respected, byte range 0x20 .. 0x2f\n * Note that this is not in line with ECMA-48 which does not limit either of those.\n * Furthermore ECMA-48 allows the prefix byte range at any param byte position. Currently\n * there are no known sequences that follow the broader definition of the specification.\n *\n * TODO: implement error recovery hook via error handler return values\n */\nexport class EscapeSequenceParser extends Disposable implements IEscapeSequenceParser {\n public initialState: number;\n public currentState: number;\n public precedingJoinState: number; // UnicodeJoinProperties\n\n // buffers over several parse calls\n protected _params: Params;\n protected _collect: number;\n\n // handler lookup containers\n protected _printHandler: PrintHandlerType;\n protected _executeHandlers: { [flag: number]: ExecuteHandlerType };\n protected _csiHandlers: IHandlerCollection;\n protected _escHandlers: IHandlerCollection;\n protected readonly _oscParser: IOscParser;\n protected readonly _dcsParser: IDcsParser;\n protected _errorHandler: (state: IParsingState) => IParsingState;\n\n // fallback handlers\n protected _printHandlerFb: PrintFallbackHandlerType;\n protected _executeHandlerFb: ExecuteFallbackHandlerType;\n protected _csiHandlerFb: CsiFallbackHandlerType;\n protected _escHandlerFb: EscFallbackHandlerType;\n protected _errorHandlerFb: (state: IParsingState) => IParsingState;\n\n // parser stack save for async handler support\n protected _parseStack: IParserStackState = {\n state: ParserStackType.NONE,\n handlers: [],\n handlerPos: 0,\n transition: 0,\n chunkPos: 0\n };\n\n constructor(\n protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE\n ) {\n super();\n\n this.initialState = ParserState.GROUND;\n this.currentState = this.initialState;\n this._params = new Params(); // defaults to 32 storable params/subparams\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n\n // set default fallback handlers and handler lookup containers\n this._printHandlerFb = (data, start, end): void => { };\n this._executeHandlerFb = (code: number): void => { };\n this._csiHandlerFb = (ident: number, params: IParams): void => { };\n this._escHandlerFb = (ident: number): void => { };\n this._errorHandlerFb = (state: IParsingState): IParsingState => state;\n this._printHandler = this._printHandlerFb;\n this._executeHandlers = Object.create(null);\n this._csiHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n this._register(toDisposable(() => {\n this._csiHandlers = Object.create(null);\n this._executeHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n }));\n this._oscParser = this._register(new OscParser());\n this._dcsParser = this._register(new DcsParser());\n this._errorHandler = this._errorHandlerFb;\n\n // swallow 7bit ST (ESC+\\)\n this.registerEscHandler({ final: '\\\\' }, () => true);\n }\n\n protected _identifier(id: IFunctionIdentifier, finalRange: number[] = [0x40, 0x7e]): number {\n let res = 0;\n if (id.prefix) {\n if (id.prefix.length > 1) {\n throw new Error('only one byte as prefix supported');\n }\n res = id.prefix.charCodeAt(0);\n if (res && 0x3c > res || res > 0x3f) {\n throw new Error('prefix must be in range 0x3c .. 0x3f');\n }\n }\n if (id.intermediates) {\n if (id.intermediates.length > 2) {\n throw new Error('only two bytes as intermediates are supported');\n }\n for (let i = 0; i < id.intermediates.length; ++i) {\n const intermediate = id.intermediates.charCodeAt(i);\n if (0x20 > intermediate || intermediate > 0x2f) {\n throw new Error('intermediate must be in range 0x20 .. 0x2f');\n }\n res <<= 8;\n res |= intermediate;\n }\n }\n if (id.final.length !== 1) {\n throw new Error('final must be a single byte');\n }\n const finalCode = id.final.charCodeAt(0);\n if (finalRange[0] > finalCode || finalCode > finalRange[1]) {\n throw new Error(`final must be in range ${finalRange[0]} .. ${finalRange[1]}`);\n }\n res <<= 8;\n res |= finalCode;\n\n return res;\n }\n\n public identToString(ident: number): string {\n const res: string[] = [];\n while (ident) {\n res.push(String.fromCharCode(ident & 0xFF));\n ident >>= 8;\n }\n return res.reverse().join('');\n }\n\n public setPrintHandler(handler: PrintHandlerType): void {\n this._printHandler = handler;\n }\n public clearPrintHandler(): void {\n this._printHandler = this._printHandlerFb;\n }\n\n public registerEscHandler(id: IFunctionIdentifier, handler: EscHandlerType): IDisposable {\n const ident = this._identifier(id, [0x30, 0x7e]);\n if (this._escHandlers[ident] === undefined) {\n this._escHandlers[ident] = [];\n }\n const handlerList = this._escHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearEscHandler(id: IFunctionIdentifier): void {\n if (this._escHandlers[this._identifier(id, [0x30, 0x7e])]) delete this._escHandlers[this._identifier(id, [0x30, 0x7e])];\n }\n public setEscHandlerFallback(handler: EscFallbackHandlerType): void {\n this._escHandlerFb = handler;\n }\n\n public setExecuteHandler(flag: string, handler: ExecuteHandlerType): void {\n this._executeHandlers[flag.charCodeAt(0)] = handler;\n }\n public clearExecuteHandler(flag: string): void {\n if (this._executeHandlers[flag.charCodeAt(0)]) delete this._executeHandlers[flag.charCodeAt(0)];\n }\n public setExecuteHandlerFallback(handler: ExecuteFallbackHandlerType): void {\n this._executeHandlerFb = handler;\n }\n\n public registerCsiHandler(id: IFunctionIdentifier, handler: CsiHandlerType): IDisposable {\n const ident = this._identifier(id);\n if (this._csiHandlers[ident] === undefined) {\n this._csiHandlers[ident] = [];\n }\n const handlerList = this._csiHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearCsiHandler(id: IFunctionIdentifier): void {\n if (this._csiHandlers[this._identifier(id)]) delete this._csiHandlers[this._identifier(id)];\n }\n public setCsiHandlerFallback(callback: (ident: number, params: IParams) => void): void {\n this._csiHandlerFb = callback;\n }\n\n public registerDcsHandler(id: IFunctionIdentifier, handler: IDcsHandler): IDisposable {\n return this._dcsParser.registerHandler(this._identifier(id), handler);\n }\n public clearDcsHandler(id: IFunctionIdentifier): void {\n this._dcsParser.clearHandler(this._identifier(id));\n }\n public setDcsHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._dcsParser.setHandlerFallback(handler);\n }\n\n public registerOscHandler(ident: number, handler: IOscHandler): IDisposable {\n return this._oscParser.registerHandler(ident, handler);\n }\n public clearOscHandler(ident: number): void {\n this._oscParser.clearHandler(ident);\n }\n public setOscHandlerFallback(handler: OscFallbackHandlerType): void {\n this._oscParser.setHandlerFallback(handler);\n }\n\n public setErrorHandler(callback: (state: IParsingState) => IParsingState): void {\n this._errorHandler = callback;\n }\n public clearErrorHandler(): void {\n this._errorHandler = this._errorHandlerFb;\n }\n\n /**\n * Reset parser to initial values.\n *\n * This can also be used to lift the improper continuation error condition\n * when dealing with async handlers. Use this only as a last resort to silence\n * that error when the terminal has no pending data to be processed. Note that\n * the interrupted async handler might continue its work in the future messing\n * up the terminal state even further.\n */\n public reset(): void {\n this.currentState = this.initialState;\n this._oscParser.reset();\n this._dcsParser.reset();\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n // abort pending continuation from async handler\n // Here the RESET type indicates, that the next parse call will\n // ignore any saved stack, instead continues sync with next codepoint from GROUND\n if (this._parseStack.state !== ParserStackType.NONE) {\n this._parseStack.state = ParserStackType.RESET;\n this._parseStack.handlers = []; // also release handlers ref\n }\n }\n\n /**\n * Async parse support.\n */\n protected _preserveStack(\n state: ParserStackType,\n handlers: ResumableHandlersType,\n handlerPos: number,\n transition: number,\n chunkPos: number\n ): void {\n this._parseStack.state = state;\n this._parseStack.handlers = handlers;\n this._parseStack.handlerPos = handlerPos;\n this._parseStack.transition = transition;\n this._parseStack.chunkPos = chunkPos;\n }\n\n /**\n * Parse UTF32 codepoints in `data` up to `length`.\n *\n * Note: For several actions with high data load the parsing is optimized\n * by using local read ahead loops with hardcoded conditions to\n * avoid costly table lookups. Make sure that any change of table values\n * will be reflected in the loop conditions as well and vice versa.\n * Affected states/actions:\n * - GROUND:PRINT\n * - CSI_PARAM:PARAM\n * - DCS_PARAM:PARAM\n * - OSC_STRING:OSC_PUT\n * - DCS_PASSTHROUGH:DCS_PUT\n *\n * Note on asynchronous handler support:\n * Any handler returning a promise will be treated as asynchronous.\n * To keep the in-band blocking working for async handlers, `parse` pauses execution,\n * creates a stack save and returns the promise to the caller.\n * For proper continuation of the paused state it is important\n * to await the promise resolving. On resolve the parse must be repeated\n * with the same chunk of data and the resolved value in `promiseResult`\n * until no promise is returned.\n *\n * Important: With only sync handlers defined, parsing is completely synchronous as well.\n * As soon as an async handler is involved, synchronous parsing is not possible anymore.\n *\n * Boilerplate for proper parsing of multiple chunks with async handlers:\n *\n * ```typescript\n * async function parseMultipleChunks(chunks: Uint32Array[]): Promise {\n * for (const chunk of chunks) {\n * let result: void | Promise;\n * let prev: boolean | undefined;\n * while (result = parser.parse(chunk, chunk.length, prev)) {\n * prev = await result;\n * }\n * }\n * // finished parsing all chunks...\n * }\n * ```\n */\n public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise {\n let code = 0;\n let transition = 0;\n let start = 0;\n let handlerResult: void | boolean | Promise;\n\n // resume from async handler\n if (this._parseStack.state) {\n // allow sync parser reset even in continuation mode\n // Note: can be used to recover parser from improper continuation error below\n if (this._parseStack.state === ParserStackType.RESET) {\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1; // continue with next codepoint in GROUND\n } else {\n if (promiseResult === undefined || this._parseStack.state === ParserStackType.FAIL) {\n /**\n * Reject further parsing on improper continuation after pausing. This is a really bad\n * condition with screwed up execution order and prolly messed up terminal state,\n * therefore we exit hard with an exception and reject any further parsing.\n *\n * Note: With `Terminal.write` usage this exception should never occur, as the top level\n * calls are guaranteed to handle async conditions properly. If you ever encounter this\n * exception in your terminal integration it indicates, that you injected data chunks to\n * `InputHandler.parse` or `EscapeSequenceParser.parse` synchronously without waiting for\n * continuation of a running async handler.\n *\n * It is possible to get rid of this error by calling `reset`. But dont rely on that, as\n * the pending async handler still might mess up the terminal later. Instead fix the\n * faulty async handling, so this error will not be thrown anymore.\n */\n this._parseStack.state = ParserStackType.FAIL;\n throw new Error('improper continuation due to previous async handler, giving up parsing');\n }\n\n // we have to resume the old handler loop if:\n // - return value of the promise was `false`\n // - handlers are not exhausted yet\n const handlers = this._parseStack.handlers;\n let handlerPos = this._parseStack.handlerPos - 1;\n switch (this._parseStack.state) {\n case ParserStackType.CSI:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as CsiHandlerType[])[handlerPos](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.ESC:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as EscHandlerType[])[handlerPos]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.DCS:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserStackType.OSC:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n }\n // cleanup before continuing with the main sync loop\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1;\n this.precedingJoinState = 0;\n this.currentState = this._parseStack.transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n\n // continue with main sync loop\n\n // process input string\n for (let i = start; i < length; ++i) {\n code = data[i];\n\n // normal transition & action lookup\n transition = this._transitions.table[this.currentState << TableAccess.INDEX_STATE_SHIFT | (code < 0xa0 ? code : NON_ASCII_PRINTABLE)];\n switch (transition >> TableAccess.TRANSITION_ACTION_SHIFT) {\n case ParserAction.PRINT:\n // read ahead with loop unrolling\n // Note: 0x20 (SP) is included, 0x7F (DEL) is excluded\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.EXECUTE:\n if (this._executeHandlers[code]) this._executeHandlers[code]();\n else this._executeHandlerFb(code);\n this.precedingJoinState = 0;\n break;\n case ParserAction.IGNORE:\n break;\n case ParserAction.ERROR:\n const inject: IParsingState = this._errorHandler(\n {\n position: i,\n code,\n currentState: this.currentState,\n collect: this._collect,\n params: this._params,\n abort: false\n });\n if (inject.abort) return;\n // inject values: currently not implemented\n break;\n case ParserAction.CSI_DISPATCH:\n // Trigger CSI Handler\n const handlers = this._csiHandlers[this._collect << 8 | code];\n let j = handlers ? handlers.length - 1 : -1;\n for (; j >= 0; j--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlers[j](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.CSI, handlers, j, transition, i);\n return handlerResult;\n }\n }\n if (j < 0) {\n this._csiHandlerFb(this._collect << 8 | code, this._params);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.PARAM:\n // inner loop: digits (0x30 - 0x39) and ; (0x3b) and : (0x3a)\n do {\n switch (code) {\n case 0x3b:\n this._params.addParam(0); // ZDM\n break;\n case 0x3a:\n this._params.addSubParam(-1);\n break;\n default: // 0x30 - 0x39\n this._params.addDigit(code - 48);\n }\n } while (++i < length && (code = data[i]) > 0x2f && code < 0x3c);\n i--;\n break;\n case ParserAction.COLLECT:\n this._collect <<= 8;\n this._collect |= code;\n break;\n case ParserAction.ESC_DISPATCH:\n const handlersEsc = this._escHandlers[this._collect << 8 | code];\n let jj = handlersEsc ? handlersEsc.length - 1 : -1;\n for (; jj >= 0; jj--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlersEsc[jj]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.ESC, handlersEsc, jj, transition, i);\n return handlerResult;\n }\n }\n if (jj < 0) {\n this._escHandlerFb(this._collect << 8 | code);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.CLEAR:\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserAction.DCS_HOOK:\n this._dcsParser.hook(this._collect << 8 | code, this._params);\n break;\n case ParserAction.DCS_PUT:\n // inner loop - exit DCS_PUT: 0x18, 0x1a, 0x1b, 0x7f, 0x80 - 0x9f\n // unhook triggered by: 0x1b, 0x9c (success) and 0x18, 0x1a (abort)\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._dcsParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.DCS_UNHOOK:\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.DCS, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n case ParserAction.OSC_START:\n this._oscParser.start();\n break;\n case ParserAction.OSC_PUT:\n // inner loop: 0x20 (SP) included, 0x7F (DEL) included\n for (let j = i + 1; ; j++) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._oscParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.OSC_END:\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.OSC, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n }\n this.currentState = transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';\nimport { OscState, PAYLOAD_LIMIT } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IOscHandler[] = [];\n\nexport class OscParser implements IOscParser {\n private _state = OscState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: OscFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public registerHandler(ident: number, handler: IOscHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n public setHandlerFallback(handler: OscFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // force cleanup handlers if payload was already sent\n if (this._state === OscState.PAYLOAD) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].end(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = OscState.ID;\n }\n\n /**\n * Put data to current OSC command.\n * Expects the identifier of the OSC command in the form\n * OSC id ; payload ST/BEL\n * Payload chunks are not further processed and get\n * directly passed to the handlers.\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === OscState.ABORT) {\n return;\n }\n if (this._state === OscState.ID) {\n while (start < end) {\n const code = data[start++];\n if (code === 0x3b) {\n this._state = OscState.PAYLOAD;\n this._start();\n break;\n }\n if (code < 0x30 || 0x39 < code) {\n this._state = OscState.ABORT;\n return;\n }\n if (this._id === -1) {\n this._id = 0;\n }\n this._id = this._id * 10 + code - 48;\n }\n }\n if (this._state === OscState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an OSC command.\n * Whether the OSC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean, promiseResult: boolean = true): void | Promise {\n if (this._state === OscState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== OscState.ABORT) {\n // if we are still in ID state and get an early end\n // means that the command has no payload thus we still have\n // to announce START and send END right after\n if (this._state === OscState.ID) {\n this._start();\n }\n\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers\n // we always have to call .end for proper cleanup,\n // here we use `success` to indicate whether a handler should execute\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as OSC handlers.\n */\nexport class OscHandler implements IOscHandler {\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean | Promise) { }\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n if (ret instanceof Promise) {\n // need to hold data until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IParams, ParamsArray } from 'common/parser/Types';\n\n// max value supported for a single param/subparam (clamped to positive int32 range)\nconst MAX_VALUE = 0x7FFFFFFF;\n// max allowed subparams for a single sequence (hardcoded limitation)\nconst MAX_SUBPARAMS = 256;\n\n/**\n * Params storage class.\n * This type is used by the parser to accumulate sequence parameters and sub parameters\n * and transmit them to the input handler actions.\n *\n * NOTES:\n * - params object for action handlers is borrowed, use `.toArray` or `.clone` to get a copy\n * - never read beyond `params.length - 1` (likely to contain arbitrary data)\n * - `.getSubParams` returns a borrowed typed array, use `.getSubParamsAll` for cloned sub params\n * - hardcoded limitations:\n * - max. value for a single (sub) param is 2^31 - 1 (greater values are clamped to that)\n * - max. 256 sub params possible\n * - negative values are not allowed beside -1 (placeholder for default value)\n *\n * About ZDM (Zero Default Mode):\n * ZDM is not orchestrated by this class. If the parser is in ZDM,\n * it should add 0 for empty params, otherwise -1. This does not apply\n * to subparams, empty subparams should always be added with -1.\n */\nexport class Params implements IParams {\n // params store and length\n public params: Int32Array;\n public length: number;\n\n // sub params store and length\n protected _subParams: Int32Array;\n protected _subParamsLength: number;\n\n // sub params offsets from param: param idx --> [start, end] offset\n private _subParamsIdx: Uint16Array;\n private _rejectDigits: boolean;\n private _rejectSubDigits: boolean;\n private _digitIsSub: boolean;\n\n /**\n * Create a `Params` type from JS array representation.\n */\n public static fromArray(values: ParamsArray): Params {\n const params = new Params();\n if (!values.length) {\n return params;\n }\n // skip leading sub params\n for (let i = (Array.isArray(values[0])) ? 1 : 0; i < values.length; ++i) {\n const value = values[i];\n if (Array.isArray(value)) {\n for (let k = 0; k < value.length; ++k) {\n params.addSubParam(value[k]);\n }\n } else {\n params.addParam(value);\n }\n }\n return params;\n }\n\n /**\n * @param maxLength max length of storable parameters\n * @param maxSubParamsLength max length of storable sub parameters\n */\n constructor(public maxLength: number = 32, public maxSubParamsLength: number = 32) {\n if (maxSubParamsLength > MAX_SUBPARAMS) {\n throw new Error('maxSubParamsLength must not be greater than 256');\n }\n this.params = new Int32Array(maxLength);\n this.length = 0;\n this._subParams = new Int32Array(maxSubParamsLength);\n this._subParamsLength = 0;\n this._subParamsIdx = new Uint16Array(maxLength);\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Clone object.\n */\n public clone(): Params {\n const newParams = new Params(this.maxLength, this.maxSubParamsLength);\n newParams.params.set(this.params);\n newParams.length = this.length;\n newParams._subParams.set(this._subParams);\n newParams._subParamsLength = this._subParamsLength;\n newParams._subParamsIdx.set(this._subParamsIdx);\n newParams._rejectDigits = this._rejectDigits;\n newParams._rejectSubDigits = this._rejectSubDigits;\n newParams._digitIsSub = this._digitIsSub;\n return newParams;\n }\n\n /**\n * Get a JS array representation of the current parameters and sub parameters.\n * The array is structured as follows:\n * sequence: \"1;2:3:4;5::6\"\n * array : [1, 2, [3, 4], 5, [-1, 6]]\n */\n public toArray(): ParamsArray {\n const res: ParamsArray = [];\n for (let i = 0; i < this.length; ++i) {\n res.push(this.params[i]);\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n res.push(Array.prototype.slice.call(this._subParams, start, end));\n }\n }\n return res;\n }\n\n /**\n * Reset to initial empty state.\n */\n public reset(): void {\n this.length = 0;\n this._subParamsLength = 0;\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Add a parameter value.\n * `Params` only stores up to `maxLength` parameters, any later\n * parameter will be ignored.\n * Note: VT devices only stored up to 16 values, xterm seems to\n * store up to 30.\n */\n public addParam(value: number): void {\n this._digitIsSub = false;\n if (this.length >= this.maxLength) {\n this._rejectDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;\n this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;\n }\n\n /**\n * Add a sub parameter value.\n * The sub parameter is automatically associated with the last parameter value.\n * Thus it is not possible to add a subparameter without any parameter added yet.\n * `Params` only stores up to `subParamsLength` sub parameters, any later\n * sub parameter will be ignored.\n */\n public addSubParam(value: number): void {\n this._digitIsSub = true;\n if (!this.length) {\n return;\n }\n if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength) {\n this._rejectSubDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;\n this._subParamsIdx[this.length - 1]++;\n }\n\n /**\n * Whether parameter at index `idx` has sub parameters.\n */\n public hasSubParams(idx: number): boolean {\n return ((this._subParamsIdx[idx] & 0xFF) - (this._subParamsIdx[idx] >> 8) > 0);\n }\n\n /**\n * Return sub parameters for parameter at index `idx`.\n * Note: The values are borrowed, thus you need to copy\n * the values if you need to hold them in nonlocal scope.\n */\n public getSubParams(idx: number): Int32Array | null {\n const start = this._subParamsIdx[idx] >> 8;\n const end = this._subParamsIdx[idx] & 0xFF;\n if (end - start > 0) {\n return this._subParams.subarray(start, end);\n }\n return null;\n }\n\n /**\n * Return all sub parameters as {idx: subparams} mapping.\n * Note: The values are not borrowed.\n */\n public getSubParamsAll(): {[idx: number]: Int32Array} {\n const result: {[idx: number]: Int32Array} = {};\n for (let i = 0; i < this.length; ++i) {\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n result[i] = this._subParams.slice(start, end);\n }\n }\n return result;\n }\n\n /**\n * Add a single digit value to current parameter.\n * This is used by the parser to account digits on a char by char basis.\n */\n public addDigit(value: number): void {\n let length;\n if (this._rejectDigits\n || !(length = this._digitIsSub ? this._subParamsLength : this.length)\n || (this._digitIsSub && this._rejectSubDigits)\n ) {\n return;\n }\n\n const store = this._digitIsSub ? this._subParams : this.params;\n const cur = store[length - 1];\n store[length - 1] = ~cur ? Math.min(cur * 10 + value, MAX_VALUE) : value;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminalAddon, IDisposable, Terminal } from '@xterm/xterm';\n\nexport interface ILoadedAddon {\n instance: ITerminalAddon;\n dispose: () => void;\n isDisposed: boolean;\n}\n\nexport class AddonManager implements IDisposable {\n protected _addons: ILoadedAddon[] = [];\n\n public dispose(): void {\n for (let i = this._addons.length - 1; i >= 0; i--) {\n this._addons[i].instance.dispose();\n }\n }\n\n public loadAddon(terminal: Terminal, instance: ITerminalAddon): void {\n const loadedAddon: ILoadedAddon = {\n instance,\n dispose: instance.dispose,\n isDisposed: false\n };\n this._addons.push(loadedAddon);\n instance.dispose = () => this._wrappedAddonDispose(loadedAddon);\n instance.activate(terminal as any);\n }\n\n private _wrappedAddonDispose(loadedAddon: ILoadedAddon): void {\n if (loadedAddon.isDisposed) {\n // Do nothing if already disposed\n return;\n }\n let index = -1;\n for (let i = 0; i < this._addons.length; i++) {\n if (this._addons[i] === loadedAddon) {\n index = i;\n break;\n }\n }\n if (index === -1) {\n throw new Error('Could not dispose an addon that has not been loaded');\n }\n loadedAddon.isDisposed = true;\n loadedAddon.dispose.apply(loadedAddon.instance);\n this._addons.splice(index, 1);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';\nimport { IBuffer } from 'common/buffer/Types';\nimport { BufferLineApiView } from 'common/public/BufferLineApiView';\nimport { CellData } from 'common/buffer/CellData';\n\nexport class BufferApiView implements IBufferApi {\n constructor(\n private _buffer: IBuffer,\n public readonly type: 'normal' | 'alternate'\n ) { }\n\n public init(buffer: IBuffer): BufferApiView {\n this._buffer = buffer;\n return this;\n }\n\n public get cursorY(): number { return this._buffer.y; }\n public get cursorX(): number { return this._buffer.x; }\n public get viewportY(): number { return this._buffer.ydisp; }\n public get baseY(): number { return this._buffer.ybase; }\n public get length(): number { return this._buffer.lines.length; }\n public getLine(y: number): IBufferLineApi | undefined {\n const line = this._buffer.lines.get(y);\n if (!line) {\n return undefined;\n }\n return new BufferLineApiView(line);\n }\n public getNullCell(): IBufferCellApi { return new CellData(); }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferLine, ICellData } from 'common/Types';\nimport { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';\n\nexport class BufferLineApiView implements IBufferLineApi {\n constructor(private _line: IBufferLine) { }\n\n public get isWrapped(): boolean { return this._line.isWrapped; }\n public get length(): number { return this._line.length; }\n public getCell(x: number, cell?: IBufferCellApi): IBufferCellApi | undefined {\n if (x < 0 || x >= this._line.length) {\n return undefined;\n }\n\n if (cell) {\n this._line.loadCell(x, cell as ICellData);\n return cell;\n }\n return this._line.loadCell(x, new CellData());\n }\n public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {\n return this._line.translateToString(trimRight, startColumn, endColumn);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';\nimport { BufferApiView } from 'common/public/BufferApiView';\nimport { ICoreTerminal } from 'common/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\nexport class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {\n private _normal: BufferApiView;\n private _alternate: BufferApiView;\n\n private readonly _onBufferChange = this._register(new Emitter());\n public readonly onBufferChange = this._onBufferChange.event;\n\n constructor(private _core: ICoreTerminal) {\n super();\n this._normal = new BufferApiView(this._core.buffers.normal, 'normal');\n this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');\n this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));\n }\n public get active(): IBufferApi {\n if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }\n if (this._core.buffers.active === this._core.buffers.alt) { return this.alternate; }\n throw new Error('Active buffer is neither normal nor alternate');\n }\n public get normal(): IBufferApi {\n return this._normal.init(this._core.buffers.normal);\n }\n public get alternate(): IBufferApi {\n return this._alternate.init(this._core.buffers.alt);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParams } from 'common/parser/Types';\nimport { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class ParserApi implements IParser {\n constructor(private _core: ICoreTerminal) { }\n\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n }\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerCsiHandler(id, callback);\n }\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerDcsHandler(id, (data: string, params: IParams) => callback(data, params.toArray()));\n }\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerDcsHandler(id, callback);\n }\n public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this._core.registerEscHandler(id, handler);\n }\n public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this.registerEscHandler(id, handler);\n }\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerOscHandler(ident, callback);\n }\n public addOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this.registerOscHandler(ident, callback);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreTerminal } from 'common/Types';\nimport { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';\n\nexport class UnicodeApi implements IUnicodeHandling {\n constructor(private _core: ICoreTerminal) { }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._core.unicodeService.register(provider);\n }\n\n public get versions(): string[] {\n return this._core.unicodeService.versions;\n }\n\n public get activeVersion(): string {\n return this._core.unicodeService.activeVersion;\n }\n\n public set activeVersion(version: string) {\n this._core.unicodeService.activeVersion = version;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IAttributeData, IBufferLine } from 'common/Types';\nimport { BufferSet } from 'common/buffer/BufferSet';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nexport const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars\nexport const MINIMUM_ROWS = 1;\n\nexport class BufferService extends Disposable implements IBufferService {\n public serviceBrand: any;\n\n public cols: number;\n public rows: number;\n public buffers: IBufferSet;\n /** Whether the user is scrolling (locks the scroll position) */\n public isUserScrolling: boolean = false;\n\n private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n\n public get buffer(): IBuffer { return this.buffers.active; }\n\n /** An IBufferline to clone/copy from for new blank lines */\n private _cachedBlankLine: IBufferLine | undefined;\n\n constructor(@IOptionsService optionsService: IOptionsService) {\n super();\n this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);\n this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);\n this.buffers = this._register(new BufferSet(optionsService, this));\n }\n\n public resize(cols: number, rows: number): void {\n this.cols = cols;\n this.rows = rows;\n this.buffers.resize(cols, rows);\n // TODO: This doesn't fire when scrollback changes - add a resize event to BufferSet and forward\n // event\n this._onResize.fire({ cols, rows });\n }\n\n public reset(): void {\n this.buffers.reset();\n this.isUserScrolling = false;\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n const buffer = this.buffer;\n\n let newLine: IBufferLine | undefined;\n newLine = this._cachedBlankLine;\n if (!newLine || newLine.length !== this.cols || newLine.getFg(0) !== eraseAttr.fg || newLine.getBg(0) !== eraseAttr.bg) {\n newLine = buffer.getBlankLine(eraseAttr, isWrapped);\n this._cachedBlankLine = newLine;\n }\n newLine.isWrapped = isWrapped;\n\n const topRow = buffer.ybase + buffer.scrollTop;\n const bottomRow = buffer.ybase + buffer.scrollBottom;\n\n if (buffer.scrollTop === 0) {\n // Determine whether the buffer is going to be trimmed after insertion.\n const willBufferBeTrimmed = buffer.lines.isFull;\n\n // Insert the line using the fastest method\n if (bottomRow === buffer.lines.length - 1) {\n if (willBufferBeTrimmed) {\n buffer.lines.recycle().copyFrom(newLine);\n } else {\n buffer.lines.push(newLine.clone());\n }\n } else {\n buffer.lines.splice(bottomRow + 1, 0, newLine.clone());\n }\n\n // Only adjust ybase and ydisp when the buffer is not trimmed\n if (!willBufferBeTrimmed) {\n buffer.ybase++;\n // Only scroll the ydisp with ybase if the user has not scrolled up\n if (!this.isUserScrolling) {\n buffer.ydisp++;\n }\n } else {\n // When the buffer is full and the user has scrolled up, keep the text\n // stable unless ydisp is right at the top\n if (this.isUserScrolling) {\n buffer.ydisp = Math.max(buffer.ydisp - 1, 0);\n }\n }\n } else {\n // scrollTop is non-zero which means no line will be going to the\n // scrollback, instead we can just shift them in-place.\n const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;\n buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);\n buffer.lines.set(bottomRow, newLine.clone());\n }\n\n // Move the viewport to the bottom of the buffer unless the user is\n // scrolling.\n if (!this.isUserScrolling) {\n buffer.ydisp = buffer.ybase;\n }\n\n this._onScroll.fire(buffer.ydisp);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used\n * to avoid unwanted events being handled by the viewport when the event was triggered from the\n * viewport originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n const buffer = this.buffer;\n if (disp < 0) {\n if (buffer.ydisp === 0) {\n return;\n }\n this.isUserScrolling = true;\n } else if (disp + buffer.ydisp >= buffer.ybase) {\n this.isUserScrolling = false;\n }\n\n const oldYdisp = buffer.ydisp;\n buffer.ydisp = Math.max(Math.min(buffer.ydisp + disp, buffer.ybase), 0);\n\n // No change occurred, don't trigger scroll/refresh\n if (oldYdisp === buffer.ydisp) {\n return;\n }\n\n if (!suppressScrollEvent) {\n this._onScroll.fire(buffer.ydisp);\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharsetService } from 'common/services/Services';\nimport { ICharset } from 'common/Types';\n\nexport class CharsetService implements ICharsetService {\n public serviceBrand: any;\n\n public charset: ICharset | undefined;\n public glevel: number = 0;\n\n private _charsets: (ICharset | undefined)[] = [];\n\n public reset(): void {\n this.charset = undefined;\n this._charsets = [];\n this.glevel = 0;\n }\n\n public setgLevel(g: number): void {\n this.glevel = g;\n this.charset = this._charsets[g];\n }\n\n public setgCharset(g: number, charset: ICharset | undefined): void {\n this._charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';\nimport { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * Supported default protocols.\n */\nconst DEFAULT_PROTOCOLS: { [key: string]: ICoreMouseProtocol } = {\n /**\n * NONE\n * Events: none\n * Modifiers: none\n */\n NONE: {\n events: CoreMouseEventType.NONE,\n restrict: () => false\n },\n /**\n * X10\n * Events: mousedown\n * Modifiers: none\n */\n X10: {\n events: CoreMouseEventType.DOWN,\n restrict: (e: ICoreMouseEvent) => {\n // no wheel, no move, no up\n if (e.button === CoreMouseButton.WHEEL || e.action !== CoreMouseAction.DOWN) {\n return false;\n }\n // no modifiers\n e.ctrl = false;\n e.alt = false;\n e.shift = false;\n return true;\n }\n },\n /**\n * VT200\n * Events: mousedown / mouseup / wheel\n * Modifiers: all\n */\n VT200: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL,\n restrict: (e: ICoreMouseEvent) => {\n // no move\n if (e.action === CoreMouseAction.MOVE) {\n return false;\n }\n return true;\n }\n },\n /**\n * DRAG\n * Events: mousedown / mouseup / wheel / mousedrag\n * Modifiers: all\n */\n DRAG: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL | CoreMouseEventType.DRAG,\n restrict: (e: ICoreMouseEvent) => {\n // no move without button\n if (e.action === CoreMouseAction.MOVE && e.button === CoreMouseButton.NONE) {\n return false;\n }\n return true;\n }\n },\n /**\n * ANY\n * Events: all mouse related events\n * Modifiers: all\n */\n ANY: {\n events:\n CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL\n | CoreMouseEventType.DRAG | CoreMouseEventType.MOVE,\n restrict: (e: ICoreMouseEvent) => true\n }\n};\n\nconst enum Modifiers {\n SHIFT = 4,\n ALT = 8,\n CTRL = 16\n}\n\n// helper for default encoders to generate the event code.\nfunction eventCode(e: ICoreMouseEvent, isSGR: boolean): number {\n let code = (e.ctrl ? Modifiers.CTRL : 0) | (e.shift ? Modifiers.SHIFT : 0) | (e.alt ? Modifiers.ALT : 0);\n if (e.button === CoreMouseButton.WHEEL) {\n code |= 64;\n code |= e.action;\n } else {\n code |= e.button & 3;\n if (e.button & 4) {\n code |= 64;\n }\n if (e.button & 8) {\n code |= 128;\n }\n if (e.action === CoreMouseAction.MOVE) {\n code |= CoreMouseAction.MOVE;\n } else if (e.action === CoreMouseAction.UP && !isSGR) {\n // special case - only SGR can report button on release\n // all others have to go with NONE\n code |= CoreMouseButton.NONE;\n }\n }\n return code;\n}\n\nconst S = String.fromCharCode;\n\n/**\n * Supported default encodings.\n */\nconst DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {\n /**\n * DEFAULT - CSI M Pb Px Py\n * Single byte encoding for coords and event code.\n * Can encode values up to 223 (1-based).\n */\n DEFAULT: (e: ICoreMouseEvent) => {\n const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32];\n // supress mouse report if we exceed addressible range\n // Note this is handled differently by emulators\n // - xterm: sends 0;0 coords instead\n // - vte, konsole: no report\n if (params[0] > 255 || params[1] > 255 || params[2] > 255) {\n return '';\n }\n return `\\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`;\n },\n /**\n * SGR - CSI < Pb ; Px ; Py M|m\n * No encoding limitation.\n * Can report button on release and works with a well formed sequence.\n */\n SGR: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`;\n },\n SGR_PIXELS: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.x};${e.y}${final}`;\n }\n};\n\n/**\n * CoreMouseService\n *\n * Provides mouse tracking reports with different protocols and encodings.\n * - protocols: NONE (default), X10, VT200, DRAG, ANY\n * - encodings: DEFAULT, SGR (UTF8, URXVT removed in #2507)\n *\n * Custom protocols/encodings can be added by `addProtocol` / `addEncoding`.\n * To activate a protocol/encoding, set `activeProtocol` / `activeEncoding`.\n * Switching a protocol will send a notification event `onProtocolChange`\n * with a list of needed events to track.\n *\n * The service handles the mouse tracking state and decides whether to send\n * a tracking report to the backend based on protocol and encoding limitations.\n * To send a mouse event call `triggerMouseEvent`.\n */\nexport class CoreMouseService extends Disposable implements ICoreMouseService {\n public serviceBrand: any;\n\n private _protocols: { [name: string]: ICoreMouseProtocol } = {};\n private _encodings: { [name: string]: CoreMouseEncoding } = {};\n private _activeProtocol: string = '';\n private _activeEncoding: string = '';\n private _lastEvent: ICoreMouseEvent | null = null;\n\n private readonly _onProtocolChange = this._register(new Emitter());\n public readonly onProtocolChange = this._onProtocolChange.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService\n ) {\n super();\n // register default protocols and encodings\n for (const name of Object.keys(DEFAULT_PROTOCOLS)) this.addProtocol(name, DEFAULT_PROTOCOLS[name]);\n for (const name of Object.keys(DEFAULT_ENCODINGS)) this.addEncoding(name, DEFAULT_ENCODINGS[name]);\n // call reset to set defaults\n this.reset();\n }\n\n public addProtocol(name: string, protocol: ICoreMouseProtocol): void {\n this._protocols[name] = protocol;\n }\n\n public addEncoding(name: string, encoding: CoreMouseEncoding): void {\n this._encodings[name] = encoding;\n }\n\n public get activeProtocol(): string {\n return this._activeProtocol;\n }\n\n public get areMouseEventsActive(): boolean {\n return this._protocols[this._activeProtocol].events !== 0;\n }\n\n public set activeProtocol(name: string) {\n if (!this._protocols[name]) {\n throw new Error(`unknown protocol \"${name}\"`);\n }\n this._activeProtocol = name;\n this._onProtocolChange.fire(this._protocols[name].events);\n }\n\n public get activeEncoding(): string {\n return this._activeEncoding;\n }\n\n public set activeEncoding(name: string) {\n if (!this._encodings[name]) {\n throw new Error(`unknown encoding \"${name}\"`);\n }\n this._activeEncoding = name;\n }\n\n public reset(): void {\n this.activeProtocol = 'NONE';\n this.activeEncoding = 'DEFAULT';\n this._lastEvent = null;\n }\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n public triggerMouseEvent(e: ICoreMouseEvent): boolean {\n // range check for col/row\n if (e.col < 0 || e.col >= this._bufferService.cols\n || e.row < 0 || e.row >= this._bufferService.rows) {\n return false;\n }\n\n // filter nonsense combinations of button + action\n if (e.button === CoreMouseButton.WHEEL && e.action === CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button === CoreMouseButton.NONE && e.action !== CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button !== CoreMouseButton.WHEEL && (e.action === CoreMouseAction.LEFT || e.action === CoreMouseAction.RIGHT)) {\n return false;\n }\n\n // report 1-based coords\n e.col++;\n e.row++;\n\n // debounce move events at grid or pixel level\n if (e.action === CoreMouseAction.MOVE\n && this._lastEvent\n && this._equalEvents(this._lastEvent, e, this._activeEncoding === 'SGR_PIXELS')\n ) {\n return false;\n }\n\n // apply protocol restrictions\n if (!this._protocols[this._activeProtocol].restrict(e)) {\n return false;\n }\n\n // encode report and send\n const report = this._encodings[this._activeEncoding](e);\n if (report) {\n // always send DEFAULT as binary data\n if (this._activeEncoding === 'DEFAULT') {\n this._coreService.triggerBinaryEvent(report);\n } else {\n this._coreService.triggerDataEvent(report, true);\n }\n }\n\n this._lastEvent = e;\n\n return true;\n }\n\n public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {\n return {\n down: !!(events & CoreMouseEventType.DOWN),\n up: !!(events & CoreMouseEventType.UP),\n drag: !!(events & CoreMouseEventType.DRAG),\n move: !!(events & CoreMouseEventType.MOVE),\n wheel: !!(events & CoreMouseEventType.WHEEL)\n };\n }\n\n private _equalEvents(e1: ICoreMouseEvent, e2: ICoreMouseEvent, pixels: boolean): boolean {\n if (pixels) {\n if (e1.x !== e2.x) return false;\n if (e1.y !== e2.y) return false;\n } else {\n if (e1.col !== e2.col) return false;\n if (e1.row !== e2.row) return false;\n }\n if (e1.button !== e2.button) return false;\n if (e1.action !== e2.action) return false;\n if (e1.ctrl !== e2.ctrl) return false;\n if (e1.alt !== e2.alt) return false;\n if (e1.shift !== e2.shift) return false;\n return true;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { clone } from 'common/Clone';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IDecPrivateModes, IModes } from 'common/Types';\nimport { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nconst DEFAULT_MODES: IModes = Object.freeze({\n insertMode: false\n});\n\nconst DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({\n applicationCursorKeys: false,\n applicationKeypad: false,\n bracketedPasteMode: false,\n origin: false,\n reverseWraparound: false,\n sendFocus: false,\n wraparound: true // defaults: xterm - true, vt100 - false\n});\n\nexport class CoreService extends Disposable implements ICoreService {\n public serviceBrand: any;\n\n public isCursorInitialized: boolean = false;\n public isCursorHidden: boolean = false;\n public modes: IModes;\n public decPrivateModes: IDecPrivateModes;\n\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n private readonly _onUserInput = this._register(new Emitter());\n public readonly onUserInput = this._onUserInput.event;\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onRequestScrollToBottom = this._register(new Emitter());\n public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ILogService private readonly _logService: ILogService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public reset(): void {\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public triggerDataEvent(data: string, wasUserInput: boolean = false): void {\n // Prevents all events to pty process if stdin is disabled\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n\n // Input is being sent to the terminal, the terminal should focus the prompt.\n const buffer = this._bufferService.buffer;\n if (wasUserInput && this._optionsService.rawOptions.scrollOnUserInput && buffer.ybase !== buffer.ydisp) {\n this._onRequestScrollToBottom.fire();\n }\n\n // Fire onUserInput so listeners can react as well (eg. clear selection)\n if (wasUserInput) {\n this._onUserInput.fire();\n }\n\n // Fire onData API\n this._logService.debug(`sending data \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onData.fire(data);\n }\n\n public triggerBinaryEvent(data: string): void {\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n this._logService.debug(`sending binary \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onBinary.fire(data);\n }\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { css } from 'common/Color';\nimport { Disposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDecorationService, IInternalDecoration } from 'common/services/Services';\nimport { SortedList } from 'common/SortedList';\nimport { IColor } from 'common/Types';\nimport { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';\nimport { Emitter } from 'vs/base/common/event';\n\n// Work variables to avoid garbage collection\nlet $xmin = 0;\nlet $xmax = 0;\n\nexport class DecorationService extends Disposable implements IDecorationService {\n public serviceBrand: any;\n\n /**\n * A list of all decorations, sorted by the marker's line value. This relies on the fact that\n * while marker line values do change, they should all change by the same amount so this should\n * never become out of order.\n */\n private readonly _decorations: SortedList = new SortedList(e => e?.marker.line);\n\n private readonly _onDecorationRegistered = this._register(new Emitter());\n public readonly onDecorationRegistered = this._onDecorationRegistered.event;\n private readonly _onDecorationRemoved = this._register(new Emitter());\n public readonly onDecorationRemoved = this._onDecorationRemoved.event;\n\n public get decorations(): IterableIterator { return this._decorations.values(); }\n\n constructor() {\n super();\n\n this._register(toDisposable(() => this.reset()));\n }\n\n public registerDecoration(options: IDecorationOptions): IDecoration | undefined {\n if (options.marker.isDisposed) {\n return undefined;\n }\n const decoration = new Decoration(options);\n if (decoration) {\n const markerDispose = decoration.marker.onDispose(() => decoration.dispose());\n const listener = decoration.onDispose(() => {\n listener.dispose();\n if (decoration) {\n if (this._decorations.delete(decoration)) {\n this._onDecorationRemoved.fire(decoration);\n }\n markerDispose.dispose();\n }\n });\n this._decorations.insert(decoration);\n this._onDecorationRegistered.fire(decoration);\n }\n return decoration;\n }\n\n public reset(): void {\n for (const d of this._decorations.values()) {\n d.dispose();\n }\n this._decorations.clear();\n }\n\n public *getDecorationsAtCell(x: number, line: number, layer?: 'bottom' | 'top'): IterableIterator {\n let xmin = 0;\n let xmax = 0;\n for (const d of this._decorations.getKeyIterator(line)) {\n xmin = d.options.x ?? 0;\n xmax = xmin + (d.options.width ?? 1);\n if (x >= xmin && x < xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n yield d;\n }\n }\n }\n\n public forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void {\n this._decorations.forEachByKey(line, d => {\n $xmin = d.options.x ?? 0;\n $xmax = $xmin + (d.options.width ?? 1);\n if (x >= $xmin && x < $xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n callback(d);\n }\n });\n }\n}\n\nclass Decoration extends DisposableStore implements IInternalDecoration {\n public readonly marker: IMarker;\n public element: HTMLElement | undefined;\n\n public readonly onRenderEmitter = this.add(new Emitter());\n public readonly onRender = this.onRenderEmitter.event;\n private readonly _onDispose = this.add(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n private _cachedBg: IColor | undefined | null = null;\n public get backgroundColorRGB(): IColor | undefined {\n if (this._cachedBg === null) {\n if (this.options.backgroundColor) {\n this._cachedBg = css.toColor(this.options.backgroundColor);\n } else {\n this._cachedBg = undefined;\n }\n }\n return this._cachedBg;\n }\n\n private _cachedFg: IColor | undefined | null = null;\n public get foregroundColorRGB(): IColor | undefined {\n if (this._cachedFg === null) {\n if (this.options.foregroundColor) {\n this._cachedFg = css.toColor(this.options.foregroundColor);\n } else {\n this._cachedFg = undefined;\n }\n }\n return this._cachedFg;\n }\n\n constructor(\n public readonly options: IDecorationOptions\n ) {\n super();\n this.marker = options.marker;\n if (this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position) {\n this.options.overviewRulerOptions.position = 'full';\n }\n }\n\n public override dispose(): void {\n this._onDispose.fire();\n super.dispose();\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInstantiationService, IServiceIdentifier } from 'common/services/Services';\nimport { getServiceDependencies } from 'common/services/ServiceRegistry';\n\nexport class ServiceCollection {\n\n private _entries = new Map, any>();\n\n constructor(...entries: [IServiceIdentifier, any][]) {\n for (const [id, service] of entries) {\n this.set(id, service);\n }\n }\n\n public set(id: IServiceIdentifier, instance: T): T {\n const result = this._entries.get(id);\n this._entries.set(id, instance);\n return result;\n }\n\n public forEach(callback: (id: IServiceIdentifier, instance: any) => any): void {\n for (const [key, value] of this._entries.entries()) {\n callback(key, value);\n }\n }\n\n public has(id: IServiceIdentifier): boolean {\n return this._entries.has(id);\n }\n\n public get(id: IServiceIdentifier): T | undefined {\n return this._entries.get(id);\n }\n}\n\nexport class InstantiationService implements IInstantiationService {\n public serviceBrand: undefined;\n\n private readonly _services: ServiceCollection = new ServiceCollection();\n\n constructor() {\n this._services.set(IInstantiationService, this);\n }\n\n public setService(id: IServiceIdentifier, instance: T): void {\n this._services.set(id, instance);\n }\n\n public getService(id: IServiceIdentifier): T | undefined {\n return this._services.get(id);\n }\n\n public createInstance(ctor: any, ...args: any[]): T {\n const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);\n\n const serviceArgs: any[] = [];\n for (const dependency of serviceDependencies) {\n const service = this._services.get(dependency.id);\n if (!service) {\n throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`);\n }\n serviceArgs.push(service);\n }\n\n const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;\n\n // check for argument mismatches, adjust static args if needed\n if (args.length !== firstServiceArgPos) {\n throw new Error(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);\n }\n\n // now create the instance\n return new ctor(...[...args, ...serviceArgs]);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { ILogService, IOptionsService, LogLevelEnum } from 'common/services/Services';\n\ntype LogType = (message?: any, ...optionalParams: any[]) => void;\n\ninterface IConsole {\n log: LogType;\n error: LogType;\n info: LogType;\n trace: LogType;\n warn: LogType;\n}\n\n// console is available on both node.js and browser contexts but the common\n// module doesn't depend on them so we need to explicitly declare it.\ndeclare const console: IConsole;\n\nconst optionsKeyToLogLevel: { [key: string]: LogLevelEnum } = {\n trace: LogLevelEnum.TRACE,\n debug: LogLevelEnum.DEBUG,\n info: LogLevelEnum.INFO,\n warn: LogLevelEnum.WARN,\n error: LogLevelEnum.ERROR,\n off: LogLevelEnum.OFF\n};\n\nconst LOG_PREFIX = 'xterm.js: ';\n\nexport class LogService extends Disposable implements ILogService {\n public serviceBrand: any;\n\n private _logLevel: LogLevelEnum = LogLevelEnum.OFF;\n public get logLevel(): LogLevelEnum { return this._logLevel; }\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this._updateLogLevel();\n this._register(this._optionsService.onSpecificOptionChange('logLevel', () => this._updateLogLevel()));\n\n // For trace logging, assume the latest created log service is valid\n traceLogger = this;\n }\n\n private _updateLogLevel(): void {\n this._logLevel = optionsKeyToLogLevel[this._optionsService.rawOptions.logLevel];\n }\n\n private _evalLazyOptionalParams(optionalParams: any[]): void {\n for (let i = 0; i < optionalParams.length; i++) {\n if (typeof optionalParams[i] === 'function') {\n optionalParams[i] = optionalParams[i]();\n }\n }\n }\n\n private _log(type: LogType, message: string, optionalParams: any[]): void {\n this._evalLazyOptionalParams(optionalParams);\n type.call(console, (this._optionsService.options.logger ? '' : LOG_PREFIX) + message, ...optionalParams);\n }\n\n public trace(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.TRACE) {\n this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public debug(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.DEBUG) {\n this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public info(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.INFO) {\n this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, message, optionalParams);\n }\n }\n\n public warn(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.WARN) {\n this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, message, optionalParams);\n }\n }\n\n public error(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.ERROR) {\n this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, message, optionalParams);\n }\n }\n}\n\nlet traceLogger: ILogService;\nexport function setTraceLogger(logger: ILogService): void {\n traceLogger = logger;\n}\n\n/**\n * A decorator that can be used to automatically log trace calls to the decorated function.\n */\nexport function traceCall(_target: any, key: string, descriptor: any): any {\n if (typeof descriptor.value !== 'function') {\n throw new Error('not supported');\n }\n const fnKey = 'value';\n const fn = descriptor.value;\n descriptor[fnKey] = function (...args: any[]) {\n // Early exit\n if (traceLogger.logLevel !== LogLevelEnum.TRACE) {\n return fn.apply(this, args);\n }\n\n traceLogger.trace(`GlyphRenderer#${fn.name}(${args.map(e => JSON.stringify(e)).join(', ')})`);\n const result = fn.apply(this, args);\n traceLogger.trace(`GlyphRenderer#${fn.name} return`, result);\n return result;\n };\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { isMac } from 'common/Platform';\nimport { CursorStyle, IDisposable } from 'common/Types';\nimport { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nexport const DEFAULT_OPTIONS: Readonly> = {\n cols: 80,\n rows: 24,\n cursorBlink: false,\n cursorStyle: 'block',\n cursorWidth: 1,\n cursorInactiveStyle: 'outline',\n customGlyphs: true,\n drawBoldTextInBrightColors: true,\n documentOverride: null,\n fastScrollModifier: 'alt',\n fastScrollSensitivity: 5,\n fontFamily: 'courier-new, courier, monospace',\n fontSize: 15,\n fontWeight: 'normal',\n fontWeightBold: 'bold',\n ignoreBracketedPasteMode: false,\n lineHeight: 1.0,\n letterSpacing: 0,\n linkHandler: null,\n logLevel: 'info',\n logger: null,\n scrollback: 1000,\n scrollOnUserInput: true,\n scrollSensitivity: 1,\n screenReaderMode: false,\n smoothScrollDuration: 0,\n macOptionIsMeta: false,\n macOptionClickForcesSelection: false,\n minimumContrastRatio: 1,\n disableStdin: false,\n allowProposedApi: false,\n allowTransparency: false,\n tabStopWidth: 8,\n theme: {},\n rescaleOverlappingGlyphs: false,\n rightClickSelectsWord: isMac,\n windowOptions: {},\n windowsMode: false,\n windowsPty: {},\n wordSeparator: ' ()[]{}\\',\"`',\n altClickMovesCursor: true,\n convertEol: false,\n termName: 'xterm',\n cancelEvents: false,\n overviewRuler: {}\n};\n\nconst FONT_WEIGHT_OPTIONS: Extract[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\nexport class OptionsService extends Disposable implements IOptionsService {\n public serviceBrand: any;\n\n public readonly rawOptions: Required;\n public options: Required;\n\n private readonly _onOptionChange = this._register(new Emitter());\n public readonly onOptionChange = this._onOptionChange.event;\n\n constructor(options: Partial) {\n super();\n // set the default value of each option\n const defaultOptions = { ...DEFAULT_OPTIONS };\n for (const key in options) {\n if (key in defaultOptions) {\n try {\n const newValue = options[key];\n defaultOptions[key] = this._sanitizeAndValidateOption(key, newValue);\n } catch (e) {\n console.error(e);\n }\n }\n }\n\n // set up getters and setters for each option\n this.rawOptions = defaultOptions;\n this.options = { ... defaultOptions };\n this._setupOptions();\n\n // Clear out options that could link outside xterm.js as they could easily cause an embedder\n // memory leak\n this._register(toDisposable(() => {\n this.rawOptions.linkHandler = null;\n this.rawOptions.documentOverride = null;\n }));\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onSpecificOptionChange(key: T, listener: (value: ITerminalOptions[T]) => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (eventKey === key) {\n listener(this.rawOptions[key]);\n }\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (keys.indexOf(eventKey) !== -1) {\n listener();\n }\n });\n }\n\n private _setupOptions(): void {\n const getter = (propName: string): any => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n return this.rawOptions[propName];\n };\n\n const setter = (propName: string, value: any): void => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n\n value = this._sanitizeAndValidateOption(propName, value);\n // Don't fire an option change event if they didn't change\n if (this.rawOptions[propName] !== value) {\n this.rawOptions[propName] = value;\n this._onOptionChange.fire(propName);\n }\n };\n\n for (const propName in this.rawOptions) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this.options, propName, desc);\n }\n }\n\n private _sanitizeAndValidateOption(key: string, value: any): any {\n switch (key) {\n case 'cursorStyle':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n if (!isCursorStyle(value)) {\n throw new Error(`\"${value}\" is not a valid value for ${key}`);\n }\n break;\n case 'wordSeparator':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n break;\n case 'fontWeight':\n case 'fontWeightBold':\n if (typeof value === 'number' && 1 <= value && value <= 1000) {\n // already valid numeric value\n break;\n }\n value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];\n break;\n case 'cursorWidth':\n value = Math.floor(value);\n // Fall through for bounds check\n case 'lineHeight':\n case 'tabStopWidth':\n if (value < 1) {\n throw new Error(`${key} cannot be less than 1, value: ${value}`);\n }\n break;\n case 'minimumContrastRatio':\n value = Math.max(1, Math.min(21, Math.round(value * 10) / 10));\n break;\n case 'scrollback':\n value = Math.min(value, 4294967295);\n if (value < 0) {\n throw new Error(`${key} cannot be less than 0, value: ${value}`);\n }\n break;\n case 'fastScrollSensitivity':\n case 'scrollSensitivity':\n if (value <= 0) {\n throw new Error(`${key} cannot be less than or equal to 0, value: ${value}`);\n }\n break;\n case 'rows':\n case 'cols':\n if (!value && value !== 0) {\n throw new Error(`${key} must be numeric, value: ${value}`);\n }\n break;\n case 'windowsPty':\n value = value ?? {};\n break;\n }\n return value;\n }\n}\n\nfunction isCursorStyle(value: unknown): value is CursorStyle {\n return value === 'block' || value === 'underline' || value === 'bar';\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, IOscLinkService } from 'common/services/Services';\nimport { IMarker, IOscLinkData } from 'common/Types';\n\nexport class OscLinkService implements IOscLinkService {\n public serviceBrand: any;\n\n private _nextId = 1;\n\n /**\n * A map of the link key to link entry. This is used to add additional lines to links with ids.\n */\n private _entriesWithId: Map = new Map();\n\n /**\n * A map of the link id to the link entry. The \"link id\" (number) which is the numberic\n * representation of a unique link should not be confused with \"id\" (string) which comes in with\n * `id=` in the OSC link's properties.\n */\n private _dataByLinkId: Map = new Map();\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n }\n\n public registerLink(data: IOscLinkData): number {\n const buffer = this._bufferService.buffer;\n\n // Links with no id will only ever be registered a single time\n if (data.id === undefined) {\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryNoId = {\n data,\n id: this._nextId++,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n // Add the line to the link if it already exists\n const castData = data as Required;\n const key = this._getEntryIdKey(castData);\n const match = this._entriesWithId.get(key);\n if (match) {\n this.addLineToLink(match.id, buffer.ybase + buffer.y);\n return match.id;\n }\n\n // Create the link\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryWithId = {\n id: this._nextId++,\n key: this._getEntryIdKey(castData),\n data: castData,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._entriesWithId.set(entry.key, entry);\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n public addLineToLink(linkId: number, y: number): void {\n const entry = this._dataByLinkId.get(linkId);\n if (!entry) {\n return;\n }\n if (entry.lines.every(e => e.line !== y)) {\n const marker = this._bufferService.buffer.addMarker(y);\n entry.lines.push(marker);\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n }\n }\n\n public getLinkData(linkId: number): IOscLinkData | undefined {\n return this._dataByLinkId.get(linkId)?.data;\n }\n\n private _getEntryIdKey(linkData: Required): string {\n return `${linkData.id};;${linkData.uri}`;\n }\n\n private _removeMarkerFromLink(entry: IOscLinkEntryNoId | IOscLinkEntryWithId, marker: IMarker): void {\n const index = entry.lines.indexOf(marker);\n if (index === -1) {\n return;\n }\n entry.lines.splice(index, 1);\n if (entry.lines.length === 0) {\n if (entry.data.id !== undefined) {\n this._entriesWithId.delete((entry as IOscLinkEntryWithId).key);\n }\n this._dataByLinkId.delete(entry.id);\n }\n }\n}\n\ninterface IOscLinkEntry {\n data: T;\n id: number;\n lines: IMarker[];\n}\n\ninterface IOscLinkEntryNoId extends IOscLinkEntry {\n}\n\ninterface IOscLinkEntryWithId extends IOscLinkEntry> {\n key: string;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IServiceIdentifier } from 'common/services/Services';\n\nconst DI_TARGET = 'di$target';\nconst DI_DEPENDENCIES = 'di$dependencies';\n\nexport const serviceRegistry: Map> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier, index: number, optional: boolean }[] {\n return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator(id: string): IServiceIdentifier {\n if (serviceRegistry.has(id)) {\n return serviceRegistry.get(id)!;\n }\n\n const decorator: any = function (target: Function, key: string, index: number): any {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n\n storeServiceDependency(decorator, target, index);\n };\n\n decorator.toString = () => id;\n\n serviceRegistry.set(id, decorator);\n return decorator;\n}\n\nfunction storeServiceDependency(id: Function, target: Function, index: number): void {\n if ((target as any)[DI_TARGET] === target) {\n (target as any)[DI_DEPENDENCIES].push({ id, index });\n } else {\n (target as any)[DI_DEPENDENCIES] = [{ id, index }];\n (target as any)[DI_TARGET] = target;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, type IOverviewRulerOptions } from '@xterm/xterm';\nimport { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport type { Emitter, Event } from 'vs/base/common/event';\n\nexport const IBufferService = createDecorator('BufferService');\nexport interface IBufferService {\n serviceBrand: undefined;\n\n readonly cols: number;\n readonly rows: number;\n readonly buffer: IBuffer;\n readonly buffers: IBufferSet;\n isUserScrolling: boolean;\n onResize: Event<{ cols: number, rows: number }>;\n onScroll: Event;\n scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;\n scrollLines(disp: number, suppressScrollEvent?: boolean): void;\n resize(cols: number, rows: number): void;\n reset(): void;\n}\n\nexport const ICoreMouseService = createDecorator('CoreMouseService');\nexport interface ICoreMouseService {\n serviceBrand: undefined;\n\n activeProtocol: string;\n activeEncoding: string;\n areMouseEventsActive: boolean;\n addProtocol(name: string, protocol: ICoreMouseProtocol): void;\n addEncoding(name: string, encoding: CoreMouseEncoding): void;\n reset(): void;\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n triggerMouseEvent(event: ICoreMouseEvent): boolean;\n\n /**\n * Event to announce changes in mouse tracking.\n */\n onProtocolChange: Event;\n\n /**\n * Human readable version of mouse events.\n */\n explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n}\n\nexport const ICoreService = createDecorator('CoreService');\nexport interface ICoreService {\n serviceBrand: undefined;\n\n /**\n * Initially the cursor will not be visible until the first time the terminal\n * is focused.\n */\n isCursorInitialized: boolean;\n isCursorHidden: boolean;\n\n readonly modes: IModes;\n readonly decPrivateModes: IDecPrivateModes;\n\n readonly onData: Event;\n readonly onUserInput: Event;\n readonly onBinary: Event;\n readonly onRequestScrollToBottom: Event;\n\n reset(): void;\n\n /**\n * Triggers the onData event in the public API.\n * @param data The data that is being emitted.\n * @param wasUserInput Whether the data originated from the user (as opposed to\n * resulting from parsing incoming data). When true this will also:\n * - Scroll to the bottom of the buffer if option scrollOnUserInput is true.\n * - Fire the `onUserInput` event (so selection can be cleared).\n */\n triggerDataEvent(data: string, wasUserInput?: boolean): void;\n\n /**\n * Triggers the onBinary event in the public API.\n * @param data The data that is being emitted.\n */\n triggerBinaryEvent(data: string): void;\n}\n\nexport const ICharsetService = createDecorator('CharsetService');\nexport interface ICharsetService {\n serviceBrand: undefined;\n\n charset: ICharset | undefined;\n readonly glevel: number;\n\n reset(): void;\n\n /**\n * Set the G level of the terminal.\n * @param g\n */\n setgLevel(g: number): void;\n\n /**\n * Set the charset for the given G level of the terminal.\n * @param g\n * @param charset\n */\n setgCharset(g: number, charset: ICharset | undefined): void;\n}\n\nexport interface IServiceIdentifier {\n (...args: any[]): void;\n type: T;\n}\n\nexport interface IBrandedService {\n serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs = TArgs extends [] ? []\n : TArgs extends [...infer TFirst, infer TLast] ? TLast extends IBrandedService ? GetLeadingNonServiceArgs : TArgs\n : never;\n\nexport const IInstantiationService = createDecorator('InstantiationService');\nexport interface IInstantiationService {\n serviceBrand: undefined;\n\n setService(id: IServiceIdentifier, instance: T): void;\n getService(id: IServiceIdentifier): T | undefined;\n createInstance any, R extends InstanceType>(t: Ctor, ...args: GetLeadingNonServiceArgs>): R;\n}\n\nexport enum LogLevelEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n OFF = 5\n}\n\nexport const ILogService = createDecorator('LogService');\nexport interface ILogService {\n serviceBrand: undefined;\n\n readonly logLevel: LogLevelEnum;\n\n trace(message: any, ...optionalParams: any[]): void;\n debug(message: any, ...optionalParams: any[]): void;\n info(message: any, ...optionalParams: any[]): void;\n warn(message: any, ...optionalParams: any[]): void;\n error(message: any, ...optionalParams: any[]): void;\n}\n\nexport const IOptionsService = createDecorator('OptionsService');\nexport interface IOptionsService {\n serviceBrand: undefined;\n\n /**\n * Read only access to the raw options object, this is an internal-only fast path for accessing\n * single options without any validation as we trust TypeScript to enforce correct usage\n * internally.\n */\n readonly rawOptions: Required;\n\n /**\n * Options as exposed through the public API, this property uses getters and setters with\n * validation which makes it safer but slower. {@link rawOptions} should be used for pretty much\n * all internal usage for performance reasons.\n */\n readonly options: Required;\n\n /**\n * Adds an event listener for when any option changes.\n */\n readonly onOptionChange: Event;\n\n /**\n * Adds an event listener for when a specific option changes, this is a convenience method that is\n * preferred over {@link onOptionChange} when only a single option is being listened to.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onSpecificOptionChange(key: T, listener: (arg1: Required[T]) => any): IDisposable;\n\n /**\n * Adds an event listener for when a set of specific options change, this is a convenience method\n * that is preferred over {@link onOptionChange} when multiple options are being listened to and\n * handled the same way.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable;\n}\n\nexport type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';\n\nexport interface ITerminalOptions {\n allowProposedApi?: boolean;\n allowTransparency?: boolean;\n altClickMovesCursor?: boolean;\n cols?: number;\n convertEol?: boolean;\n cursorBlink?: boolean;\n cursorStyle?: CursorStyle;\n cursorWidth?: number;\n cursorInactiveStyle?: CursorInactiveStyle;\n customGlyphs?: boolean;\n disableStdin?: boolean;\n documentOverride?: any | null;\n drawBoldTextInBrightColors?: boolean;\n /** @deprecated No longer supported */\n fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';\n fastScrollSensitivity?: number;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: FontWeight;\n fontWeightBold?: FontWeight;\n ignoreBracketedPasteMode?: boolean;\n letterSpacing?: number;\n lineHeight?: number;\n linkHandler?: ILinkHandler | null;\n logLevel?: LogLevel;\n logger?: ILogger | null;\n macOptionIsMeta?: boolean;\n macOptionClickForcesSelection?: boolean;\n minimumContrastRatio?: number;\n rescaleOverlappingGlyphs?: boolean;\n rightClickSelectsWord?: boolean;\n rows?: number;\n screenReaderMode?: boolean;\n scrollback?: number;\n scrollOnUserInput?: boolean;\n scrollSensitivity?: number;\n smoothScrollDuration?: number;\n tabStopWidth?: number;\n theme?: ITheme;\n windowsMode?: boolean;\n windowsPty?: IWindowsPty;\n windowOptions?: IWindowOptions;\n wordSeparator?: string;\n overviewRuler?: IOverviewRulerOptions;\n\n [key: string]: any;\n cancelEvents: boolean;\n termName: string;\n}\n\nexport interface ITheme {\n foreground?: string;\n background?: string;\n cursor?: string;\n cursorAccent?: string;\n selectionForeground?: string;\n selectionBackground?: string;\n selectionInactiveBackground?: string;\n scrollbarSliderBackground?: string;\n scrollbarSliderHoverBackground?: string;\n scrollbarSliderActiveBackground?: string;\n overviewRulerBorder?: string;\n black?: string;\n red?: string;\n green?: string;\n yellow?: string;\n blue?: string;\n magenta?: string;\n cyan?: string;\n white?: string;\n brightBlack?: string;\n brightRed?: string;\n brightGreen?: string;\n brightYellow?: string;\n brightBlue?: string;\n brightMagenta?: string;\n brightCyan?: string;\n brightWhite?: string;\n extendedAnsi?: string[];\n}\n\nexport const IOscLinkService = createDecorator('OscLinkService');\nexport interface IOscLinkService {\n serviceBrand: undefined;\n /**\n * Registers a link to the service, returning the link ID. The link data is managed by this\n * service and will be freed when this current cursor position is trimmed off the buffer.\n */\n registerLink(linkData: IOscLinkData): number;\n /**\n * Adds a line to a link if needed.\n */\n addLineToLink(linkId: number, y: number): void;\n /** Get the link data associated with a link ID. */\n getLinkData(linkId: number): IOscLinkData | undefined;\n}\n\n/*\n * Width and Grapheme_Cluster_Break properties of a character as a bit mask.\n *\n * bit 0: shouldJoin - should combine with preceding character.\n * bit 1..2: wcwidth - see UnicodeCharWidth.\n * bit 3..31: class of character (currently only 4 bits are used).\n * This is used to determined grapheme clustering - i.e. which codepoints\n * are to be combined into a single compound character.\n *\n * Use the UnicodeService static function createPropertyValue to create a\n * UnicodeCharProperties; use extractShouldJoin, extractWidth, and\n * extractCharKind to extract the components.\n */\nexport type UnicodeCharProperties = number;\n\n/**\n * Width in columns of a character.\n * In a CJK context, \"half-width\" characters (such as Latin) are width 1,\n * while \"full-width\" characters (such as Kanji) are 2 columns wide.\n * Combining characters (such as accents) are width 0.\n */\nexport type UnicodeCharWidth = 0 | 1 | 2;\n\nexport const IUnicodeService = createDecorator('UnicodeService');\nexport interface IUnicodeService {\n serviceBrand: undefined;\n /** Register an Unicode version provider. */\n register(provider: IUnicodeVersionProvider): void;\n /** Registered Unicode versions. */\n readonly versions: string[];\n /** Currently active version. */\n activeVersion: string;\n /** Event triggered, when activate version changed. */\n readonly onChange: Event;\n\n /**\n * Unicode version dependent\n */\n wcwidth(codepoint: number): UnicodeCharWidth;\n getStringCellWidth(s: string): number;\n /**\n * Return character width and type for grapheme clustering.\n * If preceding != 0, it is the return code from the previous character;\n * in that case the result specifies if the characters should be joined.\n */\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport interface IUnicodeVersionProvider {\n readonly version: string;\n wcwidth(ucs: number): UnicodeCharWidth;\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport const IDecorationService = createDecorator('DecorationService');\nexport interface IDecorationService extends IDisposable {\n serviceBrand: undefined;\n readonly decorations: IterableIterator;\n readonly onDecorationRegistered: Event;\n readonly onDecorationRemoved: Event;\n registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;\n reset(): void;\n /**\n * Trigger a callback over the decoration at a cell (in no particular order). This uses a callback\n * instead of an iterator as it's typically used in hot code paths.\n */\n forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void;\n}\nexport interface IInternalDecoration extends IDecoration {\n readonly options: IDecorationOptions;\n readonly backgroundColorRGB: IColor | undefined;\n readonly foregroundColorRGB: IColor | undefined;\n readonly onRenderEmitter: Emitter;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { UnicodeV6 } from 'common/input/UnicodeV6';\nimport { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nexport class UnicodeService implements IUnicodeService {\n public serviceBrand: any;\n\n private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);\n private _active: string = '';\n private _activeProvider: IUnicodeVersionProvider;\n\n private readonly _onChange = new Emitter();\n public readonly onChange = this._onChange.event;\n\n public static extractShouldJoin(value: UnicodeCharProperties): boolean {\n return (value & 1) !== 0;\n }\n public static extractWidth(value: UnicodeCharProperties): UnicodeCharWidth {\n return ((value >> 1) & 0x3) as UnicodeCharWidth;\n }\n public static extractCharKind(value: UnicodeCharProperties): number {\n return value >> 3;\n }\n public static createPropertyValue(state: number, width: number, shouldJoin: boolean = false): UnicodeCharProperties {\n return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);\n }\n\n constructor() {\n const defaultProvider = new UnicodeV6();\n this.register(defaultProvider);\n this._active = defaultProvider.version;\n this._activeProvider = defaultProvider;\n }\n\n public dispose(): void {\n this._onChange.dispose();\n }\n\n public get versions(): string[] {\n return Object.keys(this._providers);\n }\n\n public get activeVersion(): string {\n return this._active;\n }\n\n public set activeVersion(version: string) {\n if (!this._providers[version]) {\n throw new Error(`unknown Unicode version \"${version}\"`);\n }\n this._active = version;\n this._activeProvider = this._providers[version];\n this._onChange.fire(version);\n }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._providers[provider.version] = provider;\n }\n\n /**\n * Unicode version dependent interface.\n */\n public wcwidth(num: number): UnicodeCharWidth {\n return this._activeProvider.wcwidth(num);\n }\n\n public getStringCellWidth(s: string): number {\n let result = 0;\n let precedingInfo = 0;\n const length = s.length;\n for (let i = 0; i < length; ++i) {\n let code = s.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n // this should not happen with strings retrieved from\n // Buffer.translateToString as it converts from UTF-32\n // and therefore always should contain the second part\n // for any other string we still have to handle it somehow:\n // simply treat the lonely surrogate first as a single char (UCS-2 behavior)\n return result + this.wcwidth(code);\n }\n const second = s.charCodeAt(i);\n // convert surrogate pair to high codepoint only for valid second part (UTF-16)\n // otherwise treat them independently (UCS-2 behavior)\n if (0xDC00 <= second && second <= 0xDFFF) {\n code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n result += this.wcwidth(second);\n }\n }\n const currentInfo = this.charProperties(code, precedingInfo);\n let chWidth = UnicodeService.extractWidth(currentInfo);\n if (UnicodeService.extractShouldJoin(currentInfo)) {\n chWidth -= UnicodeService.extractWidth(precedingInfo);\n }\n result += chWidth;\n precedingInfo = currentInfo;\n }\n return result;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n return this._activeProvider.charProperties(codepoint, preceding);\n }\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAndroid = exports.isElectron = exports.isWebkitWebView = exports.isSafari = exports.isChrome = exports.isWebKit = exports.isFirefox = exports.onDidChangeFullscreen = exports.onDidChangeZoomLevel = void 0;\nexports.addMatchMediaChangeListener = addMatchMediaChangeListener;\nexports.setZoomLevel = setZoomLevel;\nexports.getZoomLevel = getZoomLevel;\nexports.getZoomFactor = getZoomFactor;\nexports.setZoomFactor = setZoomFactor;\nexports.setFullscreen = setFullscreen;\nexports.isFullscreen = isFullscreen;\nexports.isStandalone = isStandalone;\nexports.isWCOEnabled = isWCOEnabled;\nexports.getWCOBoundingRect = getWCOBoundingRect;\nconst window_1 = require(\"vs/base/browser/window\");\nconst event_1 = require(\"vs/base/common/event\");\nclass WindowManager {\n constructor() {\n // --- Zoom Level\n this.mapWindowIdToZoomLevel = new Map();\n this._onDidChangeZoomLevel = new event_1.Emitter();\n this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\n // --- Zoom Factor\n this.mapWindowIdToZoomFactor = new Map();\n // --- Fullscreen\n this._onDidChangeFullscreen = new event_1.Emitter();\n this.onDidChangeFullscreen = this._onDidChangeFullscreen.event;\n this.mapWindowIdToFullScreen = new Map();\n }\n static { this.INSTANCE = new WindowManager(); }\n getZoomLevel(targetWindow) {\n return this.mapWindowIdToZoomLevel.get(this.getWindowId(targetWindow)) ?? 0;\n }\n setZoomLevel(zoomLevel, targetWindow) {\n if (this.getZoomLevel(targetWindow) === zoomLevel) {\n return;\n }\n const targetWindowId = this.getWindowId(targetWindow);\n this.mapWindowIdToZoomLevel.set(targetWindowId, zoomLevel);\n this._onDidChangeZoomLevel.fire(targetWindowId);\n }\n getZoomFactor(targetWindow) {\n return this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;\n }\n setZoomFactor(zoomFactor, targetWindow) {\n this.mapWindowIdToZoomFactor.set(this.getWindowId(targetWindow), zoomFactor);\n }\n setFullscreen(fullscreen, targetWindow) {\n if (this.isFullscreen(targetWindow) === fullscreen) {\n return;\n }\n const windowId = this.getWindowId(targetWindow);\n this.mapWindowIdToFullScreen.set(windowId, fullscreen);\n this._onDidChangeFullscreen.fire(windowId);\n }\n isFullscreen(targetWindow) {\n return !!this.mapWindowIdToFullScreen.get(this.getWindowId(targetWindow));\n }\n getWindowId(targetWindow) {\n return targetWindow.vscodeWindowId;\n }\n}\nfunction addMatchMediaChangeListener(targetWindow, query, callback) {\n if (typeof query === 'string') {\n query = targetWindow.matchMedia(query);\n }\n query.addEventListener('change', callback);\n}\n/** A zoom index, e.g. 1, 2, 3 */\nfunction setZoomLevel(zoomLevel, targetWindow) {\n WindowManager.INSTANCE.setZoomLevel(zoomLevel, targetWindow);\n}\nfunction getZoomLevel(targetWindow) {\n return WindowManager.INSTANCE.getZoomLevel(targetWindow);\n}\nexports.onDidChangeZoomLevel = WindowManager.INSTANCE.onDidChangeZoomLevel;\n/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */\nfunction getZoomFactor(targetWindow) {\n return WindowManager.INSTANCE.getZoomFactor(targetWindow);\n}\nfunction setZoomFactor(zoomFactor, targetWindow) {\n WindowManager.INSTANCE.setZoomFactor(zoomFactor, targetWindow);\n}\nfunction setFullscreen(fullscreen, targetWindow) {\n WindowManager.INSTANCE.setFullscreen(fullscreen, targetWindow);\n}\nfunction isFullscreen(targetWindow) {\n return WindowManager.INSTANCE.isFullscreen(targetWindow);\n}\nexports.onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;\nconst userAgent = typeof navigator === 'object' ? navigator.userAgent : '';\nexports.isFirefox = (userAgent.indexOf('Firefox') >= 0);\nexports.isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);\nexports.isChrome = (userAgent.indexOf('Chrome') >= 0);\nexports.isSafari = (!exports.isChrome && (userAgent.indexOf('Safari') >= 0));\nexports.isWebkitWebView = (!exports.isChrome && !exports.isSafari && exports.isWebKit);\nexports.isElectron = (userAgent.indexOf('Electron/') >= 0);\nexports.isAndroid = (userAgent.indexOf('Android') >= 0);\nlet standalone = false;\nif (typeof window_1.mainWindow.matchMedia === 'function') {\n const standaloneMatchMedia = window_1.mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');\n const fullScreenMatchMedia = window_1.mainWindow.matchMedia('(display-mode: fullscreen)');\n standalone = standaloneMatchMedia.matches;\n addMatchMediaChangeListener(window_1.mainWindow, standaloneMatchMedia, ({ matches }) => {\n // entering fullscreen would change standaloneMatchMedia.matches to false\n // if standalone is true (running as PWA) and entering fullscreen, skip this change\n if (standalone && fullScreenMatchMedia.matches) {\n return;\n }\n // otherwise update standalone (browser to PWA or PWA to browser)\n standalone = matches;\n });\n}\nfunction isStandalone() {\n return standalone;\n}\n// Visible means that the feature is enabled, not necessarily being rendered\n// e.g. visible is true even in fullscreen mode where the controls are hidden\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible\nfunction isWCOEnabled() {\n return navigator?.windowControlsOverlay?.visible;\n}\n// Returns the bounding rect of the titlebar area if it is supported and defined\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/getTitlebarAreaRect\nfunction getWCOBoundingRect() {\n return navigator?.windowControlsOverlay?.getTitlebarAreaRect();\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BrowserFeatures = exports.KeyboardSupport = void 0;\nconst browser = __importStar(require(\"vs/base/browser/browser\"));\nconst window_1 = require(\"vs/base/browser/window\");\nconst platform = __importStar(require(\"vs/base/common/platform\"));\nvar KeyboardSupport;\n(function (KeyboardSupport) {\n KeyboardSupport[KeyboardSupport[\"Always\"] = 0] = \"Always\";\n KeyboardSupport[KeyboardSupport[\"FullScreen\"] = 1] = \"FullScreen\";\n KeyboardSupport[KeyboardSupport[\"None\"] = 2] = \"None\";\n})(KeyboardSupport || (exports.KeyboardSupport = KeyboardSupport = {}));\nconst safeNavigator = typeof navigator === 'object' ? navigator : {};\n/**\n * Browser feature we can support in current platform, browser and environment.\n */\nexports.BrowserFeatures = {\n clipboard: {\n writeText: (platform.isNative\n || (document.queryCommandSupported && document.queryCommandSupported('copy'))\n || !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.writeText)),\n readText: (platform.isNative\n || !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.readText))\n },\n keyboard: (() => {\n if (platform.isNative || browser.isStandalone()) {\n return KeyboardSupport.Always;\n }\n if (safeNavigator.keyboard || browser.isSafari) {\n return KeyboardSupport.FullScreen;\n }\n return KeyboardSupport.None;\n })(),\n // 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be\n // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n touch: 'ontouchstart' in window_1.mainWindow || safeNavigator.maxTouchPoints > 0,\n pointerEvents: window_1.mainWindow.PointerEvent && ('ontouchstart' in window_1.mainWindow || navigator.maxTouchPoints > 0)\n};\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SafeTriangle = exports.DragAndDropObserver = exports.ModifierKeyEmitter = exports.DetectedFullscreenMode = exports.Namespace = exports.EventHelper = exports.EventType = exports.sharedMutationObserver = exports.Dimension = exports.WindowIntervalTimer = exports.scheduleAtNextAnimationFrame = exports.runAtThisOrScheduleAtNextAnimationFrame = exports.WindowIdleValue = exports.addStandardDisposableGenericMouseUpListener = exports.addStandardDisposableGenericMouseDownListener = exports.addStandardDisposableListener = exports.onDidUnregisterWindow = exports.onWillUnregisterWindow = exports.onDidRegisterWindow = exports.hasWindow = exports.getWindowById = exports.getWindowId = exports.getWindowsCount = exports.getWindows = exports.getDocument = exports.getWindow = exports.registerWindow = void 0;\nexports.clearNode = clearNode;\nexports.clearNodeRecursively = clearNodeRecursively;\nexports.addDisposableListener = addDisposableListener;\nexports.addDisposableGenericMouseDownListener = addDisposableGenericMouseDownListener;\nexports.addDisposableGenericMouseMoveListener = addDisposableGenericMouseMoveListener;\nexports.addDisposableGenericMouseUpListener = addDisposableGenericMouseUpListener;\nexports.runWhenWindowIdle = runWhenWindowIdle;\nexports.disposableWindowInterval = disposableWindowInterval;\nexports.measure = measure;\nexports.modify = modify;\nexports.addDisposableThrottledListener = addDisposableThrottledListener;\nexports.getComputedStyle = getComputedStyle;\nexports.getClientArea = getClientArea;\nexports.getTopLeftOffset = getTopLeftOffset;\nexports.size = size;\nexports.position = position;\nexports.getDomNodePagePosition = getDomNodePagePosition;\nexports.getDomNodeZoomLevel = getDomNodeZoomLevel;\nexports.getTotalWidth = getTotalWidth;\nexports.getContentWidth = getContentWidth;\nexports.getTotalScrollWidth = getTotalScrollWidth;\nexports.getContentHeight = getContentHeight;\nexports.getTotalHeight = getTotalHeight;\nexports.getLargestChildWidth = getLargestChildWidth;\nexports.isAncestor = isAncestor;\nexports.setParentFlowTo = setParentFlowTo;\nexports.isAncestorUsingFlowTo = isAncestorUsingFlowTo;\nexports.findParentWithClass = findParentWithClass;\nexports.hasParentWithClass = hasParentWithClass;\nexports.isShadowRoot = isShadowRoot;\nexports.isInShadowDOM = isInShadowDOM;\nexports.getShadowRoot = getShadowRoot;\nexports.getActiveElement = getActiveElement;\nexports.isActiveElement = isActiveElement;\nexports.isAncestorOfActiveElement = isAncestorOfActiveElement;\nexports.isActiveDocument = isActiveDocument;\nexports.getActiveDocument = getActiveDocument;\nexports.getActiveWindow = getActiveWindow;\nexports.isGlobalStylesheet = isGlobalStylesheet;\nexports.createStyleSheet2 = createStyleSheet2;\nexports.createStyleSheet = createStyleSheet;\nexports.cloneGlobalStylesheets = cloneGlobalStylesheets;\nexports.createMetaElement = createMetaElement;\nexports.createLinkElement = createLinkElement;\nexports.createCSSRule = createCSSRule;\nexports.removeCSSRulesContainingSelector = removeCSSRulesContainingSelector;\nexports.isHTMLElement = isHTMLElement;\nexports.isHTMLAnchorElement = isHTMLAnchorElement;\nexports.isHTMLSpanElement = isHTMLSpanElement;\nexports.isHTMLTextAreaElement = isHTMLTextAreaElement;\nexports.isHTMLInputElement = isHTMLInputElement;\nexports.isHTMLButtonElement = isHTMLButtonElement;\nexports.isHTMLDivElement = isHTMLDivElement;\nexports.isSVGElement = isSVGElement;\nexports.isMouseEvent = isMouseEvent;\nexports.isKeyboardEvent = isKeyboardEvent;\nexports.isPointerEvent = isPointerEvent;\nexports.isDragEvent = isDragEvent;\nexports.isEventLike = isEventLike;\nexports.saveParentsScrollTop = saveParentsScrollTop;\nexports.restoreParentsScrollTop = restoreParentsScrollTop;\nexports.trackFocus = trackFocus;\nexports.after = after;\nexports.append = append;\nexports.prepend = prepend;\nexports.reset = reset;\nexports.$ = $;\nexports.join = join;\nexports.setVisibility = setVisibility;\nexports.show = show;\nexports.hide = hide;\nexports.removeTabIndexAndUpdateFocus = removeTabIndexAndUpdateFocus;\nexports.finalHandler = finalHandler;\nexports.domContentLoaded = domContentLoaded;\nexports.computeScreenAwareSize = computeScreenAwareSize;\nexports.windowOpenNoOpener = windowOpenNoOpener;\nexports.windowOpenPopup = windowOpenPopup;\nexports.windowOpenWithSuccess = windowOpenWithSuccess;\nexports.animate = animate;\nexports.asCSSPropertyValue = asCSSPropertyValue;\nexports.asCssValueWithDefault = asCssValueWithDefault;\nexports.detectFullscreen = detectFullscreen;\nexports.multibyteAwareBtoa = multibyteAwareBtoa;\nexports.getCookieValue = getCookieValue;\nexports.h = h;\nexports.svgElem = svgElem;\nexports.copyAttributes = copyAttributes;\nexports.trackAttributes = trackAttributes;\nconst browser = __importStar(require(\"vs/base/browser/browser\"));\nconst canIUse_1 = require(\"vs/base/browser/canIUse\");\nconst keyboardEvent_1 = require(\"vs/base/browser/keyboardEvent\");\nconst mouseEvent_1 = require(\"vs/base/browser/mouseEvent\");\nconst async_1 = require(\"vs/base/common/async\");\nconst errors_1 = require(\"vs/base/common/errors\");\nconst event = __importStar(require(\"vs/base/common/event\"));\nconst keyCodes_1 = require(\"vs/base/common/keyCodes\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nconst platform = __importStar(require(\"vs/base/common/platform\"));\nconst hash_1 = require(\"vs/base/common/hash\");\nconst window_1 = require(\"vs/base/browser/window\");\nconst numbers_1 = require(\"vs/base/common/numbers\");\n//# region Multi-Window Support Utilities\n_a = (function () {\n const windows = new Map();\n (0, window_1.ensureCodeWindow)(window_1.mainWindow, 1);\n const mainWindowRegistration = { window: window_1.mainWindow, disposables: new lifecycle_1.DisposableStore() };\n windows.set(window_1.mainWindow.vscodeWindowId, mainWindowRegistration);\n const onDidRegisterWindow = new event.Emitter();\n const onDidUnregisterWindow = new event.Emitter();\n const onWillUnregisterWindow = new event.Emitter();\n function getWindowById(windowId, fallbackToMain) {\n const window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n return window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n }\n return {\n onDidRegisterWindow: onDidRegisterWindow.event,\n onWillUnregisterWindow: onWillUnregisterWindow.event,\n onDidUnregisterWindow: onDidUnregisterWindow.event,\n registerWindow(window) {\n if (windows.has(window.vscodeWindowId)) {\n return lifecycle_1.Disposable.None;\n }\n const disposables = new lifecycle_1.DisposableStore();\n const registeredWindow = {\n window,\n disposables: disposables.add(new lifecycle_1.DisposableStore())\n };\n windows.set(window.vscodeWindowId, registeredWindow);\n disposables.add((0, lifecycle_1.toDisposable)(() => {\n windows.delete(window.vscodeWindowId);\n onDidUnregisterWindow.fire(window);\n }));\n disposables.add(addDisposableListener(window, exports.EventType.BEFORE_UNLOAD, () => {\n onWillUnregisterWindow.fire(window);\n }));\n onDidRegisterWindow.fire(registeredWindow);\n return disposables;\n },\n getWindows() {\n return windows.values();\n },\n getWindowsCount() {\n return windows.size;\n },\n getWindowId(targetWindow) {\n return targetWindow.vscodeWindowId;\n },\n hasWindow(windowId) {\n return windows.has(windowId);\n },\n getWindowById,\n getWindow(e) {\n const candidateNode = e;\n if (candidateNode?.ownerDocument?.defaultView) {\n return candidateNode.ownerDocument.defaultView.window;\n }\n const candidateEvent = e;\n if (candidateEvent?.view) {\n return candidateEvent.view.window;\n }\n return window_1.mainWindow;\n },\n getDocument(e) {\n const candidateNode = e;\n return (0, exports.getWindow)(candidateNode).document;\n }\n };\n})(), exports.registerWindow = _a.registerWindow, exports.getWindow = _a.getWindow, exports.getDocument = _a.getDocument, exports.getWindows = _a.getWindows, exports.getWindowsCount = _a.getWindowsCount, exports.getWindowId = _a.getWindowId, exports.getWindowById = _a.getWindowById, exports.hasWindow = _a.hasWindow, exports.onDidRegisterWindow = _a.onDidRegisterWindow, exports.onWillUnregisterWindow = _a.onWillUnregisterWindow, exports.onDidUnregisterWindow = _a.onDidUnregisterWindow;\n//#endregion\nfunction clearNode(node) {\n while (node.firstChild) {\n node.firstChild.remove();\n }\n}\nfunction clearNodeRecursively(domNode) {\n while (domNode.firstChild) {\n const element = domNode.firstChild;\n element.remove();\n clearNodeRecursively(element);\n }\n}\nclass DomListener {\n constructor(node, type, handler, options) {\n this._node = node;\n this._type = type;\n this._handler = handler;\n this._options = (options || false);\n this._node.addEventListener(this._type, this._handler, this._options);\n }\n dispose() {\n if (!this._handler) {\n // Already disposed\n return;\n }\n this._node.removeEventListener(this._type, this._handler, this._options);\n // Prevent leakers from holding on to the dom or handler func\n this._node = null;\n this._handler = null;\n }\n}\nfunction addDisposableListener(node, type, handler, useCaptureOrOptions) {\n return new DomListener(node, type, handler, useCaptureOrOptions);\n}\nfunction _wrapAsStandardMouseEvent(targetWindow, handler) {\n return function (e) {\n return handler(new mouseEvent_1.StandardMouseEvent(targetWindow, e));\n };\n}\nfunction _wrapAsStandardKeyboardEvent(handler) {\n return function (e) {\n return handler(new keyboardEvent_1.StandardKeyboardEvent(e));\n };\n}\nconst addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {\n let wrapHandler = handler;\n if (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n wrapHandler = _wrapAsStandardMouseEvent((0, exports.getWindow)(node), handler);\n }\n else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n wrapHandler = _wrapAsStandardKeyboardEvent(handler);\n }\n return addDisposableListener(node, type, wrapHandler, useCapture);\n};\nexports.addStandardDisposableListener = addStandardDisposableListener;\nconst addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node, handler, useCapture) {\n const wrapHandler = _wrapAsStandardMouseEvent((0, exports.getWindow)(node), handler);\n return addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\nexports.addStandardDisposableGenericMouseDownListener = addStandardDisposableGenericMouseDownListener;\nconst addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node, handler, useCapture) {\n const wrapHandler = _wrapAsStandardMouseEvent((0, exports.getWindow)(node), handler);\n return addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexports.addStandardDisposableGenericMouseUpListener = addStandardDisposableGenericMouseUpListener;\nfunction addDisposableGenericMouseDownListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? exports.EventType.POINTER_DOWN : exports.EventType.MOUSE_DOWN, handler, useCapture);\n}\nfunction addDisposableGenericMouseMoveListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? exports.EventType.POINTER_MOVE : exports.EventType.MOUSE_MOVE, handler, useCapture);\n}\nfunction addDisposableGenericMouseUpListener(node, handler, useCapture) {\n return addDisposableListener(node, platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? exports.EventType.POINTER_UP : exports.EventType.MOUSE_UP, handler, useCapture);\n}\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nfunction runWhenWindowIdle(targetWindow, callback, timeout) {\n return (0, async_1._runWhenIdle)(targetWindow, callback, timeout);\n}\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nclass WindowIdleValue extends async_1.AbstractIdleValue {\n constructor(targetWindow, executor) {\n super(targetWindow, executor);\n }\n}\nexports.WindowIdleValue = WindowIdleValue;\nfunction disposableWindowInterval(targetWindow, handler, interval, iterations) {\n let iteration = 0;\n const timer = targetWindow.setInterval(() => {\n iteration++;\n if ((typeof iterations === 'number' && iteration >= iterations) || handler() === true) {\n disposable.dispose();\n }\n }, interval);\n const disposable = (0, lifecycle_1.toDisposable)(() => {\n targetWindow.clearInterval(timer);\n });\n return disposable;\n}\nclass WindowIntervalTimer extends async_1.IntervalTimer {\n /**\n *\n * @param node The optional node from which the target window is determined\n */\n constructor(node) {\n super();\n this.defaultTarget = node && (0, exports.getWindow)(node);\n }\n cancelAndSet(runner, interval, targetWindow) {\n return super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n }\n}\nexports.WindowIntervalTimer = WindowIntervalTimer;\nclass AnimationFrameQueueItem {\n constructor(runner, priority = 0) {\n this._runner = runner;\n this.priority = priority;\n this._canceled = false;\n }\n dispose() {\n this._canceled = true;\n }\n execute() {\n if (this._canceled) {\n return;\n }\n try {\n this._runner();\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n }\n }\n // Sort by priority (largest to lowest)\n static sort(a, b) {\n return b.priority - a.priority;\n }\n}\n(function () {\n /**\n * The runners scheduled at the next animation frame\n */\n const NEXT_QUEUE = new Map();\n /**\n * The runners scheduled at the current animation frame\n */\n const CURRENT_QUEUE = new Map();\n /**\n * A flag to keep track if the native requestAnimationFrame was already called\n */\n const animFrameRequested = new Map();\n /**\n * A flag to indicate if currently handling a native requestAnimationFrame callback\n */\n const inAnimationFrameRunner = new Map();\n const animationFrameRunner = (targetWindowId) => {\n animFrameRequested.set(targetWindowId, false);\n const currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n CURRENT_QUEUE.set(targetWindowId, currentQueue);\n NEXT_QUEUE.set(targetWindowId, []);\n inAnimationFrameRunner.set(targetWindowId, true);\n while (currentQueue.length > 0) {\n currentQueue.sort(AnimationFrameQueueItem.sort);\n const top = currentQueue.shift();\n top.execute();\n }\n inAnimationFrameRunner.set(targetWindowId, false);\n };\n exports.scheduleAtNextAnimationFrame = (targetWindow, runner, priority = 0) => {\n const targetWindowId = (0, exports.getWindowId)(targetWindow);\n const item = new AnimationFrameQueueItem(runner, priority);\n let nextQueue = NEXT_QUEUE.get(targetWindowId);\n if (!nextQueue) {\n nextQueue = [];\n NEXT_QUEUE.set(targetWindowId, nextQueue);\n }\n nextQueue.push(item);\n if (!animFrameRequested.get(targetWindowId)) {\n animFrameRequested.set(targetWindowId, true);\n targetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n }\n return item;\n };\n exports.runAtThisOrScheduleAtNextAnimationFrame = (targetWindow, runner, priority) => {\n const targetWindowId = (0, exports.getWindowId)(targetWindow);\n if (inAnimationFrameRunner.get(targetWindowId)) {\n const item = new AnimationFrameQueueItem(runner, priority);\n let currentQueue = CURRENT_QUEUE.get(targetWindowId);\n if (!currentQueue) {\n currentQueue = [];\n CURRENT_QUEUE.set(targetWindowId, currentQueue);\n }\n currentQueue.push(item);\n return item;\n }\n else {\n return (0, exports.scheduleAtNextAnimationFrame)(targetWindow, runner, priority);\n }\n };\n})();\nfunction measure(targetWindow, callback) {\n return (0, exports.scheduleAtNextAnimationFrame)(targetWindow, callback, 10000 /* must be early */);\n}\nfunction modify(targetWindow, callback) {\n return (0, exports.scheduleAtNextAnimationFrame)(targetWindow, callback, -10000 /* must be late */);\n}\nconst MINIMUM_TIME_MS = 8;\nconst DEFAULT_EVENT_MERGER = function (lastEvent, currentEvent) {\n return currentEvent;\n};\nclass TimeoutThrottledDomListener extends lifecycle_1.Disposable {\n constructor(node, type, handler, eventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs = MINIMUM_TIME_MS) {\n super();\n let lastEvent = null;\n let lastHandlerTime = 0;\n const timeout = this._register(new async_1.TimeoutTimer());\n const invokeHandler = () => {\n lastHandlerTime = (new Date()).getTime();\n handler(lastEvent);\n lastEvent = null;\n };\n this._register(addDisposableListener(node, type, (e) => {\n lastEvent = eventMerger(lastEvent, e);\n const elapsedTime = (new Date()).getTime() - lastHandlerTime;\n if (elapsedTime >= minimumTimeMs) {\n timeout.cancel();\n invokeHandler();\n }\n else {\n timeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);\n }\n }));\n }\n}\nfunction addDisposableThrottledListener(node, type, handler, eventMerger, minimumTimeMs) {\n return new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);\n}\nfunction getComputedStyle(el) {\n return (0, exports.getWindow)(el).getComputedStyle(el, null);\n}\nfunction getClientArea(element, fallback) {\n const elWindow = (0, exports.getWindow)(element);\n const elDocument = elWindow.document;\n // Try with DOM clientWidth / clientHeight\n if (element !== elDocument.body) {\n return new Dimension(element.clientWidth, element.clientHeight);\n }\n // If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n if (platform.isIOS && elWindow?.visualViewport) {\n return new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n }\n // Try innerWidth / innerHeight\n if (elWindow?.innerWidth && elWindow.innerHeight) {\n return new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n }\n // Try with document.body.clientWidth / document.body.clientHeight\n if (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n return new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n }\n // Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n if (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n return new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n }\n if (fallback) {\n return getClientArea(fallback);\n }\n throw new Error('Unable to figure out browser width and height');\n}\nclass SizeUtils {\n // Adapted from WinJS\n // Converts a CSS positioning string for the specified element to pixels.\n static convertToPixels(element, value) {\n return parseFloat(value) || 0;\n }\n static getDimension(element, cssPropertyName, jsPropertyName) {\n const computedStyle = getComputedStyle(element);\n const value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n return SizeUtils.convertToPixels(element, value);\n }\n static getBorderLeftWidth(element) {\n return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');\n }\n static getBorderRightWidth(element) {\n return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');\n }\n static getBorderTopWidth(element) {\n return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');\n }\n static getBorderBottomWidth(element) {\n return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');\n }\n static getPaddingLeft(element) {\n return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');\n }\n static getPaddingRight(element) {\n return SizeUtils.getDimension(element, 'padding-right', 'paddingRight');\n }\n static getPaddingTop(element) {\n return SizeUtils.getDimension(element, 'padding-top', 'paddingTop');\n }\n static getPaddingBottom(element) {\n return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');\n }\n static getMarginLeft(element) {\n return SizeUtils.getDimension(element, 'margin-left', 'marginLeft');\n }\n static getMarginTop(element) {\n return SizeUtils.getDimension(element, 'margin-top', 'marginTop');\n }\n static getMarginRight(element) {\n return SizeUtils.getDimension(element, 'margin-right', 'marginRight');\n }\n static getMarginBottom(element) {\n return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');\n }\n}\nclass Dimension {\n static { this.None = new Dimension(0, 0); }\n constructor(width, height) {\n this.width = width;\n this.height = height;\n }\n with(width = this.width, height = this.height) {\n if (width !== this.width || height !== this.height) {\n return new Dimension(width, height);\n }\n else {\n return this;\n }\n }\n static is(obj) {\n return typeof obj === 'object' && typeof obj.height === 'number' && typeof obj.width === 'number';\n }\n static lift(obj) {\n if (obj instanceof Dimension) {\n return obj;\n }\n else {\n return new Dimension(obj.width, obj.height);\n }\n }\n static equals(a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return a.width === b.width && a.height === b.height;\n }\n}\nexports.Dimension = Dimension;\nfunction getTopLeftOffset(element) {\n // Adapted from WinJS.Utilities.getPosition\n // and added borders to the mix\n let offsetParent = element.offsetParent;\n let top = element.offsetTop;\n let left = element.offsetLeft;\n while ((element = element.parentNode) !== null\n && element !== element.ownerDocument.body\n && element !== element.ownerDocument.documentElement) {\n top -= element.scrollTop;\n const c = isShadowRoot(element) ? null : getComputedStyle(element);\n if (c) {\n left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n }\n if (element === offsetParent) {\n left += SizeUtils.getBorderLeftWidth(element);\n top += SizeUtils.getBorderTopWidth(element);\n top += element.offsetTop;\n left += element.offsetLeft;\n offsetParent = element.offsetParent;\n }\n }\n return {\n left: left,\n top: top\n };\n}\nfunction size(element, width, height) {\n if (typeof width === 'number') {\n element.style.width = `${width}px`;\n }\n if (typeof height === 'number') {\n element.style.height = `${height}px`;\n }\n}\nfunction position(element, top, right, bottom, left, position = 'absolute') {\n if (typeof top === 'number') {\n element.style.top = `${top}px`;\n }\n if (typeof right === 'number') {\n element.style.right = `${right}px`;\n }\n if (typeof bottom === 'number') {\n element.style.bottom = `${bottom}px`;\n }\n if (typeof left === 'number') {\n element.style.left = `${left}px`;\n }\n element.style.position = position;\n}\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nfunction getDomNodePagePosition(domNode) {\n const bb = domNode.getBoundingClientRect();\n const window = (0, exports.getWindow)(domNode);\n return {\n left: bb.left + window.scrollX,\n top: bb.top + window.scrollY,\n width: bb.width,\n height: bb.height\n };\n}\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nfunction getDomNodeZoomLevel(domNode) {\n let testElement = domNode;\n let zoom = 1.0;\n do {\n const elementZoomLevel = getComputedStyle(testElement).zoom;\n if (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n zoom *= elementZoomLevel;\n }\n testElement = testElement.parentElement;\n } while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n return zoom;\n}\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nfunction getTotalWidth(element) {\n const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n return element.offsetWidth + margin;\n}\nfunction getContentWidth(element) {\n const border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n const padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n return element.offsetWidth - border - padding;\n}\nfunction getTotalScrollWidth(element) {\n const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n return element.scrollWidth + margin;\n}\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nfunction getContentHeight(element) {\n const border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n const padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n return element.offsetHeight - border - padding;\n}\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nfunction getTotalHeight(element) {\n const margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n return element.offsetHeight + margin;\n}\n// Gets the left coordinate of the specified element relative to the specified parent.\nfunction getRelativeLeft(element, parent) {\n if (element === null) {\n return 0;\n }\n const elementPosition = getTopLeftOffset(element);\n const parentPosition = getTopLeftOffset(parent);\n return elementPosition.left - parentPosition.left;\n}\nfunction getLargestChildWidth(parent, children) {\n const childWidths = children.map((child) => {\n return Math.max(getTotalScrollWidth(child), getTotalWidth(child)) + getRelativeLeft(child, parent) || 0;\n });\n const maxWidth = Math.max(...childWidths);\n return maxWidth;\n}\n// ----------------------------------------------------------------------------------------\nfunction isAncestor(testChild, testAncestor) {\n return Boolean(testAncestor?.contains(testChild));\n}\nconst parentFlowToDataKey = 'parentFlowToElementId';\n/**\n * Set an explicit parent to use for nodes that are not part of the\n * regular dom structure.\n */\nfunction setParentFlowTo(fromChildElement, toParentElement) {\n fromChildElement.dataset[parentFlowToDataKey] = toParentElement.id;\n}\nfunction getParentFlowToElement(node) {\n const flowToParentId = node.dataset[parentFlowToDataKey];\n if (typeof flowToParentId === 'string') {\n return node.ownerDocument.getElementById(flowToParentId);\n }\n return null;\n}\n/**\n * Check if `testAncestor` is an ancestor of `testChild`, observing the explicit\n * parents set by `setParentFlowTo`.\n */\nfunction isAncestorUsingFlowTo(testChild, testAncestor) {\n let node = testChild;\n while (node) {\n if (node === testAncestor) {\n return true;\n }\n if (isHTMLElement(node)) {\n const flowToParentElement = getParentFlowToElement(node);\n if (flowToParentElement) {\n node = flowToParentElement;\n continue;\n }\n }\n node = node.parentNode;\n }\n return false;\n}\nfunction findParentWithClass(node, clazz, stopAtClazzOrNode) {\n while (node && node.nodeType === node.ELEMENT_NODE) {\n if (node.classList.contains(clazz)) {\n return node;\n }\n if (stopAtClazzOrNode) {\n if (typeof stopAtClazzOrNode === 'string') {\n if (node.classList.contains(stopAtClazzOrNode)) {\n return null;\n }\n }\n else {\n if (node === stopAtClazzOrNode) {\n return null;\n }\n }\n }\n node = node.parentNode;\n }\n return null;\n}\nfunction hasParentWithClass(node, clazz, stopAtClazzOrNode) {\n return !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\nfunction isShadowRoot(node) {\n return (node && !!node.host && !!node.mode);\n}\nfunction isInShadowDOM(domNode) {\n return !!getShadowRoot(domNode);\n}\nfunction getShadowRoot(domNode) {\n while (domNode.parentNode) {\n if (domNode === domNode.ownerDocument?.body) {\n // reached the body\n return null;\n }\n domNode = domNode.parentNode;\n }\n return isShadowRoot(domNode) ? domNode : null;\n}\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nfunction getActiveElement() {\n let result = getActiveDocument().activeElement;\n while (result?.shadowRoot) {\n result = result.shadowRoot.activeElement;\n }\n return result;\n}\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nfunction isActiveElement(element) {\n return getActiveElement() === element;\n}\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nfunction isAncestorOfActiveElement(ancestor) {\n return isAncestor(getActiveElement(), ancestor);\n}\n/**\n * Returns whether the element is in the active `document`. The active\n * document has focus or will be the main windows document.\n */\nfunction isActiveDocument(element) {\n return element.ownerDocument === getActiveDocument();\n}\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main windows document.\n */\nfunction getActiveDocument() {\n if ((0, exports.getWindowsCount)() <= 1) {\n return window_1.mainWindow.document;\n }\n const documents = Array.from((0, exports.getWindows)()).map(({ window }) => window.document);\n return documents.find(doc => doc.hasFocus()) ?? window_1.mainWindow.document;\n}\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nfunction getActiveWindow() {\n const document = getActiveDocument();\n return (document.defaultView?.window ?? window_1.mainWindow);\n}\nconst globalStylesheets = new Map();\nfunction isGlobalStylesheet(node) {\n return globalStylesheets.has(node);\n}\n/**\n * A version of createStyleSheet which has a unified API to initialize/set the style content.\n */\nfunction createStyleSheet2() {\n return new WrappedStyleElement();\n}\nclass WrappedStyleElement {\n constructor() {\n this._currentCssStyle = '';\n this._styleSheet = undefined;\n }\n setStyle(cssStyle) {\n if (cssStyle === this._currentCssStyle) {\n return;\n }\n this._currentCssStyle = cssStyle;\n if (!this._styleSheet) {\n this._styleSheet = createStyleSheet(window_1.mainWindow.document.head, (s) => s.innerText = cssStyle);\n }\n else {\n this._styleSheet.innerText = cssStyle;\n }\n }\n dispose() {\n if (this._styleSheet) {\n this._styleSheet.remove();\n this._styleSheet = undefined;\n }\n }\n}\nfunction createStyleSheet(container = window_1.mainWindow.document.head, beforeAppend, disposableStore) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.media = 'screen';\n beforeAppend?.(style);\n container.appendChild(style);\n if (disposableStore) {\n disposableStore.add((0, lifecycle_1.toDisposable)(() => style.remove()));\n }\n // With as container, the stylesheet becomes global and is tracked\n // to support auxiliary windows to clone the stylesheet.\n if (container === window_1.mainWindow.document.head) {\n const globalStylesheetClones = new Set();\n globalStylesheets.set(style, globalStylesheetClones);\n for (const { window: targetWindow, disposables } of (0, exports.getWindows)()) {\n if (targetWindow === window_1.mainWindow) {\n continue; // main window is already tracked\n }\n const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));\n disposableStore?.add(cloneDisposable);\n }\n }\n return style;\n}\nfunction cloneGlobalStylesheets(targetWindow) {\n const disposables = new lifecycle_1.DisposableStore();\n for (const [globalStylesheet, clonedGlobalStylesheets] of globalStylesheets) {\n disposables.add(cloneGlobalStyleSheet(globalStylesheet, clonedGlobalStylesheets, targetWindow));\n }\n return disposables;\n}\nfunction cloneGlobalStyleSheet(globalStylesheet, globalStylesheetClones, targetWindow) {\n const disposables = new lifecycle_1.DisposableStore();\n const clone = globalStylesheet.cloneNode(true);\n targetWindow.document.head.appendChild(clone);\n disposables.add((0, lifecycle_1.toDisposable)(() => clone.remove()));\n for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {\n clone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);\n }\n disposables.add(exports.sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {\n clone.textContent = globalStylesheet.textContent;\n }));\n globalStylesheetClones.add(clone);\n disposables.add((0, lifecycle_1.toDisposable)(() => globalStylesheetClones.delete(clone)));\n return disposables;\n}\nexports.sharedMutationObserver = new class {\n constructor() {\n this.mutationObservers = new Map();\n }\n observe(target, disposables, options) {\n let mutationObserversPerTarget = this.mutationObservers.get(target);\n if (!mutationObserversPerTarget) {\n mutationObserversPerTarget = new Map();\n this.mutationObservers.set(target, mutationObserversPerTarget);\n }\n const optionsHash = (0, hash_1.hash)(options);\n let mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n if (!mutationObserverPerOptions) {\n const onDidMutate = new event.Emitter();\n const observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n observer.observe(target, options);\n const resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n users: 1,\n observer,\n onDidMutate: onDidMutate.event\n };\n disposables.add((0, lifecycle_1.toDisposable)(() => {\n resolvedMutationObserverPerOptions.users -= 1;\n if (resolvedMutationObserverPerOptions.users === 0) {\n onDidMutate.dispose();\n observer.disconnect();\n mutationObserversPerTarget?.delete(optionsHash);\n if (mutationObserversPerTarget?.size === 0) {\n this.mutationObservers.delete(target);\n }\n }\n }));\n mutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n }\n else {\n mutationObserverPerOptions.users += 1;\n }\n return mutationObserverPerOptions.onDidMutate;\n }\n};\nfunction createMetaElement(container = window_1.mainWindow.document.head) {\n return createHeadElement('meta', container);\n}\nfunction createLinkElement(container = window_1.mainWindow.document.head) {\n return createHeadElement('link', container);\n}\nfunction createHeadElement(tagName, container = window_1.mainWindow.document.head) {\n const element = document.createElement(tagName);\n container.appendChild(element);\n return element;\n}\nlet _sharedStyleSheet = null;\nfunction getSharedStyleSheet() {\n if (!_sharedStyleSheet) {\n _sharedStyleSheet = createStyleSheet();\n }\n return _sharedStyleSheet;\n}\nfunction getDynamicStyleSheetRules(style) {\n if (style?.sheet?.rules) {\n // Chrome, IE\n return style.sheet.rules;\n }\n if (style?.sheet?.cssRules) {\n // FF\n return style.sheet.cssRules;\n }\n return [];\n}\nfunction createCSSRule(selector, cssText, style = getSharedStyleSheet()) {\n if (!style || !cssText) {\n return;\n }\n style.sheet?.insertRule(`${selector} {${cssText}}`, 0);\n // Apply rule also to all cloned global stylesheets\n for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n createCSSRule(selector, cssText, clonedGlobalStylesheet);\n }\n}\nfunction removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) {\n if (!style) {\n return;\n }\n const rules = getDynamicStyleSheetRules(style);\n const toDelete = [];\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {\n toDelete.push(i);\n }\n }\n for (let i = toDelete.length - 1; i >= 0; i--) {\n style.sheet?.deleteRule(toDelete[i]);\n }\n // Remove rules also from all cloned global stylesheets\n for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);\n }\n}\nfunction isCSSStyleRule(rule) {\n return typeof rule.selectorText === 'string';\n}\nfunction isHTMLElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof HTMLElement || e instanceof (0, exports.getWindow)(e).HTMLElement;\n}\nfunction isHTMLAnchorElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof HTMLAnchorElement || e instanceof (0, exports.getWindow)(e).HTMLAnchorElement;\n}\nfunction isHTMLSpanElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof HTMLSpanElement || e instanceof (0, exports.getWindow)(e).HTMLSpanElement;\n}\nfunction isHTMLTextAreaElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof HTMLTextAreaElement || e instanceof (0, exports.getWindow)(e).HTMLTextAreaElement;\n}\nfunction isHTMLInputElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof HTMLInputElement || e instanceof (0, exports.getWindow)(e).HTMLInputElement;\n}\nfunction isHTMLButtonElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof HTMLButtonElement || e instanceof (0, exports.getWindow)(e).HTMLButtonElement;\n}\nfunction isHTMLDivElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof HTMLDivElement || e instanceof (0, exports.getWindow)(e).HTMLDivElement;\n}\nfunction isSVGElement(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof SVGElement || e instanceof (0, exports.getWindow)(e).SVGElement;\n}\nfunction isMouseEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof MouseEvent || e instanceof (0, exports.getWindow)(e).MouseEvent;\n}\nfunction isKeyboardEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof KeyboardEvent || e instanceof (0, exports.getWindow)(e).KeyboardEvent;\n}\nfunction isPointerEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof PointerEvent || e instanceof (0, exports.getWindow)(e).PointerEvent;\n}\nfunction isDragEvent(e) {\n // eslint-disable-next-line no-restricted-syntax\n return e instanceof DragEvent || e instanceof (0, exports.getWindow)(e).DragEvent;\n}\nexports.EventType = {\n // Mouse\n CLICK: 'click',\n AUXCLICK: 'auxclick',\n DBLCLICK: 'dblclick',\n MOUSE_UP: 'mouseup',\n MOUSE_DOWN: 'mousedown',\n MOUSE_OVER: 'mouseover',\n MOUSE_MOVE: 'mousemove',\n MOUSE_OUT: 'mouseout',\n MOUSE_ENTER: 'mouseenter',\n MOUSE_LEAVE: 'mouseleave',\n MOUSE_WHEEL: 'wheel',\n POINTER_UP: 'pointerup',\n POINTER_DOWN: 'pointerdown',\n POINTER_MOVE: 'pointermove',\n POINTER_LEAVE: 'pointerleave',\n CONTEXT_MENU: 'contextmenu',\n WHEEL: 'wheel',\n // Keyboard\n KEY_DOWN: 'keydown',\n KEY_PRESS: 'keypress',\n KEY_UP: 'keyup',\n // HTML Document\n LOAD: 'load',\n BEFORE_UNLOAD: 'beforeunload',\n UNLOAD: 'unload',\n PAGE_SHOW: 'pageshow',\n PAGE_HIDE: 'pagehide',\n PASTE: 'paste',\n ABORT: 'abort',\n ERROR: 'error',\n RESIZE: 'resize',\n SCROLL: 'scroll',\n FULLSCREEN_CHANGE: 'fullscreenchange',\n WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n // Form\n SELECT: 'select',\n CHANGE: 'change',\n SUBMIT: 'submit',\n RESET: 'reset',\n FOCUS: 'focus',\n FOCUS_IN: 'focusin',\n FOCUS_OUT: 'focusout',\n BLUR: 'blur',\n INPUT: 'input',\n // Local Storage\n STORAGE: 'storage',\n // Drag\n DRAG_START: 'dragstart',\n DRAG: 'drag',\n DRAG_ENTER: 'dragenter',\n DRAG_LEAVE: 'dragleave',\n DRAG_OVER: 'dragover',\n DROP: 'drop',\n DRAG_END: 'dragend',\n // Animation\n ANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n ANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n ANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n};\nfunction isEventLike(obj) {\n const candidate = obj;\n return !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\nexports.EventHelper = {\n stop: (e, cancelBubble) => {\n e.preventDefault();\n if (cancelBubble) {\n e.stopPropagation();\n }\n return e;\n }\n};\nfunction saveParentsScrollTop(node) {\n const r = [];\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n r[i] = node.scrollTop;\n node = node.parentNode;\n }\n return r;\n}\nfunction restoreParentsScrollTop(node, state) {\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n if (node.scrollTop !== state[i]) {\n node.scrollTop = state[i];\n }\n node = node.parentNode;\n }\n}\nclass FocusTracker extends lifecycle_1.Disposable {\n static hasFocusWithin(element) {\n if (isHTMLElement(element)) {\n const shadowRoot = getShadowRoot(element);\n const activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n return isAncestor(activeElement, element);\n }\n else {\n const window = element;\n return isAncestor(window.document.activeElement, window.document);\n }\n }\n constructor(element) {\n super();\n this._onDidFocus = this._register(new event.Emitter());\n this.onDidFocus = this._onDidFocus.event;\n this._onDidBlur = this._register(new event.Emitter());\n this.onDidBlur = this._onDidBlur.event;\n let hasFocus = FocusTracker.hasFocusWithin(element);\n let loosingFocus = false;\n const onFocus = () => {\n loosingFocus = false;\n if (!hasFocus) {\n hasFocus = true;\n this._onDidFocus.fire();\n }\n };\n const onBlur = () => {\n if (hasFocus) {\n loosingFocus = true;\n (isHTMLElement(element) ? (0, exports.getWindow)(element) : element).setTimeout(() => {\n if (loosingFocus) {\n loosingFocus = false;\n hasFocus = false;\n this._onDidBlur.fire();\n }\n }, 0);\n }\n };\n this._refreshStateHandler = () => {\n const currentNodeHasFocus = FocusTracker.hasFocusWithin(element);\n if (currentNodeHasFocus !== hasFocus) {\n if (hasFocus) {\n onBlur();\n }\n else {\n onFocus();\n }\n }\n };\n this._register(addDisposableListener(element, exports.EventType.FOCUS, onFocus, true));\n this._register(addDisposableListener(element, exports.EventType.BLUR, onBlur, true));\n if (isHTMLElement(element)) {\n this._register(addDisposableListener(element, exports.EventType.FOCUS_IN, () => this._refreshStateHandler()));\n this._register(addDisposableListener(element, exports.EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n }\n }\n refreshState() {\n this._refreshStateHandler();\n }\n}\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nfunction trackFocus(element) {\n return new FocusTracker(element);\n}\nfunction after(sibling, child) {\n sibling.after(child);\n return child;\n}\nfunction append(parent, ...children) {\n parent.append(...children);\n if (children.length === 1 && typeof children[0] !== 'string') {\n return children[0];\n }\n}\nfunction prepend(parent, child) {\n parent.insertBefore(child, parent.firstChild);\n return child;\n}\n/**\n * Removes all children from `parent` and appends `children`\n */\nfunction reset(parent, ...children) {\n parent.innerText = '';\n append(parent, ...children);\n}\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\nvar Namespace;\n(function (Namespace) {\n Namespace[\"HTML\"] = \"http://www.w3.org/1999/xhtml\";\n Namespace[\"SVG\"] = \"http://www.w3.org/2000/svg\";\n})(Namespace || (exports.Namespace = Namespace = {}));\nfunction _$(namespace, description, attrs, ...children) {\n const match = SELECTOR_REGEX.exec(description);\n if (!match) {\n throw new Error('Bad use of emmet');\n }\n const tagName = match[1] || 'div';\n let result;\n if (namespace !== Namespace.HTML) {\n result = document.createElementNS(namespace, tagName);\n }\n else {\n result = document.createElement(tagName);\n }\n if (match[3]) {\n result.id = match[3];\n }\n if (match[4]) {\n result.className = match[4].replace(/\\./g, ' ').trim();\n }\n if (attrs) {\n Object.entries(attrs).forEach(([name, value]) => {\n if (typeof value === 'undefined') {\n return;\n }\n if (/^on\\w+$/.test(name)) {\n result[name] = value;\n }\n else if (name === 'selected') {\n if (value) {\n result.setAttribute(name, 'true');\n }\n }\n else {\n result.setAttribute(name, value);\n }\n });\n }\n result.append(...children);\n return result;\n}\nfunction $(description, attrs, ...children) {\n return _$(Namespace.HTML, description, attrs, ...children);\n}\n$.SVG = function (description, attrs, ...children) {\n return _$(Namespace.SVG, description, attrs, ...children);\n};\nfunction join(nodes, separator) {\n const result = [];\n nodes.forEach((node, index) => {\n if (index > 0) {\n if (separator instanceof Node) {\n result.push(separator.cloneNode());\n }\n else {\n result.push(document.createTextNode(separator));\n }\n }\n result.push(node);\n });\n return result;\n}\nfunction setVisibility(visible, ...elements) {\n if (visible) {\n show(...elements);\n }\n else {\n hide(...elements);\n }\n}\nfunction show(...elements) {\n for (const element of elements) {\n element.style.display = '';\n element.removeAttribute('aria-hidden');\n }\n}\nfunction hide(...elements) {\n for (const element of elements) {\n element.style.display = 'none';\n element.setAttribute('aria-hidden', 'true');\n }\n}\nfunction findParentWithAttribute(node, attribute) {\n while (node && node.nodeType === node.ELEMENT_NODE) {\n if (isHTMLElement(node) && node.hasAttribute(attribute)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n}\nfunction removeTabIndexAndUpdateFocus(node) {\n if (!node || !node.hasAttribute('tabIndex')) {\n return;\n }\n // If we are the currently focused element and tabIndex is removed,\n // standard DOM behavior is to move focus to the element. We\n // typically never want that, rather put focus to the closest element\n // in the hierarchy of the parent DOM nodes.\n if (node.ownerDocument.activeElement === node) {\n const parentFocusable = findParentWithAttribute(node.parentElement, 'tabIndex');\n parentFocusable?.focus();\n }\n node.removeAttribute('tabindex');\n}\nfunction finalHandler(fn) {\n return e => {\n e.preventDefault();\n e.stopPropagation();\n fn(e);\n };\n}\nfunction domContentLoaded(targetWindow) {\n return new Promise(resolve => {\n const readyState = targetWindow.document.readyState;\n if (readyState === 'complete' || (targetWindow.document && targetWindow.document.body !== null)) {\n resolve(undefined);\n }\n else {\n const listener = () => {\n targetWindow.window.removeEventListener('DOMContentLoaded', listener, false);\n resolve();\n };\n targetWindow.window.addEventListener('DOMContentLoaded', listener, false);\n }\n });\n}\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nfunction computeScreenAwareSize(window, cssPx) {\n const screenPx = window.devicePixelRatio * cssPx;\n return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nfunction windowOpenNoOpener(url) {\n // By using 'noopener' in the `windowFeatures` argument, the newly created window will\n // not be able to use `window.opener` to reach back to the current page.\n // See https://stackoverflow.com/a/46958731\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n // However, this also doesn't allow us to realize if the browser blocked\n // the creation of the window.\n window_1.mainWindow.open(url, '_blank', 'noopener');\n}\n/**\n * Open a new window in a popup. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * Note: this does not set {@link window.opener} to null. This is to allow the opened popup to\n * be able to use {@link window.close} to close itself. Because of this, you should only use\n * this function on urls that you trust.\n *\n * In otherwords, you should almost always use {@link windowOpenNoOpener} instead of this function.\n */\nconst popupWidth = 780, popupHeight = 640;\nfunction windowOpenPopup(url) {\n const left = Math.floor(window_1.mainWindow.screenLeft + window_1.mainWindow.innerWidth / 2 - popupWidth / 2);\n const top = Math.floor(window_1.mainWindow.screenTop + window_1.mainWindow.innerHeight / 2 - popupHeight / 2);\n window_1.mainWindow.open(url, '_blank', `width=${popupWidth},height=${popupHeight},top=${top},left=${left}`);\n}\n/**\n * Attempts to open a window and returns whether it succeeded. This technique is\n * not appropriate in certain contexts, like for example when the JS context is\n * executing inside a sandboxed iframe. If it is not necessary to know if the\n * browser blocked the new window, use {@link windowOpenNoOpener}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * See https://github.com/microsoft/monaco-editor/issues/2474\n * See https://mathiasbynens.github.io/rel-noopener/\n *\n * @param url the url to open\n * @param noOpener whether or not to set the {@link window.opener} to null. You should leave the default\n * (true) unless you trust the url that is being opened.\n * @returns boolean indicating if the {@link window.open} call succeeded\n */\nfunction windowOpenWithSuccess(url, noOpener = true) {\n const newTab = window_1.mainWindow.open();\n if (newTab) {\n if (noOpener) {\n // see `windowOpenNoOpener` for details on why this is important\n newTab.opener = null;\n }\n newTab.location.href = url;\n return true;\n }\n return false;\n}\nfunction animate(targetWindow, fn) {\n const step = () => {\n fn();\n stepDisposable = (0, exports.scheduleAtNextAnimationFrame)(targetWindow, step);\n };\n let stepDisposable = (0, exports.scheduleAtNextAnimationFrame)(targetWindow, step);\n return (0, lifecycle_1.toDisposable)(() => stepDisposable.dispose());\n}\nfunction asCSSPropertyValue(value) {\n return `'${value.replace(/'/g, '%27')}'`;\n}\nfunction asCssValueWithDefault(cssPropertyValue, dflt) {\n if (cssPropertyValue !== undefined) {\n const variableMatch = cssPropertyValue.match(/^\\s*var\\((.+)\\)$/);\n if (variableMatch) {\n const varArguments = variableMatch[1].split(',', 2);\n if (varArguments.length === 2) {\n dflt = asCssValueWithDefault(varArguments[1].trim(), dflt);\n }\n return `var(${varArguments[0]}, ${dflt})`;\n }\n return cssPropertyValue;\n }\n return dflt;\n}\nvar DetectedFullscreenMode;\n(function (DetectedFullscreenMode) {\n /**\n * The document is fullscreen, e.g. because an element\n * in the document requested to be fullscreen.\n */\n DetectedFullscreenMode[DetectedFullscreenMode[\"DOCUMENT\"] = 1] = \"DOCUMENT\";\n /**\n * The browser is fullscreen, e.g. because the user enabled\n * native window fullscreen for it.\n */\n DetectedFullscreenMode[DetectedFullscreenMode[\"BROWSER\"] = 2] = \"BROWSER\";\n})(DetectedFullscreenMode || (exports.DetectedFullscreenMode = DetectedFullscreenMode = {}));\nfunction detectFullscreen(targetWindow) {\n // Browser fullscreen: use DOM APIs to detect\n if (targetWindow.document.fullscreenElement || targetWindow.document.webkitFullscreenElement || targetWindow.document.webkitIsFullScreen) {\n return { mode: DetectedFullscreenMode.DOCUMENT, guess: false };\n }\n // There is no standard way to figure out if the browser\n // is using native fullscreen. Via checking on screen\n // height and comparing that to window height, we can guess\n // it though.\n if (targetWindow.innerHeight === targetWindow.screen.height) {\n // if the height of the window matches the screen height, we can\n // safely assume that the browser is fullscreen because no browser\n // chrome is taking height away (e.g. like toolbars).\n return { mode: DetectedFullscreenMode.BROWSER, guess: false };\n }\n if (platform.isMacintosh || platform.isLinux) {\n // macOS and Linux do not properly report `innerHeight`, only Windows does\n if (targetWindow.outerHeight === targetWindow.screen.height && targetWindow.outerWidth === targetWindow.screen.width) {\n // if the height of the browser matches the screen height, we can\n // only guess that we are in fullscreen. It is also possible that\n // the user has turned off taskbars in the OS and the browser is\n // simply able to span the entire size of the screen.\n return { mode: DetectedFullscreenMode.BROWSER, guess: true };\n }\n }\n // Not in fullscreen\n return null;\n}\n/**\n * Convert a Unicode string to a string in which each 16-bit unit occupies only one byte\n *\n * From https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa\n */\nfunction toBinary(str) {\n const codeUnits = new Uint16Array(str.length);\n for (let i = 0; i < codeUnits.length; i++) {\n codeUnits[i] = str.charCodeAt(i);\n }\n let binary = '';\n const uint8array = new Uint8Array(codeUnits.buffer);\n for (let i = 0; i < uint8array.length; i++) {\n binary += String.fromCharCode(uint8array[i]);\n }\n return binary;\n}\n/**\n * Version of the global `btoa` function that handles multi-byte characters instead\n * of throwing an exception.\n */\nfunction multibyteAwareBtoa(str) {\n return btoa(toBinary(str));\n}\nclass ModifierKeyEmitter extends event.Emitter {\n constructor() {\n super();\n this._subscriptions = new lifecycle_1.DisposableStore();\n this._keyStatus = {\n altKey: false,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false\n };\n this._subscriptions.add(event.Event.runAndSubscribe(exports.onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: window_1.mainWindow, disposables: this._subscriptions }));\n }\n registerListeners(window, disposables) {\n disposables.add(addDisposableListener(window, 'keydown', e => {\n if (e.defaultPrevented) {\n return;\n }\n const event = new keyboardEvent_1.StandardKeyboardEvent(e);\n // If Alt-key keydown event is repeated, ignore it #112347\n // Only known to be necessary for Alt-Key at the moment #115810\n if (event.keyCode === keyCodes_1.KeyCode.Alt && e.repeat) {\n return;\n }\n if (e.altKey && !this._keyStatus.altKey) {\n this._keyStatus.lastKeyPressed = 'alt';\n }\n else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n this._keyStatus.lastKeyPressed = 'ctrl';\n }\n else if (e.metaKey && !this._keyStatus.metaKey) {\n this._keyStatus.lastKeyPressed = 'meta';\n }\n else if (e.shiftKey && !this._keyStatus.shiftKey) {\n this._keyStatus.lastKeyPressed = 'shift';\n }\n else if (event.keyCode !== keyCodes_1.KeyCode.Alt) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n else {\n return;\n }\n this._keyStatus.altKey = e.altKey;\n this._keyStatus.ctrlKey = e.ctrlKey;\n this._keyStatus.metaKey = e.metaKey;\n this._keyStatus.shiftKey = e.shiftKey;\n if (this._keyStatus.lastKeyPressed) {\n this._keyStatus.event = e;\n this.fire(this._keyStatus);\n }\n }, true));\n disposables.add(addDisposableListener(window, 'keyup', e => {\n if (e.defaultPrevented) {\n return;\n }\n if (!e.altKey && this._keyStatus.altKey) {\n this._keyStatus.lastKeyReleased = 'alt';\n }\n else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n this._keyStatus.lastKeyReleased = 'ctrl';\n }\n else if (!e.metaKey && this._keyStatus.metaKey) {\n this._keyStatus.lastKeyReleased = 'meta';\n }\n else if (!e.shiftKey && this._keyStatus.shiftKey) {\n this._keyStatus.lastKeyReleased = 'shift';\n }\n else {\n this._keyStatus.lastKeyReleased = undefined;\n }\n if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n this._keyStatus.altKey = e.altKey;\n this._keyStatus.ctrlKey = e.ctrlKey;\n this._keyStatus.metaKey = e.metaKey;\n this._keyStatus.shiftKey = e.shiftKey;\n if (this._keyStatus.lastKeyReleased) {\n this._keyStatus.event = e;\n this.fire(this._keyStatus);\n }\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n this._keyStatus.lastKeyPressed = undefined;\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n this._keyStatus.lastKeyPressed = undefined;\n }, true));\n disposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n if (e.buttons) {\n this._keyStatus.lastKeyPressed = undefined;\n }\n }, true));\n disposables.add(addDisposableListener(window, 'blur', () => {\n this.resetKeyStatus();\n }));\n }\n get keyStatus() {\n return this._keyStatus;\n }\n get isModifierPressed() {\n return this._keyStatus.altKey || this._keyStatus.ctrlKey || this._keyStatus.metaKey || this._keyStatus.shiftKey;\n }\n /**\n * Allows to explicitly reset the key status based on more knowledge (#109062)\n */\n resetKeyStatus() {\n this.doResetKeyStatus();\n this.fire(this._keyStatus);\n }\n doResetKeyStatus() {\n this._keyStatus = {\n altKey: false,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false\n };\n }\n static getInstance() {\n if (!ModifierKeyEmitter.instance) {\n ModifierKeyEmitter.instance = new ModifierKeyEmitter();\n }\n return ModifierKeyEmitter.instance;\n }\n dispose() {\n super.dispose();\n this._subscriptions.dispose();\n }\n}\nexports.ModifierKeyEmitter = ModifierKeyEmitter;\nfunction getCookieValue(name) {\n const match = document.cookie.match('(^|[^;]+)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531\n return match ? match.pop() : undefined;\n}\nclass DragAndDropObserver extends lifecycle_1.Disposable {\n constructor(element, callbacks) {\n super();\n this.element = element;\n this.callbacks = callbacks;\n // A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n // calls see https://github.com/microsoft/vscode/issues/14470\n // when the element has child elements where the events are fired\n // repeadedly.\n this.counter = 0;\n // Allows to measure the duration of the drag operation.\n this.dragStartTime = 0;\n this.registerListeners();\n }\n registerListeners() {\n if (this.callbacks.onDragStart) {\n this._register(addDisposableListener(this.element, exports.EventType.DRAG_START, (e) => {\n this.callbacks.onDragStart?.(e);\n }));\n }\n if (this.callbacks.onDrag) {\n this._register(addDisposableListener(this.element, exports.EventType.DRAG, (e) => {\n this.callbacks.onDrag?.(e);\n }));\n }\n this._register(addDisposableListener(this.element, exports.EventType.DRAG_ENTER, (e) => {\n this.counter++;\n this.dragStartTime = e.timeStamp;\n this.callbacks.onDragEnter?.(e);\n }));\n this._register(addDisposableListener(this.element, exports.EventType.DRAG_OVER, (e) => {\n e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n this.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n }));\n this._register(addDisposableListener(this.element, exports.EventType.DRAG_LEAVE, (e) => {\n this.counter--;\n if (this.counter === 0) {\n this.dragStartTime = 0;\n this.callbacks.onDragLeave?.(e);\n }\n }));\n this._register(addDisposableListener(this.element, exports.EventType.DRAG_END, (e) => {\n this.counter = 0;\n this.dragStartTime = 0;\n this.callbacks.onDragEnd?.(e);\n }));\n this._register(addDisposableListener(this.element, exports.EventType.DROP, (e) => {\n this.counter = 0;\n this.dragStartTime = 0;\n this.callbacks.onDrop?.(e);\n }));\n }\n}\nexports.DragAndDropObserver = DragAndDropObserver;\nconst H_REGEX = /(?[\\w\\-]+)?(?:#(?[\\w\\-]+))?(?(?:\\.(?:[\\w\\-]+))*)(?:@(?(?:[\\w\\_])+))?/;\nfunction h(tag, ...args) {\n let attributes;\n let children;\n if (Array.isArray(args[0])) {\n attributes = {};\n children = args[0];\n }\n else {\n attributes = args[0] || {};\n children = args[1];\n }\n const match = H_REGEX.exec(tag);\n if (!match || !match.groups) {\n throw new Error('Bad use of h');\n }\n const tagName = match.groups['tag'] || 'div';\n const el = document.createElement(tagName);\n if (match.groups['id']) {\n el.id = match.groups['id'];\n }\n const classNames = [];\n if (match.groups['class']) {\n for (const className of match.groups['class'].split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (attributes.className !== undefined) {\n for (const className of attributes.className.split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (classNames.length > 0) {\n el.className = classNames.join(' ');\n }\n const result = {};\n if (match.groups['name']) {\n result[match.groups['name']] = el;\n }\n if (children) {\n for (const c of children) {\n if (isHTMLElement(c)) {\n el.appendChild(c);\n }\n else if (typeof c === 'string') {\n el.append(c);\n }\n else if ('root' in c) {\n Object.assign(result, c);\n el.appendChild(c.root);\n }\n }\n }\n for (const [key, value] of Object.entries(attributes)) {\n if (key === 'className') {\n continue;\n }\n else if (key === 'style') {\n for (const [cssKey, cssValue] of Object.entries(value)) {\n el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue);\n }\n }\n else if (key === 'tabIndex') {\n el.tabIndex = value;\n }\n else {\n el.setAttribute(camelCaseToHyphenCase(key), value.toString());\n }\n }\n result['root'] = el;\n return result;\n}\nfunction svgElem(tag, ...args) {\n let attributes;\n let children;\n if (Array.isArray(args[0])) {\n attributes = {};\n children = args[0];\n }\n else {\n attributes = args[0] || {};\n children = args[1];\n }\n const match = H_REGEX.exec(tag);\n if (!match || !match.groups) {\n throw new Error('Bad use of h');\n }\n const tagName = match.groups['tag'] || 'div';\n const el = document.createElementNS('http://www.w3.org/2000/svg', tagName);\n if (match.groups['id']) {\n el.id = match.groups['id'];\n }\n const classNames = [];\n if (match.groups['class']) {\n for (const className of match.groups['class'].split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (attributes.className !== undefined) {\n for (const className of attributes.className.split('.')) {\n if (className !== '') {\n classNames.push(className);\n }\n }\n }\n if (classNames.length > 0) {\n el.className = classNames.join(' ');\n }\n const result = {};\n if (match.groups['name']) {\n result[match.groups['name']] = el;\n }\n if (children) {\n for (const c of children) {\n if (isHTMLElement(c)) {\n el.appendChild(c);\n }\n else if (typeof c === 'string') {\n el.append(c);\n }\n else if ('root' in c) {\n Object.assign(result, c);\n el.appendChild(c.root);\n }\n }\n }\n for (const [key, value] of Object.entries(attributes)) {\n if (key === 'className') {\n continue;\n }\n else if (key === 'style') {\n for (const [cssKey, cssValue] of Object.entries(value)) {\n el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue);\n }\n }\n else if (key === 'tabIndex') {\n el.tabIndex = value;\n }\n else {\n el.setAttribute(camelCaseToHyphenCase(key), value.toString());\n }\n }\n result['root'] = el;\n return result;\n}\nfunction camelCaseToHyphenCase(str) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\nfunction copyAttributes(from, to, filter) {\n for (const { name, value } of from.attributes) {\n if (!filter || filter.includes(name)) {\n to.setAttribute(name, value);\n }\n }\n}\nfunction copyAttribute(from, to, name) {\n const value = from.getAttribute(name);\n if (value) {\n to.setAttribute(name, value);\n }\n else {\n to.removeAttribute(name);\n }\n}\nfunction trackAttributes(from, to, filter) {\n copyAttributes(from, to, filter);\n const disposables = new lifecycle_1.DisposableStore();\n disposables.add(exports.sharedMutationObserver.observe(from, disposables, { attributes: true, attributeFilter: filter })(mutations => {\n for (const mutation of mutations) {\n if (mutation.type === 'attributes' && mutation.attributeName) {\n copyAttribute(from, to, mutation.attributeName);\n }\n }\n }));\n return disposables;\n}\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nclass SafeTriangle {\n constructor(originX, originY, target) {\n this.originX = originX;\n this.originY = originY;\n // 4 triangles, 2 points (x, y) stored for each\n this.triangles = [];\n const { top, left, right, bottom } = target.getBoundingClientRect();\n const t = this.triangles;\n let i = 0;\n t[i++] = left;\n t[i++] = top;\n t[i++] = right;\n t[i++] = top;\n t[i++] = left;\n t[i++] = top;\n t[i++] = left;\n t[i++] = bottom;\n t[i++] = right;\n t[i++] = top;\n t[i++] = right;\n t[i++] = bottom;\n t[i++] = left;\n t[i++] = bottom;\n t[i++] = right;\n t[i++] = bottom;\n }\n contains(x, y) {\n const { triangles, originX, originY } = this;\n for (let i = 0; i < 4; i++) {\n if ((0, numbers_1.isPointWithinTriangle)(x, y, originX, originY, triangles[2 * i], triangles[2 * i + 1], triangles[2 * i + 2], triangles[2 * i + 3])) {\n return true;\n }\n }\n return false;\n }\n}\nexports.SafeTriangle = SafeTriangle;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FastDomNode = void 0;\nexports.createFastDomNode = createFastDomNode;\nclass FastDomNode {\n constructor(domNode) {\n this.domNode = domNode;\n this._maxWidth = '';\n this._width = '';\n this._height = '';\n this._top = '';\n this._left = '';\n this._bottom = '';\n this._right = '';\n this._paddingTop = '';\n this._paddingLeft = '';\n this._paddingBottom = '';\n this._paddingRight = '';\n this._fontFamily = '';\n this._fontWeight = '';\n this._fontSize = '';\n this._fontStyle = '';\n this._fontFeatureSettings = '';\n this._fontVariationSettings = '';\n this._textDecoration = '';\n this._lineHeight = '';\n this._letterSpacing = '';\n this._className = '';\n this._display = '';\n this._position = '';\n this._visibility = '';\n this._color = '';\n this._backgroundColor = '';\n this._layerHint = false;\n this._contain = 'none';\n this._boxShadow = '';\n }\n setMaxWidth(_maxWidth) {\n const maxWidth = numberAsPixels(_maxWidth);\n if (this._maxWidth === maxWidth) {\n return;\n }\n this._maxWidth = maxWidth;\n this.domNode.style.maxWidth = this._maxWidth;\n }\n setWidth(_width) {\n const width = numberAsPixels(_width);\n if (this._width === width) {\n return;\n }\n this._width = width;\n this.domNode.style.width = this._width;\n }\n setHeight(_height) {\n const height = numberAsPixels(_height);\n if (this._height === height) {\n return;\n }\n this._height = height;\n this.domNode.style.height = this._height;\n }\n setTop(_top) {\n const top = numberAsPixels(_top);\n if (this._top === top) {\n return;\n }\n this._top = top;\n this.domNode.style.top = this._top;\n }\n setLeft(_left) {\n const left = numberAsPixels(_left);\n if (this._left === left) {\n return;\n }\n this._left = left;\n this.domNode.style.left = this._left;\n }\n setBottom(_bottom) {\n const bottom = numberAsPixels(_bottom);\n if (this._bottom === bottom) {\n return;\n }\n this._bottom = bottom;\n this.domNode.style.bottom = this._bottom;\n }\n setRight(_right) {\n const right = numberAsPixels(_right);\n if (this._right === right) {\n return;\n }\n this._right = right;\n this.domNode.style.right = this._right;\n }\n setPaddingTop(_paddingTop) {\n const paddingTop = numberAsPixels(_paddingTop);\n if (this._paddingTop === paddingTop) {\n return;\n }\n this._paddingTop = paddingTop;\n this.domNode.style.paddingTop = this._paddingTop;\n }\n setPaddingLeft(_paddingLeft) {\n const paddingLeft = numberAsPixels(_paddingLeft);\n if (this._paddingLeft === paddingLeft) {\n return;\n }\n this._paddingLeft = paddingLeft;\n this.domNode.style.paddingLeft = this._paddingLeft;\n }\n setPaddingBottom(_paddingBottom) {\n const paddingBottom = numberAsPixels(_paddingBottom);\n if (this._paddingBottom === paddingBottom) {\n return;\n }\n this._paddingBottom = paddingBottom;\n this.domNode.style.paddingBottom = this._paddingBottom;\n }\n setPaddingRight(_paddingRight) {\n const paddingRight = numberAsPixels(_paddingRight);\n if (this._paddingRight === paddingRight) {\n return;\n }\n this._paddingRight = paddingRight;\n this.domNode.style.paddingRight = this._paddingRight;\n }\n setFontFamily(fontFamily) {\n if (this._fontFamily === fontFamily) {\n return;\n }\n this._fontFamily = fontFamily;\n this.domNode.style.fontFamily = this._fontFamily;\n }\n setFontWeight(fontWeight) {\n if (this._fontWeight === fontWeight) {\n return;\n }\n this._fontWeight = fontWeight;\n this.domNode.style.fontWeight = this._fontWeight;\n }\n setFontSize(_fontSize) {\n const fontSize = numberAsPixels(_fontSize);\n if (this._fontSize === fontSize) {\n return;\n }\n this._fontSize = fontSize;\n this.domNode.style.fontSize = this._fontSize;\n }\n setFontStyle(fontStyle) {\n if (this._fontStyle === fontStyle) {\n return;\n }\n this._fontStyle = fontStyle;\n this.domNode.style.fontStyle = this._fontStyle;\n }\n setFontFeatureSettings(fontFeatureSettings) {\n if (this._fontFeatureSettings === fontFeatureSettings) {\n return;\n }\n this._fontFeatureSettings = fontFeatureSettings;\n this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;\n }\n setFontVariationSettings(fontVariationSettings) {\n if (this._fontVariationSettings === fontVariationSettings) {\n return;\n }\n this._fontVariationSettings = fontVariationSettings;\n this.domNode.style.fontVariationSettings = this._fontVariationSettings;\n }\n setTextDecoration(textDecoration) {\n if (this._textDecoration === textDecoration) {\n return;\n }\n this._textDecoration = textDecoration;\n this.domNode.style.textDecoration = this._textDecoration;\n }\n setLineHeight(_lineHeight) {\n const lineHeight = numberAsPixels(_lineHeight);\n if (this._lineHeight === lineHeight) {\n return;\n }\n this._lineHeight = lineHeight;\n this.domNode.style.lineHeight = this._lineHeight;\n }\n setLetterSpacing(_letterSpacing) {\n const letterSpacing = numberAsPixels(_letterSpacing);\n if (this._letterSpacing === letterSpacing) {\n return;\n }\n this._letterSpacing = letterSpacing;\n this.domNode.style.letterSpacing = this._letterSpacing;\n }\n setClassName(className) {\n if (this._className === className) {\n return;\n }\n this._className = className;\n this.domNode.className = this._className;\n }\n toggleClassName(className, shouldHaveIt) {\n this.domNode.classList.toggle(className, shouldHaveIt);\n this._className = this.domNode.className;\n }\n setDisplay(display) {\n if (this._display === display) {\n return;\n }\n this._display = display;\n this.domNode.style.display = this._display;\n }\n setPosition(position) {\n if (this._position === position) {\n return;\n }\n this._position = position;\n this.domNode.style.position = this._position;\n }\n setVisibility(visibility) {\n if (this._visibility === visibility) {\n return;\n }\n this._visibility = visibility;\n this.domNode.style.visibility = this._visibility;\n }\n setColor(color) {\n if (this._color === color) {\n return;\n }\n this._color = color;\n this.domNode.style.color = this._color;\n }\n setBackgroundColor(backgroundColor) {\n if (this._backgroundColor === backgroundColor) {\n return;\n }\n this._backgroundColor = backgroundColor;\n this.domNode.style.backgroundColor = this._backgroundColor;\n }\n setLayerHinting(layerHint) {\n if (this._layerHint === layerHint) {\n return;\n }\n this._layerHint = layerHint;\n this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';\n }\n setBoxShadow(boxShadow) {\n if (this._boxShadow === boxShadow) {\n return;\n }\n this._boxShadow = boxShadow;\n this.domNode.style.boxShadow = boxShadow;\n }\n setContain(contain) {\n if (this._contain === contain) {\n return;\n }\n this._contain = contain;\n this.domNode.style.contain = this._contain;\n }\n setAttribute(name, value) {\n this.domNode.setAttribute(name, value);\n }\n removeAttribute(name) {\n this.domNode.removeAttribute(name);\n }\n appendChild(child) {\n this.domNode.appendChild(child.domNode);\n }\n removeChild(child) {\n this.domNode.removeChild(child.domNode);\n }\n}\nexports.FastDomNode = FastDomNode;\nfunction numberAsPixels(value) {\n return (typeof value === 'number' ? `${value}px` : value);\n}\nfunction createFastDomNode(domNode) {\n return new FastDomNode(domNode);\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.GlobalPointerMoveMonitor = void 0;\nconst dom = __importStar(require(\"vs/base/browser/dom\"));\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nclass GlobalPointerMoveMonitor {\n constructor() {\n this._hooks = new lifecycle_1.DisposableStore();\n this._pointerMoveCallback = null;\n this._onStopCallback = null;\n }\n dispose() {\n this.stopMonitoring(false);\n this._hooks.dispose();\n }\n stopMonitoring(invokeStopCallback, browserEvent) {\n if (!this.isMonitoring()) {\n // Not monitoring\n return;\n }\n // Unhook\n this._hooks.clear();\n this._pointerMoveCallback = null;\n const onStopCallback = this._onStopCallback;\n this._onStopCallback = null;\n if (invokeStopCallback && onStopCallback) {\n onStopCallback(browserEvent);\n }\n }\n isMonitoring() {\n return !!this._pointerMoveCallback;\n }\n startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {\n if (this.isMonitoring()) {\n this.stopMonitoring(false);\n }\n this._pointerMoveCallback = pointerMoveCallback;\n this._onStopCallback = onStopCallback;\n let eventSource = initialElement;\n try {\n initialElement.setPointerCapture(pointerId);\n this._hooks.add((0, lifecycle_1.toDisposable)(() => {\n try {\n initialElement.releasePointerCapture(pointerId);\n }\n catch (err) {\n // See https://github.com/microsoft/vscode/issues/161731\n //\n // `releasePointerCapture` sometimes fails when being invoked with the exception:\n // DOMException: Failed to execute 'releasePointerCapture' on 'Element':\n // No active pointer with the given id is found.\n //\n // There's no need to do anything in case of failure\n }\n }));\n }\n catch (err) {\n // See https://github.com/microsoft/vscode/issues/144584\n // See https://github.com/microsoft/vscode/issues/146947\n // `setPointerCapture` sometimes fails when being invoked\n // from a `mousedown` listener on macOS and Windows\n // and it always fails on Linux with the exception:\n // DOMException: Failed to execute 'setPointerCapture' on 'Element':\n // No active pointer with the given id is found.\n // In case of failure, we bind the listeners on the window\n eventSource = dom.getWindow(initialElement);\n }\n this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_MOVE, (e) => {\n if (e.buttons !== initialButtons) {\n // Buttons state has changed in the meantime\n this.stopMonitoring(true);\n return;\n }\n e.preventDefault();\n this._pointerMoveCallback(e);\n }));\n this._hooks.add(dom.addDisposableListener(eventSource, dom.EventType.POINTER_UP, (e) => this.stopMonitoring(true)));\n }\n}\nexports.GlobalPointerMoveMonitor = GlobalPointerMoveMonitor;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.IframeUtils = void 0;\nexports.parentOriginHash = parentOriginHash;\nconst sameOriginWindowChainCache = new WeakMap();\nfunction getParentWindowIfSameOrigin(w) {\n if (!w.parent || w.parent === w) {\n return null;\n }\n // Cannot really tell if we have access to the parent window unless we try to access something in it\n try {\n const location = w.location;\n const parentLocation = w.parent.location;\n if (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) {\n return null;\n }\n }\n catch (e) {\n return null;\n }\n return w.parent;\n}\nclass IframeUtils {\n /**\n * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).\n * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.\n */\n static getSameOriginWindowChain(targetWindow) {\n let windowChainCache = sameOriginWindowChainCache.get(targetWindow);\n if (!windowChainCache) {\n windowChainCache = [];\n sameOriginWindowChainCache.set(targetWindow, windowChainCache);\n let w = targetWindow;\n let parent;\n do {\n parent = getParentWindowIfSameOrigin(w);\n if (parent) {\n windowChainCache.push({\n window: new WeakRef(w),\n iframeElement: w.frameElement || null\n });\n }\n else {\n windowChainCache.push({\n window: new WeakRef(w),\n iframeElement: null\n });\n }\n w = parent;\n } while (w);\n }\n return windowChainCache.slice(0);\n }\n /**\n * Returns the position of `childWindow` relative to `ancestorWindow`\n */\n static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {\n if (!ancestorWindow || childWindow === ancestorWindow) {\n return {\n top: 0,\n left: 0\n };\n }\n let top = 0, left = 0;\n const windowChain = this.getSameOriginWindowChain(childWindow);\n for (const windowChainEl of windowChain) {\n const windowInChain = windowChainEl.window.deref();\n top += windowInChain?.scrollY ?? 0;\n left += windowInChain?.scrollX ?? 0;\n if (windowInChain === ancestorWindow) {\n break;\n }\n if (!windowChainEl.iframeElement) {\n break;\n }\n const boundingRect = windowChainEl.iframeElement.getBoundingClientRect();\n top += boundingRect.top;\n left += boundingRect.left;\n }\n return {\n top: top,\n left: left\n };\n }\n}\nexports.IframeUtils = IframeUtils;\n/**\n * Returns a sha-256 composed of `parentOrigin` and `salt` converted to base 32\n */\nasync function parentOriginHash(parentOrigin, salt) {\n // This same code is also inlined at `src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html`\n if (!crypto.subtle) {\n throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);\n }\n const strData = JSON.stringify({ parentOrigin, salt });\n const encoder = new TextEncoder();\n const arrData = encoder.encode(strData);\n const hash = await crypto.subtle.digest('sha-256', arrData);\n return sha256AsBase32(hash);\n}\nfunction sha256AsBase32(bytes) {\n const array = Array.from(new Uint8Array(bytes));\n const hexArray = array.map(b => b.toString(16).padStart(2, '0')).join('');\n // sha256 has 256 bits, so we need at most ceil(lg(2^256-1)/lg(32)) = 52 chars to represent it in base 32\n return BigInt(`0x${hexArray}`).toString(32).padStart(52, '0');\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StandardKeyboardEvent = void 0;\nexports.printKeyboardEvent = printKeyboardEvent;\nexports.printStandardKeyboardEvent = printStandardKeyboardEvent;\nconst browser = __importStar(require(\"vs/base/browser/browser\"));\nconst keyCodes_1 = require(\"vs/base/common/keyCodes\");\nconst keybindings_1 = require(\"vs/base/common/keybindings\");\nconst platform = __importStar(require(\"vs/base/common/platform\"));\nfunction extractKeyCode(e) {\n if (e.charCode) {\n // \"keypress\" events mostly\n const char = String.fromCharCode(e.charCode).toUpperCase();\n return keyCodes_1.KeyCodeUtils.fromString(char);\n }\n const keyCode = e.keyCode;\n // browser quirks\n if (keyCode === 3) {\n return keyCodes_1.KeyCode.PauseBreak;\n }\n else if (browser.isFirefox) {\n switch (keyCode) {\n case 59: return keyCodes_1.KeyCode.Semicolon;\n case 60:\n if (platform.isLinux) {\n return keyCodes_1.KeyCode.IntlBackslash;\n }\n break;\n case 61: return keyCodes_1.KeyCode.Equal;\n // based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys\n case 107: return keyCodes_1.KeyCode.NumpadAdd;\n case 109: return keyCodes_1.KeyCode.NumpadSubtract;\n case 173: return keyCodes_1.KeyCode.Minus;\n case 224:\n if (platform.isMacintosh) {\n return keyCodes_1.KeyCode.Meta;\n }\n break;\n }\n }\n else if (browser.isWebKit) {\n if (platform.isMacintosh && keyCode === 93) {\n // the two meta keys in the Mac have different key codes (91 and 93)\n return keyCodes_1.KeyCode.Meta;\n }\n else if (!platform.isMacintosh && keyCode === 92) {\n return keyCodes_1.KeyCode.Meta;\n }\n }\n // cross browser keycodes:\n return keyCodes_1.EVENT_KEY_CODE_MAP[keyCode] || keyCodes_1.KeyCode.Unknown;\n}\nconst ctrlKeyMod = (platform.isMacintosh ? keyCodes_1.KeyMod.WinCtrl : keyCodes_1.KeyMod.CtrlCmd);\nconst altKeyMod = keyCodes_1.KeyMod.Alt;\nconst shiftKeyMod = keyCodes_1.KeyMod.Shift;\nconst metaKeyMod = (platform.isMacintosh ? keyCodes_1.KeyMod.CtrlCmd : keyCodes_1.KeyMod.WinCtrl);\nfunction printKeyboardEvent(e) {\n const modifiers = [];\n if (e.ctrlKey) {\n modifiers.push(`ctrl`);\n }\n if (e.shiftKey) {\n modifiers.push(`shift`);\n }\n if (e.altKey) {\n modifiers.push(`alt`);\n }\n if (e.metaKey) {\n modifiers.push(`meta`);\n }\n return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`;\n}\nfunction printStandardKeyboardEvent(e) {\n const modifiers = [];\n if (e.ctrlKey) {\n modifiers.push(`ctrl`);\n }\n if (e.shiftKey) {\n modifiers.push(`shift`);\n }\n if (e.altKey) {\n modifiers.push(`alt`);\n }\n if (e.metaKey) {\n modifiers.push(`meta`);\n }\n return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${keyCodes_1.KeyCodeUtils.toString(e.keyCode)}')`;\n}\nclass StandardKeyboardEvent {\n constructor(source) {\n this._standardKeyboardEventBrand = true;\n const e = source;\n this.browserEvent = e;\n this.target = e.target;\n this.ctrlKey = e.ctrlKey;\n this.shiftKey = e.shiftKey;\n this.altKey = e.altKey;\n this.metaKey = e.metaKey;\n this.altGraphKey = e.getModifierState?.('AltGraph');\n this.keyCode = extractKeyCode(e);\n this.code = e.code;\n // console.info(e.type + \": keyCode: \" + e.keyCode + \", which: \" + e.which + \", charCode: \" + e.charCode + \", detail: \" + e.detail + \" ====> \" + this.keyCode + ' -- ' + KeyCode[this.keyCode]);\n this.ctrlKey = this.ctrlKey || this.keyCode === keyCodes_1.KeyCode.Ctrl;\n this.altKey = this.altKey || this.keyCode === keyCodes_1.KeyCode.Alt;\n this.shiftKey = this.shiftKey || this.keyCode === keyCodes_1.KeyCode.Shift;\n this.metaKey = this.metaKey || this.keyCode === keyCodes_1.KeyCode.Meta;\n this._asKeybinding = this._computeKeybinding();\n this._asKeyCodeChord = this._computeKeyCodeChord();\n // console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);\n }\n preventDefault() {\n if (this.browserEvent && this.browserEvent.preventDefault) {\n this.browserEvent.preventDefault();\n }\n }\n stopPropagation() {\n if (this.browserEvent && this.browserEvent.stopPropagation) {\n this.browserEvent.stopPropagation();\n }\n }\n toKeyCodeChord() {\n return this._asKeyCodeChord;\n }\n equals(other) {\n return this._asKeybinding === other;\n }\n _computeKeybinding() {\n let key = keyCodes_1.KeyCode.Unknown;\n if (this.keyCode !== keyCodes_1.KeyCode.Ctrl && this.keyCode !== keyCodes_1.KeyCode.Shift && this.keyCode !== keyCodes_1.KeyCode.Alt && this.keyCode !== keyCodes_1.KeyCode.Meta) {\n key = this.keyCode;\n }\n let result = 0;\n if (this.ctrlKey) {\n result |= ctrlKeyMod;\n }\n if (this.altKey) {\n result |= altKeyMod;\n }\n if (this.shiftKey) {\n result |= shiftKeyMod;\n }\n if (this.metaKey) {\n result |= metaKeyMod;\n }\n result |= key;\n return result;\n }\n _computeKeyCodeChord() {\n let key = keyCodes_1.KeyCode.Unknown;\n if (this.keyCode !== keyCodes_1.KeyCode.Ctrl && this.keyCode !== keyCodes_1.KeyCode.Shift && this.keyCode !== keyCodes_1.KeyCode.Alt && this.keyCode !== keyCodes_1.KeyCode.Meta) {\n key = this.keyCode;\n }\n return new keybindings_1.KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);\n }\n}\nexports.StandardKeyboardEvent = StandardKeyboardEvent;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StandardWheelEvent = exports.DragMouseEvent = exports.StandardMouseEvent = void 0;\nconst browser = __importStar(require(\"vs/base/browser/browser\"));\nconst iframe_1 = require(\"vs/base/browser/iframe\");\nconst platform = __importStar(require(\"vs/base/common/platform\"));\nclass StandardMouseEvent {\n constructor(targetWindow, e) {\n this.timestamp = Date.now();\n this.browserEvent = e;\n this.leftButton = e.button === 0;\n this.middleButton = e.button === 1;\n this.rightButton = e.button === 2;\n this.buttons = e.buttons;\n this.target = e.target;\n this.detail = e.detail || 1;\n if (e.type === 'dblclick') {\n this.detail = 2;\n }\n this.ctrlKey = e.ctrlKey;\n this.shiftKey = e.shiftKey;\n this.altKey = e.altKey;\n this.metaKey = e.metaKey;\n if (typeof e.pageX === 'number') {\n this.posx = e.pageX;\n this.posy = e.pageY;\n }\n else {\n // Probably hit by MSGestureEvent\n this.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;\n this.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;\n }\n // Find the position of the iframe this code is executing in relative to the iframe where the event was captured.\n const iframeOffsets = iframe_1.IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);\n this.posx -= iframeOffsets.left;\n this.posy -= iframeOffsets.top;\n }\n preventDefault() {\n this.browserEvent.preventDefault();\n }\n stopPropagation() {\n this.browserEvent.stopPropagation();\n }\n}\nexports.StandardMouseEvent = StandardMouseEvent;\nclass DragMouseEvent extends StandardMouseEvent {\n constructor(targetWindow, e) {\n super(targetWindow, e);\n this.dataTransfer = e.dataTransfer;\n }\n}\nexports.DragMouseEvent = DragMouseEvent;\nclass StandardWheelEvent {\n constructor(e, deltaX = 0, deltaY = 0) {\n this.browserEvent = e || null;\n this.target = e ? (e.target || e.targetNode || e.srcElement) : null;\n this.deltaY = deltaY;\n this.deltaX = deltaX;\n let shouldFactorDPR = false;\n if (browser.isChrome) {\n // Chrome version >= 123 contains the fix to factor devicePixelRatio into the wheel event.\n // See https://chromium.googlesource.com/chromium/src.git/+/be51b448441ff0c9d1f17e0f25c4bf1ab3f11f61\n const chromeVersionMatch = navigator.userAgent.match(/Chrome\\/(\\d+)/);\n const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;\n shouldFactorDPR = chromeMajorVersion <= 122;\n }\n if (e) {\n // Old (deprecated) wheel events\n const e1 = e;\n const e2 = e;\n const devicePixelRatio = e.view?.devicePixelRatio || 1;\n // vertical delta scroll\n if (typeof e1.wheelDeltaY !== 'undefined') {\n if (shouldFactorDPR) {\n // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n this.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);\n }\n else {\n this.deltaY = e1.wheelDeltaY / 120;\n }\n }\n else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {\n this.deltaY = -e2.detail / 3;\n }\n else if (e.type === 'wheel') {\n // Modern wheel event\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n const ev = e;\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\n // the deltas are expressed in lines\n if (browser.isFirefox && !platform.isMacintosh) {\n this.deltaY = -e.deltaY / 3;\n }\n else {\n this.deltaY = -e.deltaY;\n }\n }\n else {\n this.deltaY = -e.deltaY / 40;\n }\n }\n // horizontal delta scroll\n if (typeof e1.wheelDeltaX !== 'undefined') {\n if (browser.isSafari && platform.isWindows) {\n this.deltaX = -(e1.wheelDeltaX / 120);\n }\n else if (shouldFactorDPR) {\n // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n this.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);\n }\n else {\n this.deltaX = e1.wheelDeltaX / 120;\n }\n }\n else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {\n this.deltaX = -e.detail / 3;\n }\n else if (e.type === 'wheel') {\n // Modern wheel event\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n const ev = e;\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\n // the deltas are expressed in lines\n if (browser.isFirefox && !platform.isMacintosh) {\n this.deltaX = -e.deltaX / 3;\n }\n else {\n this.deltaX = -e.deltaX;\n }\n }\n else {\n this.deltaX = -e.deltaX / 40;\n }\n }\n // Assume a vertical scroll if nothing else worked\n if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {\n if (shouldFactorDPR) {\n // Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n this.deltaY = e.wheelDelta / (120 * devicePixelRatio);\n }\n else {\n this.deltaY = e.wheelDelta / 120;\n }\n }\n }\n }\n preventDefault() {\n this.browserEvent?.preventDefault();\n }\n stopPropagation() {\n this.browserEvent?.stopPropagation();\n }\n}\nexports.StandardWheelEvent = StandardWheelEvent;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Gesture = exports.EventType = void 0;\nconst DomUtils = __importStar(require(\"vs/base/browser/dom\"));\nconst window_1 = require(\"vs/base/browser/window\");\nconst arrays = __importStar(require(\"vs/base/common/arrays\"));\nconst decorators_1 = require(\"vs/base/common/decorators\");\nconst event_1 = require(\"vs/base/common/event\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nconst linkedList_1 = require(\"vs/base/common/linkedList\");\nvar EventType;\n(function (EventType) {\n EventType.Tap = '-xterm-gesturetap';\n EventType.Change = '-xterm-gesturechange';\n EventType.Start = '-xterm-gesturestart';\n EventType.End = '-xterm-gesturesend';\n EventType.Contextmenu = '-xterm-gesturecontextmenu';\n})(EventType || (exports.EventType = EventType = {}));\nclass Gesture extends lifecycle_1.Disposable {\n static { this.SCROLL_FRICTION = -0.005; }\n static { this.HOLD_DELAY = 700; }\n static { this.CLEAR_TAP_COUNT_TIME = 400; } // ms\n constructor() {\n super();\n this.dispatched = false;\n this.targets = new linkedList_1.LinkedList();\n this.ignoreTargets = new linkedList_1.LinkedList();\n this.activeTouches = {};\n this.handle = null;\n this._lastSetTapCountTime = 0;\n this._register(event_1.Event.runAndSubscribe(DomUtils.onDidRegisterWindow, ({ window, disposables }) => {\n disposables.add(DomUtils.addDisposableListener(window.document, 'touchstart', (e) => this.onTouchStart(e), { passive: false }));\n disposables.add(DomUtils.addDisposableListener(window.document, 'touchend', (e) => this.onTouchEnd(window, e)));\n disposables.add(DomUtils.addDisposableListener(window.document, 'touchmove', (e) => this.onTouchMove(e), { passive: false }));\n }, { window: window_1.mainWindow, disposables: this._store }));\n }\n static addTarget(element) {\n if (!Gesture.isTouchDevice()) {\n return lifecycle_1.Disposable.None;\n }\n if (!Gesture.INSTANCE) {\n Gesture.INSTANCE = (0, lifecycle_1.markAsSingleton)(new Gesture());\n }\n const remove = Gesture.INSTANCE.targets.push(element);\n return (0, lifecycle_1.toDisposable)(remove);\n }\n static ignoreTarget(element) {\n if (!Gesture.isTouchDevice()) {\n return lifecycle_1.Disposable.None;\n }\n if (!Gesture.INSTANCE) {\n Gesture.INSTANCE = (0, lifecycle_1.markAsSingleton)(new Gesture());\n }\n const remove = Gesture.INSTANCE.ignoreTargets.push(element);\n return (0, lifecycle_1.toDisposable)(remove);\n }\n static isTouchDevice() {\n // `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be\n // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n return 'ontouchstart' in window_1.mainWindow || navigator.maxTouchPoints > 0;\n }\n dispose() {\n if (this.handle) {\n this.handle.dispose();\n this.handle = null;\n }\n super.dispose();\n }\n onTouchStart(e) {\n const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n if (this.handle) {\n this.handle.dispose();\n this.handle = null;\n }\n for (let i = 0, len = e.targetTouches.length; i < len; i++) {\n const touch = e.targetTouches.item(i);\n this.activeTouches[touch.identifier] = {\n id: touch.identifier,\n initialTarget: touch.target,\n initialTimeStamp: timestamp,\n initialPageX: touch.pageX,\n initialPageY: touch.pageY,\n rollingTimestamps: [timestamp],\n rollingPageX: [touch.pageX],\n rollingPageY: [touch.pageY]\n };\n const evt = this.newGestureEvent(EventType.Start, touch.target);\n evt.pageX = touch.pageX;\n evt.pageY = touch.pageY;\n this.dispatchEvent(evt);\n }\n if (this.dispatched) {\n e.preventDefault();\n e.stopPropagation();\n this.dispatched = false;\n }\n }\n onTouchEnd(targetWindow, e) {\n const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n const activeTouchCount = Object.keys(this.activeTouches).length;\n for (let i = 0, len = e.changedTouches.length; i < len; i++) {\n const touch = e.changedTouches.item(i);\n if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n console.warn('move of an UNKNOWN touch', touch);\n continue;\n }\n const data = this.activeTouches[touch.identifier], holdTime = Date.now() - data.initialTimeStamp;\n if (holdTime < Gesture.HOLD_DELAY\n && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30\n && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {\n const evt = this.newGestureEvent(EventType.Tap, data.initialTarget);\n evt.pageX = arrays.tail(data.rollingPageX);\n evt.pageY = arrays.tail(data.rollingPageY);\n this.dispatchEvent(evt);\n }\n else if (holdTime >= Gesture.HOLD_DELAY\n && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30\n && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {\n const evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget);\n evt.pageX = arrays.tail(data.rollingPageX);\n evt.pageY = arrays.tail(data.rollingPageY);\n this.dispatchEvent(evt);\n }\n else if (activeTouchCount === 1) {\n const finalX = arrays.tail(data.rollingPageX);\n const finalY = arrays.tail(data.rollingPageY);\n const deltaT = arrays.tail(data.rollingTimestamps) - data.rollingTimestamps[0];\n const deltaX = finalX - data.rollingPageX[0];\n const deltaY = finalY - data.rollingPageY[0];\n // We need to get all the dispatch targets on the start of the inertia event\n const dispatchTo = [...this.targets].filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget));\n this.inertia(targetWindow, dispatchTo, timestamp, // time now\n Math.abs(deltaX) / deltaT, // speed\n deltaX > 0 ? 1 : -1, // x direction\n finalX, // x now\n Math.abs(deltaY) / deltaT, // y speed\n deltaY > 0 ? 1 : -1, // y direction\n finalY // y now\n );\n }\n this.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget));\n // forget about this touch\n delete this.activeTouches[touch.identifier];\n }\n if (this.dispatched) {\n e.preventDefault();\n e.stopPropagation();\n this.dispatched = false;\n }\n }\n newGestureEvent(type, initialTarget) {\n const event = document.createEvent('CustomEvent');\n event.initEvent(type, false, true);\n event.initialTarget = initialTarget;\n event.tapCount = 0;\n return event;\n }\n dispatchEvent(event) {\n if (event.type === EventType.Tap) {\n const currentTime = (new Date()).getTime();\n let setTapCount = 0;\n if (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) {\n setTapCount = 1;\n }\n else {\n setTapCount = 2;\n }\n this._lastSetTapCountTime = currentTime;\n event.tapCount = setTapCount;\n }\n else if (event.type === EventType.Change || event.type === EventType.Contextmenu) {\n // tap is canceled by scrolling or context menu\n this._lastSetTapCountTime = 0;\n }\n if (event.initialTarget instanceof Node) {\n for (const ignoreTarget of this.ignoreTargets) {\n if (ignoreTarget.contains(event.initialTarget)) {\n return;\n }\n }\n const targets = [];\n for (const target of this.targets) {\n if (target.contains(event.initialTarget)) {\n let depth = 0;\n let now = event.initialTarget;\n while (now && now !== target) {\n depth++;\n now = now.parentElement;\n }\n targets.push([depth, target]);\n }\n }\n targets.sort((a, b) => a[0] - b[0]);\n for (const [_, target] of targets) {\n target.dispatchEvent(event);\n this.dispatched = true;\n }\n }\n }\n inertia(targetWindow, dispatchTo, t1, vX, dirX, x, vY, dirY, y) {\n this.handle = DomUtils.scheduleAtNextAnimationFrame(targetWindow, () => {\n const now = Date.now();\n // velocity: old speed + accel_over_time\n const deltaT = now - t1;\n let delta_pos_x = 0, delta_pos_y = 0;\n let stopped = true;\n vX += Gesture.SCROLL_FRICTION * deltaT;\n vY += Gesture.SCROLL_FRICTION * deltaT;\n if (vX > 0) {\n stopped = false;\n delta_pos_x = dirX * vX * deltaT;\n }\n if (vY > 0) {\n stopped = false;\n delta_pos_y = dirY * vY * deltaT;\n }\n // dispatch translation event\n const evt = this.newGestureEvent(EventType.Change);\n evt.translationX = delta_pos_x;\n evt.translationY = delta_pos_y;\n dispatchTo.forEach(d => d.dispatchEvent(evt));\n if (!stopped) {\n this.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);\n }\n });\n }\n onTouchMove(e) {\n const timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n for (let i = 0, len = e.changedTouches.length; i < len; i++) {\n const touch = e.changedTouches.item(i);\n if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n console.warn('end of an UNKNOWN touch', touch);\n continue;\n }\n const data = this.activeTouches[touch.identifier];\n const evt = this.newGestureEvent(EventType.Change, data.initialTarget);\n evt.translationX = touch.pageX - arrays.tail(data.rollingPageX);\n evt.translationY = touch.pageY - arrays.tail(data.rollingPageY);\n evt.pageX = touch.pageX;\n evt.pageY = touch.pageY;\n this.dispatchEvent(evt);\n // only keep a few data points, to average the final speed\n if (data.rollingPageX.length > 3) {\n data.rollingPageX.shift();\n data.rollingPageY.shift();\n data.rollingTimestamps.shift();\n }\n data.rollingPageX.push(touch.pageX);\n data.rollingPageY.push(touch.pageY);\n data.rollingTimestamps.push(timestamp);\n }\n if (this.dispatched) {\n e.preventDefault();\n e.stopPropagation();\n this.dispatched = false;\n }\n }\n}\nexports.Gesture = Gesture;\n__decorate([\n decorators_1.memoize\n], Gesture, \"isTouchDevice\", null);\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbstractScrollbar = void 0;\nconst dom = __importStar(require(\"vs/base/browser/dom\"));\nconst fastDomNode_1 = require(\"vs/base/browser/fastDomNode\");\nconst globalPointerMoveMonitor_1 = require(\"vs/base/browser/globalPointerMoveMonitor\");\nconst scrollbarArrow_1 = require(\"vs/base/browser/ui/scrollbar/scrollbarArrow\");\nconst scrollbarVisibilityController_1 = require(\"vs/base/browser/ui/scrollbar/scrollbarVisibilityController\");\nconst widget_1 = require(\"vs/base/browser/ui/widget\");\nconst platform = __importStar(require(\"vs/base/common/platform\"));\n/**\n * The orthogonal distance to the slider at which dragging \"resets\". This implements \"snapping\"\n */\nconst POINTER_DRAG_RESET_DISTANCE = 140;\nclass AbstractScrollbar extends widget_1.Widget {\n constructor(opts) {\n super();\n this._lazyRender = opts.lazyRender;\n this._host = opts.host;\n this._scrollable = opts.scrollable;\n this._scrollByPage = opts.scrollByPage;\n this._scrollbarState = opts.scrollbarState;\n this._visibilityController = this._register(new scrollbarVisibilityController_1.ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName));\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._pointerMoveMonitor = this._register(new globalPointerMoveMonitor_1.GlobalPointerMoveMonitor());\n this._shouldRender = true;\n this.domNode = (0, fastDomNode_1.createFastDomNode)(document.createElement('div'));\n this.domNode.setAttribute('role', 'presentation');\n this.domNode.setAttribute('aria-hidden', 'true');\n this._visibilityController.setDomNode(this.domNode);\n this.domNode.setPosition('absolute');\n this._register(dom.addDisposableListener(this.domNode.domNode, dom.EventType.POINTER_DOWN, (e) => this._domNodePointerDown(e)));\n }\n // ----------------- creation\n /**\n * Creates the dom node for an arrow & adds it to the container\n */\n _createArrow(opts) {\n const arrow = this._register(new scrollbarArrow_1.ScrollbarArrow(opts));\n this.domNode.domNode.appendChild(arrow.bgDomNode);\n this.domNode.domNode.appendChild(arrow.domNode);\n }\n /**\n * Creates the slider dom node, adds it to the container & hooks up the events\n */\n _createSlider(top, left, width, height) {\n this.slider = (0, fastDomNode_1.createFastDomNode)(document.createElement('div'));\n this.slider.setClassName('slider');\n this.slider.setPosition('absolute');\n this.slider.setTop(top);\n this.slider.setLeft(left);\n if (typeof width === 'number') {\n this.slider.setWidth(width);\n }\n if (typeof height === 'number') {\n this.slider.setHeight(height);\n }\n this.slider.setLayerHinting(true);\n this.slider.setContain('strict');\n this.domNode.domNode.appendChild(this.slider.domNode);\n this._register(dom.addDisposableListener(this.slider.domNode, dom.EventType.POINTER_DOWN, (e) => {\n if (e.button === 0) {\n e.preventDefault();\n this._sliderPointerDown(e);\n }\n }));\n this.onclick(this.slider.domNode, e => {\n if (e.leftButton) {\n e.stopPropagation();\n }\n });\n }\n // ----------------- Update state\n _onElementSize(visibleSize) {\n if (this._scrollbarState.setVisibleSize(visibleSize)) {\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n return this._shouldRender;\n }\n _onElementScrollSize(elementScrollSize) {\n if (this._scrollbarState.setScrollSize(elementScrollSize)) {\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n return this._shouldRender;\n }\n _onElementScrollPosition(elementScrollPosition) {\n if (this._scrollbarState.setScrollPosition(elementScrollPosition)) {\n this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n return this._shouldRender;\n }\n // ----------------- rendering\n beginReveal() {\n this._visibilityController.setShouldBeVisible(true);\n }\n beginHide() {\n this._visibilityController.setShouldBeVisible(false);\n }\n render() {\n if (!this._shouldRender) {\n return;\n }\n this._shouldRender = false;\n this._renderDomNode(this._scrollbarState.getRectangleLargeSize(), this._scrollbarState.getRectangleSmallSize());\n this._updateSlider(this._scrollbarState.getSliderSize(), this._scrollbarState.getArrowSize() + this._scrollbarState.getSliderPosition());\n }\n // ----------------- DOM events\n _domNodePointerDown(e) {\n if (e.target !== this.domNode.domNode) {\n return;\n }\n this._onPointerDown(e);\n }\n delegatePointerDown(e) {\n const domTop = this.domNode.domNode.getClientRects()[0].top;\n const sliderStart = domTop + this._scrollbarState.getSliderPosition();\n const sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize();\n const pointerPos = this._sliderPointerPosition(e);\n if (sliderStart <= pointerPos && pointerPos <= sliderStop) {\n // Act as if it was a pointer down on the slider\n if (e.button === 0) {\n e.preventDefault();\n this._sliderPointerDown(e);\n }\n }\n else {\n // Act as if it was a pointer down on the scrollbar\n this._onPointerDown(e);\n }\n }\n _onPointerDown(e) {\n let offsetX;\n let offsetY;\n if (e.target === this.domNode.domNode && typeof e.offsetX === 'number' && typeof e.offsetY === 'number') {\n offsetX = e.offsetX;\n offsetY = e.offsetY;\n }\n else {\n const domNodePosition = dom.getDomNodePagePosition(this.domNode.domNode);\n offsetX = e.pageX - domNodePosition.left;\n offsetY = e.pageY - domNodePosition.top;\n }\n const offset = this._pointerDownRelativePosition(offsetX, offsetY);\n this._setDesiredScrollPositionNow(this._scrollByPage\n ? this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(offset)\n : this._scrollbarState.getDesiredScrollPositionFromOffset(offset));\n if (e.button === 0) {\n // left button\n e.preventDefault();\n this._sliderPointerDown(e);\n }\n }\n _sliderPointerDown(e) {\n if (!e.target || !(e.target instanceof Element)) {\n return;\n }\n const initialPointerPosition = this._sliderPointerPosition(e);\n const initialPointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(e);\n const initialScrollbarState = this._scrollbarState.clone();\n this.slider.toggleClassName('active', true);\n this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => {\n const pointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(pointerMoveData);\n const pointerOrthogonalDelta = Math.abs(pointerOrthogonalPosition - initialPointerOrthogonalPosition);\n if (platform.isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE) {\n // The pointer has wondered away from the scrollbar => reset dragging\n this._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition());\n return;\n }\n const pointerPosition = this._sliderPointerPosition(pointerMoveData);\n const pointerDelta = pointerPosition - initialPointerPosition;\n this._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(pointerDelta));\n }, () => {\n this.slider.toggleClassName('active', false);\n this._host.onDragEnd();\n });\n this._host.onDragStart();\n }\n _setDesiredScrollPositionNow(_desiredScrollPosition) {\n const desiredScrollPosition = {};\n this.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition);\n this._scrollable.setScrollPositionNow(desiredScrollPosition);\n }\n updateScrollbarSize(scrollbarSize) {\n this._updateScrollbarSize(scrollbarSize);\n this._scrollbarState.setScrollbarSize(scrollbarSize);\n this._shouldRender = true;\n if (!this._lazyRender) {\n this.render();\n }\n }\n isNeeded() {\n return this._scrollbarState.isNeeded();\n }\n}\nexports.AbstractScrollbar = AbstractScrollbar;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HorizontalScrollbar = void 0;\nconst abstractScrollbar_1 = require(\"vs/base/browser/ui/scrollbar/abstractScrollbar\");\nconst scrollbarState_1 = require(\"vs/base/browser/ui/scrollbar/scrollbarState\");\nconst scrollable_1 = require(\"vs/base/common/scrollable\");\nclass HorizontalScrollbar extends abstractScrollbar_1.AbstractScrollbar {\n constructor(scrollable, options, host) {\n const scrollDimensions = scrollable.getScrollDimensions();\n const scrollPosition = scrollable.getCurrentScrollPosition();\n super({\n lazyRender: options.lazyRender,\n host: host,\n scrollbarState: new scrollbarState_1.ScrollbarState((options.horizontalHasArrows ? options.arrowSize : 0), (options.horizontal === scrollable_1.ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize), (options.vertical === scrollable_1.ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize), scrollDimensions.width, scrollDimensions.scrollWidth, scrollPosition.scrollLeft),\n visibility: options.horizontal,\n extraScrollbarClassName: 'horizontal',\n scrollable: scrollable,\n scrollByPage: options.scrollByPage\n });\n if (options.horizontalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n // const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n // const scrollbarDelta = (options.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2;\n // this._createArrow({\n // \tclassName: 'scra',\n // \ticon: Codicon.scrollbarButtonLeft,\n // \ttop: scrollbarDelta,\n // \tleft: arrowDelta,\n // \tbottom: undefined,\n // \tright: undefined,\n // \tbgWidth: options.arrowSize,\n // \tbgHeight: options.horizontalScrollbarSize,\n // \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 1, 0)),\n // });\n // this._createArrow({\n // \tclassName: 'scra',\n // \ticon: Codicon.scrollbarButtonRight,\n // \ttop: scrollbarDelta,\n // \tleft: undefined,\n // \tbottom: undefined,\n // \tright: arrowDelta,\n // \tbgWidth: options.arrowSize,\n // \tbgHeight: options.horizontalScrollbarSize,\n // \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, -1, 0)),\n // });\n }\n this._createSlider(Math.floor((options.horizontalScrollbarSize - options.horizontalSliderSize) / 2), 0, undefined, options.horizontalSliderSize);\n }\n _updateSlider(sliderSize, sliderPosition) {\n this.slider.setWidth(sliderSize);\n this.slider.setLeft(sliderPosition);\n }\n _renderDomNode(largeSize, smallSize) {\n this.domNode.setWidth(largeSize);\n this.domNode.setHeight(smallSize);\n this.domNode.setLeft(0);\n this.domNode.setBottom(0);\n }\n onDidScroll(e) {\n this._shouldRender = this._onElementScrollSize(e.scrollWidth) || this._shouldRender;\n this._shouldRender = this._onElementScrollPosition(e.scrollLeft) || this._shouldRender;\n this._shouldRender = this._onElementSize(e.width) || this._shouldRender;\n return this._shouldRender;\n }\n _pointerDownRelativePosition(offsetX, offsetY) {\n return offsetX;\n }\n _sliderPointerPosition(e) {\n return e.pageX;\n }\n _sliderOrthogonalPointerPosition(e) {\n return e.pageY;\n }\n _updateScrollbarSize(size) {\n this.slider.setHeight(size);\n }\n writeScrollPosition(target, scrollPosition) {\n target.scrollLeft = scrollPosition;\n }\n updateOptions(options) {\n this.updateScrollbarSize(options.horizontal === scrollable_1.ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize);\n this._scrollbarState.setOppositeScrollbarSize(options.vertical === scrollable_1.ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n this._visibilityController.setVisibility(options.horizontal);\n this._scrollByPage = options.scrollByPage;\n }\n}\nexports.HorizontalScrollbar = HorizontalScrollbar;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DomScrollableElement = exports.SmoothScrollableElement = exports.ScrollableElement = exports.AbstractScrollableElement = exports.MouseWheelClassifier = void 0;\nconst browser_1 = require(\"vs/base/browser/browser\");\nconst dom = __importStar(require(\"vs/base/browser/dom\"));\nconst fastDomNode_1 = require(\"vs/base/browser/fastDomNode\");\nconst mouseEvent_1 = require(\"vs/base/browser/mouseEvent\");\nconst horizontalScrollbar_1 = require(\"vs/base/browser/ui/scrollbar/horizontalScrollbar\");\nconst verticalScrollbar_1 = require(\"vs/base/browser/ui/scrollbar/verticalScrollbar\");\nconst widget_1 = require(\"vs/base/browser/ui/widget\");\nconst async_1 = require(\"vs/base/common/async\");\nconst event_1 = require(\"vs/base/common/event\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nconst platform = __importStar(require(\"vs/base/common/platform\"));\nconst scrollable_1 = require(\"vs/base/common/scrollable\");\n// import 'vs/css!./media/scrollbars';\nconst HIDE_TIMEOUT = 500;\nconst SCROLL_WHEEL_SENSITIVITY = 50;\nconst SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true;\nclass MouseWheelClassifierItem {\n constructor(timestamp, deltaX, deltaY) {\n this.timestamp = timestamp;\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n this.score = 0;\n }\n}\nclass MouseWheelClassifier {\n static { this.INSTANCE = new MouseWheelClassifier(); }\n constructor() {\n this._capacity = 5;\n this._memory = [];\n this._front = -1;\n this._rear = -1;\n }\n isPhysicalMouseWheel() {\n if (this._front === -1 && this._rear === -1) {\n // no elements\n return false;\n }\n // 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ...\n let remainingInfluence = 1;\n let score = 0;\n let iteration = 1;\n let index = this._rear;\n do {\n const influence = (index === this._front ? remainingInfluence : Math.pow(2, -iteration));\n remainingInfluence -= influence;\n score += this._memory[index].score * influence;\n if (index === this._front) {\n break;\n }\n index = (this._capacity + index - 1) % this._capacity;\n iteration++;\n } while (true);\n return (score <= 0.5);\n }\n acceptStandardWheelEvent(e) {\n if (browser_1.isChrome) {\n const targetWindow = dom.getWindow(e.browserEvent);\n const pageZoomFactor = (0, browser_1.getZoomFactor)(targetWindow);\n // On Chrome, the incoming delta events are multiplied with the OS zoom factor.\n // The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account.\n this.accept(Date.now(), e.deltaX * pageZoomFactor, e.deltaY * pageZoomFactor);\n }\n else {\n this.accept(Date.now(), e.deltaX, e.deltaY);\n }\n }\n accept(timestamp, deltaX, deltaY) {\n let previousItem = null;\n const item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY);\n if (this._front === -1 && this._rear === -1) {\n this._memory[0] = item;\n this._front = 0;\n this._rear = 0;\n }\n else {\n previousItem = this._memory[this._rear];\n this._rear = (this._rear + 1) % this._capacity;\n if (this._rear === this._front) {\n // Drop oldest\n this._front = (this._front + 1) % this._capacity;\n }\n this._memory[this._rear] = item;\n }\n item.score = this._computeScore(item, previousItem);\n }\n /**\n * A score between 0 and 1 for `item`.\n * - a score towards 0 indicates that the source appears to be a physical mouse wheel\n * - a score towards 1 indicates that the source appears to be a touchpad or magic mouse, etc.\n */\n _computeScore(item, previousItem) {\n if (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) {\n // both axes exercised => definitely not a physical mouse wheel\n return 1;\n }\n let score = 0.5;\n if (!this._isAlmostInt(item.deltaX) || !this._isAlmostInt(item.deltaY)) {\n // non-integer deltas => indicator that this is not a physical mouse wheel\n score += 0.25;\n }\n // Non-accelerating scroll => indicator that this is a physical mouse wheel\n // These can be identified by seeing whether they are the module of one another.\n if (previousItem) {\n const absDeltaX = Math.abs(item.deltaX);\n const absDeltaY = Math.abs(item.deltaY);\n const absPreviousDeltaX = Math.abs(previousItem.deltaX);\n const absPreviousDeltaY = Math.abs(previousItem.deltaY);\n // Min 1 to avoid division by zero, module 1 will still be 0.\n const minDeltaX = Math.max(Math.min(absDeltaX, absPreviousDeltaX), 1);\n const minDeltaY = Math.max(Math.min(absDeltaY, absPreviousDeltaY), 1);\n const maxDeltaX = Math.max(absDeltaX, absPreviousDeltaX);\n const maxDeltaY = Math.max(absDeltaY, absPreviousDeltaY);\n const isSameModulo = (maxDeltaX % minDeltaX === 0 && maxDeltaY % minDeltaY === 0);\n if (isSameModulo) {\n score -= 0.5;\n }\n }\n return Math.min(Math.max(score, 0), 1);\n }\n _isAlmostInt(value) {\n const delta = Math.abs(Math.round(value) - value);\n return (delta < 0.01);\n }\n}\nexports.MouseWheelClassifier = MouseWheelClassifier;\nclass AbstractScrollableElement extends widget_1.Widget {\n get options() {\n return this._options;\n }\n constructor(element, options, scrollable) {\n super();\n this._onScroll = this._register(new event_1.Emitter());\n this.onScroll = this._onScroll.event;\n this._onWillScroll = this._register(new event_1.Emitter());\n this.onWillScroll = this._onWillScroll.event;\n // HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n // element.style.overflow = 'hidden';\n this._options = resolveOptions(options);\n this._scrollable = scrollable;\n this._register(this._scrollable.onScroll((e) => {\n this._onWillScroll.fire(e);\n this._onDidScroll(e);\n this._onScroll.fire(e);\n }));\n const scrollbarHost = {\n onMouseWheel: (mouseWheelEvent) => this._onMouseWheel(mouseWheelEvent),\n onDragStart: () => this._onDragStart(),\n onDragEnd: () => this._onDragEnd(),\n };\n this._verticalScrollbar = this._register(new verticalScrollbar_1.VerticalScrollbar(this._scrollable, this._options, scrollbarHost));\n this._horizontalScrollbar = this._register(new horizontalScrollbar_1.HorizontalScrollbar(this._scrollable, this._options, scrollbarHost));\n this._domNode = document.createElement('div');\n this._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n this._domNode.setAttribute('role', 'presentation');\n this._domNode.style.position = 'relative';\n // HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n // this._domNode.style.overflow = 'hidden';\n this._domNode.appendChild(element);\n this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode);\n this._domNode.appendChild(this._verticalScrollbar.domNode.domNode);\n if (this._options.useShadows) {\n this._leftShadowDomNode = (0, fastDomNode_1.createFastDomNode)(document.createElement('div'));\n this._leftShadowDomNode.setClassName('shadow');\n this._domNode.appendChild(this._leftShadowDomNode.domNode);\n this._topShadowDomNode = (0, fastDomNode_1.createFastDomNode)(document.createElement('div'));\n this._topShadowDomNode.setClassName('shadow');\n this._domNode.appendChild(this._topShadowDomNode.domNode);\n this._topLeftShadowDomNode = (0, fastDomNode_1.createFastDomNode)(document.createElement('div'));\n this._topLeftShadowDomNode.setClassName('shadow');\n this._domNode.appendChild(this._topLeftShadowDomNode.domNode);\n }\n else {\n this._leftShadowDomNode = null;\n this._topShadowDomNode = null;\n this._topLeftShadowDomNode = null;\n }\n this._listenOnDomNode = this._options.listenOnDomNode || this._domNode;\n this._mouseWheelToDispose = [];\n this._setListeningToMouseWheel(this._options.handleMouseWheel);\n this.onmouseover(this._listenOnDomNode, (e) => this._onMouseOver(e));\n this.onmouseleave(this._listenOnDomNode, (e) => this._onMouseLeave(e));\n this._hideTimeout = this._register(new async_1.TimeoutTimer());\n this._isDragging = false;\n this._mouseIsOver = false;\n this._shouldRender = true;\n this._revealOnScroll = true;\n }\n dispose() {\n this._mouseWheelToDispose = (0, lifecycle_1.dispose)(this._mouseWheelToDispose);\n super.dispose();\n }\n /**\n * Get the generated 'scrollable' dom node\n */\n getDomNode() {\n return this._domNode;\n }\n getOverviewRulerLayoutInfo() {\n return {\n parent: this._domNode,\n insertBefore: this._verticalScrollbar.domNode.domNode,\n };\n }\n /**\n * Delegate a pointer down event to the vertical scrollbar.\n * This is to help with clicking somewhere else and having the scrollbar react.\n */\n delegateVerticalScrollbarPointerDown(browserEvent) {\n this._verticalScrollbar.delegatePointerDown(browserEvent);\n }\n getScrollDimensions() {\n return this._scrollable.getScrollDimensions();\n }\n setScrollDimensions(dimensions) {\n this._scrollable.setScrollDimensions(dimensions, false);\n }\n /**\n * Update the class name of the scrollable element.\n */\n updateClassName(newClassName) {\n this._options.className = newClassName;\n // Defaults are different on Macs\n if (platform.isMacintosh) {\n this._options.className += ' mac';\n }\n this._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n }\n /**\n * Update configuration options for the scrollbar.\n */\n updateOptions(newOptions) {\n if (typeof newOptions.handleMouseWheel !== 'undefined') {\n this._options.handleMouseWheel = newOptions.handleMouseWheel;\n this._setListeningToMouseWheel(this._options.handleMouseWheel);\n }\n if (typeof newOptions.mouseWheelScrollSensitivity !== 'undefined') {\n this._options.mouseWheelScrollSensitivity = newOptions.mouseWheelScrollSensitivity;\n }\n if (typeof newOptions.fastScrollSensitivity !== 'undefined') {\n this._options.fastScrollSensitivity = newOptions.fastScrollSensitivity;\n }\n if (typeof newOptions.scrollPredominantAxis !== 'undefined') {\n this._options.scrollPredominantAxis = newOptions.scrollPredominantAxis;\n }\n if (typeof newOptions.horizontal !== 'undefined') {\n this._options.horizontal = newOptions.horizontal;\n }\n if (typeof newOptions.vertical !== 'undefined') {\n this._options.vertical = newOptions.vertical;\n }\n if (typeof newOptions.horizontalScrollbarSize !== 'undefined') {\n this._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize;\n }\n if (typeof newOptions.verticalScrollbarSize !== 'undefined') {\n this._options.verticalScrollbarSize = newOptions.verticalScrollbarSize;\n }\n if (typeof newOptions.scrollByPage !== 'undefined') {\n this._options.scrollByPage = newOptions.scrollByPage;\n }\n this._horizontalScrollbar.updateOptions(this._options);\n this._verticalScrollbar.updateOptions(this._options);\n if (!this._options.lazyRender) {\n this._render();\n }\n }\n setRevealOnScroll(value) {\n this._revealOnScroll = value;\n }\n delegateScrollFromMouseWheelEvent(browserEvent) {\n this._onMouseWheel(new mouseEvent_1.StandardWheelEvent(browserEvent));\n }\n // -------------------- mouse wheel scrolling --------------------\n _setListeningToMouseWheel(shouldListen) {\n const isListening = (this._mouseWheelToDispose.length > 0);\n if (isListening === shouldListen) {\n // No change\n return;\n }\n // Stop listening (if necessary)\n this._mouseWheelToDispose = (0, lifecycle_1.dispose)(this._mouseWheelToDispose);\n // Start listening (if necessary)\n if (shouldListen) {\n const onMouseWheel = (browserEvent) => {\n this._onMouseWheel(new mouseEvent_1.StandardWheelEvent(browserEvent));\n };\n this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { passive: false }));\n }\n }\n _onMouseWheel(e) {\n if (e.browserEvent?.defaultPrevented) {\n return;\n }\n const classifier = MouseWheelClassifier.INSTANCE;\n if (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) {\n classifier.acceptStandardWheelEvent(e);\n }\n // useful for creating unit tests:\n // console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`);\n let didScroll = false;\n if (e.deltaY || e.deltaX) {\n let deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity;\n let deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity;\n if (this._options.scrollPredominantAxis) {\n if (this._options.scrollYToX && deltaX + deltaY === 0) {\n // when configured to map Y to X and we both see\n // no dominant axis and X and Y are competing with\n // identical values into opposite directions, we\n // ignore the delta as we cannot make a decision then\n deltaX = deltaY = 0;\n }\n else if (Math.abs(deltaY) >= Math.abs(deltaX)) {\n deltaX = 0;\n }\n else {\n deltaY = 0;\n }\n }\n if (this._options.flipAxes) {\n [deltaY, deltaX] = [deltaX, deltaY];\n }\n // Convert vertical scrolling to horizontal if shift is held, this\n // is handled at a higher level on Mac\n const shiftConvert = !platform.isMacintosh && e.browserEvent && e.browserEvent.shiftKey;\n if ((this._options.scrollYToX || shiftConvert) && !deltaX) {\n deltaX = deltaY;\n deltaY = 0;\n }\n if (e.browserEvent && e.browserEvent.altKey) {\n // fastScrolling\n deltaX = deltaX * this._options.fastScrollSensitivity;\n deltaY = deltaY * this._options.fastScrollSensitivity;\n }\n const futureScrollPosition = this._scrollable.getFutureScrollPosition();\n let desiredScrollPosition = {};\n if (deltaY) {\n const deltaScrollTop = SCROLL_WHEEL_SENSITIVITY * deltaY;\n // Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n const desiredScrollTop = futureScrollPosition.scrollTop - (deltaScrollTop < 0 ? Math.floor(deltaScrollTop) : Math.ceil(deltaScrollTop));\n this._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop);\n }\n if (deltaX) {\n const deltaScrollLeft = SCROLL_WHEEL_SENSITIVITY * deltaX;\n // Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n const desiredScrollLeft = futureScrollPosition.scrollLeft - (deltaScrollLeft < 0 ? Math.floor(deltaScrollLeft) : Math.ceil(deltaScrollLeft));\n this._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft);\n }\n // Check that we are scrolling towards a location which is valid\n desiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition);\n if (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) {\n const canPerformSmoothScroll = (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED\n && this._options.mouseWheelSmoothScroll\n && classifier.isPhysicalMouseWheel());\n if (canPerformSmoothScroll) {\n this._scrollable.setScrollPositionSmooth(desiredScrollPosition);\n }\n else {\n this._scrollable.setScrollPositionNow(desiredScrollPosition);\n }\n didScroll = true;\n }\n }\n let consumeMouseWheel = didScroll;\n if (!consumeMouseWheel && this._options.alwaysConsumeMouseWheel) {\n consumeMouseWheel = true;\n }\n if (!consumeMouseWheel && this._options.consumeMouseWheelIfScrollbarIsNeeded && (this._verticalScrollbar.isNeeded() || this._horizontalScrollbar.isNeeded())) {\n consumeMouseWheel = true;\n }\n if (consumeMouseWheel) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n _onDidScroll(e) {\n this._shouldRender = this._horizontalScrollbar.onDidScroll(e) || this._shouldRender;\n this._shouldRender = this._verticalScrollbar.onDidScroll(e) || this._shouldRender;\n if (this._options.useShadows) {\n this._shouldRender = true;\n }\n if (this._revealOnScroll) {\n this._reveal();\n }\n if (!this._options.lazyRender) {\n this._render();\n }\n }\n /**\n * Render / mutate the DOM now.\n * Should be used together with the ctor option `lazyRender`.\n */\n renderNow() {\n if (!this._options.lazyRender) {\n throw new Error('Please use `lazyRender` together with `renderNow`!');\n }\n this._render();\n }\n _render() {\n if (!this._shouldRender) {\n return;\n }\n this._shouldRender = false;\n this._horizontalScrollbar.render();\n this._verticalScrollbar.render();\n if (this._options.useShadows) {\n const scrollState = this._scrollable.getCurrentScrollPosition();\n const enableTop = scrollState.scrollTop > 0;\n const enableLeft = scrollState.scrollLeft > 0;\n const leftClassName = (enableLeft ? ' left' : '');\n const topClassName = (enableTop ? ' top' : '');\n const topLeftClassName = (enableLeft || enableTop ? ' top-left-corner' : '');\n this._leftShadowDomNode.setClassName(`shadow${leftClassName}`);\n this._topShadowDomNode.setClassName(`shadow${topClassName}`);\n this._topLeftShadowDomNode.setClassName(`shadow${topLeftClassName}${topClassName}${leftClassName}`);\n }\n }\n // -------------------- fade in / fade out --------------------\n _onDragStart() {\n this._isDragging = true;\n this._reveal();\n }\n _onDragEnd() {\n this._isDragging = false;\n this._hide();\n }\n _onMouseLeave(e) {\n this._mouseIsOver = false;\n this._hide();\n }\n _onMouseOver(e) {\n this._mouseIsOver = true;\n this._reveal();\n }\n _reveal() {\n this._verticalScrollbar.beginReveal();\n this._horizontalScrollbar.beginReveal();\n this._scheduleHide();\n }\n _hide() {\n if (!this._mouseIsOver && !this._isDragging) {\n this._verticalScrollbar.beginHide();\n this._horizontalScrollbar.beginHide();\n }\n }\n _scheduleHide() {\n if (!this._mouseIsOver && !this._isDragging) {\n this._hideTimeout.cancelAndSet(() => this._hide(), HIDE_TIMEOUT);\n }\n }\n}\nexports.AbstractScrollableElement = AbstractScrollableElement;\nclass ScrollableElement extends AbstractScrollableElement {\n constructor(element, options) {\n options = options || {};\n options.mouseWheelSmoothScroll = false;\n const scrollable = new scrollable_1.Scrollable({\n forceIntegerValues: true,\n smoothScrollDuration: 0,\n scheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n });\n super(element, options, scrollable);\n this._register(scrollable);\n }\n setScrollPosition(update) {\n this._scrollable.setScrollPositionNow(update);\n }\n getScrollPosition() {\n return this._scrollable.getCurrentScrollPosition();\n }\n}\nexports.ScrollableElement = ScrollableElement;\nclass SmoothScrollableElement extends AbstractScrollableElement {\n constructor(element, options, scrollable) {\n super(element, options, scrollable);\n }\n setScrollPosition(update) {\n if (update.reuseAnimation) {\n this._scrollable.setScrollPositionSmooth(update, update.reuseAnimation);\n }\n else {\n this._scrollable.setScrollPositionNow(update);\n }\n }\n getScrollPosition() {\n return this._scrollable.getCurrentScrollPosition();\n }\n}\nexports.SmoothScrollableElement = SmoothScrollableElement;\nclass DomScrollableElement extends AbstractScrollableElement {\n constructor(element, options) {\n options = options || {};\n options.mouseWheelSmoothScroll = false;\n const scrollable = new scrollable_1.Scrollable({\n forceIntegerValues: false, // See https://github.com/microsoft/vscode/issues/139877\n smoothScrollDuration: 0,\n scheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n });\n super(element, options, scrollable);\n this._register(scrollable);\n this._element = element;\n this._register(this.onScroll((e) => {\n if (e.scrollTopChanged) {\n this._element.scrollTop = e.scrollTop;\n }\n if (e.scrollLeftChanged) {\n this._element.scrollLeft = e.scrollLeft;\n }\n }));\n this.scanDomNode();\n }\n setScrollPosition(update) {\n this._scrollable.setScrollPositionNow(update);\n }\n getScrollPosition() {\n return this._scrollable.getCurrentScrollPosition();\n }\n scanDomNode() {\n // width, scrollLeft, scrollWidth, height, scrollTop, scrollHeight\n this.setScrollDimensions({\n width: this._element.clientWidth,\n scrollWidth: this._element.scrollWidth,\n height: this._element.clientHeight,\n scrollHeight: this._element.scrollHeight\n });\n this.setScrollPosition({\n scrollLeft: this._element.scrollLeft,\n scrollTop: this._element.scrollTop,\n });\n }\n}\nexports.DomScrollableElement = DomScrollableElement;\nfunction resolveOptions(opts) {\n const result = {\n lazyRender: (typeof opts.lazyRender !== 'undefined' ? opts.lazyRender : false),\n className: (typeof opts.className !== 'undefined' ? opts.className : ''),\n useShadows: (typeof opts.useShadows !== 'undefined' ? opts.useShadows : true),\n handleMouseWheel: (typeof opts.handleMouseWheel !== 'undefined' ? opts.handleMouseWheel : true),\n flipAxes: (typeof opts.flipAxes !== 'undefined' ? opts.flipAxes : false),\n consumeMouseWheelIfScrollbarIsNeeded: (typeof opts.consumeMouseWheelIfScrollbarIsNeeded !== 'undefined' ? opts.consumeMouseWheelIfScrollbarIsNeeded : false),\n alwaysConsumeMouseWheel: (typeof opts.alwaysConsumeMouseWheel !== 'undefined' ? opts.alwaysConsumeMouseWheel : false),\n scrollYToX: (typeof opts.scrollYToX !== 'undefined' ? opts.scrollYToX : false),\n mouseWheelScrollSensitivity: (typeof opts.mouseWheelScrollSensitivity !== 'undefined' ? opts.mouseWheelScrollSensitivity : 1),\n fastScrollSensitivity: (typeof opts.fastScrollSensitivity !== 'undefined' ? opts.fastScrollSensitivity : 5),\n scrollPredominantAxis: (typeof opts.scrollPredominantAxis !== 'undefined' ? opts.scrollPredominantAxis : true),\n mouseWheelSmoothScroll: (typeof opts.mouseWheelSmoothScroll !== 'undefined' ? opts.mouseWheelSmoothScroll : true),\n arrowSize: (typeof opts.arrowSize !== 'undefined' ? opts.arrowSize : 11),\n listenOnDomNode: (typeof opts.listenOnDomNode !== 'undefined' ? opts.listenOnDomNode : null),\n horizontal: (typeof opts.horizontal !== 'undefined' ? opts.horizontal : scrollable_1.ScrollbarVisibility.Auto),\n horizontalScrollbarSize: (typeof opts.horizontalScrollbarSize !== 'undefined' ? opts.horizontalScrollbarSize : 10),\n horizontalSliderSize: (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : 0),\n horizontalHasArrows: (typeof opts.horizontalHasArrows !== 'undefined' ? opts.horizontalHasArrows : false),\n vertical: (typeof opts.vertical !== 'undefined' ? opts.vertical : scrollable_1.ScrollbarVisibility.Auto),\n verticalScrollbarSize: (typeof opts.verticalScrollbarSize !== 'undefined' ? opts.verticalScrollbarSize : 10),\n verticalHasArrows: (typeof opts.verticalHasArrows !== 'undefined' ? opts.verticalHasArrows : false),\n verticalSliderSize: (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : 0),\n scrollByPage: (typeof opts.scrollByPage !== 'undefined' ? opts.scrollByPage : false)\n };\n result.horizontalSliderSize = (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : result.horizontalScrollbarSize);\n result.verticalSliderSize = (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : result.verticalScrollbarSize);\n // Defaults are different on Macs\n if (platform.isMacintosh) {\n result.className += ' mac';\n }\n return result;\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ScrollbarArrow = exports.ARROW_IMG_SIZE = void 0;\nconst globalPointerMoveMonitor_1 = require(\"vs/base/browser/globalPointerMoveMonitor\");\nconst widget_1 = require(\"vs/base/browser/ui/widget\");\nconst async_1 = require(\"vs/base/common/async\");\nconst dom = __importStar(require(\"vs/base/browser/dom\"));\n/**\n * The arrow image size.\n */\nexports.ARROW_IMG_SIZE = 11;\nclass ScrollbarArrow extends widget_1.Widget {\n constructor(opts) {\n super();\n this._onActivate = opts.onActivate;\n this.bgDomNode = document.createElement('div');\n this.bgDomNode.className = 'arrow-background';\n this.bgDomNode.style.position = 'absolute';\n this.bgDomNode.style.width = opts.bgWidth + 'px';\n this.bgDomNode.style.height = opts.bgHeight + 'px';\n if (typeof opts.top !== 'undefined') {\n this.bgDomNode.style.top = '0px';\n }\n if (typeof opts.left !== 'undefined') {\n this.bgDomNode.style.left = '0px';\n }\n if (typeof opts.bottom !== 'undefined') {\n this.bgDomNode.style.bottom = '0px';\n }\n if (typeof opts.right !== 'undefined') {\n this.bgDomNode.style.right = '0px';\n }\n this.domNode = document.createElement('div');\n this.domNode.className = opts.className;\n // this.domNode.classList.add(...ThemeIcon.asClassNameArray(opts.icon));\n this.domNode.style.position = 'absolute';\n this.domNode.style.width = exports.ARROW_IMG_SIZE + 'px';\n this.domNode.style.height = exports.ARROW_IMG_SIZE + 'px';\n if (typeof opts.top !== 'undefined') {\n this.domNode.style.top = opts.top + 'px';\n }\n if (typeof opts.left !== 'undefined') {\n this.domNode.style.left = opts.left + 'px';\n }\n if (typeof opts.bottom !== 'undefined') {\n this.domNode.style.bottom = opts.bottom + 'px';\n }\n if (typeof opts.right !== 'undefined') {\n this.domNode.style.right = opts.right + 'px';\n }\n this._pointerMoveMonitor = this._register(new globalPointerMoveMonitor_1.GlobalPointerMoveMonitor());\n this._register(dom.addStandardDisposableListener(this.bgDomNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n this._register(dom.addStandardDisposableListener(this.domNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n this._pointerdownRepeatTimer = this._register(new dom.WindowIntervalTimer());\n this._pointerdownScheduleRepeatTimer = this._register(new async_1.TimeoutTimer());\n }\n _arrowPointerDown(e) {\n if (!e.target || !(e.target instanceof Element)) {\n return;\n }\n const scheduleRepeater = () => {\n this._pointerdownRepeatTimer.cancelAndSet(() => this._onActivate(), 1000 / 24, dom.getWindow(e));\n };\n this._onActivate();\n this._pointerdownRepeatTimer.cancel();\n this._pointerdownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);\n this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => { }, () => {\n this._pointerdownRepeatTimer.cancel();\n this._pointerdownScheduleRepeatTimer.cancel();\n });\n e.preventDefault();\n }\n}\nexports.ScrollbarArrow = ScrollbarArrow;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ScrollbarState = void 0;\n/**\n * The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged.\n */\nconst MINIMUM_SLIDER_SIZE = 20;\nclass ScrollbarState {\n constructor(arrowSize, scrollbarSize, oppositeScrollbarSize, visibleSize, scrollSize, scrollPosition) {\n this._scrollbarSize = Math.round(scrollbarSize);\n this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n this._arrowSize = Math.round(arrowSize);\n this._visibleSize = visibleSize;\n this._scrollSize = scrollSize;\n this._scrollPosition = scrollPosition;\n this._computedAvailableSize = 0;\n this._computedIsNeeded = false;\n this._computedSliderSize = 0;\n this._computedSliderRatio = 0;\n this._computedSliderPosition = 0;\n this._refreshComputedValues();\n }\n clone() {\n return new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n }\n setVisibleSize(visibleSize) {\n const iVisibleSize = Math.round(visibleSize);\n if (this._visibleSize !== iVisibleSize) {\n this._visibleSize = iVisibleSize;\n this._refreshComputedValues();\n return true;\n }\n return false;\n }\n setScrollSize(scrollSize) {\n const iScrollSize = Math.round(scrollSize);\n if (this._scrollSize !== iScrollSize) {\n this._scrollSize = iScrollSize;\n this._refreshComputedValues();\n return true;\n }\n return false;\n }\n setScrollPosition(scrollPosition) {\n const iScrollPosition = Math.round(scrollPosition);\n if (this._scrollPosition !== iScrollPosition) {\n this._scrollPosition = iScrollPosition;\n this._refreshComputedValues();\n return true;\n }\n return false;\n }\n setScrollbarSize(scrollbarSize) {\n this._scrollbarSize = Math.round(scrollbarSize);\n }\n setOppositeScrollbarSize(oppositeScrollbarSize) {\n this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n }\n static _computeValues(oppositeScrollbarSize, arrowSize, visibleSize, scrollSize, scrollPosition) {\n const computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);\n const computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);\n const computedIsNeeded = (scrollSize > 0 && scrollSize > visibleSize);\n if (!computedIsNeeded) {\n // There is no need for a slider\n return {\n computedAvailableSize: Math.round(computedAvailableSize),\n computedIsNeeded: computedIsNeeded,\n computedSliderSize: Math.round(computedRepresentableSize),\n computedSliderRatio: 0,\n computedSliderPosition: 0,\n };\n }\n // We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise\n const computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize)));\n // The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize`\n // in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`.\n const computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);\n const computedSliderPosition = (scrollPosition * computedSliderRatio);\n return {\n computedAvailableSize: Math.round(computedAvailableSize),\n computedIsNeeded: computedIsNeeded,\n computedSliderSize: Math.round(computedSliderSize),\n computedSliderRatio: computedSliderRatio,\n computedSliderPosition: Math.round(computedSliderPosition),\n };\n }\n _refreshComputedValues() {\n const r = ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n this._computedAvailableSize = r.computedAvailableSize;\n this._computedIsNeeded = r.computedIsNeeded;\n this._computedSliderSize = r.computedSliderSize;\n this._computedSliderRatio = r.computedSliderRatio;\n this._computedSliderPosition = r.computedSliderPosition;\n }\n getArrowSize() {\n return this._arrowSize;\n }\n getScrollPosition() {\n return this._scrollPosition;\n }\n getRectangleLargeSize() {\n return this._computedAvailableSize;\n }\n getRectangleSmallSize() {\n return this._scrollbarSize;\n }\n isNeeded() {\n return this._computedIsNeeded;\n }\n getSliderSize() {\n return this._computedSliderSize;\n }\n getSliderPosition() {\n return this._computedSliderPosition;\n }\n /**\n * Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider.\n * `offset` is based on the same coordinate system as the `sliderPosition`.\n */\n getDesiredScrollPositionFromOffset(offset) {\n if (!this._computedIsNeeded) {\n // no need for a slider\n return 0;\n }\n const desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;\n return Math.round(desiredSliderPosition / this._computedSliderRatio);\n }\n /**\n * Compute a desired `scrollPosition` from if offset is before or after the slider position.\n * If offset is before slider, treat as a page up (or left). If after, page down (or right).\n * `offset` and `_computedSliderPosition` are based on the same coordinate system.\n * `_visibleSize` corresponds to a \"page\" of lines in the returned coordinate system.\n */\n getDesiredScrollPositionFromOffsetPaged(offset) {\n if (!this._computedIsNeeded) {\n // no need for a slider\n return 0;\n }\n const correctedOffset = offset - this._arrowSize; // compensate if has arrows\n let desiredScrollPosition = this._scrollPosition;\n if (correctedOffset < this._computedSliderPosition) {\n desiredScrollPosition -= this._visibleSize; // page up/left\n }\n else {\n desiredScrollPosition += this._visibleSize; // page down/right\n }\n return desiredScrollPosition;\n }\n /**\n * Compute a desired `scrollPosition` such that the slider moves by `delta`.\n */\n getDesiredScrollPositionFromDelta(delta) {\n if (!this._computedIsNeeded) {\n // no need for a slider\n return 0;\n }\n const desiredSliderPosition = this._computedSliderPosition + delta;\n return Math.round(desiredSliderPosition / this._computedSliderRatio);\n }\n}\nexports.ScrollbarState = ScrollbarState;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ScrollbarVisibilityController = void 0;\nconst async_1 = require(\"vs/base/common/async\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nconst scrollable_1 = require(\"vs/base/common/scrollable\");\nclass ScrollbarVisibilityController extends lifecycle_1.Disposable {\n constructor(visibility, visibleClassName, invisibleClassName) {\n super();\n this._visibility = visibility;\n this._visibleClassName = visibleClassName;\n this._invisibleClassName = invisibleClassName;\n this._domNode = null;\n this._isVisible = false;\n this._isNeeded = false;\n this._rawShouldBeVisible = false;\n this._shouldBeVisible = false;\n this._revealTimer = this._register(new async_1.TimeoutTimer());\n }\n setVisibility(visibility) {\n if (this._visibility !== visibility) {\n this._visibility = visibility;\n this._updateShouldBeVisible();\n }\n }\n // ----------------- Hide / Reveal\n setShouldBeVisible(rawShouldBeVisible) {\n this._rawShouldBeVisible = rawShouldBeVisible;\n this._updateShouldBeVisible();\n }\n _applyVisibilitySetting() {\n if (this._visibility === scrollable_1.ScrollbarVisibility.Hidden) {\n return false;\n }\n if (this._visibility === scrollable_1.ScrollbarVisibility.Visible) {\n return true;\n }\n return this._rawShouldBeVisible;\n }\n _updateShouldBeVisible() {\n const shouldBeVisible = this._applyVisibilitySetting();\n if (this._shouldBeVisible !== shouldBeVisible) {\n this._shouldBeVisible = shouldBeVisible;\n this.ensureVisibility();\n }\n }\n setIsNeeded(isNeeded) {\n if (this._isNeeded !== isNeeded) {\n this._isNeeded = isNeeded;\n this.ensureVisibility();\n }\n }\n setDomNode(domNode) {\n this._domNode = domNode;\n this._domNode.setClassName(this._invisibleClassName);\n // Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration\n this.setShouldBeVisible(false);\n }\n ensureVisibility() {\n if (!this._isNeeded) {\n // Nothing to be rendered\n this._hide(false);\n return;\n }\n if (this._shouldBeVisible) {\n this._reveal();\n }\n else {\n this._hide(true);\n }\n }\n _reveal() {\n if (this._isVisible) {\n return;\n }\n this._isVisible = true;\n // The CSS animation doesn't play otherwise\n this._revealTimer.setIfNotSet(() => {\n this._domNode?.setClassName(this._visibleClassName);\n }, 0);\n }\n _hide(withFadeAway) {\n this._revealTimer.cancel();\n if (!this._isVisible) {\n return;\n }\n this._isVisible = false;\n this._domNode?.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : ''));\n }\n}\nexports.ScrollbarVisibilityController = ScrollbarVisibilityController;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VerticalScrollbar = void 0;\nconst abstractScrollbar_1 = require(\"vs/base/browser/ui/scrollbar/abstractScrollbar\");\nconst scrollbarState_1 = require(\"vs/base/browser/ui/scrollbar/scrollbarState\");\nconst scrollable_1 = require(\"vs/base/common/scrollable\");\nclass VerticalScrollbar extends abstractScrollbar_1.AbstractScrollbar {\n constructor(scrollable, options, host) {\n const scrollDimensions = scrollable.getScrollDimensions();\n const scrollPosition = scrollable.getCurrentScrollPosition();\n super({\n lazyRender: options.lazyRender,\n host: host,\n scrollbarState: new scrollbarState_1.ScrollbarState((options.verticalHasArrows ? options.arrowSize : 0), (options.vertical === scrollable_1.ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize), \n // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n 0, scrollDimensions.height, scrollDimensions.scrollHeight, scrollPosition.scrollTop),\n visibility: options.vertical,\n extraScrollbarClassName: 'vertical',\n scrollable: scrollable,\n scrollByPage: options.scrollByPage\n });\n if (options.verticalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n // const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n // const scrollbarDelta = (options.verticalScrollbarSize - ARROW_IMG_SIZE) / 2;\n // this._createArrow({\n // \tclassName: 'scra',\n // \ticon: Codicon.scrollbarButtonUp,\n // \ttop: arrowDelta,\n // \tleft: scrollbarDelta,\n // \tbottom: undefined,\n // \tright: undefined,\n // \tbgWidth: options.verticalScrollbarSize,\n // \tbgHeight: options.arrowSize,\n // \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, 1)),\n // });\n // this._createArrow({\n // \tclassName: 'scra',\n // \ticon: Codicon.scrollbarButtonDown,\n // \ttop: undefined,\n // \tleft: scrollbarDelta,\n // \tbottom: arrowDelta,\n // \tright: undefined,\n // \tbgWidth: options.verticalScrollbarSize,\n // \tbgHeight: options.arrowSize,\n // \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, -1)),\n // });\n }\n this._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined);\n }\n _updateSlider(sliderSize, sliderPosition) {\n this.slider.setHeight(sliderSize);\n this.slider.setTop(sliderPosition);\n }\n _renderDomNode(largeSize, smallSize) {\n this.domNode.setWidth(smallSize);\n this.domNode.setHeight(largeSize);\n this.domNode.setRight(0);\n this.domNode.setTop(0);\n }\n onDidScroll(e) {\n this._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender;\n this._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender;\n this._shouldRender = this._onElementSize(e.height) || this._shouldRender;\n return this._shouldRender;\n }\n _pointerDownRelativePosition(offsetX, offsetY) {\n return offsetY;\n }\n _sliderPointerPosition(e) {\n return e.pageY;\n }\n _sliderOrthogonalPointerPosition(e) {\n return e.pageX;\n }\n _updateScrollbarSize(size) {\n this.slider.setWidth(size);\n }\n writeScrollPosition(target, scrollPosition) {\n target.scrollTop = scrollPosition;\n }\n updateOptions(options) {\n this.updateScrollbarSize(options.vertical === scrollable_1.ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n this._scrollbarState.setOppositeScrollbarSize(0);\n this._visibilityController.setVisibility(options.vertical);\n this._scrollByPage = options.scrollByPage;\n }\n}\nexports.VerticalScrollbar = VerticalScrollbar;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Widget = void 0;\nconst dom = __importStar(require(\"vs/base/browser/dom\"));\nconst keyboardEvent_1 = require(\"vs/base/browser/keyboardEvent\");\nconst mouseEvent_1 = require(\"vs/base/browser/mouseEvent\");\nconst touch_1 = require(\"vs/base/browser/touch\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nclass Widget extends lifecycle_1.Disposable {\n onclick(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, (e) => listener(new mouseEvent_1.StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onmousedown(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, (e) => listener(new mouseEvent_1.StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onmouseover(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, (e) => listener(new mouseEvent_1.StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onmouseleave(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_LEAVE, (e) => listener(new mouseEvent_1.StandardMouseEvent(dom.getWindow(domNode), e))));\n }\n onkeydown(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e) => listener(new keyboardEvent_1.StandardKeyboardEvent(e))));\n }\n onkeyup(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e) => listener(new keyboardEvent_1.StandardKeyboardEvent(e))));\n }\n oninput(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener));\n }\n onblur(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener));\n }\n onfocus(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener));\n }\n onchange(domNode, listener) {\n this._register(dom.addDisposableListener(domNode, dom.EventType.CHANGE, listener));\n }\n ignoreGesture(domNode) {\n return touch_1.Gesture.ignoreTarget(domNode);\n }\n}\nexports.Widget = Widget;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.mainWindow = void 0;\nexports.ensureCodeWindow = ensureCodeWindow;\nfunction ensureCodeWindow(targetWindow, fallbackWindowId) {\n}\n// eslint-disable-next-line no-restricted-globals\nexports.mainWindow = (typeof window === 'object' ? window : globalThis);\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Permutation = exports.CallbackIterable = exports.ArrayQueue = exports.booleanComparator = exports.numberComparator = exports.CompareResult = void 0;\nexports.tail = tail;\nexports.tail2 = tail2;\nexports.equals = equals;\nexports.removeFastWithoutKeepingOrder = removeFastWithoutKeepingOrder;\nexports.binarySearch = binarySearch;\nexports.binarySearch2 = binarySearch2;\nexports.quickSelect = quickSelect;\nexports.groupBy = groupBy;\nexports.groupAdjacentBy = groupAdjacentBy;\nexports.forEachAdjacent = forEachAdjacent;\nexports.forEachWithNeighbors = forEachWithNeighbors;\nexports.sortedDiff = sortedDiff;\nexports.delta = delta;\nexports.top = top;\nexports.topAsync = topAsync;\nexports.coalesce = coalesce;\nexports.coalesceInPlace = coalesceInPlace;\nexports.move = move;\nexports.isFalsyOrEmpty = isFalsyOrEmpty;\nexports.isNonEmptyArray = isNonEmptyArray;\nexports.distinct = distinct;\nexports.uniqueFilter = uniqueFilter;\nexports.firstOrDefault = firstOrDefault;\nexports.lastOrDefault = lastOrDefault;\nexports.commonPrefixLength = commonPrefixLength;\nexports.range = range;\nexports.index = index;\nexports.insert = insert;\nexports.remove = remove;\nexports.arrayInsert = arrayInsert;\nexports.shuffle = shuffle;\nexports.pushToStart = pushToStart;\nexports.pushToEnd = pushToEnd;\nexports.pushMany = pushMany;\nexports.mapArrayOrNot = mapArrayOrNot;\nexports.asArray = asArray;\nexports.getRandomElement = getRandomElement;\nexports.insertInto = insertInto;\nexports.splice = splice;\nexports.compareBy = compareBy;\nexports.tieBreakComparators = tieBreakComparators;\nexports.reverseOrder = reverseOrder;\nconst errors_1 = require(\"vs/base/common/errors\");\nconst arraysFind_1 = require(\"./arraysFind\");\n/**\n * Returns the last element of an array.\n * @param array The array.\n * @param n Which element from the end (default is zero).\n */\nfunction tail(array, n = 0) {\n return array[array.length - (1 + n)];\n}\nfunction tail2(arr) {\n if (arr.length === 0) {\n throw new Error('Invalid tail call');\n }\n return [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\nfunction equals(one, other, itemEquals = (a, b) => a === b) {\n if (one === other) {\n return true;\n }\n if (!one || !other) {\n return false;\n }\n if (one.length !== other.length) {\n return false;\n }\n for (let i = 0, len = one.length; i < len; i++) {\n if (!itemEquals(one[i], other[i])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Remove the element at `index` by replacing it with the last element. This is faster than `splice`\n * but changes the order of the array\n */\nfunction removeFastWithoutKeepingOrder(array, index) {\n const last = array.length - 1;\n if (index < last) {\n array[index] = array[last];\n }\n array.pop();\n}\n/**\n * Performs a binary search algorithm over a sorted array.\n *\n * @param array The array being searched.\n * @param key The value we search for.\n * @param comparator A function that takes two array elements and returns zero\n * if they are equal, a negative number if the first element precedes the\n * second one in the sorting order, or a positive number if the second element\n * precedes the first one.\n * @return See {@link binarySearch2}\n */\nfunction binarySearch(array, key, comparator) {\n return binarySearch2(array.length, i => comparator(array[i], key));\n}\n/**\n * Performs a binary search algorithm over a sorted collection. Useful for cases\n * when we need to perform a binary search over something that isn't actually an\n * array, and converting data to an array would defeat the use of binary search\n * in the first place.\n *\n * @param length The collection length.\n * @param compareToKey A function that takes an index of an element in the\n * collection and returns zero if the value at this index is equal to the\n * search key, a negative number if the value precedes the search key in the\n * sorting order, or a positive number if the search key precedes the value.\n * @return A non-negative index of an element, if found. If not found, the\n * result is -(n+1) (or ~n, using bitwise notation), where n is the index\n * where the key should be inserted to maintain the sorting order.\n */\nfunction binarySearch2(length, compareToKey) {\n let low = 0, high = length - 1;\n while (low <= high) {\n const mid = ((low + high) / 2) | 0;\n const comp = compareToKey(mid);\n if (comp < 0) {\n low = mid + 1;\n }\n else if (comp > 0) {\n high = mid - 1;\n }\n else {\n return mid;\n }\n }\n return -(low + 1);\n}\nfunction quickSelect(nth, data, compare) {\n nth = nth | 0;\n if (nth >= data.length) {\n throw new TypeError('invalid index');\n }\n const pivotValue = data[Math.floor(data.length * Math.random())];\n const lower = [];\n const higher = [];\n const pivots = [];\n for (const value of data) {\n const val = compare(value, pivotValue);\n if (val < 0) {\n lower.push(value);\n }\n else if (val > 0) {\n higher.push(value);\n }\n else {\n pivots.push(value);\n }\n }\n if (nth < lower.length) {\n return quickSelect(nth, lower, compare);\n }\n else if (nth < lower.length + pivots.length) {\n return pivots[0];\n }\n else {\n return quickSelect(nth - (lower.length + pivots.length), higher, compare);\n }\n}\nfunction groupBy(data, compare) {\n const result = [];\n let currentGroup = undefined;\n for (const element of data.slice(0).sort(compare)) {\n if (!currentGroup || compare(currentGroup[0], element) !== 0) {\n currentGroup = [element];\n result.push(currentGroup);\n }\n else {\n currentGroup.push(element);\n }\n }\n return result;\n}\n/**\n * Splits the given items into a list of (non-empty) groups.\n * `shouldBeGrouped` is used to decide if two consecutive items should be in the same group.\n * The order of the items is preserved.\n */\nfunction* groupAdjacentBy(items, shouldBeGrouped) {\n let currentGroup;\n let last;\n for (const item of items) {\n if (last !== undefined && shouldBeGrouped(last, item)) {\n currentGroup.push(item);\n }\n else {\n if (currentGroup) {\n yield currentGroup;\n }\n currentGroup = [item];\n }\n last = item;\n }\n if (currentGroup) {\n yield currentGroup;\n }\n}\nfunction forEachAdjacent(arr, f) {\n for (let i = 0; i <= arr.length; i++) {\n f(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);\n }\n}\nfunction forEachWithNeighbors(arr, f) {\n for (let i = 0; i < arr.length; i++) {\n f(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);\n }\n}\n/**\n * Diffs two *sorted* arrays and computes the splices which apply the diff.\n */\nfunction sortedDiff(before, after, compare) {\n const result = [];\n function pushSplice(start, deleteCount, toInsert) {\n if (deleteCount === 0 && toInsert.length === 0) {\n return;\n }\n const latest = result[result.length - 1];\n if (latest && latest.start + latest.deleteCount === start) {\n latest.deleteCount += deleteCount;\n latest.toInsert.push(...toInsert);\n }\n else {\n result.push({ start, deleteCount, toInsert });\n }\n }\n let beforeIdx = 0;\n let afterIdx = 0;\n while (true) {\n if (beforeIdx === before.length) {\n pushSplice(beforeIdx, 0, after.slice(afterIdx));\n break;\n }\n if (afterIdx === after.length) {\n pushSplice(beforeIdx, before.length - beforeIdx, []);\n break;\n }\n const beforeElement = before[beforeIdx];\n const afterElement = after[afterIdx];\n const n = compare(beforeElement, afterElement);\n if (n === 0) {\n // equal\n beforeIdx += 1;\n afterIdx += 1;\n }\n else if (n < 0) {\n // beforeElement is smaller -> before element removed\n pushSplice(beforeIdx, 1, []);\n beforeIdx += 1;\n }\n else if (n > 0) {\n // beforeElement is greater -> after element added\n pushSplice(beforeIdx, 0, [afterElement]);\n afterIdx += 1;\n }\n }\n return result;\n}\n/**\n * Takes two *sorted* arrays and computes their delta (removed, added elements).\n * Finishes in `Math.min(before.length, after.length)` steps.\n */\nfunction delta(before, after, compare) {\n const splices = sortedDiff(before, after, compare);\n const removed = [];\n const added = [];\n for (const splice of splices) {\n removed.push(...before.slice(splice.start, splice.start + splice.deleteCount));\n added.push(...splice.toInsert);\n }\n return { removed, added };\n}\n/**\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @return The first n elements from array when sorted with compare.\n */\nfunction top(array, compare, n) {\n if (n === 0) {\n return [];\n }\n const result = array.slice(0, n).sort(compare);\n topStep(array, compare, result, n, array.length);\n return result;\n}\n/**\n * Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.\n *\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @param batch The number of elements to examine before yielding to the event loop.\n * @return The first n elements from array when sorted with compare.\n */\nfunction topAsync(array, compare, n, batch, token) {\n if (n === 0) {\n return Promise.resolve([]);\n }\n return new Promise((resolve, reject) => {\n (async () => {\n const o = array.length;\n const result = array.slice(0, n).sort(compare);\n for (let i = n, m = Math.min(n + batch, o); i < o; i = m, m = Math.min(m + batch, o)) {\n if (i > n) {\n await new Promise(resolve => setTimeout(resolve)); // any other delay function would starve I/O\n }\n if (token && token.isCancellationRequested) {\n throw new errors_1.CancellationError();\n }\n topStep(array, compare, result, i, m);\n }\n return result;\n })()\n .then(resolve, reject);\n });\n}\nfunction topStep(array, compare, result, i, m) {\n for (const n = result.length; i < m; i++) {\n const element = array[i];\n if (compare(element, result[n - 1]) < 0) {\n result.pop();\n const j = (0, arraysFind_1.findFirstIdxMonotonousOrArrLen)(result, e => compare(element, e) < 0);\n result.splice(j, 0, element);\n }\n }\n}\n/**\n * @returns New array with all falsy values removed. The original array IS NOT modified.\n */\nfunction coalesce(array) {\n return array.filter((e) => !!e);\n}\n/**\n * Remove all falsy values from `array`. The original array IS modified.\n */\nfunction coalesceInPlace(array) {\n let to = 0;\n for (let i = 0; i < array.length; i++) {\n if (!!array[i]) {\n array[to] = array[i];\n to += 1;\n }\n }\n array.length = to;\n}\n/**\n * @deprecated Use `Array.copyWithin` instead\n */\nfunction move(array, from, to) {\n array.splice(to, 0, array.splice(from, 1)[0]);\n}\n/**\n * @returns false if the provided object is an array and not empty.\n */\nfunction isFalsyOrEmpty(obj) {\n return !Array.isArray(obj) || obj.length === 0;\n}\nfunction isNonEmptyArray(obj) {\n return Array.isArray(obj) && obj.length > 0;\n}\n/**\n * Removes duplicates from the given array. The optional keyFn allows to specify\n * how elements are checked for equality by returning an alternate value for each.\n */\nfunction distinct(array, keyFn = value => value) {\n const seen = new Set();\n return array.filter(element => {\n const key = keyFn(element);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n}\nfunction uniqueFilter(keyFn) {\n const seen = new Set();\n return element => {\n const key = keyFn(element);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n };\n}\nfunction firstOrDefault(array, notFoundValue) {\n return array.length > 0 ? array[0] : notFoundValue;\n}\nfunction lastOrDefault(array, notFoundValue) {\n return array.length > 0 ? array[array.length - 1] : notFoundValue;\n}\nfunction commonPrefixLength(one, other, equals = (a, b) => a === b) {\n let result = 0;\n for (let i = 0, len = Math.min(one.length, other.length); i < len && equals(one[i], other[i]); i++) {\n result++;\n }\n return result;\n}\nfunction range(arg, to) {\n let from = typeof to === 'number' ? arg : 0;\n if (typeof to === 'number') {\n from = arg;\n }\n else {\n from = 0;\n to = arg;\n }\n const result = [];\n if (from <= to) {\n for (let i = from; i < to; i++) {\n result.push(i);\n }\n }\n else {\n for (let i = from; i > to; i--) {\n result.push(i);\n }\n }\n return result;\n}\nfunction index(array, indexer, mapper) {\n return array.reduce((r, t) => {\n r[indexer(t)] = mapper ? mapper(t) : t;\n return r;\n }, Object.create(null));\n}\n/**\n * Inserts an element into an array. Returns a function which, when\n * called, will remove that element from the array.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nfunction insert(array, element) {\n array.push(element);\n return () => remove(array, element);\n}\n/**\n * Removes an element from an array if it can be found.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nfunction remove(array, element) {\n const index = array.indexOf(element);\n if (index > -1) {\n array.splice(index, 1);\n return element;\n }\n return undefined;\n}\n/**\n * Insert `insertArr` inside `target` at `insertIndex`.\n * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array\n */\nfunction arrayInsert(target, insertIndex, insertArr) {\n const before = target.slice(0, insertIndex);\n const after = target.slice(insertIndex);\n return before.concat(insertArr, after);\n}\n/**\n * Uses Fisher-Yates shuffle to shuffle the given array\n */\nfunction shuffle(array, _seed) {\n let rand;\n if (typeof _seed === 'number') {\n let seed = _seed;\n // Seeded random number generator in JS. Modified from:\n // https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript\n rand = () => {\n const x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias\n return x - Math.floor(x);\n };\n }\n else {\n rand = Math.random;\n }\n for (let i = array.length - 1; i > 0; i -= 1) {\n const j = Math.floor(rand() * (i + 1));\n const temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}\n/**\n * Pushes an element to the start of the array, if found.\n */\nfunction pushToStart(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.unshift(value);\n }\n}\n/**\n * Pushes an element to the end of the array, if found.\n */\nfunction pushToEnd(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.push(value);\n }\n}\nfunction pushMany(arr, items) {\n for (const item of items) {\n arr.push(item);\n }\n}\nfunction mapArrayOrNot(items, fn) {\n return Array.isArray(items) ?\n items.map(fn) :\n fn(items);\n}\nfunction asArray(x) {\n return Array.isArray(x) ? x : [x];\n}\nfunction getRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}\n/**\n * Insert the new items in the array.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start inserting elements.\n * @param newItems The items to be inserted\n */\nfunction insertInto(array, start, newItems) {\n const startIdx = getActualStartIndex(array, start);\n const originalLength = array.length;\n const newItemsLength = newItems.length;\n array.length = originalLength + newItemsLength;\n // Move the items after the start index, start from the end so that we don't overwrite any value.\n for (let i = originalLength - 1; i >= startIdx; i--) {\n array[i + newItemsLength] = array[i];\n }\n for (let i = 0; i < newItemsLength; i++) {\n array[i + startIdx] = newItems[i];\n }\n}\n/**\n * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it\n * can only support limited number of items due to the maximum call stack size limit.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns An array containing the elements that were deleted.\n */\nfunction splice(array, start, deleteCount, newItems) {\n const index = getActualStartIndex(array, start);\n let result = array.splice(index, deleteCount);\n if (result === undefined) {\n // see https://bugs.webkit.org/show_bug.cgi?id=261140\n result = [];\n }\n insertInto(array, index, newItems);\n return result;\n}\n/**\n * Determine the actual start index (same logic as the native splice() or slice())\n * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.\n * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0.\n * @param array The target array.\n * @param start The operation index.\n */\nfunction getActualStartIndex(array, start) {\n return start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\n}\nvar CompareResult;\n(function (CompareResult) {\n function isLessThan(result) {\n return result < 0;\n }\n CompareResult.isLessThan = isLessThan;\n function isLessThanOrEqual(result) {\n return result <= 0;\n }\n CompareResult.isLessThanOrEqual = isLessThanOrEqual;\n function isGreaterThan(result) {\n return result > 0;\n }\n CompareResult.isGreaterThan = isGreaterThan;\n function isNeitherLessOrGreaterThan(result) {\n return result === 0;\n }\n CompareResult.isNeitherLessOrGreaterThan = isNeitherLessOrGreaterThan;\n CompareResult.greaterThan = 1;\n CompareResult.lessThan = -1;\n CompareResult.neitherLessOrGreaterThan = 0;\n})(CompareResult || (exports.CompareResult = CompareResult = {}));\nfunction compareBy(selector, comparator) {\n return (a, b) => comparator(selector(a), selector(b));\n}\nfunction tieBreakComparators(...comparators) {\n return (item1, item2) => {\n for (const comparator of comparators) {\n const result = comparator(item1, item2);\n if (!CompareResult.isNeitherLessOrGreaterThan(result)) {\n return result;\n }\n }\n return CompareResult.neitherLessOrGreaterThan;\n };\n}\n/**\n * The natural order on numbers.\n*/\nconst numberComparator = (a, b) => a - b;\nexports.numberComparator = numberComparator;\nconst booleanComparator = (a, b) => (0, exports.numberComparator)(a ? 1 : 0, b ? 1 : 0);\nexports.booleanComparator = booleanComparator;\nfunction reverseOrder(comparator) {\n return (a, b) => -comparator(a, b);\n}\nclass ArrayQueue {\n /**\n * Constructs a queue that is backed by the given array. Runtime is O(1).\n */\n constructor(items) {\n this.items = items;\n this.firstIdx = 0;\n this.lastIdx = this.items.length - 1;\n }\n get length() {\n return this.lastIdx - this.firstIdx + 1;\n }\n /**\n * Consumes elements from the beginning of the queue as long as the predicate returns true.\n * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\n */\n takeWhile(predicate) {\n // P(k) := k <= this.lastIdx && predicate(this.items[k])\n // Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\n let startIdx = this.firstIdx;\n while (startIdx < this.items.length && predicate(this.items[startIdx])) {\n startIdx++;\n }\n const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\n this.firstIdx = startIdx;\n return result;\n }\n /**\n * Consumes elements from the end of the queue as long as the predicate returns true.\n * If no elements were consumed, `null` is returned.\n * The result has the same order as the underlying array!\n */\n takeFromEndWhile(predicate) {\n // P(k) := this.firstIdx >= k && predicate(this.items[k])\n // Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\n let endIdx = this.lastIdx;\n while (endIdx >= 0 && predicate(this.items[endIdx])) {\n endIdx--;\n }\n const result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\n this.lastIdx = endIdx;\n return result;\n }\n peek() {\n if (this.length === 0) {\n return undefined;\n }\n return this.items[this.firstIdx];\n }\n peekLast() {\n if (this.length === 0) {\n return undefined;\n }\n return this.items[this.lastIdx];\n }\n dequeue() {\n const result = this.items[this.firstIdx];\n this.firstIdx++;\n return result;\n }\n removeLast() {\n const result = this.items[this.lastIdx];\n this.lastIdx--;\n return result;\n }\n takeCount(count) {\n const result = this.items.slice(this.firstIdx, this.firstIdx + count);\n this.firstIdx += count;\n return result;\n }\n}\nexports.ArrayQueue = ArrayQueue;\n/**\n * This class is faster than an iterator and array for lazy computed data.\n*/\nclass CallbackIterable {\n static { this.empty = new CallbackIterable(_callback => { }); }\n constructor(\n /**\n * Calls the callback for every item.\n * Stops when the callback returns false.\n */\n iterate) {\n this.iterate = iterate;\n }\n forEach(handler) {\n this.iterate(item => { handler(item); return true; });\n }\n toArray() {\n const result = [];\n this.iterate(item => { result.push(item); return true; });\n return result;\n }\n filter(predicate) {\n return new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true));\n }\n map(mapFn) {\n return new CallbackIterable(cb => this.iterate(item => cb(mapFn(item))));\n }\n some(predicate) {\n let result = false;\n this.iterate(item => { result = predicate(item); return !result; });\n return result;\n }\n findFirst(predicate) {\n let result;\n this.iterate(item => {\n if (predicate(item)) {\n result = item;\n return false;\n }\n return true;\n });\n return result;\n }\n findLast(predicate) {\n let result;\n this.iterate(item => {\n if (predicate(item)) {\n result = item;\n }\n return true;\n });\n return result;\n }\n findLastMaxBy(comparator) {\n let result;\n let first = true;\n this.iterate(item => {\n if (first || CompareResult.isGreaterThan(comparator(item, result))) {\n first = false;\n result = item;\n }\n return true;\n });\n return result;\n }\n}\nexports.CallbackIterable = CallbackIterable;\n/**\n * Represents a re-arrangement of items in an array.\n */\nclass Permutation {\n constructor(_indexMap) {\n this._indexMap = _indexMap;\n }\n /**\n * Returns a permutation that sorts the given array according to the given compare function.\n */\n static createSortPermutation(arr, compareFn) {\n const sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2]));\n return new Permutation(sortIndices);\n }\n /**\n * Returns a new array with the elements of the given array re-arranged according to this permutation.\n */\n apply(arr) {\n return arr.map((_, index) => arr[this._indexMap[index]]);\n }\n /**\n * Returns a new permutation that undoes the re-arrangement of this permutation.\n */\n inverse() {\n const inverseIndexMap = this._indexMap.slice();\n for (let i = 0; i < this._indexMap.length; i++) {\n inverseIndexMap[this._indexMap[i]] = i;\n }\n return new Permutation(inverseIndexMap);\n }\n}\nexports.Permutation = Permutation;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MonotonousArray = void 0;\nexports.findLast = findLast;\nexports.findLastIdx = findLastIdx;\nexports.findLastMonotonous = findLastMonotonous;\nexports.findLastIdxMonotonous = findLastIdxMonotonous;\nexports.findFirstMonotonous = findFirstMonotonous;\nexports.findFirstIdxMonotonousOrArrLen = findFirstIdxMonotonousOrArrLen;\nexports.findFirstIdxMonotonous = findFirstIdxMonotonous;\nexports.findFirstMax = findFirstMax;\nexports.findLastMax = findLastMax;\nexports.findFirstMin = findFirstMin;\nexports.findMaxIdx = findMaxIdx;\nexports.mapFindFirst = mapFindFirst;\nfunction findLast(array, predicate) {\n const idx = findLastIdx(array, predicate);\n if (idx === -1) {\n return undefined;\n }\n return array[idx];\n}\nfunction findLastIdx(array, predicate, fromIndex = array.length - 1) {\n for (let i = fromIndex; i >= 0; i--) {\n const element = array[i];\n if (predicate(element)) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `undefined` if no item matches, otherwise the last item that matches the predicate.\n */\nfunction findLastMonotonous(array, predicate) {\n const idx = findLastIdxMonotonous(array, predicate);\n return idx === -1 ? undefined : array[idx];\n}\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate.\n */\nfunction findLastIdxMonotonous(array, predicate, startIdx = 0, endIdxEx = array.length) {\n let i = startIdx;\n let j = endIdxEx;\n while (i < j) {\n const k = Math.floor((i + j) / 2);\n if (predicate(array[k])) {\n i = k + 1;\n }\n else {\n j = k;\n }\n }\n return i - 1;\n}\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `undefined` if no item matches, otherwise the first item that matches the predicate.\n */\nfunction findFirstMonotonous(array, predicate) {\n const idx = findFirstIdxMonotonousOrArrLen(array, predicate);\n return idx === array.length ? undefined : array[idx];\n}\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate.\n */\nfunction findFirstIdxMonotonousOrArrLen(array, predicate, startIdx = 0, endIdxEx = array.length) {\n let i = startIdx;\n let j = endIdxEx;\n while (i < j) {\n const k = Math.floor((i + j) / 2);\n if (predicate(array[k])) {\n j = k;\n }\n else {\n i = k + 1;\n }\n }\n return i;\n}\nfunction findFirstIdxMonotonous(array, predicate, startIdx = 0, endIdxEx = array.length) {\n const idx = findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx);\n return idx === array.length ? -1 : idx;\n}\n/**\n * Use this when\n * * You have a sorted array\n * * You query this array with a monotonous predicate to find the last item that has a certain property.\n * * You query this array multiple times with monotonous predicates that get weaker and weaker.\n */\nclass MonotonousArray {\n static { this.assertInvariants = false; }\n constructor(_array) {\n this._array = _array;\n this._findLastMonotonousLastIdx = 0;\n }\n /**\n * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.\n */\n findLastMonotonous(predicate) {\n if (MonotonousArray.assertInvariants) {\n if (this._prevFindLastPredicate) {\n for (const item of this._array) {\n if (this._prevFindLastPredicate(item) && !predicate(item)) {\n throw new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');\n }\n }\n }\n this._prevFindLastPredicate = predicate;\n }\n const idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);\n this._findLastMonotonousLastIdx = idx + 1;\n return idx === -1 ? undefined : this._array[idx];\n }\n}\nexports.MonotonousArray = MonotonousArray;\n/**\n * Returns the first item that is equal to or greater than every other item.\n*/\nfunction findFirstMax(array, comparator) {\n if (array.length === 0) {\n return undefined;\n }\n let max = array[0];\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, max) > 0) {\n max = item;\n }\n }\n return max;\n}\n/**\n * Returns the last item that is equal to or greater than every other item.\n*/\nfunction findLastMax(array, comparator) {\n if (array.length === 0) {\n return undefined;\n }\n let max = array[0];\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, max) >= 0) {\n max = item;\n }\n }\n return max;\n}\n/**\n * Returns the first item that is equal to or less than every other item.\n*/\nfunction findFirstMin(array, comparator) {\n return findFirstMax(array, (a, b) => -comparator(a, b));\n}\nfunction findMaxIdx(array, comparator) {\n if (array.length === 0) {\n return -1;\n }\n let maxIdx = 0;\n for (let i = 1; i < array.length; i++) {\n const item = array[i];\n if (comparator(item, array[maxIdx]) > 0) {\n maxIdx = i;\n }\n }\n return maxIdx;\n}\n/**\n * Returns the first mapped value of the array which is not undefined.\n */\nfunction mapFindFirst(items, mapFn) {\n for (const value of items) {\n const mapped = mapFn(value);\n if (mapped !== undefined) {\n return mapped;\n }\n }\n return undefined;\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AsyncIterableSource = exports.CancelableAsyncIterableObject = exports.AsyncIterableObject = exports.LazyStatefulPromise = exports.StatefulPromise = exports.Promises = exports.DeferredPromise = exports.IntervalCounter = exports.TaskSequentializer = exports.GlobalIdleValue = exports.AbstractIdleValue = exports._runWhenIdle = exports.runWhenGlobalIdle = exports.ThrottledWorker = exports.RunOnceWorker = exports.ProcessTimeRunOnceScheduler = exports.RunOnceScheduler = exports.IntervalTimer = exports.TimeoutTimer = exports.LimitedQueue = exports.Queue = exports.Limiter = exports.AutoOpenBarrier = exports.Barrier = exports.ThrottledDelayer = exports.Delayer = exports.SequencerByKey = exports.Sequencer = exports.Throttler = void 0;\nexports.isThenable = isThenable;\nexports.createCancelablePromise = createCancelablePromise;\nexports.raceCancellation = raceCancellation;\nexports.raceCancellationError = raceCancellationError;\nexports.raceCancellablePromises = raceCancellablePromises;\nexports.raceTimeout = raceTimeout;\nexports.asPromise = asPromise;\nexports.promiseWithResolvers = promiseWithResolvers;\nexports.timeout = timeout;\nexports.disposableTimeout = disposableTimeout;\nexports.sequence = sequence;\nexports.first = first;\nexports.firstParallel = firstParallel;\nexports.retry = retry;\nexports.createCancelableAsyncIterable = createCancelableAsyncIterable;\nconst cancellation_1 = require(\"vs/base/common/cancellation\");\nconst errors_1 = require(\"vs/base/common/errors\");\nconst event_1 = require(\"vs/base/common/event\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nconst platform_1 = require(\"vs/base/common/platform\");\nconst symbols_1 = require(\"./symbols\");\nconst lazy_1 = require(\"vs/base/common/lazy\");\nfunction isThenable(obj) {\n return !!obj && typeof obj.then === 'function';\n}\nfunction createCancelablePromise(callback) {\n const source = new cancellation_1.CancellationTokenSource();\n const thenable = callback(source.token);\n const promise = new Promise((resolve, reject) => {\n const subscription = source.token.onCancellationRequested(() => {\n subscription.dispose();\n reject(new errors_1.CancellationError());\n });\n Promise.resolve(thenable).then(value => {\n subscription.dispose();\n source.dispose();\n resolve(value);\n }, err => {\n subscription.dispose();\n source.dispose();\n reject(err);\n });\n });\n return new class {\n cancel() {\n source.cancel();\n source.dispose();\n }\n then(resolve, reject) {\n return promise.then(resolve, reject);\n }\n catch(reject) {\n return this.then(undefined, reject);\n }\n finally(onfinally) {\n return promise.finally(onfinally);\n }\n };\n}\nfunction raceCancellation(promise, token, defaultValue) {\n return new Promise((resolve, reject) => {\n const ref = token.onCancellationRequested(() => {\n ref.dispose();\n resolve(defaultValue);\n });\n promise.then(resolve, reject).finally(() => ref.dispose());\n });\n}\n/**\n * Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled.\n * @see {@link raceCancellation}\n */\nfunction raceCancellationError(promise, token) {\n return new Promise((resolve, reject) => {\n const ref = token.onCancellationRequested(() => {\n ref.dispose();\n reject(new errors_1.CancellationError());\n });\n promise.then(resolve, reject).finally(() => ref.dispose());\n });\n}\n/**\n * Returns as soon as one of the promises resolves or rejects and cancels remaining promises\n */\nasync function raceCancellablePromises(cancellablePromises) {\n let resolvedPromiseIndex = -1;\n const promises = cancellablePromises.map((promise, index) => promise.then(result => { resolvedPromiseIndex = index; return result; }));\n try {\n const result = await Promise.race(promises);\n return result;\n }\n finally {\n cancellablePromises.forEach((cancellablePromise, index) => {\n if (index !== resolvedPromiseIndex) {\n cancellablePromise.cancel();\n }\n });\n }\n}\nfunction raceTimeout(promise, timeout, onTimeout) {\n let promiseResolve = undefined;\n const timer = setTimeout(() => {\n promiseResolve?.(undefined);\n onTimeout?.();\n }, timeout);\n return Promise.race([\n promise.finally(() => clearTimeout(timer)),\n new Promise(resolve => promiseResolve = resolve)\n ]);\n}\nfunction asPromise(callback) {\n return new Promise((resolve, reject) => {\n const item = callback();\n if (isThenable(item)) {\n item.then(resolve, reject);\n }\n else {\n resolve(item);\n }\n });\n}\n/**\n * Creates and returns a new promise, plus its `resolve` and `reject` callbacks.\n *\n * Replace with standardized [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) once it is supported\n */\nfunction promiseWithResolvers() {\n let resolve;\n let reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve: resolve, reject: reject };\n}\n/**\n * A helper to prevent accumulation of sequential async tasks.\n *\n * Imagine a mail man with the sole task of delivering letters. As soon as\n * a letter submitted for delivery, he drives to the destination, delivers it\n * and returns to his base. Imagine that during the trip, N more letters were submitted.\n * When the mail man returns, he picks those N letters and delivers them all in a\n * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.\n *\n * The throttler implements this via the queue() method, by providing it a task\n * factory. Following the example:\n *\n * \t\tconst throttler = new Throttler();\n * \t\tconst letters = [];\n *\n * \t\tfunction deliver() {\n * \t\t\tconst lettersToDeliver = letters;\n * \t\t\tletters = [];\n * \t\t\treturn makeTheTrip(lettersToDeliver);\n * \t\t}\n *\n * \t\tfunction onLetterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tthrottler.queue(deliver);\n * \t\t}\n */\nclass Throttler {\n constructor() {\n this.isDisposed = false;\n this.activePromise = null;\n this.queuedPromise = null;\n this.queuedPromiseFactory = null;\n }\n queue(promiseFactory) {\n if (this.isDisposed) {\n return Promise.reject(new Error('Throttler is disposed'));\n }\n if (this.activePromise) {\n this.queuedPromiseFactory = promiseFactory;\n if (!this.queuedPromise) {\n const onComplete = () => {\n this.queuedPromise = null;\n if (this.isDisposed) {\n return;\n }\n const result = this.queue(this.queuedPromiseFactory);\n this.queuedPromiseFactory = null;\n return result;\n };\n this.queuedPromise = new Promise(resolve => {\n this.activePromise.then(onComplete, onComplete).then(resolve);\n });\n }\n return new Promise((resolve, reject) => {\n this.queuedPromise.then(resolve, reject);\n });\n }\n this.activePromise = promiseFactory();\n return new Promise((resolve, reject) => {\n this.activePromise.then((result) => {\n this.activePromise = null;\n resolve(result);\n }, (err) => {\n this.activePromise = null;\n reject(err);\n });\n });\n }\n dispose() {\n this.isDisposed = true;\n }\n}\nexports.Throttler = Throttler;\nclass Sequencer {\n constructor() {\n this.current = Promise.resolve(null);\n }\n queue(promiseTask) {\n return this.current = this.current.then(() => promiseTask(), () => promiseTask());\n }\n}\nexports.Sequencer = Sequencer;\nclass SequencerByKey {\n constructor() {\n this.promiseMap = new Map();\n }\n queue(key, promiseTask) {\n const runningPromise = this.promiseMap.get(key) ?? Promise.resolve();\n const newPromise = runningPromise\n .catch(() => { })\n .then(promiseTask)\n .finally(() => {\n if (this.promiseMap.get(key) === newPromise) {\n this.promiseMap.delete(key);\n }\n });\n this.promiseMap.set(key, newPromise);\n return newPromise;\n }\n}\nexports.SequencerByKey = SequencerByKey;\nconst timeoutDeferred = (timeout, fn) => {\n let scheduled = true;\n const handle = setTimeout(() => {\n scheduled = false;\n fn();\n }, timeout);\n return {\n isTriggered: () => scheduled,\n dispose: () => {\n clearTimeout(handle);\n scheduled = false;\n },\n };\n};\nconst microtaskDeferred = (fn) => {\n let scheduled = true;\n queueMicrotask(() => {\n if (scheduled) {\n scheduled = false;\n fn();\n }\n });\n return {\n isTriggered: () => scheduled,\n dispose: () => { scheduled = false; },\n };\n};\n/**\n * A helper to delay (debounce) execution of a task that is being requested often.\n *\n * Following the throttler, now imagine the mail man wants to optimize the number of\n * trips proactively. The trip itself can be long, so he decides not to make the trip\n * as soon as a letter is submitted. Instead he waits a while, in case more\n * letters are submitted. After said waiting period, if no letters were submitted, he\n * decides to make the trip. Imagine that N more letters were submitted after the first\n * one, all within a short period of time between each other. Even though N+1\n * submissions occurred, only 1 delivery was made.\n *\n * The delayer offers this behavior via the trigger() method, into which both the task\n * to be executed and the waiting period (delay) must be passed in as arguments. Following\n * the example:\n *\n * \t\tconst delayer = new Delayer(WAITING_PERIOD);\n * \t\tconst letters = [];\n *\n * \t\tfunction letterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tdelayer.trigger(() => { return makeTheTrip(); });\n * \t\t}\n */\nclass Delayer {\n constructor(defaultDelay) {\n this.defaultDelay = defaultDelay;\n this.deferred = null;\n this.completionPromise = null;\n this.doResolve = null;\n this.doReject = null;\n this.task = null;\n }\n trigger(task, delay = this.defaultDelay) {\n this.task = task;\n this.cancelTimeout();\n if (!this.completionPromise) {\n this.completionPromise = new Promise((resolve, reject) => {\n this.doResolve = resolve;\n this.doReject = reject;\n }).then(() => {\n this.completionPromise = null;\n this.doResolve = null;\n if (this.task) {\n const task = this.task;\n this.task = null;\n return task();\n }\n return undefined;\n });\n }\n const fn = () => {\n this.deferred = null;\n this.doResolve?.(null);\n };\n this.deferred = delay === symbols_1.MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);\n return this.completionPromise;\n }\n isTriggered() {\n return !!this.deferred?.isTriggered();\n }\n cancel() {\n this.cancelTimeout();\n if (this.completionPromise) {\n this.doReject?.(new errors_1.CancellationError());\n this.completionPromise = null;\n }\n }\n cancelTimeout() {\n this.deferred?.dispose();\n this.deferred = null;\n }\n dispose() {\n this.cancel();\n }\n}\nexports.Delayer = Delayer;\n/**\n * A helper to delay execution of a task that is being requested often, while\n * preventing accumulation of consecutive executions, while the task runs.\n *\n * The mail man is clever and waits for a certain amount of time, before going\n * out to deliver letters. While the mail man is going out, more letters arrive\n * and can only be delivered once he is back. Once he is back the mail man will\n * do one more trip to deliver the letters that have accumulated while he was out.\n */\nclass ThrottledDelayer {\n constructor(defaultDelay) {\n this.delayer = new Delayer(defaultDelay);\n this.throttler = new Throttler();\n }\n trigger(promiseFactory, delay) {\n return this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay);\n }\n isTriggered() {\n return this.delayer.isTriggered();\n }\n cancel() {\n this.delayer.cancel();\n }\n dispose() {\n this.delayer.dispose();\n this.throttler.dispose();\n }\n}\nexports.ThrottledDelayer = ThrottledDelayer;\n/**\n * A barrier that is initially closed and then becomes opened permanently.\n */\nclass Barrier {\n constructor() {\n this._isOpen = false;\n this._promise = new Promise((c, e) => {\n this._completePromise = c;\n });\n }\n isOpen() {\n return this._isOpen;\n }\n open() {\n this._isOpen = true;\n this._completePromise(true);\n }\n wait() {\n return this._promise;\n }\n}\nexports.Barrier = Barrier;\n/**\n * A barrier that is initially closed and then becomes opened permanently after a certain period of\n * time or when open is called explicitly\n */\nclass AutoOpenBarrier extends Barrier {\n constructor(autoOpenTimeMs) {\n super();\n this._timeout = setTimeout(() => this.open(), autoOpenTimeMs);\n }\n open() {\n clearTimeout(this._timeout);\n super.open();\n }\n}\nexports.AutoOpenBarrier = AutoOpenBarrier;\nfunction timeout(millis, token) {\n if (!token) {\n return createCancelablePromise(token => timeout(millis, token));\n }\n return new Promise((resolve, reject) => {\n const handle = setTimeout(() => {\n disposable.dispose();\n resolve();\n }, millis);\n const disposable = token.onCancellationRequested(() => {\n clearTimeout(handle);\n disposable.dispose();\n reject(new errors_1.CancellationError());\n });\n });\n}\n/**\n * Creates a timeout that can be disposed using its returned value.\n * @param handler The timeout handler.\n * @param timeout An optional timeout in milliseconds.\n * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.\n *\n * @example\n * const store = new DisposableStore;\n * // Call the timeout after 1000ms at which point it will be automatically\n * // evicted from the store.\n * const timeoutDisposable = disposableTimeout(() => {}, 1000, store);\n *\n * if (foo) {\n * // Cancel the timeout and evict it from store.\n * timeoutDisposable.dispose();\n * }\n */\nfunction disposableTimeout(handler, timeout = 0, store) {\n const timer = setTimeout(() => {\n handler();\n if (store) {\n disposable.dispose();\n }\n }, timeout);\n const disposable = (0, lifecycle_1.toDisposable)(() => {\n clearTimeout(timer);\n store?.deleteAndLeak(disposable);\n });\n store?.add(disposable);\n return disposable;\n}\n/**\n * Runs the provided list of promise factories in sequential order. The returned\n * promise will complete to an array of results from each promise.\n */\nfunction sequence(promiseFactories) {\n const results = [];\n let index = 0;\n const len = promiseFactories.length;\n function next() {\n return index < len ? promiseFactories[index++]() : null;\n }\n function thenHandler(result) {\n if (result !== undefined && result !== null) {\n results.push(result);\n }\n const n = next();\n if (n) {\n return n.then(thenHandler);\n }\n return Promise.resolve(results);\n }\n return Promise.resolve(null).then(thenHandler);\n}\nfunction first(promiseFactories, shouldStop = t => !!t, defaultValue = null) {\n let index = 0;\n const len = promiseFactories.length;\n const loop = () => {\n if (index >= len) {\n return Promise.resolve(defaultValue);\n }\n const factory = promiseFactories[index++];\n const promise = Promise.resolve(factory());\n return promise.then(result => {\n if (shouldStop(result)) {\n return Promise.resolve(result);\n }\n return loop();\n });\n };\n return loop();\n}\nfunction firstParallel(promiseList, shouldStop = t => !!t, defaultValue = null) {\n if (promiseList.length === 0) {\n return Promise.resolve(defaultValue);\n }\n let todo = promiseList.length;\n const finish = () => {\n todo = -1;\n for (const promise of promiseList) {\n promise.cancel?.();\n }\n };\n return new Promise((resolve, reject) => {\n for (const promise of promiseList) {\n promise.then(result => {\n if (--todo >= 0 && shouldStop(result)) {\n finish();\n resolve(result);\n }\n else if (todo === 0) {\n resolve(defaultValue);\n }\n })\n .catch(err => {\n if (--todo >= 0) {\n finish();\n reject(err);\n }\n });\n }\n });\n}\n/**\n * A helper to queue N promises and run them all with a max degree of parallelism. The helper\n * ensures that at any time no more than M promises are running at the same time.\n */\nclass Limiter {\n constructor(maxDegreeOfParalellism) {\n this._size = 0;\n this._isDisposed = false;\n this.maxDegreeOfParalellism = maxDegreeOfParalellism;\n this.outstandingPromises = [];\n this.runningPromises = 0;\n this._onDrained = new event_1.Emitter();\n }\n /**\n *\n * @returns A promise that resolved when all work is done (onDrained) or when\n * there is nothing to do\n */\n whenIdle() {\n return this.size > 0\n ? event_1.Event.toPromise(this.onDrained)\n : Promise.resolve();\n }\n get onDrained() {\n return this._onDrained.event;\n }\n get size() {\n return this._size;\n }\n queue(factory) {\n if (this._isDisposed) {\n throw new Error('Object has been disposed');\n }\n this._size++;\n return new Promise((c, e) => {\n this.outstandingPromises.push({ factory, c, e });\n this.consume();\n });\n }\n consume() {\n while (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {\n const iLimitedTask = this.outstandingPromises.shift();\n this.runningPromises++;\n const promise = iLimitedTask.factory();\n promise.then(iLimitedTask.c, iLimitedTask.e);\n promise.then(() => this.consumed(), () => this.consumed());\n }\n }\n consumed() {\n if (this._isDisposed) {\n return;\n }\n this.runningPromises--;\n if (--this._size === 0) {\n this._onDrained.fire();\n }\n if (this.outstandingPromises.length > 0) {\n this.consume();\n }\n }\n clear() {\n if (this._isDisposed) {\n throw new Error('Object has been disposed');\n }\n this.outstandingPromises.length = 0;\n this._size = this.runningPromises;\n }\n dispose() {\n this._isDisposed = true;\n this.outstandingPromises.length = 0; // stop further processing\n this._size = 0;\n this._onDrained.dispose();\n }\n}\nexports.Limiter = Limiter;\n/**\n * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.\n */\nclass Queue extends Limiter {\n constructor() {\n super(1);\n }\n}\nexports.Queue = Queue;\n/**\n * Same as `Queue`, ensures that only 1 task is executed at the same time. The difference to `Queue` is that\n * there is only 1 task about to be scheduled next. As such, calling `queue` while a task is executing will\n * replace the currently queued task until it executes.\n *\n * As such, the returned promise may not be from the factory that is passed in but from the next factory that\n * is running after having called `queue`.\n */\nclass LimitedQueue {\n constructor() {\n this.sequentializer = new TaskSequentializer();\n this.tasks = 0;\n }\n queue(factory) {\n if (!this.sequentializer.isRunning()) {\n return this.sequentializer.run(this.tasks++, factory());\n }\n return this.sequentializer.queue(() => {\n return this.sequentializer.run(this.tasks++, factory());\n });\n }\n}\nexports.LimitedQueue = LimitedQueue;\nclass TimeoutTimer {\n constructor(runner, timeout) {\n this._isDisposed = false;\n this._token = -1;\n if (typeof runner === 'function' && typeof timeout === 'number') {\n this.setIfNotSet(runner, timeout);\n }\n }\n dispose() {\n this.cancel();\n this._isDisposed = true;\n }\n cancel() {\n if (this._token !== -1) {\n clearTimeout(this._token);\n this._token = -1;\n }\n }\n cancelAndSet(runner, timeout) {\n if (this._isDisposed) {\n throw new errors_1.BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);\n }\n this.cancel();\n this._token = setTimeout(() => {\n this._token = -1;\n runner();\n }, timeout);\n }\n setIfNotSet(runner, timeout) {\n if (this._isDisposed) {\n throw new errors_1.BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);\n }\n if (this._token !== -1) {\n // timer is already set\n return;\n }\n this._token = setTimeout(() => {\n this._token = -1;\n runner();\n }, timeout);\n }\n}\nexports.TimeoutTimer = TimeoutTimer;\nclass IntervalTimer {\n constructor() {\n this.disposable = undefined;\n this.isDisposed = false;\n }\n cancel() {\n this.disposable?.dispose();\n this.disposable = undefined;\n }\n cancelAndSet(runner, interval, context = globalThis) {\n if (this.isDisposed) {\n throw new errors_1.BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`);\n }\n this.cancel();\n const handle = context.setInterval(() => {\n runner();\n }, interval);\n this.disposable = (0, lifecycle_1.toDisposable)(() => {\n context.clearInterval(handle);\n this.disposable = undefined;\n });\n }\n dispose() {\n this.cancel();\n this.isDisposed = true;\n }\n}\nexports.IntervalTimer = IntervalTimer;\nclass RunOnceScheduler {\n constructor(runner, delay) {\n this.timeoutToken = -1;\n this.runner = runner;\n this.timeout = delay;\n this.timeoutHandler = this.onTimeout.bind(this);\n }\n /**\n * Dispose RunOnceScheduler\n */\n dispose() {\n this.cancel();\n this.runner = null;\n }\n /**\n * Cancel current scheduled runner (if any).\n */\n cancel() {\n if (this.isScheduled()) {\n clearTimeout(this.timeoutToken);\n this.timeoutToken = -1;\n }\n }\n /**\n * Cancel previous runner (if any) & schedule a new runner.\n */\n schedule(delay = this.timeout) {\n this.cancel();\n this.timeoutToken = setTimeout(this.timeoutHandler, delay);\n }\n get delay() {\n return this.timeout;\n }\n set delay(value) {\n this.timeout = value;\n }\n /**\n * Returns true if scheduled.\n */\n isScheduled() {\n return this.timeoutToken !== -1;\n }\n flush() {\n if (this.isScheduled()) {\n this.cancel();\n this.doRun();\n }\n }\n onTimeout() {\n this.timeoutToken = -1;\n if (this.runner) {\n this.doRun();\n }\n }\n doRun() {\n this.runner?.();\n }\n}\nexports.RunOnceScheduler = RunOnceScheduler;\n/**\n * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.\n * > **NOTE**: Only offers 1s resolution.\n *\n * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep\n * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But\n * this scheduler will execute 3hrs **after waking the computer from sleep**.\n */\nclass ProcessTimeRunOnceScheduler {\n constructor(runner, delay) {\n if (delay % 1000 !== 0) {\n console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n }\n this.runner = runner;\n this.timeout = delay;\n this.counter = 0;\n this.intervalToken = -1;\n this.intervalHandler = this.onInterval.bind(this);\n }\n dispose() {\n this.cancel();\n this.runner = null;\n }\n cancel() {\n if (this.isScheduled()) {\n clearInterval(this.intervalToken);\n this.intervalToken = -1;\n }\n }\n /**\n * Cancel previous runner (if any) & schedule a new runner.\n */\n schedule(delay = this.timeout) {\n if (delay % 1000 !== 0) {\n console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n }\n this.cancel();\n this.counter = Math.ceil(delay / 1000);\n this.intervalToken = setInterval(this.intervalHandler, 1000);\n }\n /**\n * Returns true if scheduled.\n */\n isScheduled() {\n return this.intervalToken !== -1;\n }\n onInterval() {\n this.counter--;\n if (this.counter > 0) {\n // still need to wait\n return;\n }\n // time elapsed\n clearInterval(this.intervalToken);\n this.intervalToken = -1;\n this.runner?.();\n }\n}\nexports.ProcessTimeRunOnceScheduler = ProcessTimeRunOnceScheduler;\nclass RunOnceWorker extends RunOnceScheduler {\n constructor(runner, timeout) {\n super(runner, timeout);\n this.units = [];\n }\n work(unit) {\n this.units.push(unit);\n if (!this.isScheduled()) {\n this.schedule();\n }\n }\n doRun() {\n const units = this.units;\n this.units = [];\n this.runner?.(units);\n }\n dispose() {\n this.units = [];\n super.dispose();\n }\n}\nexports.RunOnceWorker = RunOnceWorker;\n/**\n * The `ThrottledWorker` will accept units of work `T`\n * to handle. The contract is:\n * * there is a maximum of units the worker can handle at once (via `maxWorkChunkSize`)\n * * there is a maximum of units the worker will keep in memory for processing (via `maxBufferedWork`)\n * * after having handled `maxWorkChunkSize` units, the worker needs to rest (via `throttleDelay`)\n */\nclass ThrottledWorker extends lifecycle_1.Disposable {\n constructor(options, handler) {\n super();\n this.options = options;\n this.handler = handler;\n this.pendingWork = [];\n this.throttler = this._register(new lifecycle_1.MutableDisposable());\n this.disposed = false;\n }\n /**\n * The number of work units that are pending to be processed.\n */\n get pending() { return this.pendingWork.length; }\n /**\n * Add units to be worked on. Use `pending` to figure out\n * how many units are not yet processed after this method\n * was called.\n *\n * @returns whether the work was accepted or not. If the\n * worker is disposed, it will not accept any more work.\n * If the number of pending units would become larger\n * than `maxPendingWork`, more work will also not be accepted.\n */\n work(units) {\n if (this.disposed) {\n return false; // work not accepted: disposed\n }\n // Check for reaching maximum of pending work\n if (typeof this.options.maxBufferedWork === 'number') {\n // Throttled: simple check if pending + units exceeds max pending\n if (this.throttler.value) {\n if (this.pending + units.length > this.options.maxBufferedWork) {\n return false; // work not accepted: too much pending work\n }\n }\n // Unthrottled: same as throttled, but account for max chunk getting\n // worked on directly without being pending\n else {\n if (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {\n return false; // work not accepted: too much pending work\n }\n }\n }\n // Add to pending units first\n for (const unit of units) {\n this.pendingWork.push(unit);\n }\n // If not throttled, start working directly\n // Otherwise, when the throttle delay has\n // past, pending work will be worked again.\n if (!this.throttler.value) {\n this.doWork();\n }\n return true; // work accepted\n }\n doWork() {\n // Extract chunk to handle and handle it\n this.handler(this.pendingWork.splice(0, this.options.maxWorkChunkSize));\n // If we have remaining work, schedule it after a delay\n if (this.pendingWork.length > 0) {\n this.throttler.value = new RunOnceScheduler(() => {\n this.throttler.clear();\n this.doWork();\n }, this.options.throttleDelay);\n this.throttler.value.schedule();\n }\n }\n dispose() {\n super.dispose();\n this.disposed = true;\n }\n}\nexports.ThrottledWorker = ThrottledWorker;\n(function () {\n if (typeof globalThis.requestIdleCallback !== 'function' || typeof globalThis.cancelIdleCallback !== 'function') {\n exports._runWhenIdle = (_targetWindow, runner) => {\n (0, platform_1.setTimeout0)(() => {\n if (disposed) {\n return;\n }\n const end = Date.now() + 15; // one frame at 64fps\n const deadline = {\n didTimeout: true,\n timeRemaining() {\n return Math.max(0, end - Date.now());\n }\n };\n runner(Object.freeze(deadline));\n });\n let disposed = false;\n return {\n dispose() {\n if (disposed) {\n return;\n }\n disposed = true;\n }\n };\n };\n }\n else {\n exports._runWhenIdle = (targetWindow, runner, timeout) => {\n const handle = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\n let disposed = false;\n return {\n dispose() {\n if (disposed) {\n return;\n }\n disposed = true;\n targetWindow.cancelIdleCallback(handle);\n }\n };\n };\n }\n exports.runWhenGlobalIdle = (runner) => (0, exports._runWhenIdle)(globalThis, runner);\n})();\nclass AbstractIdleValue {\n constructor(targetWindow, executor) {\n this._didRun = false;\n this._executor = () => {\n try {\n this._value = executor();\n }\n catch (err) {\n this._error = err;\n }\n finally {\n this._didRun = true;\n }\n };\n this._handle = (0, exports._runWhenIdle)(targetWindow, () => this._executor());\n }\n dispose() {\n this._handle.dispose();\n }\n get value() {\n if (!this._didRun) {\n this._handle.dispose();\n this._executor();\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n get isInitialized() {\n return this._didRun;\n }\n}\nexports.AbstractIdleValue = AbstractIdleValue;\n/**\n * An `IdleValue` that always uses the current window (which might be throttled or inactive)\n *\n * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser\n * context\n */\nclass GlobalIdleValue extends AbstractIdleValue {\n constructor(executor) {\n super(globalThis, executor);\n }\n}\nexports.GlobalIdleValue = GlobalIdleValue;\n//#endregion\nasync function retry(task, delay, retries) {\n let lastError;\n for (let i = 0; i < retries; i++) {\n try {\n return await task();\n }\n catch (error) {\n lastError = error;\n await timeout(delay);\n }\n }\n throw lastError;\n}\n/**\n * @deprecated use `LimitedQueue` instead for an easier to use API\n */\nclass TaskSequentializer {\n isRunning(taskId) {\n if (typeof taskId === 'number') {\n return this._running?.taskId === taskId;\n }\n return !!this._running;\n }\n get running() {\n return this._running?.promise;\n }\n cancelRunning() {\n this._running?.cancel();\n }\n run(taskId, promise, onCancel) {\n this._running = { taskId, cancel: () => onCancel?.(), promise };\n promise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));\n return promise;\n }\n doneRunning(taskId) {\n if (this._running && taskId === this._running.taskId) {\n // only set running to done if the promise finished that is associated with that taskId\n this._running = undefined;\n // schedule the queued task now that we are free if we have any\n this.runQueued();\n }\n }\n runQueued() {\n if (this._queued) {\n const queued = this._queued;\n this._queued = undefined;\n // Run queued task and complete on the associated promise\n queued.run().then(queued.promiseResolve, queued.promiseReject);\n }\n }\n /**\n * Note: the promise to schedule as next run MUST itself call `run`.\n * Otherwise, this sequentializer will report `false` for `isRunning`\n * even when this task is running. Missing this detail means that\n * suddenly multiple tasks will run in parallel.\n */\n queue(run) {\n // this is our first queued task, so we create associated promise with it\n // so that we can return a promise that completes when the task has\n // completed.\n if (!this._queued) {\n const { promise, resolve: promiseResolve, reject: promiseReject } = promiseWithResolvers();\n this._queued = {\n run,\n promise,\n promiseResolve: promiseResolve,\n promiseReject: promiseReject\n };\n }\n // we have a previous queued task, just overwrite it\n else {\n this._queued.run = run;\n }\n return this._queued.promise;\n }\n hasQueued() {\n return !!this._queued;\n }\n async join() {\n return this._queued?.promise ?? this._running?.promise;\n }\n}\nexports.TaskSequentializer = TaskSequentializer;\n//#endregion\n//#region\n/**\n * The `IntervalCounter` allows to count the number\n * of calls to `increment()` over a duration of\n * `interval`. This utility can be used to conditionally\n * throttle a frequent task when a certain threshold\n * is reached.\n */\nclass IntervalCounter {\n constructor(interval, nowFn = () => Date.now()) {\n this.interval = interval;\n this.nowFn = nowFn;\n this.lastIncrementTime = 0;\n this.value = 0;\n }\n increment() {\n const now = this.nowFn();\n // We are outside of the range of `interval` and as such\n // start counting from 0 and remember the time\n if (now - this.lastIncrementTime > this.interval) {\n this.lastIncrementTime = now;\n this.value = 0;\n }\n this.value++;\n return this.value;\n }\n}\nexports.IntervalCounter = IntervalCounter;\nvar DeferredOutcome;\n(function (DeferredOutcome) {\n DeferredOutcome[DeferredOutcome[\"Resolved\"] = 0] = \"Resolved\";\n DeferredOutcome[DeferredOutcome[\"Rejected\"] = 1] = \"Rejected\";\n})(DeferredOutcome || (DeferredOutcome = {}));\n/**\n * Creates a promise whose resolution or rejection can be controlled imperatively.\n */\nclass DeferredPromise {\n get isRejected() {\n return this.outcome?.outcome === DeferredOutcome.Rejected;\n }\n get isResolved() {\n return this.outcome?.outcome === DeferredOutcome.Resolved;\n }\n get isSettled() {\n return !!this.outcome;\n }\n get value() {\n return this.outcome?.outcome === DeferredOutcome.Resolved ? this.outcome?.value : undefined;\n }\n constructor() {\n this.p = new Promise((c, e) => {\n this.completeCallback = c;\n this.errorCallback = e;\n });\n }\n complete(value) {\n return new Promise(resolve => {\n this.completeCallback(value);\n this.outcome = { outcome: DeferredOutcome.Resolved, value };\n resolve();\n });\n }\n error(err) {\n return new Promise(resolve => {\n this.errorCallback(err);\n this.outcome = { outcome: DeferredOutcome.Rejected, value: err };\n resolve();\n });\n }\n cancel() {\n return this.error(new errors_1.CancellationError());\n }\n}\nexports.DeferredPromise = DeferredPromise;\n//#endregion\n//#region Promises\nvar Promises;\n(function (Promises) {\n /**\n * A drop-in replacement for `Promise.all` with the only difference\n * that the method awaits every promise to either fulfill or reject.\n *\n * Similar to `Promise.all`, only the first error will be returned\n * if any.\n */\n async function settled(promises) {\n let firstError = undefined;\n const result = await Promise.all(promises.map(promise => promise.then(value => value, error => {\n if (!firstError) {\n firstError = error;\n }\n return undefined; // do not rethrow so that other promises can settle\n })));\n if (typeof firstError !== 'undefined') {\n throw firstError;\n }\n return result; // cast is needed and protected by the `throw` above\n }\n Promises.settled = settled;\n /**\n * A helper to create a new `Promise` with a body that is a promise\n * itself. By default, an error that raises from the async body will\n * end up as a unhandled rejection, so this utility properly awaits the\n * body and rejects the promise as a normal promise does without async\n * body.\n *\n * This method should only be used in rare cases where otherwise `async`\n * cannot be used (e.g. when callbacks are involved that require this).\n */\n function withAsyncBody(bodyFn) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n try {\n await bodyFn(resolve, reject);\n }\n catch (error) {\n reject(error);\n }\n });\n }\n Promises.withAsyncBody = withAsyncBody;\n})(Promises || (exports.Promises = Promises = {}));\nclass StatefulPromise {\n get value() { return this._value; }\n get error() { return this._error; }\n get isResolved() { return this._isResolved; }\n constructor(promise) {\n this._value = undefined;\n this._error = undefined;\n this._isResolved = false;\n this.promise = promise.then(value => {\n this._value = value;\n this._isResolved = true;\n return value;\n }, error => {\n this._error = error;\n this._isResolved = true;\n throw error;\n });\n }\n /**\n * Returns the resolved value.\n * Throws if the promise is not resolved yet.\n */\n requireValue() {\n if (!this._isResolved) {\n throw new errors_1.BugIndicatingError('Promise is not resolved yet');\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n}\nexports.StatefulPromise = StatefulPromise;\nclass LazyStatefulPromise {\n constructor(_compute) {\n this._compute = _compute;\n this._promise = new lazy_1.Lazy(() => new StatefulPromise(this._compute()));\n }\n /**\n * Returns the resolved value.\n * Throws if the promise is not resolved yet.\n */\n requireValue() {\n return this._promise.value.requireValue();\n }\n /**\n * Returns the promise (and triggers a computation of the promise if not yet done so).\n */\n getPromise() {\n return this._promise.value.promise;\n }\n /**\n * Reads the current value without triggering a computation of the promise.\n */\n get currentValue() {\n return this._promise.rawValue?.value;\n }\n}\nexports.LazyStatefulPromise = LazyStatefulPromise;\n//#endregion\n//#region\nvar AsyncIterableSourceState;\n(function (AsyncIterableSourceState) {\n AsyncIterableSourceState[AsyncIterableSourceState[\"Initial\"] = 0] = \"Initial\";\n AsyncIterableSourceState[AsyncIterableSourceState[\"DoneOK\"] = 1] = \"DoneOK\";\n AsyncIterableSourceState[AsyncIterableSourceState[\"DoneError\"] = 2] = \"DoneError\";\n})(AsyncIterableSourceState || (AsyncIterableSourceState = {}));\n/**\n * A rich implementation for an `AsyncIterable`.\n */\nclass AsyncIterableObject {\n static fromArray(items) {\n return new AsyncIterableObject((writer) => {\n writer.emitMany(items);\n });\n }\n static fromPromise(promise) {\n return new AsyncIterableObject(async (emitter) => {\n emitter.emitMany(await promise);\n });\n }\n static fromPromises(promises) {\n return new AsyncIterableObject(async (emitter) => {\n await Promise.all(promises.map(async (p) => emitter.emitOne(await p)));\n });\n }\n static merge(iterables) {\n return new AsyncIterableObject(async (emitter) => {\n await Promise.all(iterables.map(async (iterable) => {\n for await (const item of iterable) {\n emitter.emitOne(item);\n }\n }));\n });\n }\n static { this.EMPTY = AsyncIterableObject.fromArray([]); }\n constructor(executor, onReturn) {\n this._state = AsyncIterableSourceState.Initial;\n this._results = [];\n this._error = null;\n this._onReturn = onReturn;\n this._onStateChanged = new event_1.Emitter();\n queueMicrotask(async () => {\n const writer = {\n emitOne: (item) => this.emitOne(item),\n emitMany: (items) => this.emitMany(items),\n reject: (error) => this.reject(error)\n };\n try {\n await Promise.resolve(executor(writer));\n this.resolve();\n }\n catch (err) {\n this.reject(err);\n }\n finally {\n writer.emitOne = undefined;\n writer.emitMany = undefined;\n writer.reject = undefined;\n }\n });\n }\n [Symbol.asyncIterator]() {\n let i = 0;\n return {\n next: async () => {\n do {\n if (this._state === AsyncIterableSourceState.DoneError) {\n throw this._error;\n }\n if (i < this._results.length) {\n return { done: false, value: this._results[i++] };\n }\n if (this._state === AsyncIterableSourceState.DoneOK) {\n return { done: true, value: undefined };\n }\n await event_1.Event.toPromise(this._onStateChanged.event);\n } while (true);\n },\n return: async () => {\n this._onReturn?.();\n return { done: true, value: undefined };\n }\n };\n }\n static map(iterable, mapFn) {\n return new AsyncIterableObject(async (emitter) => {\n for await (const item of iterable) {\n emitter.emitOne(mapFn(item));\n }\n });\n }\n map(mapFn) {\n return AsyncIterableObject.map(this, mapFn);\n }\n static filter(iterable, filterFn) {\n return new AsyncIterableObject(async (emitter) => {\n for await (const item of iterable) {\n if (filterFn(item)) {\n emitter.emitOne(item);\n }\n }\n });\n }\n filter(filterFn) {\n return AsyncIterableObject.filter(this, filterFn);\n }\n static coalesce(iterable) {\n return AsyncIterableObject.filter(iterable, item => !!item);\n }\n coalesce() {\n return AsyncIterableObject.coalesce(this);\n }\n static async toPromise(iterable) {\n const result = [];\n for await (const item of iterable) {\n result.push(item);\n }\n return result;\n }\n toPromise() {\n return AsyncIterableObject.toPromise(this);\n }\n /**\n * The value will be appended at the end.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n emitOne(value) {\n if (this._state !== AsyncIterableSourceState.Initial) {\n return;\n }\n // it is important to add new values at the end,\n // as we may have iterators already running on the array\n this._results.push(value);\n this._onStateChanged.fire();\n }\n /**\n * The values will be appended at the end.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n emitMany(values) {\n if (this._state !== AsyncIterableSourceState.Initial) {\n return;\n }\n // it is important to add new values at the end,\n // as we may have iterators already running on the array\n this._results = this._results.concat(values);\n this._onStateChanged.fire();\n }\n /**\n * Calling `resolve()` will mark the result array as complete.\n *\n * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n resolve() {\n if (this._state !== AsyncIterableSourceState.Initial) {\n return;\n }\n this._state = AsyncIterableSourceState.DoneOK;\n this._onStateChanged.fire();\n }\n /**\n * Writing an error will permanently invalidate this iterable.\n * The current users will receive an error thrown, as will all future users.\n *\n * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n */\n reject(error) {\n if (this._state !== AsyncIterableSourceState.Initial) {\n return;\n }\n this._state = AsyncIterableSourceState.DoneError;\n this._error = error;\n this._onStateChanged.fire();\n }\n}\nexports.AsyncIterableObject = AsyncIterableObject;\nclass CancelableAsyncIterableObject extends AsyncIterableObject {\n constructor(_source, executor) {\n super(executor);\n this._source = _source;\n }\n cancel() {\n this._source.cancel();\n }\n}\nexports.CancelableAsyncIterableObject = CancelableAsyncIterableObject;\nfunction createCancelableAsyncIterable(callback) {\n const source = new cancellation_1.CancellationTokenSource();\n const innerIterable = callback(source.token);\n return new CancelableAsyncIterableObject(source, async (emitter) => {\n const subscription = source.token.onCancellationRequested(() => {\n subscription.dispose();\n source.dispose();\n emitter.reject(new errors_1.CancellationError());\n });\n try {\n for await (const item of innerIterable) {\n if (source.token.isCancellationRequested) {\n // canceled in the meantime\n return;\n }\n emitter.emitOne(item);\n }\n subscription.dispose();\n source.dispose();\n }\n catch (err) {\n subscription.dispose();\n source.dispose();\n emitter.reject(err);\n }\n });\n}\nclass AsyncIterableSource {\n /**\n *\n * @param onReturn A function that will be called when consuming the async iterable\n * has finished by the consumer, e.g the for-await-loop has be existed (break, return) early.\n * This is NOT called when resolving this source by its owner.\n */\n constructor(onReturn) {\n this._deferred = new DeferredPromise();\n this._asyncIterable = new AsyncIterableObject(emitter => {\n if (earlyError) {\n emitter.reject(earlyError);\n return;\n }\n if (earlyItems) {\n emitter.emitMany(earlyItems);\n }\n this._errorFn = (error) => emitter.reject(error);\n this._emitFn = (item) => emitter.emitOne(item);\n return this._deferred.p;\n }, onReturn);\n let earlyError;\n let earlyItems;\n this._emitFn = (item) => {\n if (!earlyItems) {\n earlyItems = [];\n }\n earlyItems.push(item);\n };\n this._errorFn = (error) => {\n if (!earlyError) {\n earlyError = error;\n }\n };\n }\n get asyncIterable() {\n return this._asyncIterable;\n }\n resolve() {\n this._deferred.complete();\n }\n reject(error) {\n this._errorFn(error);\n this._deferred.complete();\n }\n emitOne(item) {\n this._emitFn(item);\n }\n}\nexports.AsyncIterableSource = AsyncIterableSource;\n//#endregion\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CancellationTokenSource = exports.CancellationToken = void 0;\nexports.cancelOnDispose = cancelOnDispose;\nconst event_1 = require(\"vs/base/common/event\");\nconst shortcutEvent = Object.freeze(function (callback, context) {\n const handle = setTimeout(callback.bind(context), 0);\n return { dispose() { clearTimeout(handle); } };\n});\nvar CancellationToken;\n(function (CancellationToken) {\n function isCancellationToken(thing) {\n if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n return true;\n }\n if (thing instanceof MutableToken) {\n return true;\n }\n if (!thing || typeof thing !== 'object') {\n return false;\n }\n return typeof thing.isCancellationRequested === 'boolean'\n && typeof thing.onCancellationRequested === 'function';\n }\n CancellationToken.isCancellationToken = isCancellationToken;\n CancellationToken.None = Object.freeze({\n isCancellationRequested: false,\n onCancellationRequested: event_1.Event.None\n });\n CancellationToken.Cancelled = Object.freeze({\n isCancellationRequested: true,\n onCancellationRequested: shortcutEvent\n });\n})(CancellationToken || (exports.CancellationToken = CancellationToken = {}));\nclass MutableToken {\n constructor() {\n this._isCancelled = false;\n this._emitter = null;\n }\n cancel() {\n if (!this._isCancelled) {\n this._isCancelled = true;\n if (this._emitter) {\n this._emitter.fire(undefined);\n this.dispose();\n }\n }\n }\n get isCancellationRequested() {\n return this._isCancelled;\n }\n get onCancellationRequested() {\n if (this._isCancelled) {\n return shortcutEvent;\n }\n if (!this._emitter) {\n this._emitter = new event_1.Emitter();\n }\n return this._emitter.event;\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n this._emitter = null;\n }\n }\n}\nclass CancellationTokenSource {\n constructor(parent) {\n this._token = undefined;\n this._parentListener = undefined;\n this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n }\n get token() {\n if (!this._token) {\n // be lazy and create the token only when\n // actually needed\n this._token = new MutableToken();\n }\n return this._token;\n }\n cancel() {\n if (!this._token) {\n // save an object by returning the default\n // cancelled token when cancellation happens\n // before someone asks for the token\n this._token = CancellationToken.Cancelled;\n }\n else if (this._token instanceof MutableToken) {\n // actually cancel\n this._token.cancel();\n }\n }\n dispose(cancel = false) {\n if (cancel) {\n this.cancel();\n }\n this._parentListener?.dispose();\n if (!this._token) {\n // ensure to initialize with an empty token if we had none\n this._token = CancellationToken.None;\n }\n else if (this._token instanceof MutableToken) {\n // actually dispose\n this._token.dispose();\n }\n }\n}\nexports.CancellationTokenSource = CancellationTokenSource;\nfunction cancelOnDispose(store) {\n const source = new CancellationTokenSource();\n store.add({ dispose() { source.cancel(); } });\n return source.token;\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CharCode = void 0;\n// Names from https://blog.codinghorror.com/ascii-pronunciation-rules-for-programmers/\n/**\n * An inlined enum containing useful character codes (to be used with String.charCodeAt).\n * Please leave the const keyword such that it gets inlined when compiled to JavaScript!\n */\nvar CharCode;\n(function (CharCode) {\n CharCode[CharCode[\"Null\"] = 0] = \"Null\";\n /**\n * The `\\b` character.\n */\n CharCode[CharCode[\"Backspace\"] = 8] = \"Backspace\";\n /**\n * The `\\t` character.\n */\n CharCode[CharCode[\"Tab\"] = 9] = \"Tab\";\n /**\n * The `\\n` character.\n */\n CharCode[CharCode[\"LineFeed\"] = 10] = \"LineFeed\";\n /**\n * The `\\r` character.\n */\n CharCode[CharCode[\"CarriageReturn\"] = 13] = \"CarriageReturn\";\n CharCode[CharCode[\"Space\"] = 32] = \"Space\";\n /**\n * The `!` character.\n */\n CharCode[CharCode[\"ExclamationMark\"] = 33] = \"ExclamationMark\";\n /**\n * The `\"` character.\n */\n CharCode[CharCode[\"DoubleQuote\"] = 34] = \"DoubleQuote\";\n /**\n * The `#` character.\n */\n CharCode[CharCode[\"Hash\"] = 35] = \"Hash\";\n /**\n * The `$` character.\n */\n CharCode[CharCode[\"DollarSign\"] = 36] = \"DollarSign\";\n /**\n * The `%` character.\n */\n CharCode[CharCode[\"PercentSign\"] = 37] = \"PercentSign\";\n /**\n * The `&` character.\n */\n CharCode[CharCode[\"Ampersand\"] = 38] = \"Ampersand\";\n /**\n * The `'` character.\n */\n CharCode[CharCode[\"SingleQuote\"] = 39] = \"SingleQuote\";\n /**\n * The `(` character.\n */\n CharCode[CharCode[\"OpenParen\"] = 40] = \"OpenParen\";\n /**\n * The `)` character.\n */\n CharCode[CharCode[\"CloseParen\"] = 41] = \"CloseParen\";\n /**\n * The `*` character.\n */\n CharCode[CharCode[\"Asterisk\"] = 42] = \"Asterisk\";\n /**\n * The `+` character.\n */\n CharCode[CharCode[\"Plus\"] = 43] = \"Plus\";\n /**\n * The `,` character.\n */\n CharCode[CharCode[\"Comma\"] = 44] = \"Comma\";\n /**\n * The `-` character.\n */\n CharCode[CharCode[\"Dash\"] = 45] = \"Dash\";\n /**\n * The `.` character.\n */\n CharCode[CharCode[\"Period\"] = 46] = \"Period\";\n /**\n * The `/` character.\n */\n CharCode[CharCode[\"Slash\"] = 47] = \"Slash\";\n CharCode[CharCode[\"Digit0\"] = 48] = \"Digit0\";\n CharCode[CharCode[\"Digit1\"] = 49] = \"Digit1\";\n CharCode[CharCode[\"Digit2\"] = 50] = \"Digit2\";\n CharCode[CharCode[\"Digit3\"] = 51] = \"Digit3\";\n CharCode[CharCode[\"Digit4\"] = 52] = \"Digit4\";\n CharCode[CharCode[\"Digit5\"] = 53] = \"Digit5\";\n CharCode[CharCode[\"Digit6\"] = 54] = \"Digit6\";\n CharCode[CharCode[\"Digit7\"] = 55] = \"Digit7\";\n CharCode[CharCode[\"Digit8\"] = 56] = \"Digit8\";\n CharCode[CharCode[\"Digit9\"] = 57] = \"Digit9\";\n /**\n * The `:` character.\n */\n CharCode[CharCode[\"Colon\"] = 58] = \"Colon\";\n /**\n * The `;` character.\n */\n CharCode[CharCode[\"Semicolon\"] = 59] = \"Semicolon\";\n /**\n * The `<` character.\n */\n CharCode[CharCode[\"LessThan\"] = 60] = \"LessThan\";\n /**\n * The `=` character.\n */\n CharCode[CharCode[\"Equals\"] = 61] = \"Equals\";\n /**\n * The `>` character.\n */\n CharCode[CharCode[\"GreaterThan\"] = 62] = \"GreaterThan\";\n /**\n * The `?` character.\n */\n CharCode[CharCode[\"QuestionMark\"] = 63] = \"QuestionMark\";\n /**\n * The `@` character.\n */\n CharCode[CharCode[\"AtSign\"] = 64] = \"AtSign\";\n CharCode[CharCode[\"A\"] = 65] = \"A\";\n CharCode[CharCode[\"B\"] = 66] = \"B\";\n CharCode[CharCode[\"C\"] = 67] = \"C\";\n CharCode[CharCode[\"D\"] = 68] = \"D\";\n CharCode[CharCode[\"E\"] = 69] = \"E\";\n CharCode[CharCode[\"F\"] = 70] = \"F\";\n CharCode[CharCode[\"G\"] = 71] = \"G\";\n CharCode[CharCode[\"H\"] = 72] = \"H\";\n CharCode[CharCode[\"I\"] = 73] = \"I\";\n CharCode[CharCode[\"J\"] = 74] = \"J\";\n CharCode[CharCode[\"K\"] = 75] = \"K\";\n CharCode[CharCode[\"L\"] = 76] = \"L\";\n CharCode[CharCode[\"M\"] = 77] = \"M\";\n CharCode[CharCode[\"N\"] = 78] = \"N\";\n CharCode[CharCode[\"O\"] = 79] = \"O\";\n CharCode[CharCode[\"P\"] = 80] = \"P\";\n CharCode[CharCode[\"Q\"] = 81] = \"Q\";\n CharCode[CharCode[\"R\"] = 82] = \"R\";\n CharCode[CharCode[\"S\"] = 83] = \"S\";\n CharCode[CharCode[\"T\"] = 84] = \"T\";\n CharCode[CharCode[\"U\"] = 85] = \"U\";\n CharCode[CharCode[\"V\"] = 86] = \"V\";\n CharCode[CharCode[\"W\"] = 87] = \"W\";\n CharCode[CharCode[\"X\"] = 88] = \"X\";\n CharCode[CharCode[\"Y\"] = 89] = \"Y\";\n CharCode[CharCode[\"Z\"] = 90] = \"Z\";\n /**\n * The `[` character.\n */\n CharCode[CharCode[\"OpenSquareBracket\"] = 91] = \"OpenSquareBracket\";\n /**\n * The `\\` character.\n */\n CharCode[CharCode[\"Backslash\"] = 92] = \"Backslash\";\n /**\n * The `]` character.\n */\n CharCode[CharCode[\"CloseSquareBracket\"] = 93] = \"CloseSquareBracket\";\n /**\n * The `^` character.\n */\n CharCode[CharCode[\"Caret\"] = 94] = \"Caret\";\n /**\n * The `_` character.\n */\n CharCode[CharCode[\"Underline\"] = 95] = \"Underline\";\n /**\n * The ``(`)`` character.\n */\n CharCode[CharCode[\"BackTick\"] = 96] = \"BackTick\";\n CharCode[CharCode[\"a\"] = 97] = \"a\";\n CharCode[CharCode[\"b\"] = 98] = \"b\";\n CharCode[CharCode[\"c\"] = 99] = \"c\";\n CharCode[CharCode[\"d\"] = 100] = \"d\";\n CharCode[CharCode[\"e\"] = 101] = \"e\";\n CharCode[CharCode[\"f\"] = 102] = \"f\";\n CharCode[CharCode[\"g\"] = 103] = \"g\";\n CharCode[CharCode[\"h\"] = 104] = \"h\";\n CharCode[CharCode[\"i\"] = 105] = \"i\";\n CharCode[CharCode[\"j\"] = 106] = \"j\";\n CharCode[CharCode[\"k\"] = 107] = \"k\";\n CharCode[CharCode[\"l\"] = 108] = \"l\";\n CharCode[CharCode[\"m\"] = 109] = \"m\";\n CharCode[CharCode[\"n\"] = 110] = \"n\";\n CharCode[CharCode[\"o\"] = 111] = \"o\";\n CharCode[CharCode[\"p\"] = 112] = \"p\";\n CharCode[CharCode[\"q\"] = 113] = \"q\";\n CharCode[CharCode[\"r\"] = 114] = \"r\";\n CharCode[CharCode[\"s\"] = 115] = \"s\";\n CharCode[CharCode[\"t\"] = 116] = \"t\";\n CharCode[CharCode[\"u\"] = 117] = \"u\";\n CharCode[CharCode[\"v\"] = 118] = \"v\";\n CharCode[CharCode[\"w\"] = 119] = \"w\";\n CharCode[CharCode[\"x\"] = 120] = \"x\";\n CharCode[CharCode[\"y\"] = 121] = \"y\";\n CharCode[CharCode[\"z\"] = 122] = \"z\";\n /**\n * The `{` character.\n */\n CharCode[CharCode[\"OpenCurlyBrace\"] = 123] = \"OpenCurlyBrace\";\n /**\n * The `|` character.\n */\n CharCode[CharCode[\"Pipe\"] = 124] = \"Pipe\";\n /**\n * The `}` character.\n */\n CharCode[CharCode[\"CloseCurlyBrace\"] = 125] = \"CloseCurlyBrace\";\n /**\n * The `~` character.\n */\n CharCode[CharCode[\"Tilde\"] = 126] = \"Tilde\";\n /**\n * The   (no-break space) character.\n * Unicode Character 'NO-BREAK SPACE' (U+00A0)\n */\n CharCode[CharCode[\"NoBreakSpace\"] = 160] = \"NoBreakSpace\";\n CharCode[CharCode[\"U_Combining_Grave_Accent\"] = 768] = \"U_Combining_Grave_Accent\";\n CharCode[CharCode[\"U_Combining_Acute_Accent\"] = 769] = \"U_Combining_Acute_Accent\";\n CharCode[CharCode[\"U_Combining_Circumflex_Accent\"] = 770] = \"U_Combining_Circumflex_Accent\";\n CharCode[CharCode[\"U_Combining_Tilde\"] = 771] = \"U_Combining_Tilde\";\n CharCode[CharCode[\"U_Combining_Macron\"] = 772] = \"U_Combining_Macron\";\n CharCode[CharCode[\"U_Combining_Overline\"] = 773] = \"U_Combining_Overline\";\n CharCode[CharCode[\"U_Combining_Breve\"] = 774] = \"U_Combining_Breve\";\n CharCode[CharCode[\"U_Combining_Dot_Above\"] = 775] = \"U_Combining_Dot_Above\";\n CharCode[CharCode[\"U_Combining_Diaeresis\"] = 776] = \"U_Combining_Diaeresis\";\n CharCode[CharCode[\"U_Combining_Hook_Above\"] = 777] = \"U_Combining_Hook_Above\";\n CharCode[CharCode[\"U_Combining_Ring_Above\"] = 778] = \"U_Combining_Ring_Above\";\n CharCode[CharCode[\"U_Combining_Double_Acute_Accent\"] = 779] = \"U_Combining_Double_Acute_Accent\";\n CharCode[CharCode[\"U_Combining_Caron\"] = 780] = \"U_Combining_Caron\";\n CharCode[CharCode[\"U_Combining_Vertical_Line_Above\"] = 781] = \"U_Combining_Vertical_Line_Above\";\n CharCode[CharCode[\"U_Combining_Double_Vertical_Line_Above\"] = 782] = \"U_Combining_Double_Vertical_Line_Above\";\n CharCode[CharCode[\"U_Combining_Double_Grave_Accent\"] = 783] = \"U_Combining_Double_Grave_Accent\";\n CharCode[CharCode[\"U_Combining_Candrabindu\"] = 784] = \"U_Combining_Candrabindu\";\n CharCode[CharCode[\"U_Combining_Inverted_Breve\"] = 785] = \"U_Combining_Inverted_Breve\";\n CharCode[CharCode[\"U_Combining_Turned_Comma_Above\"] = 786] = \"U_Combining_Turned_Comma_Above\";\n CharCode[CharCode[\"U_Combining_Comma_Above\"] = 787] = \"U_Combining_Comma_Above\";\n CharCode[CharCode[\"U_Combining_Reversed_Comma_Above\"] = 788] = \"U_Combining_Reversed_Comma_Above\";\n CharCode[CharCode[\"U_Combining_Comma_Above_Right\"] = 789] = \"U_Combining_Comma_Above_Right\";\n CharCode[CharCode[\"U_Combining_Grave_Accent_Below\"] = 790] = \"U_Combining_Grave_Accent_Below\";\n CharCode[CharCode[\"U_Combining_Acute_Accent_Below\"] = 791] = \"U_Combining_Acute_Accent_Below\";\n CharCode[CharCode[\"U_Combining_Left_Tack_Below\"] = 792] = \"U_Combining_Left_Tack_Below\";\n CharCode[CharCode[\"U_Combining_Right_Tack_Below\"] = 793] = \"U_Combining_Right_Tack_Below\";\n CharCode[CharCode[\"U_Combining_Left_Angle_Above\"] = 794] = \"U_Combining_Left_Angle_Above\";\n CharCode[CharCode[\"U_Combining_Horn\"] = 795] = \"U_Combining_Horn\";\n CharCode[CharCode[\"U_Combining_Left_Half_Ring_Below\"] = 796] = \"U_Combining_Left_Half_Ring_Below\";\n CharCode[CharCode[\"U_Combining_Up_Tack_Below\"] = 797] = \"U_Combining_Up_Tack_Below\";\n CharCode[CharCode[\"U_Combining_Down_Tack_Below\"] = 798] = \"U_Combining_Down_Tack_Below\";\n CharCode[CharCode[\"U_Combining_Plus_Sign_Below\"] = 799] = \"U_Combining_Plus_Sign_Below\";\n CharCode[CharCode[\"U_Combining_Minus_Sign_Below\"] = 800] = \"U_Combining_Minus_Sign_Below\";\n CharCode[CharCode[\"U_Combining_Palatalized_Hook_Below\"] = 801] = \"U_Combining_Palatalized_Hook_Below\";\n CharCode[CharCode[\"U_Combining_Retroflex_Hook_Below\"] = 802] = \"U_Combining_Retroflex_Hook_Below\";\n CharCode[CharCode[\"U_Combining_Dot_Below\"] = 803] = \"U_Combining_Dot_Below\";\n CharCode[CharCode[\"U_Combining_Diaeresis_Below\"] = 804] = \"U_Combining_Diaeresis_Below\";\n CharCode[CharCode[\"U_Combining_Ring_Below\"] = 805] = \"U_Combining_Ring_Below\";\n CharCode[CharCode[\"U_Combining_Comma_Below\"] = 806] = \"U_Combining_Comma_Below\";\n CharCode[CharCode[\"U_Combining_Cedilla\"] = 807] = \"U_Combining_Cedilla\";\n CharCode[CharCode[\"U_Combining_Ogonek\"] = 808] = \"U_Combining_Ogonek\";\n CharCode[CharCode[\"U_Combining_Vertical_Line_Below\"] = 809] = \"U_Combining_Vertical_Line_Below\";\n CharCode[CharCode[\"U_Combining_Bridge_Below\"] = 810] = \"U_Combining_Bridge_Below\";\n CharCode[CharCode[\"U_Combining_Inverted_Double_Arch_Below\"] = 811] = \"U_Combining_Inverted_Double_Arch_Below\";\n CharCode[CharCode[\"U_Combining_Caron_Below\"] = 812] = \"U_Combining_Caron_Below\";\n CharCode[CharCode[\"U_Combining_Circumflex_Accent_Below\"] = 813] = \"U_Combining_Circumflex_Accent_Below\";\n CharCode[CharCode[\"U_Combining_Breve_Below\"] = 814] = \"U_Combining_Breve_Below\";\n CharCode[CharCode[\"U_Combining_Inverted_Breve_Below\"] = 815] = \"U_Combining_Inverted_Breve_Below\";\n CharCode[CharCode[\"U_Combining_Tilde_Below\"] = 816] = \"U_Combining_Tilde_Below\";\n CharCode[CharCode[\"U_Combining_Macron_Below\"] = 817] = \"U_Combining_Macron_Below\";\n CharCode[CharCode[\"U_Combining_Low_Line\"] = 818] = \"U_Combining_Low_Line\";\n CharCode[CharCode[\"U_Combining_Double_Low_Line\"] = 819] = \"U_Combining_Double_Low_Line\";\n CharCode[CharCode[\"U_Combining_Tilde_Overlay\"] = 820] = \"U_Combining_Tilde_Overlay\";\n CharCode[CharCode[\"U_Combining_Short_Stroke_Overlay\"] = 821] = \"U_Combining_Short_Stroke_Overlay\";\n CharCode[CharCode[\"U_Combining_Long_Stroke_Overlay\"] = 822] = \"U_Combining_Long_Stroke_Overlay\";\n CharCode[CharCode[\"U_Combining_Short_Solidus_Overlay\"] = 823] = \"U_Combining_Short_Solidus_Overlay\";\n CharCode[CharCode[\"U_Combining_Long_Solidus_Overlay\"] = 824] = \"U_Combining_Long_Solidus_Overlay\";\n CharCode[CharCode[\"U_Combining_Right_Half_Ring_Below\"] = 825] = \"U_Combining_Right_Half_Ring_Below\";\n CharCode[CharCode[\"U_Combining_Inverted_Bridge_Below\"] = 826] = \"U_Combining_Inverted_Bridge_Below\";\n CharCode[CharCode[\"U_Combining_Square_Below\"] = 827] = \"U_Combining_Square_Below\";\n CharCode[CharCode[\"U_Combining_Seagull_Below\"] = 828] = \"U_Combining_Seagull_Below\";\n CharCode[CharCode[\"U_Combining_X_Above\"] = 829] = \"U_Combining_X_Above\";\n CharCode[CharCode[\"U_Combining_Vertical_Tilde\"] = 830] = \"U_Combining_Vertical_Tilde\";\n CharCode[CharCode[\"U_Combining_Double_Overline\"] = 831] = \"U_Combining_Double_Overline\";\n CharCode[CharCode[\"U_Combining_Grave_Tone_Mark\"] = 832] = \"U_Combining_Grave_Tone_Mark\";\n CharCode[CharCode[\"U_Combining_Acute_Tone_Mark\"] = 833] = \"U_Combining_Acute_Tone_Mark\";\n CharCode[CharCode[\"U_Combining_Greek_Perispomeni\"] = 834] = \"U_Combining_Greek_Perispomeni\";\n CharCode[CharCode[\"U_Combining_Greek_Koronis\"] = 835] = \"U_Combining_Greek_Koronis\";\n CharCode[CharCode[\"U_Combining_Greek_Dialytika_Tonos\"] = 836] = \"U_Combining_Greek_Dialytika_Tonos\";\n CharCode[CharCode[\"U_Combining_Greek_Ypogegrammeni\"] = 837] = \"U_Combining_Greek_Ypogegrammeni\";\n CharCode[CharCode[\"U_Combining_Bridge_Above\"] = 838] = \"U_Combining_Bridge_Above\";\n CharCode[CharCode[\"U_Combining_Equals_Sign_Below\"] = 839] = \"U_Combining_Equals_Sign_Below\";\n CharCode[CharCode[\"U_Combining_Double_Vertical_Line_Below\"] = 840] = \"U_Combining_Double_Vertical_Line_Below\";\n CharCode[CharCode[\"U_Combining_Left_Angle_Below\"] = 841] = \"U_Combining_Left_Angle_Below\";\n CharCode[CharCode[\"U_Combining_Not_Tilde_Above\"] = 842] = \"U_Combining_Not_Tilde_Above\";\n CharCode[CharCode[\"U_Combining_Homothetic_Above\"] = 843] = \"U_Combining_Homothetic_Above\";\n CharCode[CharCode[\"U_Combining_Almost_Equal_To_Above\"] = 844] = \"U_Combining_Almost_Equal_To_Above\";\n CharCode[CharCode[\"U_Combining_Left_Right_Arrow_Below\"] = 845] = \"U_Combining_Left_Right_Arrow_Below\";\n CharCode[CharCode[\"U_Combining_Upwards_Arrow_Below\"] = 846] = \"U_Combining_Upwards_Arrow_Below\";\n CharCode[CharCode[\"U_Combining_Grapheme_Joiner\"] = 847] = \"U_Combining_Grapheme_Joiner\";\n CharCode[CharCode[\"U_Combining_Right_Arrowhead_Above\"] = 848] = \"U_Combining_Right_Arrowhead_Above\";\n CharCode[CharCode[\"U_Combining_Left_Half_Ring_Above\"] = 849] = \"U_Combining_Left_Half_Ring_Above\";\n CharCode[CharCode[\"U_Combining_Fermata\"] = 850] = \"U_Combining_Fermata\";\n CharCode[CharCode[\"U_Combining_X_Below\"] = 851] = \"U_Combining_X_Below\";\n CharCode[CharCode[\"U_Combining_Left_Arrowhead_Below\"] = 852] = \"U_Combining_Left_Arrowhead_Below\";\n CharCode[CharCode[\"U_Combining_Right_Arrowhead_Below\"] = 853] = \"U_Combining_Right_Arrowhead_Below\";\n CharCode[CharCode[\"U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below\"] = 854] = \"U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below\";\n CharCode[CharCode[\"U_Combining_Right_Half_Ring_Above\"] = 855] = \"U_Combining_Right_Half_Ring_Above\";\n CharCode[CharCode[\"U_Combining_Dot_Above_Right\"] = 856] = \"U_Combining_Dot_Above_Right\";\n CharCode[CharCode[\"U_Combining_Asterisk_Below\"] = 857] = \"U_Combining_Asterisk_Below\";\n CharCode[CharCode[\"U_Combining_Double_Ring_Below\"] = 858] = \"U_Combining_Double_Ring_Below\";\n CharCode[CharCode[\"U_Combining_Zigzag_Above\"] = 859] = \"U_Combining_Zigzag_Above\";\n CharCode[CharCode[\"U_Combining_Double_Breve_Below\"] = 860] = \"U_Combining_Double_Breve_Below\";\n CharCode[CharCode[\"U_Combining_Double_Breve\"] = 861] = \"U_Combining_Double_Breve\";\n CharCode[CharCode[\"U_Combining_Double_Macron\"] = 862] = \"U_Combining_Double_Macron\";\n CharCode[CharCode[\"U_Combining_Double_Macron_Below\"] = 863] = \"U_Combining_Double_Macron_Below\";\n CharCode[CharCode[\"U_Combining_Double_Tilde\"] = 864] = \"U_Combining_Double_Tilde\";\n CharCode[CharCode[\"U_Combining_Double_Inverted_Breve\"] = 865] = \"U_Combining_Double_Inverted_Breve\";\n CharCode[CharCode[\"U_Combining_Double_Rightwards_Arrow_Below\"] = 866] = \"U_Combining_Double_Rightwards_Arrow_Below\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_A\"] = 867] = \"U_Combining_Latin_Small_Letter_A\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_E\"] = 868] = \"U_Combining_Latin_Small_Letter_E\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_I\"] = 869] = \"U_Combining_Latin_Small_Letter_I\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_O\"] = 870] = \"U_Combining_Latin_Small_Letter_O\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_U\"] = 871] = \"U_Combining_Latin_Small_Letter_U\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_C\"] = 872] = \"U_Combining_Latin_Small_Letter_C\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_D\"] = 873] = \"U_Combining_Latin_Small_Letter_D\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_H\"] = 874] = \"U_Combining_Latin_Small_Letter_H\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_M\"] = 875] = \"U_Combining_Latin_Small_Letter_M\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_R\"] = 876] = \"U_Combining_Latin_Small_Letter_R\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_T\"] = 877] = \"U_Combining_Latin_Small_Letter_T\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_V\"] = 878] = \"U_Combining_Latin_Small_Letter_V\";\n CharCode[CharCode[\"U_Combining_Latin_Small_Letter_X\"] = 879] = \"U_Combining_Latin_Small_Letter_X\";\n /**\n * Unicode Character 'LINE SEPARATOR' (U+2028)\n * http://www.fileformat.info/info/unicode/char/2028/index.htm\n */\n CharCode[CharCode[\"LINE_SEPARATOR\"] = 8232] = \"LINE_SEPARATOR\";\n /**\n * Unicode Character 'PARAGRAPH SEPARATOR' (U+2029)\n * http://www.fileformat.info/info/unicode/char/2029/index.htm\n */\n CharCode[CharCode[\"PARAGRAPH_SEPARATOR\"] = 8233] = \"PARAGRAPH_SEPARATOR\";\n /**\n * Unicode Character 'NEXT LINE' (U+0085)\n * http://www.fileformat.info/info/unicode/char/0085/index.htm\n */\n CharCode[CharCode[\"NEXT_LINE\"] = 133] = \"NEXT_LINE\";\n // http://www.fileformat.info/info/unicode/category/Sk/list.htm\n CharCode[CharCode[\"U_CIRCUMFLEX\"] = 94] = \"U_CIRCUMFLEX\";\n CharCode[CharCode[\"U_GRAVE_ACCENT\"] = 96] = \"U_GRAVE_ACCENT\";\n CharCode[CharCode[\"U_DIAERESIS\"] = 168] = \"U_DIAERESIS\";\n CharCode[CharCode[\"U_MACRON\"] = 175] = \"U_MACRON\";\n CharCode[CharCode[\"U_ACUTE_ACCENT\"] = 180] = \"U_ACUTE_ACCENT\";\n CharCode[CharCode[\"U_CEDILLA\"] = 184] = \"U_CEDILLA\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LEFT_ARROWHEAD\"] = 706] = \"U_MODIFIER_LETTER_LEFT_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_RIGHT_ARROWHEAD\"] = 707] = \"U_MODIFIER_LETTER_RIGHT_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_UP_ARROWHEAD\"] = 708] = \"U_MODIFIER_LETTER_UP_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_DOWN_ARROWHEAD\"] = 709] = \"U_MODIFIER_LETTER_DOWN_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING\"] = 722] = \"U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING\"] = 723] = \"U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_UP_TACK\"] = 724] = \"U_MODIFIER_LETTER_UP_TACK\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_DOWN_TACK\"] = 725] = \"U_MODIFIER_LETTER_DOWN_TACK\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_PLUS_SIGN\"] = 726] = \"U_MODIFIER_LETTER_PLUS_SIGN\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_MINUS_SIGN\"] = 727] = \"U_MODIFIER_LETTER_MINUS_SIGN\";\n CharCode[CharCode[\"U_BREVE\"] = 728] = \"U_BREVE\";\n CharCode[CharCode[\"U_DOT_ABOVE\"] = 729] = \"U_DOT_ABOVE\";\n CharCode[CharCode[\"U_RING_ABOVE\"] = 730] = \"U_RING_ABOVE\";\n CharCode[CharCode[\"U_OGONEK\"] = 731] = \"U_OGONEK\";\n CharCode[CharCode[\"U_SMALL_TILDE\"] = 732] = \"U_SMALL_TILDE\";\n CharCode[CharCode[\"U_DOUBLE_ACUTE_ACCENT\"] = 733] = \"U_DOUBLE_ACUTE_ACCENT\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_RHOTIC_HOOK\"] = 734] = \"U_MODIFIER_LETTER_RHOTIC_HOOK\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_CROSS_ACCENT\"] = 735] = \"U_MODIFIER_LETTER_CROSS_ACCENT\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR\"] = 741] = \"U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_HIGH_TONE_BAR\"] = 742] = \"U_MODIFIER_LETTER_HIGH_TONE_BAR\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_MID_TONE_BAR\"] = 743] = \"U_MODIFIER_LETTER_MID_TONE_BAR\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_TONE_BAR\"] = 744] = \"U_MODIFIER_LETTER_LOW_TONE_BAR\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR\"] = 745] = \"U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK\"] = 746] = \"U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK\"] = 747] = \"U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_UNASPIRATED\"] = 749] = \"U_MODIFIER_LETTER_UNASPIRATED\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD\"] = 751] = \"U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_UP_ARROWHEAD\"] = 752] = \"U_MODIFIER_LETTER_LOW_UP_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD\"] = 753] = \"U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD\"] = 754] = \"U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_RING\"] = 755] = \"U_MODIFIER_LETTER_LOW_RING\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT\"] = 756] = \"U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT\"] = 757] = \"U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT\"] = 758] = \"U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_TILDE\"] = 759] = \"U_MODIFIER_LETTER_LOW_TILDE\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_RAISED_COLON\"] = 760] = \"U_MODIFIER_LETTER_RAISED_COLON\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_BEGIN_HIGH_TONE\"] = 761] = \"U_MODIFIER_LETTER_BEGIN_HIGH_TONE\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_END_HIGH_TONE\"] = 762] = \"U_MODIFIER_LETTER_END_HIGH_TONE\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_BEGIN_LOW_TONE\"] = 763] = \"U_MODIFIER_LETTER_BEGIN_LOW_TONE\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_END_LOW_TONE\"] = 764] = \"U_MODIFIER_LETTER_END_LOW_TONE\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_SHELF\"] = 765] = \"U_MODIFIER_LETTER_SHELF\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_OPEN_SHELF\"] = 766] = \"U_MODIFIER_LETTER_OPEN_SHELF\";\n CharCode[CharCode[\"U_MODIFIER_LETTER_LOW_LEFT_ARROW\"] = 767] = \"U_MODIFIER_LETTER_LOW_LEFT_ARROW\";\n CharCode[CharCode[\"U_GREEK_LOWER_NUMERAL_SIGN\"] = 885] = \"U_GREEK_LOWER_NUMERAL_SIGN\";\n CharCode[CharCode[\"U_GREEK_TONOS\"] = 900] = \"U_GREEK_TONOS\";\n CharCode[CharCode[\"U_GREEK_DIALYTIKA_TONOS\"] = 901] = \"U_GREEK_DIALYTIKA_TONOS\";\n CharCode[CharCode[\"U_GREEK_KORONIS\"] = 8125] = \"U_GREEK_KORONIS\";\n CharCode[CharCode[\"U_GREEK_PSILI\"] = 8127] = \"U_GREEK_PSILI\";\n CharCode[CharCode[\"U_GREEK_PERISPOMENI\"] = 8128] = \"U_GREEK_PERISPOMENI\";\n CharCode[CharCode[\"U_GREEK_DIALYTIKA_AND_PERISPOMENI\"] = 8129] = \"U_GREEK_DIALYTIKA_AND_PERISPOMENI\";\n CharCode[CharCode[\"U_GREEK_PSILI_AND_VARIA\"] = 8141] = \"U_GREEK_PSILI_AND_VARIA\";\n CharCode[CharCode[\"U_GREEK_PSILI_AND_OXIA\"] = 8142] = \"U_GREEK_PSILI_AND_OXIA\";\n CharCode[CharCode[\"U_GREEK_PSILI_AND_PERISPOMENI\"] = 8143] = \"U_GREEK_PSILI_AND_PERISPOMENI\";\n CharCode[CharCode[\"U_GREEK_DASIA_AND_VARIA\"] = 8157] = \"U_GREEK_DASIA_AND_VARIA\";\n CharCode[CharCode[\"U_GREEK_DASIA_AND_OXIA\"] = 8158] = \"U_GREEK_DASIA_AND_OXIA\";\n CharCode[CharCode[\"U_GREEK_DASIA_AND_PERISPOMENI\"] = 8159] = \"U_GREEK_DASIA_AND_PERISPOMENI\";\n CharCode[CharCode[\"U_GREEK_DIALYTIKA_AND_VARIA\"] = 8173] = \"U_GREEK_DIALYTIKA_AND_VARIA\";\n CharCode[CharCode[\"U_GREEK_DIALYTIKA_AND_OXIA\"] = 8174] = \"U_GREEK_DIALYTIKA_AND_OXIA\";\n CharCode[CharCode[\"U_GREEK_VARIA\"] = 8175] = \"U_GREEK_VARIA\";\n CharCode[CharCode[\"U_GREEK_OXIA\"] = 8189] = \"U_GREEK_OXIA\";\n CharCode[CharCode[\"U_GREEK_DASIA\"] = 8190] = \"U_GREEK_DASIA\";\n CharCode[CharCode[\"U_IDEOGRAPHIC_FULL_STOP\"] = 12290] = \"U_IDEOGRAPHIC_FULL_STOP\";\n CharCode[CharCode[\"U_LEFT_CORNER_BRACKET\"] = 12300] = \"U_LEFT_CORNER_BRACKET\";\n CharCode[CharCode[\"U_RIGHT_CORNER_BRACKET\"] = 12301] = \"U_RIGHT_CORNER_BRACKET\";\n CharCode[CharCode[\"U_LEFT_BLACK_LENTICULAR_BRACKET\"] = 12304] = \"U_LEFT_BLACK_LENTICULAR_BRACKET\";\n CharCode[CharCode[\"U_RIGHT_BLACK_LENTICULAR_BRACKET\"] = 12305] = \"U_RIGHT_BLACK_LENTICULAR_BRACKET\";\n CharCode[CharCode[\"U_OVERLINE\"] = 8254] = \"U_OVERLINE\";\n /**\n * UTF-8 BOM\n * Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF)\n * http://www.fileformat.info/info/unicode/char/feff/index.htm\n */\n CharCode[CharCode[\"UTF8_BOM\"] = 65279] = \"UTF8_BOM\";\n CharCode[CharCode[\"U_FULLWIDTH_SEMICOLON\"] = 65307] = \"U_FULLWIDTH_SEMICOLON\";\n CharCode[CharCode[\"U_FULLWIDTH_COMMA\"] = 65292] = \"U_FULLWIDTH_COMMA\";\n})(CharCode || (exports.CharCode = CharCode = {}));\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SetWithKey = void 0;\nexports.groupBy = groupBy;\nexports.diffSets = diffSets;\nexports.diffMaps = diffMaps;\nexports.intersection = intersection;\n/**\n * Groups the collection into a dictionary based on the provided\n * group function.\n */\nfunction groupBy(data, groupFn) {\n const result = Object.create(null);\n for (const element of data) {\n const key = groupFn(element);\n let target = result[key];\n if (!target) {\n target = result[key] = [];\n }\n target.push(element);\n }\n return result;\n}\nfunction diffSets(before, after) {\n const removed = [];\n const added = [];\n for (const element of before) {\n if (!after.has(element)) {\n removed.push(element);\n }\n }\n for (const element of after) {\n if (!before.has(element)) {\n added.push(element);\n }\n }\n return { removed, added };\n}\nfunction diffMaps(before, after) {\n const removed = [];\n const added = [];\n for (const [index, value] of before) {\n if (!after.has(index)) {\n removed.push(value);\n }\n }\n for (const [index, value] of after) {\n if (!before.has(index)) {\n added.push(value);\n }\n }\n return { removed, added };\n}\n/**\n * Computes the intersection of two sets.\n *\n * @param setA - The first set.\n * @param setB - The second iterable.\n * @returns A new set containing the elements that are in both `setA` and `setB`.\n */\nfunction intersection(setA, setB) {\n const result = new Set();\n for (const elem of setB) {\n if (setA.has(elem)) {\n result.add(elem);\n }\n }\n return result;\n}\nclass SetWithKey {\n static { _a = Symbol.toStringTag; }\n constructor(values, toKey) {\n this.toKey = toKey;\n this._map = new Map();\n this[_a] = 'SetWithKey';\n for (const value of values) {\n this.add(value);\n }\n }\n get size() {\n return this._map.size;\n }\n add(value) {\n const key = this.toKey(value);\n this._map.set(key, value);\n return this;\n }\n delete(value) {\n return this._map.delete(this.toKey(value));\n }\n has(value) {\n return this._map.has(this.toKey(value));\n }\n *entries() {\n for (const entry of this._map.values()) {\n yield [entry, entry];\n }\n }\n keys() {\n return this.values();\n }\n *values() {\n for (const entry of this._map.values()) {\n yield entry;\n }\n }\n clear() {\n this._map.clear();\n }\n forEach(callbackfn, thisArg) {\n this._map.forEach(entry => callbackfn.call(thisArg, entry, entry, this));\n }\n [Symbol.iterator]() {\n return this.values();\n }\n}\nexports.SetWithKey = SetWithKey;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.memoize = memoize;\nexports.debounce = debounce;\nexports.throttle = throttle;\nfunction createDecorator(mapFn) {\n return (target, key, descriptor) => {\n let fnKey = null;\n let fn = null;\n if (typeof descriptor.value === 'function') {\n fnKey = 'value';\n fn = descriptor.value;\n }\n else if (typeof descriptor.get === 'function') {\n fnKey = 'get';\n fn = descriptor.get;\n }\n if (!fn) {\n throw new Error('not supported');\n }\n descriptor[fnKey] = mapFn(fn, key);\n };\n}\nfunction memoize(_target, key, descriptor) {\n let fnKey = null;\n let fn = null;\n if (typeof descriptor.value === 'function') {\n fnKey = 'value';\n fn = descriptor.value;\n if (fn.length !== 0) {\n console.warn('Memoize should only be used in functions with zero parameters');\n }\n }\n else if (typeof descriptor.get === 'function') {\n fnKey = 'get';\n fn = descriptor.get;\n }\n if (!fn) {\n throw new Error('not supported');\n }\n const memoizeKey = `$memoize$${key}`;\n descriptor[fnKey] = function (...args) {\n if (!this.hasOwnProperty(memoizeKey)) {\n Object.defineProperty(this, memoizeKey, {\n configurable: false,\n enumerable: false,\n writable: false,\n value: fn.apply(this, args)\n });\n }\n return this[memoizeKey];\n };\n}\nfunction debounce(delay, reducer, initialValueProvider) {\n return createDecorator((fn, key) => {\n const timerKey = `$debounce$${key}`;\n const resultKey = `$debounce$result$${key}`;\n return function (...args) {\n if (!this[resultKey]) {\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }\n clearTimeout(this[timerKey]);\n if (reducer) {\n this[resultKey] = reducer(this[resultKey], ...args);\n args = [this[resultKey]];\n }\n this[timerKey] = setTimeout(() => {\n fn.apply(this, args);\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }, delay);\n };\n });\n}\nfunction throttle(delay, reducer, initialValueProvider) {\n return createDecorator((fn, key) => {\n const timerKey = `$throttle$timer$${key}`;\n const resultKey = `$throttle$result$${key}`;\n const lastRunKey = `$throttle$lastRun$${key}`;\n const pendingKey = `$throttle$pending$${key}`;\n return function (...args) {\n if (!this[resultKey]) {\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }\n if (this[lastRunKey] === null || this[lastRunKey] === undefined) {\n this[lastRunKey] = -Number.MAX_VALUE;\n }\n if (reducer) {\n this[resultKey] = reducer(this[resultKey], ...args);\n }\n if (this[pendingKey]) {\n return;\n }\n const nextTime = this[lastRunKey] + delay;\n if (nextTime <= Date.now()) {\n this[lastRunKey] = Date.now();\n fn.apply(this, [this[resultKey]]);\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }\n else {\n this[pendingKey] = true;\n this[timerKey] = setTimeout(() => {\n this[pendingKey] = false;\n this[lastRunKey] = Date.now();\n fn.apply(this, [this[resultKey]]);\n this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n }, nextTime - Date.now());\n }\n };\n });\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BugIndicatingError = exports.ErrorNoTelemetry = exports.ExpectedError = exports.NotSupportedError = exports.NotImplementedError = exports.ReadonlyError = exports.CancellationError = exports.errorHandler = exports.ErrorHandler = void 0;\nexports.setUnexpectedErrorHandler = setUnexpectedErrorHandler;\nexports.isSigPipeError = isSigPipeError;\nexports.onUnexpectedError = onUnexpectedError;\nexports.onUnexpectedExternalError = onUnexpectedExternalError;\nexports.transformErrorForSerialization = transformErrorForSerialization;\nexports.transformErrorFromSerialization = transformErrorFromSerialization;\nexports.isCancellationError = isCancellationError;\nexports.canceled = canceled;\nexports.illegalArgument = illegalArgument;\nexports.illegalState = illegalState;\nexports.getErrorMessage = getErrorMessage;\n// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\nclass ErrorHandler {\n constructor() {\n this.listeners = [];\n this.unexpectedErrorHandler = function (e) {\n setTimeout(() => {\n if (e.stack) {\n if (ErrorNoTelemetry.isErrorNoTelemetry(e)) {\n throw new ErrorNoTelemetry(e.message + '\\n\\n' + e.stack);\n }\n throw new Error(e.message + '\\n\\n' + e.stack);\n }\n throw e;\n }, 0);\n };\n }\n addListener(listener) {\n this.listeners.push(listener);\n return () => {\n this._removeListener(listener);\n };\n }\n emit(e) {\n this.listeners.forEach((listener) => {\n listener(e);\n });\n }\n _removeListener(listener) {\n this.listeners.splice(this.listeners.indexOf(listener), 1);\n }\n setUnexpectedErrorHandler(newUnexpectedErrorHandler) {\n this.unexpectedErrorHandler = newUnexpectedErrorHandler;\n }\n getUnexpectedErrorHandler() {\n return this.unexpectedErrorHandler;\n }\n onUnexpectedError(e) {\n this.unexpectedErrorHandler(e);\n this.emit(e);\n }\n // For external errors, we don't want the listeners to be called\n onUnexpectedExternalError(e) {\n this.unexpectedErrorHandler(e);\n }\n}\nexports.ErrorHandler = ErrorHandler;\nexports.errorHandler = new ErrorHandler();\n/** @skipMangle */\nfunction setUnexpectedErrorHandler(newUnexpectedErrorHandler) {\n exports.errorHandler.setUnexpectedErrorHandler(newUnexpectedErrorHandler);\n}\n/**\n * Returns if the error is a SIGPIPE error. SIGPIPE errors should generally be\n * logged at most once, to avoid a loop.\n *\n * @see https://github.com/microsoft/vscode-remote-release/issues/6481\n */\nfunction isSigPipeError(e) {\n if (!e || typeof e !== 'object') {\n return false;\n }\n const cast = e;\n return cast.code === 'EPIPE' && cast.syscall?.toUpperCase() === 'WRITE';\n}\nfunction onUnexpectedError(e) {\n // ignore errors from cancelled promises\n if (!isCancellationError(e)) {\n exports.errorHandler.onUnexpectedError(e);\n }\n return undefined;\n}\nfunction onUnexpectedExternalError(e) {\n // ignore errors from cancelled promises\n if (!isCancellationError(e)) {\n exports.errorHandler.onUnexpectedExternalError(e);\n }\n return undefined;\n}\nfunction transformErrorForSerialization(error) {\n if (error instanceof Error) {\n const { name, message } = error;\n const stack = error.stacktrace || error.stack;\n return {\n $isError: true,\n name,\n message,\n stack,\n noTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error)\n };\n }\n // return as is\n return error;\n}\nfunction transformErrorFromSerialization(data) {\n let error;\n if (data.noTelemetry) {\n error = new ErrorNoTelemetry();\n }\n else {\n error = new Error();\n error.name = data.name;\n }\n error.message = data.message;\n error.stack = data.stack;\n return error;\n}\nconst canceledName = 'Canceled';\n/**\n * Checks if the given error is a promise in canceled state\n */\nfunction isCancellationError(error) {\n if (error instanceof CancellationError) {\n return true;\n }\n return error instanceof Error && error.name === canceledName && error.message === canceledName;\n}\n// !!!IMPORTANT!!!\n// Do NOT change this class because it is also used as an API-type.\nclass CancellationError extends Error {\n constructor() {\n super(canceledName);\n this.name = this.message;\n }\n}\nexports.CancellationError = CancellationError;\n/**\n * @deprecated use {@link CancellationError `new CancellationError()`} instead\n */\nfunction canceled() {\n const error = new Error(canceledName);\n error.name = error.message;\n return error;\n}\nfunction illegalArgument(name) {\n if (name) {\n return new Error(`Illegal argument: ${name}`);\n }\n else {\n return new Error('Illegal argument');\n }\n}\nfunction illegalState(name) {\n if (name) {\n return new Error(`Illegal state: ${name}`);\n }\n else {\n return new Error('Illegal state');\n }\n}\nclass ReadonlyError extends TypeError {\n constructor(name) {\n super(name ? `${name} is read-only and cannot be changed` : 'Cannot change read-only property');\n }\n}\nexports.ReadonlyError = ReadonlyError;\nfunction getErrorMessage(err) {\n if (!err) {\n return 'Error';\n }\n if (err.message) {\n return err.message;\n }\n if (err.stack) {\n return err.stack.split('\\n')[0];\n }\n return String(err);\n}\nclass NotImplementedError extends Error {\n constructor(message) {\n super('NotImplemented');\n if (message) {\n this.message = message;\n }\n }\n}\nexports.NotImplementedError = NotImplementedError;\nclass NotSupportedError extends Error {\n constructor(message) {\n super('NotSupported');\n if (message) {\n this.message = message;\n }\n }\n}\nexports.NotSupportedError = NotSupportedError;\nclass ExpectedError extends Error {\n constructor() {\n super(...arguments);\n this.isExpected = true;\n }\n}\nexports.ExpectedError = ExpectedError;\n/**\n * Error that when thrown won't be logged in telemetry as an unhandled error.\n */\nclass ErrorNoTelemetry extends Error {\n constructor(msg) {\n super(msg);\n this.name = 'CodeExpectedError';\n }\n static fromError(err) {\n if (err instanceof ErrorNoTelemetry) {\n return err;\n }\n const result = new ErrorNoTelemetry();\n result.message = err.message;\n result.stack = err.stack;\n return result;\n }\n static isErrorNoTelemetry(err) {\n return err.name === 'CodeExpectedError';\n }\n}\nexports.ErrorNoTelemetry = ErrorNoTelemetry;\n/**\n * This error indicates a bug.\n * Do not throw this for invalid user input.\n * Only catch this error to recover gracefully from bugs.\n */\nclass BugIndicatingError extends Error {\n constructor(message) {\n super(message || 'An unexpected bug occurred.');\n Object.setPrototypeOf(this, BugIndicatingError.prototype);\n // Because we know for sure only buggy code throws this,\n // we definitely want to break here and fix the bug.\n // eslint-disable-next-line no-debugger\n // debugger;\n }\n}\nexports.BugIndicatingError = BugIndicatingError;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ValueWithChangeEvent = exports.Relay = exports.EventBufferer = exports.DynamicListEventMultiplexer = exports.EventMultiplexer = exports.MicrotaskEmitter = exports.DebounceEmitter = exports.PauseableEmitter = exports.AsyncEmitter = exports.createEventDeliveryQueue = exports.Emitter = exports.ListenerRefusalError = exports.ListenerLeakError = exports.EventProfiling = exports.Event = void 0;\nexports.setGlobalLeakWarningThreshold = setGlobalLeakWarningThreshold;\nconst errors_1 = require(\"vs/base/common/errors\");\nconst functional_1 = require(\"vs/base/common/functional\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nconst linkedList_1 = require(\"vs/base/common/linkedList\");\nconst stopwatch_1 = require(\"vs/base/common/stopwatch\");\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a listener is GC'ed without having been disposed. This is a LEAK.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableListenerGCedWarning = false;\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableDisposeWithListenerWarning = false;\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup.\n// See https://github.com/microsoft/vscode/issues/142851\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableSnapshotPotentialLeakWarning = false;\nvar Event;\n(function (Event) {\n Event.None = () => lifecycle_1.Disposable.None;\n function _addLeakageTraceLogic(options) {\n if (_enableSnapshotPotentialLeakWarning) {\n const { onDidAddListener: origListenerDidAdd } = options;\n const stack = Stacktrace.create();\n let count = 0;\n options.onDidAddListener = () => {\n if (++count === 2) {\n console.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here');\n stack.print();\n }\n origListenerDidAdd?.();\n };\n }\n }\n /**\n * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared\n * `setTimeout`. The event is converted into a signal (`Event`) to avoid additional object creation as a\n * result of merging events and to try prevent race conditions that could arise when using related deferred and\n * non-deferred events.\n *\n * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work\n * (eg. latency of keypress to text rendered).\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function defer(event, disposable) {\n return debounce(event, () => void 0, 0, undefined, true, undefined, disposable);\n }\n Event.defer = defer;\n /**\n * Given an event, returns another event which only fires once.\n *\n * @param event The event source for the new event.\n */\n function once(event) {\n return (listener, thisArgs = null, disposables) => {\n // we need this, in case the event fires during the listener call\n let didFire = false;\n let result = undefined;\n result = event(e => {\n if (didFire) {\n return;\n }\n else if (result) {\n result.dispose();\n }\n else {\n didFire = true;\n }\n return listener.call(thisArgs, e);\n }, null, disposables);\n if (didFire) {\n result.dispose();\n }\n return result;\n };\n }\n Event.once = once;\n /**\n * Maps an event of one type into an event of another type using a mapping function, similar to how\n * `Array.prototype.map` works.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param map The mapping function.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function map(event, map, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);\n }\n Event.map = map;\n /**\n * Wraps an event in another event that performs some function on the event object before firing.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param each The function to perform on the event object.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function forEach(event, each, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n }\n Event.forEach = forEach;\n function filter(event, filter, disposable) {\n return snapshot((listener, thisArgs = null, disposables) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);\n }\n Event.filter = filter;\n /**\n * Given an event, returns the same event but typed as `Event`.\n */\n function signal(event) {\n return event;\n }\n Event.signal = signal;\n function any(...events) {\n return (listener, thisArgs = null, disposables) => {\n const disposable = (0, lifecycle_1.combinedDisposable)(...events.map(event => event(e => listener.call(thisArgs, e))));\n return addAndReturnDisposable(disposable, disposables);\n };\n }\n Event.any = any;\n /**\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n */\n function reduce(event, merge, initial, disposable) {\n let output = initial;\n return map(event, e => {\n output = merge(output, e);\n return output;\n }, disposable);\n }\n Event.reduce = reduce;\n function snapshot(event, disposable) {\n let listener;\n const options = {\n onWillAddFirstListener() {\n listener = event(emitter.fire, emitter);\n },\n onDidRemoveLastListener() {\n listener?.dispose();\n }\n };\n if (!disposable) {\n _addLeakageTraceLogic(options);\n }\n const emitter = new Emitter(options);\n disposable?.add(emitter);\n return emitter.event;\n }\n /**\n * Adds the IDisposable to the store if it's set, and returns it. Useful to\n * Event function implementation.\n */\n function addAndReturnDisposable(d, store) {\n if (store instanceof Array) {\n store.push(d);\n }\n else if (store) {\n store.add(d);\n }\n return d;\n }\n function debounce(event, merge, delay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold, disposable) {\n let subscription;\n let output = undefined;\n let handle = undefined;\n let numDebouncedCalls = 0;\n let doFire;\n const options = {\n leakWarningThreshold,\n onWillAddFirstListener() {\n subscription = event(cur => {\n numDebouncedCalls++;\n output = merge(output, cur);\n if (leading && !handle) {\n emitter.fire(output);\n output = undefined;\n }\n doFire = () => {\n const _output = output;\n output = undefined;\n handle = undefined;\n if (!leading || numDebouncedCalls > 1) {\n emitter.fire(_output);\n }\n numDebouncedCalls = 0;\n };\n if (typeof delay === 'number') {\n clearTimeout(handle);\n handle = setTimeout(doFire, delay);\n }\n else {\n if (handle === undefined) {\n handle = 0;\n queueMicrotask(doFire);\n }\n }\n });\n },\n onWillRemoveListener() {\n if (flushOnListenerRemove && numDebouncedCalls > 0) {\n doFire?.();\n }\n },\n onDidRemoveLastListener() {\n doFire = undefined;\n subscription.dispose();\n }\n };\n if (!disposable) {\n _addLeakageTraceLogic(options);\n }\n const emitter = new Emitter(options);\n disposable?.add(emitter);\n return emitter.event;\n }\n Event.debounce = debounce;\n /**\n * Debounces an event, firing after some delay (default=0) with an array of all event original objects.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n */\n function accumulate(event, delay = 0, disposable) {\n return Event.debounce(event, (last, e) => {\n if (!last) {\n return [e];\n }\n last.push(e);\n return last;\n }, delay, undefined, true, undefined, disposable);\n }\n Event.accumulate = accumulate;\n /**\n * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate\n * event objects from different sources do not fire the same event object.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param equals The equality condition.\n * @param disposable A disposable store to add the new EventEmitter to.\n *\n * @example\n * ```\n * // Fire only one time when a single window is opened or focused\n * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))\n * ```\n */\n function latch(event, equals = (a, b) => a === b, disposable) {\n let firstCall = true;\n let cache;\n return filter(event, value => {\n const shouldEmit = firstCall || !equals(value, cache);\n firstCall = false;\n cache = value;\n return shouldEmit;\n }, disposable);\n }\n Event.latch = latch;\n /**\n * Splits an event whose parameter is a union type into 2 separate events for each type in the union.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @example\n * ```\n * const event = new EventEmitter().event;\n * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);\n * ```\n *\n * @param event The event source for the new event.\n * @param isT A function that determines what event is of the first type.\n * @param disposable A disposable store to add the new EventEmitter to.\n */\n function split(event, isT, disposable) {\n return [\n Event.filter(event, isT, disposable),\n Event.filter(event, e => !isT(e), disposable),\n ];\n }\n Event.split = split;\n /**\n * Buffers an event until it has a listener attached.\n *\n * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n * returned event causes this utility to leak a listener on the original event.\n *\n * @param event The event source for the new event.\n * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a\n * `setTimeout` when the first event listener is added.\n * @param _buffer Internal: A source event array used for tests.\n *\n * @example\n * ```\n * // Start accumulating events, when the first listener is attached, flush\n * // the event after a timeout such that multiple listeners attached before\n * // the timeout would receive the event\n * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n * ```\n */\n function buffer(event, flushAfterTimeout = false, _buffer = [], disposable) {\n let buffer = _buffer.slice();\n let listener = event(e => {\n if (buffer) {\n buffer.push(e);\n }\n else {\n emitter.fire(e);\n }\n });\n if (disposable) {\n disposable.add(listener);\n }\n const flush = () => {\n buffer?.forEach(e => emitter.fire(e));\n buffer = null;\n };\n const emitter = new Emitter({\n onWillAddFirstListener() {\n if (!listener) {\n listener = event(e => emitter.fire(e));\n if (disposable) {\n disposable.add(listener);\n }\n }\n },\n onDidAddFirstListener() {\n if (buffer) {\n if (flushAfterTimeout) {\n setTimeout(flush);\n }\n else {\n flush();\n }\n }\n },\n onDidRemoveLastListener() {\n if (listener) {\n listener.dispose();\n }\n listener = null;\n }\n });\n if (disposable) {\n disposable.add(emitter);\n }\n return emitter.event;\n }\n Event.buffer = buffer;\n /**\n * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.\n *\n * @example\n * ```\n * // Normal\n * const onEnterPressNormal = Event.filter(\n * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),\n * e.keyCode === KeyCode.Enter\n * ).event;\n *\n * // Using chain\n * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $\n * .map(e => new StandardKeyboardEvent(e))\n * .filter(e => e.keyCode === KeyCode.Enter)\n * );\n * ```\n */\n function chain(event, sythensize) {\n const fn = (listener, thisArgs, disposables) => {\n const cs = sythensize(new ChainableSynthesis());\n return event(function (value) {\n const result = cs.evaluate(value);\n if (result !== HaltChainable) {\n listener.call(thisArgs, result);\n }\n }, undefined, disposables);\n };\n return fn;\n }\n Event.chain = chain;\n const HaltChainable = Symbol('HaltChainable');\n class ChainableSynthesis {\n constructor() {\n this.steps = [];\n }\n map(fn) {\n this.steps.push(fn);\n return this;\n }\n forEach(fn) {\n this.steps.push(v => {\n fn(v);\n return v;\n });\n return this;\n }\n filter(fn) {\n this.steps.push(v => fn(v) ? v : HaltChainable);\n return this;\n }\n reduce(merge, initial) {\n let last = initial;\n this.steps.push(v => {\n last = merge(last, v);\n return last;\n });\n return this;\n }\n latch(equals = (a, b) => a === b) {\n let firstCall = true;\n let cache;\n this.steps.push(value => {\n const shouldEmit = firstCall || !equals(value, cache);\n firstCall = false;\n cache = value;\n return shouldEmit ? value : HaltChainable;\n });\n return this;\n }\n evaluate(value) {\n for (const step of this.steps) {\n value = step(value);\n if (value === HaltChainable) {\n break;\n }\n }\n return value;\n }\n }\n /**\n * Creates an {@link Event} from a node event emitter.\n */\n function fromNodeEventEmitter(emitter, eventName, map = id => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.on(eventName, fn);\n const onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n return result.event;\n }\n Event.fromNodeEventEmitter = fromNodeEventEmitter;\n /**\n * Creates an {@link Event} from a DOM event emitter.\n */\n function fromDOMEventEmitter(emitter, eventName, map = id => id) {\n const fn = (...args) => result.fire(map(...args));\n const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\n const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\n const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n return result.event;\n }\n Event.fromDOMEventEmitter = fromDOMEventEmitter;\n /**\n * Creates a promise out of an event, using the {@link Event.once} helper.\n */\n function toPromise(event) {\n return new Promise(resolve => once(event)(resolve));\n }\n Event.toPromise = toPromise;\n /**\n * Creates an event out of a promise that fires once when the promise is\n * resolved with the result of the promise or `undefined`.\n */\n function fromPromise(promise) {\n const result = new Emitter();\n promise.then(res => {\n result.fire(res);\n }, () => {\n result.fire(undefined);\n }).finally(() => {\n result.dispose();\n });\n return result.event;\n }\n Event.fromPromise = fromPromise;\n /**\n * A convenience function for forwarding an event to another emitter which\n * improves readability.allows Event.forward(event, emitter) instead of `event(e => emitter.fire(e))`.\n * @param from The event to forward.\n * @param to The emitter to forward the event to.\n * @example\n * Event.forward(event, emitter);\n * // equivalent to\n * event(e => emitter.fire(e));\n * // equivalent to\n * event(emitter.fire, emitter);\n */\n function forward(from, to) {\n return from(e => to.fire(e));\n }\n Event.forward = forward;\n function runAndSubscribe(event, handler, initial) {\n handler(initial);\n return event(e => handler(e));\n }\n Event.runAndSubscribe = runAndSubscribe;\n class EmitterObserver {\n constructor(_observable, store) {\n this._observable = _observable;\n this._counter = 0;\n this._hasChanged = false;\n const options = {\n onWillAddFirstListener: () => {\n _observable.addObserver(this);\n },\n onDidRemoveLastListener: () => {\n _observable.removeObserver(this);\n }\n };\n if (!store) {\n _addLeakageTraceLogic(options);\n }\n this.emitter = new Emitter(options);\n if (store) {\n store.add(this.emitter);\n }\n }\n beginUpdate(_observable) {\n // assert(_observable === this.obs);\n this._counter++;\n }\n handlePossibleChange(_observable) {\n // assert(_observable === this.obs);\n }\n handleChange(_observable, _change) {\n // assert(_observable === this.obs);\n this._hasChanged = true;\n }\n endUpdate(_observable) {\n // assert(_observable === this.obs);\n this._counter--;\n if (this._counter === 0) {\n this._observable.reportChanges();\n if (this._hasChanged) {\n this._hasChanged = false;\n this.emitter.fire(this._observable.get());\n }\n }\n }\n }\n /**\n * Creates an event emitter that is fired when the observable changes.\n * Each listeners subscribes to the emitter.\n */\n function fromObservable(obs, store) {\n const observer = new EmitterObserver(obs, store);\n return observer.emitter.event;\n }\n Event.fromObservable = fromObservable;\n /**\n * Each listener is attached to the observable directly.\n */\n function fromObservableLight(observable) {\n return (listener, thisArgs, disposables) => {\n let count = 0;\n let didChange = false;\n const observer = {\n beginUpdate() {\n count++;\n },\n endUpdate() {\n count--;\n if (count === 0) {\n observable.reportChanges();\n if (didChange) {\n didChange = false;\n listener.call(thisArgs);\n }\n }\n },\n handlePossibleChange() {\n // noop\n },\n handleChange() {\n didChange = true;\n }\n };\n observable.addObserver(observer);\n observable.reportChanges();\n const disposable = {\n dispose() {\n observable.removeObserver(observer);\n }\n };\n if (disposables instanceof lifecycle_1.DisposableStore) {\n disposables.add(disposable);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(disposable);\n }\n return disposable;\n };\n }\n Event.fromObservableLight = fromObservableLight;\n})(Event || (exports.Event = Event = {}));\nclass EventProfiling {\n static { this.all = new Set(); }\n static { this._idPool = 0; }\n constructor(name) {\n this.listenerCount = 0;\n this.invocationCount = 0;\n this.elapsedOverall = 0;\n this.durations = [];\n this.name = `${name}_${EventProfiling._idPool++}`;\n EventProfiling.all.add(this);\n }\n start(listenerCount) {\n this._stopWatch = new stopwatch_1.StopWatch();\n this.listenerCount = listenerCount;\n }\n stop() {\n if (this._stopWatch) {\n const elapsed = this._stopWatch.elapsed();\n this.durations.push(elapsed);\n this.elapsedOverall += elapsed;\n this.invocationCount += 1;\n this._stopWatch = undefined;\n }\n }\n}\nexports.EventProfiling = EventProfiling;\nlet _globalLeakWarningThreshold = -1;\nfunction setGlobalLeakWarningThreshold(n) {\n const oldValue = _globalLeakWarningThreshold;\n _globalLeakWarningThreshold = n;\n return {\n dispose() {\n _globalLeakWarningThreshold = oldValue;\n }\n };\n}\nclass LeakageMonitor {\n static { this._idPool = 1; }\n constructor(_errorHandler, threshold, name = (LeakageMonitor._idPool++).toString(16).padStart(3, '0')) {\n this._errorHandler = _errorHandler;\n this.threshold = threshold;\n this.name = name;\n this._warnCountdown = 0;\n }\n dispose() {\n this._stacks?.clear();\n }\n check(stack, listenerCount) {\n const threshold = this.threshold;\n if (threshold <= 0 || listenerCount < threshold) {\n return undefined;\n }\n if (!this._stacks) {\n this._stacks = new Map();\n }\n const count = (this._stacks.get(stack.value) || 0);\n this._stacks.set(stack.value, count + 1);\n this._warnCountdown -= 1;\n if (this._warnCountdown <= 0) {\n // only warn on first exceed and then every time the limit\n // is exceeded by 50% again\n this._warnCountdown = threshold * 0.5;\n const [topStack, topCount] = this.getMostFrequentStack();\n const message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;\n console.warn(message);\n console.warn(topStack);\n const error = new ListenerLeakError(message, topStack);\n this._errorHandler(error);\n }\n return () => {\n const count = (this._stacks.get(stack.value) || 0);\n this._stacks.set(stack.value, count - 1);\n };\n }\n getMostFrequentStack() {\n if (!this._stacks) {\n return undefined;\n }\n let topStack;\n let topCount = 0;\n for (const [stack, count] of this._stacks) {\n if (!topStack || topCount < count) {\n topStack = [stack, count];\n topCount = count;\n }\n }\n return topStack;\n }\n}\nclass Stacktrace {\n static create() {\n const err = new Error();\n return new Stacktrace(err.stack ?? '');\n }\n constructor(value) {\n this.value = value;\n }\n print() {\n console.warn(this.value.split('\\n').slice(2).join('\\n'));\n }\n}\n// error that is logged when going over the configured listener threshold\nclass ListenerLeakError extends Error {\n constructor(message, stack) {\n super(message);\n this.name = 'ListenerLeakError';\n this.stack = stack;\n }\n}\nexports.ListenerLeakError = ListenerLeakError;\n// SEVERE error that is logged when having gone way over the configured listener\n// threshold so that the emitter refuses to accept more listeners\nclass ListenerRefusalError extends Error {\n constructor(message, stack) {\n super(message);\n this.name = 'ListenerRefusalError';\n this.stack = stack;\n }\n}\nexports.ListenerRefusalError = ListenerRefusalError;\nlet id = 0;\nclass UniqueContainer {\n constructor(value) {\n this.value = value;\n this.id = id++;\n }\n}\nconst compactionThreshold = 2;\nconst forEachListener = (listeners, fn) => {\n if (listeners instanceof UniqueContainer) {\n fn(listeners);\n }\n else {\n for (let i = 0; i < listeners.length; i++) {\n const l = listeners[i];\n if (l) {\n fn(l);\n }\n }\n }\n};\nlet _listenerFinalizers;\nif (_enableListenerGCedWarning) {\n const leaks = [];\n setInterval(() => {\n if (leaks.length === 0) {\n return;\n }\n console.warn('[LEAKING LISTENERS] GC\\'ed these listeners that were NOT yet disposed:');\n console.warn(leaks.join('\\n'));\n leaks.length = 0;\n }, 3000);\n _listenerFinalizers = new FinalizationRegistry(heldValue => {\n if (typeof heldValue === 'string') {\n leaks.push(heldValue);\n }\n });\n}\n/**\n * The Emitter can be used to expose an Event to the public\n * to fire it from the insides.\n * Sample:\n class Document {\n\n private readonly _onDidChange = new Emitter<(value:string)=>any>();\n\n public onDidChange = this._onDidChange.event;\n\n // getter-style\n // get onDidChange(): Event<(value:string)=>any> {\n // \treturn this._onDidChange.event;\n // }\n\n private _doIt() {\n //...\n this._onDidChange.fire(value);\n }\n }\n */\nclass Emitter {\n constructor(options) {\n this._size = 0;\n this._options = options;\n this._leakageMon = (_globalLeakWarningThreshold > 0 || this._options?.leakWarningThreshold)\n ? new LeakageMonitor(options?.onListenerError ?? errors_1.onUnexpectedError, this._options?.leakWarningThreshold ?? _globalLeakWarningThreshold) :\n undefined;\n this._perfMon = this._options?._profName ? new EventProfiling(this._options._profName) : undefined;\n this._deliveryQueue = this._options?.deliveryQueue;\n }\n dispose() {\n if (!this._disposed) {\n this._disposed = true;\n // It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter\n // alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and\n // unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the\n // the following programming pattern is very popular:\n //\n // const someModel = this._disposables.add(new ModelObject()); // (1) create and register model\n // this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener\n // ...later...\n // this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the \"overall dispose\" is done\n if (this._deliveryQueue?.current === this) {\n this._deliveryQueue.reset();\n }\n if (this._listeners) {\n if (_enableDisposeWithListenerWarning) {\n const listeners = this._listeners;\n queueMicrotask(() => {\n forEachListener(listeners, l => l.stack?.print());\n });\n }\n this._listeners = undefined;\n this._size = 0;\n }\n this._options?.onDidRemoveLastListener?.();\n this._leakageMon?.dispose();\n }\n }\n /**\n * For the public to allow to subscribe\n * to events from this Emitter\n */\n get event() {\n this._event ??= (callback, thisArgs, disposables) => {\n if (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {\n const message = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;\n console.warn(message);\n const tuple = this._leakageMon.getMostFrequentStack() ?? ['UNKNOWN stack', -1];\n const error = new ListenerRefusalError(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);\n const errorHandler = this._options?.onListenerError || errors_1.onUnexpectedError;\n errorHandler(error);\n return lifecycle_1.Disposable.None;\n }\n if (this._disposed) {\n // todo: should we warn if a listener is added to a disposed emitter? This happens often\n return lifecycle_1.Disposable.None;\n }\n if (thisArgs) {\n callback = callback.bind(thisArgs);\n }\n const contained = new UniqueContainer(callback);\n let removeMonitor;\n let stack;\n if (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {\n // check and record this emitter for potential leakage\n contained.stack = Stacktrace.create();\n removeMonitor = this._leakageMon.check(contained.stack, this._size + 1);\n }\n if (_enableDisposeWithListenerWarning) {\n contained.stack = stack ?? Stacktrace.create();\n }\n if (!this._listeners) {\n this._options?.onWillAddFirstListener?.(this);\n this._listeners = contained;\n this._options?.onDidAddFirstListener?.(this);\n }\n else if (this._listeners instanceof UniqueContainer) {\n this._deliveryQueue ??= new EventDeliveryQueuePrivate();\n this._listeners = [this._listeners, contained];\n }\n else {\n this._listeners.push(contained);\n }\n this._size++;\n const result = (0, lifecycle_1.toDisposable)(() => {\n _listenerFinalizers?.unregister(result);\n removeMonitor?.();\n this._removeListener(contained);\n });\n if (disposables instanceof lifecycle_1.DisposableStore) {\n disposables.add(result);\n }\n else if (Array.isArray(disposables)) {\n disposables.push(result);\n }\n if (_listenerFinalizers) {\n const stack = new Error().stack.split('\\n').slice(2, 3).join('\\n').trim();\n const match = /(file:|vscode-file:\\/\\/vscode-app)?(\\/[^:]*:\\d+:\\d+)/.exec(stack);\n _listenerFinalizers.register(result, match?.[2] ?? stack, result);\n }\n return result;\n };\n return this._event;\n }\n _removeListener(listener) {\n this._options?.onWillRemoveListener?.(this);\n if (!this._listeners) {\n return; // expected if a listener gets disposed\n }\n if (this._size === 1) {\n this._listeners = undefined;\n this._options?.onDidRemoveLastListener?.(this);\n this._size = 0;\n return;\n }\n // size > 1 which requires that listeners be a list:\n const listeners = this._listeners;\n const index = listeners.indexOf(listener);\n if (index === -1) {\n console.log('disposed?', this._disposed);\n console.log('size?', this._size);\n console.log('arr?', JSON.stringify(this._listeners));\n throw new Error('Attempted to dispose unknown listener');\n }\n this._size--;\n listeners[index] = undefined;\n const adjustDeliveryQueue = this._deliveryQueue.current === this;\n if (this._size * compactionThreshold <= listeners.length) {\n let n = 0;\n for (let i = 0; i < listeners.length; i++) {\n if (listeners[i]) {\n listeners[n++] = listeners[i];\n }\n else if (adjustDeliveryQueue) {\n this._deliveryQueue.end--;\n if (n < this._deliveryQueue.i) {\n this._deliveryQueue.i--;\n }\n }\n }\n listeners.length = n;\n }\n }\n _deliver(listener, value) {\n if (!listener) {\n return;\n }\n const errorHandler = this._options?.onListenerError || errors_1.onUnexpectedError;\n if (!errorHandler) {\n listener.value(value);\n return;\n }\n try {\n listener.value(value);\n }\n catch (e) {\n errorHandler(e);\n }\n }\n /** Delivers items in the queue. Assumes the queue is ready to go. */\n _deliverQueue(dq) {\n const listeners = dq.current._listeners;\n while (dq.i < dq.end) {\n // important: dq.i is incremented before calling deliver() because it might reenter deliverQueue()\n this._deliver(listeners[dq.i++], dq.value);\n }\n dq.reset();\n }\n /**\n * To be kept private to fire an event to\n * subscribers\n */\n fire(event) {\n if (this._deliveryQueue?.current) {\n this._deliverQueue(this._deliveryQueue);\n this._perfMon?.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch\n }\n this._perfMon?.start(this._size);\n if (!this._listeners) {\n // no-op\n }\n else if (this._listeners instanceof UniqueContainer) {\n this._deliver(this._listeners, event);\n }\n else {\n const dq = this._deliveryQueue;\n dq.enqueue(this, event, this._listeners.length);\n this._deliverQueue(dq);\n }\n this._perfMon?.stop();\n }\n hasListeners() {\n return this._size > 0;\n }\n}\nexports.Emitter = Emitter;\nconst createEventDeliveryQueue = () => new EventDeliveryQueuePrivate();\nexports.createEventDeliveryQueue = createEventDeliveryQueue;\nclass EventDeliveryQueuePrivate {\n constructor() {\n /**\n * Index in current's listener list.\n */\n this.i = -1;\n /**\n * The last index in the listener's list to deliver.\n */\n this.end = 0;\n }\n enqueue(emitter, value, end) {\n this.i = 0;\n this.end = end;\n this.current = emitter;\n this.value = value;\n }\n reset() {\n this.i = this.end; // force any current emission loop to stop, mainly for during dispose\n this.current = undefined;\n this.value = undefined;\n }\n}\nclass AsyncEmitter extends Emitter {\n async fireAsync(data, token, promiseJoin) {\n if (!this._listeners) {\n return;\n }\n if (!this._asyncDeliveryQueue) {\n this._asyncDeliveryQueue = new linkedList_1.LinkedList();\n }\n forEachListener(this._listeners, listener => this._asyncDeliveryQueue.push([listener.value, data]));\n while (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n const [listener, data] = this._asyncDeliveryQueue.shift();\n const thenables = [];\n const event = {\n ...data,\n token,\n waitUntil: (p) => {\n if (Object.isFrozen(thenables)) {\n throw new Error('waitUntil can NOT be called asynchronous');\n }\n if (promiseJoin) {\n p = promiseJoin(p, listener);\n }\n thenables.push(p);\n }\n };\n try {\n listener(event);\n }\n catch (e) {\n (0, errors_1.onUnexpectedError)(e);\n continue;\n }\n // freeze thenables-collection to enforce sync-calls to\n // wait until and then wait for all thenables to resolve\n Object.freeze(thenables);\n await Promise.allSettled(thenables).then(values => {\n for (const value of values) {\n if (value.status === 'rejected') {\n (0, errors_1.onUnexpectedError)(value.reason);\n }\n }\n });\n }\n }\n}\nexports.AsyncEmitter = AsyncEmitter;\nclass PauseableEmitter extends Emitter {\n get isPaused() {\n return this._isPaused !== 0;\n }\n constructor(options) {\n super(options);\n this._isPaused = 0;\n this._eventQueue = new linkedList_1.LinkedList();\n this._mergeFn = options?.merge;\n }\n pause() {\n this._isPaused++;\n }\n resume() {\n if (this._isPaused !== 0 && --this._isPaused === 0) {\n if (this._mergeFn) {\n // use the merge function to create a single composite\n // event. make a copy in case firing pauses this emitter\n if (this._eventQueue.size > 0) {\n const events = Array.from(this._eventQueue);\n this._eventQueue.clear();\n super.fire(this._mergeFn(events));\n }\n }\n else {\n // no merging, fire each event individually and test\n // that this emitter isn't paused halfway through\n while (!this._isPaused && this._eventQueue.size !== 0) {\n super.fire(this._eventQueue.shift());\n }\n }\n }\n }\n fire(event) {\n if (this._size) {\n if (this._isPaused !== 0) {\n this._eventQueue.push(event);\n }\n else {\n super.fire(event);\n }\n }\n }\n}\nexports.PauseableEmitter = PauseableEmitter;\nclass DebounceEmitter extends PauseableEmitter {\n constructor(options) {\n super(options);\n this._delay = options.delay ?? 100;\n }\n fire(event) {\n if (!this._handle) {\n this.pause();\n this._handle = setTimeout(() => {\n this._handle = undefined;\n this.resume();\n }, this._delay);\n }\n super.fire(event);\n }\n}\nexports.DebounceEmitter = DebounceEmitter;\n/**\n * An emitter which queue all events and then process them at the\n * end of the event loop.\n */\nclass MicrotaskEmitter extends Emitter {\n constructor(options) {\n super(options);\n this._queuedEvents = [];\n this._mergeFn = options?.merge;\n }\n fire(event) {\n if (!this.hasListeners()) {\n return;\n }\n this._queuedEvents.push(event);\n if (this._queuedEvents.length === 1) {\n queueMicrotask(() => {\n if (this._mergeFn) {\n super.fire(this._mergeFn(this._queuedEvents));\n }\n else {\n this._queuedEvents.forEach(e => super.fire(e));\n }\n this._queuedEvents = [];\n });\n }\n }\n}\nexports.MicrotaskEmitter = MicrotaskEmitter;\n/**\n * An event emitter that multiplexes many events into a single event.\n *\n * @example Listen to the `onData` event of all `Thing`s, dynamically adding and removing `Thing`s\n * to the multiplexer as needed.\n *\n * ```typescript\n * const anythingDataMultiplexer = new EventMultiplexer<{ data: string }>();\n *\n * const thingListeners = DisposableMap();\n *\n * thingService.onDidAddThing(thing => {\n * thingListeners.set(thing, anythingDataMultiplexer.add(thing.onData);\n * });\n * thingService.onDidRemoveThing(thing => {\n * thingListeners.deleteAndDispose(thing);\n * });\n *\n * anythingDataMultiplexer.event(e => {\n * console.log('Something fired data ' + e.data)\n * });\n * ```\n */\nclass EventMultiplexer {\n constructor() {\n this.hasListeners = false;\n this.events = [];\n this.emitter = new Emitter({\n onWillAddFirstListener: () => this.onFirstListenerAdd(),\n onDidRemoveLastListener: () => this.onLastListenerRemove()\n });\n }\n get event() {\n return this.emitter.event;\n }\n add(event) {\n const e = { event: event, listener: null };\n this.events.push(e);\n if (this.hasListeners) {\n this.hook(e);\n }\n const dispose = () => {\n if (this.hasListeners) {\n this.unhook(e);\n }\n const idx = this.events.indexOf(e);\n this.events.splice(idx, 1);\n };\n return (0, lifecycle_1.toDisposable)((0, functional_1.createSingleCallFunction)(dispose));\n }\n onFirstListenerAdd() {\n this.hasListeners = true;\n this.events.forEach(e => this.hook(e));\n }\n onLastListenerRemove() {\n this.hasListeners = false;\n this.events.forEach(e => this.unhook(e));\n }\n hook(e) {\n e.listener = e.event(r => this.emitter.fire(r));\n }\n unhook(e) {\n e.listener?.dispose();\n e.listener = null;\n }\n dispose() {\n this.emitter.dispose();\n for (const e of this.events) {\n e.listener?.dispose();\n }\n this.events = [];\n }\n}\nexports.EventMultiplexer = EventMultiplexer;\nclass DynamicListEventMultiplexer {\n constructor(items, onAddItem, onRemoveItem, getEvent) {\n this._store = new lifecycle_1.DisposableStore();\n const multiplexer = this._store.add(new EventMultiplexer());\n const itemListeners = this._store.add(new lifecycle_1.DisposableMap());\n function addItem(instance) {\n itemListeners.set(instance, multiplexer.add(getEvent(instance)));\n }\n // Existing items\n for (const instance of items) {\n addItem(instance);\n }\n // Added items\n this._store.add(onAddItem(instance => {\n addItem(instance);\n }));\n // Removed items\n this._store.add(onRemoveItem(instance => {\n itemListeners.deleteAndDispose(instance);\n }));\n this.event = multiplexer.event;\n }\n dispose() {\n this._store.dispose();\n }\n}\nexports.DynamicListEventMultiplexer = DynamicListEventMultiplexer;\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n * emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nclass EventBufferer {\n constructor() {\n this.data = [];\n }\n wrapEvent(event, reduce, initial) {\n return (listener, thisArgs, disposables) => {\n return event(i => {\n const data = this.data[this.data.length - 1];\n // Non-reduce scenario\n if (!reduce) {\n // Buffering case\n if (data) {\n data.buffers.push(() => listener.call(thisArgs, i));\n }\n else {\n // Not buffering case\n listener.call(thisArgs, i);\n }\n return;\n }\n // Reduce scenario\n const reduceData = data;\n // Not buffering case\n if (!reduceData) {\n // TODO: Is there a way to cache this reduce call for all listeners?\n listener.call(thisArgs, reduce(initial, i));\n return;\n }\n // Buffering case\n reduceData.items ??= [];\n reduceData.items.push(i);\n if (reduceData.buffers.length === 0) {\n // Include a single buffered function that will reduce all events when we're done buffering events\n data.buffers.push(() => {\n // cache the reduced result so that the value can be shared across all listeners\n reduceData.reducedResult ??= initial\n ? reduceData.items.reduce(reduce, initial)\n : reduceData.items.reduce(reduce);\n listener.call(thisArgs, reduceData.reducedResult);\n });\n }\n }, undefined, disposables);\n };\n }\n bufferEvents(fn) {\n const data = { buffers: new Array() };\n this.data.push(data);\n const r = fn();\n this.data.pop();\n data.buffers.forEach(flush => flush());\n return r;\n }\n}\nexports.EventBufferer = EventBufferer;\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nclass Relay {\n constructor() {\n this.listening = false;\n this.inputEvent = Event.None;\n this.inputEventListener = lifecycle_1.Disposable.None;\n this.emitter = new Emitter({\n onDidAddFirstListener: () => {\n this.listening = true;\n this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n },\n onDidRemoveLastListener: () => {\n this.listening = false;\n this.inputEventListener.dispose();\n }\n });\n this.event = this.emitter.event;\n }\n set input(event) {\n this.inputEvent = event;\n if (this.listening) {\n this.inputEventListener.dispose();\n this.inputEventListener = event(this.emitter.fire, this.emitter);\n }\n }\n dispose() {\n this.inputEventListener.dispose();\n this.emitter.dispose();\n }\n}\nexports.Relay = Relay;\nclass ValueWithChangeEvent {\n static const(value) {\n return new ConstValueWithChangeEvent(value);\n }\n constructor(_value) {\n this._value = _value;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n }\n get value() {\n return this._value;\n }\n set value(value) {\n if (value !== this._value) {\n this._value = value;\n this._onDidChange.fire(undefined);\n }\n }\n}\nexports.ValueWithChangeEvent = ValueWithChangeEvent;\nclass ConstValueWithChangeEvent {\n constructor(value) {\n this.value = value;\n this.onDidChange = Event.None;\n }\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createSingleCallFunction = createSingleCallFunction;\n/**\n * Given a function, returns a function that is only calling that function once.\n */\nfunction createSingleCallFunction(fn, fnDidRunCallback) {\n const _this = this;\n let didCall = false;\n let result;\n return function () {\n if (didCall) {\n return result;\n }\n didCall = true;\n if (fnDidRunCallback) {\n try {\n result = fn.apply(_this, arguments);\n }\n finally {\n fnDidRunCallback();\n }\n }\n else {\n result = fn.apply(_this, arguments);\n }\n return result;\n };\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StringSHA1 = exports.Hasher = void 0;\nexports.hash = hash;\nexports.doHash = doHash;\nexports.numberHash = numberHash;\nexports.stringHash = stringHash;\nexports.toHexString = toHexString;\nconst strings = __importStar(require(\"vs/base/common/strings\"));\n/**\n * Return a hash value for an object.\n */\nfunction hash(obj) {\n return doHash(obj, 0);\n}\nfunction doHash(obj, hashVal) {\n switch (typeof obj) {\n case 'object':\n if (obj === null) {\n return numberHash(349, hashVal);\n }\n else if (Array.isArray(obj)) {\n return arrayHash(obj, hashVal);\n }\n return objectHash(obj, hashVal);\n case 'string':\n return stringHash(obj, hashVal);\n case 'boolean':\n return booleanHash(obj, hashVal);\n case 'number':\n return numberHash(obj, hashVal);\n case 'undefined':\n return numberHash(937, hashVal);\n default:\n return numberHash(617, hashVal);\n }\n}\nfunction numberHash(val, initialHashVal) {\n return (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\n}\nfunction booleanHash(b, initialHashVal) {\n return numberHash(b ? 433 : 863, initialHashVal);\n}\nfunction stringHash(s, hashVal) {\n hashVal = numberHash(149417, hashVal);\n for (let i = 0, length = s.length; i < length; i++) {\n hashVal = numberHash(s.charCodeAt(i), hashVal);\n }\n return hashVal;\n}\nfunction arrayHash(arr, initialHashVal) {\n initialHashVal = numberHash(104579, initialHashVal);\n return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\n}\nfunction objectHash(obj, initialHashVal) {\n initialHashVal = numberHash(181387, initialHashVal);\n return Object.keys(obj).sort().reduce((hashVal, key) => {\n hashVal = stringHash(key, hashVal);\n return doHash(obj[key], hashVal);\n }, initialHashVal);\n}\nclass Hasher {\n constructor() {\n this._value = 0;\n }\n get value() {\n return this._value;\n }\n hash(obj) {\n this._value = doHash(obj, this._value);\n return this._value;\n }\n}\nexports.Hasher = Hasher;\nvar SHA1Constant;\n(function (SHA1Constant) {\n SHA1Constant[SHA1Constant[\"BLOCK_SIZE\"] = 64] = \"BLOCK_SIZE\";\n SHA1Constant[SHA1Constant[\"UNICODE_REPLACEMENT\"] = 65533] = \"UNICODE_REPLACEMENT\";\n})(SHA1Constant || (SHA1Constant = {}));\nfunction leftRotate(value, bits, totalBits = 32) {\n // delta + bits = totalBits\n const delta = totalBits - bits;\n // All ones, expect `delta` zeros aligned to the right\n const mask = ~((1 << delta) - 1);\n // Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\n return ((value << bits) | ((mask & value) >>> delta)) >>> 0;\n}\nfunction fill(dest, index = 0, count = dest.byteLength, value = 0) {\n for (let i = 0; i < count; i++) {\n dest[index + i] = value;\n }\n}\nfunction leftPad(value, length, char = '0') {\n while (value.length < length) {\n value = char + value;\n }\n return value;\n}\nfunction toHexString(bufferOrValue, bitsize = 32) {\n if (bufferOrValue instanceof ArrayBuffer) {\n return Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\n }\n return leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\n}\n/**\n * A SHA1 implementation that works with strings and does not allocate.\n */\nclass StringSHA1 {\n static { this._bigBlock32 = new DataView(new ArrayBuffer(320)); } // 80 * 4 = 320\n constructor() {\n this._h0 = 0x67452301;\n this._h1 = 0xEFCDAB89;\n this._h2 = 0x98BADCFE;\n this._h3 = 0x10325476;\n this._h4 = 0xC3D2E1F0;\n this._buff = new Uint8Array(SHA1Constant.BLOCK_SIZE + 3 /* to fit any utf-8 */);\n this._buffDV = new DataView(this._buff.buffer);\n this._buffLen = 0;\n this._totalLen = 0;\n this._leftoverHighSurrogate = 0;\n this._finished = false;\n }\n update(str) {\n const strLen = str.length;\n if (strLen === 0) {\n return;\n }\n const buff = this._buff;\n let buffLen = this._buffLen;\n let leftoverHighSurrogate = this._leftoverHighSurrogate;\n let charCode;\n let offset;\n if (leftoverHighSurrogate !== 0) {\n charCode = leftoverHighSurrogate;\n offset = -1;\n leftoverHighSurrogate = 0;\n }\n else {\n charCode = str.charCodeAt(0);\n offset = 0;\n }\n while (true) {\n let codePoint = charCode;\n if (strings.isHighSurrogate(charCode)) {\n if (offset + 1 < strLen) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (strings.isLowSurrogate(nextCharCode)) {\n offset++;\n codePoint = strings.computeCodePoint(charCode, nextCharCode);\n }\n else {\n // illegal => unicode replacement character\n codePoint = SHA1Constant.UNICODE_REPLACEMENT;\n }\n }\n else {\n // last character is a surrogate pair\n leftoverHighSurrogate = charCode;\n break;\n }\n }\n else if (strings.isLowSurrogate(charCode)) {\n // illegal => unicode replacement character\n codePoint = SHA1Constant.UNICODE_REPLACEMENT;\n }\n buffLen = this._push(buff, buffLen, codePoint);\n offset++;\n if (offset < strLen) {\n charCode = str.charCodeAt(offset);\n }\n else {\n break;\n }\n }\n this._buffLen = buffLen;\n this._leftoverHighSurrogate = leftoverHighSurrogate;\n }\n _push(buff, buffLen, codePoint) {\n if (codePoint < 0x0080) {\n buff[buffLen++] = codePoint;\n }\n else if (codePoint < 0x0800) {\n buff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else if (codePoint < 0x10000) {\n buff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n else {\n buff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n }\n if (buffLen >= SHA1Constant.BLOCK_SIZE) {\n this._step();\n buffLen -= SHA1Constant.BLOCK_SIZE;\n this._totalLen += SHA1Constant.BLOCK_SIZE;\n // take last 3 in case of UTF8 overflow\n buff[0] = buff[SHA1Constant.BLOCK_SIZE + 0];\n buff[1] = buff[SHA1Constant.BLOCK_SIZE + 1];\n buff[2] = buff[SHA1Constant.BLOCK_SIZE + 2];\n }\n return buffLen;\n }\n digest() {\n if (!this._finished) {\n this._finished = true;\n if (this._leftoverHighSurrogate) {\n // illegal => unicode replacement character\n this._leftoverHighSurrogate = 0;\n this._buffLen = this._push(this._buff, this._buffLen, SHA1Constant.UNICODE_REPLACEMENT);\n }\n this._totalLen += this._buffLen;\n this._wrapUp();\n }\n return toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\n }\n _wrapUp() {\n this._buff[this._buffLen++] = 0x80;\n fill(this._buff, this._buffLen);\n if (this._buffLen > 56) {\n this._step();\n fill(this._buff);\n }\n // this will fit because the mantissa can cover up to 52 bits\n const ml = 8 * this._totalLen;\n this._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\n this._buffDV.setUint32(60, ml % 4294967296, false);\n this._step();\n }\n _step() {\n const bigBlock32 = StringSHA1._bigBlock32;\n const data = this._buffDV;\n for (let j = 0; j < 64 /* 16*4 */; j += 4) {\n bigBlock32.setUint32(j, data.getUint32(j, false), false);\n }\n for (let j = 64; j < 320 /* 80*4 */; j += 4) {\n bigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\n }\n let a = this._h0;\n let b = this._h1;\n let c = this._h2;\n let d = this._h3;\n let e = this._h4;\n let f, k;\n let temp;\n for (let j = 0; j < 80; j++) {\n if (j < 20) {\n f = (b & c) | ((~b) & d);\n k = 0x5A827999;\n }\n else if (j < 40) {\n f = b ^ c ^ d;\n k = 0x6ED9EBA1;\n }\n else if (j < 60) {\n f = (b & c) | (b & d) | (c & d);\n k = 0x8F1BBCDC;\n }\n else {\n f = b ^ c ^ d;\n k = 0xCA62C1D6;\n }\n temp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\n e = d;\n d = c;\n c = leftRotate(b, 30);\n b = a;\n a = temp;\n }\n this._h0 = (this._h0 + a) & 0xffffffff;\n this._h1 = (this._h1 + b) & 0xffffffff;\n this._h2 = (this._h2 + c) & 0xffffffff;\n this._h3 = (this._h3 + d) & 0xffffffff;\n this._h4 = (this._h4 + e) & 0xffffffff;\n }\n}\nexports.StringSHA1 = StringSHA1;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Iterable = void 0;\nvar Iterable;\n(function (Iterable) {\n function is(thing) {\n return thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\n }\n Iterable.is = is;\n const _empty = Object.freeze([]);\n function empty() {\n return _empty;\n }\n Iterable.empty = empty;\n function* single(element) {\n yield element;\n }\n Iterable.single = single;\n function wrap(iterableOrElement) {\n if (is(iterableOrElement)) {\n return iterableOrElement;\n }\n else {\n return single(iterableOrElement);\n }\n }\n Iterable.wrap = wrap;\n function from(iterable) {\n return iterable || _empty;\n }\n Iterable.from = from;\n function* reverse(array) {\n for (let i = array.length - 1; i >= 0; i--) {\n yield array[i];\n }\n }\n Iterable.reverse = reverse;\n function isEmpty(iterable) {\n return !iterable || iterable[Symbol.iterator]().next().done === true;\n }\n Iterable.isEmpty = isEmpty;\n function first(iterable) {\n return iterable[Symbol.iterator]().next().value;\n }\n Iterable.first = first;\n function some(iterable, predicate) {\n let i = 0;\n for (const element of iterable) {\n if (predicate(element, i++)) {\n return true;\n }\n }\n return false;\n }\n Iterable.some = some;\n function find(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n return element;\n }\n }\n return undefined;\n }\n Iterable.find = find;\n function* filter(iterable, predicate) {\n for (const element of iterable) {\n if (predicate(element)) {\n yield element;\n }\n }\n }\n Iterable.filter = filter;\n function* map(iterable, fn) {\n let index = 0;\n for (const element of iterable) {\n yield fn(element, index++);\n }\n }\n Iterable.map = map;\n function* flatMap(iterable, fn) {\n let index = 0;\n for (const element of iterable) {\n yield* fn(element, index++);\n }\n }\n Iterable.flatMap = flatMap;\n function* concat(...iterables) {\n for (const iterable of iterables) {\n yield* iterable;\n }\n }\n Iterable.concat = concat;\n function reduce(iterable, reducer, initialValue) {\n let value = initialValue;\n for (const element of iterable) {\n value = reducer(value, element);\n }\n return value;\n }\n Iterable.reduce = reduce;\n /**\n * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\n */\n function* slice(arr, from, to = arr.length) {\n if (from < 0) {\n from += arr.length;\n }\n if (to < 0) {\n to += arr.length;\n }\n else if (to > arr.length) {\n to = arr.length;\n }\n for (; from < to; from++) {\n yield arr[from];\n }\n }\n Iterable.slice = slice;\n /**\n * Consumes `atMost` elements from iterable and returns the consumed elements,\n * and an iterable for the rest of the elements.\n */\n function consume(iterable, atMost = Number.POSITIVE_INFINITY) {\n const consumed = [];\n if (atMost === 0) {\n return [consumed, iterable];\n }\n const iterator = iterable[Symbol.iterator]();\n for (let i = 0; i < atMost; i++) {\n const next = iterator.next();\n if (next.done) {\n return [consumed, Iterable.empty()];\n }\n consumed.push(next.value);\n }\n return [consumed, { [Symbol.iterator]() { return iterator; } }];\n }\n Iterable.consume = consume;\n async function asyncToArray(iterable) {\n const result = [];\n for await (const item of iterable) {\n result.push(item);\n }\n return Promise.resolve(result);\n }\n Iterable.asyncToArray = asyncToArray;\n})(Iterable || (exports.Iterable = Iterable = {}));\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.KeyMod = exports.KeyCodeUtils = exports.ScanCodeUtils = exports.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE = exports.EVENT_KEY_CODE_MAP = exports.ScanCode = exports.KeyCode = void 0;\nexports.KeyChord = KeyChord;\n/**\n * Virtual Key Codes, the value does not hold any inherent meaning.\n * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n * But these are \"more general\", as they should work across browsers & OS`s.\n */\nvar KeyCode;\n(function (KeyCode) {\n KeyCode[KeyCode[\"DependsOnKbLayout\"] = -1] = \"DependsOnKbLayout\";\n /**\n * Placed first to cover the 0 value of the enum.\n */\n KeyCode[KeyCode[\"Unknown\"] = 0] = \"Unknown\";\n KeyCode[KeyCode[\"Backspace\"] = 1] = \"Backspace\";\n KeyCode[KeyCode[\"Tab\"] = 2] = \"Tab\";\n KeyCode[KeyCode[\"Enter\"] = 3] = \"Enter\";\n KeyCode[KeyCode[\"Shift\"] = 4] = \"Shift\";\n KeyCode[KeyCode[\"Ctrl\"] = 5] = \"Ctrl\";\n KeyCode[KeyCode[\"Alt\"] = 6] = \"Alt\";\n KeyCode[KeyCode[\"PauseBreak\"] = 7] = \"PauseBreak\";\n KeyCode[KeyCode[\"CapsLock\"] = 8] = \"CapsLock\";\n KeyCode[KeyCode[\"Escape\"] = 9] = \"Escape\";\n KeyCode[KeyCode[\"Space\"] = 10] = \"Space\";\n KeyCode[KeyCode[\"PageUp\"] = 11] = \"PageUp\";\n KeyCode[KeyCode[\"PageDown\"] = 12] = \"PageDown\";\n KeyCode[KeyCode[\"End\"] = 13] = \"End\";\n KeyCode[KeyCode[\"Home\"] = 14] = \"Home\";\n KeyCode[KeyCode[\"LeftArrow\"] = 15] = \"LeftArrow\";\n KeyCode[KeyCode[\"UpArrow\"] = 16] = \"UpArrow\";\n KeyCode[KeyCode[\"RightArrow\"] = 17] = \"RightArrow\";\n KeyCode[KeyCode[\"DownArrow\"] = 18] = \"DownArrow\";\n KeyCode[KeyCode[\"Insert\"] = 19] = \"Insert\";\n KeyCode[KeyCode[\"Delete\"] = 20] = \"Delete\";\n KeyCode[KeyCode[\"Digit0\"] = 21] = \"Digit0\";\n KeyCode[KeyCode[\"Digit1\"] = 22] = \"Digit1\";\n KeyCode[KeyCode[\"Digit2\"] = 23] = \"Digit2\";\n KeyCode[KeyCode[\"Digit3\"] = 24] = \"Digit3\";\n KeyCode[KeyCode[\"Digit4\"] = 25] = \"Digit4\";\n KeyCode[KeyCode[\"Digit5\"] = 26] = \"Digit5\";\n KeyCode[KeyCode[\"Digit6\"] = 27] = \"Digit6\";\n KeyCode[KeyCode[\"Digit7\"] = 28] = \"Digit7\";\n KeyCode[KeyCode[\"Digit8\"] = 29] = \"Digit8\";\n KeyCode[KeyCode[\"Digit9\"] = 30] = \"Digit9\";\n KeyCode[KeyCode[\"KeyA\"] = 31] = \"KeyA\";\n KeyCode[KeyCode[\"KeyB\"] = 32] = \"KeyB\";\n KeyCode[KeyCode[\"KeyC\"] = 33] = \"KeyC\";\n KeyCode[KeyCode[\"KeyD\"] = 34] = \"KeyD\";\n KeyCode[KeyCode[\"KeyE\"] = 35] = \"KeyE\";\n KeyCode[KeyCode[\"KeyF\"] = 36] = \"KeyF\";\n KeyCode[KeyCode[\"KeyG\"] = 37] = \"KeyG\";\n KeyCode[KeyCode[\"KeyH\"] = 38] = \"KeyH\";\n KeyCode[KeyCode[\"KeyI\"] = 39] = \"KeyI\";\n KeyCode[KeyCode[\"KeyJ\"] = 40] = \"KeyJ\";\n KeyCode[KeyCode[\"KeyK\"] = 41] = \"KeyK\";\n KeyCode[KeyCode[\"KeyL\"] = 42] = \"KeyL\";\n KeyCode[KeyCode[\"KeyM\"] = 43] = \"KeyM\";\n KeyCode[KeyCode[\"KeyN\"] = 44] = \"KeyN\";\n KeyCode[KeyCode[\"KeyO\"] = 45] = \"KeyO\";\n KeyCode[KeyCode[\"KeyP\"] = 46] = \"KeyP\";\n KeyCode[KeyCode[\"KeyQ\"] = 47] = \"KeyQ\";\n KeyCode[KeyCode[\"KeyR\"] = 48] = \"KeyR\";\n KeyCode[KeyCode[\"KeyS\"] = 49] = \"KeyS\";\n KeyCode[KeyCode[\"KeyT\"] = 50] = \"KeyT\";\n KeyCode[KeyCode[\"KeyU\"] = 51] = \"KeyU\";\n KeyCode[KeyCode[\"KeyV\"] = 52] = \"KeyV\";\n KeyCode[KeyCode[\"KeyW\"] = 53] = \"KeyW\";\n KeyCode[KeyCode[\"KeyX\"] = 54] = \"KeyX\";\n KeyCode[KeyCode[\"KeyY\"] = 55] = \"KeyY\";\n KeyCode[KeyCode[\"KeyZ\"] = 56] = \"KeyZ\";\n KeyCode[KeyCode[\"Meta\"] = 57] = \"Meta\";\n KeyCode[KeyCode[\"ContextMenu\"] = 58] = \"ContextMenu\";\n KeyCode[KeyCode[\"F1\"] = 59] = \"F1\";\n KeyCode[KeyCode[\"F2\"] = 60] = \"F2\";\n KeyCode[KeyCode[\"F3\"] = 61] = \"F3\";\n KeyCode[KeyCode[\"F4\"] = 62] = \"F4\";\n KeyCode[KeyCode[\"F5\"] = 63] = \"F5\";\n KeyCode[KeyCode[\"F6\"] = 64] = \"F6\";\n KeyCode[KeyCode[\"F7\"] = 65] = \"F7\";\n KeyCode[KeyCode[\"F8\"] = 66] = \"F8\";\n KeyCode[KeyCode[\"F9\"] = 67] = \"F9\";\n KeyCode[KeyCode[\"F10\"] = 68] = \"F10\";\n KeyCode[KeyCode[\"F11\"] = 69] = \"F11\";\n KeyCode[KeyCode[\"F12\"] = 70] = \"F12\";\n KeyCode[KeyCode[\"F13\"] = 71] = \"F13\";\n KeyCode[KeyCode[\"F14\"] = 72] = \"F14\";\n KeyCode[KeyCode[\"F15\"] = 73] = \"F15\";\n KeyCode[KeyCode[\"F16\"] = 74] = \"F16\";\n KeyCode[KeyCode[\"F17\"] = 75] = \"F17\";\n KeyCode[KeyCode[\"F18\"] = 76] = \"F18\";\n KeyCode[KeyCode[\"F19\"] = 77] = \"F19\";\n KeyCode[KeyCode[\"F20\"] = 78] = \"F20\";\n KeyCode[KeyCode[\"F21\"] = 79] = \"F21\";\n KeyCode[KeyCode[\"F22\"] = 80] = \"F22\";\n KeyCode[KeyCode[\"F23\"] = 81] = \"F23\";\n KeyCode[KeyCode[\"F24\"] = 82] = \"F24\";\n KeyCode[KeyCode[\"NumLock\"] = 83] = \"NumLock\";\n KeyCode[KeyCode[\"ScrollLock\"] = 84] = \"ScrollLock\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the ';:' key\n */\n KeyCode[KeyCode[\"Semicolon\"] = 85] = \"Semicolon\";\n /**\n * For any country/region, the '+' key\n * For the US standard keyboard, the '=+' key\n */\n KeyCode[KeyCode[\"Equal\"] = 86] = \"Equal\";\n /**\n * For any country/region, the ',' key\n * For the US standard keyboard, the ',<' key\n */\n KeyCode[KeyCode[\"Comma\"] = 87] = \"Comma\";\n /**\n * For any country/region, the '-' key\n * For the US standard keyboard, the '-_' key\n */\n KeyCode[KeyCode[\"Minus\"] = 88] = \"Minus\";\n /**\n * For any country/region, the '.' key\n * For the US standard keyboard, the '.>' key\n */\n KeyCode[KeyCode[\"Period\"] = 89] = \"Period\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '/?' key\n */\n KeyCode[KeyCode[\"Slash\"] = 90] = \"Slash\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '`~' key\n */\n KeyCode[KeyCode[\"Backquote\"] = 91] = \"Backquote\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '[{' key\n */\n KeyCode[KeyCode[\"BracketLeft\"] = 92] = \"BracketLeft\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the '\\|' key\n */\n KeyCode[KeyCode[\"Backslash\"] = 93] = \"Backslash\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the ']}' key\n */\n KeyCode[KeyCode[\"BracketRight\"] = 94] = \"BracketRight\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n * For the US standard keyboard, the ''\"' key\n */\n KeyCode[KeyCode[\"Quote\"] = 95] = \"Quote\";\n /**\n * Used for miscellaneous characters; it can vary by keyboard.\n */\n KeyCode[KeyCode[\"OEM_8\"] = 96] = \"OEM_8\";\n /**\n * Either the angle bracket key or the backslash key on the RT 102-key keyboard.\n */\n KeyCode[KeyCode[\"IntlBackslash\"] = 97] = \"IntlBackslash\";\n KeyCode[KeyCode[\"Numpad0\"] = 98] = \"Numpad0\";\n KeyCode[KeyCode[\"Numpad1\"] = 99] = \"Numpad1\";\n KeyCode[KeyCode[\"Numpad2\"] = 100] = \"Numpad2\";\n KeyCode[KeyCode[\"Numpad3\"] = 101] = \"Numpad3\";\n KeyCode[KeyCode[\"Numpad4\"] = 102] = \"Numpad4\";\n KeyCode[KeyCode[\"Numpad5\"] = 103] = \"Numpad5\";\n KeyCode[KeyCode[\"Numpad6\"] = 104] = \"Numpad6\";\n KeyCode[KeyCode[\"Numpad7\"] = 105] = \"Numpad7\";\n KeyCode[KeyCode[\"Numpad8\"] = 106] = \"Numpad8\";\n KeyCode[KeyCode[\"Numpad9\"] = 107] = \"Numpad9\";\n KeyCode[KeyCode[\"NumpadMultiply\"] = 108] = \"NumpadMultiply\";\n KeyCode[KeyCode[\"NumpadAdd\"] = 109] = \"NumpadAdd\";\n KeyCode[KeyCode[\"NUMPAD_SEPARATOR\"] = 110] = \"NUMPAD_SEPARATOR\";\n KeyCode[KeyCode[\"NumpadSubtract\"] = 111] = \"NumpadSubtract\";\n KeyCode[KeyCode[\"NumpadDecimal\"] = 112] = \"NumpadDecimal\";\n KeyCode[KeyCode[\"NumpadDivide\"] = 113] = \"NumpadDivide\";\n /**\n * Cover all key codes when IME is processing input.\n */\n KeyCode[KeyCode[\"KEY_IN_COMPOSITION\"] = 114] = \"KEY_IN_COMPOSITION\";\n KeyCode[KeyCode[\"ABNT_C1\"] = 115] = \"ABNT_C1\";\n KeyCode[KeyCode[\"ABNT_C2\"] = 116] = \"ABNT_C2\";\n KeyCode[KeyCode[\"AudioVolumeMute\"] = 117] = \"AudioVolumeMute\";\n KeyCode[KeyCode[\"AudioVolumeUp\"] = 118] = \"AudioVolumeUp\";\n KeyCode[KeyCode[\"AudioVolumeDown\"] = 119] = \"AudioVolumeDown\";\n KeyCode[KeyCode[\"BrowserSearch\"] = 120] = \"BrowserSearch\";\n KeyCode[KeyCode[\"BrowserHome\"] = 121] = \"BrowserHome\";\n KeyCode[KeyCode[\"BrowserBack\"] = 122] = \"BrowserBack\";\n KeyCode[KeyCode[\"BrowserForward\"] = 123] = \"BrowserForward\";\n KeyCode[KeyCode[\"MediaTrackNext\"] = 124] = \"MediaTrackNext\";\n KeyCode[KeyCode[\"MediaTrackPrevious\"] = 125] = \"MediaTrackPrevious\";\n KeyCode[KeyCode[\"MediaStop\"] = 126] = \"MediaStop\";\n KeyCode[KeyCode[\"MediaPlayPause\"] = 127] = \"MediaPlayPause\";\n KeyCode[KeyCode[\"LaunchMediaPlayer\"] = 128] = \"LaunchMediaPlayer\";\n KeyCode[KeyCode[\"LaunchMail\"] = 129] = \"LaunchMail\";\n KeyCode[KeyCode[\"LaunchApp2\"] = 130] = \"LaunchApp2\";\n /**\n * VK_CLEAR, 0x0C, CLEAR key\n */\n KeyCode[KeyCode[\"Clear\"] = 131] = \"Clear\";\n /**\n * Placed last to cover the length of the enum.\n * Please do not depend on this value!\n */\n KeyCode[KeyCode[\"MAX_VALUE\"] = 132] = \"MAX_VALUE\";\n})(KeyCode || (exports.KeyCode = KeyCode = {}));\n/**\n * keyboardEvent.code\n */\nvar ScanCode;\n(function (ScanCode) {\n ScanCode[ScanCode[\"DependsOnKbLayout\"] = -1] = \"DependsOnKbLayout\";\n ScanCode[ScanCode[\"None\"] = 0] = \"None\";\n ScanCode[ScanCode[\"Hyper\"] = 1] = \"Hyper\";\n ScanCode[ScanCode[\"Super\"] = 2] = \"Super\";\n ScanCode[ScanCode[\"Fn\"] = 3] = \"Fn\";\n ScanCode[ScanCode[\"FnLock\"] = 4] = \"FnLock\";\n ScanCode[ScanCode[\"Suspend\"] = 5] = \"Suspend\";\n ScanCode[ScanCode[\"Resume\"] = 6] = \"Resume\";\n ScanCode[ScanCode[\"Turbo\"] = 7] = \"Turbo\";\n ScanCode[ScanCode[\"Sleep\"] = 8] = \"Sleep\";\n ScanCode[ScanCode[\"WakeUp\"] = 9] = \"WakeUp\";\n ScanCode[ScanCode[\"KeyA\"] = 10] = \"KeyA\";\n ScanCode[ScanCode[\"KeyB\"] = 11] = \"KeyB\";\n ScanCode[ScanCode[\"KeyC\"] = 12] = \"KeyC\";\n ScanCode[ScanCode[\"KeyD\"] = 13] = \"KeyD\";\n ScanCode[ScanCode[\"KeyE\"] = 14] = \"KeyE\";\n ScanCode[ScanCode[\"KeyF\"] = 15] = \"KeyF\";\n ScanCode[ScanCode[\"KeyG\"] = 16] = \"KeyG\";\n ScanCode[ScanCode[\"KeyH\"] = 17] = \"KeyH\";\n ScanCode[ScanCode[\"KeyI\"] = 18] = \"KeyI\";\n ScanCode[ScanCode[\"KeyJ\"] = 19] = \"KeyJ\";\n ScanCode[ScanCode[\"KeyK\"] = 20] = \"KeyK\";\n ScanCode[ScanCode[\"KeyL\"] = 21] = \"KeyL\";\n ScanCode[ScanCode[\"KeyM\"] = 22] = \"KeyM\";\n ScanCode[ScanCode[\"KeyN\"] = 23] = \"KeyN\";\n ScanCode[ScanCode[\"KeyO\"] = 24] = \"KeyO\";\n ScanCode[ScanCode[\"KeyP\"] = 25] = \"KeyP\";\n ScanCode[ScanCode[\"KeyQ\"] = 26] = \"KeyQ\";\n ScanCode[ScanCode[\"KeyR\"] = 27] = \"KeyR\";\n ScanCode[ScanCode[\"KeyS\"] = 28] = \"KeyS\";\n ScanCode[ScanCode[\"KeyT\"] = 29] = \"KeyT\";\n ScanCode[ScanCode[\"KeyU\"] = 30] = \"KeyU\";\n ScanCode[ScanCode[\"KeyV\"] = 31] = \"KeyV\";\n ScanCode[ScanCode[\"KeyW\"] = 32] = \"KeyW\";\n ScanCode[ScanCode[\"KeyX\"] = 33] = \"KeyX\";\n ScanCode[ScanCode[\"KeyY\"] = 34] = \"KeyY\";\n ScanCode[ScanCode[\"KeyZ\"] = 35] = \"KeyZ\";\n ScanCode[ScanCode[\"Digit1\"] = 36] = \"Digit1\";\n ScanCode[ScanCode[\"Digit2\"] = 37] = \"Digit2\";\n ScanCode[ScanCode[\"Digit3\"] = 38] = \"Digit3\";\n ScanCode[ScanCode[\"Digit4\"] = 39] = \"Digit4\";\n ScanCode[ScanCode[\"Digit5\"] = 40] = \"Digit5\";\n ScanCode[ScanCode[\"Digit6\"] = 41] = \"Digit6\";\n ScanCode[ScanCode[\"Digit7\"] = 42] = \"Digit7\";\n ScanCode[ScanCode[\"Digit8\"] = 43] = \"Digit8\";\n ScanCode[ScanCode[\"Digit9\"] = 44] = \"Digit9\";\n ScanCode[ScanCode[\"Digit0\"] = 45] = \"Digit0\";\n ScanCode[ScanCode[\"Enter\"] = 46] = \"Enter\";\n ScanCode[ScanCode[\"Escape\"] = 47] = \"Escape\";\n ScanCode[ScanCode[\"Backspace\"] = 48] = \"Backspace\";\n ScanCode[ScanCode[\"Tab\"] = 49] = \"Tab\";\n ScanCode[ScanCode[\"Space\"] = 50] = \"Space\";\n ScanCode[ScanCode[\"Minus\"] = 51] = \"Minus\";\n ScanCode[ScanCode[\"Equal\"] = 52] = \"Equal\";\n ScanCode[ScanCode[\"BracketLeft\"] = 53] = \"BracketLeft\";\n ScanCode[ScanCode[\"BracketRight\"] = 54] = \"BracketRight\";\n ScanCode[ScanCode[\"Backslash\"] = 55] = \"Backslash\";\n ScanCode[ScanCode[\"IntlHash\"] = 56] = \"IntlHash\";\n ScanCode[ScanCode[\"Semicolon\"] = 57] = \"Semicolon\";\n ScanCode[ScanCode[\"Quote\"] = 58] = \"Quote\";\n ScanCode[ScanCode[\"Backquote\"] = 59] = \"Backquote\";\n ScanCode[ScanCode[\"Comma\"] = 60] = \"Comma\";\n ScanCode[ScanCode[\"Period\"] = 61] = \"Period\";\n ScanCode[ScanCode[\"Slash\"] = 62] = \"Slash\";\n ScanCode[ScanCode[\"CapsLock\"] = 63] = \"CapsLock\";\n ScanCode[ScanCode[\"F1\"] = 64] = \"F1\";\n ScanCode[ScanCode[\"F2\"] = 65] = \"F2\";\n ScanCode[ScanCode[\"F3\"] = 66] = \"F3\";\n ScanCode[ScanCode[\"F4\"] = 67] = \"F4\";\n ScanCode[ScanCode[\"F5\"] = 68] = \"F5\";\n ScanCode[ScanCode[\"F6\"] = 69] = \"F6\";\n ScanCode[ScanCode[\"F7\"] = 70] = \"F7\";\n ScanCode[ScanCode[\"F8\"] = 71] = \"F8\";\n ScanCode[ScanCode[\"F9\"] = 72] = \"F9\";\n ScanCode[ScanCode[\"F10\"] = 73] = \"F10\";\n ScanCode[ScanCode[\"F11\"] = 74] = \"F11\";\n ScanCode[ScanCode[\"F12\"] = 75] = \"F12\";\n ScanCode[ScanCode[\"PrintScreen\"] = 76] = \"PrintScreen\";\n ScanCode[ScanCode[\"ScrollLock\"] = 77] = \"ScrollLock\";\n ScanCode[ScanCode[\"Pause\"] = 78] = \"Pause\";\n ScanCode[ScanCode[\"Insert\"] = 79] = \"Insert\";\n ScanCode[ScanCode[\"Home\"] = 80] = \"Home\";\n ScanCode[ScanCode[\"PageUp\"] = 81] = \"PageUp\";\n ScanCode[ScanCode[\"Delete\"] = 82] = \"Delete\";\n ScanCode[ScanCode[\"End\"] = 83] = \"End\";\n ScanCode[ScanCode[\"PageDown\"] = 84] = \"PageDown\";\n ScanCode[ScanCode[\"ArrowRight\"] = 85] = \"ArrowRight\";\n ScanCode[ScanCode[\"ArrowLeft\"] = 86] = \"ArrowLeft\";\n ScanCode[ScanCode[\"ArrowDown\"] = 87] = \"ArrowDown\";\n ScanCode[ScanCode[\"ArrowUp\"] = 88] = \"ArrowUp\";\n ScanCode[ScanCode[\"NumLock\"] = 89] = \"NumLock\";\n ScanCode[ScanCode[\"NumpadDivide\"] = 90] = \"NumpadDivide\";\n ScanCode[ScanCode[\"NumpadMultiply\"] = 91] = \"NumpadMultiply\";\n ScanCode[ScanCode[\"NumpadSubtract\"] = 92] = \"NumpadSubtract\";\n ScanCode[ScanCode[\"NumpadAdd\"] = 93] = \"NumpadAdd\";\n ScanCode[ScanCode[\"NumpadEnter\"] = 94] = \"NumpadEnter\";\n ScanCode[ScanCode[\"Numpad1\"] = 95] = \"Numpad1\";\n ScanCode[ScanCode[\"Numpad2\"] = 96] = \"Numpad2\";\n ScanCode[ScanCode[\"Numpad3\"] = 97] = \"Numpad3\";\n ScanCode[ScanCode[\"Numpad4\"] = 98] = \"Numpad4\";\n ScanCode[ScanCode[\"Numpad5\"] = 99] = \"Numpad5\";\n ScanCode[ScanCode[\"Numpad6\"] = 100] = \"Numpad6\";\n ScanCode[ScanCode[\"Numpad7\"] = 101] = \"Numpad7\";\n ScanCode[ScanCode[\"Numpad8\"] = 102] = \"Numpad8\";\n ScanCode[ScanCode[\"Numpad9\"] = 103] = \"Numpad9\";\n ScanCode[ScanCode[\"Numpad0\"] = 104] = \"Numpad0\";\n ScanCode[ScanCode[\"NumpadDecimal\"] = 105] = \"NumpadDecimal\";\n ScanCode[ScanCode[\"IntlBackslash\"] = 106] = \"IntlBackslash\";\n ScanCode[ScanCode[\"ContextMenu\"] = 107] = \"ContextMenu\";\n ScanCode[ScanCode[\"Power\"] = 108] = \"Power\";\n ScanCode[ScanCode[\"NumpadEqual\"] = 109] = \"NumpadEqual\";\n ScanCode[ScanCode[\"F13\"] = 110] = \"F13\";\n ScanCode[ScanCode[\"F14\"] = 111] = \"F14\";\n ScanCode[ScanCode[\"F15\"] = 112] = \"F15\";\n ScanCode[ScanCode[\"F16\"] = 113] = \"F16\";\n ScanCode[ScanCode[\"F17\"] = 114] = \"F17\";\n ScanCode[ScanCode[\"F18\"] = 115] = \"F18\";\n ScanCode[ScanCode[\"F19\"] = 116] = \"F19\";\n ScanCode[ScanCode[\"F20\"] = 117] = \"F20\";\n ScanCode[ScanCode[\"F21\"] = 118] = \"F21\";\n ScanCode[ScanCode[\"F22\"] = 119] = \"F22\";\n ScanCode[ScanCode[\"F23\"] = 120] = \"F23\";\n ScanCode[ScanCode[\"F24\"] = 121] = \"F24\";\n ScanCode[ScanCode[\"Open\"] = 122] = \"Open\";\n ScanCode[ScanCode[\"Help\"] = 123] = \"Help\";\n ScanCode[ScanCode[\"Select\"] = 124] = \"Select\";\n ScanCode[ScanCode[\"Again\"] = 125] = \"Again\";\n ScanCode[ScanCode[\"Undo\"] = 126] = \"Undo\";\n ScanCode[ScanCode[\"Cut\"] = 127] = \"Cut\";\n ScanCode[ScanCode[\"Copy\"] = 128] = \"Copy\";\n ScanCode[ScanCode[\"Paste\"] = 129] = \"Paste\";\n ScanCode[ScanCode[\"Find\"] = 130] = \"Find\";\n ScanCode[ScanCode[\"AudioVolumeMute\"] = 131] = \"AudioVolumeMute\";\n ScanCode[ScanCode[\"AudioVolumeUp\"] = 132] = \"AudioVolumeUp\";\n ScanCode[ScanCode[\"AudioVolumeDown\"] = 133] = \"AudioVolumeDown\";\n ScanCode[ScanCode[\"NumpadComma\"] = 134] = \"NumpadComma\";\n ScanCode[ScanCode[\"IntlRo\"] = 135] = \"IntlRo\";\n ScanCode[ScanCode[\"KanaMode\"] = 136] = \"KanaMode\";\n ScanCode[ScanCode[\"IntlYen\"] = 137] = \"IntlYen\";\n ScanCode[ScanCode[\"Convert\"] = 138] = \"Convert\";\n ScanCode[ScanCode[\"NonConvert\"] = 139] = \"NonConvert\";\n ScanCode[ScanCode[\"Lang1\"] = 140] = \"Lang1\";\n ScanCode[ScanCode[\"Lang2\"] = 141] = \"Lang2\";\n ScanCode[ScanCode[\"Lang3\"] = 142] = \"Lang3\";\n ScanCode[ScanCode[\"Lang4\"] = 143] = \"Lang4\";\n ScanCode[ScanCode[\"Lang5\"] = 144] = \"Lang5\";\n ScanCode[ScanCode[\"Abort\"] = 145] = \"Abort\";\n ScanCode[ScanCode[\"Props\"] = 146] = \"Props\";\n ScanCode[ScanCode[\"NumpadParenLeft\"] = 147] = \"NumpadParenLeft\";\n ScanCode[ScanCode[\"NumpadParenRight\"] = 148] = \"NumpadParenRight\";\n ScanCode[ScanCode[\"NumpadBackspace\"] = 149] = \"NumpadBackspace\";\n ScanCode[ScanCode[\"NumpadMemoryStore\"] = 150] = \"NumpadMemoryStore\";\n ScanCode[ScanCode[\"NumpadMemoryRecall\"] = 151] = \"NumpadMemoryRecall\";\n ScanCode[ScanCode[\"NumpadMemoryClear\"] = 152] = \"NumpadMemoryClear\";\n ScanCode[ScanCode[\"NumpadMemoryAdd\"] = 153] = \"NumpadMemoryAdd\";\n ScanCode[ScanCode[\"NumpadMemorySubtract\"] = 154] = \"NumpadMemorySubtract\";\n ScanCode[ScanCode[\"NumpadClear\"] = 155] = \"NumpadClear\";\n ScanCode[ScanCode[\"NumpadClearEntry\"] = 156] = \"NumpadClearEntry\";\n ScanCode[ScanCode[\"ControlLeft\"] = 157] = \"ControlLeft\";\n ScanCode[ScanCode[\"ShiftLeft\"] = 158] = \"ShiftLeft\";\n ScanCode[ScanCode[\"AltLeft\"] = 159] = \"AltLeft\";\n ScanCode[ScanCode[\"MetaLeft\"] = 160] = \"MetaLeft\";\n ScanCode[ScanCode[\"ControlRight\"] = 161] = \"ControlRight\";\n ScanCode[ScanCode[\"ShiftRight\"] = 162] = \"ShiftRight\";\n ScanCode[ScanCode[\"AltRight\"] = 163] = \"AltRight\";\n ScanCode[ScanCode[\"MetaRight\"] = 164] = \"MetaRight\";\n ScanCode[ScanCode[\"BrightnessUp\"] = 165] = \"BrightnessUp\";\n ScanCode[ScanCode[\"BrightnessDown\"] = 166] = \"BrightnessDown\";\n ScanCode[ScanCode[\"MediaPlay\"] = 167] = \"MediaPlay\";\n ScanCode[ScanCode[\"MediaRecord\"] = 168] = \"MediaRecord\";\n ScanCode[ScanCode[\"MediaFastForward\"] = 169] = \"MediaFastForward\";\n ScanCode[ScanCode[\"MediaRewind\"] = 170] = \"MediaRewind\";\n ScanCode[ScanCode[\"MediaTrackNext\"] = 171] = \"MediaTrackNext\";\n ScanCode[ScanCode[\"MediaTrackPrevious\"] = 172] = \"MediaTrackPrevious\";\n ScanCode[ScanCode[\"MediaStop\"] = 173] = \"MediaStop\";\n ScanCode[ScanCode[\"Eject\"] = 174] = \"Eject\";\n ScanCode[ScanCode[\"MediaPlayPause\"] = 175] = \"MediaPlayPause\";\n ScanCode[ScanCode[\"MediaSelect\"] = 176] = \"MediaSelect\";\n ScanCode[ScanCode[\"LaunchMail\"] = 177] = \"LaunchMail\";\n ScanCode[ScanCode[\"LaunchApp2\"] = 178] = \"LaunchApp2\";\n ScanCode[ScanCode[\"LaunchApp1\"] = 179] = \"LaunchApp1\";\n ScanCode[ScanCode[\"SelectTask\"] = 180] = \"SelectTask\";\n ScanCode[ScanCode[\"LaunchScreenSaver\"] = 181] = \"LaunchScreenSaver\";\n ScanCode[ScanCode[\"BrowserSearch\"] = 182] = \"BrowserSearch\";\n ScanCode[ScanCode[\"BrowserHome\"] = 183] = \"BrowserHome\";\n ScanCode[ScanCode[\"BrowserBack\"] = 184] = \"BrowserBack\";\n ScanCode[ScanCode[\"BrowserForward\"] = 185] = \"BrowserForward\";\n ScanCode[ScanCode[\"BrowserStop\"] = 186] = \"BrowserStop\";\n ScanCode[ScanCode[\"BrowserRefresh\"] = 187] = \"BrowserRefresh\";\n ScanCode[ScanCode[\"BrowserFavorites\"] = 188] = \"BrowserFavorites\";\n ScanCode[ScanCode[\"ZoomToggle\"] = 189] = \"ZoomToggle\";\n ScanCode[ScanCode[\"MailReply\"] = 190] = \"MailReply\";\n ScanCode[ScanCode[\"MailForward\"] = 191] = \"MailForward\";\n ScanCode[ScanCode[\"MailSend\"] = 192] = \"MailSend\";\n ScanCode[ScanCode[\"MAX_VALUE\"] = 193] = \"MAX_VALUE\";\n})(ScanCode || (exports.ScanCode = ScanCode = {}));\nclass KeyCodeStrMap {\n constructor() {\n this._keyCodeToStr = [];\n this._strToKeyCode = Object.create(null);\n }\n define(keyCode, str) {\n this._keyCodeToStr[keyCode] = str;\n this._strToKeyCode[str.toLowerCase()] = keyCode;\n }\n keyCodeToStr(keyCode) {\n return this._keyCodeToStr[keyCode];\n }\n strToKeyCode(str) {\n return this._strToKeyCode[str.toLowerCase()] || KeyCode.Unknown;\n }\n}\nconst uiMap = new KeyCodeStrMap();\nconst userSettingsUSMap = new KeyCodeStrMap();\nconst userSettingsGeneralMap = new KeyCodeStrMap();\nexports.EVENT_KEY_CODE_MAP = new Array(230);\nexports.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE = {};\nconst scanCodeIntToStr = [];\nconst scanCodeStrToInt = Object.create(null);\nconst scanCodeLowerCaseStrToInt = Object.create(null);\nexports.ScanCodeUtils = {\n lowerCaseToEnum: (scanCode) => scanCodeLowerCaseStrToInt[scanCode] || ScanCode.None,\n toEnum: (scanCode) => scanCodeStrToInt[scanCode] || ScanCode.None,\n toString: (scanCode) => scanCodeIntToStr[scanCode] || 'None'\n};\nvar KeyCodeUtils;\n(function (KeyCodeUtils) {\n function toString(keyCode) {\n return uiMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toString = toString;\n function fromString(key) {\n return uiMap.strToKeyCode(key);\n }\n KeyCodeUtils.fromString = fromString;\n function toUserSettingsUS(keyCode) {\n return userSettingsUSMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toUserSettingsUS = toUserSettingsUS;\n function toUserSettingsGeneral(keyCode) {\n return userSettingsGeneralMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toUserSettingsGeneral = toUserSettingsGeneral;\n function fromUserSettings(key) {\n return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\n }\n KeyCodeUtils.fromUserSettings = fromUserSettings;\n function toElectronAccelerator(keyCode) {\n if (keyCode >= KeyCode.Numpad0 && keyCode <= KeyCode.NumpadDivide) {\n // [Electron Accelerators] Electron is able to parse numpad keys, but unfortunately it\n // renders them just as regular keys in menus. For example, num0 is rendered as \"0\",\n // numdiv is rendered as \"/\", numsub is rendered as \"-\".\n //\n // This can lead to incredible confusion, as it makes numpad based keybindings indistinguishable\n // from keybindings based on regular keys.\n //\n // We therefore need to fall back to custom rendering for numpad keys.\n return null;\n }\n switch (keyCode) {\n case KeyCode.UpArrow:\n return 'Up';\n case KeyCode.DownArrow:\n return 'Down';\n case KeyCode.LeftArrow:\n return 'Left';\n case KeyCode.RightArrow:\n return 'Right';\n }\n return uiMap.keyCodeToStr(keyCode);\n }\n KeyCodeUtils.toElectronAccelerator = toElectronAccelerator;\n})(KeyCodeUtils || (exports.KeyCodeUtils = KeyCodeUtils = {}));\nvar KeyMod;\n(function (KeyMod) {\n KeyMod[KeyMod[\"CtrlCmd\"] = 2048] = \"CtrlCmd\";\n KeyMod[KeyMod[\"Shift\"] = 1024] = \"Shift\";\n KeyMod[KeyMod[\"Alt\"] = 512] = \"Alt\";\n KeyMod[KeyMod[\"WinCtrl\"] = 256] = \"WinCtrl\";\n})(KeyMod || (exports.KeyMod = KeyMod = {}));\nfunction KeyChord(firstPart, secondPart) {\n const chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\n return (firstPart | chordPart) >>> 0;\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ResolvedKeybinding = exports.ResolvedChord = exports.Keybinding = exports.ScanCodeChord = exports.KeyCodeChord = void 0;\nexports.decodeKeybinding = decodeKeybinding;\nexports.createSimpleKeybinding = createSimpleKeybinding;\nconst errors_1 = require(\"vs/base/common/errors\");\nconst keyCodes_1 = require(\"vs/base/common/keyCodes\");\nconst platform_1 = require(\"vs/base/common/platform\");\n/**\n * Binary encoding strategy:\n * ```\n * 1111 11\n * 5432 1098 7654 3210\n * ---- CSAW KKKK KKKK\n * C = bit 11 = ctrlCmd flag\n * S = bit 10 = shift flag\n * A = bit 9 = alt flag\n * W = bit 8 = winCtrl flag\n * K = bits 0-7 = key code\n * ```\n */\nvar BinaryKeybindingsMask;\n(function (BinaryKeybindingsMask) {\n BinaryKeybindingsMask[BinaryKeybindingsMask[\"CtrlCmd\"] = 2048] = \"CtrlCmd\";\n BinaryKeybindingsMask[BinaryKeybindingsMask[\"Shift\"] = 1024] = \"Shift\";\n BinaryKeybindingsMask[BinaryKeybindingsMask[\"Alt\"] = 512] = \"Alt\";\n BinaryKeybindingsMask[BinaryKeybindingsMask[\"WinCtrl\"] = 256] = \"WinCtrl\";\n BinaryKeybindingsMask[BinaryKeybindingsMask[\"KeyCode\"] = 255] = \"KeyCode\";\n})(BinaryKeybindingsMask || (BinaryKeybindingsMask = {}));\nfunction decodeKeybinding(keybinding, OS) {\n if (typeof keybinding === 'number') {\n if (keybinding === 0) {\n return null;\n }\n const firstChord = (keybinding & 0x0000FFFF) >>> 0;\n const secondChord = (keybinding & 0xFFFF0000) >>> 16;\n if (secondChord !== 0) {\n return new Keybinding([\n createSimpleKeybinding(firstChord, OS),\n createSimpleKeybinding(secondChord, OS)\n ]);\n }\n return new Keybinding([createSimpleKeybinding(firstChord, OS)]);\n }\n else {\n const chords = [];\n for (let i = 0; i < keybinding.length; i++) {\n chords.push(createSimpleKeybinding(keybinding[i], OS));\n }\n return new Keybinding(chords);\n }\n}\nfunction createSimpleKeybinding(keybinding, OS) {\n const ctrlCmd = (keybinding & BinaryKeybindingsMask.CtrlCmd ? true : false);\n const winCtrl = (keybinding & BinaryKeybindingsMask.WinCtrl ? true : false);\n const ctrlKey = (OS === platform_1.OperatingSystem.Macintosh ? winCtrl : ctrlCmd);\n const shiftKey = (keybinding & BinaryKeybindingsMask.Shift ? true : false);\n const altKey = (keybinding & BinaryKeybindingsMask.Alt ? true : false);\n const metaKey = (OS === platform_1.OperatingSystem.Macintosh ? ctrlCmd : winCtrl);\n const keyCode = (keybinding & BinaryKeybindingsMask.KeyCode);\n return new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);\n}\n/**\n * Represents a chord which uses the `keyCode` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nclass KeyCodeChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.keyCode = keyCode;\n }\n equals(other) {\n return (other instanceof KeyCodeChord\n && this.ctrlKey === other.ctrlKey\n && this.shiftKey === other.shiftKey\n && this.altKey === other.altKey\n && this.metaKey === other.metaKey\n && this.keyCode === other.keyCode);\n }\n getHashCode() {\n const ctrl = this.ctrlKey ? '1' : '0';\n const shift = this.shiftKey ? '1' : '0';\n const alt = this.altKey ? '1' : '0';\n const meta = this.metaKey ? '1' : '0';\n return `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;\n }\n isModifierKey() {\n return (this.keyCode === keyCodes_1.KeyCode.Unknown\n || this.keyCode === keyCodes_1.KeyCode.Ctrl\n || this.keyCode === keyCodes_1.KeyCode.Meta\n || this.keyCode === keyCodes_1.KeyCode.Alt\n || this.keyCode === keyCodes_1.KeyCode.Shift);\n }\n toKeybinding() {\n return new Keybinding([this]);\n }\n /**\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n */\n isDuplicateModifierCase() {\n return ((this.ctrlKey && this.keyCode === keyCodes_1.KeyCode.Ctrl)\n || (this.shiftKey && this.keyCode === keyCodes_1.KeyCode.Shift)\n || (this.altKey && this.keyCode === keyCodes_1.KeyCode.Alt)\n || (this.metaKey && this.keyCode === keyCodes_1.KeyCode.Meta));\n }\n}\nexports.KeyCodeChord = KeyCodeChord;\n/**\n * Represents a chord which uses the `code` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nclass ScanCodeChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, scanCode) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.scanCode = scanCode;\n }\n equals(other) {\n return (other instanceof ScanCodeChord\n && this.ctrlKey === other.ctrlKey\n && this.shiftKey === other.shiftKey\n && this.altKey === other.altKey\n && this.metaKey === other.metaKey\n && this.scanCode === other.scanCode);\n }\n getHashCode() {\n const ctrl = this.ctrlKey ? '1' : '0';\n const shift = this.shiftKey ? '1' : '0';\n const alt = this.altKey ? '1' : '0';\n const meta = this.metaKey ? '1' : '0';\n return `S${ctrl}${shift}${alt}${meta}${this.scanCode}`;\n }\n /**\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n */\n isDuplicateModifierCase() {\n return ((this.ctrlKey && (this.scanCode === keyCodes_1.ScanCode.ControlLeft || this.scanCode === keyCodes_1.ScanCode.ControlRight))\n || (this.shiftKey && (this.scanCode === keyCodes_1.ScanCode.ShiftLeft || this.scanCode === keyCodes_1.ScanCode.ShiftRight))\n || (this.altKey && (this.scanCode === keyCodes_1.ScanCode.AltLeft || this.scanCode === keyCodes_1.ScanCode.AltRight))\n || (this.metaKey && (this.scanCode === keyCodes_1.ScanCode.MetaLeft || this.scanCode === keyCodes_1.ScanCode.MetaRight)));\n }\n}\nexports.ScanCodeChord = ScanCodeChord;\n/**\n * A keybinding is a sequence of chords.\n */\nclass Keybinding {\n constructor(chords) {\n if (chords.length === 0) {\n throw (0, errors_1.illegalArgument)(`chords`);\n }\n this.chords = chords;\n }\n getHashCode() {\n let result = '';\n for (let i = 0, len = this.chords.length; i < len; i++) {\n if (i !== 0) {\n result += ';';\n }\n result += this.chords[i].getHashCode();\n }\n return result;\n }\n equals(other) {\n if (other === null) {\n return false;\n }\n if (this.chords.length !== other.chords.length) {\n return false;\n }\n for (let i = 0; i < this.chords.length; i++) {\n if (!this.chords[i].equals(other.chords[i])) {\n return false;\n }\n }\n return true;\n }\n}\nexports.Keybinding = Keybinding;\nclass ResolvedChord {\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyLabel, keyAriaLabel) {\n this.ctrlKey = ctrlKey;\n this.shiftKey = shiftKey;\n this.altKey = altKey;\n this.metaKey = metaKey;\n this.keyLabel = keyLabel;\n this.keyAriaLabel = keyAriaLabel;\n }\n}\nexports.ResolvedChord = ResolvedChord;\n/**\n * A resolved keybinding. Consists of one or multiple chords.\n */\nclass ResolvedKeybinding {\n}\nexports.ResolvedKeybinding = ResolvedKeybinding;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Lazy = void 0;\nclass Lazy {\n constructor(executor) {\n this.executor = executor;\n this._didRun = false;\n }\n /**\n * True if the lazy value has been resolved.\n */\n get hasValue() { return this._didRun; }\n /**\n * Get the wrapped value.\n *\n * This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only\n * resolved once. `getValue` will re-throw exceptions that are hit while resolving the value\n */\n get value() {\n if (!this._didRun) {\n try {\n this._value = this.executor();\n }\n catch (err) {\n this._error = err;\n }\n finally {\n this._didRun = true;\n }\n }\n if (this._error) {\n throw this._error;\n }\n return this._value;\n }\n /**\n * Get the wrapped value without forcing evaluation.\n */\n get rawValue() { return this._value; }\n}\nexports.Lazy = Lazy;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DisposableMap = exports.ImmortalReference = exports.AsyncReferenceCollection = exports.ReferenceCollection = exports.SafeDisposable = exports.RefCountedDisposable = exports.MandatoryMutableDisposable = exports.MutableDisposable = exports.Disposable = exports.DisposableStore = exports.DisposableTracker = void 0;\nexports.setDisposableTracker = setDisposableTracker;\nexports.trackDisposable = trackDisposable;\nexports.markAsDisposed = markAsDisposed;\nexports.markAsSingleton = markAsSingleton;\nexports.isDisposable = isDisposable;\nexports.dispose = dispose;\nexports.disposeIfDisposable = disposeIfDisposable;\nexports.combinedDisposable = combinedDisposable;\nexports.toDisposable = toDisposable;\nexports.disposeOnReturn = disposeOnReturn;\nconst arrays_1 = require(\"vs/base/common/arrays\");\nconst collections_1 = require(\"vs/base/common/collections\");\nconst map_1 = require(\"./map\");\nconst functional_1 = require(\"vs/base/common/functional\");\nconst iterator_1 = require(\"vs/base/common/iterator\");\n// #region Disposable Tracking\n/**\n * Enables logging of potentially leaked disposables.\n *\n * A disposable is considered leaked if it is not disposed or not registered as the child of\n * another disposable. This tracking is very simple an only works for classes that either\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\n */\nconst TRACK_DISPOSABLES = false;\nlet disposableTracker = null;\nclass DisposableTracker {\n constructor() {\n this.livingDisposables = new Map();\n }\n static { this.idx = 0; }\n getDisposableData(d) {\n let val = this.livingDisposables.get(d);\n if (!val) {\n val = { parent: null, source: null, isSingleton: false, value: d, idx: DisposableTracker.idx++ };\n this.livingDisposables.set(d, val);\n }\n return val;\n }\n trackDisposable(d) {\n const data = this.getDisposableData(d);\n if (!data.source) {\n data.source =\n new Error().stack;\n }\n }\n setParent(child, parent) {\n const data = this.getDisposableData(child);\n data.parent = parent;\n }\n markAsDisposed(x) {\n this.livingDisposables.delete(x);\n }\n markAsSingleton(disposable) {\n this.getDisposableData(disposable).isSingleton = true;\n }\n getRootParent(data, cache) {\n const cacheValue = cache.get(data);\n if (cacheValue) {\n return cacheValue;\n }\n const result = data.parent ? this.getRootParent(this.getDisposableData(data.parent), cache) : data;\n cache.set(data, result);\n return result;\n }\n getTrackedDisposables() {\n const rootParentCache = new Map();\n const leaking = [...this.livingDisposables.entries()]\n .filter(([, v]) => v.source !== null && !this.getRootParent(v, rootParentCache).isSingleton)\n .flatMap(([k]) => k);\n return leaking;\n }\n computeLeakingDisposables(maxReported = 10, preComputedLeaks) {\n let uncoveredLeakingObjs;\n if (preComputedLeaks) {\n uncoveredLeakingObjs = preComputedLeaks;\n }\n else {\n const rootParentCache = new Map();\n const leakingObjects = [...this.livingDisposables.values()]\n .filter((info) => info.source !== null && !this.getRootParent(info, rootParentCache).isSingleton);\n if (leakingObjects.length === 0) {\n return;\n }\n const leakingObjsSet = new Set(leakingObjects.map(o => o.value));\n // Remove all objects that are a child of other leaking objects. Assumes there are no cycles.\n uncoveredLeakingObjs = leakingObjects.filter(l => {\n return !(l.parent && leakingObjsSet.has(l.parent));\n });\n if (uncoveredLeakingObjs.length === 0) {\n throw new Error('There are cyclic diposable chains!');\n }\n }\n if (!uncoveredLeakingObjs) {\n return undefined;\n }\n function getStackTracePath(leaking) {\n function removePrefix(array, linesToRemove) {\n while (array.length > 0 && linesToRemove.some(regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp))) {\n array.shift();\n }\n }\n const lines = leaking.source.split('\\n').map(p => p.trim().replace('at ', '')).filter(l => l !== '');\n removePrefix(lines, ['Error', /^trackDisposable \\(.*\\)$/, /^DisposableTracker.trackDisposable \\(.*\\)$/]);\n return lines.reverse();\n }\n const stackTraceStarts = new map_1.SetMap();\n for (const leaking of uncoveredLeakingObjs) {\n const stackTracePath = getStackTracePath(leaking);\n for (let i = 0; i <= stackTracePath.length; i++) {\n stackTraceStarts.add(stackTracePath.slice(0, i).join('\\n'), leaking);\n }\n }\n // Put earlier leaks first\n uncoveredLeakingObjs.sort((0, arrays_1.compareBy)(l => l.idx, arrays_1.numberComparator));\n let message = '';\n let i = 0;\n for (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {\n i++;\n const stackTracePath = getStackTracePath(leaking);\n const stackTraceFormattedLines = [];\n for (let i = 0; i < stackTracePath.length; i++) {\n let line = stackTracePath[i];\n const starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\\n'));\n line = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;\n const prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\\n'));\n const continuations = (0, collections_1.groupBy)([...prevStarts].map(d => getStackTracePath(d)[i]), v => v);\n delete continuations[stackTracePath[i]];\n for (const [cont, set] of Object.entries(continuations)) {\n stackTraceFormattedLines.unshift(` - stacktraces of ${set.length} other leaks continue with ${cont}`);\n }\n stackTraceFormattedLines.unshift(line);\n }\n message += `\\n\\n\\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\\n${stackTraceFormattedLines.join('\\n')}\\n============================================================\\n\\n`;\n }\n if (uncoveredLeakingObjs.length > maxReported) {\n message += `\\n\\n\\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\\n\\n`;\n }\n return { leaks: uncoveredLeakingObjs, details: message };\n }\n}\nexports.DisposableTracker = DisposableTracker;\nfunction setDisposableTracker(tracker) {\n disposableTracker = tracker;\n}\nif (TRACK_DISPOSABLES) {\n const __is_disposable_tracked__ = '__is_disposable_tracked__';\n setDisposableTracker(new class {\n trackDisposable(x) {\n const stack = new Error('Potentially leaked disposable').stack;\n setTimeout(() => {\n if (!x[__is_disposable_tracked__]) {\n console.log(stack);\n }\n }, 3000);\n }\n setParent(child, parent) {\n if (child && child !== Disposable.None) {\n try {\n child[__is_disposable_tracked__] = true;\n }\n catch {\n // noop\n }\n }\n }\n markAsDisposed(disposable) {\n if (disposable && disposable !== Disposable.None) {\n try {\n disposable[__is_disposable_tracked__] = true;\n }\n catch {\n // noop\n }\n }\n }\n markAsSingleton(disposable) { }\n });\n}\nfunction trackDisposable(x) {\n disposableTracker?.trackDisposable(x);\n return x;\n}\nfunction markAsDisposed(disposable) {\n disposableTracker?.markAsDisposed(disposable);\n}\nfunction setParentOfDisposable(child, parent) {\n disposableTracker?.setParent(child, parent);\n}\nfunction setParentOfDisposables(children, parent) {\n if (!disposableTracker) {\n return;\n }\n for (const child of children) {\n disposableTracker.setParent(child, parent);\n }\n}\n/**\n * Indicates that the given object is a singleton which does not need to be disposed.\n*/\nfunction markAsSingleton(singleton) {\n disposableTracker?.markAsSingleton(singleton);\n return singleton;\n}\n/**\n * Check if `thing` is {@link IDisposable disposable}.\n */\nfunction isDisposable(thing) {\n return typeof thing === 'object' && thing !== null && typeof thing.dispose === 'function' && thing.dispose.length === 0;\n}\nfunction dispose(arg) {\n if (iterator_1.Iterable.is(arg)) {\n const errors = [];\n for (const d of arg) {\n if (d) {\n try {\n d.dispose();\n }\n catch (e) {\n errors.push(e);\n }\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n }\n else if (errors.length > 1) {\n throw new AggregateError(errors, 'Encountered errors while disposing of store');\n }\n return Array.isArray(arg) ? [] : arg;\n }\n else if (arg) {\n arg.dispose();\n return arg;\n }\n}\nfunction disposeIfDisposable(disposables) {\n for (const d of disposables) {\n if (isDisposable(d)) {\n d.dispose();\n }\n }\n return [];\n}\n/**\n * Combine multiple disposable values into a single {@link IDisposable}.\n */\nfunction combinedDisposable(...disposables) {\n const parent = toDisposable(() => dispose(disposables));\n setParentOfDisposables(disposables, parent);\n return parent;\n}\n/**\n * Turn a function that implements dispose into an {@link IDisposable}.\n *\n * @param fn Clean up function, guaranteed to be called only **once**.\n */\nfunction toDisposable(fn) {\n const self = trackDisposable({\n dispose: (0, functional_1.createSingleCallFunction)(() => {\n markAsDisposed(self);\n fn();\n })\n });\n return self;\n}\n/**\n * Manages a collection of disposable values.\n *\n * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an\n * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a\n * store that has already been disposed of.\n */\nclass DisposableStore {\n static { this.DISABLE_DISPOSED_WARNING = false; }\n constructor() {\n this._toDispose = new Set();\n this._isDisposed = false;\n trackDisposable(this);\n }\n /**\n * Dispose of all registered disposables and mark this object as disposed.\n *\n * Any future disposables added to this object will be disposed of on `add`.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n markAsDisposed(this);\n this._isDisposed = true;\n this.clear();\n }\n /**\n * @return `true` if this object has been disposed of.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of all registered disposables but do not mark this object as disposed.\n */\n clear() {\n if (this._toDispose.size === 0) {\n return;\n }\n try {\n dispose(this._toDispose);\n }\n finally {\n this._toDispose.clear();\n }\n }\n /**\n * Add a new {@link IDisposable disposable} to the collection.\n */\n add(o) {\n if (!o) {\n return o;\n }\n if (o === this) {\n throw new Error('Cannot register a disposable on itself!');\n }\n setParentOfDisposable(o, this);\n if (this._isDisposed) {\n if (!DisposableStore.DISABLE_DISPOSED_WARNING) {\n console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\n }\n }\n else {\n this._toDispose.add(o);\n }\n return o;\n }\n /**\n * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the\n * disposable even when the disposable is not part in the store.\n */\n delete(o) {\n if (!o) {\n return;\n }\n if (o === this) {\n throw new Error('Cannot dispose a disposable on itself!');\n }\n this._toDispose.delete(o);\n o.dispose();\n }\n /**\n * Deletes the value from the store, but does not dispose it.\n */\n deleteAndLeak(o) {\n if (!o) {\n return;\n }\n if (this._toDispose.has(o)) {\n this._toDispose.delete(o);\n setParentOfDisposable(o, null);\n }\n }\n}\nexports.DisposableStore = DisposableStore;\n/**\n * Abstract base class for a {@link IDisposable disposable} object.\n *\n * Subclasses can {@linkcode _register} disposables that will be automatically cleaned up when this object is disposed of.\n */\nclass Disposable {\n /**\n * A disposable that does nothing when it is disposed of.\n *\n * TODO: This should not be a static property.\n */\n static { this.None = Object.freeze({ dispose() { } }); }\n constructor() {\n this._store = new DisposableStore();\n trackDisposable(this);\n setParentOfDisposable(this._store, this);\n }\n dispose() {\n markAsDisposed(this);\n this._store.dispose();\n }\n /**\n * Adds `o` to the collection of disposables managed by this object.\n */\n _register(o) {\n if (o === this) {\n throw new Error('Cannot register a disposable on itself!');\n }\n return this._store.add(o);\n }\n}\nexports.Disposable = Disposable;\n/**\n * Manages the lifecycle of a disposable value that may be changed.\n *\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\n */\nclass MutableDisposable {\n constructor() {\n this._isDisposed = false;\n trackDisposable(this);\n }\n get value() {\n return this._isDisposed ? undefined : this._value;\n }\n set value(value) {\n if (this._isDisposed || value === this._value) {\n return;\n }\n this._value?.dispose();\n if (value) {\n setParentOfDisposable(value, this);\n }\n this._value = value;\n }\n /**\n * Resets the stored value and disposed of the previously stored value.\n */\n clear() {\n this.value = undefined;\n }\n dispose() {\n this._isDisposed = true;\n markAsDisposed(this);\n this._value?.dispose();\n this._value = undefined;\n }\n /**\n * Clears the value, but does not dispose it.\n * The old value is returned.\n */\n clearAndLeak() {\n const oldValue = this._value;\n this._value = undefined;\n if (oldValue) {\n setParentOfDisposable(oldValue, null);\n }\n return oldValue;\n }\n}\nexports.MutableDisposable = MutableDisposable;\n/**\n * Manages the lifecycle of a disposable value that may be changed like {@link MutableDisposable}, but the value must\n * exist and cannot be undefined.\n */\nclass MandatoryMutableDisposable {\n constructor(initialValue) {\n this._disposable = new MutableDisposable();\n this._isDisposed = false;\n this._disposable.value = initialValue;\n }\n get value() {\n return this._disposable.value;\n }\n set value(value) {\n if (this._isDisposed || value === this._disposable.value) {\n return;\n }\n this._disposable.value = value;\n }\n dispose() {\n this._isDisposed = true;\n this._disposable.dispose();\n }\n}\nexports.MandatoryMutableDisposable = MandatoryMutableDisposable;\nclass RefCountedDisposable {\n constructor(_disposable) {\n this._disposable = _disposable;\n this._counter = 1;\n }\n acquire() {\n this._counter++;\n return this;\n }\n release() {\n if (--this._counter === 0) {\n this._disposable.dispose();\n }\n return this;\n }\n}\nexports.RefCountedDisposable = RefCountedDisposable;\n/**\n * A safe disposable can be `unset` so that a leaked reference (listener)\n * can be cut-off.\n */\nclass SafeDisposable {\n constructor() {\n this.dispose = () => { };\n this.unset = () => { };\n this.isset = () => false;\n trackDisposable(this);\n }\n set(fn) {\n let callback = fn;\n this.unset = () => callback = undefined;\n this.isset = () => callback !== undefined;\n this.dispose = () => {\n if (callback) {\n callback();\n callback = undefined;\n markAsDisposed(this);\n }\n };\n return this;\n }\n}\nexports.SafeDisposable = SafeDisposable;\nclass ReferenceCollection {\n constructor() {\n this.references = new Map();\n }\n acquire(key, ...args) {\n let reference = this.references.get(key);\n if (!reference) {\n reference = { counter: 0, object: this.createReferencedObject(key, ...args) };\n this.references.set(key, reference);\n }\n const { object } = reference;\n const dispose = (0, functional_1.createSingleCallFunction)(() => {\n if (--reference.counter === 0) {\n this.destroyReferencedObject(key, reference.object);\n this.references.delete(key);\n }\n });\n reference.counter++;\n return { object, dispose };\n }\n}\nexports.ReferenceCollection = ReferenceCollection;\n/**\n * Unwraps a reference collection of promised values. Makes sure\n * references are disposed whenever promises get rejected.\n */\nclass AsyncReferenceCollection {\n constructor(referenceCollection) {\n this.referenceCollection = referenceCollection;\n }\n async acquire(key, ...args) {\n const ref = this.referenceCollection.acquire(key, ...args);\n try {\n const object = await ref.object;\n return {\n object,\n dispose: () => ref.dispose()\n };\n }\n catch (error) {\n ref.dispose();\n throw error;\n }\n }\n}\nexports.AsyncReferenceCollection = AsyncReferenceCollection;\nclass ImmortalReference {\n constructor(object) {\n this.object = object;\n }\n dispose() { }\n}\nexports.ImmortalReference = ImmortalReference;\nfunction disposeOnReturn(fn) {\n const store = new DisposableStore();\n try {\n fn(store);\n }\n finally {\n store.dispose();\n }\n}\n/**\n * A map the manages the lifecycle of the values that it stores.\n */\nclass DisposableMap {\n constructor() {\n this._store = new Map();\n this._isDisposed = false;\n trackDisposable(this);\n }\n /**\n * Disposes of all stored values and mark this object as disposed.\n *\n * Trying to use this object after it has been disposed of is an error.\n */\n dispose() {\n markAsDisposed(this);\n this._isDisposed = true;\n this.clearAndDisposeAll();\n }\n /**\n * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.\n */\n clearAndDisposeAll() {\n if (!this._store.size) {\n return;\n }\n try {\n dispose(this._store.values());\n }\n finally {\n this._store.clear();\n }\n }\n has(key) {\n return this._store.has(key);\n }\n get size() {\n return this._store.size;\n }\n get(key) {\n return this._store.get(key);\n }\n set(key, value, skipDisposeOnOverwrite = false) {\n if (this._isDisposed) {\n console.warn(new Error('Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!').stack);\n }\n if (!skipDisposeOnOverwrite) {\n this._store.get(key)?.dispose();\n }\n this._store.set(key, value);\n }\n /**\n * Delete the value stored for `key` from this map and also dispose of it.\n */\n deleteAndDispose(key) {\n this._store.get(key)?.dispose();\n this._store.delete(key);\n }\n /**\n * Delete the value stored for `key` from this map but return it. The caller is\n * responsible for disposing of the value.\n */\n deleteAndLeak(key) {\n const value = this._store.get(key);\n this._store.delete(key);\n return value;\n }\n keys() {\n return this._store.keys();\n }\n values() {\n return this._store.values();\n }\n [Symbol.iterator]() {\n return this._store[Symbol.iterator]();\n }\n}\nexports.DisposableMap = DisposableMap;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LinkedList = void 0;\nclass Node {\n static { this.Undefined = new Node(undefined); }\n constructor(element) {\n this.element = element;\n this.next = Node.Undefined;\n this.prev = Node.Undefined;\n }\n}\nclass LinkedList {\n constructor() {\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n get size() {\n return this._size;\n }\n isEmpty() {\n return this._first === Node.Undefined;\n }\n clear() {\n let node = this._first;\n while (node !== Node.Undefined) {\n const next = node.next;\n node.prev = Node.Undefined;\n node.next = Node.Undefined;\n node = next;\n }\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n this._size = 0;\n }\n unshift(element) {\n return this._insert(element, false);\n }\n push(element) {\n return this._insert(element, true);\n }\n _insert(element, atTheEnd) {\n const newNode = new Node(element);\n if (this._first === Node.Undefined) {\n this._first = newNode;\n this._last = newNode;\n }\n else if (atTheEnd) {\n // push\n const oldLast = this._last;\n this._last = newNode;\n newNode.prev = oldLast;\n oldLast.next = newNode;\n }\n else {\n // unshift\n const oldFirst = this._first;\n this._first = newNode;\n newNode.next = oldFirst;\n oldFirst.prev = newNode;\n }\n this._size += 1;\n let didRemove = false;\n return () => {\n if (!didRemove) {\n didRemove = true;\n this._remove(newNode);\n }\n };\n }\n shift() {\n if (this._first === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._first.element;\n this._remove(this._first);\n return res;\n }\n }\n pop() {\n if (this._last === Node.Undefined) {\n return undefined;\n }\n else {\n const res = this._last.element;\n this._remove(this._last);\n return res;\n }\n }\n _remove(node) {\n if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n // middle\n const anchor = node.prev;\n anchor.next = node.next;\n node.next.prev = anchor;\n }\n else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n // only node\n this._first = Node.Undefined;\n this._last = Node.Undefined;\n }\n else if (node.next === Node.Undefined) {\n // last\n this._last = this._last.prev;\n this._last.next = Node.Undefined;\n }\n else if (node.prev === Node.Undefined) {\n // first\n this._first = this._first.next;\n this._first.prev = Node.Undefined;\n }\n // done\n this._size -= 1;\n }\n *[Symbol.iterator]() {\n let node = this._first;\n while (node !== Node.Undefined) {\n yield node.element;\n node = node.next;\n }\n }\n}\nexports.LinkedList = LinkedList;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SetMap = exports.BidirectionalMap = exports.CounterSet = exports.Touch = void 0;\nexports.getOrSet = getOrSet;\nexports.mapToString = mapToString;\nexports.setToString = setToString;\nexports.mapsStrictEqualIgnoreOrder = mapsStrictEqualIgnoreOrder;\nfunction getOrSet(map, key, value) {\n let result = map.get(key);\n if (result === undefined) {\n result = value;\n map.set(key, result);\n }\n return result;\n}\nfunction mapToString(map) {\n const entries = [];\n map.forEach((value, key) => {\n entries.push(`${key} => ${value}`);\n });\n return `Map(${map.size}) {${entries.join(', ')}}`;\n}\nfunction setToString(set) {\n const entries = [];\n set.forEach(value => {\n entries.push(value);\n });\n return `Set(${set.size}) {${entries.join(', ')}}`;\n}\nvar Touch;\n(function (Touch) {\n Touch[Touch[\"None\"] = 0] = \"None\";\n Touch[Touch[\"AsOld\"] = 1] = \"AsOld\";\n Touch[Touch[\"AsNew\"] = 2] = \"AsNew\";\n})(Touch || (exports.Touch = Touch = {}));\nclass CounterSet {\n constructor() {\n this.map = new Map();\n }\n add(value) {\n this.map.set(value, (this.map.get(value) || 0) + 1);\n return this;\n }\n delete(value) {\n let counter = this.map.get(value) || 0;\n if (counter === 0) {\n return false;\n }\n counter--;\n if (counter === 0) {\n this.map.delete(value);\n }\n else {\n this.map.set(value, counter);\n }\n return true;\n }\n has(value) {\n return this.map.has(value);\n }\n}\nexports.CounterSet = CounterSet;\n/**\n * A map that allows access both by keys and values.\n * **NOTE**: values need to be unique.\n */\nclass BidirectionalMap {\n constructor(entries) {\n this._m1 = new Map();\n this._m2 = new Map();\n if (entries) {\n for (const [key, value] of entries) {\n this.set(key, value);\n }\n }\n }\n clear() {\n this._m1.clear();\n this._m2.clear();\n }\n set(key, value) {\n this._m1.set(key, value);\n this._m2.set(value, key);\n }\n get(key) {\n return this._m1.get(key);\n }\n getKey(value) {\n return this._m2.get(value);\n }\n delete(key) {\n const value = this._m1.get(key);\n if (value === undefined) {\n return false;\n }\n this._m1.delete(key);\n this._m2.delete(value);\n return true;\n }\n forEach(callbackfn, thisArg) {\n this._m1.forEach((value, key) => {\n callbackfn.call(thisArg, value, key, this);\n });\n }\n keys() {\n return this._m1.keys();\n }\n values() {\n return this._m1.values();\n }\n}\nexports.BidirectionalMap = BidirectionalMap;\nclass SetMap {\n constructor() {\n this.map = new Map();\n }\n add(key, value) {\n let values = this.map.get(key);\n if (!values) {\n values = new Set();\n this.map.set(key, values);\n }\n values.add(value);\n }\n delete(key, value) {\n const values = this.map.get(key);\n if (!values) {\n return;\n }\n values.delete(value);\n if (values.size === 0) {\n this.map.delete(key);\n }\n }\n forEach(key, fn) {\n const values = this.map.get(key);\n if (!values) {\n return;\n }\n values.forEach(fn);\n }\n get(key) {\n const values = this.map.get(key);\n if (!values) {\n return new Set();\n }\n return values;\n }\n}\nexports.SetMap = SetMap;\nfunction mapsStrictEqualIgnoreOrder(a, b) {\n if (a === b) {\n return true;\n }\n if (a.size !== b.size) {\n return false;\n }\n for (const [key, value] of a) {\n if (!b.has(key) || b.get(key) !== value) {\n return false;\n }\n }\n for (const [key] of b) {\n if (!a.has(key)) {\n return false;\n }\n }\n return true;\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SlidingWindowAverage = exports.MovingAverage = exports.Counter = void 0;\nexports.clamp = clamp;\nexports.rot = rot;\nexports.isPointWithinTriangle = isPointWithinTriangle;\nfunction clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\nfunction rot(index, modulo) {\n return (modulo + (index % modulo)) % modulo;\n}\nclass Counter {\n constructor() {\n this._next = 0;\n }\n getNext() {\n return this._next++;\n }\n}\nexports.Counter = Counter;\nclass MovingAverage {\n constructor() {\n this._n = 1;\n this._val = 0;\n }\n update(value) {\n this._val = this._val + (value - this._val) / this._n;\n this._n += 1;\n return this._val;\n }\n get value() {\n return this._val;\n }\n}\nexports.MovingAverage = MovingAverage;\nclass SlidingWindowAverage {\n constructor(size) {\n this._n = 0;\n this._val = 0;\n this._values = [];\n this._index = 0;\n this._sum = 0;\n this._values = new Array(size);\n this._values.fill(0, 0, size);\n }\n update(value) {\n const oldValue = this._values[this._index];\n this._values[this._index] = value;\n this._index = (this._index + 1) % this._values.length;\n this._sum -= oldValue;\n this._sum += value;\n if (this._n < this._values.length) {\n this._n += 1;\n }\n this._val = this._sum / this._n;\n return this._val;\n }\n get value() {\n return this._val;\n }\n}\nexports.SlidingWindowAverage = SlidingWindowAverage;\n/** Returns whether the point is within the triangle formed by the following 6 x/y point pairs */\nfunction isPointWithinTriangle(x, y, ax, ay, bx, by, cx, cy) {\n const v0x = cx - ax;\n const v0y = cy - ay;\n const v1x = bx - ax;\n const v1y = by - ay;\n const v2x = x - ax;\n const v2y = y - ay;\n const dot00 = v0x * v0x + v0y * v0y;\n const dot01 = v0x * v1x + v0y * v1y;\n const dot02 = v0x * v2x + v0y * v2y;\n const dot11 = v1x * v1x + v1y * v1y;\n const dot12 = v1x * v2x + v1y * v2y;\n const invDenom = 1 / (dot00 * dot11 - dot01 * dot01);\n const u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n const v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n return u >= 0 && v >= 0 && u + v < 1;\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAndroid = exports.isEdge = exports.isSafari = exports.isFirefox = exports.isChrome = exports.OS = exports.OperatingSystem = exports.setTimeout0 = exports.setTimeout0IsFaster = exports.translationsConfigFile = exports.platformLocale = exports.locale = exports.Language = exports.language = exports.userAgent = exports.platform = exports.isCI = exports.isMobile = exports.isIOS = exports.webWorkerOrigin = exports.isWebWorker = exports.isWeb = exports.isElectron = exports.isNative = exports.isLinuxSnap = exports.isLinux = exports.isMacintosh = exports.isWindows = exports.Platform = exports.LANGUAGE_DEFAULT = void 0;\nexports.PlatformToString = PlatformToString;\nexports.isLittleEndian = isLittleEndian;\nexports.isBigSurOrNewer = isBigSurOrNewer;\nexports.LANGUAGE_DEFAULT = 'en';\nlet _isWindows = false;\nlet _isMacintosh = false;\nlet _isLinux = false;\nlet _isLinuxSnap = false;\nlet _isNative = false;\nlet _isWeb = false;\nlet _isElectron = false;\nlet _isIOS = false;\nlet _isCI = false;\nlet _isMobile = false;\nlet _locale = undefined;\nlet _language = exports.LANGUAGE_DEFAULT;\nlet _platformLocale = exports.LANGUAGE_DEFAULT;\nlet _translationsConfigFile = undefined;\nlet _userAgent = undefined;\nconst $globalThis = globalThis;\nlet nodeProcess = undefined;\nif (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {\n // Native environment (sandboxed)\n nodeProcess = $globalThis.vscode.process;\n}\nelse if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') {\n // Native environment (non-sandboxed)\n nodeProcess = process;\n}\nconst isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';\nconst isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';\n// Native environment\nif (typeof nodeProcess === 'object') {\n _isWindows = (nodeProcess.platform === 'win32');\n _isMacintosh = (nodeProcess.platform === 'darwin');\n _isLinux = (nodeProcess.platform === 'linux');\n _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\n _isElectron = isElectronProcess;\n _isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];\n _locale = exports.LANGUAGE_DEFAULT;\n _language = exports.LANGUAGE_DEFAULT;\n const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\n if (rawNlsConfig) {\n try {\n const nlsConfig = JSON.parse(rawNlsConfig);\n _locale = nlsConfig.userLocale;\n _platformLocale = nlsConfig.osLocale;\n _language = nlsConfig.resolvedLanguage || exports.LANGUAGE_DEFAULT;\n _translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;\n }\n catch (e) {\n }\n }\n _isNative = true;\n}\n// Web environment\nelse if (typeof navigator === 'object' && !isElectronRenderer) {\n _userAgent = navigator.userAgent;\n _isWindows = _userAgent.indexOf('Windows') >= 0;\n _isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\n _isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\n _isLinux = _userAgent.indexOf('Linux') >= 0;\n _isMobile = _userAgent?.indexOf('Mobi') >= 0;\n _isWeb = true;\n // VSCODE_GLOBALS: NLS\n _language = globalThis._VSCODE_NLS_LANGUAGE || exports.LANGUAGE_DEFAULT;\n _locale = navigator.language.toLowerCase();\n _platformLocale = _locale;\n}\n// Unknown environment\nelse {\n console.error('Unable to resolve platform.');\n}\nvar Platform;\n(function (Platform) {\n Platform[Platform[\"Web\"] = 0] = \"Web\";\n Platform[Platform[\"Mac\"] = 1] = \"Mac\";\n Platform[Platform[\"Linux\"] = 2] = \"Linux\";\n Platform[Platform[\"Windows\"] = 3] = \"Windows\";\n})(Platform || (exports.Platform = Platform = {}));\nfunction PlatformToString(platform) {\n switch (platform) {\n case Platform.Web: return 'Web';\n case Platform.Mac: return 'Mac';\n case Platform.Linux: return 'Linux';\n case Platform.Windows: return 'Windows';\n }\n}\nlet _platform = Platform.Web;\nif (_isMacintosh) {\n _platform = Platform.Mac;\n}\nelse if (_isWindows) {\n _platform = Platform.Windows;\n}\nelse if (_isLinux) {\n _platform = Platform.Linux;\n}\nexports.isWindows = _isWindows;\nexports.isMacintosh = _isMacintosh;\nexports.isLinux = _isLinux;\nexports.isLinuxSnap = _isLinuxSnap;\nexports.isNative = _isNative;\nexports.isElectron = _isElectron;\nexports.isWeb = _isWeb;\nexports.isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function');\nexports.webWorkerOrigin = exports.isWebWorker ? $globalThis.origin : undefined;\nexports.isIOS = _isIOS;\nexports.isMobile = _isMobile;\n/**\n * Whether we run inside a CI environment, such as\n * GH actions or Azure Pipelines.\n */\nexports.isCI = _isCI;\nexports.platform = _platform;\nexports.userAgent = _userAgent;\n/**\n * The language used for the user interface. The format of\n * the string is all lower case (e.g. zh-tw for Traditional\n * Chinese or de for German)\n */\nexports.language = _language;\nvar Language;\n(function (Language) {\n function value() {\n return exports.language;\n }\n Language.value = value;\n function isDefaultVariant() {\n if (exports.language.length === 2) {\n return exports.language === 'en';\n }\n else if (exports.language.length >= 3) {\n return exports.language[0] === 'e' && exports.language[1] === 'n' && exports.language[2] === '-';\n }\n else {\n return false;\n }\n }\n Language.isDefaultVariant = isDefaultVariant;\n function isDefault() {\n return exports.language === 'en';\n }\n Language.isDefault = isDefault;\n})(Language || (exports.Language = Language = {}));\n/**\n * Desktop: The OS locale or the locale specified by --locale or `argv.json`.\n * Web: matches `platformLocale`.\n *\n * The UI is not necessarily shown in the provided locale.\n */\nexports.locale = _locale;\n/**\n * This will always be set to the OS/browser's locale regardless of\n * what was specified otherwise. The format of the string is all\n * lower case (e.g. zh-tw for Traditional Chinese). The UI is not\n * necessarily shown in the provided locale.\n */\nexports.platformLocale = _platformLocale;\n/**\n * The translations that are available through language packs.\n */\nexports.translationsConfigFile = _translationsConfigFile;\nexports.setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);\n/**\n * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.\n *\n * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay\n * that browsers set when the nesting level is > 5.\n */\nexports.setTimeout0 = (() => {\n if (exports.setTimeout0IsFaster) {\n const pending = [];\n $globalThis.addEventListener('message', (e) => {\n if (e.data && e.data.vscodeScheduleAsyncWork) {\n for (let i = 0, len = pending.length; i < len; i++) {\n const candidate = pending[i];\n if (candidate.id === e.data.vscodeScheduleAsyncWork) {\n pending.splice(i, 1);\n candidate.callback();\n return;\n }\n }\n }\n });\n let lastId = 0;\n return (callback) => {\n const myId = ++lastId;\n pending.push({\n id: myId,\n callback: callback\n });\n $globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');\n };\n }\n return (callback) => setTimeout(callback);\n})();\nvar OperatingSystem;\n(function (OperatingSystem) {\n OperatingSystem[OperatingSystem[\"Windows\"] = 1] = \"Windows\";\n OperatingSystem[OperatingSystem[\"Macintosh\"] = 2] = \"Macintosh\";\n OperatingSystem[OperatingSystem[\"Linux\"] = 3] = \"Linux\";\n})(OperatingSystem || (exports.OperatingSystem = OperatingSystem = {}));\nexports.OS = (_isMacintosh || _isIOS ? OperatingSystem.Macintosh : (_isWindows ? OperatingSystem.Windows : OperatingSystem.Linux));\nlet _isLittleEndian = true;\nlet _isLittleEndianComputed = false;\nfunction isLittleEndian() {\n if (!_isLittleEndianComputed) {\n _isLittleEndianComputed = true;\n const test = new Uint8Array(2);\n test[0] = 1;\n test[1] = 2;\n const view = new Uint16Array(test.buffer);\n _isLittleEndian = (view[0] === (2 << 8) + 1);\n }\n return _isLittleEndian;\n}\nexports.isChrome = !!(exports.userAgent && exports.userAgent.indexOf('Chrome') >= 0);\nexports.isFirefox = !!(exports.userAgent && exports.userAgent.indexOf('Firefox') >= 0);\nexports.isSafari = !!(!exports.isChrome && (exports.userAgent && exports.userAgent.indexOf('Safari') >= 0));\nexports.isEdge = !!(exports.userAgent && exports.userAgent.indexOf('Edg/') >= 0);\nexports.isAndroid = !!(exports.userAgent && exports.userAgent.indexOf('Android') >= 0);\nfunction isBigSurOrNewer(osVersion) {\n return parseFloat(osVersion) >= 20;\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SmoothScrollingOperation = exports.SmoothScrollingUpdate = exports.Scrollable = exports.ScrollState = exports.ScrollbarVisibility = void 0;\nconst event_1 = require(\"vs/base/common/event\");\nconst lifecycle_1 = require(\"vs/base/common/lifecycle\");\nvar ScrollbarVisibility;\n(function (ScrollbarVisibility) {\n ScrollbarVisibility[ScrollbarVisibility[\"Auto\"] = 1] = \"Auto\";\n ScrollbarVisibility[ScrollbarVisibility[\"Hidden\"] = 2] = \"Hidden\";\n ScrollbarVisibility[ScrollbarVisibility[\"Visible\"] = 3] = \"Visible\";\n})(ScrollbarVisibility || (exports.ScrollbarVisibility = ScrollbarVisibility = {}));\nclass ScrollState {\n constructor(_forceIntegerValues, width, scrollWidth, scrollLeft, height, scrollHeight, scrollTop) {\n this._forceIntegerValues = _forceIntegerValues;\n this._scrollStateBrand = undefined;\n if (this._forceIntegerValues) {\n width = width | 0;\n scrollWidth = scrollWidth | 0;\n scrollLeft = scrollLeft | 0;\n height = height | 0;\n scrollHeight = scrollHeight | 0;\n scrollTop = scrollTop | 0;\n }\n this.rawScrollLeft = scrollLeft; // before validation\n this.rawScrollTop = scrollTop; // before validation\n if (width < 0) {\n width = 0;\n }\n if (scrollLeft + width > scrollWidth) {\n scrollLeft = scrollWidth - width;\n }\n if (scrollLeft < 0) {\n scrollLeft = 0;\n }\n if (height < 0) {\n height = 0;\n }\n if (scrollTop + height > scrollHeight) {\n scrollTop = scrollHeight - height;\n }\n if (scrollTop < 0) {\n scrollTop = 0;\n }\n this.width = width;\n this.scrollWidth = scrollWidth;\n this.scrollLeft = scrollLeft;\n this.height = height;\n this.scrollHeight = scrollHeight;\n this.scrollTop = scrollTop;\n }\n equals(other) {\n return (this.rawScrollLeft === other.rawScrollLeft\n && this.rawScrollTop === other.rawScrollTop\n && this.width === other.width\n && this.scrollWidth === other.scrollWidth\n && this.scrollLeft === other.scrollLeft\n && this.height === other.height\n && this.scrollHeight === other.scrollHeight\n && this.scrollTop === other.scrollTop);\n }\n withScrollDimensions(update, useRawScrollPositions) {\n return new ScrollState(this._forceIntegerValues, (typeof update.width !== 'undefined' ? update.width : this.width), (typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth), useRawScrollPositions ? this.rawScrollLeft : this.scrollLeft, (typeof update.height !== 'undefined' ? update.height : this.height), (typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight), useRawScrollPositions ? this.rawScrollTop : this.scrollTop);\n }\n withScrollPosition(update) {\n return new ScrollState(this._forceIntegerValues, this.width, this.scrollWidth, (typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft), this.height, this.scrollHeight, (typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop));\n }\n createScrollEvent(previous, inSmoothScrolling) {\n const widthChanged = (this.width !== previous.width);\n const scrollWidthChanged = (this.scrollWidth !== previous.scrollWidth);\n const scrollLeftChanged = (this.scrollLeft !== previous.scrollLeft);\n const heightChanged = (this.height !== previous.height);\n const scrollHeightChanged = (this.scrollHeight !== previous.scrollHeight);\n const scrollTopChanged = (this.scrollTop !== previous.scrollTop);\n return {\n inSmoothScrolling: inSmoothScrolling,\n oldWidth: previous.width,\n oldScrollWidth: previous.scrollWidth,\n oldScrollLeft: previous.scrollLeft,\n width: this.width,\n scrollWidth: this.scrollWidth,\n scrollLeft: this.scrollLeft,\n oldHeight: previous.height,\n oldScrollHeight: previous.scrollHeight,\n oldScrollTop: previous.scrollTop,\n height: this.height,\n scrollHeight: this.scrollHeight,\n scrollTop: this.scrollTop,\n widthChanged: widthChanged,\n scrollWidthChanged: scrollWidthChanged,\n scrollLeftChanged: scrollLeftChanged,\n heightChanged: heightChanged,\n scrollHeightChanged: scrollHeightChanged,\n scrollTopChanged: scrollTopChanged,\n };\n }\n}\nexports.ScrollState = ScrollState;\nclass Scrollable extends lifecycle_1.Disposable {\n constructor(options) {\n super();\n this._scrollableBrand = undefined;\n this._onScroll = this._register(new event_1.Emitter());\n this.onScroll = this._onScroll.event;\n this._smoothScrollDuration = options.smoothScrollDuration;\n this._scheduleAtNextAnimationFrame = options.scheduleAtNextAnimationFrame;\n this._state = new ScrollState(options.forceIntegerValues, 0, 0, 0, 0, 0, 0);\n this._smoothScrolling = null;\n }\n dispose() {\n if (this._smoothScrolling) {\n this._smoothScrolling.dispose();\n this._smoothScrolling = null;\n }\n super.dispose();\n }\n setSmoothScrollDuration(smoothScrollDuration) {\n this._smoothScrollDuration = smoothScrollDuration;\n }\n validateScrollPosition(scrollPosition) {\n return this._state.withScrollPosition(scrollPosition);\n }\n getScrollDimensions() {\n return this._state;\n }\n setScrollDimensions(dimensions, useRawScrollPositions) {\n const newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);\n this._setState(newState, Boolean(this._smoothScrolling));\n // Validate outstanding animated scroll position target\n this._smoothScrolling?.acceptScrollDimensions(this._state);\n }\n /**\n * Returns the final scroll position that the instance will have once the smooth scroll animation concludes.\n * If no scroll animation is occurring, it will return the current scroll position instead.\n */\n getFutureScrollPosition() {\n if (this._smoothScrolling) {\n return this._smoothScrolling.to;\n }\n return this._state;\n }\n /**\n * Returns the current scroll position.\n * Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.\n */\n getCurrentScrollPosition() {\n return this._state;\n }\n setScrollPositionNow(update) {\n // no smooth scrolling requested\n const newState = this._state.withScrollPosition(update);\n // Terminate any outstanding smooth scrolling\n if (this._smoothScrolling) {\n this._smoothScrolling.dispose();\n this._smoothScrolling = null;\n }\n this._setState(newState, false);\n }\n setScrollPositionSmooth(update, reuseAnimation) {\n if (this._smoothScrollDuration === 0) {\n // Smooth scrolling not supported.\n return this.setScrollPositionNow(update);\n }\n if (this._smoothScrolling) {\n // Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop\n update = {\n scrollLeft: (typeof update.scrollLeft === 'undefined' ? this._smoothScrolling.to.scrollLeft : update.scrollLeft),\n scrollTop: (typeof update.scrollTop === 'undefined' ? this._smoothScrolling.to.scrollTop : update.scrollTop)\n };\n // Validate `update`\n const validTarget = this._state.withScrollPosition(update);\n if (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) {\n // No need to interrupt or extend the current animation since we're going to the same place\n return;\n }\n let newSmoothScrolling;\n if (reuseAnimation) {\n newSmoothScrolling = new SmoothScrollingOperation(this._smoothScrolling.from, validTarget, this._smoothScrolling.startTime, this._smoothScrolling.duration);\n }\n else {\n newSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration);\n }\n this._smoothScrolling.dispose();\n this._smoothScrolling = newSmoothScrolling;\n }\n else {\n // Validate `update`\n const validTarget = this._state.withScrollPosition(update);\n this._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration);\n }\n // Begin smooth scrolling animation\n this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n if (!this._smoothScrolling) {\n return;\n }\n this._smoothScrolling.animationFrameDisposable = null;\n this._performSmoothScrolling();\n });\n }\n hasPendingScrollAnimation() {\n return Boolean(this._smoothScrolling);\n }\n _performSmoothScrolling() {\n if (!this._smoothScrolling) {\n return;\n }\n const update = this._smoothScrolling.tick();\n const newState = this._state.withScrollPosition(update);\n this._setState(newState, true);\n if (!this._smoothScrolling) {\n // Looks like someone canceled the smooth scrolling\n // from the scroll event handler\n return;\n }\n if (update.isDone) {\n this._smoothScrolling.dispose();\n this._smoothScrolling = null;\n return;\n }\n // Continue smooth scrolling animation\n this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n if (!this._smoothScrolling) {\n return;\n }\n this._smoothScrolling.animationFrameDisposable = null;\n this._performSmoothScrolling();\n });\n }\n _setState(newState, inSmoothScrolling) {\n const oldState = this._state;\n if (oldState.equals(newState)) {\n // no change\n return;\n }\n this._state = newState;\n this._onScroll.fire(this._state.createScrollEvent(oldState, inSmoothScrolling));\n }\n}\nexports.Scrollable = Scrollable;\nclass SmoothScrollingUpdate {\n constructor(scrollLeft, scrollTop, isDone) {\n this.scrollLeft = scrollLeft;\n this.scrollTop = scrollTop;\n this.isDone = isDone;\n }\n}\nexports.SmoothScrollingUpdate = SmoothScrollingUpdate;\nfunction createEaseOutCubic(from, to) {\n const delta = to - from;\n return function (completion) {\n return from + delta * easeOutCubic(completion);\n };\n}\nfunction createComposed(a, b, cut) {\n return function (completion) {\n if (completion < cut) {\n return a(completion / cut);\n }\n return b((completion - cut) / (1 - cut));\n };\n}\nclass SmoothScrollingOperation {\n constructor(from, to, startTime, duration) {\n this.from = from;\n this.to = to;\n this.duration = duration;\n this.startTime = startTime;\n this.animationFrameDisposable = null;\n this._initAnimations();\n }\n _initAnimations() {\n this.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);\n this.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);\n }\n _initAnimation(from, to, viewportSize) {\n const delta = Math.abs(from - to);\n if (delta > 2.5 * viewportSize) {\n let stop1, stop2;\n if (from < to) {\n // scroll to 75% of the viewportSize\n stop1 = from + 0.75 * viewportSize;\n stop2 = to - 0.75 * viewportSize;\n }\n else {\n stop1 = from - 0.75 * viewportSize;\n stop2 = to + 0.75 * viewportSize;\n }\n return createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);\n }\n return createEaseOutCubic(from, to);\n }\n dispose() {\n if (this.animationFrameDisposable !== null) {\n this.animationFrameDisposable.dispose();\n this.animationFrameDisposable = null;\n }\n }\n acceptScrollDimensions(state) {\n this.to = state.withScrollPosition(this.to);\n this._initAnimations();\n }\n tick() {\n return this._tick(Date.now());\n }\n _tick(now) {\n const completion = (now - this.startTime) / this.duration;\n if (completion < 1) {\n const newScrollLeft = this.scrollLeft(completion);\n const newScrollTop = this.scrollTop(completion);\n return new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);\n }\n return new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);\n }\n combine(from, to, duration) {\n return SmoothScrollingOperation.start(from, to, duration);\n }\n static start(from, to, duration) {\n // +10 / -10 : pretend the animation already started for a quicker response to a scroll request\n duration = duration + 10;\n const startTime = Date.now() - 10;\n return new SmoothScrollingOperation(from, to, startTime, duration);\n }\n}\nexports.SmoothScrollingOperation = SmoothScrollingOperation;\nfunction easeInCubic(t) {\n return Math.pow(t, 3);\n}\nfunction easeOutCubic(t) {\n return 1 - easeInCubic(1 - t);\n}\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StopWatch = void 0;\nconst hasPerformanceNow = (globalThis.performance && typeof globalThis.performance.now === 'function');\nclass StopWatch {\n static create(highResolution) {\n return new StopWatch(highResolution);\n }\n constructor(highResolution) {\n this._now = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance.now.bind(globalThis.performance);\n this._startTime = this._now();\n this._stopTime = -1;\n }\n stop() {\n this._stopTime = this._now();\n }\n reset() {\n this._startTime = this._now();\n this._stopTime = -1;\n }\n elapsed() {\n if (this._stopTime !== -1) {\n return this._stopTime - this._startTime;\n }\n return this._now() - this._startTime;\n }\n}\nexports.StopWatch = StopWatch;\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.noBreakWhitespace = exports.CodePointIterator = void 0;\nexports.isFalsyOrWhitespace = isFalsyOrWhitespace;\nexports.format = format;\nexports.format2 = format2;\nexports.htmlAttributeEncodeValue = htmlAttributeEncodeValue;\nexports.escape = escape;\nexports.escapeRegExpCharacters = escapeRegExpCharacters;\nexports.count = count;\nexports.truncate = truncate;\nexports.truncateMiddle = truncateMiddle;\nexports.trim = trim;\nexports.ltrim = ltrim;\nexports.rtrim = rtrim;\nexports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;\nexports.stripWildcards = stripWildcards;\nexports.createRegExp = createRegExp;\nexports.regExpLeadsToEndlessLoop = regExpLeadsToEndlessLoop;\nexports.splitLines = splitLines;\nexports.splitLinesIncludeSeparators = splitLinesIncludeSeparators;\nexports.firstNonWhitespaceIndex = firstNonWhitespaceIndex;\nexports.getLeadingWhitespace = getLeadingWhitespace;\nexports.lastNonWhitespaceIndex = lastNonWhitespaceIndex;\nexports.replaceAsync = replaceAsync;\nexports.compare = compare;\nexports.compareSubstring = compareSubstring;\nexports.compareIgnoreCase = compareIgnoreCase;\nexports.compareSubstringIgnoreCase = compareSubstringIgnoreCase;\nexports.isAsciiDigit = isAsciiDigit;\nexports.isLowerAsciiLetter = isLowerAsciiLetter;\nexports.isUpperAsciiLetter = isUpperAsciiLetter;\nexports.equalsIgnoreCase = equalsIgnoreCase;\nexports.startsWithIgnoreCase = startsWithIgnoreCase;\nexports.commonPrefixLength = commonPrefixLength;\nexports.commonSuffixLength = commonSuffixLength;\nexports.isHighSurrogate = isHighSurrogate;\nexports.isLowSurrogate = isLowSurrogate;\nexports.computeCodePoint = computeCodePoint;\nexports.getNextCodePoint = getNextCodePoint;\nconst charCode_1 = require(\"vs/base/common/charCode\");\nconst uint_1 = require(\"vs/base/common/uint\");\nfunction isFalsyOrWhitespace(str) {\n if (!str || typeof str !== 'string') {\n return true;\n }\n return str.trim().length === 0;\n}\nconst _formatRegexp = /{(\\d+)}/g;\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nfunction format(value, ...args) {\n if (args.length === 0) {\n return value;\n }\n return value.replace(_formatRegexp, function (match, group) {\n const idx = parseInt(group, 10);\n return isNaN(idx) || idx < 0 || idx >= args.length ?\n match :\n args[idx];\n });\n}\nconst _format2Regexp = /{([^}]+)}/g;\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nfunction format2(template, values) {\n if (Object.keys(values).length === 0) {\n return template;\n }\n return template.replace(_format2Regexp, (match, group) => (values[group] ?? match));\n}\n/**\n * Encodes the given value so that it can be used as literal value in html attributes.\n *\n * In other words, computes `$val`, such that `attr` in `
` has the runtime value `value`.\n * This prevents XSS injection.\n */\nfunction htmlAttributeEncodeValue(value) {\n return value.replace(/[<>\"'&]/g, ch => {\n switch (ch) {\n case '<': return '<';\n case '>': return '>';\n case '\"': return '"';\n case '\\'': return ''';\n case '&': return '&';\n }\n return ch;\n });\n}\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nfunction escape(html) {\n return html.replace(/[<>&]/g, function (match) {\n switch (match) {\n case '<': return '<';\n case '>': return '>';\n case '&': return '&';\n default: return match;\n }\n });\n}\n/**\n * Escapes regular expression characters in a given string\n */\nfunction escapeRegExpCharacters(value) {\n return value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\n/**\n * Counts how often `substr` occurs inside `value`.\n */\nfunction count(value, substr) {\n let result = 0;\n let index = value.indexOf(substr);\n while (index !== -1) {\n result++;\n index = value.indexOf(substr, index + substr.length);\n }\n return result;\n}\nfunction truncate(value, maxLength, suffix = '…') {\n if (value.length <= maxLength) {\n return value;\n }\n return `${value.substr(0, maxLength)}${suffix}`;\n}\nfunction truncateMiddle(value, maxLength, suffix = '…') {\n if (value.length <= maxLength) {\n return value;\n }\n const prefixLength = Math.ceil(maxLength / 2) - suffix.length / 2;\n const suffixLength = Math.floor(maxLength / 2) - suffix.length / 2;\n return `${value.substr(0, prefixLength)}${suffix}${value.substr(value.length - suffixLength)}`;\n}\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nfunction trim(haystack, needle = ' ') {\n const trimmed = ltrim(haystack, needle);\n return rtrim(trimmed, needle);\n}\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nfunction ltrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length;\n if (needleLen === 0 || haystack.length === 0) {\n return haystack;\n }\n let offset = 0;\n while (haystack.indexOf(needle, offset) === offset) {\n offset = offset + needleLen;\n }\n return haystack.substring(offset);\n}\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nfunction rtrim(haystack, needle) {\n if (!haystack || !needle) {\n return haystack;\n }\n const needleLen = needle.length, haystackLen = haystack.length;\n if (needleLen === 0 || haystackLen === 0) {\n return haystack;\n }\n let offset = haystackLen, idx = -1;\n while (true) {\n idx = haystack.lastIndexOf(needle, offset - 1);\n if (idx === -1 || idx + needleLen !== offset) {\n break;\n }\n if (idx === 0) {\n return '';\n }\n offset = idx;\n }\n return haystack.substring(0, offset);\n}\nfunction convertSimple2RegExpPattern(pattern) {\n return pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\nfunction stripWildcards(pattern) {\n return pattern.replace(/\\*/g, '');\n}\nfunction createRegExp(searchString, isRegex, options = {}) {\n if (!searchString) {\n throw new Error('Cannot create regex from empty string');\n }\n if (!isRegex) {\n searchString = escapeRegExpCharacters(searchString);\n }\n if (options.wholeWord) {\n if (!/\\B/.test(searchString.charAt(0))) {\n searchString = '\\\\b' + searchString;\n }\n if (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n searchString = searchString + '\\\\b';\n }\n }\n let modifiers = '';\n if (options.global) {\n modifiers += 'g';\n }\n if (!options.matchCase) {\n modifiers += 'i';\n }\n if (options.multiline) {\n modifiers += 'm';\n }\n if (options.unicode) {\n modifiers += 'u';\n }\n return new RegExp(searchString, modifiers);\n}\nfunction regExpLeadsToEndlessLoop(regexp) {\n // Exit early if it's one of these special cases which are meant to match\n // against an empty string\n if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n return false;\n }\n // We check against an empty string. If the regular expression doesn't advance\n // (e.g. ends in an endless loop) it will match an empty string.\n const match = regexp.exec('');\n return !!(match && regexp.lastIndex === 0);\n}\nfunction splitLines(str) {\n return str.split(/\\r\\n|\\r|\\n/);\n}\nfunction splitLinesIncludeSeparators(str) {\n const linesWithSeparators = [];\n const splitLinesAndSeparators = str.split(/(\\r\\n|\\r|\\n)/);\n for (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) {\n linesWithSeparators.push(splitLinesAndSeparators[2 * i] + (splitLinesAndSeparators[2 * i + 1] ?? ''));\n }\n return linesWithSeparators;\n}\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nfunction firstNonWhitespaceIndex(str) {\n for (let i = 0, len = str.length; i < len; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== charCode_1.CharCode.Space && chCode !== charCode_1.CharCode.Tab) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nfunction getLeadingWhitespace(str, start = 0, end = str.length) {\n for (let i = start; i < end; i++) {\n const chCode = str.charCodeAt(i);\n if (chCode !== charCode_1.CharCode.Space && chCode !== charCode_1.CharCode.Tab) {\n return str.substring(start, i);\n }\n }\n return str.substring(start, end);\n}\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nfunction lastNonWhitespaceIndex(str, startIndex = str.length - 1) {\n for (let i = startIndex; i >= 0; i--) {\n const chCode = str.charCodeAt(i);\n if (chCode !== charCode_1.CharCode.Space && chCode !== charCode_1.CharCode.Tab) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Function that works identically to String.prototype.replace, except, the\n * replace function is allowed to be async and return a Promise.\n */\nfunction replaceAsync(str, search, replacer) {\n const parts = [];\n let last = 0;\n for (const match of str.matchAll(search)) {\n parts.push(str.slice(last, match.index));\n if (match.index === undefined) {\n throw new Error('match.index should be defined');\n }\n last = match.index + match[0].length;\n parts.push(replacer(match[0], ...match.slice(1), match.index, str, match.groups));\n }\n parts.push(str.slice(last));\n return Promise.all(parts).then(p => p.join(''));\n}\nfunction compare(a, b) {\n if (a < b) {\n return -1;\n }\n else if (a > b) {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n const codeA = a.charCodeAt(aStart);\n const codeB = b.charCodeAt(bStart);\n if (codeA < codeB) {\n return -1;\n }\n else if (codeA > codeB) {\n return 1;\n }\n }\n const aLen = aEnd - aStart;\n const bLen = bEnd - bStart;\n if (aLen < bLen) {\n return -1;\n }\n else if (aLen > bLen) {\n return 1;\n }\n return 0;\n}\nfunction compareIgnoreCase(a, b) {\n return compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\n}\nfunction compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n let codeA = a.charCodeAt(aStart);\n let codeB = b.charCodeAt(bStart);\n if (codeA === codeB) {\n // equal\n continue;\n }\n if (codeA >= 128 || codeB >= 128) {\n // not ASCII letters -> fallback to lower-casing strings\n return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\n }\n // mapper lower-case ascii letter onto upper-case varinats\n // [97-122] (lower ascii) --> [65-90] (upper ascii)\n if (isLowerAsciiLetter(codeA)) {\n codeA -= 32;\n }\n if (isLowerAsciiLetter(codeB)) {\n codeB -= 32;\n }\n // compare both code points\n const diff = codeA - codeB;\n if (diff === 0) {\n continue;\n }\n return diff;\n }\n const aLen = aEnd - aStart;\n const bLen = bEnd - bStart;\n if (aLen < bLen) {\n return -1;\n }\n else if (aLen > bLen) {\n return 1;\n }\n return 0;\n}\nfunction isAsciiDigit(code) {\n return code >= charCode_1.CharCode.Digit0 && code <= charCode_1.CharCode.Digit9;\n}\nfunction isLowerAsciiLetter(code) {\n return code >= charCode_1.CharCode.a && code <= charCode_1.CharCode.z;\n}\nfunction isUpperAsciiLetter(code) {\n return code >= charCode_1.CharCode.A && code <= charCode_1.CharCode.Z;\n}\nfunction equalsIgnoreCase(a, b) {\n return a.length === b.length && compareSubstringIgnoreCase(a, b) === 0;\n}\nfunction startsWithIgnoreCase(str, candidate) {\n const candidateLength = candidate.length;\n if (candidate.length > str.length) {\n return false;\n }\n return compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;\n}\n/**\n * @returns the length of the common prefix of the two strings.\n */\nfunction commonPrefixLength(a, b) {\n const len = Math.min(a.length, b.length);\n let i;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(i) !== b.charCodeAt(i)) {\n return i;\n }\n }\n return len;\n}\n/**\n * @returns the length of the common suffix of the two strings.\n */\nfunction commonSuffixLength(a, b) {\n const len = Math.min(a.length, b.length);\n let i;\n const aLastIndex = a.length - 1;\n const bLastIndex = b.length - 1;\n for (i = 0; i < len; i++) {\n if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n return i;\n }\n }\n return len;\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nfunction isHighSurrogate(charCode) {\n return (0xD800 <= charCode && charCode <= 0xDBFF);\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nfunction isLowSurrogate(charCode) {\n return (0xDC00 <= charCode && charCode <= 0xDFFF);\n}\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nfunction computeCodePoint(highSurrogate, lowSurrogate) {\n return ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\n}\n/**\n * get the code point that begins at offset `offset`\n */\nfunction getNextCodePoint(str, len, offset) {\n const charCode = str.charCodeAt(offset);\n if (isHighSurrogate(charCode) && offset + 1 < len) {\n const nextCharCode = str.charCodeAt(offset + 1);\n if (isLowSurrogate(nextCharCode)) {\n return computeCodePoint(charCode, nextCharCode);\n }\n }\n return charCode;\n}\n/**\n * get the code point that ends right before offset `offset`\n */\nfunction getPrevCodePoint(str, offset) {\n const charCode = str.charCodeAt(offset - 1);\n if (isLowSurrogate(charCode) && offset > 1) {\n const prevCharCode = str.charCodeAt(offset - 2);\n if (isHighSurrogate(prevCharCode)) {\n return computeCodePoint(prevCharCode, charCode);\n }\n }\n return charCode;\n}\nclass CodePointIterator {\n get offset() {\n return this._offset;\n }\n constructor(str, offset = 0) {\n this._str = str;\n this._len = str.length;\n this._offset = offset;\n }\n setOffset(offset) {\n this._offset = offset;\n }\n prevCodePoint() {\n const codePoint = getPrevCodePoint(this._str, this._offset);\n this._offset -= (codePoint >= uint_1.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n return codePoint;\n }\n nextCodePoint() {\n const codePoint = getNextCodePoint(this._str, this._len, this._offset);\n this._offset += (codePoint >= uint_1.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n return codePoint;\n }\n eol() {\n return (this._offset >= this._len);\n }\n}\nexports.CodePointIterator = CodePointIterator;\nexports.noBreakWhitespace = '\\xa0';\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MicrotaskDelay = void 0;\n/**\n * Can be passed into the Delayed to defer using a microtask\n * */\nexports.MicrotaskDelay = Symbol('MicrotaskDelay');\n","\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Constants = void 0;\nexports.toUint8 = toUint8;\nexports.toUint32 = toUint32;\nvar Constants;\n(function (Constants) {\n /**\n * MAX SMI (SMall Integer) as defined in v8.\n * one bit is lost for boxing/unboxing flag.\n * one bit is lost for sign flag.\n * See https://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/#tagged-values\n */\n Constants[Constants[\"MAX_SAFE_SMALL_INTEGER\"] = 1073741824] = \"MAX_SAFE_SMALL_INTEGER\";\n /**\n * MIN SMI (SMall Integer) as defined in v8.\n * one bit is lost for boxing/unboxing flag.\n * one bit is lost for sign flag.\n * See https://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/#tagged-values\n */\n Constants[Constants[\"MIN_SAFE_SMALL_INTEGER\"] = -1073741824] = \"MIN_SAFE_SMALL_INTEGER\";\n /**\n * Max unsigned integer that fits on 8 bits.\n */\n Constants[Constants[\"MAX_UINT_8\"] = 255] = \"MAX_UINT_8\";\n /**\n * Max unsigned integer that fits on 16 bits.\n */\n Constants[Constants[\"MAX_UINT_16\"] = 65535] = \"MAX_UINT_16\";\n /**\n * Max unsigned integer that fits on 32 bits.\n */\n Constants[Constants[\"MAX_UINT_32\"] = 4294967295] = \"MAX_UINT_32\";\n Constants[Constants[\"UNICODE_SUPPLEMENTARY_PLANE_BEGIN\"] = 65536] = \"UNICODE_SUPPLEMENTARY_PLANE_BEGIN\";\n})(Constants || (exports.Constants = Constants = {}));\nfunction toUint8(v) {\n if (v < 0) {\n return 0;\n }\n if (v > Constants.MAX_UINT_8) {\n return Constants.MAX_UINT_8;\n }\n return v | 0;\n}\nfunction toUint32(v) {\n if (v < 0) {\n return 0;\n }\n if (v > Constants.MAX_UINT_32) {\n return Constants.MAX_UINT_32;\n }\n return v | 0;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';\nimport { IBufferRange, ITerminal } from 'browser/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { ITerminalOptions } from 'common/Types';\nimport { AddonManager } from 'common/public/AddonManager';\nimport { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';\nimport { ParserApi } from 'common/public/ParserApi';\nimport { UnicodeApi } from 'common/public/UnicodeApi';\nimport { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';\nimport type { Event } from 'vs/base/common/event';\n\n/**\n * The set of options that only have an effect when set in the Terminal constructor.\n */\nconst CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];\n\nlet $value = 0;\n\nexport class Terminal extends Disposable implements ITerminalApi {\n private _core: ITerminal;\n private _addonManager: AddonManager;\n private _parser: IParser | undefined;\n private _buffer: BufferNamespaceApi | undefined;\n private _publicOptions: Required;\n\n constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions) {\n super();\n\n this._core = this._register(new TerminalCore(options));\n this._addonManager = this._register(new AddonManager());\n\n this._publicOptions = { ... this._core.options };\n const getter = (propName: string): any => {\n return this._core.options[propName];\n };\n const setter = (propName: string, value: any): void => {\n this._checkReadonlyOptions(propName);\n this._core.options[propName] = value;\n };\n\n for (const propName in this._core.options) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this._publicOptions, propName, desc);\n }\n }\n\n private _checkReadonlyOptions(propName: string): void {\n // Throw an error if any constructor only option is modified\n // from terminal.options\n // Modifications from anywhere else are allowed\n if (CONSTRUCTOR_ONLY_OPTIONS.includes(propName)) {\n throw new Error(`Option \"${propName}\" can only be set in the constructor`);\n }\n }\n\n private _checkProposedApi(): void {\n if (!this._core.optionsService.rawOptions.allowProposedApi) {\n throw new Error('You must set the allowProposedApi option to true to use proposed API');\n }\n }\n\n public get onBell(): Event { return this._core.onBell; }\n public get onBinary(): Event { return this._core.onBinary; }\n public get onCursorMove(): Event { return this._core.onCursorMove; }\n public get onData(): Event { return this._core.onData; }\n public get onKey(): Event<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n public get onLineFeed(): Event { return this._core.onLineFeed; }\n public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }\n public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }\n public get onScroll(): Event { return this._core.onScroll; }\n public get onSelectionChange(): Event { return this._core.onSelectionChange; }\n public get onTitleChange(): Event { return this._core.onTitleChange; }\n public get onWriteParsed(): Event { return this._core.onWriteParsed; }\n\n public get element(): HTMLElement | undefined { return this._core.element; }\n public get parser(): IParser {\n if (!this._parser) {\n this._parser = new ParserApi(this._core);\n }\n return this._parser;\n }\n public get unicode(): IUnicodeHandling {\n this._checkProposedApi();\n return new UnicodeApi(this._core);\n }\n public get textarea(): HTMLTextAreaElement | undefined { return this._core.textarea; }\n public get rows(): number { return this._core.rows; }\n public get cols(): number { return this._core.cols; }\n public get buffer(): IBufferNamespaceApi {\n if (!this._buffer) {\n this._buffer = this._register(new BufferNamespaceApi(this._core));\n }\n return this._buffer;\n }\n public get markers(): ReadonlyArray {\n this._checkProposedApi();\n return this._core.markers;\n }\n public get modes(): IModes {\n const m = this._core.coreService.decPrivateModes;\n let mouseTrackingMode: 'none' | 'x10' | 'vt200' | 'drag' | 'any' = 'none';\n switch (this._core.coreMouseService.activeProtocol) {\n case 'X10': mouseTrackingMode = 'x10'; break;\n case 'VT200': mouseTrackingMode = 'vt200'; break;\n case 'DRAG': mouseTrackingMode = 'drag'; break;\n case 'ANY': mouseTrackingMode = 'any'; break;\n }\n return {\n applicationCursorKeysMode: m.applicationCursorKeys,\n applicationKeypadMode: m.applicationKeypad,\n bracketedPasteMode: m.bracketedPasteMode,\n insertMode: this._core.coreService.modes.insertMode,\n mouseTrackingMode: mouseTrackingMode,\n originMode: m.origin,\n reverseWraparoundMode: m.reverseWraparound,\n sendFocusMode: m.sendFocus,\n wraparoundMode: m.wraparound\n };\n }\n public get options(): Required {\n return this._publicOptions;\n }\n public set options(options: ITerminalOptions) {\n for (const propName in options) {\n this._publicOptions[propName] = options[propName];\n }\n }\n public blur(): void {\n this._core.blur();\n }\n public focus(): void {\n this._core.focus();\n }\n public input(data: string, wasUserInput: boolean = true): void {\n this._core.input(data, wasUserInput);\n }\n public resize(columns: number, rows: number): void {\n this._verifyIntegers(columns, rows);\n this._core.resize(columns, rows);\n }\n public open(parent: HTMLElement): void {\n this._core.open(parent);\n }\n public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {\n this._core.attachCustomKeyEventHandler(customKeyEventHandler);\n }\n public attachCustomWheelEventHandler(customWheelEventHandler: (event: WheelEvent) => boolean): void {\n this._core.attachCustomWheelEventHandler(customWheelEventHandler);\n }\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._core.registerLinkProvider(linkProvider);\n }\n public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {\n this._checkProposedApi();\n return this._core.registerCharacterJoiner(handler);\n }\n public deregisterCharacterJoiner(joinerId: number): void {\n this._checkProposedApi();\n this._core.deregisterCharacterJoiner(joinerId);\n }\n public registerMarker(cursorYOffset: number = 0): IMarker {\n this._verifyIntegers(cursorYOffset);\n return this._core.registerMarker(cursorYOffset);\n }\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n this._checkProposedApi();\n this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0);\n return this._core.registerDecoration(decorationOptions);\n }\n public hasSelection(): boolean {\n return this._core.hasSelection();\n }\n public select(column: number, row: number, length: number): void {\n this._verifyIntegers(column, row, length);\n this._core.select(column, row, length);\n }\n public getSelection(): string {\n return this._core.getSelection();\n }\n public getSelectionPosition(): IBufferRange | undefined {\n return this._core.getSelectionPosition();\n }\n public clearSelection(): void {\n this._core.clearSelection();\n }\n public selectAll(): void {\n this._core.selectAll();\n }\n public selectLines(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.selectLines(start, end);\n }\n public dispose(): void {\n super.dispose();\n }\n public scrollLines(amount: number): void {\n this._verifyIntegers(amount);\n this._core.scrollLines(amount);\n }\n public scrollPages(pageCount: number): void {\n this._verifyIntegers(pageCount);\n this._core.scrollPages(pageCount);\n }\n public scrollToTop(): void {\n this._core.scrollToTop();\n }\n public scrollToBottom(): void {\n this._core.scrollToBottom();\n }\n public scrollToLine(line: number): void {\n this._verifyIntegers(line);\n this._core.scrollToLine(line);\n }\n public clear(): void {\n this._core.clear();\n }\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data, callback);\n }\n public writeln(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data);\n this._core.write('\\r\\n', callback);\n }\n public paste(data: string): void {\n this._core.paste(data);\n }\n public refresh(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.refresh(start, end);\n }\n public reset(): void {\n this._core.reset();\n }\n public clearTextureAtlas(): void {\n this._core.clearTextureAtlas();\n }\n public loadAddon(addon: ITerminalAddon): void {\n this._addonManager.loadAddon(this, addon);\n }\n public static get strings(): ILocalizableStrings {\n // A wrapper is required here because esbuild prevents setting an `export let`\n return {\n get promptLabel(): string { return Strings.promptLabel.get(); },\n set promptLabel(value: string) { Strings.promptLabel.set(value); },\n get tooMuchOutput(): string { return Strings.tooMuchOutput.get(); },\n set tooMuchOutput(value: string) { Strings.tooMuchOutput.set(value); }\n };\n }\n\n private _verifyIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value === Infinity || isNaN($value) || $value % 1 !== 0) {\n throw new Error('This API only accepts integers');\n }\n }\n }\n\n private _verifyPositiveIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value && ($value === Infinity || isNaN($value) || $value % 1 !== 0 || $value < 0)) {\n throw new Error('This API only accepts positive integers');\n }\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","a","i","globalThis","AccessibilityManager","Disposable","constructor","_terminal","instantiationService","super","_coreBrowserService","_renderService","_rowColumns","WeakMap","_liveRegionLineCount","_charsToConsume","_charsToAnnounce","doc","this","mainDocument","_accessibilityContainer","createElement","classList","add","_rowContainer","setAttribute","_rowElements","rows","_createAccessibilityTreeNode","appendChild","_topBoundaryFocusListener","e","_handleBoundaryFocus","_bottomBoundaryFocusListener","addEventListener","length","_liveRegion","_liveRegionDebouncer","_register","TimeBasedDebouncer","_renderRows","bind","element","Error","insertAdjacentElement","onResize","_handleResize","onRender","_refreshRows","start","end","onScroll","onA11yChar","char","_handleChar","onLineFeed","onA11yTab","spaceCount","_handleTab","onKey","_handleKey","key","onBlur","_clearLiveRegion","onDimensionsChange","_refreshRowsDimensions","addDisposableListener","_handleSelectionChange","onDprChange","toDisposable","remove","MAX_ROWS_TO_READ","shift","textContent","Strings","tooMuchOutput","get","keyChar","test","push","refresh","buffer","setSize","lines","toString","line","ydisp","columns","lineData","translateToString","undefined","posInSet","innerText","set","_alignRowWidth","_announceCharacters","position","boundaryElement","target","beforeBoundaryElement","getAttribute","relatedTarget","topBoundaryElement","bottomBoundaryElement","pop","removeChild","removeEventListener","newElement","unshift","scrollLines","focus","preventDefault","stopImmediatePropagation","selection","getSelection","isCollapsed","contains","anchorNode","clearSelection","focusNode","console","error","begin","node","offset","anchorOffset","focusOffset","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINED_BY","DOCUMENT_POSITION_FOLLOWING","childNodes","lastRowElement","slice","toRowColumn","rowElement","Text","parentNode","row","parseInt","isNaN","warn","column","cols","beginRowColumn","endRowColumn","select","children","tabIndex","_refreshRowDimensions","dimensions","css","cell","height","Object","assign","style","width","canvas","fontSize","options","transform","getBoundingClientRect","lastColumn","targetWidth","IInstantiationService","ICoreBrowserService","IRenderService","prepareTextForTerminal","text","replace","bracketTextForPaste","bracketedPasteMode","paste","textarea","coreService","optionsService","decPrivateModes","rawOptions","ignoreBracketedPasteMode","triggerDataEvent","value","moveTextAreaUnderMouseCursor","ev","screenElement","pos","left","clientX","top","clientY","zIndex","selectionService","clipboardData","setData","selectionText","stopPropagation","getData","shouldSelectWord","rightClickSelect","_color","TwoKeyMap","_css","setCss","bg","fg","getCss","setColor","getColor","clear","CoreBrowserTerminal","CoreTerminal","linkifier","_linkifier","onFocus","_onFocus","event","_onBlur","_onA11yCharEmitter","_onA11yTabEmitter","onWillOpen","_onWillOpen","MutableDisposable","browser","Browser","_keyDownHandled","_keyDownSeen","_keyPressHandled","_unprocessedDeadKey","_accessibilityManager","_onCursorMove","Emitter","onCursorMove","_onKey","_onRender","_onSelectionChange","onSelectionChange","_onTitleChange","onTitleChange","_onBell","onBell","_setup","_decorationService","_instantiationService","createInstance","DecorationService","setService","IDecorationService","_linkProviderService","LinkProviderService","ILinkProviderService","registerLinkProvider","OscLinkProvider","_inputHandler","onRequestBell","fire","onRequestRefreshRows","onRequestSendFocus","_reportFocus","onRequestReset","reset","onRequestWindowsOptionsReport","type","_reportWindowsOptions","onColor","_handleColorEvent","Event","forward","_bufferService","_afterResize","_customKeyEventHandler","_themeService","req","acc","ident","index","colorRgb","color","toColorRGB","colors","ansi","C0","ESC","toRgbString","C1_ESCAPED","ST","modifyColors","channels","toColor","narrowedAcc","restoreColor","buffers","active","preventScroll","_handleScreenReaderModeOptionChange","_handleTextAreaFocus","sendFocus","_showCursor","blur","_handleTextAreaBlur","y","_syncTextArea","isCursorInViewport","_compositionHelper","isComposing","cursorY","ybase","bufferLine","cursorX","Math","min","x","cellHeight","getWidth","cellWidth","cursorTop","cursorLeft","lineHeight","_initGlobal","_bindKeys","hasSelection","copyHandler","_selectionService","pasteHandlerWrapper","handlePasteEvent","isFirefox","button","rightClickHandler","rightClickSelectsWord","isLinux","_keyUp","_keyDown","_keyPress","compositionstart","compositionupdate","compositionend","_inputEvent","updateCompositionElements","open","parent","isConnected","_logService","debug","ownerDocument","defaultView","window","_document","documentOverride","Document","dir","fragment","createDocumentFragment","_viewportElement","updateCursorStyle","_helperContainer","promptLabel","isChromeOS","CoreBrowserService","document","_charSizeService","CharSizeService","ICharSizeService","ThemeService","IThemeService","_characterJoinerService","CharacterJoinerService","ICharacterJoinerService","RenderService","onRenderedViewportChange","resize","_compositionView","CompositionHelper","_mouseService","MouseService","IMouseService","Linkifier","hasRenderer","setRenderer","_createRenderer","handleCursorMove","handleResize","handleBlur","handleFocus","_viewport","Viewport","onRequestScrollLines","SelectionService","ISelectionService","amount","suppressScrollEvent","onRequestRedraw","handleSelectionChanged","columnSelectMode","onLinuxMouseSelection","_onScroll","BufferDecorationRenderer","handleMouseDown","coreMouseService","areMouseEventsActive","disable","enable","screenReaderMode","onSpecificOptionChange","overviewRuler","_overviewRulerRenderer","OverviewRulerRenderer","measure","bindMouse","DomRenderer","self","el","sendEvent","getMouseReportCoords","but","action","overrideType","buttons","_customWheelEventHandler","deltaY","triggerMouseEvent","col","ctrl","ctrlKey","alt","altKey","shiftKey","requestedEvents","mouseup","wheel","mousedrag","mousemove","eventListeners","cancel","onProtocolChange","events","logLevel","explainEvents","passive","activeProtocol","shouldForceSelection","hasScrollback","sequence","applicationCursorKeys","refreshRows","shouldColumnSelect","isCursorInitialized","disp","scrollPages","pageCount","scrollToTop","scrollToBottom","disableSmoothScroll","scrollToLine","scrollAmount","data","attachCustomKeyEventHandler","customKeyEventHandler","attachCustomWheelEventHandler","customWheelEventHandler","linkProvider","registerCharacterJoiner","handler","joinerId","register","deregisterCharacterJoiner","deregister","markers","registerMarker","cursorYOffset","addMarker","registerDecoration","decorationOptions","setSelection","getSelectionPosition","selectionStart","selectionEnd","selectAll","selectLines","shouldIgnoreComposition","isMac","macOptionIsMeta","keydown","scrollOnUserInput","result","evaluateKeyboardEvent","scrollCount","_isThirdLevelShift","metaKey","charCodeAt","ETX","CR","domEvent","thirdLevelKey","isWindows","getModifierState","keyCode","wasModifierKeyOnlyEvent","charCode","which","String","fromCharCode","inputType","composed","hasValidSize","clearAllMarkers","getBlankLine","DEFAULT_ATTR_DATA","clearTextureAtlas","WindowsOptionsReportType","GET_WIN_SIZE_PIXELS","canvasWidth","toFixed","canvasHeight","GET_CELL_SIZE_PIXELS","force","cancelEvents","currentLink","_currentLink","_element","_linkCacheDisposables","_isMouseOut","_wasResized","_activeLine","_onShowLinkUnderline","onShowLinkUnderline","_onHideLinkUnderline","onHideLinkUnderline","dispose","_lastMouseEvent","_activeProviderReplies","_clearCurrentLink","_handleMouseMove","_handleMouseDown","_handleMouseUp","_positionFromMouseEvent","composedPath","_lastBufferCell","_handleHover","_askForLink","_linkAtPosition","link","useLineCache","forEach","reply","linkWithState","Map","linkProvided","linkProviders","entries","existingReply","_checkLinkProviderResult","provideLinks","links","linksWithState","map","size","_removeIntersectingLinks","replies","occupiedCells","Set","providerReply","startX","range","endX","has","splice","hasLinkBefore","j","linkAtPosition","find","_handleNewLink","_mouseDownLink","b","activate","startRow","endRow","_linkLeave","state","decorations","underline","pointerCursor","isHovered","_linkHover","defineProperties","v","toggle","_fireUnderlineEvent","hover","showEvent","scrollOffset","_createLinkUnderlineEvent","leave","lower","upper","current","mouseService","coords","getCoords","x1","y1","x2","y2","IBufferService","promptLabelInternal","tooMuchOutputInternal","_optionsService","_oscLinkService","callback","linkHandler","CellData","lineLength","getTrimmedLength","currentLinkId","currentStart","finishLink","hasContent","loadCell","hasExtendedAttrs","extended","urlId","getLinkData","uri","ignoreLink","allowNonHttpProtocols","parsed","URL","includes","protocol","defaultActivate","confirm","newWindow","opener","location","href","IOptionsService","IOscLinkService","_renderCallback","_refreshCallbacks","_animationFrame","cancelAnimationFrame","addRefreshCallback","requestAnimationFrame","_innerRefresh","rowStart","rowEnd","rowCount","_rowCount","_rowStart","_rowEnd","max","_runRefreshCallbacks","_debounceThresholdMS","_lastRefreshMs","_additionalRefreshRequested","_refreshTimeoutID","clearTimeout","refreshRequestTime","Date","now","elapsed","waitPeriodBeforeTrailingRefresh","setTimeout","DEFAULT_ANSI_COLORS","freeze","r","g","toCss","rgba","toRgba","c","coreBrowserService","themeService","_onRequestScrollLines","_isSyncing","_isHandlingScroll","_suppressOnScrollHandler","scrollable","Scrollable","forceIntegerValues","smoothScrollDuration","scheduleAtNextAnimationFrame","cb","setSmoothScrollDuration","_scrollableElement","SmoothScrollableElement","vertical","horizontal","useShadows","mouseWheelSmoothScroll","_getChangeOptions","onMultipleOptionChange","updateOptions","handleMouseWheel","setScrollDimensions","scrollHeight","runAndSubscribe","onChangeColors","getDomNode","backgroundColor","background","_styleElement","scrollbarSliderBackground","scrollbarSliderHoverBackground","scrollbarSliderActiveBackground","join","_queueSync","onBufferActivate","_sync","_handleScroll","getScrollPosition","setScrollPosition","reuseAnimation","scrollTop","_latestYDisp","mouseWheelScrollSensitivity","scrollSensitivity","fastScrollSensitivity","verticalScrollbarSize","_queuedAnimationFrame","newRow","round","diff","ICoreMouseService","_screenElement","_decorationElements","_altBufferIsActive","_dimensionsChanged","_container","_doRefreshDecorations","_queueRefresh","onDecorationRegistered","onDecorationRemoved","decoration","_removeDecoration","_renderDecoration","_refreshStyle","_refreshXPosition","_createElement","layer","marker","display","onRenderEmitter","onDispose","delete","anchor","right","_zones","_zonePool","_zonePoolIndex","_linePadding","full","center","zones","addDecoration","overviewRulerOptions","z","_lineIntersectsZone","_lineAdjacentToZone","_addLineToZone","startBufferLine","endBufferLine","setPadding","padding","zone","drawHeight","drawWidth","drawX","_width","_colorZoneStore","ColorZoneStore","_shouldUpdateDimensions","_shouldUpdateAnchor","_lastKnownBufferLength","_canvas","_refreshCanvasDimensions","parentElement","insertBefore","ctx","getContext","_ctx","normal","_refreshDrawHeightConstants","_refreshColorZonePadding","_containerHeight","clientHeight","_refreshDrawConstants","outerWidth","floor","innerWidth","ceil","dpr","pixelsPerLine","nonFullHeight","_refreshDecorations","clearRect","lineWidth","_renderRulerOutline","_renderColorZone","fillStyle","overviewRulerBorder","fillRect","showTopBorder","showBottomBorder","updateCanvasDimensions","updateAnchor","_isComposing","_textarea","_coreService","_isSendingComposition","_compositionPosition","_dataAlreadySent","_finalizeComposition","_handleAnyTextareaChanges","waitForPropagation","currentCompositionPosition","input","substring","oldValue","newValue","DEL","dontRecurse","fontFamily","compositionViewBounds","ICoreService","getCoordsRelativeToElement","rect","elementStyle","getComputedStyle","leftPadding","getPropertyValue","topPadding","colCount","hasValidCharSize","cssCellWidth","cssCellHeight","isSelection","targetX","targetY","bufferService","applicationCursor","startY","moveToRequestedRow","repeat","wrappedRowsForRow","resetStartingRow","direction","horizontalDirection","moveToRequestedCol","abs","rowDifference","currX","colsFromRowEnd","rowsToMove","wrappedRows","verticalDirection","isWrapped","wrappedRowsCount","currentRow","lineWraps","startCol","endCol","currentCol","bufferStr","translateBufferLineToString","mod","count","str","rpt","TERMINAL_CLASS_PREFIX","ROW_CONTAINER_CLASS","FG_CLASS_PREFIX","BG_CLASS_PREFIX","FOCUS_CLASS","SELECTION_CLASS","nextTerminalId","_linkifier2","_terminalClass","_selectionRenderModel","createSelectionRenderModel","_refreshRowElements","_selectionContainer","createRenderDimensions","_updateDimensions","onOptionChange","_handleOptionsChanged","_injectCss","_rowFactory","DomRendererRowFactory","_handleLinkHover","_handleLinkLeave","_widthCache","_themeStyleElement","_dimensionsStyleElement","WidthCache","setFont","fontWeight","fontWeightBold","_setDefaultSpacing","device","letterSpacing","overflow","styles","_terminalSelector","foreground","multiplyOpacity","blinkAnimationUnderlineId","blinkAnimationBarId","blinkAnimationBlockId","cursor","cursorAccent","cursorWidth","selectionBackgroundOpaque","selectionInactiveBackgroundOpaque","INVERTED_DEFAULT_COLOR","opaque","spacing","defaultSpacing","handleDevicePixelRatioChange","handleCharSizeChanged","renderRows","replaceChildren","update","viewportStartRow","viewportEndRow","viewportCappedStartRow","viewportCappedEndRow","documentFragment","isXFlipped","_createSelectionElement","middleRowsCount","colStart","colEnd","cursorAbsoluteY","cursorBlink","cursorStyle","cursorInactiveStyle","createRow","_setCellUnderline","enabled","maxY","bufferline","_workCell","_columnSelectMode","_selectionStart","_selectionEnd","isCursorRow","widthCache","linkStart","linkEnd","elements","joinedRanges","getJoinedCharacters","charElement","getNoBgTrimmedLength","cellAmount","oldBg","oldFg","oldExt","oldLinkHover","oldSpacing","oldIsInSelection","classes","hasHover","isJoined","lastCharX","JoinedCellData","isInSelection","_isCellInSelection","isCursorCell","isLinkHover","isDecorated","forEachDecorationAtCell","d","chars","getChars","WHITESPACE_CELL_CHAR","isUnderline","isOverline","isBold","isItalic","selectionForeground","ext","isInvisible","isCursorHidden","isFocused","isDim","underlineStyle","isUnderlineColorDefault","isUnderlineColorRGB","textDecorationColor","AttributeData","getUnderlineColor","drawBoldTextInBrightColors","isStrikethrough","textDecoration","getFgColor","fgColorMode","getFgColorMode","getBgColor","bgColorMode","getBgColorMode","isInverse","temp","temp2","bgOverride","fgOverride","resolvedBg","isTop","backgroundColorRGB","foregroundColorRGB","_addStyle","padStart","_applyMinimumContrast","className","minimumContrastRatio","treatGlyphAsBackgroundColor","getCode","cache","_getContrastCache","adjustedColor","ratio","ensureContrastRatio","halfContrastCache","contrastCache","padChar","_flat","Float32Array","_font","_fontSize","_weight","_weightBold","_measureElements","whiteSpace","fontKerning","regular","bold","italic","fontStyle","boldItalic","_holey","fill","font","weight","weightBold","cp","_measure","variant","offsetWidth","DIM_OPACITY","TEXT_BASELINE","isLegacyEdge","isPowerlineGlyph","codepoint","isEmoji","glyphSizeX","deviceCellWidth","isNerdFontGlyph","isBoxOrBlockGlyph","currentOffset","SelectionRenderModel","terminal","viewportY","isCellSelected","isSelectAllActive","selectionStartLength","finalSelectionStart","areSelectionValuesReversed","finalSelectionEnd","startPlusLength","handleTrim","_onCharSizeChange","onCharSizeChange","_measureStrategy","TextMetricsMeasureStrategy","DomMeasureStrategy","BaseMeasureStategy","_result","_validateAndSet","_parentElement","_measureElement","Number","offsetHeight","OffscreenCanvas","measureText","metrics","fontBoundingBoxAscent","fontBoundingBoxDescent","firstCell","content","combinedData","isCombined","setFromCharData","getAsCharData","_characterJoiners","_nextCharacterJoinerId","joiner","id","ranges","lineStr","rangeStartColumn","currentStringIndex","rangeStartStringIndex","rangeAttrFG","getFg","rangeAttrBG","getBg","_getJoinedRanges","startIndex","endIndex","allJoinedRanges","joinerRanges","_mergeRanges","_stringRangesToCellRanges","currentRangeIndex","currentRangeStarted","currentRange","getString","newRange","inRange","_window","_isFocused","_cachedIsFocused","_screenDprMonitor","ScreenDprMonitor","_onDprChange","_onWindowChange","onWindowChange","w","setWindow","devicePixelRatio","hasFocus","queueMicrotask","_parentWindow","_windowResizeListener","_outerListener","_setDprAndFireIfDiffers","_currentDevicePixelRatio","_updateDpr","_setWindowResizeListener","clearListener","parentWindow","_resolutionMediaMatchList","removeListener","matchMedia","addListener","providerIndex","indexOf","_renderer","decorationService","_pausedResizeTask","DebouncedIdleTask","_observerDisposable","_isPaused","_needsFullRefresh","_isNextRenderRedrawOnly","_needsSelectionRefresh","_canvasWidth","_canvasHeight","_selectionState","_onDimensionsChange","_onRenderedViewportChange","_onRefreshRequest","onRefreshRequest","_renderDebouncer","RenderDebouncer","_fullRefresh","_registerIntersectionObserver","observer","IntersectionObserver","_handleIntersectionChange","threshold","observe","disconnect","entry","isIntersecting","intersectionRatio","flush","isRedrawOnly","_fireOnCanvasResize","renderer","NON_BREAKING_SPACE_CHAR","ALL_NON_BREAKING_SPACE_REGEX","RegExp","_dragScrollAmount","_enabled","_mouseDownTimeStamp","_oldHasSelection","_oldSelectionStart","_oldSelectionEnd","_onLinuxMouseSelection","_onRedrawRequest","_mouseMoveListener","_mouseUpListener","onUserInput","_trimListener","onTrim","_handleTrim","_handleBufferActivate","_model","SelectionModel","_activeSelectionMode","_removeMouseDownListeners","lineText","startRowEndCol","isLinuxMouseSelection","_refreshAnimationFrame","_refresh","_isClickInSelection","_getMouseBufferCoords","_areCoordsInSelection","isCellInSelection","_selectWordAtCursor","allowWhitespaceOnlySelection","getRangeLength","_selectWordAt","_getMouseEventScrollAmount","terminalHeight","macOptionClickForcesSelection","timeStamp","_handleIncrementalClick","detail","_handleSingleClick","_handleDoubleClick","_handleTripleClick","_addMouseDownListeners","_dragScrollIntervalTimer","setInterval","_dragScroll","clearInterval","hasWidth","_selectLineAt","previousSelectionEnd","_selectToWordAt","timeElapsed","altClickMovesCursor","coordinates","moveToCellSequence","_fireEventIfSelectionChanged","_fireOnSelectionChange","activeBuffer","_convertViewportColToCharacterIndex","charIndex","_getWordAt","followWrappedLinesAbove","followWrappedLinesBelow","charOffset","leftWideCharCount","rightWideCharCount","leftLongCharOffset","rightLongCharOffset","charAt","_isCharWordSeparator","trim","getCodePoint","previousBufferLine","previousLineWordPosition","nextBufferLine","nextLineWordPosition","wordPosition","wordSeparator","wrappedRange","getWrappedRangeForLine","first","last","createDecorator","DEFAULT_FOREGROUND","DEFAULT_BACKGROUND","DEFAULT_CURSOR","DEFAULT_CURSOR_ACCENT","DEFAULT_SELECTION","DEFAULT_OVERVIEW_RULER_BORDER","_colors","_contrastCache","ColorContrastCache","_halfContrastCache","_onChangeColors","selectionBackgroundTransparent","blend","selectionInactiveBackgroundTransparent","opacity","_updateRestoreColors","_setTheme","theme","parseColor","selectionBackground","selectionInactiveBackground","NULL_COLOR","isOpaque","black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite","extendedAnsi","colorCount","slot","_restoreColor","_restoreColors","cssString","fallback","CircularList","_maxLength","onDeleteEmitter","onDelete","onInsertEmitter","onInsert","onTrimEmitter","_array","Array","_startIndex","_length","maxLength","newMaxLength","newArray","_getCyclicIndex","newLength","recycle","isFull","deleteCount","items","countToTrim","trimStart","shiftElements","expandListBy","clone","val","depth","clonedObject","isArray","$r","$g","$b","$a","rgb","toPaddedHex","s","contrastRatio","l1","l2","toChannels","fgR","fgG","fgB","bgR","bgG","bgB","rgbaColor","factor","$ctx","$litmusColor","willReadFrequently","globalCompositeOperation","createLinearGradient","match","rgbaMatch","parseFloat","getImageData","relativeLuminance2","rs","gs","bs","pow","relativeLuminance","reduceLuminance","bgRgba","fgRgba","cr","increaseLuminance","bgL","fgL","resultA","resultARatio","resultB","hasWriteSyncWarnHappened","_onScrollApi","_windowsWrappingHeuristics","_onBinary","onBinary","_onData","onData","_onLineFeed","_onResize","_onWriteParsed","onWriteParsed","InstantiationService","OptionsService","BufferService","LogService","ILogService","CoreService","CoreMouseService","unicodeService","UnicodeService","IUnicodeService","_charsetService","CharsetService","ICharsetService","OscLinkService","InputHandler","onRequestScrollToBottom","_writeBuffer","handleUserInput","_handleWindowsPtyOptionChange","markRangeDirty","scrollBottom","WriteBuffer","promiseResult","parse","write","writeSync","maxSubsequentCalls","LogLevelEnum","WARN","wasUserInput","MINIMUM_COLS","MINIMUM_ROWS","scroll","eraseAttr","registerEscHandler","registerDcsHandler","registerCsiHandler","registerOscHandler","windowsPty","buildNumber","backend","windowsMode","_enableWindowsWrappingHeuristics","disposables","updateWindowsModeWrappedState","final","GLEVEL","MAX_PARSEBUFFER_LENGTH","paramToWindowOption","n","opts","setWinLines","restoreWin","minimizeWin","setWinPosition","setWinSizePixels","raiseWin","lowerWin","refreshWin","setWinSizeChars","maximizeWin","fullscreenWin","getWinState","getWinPosition","getWinSizePixels","getScreenSizePixels","getCellSizePixels","getWinSizeChars","getScreenSizeChars","getIconTitle","getWinTitle","pushTitle","popTitle","$temp","getAttrData","_curAttrData","_coreMouseService","_unicodeService","_parser","EscapeSequenceParser","_parseBuffer","Uint32Array","_stringDecoder","StringToUtf32","_utf8Decoder","Utf8ToUtf32","_windowTitle","_iconName","_windowTitleStack","_iconNameStack","_eraseAttrDataInternal","_onRequestBell","_onRequestRefreshRows","_onRequestReset","_onRequestSendFocus","_onRequestSyncScrollBar","onRequestSyncScrollBar","_onRequestWindowsOptionsReport","_onA11yChar","_onA11yTab","_onColor","_parseStack","paused","cursorStartX","cursorStartY","decodedLength","_specialColors","_dirtyRowTracker","DirtyRowTracker","_activeBuffer","setCsiHandlerFallback","params","identifier","identToString","toArray","setEscHandlerFallback","setExecuteHandlerFallback","code","setOscHandlerFallback","setDcsHandlerFallback","payload","setPrintHandler","print","insertChars","intermediates","scrollLeft","cursorUp","scrollRight","cursorDown","cursorForward","cursorBackward","cursorNextLine","cursorPrecedingLine","cursorCharAbsolute","cursorPosition","cursorForwardTab","eraseInDisplay","prefix","eraseInLine","insertLines","deleteLines","deleteChars","scrollUp","scrollDown","eraseChars","cursorBackwardTab","charPosAbsolute","hPositionRelative","repeatPrecedingCharacter","sendDeviceAttributesPrimary","sendDeviceAttributesSecondary","linePosAbsolute","vPositionRelative","hVPosition","tabClear","setMode","setModePrivate","resetMode","resetModePrivate","charAttributes","deviceStatus","deviceStatusPrivate","softReset","setCursorStyle","setScrollRegion","saveCursor","windowOptions","restoreCursor","insertColumns","deleteColumns","selectProtected","requestMode","setExecuteHandler","BEL","bell","LF","lineFeed","VT","FF","carriageReturn","BS","backspace","HT","tab","SO","shiftOut","SI","shiftIn","C1","IND","NEL","nextLine","HTS","tabSet","OscHandler","setTitle","setIconName","setOrReportIndexedColor","setHyperlink","setOrReportFgColor","setOrReportBgColor","setOrReportCursorColor","restoreIndexedColor","restoreFgColor","restoreBgColor","restoreCursorColor","reverseIndex","keypadApplicationMode","keypadNumericMode","fullReset","setgLevel","selectDefaultCharset","flag","CHARSETS","selectCharset","screenAlignmentPattern","setErrorHandler","DcsHandler","requestStatusString","_preserveStack","_logSlowResolvingAsync","p","Promise","race","res","rej","catch","err","_getCurrentLinkId","wasPaused","DEBUG","prototype","call","split","clearRange","len","decode","subarray","viewportEnd","viewportStart","chWidth","charset","wraparoundMode","wraparound","insertMode","modes","curAttr","bufferRow","markDirty","setCellFromCodepoint","precedingJoinState","ch","currentInfo","charProperties","extractWidth","shouldJoin","extractShouldJoin","oldWidth","stringFromCodePoint","addLineToLink","oldRow","oldCol","_eraseAttrData","BufferLine","copyCellsFrom","addCodepointToCell","delta","insertCells","getNullCell","NULL_CELL_CODE","NULL_CELL_WIDTH","convertEol","reverseWraparound","_restrictCursor","originalX","nextStop","maxCol","origin","_setCursor","_moveCursor","diffToTop","diffToBottom","param","tabs","prevStop","_eraseInBufferLine","clearWrap","respectProtect","replaceCells","_resetBufferLine","clearMarkers","scrollBackSize","scrollBottomRowsOffset","scrollBottomAbsolute","deleteCells","joinState","idata","itext","codePointAt","tlength","copyWithin","_is","term","termName","setgCharset","DEFAULT_CHARSET","applicationKeypad","activeEncoding","activateAltBuffer","activateNormalBuffer","dm","mouseProtocol","mouseEncoding","cs","b2v","m","_updateAttrColor","mode","c1","c2","c3","fromColorRGB","_extractColor","attr","accu","cSpace","advance","hasSubParams","subparams","getSubParams","underlineColor","_processUnderline","updateExtended","_processSGR0","l","savedX","savedY","savedCurAttrData","savedCharset","isBlinking","bottom","second","_savedCharset","slots","idx","spec","exec","isValidColorIndex","_createHyperlink","_finishHyperlink","parsedParams","idParamIndex","findIndex","startsWith","registerLink","_setOrReportSpecialColor","collectAndFlag","scrollRegionHeight","level","yOffset","markAllDirty","f","isProtected","_data","third","fourth","isSafari","majorVersion","userAgent","isNode","process","navigator","platform","isIpad","isIphone","_getKey","_insertedValues","_flushInsertedTask","IdleTaskQueue","_isFlushingInserted","_deletedIndices","_flushDeletedTask","_isFlushingDeleted","insert","_flushCleanupDeleted","enqueue","_flushInserted","sortedAddedValues","sort","sortedAddedValuesIndex","arrayIndex","newArrayIndex","_flushCleanupInserted","_search","_flushDeleted","sortedDeletedIndices","sortedDeletedIndicesIndex","getKeyIterator","forEachByKey","values","mid","midKey","TaskQueue","_tasks","_i","task","_start","_idleCallback","_cancelCallback","_requestCallback","_process","deadline","taskDuration","longestTask","lastDeadlineRemaining","timeRemaining","deadlineRemaining","PriorityTaskQueue","_createDeadline","duration","requestIdleCallback","cancelIdleCallback","_queue","lastChar","CHAR_DATA_CODE_INDEX","WHITESPACE_CELL_CODE","ExtendedAttrs","newObj","isBlink","isFgRGB","isBgRGB","isFgPalette","isBgPalette","isFgDefault","isBgDefault","isAttributeDefault","isEmpty","getUnderlineColorMode","isUnderlineColorPalette","getUnderlineStyle","getUnderlineVariantOffset","underlineVariantOffset","_urlId","_ext","MAX_BUFFER_SIZE","_hasScrollback","_nullCell","fromCharData","NULL_CELL_CHAR","_whitespaceCell","WHITESPACE_CELL_WIDTH","_isClearing","_memoryCleanupQueue","_memoryCleanupPosition","_cols","_rows","_getCorrectBufferLength","setupTabStops","getWhitespaceCell","relativeY","correctBufferLength","scrollback","fillViewportRows","fillAttr","newCols","newRows","nullCell","dirtyMemoryLines","addToY","amountToTrim","_isReflowEnabled","_reflow","_batchedMemoryCleanup","normalRun","counted","cleanupMemory","_reflowLarger","_reflowSmaller","toRemove","reflowLargerGetLinesToRemove","newLayoutResult","reflowLargerCreateNewLayout","reflowLargerApplyNewLayout","layout","_reflowLargerAdjustViewport","countRemoved","viewportAdjustments","toInsert","countToInsert","wrappedLines","absoluteY","lastLineLength","destLineLengths","reflowSmallerGetNewLineLengths","linesToAdd","trimmedLines","newLines","newLine","destLineIndex","destCol","srcLineIndex","srcCol","cellsToCopy","wrappedLinesIndex","getWrappedLineTrimmedLength","setCell","insertEvents","originalLines","originalLinesLength","originalLineIndex","nextToInsertIndex","nextToInsert","countInsertedSoFar","nextI","insertCountEmitted","lineIndex","trimRight","tabStopWidth","Marker","_removeMarker","$startIndex","fillCellData","_combined","_extendedAttrs","CHAR_DATA_ATTR_INDEX","CHAR_DATA_CHAR_INDEX","CHAR_DATA_WIDTH_INDEX","codePoint","attrs","byteLength","uint32Cells","keys","extKeys","copyFrom","src","applyInReverse","srcData","srcCombinedKeys","outColumns","bufferCols","endsInNull","followingLineStartsWithWide","oldCols","bufferAbsoluteY","srcTrimmedTineLength","srcRemainingCells","destRemainingCells","countToRemove","nextToRemoveIndex","nextToRemoveStart","countRemovedSoFar","newLayout","newLayoutLines","newLineLengths","cellsNeeded","reduce","srcLine","cellsAvailable","oldTrimmedLength","endsWithWide","BufferSet","_onBufferActivate","_normal","Buffer","_alt","inactiveBuffer","obj","combined","DEFAULT_COLOR","DEFAULT_ATTR","DEFAULT_EXT","_id","isDisposed","_disposables","_nextId","_onDispose","disposable","C","NUL","SOH","STX","EOT","ENQ","ACK","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","FS","GS","RS","US","SP","PAD","HOP","BPH","NBH","SSA","ESA","HTJ","VTS","PLD","PLU","RI","SS2","SS3","DCS","PU1","PU2","STS","CCH","MW","SPA","EPA","SOS","SGCI","SCI","CSI","OSC","PM","APC","applicationCursorMode","modifiers","keyMapping","KEYCODE_KEY_MAPPINGS","keyString","toUpperCase","toLowerCase","_interim","startPos","interim","Uint8Array","byte1","byte2","byte3","byte4","discardInterim","tmp","missing","fourStop","BMP_COMBINING","HIGH_COMBINING","table","version","wcwidth","num","ucs","bisearch","preceding","createPropertyValue","_action","_callbacks","_pendingData","_bufferOffset","_isSyncWriting","_syncCalls","_didUserInput","chunk","_innerWrite","lastTime","startTime","continuation","resolve","then","low","RGB_REX","base","HASH_REX","adv","bits","pad","s2","PAYLOAD_LIMIT","EMPTY_HANDLERS","_handlers","create","_active","_ident","_handlerFb","_stack","loopPosition","fallThrough","registerHandler","handlerList","handlerIndex","clearHandler","setHandlerFallback","unhook","hook","put","utf32ToString","success","handlerResult","EMPTY_PARAMS","Params","addParam","_handler","_params","_hitLimit","ret","TransitionTable","setDefault","next","addMany","codes","NON_ASCII_PRINTABLE","VT500_TRANSITION_TABLE","blueprint","apply","unused","PRINTABLES","EXECUTABLES","states","_transitions","handlers","handlerPos","transition","chunkPos","initialState","currentState","_collect","_printHandlerFb","_executeHandlerFb","_csiHandlerFb","_escHandlerFb","_errorHandlerFb","_printHandler","_executeHandlers","_csiHandlers","_escHandlers","_oscParser","OscParser","_dcsParser","DcsParser","_errorHandler","_identifier","finalRange","intermediate","finalCode","reverse","clearPrintHandler","clearEscHandler","clearExecuteHandler","clearCsiHandler","clearDcsHandler","clearOscHandler","clearErrorHandler","collect","abort","addSubParam","addDigit","handlersEsc","jj","_state","_put","MAX_VALUE","fromArray","k","maxSubParamsLength","Int32Array","_subParams","_subParamsLength","_subParamsIdx","Uint16Array","_rejectDigits","_rejectSubDigits","_digitIsSub","newParams","getSubParamsAll","store","cur","_addons","instance","loadAddon","loadedAddon","_wrappedAddonDispose","_buffer","init","baseY","getLine","BufferLineApiView","_line","getCell","startColumn","endColumn","BufferNamespaceApi","_core","_onBufferChange","onBufferChange","BufferApiView","_alternate","alternate","addCsiHandler","addDcsHandler","addEscHandler","addOscHandler","provider","versions","activeVersion","isUserScrolling","_cachedBlankLine","topRow","bottomRow","willBufferBeTrimmed","oldYdisp","glevel","_charsets","DEFAULT_PROTOCOLS","NONE","restrict","X10","VT200","DRAG","ANY","eventCode","isSGR","S","DEFAULT_ENCODINGS","DEFAULT","SGR","SGR_PIXELS","_protocols","_encodings","_activeProtocol","_activeEncoding","_lastEvent","_onProtocolChange","name","addProtocol","addEncoding","encoding","_equalEvents","report","triggerBinaryEvent","down","up","drag","move","e1","e2","pixels","DEFAULT_MODES","DEFAULT_DEC_PRIVATE_MODES","_onUserInput","_onRequestScrollToBottom","disableStdin","$xmin","$xmax","_decorations","SortedList","_onDecorationRegistered","_onDecorationRemoved","Decoration","markerDispose","listener","getDecorationsAtCell","xmin","xmax","DisposableStore","_cachedBg","_cachedFg","foregroundColor","ServiceCollection","_entries","service","_services","getService","ctor","args","serviceDependencies","getServiceDependencies","serviceArgs","dependency","firstServiceArgPos","logger","traceLogger","_target","descriptor","fn","TRACE","trace","JSON","stringify","optionsKeyToLogLevel","info","INFO","ERROR","off","OFF","_logLevel","_updateLogLevel","_evalLazyOptionalParams","optionalParams","_log","message","log","DEFAULT_OPTIONS","customGlyphs","fastScrollModifier","allowProposedApi","allowTransparency","rescaleOverlappingGlyphs","FONT_WEIGHT_OPTIONS","_onOptionChange","defaultOptions","_sanitizeAndValidateOption","_setupOptions","eventKey","getter","propName","setter","desc","defineProperty","isCursorStyle","_entriesWithId","_dataByLinkId","_removeMarkerFromLink","castData","_getEntryIdKey","linkId","every","linkData","DI_DEPENDENCIES","serviceRegistry","decorator","arguments","DI_TARGET","storeServiceDependency","extractCharKind","_providers","_onChange","onChange","defaultProvider","UnicodeV6","_activeProvider","getStringCellWidth","precedingInfo","isAndroid","isElectron","isWebkitWebView","isChrome","isWebKit","onDidChangeFullscreen","onDidChangeZoomLevel","addMatchMediaChangeListener","setZoomLevel","zoomLevel","targetWindow","WindowManager","INSTANCE","getZoomLevel","getZoomFactor","setZoomFactor","zoomFactor","setFullscreen","fullscreen","isFullscreen","isStandalone","standalone","isWCOEnabled","windowControlsOverlay","visible","getWCOBoundingRect","getTitlebarAreaRect","window_1","event_1","mapWindowIdToZoomLevel","_onDidChangeZoomLevel","mapWindowIdToZoomFactor","_onDidChangeFullscreen","mapWindowIdToFullScreen","getWindowId","targetWindowId","windowId","vscodeWindowId","query","mainWindow","standaloneMatchMedia","fullScreenMatchMedia","matches","__createBinding","o","k2","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","__setModuleDefault","__importStar","hasOwnProperty","BrowserFeatures","KeyboardSupport","safeNavigator","clipboard","writeText","isNative","queryCommandSupported","readText","keyboard","Always","FullScreen","None","touch","maxTouchPoints","pointerEvents","PointerEvent","_a","SafeTriangle","DragAndDropObserver","ModifierKeyEmitter","DetectedFullscreenMode","Namespace","EventHelper","EventType","sharedMutationObserver","Dimension","WindowIntervalTimer","runAtThisOrScheduleAtNextAnimationFrame","WindowIdleValue","addStandardDisposableGenericMouseUpListener","addStandardDisposableGenericMouseDownListener","addStandardDisposableListener","onDidUnregisterWindow","onWillUnregisterWindow","onDidRegisterWindow","hasWindow","getWindowById","getWindowsCount","getWindows","getDocument","getWindow","registerWindow","clearNode","firstChild","clearNodeRecursively","domNode","addDisposableGenericMouseDownListener","addDisposableGenericMouseMoveListener","useCapture","isIOS","canIUse_1","POINTER_MOVE","MOUSE_MOVE","addDisposableGenericMouseUpListener","runWhenWindowIdle","timeout","async_1","_runWhenIdle","disposableWindowInterval","interval","iterations","iteration","timer","lifecycle_1","modify","addDisposableThrottledListener","eventMerger","minimumTimeMs","TimeoutThrottledDomListener","getClientArea","elWindow","elDocument","body","clientWidth","visualViewport","innerHeight","documentElement","getTopLeftOffset","getDomNodePagePosition","bb","scrollX","scrollY","getDomNodeZoomLevel","testElement","zoom","elementZoomLevel","getTotalWidth","getContentWidth","border","SizeUtils","getBorderLeftWidth","getBorderRightWidth","getPaddingLeft","getPaddingRight","getTotalScrollWidth","getContentHeight","getBorderTopWidth","getBorderBottomWidth","getPaddingTop","getPaddingBottom","getTotalHeight","margin","getMarginTop","getMarginBottom","getLargestChildWidth","childWidths","child","elementPosition","parentPosition","getRelativeLeft","isAncestor","setParentFlowTo","fromChildElement","toParentElement","dataset","parentFlowToDataKey","isAncestorUsingFlowTo","testChild","testAncestor","isHTMLElement","flowToParentElement","getParentFlowToElement","findParentWithClass","hasParentWithClass","clazz","stopAtClazzOrNode","isShadowRoot","isInShadowDOM","getShadowRoot","getActiveElement","isActiveElement","isAncestorOfActiveElement","ancestor","isActiveDocument","getActiveDocument","getActiveWindow","isGlobalStylesheet","globalStylesheets","createStyleSheet2","WrappedStyleElement","createStyleSheet","cloneGlobalStylesheets","globalStylesheet","clonedGlobalStylesheets","cloneGlobalStyleSheet","createMetaElement","container","head","createHeadElement","createLinkElement","createCSSRule","selector","cssText","getSharedStyleSheet","sheet","insertRule","clonedGlobalStylesheet","removeCSSRulesContainingSelector","ruleName","rules","getDynamicStyleSheetRules","toDelete","rule","isCSSStyleRule","selectorText","deleteRule","isHTMLAnchorElement","HTMLAnchorElement","isHTMLSpanElement","HTMLSpanElement","isHTMLTextAreaElement","HTMLTextAreaElement","isHTMLInputElement","HTMLInputElement","isHTMLButtonElement","HTMLButtonElement","isHTMLDivElement","HTMLDivElement","isSVGElement","SVGElement","isMouseEvent","MouseEvent","isKeyboardEvent","KeyboardEvent","isPointerEvent","isDragEvent","DragEvent","isEventLike","candidate","saveParentsScrollTop","nodeType","ELEMENT_NODE","restoreParentsScrollTop","trackFocus","FocusTracker","after","sibling","append","prepend","$","nodes","separator","cloneNode","createTextNode","setVisibility","show","hide","removeTabIndexAndUpdateFocus","hasAttribute","activeElement","parentFocusable","findParentWithAttribute","removeAttribute","finalHandler","domContentLoaded","readyState","computeScreenAwareSize","cssPx","screenPx","windowOpenNoOpener","url","windowOpenPopup","screenLeft","popupWidth","screenTop","popupHeight","windowOpenWithSuccess","noOpener","newTab","animate","step","stepDisposable","asCSSPropertyValue","asCssValueWithDefault","cssPropertyValue","dflt","variableMatch","varArguments","detectFullscreen","fullscreenElement","webkitFullscreenElement","webkitIsFullScreen","DOCUMENT","guess","screen","BROWSER","isMacintosh","outerHeight","multibyteAwareBtoa","btoa","codeUnits","binary","uint8array","toBinary","getCookieValue","cookie","h","tag","attributes","H_REGEX","groups","tagName","classNames","cssKey","cssValue","setProperty","camelCaseToHyphenCase","svgElem","createElementNS","copyAttributes","trackAttributes","from","to","filter","attributeFilter","mutations","mutation","attributeName","copyAttribute","keyboardEvent_1","mouseEvent_1","errors_1","keyCodes_1","hash_1","numbers_1","windows","ensureCodeWindow","mainWindowRegistration","registeredWindow","BEFORE_UNLOAD","fallbackToMain","candidateNode","candidateEvent","view","DomListener","_node","_type","_options","useCaptureOrOptions","_wrapAsStandardMouseEvent","StandardMouseEvent","POINTER_DOWN","MOUSE_DOWN","POINTER_UP","MOUSE_UP","wrapHandler","StandardKeyboardEvent","_wrapAsStandardKeyboardEvent","AbstractIdleValue","executor","IntervalTimer","defaultTarget","cancelAndSet","runner","AnimationFrameQueueItem","priority","_runner","_canceled","execute","onUnexpectedError","NEXT_QUEUE","CURRENT_QUEUE","animFrameRequested","inAnimationFrameRunner","item","nextQueue","currentQueue","animationFrameRunner","DEFAULT_EVENT_MERGER","lastEvent","currentEvent","lastHandlerTime","TimeoutTimer","invokeHandler","getTime","elapsedTime","setIfNotSet","convertToPixels","getDimension","cssPropertyName","jsPropertyName","computedStyle","getMarginLeft","getMarginRight","is","lift","equals","offsetParent","offsetTop","offsetLeft","scrollWidth","Boolean","flowToParentId","getElementById","host","shadowRoot","_currentCssStyle","_styleSheet","setStyle","cssStyle","beforeAppend","disposableStore","media","globalStylesheetClones","cloneDisposable","cssRules","childList","mutationObservers","mutationObserversPerTarget","optionsHash","hash","mutationObserverPerOptions","users","onDidMutate","MutationObserver","resolvedMutationObserverPerOptions","_sharedStyleSheet","HTMLElement","CLICK","AUXCLICK","DBLCLICK","MOUSE_OVER","MOUSE_OUT","MOUSE_ENTER","MOUSE_LEAVE","MOUSE_WHEEL","POINTER_LEAVE","CONTEXT_MENU","WHEEL","KEY_DOWN","KEY_PRESS","KEY_UP","LOAD","UNLOAD","PAGE_SHOW","PAGE_HIDE","PASTE","ABORT","RESIZE","SCROLL","FULLSCREEN_CHANGE","WK_FULLSCREEN_CHANGE","SELECT","CHANGE","SUBMIT","RESET","FOCUS","FOCUS_IN","FOCUS_OUT","BLUR","INPUT","STORAGE","DRAG_START","DRAG_ENTER","DRAG_LEAVE","DRAG_OVER","DROP","DRAG_END","ANIMATION_START","ANIMATION_END","ANIMATION_ITERATION","stop","cancelBubble","hasFocusWithin","_onDidFocus","onDidFocus","_onDidBlur","onDidBlur","loosingFocus","_refreshStateHandler","refreshState","SELECTOR_REGEX","_$","namespace","description","HTML","SVG","_subscriptions","_keyStatus","registerListeners","defaultPrevented","KeyCode","Alt","lastKeyPressed","lastKeyReleased","resetKeyStatus","keyStatus","isModifierPressed","doResetKeyStatus","getInstance","callbacks","counter","dragStartTime","onDragStart","onDrag","onDragEnter","onDragOver","onDragLeave","onDragEnd","onDrop","originX","originY","triangles","t","isPointWithinTriangle","FastDomNode","createFastDomNode","_maxWidth","_height","_top","_left","_bottom","_right","_paddingTop","_paddingLeft","_paddingBottom","_paddingRight","_fontFamily","_fontWeight","_fontStyle","_fontFeatureSettings","_fontVariationSettings","_textDecoration","_lineHeight","_letterSpacing","_className","_display","_position","_visibility","_backgroundColor","_layerHint","_contain","_boxShadow","setMaxWidth","maxWidth","numberAsPixels","setWidth","setHeight","setTop","setLeft","setBottom","setRight","setPaddingTop","paddingTop","setPaddingLeft","paddingLeft","setPaddingBottom","paddingBottom","setPaddingRight","paddingRight","setFontFamily","setFontWeight","setFontSize","setFontStyle","setFontFeatureSettings","fontFeatureSettings","setFontVariationSettings","fontVariationSettings","setTextDecoration","setLineHeight","setLetterSpacing","setClassName","toggleClassName","shouldHaveIt","setDisplay","setPosition","visibility","setBackgroundColor","setLayerHinting","layerHint","setBoxShadow","boxShadow","setContain","contain","GlobalPointerMoveMonitor","dom","_hooks","_pointerMoveCallback","_onStopCallback","stopMonitoring","invokeStopCallback","browserEvent","isMonitoring","onStopCallback","startMonitoring","initialElement","pointerId","initialButtons","pointerMoveCallback","eventSource","setPointerCapture","releasePointerCapture","IframeUtils","parentOriginHash","async","parentOrigin","salt","crypto","subtle","strData","arrData","TextEncoder","encode","bytes","hexArray","BigInt","sha256AsBase32","digest","sameOriginWindowChainCache","getParentWindowIfSameOrigin","parentLocation","getSameOriginWindowChain","windowChainCache","WeakRef","iframeElement","frameElement","getPositionOfChildWindowRelativeToAncestorWindow","childWindow","ancestorWindow","windowChain","windowChainEl","windowInChain","deref","boundingRect","printKeyboardEvent","printStandardKeyboardEvent","KeyCodeUtils","keybindings_1","ctrlKeyMod","KeyMod","WinCtrl","CtrlCmd","altKeyMod","shiftKeyMod","Shift","metaKeyMod","source","_standardKeyboardEventBrand","altGraphKey","fromString","PauseBreak","Semicolon","IntlBackslash","Equal","NumpadAdd","NumpadSubtract","Minus","Meta","EVENT_KEY_CODE_MAP","Unknown","extractKeyCode","Ctrl","_asKeybinding","_computeKeybinding","_asKeyCodeChord","_computeKeyCodeChord","toKeyCodeChord","other","KeyCodeChord","StandardWheelEvent","DragMouseEvent","iframe_1","timestamp","leftButton","middleButton","rightButton","pageX","posx","posy","pageY","iframeOffsets","dataTransfer","deltaX","targetNode","srcElement","shouldFactorDPR","chromeVersionMatch","wheelDeltaY","VERTICAL_AXIS","axis","deltaMode","DOM_DELTA_LINE","wheelDeltaX","HORIZONTAL_AXIS","wheelDelta","__decorate","decorators","Reflect","decorate","Gesture","DomUtils","arrays","decorators_1","linkedList_1","Tap","Change","Start","End","Contextmenu","SCROLL_FRICTION","HOLD_DELAY","CLEAR_TAP_COUNT_TIME","dispatched","targets","LinkedList","ignoreTargets","activeTouches","handle","_lastSetTapCountTime","onTouchStart","onTouchEnd","onTouchMove","_store","addTarget","isTouchDevice","markAsSingleton","ignoreTarget","targetTouches","initialTarget","initialTimeStamp","initialPageX","initialPageY","rollingTimestamps","rollingPageX","rollingPageY","evt","newGestureEvent","dispatchEvent","activeTouchCount","changedTouches","holdTime","tail","finalX","finalY","deltaT","dispatchTo","inertia","createEvent","initEvent","tapCount","currentTime","setTapCount","_","t1","vX","dirX","vY","dirY","delta_pos_x","delta_pos_y","stopped","translationX","translationY","memoize","AbstractScrollbar","fastDomNode_1","globalPointerMoveMonitor_1","scrollbarArrow_1","scrollbarVisibilityController_1","widget_1","Widget","_lazyRender","lazyRender","_host","_scrollable","_scrollByPage","scrollByPage","_scrollbarState","scrollbarState","_visibilityController","ScrollbarVisibilityController","extraScrollbarClassName","setIsNeeded","isNeeded","_pointerMoveMonitor","_shouldRender","setDomNode","_domNodePointerDown","_createArrow","arrow","ScrollbarArrow","bgDomNode","_createSlider","slider","_sliderPointerDown","onclick","_onElementSize","visibleSize","setVisibleSize","render","_onElementScrollSize","elementScrollSize","setScrollSize","_onElementScrollPosition","elementScrollPosition","beginReveal","setShouldBeVisible","beginHide","_renderDomNode","getRectangleLargeSize","getRectangleSmallSize","_updateSlider","getSliderSize","getArrowSize","getSliderPosition","_onPointerDown","delegatePointerDown","domTop","getClientRects","sliderStart","sliderStop","pointerPos","_sliderPointerPosition","offsetX","offsetY","domNodePosition","_pointerDownRelativePosition","_setDesiredScrollPositionNow","getDesiredScrollPositionFromOffsetPaged","getDesiredScrollPositionFromOffset","Element","initialPointerPosition","initialPointerOrthogonalPosition","_sliderOrthogonalPointerPosition","initialScrollbarState","pointerMoveData","pointerOrthogonalPosition","pointerOrthogonalDelta","pointerDelta","getDesiredScrollPositionFromDelta","_desiredScrollPosition","desiredScrollPosition","writeScrollPosition","setScrollPositionNow","updateScrollbarSize","scrollbarSize","_updateScrollbarSize","setScrollbarSize","HorizontalScrollbar","abstractScrollbar_1","scrollbarState_1","scrollable_1","scrollDimensions","getScrollDimensions","scrollPosition","getCurrentScrollPosition","ScrollbarState","horizontalHasArrows","arrowSize","ScrollbarVisibility","Hidden","horizontalScrollbarSize","horizontalSliderSize","sliderSize","sliderPosition","largeSize","smallSize","onDidScroll","setOppositeScrollbarSize","DomScrollableElement","ScrollableElement","AbstractScrollableElement","MouseWheelClassifier","browser_1","horizontalScrollbar_1","verticalScrollbar_1","MouseWheelClassifierItem","score","_capacity","_memory","_front","_rear","isPhysicalMouseWheel","remainingInfluence","influence","acceptStandardWheelEvent","pageZoomFactor","accept","previousItem","_computeScore","_isAlmostInt","absDeltaX","absDeltaY","absPreviousDeltaX","absPreviousDeltaY","minDeltaX","minDeltaY","maxDeltaX","maxDeltaY","_onWillScroll","onWillScroll","flipAxes","consumeMouseWheelIfScrollbarIsNeeded","alwaysConsumeMouseWheel","scrollYToX","scrollPredominantAxis","listenOnDomNode","Auto","verticalHasArrows","verticalSliderSize","resolveOptions","_onDidScroll","scrollbarHost","onMouseWheel","mouseWheelEvent","_onMouseWheel","_onDragStart","_onDragEnd","_verticalScrollbar","VerticalScrollbar","_horizontalScrollbar","_domNode","_leftShadowDomNode","_topShadowDomNode","_topLeftShadowDomNode","_listenOnDomNode","_mouseWheelToDispose","_setListeningToMouseWheel","onmouseover","_onMouseOver","onmouseleave","_onMouseLeave","_hideTimeout","_isDragging","_mouseIsOver","_revealOnScroll","getOverviewRulerLayoutInfo","delegateVerticalScrollbarPointerDown","updateClassName","newClassName","newOptions","_render","setRevealOnScroll","delegateScrollFromMouseWheelEvent","shouldListen","classifier","didScroll","shiftConvert","futureScrollPosition","getFutureScrollPosition","deltaScrollTop","desiredScrollTop","deltaScrollLeft","desiredScrollLeft","validateScrollPosition","setScrollPositionSmooth","consumeMouseWheel","_reveal","renderNow","scrollState","enableTop","enableLeft","leftClassName","topClassName","topLeftClassName","_hide","_scheduleHide","scrollTopChanged","scrollLeftChanged","scanDomNode","ARROW_IMG_SIZE","_onActivate","onActivate","bgWidth","bgHeight","_arrowPointerDown","_pointerdownRepeatTimer","_pointerdownScheduleRepeatTimer","oppositeScrollbarSize","scrollSize","_scrollbarSize","_oppositeScrollbarSize","_arrowSize","_visibleSize","_scrollSize","_scrollPosition","_computedAvailableSize","_computedIsNeeded","_computedSliderSize","_computedSliderRatio","_computedSliderPosition","_refreshComputedValues","iVisibleSize","iScrollSize","iScrollPosition","_computeValues","computedAvailableSize","computedRepresentableSize","computedIsNeeded","computedSliderSize","computedSliderRatio","computedSliderPosition","desiredSliderPosition","correctedOffset","visibleClassName","invisibleClassName","_visibleClassName","_invisibleClassName","_isVisible","_isNeeded","_rawShouldBeVisible","_shouldBeVisible","_revealTimer","_updateShouldBeVisible","rawShouldBeVisible","_applyVisibilitySetting","Visible","shouldBeVisible","ensureVisibility","withFadeAway","touch_1","onmousedown","onkeydown","onkeyup","oninput","onblur","onfocus","onchange","ignoreGesture","fallbackWindowId","Permutation","CallbackIterable","ArrayQueue","booleanComparator","numberComparator","CompareResult","array","tail2","arr","one","itemEquals","removeFastWithoutKeepingOrder","binarySearch","comparator","binarySearch2","quickSelect","nth","compare","TypeError","pivotValue","random","higher","pivots","groupBy","currentGroup","groupAdjacentBy","shouldBeGrouped","forEachAdjacent","forEachWithNeighbors","sortedDiff","before","splices","removed","added","topStep","topAsync","batch","token","reject","isCancellationRequested","CancellationError","coalesce","coalesceInPlace","isFalsyOrEmpty","isNonEmptyArray","distinct","keyFn","seen","uniqueFilter","firstOrDefault","notFoundValue","lastOrDefault","commonPrefixLength","arg","indexer","mapper","arrayInsert","insertIndex","insertArr","concat","shuffle","_seed","rand","seed","sin","pushToStart","pushToEnd","pushMany","mapArrayOrNot","asArray","getRandomElement","insertInto","newItems","getActualStartIndex","compareBy","tieBreakComparators","comparators","item1","item2","isNeitherLessOrGreaterThan","neitherLessOrGreaterThan","reverseOrder","arraysFind_1","compareToKey","high","comp","pushSplice","latest","beforeIdx","afterIdx","beforeElement","afterElement","findFirstIdxMonotonousOrArrLen","startIdx","originalLength","newItemsLength","isLessThan","isLessThanOrEqual","isGreaterThan","greaterThan","lessThan","firstIdx","lastIdx","takeWhile","predicate","takeFromEndWhile","endIdx","peek","peekLast","dequeue","removeLast","takeCount","empty","_callback","iterate","mapFn","some","findFirst","findLast","findLastMaxBy","_indexMap","createSortPermutation","compareFn","sortIndices","index1","index2","inverse","inverseIndexMap","findLastIdx","fromIndex","findLastIdxMonotonous","endIdxEx","MonotonousArray","findLastMonotonous","findFirstMonotonous","findFirstIdxMonotonous","findFirstMax","findLastMax","findFirstMin","findMaxIdx","maxIdx","mapFindFirst","mapped","assertInvariants","_findLastMonotonousLastIdx","_prevFindLastPredicate","AsyncIterableSource","CancelableAsyncIterableObject","AsyncIterableObject","LazyStatefulPromise","StatefulPromise","Promises","DeferredPromise","IntervalCounter","TaskSequentializer","GlobalIdleValue","runWhenGlobalIdle","ThrottledWorker","RunOnceWorker","ProcessTimeRunOnceScheduler","RunOnceScheduler","LimitedQueue","Queue","Limiter","AutoOpenBarrier","Barrier","ThrottledDelayer","Delayer","SequencerByKey","Sequencer","Throttler","isThenable","createCancelablePromise","raceCancellation","promise","defaultValue","ref","onCancellationRequested","finally","raceCancellationError","raceCancellablePromises","cancellablePromises","resolvedPromiseIndex","promises","cancellablePromise","raceTimeout","onTimeout","promiseResolve","asPromise","promiseWithResolvers","disposableTimeout","deleteAndLeak","promiseFactories","results","thenHandler","shouldStop","loop","firstParallel","promiseList","todo","finish","retry","delay","retries","lastError","createCancelableAsyncIterable","cancellation_1","CancellationTokenSource","innerIterable","emitter","subscription","emitOne","platform_1","symbols_1","lazy_1","thenable","onfinally","activePromise","queuedPromise","queuedPromiseFactory","queue","promiseFactory","onComplete","promiseTask","promiseMap","newPromise","defaultDelay","deferred","completionPromise","doResolve","doReject","trigger","cancelTimeout","MicrotaskDelay","scheduled","isTriggered","microtaskDeferred","timeoutDeferred","delayer","throttler","_isOpen","_promise","_completePromise","isOpen","wait","millis","autoOpenTimeMs","_timeout","maxDegreeOfParalellism","_size","_isDisposed","outstandingPromises","runningPromises","_onDrained","whenIdle","toPromise","onDrained","consume","iLimitedTask","consumed","sequentializer","tasks","isRunning","run","_token","BugIndicatingError","context","timeoutToken","timeoutHandler","isScheduled","schedule","doRun","intervalToken","intervalHandler","onInterval","units","work","unit","pendingWork","disposed","pending","maxBufferedWork","maxWorkChunkSize","doWork","throttleDelay","_targetWindow","setTimeout0","didTimeout","_didRun","_executor","_value","_error","_handle","isInitialized","taskId","_running","running","cancelRunning","onCancel","doneRunning","runQueued","_queued","queued","promiseReject","hasQueued","DeferredOutcome","AsyncIterableSourceState","nowFn","lastIncrementTime","increment","isRejected","outcome","Rejected","isResolved","Resolved","isSettled","completeCallback","errorCallback","complete","settled","firstError","all","withAsyncBody","bodyFn","_isResolved","requireValue","_compute","Lazy","getPromise","currentValue","rawValue","writer","emitMany","fromPromise","fromPromises","merge","iterables","iterable","EMPTY","onReturn","Initial","_results","_onReturn","_onStateChanged","Symbol","asyncIterator","DoneError","done","DoneOK","return","filterFn","_source","earlyError","earlyItems","_deferred","_asyncIterable","_errorFn","_emitFn","asyncIterable","CancellationToken","cancelOnDispose","shortcutEvent","isCancellationToken","thing","Cancelled","MutableToken","_isCancelled","_emitter","_parentListener","CharCode","SetWithKey","groupFn","diffSets","diffMaps","intersection","setA","setB","elem","toStringTag","toKey","_map","callbackfn","thisArg","iterator","fnKey","memoizeKey","debounce","reducer","initialValueProvider","timerKey","resultKey","throttle","lastRunKey","pendingKey","nextTime","ErrorNoTelemetry","ExpectedError","NotSupportedError","NotImplementedError","ReadonlyError","errorHandler","ErrorHandler","setUnexpectedErrorHandler","newUnexpectedErrorHandler","isSigPipeError","cast","syscall","isCancellationError","onUnexpectedExternalError","transformErrorForSerialization","$isError","stack","stacktrace","noTelemetry","isErrorNoTelemetry","transformErrorFromSerialization","canceled","canceledName","illegalArgument","illegalState","getErrorMessage","listeners","unexpectedErrorHandler","_removeListener","emit","getUnexpectedErrorHandler","isExpected","msg","fromError","setPrototypeOf","ValueWithChangeEvent","Relay","EventBufferer","DynamicListEventMultiplexer","EventMultiplexer","MicrotaskEmitter","DebounceEmitter","PauseableEmitter","AsyncEmitter","createEventDeliveryQueue","ListenerRefusalError","ListenerLeakError","EventProfiling","setGlobalLeakWarningThreshold","_globalLeakWarningThreshold","functional_1","stopwatch_1","once","thisArgs","didFire","snapshot","onWillAddFirstListener","onDidRemoveLastListener","leading","flushOnListenerRemove","leakWarningThreshold","output","doFire","numDebouncedCalls","_output","onWillRemoveListener","defer","each","signal","any","combinedDisposable","initial","accumulate","latch","firstCall","shouldEmit","isT","flushAfterTimeout","onDidAddFirstListener","chain","sythensize","ChainableSynthesis","evaluate","HaltChainable","steps","fromNodeEventEmitter","eventName","on","fromDOMEventEmitter","EmitterObserver","_observable","_counter","_hasChanged","addObserver","removeObserver","beginUpdate","handlePossibleChange","handleChange","_change","endUpdate","reportChanges","fromObservable","obs","fromObservableLight","observable","didChange","_idPool","listenerCount","invocationCount","elapsedOverall","durations","_stopWatch","StopWatch","LeakageMonitor","_warnCountdown","_stacks","check","topStack","topCount","getMostFrequentStack","Stacktrace","UniqueContainer","_leakageMon","onListenerError","_perfMon","_profName","_deliveryQueue","deliveryQueue","_disposed","_listeners","_event","tuple","contained","removeMonitor","EventDeliveryQueuePrivate","adjustDeliveryQueue","_deliver","_deliverQueue","dq","hasListeners","fireAsync","promiseJoin","_asyncDeliveryQueue","forEachListener","thenables","waitUntil","isFrozen","allSettled","status","reason","isPaused","_eventQueue","_mergeFn","pause","resume","_delay","_queuedEvents","onFirstListenerAdd","onLastListenerRemove","createSingleCallFunction","onAddItem","onRemoveItem","getEvent","multiplexer","itemListeners","DisposableMap","addItem","deleteAndDispose","wrapEvent","reduceData","reducedResult","bufferEvents","listening","inputEvent","inputEventListener","ConstValueWithChangeEvent","_onDidChange","onDidChange","fnDidRunCallback","_this","didCall","StringSHA1","Hasher","doHash","numberHash","stringHash","toHexString","strings","hashVal","initialHashVal","objectHash","booleanHash","SHA1Constant","leftRotate","totalBits","dest","bufferOrValue","bitsize","ArrayBuffer","leftPad","_bigBlock32","DataView","_h0","_h1","_h2","_h3","_h4","_buff","BLOCK_SIZE","_buffDV","_buffLen","_totalLen","_leftoverHighSurrogate","_finished","strLen","buff","buffLen","leftoverHighSurrogate","isHighSurrogate","nextCharCode","isLowSurrogate","computeCodePoint","UNICODE_REPLACEMENT","_push","_step","_wrapUp","ml","setUint32","bigBlock32","getUint32","Iterable","_empty","single","wrap","iterableOrElement","flatMap","initialValue","atMost","POSITIVE_INFINITY","asyncToArray","ScanCode","ScanCodeUtils","NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE","KeyChord","firstPart","secondPart","KeyCodeStrMap","_keyCodeToStr","_strToKeyCode","keyCodeToStr","strToKeyCode","uiMap","userSettingsUSMap","userSettingsGeneralMap","scanCodeIntToStr","scanCodeStrToInt","scanCodeLowerCaseStrToInt","lowerCaseToEnum","scanCode","toEnum","toUserSettingsUS","toUserSettingsGeneral","fromUserSettings","toElectronAccelerator","Numpad0","NumpadDivide","UpArrow","DownArrow","LeftArrow","RightArrow","ResolvedKeybinding","ResolvedChord","Keybinding","ScanCodeChord","decodeKeybinding","keybinding","OS","firstChord","secondChord","createSimpleKeybinding","chords","BinaryKeybindingsMask","ctrlCmd","winCtrl","OperatingSystem","Macintosh","getHashCode","isModifierKey","toKeybinding","isDuplicateModifierCase","ControlLeft","ControlRight","ShiftLeft","ShiftRight","AltLeft","AltRight","MetaLeft","MetaRight","keyLabel","keyAriaLabel","hasValue","ImmortalReference","AsyncReferenceCollection","ReferenceCollection","SafeDisposable","RefCountedDisposable","MandatoryMutableDisposable","DisposableTracker","setDisposableTracker","tracker","disposableTracker","trackDisposable","markAsDisposed","singleton","isDisposable","disposeIfDisposable","setParent","setParentOfDisposables","disposeOnReturn","arrays_1","collections_1","map_1","iterator_1","livingDisposables","getDisposableData","isSingleton","getRootParent","cacheValue","getTrackedDisposables","rootParentCache","computeLeakingDisposables","maxReported","preComputedLeaks","uncoveredLeakingObjs","leakingObjects","leakingObjsSet","getStackTracePath","leaking","linesToRemove","regexp","removePrefix","stackTraceStarts","SetMap","stackTracePath","stackTraceFormattedLines","prevStarts","continuations","cont","leaks","details","setParentOfDisposable","errors","AggregateError","DISABLE_DISPOSED_WARNING","_toDispose","clearAndLeak","_disposable","acquire","release","unset","isset","references","reference","object","createReferencedObject","destroyReferencedObject","referenceCollection","clearAndDisposeAll","skipDisposeOnOverwrite","Undefined","prev","_first","_last","_insert","atTheEnd","newNode","oldLast","oldFirst","didRemove","_remove","Touch","BidirectionalMap","CounterSet","getOrSet","mapToString","setToString","mapsStrictEqualIgnoreOrder","_m1","_m2","getKey","SlidingWindowAverage","MovingAverage","Counter","clamp","rot","modulo","ax","ay","bx","by","cx","cy","v0x","v0y","v1x","v1y","v2x","v2y","dot00","dot01","dot02","dot11","dot12","invDenom","u","_next","getNext","_n","_val","_values","_index","_sum","isEdge","setTimeout0IsFaster","translationsConfigFile","platformLocale","locale","Language","language","isCI","isMobile","webWorkerOrigin","isWebWorker","isWeb","isLinuxSnap","Platform","LANGUAGE_DEFAULT","PlatformToString","Web","Mac","Linux","Windows","isLittleEndian","_isLittleEndianComputed","_isLittleEndian","isBigSurOrNewer","osVersion","_locale","_translationsConfigFile","_userAgent","_isWindows","_isMacintosh","_isLinux","_isLinuxSnap","_isNative","_isWeb","_isElectron","_isIOS","_isCI","_isMobile","_language","_platformLocale","$globalThis","nodeProcess","vscode","isElectronProcess","electron","isElectronRenderer","env","rawNlsConfig","nlsConfig","userLocale","osLocale","resolvedLanguage","languagePack","_VSCODE_NLS_LANGUAGE","_platform","importScripts","isDefaultVariant","isDefault","postMessage","vscodeScheduleAsyncWork","lastId","myId","SmoothScrollingOperation","SmoothScrollingUpdate","ScrollState","_forceIntegerValues","_scrollStateBrand","rawScrollLeft","rawScrollTop","withScrollDimensions","useRawScrollPositions","withScrollPosition","createScrollEvent","previous","inSmoothScrolling","widthChanged","scrollWidthChanged","heightChanged","scrollHeightChanged","oldScrollWidth","oldScrollLeft","oldHeight","oldScrollHeight","oldScrollTop","_scrollableBrand","_smoothScrollDuration","_scheduleAtNextAnimationFrame","_smoothScrolling","newState","_setState","acceptScrollDimensions","validTarget","newSmoothScrolling","combine","animationFrameDisposable","_performSmoothScrolling","hasPendingScrollAnimation","tick","isDone","oldState","createEaseOutCubic","completion","_initAnimations","_initAnimation","viewportSize","stop1","stop2","cut","_tick","newScrollLeft","newScrollTop","hasPerformanceNow","performance","highResolution","_now","_startTime","_stopTime","noBreakWhitespace","CodePointIterator","isFalsyOrWhitespace","format","_formatRegexp","group","format2","template","_format2Regexp","htmlAttributeEncodeValue","escape","html","escapeRegExpCharacters","substr","truncate","suffix","truncateMiddle","prefixLength","suffixLength","haystack","needle","rtrim","ltrim","convertSimple2RegExpPattern","pattern","stripWildcards","createRegExp","searchString","isRegex","wholeWord","global","matchCase","multiline","unicode","regExpLeadsToEndlessLoop","lastIndex","splitLines","splitLinesIncludeSeparators","linesWithSeparators","splitLinesAndSeparators","firstNonWhitespaceIndex","chCode","charCode_1","Space","Tab","getLeadingWhitespace","lastNonWhitespaceIndex","replaceAsync","search","replacer","parts","matchAll","compareSubstring","compareIgnoreCase","compareSubstringIgnoreCase","isAsciiDigit","Digit0","Digit9","isLowerAsciiLetter","isUpperAsciiLetter","A","Z","equalsIgnoreCase","startsWithIgnoreCase","candidateLength","commonSuffixLength","aLastIndex","bLastIndex","getNextCodePoint","uint_1","needleLen","haystackLen","lastIndexOf","aStart","aEnd","bStart","bEnd","codeA","codeB","aLen","bLen","highSurrogate","lowSurrogate","_offset","_str","_len","setOffset","prevCodePoint","prevCharCode","getPrevCodePoint","Constants","UNICODE_SUPPLEMENTARY_PLANE_BEGIN","nextCodePoint","eol","toUint8","MAX_UINT_8","toUint32","MAX_UINT_32","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","CONSTRUCTOR_ONLY_OPTIONS","$value","Terminal","_addonManager","AddonManager","_publicOptions","_checkReadonlyOptions","_checkProposedApi","parser","ParserApi","UnicodeApi","mouseTrackingMode","applicationCursorKeysMode","applicationKeypadMode","originMode","reverseWraparoundMode","sendFocusMode","_verifyIntegers","_verifyPositiveIntegers","writeln","addon","Infinity"],"sourceRoot":""} \ No newline at end of file diff --git a/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.mjs b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.mjs new file mode 100644 index 0000000..35d9308 --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.mjs @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved. + * @license MIT + * + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * @license MIT + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + */ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var Fs=Object.defineProperty;var xl=Object.getOwnPropertyDescriptor;var wl=(s,t)=>{for(var e in t)Fs(s,e,{get:t[e],enumerable:!0})};var C=(s,t,e,i)=>{for(var r=i>1?void 0:i?xl(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&Fs(t,e,r),r},E=(s,t)=>(e,i)=>t(e,i,s);var Hs="Terminal input",di={get:()=>Hs,set:s=>Hs=s},Ws="Too much output to announce, navigate to rows manually to read",fi={get:()=>Ws,set:s=>Ws=s};function Dl(s){return s.replace(/\r?\n/g,"\r")}function Rl(s,t){return t?"\x1B[200~"+s+"\x1B[201~":s}function Us(s,t){s.clipboardData&&s.clipboardData.setData("text/plain",t.selectionText),s.preventDefault()}function Ks(s,t,e,i){if(s.stopPropagation(),s.clipboardData){let r=s.clipboardData.getData("text/plain");Ln(r,t,e,i)}}function Ln(s,t,e,i){s=Dl(s),s=Rl(s,e.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),e.triggerDataEvent(s,!0),t.value=""}function An(s,t,e){let i=e.getBoundingClientRect(),r=s.clientX-i.left-10,n=s.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function kn(s,t,e,i,r){An(s,t,e),r&&i.rightClickSelect(s),t.value=i.selectionText,t.select()}function Be(s){return s>65535?(s-=65536,String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)}function yt(s,t=0,e=s.length){let i="";for(let r=t;r65535?(n-=65536,i+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):i+=String.fromCharCode(n)}return i}var Zi=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let i=t.length;if(!i)return 0;let r=0,n=0;if(this._interim){let o=t.charCodeAt(n++);56320<=o&&o<=57343?e[r++]=(this._interim-55296)*1024+o-56320+65536:(e[r++]=this._interim,e[r++]=o),this._interim=0}for(let o=n;o=i)return this._interim=l,r;let a=t.charCodeAt(o);56320<=a&&a<=57343?e[r++]=(l-55296)*1024+a-56320+65536:(e[r++]=l,e[r++]=a);continue}l!==65279&&(e[r++]=l)}return r}},Qi=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let i=t.length;if(!i)return 0;let r=0,n,o,l,a,u=0,h=0;if(this.interim[0]){let v=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let f=0,m;for(;(m=this.interim[++f]&63)&&f<4;)p<<=6,p|=m;let A=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=A-f;for(;h=i)return 0;if(m=t[h++],(m&192)!==128){h--,v=!0;break}else this.interim[f++]=m,p<<=6,p|=m&63}v||(A===2?p<128?h--:e[r++]=p:A===3?p<2048||p>=55296&&p<=57343||p===65279||(e[r++]=p):p<65536||p>1114111||(e[r++]=p)),this.interim.fill(0)}let c=i-4,d=h;for(;d=i)return this.interim[0]=n,r;if(o=t[d++],(o&192)!==128){d--;continue}if(u=(n&31)<<6|o&63,u<128){d--;continue}e[r++]=u}else if((n&240)===224){if(d>=i)return this.interim[0]=n,r;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=n,this.interim[1]=o,r;if(l=t[d++],(l&192)!==128){d--;continue}if(u=(n&15)<<12|(o&63)<<6|l&63,u<2048||u>=55296&&u<=57343||u===65279)continue;e[r++]=u}else if((n&248)===240){if(d>=i)return this.interim[0]=n,r;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=n,this.interim[1]=o,r;if(l=t[d++],(l&192)!==128){d--;continue}if(d>=i)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,r;if(a=t[d++],(a&192)!==128){d--;continue}if(u=(n&7)<<18|(o&63)<<12|(l&63)<<6|a&63,u<65536||u>1114111)continue;e[r++]=u}}return r}};var Ji="";var Re=" ";var Le=class s{constructor(){this.fg=0;this.bg=0;this.extended=new tt}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new s;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},tt=class s{constructor(t=0,e=0){this._ext=0;this._urlId=0;this._ext=t,this._urlId=e}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new s(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}};var j=class s extends Le{constructor(){super(...arguments);this.content=0;this.fg=0;this.bg=0;this.extended=new tt;this.combinedData=""}static fromCharData(e){let i=new s;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Be(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let n=e[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(r-55296)*1024+n-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};var zs="di$target",Bn="di$dependencies",On=new Map;function $s(s){return s[Bn]||[]}function ie(s){if(On.has(s))return On.get(s);let t=function(e,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");kl(t,e,r)};return t.toString=()=>s,On.set(s,t),t}function kl(s,t,e){t[zs]===t?t[Bn].push({id:s,index:e}):(t[Bn]=[{id:s,index:e}],t[zs]=t)}var F=ie("BufferService"),er=ie("CoreMouseService"),Fe=ie("CoreService"),Vs=ie("CharsetService"),wt=ie("InstantiationService");var tr=ie("LogService"),W=ie("OptionsService"),ir=ie("OscLinkService"),qs=ie("UnicodeService"),He=ie("DecorationService");var Dt=class{constructor(t,e,i){this._bufferService=t;this._optionsService=e;this._oscLinkService=i}provideLinks(t,e){let i=this._bufferService.buffer.lines.get(t-1);if(!i){e(void 0);return}let r=[],n=this._optionsService.rawOptions.linkHandler,o=new j,l=i.getTrimmedLength(),a=-1,u=-1,h=!1;for(let c=0;cn?n.activate(f,m,v):Cl(f,m),hover:(f,m)=>n?.hover?.(f,m,v),leave:(f,m)=>n?.leave?.(f,m,v)})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=c,a=o.extended.urlId):(u=-1,a=-1)}}e(r)}};Dt=C([E(0,F),E(1,W),E(2,ir)],Dt);function Cl(s,t){if(confirm(`Do you want to navigate to ${t}? + +WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var it=ie("CharSizeService"),le=ie("CoreBrowserService"),Rt=ie("MouseService"),ae=ie("RenderService"),Ys=ie("SelectionService"),rr=ie("CharacterJoinerService"),Ae=ie("ThemeService"),nr=ie("LinkProviderService");var Nn=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?sr.isErrorNoTelemetry(t)?new sr(t.message+` + +`+t.stack):new Error(t.message+` + +`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},Ml=new Nn;function At(s){Pl(s)||Ml.onUnexpectedError(s)}var Fn="Canceled";function Pl(s){return s instanceof pi?!0:s instanceof Error&&s.name===Fn&&s.message===Fn}var pi=class extends Error{constructor(){super(Fn),this.name=this.message}};function js(s){return s?new Error(`Illegal argument: ${s}`):new Error("Illegal argument")}var sr=class s extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof s)return t;let e=new s;return e.message=t.message,e.stack=t.stack,e}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Lt=class s extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,s.prototype)}};function Ol(s,t,e=0,i=s.length){let r=e,n=i;for(;r{function s(a){return a<0}l.isLessThan=s;function t(a){return a<=0}l.isLessThanOrEqual=t;function e(a){return a>0}l.isGreaterThan=e;function i(a){return a===0}l.isNeitherLessOrGreaterThan=i,l.greaterThan=1,l.lessThan=-1,l.neitherLessOrGreaterThan=0})(Qs||={});function Js(s,t){return(e,i)=>t(s(e),s(i))}var eo=(s,t)=>s-t;var kt=class kt{constructor(t){this.iterate=t}forEach(t){this.iterate(e=>(t(e),!0))}toArray(){let t=[];return this.iterate(e=>(t.push(e),!0)),t}filter(t){return new kt(e=>this.iterate(i=>t(i)?e(i):!0))}map(t){return new kt(e=>this.iterate(i=>e(t(i))))}some(t){let e=!1;return this.iterate(i=>(e=t(i),!e)),e}findFirst(t){let e;return this.iterate(i=>t(i)?(e=i,!1):!0),e}findLast(t){let e;return this.iterate(i=>(t(i)&&(e=i),!0)),e}findLastMaxBy(t){let e,i=!0;return this.iterate(r=>((i||Qs.isGreaterThan(t(r,e)))&&(i=!1,e=r),!0)),e}};kt.empty=new kt(t=>{});var Zs=kt;function no(s,t){let e=Object.create(null);for(let i of s){let r=t(i),n=e[r];n||(n=e[r]=[]),n.push(i)}return e}var io,ro,to=class{constructor(t,e){this.toKey=e;this._map=new Map;this[io]="SetWithKey";for(let i of t)this.add(i)}get size(){return this._map.size}add(t){let e=this.toKey(t);return this._map.set(e,t),this}delete(t){return this._map.delete(this.toKey(t))}has(t){return this._map.has(this.toKey(t))}*entries(){for(let t of this._map.values())yield[t,t]}keys(){return this.values()}*values(){for(let t of this._map.values())yield t}clear(){this._map.clear()}forEach(t,e){this._map.forEach(i=>t.call(e,i,i,this))}[(ro=Symbol.iterator,io=Symbol.toStringTag,ro)](){return this.values()}};var lr=class{constructor(){this.map=new Map}add(t,e){let i=this.map.get(t);i||(i=new Set,this.map.set(t,i)),i.add(e)}delete(t,e){let i=this.map.get(t);i&&(i.delete(e),i.size===0&&this.map.delete(t))}forEach(t,e){let i=this.map.get(t);i&&i.forEach(e)}get(t){let e=this.map.get(t);return e||new Set}};function Hn(s,t){let e=this,i=!1,r;return function(){if(i)return r;if(i=!0,t)try{r=s.apply(e,arguments)}finally{t()}else r=s.apply(e,arguments);return r}}var Wn;(N=>{function s(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}N.is=s;let t=Object.freeze([]);function e(){return t}N.empty=e;function*i(I){yield I}N.single=i;function r(I){return s(I)?I:i(I)}N.wrap=r;function n(I){return I||t}N.from=n;function*o(I){for(let L=I.length-1;L>=0;L--)yield I[L]}N.reverse=o;function l(I){return!I||I[Symbol.iterator]().next().done===!0}N.isEmpty=l;function a(I){return I[Symbol.iterator]().next().value}N.first=a;function u(I,L){let P=0;for(let oe of I)if(L(oe,P++))return!0;return!1}N.some=u;function h(I,L){for(let P of I)if(L(P))return P}N.find=h;function*c(I,L){for(let P of I)L(P)&&(yield P)}N.filter=c;function*d(I,L){let P=0;for(let oe of I)yield L(oe,P++)}N.map=d;function*v(I,L){let P=0;for(let oe of I)yield*L(oe,P++)}N.flatMap=v;function*p(...I){for(let L of I)yield*L}N.concat=p;function f(I,L,P){let oe=P;for(let we of I)oe=L(oe,we);return oe}N.reduce=f;function*m(I,L,P=I.length){for(L<0&&(L+=I.length),P<0?P+=I.length:P>I.length&&(P=I.length);Li.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,e){let i;if(e)i=e;else{let a=new Map,u=[...this.livingDisposables.values()].filter(c=>c.source!==null&&!this.getRootParent(c,a).isSingleton);if(u.length===0)return;let h=new Set(u.map(c=>c.value));if(i=u.filter(c=>!(c.parent&&h.has(c.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function r(a){function u(c,d){for(;c.length>0&&d.some(v=>typeof v=="string"?v===c[0]:c[0].match(v));)c.shift()}let h=a.source.split(` +`).map(c=>c.trim().replace("at ","")).filter(c=>c!=="");return u(h,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),h.reverse()}let n=new lr;for(let a of i){let u=r(a);for(let h=0;h<=u.length;h++)n.add(u.slice(0,h).join(` +`),a)}i.sort(Js(a=>a.idx,eo));let o="",l=0;for(let a of i.slice(0,t)){l++;let u=r(a),h=[];for(let c=0;cr(m)[c]),m=>m);delete f[u[c]];for(let[m,A]of Object.entries(f))h.unshift(` - stacktraces of ${A.length} other leaks continue with ${m}`);h.unshift(d)}o+=` + + +==================== Leaking disposable ${l}/${i.length}: ${a.value.constructor.name} ==================== +${h.join(` +`)} +============================================================ + +`}return i.length>t&&(o+=` + + +... and ${i.length-t} more leaking disposables + +`),{leaks:i,details:o}}};ar.idx=0;var so=ar;function Fl(s){ut=s}if(Nl){let s="__is_disposable_tracked__";Fl(new class{trackDisposable(t){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[s]||console.log(e)},3e3)}setParent(t,e){if(t&&t!==y.None)try{t[s]=!0}catch{}}markAsDisposed(t){if(t&&t!==y.None)try{t[s]=!0}catch{}}markAsSingleton(t){}})}function ur(s){return ut?.trackDisposable(s),s}function hr(s){ut?.markAsDisposed(s)}function mi(s,t){ut?.setParent(s,t)}function Hl(s,t){if(ut)for(let e of s)ut.setParent(e,t)}function Un(s){return ut?.markAsSingleton(s),s}function We(s){if(Wn.is(s)){let t=[];for(let e of s)if(e)try{e.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(s)?[]:s}else if(s)return s.dispose(),s}function oo(...s){let t=M(()=>We(s));return Hl(s,t),t}function M(s){let t=ur({dispose:Hn(()=>{hr(t),s()})});return t}var cr=class cr{constructor(){this._toDispose=new Set;this._isDisposed=!1;ur(this)}dispose(){this._isDisposed||(hr(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{We(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return mi(t,this),this._isDisposed?cr.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),mi(t,null))}};cr.DISABLE_DISPOSED_WARNING=!1;var Se=cr,y=class{constructor(){this._store=new Se;ur(this),mi(this._store,this)}dispose(){hr(this),this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};y.None=Object.freeze({dispose(){}});var ye=class{constructor(){this._isDisposed=!1;ur(this)}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),t&&mi(t,this),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,hr(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t&&mi(t,null),t}};var fe=typeof window=="object"?window:globalThis;var Ct=class Ct{constructor(t){this.element=t,this.next=Ct.Undefined,this.prev=Ct.Undefined}};Ct.Undefined=new Ct(void 0);var $=Ct,Mt=class{constructor(){this._first=$.Undefined;this._last=$.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===$.Undefined}clear(){let t=this._first;for(;t!==$.Undefined;){let e=t.next;t.prev=$.Undefined,t.next=$.Undefined,t=e}this._first=$.Undefined,this._last=$.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let i=new $(t);if(this._first===$.Undefined)this._first=i,this._last=i;else if(e){let n=this._last;this._last=i,i.prev=n,n.next=i}else{let n=this._first;this._first=i,i.next=n,n.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==$.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==$.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==$.Undefined&&t.next!==$.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===$.Undefined&&t.next===$.Undefined?(this._first=$.Undefined,this._last=$.Undefined):t.next===$.Undefined?(this._last=this._last.prev,this._last.next=$.Undefined):t.prev===$.Undefined&&(this._first=this._first.next,this._first.prev=$.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==$.Undefined;)yield t.element,t=t.next}};var Wl=globalThis.performance&&typeof globalThis.performance.now=="function",dr=class s{static create(t){return new s(t)}constructor(t){this._now=Wl&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var Ul=!1,lo=!1,Kl=!1,V;(Ne=>{Ne.None=()=>y.None;function t(w){if(Kl){let{onDidAddListener:T}=w,_=_i.create(),x=0;w.onDidAddListener=()=>{++x===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),_.print()),T?.()}}}function e(w,T){return d(w,()=>{},0,void 0,!0,void 0,T)}Ne.defer=e;function i(w){return(T,_=null,x)=>{let S=!1,k;return k=w(B=>{if(!S)return k?k.dispose():S=!0,T.call(_,B)},null,x),S&&k.dispose(),k}}Ne.once=i;function r(w,T,_){return h((x,S=null,k)=>w(B=>x.call(S,T(B)),null,k),_)}Ne.map=r;function n(w,T,_){return h((x,S=null,k)=>w(B=>{T(B),x.call(S,B)},null,k),_)}Ne.forEach=n;function o(w,T,_){return h((x,S=null,k)=>w(B=>T(B)&&x.call(S,B),null,k),_)}Ne.filter=o;function l(w){return w}Ne.signal=l;function a(...w){return(T,_=null,x)=>{let S=oo(...w.map(k=>k(B=>T.call(_,B))));return c(S,x)}}Ne.any=a;function u(w,T,_,x){let S=_;return r(w,k=>(S=T(S,k),S),x)}Ne.reduce=u;function h(w,T){let _,x={onWillAddFirstListener(){_=w(S.fire,S)},onDidRemoveLastListener(){_?.dispose()}};T||t(x);let S=new g(x);return T?.add(S),S.event}function c(w,T){return T instanceof Array?T.push(w):T&&T.add(w),w}function d(w,T,_=100,x=!1,S=!1,k,B){let q,H,De,me=0,Oe,Tt={leakWarningThreshold:k,onWillAddFirstListener(){q=w(It=>{me++,H=T(H,It),x&&!De&&(Ie.fire(H),H=void 0),Oe=()=>{let ct=H;H=void 0,De=void 0,(!x||me>1)&&Ie.fire(ct),me=0},typeof _=="number"?(clearTimeout(De),De=setTimeout(Oe,_)):De===void 0&&(De=0,queueMicrotask(Oe))})},onWillRemoveListener(){S&&me>0&&Oe?.()},onDidRemoveLastListener(){Oe=void 0,q.dispose()}};B||t(Tt);let Ie=new g(Tt);return B?.add(Ie),Ie.event}Ne.debounce=d;function v(w,T=0,_){return Ne.debounce(w,(x,S)=>x?(x.push(S),x):[S],T,void 0,!0,void 0,_)}Ne.accumulate=v;function p(w,T=(x,S)=>x===S,_){let x=!0,S;return o(w,k=>{let B=x||!T(k,S);return x=!1,S=k,B},_)}Ne.latch=p;function f(w,T,_){return[Ne.filter(w,T,_),Ne.filter(w,x=>!T(x),_)]}Ne.split=f;function m(w,T=!1,_=[],x){let S=_.slice(),k=w(H=>{S?S.push(H):q.fire(H)});x&&x.add(k);let B=()=>{S?.forEach(H=>q.fire(H)),S=null},q=new g({onWillAddFirstListener(){k||(k=w(H=>q.fire(H)),x&&x.add(k))},onDidAddFirstListener(){S&&(T?setTimeout(B):B())},onDidRemoveLastListener(){k&&k.dispose(),k=null}});return x&&x.add(q),q.event}Ne.buffer=m;function A(w,T){return(x,S,k)=>{let B=T(new N);return w(function(q){let H=B.evaluate(q);H!==D&&x.call(S,H)},void 0,k)}}Ne.chain=A;let D=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push(_=>(T(_),_)),this}filter(T){return this.steps.push(_=>T(_)?_:D),this}reduce(T,_){let x=_;return this.steps.push(S=>(x=T(x,S),x)),this}latch(T=(_,x)=>_===x){let _=!0,x;return this.steps.push(S=>{let k=_||!T(S,x);return _=!1,x=S,k?S:D}),this}evaluate(T){for(let _ of this.steps)if(T=_(T),T===D)break;return T}}function I(w,T,_=x=>x){let x=(...q)=>B.fire(_(...q)),S=()=>w.on(T,x),k=()=>w.removeListener(T,x),B=new g({onWillAddFirstListener:S,onDidRemoveLastListener:k});return B.event}Ne.fromNodeEventEmitter=I;function L(w,T,_=x=>x){let x=(...q)=>B.fire(_(...q)),S=()=>w.addEventListener(T,x),k=()=>w.removeEventListener(T,x),B=new g({onWillAddFirstListener:S,onDidRemoveLastListener:k});return B.event}Ne.fromDOMEventEmitter=L;function P(w){return new Promise(T=>i(w)(T))}Ne.toPromise=P;function oe(w){let T=new g;return w.then(_=>{T.fire(_)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}Ne.fromPromise=oe;function we(w,T){return w(_=>T.fire(_))}Ne.forward=we;function Pe(w,T,_){return T(_),w(x=>T(x))}Ne.runAndSubscribe=Pe;class z{constructor(T,_){this._observable=T;this._counter=0;this._hasChanged=!1;let x={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};_||t(x),this.emitter=new g(x),_&&_.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,_){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Xi(w,T){return new z(w,T).emitter.event}Ne.fromObservable=Xi;function de(w){return(T,_,x)=>{let S=0,k=!1,B={beginUpdate(){S++},endUpdate(){S--,S===0&&(w.reportChanges(),k&&(k=!1,T.call(_)))},handlePossibleChange(){},handleChange(){k=!0}};w.addObserver(B),w.reportChanges();let q={dispose(){w.removeObserver(B)}};return x instanceof Se?x.add(q):Array.isArray(x)&&x.push(q),q}}Ne.fromObservableLight=de})(V||={});var Pt=class Pt{constructor(t){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${t}_${Pt._idPool++}`,Pt.all.add(this)}start(t){this._stopWatch=new dr,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Pt.all=new Set,Pt._idPool=0;var Kn=Pt,ao=-1;var pr=class pr{constructor(t,e,i=(pr._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t;this.threshold=e;this.name=i;this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,e){let i=this.threshold;if(i<=0||e{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,e=0;for(let[i,r]of this._stacks)(!t||e{if(s instanceof Ot)t(s);else for(let e=0;e{s.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(s.join(` +`)),s.length=0)},3e3),fr=new FinalizationRegistry(t=>{typeof t=="string"&&s.push(t)})}var g=class{constructor(t){this._size=0;this._options=t,this._leakageMon=ao>0||this._options?.leakWarningThreshold?new Gn(t?.onListenerError??At,this._options?.leakWarningThreshold??ao):void 0,this._perfMon=this._options?._profName?new Kn(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(lo){let t=this._listeners;queueMicrotask(()=>{$l(t,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(t,e,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],h=new $n(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||At)(h),y.None}if(this._disposed)return y.None;e&&(t=t.bind(e));let r=new Ot(t),n,o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=_i.create(),n=this._leakageMon.check(r.stack,this._size+1)),lo&&(r.stack=o??_i.create()),this._listeners?this._listeners instanceof Ot?(this._deliveryQueue??=new Vn,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=M(()=>{fr?.unregister(l),n?.(),this._removeListener(r)});if(i instanceof Se?i.add(l):Array.isArray(i)&&i.push(l),fr){let a=new Error().stack.split(` +`).slice(2,3).join(` +`).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);fr.register(l,u?.[2]??a,l)}return l},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*zl<=e.length){let n=0;for(let o=0;o0}};var Vn=class{constructor(){this.i=-1;this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var _r=class _r{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new g;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new g;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,e){if(this.getZoomLevel(e)===t)return;let i=this.getWindowId(e);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,e){this.mapWindowIdToZoomFactor.set(this.getWindowId(e),t)}setFullscreen(t,e){if(this.isFullscreen(e)===t)return;let i=this.getWindowId(e);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};_r.INSTANCE=new _r;var bi=_r;function ql(s,t,e){typeof t=="string"&&(t=s.matchMedia(t)),t.addEventListener("change",e)}var bu=bi.INSTANCE.onDidChangeZoomLevel;function co(s){return bi.INSTANCE.getZoomFactor(s)}var vu=bi.INSTANCE.onDidChangeFullscreen,Bt=typeof navigator=="object"?navigator.userAgent:"",vi=Bt.indexOf("Firefox")>=0,Nt=Bt.indexOf("AppleWebKit")>=0,gi=Bt.indexOf("Chrome")>=0,br=!gi&&Bt.indexOf("Safari")>=0;var gu=Bt.indexOf("Electron/")>=0,Su=Bt.indexOf("Android")>=0,mr=!1;if(typeof fe.matchMedia=="function"){let s=fe.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=fe.matchMedia("(display-mode: fullscreen)");mr=s.matches,ql(fe,s,({matches:e})=>{mr&&t.matches||(mr=e)})}function uo(){return mr}var Ft="en",Er=!1,Tr=!1,Si=!1,Yl=!1,fo=!1,po=!1,jl=!1,Xl=!1,Zl=!1,Ql=!1,gr,Sr=Ft,ho=Ft,Jl,Ve,qe=globalThis,xe;typeof qe.vscode<"u"&&typeof qe.vscode.process<"u"?xe=qe.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(xe=process);var mo=typeof xe?.versions?.electron=="string",ea=mo&&xe?.type==="renderer";if(typeof xe=="object"){Er=xe.platform==="win32",Tr=xe.platform==="darwin",Si=xe.platform==="linux",Yl=Si&&!!xe.env.SNAP&&!!xe.env.SNAP_REVISION,jl=mo,Zl=!!xe.env.CI||!!xe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,gr=Ft,Sr=Ft;let s=xe.env.VSCODE_NLS_CONFIG;if(s)try{let t=JSON.parse(s);gr=t.userLocale,ho=t.osLocale,Sr=t.resolvedLanguage||Ft,Jl=t.languagePack?.translationsConfigFile}catch{}fo=!0}else typeof navigator=="object"&&!ea?(Ve=navigator.userAgent,Er=Ve.indexOf("Windows")>=0,Tr=Ve.indexOf("Macintosh")>=0,Xl=(Ve.indexOf("Macintosh")>=0||Ve.indexOf("iPad")>=0||Ve.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Si=Ve.indexOf("Linux")>=0,Ql=Ve?.indexOf("Mobi")>=0,po=!0,Sr=globalThis._VSCODE_NLS_LANGUAGE||Ft,gr=navigator.language.toLowerCase(),ho=gr):console.error("Unable to resolve platform.");var qn=0;Tr?qn=1:Er?qn=3:Si&&(qn=2);var Ir=Er,Ee=Tr,Yn=Si;var yr=fo;var ta=po&&typeof qe.importScripts=="function",Eu=ta?qe.origin:void 0;var Ue=Ve,rt=Sr,ia;(i=>{function s(){return rt}i.value=s;function t(){return rt.length===2?rt==="en":rt.length>=3?rt[0]==="e"&&rt[1]==="n"&&rt[2]==="-":!1}i.isDefaultVariant=t;function e(){return rt==="en"}i.isDefault=e})(ia||={});var ra=typeof qe.postMessage=="function"&&!qe.importScripts,_o=(()=>{if(ra){let s=[];qe.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let i=0,r=s.length;i{let i=++t;s.push({id:i,callback:e}),qe.postMessage({vscodeScheduleAsyncWork:i},"*")}}return s=>setTimeout(s)})();var na=!!(Ue&&Ue.indexOf("Chrome")>=0),Tu=!!(Ue&&Ue.indexOf("Firefox")>=0),Iu=!!(!na&&Ue&&Ue.indexOf("Safari")>=0),yu=!!(Ue&&Ue.indexOf("Edg/")>=0),xu=!!(Ue&&Ue.indexOf("Android")>=0);var nt=typeof navigator=="object"?navigator:{},sa={clipboard:{writeText:yr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(nt&&nt.clipboard&&nt.clipboard.writeText),readText:yr||!!(nt&&nt.clipboard&&nt.clipboard.readText)},keyboard:yr||uo()?0:nt.keyboard||br?1:2,touch:"ontouchstart"in fe||nt.maxTouchPoints>0,pointerEvents:fe.PointerEvent&&("ontouchstart"in fe||navigator.maxTouchPoints>0)};var Ei=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},jn=new Ei,bo=new Ei,vo=new Ei,go=new Array(230);var Xn;(o=>{function s(l){return jn.keyCodeToStr(l)}o.toString=s;function t(l){return jn.strToKeyCode(l)}o.fromString=t;function e(l){return bo.keyCodeToStr(l)}o.toUserSettingsUS=e;function i(l){return vo.keyCodeToStr(l)}o.toUserSettingsGeneral=i;function r(l){return bo.strToKeyCode(l)||vo.strToKeyCode(l)}o.fromUserSettings=r;function n(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return jn.keyCodeToStr(l)}o.toElectronAccelerator=n})(Xn||={});var xr=class s{constructor(t,e,i,r,n){this.ctrlKey=t;this.shiftKey=e;this.altKey=i;this.metaKey=r;this.keyCode=n}equals(t){return t instanceof s&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${e}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Zn([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}};var Zn=class{constructor(t){if(t.length===0)throw js("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e{function s(r){return r===i.None||r===i.Cancelled||r instanceof Qn?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}i.isCancellationToken=s,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:V.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:To})})(da||={});var Qn=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?To:(this._emitter||(this._emitter=new g),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var fa=Symbol("MicrotaskDelay");var je=class{constructor(t,e){this._isDisposed=!1;this._token=-1,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,e){if(this._isDisposed)throw new Lt("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new Lt("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},e))}},Rr=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,e,i=globalThis){if(this.isDisposed)throw new Lt("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{t()},e);this.disposable=M(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};var pa,Dr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Dr=(s,t)=>{_o(()=>{if(e)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let e=!1;return{dispose(){e||(e=!0)}}}:Dr=(s,t,e)=>{let i=s.requestIdleCallback(t,typeof e=="number"?{timeout:e}:void 0),r=!1;return{dispose(){r||(r=!0,s.cancelIdleCallback(i))}}},pa=s=>Dr(globalThis,s)})();var ma;(e=>{async function s(i){let r,n=await Promise.all(i.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}e.settled=s;function t(i){return new Promise(async(r,n)=>{try{await i(r,n)}catch(o){n(o)}})}e.withAsyncBody=t})(ma||={});var _e=class _e{static fromArray(t){return new _e(e=>{e.emitMany(t)})}static fromPromise(t){return new _e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new _e(async e=>{await Promise.all(t.map(async i=>e.emitOne(await i)))})}static merge(t){return new _e(async e=>{await Promise.all(t.map(async i=>{for await(let r of i)e.emitOne(r)}))})}constructor(t,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new g,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,e){return new _e(async i=>{for await(let r of t)i.emitOne(e(r))})}map(t){return _e.map(this,t)}static filter(t,e){return new _e(async i=>{for await(let r of t)e(r)&&i.emitOne(r)})}filter(t){return _e.filter(this,t)}static coalesce(t){return _e.filter(t,e=>!!e)}coalesce(){return _e.coalesce(this)}static async toPromise(t){let e=[];for await(let i of t)e.push(i);return e}toPromise(){return _e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};_e.EMPTY=_e.fromArray([]);var Io=_e;function yo(s){return 55296<=s&&s<=56319}function Jn(s){return 56320<=s&&s<=57343}function xo(s,t){return(s-55296<<10)+(t-56320)+65536}function Ro(s){return ts(s,0)}function ts(s,t){switch(typeof s){case"object":return s===null?Xe(349,t):Array.isArray(s)?va(s,t):ga(s,t);case"string":return Lo(s,t);case"boolean":return ba(s,t);case"number":return Xe(s,t);case"undefined":return Xe(937,t);default:return Xe(617,t)}}function Xe(s,t){return(t<<5)-t+s|0}function ba(s,t){return Xe(s?433:863,t)}function Lo(s,t){t=Xe(149417,t);for(let e=0,i=s.length;ets(i,e),t)}function ga(s,t){return t=Xe(181387,t),Object.keys(s).sort().reduce((e,i)=>(e=Lo(i,e),ts(s[i],e)),t)}function es(s,t,e=32){let i=e-t,r=~((1<>>i)>>>0}function wo(s,t=0,e=s.byteLength,i=0){for(let r=0;re.toString(16).padStart(2,"0")).join(""):Sa((s>>>0).toString(16),t/4)}var Lr=class Lr{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let e=t.length;if(e===0)return;let i=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,l;for(n!==0?(o=n,l=-1,n=0):(o=t.charCodeAt(0),l=0);;){let a=o;if(yo(o))if(l+1>>6,t[e++]=128|(i&63)>>>0):i<65536?(t[e++]=224|(i&61440)>>>12,t[e++]=128|(i&4032)>>>6,t[e++]=128|(i&63)>>>0):(t[e++]=240|(i&1835008)>>>18,t[e++]=128|(i&258048)>>>12,t[e++]=128|(i&4032)>>>6,t[e++]=128|(i&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),e}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Ii(this._h0)+Ii(this._h1)+Ii(this._h2)+Ii(this._h3)+Ii(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,wo(this._buff,this._buffLen),this._buffLen>56&&(this._step(),wo(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=Lr._bigBlock32,e=this._buffDV;for(let c=0;c<64;c+=4)t.setUint32(c,e.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)t.setUint32(c,es(t.getUint32(c-12,!1)^t.getUint32(c-32,!1)^t.getUint32(c-56,!1)^t.getUint32(c-64,!1),1),!1);let i=this._h0,r=this._h1,n=this._h2,o=this._h3,l=this._h4,a,u,h;for(let c=0;c<80;c++)c<20?(a=r&n|~r&o,u=1518500249):c<40?(a=r^n^o,u=1859775393):c<60?(a=r&n|r&o|n&o,u=2400959708):(a=r^n^o,u=3395469782),h=es(i,5)+a+l+u+t.getUint32(c*4,!1)&4294967295,l=o,o=n,n=es(r,30),r=i,i=h;this._h0=this._h0+i&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+l&4294967295}};Lr._bigBlock32=new DataView(new ArrayBuffer(320));var Do=Lr;var{registerWindow:Ch,getWindow:be,getDocument:Mh,getWindows:Ph,getWindowsCount:Oh,getWindowId:Ao,getWindowById:Bh,hasWindow:Nh,onDidRegisterWindow:Co,onWillUnregisterWindow:Fh,onDidUnregisterWindow:Hh}=function(){let s=new Map;fe;let t={window:fe,disposables:new Se};s.set(fe.vscodeWindowId,t);let e=new g,i=new g,r=new g;function n(o,l){return(typeof o=="number"?s.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:e.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(o){if(s.has(o.vscodeWindowId))return y.None;let l=new Se,a={window:o,disposables:l.add(new Se)};return s.set(o.vscodeWindowId,a),l.add(M(()=>{s.delete(o.vscodeWindowId),i.fire(o)})),l.add(R(o,X.BEFORE_UNLOAD,()=>{r.fire(o)})),e.fire(a),l},getWindows(){return s.values()},getWindowsCount(){return s.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return s.has(o)},getWindowById:n,getWindow(o){let l=o;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a?.view?a.view.window:fe},getDocument(o){return be(o).document}}}();var is=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function R(s,t,e,i){return new is(s,t,e,i)}function Ea(s,t){return function(e){return t(new Ye(s,e))}}function Ta(s){return function(t){return s(new ht(t))}}var rs=function(t,e,i,r){let n=i;return e==="click"||e==="mousedown"||e==="contextmenu"?n=Ea(be(t),i):(e==="keydown"||e==="keypress"||e==="keyup")&&(n=Ta(i)),R(t,e,n,r)};var Ia,ft;var Ar=class extends Rr{constructor(t){super(),this.defaultTarget=t&&be(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},yi=class{constructor(t,e=0){this._runner=t,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(t){At(t)}}static sort(t,e){return e.priority-t.priority}};(function(){let s=new Map,t=new Map,e=new Map,i=new Map,r=n=>{e.set(n,!1);let o=s.get(n)??[];for(t.set(n,o),s.set(n,[]),i.set(n,!0);o.length>0;)o.sort(yi.sort),o.shift().execute();i.set(n,!1)};ft=(n,o,l=0)=>{let a=Ao(n),u=new yi(o,l),h=s.get(a);return h||(h=[],s.set(a,h)),h.push(u),e.get(a)||(e.set(a,!0),n.requestAnimationFrame(()=>r(a))),u},Ia=(n,o,l)=>{let a=Ao(n);if(i.get(a)){let u=new yi(o,l),h=t.get(a);return h||(h=[],t.set(a,h)),h.push(u),u}else return ft(n,o,l)}})();var dt=class dt{constructor(t,e){this.width=t;this.height=e}with(t=this.width,e=this.height){return t!==this.width||e!==this.height?new dt(t,e):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof dt?t:new dt(t.width,t.height)}static equals(t,e){return t===e?!0:!t||!e?!1:t.width===e.width&&t.height===e.height}};dt.None=new dt(0,0);var ko=dt;function Mo(s){let t=s.getBoundingClientRect(),e=be(s);return{left:t.left+e.scrollX,top:t.top+e.scrollY,width:t.width,height:t.height}}var Wh=new class{constructor(){this.mutationObservers=new Map}observe(s,t,e){let i=this.mutationObservers.get(s);i||(i=new Map,this.mutationObservers.set(s,i));let r=Ro(e),n=i.get(r);if(n)n.users+=1;else{let o=new g,l=new MutationObserver(u=>o.fire(u));l.observe(s,e);let a=n={users:1,observer:l,onDidMutate:o.event};t.add(M(()=>{a.users-=1,a.users===0&&(o.dispose(),l.disconnect(),i?.delete(r),i?.size===0&&this.mutationObservers.delete(s))})),i.set(r,n)}return n.onDidMutate}};var X={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Nt?"webkitAnimationStart":"animationstart",ANIMATION_END:Nt?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Nt?"webkitAnimationIteration":"animationiteration"};var ya=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Po(s,t,e,...i){let r=ya.exec(t);if(!r)throw new Error("Bad use of emmet");let n=r[1]||"div",o;return s!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(s,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),e&&Object.entries(e).forEach(([l,a])=>{typeof a>"u"||(/^on\w+$/.test(l)?o[l]=a:l==="selected"?a&&o.setAttribute(l,"true"):o.setAttribute(l,a))}),o.append(...i),o}function xa(s,t,...e){return Po("http://www.w3.org/1999/xhtml",s,t,...e)}xa.SVG=function(s,t,...e){return Po("http://www.w3.org/2000/svg",s,t,...e)};var ns=class{constructor(t){this.domNode=t;this._maxWidth="";this._width="";this._height="";this._top="";this._left="";this._bottom="";this._right="";this._paddingTop="";this._paddingLeft="";this._paddingBottom="";this._paddingRight="";this._fontFamily="";this._fontWeight="";this._fontSize="";this._fontStyle="";this._fontFeatureSettings="";this._fontVariationSettings="";this._textDecoration="";this._lineHeight="";this._letterSpacing="";this._className="";this._display="";this._position="";this._visibility="";this._color="";this._backgroundColor="";this._layerHint=!1;this._contain="none";this._boxShadow=""}setMaxWidth(t){let e=Te(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Te(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Te(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Te(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Te(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Te(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Te(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Te(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Te(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Te(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Te(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Te(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Te(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Te(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Te(s){return typeof s=="number"?`${s}px`:s}function pt(s){return new ns(s)}var Ut=class{constructor(){this._hooks=new Se;this._pointerMoveCallback=null;this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(t,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,t&&i&&i(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(t,e,i,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=t;try{t.setPointerCapture(e),this._hooks.add(M(()=>{try{t.releasePointerCapture(e)}catch{}}))}catch{o=be(t)}this._hooks.add(R(o,X.POINTER_MOVE,l=>{if(l.buttons!==i){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(R(o,X.POINTER_UP,l=>this.stopMonitoring(!0)))}};function Oo(s,t,e){let i=null,r=null;if(typeof e.value=="function"?(i="value",r=e.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(i="get",r=e.get),!r)throw new Error("not supported");let n=`$memoize$${t}`;e[i]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var Ke;(n=>(n.Tap="-xterm-gesturetap",n.Change="-xterm-gesturechange",n.Start="-xterm-gesturestart",n.End="-xterm-gesturesend",n.Contextmenu="-xterm-gesturecontextmenu"))(Ke||={});var ee=class ee extends y{constructor(){super();this.dispatched=!1;this.targets=new Mt;this.ignoreTargets=new Mt;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(V.runAndSubscribe(Co,({window:e,disposables:i})=>{i.add(R(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(R(e.document,"touchend",r=>this.onTouchEnd(e,r))),i.add(R(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:fe,disposables:this._store}))}static addTarget(e){if(!ee.isTouchDevice())return y.None;ee.INSTANCE||(ee.INSTANCE=Un(new ee));let i=ee.INSTANCE.targets.push(e);return M(i)}static ignoreTarget(e){if(!ee.isTouchDevice())return y.None;ee.INSTANCE||(ee.INSTANCE=Un(new ee));let i=ee.INSTANCE.ignoreTargets.push(e);return M(i)}static isTouchDevice(){return"ontouchstart"in fe||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,n=e.targetTouches.length;r=ee.HOLD_DELAY&&Math.abs(u.initialPageX-ge(u.rollingPageX))<30&&Math.abs(u.initialPageY-ge(u.rollingPageY))<30){let c=this.newGestureEvent(Ke.Contextmenu,u.initialTarget);c.pageX=ge(u.rollingPageX),c.pageY=ge(u.rollingPageY),this.dispatchEvent(c)}else if(n===1){let c=ge(u.rollingPageX),d=ge(u.rollingPageY),v=ge(u.rollingTimestamps)-u.rollingTimestamps[0],p=c-u.rollingPageX[0],f=d-u.rollingPageY[0],m=[...this.targets].filter(A=>u.initialTarget instanceof Node&&A.contains(u.initialTarget));this.inertia(e,m,r,Math.abs(p)/v,p>0?1:-1,c,Math.abs(f)/v,f>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(Ke.End,u.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(e){if(e.type===Ke.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>ee.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,e.tapCount=r}else(e.type===Ke.Change||e.type===Ke.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let n=0,o=e.initialTarget;for(;o&&o!==r;)n++,o=o.parentElement;i.push([n,r])}i.sort((r,n)=>r[0]-n[0]);for(let[r,n]of i)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,r,n,o,l,a,u,h){this.handle=ft(e,()=>{let c=Date.now(),d=c-r,v=0,p=0,f=!0;n+=ee.SCROLL_FRICTION*d,a+=ee.SCROLL_FRICTION*d,n>0&&(f=!1,v=o*n*d),a>0&&(f=!1,p=u*a*d);let m=this.newGestureEvent(Ke.Change);m.translationX=v,m.translationY=p,i.forEach(A=>A.dispatchEvent(m)),f||this.inertia(e,i,c,n,o,l+v,a,u,h+p)})}onTouchMove(e){let i=Date.now();for(let r=0,n=e.changedTouches.length;r3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(o.pageX),l.rollingPageY.push(o.pageY),l.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};ee.SCROLL_FRICTION=-.005,ee.HOLD_DELAY=700,ee.CLEAR_TAP_COUNT_TIME=400,C([Oo],ee,"isTouchDevice",1);var kr=ee;var st=class extends y{onclick(t,e){this._register(R(t,X.CLICK,i=>e(new Ye(be(t),i))))}onmousedown(t,e){this._register(R(t,X.MOUSE_DOWN,i=>e(new Ye(be(t),i))))}onmouseover(t,e){this._register(R(t,X.MOUSE_OVER,i=>e(new Ye(be(t),i))))}onmouseleave(t,e){this._register(R(t,X.MOUSE_LEAVE,i=>e(new Ye(be(t),i))))}onkeydown(t,e){this._register(R(t,X.KEY_DOWN,i=>e(new ht(i))))}onkeyup(t,e){this._register(R(t,X.KEY_UP,i=>e(new ht(i))))}oninput(t,e){this._register(R(t,X.INPUT,e))}onblur(t,e){this._register(R(t,X.BLUR,e))}onfocus(t,e){this._register(R(t,X.FOCUS,e))}onchange(t,e){this._register(R(t,X.CHANGE,e))}ignoreGesture(t){return kr.ignoreTarget(t)}};var Bo=11,Cr=class extends st{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=Bo+"px",this.domNode.style.height=Bo+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new Ut),this._register(rs(this.bgDomNode,X.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(rs(this.domNode,X.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Ar),this._pointerdownScheduleRepeatTimer=this._register(new je)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,be(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}};var os=class s{constructor(t,e,i,r,n,o,l){this._forceIntegerValues=t;this._scrollStateBrand=void 0;this._forceIntegerValues&&(e=e|0,i=i|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,e<0&&(e=0),r+e>i&&(r=i-e),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=e,this.scrollWidth=i,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,e){return new s(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,e?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,e?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new s(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,e){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:e,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},xi=class extends y{constructor(e){super();this._scrollableBrand=void 0;this._onScroll=this._register(new g);this.onScroll=this._onScroll.event;this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new os(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let r=this._state.withScrollDimensions(e,i);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;i?n=new Pr(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=Pr.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,i)))}},Mr=class{constructor(t,e,i){this.scrollLeft=t,this.scrollTop=e,this.isDone=i}};function ss(s,t){let e=t-s;return function(i){return s+e*Ra(i)}}function wa(s,t,e){return function(i){return i2.5*i){let n,o;return t{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(t){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(t?" fade":"")))}};var La=140,Kt=class extends st{constructor(t){super(),this._lazyRender=t.lazyRender,this._host=t.host,this._scrollable=t.scrollable,this._scrollByPage=t.scrollByPage,this._scrollbarState=t.scrollbarState,this._visibilityController=this._register(new Or(t.visibility,"visible scrollbar "+t.extraScrollbarClassName,"invisible scrollbar "+t.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Ut),this._shouldRender=!0,this.domNode=pt(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(R(this.domNode.domNode,X.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(t){let e=this._register(new Cr(t));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(t,e,i,r){this.slider=pt(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(t),this.slider.setLeft(e),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(R(this.slider.domNode,X.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(t){return this._scrollbarState.setVisibleSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(t){return this._scrollbarState.setScrollSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(t){return this._scrollbarState.setScrollPosition(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(t){t.target===this.domNode.domNode&&this._onPointerDown(t)}delegatePointerDown(t){let e=this.domNode.domNode.getClientRects()[0].top,i=e+this._scrollbarState.getSliderPosition(),r=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(t);i<=n&&n<=r?t.button===0&&(t.preventDefault(),this._sliderPointerDown(t)):this._onPointerDown(t)}_onPointerDown(t){let e,i;if(t.target===this.domNode.domNode&&typeof t.offsetX=="number"&&typeof t.offsetY=="number")e=t.offsetX,i=t.offsetY;else{let n=Mo(this.domNode.domNode);e=t.pageX-n.left,i=t.pageY-n.top}let r=this._pointerDownRelativePosition(e,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),t.button===0&&(t.preventDefault(),this._sliderPointerDown(t))}_sliderPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=this._sliderPointerPosition(t),i=this._sliderOrthogonalPointerPosition(t),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-i);if(Ir&&l>La){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let u=this._sliderPointerPosition(n)-e;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(u))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(t){let e={};this.writeScrollPosition(e,t),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(t){this._updateScrollbarSize(t),this._scrollbarState.setScrollbarSize(t),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};var Gt=class s{constructor(t,e,i,r,n,o){this._scrollbarSize=Math.round(e),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new s(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let e=Math.round(t);return this._visibleSize!==e?(this._visibleSize=e,this._refreshComputedValues(),!0):!1}setScrollSize(t){let e=Math.round(t);return this._scrollSize!==e?(this._scrollSize=e,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let e=Math.round(t);return this._scrollPosition!==e?(this._scrollPosition=e,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,e,i,r,n){let o=Math.max(0,i-t),l=Math.max(0,o-2*e),a=r>0&&r>i;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(i*l/r))),h=(l-u)/(r-i),c=n*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(u),computedSliderRatio:h,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=s._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let e=t-this._arrowSize-this._computedSliderSize/2;return Math.round(e/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let e=t-this._arrowSize,i=this._scrollPosition;return e0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),e){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(e.deltaX),l=Math.abs(e.deltaY),a=Math.max(Math.min(r,o),1),u=Math.max(Math.min(n,l),1),h=Math.max(r,o),c=Math.max(n,l);h%a===0&&c%u===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Wr.INSTANCE=new Wr;var as=Wr,cs=class extends st{constructor(e,i,r){super();this._onScroll=this._register(new g);this.onScroll=this._onScroll.event;this._onWillScroll=this._register(new g);this.onWillScroll=this._onWillScroll.event;this._options=ka(i),this._scrollable=r,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let n={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Fr(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Nr(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=pt(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=pt(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=pt(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new je),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=We(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Ee&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ti(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=We(this._mouseWheelToDispose),e)){let r=n=>{this._onMouseWheel(new Ti(n))};this._mouseWheelToDispose.push(R(this._listenOnDomNode,X.MOUSE_WHEEL,r,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=as.INSTANCE;Fo&&i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+o===0?l=o=0:Math.abs(o)>=Math.abs(l)?l=0:o=0),this._options.flipAxes&&([o,l]=[l,o]);let a=!Ee&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),h={};if(o){let c=No*o,d=u.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(h,d)}if(l){let c=No*l,d=u.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(h,d)}h=this._scrollable.validateScrollPosition(h),(u.scrollLeft!==h.scrollLeft||u.scrollTop!==h.scrollTop)&&(Fo&&this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",o=i?" top":"",l=r||i?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Aa)}};var Hr=class extends cs{constructor(t,e,i){super(t,e,i)}setScrollPosition(t){t.reuseAnimation?this._scrollable.setScrollPositionSmooth(t,t.reuseAnimation):this._scrollable.setScrollPositionNow(t)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function ka(s){let t={lazyRender:typeof s.lazyRender<"u"?s.lazyRender:!1,className:typeof s.className<"u"?s.className:"",useShadows:typeof s.useShadows<"u"?s.useShadows:!0,handleMouseWheel:typeof s.handleMouseWheel<"u"?s.handleMouseWheel:!0,flipAxes:typeof s.flipAxes<"u"?s.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof s.consumeMouseWheelIfScrollbarIsNeeded<"u"?s.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof s.alwaysConsumeMouseWheel<"u"?s.alwaysConsumeMouseWheel:!1,scrollYToX:typeof s.scrollYToX<"u"?s.scrollYToX:!1,mouseWheelScrollSensitivity:typeof s.mouseWheelScrollSensitivity<"u"?s.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof s.fastScrollSensitivity<"u"?s.fastScrollSensitivity:5,scrollPredominantAxis:typeof s.scrollPredominantAxis<"u"?s.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof s.mouseWheelSmoothScroll<"u"?s.mouseWheelSmoothScroll:!0,arrowSize:typeof s.arrowSize<"u"?s.arrowSize:11,listenOnDomNode:typeof s.listenOnDomNode<"u"?s.listenOnDomNode:null,horizontal:typeof s.horizontal<"u"?s.horizontal:1,horizontalScrollbarSize:typeof s.horizontalScrollbarSize<"u"?s.horizontalScrollbarSize:10,horizontalSliderSize:typeof s.horizontalSliderSize<"u"?s.horizontalSliderSize:0,horizontalHasArrows:typeof s.horizontalHasArrows<"u"?s.horizontalHasArrows:!1,vertical:typeof s.vertical<"u"?s.vertical:1,verticalScrollbarSize:typeof s.verticalScrollbarSize<"u"?s.verticalScrollbarSize:10,verticalHasArrows:typeof s.verticalHasArrows<"u"?s.verticalHasArrows:!1,verticalSliderSize:typeof s.verticalSliderSize<"u"?s.verticalSliderSize:0,scrollByPage:typeof s.scrollByPage<"u"?s.scrollByPage:!1};return t.horizontalSliderSize=typeof s.horizontalSliderSize<"u"?s.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof s.verticalSliderSize<"u"?s.verticalSliderSize:t.verticalScrollbarSize,Ee&&(t.className+=" mac"),t}var zt=class extends y{constructor(e,i,r,n,o,l,a,u){super();this._bufferService=r;this._optionsService=a;this._renderService=u;this._onRequestScrollLines=this._register(new g);this.onRequestScrollLines=this._onRequestScrollLines.event;this._isSyncing=!1;this._isHandlingScroll=!1;this._suppressOnScrollHandler=!1;let h=this._register(new xi({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>ft(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Hr(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(V.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(M(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(M(()=>this._styleElement.remove())),this._register(V.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(` +`)})),this._register(this._bufferService.onResize(()=>this._queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>this._queueSync())),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}_queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};zt=C([E(2,F),E(3,le),E(4,er),E(5,Ae),E(6,W),E(7,ae)],zt);var $t=class extends y{constructor(e,i,r,n,o){super();this._screenElement=e;this._bufferService=i;this._coreBrowserService=r;this._decorationService=n;this._renderService=o;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(l=>this._removeDecoration(l))),this._register(M(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};$t=C([E(1,F),E(2,le),E(3,He),E(4,ae)],$t);var Ur=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(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,i){return e>=t.startBufferLine-this._linePadding[i||"full"]&&e<=t.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}};var Ge={full:0,left:0,center:0,right:0},ot={full:0,left:0,center:0,right:0},wi={full:0,left:0,center:0,right:0},mt=class extends y{constructor(e,i,r,n,o,l,a,u){super();this._viewportElement=e;this._screenElement=i;this._bufferService=r;this._decorationService=n;this._renderService=o;this._optionsService=l;this._themeService=a;this._coreBrowserService=u;this._colorZoneStore=new Ur;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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(M(()=>this._canvas?.remove()));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);ot.full=this._canvas.width,ot.left=e,ot.center=i,ot.right=e,this._refreshDrawHeightConstants(),wi.full=1,wi.left=1,wi.center=1+ot.left,wi.right=1+ot.left+ot.center}_refreshDrawHeightConstants(){Ge.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ge.left=i,Ge.center=i,Ge.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ge.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(let i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(wi[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ge[e.position||"full"]/2),ot[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ge[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};mt=C([E(2,F),E(3,He),E(4,ae),E(5,W),E(6,Ae),E(7,le)],mt);var b;(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=` +`,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="\x7F"))(b||={});var Di;(_=>(_.PAD="\x80",_.HOP="\x81",_.BPH="\x82",_.NBH="\x83",_.IND="\x84",_.NEL="\x85",_.SSA="\x86",_.ESA="\x87",_.HTS="\x88",_.HTJ="\x89",_.VTS="\x8A",_.PLD="\x8B",_.PLU="\x8C",_.RI="\x8D",_.SS2="\x8E",_.SS3="\x8F",_.DCS="\x90",_.PU1="\x91",_.PU2="\x92",_.STS="\x93",_.CCH="\x94",_.MW="\x95",_.SPA="\x96",_.EPA="\x97",_.SOS="\x98",_.SGCI="\x99",_.SCI="\x9A",_.CSI="\x9B",_.ST="\x9C",_.OSC="\x9D",_.PM="\x9E",_.APC="\x9F"))(Di||={});var us;(t=>t.ST=`${b.ESC}\\`)(us||={});var Vt=class{constructor(t,e,i,r,n,o){this._textarea=t;this._compositionView=e;this._bufferService=i;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;e.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(e.start,this._compositionPosition.start):i=this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let t=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let e=this._textarea.value,i=e.replace(t,"");this._dataAlreadySent=i,e.length>t.length?this._coreService.triggerDataEvent(i,!0):e.lengththis.updateCompositionElements(!0),0)}}};Vt=C([E(2,F),E(3,W),E(4,Fe),E(5,ae)],Vt);var Gr={};wl(Gr,{getSafariVersion:()=>Ca,isChromeOS:()=>ds,isFirefox:()=>Kr,isIpad:()=>Ma,isIphone:()=>Pa,isLegacyEdge:()=>Wo,isLinux:()=>ki,isMac:()=>qt,isNode:()=>Ri,isSafari:()=>Uo,isWindows:()=>hs});var Ri=typeof process<"u"&&"title"in process,Li=Ri?"node":navigator.userAgent,Ai=Ri?"node":navigator.platform,Kr=Li.includes("Firefox"),Wo=Li.includes("Edge"),Uo=/^((?!chrome|android).)*safari/i.test(Li);function Ca(){if(!Uo)return 0;let s=Li.match(/Version\/(\d+)/);return s===null||s.length<2?0:parseInt(s[1])}var qt=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ai),Ma=Ai==="iPad",Pa=Ai==="iPhone",hs=["Windows","Win16","Win32","WinCE"].includes(Ai),ki=Ai.indexOf("Linux")>=0,ds=/\bCrOS\b/.test(Li);var _t=257;var ce=0,ue=0,he=0,J=0,fs={css:"#00000000",rgba:0},Z;(i=>{function s(r,n,o,l){return l!==void 0?`#${bt(r)}${bt(n)}${bt(o)}${bt(l)}`:`#${bt(r)}${bt(n)}${bt(o)}`}i.toCss=s;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function e(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=e})(Z||={});var K;(l=>{function s(a,u){if(J=(u.rgba&255)/255,J===1)return{css:u.css,rgba:u.rgba};let h=u.rgba>>24&255,c=u.rgba>>16&255,d=u.rgba>>8&255,v=a.rgba>>24&255,p=a.rgba>>16&255,f=a.rgba>>8&255;ce=v+Math.round((h-v)*J),ue=p+Math.round((c-p)*J),he=f+Math.round((d-f)*J);let m=Z.toCss(ce,ue,he),A=Z.toRgba(ce,ue,he);return{css:m,rgba:A}}l.blend=s;function t(a){return(a.rgba&255)===255}l.isOpaque=t;function e(a,u,h){let c=zr.ensureContrastRatio(a.rgba,u.rgba,h);if(c)return Z.toColor(c>>24&255,c>>16&255,c>>8&255)}l.ensureContrastRatio=e;function i(a){let u=(a.rgba|255)>>>0;return[ce,ue,he]=zr.toChannels(u),{css:Z.toCss(ce,ue,he),rgba:u}}l.opaque=i;function r(a,u){return J=Math.round(u*255),[ce,ue,he]=zr.toChannels(a.rgba),{css:Z.toCss(ce,ue,he,J),rgba:Z.toRgba(ce,ue,he,J)}}l.opacity=r;function n(a,u){return J=a.rgba&255,r(a,J*u/255)}l.multiplyOpacity=n;function o(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}l.toColorRGB=o})(K||={});var G;(i=>{let s,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(s=n,s.globalCompositeOperation="copy",t=s.createLinearGradient(0,0,1,1))}catch{}function e(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ce=parseInt(r.slice(1,2).repeat(2),16),ue=parseInt(r.slice(2,3).repeat(2),16),he=parseInt(r.slice(3,4).repeat(2),16),Z.toColor(ce,ue,he);case 5:return ce=parseInt(r.slice(1,2).repeat(2),16),ue=parseInt(r.slice(2,3).repeat(2),16),he=parseInt(r.slice(3,4).repeat(2),16),J=parseInt(r.slice(4,5).repeat(2),16),Z.toColor(ce,ue,he,J);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return ce=parseInt(n[1]),ue=parseInt(n[2]),he=parseInt(n[3]),J=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Z.toColor(ce,ue,he,J);if(!s||!t)throw new Error("css.toColor: Unsupported css format");if(s.fillStyle=t,s.fillStyle=r,typeof s.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(s.fillRect(0,0,1,1),[ce,ue,he,J]=s.getImageData(0,0,1,1).data,J!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Z.toRgba(ce,ue,he,J),css:r}}i.toColor=e})(G||={});var ve;(e=>{function s(i){return t(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=s;function t(i,r,n){let o=i/255,l=r/255,a=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return u*.2126+h*.7152+c*.0722}e.relativeLuminance2=t})(ve||={});var zr;(n=>{function s(o,l){if(J=(l&255)/255,J===1)return l;let a=l>>24&255,u=l>>16&255,h=l>>8&255,c=o>>24&255,d=o>>16&255,v=o>>8&255;return ce=c+Math.round((a-c)*J),ue=d+Math.round((u-d)*J),he=v+Math.round((h-v)*J),Z.toRgba(ce,ue,he)}n.blend=s;function t(o,l,a){let u=ve.relativeLuminance(o>>8),h=ve.relativeLuminance(l>>8);if(Ze(u,h)>8));if(f>8));return f>A?p:m}return p}let d=i(o,l,a),v=Ze(u,ve.relativeLuminance(d>>8));if(v>8));return v>f?d:p}return d}}n.ensureContrastRatio=t;function e(o,l,a){let u=o>>24&255,h=o>>16&255,c=o>>8&255,d=l>>24&255,v=l>>16&255,p=l>>8&255,f=Ze(ve.relativeLuminance2(d,v,p),ve.relativeLuminance2(u,h,c));for(;f0||v>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),v-=Math.max(0,Math.ceil(v*.1)),p-=Math.max(0,Math.ceil(p*.1)),f=Ze(ve.relativeLuminance2(d,v,p),ve.relativeLuminance2(u,h,c));return(d<<24|v<<16|p<<8|255)>>>0}n.reduceLuminance=e;function i(o,l,a){let u=o>>24&255,h=o>>16&255,c=o>>8&255,d=l>>24&255,v=l>>16&255,p=l>>8&255,f=Ze(ve.relativeLuminance2(d,v,p),ve.relativeLuminance2(u,h,c));for(;f>>0}n.increaseLuminance=i;function r(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}n.toChannels=r})(zr||={});function bt(s){let t=s.toString(16);return t.length<2?"0"+t:t}function Ze(s,t){return s1){let c=this._getJoinedRanges(r,l,o,e,n);for(let d=0;d1){let h=this._getJoinedRanges(r,l,o,e,n);for(let c=0;c0&&de===v[0][0]){w=!0;let Y=v.shift();_=new $r(this._workCell,t.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),T=Y[1]-1,Ne=_.getWidth()}let x=this._isCellInSelection(de,e),S=i&&de===o,k=Xi&&de>=h&&de<=c,B=!1;this._decorationService.forEachDecorationAtCell(de,e,void 0,Y=>{B=!0});let q=_.getChars()||Re;if(q===" "&&(_.isUnderline()||_.isOverline())&&(q="\xA0"),Pe=Ne*a-u.get(q,_.isBold(),_.isItalic()),!m)m=this._document.createElement("span");else if(A&&(x&&we||!x&&!we&&_.bg===N)&&(x&&we&&p.selectionForeground||_.fg===I)&&_.extended.ext===L&&k===P&&Pe===oe&&!S&&!w&&!B){_.isInvisible()?D+=Re:D+=q,A++;continue}else A&&(m.textContent=D),m=this._document.createElement("span"),A=0,D="";if(N=_.bg,I=_.fg,L=_.extended.ext,P=k,oe=Pe,we=x,w&&o>=de&&o<=T&&(o=de),!this._coreService.isCursorHidden&&S&&this._coreService.isCursorInitialized){if(z.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&z.push("xterm-cursor-blink"),z.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":z.push("xterm-cursor-outline");break;case"block":z.push("xterm-cursor-block");break;case"bar":z.push("xterm-cursor-bar");break;case"underline":z.push("xterm-cursor-underline");break;default:break}}if(_.isBold()&&z.push("xterm-bold"),_.isItalic()&&z.push("xterm-italic"),_.isDim()&&z.push("xterm-dim"),_.isInvisible()?D=Re:D=_.getChars()||Re,_.isUnderline()&&(z.push(`xterm-underline-${_.extended.underlineStyle}`),D===" "&&(D="\xA0"),!_.isUnderlineColorDefault()))if(_.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${Le.toColorRGB(_.getUnderlineColor()).join(",")})`;else{let Y=_.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&_.isBold()&&Y<8&&(Y+=8),m.style.textDecorationColor=p.ansi[Y].css}_.isOverline()&&(z.push("xterm-overline"),D===" "&&(D="\xA0")),_.isStrikethrough()&&z.push("xterm-strikethrough"),k&&(m.style.textDecoration="underline");let H=_.getFgColor(),De=_.getFgColorMode(),me=_.getBgColor(),Oe=_.getBgColorMode(),Tt=!!_.isInverse();if(Tt){let Y=H;H=me,me=Y;let yl=De;De=Oe,Oe=yl}let Ie,It,ct=!1;this._decorationService.forEachDecorationAtCell(de,e,void 0,Y=>{Y.options.layer!=="top"&&ct||(Y.backgroundColorRGB&&(Oe=50331648,me=Y.backgroundColorRGB.rgba>>8&16777215,Ie=Y.backgroundColorRGB),Y.foregroundColorRGB&&(De=50331648,H=Y.foregroundColorRGB.rgba>>8&16777215,It=Y.foregroundColorRGB),ct=Y.options.layer==="top")}),!ct&&x&&(Ie=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,me=Ie.rgba>>8&16777215,Oe=50331648,ct=!0,p.selectionForeground&&(De=50331648,H=p.selectionForeground.rgba>>8&16777215,It=p.selectionForeground)),ct&&z.push("xterm-decoration-top");let et;switch(Oe){case 16777216:case 33554432:et=p.ansi[me],z.push(`xterm-bg-${me}`);break;case 50331648:et=Z.toColor(me>>16,me>>8&255,me&255),this._addStyle(m,`background-color:#${zo((me>>>0).toString(16),"0",6)}`);break;case 0:default:Tt?(et=p.foreground,z.push(`xterm-bg-${_t}`)):et=p.background}switch(Ie||_.isDim()&&(Ie=K.multiplyOpacity(et,.5)),De){case 16777216:case 33554432:_.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(m,et,p.ansi[H],_,Ie,void 0)||z.push(`xterm-fg-${H}`);break;case 50331648:let Y=Z.toColor(H>>16&255,H>>8&255,H&255);this._applyMinimumContrast(m,et,Y,_,Ie,It)||this._addStyle(m,`color:#${zo(H.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(m,et,p.foreground,_,Ie,It)||Tt&&z.push(`xterm-fg-${_t}`)}z.length&&(m.className=z.join(" "),z.length=0),!S&&!w&&!B?A++:m.textContent=D,Pe!==this.defaultSpacing&&(m.style.letterSpacing=`${Pe}px`),d.push(m),de=T}return m&&A&&(m.textContent=D),d}_applyMinimumContrast(t,e,i,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Ko(r.getCode()))return!1;let l=this._getContrastCache(r),a;if(!n&&!o&&(a=l.getColor(e.rgba,i.rgba)),a===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=K.ensureContrastRatio(n||e,o||i,u),l.setColor((n||e).rgba,(o||i).rgba,a??null)}return a?(this._addStyle(t,`color:${a.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?t>=i[0]&&e>=i[1]&&t=i[1]&&t>=r[0]&&e<=r[1]:e>i[1]&&e=i[0]&&t=i[0]}};Yt=C([E(1,rr),E(2,W),E(3,le),E(4,Fe),E(5,He),E(6,Ae)],Yt);function zo(s,t,e){for(;s.length0&&(this._flat[r]=l),l}let n=t;e&&(n+="B"),i&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;e&&(l|=1),i&&(l|=2),o=this._measure(t,l),o>0&&this._holey.set(n,o)}return o}_measure(t,e){let i=this._measureElements[e];return i.textContent=t.repeat(32),i.offsetWidth/32}};var ps=class{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(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let n=t.buffers.active.ydisp,o=e[1]-n,l=i[1]-n,a=Math.max(o,0),u=Math.min(l,t.rows-1);if(a>=t.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=a,this.viewportCappedEndRow=u,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&e=this.startCol):!1}};function $o(){return new ps}var ms="xterm-dom-renderer-owner-",ke="xterm-rows",Yr="xterm-fg-",Vo="xterm-bg-",Ci="xterm-focus",jr="xterm-selection",Na=1,jt=class extends y{constructor(e,i,r,n,o,l,a,u,h,c,d,v,p){super();this._terminal=e;this._document=i;this._element=r;this._screenElement=n;this._viewportElement=o;this._helperContainer=l;this._linkifier2=a;this._charSizeService=h;this._optionsService=c;this._bufferService=d;this._coreBrowserService=v;this._themeService=p;this._terminalClass=Na++;this._rowElements=[];this._selectionRenderModel=$o();this.onRequestRedraw=this._register(new g).event;this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ke),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(jr),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Go(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Yt,document),this._element.classList.add(ms+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._register(M(()=>{this._element.classList.remove(ms+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new qr(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${ke} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${ke} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${ke} .xterm-dim { color: ${K.multiplyOpacity(e.foreground,.5).css};}`,i+=`${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;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${n} { 50% { box-shadow: none; }}`,i+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${ke}.${Ci} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ke}.${Ci} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ke}.${Ci} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ke} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ke} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ke} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ke} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ke} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${jr} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${jr} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${jr} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,a]of e.ansi.entries())i+=`${this._terminalSelector} .${Yr}${l} { color: ${a.css}; }${this._terminalSelector} .${Yr}${l}.xterm-dim { color: ${K.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${Vo}${l} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${Yr}${_t} { color: ${K.opaque(e.background).css}; }${this._terminalSelector} .${Yr}${_t}.xterm-dim { color: ${K.multiplyOpacity(K.opaque(e.background),.5).css}; }${this._terminalSelector} .${Vo}${_t} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let r=this._rowElements.length;r<=i;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(Ci),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ci),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(r){let h=e[0]>i[0];u.appendChild(this._createSelectionElement(l,h?i[0]:e[0],h?e[0]:i[0],a-l+1))}else{let h=n===l?e[0]:0,c=l===o?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,h,c));let d=a-l-1;if(u.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,d)),l!==a){let v=o===a?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,0,v))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,i,r,n=1){let o=this._document.createElement("div"),l=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-i);return l+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-l),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}px`,o.style.width=`${a}px`,o}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let r=this._bufferService.buffer,n=r.ybase+r.y,o=Math.min(r.x,this._bufferService.cols-1),l=this._optionsService.rawOptions.cursorBlink,a=this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=i;h++){let c=h+r.ydisp,d=this._rowElements[h],v=r.lines.get(c);if(!d||!v)break;d.replaceChildren(...this._rowFactory.createRow(v,c,c===n,a,u,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ms}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,n,o,l){r<0&&(e=0),n<0&&(i=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),n=Math.max(Math.min(n,a),0),o=Math.min(o,this._bufferService.cols);let u=this._bufferService.buffer,h=u.ybase+u.y,c=Math.min(u.x,o-1),d=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=r;f<=n;++f){let m=f+u.ydisp,A=this._rowElements[f],D=u.lines.get(m);if(!A||!D)break;A.replaceChildren(...this._rowFactory.createRow(D,m,m===h,v,p,c,d,this.dimensions.css.cell.width,this._widthCache,l?f===r?e:0:-1,l?(f===n?i:o)-1:-1))}}};jt=C([E(7,wt),E(8,it),E(9,W),E(10,F),E(11,le),E(12,Ae)],jt);var Xt=class extends y{constructor(e,i,r){super();this._optionsService=r;this.width=0;this.height=0;this._onCharSizeChange=this._register(new g);this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new bs(this._optionsService))}catch{this._measureStrategy=this._register(new _s(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Xt=C([E(2,W)],Xt);var Xr=class extends y{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(e,i){e!==void 0&&e>0&&i!==void 0&&i>0&&(this._result.width=e,this._result.height=i)}},_s=class extends Xr{constructor(e,i,r){super();this._document=e;this._parentElement=i;this._optionsService=r;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}},bs=class extends Xr{constructor(e){super();this._optionsService=e;this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}};var Zr=class extends y{constructor(e,i,r){super();this._textarea=e;this._window=i;this.mainDocument=r;this._isFocused=!1;this._cachedIsFocused=void 0;this._screenDprMonitor=this._register(new vs(this._window));this._onDprChange=this._register(new g);this.onDprChange=this._onDprChange.event;this._onWindowChange=this._register(new g);this.onWindowChange=this._onWindowChange.event;this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(V.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(R(this._textarea,"focus",()=>this._isFocused=!0)),this._register(R(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},vs=class extends y{constructor(e){super();this._parentWindow=e;this._windowResizeListener=this._register(new ye);this._onDprChange=this._register(new g);this.onDprChange=this._onDprChange.event;this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(M(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=R(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}};var Qr=class extends y{constructor(){super();this.linkProviders=[];this._register(M(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);i!==-1&&this.linkProviders.splice(i,1)}}}};function Mi(s,t,e){let i=e.getBoundingClientRect(),r=s.getComputedStyle(e),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-n,t.clientY-i.top-o]}function qo(s,t,e,i,r,n,o,l,a){if(!n)return;let u=Mi(s,t,e);if(u)return u[0]=Math.ceil((u[0]+(a?o/2:0))/o),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),i+(a?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var Zt=class{constructor(t,e){this._renderService=t;this._charSizeService=e}getCoords(t,e,i,r,n){return qo(window,t,e,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(t,e){let i=Mi(window,t,e);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Zt=C([E(0,ae),E(1,it)],Zt);var Jr=class{constructor(t,e){this._renderCallback=t;this._coreBrowserService=e;this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!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){this._runRefreshCallbacks();return}let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}};var en=class{constructor(){this._tasks=[];this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._in){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=n}this.clear()}},gs=class extends en{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=Date.now()+t;return{timeRemaining:()=>Math.max(0,e-Date.now())}}},Ss=class extends en{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Qt=!Ri&&"requestIdleCallback"in window?Ss:gs,tn=class{constructor(){this._queue=new Qt}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}};var Jt=class extends y{constructor(e,i,r,n,o,l,a,u){super();this._rowCount=e;this._charSizeService=n;this._renderer=this._register(new ye);this._pausedResizeTask=new tn;this._observerDisposable=this._register(new ye);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 g);this.onDimensionsChange=this._onDimensionsChange.event;this._onRenderedViewportChange=this._register(new g);this.onRenderedViewportChange=this._onRenderedViewportChange.event;this._onRender=this._register(new g);this.onRender=this._onRender.event;this._onRefreshRequest=this._register(new g);this.onRefreshRequest=this._onRefreshRequest.event;this._renderDebouncer=new Jr((h,c)=>this._renderRows(h,c),a),this._register(this._renderDebouncer),this._register(a.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(r.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(r.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(r.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(a.window,i),this._register(a.onWindowChange(h=>this._registerIntersectionObserver(h,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=M(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){this._renderer.value&&(e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0)}resize(e,i){this._rowCount=i,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Jt=C([E(2,W),E(3,it),E(4,He),E(5,F),E(6,le),E(7,Ae)],Jt);function Yo(s,t,e,i){let r=e.buffer.x,n=e.buffer.y;if(!e.buffer.hasScrollback)return Wa(r,n,s,t,e,i)+rn(n,t,e,i)+Ua(r,n,s,t,e,i);let o;if(n===t)return o=r>s?"D":"C",Oi(Math.abs(r-s),Pi(o,i));o=n>t?"D":"C";let l=Math.abs(n-t),a=Ha(n>t?s:r,e)+(l-1)*e.cols+1+Fa(n>t?r:s,e);return Oi(a,Pi(o,i))}function Fa(s,t){return s-1}function Ha(s,t){return t.cols-s}function Wa(s,t,e,i,r,n){return rn(t,i,r,n).length===0?"":Oi(Xo(s,t,s,t-vt(t,r),!1,r).length,Pi("D",n))}function rn(s,t,e,i){let r=s-vt(s,e),n=t-vt(t,e),o=Math.abs(r-n)-Ka(s,t,e);return Oi(o,Pi(jo(s,t),i))}function Ua(s,t,e,i,r,n){let o;rn(t,i,r,n).length>0?o=i-vt(i,r):o=t;let l=i,a=Ga(s,t,e,i,r,n);return Oi(Xo(s,o,e,l,a==="C",r).length,Pi(a,n))}function Ka(s,t,e){let i=0,r=s-vt(s,e),n=t-vt(t,e);for(let o=0;o=0&&s0?o=i-vt(i,r):o=t,s=e&&ot?"A":"B"}function Xo(s,t,e,i,r,n){let o=s,l=t,a="";for(;o!==e||l!==i;)o+=r?1:-1,r&&o>n.cols-1?(a+=n.buffer.translateBufferLineToString(l,!1,s,o),o=0,s=0,l++):!r&&o<0&&(a+=n.buffer.translateBufferLineToString(l,!1,0,s+1),o=n.cols-1,s=o,l--);return a+n.buffer.translateBufferLineToString(l,!1,s,o)}function Pi(s,t){let e=t?"O":"[";return b.ESC+e+s}function Oi(s,t){s=Math.floor(s);let e="";for(let i=0;ithis._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Es(s,t){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return t*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}var Ts=50,za=15,$a=50,Va=500,qa="\xA0",Ya=new RegExp(qa,"g");var ei=class extends y{constructor(e,i,r,n,o,l,a,u,h){super();this._element=e;this._screenElement=i;this._linkifier=r;this._bufferService=n;this._coreService=o;this._mouseService=l;this._optionsService=a;this._renderService=u;this._coreBrowserService=h;this._dragScrollAmount=0;this._enabled=!0;this._workCell=new j;this._mouseDownTimeStamp=0;this._oldHasSelection=!1;this._oldSelectionStart=void 0;this._oldSelectionEnd=void 0;this._onLinuxMouseSelection=this._register(new g);this.onLinuxMouseSelection=this._onLinuxMouseSelection.event;this._onRedrawRequest=this._register(new g);this.onRequestRedraw=this._onRedrawRequest.event;this._onSelectionChange=this._register(new g);this.onSelectionChange=this._onSelectionChange.event;this._onRequestScrollLines=this._register(new g);this.onRequestScrollLines=this._onRequestScrollLines.event;this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new nn(this._bufferService),this._activeSelectionMode=0,this._register(M(()=>{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(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let l=e[0]l.replace(Ya," ")).join(hs?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ki&&e&&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(e){let i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!i?!1:this._areCoordsInSelection(i,r,n)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,i],r,n)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]=i[0]&&e[0]=i[0]}_selectWordAtCursor(e,i){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=Es(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Mi(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),i=Math.min(Math.max(i,-Ts),Ts),i/=Ts,i/Math.abs(i)+Math.round(i*(za-1)))}shouldForceSelection(e){return qt?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),$a)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(qt&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&ithis._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let n=0;i>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:o>1&&i!==n&&(r+=o-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let a=o.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(l,e[0]),h=u,c=e[0]-u,d=0,v=0,p=0,f=0;if(a.charAt(u)===" "){for(;u>0&&a.charAt(u-1)===" ";)u--;for(;h1&&(f+=I-1,h+=I-1);D>0&&u>0&&!this._isCharWordSeparator(l.loadCell(D-1,this._workCell));){l.loadCell(D-1,this._workCell);let L=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,D--):L>1&&(p+=L-1,u-=L-1),u--,D--}for(;N1&&(f+=L-1,h+=L-1),h++,N++}}h++;let m=u+c-d+p,A=Math.min(this._bufferService.cols,h-u+d+v-p-f);if(!(!i&&a.slice(u,h).trim()==="")){if(r&&m===0&&l.getCodePoint(0)!==32){let D=o.lines.get(e[1]-1);if(D&&l.isWrapped&&D.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let I=this._bufferService.cols-N.start;m-=I,A+=I}}}if(n&&m+A===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let D=o.lines.get(e[1]+1);if(D?.isWrapped&&D.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(A+=N.length)}}return{start:m,length:A}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Es(r,this._bufferService.cols)}};ei=C([E(3,F),E(4,Fe),E(5,Rt),E(6,W),E(7,ae),E(8,le)],ei);var Bi=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}};var Ni=class{constructor(){this._color=new Bi;this._css=new Bi}setCss(t,e,i){this._css.set(t,e,i)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,i){this._color.set(t,e,i)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}};var re=Object.freeze((()=>{let s=[G.toColor("#2e3436"),G.toColor("#cc0000"),G.toColor("#4e9a06"),G.toColor("#c4a000"),G.toColor("#3465a4"),G.toColor("#75507b"),G.toColor("#06989a"),G.toColor("#d3d7cf"),G.toColor("#555753"),G.toColor("#ef2929"),G.toColor("#8ae234"),G.toColor("#fce94f"),G.toColor("#729fcf"),G.toColor("#ad7fa8"),G.toColor("#34e2e2"),G.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let e=0;e<216;e++){let i=t[e/36%6|0],r=t[e/6%6|0],n=t[e%6];s.push({css:Z.toCss(i,r,n),rgba:Z.toRgba(i,r,n)})}for(let e=0;e<24;e++){let i=8+e*10;s.push({css:Z.toCss(i,i,i),rgba:Z.toRgba(i,i,i)})}return s})());var gt=G.toColor("#ffffff"),Hi=G.toColor("#000000"),Zo=G.toColor("#ffffff"),Qo=Hi,Fi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ja=gt,ti=class extends y{constructor(e){super();this._optionsService=e;this._contrastCache=new Ni;this._halfContrastCache=new Ni;this._onChangeColors=this._register(new g);this.onChangeColors=this._onChangeColors.event;this._colors={foreground:gt,background:Hi,cursor:Zo,cursorAccent:Qo,selectionForeground:void 0,selectionBackgroundTransparent:Fi,selectionBackgroundOpaque:K.blend(Hi,Fi),selectionInactiveBackgroundTransparent:Fi,selectionInactiveBackgroundOpaque:K.blend(Hi,Fi),scrollbarSliderBackground:K.opacity(gt,.2),scrollbarSliderHoverBackground:K.opacity(gt,.4),scrollbarSliderActiveBackground:K.opacity(gt,.5),overviewRulerBorder:gt,ansi:re.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)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=U(e.foreground,gt),i.background=U(e.background,Hi),i.cursor=U(e.cursor,Zo),i.cursorAccent=U(e.cursorAccent,Qo),i.selectionBackgroundTransparent=U(e.selectionBackground,Fi),i.selectionBackgroundOpaque=K.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=U(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=K.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?U(e.selectionForeground,fs):void 0,i.selectionForeground===fs&&(i.selectionForeground=void 0),K.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=K.opacity(i.selectionBackgroundTransparent,.3)),K.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=K.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=U(e.scrollbarSliderBackground,K.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=U(e.scrollbarSliderHoverBackground,K.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=U(e.scrollbarSliderActiveBackground,K.opacity(i.foreground,.5)),i.overviewRulerBorder=U(e.overviewRulerBorder,ja),i.ansi=re.slice(),i.ansi[0]=U(e.black,re[0]),i.ansi[1]=U(e.red,re[1]),i.ansi[2]=U(e.green,re[2]),i.ansi[3]=U(e.yellow,re[3]),i.ansi[4]=U(e.blue,re[4]),i.ansi[5]=U(e.magenta,re[5]),i.ansi[6]=U(e.cyan,re[6]),i.ansi[7]=U(e.white,re[7]),i.ansi[8]=U(e.brightBlack,re[8]),i.ansi[9]=U(e.brightRed,re[9]),i.ansi[10]=U(e.brightGreen,re[10]),i.ansi[11]=U(e.brightYellow,re[11]),i.ansi[12]=U(e.brightBlue,re[12]),i.ansi[13]=U(e.brightMagenta,re[13]),i.ansi[14]=U(e.brightCyan,re[14]),i.ansi[15]=U(e.brightWhite,re[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let n=0;no.index-l.index),r=[];for(let o of i){let l=this._services.get(o.id);if(!l)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${o.id}.`);r.push(l)}let n=i.length>0?i[0].index:e.length;if(e.length!==n)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${n+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}};var Xa={trace:0,debug:1,info:2,warn:3,error:4,off:5},Za="xterm.js: ",ii=class extends y{constructor(e){super();this._optionsService=e;this._logLevel=5;this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Qa=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Xa[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;ithis._length)for(let i=this._length;i=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;nthis._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let o=i-1;o>=0;o--)this.set(e+o+r,this.get(e+o));let n=e+i+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n>22,e&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,e){this._data[t*O+1]=e[0],e[1].length>1?(this._combined[t]=e[1],this._data[t*O+0]=t|2097152|e[2]<<22):this._data[t*O+0]=e[1].charCodeAt(0)|e[2]<<22}getWidth(t){return this._data[t*O+0]>>22}hasWidth(t){return this._data[t*O+0]&12582912}getFg(t){return this._data[t*O+1]}getBg(t){return this._data[t*O+2]}hasContent(t){return this._data[t*O+0]&4194303}getCodePoint(t){let e=this._data[t*O+0];return e&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):e&2097151}isCombined(t){return this._data[t*O+0]&2097152}getString(t){let e=this._data[t*O+0];return e&2097152?this._combined[t]:e&2097151?Be(e&2097151):""}isProtected(t){return this._data[t*O+2]&536870912}loadCell(t,e){return on=t*O,e.content=this._data[on+0],e.fg=this._data[on+1],e.bg=this._data[on+2],e.content&2097152&&(e.combinedData=this._combined[t]),e.bg&268435456&&(e.extended=this._extendedAttrs[t]),e}setCell(t,e){e.content&2097152&&(this._combined[t]=e.combinedData),e.bg&268435456&&(this._extendedAttrs[t]=e.extended),this._data[t*O+0]=e.content,this._data[t*O+1]=e.fg,this._data[t*O+2]=e.bg}setCellFromCodepoint(t,e,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*O+0]=e|i<<22,this._data[t*O+1]=r.fg,this._data[t*O+2]=r.bg}addCodepointToCell(t,e,i){let r=this._data[t*O+0];r&2097152?this._combined[t]+=Be(e):r&2097151?(this._combined[t]=Be(r&2097151)+Be(e),r&=-2097152,r|=2097152):r=e|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*O+0]=r}insertCells(t,e,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),e=0;--n)this.setCell(t+e+n,this.loadCell(t+n,r));for(let n=0;nthis.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r=t&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o=t&&delete this._extendedAttrs[l]}}return this.length=t,i*4*ys=0;--t)if(this._data[t*O+0]&4194303)return t+(this._data[t*O+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*O+0]&4194303||this._data[t*O+2]&50331648)return t+(this._data[t*O+0]>>22);return 0}copyCellsFrom(t,e,i,r,n){let o=t._data;if(n)for(let a=r-1;a>=0;a--){for(let u=0;u=e&&(this._combined[u-e+i]=t._combined[u])}}translateToString(t,e,i,r){e=e??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;e>22||1}return r&&r.push(e),n}};function tl(s,t,e,i,r){let n=[];for(let o=0;o=o&&i0&&(f>h||u[f].getTrimmedLength()===0);f--)p++;p>0&&(n.push(o+u.length-p),n.push(p)),o+=u.length-1}return n}function il(s,t){let e=[],i=0,r=t[i],n=0;for(let o=0;ori(s,u,t)).reduce((a,u)=>a+u),n=0,o=0,l=0;for(;la&&(n-=a,o++);let u=s[o].getWidth(n-1)===2;u&&n--;let h=u?e-1:e;i.push(h),l+=h}return i}function ri(s,t,e){if(t===s.length-1)return s[t].getTrimmedLength();let i=!s[t].hasContent(e-1)&&s[t].getWidth(e-1)===1,r=s[t+1].getWidth(0)===2;return i&&r?e-1:e}var an=class an{constructor(t){this.line=t;this.isDisposed=!1;this._disposables=[];this._id=an._nextId++;this._onDispose=this.register(new g);this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),We(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};an._nextId=1;var ln=an;var ne={},Je=ne.B;ne[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"};ne.A={"#":"\xA3"};ne.B=void 0;ne[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"};ne.C=ne[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};ne.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"};ne.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"};ne.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"};ne.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"};ne.E=ne[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"};ne.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"};ne.H=ne[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};ne["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"};var sl=4294967295,Ki=class{constructor(t,e,i){this._hasScrollback=t;this._optionsService=e;this._bufferService=i;this.ydisp=0;this.ybase=0;this.y=0;this.x=0;this.tabs={};this.savedY=0;this.savedX=0;this.savedCurAttrData=Q.clone();this.savedCharset=Je;this.markers=[];this._nullCell=j.fromCharData([0,Ji,1,0]);this._whitespaceCell=j.fromCharData([0,Re,1,32]);this._isClearing=!1;this._memoryCleanupQueue=new Qt;this._memoryCleanupPosition=0;this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Wi(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new tt),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new tt),this._whitespaceCell}getBlankLine(t,e){return new Qe(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&esl?sl:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=Q);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Wi(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(Q),r=0,n=this._getCorrectBufferLength(e);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Qe(t,i)));else for(let l=this._rows;l>e;l--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=n}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let o=0;o.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=tl(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(Q));if(i.length>0){let r=il(this.lines,i);rl(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell(Q),n=i;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=t)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);let u=this.ybase+this.y;if(u>=o&&u0&&(r.push({start:o+a.length+n,newLines:p}),n+=p.length),a.push(...p);let f=c.length-1,m=c[f];m===0&&(f--,m=c[f]);let A=a.length-d-1,D=h;for(;A>=0;){let I=Math.min(D,m);if(a[f]===void 0)break;if(a[f].copyCellsFrom(a[A],D-I,m-I,I,!0),m-=I,m===0&&(f--,m=c[f]),D-=I,D===0){A--;let L=Math.max(A,0);D=ri(a,L,this._cols)}}for(let I=0;I0;)this.ybase===0?this.y0){let o=[],l=[];for(let f=0;f=0;f--)if(c&&c.start>u+d){for(let m=c.newLines.length-1;m>=0;m--)this.lines.set(f--,c.newLines[m]);f++,o.push({index:u+1,amount:c.newLines.length}),d+=c.newLines.length,c=r[++h]}else this.lines.set(f,l[u--]);let v=0;for(let f=o.length-1;f>=0;f--)o[f].index+=v,this.lines.onInsertEmitter.fire(o[f]),v+=o[f].amount;let p=Math.max(0,a+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(t,e,i=0,r){let n=this.lines.get(t);return n?n.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.linei.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}};var cn=class extends y{constructor(e,i){super();this._optionsService=e;this._bufferService=i;this._onBufferActivate=this._register(new g);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 Ki(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Ki(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}};var ws=2,Ds=1,ni=class extends y{constructor(e){super();this.isUserScrolling=!1;this._onResize=this._register(new g);this.onResize=this._onResize.event;this._onScroll=this._register(new g);this.onScroll=this._onScroll.event;this.cols=Math.max(e.rawOptions.cols||0,ws),this.rows=Math.max(e.rawOptions.rows||0,Ds),this.buffers=this._register(new cn(e,this))}get buffer(){return this.buffers.active}resize(e,i){this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,i),this._cachedBlankLine=n),n.isWrapped=i;let o=r.ybase+r.scrollTop,l=r.ybase+r.scrollBottom;if(r.scrollTop===0){let a=r.lines.isFull;l===r.lines.length-1?a?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(l+1,0,n.clone()),a?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let a=l-o+1;r.lines.shiftElements(o+1,a-1,-1),r.lines.set(l,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,i){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};ni=C([E(0,W)],ni);var si={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:qt,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},ec=["normal","bold","100","200","300","400","500","600","700","800","900"],un=class extends y{constructor(e){super();this._onOptionChange=this._register(new g);this.onOptionChange=this._onOptionChange.event;let i={...si};for(let r in e)if(r in i)try{let n=e[r];i[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(M(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&i()})}_setupOptions(){let e=r=>{if(!(r in si))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},i=(r,n)=>{if(!(r in si))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=si[e]),!tc(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=si[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=ec.includes(i)?i:si[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function tc(s){return s==="block"||s==="underline"||s==="bar"}function oi(s,t=5){if(typeof s!="object")return s;let e=Array.isArray(s)?[]:{};for(let i in s)e[i]=t<=1?s[i]:s[i]&&oi(s[i],t-1);return e}var ol=Object.freeze({insertMode:!1}),ll=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),li=class extends y{constructor(e,i,r){super();this._bufferService=e;this._logService=i;this._optionsService=r;this.isCursorInitialized=!1;this.isCursorHidden=!1;this._onData=this._register(new g);this.onData=this._onData.event;this._onUserInput=this._register(new g);this.onUserInput=this._onUserInput.event;this._onBinary=this._register(new g);this.onBinary=this._onBinary.event;this._onRequestScrollToBottom=this._register(new g);this.onRequestScrollToBottom=this._onRequestScrollToBottom.event;this.modes=oi(ol),this.decPrivateModes=oi(ll)}reset(){this.modes=oi(ol),this.decPrivateModes=oi(ll)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};li=C([E(0,F),E(1,tr),E(2,W)],li);var al={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button===4||s.action!==1?!1:(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>!(s.action===32&&s.button===3)},ANY:{events:31,restrict:s=>!0}};function Rs(s,t){let e=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(e|=64,e|=s.action):(e|=s.button&3,s.button&4&&(e|=64),s.button&8&&(e|=128),s.action===32?e|=32:s.action===0&&!t&&(e|=3)),e}var Ls=String.fromCharCode,cl={DEFAULT:s=>{let t=[Rs(s,!1)+32,s.col+32,s.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Ls(t[0])}${Ls(t[1])}${Ls(t[2])}`},SGR:s=>{let t=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${Rs(s,!0)};${s.col};${s.row}${t}`},SGR_PIXELS:s=>{let t=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${Rs(s,!0)};${s.x};${s.y}${t}`}},ai=class extends y{constructor(e,i){super();this._bufferService=e;this._coreService=i;this._protocols={};this._encodings={};this._activeProtocol="";this._activeEncoding="";this._lastEvent=null;this._onProtocolChange=this._register(new g);this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(al))this.addProtocol(r,al[r]);for(let r of Object.keys(cl))this.addEncoding(r,cl[r]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,i,r){if(r){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return!(e.button!==i.button||e.action!==i.action||e.ctrl!==i.ctrl||e.alt!==i.alt||e.shift!==i.shift)}};ai=C([E(0,F),E(1,Fe)],ai);var As=[[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]],nc=[[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]],se;function sc(s,t){let e=0,i=t.length-1,r;if(st[i][1])return!1;for(;i>=e;)if(r=e+i>>1,s>t[r][1])e=r+1;else if(s=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let i=this.wcwidth(t),r=i===0&&e!==0;if(r){let n=Ce.extractWidth(e);n===0?r=!1:n>i&&(i=n)}return Ce.createPropertyValue(0,i,r)}};var Ce=class s{constructor(){this._providers=Object.create(null);this._active="";this._onChange=new g;this.onChange=this._onChange.event;let t=new hn;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,e,i=!1){return(t&16777215)<<3|(e&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let e=0,i=0,r=t.length;for(let n=0;n=r)return e+this.wcwidth(o);let u=t.charCodeAt(n);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:e+=this.wcwidth(u)}let l=this.charProperties(o,i),a=s.extractWidth(l);s.extractShouldJoin(l)&&(a-=s.extractWidth(i)),e+=a,i=l}return e}charProperties(t,e){return this._activeProvider.charProperties(t,e)}};var dn=class{constructor(){this.glevel=0;this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function ks(s){let e=s.buffer.lines.get(s.buffer.ybase+s.buffer.y-1)?.get(s.cols-1),i=s.buffer.lines.get(s.buffer.ybase+s.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Gi=2147483647,oc=256,ci=class s{constructor(t=32,e=32){this.maxLength=t;this.maxSubParamsLength=e;if(e>oc)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(e),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let e=new s;if(!t.length)return e;for(let i=Array.isArray(t[0])?1:0;i>8,r=this._subParamsIdx[e]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Gi?Gi:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Gi?Gi:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let e=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-e>0?this._subParams.subarray(e,i):null}getSubParamsAll(){let t={};for(let e=0;e>8,r=this._subParamsIdx[e]&255;r-i>0&&(t[e]=this._subParams.slice(i,r))}return t}addDigit(t){let e;if(this._rejectDigits||!(e=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[e-1];i[e-1]=~r?Math.min(r*10+t,Gi):t}};var zi=[],fn=class{constructor(){this._state=0;this._active=zi;this._id=-1;this._handlers=Object.create(null);this._handlerFb=()=>{};this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=zi}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=zi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||zi,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",yt(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){if(this._state!==3){if(this._state===1)for(;e0&&this._put(t,e,i)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,n=this._stack.fallThrough,this._stack.paused=!1),!n&&i===!1){for(;r>=0&&(i=this._active[r].end(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=zi,this._id=-1,this._state=0}}},pe=class{constructor(t){this._handler=t;this._data="";this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=yt(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}};var $i=[],pn=class{constructor(){this._handlers=Object.create(null);this._active=$i;this._ident=0;this._handlerFb=()=>{};this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$i}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=$i,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||$i,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(e)}put(t,e,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",yt(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let i=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,n=this._stack.fallThrough,this._stack.paused=!1),!n&&i===!1){for(;r>=0&&(i=this._active[r].unhook(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=$i,this._ident=0}},Vi=new ci;Vi.addParam(0);var qi=class{constructor(t){this._handler=t;this._data="";this._params=Vi;this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Vi,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=yt(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Vi,this._data="",this._hitLimit=!1,i));return this._params=Vi,this._data="",this._hitLimit=!1,e}};var Ms=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,i,r){this.table[e<<8|t]=i<<4|r}addMany(t,e,i,r){for(let n=0;nu),i=(a,u)=>e.slice(a,u),r=i(32,127),n=i(0,24);n.push(25),n.push.apply(n,i(28,32));let o=i(0,14),l;s.setDefault(1,0),s.addMany(r,0,2,0);for(l in o)s.addMany([24,26,153,154],l,3,0),s.addMany(i(128,144),l,3,0),s.addMany(i(144,152),l,3,0),s.add(156,l,0,0),s.add(27,l,11,1),s.add(157,l,4,8),s.addMany([152,158,159],l,0,7),s.add(155,l,11,3),s.add(144,l,11,9);return s.addMany(n,0,3,0),s.addMany(n,1,3,1),s.add(127,1,0,1),s.addMany(n,8,0,8),s.addMany(n,3,3,3),s.add(127,3,0,3),s.addMany(n,4,3,4),s.add(127,4,0,4),s.addMany(n,6,3,6),s.addMany(n,5,3,5),s.add(127,5,0,5),s.addMany(n,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(r,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(i(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(r,7,0,7),s.addMany(n,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(i(64,127),3,7,0),s.addMany(i(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(i(48,60),4,8,4),s.addMany(i(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(i(32,64),6,0,6),s.add(127,6,0,6),s.addMany(i(64,127),6,0,0),s.addMany(i(32,48),3,9,5),s.addMany(i(32,48),5,9,5),s.addMany(i(48,64),5,0,6),s.addMany(i(64,127),5,7,0),s.addMany(i(32,48),4,9,5),s.addMany(i(32,48),1,9,2),s.addMany(i(32,48),2,9,2),s.addMany(i(48,127),2,10,0),s.addMany(i(48,80),1,10,0),s.addMany(i(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(i(96,127),1,10,0),s.add(80,1,11,9),s.addMany(n,9,0,9),s.add(127,9,0,9),s.addMany(i(28,32),9,0,9),s.addMany(i(32,48),9,9,12),s.addMany(i(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(n,11,0,11),s.addMany(i(32,128),11,0,11),s.addMany(i(28,32),11,0,11),s.addMany(n,10,0,10),s.add(127,10,0,10),s.addMany(i(28,32),10,0,10),s.addMany(i(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(i(32,48),10,9,12),s.addMany(n,12,0,12),s.add(127,12,0,12),s.addMany(i(28,32),12,0,12),s.addMany(i(32,48),12,9,12),s.addMany(i(48,64),12,0,11),s.addMany(i(64,127),12,12,13),s.addMany(i(64,127),10,12,13),s.addMany(i(64,127),9,12,13),s.addMany(n,13,13,13),s.addMany(r,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(Me,0,2,0),s.add(Me,8,5,8),s.add(Me,6,0,6),s.add(Me,11,0,11),s.add(Me,13,13,13),s}(),mn=class extends y{constructor(e=lc){super();this._transitions=e;this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0};this.initialState=0,this.currentState=this.initialState,this._params=new ci,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,n)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(M(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new fn),this._dcsParser=this._register(new pn),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;ol||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(i[0]>n||n>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=n,r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(i),{dispose:()=>{let o=n.indexOf(i);o!==-1&&n.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(i),{dispose:()=>{let o=n.indexOf(i);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,i,r,n,o){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,i,r){let n=0,o=0,l=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&h>-1){for(;h>=0&&(a=u[h](this._params),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 4:if(r===!1&&h>-1){for(;h>=0&&(a=u[h](),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(n!==24&&n!==26,r),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],a=this._oscParser.end(n!==24&&n!==26,r),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let u=l;u>4){case 2:for(let f=u+1;;++f){if(f>=i||(n=e[f])<32||n>126&&n=i||(n=e[f])<32||n>126&&n=i||(n=e[f])<32||n>126&&n=i||(n=e[f])<32||n>126&&n=0&&(a=c[d](this._params),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(3,c,d,o,u),a;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++u47&&n<60);u--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let v=this._escHandlers[this._collect<<8|n],p=v?v.length-1:-1;for(;p>=0&&(a=v[p](),a!==!0);p--)if(a instanceof Promise)return this._preserveStack(4,v,p,o,u),a;p<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let f=u+1;;++f)if(f>=i||(n=e[f])===24||n===26||n===27||n>127&&n=i||(n=e[f])<32||n>127&&n>4:n>>8}return i}}function Ps(s,t){let e=s.toString(16),i=e.length<2?"0"+e:e;switch(t){case 4:return e[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function hl(s,t=16){let[e,i,r]=s;return`rgb:${Ps(e,t)}/${Ps(i,t)}/${Ps(r,t)}`}var hc={"(":0,")":1,"*":2,"+":3,"-":1,".":2},at=131072,dl=10;function fl(s,t){if(s>24)return t.setWinLines||!1;switch(s){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var pl=5e3,ml=0,_n=class extends y{constructor(e,i,r,n,o,l,a,u,h=new mn){super();this._bufferService=e;this._charsetService=i;this._coreService=r;this._logService=n;this._optionsService=o;this._oscLinkService=l;this._coreMouseService=a;this._unicodeService=u;this._parser=h;this._parseBuffer=new Uint32Array(4096);this._stringDecoder=new Zi;this._utf8Decoder=new Qi;this._windowTitle="";this._iconName="";this._windowTitleStack=[];this._iconNameStack=[];this._curAttrData=Q.clone();this._eraseAttrDataInternal=Q.clone();this._onRequestBell=this._register(new g);this.onRequestBell=this._onRequestBell.event;this._onRequestRefreshRows=this._register(new g);this.onRequestRefreshRows=this._onRequestRefreshRows.event;this._onRequestReset=this._register(new g);this.onRequestReset=this._onRequestReset.event;this._onRequestSendFocus=this._register(new g);this.onRequestSendFocus=this._onRequestSendFocus.event;this._onRequestSyncScrollBar=this._register(new g);this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event;this._onRequestWindowsOptionsReport=this._register(new g);this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event;this._onA11yChar=this._register(new g);this.onA11yChar=this._onA11yChar.event;this._onA11yTab=this._register(new g);this.onA11yTab=this._onA11yTab.event;this._onCursorMove=this._register(new g);this.onCursorMove=this._onCursorMove.event;this._onLineFeed=this._register(new g);this.onLineFeed=this._onLineFeed.event;this._onScroll=this._register(new g);this.onScroll=this._onScroll.event;this._onTitleChange=this._register(new g);this.onTitleChange=this._onTitleChange.event;this._onColor=this._register(new g);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 Yi(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:d.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,d,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:d,data:v})}),this._parser.setDcsHandlerFallback((c,d,v)=>{d==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:d,payload:v})}),this._parser.setPrintHandler((c,d,v)=>this.print(c,d,v)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(b.BEL,()=>this.bell()),this._parser.setExecuteHandler(b.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(b.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(b.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(b.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(b.BS,()=>this.backspace()),this._parser.setExecuteHandler(b.HT,()=>this.tab()),this._parser.setExecuteHandler(b.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(b.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Di.IND,()=>this.index()),this._parser.setExecuteHandler(Di.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Di.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new pe(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new pe(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new pe(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new pe(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new pe(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new pe(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new pe(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new pe(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new pe(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new pe(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new pe(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new pe(c=>this.restoreCursorColor(c))),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(let c in ne)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new qi((c,d)=>this.requestStatusString(c,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((i,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),pl))]).catch(i=>{if(i!=="#SLOW_TIMEOUT")throw i;console.warn(`async parser handler taking longer than ${pl} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let r,n=this._activeBuffer.x,o=this._activeBuffer.y,l=0,a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>at&&(l=this._parseStack.position+at)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`,typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.lengthat)for(let c=l;c0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let p=this._parser.precedingJoinState;for(let f=i;fu){if(h){let N=v,I=this._activeBuffer.x-D;for(this._activeBuffer.x=D,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),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),D>0&&v instanceof Qe&&v.copyCellsFrom(N,I,0,D,!1);I=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(v.insertCells(this._activeBuffer.x,o-D,this._activeBuffer.getNullCell(d)),v.getWidth(u-1)===2&&v.setCellFromCodepoint(u-1,0,1,d)),v.setCellFromCodepoint(this._activeBuffer.x++,n,o,d),o>0)for(;--o;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=p,this._activeBuffer.x0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>fl(r.params[0],this._optionsService.rawOptions.windowOptions)?i(r):!0):this._parser.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new qi(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new pe(i))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let 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,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,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){let i=e.params[0];return i===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:i===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return i===1&&(this._curAttrData.bg|=536870912),(i===2||i===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,i,r,n=!1,o=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(i,r,this._activeBuffer.getNullCell(this._eraseAttrData()),o),n&&(l.isWrapped=!1)}_resetBufferLine(e,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,i=!1){this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);r=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 2:for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,i=!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,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let c=h;for(let d=1;d0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(b.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(b.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(b.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(b.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(b.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let i=0;i(P[P.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",P[P.SET=1]="SET",P[P.RESET=2]="RESET",P[P.PERMANENTLY_SET=3]="PERMANENTLY_SET",P[P.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(r||={});let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,a=this._coreService,{buffers:u,cols:h}=this._bufferService,{active:c,alt:d}=u,v=this._optionsService.rawOptions,p=(A,D)=>(a.triggerDataEvent(`${b.ESC}[${i?"":"?"}${A};${D}$y`),!0),f=A=>A?1:2,m=e.params[0];return i?m===2?p(m,4):m===4?p(m,f(a.modes.insertMode)):m===12?p(m,3):m===20?p(m,f(v.convertEol)):p(m,0):m===1?p(m,f(n.applicationCursorKeys)):m===3?p(m,v.windowOptions.setWinLines?h===80?2:h===132?1:0:0):m===6?p(m,f(n.origin)):m===7?p(m,f(n.wraparound)):m===8?p(m,3):m===9?p(m,f(o==="X10")):m===12?p(m,f(v.cursorBlink)):m===25?p(m,f(!a.isCursorHidden)):m===45?p(m,f(n.reverseWraparound)):m===66?p(m,f(n.applicationKeypad)):m===67?p(m,4):m===1e3?p(m,f(o==="VT200")):m===1002?p(m,f(o==="DRAG")):m===1003?p(m,f(o==="ANY")):m===1004?p(m,f(n.sendFocus)):m===1005?p(m,4):m===1006?p(m,f(l==="SGR")):m===1015?p(m,4):m===1016?p(m,f(l==="SGR_PIXELS")):m===1048?p(m,1):m===47||m===1047||m===1049?p(m,f(c===d)):m===2004?p(m,f(n.bracketedPasteMode)):p(m,0)}_updateAttrColor(e,i,r,n,o){return i===2?(e|=50331648,e&=-16777216,e|=Le.fromColorRGB([r,n,o])):i===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,i,r){let n=[0,0,-1,0,0,0],o=0,l=0;do{if(n[l+o]=e.params[i+l],e.hasSubParams(i+l)){let a=e.getSubParams(i+l),u=0;do n[1]===5&&(o=1),n[l+u+1+o]=a[u];while(++u=2||n[1]===2&&l+o>=5)break;n[1]&&(o=1)}while(++l+i5)&&(e=1),i.extended.underlineStyle=e,i.fg|=268435456,e===0&&(i.fg&=-268435457),i.updateExtended()}_processSGR0(e){e.fg=Q.fg,e.bg=Q.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;let i=e.length,r,n=this._curAttrData;for(let o=0;o=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=Q.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=Q.bg&16777215):r===38||r===48||r===58?o+=this._extractColor(e,o,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=Q.fg&16777215,n.bg&=-67108864,n.bg|=Q.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${b.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${b.ESC}[${i};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${b.ESC}[?${i};${r}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}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=Q.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){let i=e.params[0]||1;switch(i){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";break}let r=i%2===1;return this._optionsService.options.cursorBlink=r,!0}setScrollRegion(e){let i=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!fl(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:i!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${b.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(i===0||i===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>dl&&this._windowTitleStack.shift()),(i===0||i===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>dl&&this._iconNameStack.shift());break;case 23:(i===0||i===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(i===0||i===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}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){let i=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),o=r.shift();if(/^\d+$/.exec(n)){let l=parseInt(n);if(_l(l))if(o==="?")i.push({type:0,index:l});else{let a=Os(o);a&&i.push({type:1,index:l,color:a})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(i===-1)return!0;let r=e.slice(0,i).trim(),n=e.slice(i+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,o=r.findIndex(l=>l.startsWith("id="));return o!==-1&&(n=r[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let r=e.split(";");for(let n=0;n=this._specialColors.length);++n,++i)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let o=Os(r[n]);o&&this._onColor.fire([{type:1,index:this._specialColors[i],color:o}])}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;let i=[],r=e.split(";");for(let n=0;n=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){let 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=Q.clone(),this._eraseAttrDataInternal=Q.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new j;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i(this._coreService.triggerDataEvent(`${b.ESC}${a}${b.ESC}\\`),!0),n=this._bufferService.buffer,o=this._optionsService.rawOptions,l={block:2,underline:4,bar:6};return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${l[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},Yi=class{constructor(t){this._bufferService=t;this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){tthis.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(ml=t,t=e,e=ml),tthis.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Yi=C([E(0,F)],Yi);function _l(s){return 0<=s&&s<256}var dc=5e7,bl=12,fc=50,bn=class extends y{constructor(e){super();this._action=e;this._writeBuffer=[];this._callbacks=[];this._pendingData=0;this._bufferOffset=0;this._isSyncWriting=!1;this._syncCalls=0;this._didUserInput=!1;this._onWriteParsed=this._register(new g);this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>dc)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],o=this._action(n,i);if(o){let a=u=>Date.now()-r>=bl?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(r,u);o.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(a);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,Date.now()-r>=bl)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>fc&&(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()}};var ui=class{constructor(t){this._bufferService=t;this._nextId=1;this._entriesWithId=new Map;this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let a=e.addMarker(e.ybase+e.y),u={data:t,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(u,a)),this._dataByLinkId.set(u.id,u),u.id}let i=t,r=this._getEntryIdKey(i),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,e.ybase+e.y),n.id;let o=e.addMarker(e.ybase+e.y),l={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(t,e){let i=this._dataByLinkId.get(t);if(i&&i.lines.every(r=>r.line!==e)){let r=this._bufferService.buffer.addMarker(e);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(t){return this._dataByLinkId.get(t)?.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let i=t.lines.indexOf(e);i!==-1&&(t.lines.splice(i,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};ui=C([E(0,F)],ui);var vl=!1,vn=class extends y{constructor(e){super();this._windowsWrappingHeuristics=this._register(new ye);this._onBinary=this._register(new g);this.onBinary=this._onBinary.event;this._onData=this._register(new g);this.onData=this._onData.event;this._onLineFeed=this._register(new g);this.onLineFeed=this._onLineFeed.event;this._onResize=this._register(new g);this.onResize=this._onResize.event;this._onWriteParsed=this._register(new g);this.onWriteParsed=this._onWriteParsed.event;this._onScroll=this._register(new g);this._instantiationService=new sn,this.optionsService=this._register(new un(e)),this._instantiationService.setService(W,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ni)),this._instantiationService.setService(F,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ii)),this._instantiationService.setService(tr,this._logService),this.coreService=this._register(this._instantiationService.createInstance(li)),this._instantiationService.setService(Fe,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ai)),this._instantiationService.setService(er,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ce)),this._instantiationService.setService(qs,this.unicodeService),this._charsetService=this._instantiationService.createInstance(dn),this._instantiationService.setService(Vs,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ui),this._instantiationService.setService(ir,this._oscLinkService),this._inputHandler=this._register(new _n(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(V.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(V.forward(this._bufferService.onResize,this._onResize)),this._register(V.forward(this.coreService.onData,this._onData)),this._register(V.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new bn((i,r)=>this._inputHandler.parse(i,r))),this._register(V.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new g),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!vl&&(this._logService.warn("writeSync is unreliable and will be removed soon."),vl=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,ws),i=Math.max(i,Ds),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(ks.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(ks(this._bufferService),!1))),this._windowsWrappingHeuristics.value=M(()=>{for(let i of e)i.dispose()})}}};var mc={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:["'",'"']};function gl(s,t,e,i){let r={type:0,cancel:!1,key:void 0},n=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?t?r.key=b.ESC+"OA":r.key=b.ESC+"[A":s.key==="UIKeyInputLeftArrow"?t?r.key=b.ESC+"OD":r.key=b.ESC+"[D":s.key==="UIKeyInputRightArrow"?t?r.key=b.ESC+"OC":r.key=b.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(t?r.key=b.ESC+"OB":r.key=b.ESC+"[B");break;case 8:r.key=s.ctrlKey?"\b":b.DEL,s.altKey&&(r.key=b.ESC+r.key);break;case 9:if(s.shiftKey){r.key=b.ESC+"[Z";break}r.key=b.HT,r.cancel=!0;break;case 13:r.key=s.altKey?b.ESC+b.CR:b.CR,r.cancel=!0;break;case 27:r.key=b.ESC,s.altKey&&(r.key=b.ESC+b.ESC),r.cancel=!0;break;case 37:if(s.metaKey)break;n?(r.key=b.ESC+"[1;"+(n+1)+"D",r.key===b.ESC+"[1;3D"&&(r.key=b.ESC+(e?"b":"[1;5D"))):t?r.key=b.ESC+"OD":r.key=b.ESC+"[D";break;case 39:if(s.metaKey)break;n?(r.key=b.ESC+"[1;"+(n+1)+"C",r.key===b.ESC+"[1;3C"&&(r.key=b.ESC+(e?"f":"[1;5C"))):t?r.key=b.ESC+"OC":r.key=b.ESC+"[C";break;case 38:if(s.metaKey)break;n?(r.key=b.ESC+"[1;"+(n+1)+"A",!e&&r.key===b.ESC+"[1;3A"&&(r.key=b.ESC+"[1;5A")):t?r.key=b.ESC+"OA":r.key=b.ESC+"[A";break;case 40:if(s.metaKey)break;n?(r.key=b.ESC+"[1;"+(n+1)+"B",!e&&r.key===b.ESC+"[1;3B"&&(r.key=b.ESC+"[1;5B")):t?r.key=b.ESC+"OB":r.key=b.ESC+"[B";break;case 45:!s.shiftKey&&!s.ctrlKey&&(r.key=b.ESC+"[2~");break;case 46:n?r.key=b.ESC+"[3;"+(n+1)+"~":r.key=b.ESC+"[3~";break;case 36:n?r.key=b.ESC+"[1;"+(n+1)+"H":t?r.key=b.ESC+"OH":r.key=b.ESC+"[H";break;case 35:n?r.key=b.ESC+"[1;"+(n+1)+"F":t?r.key=b.ESC+"OF":r.key=b.ESC+"[F";break;case 33:s.shiftKey?r.type=2:s.ctrlKey?r.key=b.ESC+"[5;"+(n+1)+"~":r.key=b.ESC+"[5~";break;case 34:s.shiftKey?r.type=3:s.ctrlKey?r.key=b.ESC+"[6;"+(n+1)+"~":r.key=b.ESC+"[6~";break;case 112:n?r.key=b.ESC+"[1;"+(n+1)+"P":r.key=b.ESC+"OP";break;case 113:n?r.key=b.ESC+"[1;"+(n+1)+"Q":r.key=b.ESC+"OQ";break;case 114:n?r.key=b.ESC+"[1;"+(n+1)+"R":r.key=b.ESC+"OR";break;case 115:n?r.key=b.ESC+"[1;"+(n+1)+"S":r.key=b.ESC+"OS";break;case 116:n?r.key=b.ESC+"[15;"+(n+1)+"~":r.key=b.ESC+"[15~";break;case 117:n?r.key=b.ESC+"[17;"+(n+1)+"~":r.key=b.ESC+"[17~";break;case 118:n?r.key=b.ESC+"[18;"+(n+1)+"~":r.key=b.ESC+"[18~";break;case 119:n?r.key=b.ESC+"[19;"+(n+1)+"~":r.key=b.ESC+"[19~";break;case 120:n?r.key=b.ESC+"[20;"+(n+1)+"~":r.key=b.ESC+"[20~";break;case 121:n?r.key=b.ESC+"[21;"+(n+1)+"~":r.key=b.ESC+"[21~";break;case 122:n?r.key=b.ESC+"[23;"+(n+1)+"~":r.key=b.ESC+"[23~";break;case 123:n?r.key=b.ESC+"[24;"+(n+1)+"~":r.key=b.ESC+"[24~";break;default:if(s.ctrlKey&&!s.shiftKey&&!s.altKey&&!s.metaKey)s.keyCode>=65&&s.keyCode<=90?r.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?r.key=b.NUL:s.keyCode>=51&&s.keyCode<=55?r.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?r.key=b.DEL:s.keyCode===219?r.key=b.ESC:s.keyCode===220?r.key=b.FS:s.keyCode===221&&(r.key=b.GS);else if((!e||i)&&s.altKey&&!s.metaKey){let l=mc[s.keyCode]?.[s.shiftKey?1:0];if(l)r.key=b.ESC+l;else if(s.keyCode>=65&&s.keyCode<=90){let a=s.ctrlKey?s.keyCode-64:s.keyCode+32,u=String.fromCharCode(a);s.shiftKey&&(u=u.toUpperCase()),r.key=b.ESC+u}else if(s.keyCode===32)r.key=b.ESC+(s.ctrlKey?b.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let a=s.code.slice(3,4);s.shiftKey||(a=a.toLowerCase()),r.key=b.ESC+a,r.cancel=!0}}else e&&!s.altKey&&!s.ctrlKey&&!s.shiftKey&&s.metaKey?s.keyCode===65&&(r.type=1):s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?r.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(r.key=b.US),s.key==="@"&&(r.key=b.NUL));break}return r}var te=0,gn=class{constructor(t){this._getKey=t;this._array=[];this._insertedValues=[];this._flushInsertedTask=new Qt;this._isFlushingInserted=!1;this._deletedIndices=[];this._flushDeletedTask=new Qt;this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),e=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n=this._array.length||this._getKey(t[e])<=this._getKey(this._array[i])?(r[n]=t[e],e++):r[n]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(te=this._search(e),te===-1)||this._getKey(this._array[te])!==e)return!1;do if(this._array[te]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(te),!0;while(++ten-o),e=0,i=new Array(this._array.length-t.length),r=0;for(let n=0;n0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(te=this._search(t),!(te<0||te>=this._array.length)&&this._getKey(this._array[te])===t))do yield this._array[te];while(++te=this._array.length)&&this._getKey(this._array[te])===t))do e(this._array[te]);while(++te=e;){let r=e+i>>1,n=this._getKey(this._array[r]);if(n>t)i=r-1;else if(n0&&this._getKey(this._array[r-1])===t;)r--;return r}}return e}};var Bs=0,Sl=0,Sn=class extends y{constructor(){super();this._decorations=new gn(e=>e?.marker.line);this._onDecorationRegistered=this._register(new g);this.onDecorationRegistered=this._onDecorationRegistered.event;this._onDecorationRemoved=this._register(new g);this.onDecorationRemoved=this._onDecorationRemoved.event;this._register(M(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new Ns(e);if(i){let r=i.marker.onDispose(()=>i.dispose()),n=i.onDispose(()=>{n.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),r.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,r){let n=0,o=0;for(let l of this._decorations.getKeyIterator(i))n=l.options.x??0,o=n+(l.options.width??1),e>=n&&e{Bs=o.options.x??0,Sl=Bs+(o.options.width??1),e>=Bs&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}};var El=20;var Tl=!1,Et=class extends y{constructor(e,i,r,n){super();this._terminal=e;this._coreBrowserService=r;this._renderService=n;this._rowColumns=new WeakMap;this._liveRegionLineCount=0;this._charsToConsume=[];this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;lthis._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new En(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");Tl?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=o.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(o.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(o.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(R(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(M(()=>{Tl?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===El+1&&(this._liveRegion.textContent+=fi.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let r=this._terminal.buffer,n=r.lines.length.toString();for(let o=e;o<=i;o++){let l=r.lines.get(r.ydisp+o),a=[],u=l?.translateToString(!0,void 0,void 0,a)||"",h=(r.ydisp+o+1).toString(),c=this._rowElements[o];c&&(u.length===0?(c.innerText="\xA0",this._rowColumns.set(c,[0,1])):(c.textContent=u,this._rowColumns.set(c,a)),c.setAttribute("aria-posinset",h),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let r=e.target,n=this._rowElements[i===0?1:this._rowElements.length-2],o=r.getAttribute("aria-posinset"),l=i===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let a,u;if(i===0?(a=r,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(a=this._rowElements.shift(),u=r,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let i={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let o=({node:u,offset:h})=>{let c=u instanceof Text?u.parentNode:u,d=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(c);if(!v)return console.warn("columns is null. Race condition?"),null;let p=h=this._terminal.cols&&(++d,p=0),{row:d,column:p}},l=o(i),a=o(r);if(!(!l||!a)){if(l.row>a.row||l.row===a.row&&l.column>=a.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(a.row-l.row)*this._terminal.cols-l.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;ie;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{We(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(R(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(R(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(R(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(R(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let r=e.composedPath();for(let n=0;n{n?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(n)&&(r=this._checkLinkProviderResult(n,e,r)):o.provideLinks(e.y,l=>{if(this._isMouseOut)return;let a=l?.map(u=>({link:u}));this._activeProviderReplies?.set(n,a),r=this._checkLinkProviderResult(n,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let r=new Set;for(let n=0;ne?this._bufferService.cols:a.link.range.end.x;for(let c=u;c<=h;c++){if(r.has(c)){o.splice(l--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),o=!1;for(let l=0;lthis._linkAtPosition(a.link,i));l&&(r=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let l=0;lthis._linkAtPosition(u.link,i));if(a){r=!0,this._handleNewLink(a);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink&&bc(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){!this._currentLink||!this._lastMouseEvent||(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,We(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(n,o),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(e,i){let r=e.range,n=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,o=i.y*this._bufferService.cols+i.x;return r<=o&&o<=n}_positionFromMouseEvent(e,i,r){let n=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,n,o){return{x1:e,y1:i,x2:r,y2:n,cols:this._bufferService.cols,fg:o}}};hi=C([E(1,Rt),E(2,ae),E(3,F),E(4,nr)],hi);function bc(s,t){return s.text===t.text&&s.range.start.x===t.range.start.x&&s.range.start.y===t.range.start.y&&s.range.end.x===t.range.end.x&&s.range.end.y===t.range.end.y}var Tn=class extends vn{constructor(e={}){super(e);this._linkifier=this._register(new ye);this.browser=Gr;this._keyDownHandled=!1;this._keyDownSeen=!1;this._keyPressHandled=!1;this._unprocessedDeadKey=!1;this._accessibilityManager=this._register(new ye);this._onCursorMove=this._register(new g);this.onCursorMove=this._onCursorMove.event;this._onKey=this._register(new g);this.onKey=this._onKey.event;this._onRender=this._register(new g);this.onRender=this._onRender.event;this._onSelectionChange=this._register(new g);this.onSelectionChange=this._onSelectionChange.event;this._onTitleChange=this._register(new g);this.onTitleChange=this._onTitleChange.event;this._onBell=this._register(new g);this.onBell=this._onBell.event;this._onFocus=this._register(new g);this._onBlur=this._register(new g);this._onA11yCharEmitter=this._register(new g);this._onA11yTabEmitter=this._register(new g);this._onWillOpen=this._register(new g);this._setup(),this._decorationService=this._instantiationService.createInstance(Sn),this._instantiationService.setService(He,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Qr),this._instantiationService.setService(nr,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Dt)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(V.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(V.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(V.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(V.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(M(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let i of e){let r,n="";switch(i.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+i.index}switch(i.type){case 0:let o=K.toColorRGB(r==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${b.ESC}]${n};${hl(o)}${us.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[i.index]=Z.toColor(...i.color));else{let l=r;this._themeService.modifyColors(a=>a[l]=Z.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Et,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(b.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(b.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,o=i.getWidth(r),l=this._renderService.dimensions.css.cell.width*o,a=this.buffer.y*this._renderService.dimensions.css.cell.height,u=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=a+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(R(this.element,"copy",i=>{this.hasSelection()&&Us(i,this._selectionService)}));let e=i=>Ks(i,this.textarea,this.coreService,this.optionsService);this._register(R(this.textarea,"paste",e)),this._register(R(this.element,"paste",e)),Kr?this._register(R(this.element,"mousedown",i=>{i.button===2&&kn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(R(this.element,"contextmenu",i=>{kn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ki&&this._register(R(this.element,"auxclick",i=>{i.button===1&&An(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(R(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(R(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(R(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(R(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(R(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(R(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(R(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(R(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",di.get()),ds||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(Zr,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(le,this._coreBrowserService),this._register(R(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(R(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Xt,this._document,this._helperContainer),this._instantiationService.setService(it,this._charSizeService),this._themeService=this._instantiationService.createInstance(ti),this._instantiationService.setService(Ae,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(lt),this._instantiationService.setService(rr,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Jt,this.rows,this.screenElement)),this._instantiationService.setService(ae,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Vt,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Zt),this._instantiationService.setService(Rt,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(hi,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(zt,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ei,this.element,this.screenElement,r)),this._instantiationService.setService(Ys,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(this._onScroll.event(()=>this._selectionService.refresh())),this._register(this._instantiationService.createInstance($t,this.screenElement)),this._register(R(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Et,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mt,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mt,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(jt,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(l){let a=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!a)return!1;let u,h;switch(l.overrideType||l.type){case"mousemove":h=32,l.buttons===void 0?(u=3,l.button!==void 0&&(u=l.button<3?l.button:3)):u=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":h=0,u=l.button<3?l.button:3;break;case"mousedown":h=1,u=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let c=l.deltaY;if(c===0)return!1;h=c<0?0:1,u=4;break;default:return!1}return h===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:u,action:h,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(r(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(r(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&r(l)},mousemove:l=>{l.buttons||r(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?n.mousemove||(i.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(i.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(i.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(i.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(R(i,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return r(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(R(i,"wheel",l=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;let u=b.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?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(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){Ln(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,r){this._selectionService.setSelection(e,i,r)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=gl(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===b.ETX||r.key===b.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(vc(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;t--)this._addons[t].instance.dispose()}loadAddon(t,e){let i={instance:e,dispose:e.dispose,isDisposed:!1};this._addons.push(i),e.dispose=()=>this._wrappedAddonDispose(i),e.activate(t)}_wrappedAddonDispose(t){if(t.isDisposed)return;let e=-1;for(let i=0;i=this._line.length))return e?(this._line.loadCell(t,e),e):this._line.loadCell(t,new j)}translateToString(t,e,i){return this._line.translateToString(t,e,i)}};var ji=class{constructor(t,e){this._buffer=t;this.type=e}init(t){return this._buffer=t,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(t){let e=this._buffer.lines.get(t);if(e)return new yn(e)}getNullCell(){return new j}};var xn=class extends y{constructor(e){super();this._core=e;this._onBufferChange=this._register(new g);this.onBufferChange=this._onBufferChange.event;this._normal=new ji(this._core.buffers.normal,"normal"),this._alternate=new ji(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)}};var wn=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}};var Dn=class{constructor(t){this._core=t}register(t){this._core.unicodeService.register(t)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t}};var gc=["cols","rows"],ze=0,Il=class extends y{constructor(t){super(),this._core=this._register(new Tn(t)),this._addonManager=this._register(new In),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,n)=>{this._checkReadonlyOptions(r),this._core.options[r]=n};for(let r in this._core.options){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,n)}}_checkReadonlyOptions(t){if(gc.includes(t))throw new Error(`Option "${t}" 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 wn(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Dn(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 xn(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r +`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return di.get()},set promptLabel(t){di.set(t)},get tooMuchOutput(){return fi.get()},set tooMuchOutput(t){fi.set(t)}}}_verifyIntegers(...t){for(ze of t)if(ze===1/0||isNaN(ze)||ze%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(ze of t)if(ze&&(ze===1/0||isNaN(ze)||ze%1!==0||ze<0))throw new Error("This API only accepts positive integers")}};export{Il as Terminal}; +//# sourceMappingURL=xterm.mjs.map diff --git a/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.mjs.map b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.mjs.map new file mode 100644 index 0000000..9cefbd0 --- /dev/null +++ b/src/public/build/es6/node_modules/@xterm/xterm/lib/xterm.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/browser/LocalizableStrings.ts", "../src/browser/Clipboard.ts", "../src/common/input/TextDecoder.ts", "../src/common/buffer/Constants.ts", "../src/common/buffer/AttributeData.ts", "../src/common/buffer/CellData.ts", "../src/common/services/ServiceRegistry.ts", "../src/common/services/Services.ts", "../src/browser/OscLinkProvider.ts", "../src/browser/services/Services.ts", "../src/vs/base/common/errors.ts", "../src/vs/base/common/arraysFind.ts", "../src/vs/base/common/arrays.ts", "../src/vs/base/common/collections.ts", "../src/vs/base/common/map.ts", "../src/vs/base/common/functional.ts", "../src/vs/base/common/iterator.ts", "../src/vs/base/common/lifecycle.ts", "../src/vs/base/browser/window.ts", "../src/vs/base/common/linkedList.ts", "../src/vs/base/common/stopwatch.ts", "../src/vs/base/common/event.ts", "../src/vs/base/browser/browser.ts", "../src/vs/base/common/platform.ts", "../src/vs/base/browser/canIUse.ts", "../src/vs/base/common/keyCodes.ts", "../src/vs/base/common/keybindings.ts", "../src/vs/base/browser/keyboardEvent.ts", "../src/vs/base/browser/iframe.ts", "../src/vs/base/browser/mouseEvent.ts", "../src/vs/base/common/cancellation.ts", "../src/vs/base/common/symbols.ts", "../src/vs/base/common/async.ts", "../src/vs/base/common/strings.ts", "../src/vs/base/common/hash.ts", "../src/vs/base/browser/dom.ts", "../src/vs/base/browser/fastDomNode.ts", "../src/vs/base/browser/globalPointerMoveMonitor.ts", "../src/vs/base/common/decorators.ts", "../src/vs/base/browser/touch.ts", "../src/vs/base/browser/ui/widget.ts", "../src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts", "../src/vs/base/common/scrollable.ts", "../src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts", "../src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts", "../src/vs/base/browser/ui/scrollbar/scrollbarState.ts", "../src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts", "../src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts", "../src/vs/base/browser/ui/scrollbar/scrollableElement.ts", "../src/browser/Viewport.ts", "../src/browser/decorations/BufferDecorationRenderer.ts", "../src/browser/decorations/ColorZoneStore.ts", "../src/browser/decorations/OverviewRulerRenderer.ts", "../src/common/data/EscapeSequences.ts", "../src/browser/input/CompositionHelper.ts", "../src/common/Platform.ts", "../src/browser/renderer/shared/Constants.ts", "../src/common/Color.ts", "../src/browser/services/CharacterJoinerService.ts", "../src/browser/renderer/shared/RendererUtils.ts", "../src/browser/renderer/dom/DomRendererRowFactory.ts", "../src/browser/renderer/dom/WidthCache.ts", "../src/browser/renderer/shared/SelectionRenderModel.ts", "../src/browser/renderer/dom/DomRenderer.ts", "../src/browser/services/CharSizeService.ts", "../src/browser/services/CoreBrowserService.ts", "../src/browser/services/LinkProviderService.ts", "../src/browser/input/Mouse.ts", "../src/browser/services/MouseService.ts", "../src/browser/RenderDebouncer.ts", "../src/common/TaskQueue.ts", "../src/browser/services/RenderService.ts", "../src/browser/input/MoveToCell.ts", "../src/browser/selection/SelectionModel.ts", "../src/common/buffer/BufferRange.ts", "../src/browser/services/SelectionService.ts", "../src/common/MultiKeyMap.ts", "../src/browser/ColorContrastCache.ts", "../src/browser/Types.ts", "../src/browser/services/ThemeService.ts", "../src/common/services/InstantiationService.ts", "../src/common/services/LogService.ts", "../src/common/CircularList.ts", "../src/common/buffer/BufferLine.ts", "../src/common/buffer/BufferReflow.ts", "../src/common/buffer/Marker.ts", "../src/common/data/Charsets.ts", "../src/common/buffer/Buffer.ts", "../src/common/buffer/BufferSet.ts", "../src/common/services/BufferService.ts", "../src/common/services/OptionsService.ts", "../src/common/Clone.ts", "../src/common/services/CoreService.ts", "../src/common/services/CoreMouseService.ts", "../src/common/input/UnicodeV6.ts", "../src/common/services/UnicodeService.ts", "../src/common/services/CharsetService.ts", "../src/common/WindowsMode.ts", "../src/common/parser/Params.ts", "../src/common/parser/OscParser.ts", "../src/common/parser/DcsParser.ts", "../src/common/parser/EscapeSequenceParser.ts", "../src/common/input/XParseColor.ts", "../src/common/InputHandler.ts", "../src/common/input/WriteBuffer.ts", "../src/common/services/OscLinkService.ts", "../src/common/CoreTerminal.ts", "../src/common/input/Keyboard.ts", "../src/common/SortedList.ts", "../src/common/services/DecorationService.ts", "../src/browser/TimeBasedDebouncer.ts", "../src/browser/AccessibilityManager.ts", "../src/browser/Linkifier.ts", "../src/browser/CoreBrowserTerminal.ts", "../src/common/public/AddonManager.ts", "../src/common/public/BufferLineApiView.ts", "../src/common/public/BufferApiView.ts", "../src/common/public/BufferNamespaceApi.ts", "../src/common/public/ParserApi.ts", "../src/common/public/UnicodeApi.ts", "../src/browser/public/Terminal.ts"], + "sourcesContent": ["/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n// This file contains strings that get exported in the API so they can be localized\n\nlet promptLabelInternal = 'Terminal input';\nconst promptLabel = {\n get: () => promptLabelInternal,\n set: (value: string) => promptLabelInternal = value\n};\n\nlet tooMuchOutputInternal = 'Too much output to announce, navigate to rows manually to read';\nconst tooMuchOutput = {\n get: () => tooMuchOutputInternal,\n set: (value: string) => tooMuchOutputInternal = value\n};\n\nexport {\n promptLabel,\n tooMuchOutput\n};\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionService } from 'browser/services/Services';\nimport { ICoreService, IOptionsService } from 'common/services/Services';\n\n/**\n * Prepares text to be pasted into the terminal by normalizing the line endings\n * @param text The pasted text that needs processing before inserting into the terminal\n */\nexport function prepareTextForTerminal(text: string): string {\n return text.replace(/\\r?\\n/g, '\\r');\n}\n\n/**\n * Bracket text for paste, if necessary, as per https://cirw.in/blog/bracketed-paste\n * @param text The pasted text to bracket\n */\nexport function bracketTextForPaste(text: string, bracketedPasteMode: boolean): string {\n if (bracketedPasteMode) {\n return '\\x1b[200~' + text + '\\x1b[201~';\n }\n return text;\n}\n\n/**\n * Binds copy functionality to the given terminal.\n * @param ev The original copy event to be handled\n */\nexport function copyHandler(ev: ClipboardEvent, selectionService: ISelectionService): void {\n if (ev.clipboardData) {\n ev.clipboardData.setData('text/plain', selectionService.selectionText);\n }\n // Prevent or the original text will be copied.\n ev.preventDefault();\n}\n\n/**\n * Redirect the clipboard's data to the terminal's input handler.\n */\nexport function handlePasteEvent(ev: ClipboardEvent, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n ev.stopPropagation();\n if (ev.clipboardData) {\n const text = ev.clipboardData.getData('text/plain');\n paste(text, textarea, coreService, optionsService);\n }\n}\n\nexport function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n text = prepareTextForTerminal(text);\n text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode && optionsService.rawOptions.ignoreBracketedPasteMode !== true);\n coreService.triggerDataEvent(text, true);\n textarea.value = '';\n}\n\n/**\n * Moves the textarea under the mouse cursor and focuses it.\n * @param ev The original right click event to be handled.\n * @param textarea The terminal's textarea.\n */\nexport function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement): void {\n\n // Calculate textarea position relative to the screen element\n const pos = screenElement.getBoundingClientRect();\n const left = ev.clientX - pos.left - 10;\n const top = ev.clientY - pos.top - 10;\n\n // Bring textarea at the cursor position\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = `${left}px`;\n textarea.style.top = `${top}px`;\n textarea.style.zIndex = '1000';\n\n textarea.focus();\n}\n\n/**\n * Bind to right-click event and allow right-click copy and paste.\n */\nexport function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement, selectionService: ISelectionService, shouldSelectWord: boolean): void {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n\n // Get textarea ready to copy from the context menu\n textarea.value = selectionService.selectionText;\n textarea.select();\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Polyfill - Convert UTF32 codepoint into JS string.\n * Note: The built-in String.fromCodePoint happens to be much slower\n * due to additional sanity checks. We can avoid them since\n * we always operate on legal UTF32 (granted by the input decoders)\n * and use this faster version instead.\n */\nexport function stringFromCodePoint(codePoint: number): string {\n if (codePoint > 0xFFFF) {\n codePoint -= 0x10000;\n return String.fromCharCode((codePoint >> 10) + 0xD800) + String.fromCharCode((codePoint % 0x400) + 0xDC00);\n }\n return String.fromCharCode(codePoint);\n}\n\n/**\n * Convert UTF32 char codes into JS string.\n * Basically the same as `stringFromCodePoint` but for multiple codepoints\n * in a loop (which is a lot faster).\n */\nexport function utf32ToString(data: Uint32Array, start: number = 0, end: number = data.length): string {\n let result = '';\n for (let i = start; i < end; ++i) {\n let codepoint = data[i];\n if (codepoint > 0xFFFF) {\n // JS strings are encoded as UTF16, thus a non BMP codepoint gets converted into a surrogate\n // pair conversion rules:\n // - subtract 0x10000 from code point, leaving a 20 bit number\n // - add high 10 bits to 0xD800 --> first surrogate\n // - add low 10 bits to 0xDC00 --> second surrogate\n codepoint -= 0x10000;\n result += String.fromCharCode((codepoint >> 10) + 0xD800) + String.fromCharCode((codepoint % 0x400) + 0xDC00);\n } else {\n result += String.fromCharCode(codepoint);\n }\n }\n return result;\n}\n\n/**\n * StringToUtf32 - decodes UTF16 sequences into UTF32 codepoints.\n * To keep the decoder in line with JS strings it handles single surrogates as UCS2.\n */\nexport class StringToUtf32 {\n private _interim: number = 0;\n\n /**\n * Clears interim and resets decoder to clean state.\n */\n public clear(): void {\n this._interim = 0;\n }\n\n /**\n * Decode JS string to UTF32 codepoints.\n * The methods assumes stream input and will store partly transmitted\n * surrogate pairs and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided input data does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: string, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let startPos = 0;\n\n // handle leftover surrogate high\n if (this._interim) {\n const second = input.charCodeAt(startPos++);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (this._interim - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = this._interim;\n target[size++] = second;\n }\n this._interim = 0;\n }\n\n for (let i = startPos; i < length; ++i) {\n const code = input.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n this._interim = code;\n return size;\n }\n const second = input.charCodeAt(i);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = code;\n target[size++] = second;\n }\n continue;\n }\n if (code === 0xFEFF) {\n // BOM\n continue;\n }\n target[size++] = code;\n }\n return size;\n }\n}\n\n/**\n * Utf8Decoder - decodes UTF8 byte sequences into UTF32 codepoints.\n */\nexport class Utf8ToUtf32 {\n public interim: Uint8Array = new Uint8Array(3);\n\n /**\n * Clears interim bytes and resets decoder to clean state.\n */\n public clear(): void {\n this.interim.fill(0);\n }\n\n /**\n * Decodes UTF8 byte sequences in `input` to UTF32 codepoints in `target`.\n * The methods assumes stream input and will store partly transmitted bytes\n * and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided data chunk does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: Uint8Array, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let byte1: number;\n let byte2: number;\n let byte3: number;\n let byte4: number;\n let codepoint = 0;\n let startPos = 0;\n\n // handle leftover bytes\n if (this.interim[0]) {\n let discardInterim = false;\n let cp = this.interim[0];\n cp &= ((((cp & 0xE0) === 0xC0)) ? 0x1F : (((cp & 0xF0) === 0xE0)) ? 0x0F : 0x07);\n let pos = 0;\n let tmp: number;\n while ((tmp = this.interim[++pos] & 0x3F) && pos < 4) {\n cp <<= 6;\n cp |= tmp;\n }\n // missing bytes - read ahead from input\n const type = (((this.interim[0] & 0xE0) === 0xC0)) ? 2 : (((this.interim[0] & 0xF0) === 0xE0)) ? 3 : 4;\n const missing = type - pos;\n while (startPos < missing) {\n if (startPos >= length) {\n return 0;\n }\n tmp = input[startPos++];\n if ((tmp & 0xC0) !== 0x80) {\n // wrong continuation, discard interim bytes completely\n startPos--;\n discardInterim = true;\n break;\n } else {\n // need to save so we can continue short inputs in next call\n this.interim[pos++] = tmp;\n cp <<= 6;\n cp |= tmp & 0x3F;\n }\n }\n if (!discardInterim) {\n // final test is type dependent\n if (type === 2) {\n if (cp < 0x80) {\n // wrong starter byte\n startPos--;\n } else {\n target[size++] = cp;\n }\n } else if (type === 3) {\n if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF) || cp === 0xFEFF) {\n // illegal codepoint or BOM\n } else {\n target[size++] = cp;\n }\n } else {\n if (cp < 0x010000 || cp > 0x10FFFF) {\n // illegal codepoint\n } else {\n target[size++] = cp;\n }\n }\n }\n this.interim.fill(0);\n }\n\n // loop through input\n const fourStop = length - 4;\n let i = startPos;\n while (i < length) {\n /**\n * ASCII shortcut with loop unrolled to 4 consecutive ASCII chars.\n * This is a compromise between speed gain for ASCII\n * and penalty for non ASCII:\n * For best ASCII performance the char should be stored directly into target,\n * but even a single attempt to write to target and compare afterwards\n * penalizes non ASCII really bad (-50%), thus we load the char into byteX first,\n * which reduces ASCII performance by ~15%.\n * This trial for ASCII reduces non ASCII performance by ~10% which seems acceptible\n * compared to the gains.\n * Note that this optimization only takes place for 4 consecutive ASCII chars,\n * for any shorter it bails out. Worst case - all 4 bytes being read but\n * thrown away due to the last being a non ASCII char (-10% performance).\n */\n while (i < fourStop\n && !((byte1 = input[i]) & 0x80)\n && !((byte2 = input[i + 1]) & 0x80)\n && !((byte3 = input[i + 2]) & 0x80)\n && !((byte4 = input[i + 3]) & 0x80))\n {\n target[size++] = byte1;\n target[size++] = byte2;\n target[size++] = byte3;\n target[size++] = byte4;\n i += 4;\n }\n\n // reread byte1\n byte1 = input[i++];\n\n // 1 byte\n if (byte1 < 0x80) {\n target[size++] = byte1;\n\n // 2 bytes\n } else if ((byte1 & 0xE0) === 0xC0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x1F) << 6 | (byte2 & 0x3F);\n if (codepoint < 0x80) {\n // wrong starter byte\n i--;\n continue;\n }\n target[size++] = codepoint;\n\n // 3 bytes\n } else if ((byte1 & 0xF0) === 0xE0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F);\n if (codepoint < 0x0800 || (codepoint >= 0xD800 && codepoint <= 0xDFFF) || codepoint === 0xFEFF) {\n // illegal codepoint or BOM, no i-- here\n continue;\n }\n target[size++] = codepoint;\n\n // 4 bytes\n } else if ((byte1 & 0xF8) === 0xF0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n this.interim[2] = byte3;\n return size;\n }\n byte4 = input[i++];\n if ((byte4 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x07) << 18 | (byte2 & 0x3F) << 12 | (byte3 & 0x3F) << 6 | (byte4 & 0x3F);\n if (codepoint < 0x010000 || codepoint > 0x10FFFF) {\n // illegal codepoint, no i-- here\n continue;\n }\n target[size++] = codepoint;\n } else {\n // illegal byte, just skip\n }\n }\n return size;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport const DEFAULT_COLOR = 0;\nexport const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);\nexport const DEFAULT_EXT = 0;\n\nexport const CHAR_DATA_ATTR_INDEX = 0;\nexport const CHAR_DATA_CHAR_INDEX = 1;\nexport const CHAR_DATA_WIDTH_INDEX = 2;\nexport const CHAR_DATA_CODE_INDEX = 3;\n\n/**\n * Null cell - a real empty cell (containing nothing).\n * Note that code should always be 0 for a null cell as\n * several test condition of the buffer line rely on this.\n */\nexport const NULL_CELL_CHAR = '';\nexport const NULL_CELL_WIDTH = 1;\nexport const NULL_CELL_CODE = 0;\n\n/**\n * Whitespace cell.\n * This is meant as a replacement for empty cells when needed\n * during rendering lines to preserve correct aligment.\n */\nexport const WHITESPACE_CELL_CHAR = ' ';\nexport const WHITESPACE_CELL_WIDTH = 1;\nexport const WHITESPACE_CELL_CODE = 32;\n\n/**\n * Bitmasks for accessing data in `content`.\n */\nexport const enum Content {\n /**\n * bit 1..21 codepoint, max allowed in UTF32 is 0x10FFFF (21 bits taken)\n * read: `codepoint = content & Content.codepointMask;`\n * write: `content |= codepoint & Content.codepointMask;`\n * shortcut if precondition `codepoint <= 0x10FFFF` is met:\n * `content |= codepoint;`\n */\n CODEPOINT_MASK = 0x1FFFFF,\n\n /**\n * bit 22 flag indication whether a cell contains combined content\n * read: `isCombined = content & Content.isCombined;`\n * set: `content |= Content.isCombined;`\n * clear: `content &= ~Content.isCombined;`\n */\n IS_COMBINED_MASK = 0x200000, // 1 << 21\n\n /**\n * bit 1..22 mask to check whether a cell contains any string data\n * we need to check for codepoint and isCombined bits to see\n * whether a cell contains anything\n * read: `isEmpty = !(content & Content.hasContent)`\n */\n HAS_CONTENT_MASK = 0x3FFFFF,\n\n /**\n * bit 23..24 wcwidth value of cell, takes 2 bits (ranges from 0..2)\n * read: `width = (content & Content.widthMask) >> Content.widthShift;`\n * `hasWidth = content & Content.widthMask;`\n * as long as wcwidth is highest value in `content`:\n * `width = content >> Content.widthShift;`\n * write: `content |= (width << Content.widthShift) & Content.widthMask;`\n * shortcut if precondition `0 <= width <= 3` is met:\n * `content |= width << Content.widthShift;`\n */\n WIDTH_MASK = 0xC00000, // 3 << 22\n WIDTH_SHIFT = 22\n}\n\nexport const enum Attributes {\n /**\n * bit 1..8 blue in RGB, color in P256 and P16\n */\n BLUE_MASK = 0xFF,\n BLUE_SHIFT = 0,\n PCOLOR_MASK = 0xFF,\n PCOLOR_SHIFT = 0,\n\n /**\n * bit 9..16 green in RGB\n */\n GREEN_MASK = 0xFF00,\n GREEN_SHIFT = 8,\n\n /**\n * bit 17..24 red in RGB\n */\n RED_MASK = 0xFF0000,\n RED_SHIFT = 16,\n\n /**\n * bit 25..26 color mode: DEFAULT (0) | P16 (1) | P256 (2) | RGB (3)\n */\n CM_MASK = 0x3000000,\n CM_DEFAULT = 0,\n CM_P16 = 0x1000000,\n CM_P256 = 0x2000000,\n CM_RGB = 0x3000000,\n\n /**\n * bit 1..24 RGB room\n */\n RGB_MASK = 0xFFFFFF\n}\n\nexport const enum FgFlags {\n /**\n * bit 27..32\n */\n INVERSE = 0x4000000,\n BOLD = 0x8000000,\n UNDERLINE = 0x10000000,\n BLINK = 0x20000000,\n INVISIBLE = 0x40000000,\n STRIKETHROUGH = 0x80000000,\n}\n\nexport const enum BgFlags {\n /**\n * bit 27..32 (upper 2 unused)\n */\n ITALIC = 0x4000000,\n DIM = 0x8000000,\n HAS_EXTENDED = 0x10000000,\n PROTECTED = 0x20000000,\n OVERLINE = 0x40000000\n}\n\nexport const enum ExtFlags {\n /**\n * bit 27..29\n */\n UNDERLINE_STYLE = 0x1C000000,\n\n /**\n * bit 30..32\n *\n * An optional variant for the glyph, this can be used for example to offset underlines by a\n * number of pixels to create a perfect pattern.\n */\n VARIANT_OFFSET = 0xE0000000\n}\n\nexport const enum UnderlineStyle {\n NONE = 0,\n SINGLE = 1,\n DOUBLE = 2,\n CURLY = 3,\n DOTTED = 4,\n DASHED = 5\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';\nimport { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from 'common/buffer/Constants';\n\nexport class AttributeData implements IAttributeData {\n public static toColorRGB(value: number): IColorRGB {\n return [\n value >>> Attributes.RED_SHIFT & 255,\n value >>> Attributes.GREEN_SHIFT & 255,\n value & 255\n ];\n }\n\n public static fromColorRGB(value: IColorRGB): number {\n return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;\n }\n\n public clone(): IAttributeData {\n const newObj = new AttributeData();\n newObj.fg = this.fg;\n newObj.bg = this.bg;\n newObj.extended = this.extended.clone();\n return newObj;\n }\n\n // data\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n\n // flags\n public isInverse(): number { return this.fg & FgFlags.INVERSE; }\n public isBold(): number { return this.fg & FgFlags.BOLD; }\n public isUnderline(): number {\n if (this.hasExtendedAttrs() && this.extended.underlineStyle !== UnderlineStyle.NONE) {\n return 1;\n }\n return this.fg & FgFlags.UNDERLINE;\n }\n public isBlink(): number { return this.fg & FgFlags.BLINK; }\n public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }\n public isItalic(): number { return this.bg & BgFlags.ITALIC; }\n public isDim(): number { return this.bg & BgFlags.DIM; }\n public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }\n public isProtected(): number { return this.bg & BgFlags.PROTECTED; }\n public isOverline(): number { return this.bg & BgFlags.OVERLINE; }\n\n // color modes\n public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }\n public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }\n public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }\n public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }\n public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }\n\n // colors\n public getFgColor(): number {\n switch (this.fg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n public getBgColor(): number {\n switch (this.bg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n\n // extended attrs\n public hasExtendedAttrs(): number {\n return this.bg & BgFlags.HAS_EXTENDED;\n }\n public updateExtended(): void {\n if (this.extended.isEmpty()) {\n this.bg &= ~BgFlags.HAS_EXTENDED;\n } else {\n this.bg |= BgFlags.HAS_EXTENDED;\n }\n }\n public getUnderlineColor(): number {\n if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {\n switch (this.extended.underlineColor & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;\n default: return this.getFgColor();\n }\n }\n return this.getFgColor();\n }\n public getUnderlineColorMode(): number {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? this.extended.underlineColor & Attributes.CM_MASK\n : this.getFgColorMode();\n }\n public isUnderlineColorRGB(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB\n : this.isFgRGB();\n }\n public isUnderlineColorPalette(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16\n || (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256\n : this.isFgPalette();\n }\n public isUnderlineColorDefault(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === 0\n : this.isFgDefault();\n }\n public getUnderlineStyle(): UnderlineStyle {\n return this.fg & FgFlags.UNDERLINE\n ? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)\n : UnderlineStyle.NONE;\n }\n public getUnderlineVariantOffset(): number {\n return this.extended.underlineVariantOffset;\n }\n}\n\n\n/**\n * Extended attributes for a cell.\n * Holds information about different underline styles and color.\n */\nexport class ExtendedAttrs implements IExtendedAttrs {\n private _ext: number = 0;\n public get ext(): number {\n if (this._urlId) {\n return (\n (this._ext & ~ExtFlags.UNDERLINE_STYLE) |\n (this.underlineStyle << 26)\n );\n }\n return this._ext;\n }\n public set ext(value: number) { this._ext = value; }\n\n public get underlineStyle(): UnderlineStyle {\n // Always return the URL style if it has one\n if (this._urlId) {\n return UnderlineStyle.DASHED;\n }\n return (this._ext & ExtFlags.UNDERLINE_STYLE) >> 26;\n }\n public set underlineStyle(value: UnderlineStyle) {\n this._ext &= ~ExtFlags.UNDERLINE_STYLE;\n this._ext |= (value << 26) & ExtFlags.UNDERLINE_STYLE;\n }\n\n public get underlineColor(): number {\n return this._ext & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n public set underlineColor(value: number) {\n this._ext &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n this._ext |= value & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n\n private _urlId: number = 0;\n public get urlId(): number {\n return this._urlId;\n }\n public set urlId(value: number) {\n this._urlId = value;\n }\n\n public get underlineVariantOffset(): number {\n const val = (this._ext & ExtFlags.VARIANT_OFFSET) >> 29;\n if (val < 0) {\n return val ^ 0xFFFFFFF8;\n }\n return val;\n }\n public set underlineVariantOffset(value: number) {\n this._ext &= ~ExtFlags.VARIANT_OFFSET;\n this._ext |= (value << 29) & ExtFlags.VARIANT_OFFSET;\n }\n\n constructor(\n ext: number = 0,\n urlId: number = 0\n ) {\n this._ext = ext;\n this._urlId = urlId;\n }\n\n public clone(): IExtendedAttrs {\n return new ExtendedAttrs(this._ext, this._urlId);\n }\n\n /**\n * Convenient method to indicate whether the object holds no additional information,\n * that needs to be persistant in the buffer.\n */\n public isEmpty(): boolean {\n return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, ICellData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * CellData - represents a single Cell in the terminal buffer.\n */\nexport class CellData extends AttributeData implements ICellData {\n /** Helper to create CellData from CharData. */\n public static fromCharData(value: CharData): CellData {\n const obj = new CellData();\n obj.setFromCharData(value);\n return obj;\n }\n /** Primitives from terminal buffer. */\n public content = 0;\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n public combinedData = '';\n /** Whether cell contains a combined string. */\n public isCombined(): number {\n return this.content & Content.IS_COMBINED_MASK;\n }\n /** Width of the cell. */\n public getWidth(): number {\n return this.content >> Content.WIDTH_SHIFT;\n }\n /** JS string of the content. */\n public getChars(): string {\n if (this.content & Content.IS_COMBINED_MASK) {\n return this.combinedData;\n }\n if (this.content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);\n }\n return '';\n }\n /**\n * Codepoint of cell\n * Note this returns the UTF32 codepoint of single chars,\n * if content is a combined string it returns the codepoint\n * of the last char in string to be in line with code in CharData.\n */\n public getCode(): number {\n return (this.isCombined())\n ? this.combinedData.charCodeAt(this.combinedData.length - 1)\n : this.content & Content.CODEPOINT_MASK;\n }\n /** Set data from CharData */\n public setFromCharData(value: CharData): void {\n this.fg = value[CHAR_DATA_ATTR_INDEX];\n this.bg = 0;\n let combined = false;\n // surrogates and combined strings need special treatment\n if (value[CHAR_DATA_CHAR_INDEX].length > 2) {\n combined = true;\n }\n else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {\n const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);\n // if the 2-char string is a surrogate create single codepoint\n // everything else is combined\n if (0xD800 <= code && code <= 0xDBFF) {\n const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);\n if (0xDC00 <= second && second <= 0xDFFF) {\n this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n else {\n combined = true;\n }\n }\n else {\n combined = true;\n }\n }\n else {\n this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n if (combined) {\n this.combinedData = value[CHAR_DATA_CHAR_INDEX];\n this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n /** Get data as CharData. */\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IServiceIdentifier } from 'common/services/Services';\n\nconst DI_TARGET = 'di$target';\nconst DI_DEPENDENCIES = 'di$dependencies';\n\nexport const serviceRegistry: Map> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier, index: number, optional: boolean }[] {\n return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator(id: string): IServiceIdentifier {\n if (serviceRegistry.has(id)) {\n return serviceRegistry.get(id)!;\n }\n\n const decorator: any = function (target: Function, key: string, index: number): any {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n\n storeServiceDependency(decorator, target, index);\n };\n\n decorator.toString = () => id;\n\n serviceRegistry.set(id, decorator);\n return decorator;\n}\n\nfunction storeServiceDependency(id: Function, target: Function, index: number): void {\n if ((target as any)[DI_TARGET] === target) {\n (target as any)[DI_DEPENDENCIES].push({ id, index });\n } else {\n (target as any)[DI_DEPENDENCIES] = [{ id, index }];\n (target as any)[DI_TARGET] = target;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, type IOverviewRulerOptions } from '@xterm/xterm';\nimport { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport type { Emitter, Event } from 'vs/base/common/event';\n\nexport const IBufferService = createDecorator('BufferService');\nexport interface IBufferService {\n serviceBrand: undefined;\n\n readonly cols: number;\n readonly rows: number;\n readonly buffer: IBuffer;\n readonly buffers: IBufferSet;\n isUserScrolling: boolean;\n onResize: Event<{ cols: number, rows: number }>;\n onScroll: Event;\n scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;\n scrollLines(disp: number, suppressScrollEvent?: boolean): void;\n resize(cols: number, rows: number): void;\n reset(): void;\n}\n\nexport const ICoreMouseService = createDecorator('CoreMouseService');\nexport interface ICoreMouseService {\n serviceBrand: undefined;\n\n activeProtocol: string;\n activeEncoding: string;\n areMouseEventsActive: boolean;\n addProtocol(name: string, protocol: ICoreMouseProtocol): void;\n addEncoding(name: string, encoding: CoreMouseEncoding): void;\n reset(): void;\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n triggerMouseEvent(event: ICoreMouseEvent): boolean;\n\n /**\n * Event to announce changes in mouse tracking.\n */\n onProtocolChange: Event;\n\n /**\n * Human readable version of mouse events.\n */\n explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n}\n\nexport const ICoreService = createDecorator('CoreService');\nexport interface ICoreService {\n serviceBrand: undefined;\n\n /**\n * Initially the cursor will not be visible until the first time the terminal\n * is focused.\n */\n isCursorInitialized: boolean;\n isCursorHidden: boolean;\n\n readonly modes: IModes;\n readonly decPrivateModes: IDecPrivateModes;\n\n readonly onData: Event;\n readonly onUserInput: Event;\n readonly onBinary: Event;\n readonly onRequestScrollToBottom: Event;\n\n reset(): void;\n\n /**\n * Triggers the onData event in the public API.\n * @param data The data that is being emitted.\n * @param wasUserInput Whether the data originated from the user (as opposed to\n * resulting from parsing incoming data). When true this will also:\n * - Scroll to the bottom of the buffer if option scrollOnUserInput is true.\n * - Fire the `onUserInput` event (so selection can be cleared).\n */\n triggerDataEvent(data: string, wasUserInput?: boolean): void;\n\n /**\n * Triggers the onBinary event in the public API.\n * @param data The data that is being emitted.\n */\n triggerBinaryEvent(data: string): void;\n}\n\nexport const ICharsetService = createDecorator('CharsetService');\nexport interface ICharsetService {\n serviceBrand: undefined;\n\n charset: ICharset | undefined;\n readonly glevel: number;\n\n reset(): void;\n\n /**\n * Set the G level of the terminal.\n * @param g\n */\n setgLevel(g: number): void;\n\n /**\n * Set the charset for the given G level of the terminal.\n * @param g\n * @param charset\n */\n setgCharset(g: number, charset: ICharset | undefined): void;\n}\n\nexport interface IServiceIdentifier {\n (...args: any[]): void;\n type: T;\n}\n\nexport interface IBrandedService {\n serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs = TArgs extends [] ? []\n : TArgs extends [...infer TFirst, infer TLast] ? TLast extends IBrandedService ? GetLeadingNonServiceArgs : TArgs\n : never;\n\nexport const IInstantiationService = createDecorator('InstantiationService');\nexport interface IInstantiationService {\n serviceBrand: undefined;\n\n setService(id: IServiceIdentifier, instance: T): void;\n getService(id: IServiceIdentifier): T | undefined;\n createInstance any, R extends InstanceType>(t: Ctor, ...args: GetLeadingNonServiceArgs>): R;\n}\n\nexport enum LogLevelEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n OFF = 5\n}\n\nexport const ILogService = createDecorator('LogService');\nexport interface ILogService {\n serviceBrand: undefined;\n\n readonly logLevel: LogLevelEnum;\n\n trace(message: any, ...optionalParams: any[]): void;\n debug(message: any, ...optionalParams: any[]): void;\n info(message: any, ...optionalParams: any[]): void;\n warn(message: any, ...optionalParams: any[]): void;\n error(message: any, ...optionalParams: any[]): void;\n}\n\nexport const IOptionsService = createDecorator('OptionsService');\nexport interface IOptionsService {\n serviceBrand: undefined;\n\n /**\n * Read only access to the raw options object, this is an internal-only fast path for accessing\n * single options without any validation as we trust TypeScript to enforce correct usage\n * internally.\n */\n readonly rawOptions: Required;\n\n /**\n * Options as exposed through the public API, this property uses getters and setters with\n * validation which makes it safer but slower. {@link rawOptions} should be used for pretty much\n * all internal usage for performance reasons.\n */\n readonly options: Required;\n\n /**\n * Adds an event listener for when any option changes.\n */\n readonly onOptionChange: Event;\n\n /**\n * Adds an event listener for when a specific option changes, this is a convenience method that is\n * preferred over {@link onOptionChange} when only a single option is being listened to.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onSpecificOptionChange(key: T, listener: (arg1: Required[T]) => any): IDisposable;\n\n /**\n * Adds an event listener for when a set of specific options change, this is a convenience method\n * that is preferred over {@link onOptionChange} when multiple options are being listened to and\n * handled the same way.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable;\n}\n\nexport type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';\n\nexport interface ITerminalOptions {\n allowProposedApi?: boolean;\n allowTransparency?: boolean;\n altClickMovesCursor?: boolean;\n cols?: number;\n convertEol?: boolean;\n cursorBlink?: boolean;\n cursorStyle?: CursorStyle;\n cursorWidth?: number;\n cursorInactiveStyle?: CursorInactiveStyle;\n customGlyphs?: boolean;\n disableStdin?: boolean;\n documentOverride?: any | null;\n drawBoldTextInBrightColors?: boolean;\n /** @deprecated No longer supported */\n fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';\n fastScrollSensitivity?: number;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: FontWeight;\n fontWeightBold?: FontWeight;\n ignoreBracketedPasteMode?: boolean;\n letterSpacing?: number;\n lineHeight?: number;\n linkHandler?: ILinkHandler | null;\n logLevel?: LogLevel;\n logger?: ILogger | null;\n macOptionIsMeta?: boolean;\n macOptionClickForcesSelection?: boolean;\n minimumContrastRatio?: number;\n rescaleOverlappingGlyphs?: boolean;\n rightClickSelectsWord?: boolean;\n rows?: number;\n screenReaderMode?: boolean;\n scrollback?: number;\n scrollOnUserInput?: boolean;\n scrollSensitivity?: number;\n smoothScrollDuration?: number;\n tabStopWidth?: number;\n theme?: ITheme;\n windowsMode?: boolean;\n windowsPty?: IWindowsPty;\n windowOptions?: IWindowOptions;\n wordSeparator?: string;\n overviewRuler?: IOverviewRulerOptions;\n\n [key: string]: any;\n cancelEvents: boolean;\n termName: string;\n}\n\nexport interface ITheme {\n foreground?: string;\n background?: string;\n cursor?: string;\n cursorAccent?: string;\n selectionForeground?: string;\n selectionBackground?: string;\n selectionInactiveBackground?: string;\n scrollbarSliderBackground?: string;\n scrollbarSliderHoverBackground?: string;\n scrollbarSliderActiveBackground?: string;\n overviewRulerBorder?: string;\n black?: string;\n red?: string;\n green?: string;\n yellow?: string;\n blue?: string;\n magenta?: string;\n cyan?: string;\n white?: string;\n brightBlack?: string;\n brightRed?: string;\n brightGreen?: string;\n brightYellow?: string;\n brightBlue?: string;\n brightMagenta?: string;\n brightCyan?: string;\n brightWhite?: string;\n extendedAnsi?: string[];\n}\n\nexport const IOscLinkService = createDecorator('OscLinkService');\nexport interface IOscLinkService {\n serviceBrand: undefined;\n /**\n * Registers a link to the service, returning the link ID. The link data is managed by this\n * service and will be freed when this current cursor position is trimmed off the buffer.\n */\n registerLink(linkData: IOscLinkData): number;\n /**\n * Adds a line to a link if needed.\n */\n addLineToLink(linkId: number, y: number): void;\n /** Get the link data associated with a link ID. */\n getLinkData(linkId: number): IOscLinkData | undefined;\n}\n\n/*\n * Width and Grapheme_Cluster_Break properties of a character as a bit mask.\n *\n * bit 0: shouldJoin - should combine with preceding character.\n * bit 1..2: wcwidth - see UnicodeCharWidth.\n * bit 3..31: class of character (currently only 4 bits are used).\n * This is used to determined grapheme clustering - i.e. which codepoints\n * are to be combined into a single compound character.\n *\n * Use the UnicodeService static function createPropertyValue to create a\n * UnicodeCharProperties; use extractShouldJoin, extractWidth, and\n * extractCharKind to extract the components.\n */\nexport type UnicodeCharProperties = number;\n\n/**\n * Width in columns of a character.\n * In a CJK context, \"half-width\" characters (such as Latin) are width 1,\n * while \"full-width\" characters (such as Kanji) are 2 columns wide.\n * Combining characters (such as accents) are width 0.\n */\nexport type UnicodeCharWidth = 0 | 1 | 2;\n\nexport const IUnicodeService = createDecorator('UnicodeService');\nexport interface IUnicodeService {\n serviceBrand: undefined;\n /** Register an Unicode version provider. */\n register(provider: IUnicodeVersionProvider): void;\n /** Registered Unicode versions. */\n readonly versions: string[];\n /** Currently active version. */\n activeVersion: string;\n /** Event triggered, when activate version changed. */\n readonly onChange: Event;\n\n /**\n * Unicode version dependent\n */\n wcwidth(codepoint: number): UnicodeCharWidth;\n getStringCellWidth(s: string): number;\n /**\n * Return character width and type for grapheme clustering.\n * If preceding != 0, it is the return code from the previous character;\n * in that case the result specifies if the characters should be joined.\n */\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport interface IUnicodeVersionProvider {\n readonly version: string;\n wcwidth(ucs: number): UnicodeCharWidth;\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport const IDecorationService = createDecorator('DecorationService');\nexport interface IDecorationService extends IDisposable {\n serviceBrand: undefined;\n readonly decorations: IterableIterator;\n readonly onDecorationRegistered: Event;\n readonly onDecorationRemoved: Event;\n registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;\n reset(): void;\n /**\n * Trigger a callback over the decoration at a cell (in no particular order). This uses a callback\n * instead of an iterator as it's typically used in hot code paths.\n */\n forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void;\n}\nexport interface IInternalDecoration extends IDecoration {\n readonly options: IDecorationOptions;\n readonly backgroundColorRGB: IColor | undefined;\n readonly foregroundColorRGB: IColor | undefined;\n readonly onRenderEmitter: Emitter;\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILink } from 'browser/Types';\nimport { ILinkProvider } from 'browser/services/Services';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService, IOptionsService, IOscLinkService } from 'common/services/Services';\n\nexport class OscLinkProvider implements ILinkProvider {\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IOscLinkService private readonly _oscLinkService: IOscLinkService\n ) {\n }\n\n public provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void {\n const line = this._bufferService.buffer.lines.get(y - 1);\n if (!line) {\n callback(undefined);\n return;\n }\n\n const result: ILink[] = [];\n const linkHandler = this._optionsService.rawOptions.linkHandler;\n const cell = new CellData();\n const lineLength = line.getTrimmedLength();\n let currentLinkId = -1;\n let currentStart = -1;\n let finishLink = false;\n for (let x = 0; x < lineLength; x++) {\n // Minor optimization, only check for content if there isn't a link in case the link ends with\n // a null cell\n if (currentStart === -1 && !line.hasContent(x)) {\n continue;\n }\n\n line.loadCell(x, cell);\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n if (currentStart === -1) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n continue;\n } else {\n finishLink = cell.extended.urlId !== currentLinkId;\n }\n } else {\n if (currentStart !== -1) {\n finishLink = true;\n }\n }\n\n if (finishLink || (currentStart !== -1 && x === lineLength - 1)) {\n const text = this._oscLinkService.getLinkData(currentLinkId)?.uri;\n if (text) {\n // These ranges are 1-based\n const range: IBufferRange = {\n start: {\n x: currentStart + 1,\n y\n },\n end: {\n // Offset end x if it's a link that ends on the last cell in the line\n x: x + (!finishLink && x === lineLength - 1 ? 1 : 0),\n y\n }\n };\n\n let ignoreLink = false;\n if (!linkHandler?.allowNonHttpProtocols) {\n try {\n const parsed = new URL(text);\n if (!['http:', 'https:'].includes(parsed.protocol)) {\n ignoreLink = true;\n }\n } catch (e) {\n // Ignore invalid URLs to prevent unexpected behaviors\n ignoreLink = true;\n }\n }\n\n if (!ignoreLink) {\n // OSC links always use underline and pointer decorations\n result.push({\n text,\n range,\n activate: (e, text) => (linkHandler ? linkHandler.activate(e, text, range) : defaultActivate(e, text)),\n hover: (e, text) => linkHandler?.hover?.(e, text, range),\n leave: (e, text) => linkHandler?.leave?.(e, text, range)\n });\n }\n }\n finishLink = false;\n\n // Clear link or start a new link if one starts immediately\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n } else {\n currentStart = -1;\n currentLinkId = -1;\n }\n }\n }\n\n // TODO: Handle fetching and returning other link ranges to underline other links with the same\n // id\n callback(result);\n }\n}\n\nfunction defaultActivate(e: MouseEvent, uri: string): void {\n const answer = confirm(`Do you want to navigate to ${uri}?\\n\\nWARNING: This link could potentially be dangerous`);\n if (answer) {\n const newWindow = window.open();\n if (newWindow) {\n try {\n newWindow.opener = null;\n } catch {\n // no-op, Electron can throw\n }\n newWindow.location.href = uri;\n } else {\n console.warn('Opening link blocked as opener could not be cleared');\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';\nimport { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { AllColorIndex, IDisposable } from 'common/Types';\nimport type { Event } from 'vs/base/common/event';\n\nexport const ICharSizeService = createDecorator('CharSizeService');\nexport interface ICharSizeService {\n serviceBrand: undefined;\n\n readonly width: number;\n readonly height: number;\n readonly hasValidSize: boolean;\n\n readonly onCharSizeChange: Event;\n\n measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator('CoreBrowserService');\nexport interface ICoreBrowserService {\n serviceBrand: undefined;\n\n readonly isFocused: boolean;\n\n readonly onDprChange: Event;\n readonly onWindowChange: Event;\n\n /**\n * Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.\n * requestAnimationFrame) should be invoked in the context of this window. This should be set when\n * the window hosting the xterm.js instance changes.\n */\n window: Window & typeof globalThis;\n /**\n * The document of the primary window to be used to create elements when working with multiple\n * windows. This is defined by the documentOverride setting.\n */\n readonly mainDocument: Document;\n /**\n * Helper for getting the devicePixelRatio of the parent window.\n */\n readonly dpr: number;\n}\n\nexport const IMouseService = createDecorator('MouseService');\nexport interface IMouseService {\n serviceBrand: undefined;\n\n getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined;\n getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined;\n}\n\nexport const IRenderService = createDecorator('RenderService');\nexport interface IRenderService extends IDisposable {\n serviceBrand: undefined;\n\n onDimensionsChange: Event;\n /**\n * Fires when buffer changes are rendered. This does not fire when only cursor\n * or selections are rendered.\n */\n onRenderedViewportChange: Event<{ start: number, end: number }>;\n /**\n * Fires on render\n */\n onRender: Event<{ start: number, end: number }>;\n onRefreshRequest: Event<{ start: number, end: number }>;\n\n dimensions: IRenderDimensions;\n\n addRefreshCallback(callback: FrameRequestCallback): number;\n\n refreshRows(start: number, end: number): void;\n clearTextureAtlas(): void;\n resize(cols: number, rows: number): void;\n hasRenderer(): boolean;\n setRenderer(renderer: IRenderer): void;\n handleDevicePixelRatioChange(): void;\n handleResize(cols: number, rows: number): void;\n handleCharSizeChanged(): void;\n handleBlur(): void;\n handleFocus(): void;\n handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void;\n handleCursorMove(): void;\n clear(): void;\n}\n\nexport const ISelectionService = createDecorator('SelectionService');\nexport interface ISelectionService {\n serviceBrand: undefined;\n\n readonly selectionText: string;\n readonly hasSelection: boolean;\n readonly selectionStart: [number, number] | undefined;\n readonly selectionEnd: [number, number] | undefined;\n\n readonly onLinuxMouseSelection: Event;\n readonly onRequestRedraw: Event;\n readonly onRequestScrollLines: Event;\n readonly onSelectionChange: Event;\n\n disable(): void;\n enable(): void;\n reset(): void;\n setSelection(row: number, col: number, length: number): void;\n selectAll(): void;\n selectLines(start: number, end: number): void;\n clearSelection(): void;\n rightClickSelect(event: MouseEvent): void;\n shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;\n shouldForceSelection(event: MouseEvent): boolean;\n refresh(isLinuxMouseSelection?: boolean): void;\n handleMouseDown(event: MouseEvent): void;\n isCellInSelection(x: number, y: number): boolean;\n}\n\nexport const ICharacterJoinerService = createDecorator('CharacterJoinerService');\nexport interface ICharacterJoinerService {\n serviceBrand: undefined;\n\n register(handler: (text: string) => [number, number][]): number;\n deregister(joinerId: number): boolean;\n getJoinedCharacters(row: number): [number, number][];\n}\n\nexport const IThemeService = createDecorator('ThemeService');\nexport interface IThemeService {\n serviceBrand: undefined;\n\n readonly colors: ReadonlyColorSet;\n\n readonly onChangeColors: Event;\n\n restoreColor(slot?: AllColorIndex): void;\n /**\n * Allows external modifying of colors in the theme, this is used instead of {@link colors} to\n * prevent accidental writes.\n */\n modifyColors(callback: (colors: IColorSet) => void): void;\n}\n\n\nexport const ILinkProviderService = createDecorator('LinkProviderService');\nexport interface ILinkProviderService extends IDisposable {\n serviceBrand: undefined;\n readonly linkProviders: ReadonlyArray;\n registerLinkProvider(linkProvider: ILinkProvider): IDisposable;\n}\nexport interface ILinkProvider {\n provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport interface ErrorListenerCallback {\n\t(error: any): void;\n}\n\nexport interface ErrorListenerUnbind {\n\t(): void;\n}\n\n// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\nexport class ErrorHandler {\n\tprivate unexpectedErrorHandler: (e: any) => void;\n\tprivate listeners: ErrorListenerCallback[];\n\n\tconstructor() {\n\n\t\tthis.listeners = [];\n\n\t\tthis.unexpectedErrorHandler = function (e: any) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (e.stack) {\n\t\t\t\t\tif (ErrorNoTelemetry.isErrorNoTelemetry(e)) {\n\t\t\t\t\t\tthrow new ErrorNoTelemetry(e.message + '\\n\\n' + e.stack);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(e.message + '\\n\\n' + e.stack);\n\t\t\t\t}\n\n\t\t\t\tthrow e;\n\t\t\t}, 0);\n\t\t};\n\t}\n\n\taddListener(listener: ErrorListenerCallback): ErrorListenerUnbind {\n\t\tthis.listeners.push(listener);\n\n\t\treturn () => {\n\t\t\tthis._removeListener(listener);\n\t\t};\n\t}\n\n\tprivate emit(e: any): void {\n\t\tthis.listeners.forEach((listener) => {\n\t\t\tlistener(e);\n\t\t});\n\t}\n\n\tprivate _removeListener(listener: ErrorListenerCallback): void {\n\t\tthis.listeners.splice(this.listeners.indexOf(listener), 1);\n\t}\n\n\tsetUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\t\tthis.unexpectedErrorHandler = newUnexpectedErrorHandler;\n\t}\n\n\tgetUnexpectedErrorHandler(): (e: any) => void {\n\t\treturn this.unexpectedErrorHandler;\n\t}\n\n\tonUnexpectedError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t\tthis.emit(e);\n\t}\n\n\t// For external errors, we don't want the listeners to be called\n\tonUnexpectedExternalError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t}\n}\n\nexport const errorHandler = new ErrorHandler();\n\n/** @skipMangle */\nexport function setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\terrorHandler.setUnexpectedErrorHandler(newUnexpectedErrorHandler);\n}\n\n/**\n * Returns if the error is a SIGPIPE error. SIGPIPE errors should generally be\n * logged at most once, to avoid a loop.\n *\n * @see https://github.com/microsoft/vscode-remote-release/issues/6481\n */\nexport function isSigPipeError(e: unknown): e is Error {\n\tif (!e || typeof e !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst cast = e as Record;\n\treturn cast.code === 'EPIPE' && cast.syscall?.toUpperCase() === 'WRITE';\n}\n\nexport function onUnexpectedError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedError(e);\n\t}\n\treturn undefined;\n}\n\nexport function onUnexpectedExternalError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedExternalError(e);\n\t}\n\treturn undefined;\n}\n\nexport interface SerializedError {\n\treadonly $isError: true;\n\treadonly name: string;\n\treadonly message: string;\n\treadonly stack: string;\n\treadonly noTelemetry: boolean;\n}\n\nexport function transformErrorForSerialization(error: Error): SerializedError;\nexport function transformErrorForSerialization(error: any): any;\nexport function transformErrorForSerialization(error: any): any {\n\tif (error instanceof Error) {\n\t\tconst { name, message } = error;\n\t\tconst stack: string = (error).stacktrace || (error).stack;\n\t\treturn {\n\t\t\t$isError: true,\n\t\t\tname,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t\tnoTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error)\n\t\t};\n\t}\n\n\t// return as is\n\treturn error;\n}\n\nexport function transformErrorFromSerialization(data: SerializedError): Error {\n\tlet error: Error;\n\tif (data.noTelemetry) {\n\t\terror = new ErrorNoTelemetry();\n\t} else {\n\t\terror = new Error();\n\t\terror.name = data.name;\n\t}\n\terror.message = data.message;\n\terror.stack = data.stack;\n\treturn error;\n}\n\n// see https://github.com/v8/v8/wiki/Stack%20Trace%20API#basic-stack-traces\nexport interface V8CallSite {\n\tgetThis(): unknown;\n\tgetTypeName(): string | null;\n\tgetFunction(): Function | undefined;\n\tgetFunctionName(): string | null;\n\tgetMethodName(): string | null;\n\tgetFileName(): string | null;\n\tgetLineNumber(): number | null;\n\tgetColumnNumber(): number | null;\n\tgetEvalOrigin(): string | undefined;\n\tisToplevel(): boolean;\n\tisEval(): boolean;\n\tisNative(): boolean;\n\tisConstructor(): boolean;\n\ttoString(): string;\n}\n\nconst canceledName = 'Canceled';\n\n/**\n * Checks if the given error is a promise in canceled state\n */\nexport function isCancellationError(error: any): boolean {\n\tif (error instanceof CancellationError) {\n\t\treturn true;\n\t}\n\treturn error instanceof Error && error.name === canceledName && error.message === canceledName;\n}\n\n// !!!IMPORTANT!!!\n// Do NOT change this class because it is also used as an API-type.\nexport class CancellationError extends Error {\n\tconstructor() {\n\t\tsuper(canceledName);\n\t\tthis.name = this.message;\n\t}\n}\n\n/**\n * @deprecated use {@link CancellationError `new CancellationError()`} instead\n */\nexport function canceled(): Error {\n\tconst error = new Error(canceledName);\n\terror.name = error.message;\n\treturn error;\n}\n\nexport function illegalArgument(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal argument: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal argument');\n\t}\n}\n\nexport function illegalState(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal state: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal state');\n\t}\n}\n\nexport class ReadonlyError extends TypeError {\n\tconstructor(name?: string) {\n\t\tsuper(name ? `${name} is read-only and cannot be changed` : 'Cannot change read-only property');\n\t}\n}\n\nexport function getErrorMessage(err: any): string {\n\tif (!err) {\n\t\treturn 'Error';\n\t}\n\n\tif (err.message) {\n\t\treturn err.message;\n\t}\n\n\tif (err.stack) {\n\t\treturn err.stack.split('\\n')[0];\n\t}\n\n\treturn String(err);\n}\n\nexport class NotImplementedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotImplemented');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class NotSupportedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotSupported');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class ExpectedError extends Error {\n\treadonly isExpected = true;\n}\n\n/**\n * Error that when thrown won't be logged in telemetry as an unhandled error.\n */\nexport class ErrorNoTelemetry extends Error {\n\toverride readonly name: string;\n\n\tconstructor(msg?: string) {\n\t\tsuper(msg);\n\t\tthis.name = 'CodeExpectedError';\n\t}\n\n\tpublic static fromError(err: Error): ErrorNoTelemetry {\n\t\tif (err instanceof ErrorNoTelemetry) {\n\t\t\treturn err;\n\t\t}\n\n\t\tconst result = new ErrorNoTelemetry();\n\t\tresult.message = err.message;\n\t\tresult.stack = err.stack;\n\t\treturn result;\n\t}\n\n\tpublic static isErrorNoTelemetry(err: Error): err is ErrorNoTelemetry {\n\t\treturn err.name === 'CodeExpectedError';\n\t}\n}\n\n/**\n * This error indicates a bug.\n * Do not throw this for invalid user input.\n * Only catch this error to recover gracefully from bugs.\n */\nexport class BugIndicatingError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message || 'An unexpected bug occurred.');\n\t\tObject.setPrototypeOf(this, BugIndicatingError.prototype);\n\n\t\t// Because we know for sure only buggy code throws this,\n\t\t// we definitely want to break here and fix the bug.\n\t\t// eslint-disable-next-line no-debugger\n\t\t// debugger;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Comparator } from './arrays';\n\nexport function findLast(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findLastIdx(array, predicate);\n\tif (idx === -1) {\n\t\treturn undefined;\n\t}\n\treturn array[idx];\n}\n\nexport function findLastIdx(array: readonly T[], predicate: (item: T) => boolean, fromIndex = array.length - 1): number {\n\tfor (let i = fromIndex; i >= 0; i--) {\n\t\tconst element = array[i];\n\n\t\tif (predicate(element)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `undefined` if no item matches, otherwise the last item that matches the predicate.\n */\nexport function findLastMonotonous(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findLastIdxMonotonous(array, predicate);\n\treturn idx === -1 ? undefined : array[idx];\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate.\n */\nexport function findLastIdxMonotonous(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\ti = k + 1;\n\t\t} else {\n\t\t\tj = k;\n\t\t}\n\t}\n\treturn i - 1;\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `undefined` if no item matches, otherwise the first item that matches the predicate.\n */\nexport function findFirstMonotonous(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate);\n\treturn idx === array.length ? undefined : array[idx];\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate.\n */\nexport function findFirstIdxMonotonousOrArrLen(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\tj = k;\n\t\t} else {\n\t\t\ti = k + 1;\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function findFirstIdxMonotonous(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx);\n\treturn idx === array.length ? -1 : idx;\n}\n\n/**\n * Use this when\n * * You have a sorted array\n * * You query this array with a monotonous predicate to find the last item that has a certain property.\n * * You query this array multiple times with monotonous predicates that get weaker and weaker.\n */\nexport class MonotonousArray {\n\tpublic static assertInvariants = false;\n\n\tprivate _findLastMonotonousLastIdx = 0;\n\tprivate _prevFindLastPredicate: ((item: T) => boolean) | undefined;\n\n\tconstructor(private readonly _array: readonly T[]) {\n\t}\n\n\t/**\n\t * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n\t * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.\n\t */\n\tfindLastMonotonous(predicate: (item: T) => boolean): T | undefined {\n\t\tif (MonotonousArray.assertInvariants) {\n\t\t\tif (this._prevFindLastPredicate) {\n\t\t\t\tfor (const item of this._array) {\n\t\t\t\t\tif (this._prevFindLastPredicate(item) && !predicate(item)) {\n\t\t\t\t\t\tthrow new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._prevFindLastPredicate = predicate;\n\t\t}\n\n\t\tconst idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);\n\t\tthis._findLastMonotonousLastIdx = idx + 1;\n\t\treturn idx === -1 ? undefined : this._array[idx];\n\t}\n}\n\n/**\n * Returns the first item that is equal to or greater than every other item.\n*/\nexport function findFirstMax(array: readonly T[], comparator: Comparator): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) > 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the last item that is equal to or greater than every other item.\n*/\nexport function findLastMax(array: readonly T[], comparator: Comparator): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) >= 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the first item that is equal to or less than every other item.\n*/\nexport function findFirstMin(array: readonly T[], comparator: Comparator): T | undefined {\n\treturn findFirstMax(array, (a, b) => -comparator(a, b));\n}\n\nexport function findMaxIdx(array: readonly T[], comparator: Comparator): number {\n\tif (array.length === 0) {\n\t\treturn -1;\n\t}\n\n\tlet maxIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, array[maxIdx]) > 0) {\n\t\t\tmaxIdx = i;\n\t\t}\n\t}\n\treturn maxIdx;\n}\n\n/**\n * Returns the first mapped value of the array which is not undefined.\n */\nexport function mapFindFirst(items: Iterable, mapFn: (value: T) => R | undefined): R | undefined {\n\tfor (const value of items) {\n\t\tconst mapped = mapFn(value);\n\t\tif (mapped !== undefined) {\n\t\t\treturn mapped;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from 'vs/base/common/cancellation';\nimport { CancellationError } from 'vs/base/common/errors';\nimport { ISplice } from 'vs/base/common/sequence';\nimport { findFirstIdxMonotonousOrArrLen } from './arraysFind';\n\n/**\n * Returns the last element of an array.\n * @param array The array.\n * @param n Which element from the end (default is zero).\n */\nexport function tail(array: ArrayLike, n: number = 0): T | undefined {\n\treturn array[array.length - (1 + n)];\n}\n\nexport function tail2(arr: T[]): [T[], T] {\n\tif (arr.length === 0) {\n\t\tthrow new Error('Invalid tail call');\n\t}\n\n\treturn [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\n\nexport function equals(one: ReadonlyArray | undefined, other: ReadonlyArray | undefined, itemEquals: (a: T, b: T) => boolean = (a, b) => a === b): boolean {\n\tif (one === other) {\n\t\treturn true;\n\t}\n\n\tif (!one || !other) {\n\t\treturn false;\n\t}\n\n\tif (one.length !== other.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0, len = one.length; i < len; i++) {\n\t\tif (!itemEquals(one[i], other[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Remove the element at `index` by replacing it with the last element. This is faster than `splice`\n * but changes the order of the array\n */\nexport function removeFastWithoutKeepingOrder(array: T[], index: number) {\n\tconst last = array.length - 1;\n\tif (index < last) {\n\t\tarray[index] = array[last];\n\t}\n\tarray.pop();\n}\n\n/**\n * Performs a binary search algorithm over a sorted array.\n *\n * @param array The array being searched.\n * @param key The value we search for.\n * @param comparator A function that takes two array elements and returns zero\n * if they are equal, a negative number if the first element precedes the\n * second one in the sorting order, or a positive number if the second element\n * precedes the first one.\n * @return See {@link binarySearch2}\n */\nexport function binarySearch(array: ReadonlyArray, key: T, comparator: (op1: T, op2: T) => number): number {\n\treturn binarySearch2(array.length, i => comparator(array[i], key));\n}\n\n/**\n * Performs a binary search algorithm over a sorted collection. Useful for cases\n * when we need to perform a binary search over something that isn't actually an\n * array, and converting data to an array would defeat the use of binary search\n * in the first place.\n *\n * @param length The collection length.\n * @param compareToKey A function that takes an index of an element in the\n * collection and returns zero if the value at this index is equal to the\n * search key, a negative number if the value precedes the search key in the\n * sorting order, or a positive number if the search key precedes the value.\n * @return A non-negative index of an element, if found. If not found, the\n * result is -(n+1) (or ~n, using bitwise notation), where n is the index\n * where the key should be inserted to maintain the sorting order.\n */\nexport function binarySearch2(length: number, compareToKey: (index: number) => number): number {\n\tlet low = 0,\n\t\thigh = length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = ((low + high) / 2) | 0;\n\t\tconst comp = compareToKey(mid);\n\t\tif (comp < 0) {\n\t\t\tlow = mid + 1;\n\t\t} else if (comp > 0) {\n\t\t\thigh = mid - 1;\n\t\t} else {\n\t\t\treturn mid;\n\t\t}\n\t}\n\treturn -(low + 1);\n}\n\ntype Compare = (a: T, b: T) => number;\n\n\nexport function quickSelect(nth: number, data: T[], compare: Compare): T {\n\n\tnth = nth | 0;\n\n\tif (nth >= data.length) {\n\t\tthrow new TypeError('invalid index');\n\t}\n\n\tconst pivotValue = data[Math.floor(data.length * Math.random())];\n\tconst lower: T[] = [];\n\tconst higher: T[] = [];\n\tconst pivots: T[] = [];\n\n\tfor (const value of data) {\n\t\tconst val = compare(value, pivotValue);\n\t\tif (val < 0) {\n\t\t\tlower.push(value);\n\t\t} else if (val > 0) {\n\t\t\thigher.push(value);\n\t\t} else {\n\t\t\tpivots.push(value);\n\t\t}\n\t}\n\n\tif (nth < lower.length) {\n\t\treturn quickSelect(nth, lower, compare);\n\t} else if (nth < lower.length + pivots.length) {\n\t\treturn pivots[0];\n\t} else {\n\t\treturn quickSelect(nth - (lower.length + pivots.length), higher, compare);\n\t}\n}\n\nexport function groupBy(data: ReadonlyArray, compare: (a: T, b: T) => number): T[][] {\n\tconst result: T[][] = [];\n\tlet currentGroup: T[] | undefined = undefined;\n\tfor (const element of data.slice(0).sort(compare)) {\n\t\tif (!currentGroup || compare(currentGroup[0], element) !== 0) {\n\t\t\tcurrentGroup = [element];\n\t\t\tresult.push(currentGroup);\n\t\t} else {\n\t\t\tcurrentGroup.push(element);\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Splits the given items into a list of (non-empty) groups.\n * `shouldBeGrouped` is used to decide if two consecutive items should be in the same group.\n * The order of the items is preserved.\n */\nexport function* groupAdjacentBy(items: Iterable, shouldBeGrouped: (item1: T, item2: T) => boolean): Iterable {\n\tlet currentGroup: T[] | undefined;\n\tlet last: T | undefined;\n\tfor (const item of items) {\n\t\tif (last !== undefined && shouldBeGrouped(last, item)) {\n\t\t\tcurrentGroup!.push(item);\n\t\t} else {\n\t\t\tif (currentGroup) {\n\t\t\t\tyield currentGroup;\n\t\t\t}\n\t\t\tcurrentGroup = [item];\n\t\t}\n\t\tlast = item;\n\t}\n\tif (currentGroup) {\n\t\tyield currentGroup;\n\t}\n}\n\nexport function forEachAdjacent(arr: T[], f: (item1: T | undefined, item2: T | undefined) => void): void {\n\tfor (let i = 0; i <= arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);\n\t}\n}\n\nexport function forEachWithNeighbors(arr: T[], f: (before: T | undefined, element: T, after: T | undefined) => void): void {\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);\n\t}\n}\n\ninterface IMutableSplice extends ISplice {\n\treadonly toInsert: T[];\n\tdeleteCount: number;\n}\n\n/**\n * Diffs two *sorted* arrays and computes the splices which apply the diff.\n */\nexport function sortedDiff(before: ReadonlyArray, after: ReadonlyArray, compare: (a: T, b: T) => number): ISplice[] {\n\tconst result: IMutableSplice[] = [];\n\n\tfunction pushSplice(start: number, deleteCount: number, toInsert: T[]): void {\n\t\tif (deleteCount === 0 && toInsert.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst latest = result[result.length - 1];\n\n\t\tif (latest && latest.start + latest.deleteCount === start) {\n\t\t\tlatest.deleteCount += deleteCount;\n\t\t\tlatest.toInsert.push(...toInsert);\n\t\t} else {\n\t\t\tresult.push({ start, deleteCount, toInsert });\n\t\t}\n\t}\n\n\tlet beforeIdx = 0;\n\tlet afterIdx = 0;\n\n\twhile (true) {\n\t\tif (beforeIdx === before.length) {\n\t\t\tpushSplice(beforeIdx, 0, after.slice(afterIdx));\n\t\t\tbreak;\n\t\t}\n\t\tif (afterIdx === after.length) {\n\t\t\tpushSplice(beforeIdx, before.length - beforeIdx, []);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst beforeElement = before[beforeIdx];\n\t\tconst afterElement = after[afterIdx];\n\t\tconst n = compare(beforeElement, afterElement);\n\t\tif (n === 0) {\n\t\t\t// equal\n\t\t\tbeforeIdx += 1;\n\t\t\tafterIdx += 1;\n\t\t} else if (n < 0) {\n\t\t\t// beforeElement is smaller -> before element removed\n\t\t\tpushSplice(beforeIdx, 1, []);\n\t\t\tbeforeIdx += 1;\n\t\t} else if (n > 0) {\n\t\t\t// beforeElement is greater -> after element added\n\t\t\tpushSplice(beforeIdx, 0, [afterElement]);\n\t\t\tafterIdx += 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Takes two *sorted* arrays and computes their delta (removed, added elements).\n * Finishes in `Math.min(before.length, after.length)` steps.\n */\nexport function delta(before: ReadonlyArray, after: ReadonlyArray, compare: (a: T, b: T) => number): { removed: T[]; added: T[] } {\n\tconst splices = sortedDiff(before, after, compare);\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\n\tfor (const splice of splices) {\n\t\tremoved.push(...before.slice(splice.start, splice.start + splice.deleteCount));\n\t\tadded.push(...splice.toInsert);\n\t}\n\n\treturn { removed, added };\n}\n\n/**\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @return The first n elements from array when sorted with compare.\n */\nexport function top(array: ReadonlyArray, compare: (a: T, b: T) => number, n: number): T[] {\n\tif (n === 0) {\n\t\treturn [];\n\t}\n\tconst result = array.slice(0, n).sort(compare);\n\ttopStep(array, compare, result, n, array.length);\n\treturn result;\n}\n\n/**\n * Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.\n *\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @param batch The number of elements to examine before yielding to the event loop.\n * @return The first n elements from array when sorted with compare.\n */\nexport function topAsync(array: T[], compare: (a: T, b: T) => number, n: number, batch: number, token?: CancellationToken): Promise {\n\tif (n === 0) {\n\t\treturn Promise.resolve([]);\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\t(async () => {\n\t\t\tconst o = array.length;\n\t\t\tconst result = array.slice(0, n).sort(compare);\n\t\t\tfor (let i = n, m = Math.min(n + batch, o); i < o; i = m, m = Math.min(m + batch, o)) {\n\t\t\t\tif (i > n) {\n\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve)); // any other delay function would starve I/O\n\t\t\t\t}\n\t\t\t\tif (token && token.isCancellationRequested) {\n\t\t\t\t\tthrow new CancellationError();\n\t\t\t\t}\n\t\t\t\ttopStep(array, compare, result, i, m);\n\t\t\t}\n\t\t\treturn result;\n\t\t})()\n\t\t\t.then(resolve, reject);\n\t});\n}\n\nfunction topStep(array: ReadonlyArray, compare: (a: T, b: T) => number, result: T[], i: number, m: number): void {\n\tfor (const n = result.length; i < m; i++) {\n\t\tconst element = array[i];\n\t\tif (compare(element, result[n - 1]) < 0) {\n\t\t\tresult.pop();\n\t\t\tconst j = findFirstIdxMonotonousOrArrLen(result, e => compare(element, e) < 0);\n\t\t\tresult.splice(j, 0, element);\n\t\t}\n\t}\n}\n\n/**\n * @returns New array with all falsy values removed. The original array IS NOT modified.\n */\nexport function coalesce(array: ReadonlyArray): T[] {\n\treturn array.filter((e): e is T => !!e);\n}\n\n/**\n * Remove all falsy values from `array`. The original array IS modified.\n */\nexport function coalesceInPlace(array: Array): asserts array is Array {\n\tlet to = 0;\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (!!array[i]) {\n\t\t\tarray[to] = array[i];\n\t\t\tto += 1;\n\t\t}\n\t}\n\tarray.length = to;\n}\n\n/**\n * @deprecated Use `Array.copyWithin` instead\n */\nexport function move(array: any[], from: number, to: number): void {\n\tarray.splice(to, 0, array.splice(from, 1)[0]);\n}\n\n/**\n * @returns false if the provided object is an array and not empty.\n */\nexport function isFalsyOrEmpty(obj: any): boolean {\n\treturn !Array.isArray(obj) || obj.length === 0;\n}\n\n/**\n * @returns True if the provided object is an array and has at least one element.\n */\nexport function isNonEmptyArray(obj: T[] | undefined | null): obj is T[];\nexport function isNonEmptyArray(obj: readonly T[] | undefined | null): obj is readonly T[];\nexport function isNonEmptyArray(obj: T[] | readonly T[] | undefined | null): obj is T[] | readonly T[] {\n\treturn Array.isArray(obj) && obj.length > 0;\n}\n\n/**\n * Removes duplicates from the given array. The optional keyFn allows to specify\n * how elements are checked for equality by returning an alternate value for each.\n */\nexport function distinct(array: ReadonlyArray, keyFn: (value: T) => any = value => value): T[] {\n\tconst seen = new Set();\n\n\treturn array.filter(element => {\n\t\tconst key = keyFn!(element);\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(key);\n\t\treturn true;\n\t});\n}\n\nexport function uniqueFilter(keyFn: (t: T) => R): (t: T) => boolean {\n\tconst seen = new Set();\n\n\treturn element => {\n\t\tconst key = keyFn(element);\n\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tseen.add(key);\n\t\treturn true;\n\t};\n}\n\nexport function firstOrDefault(array: ReadonlyArray, notFoundValue: NotFound): T | NotFound;\nexport function firstOrDefault(array: ReadonlyArray): T | undefined;\nexport function firstOrDefault(array: ReadonlyArray, notFoundValue?: NotFound): T | NotFound | undefined {\n\treturn array.length > 0 ? array[0] : notFoundValue;\n}\n\nexport function lastOrDefault(array: ReadonlyArray, notFoundValue: NotFound): T | NotFound;\nexport function lastOrDefault(array: ReadonlyArray): T | undefined;\nexport function lastOrDefault(array: ReadonlyArray, notFoundValue?: NotFound): T | NotFound | undefined {\n\treturn array.length > 0 ? array[array.length - 1] : notFoundValue;\n}\n\nexport function commonPrefixLength(one: ReadonlyArray, other: ReadonlyArray, equals: (a: T, b: T) => boolean = (a, b) => a === b): number {\n\tlet result = 0;\n\n\tfor (let i = 0, len = Math.min(one.length, other.length); i < len && equals(one[i], other[i]); i++) {\n\t\tresult++;\n\t}\n\n\treturn result;\n}\n\nexport function range(to: number): number[];\nexport function range(from: number, to: number): number[];\nexport function range(arg: number, to?: number): number[] {\n\tlet from = typeof to === 'number' ? arg : 0;\n\n\tif (typeof to === 'number') {\n\t\tfrom = arg;\n\t} else {\n\t\tfrom = 0;\n\t\tto = arg;\n\t}\n\n\tconst result: number[] = [];\n\n\tif (from <= to) {\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tresult.push(i);\n\t\t}\n\t} else {\n\t\tfor (let i = from; i > to; i--) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function index(array: ReadonlyArray, indexer: (t: T) => string): { [key: string]: T };\nexport function index(array: ReadonlyArray, indexer: (t: T) => string, mapper: (t: T) => R): { [key: string]: R };\nexport function index(array: ReadonlyArray, indexer: (t: T) => string, mapper?: (t: T) => R): { [key: string]: R } {\n\treturn array.reduce((r, t) => {\n\t\tr[indexer(t)] = mapper ? mapper(t) : t;\n\t\treturn r;\n\t}, Object.create(null));\n}\n\n/**\n * Inserts an element into an array. Returns a function which, when\n * called, will remove that element from the array.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function insert(array: T[], element: T): () => void {\n\tarray.push(element);\n\n\treturn () => remove(array, element);\n}\n\n/**\n * Removes an element from an array if it can be found.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function remove(array: T[], element: T): T | undefined {\n\tconst index = array.indexOf(element);\n\tif (index > -1) {\n\t\tarray.splice(index, 1);\n\n\t\treturn element;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Insert `insertArr` inside `target` at `insertIndex`.\n * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array\n */\nexport function arrayInsert(target: T[], insertIndex: number, insertArr: T[]): T[] {\n\tconst before = target.slice(0, insertIndex);\n\tconst after = target.slice(insertIndex);\n\treturn before.concat(insertArr, after);\n}\n\n/**\n * Uses Fisher-Yates shuffle to shuffle the given array\n */\nexport function shuffle(array: T[], _seed?: number): void {\n\tlet rand: () => number;\n\n\tif (typeof _seed === 'number') {\n\t\tlet seed = _seed;\n\t\t// Seeded random number generator in JS. Modified from:\n\t\t// https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript\n\t\trand = () => {\n\t\t\tconst x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias\n\t\t\treturn x - Math.floor(x);\n\t\t};\n\t} else {\n\t\trand = Math.random;\n\t}\n\n\tfor (let i = array.length - 1; i > 0; i -= 1) {\n\t\tconst j = Math.floor(rand() * (i + 1));\n\t\tconst temp = array[i];\n\t\tarray[i] = array[j];\n\t\tarray[j] = temp;\n\t}\n}\n\n/**\n * Pushes an element to the start of the array, if found.\n */\nexport function pushToStart(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.unshift(value);\n\t}\n}\n\n/**\n * Pushes an element to the end of the array, if found.\n */\nexport function pushToEnd(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.push(value);\n\t}\n}\n\nexport function pushMany(arr: T[], items: ReadonlyArray): void {\n\tfor (const item of items) {\n\t\tarr.push(item);\n\t}\n}\n\nexport function mapArrayOrNot(items: T | T[], fn: (_: T) => U): U | U[] {\n\treturn Array.isArray(items) ?\n\t\titems.map(fn) :\n\t\tfn(items);\n}\n\nexport function asArray(x: T | T[]): T[];\nexport function asArray(x: T | readonly T[]): readonly T[];\nexport function asArray(x: T | T[]): T[] {\n\treturn Array.isArray(x) ? x : [x];\n}\n\nexport function getRandomElement(arr: T[]): T | undefined {\n\treturn arr[Math.floor(Math.random() * arr.length)];\n}\n\n/**\n * Insert the new items in the array.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start inserting elements.\n * @param newItems The items to be inserted\n */\nexport function insertInto(array: T[], start: number, newItems: T[]): void {\n\tconst startIdx = getActualStartIndex(array, start);\n\tconst originalLength = array.length;\n\tconst newItemsLength = newItems.length;\n\tarray.length = originalLength + newItemsLength;\n\t// Move the items after the start index, start from the end so that we don't overwrite any value.\n\tfor (let i = originalLength - 1; i >= startIdx; i--) {\n\t\tarray[i + newItemsLength] = array[i];\n\t}\n\n\tfor (let i = 0; i < newItemsLength; i++) {\n\t\tarray[i + startIdx] = newItems[i];\n\t}\n}\n\n/**\n * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it\n * can only support limited number of items due to the maximum call stack size limit.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns An array containing the elements that were deleted.\n */\nexport function splice(array: T[], start: number, deleteCount: number, newItems: T[]): T[] {\n\tconst index = getActualStartIndex(array, start);\n\tlet result = array.splice(index, deleteCount);\n\tif (result === undefined) {\n\t\t// see https://bugs.webkit.org/show_bug.cgi?id=261140\n\t\tresult = [];\n\t}\n\tinsertInto(array, index, newItems);\n\treturn result;\n}\n\n/**\n * Determine the actual start index (same logic as the native splice() or slice())\n * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.\n * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0.\n * @param array The target array.\n * @param start The operation index.\n */\nfunction getActualStartIndex(array: T[], start: number): number {\n\treturn start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\n}\n\n/**\n * When comparing two values,\n * a negative number indicates that the first value is less than the second,\n * a positive number indicates that the first value is greater than the second,\n * and zero indicates that neither is the case.\n*/\nexport type CompareResult = number;\n\nexport namespace CompareResult {\n\texport function isLessThan(result: CompareResult): boolean {\n\t\treturn result < 0;\n\t}\n\n\texport function isLessThanOrEqual(result: CompareResult): boolean {\n\t\treturn result <= 0;\n\t}\n\n\texport function isGreaterThan(result: CompareResult): boolean {\n\t\treturn result > 0;\n\t}\n\n\texport function isNeitherLessOrGreaterThan(result: CompareResult): boolean {\n\t\treturn result === 0;\n\t}\n\n\texport const greaterThan = 1;\n\texport const lessThan = -1;\n\texport const neitherLessOrGreaterThan = 0;\n}\n\n/**\n * A comparator `c` defines a total order `<=` on `T` as following:\n * `c(a, b) <= 0` iff `a` <= `b`.\n * We also have `c(a, b) == 0` iff `c(b, a) == 0`.\n*/\nexport type Comparator = (a: T, b: T) => CompareResult;\n\nexport function compareBy(selector: (item: TItem) => TCompareBy, comparator: Comparator): Comparator {\n\treturn (a, b) => comparator(selector(a), selector(b));\n}\n\nexport function tieBreakComparators(...comparators: Comparator[]): Comparator {\n\treturn (item1, item2) => {\n\t\tfor (const comparator of comparators) {\n\t\t\tconst result = comparator(item1, item2);\n\t\t\tif (!CompareResult.isNeitherLessOrGreaterThan(result)) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn CompareResult.neitherLessOrGreaterThan;\n\t};\n}\n\n/**\n * The natural order on numbers.\n*/\nexport const numberComparator: Comparator = (a, b) => a - b;\n\nexport const booleanComparator: Comparator = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0);\n\nexport function reverseOrder(comparator: Comparator): Comparator {\n\treturn (a, b) => -comparator(a, b);\n}\n\nexport class ArrayQueue {\n\tprivate firstIdx = 0;\n\tprivate lastIdx = this.items.length - 1;\n\n\t/**\n\t * Constructs a queue that is backed by the given array. Runtime is O(1).\n\t*/\n\tconstructor(private readonly items: readonly T[]) { }\n\n\tget length(): number {\n\t\treturn this.lastIdx - this.firstIdx + 1;\n\t}\n\n\t/**\n\t * Consumes elements from the beginning of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\n\t*/\n\ttakeWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := k <= this.lastIdx && predicate(this.items[k])\n\t\t// Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\n\n\t\tlet startIdx = this.firstIdx;\n\t\twhile (startIdx < this.items.length && predicate(this.items[startIdx])) {\n\t\t\tstartIdx++;\n\t\t}\n\t\tconst result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\n\t\tthis.firstIdx = startIdx;\n\t\treturn result;\n\t}\n\n\t/**\n\t * Consumes elements from the end of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned.\n\t * The result has the same order as the underlying array!\n\t*/\n\ttakeFromEndWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := this.firstIdx >= k && predicate(this.items[k])\n\t\t// Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\n\n\t\tlet endIdx = this.lastIdx;\n\t\twhile (endIdx >= 0 && predicate(this.items[endIdx])) {\n\t\t\tendIdx--;\n\t\t}\n\t\tconst result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\n\t\tthis.lastIdx = endIdx;\n\t\treturn result;\n\t}\n\n\tpeek(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.firstIdx];\n\t}\n\n\tpeekLast(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.lastIdx];\n\t}\n\n\tdequeue(): T | undefined {\n\t\tconst result = this.items[this.firstIdx];\n\t\tthis.firstIdx++;\n\t\treturn result;\n\t}\n\n\tremoveLast(): T | undefined {\n\t\tconst result = this.items[this.lastIdx];\n\t\tthis.lastIdx--;\n\t\treturn result;\n\t}\n\n\ttakeCount(count: number): T[] {\n\t\tconst result = this.items.slice(this.firstIdx, this.firstIdx + count);\n\t\tthis.firstIdx += count;\n\t\treturn result;\n\t}\n}\n\n/**\n * This class is faster than an iterator and array for lazy computed data.\n*/\nexport class CallbackIterable {\n\tpublic static readonly empty = new CallbackIterable(_callback => { });\n\n\tconstructor(\n\t\t/**\n\t\t * Calls the callback for every item.\n\t\t * Stops when the callback returns false.\n\t\t*/\n\t\tpublic readonly iterate: (callback: (item: T) => boolean) => void\n\t) {\n\t}\n\n\tforEach(handler: (item: T) => void) {\n\t\tthis.iterate(item => { handler(item); return true; });\n\t}\n\n\ttoArray(): T[] {\n\t\tconst result: T[] = [];\n\t\tthis.iterate(item => { result.push(item); return true; });\n\t\treturn result;\n\t}\n\n\tfilter(predicate: (item: T) => boolean): CallbackIterable {\n\t\treturn new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true));\n\t}\n\n\tmap(mapFn: (item: T) => TResult): CallbackIterable {\n\t\treturn new CallbackIterable(cb => this.iterate(item => cb(mapFn(item))));\n\t}\n\n\tsome(predicate: (item: T) => boolean): boolean {\n\t\tlet result = false;\n\t\tthis.iterate(item => { result = predicate(item); return !result; });\n\t\treturn result;\n\t}\n\n\tfindFirst(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLast(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLastMaxBy(comparator: Comparator): T | undefined {\n\t\tlet result: T | undefined;\n\t\tlet first = true;\n\t\tthis.iterate(item => {\n\t\t\tif (first || CompareResult.isGreaterThan(comparator(item, result!))) {\n\t\t\t\tfirst = false;\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n}\n\n/**\n * Represents a re-arrangement of items in an array.\n */\nexport class Permutation {\n\tconstructor(private readonly _indexMap: readonly number[]) { }\n\n\t/**\n\t * Returns a permutation that sorts the given array according to the given compare function.\n\t */\n\tpublic static createSortPermutation(arr: readonly T[], compareFn: (a: T, b: T) => number): Permutation {\n\t\tconst sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2]));\n\t\treturn new Permutation(sortIndices);\n\t}\n\n\t/**\n\t * Returns a new array with the elements of the given array re-arranged according to this permutation.\n\t */\n\tapply(arr: readonly T[]): T[] {\n\t\treturn arr.map((_, index) => arr[this._indexMap[index]]);\n\t}\n\n\t/**\n\t * Returns a new permutation that undoes the re-arrangement of this permutation.\n\t*/\n\tinverse(): Permutation {\n\t\tconst inverseIndexMap = this._indexMap.slice();\n\t\tfor (let i = 0; i < this._indexMap.length; i++) {\n\t\t\tinverseIndexMap[this._indexMap[i]] = i;\n\t\t}\n\t\treturn new Permutation(inverseIndexMap);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are strings.\n */\nexport type IStringDictionary = Record;\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are numbers.\n */\nexport type INumberDictionary = Record;\n\n/**\n * Groups the collection into a dictionary based on the provided\n * group function.\n */\nexport function groupBy(data: V[], groupFn: (element: V) => K): Record {\n\tconst result: Record = Object.create(null);\n\tfor (const element of data) {\n\t\tconst key = groupFn(element);\n\t\tlet target = result[key];\n\t\tif (!target) {\n\t\t\ttarget = result[key] = [];\n\t\t}\n\t\ttarget.push(element);\n\t}\n\treturn result;\n}\n\nexport function diffSets(before: Set, after: Set): { removed: T[]; added: T[] } {\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\tfor (const element of before) {\n\t\tif (!after.has(element)) {\n\t\t\tremoved.push(element);\n\t\t}\n\t}\n\tfor (const element of after) {\n\t\tif (!before.has(element)) {\n\t\t\tadded.push(element);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\nexport function diffMaps(before: Map, after: Map): { removed: V[]; added: V[] } {\n\tconst removed: V[] = [];\n\tconst added: V[] = [];\n\tfor (const [index, value] of before) {\n\t\tif (!after.has(index)) {\n\t\t\tremoved.push(value);\n\t\t}\n\t}\n\tfor (const [index, value] of after) {\n\t\tif (!before.has(index)) {\n\t\t\tadded.push(value);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\n/**\n * Computes the intersection of two sets.\n *\n * @param setA - The first set.\n * @param setB - The second iterable.\n * @returns A new set containing the elements that are in both `setA` and `setB`.\n */\nexport function intersection(setA: Set, setB: Iterable): Set {\n\tconst result = new Set();\n\tfor (const elem of setB) {\n\t\tif (setA.has(elem)) {\n\t\t\tresult.add(elem);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class SetWithKey implements Set {\n\tprivate _map = new Map();\n\n\tconstructor(values: T[], private toKey: (t: T) => any) {\n\t\tfor (const value of values) {\n\t\t\tthis.add(value);\n\t\t}\n\t}\n\n\tget size(): number {\n\t\treturn this._map.size;\n\t}\n\n\tadd(value: T): this {\n\t\tconst key = this.toKey(value);\n\t\tthis._map.set(key, value);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\treturn this._map.delete(this.toKey(value));\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this._map.has(this.toKey(value));\n\t}\n\n\t*entries(): IterableIterator<[T, T]> {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield [entry, entry];\n\t\t}\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this.values();\n\t}\n\n\t*values(): IterableIterator {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield entry;\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._map.clear();\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void {\n\t\tthis._map.forEach(entry => callbackfn.call(thisArg, entry, entry, this));\n\t}\n\n\t[Symbol.iterator](): IterableIterator {\n\t\treturn this.values();\n\t}\n\n\t[Symbol.toStringTag]: string = 'SetWithKey';\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport function getOrSet(map: Map, key: K, value: V): V {\n\tlet result = map.get(key);\n\tif (result === undefined) {\n\t\tresult = value;\n\t\tmap.set(key, result);\n\t}\n\n\treturn result;\n}\n\nexport function mapToString(map: Map): string {\n\tconst entries: string[] = [];\n\tmap.forEach((value, key) => {\n\t\tentries.push(`${key} => ${value}`);\n\t});\n\n\treturn `Map(${map.size}) {${entries.join(', ')}}`;\n}\n\nexport function setToString(set: Set): string {\n\tconst entries: K[] = [];\n\tset.forEach(value => {\n\t\tentries.push(value);\n\t});\n\n\treturn `Set(${set.size}) {${entries.join(', ')}}`;\n}\n\nexport const enum Touch {\n\tNone = 0,\n\tAsOld = 1,\n\tAsNew = 2\n}\n\nexport class CounterSet {\n\n\tprivate map = new Map();\n\n\tadd(value: T): CounterSet {\n\t\tthis.map.set(value, (this.map.get(value) || 0) + 1);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\tlet counter = this.map.get(value) || 0;\n\n\t\tif (counter === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tcounter--;\n\n\t\tif (counter === 0) {\n\t\t\tthis.map.delete(value);\n\t\t} else {\n\t\t\tthis.map.set(value, counter);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this.map.has(value);\n\t}\n}\n\n/**\n * A map that allows access both by keys and values.\n * **NOTE**: values need to be unique.\n */\nexport class BidirectionalMap {\n\n\tprivate readonly _m1 = new Map();\n\tprivate readonly _m2 = new Map();\n\n\tconstructor(entries?: readonly (readonly [K, V])[]) {\n\t\tif (entries) {\n\t\t\tfor (const [key, value] of entries) {\n\t\t\t\tthis.set(key, value);\n\t\t\t}\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._m1.clear();\n\t\tthis._m2.clear();\n\t}\n\n\tset(key: K, value: V): void {\n\t\tthis._m1.set(key, value);\n\t\tthis._m2.set(value, key);\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._m1.get(key);\n\t}\n\n\tgetKey(value: V): K | undefined {\n\t\treturn this._m2.get(value);\n\t}\n\n\tdelete(key: K): boolean {\n\t\tconst value = this._m1.get(key);\n\t\tif (value === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._m1.delete(key);\n\t\tthis._m2.delete(value);\n\t\treturn true;\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: BidirectionalMap) => void, thisArg?: any): void {\n\t\tthis._m1.forEach((value, key) => {\n\t\t\tcallbackfn.call(thisArg, value, key, this);\n\t\t});\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this._m1.keys();\n\t}\n\n\tvalues(): IterableIterator {\n\t\treturn this._m1.values();\n\t}\n}\n\nexport class SetMap {\n\n\tprivate map = new Map>();\n\n\tadd(key: K, value: V): void {\n\t\tlet values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\tvalues = new Set();\n\t\t\tthis.map.set(key, values);\n\t\t}\n\n\t\tvalues.add(value);\n\t}\n\n\tdelete(key: K, value: V): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.delete(value);\n\n\t\tif (values.size === 0) {\n\t\t\tthis.map.delete(key);\n\t\t}\n\t}\n\n\tforEach(key: K, fn: (value: V) => void): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.forEach(fn);\n\t}\n\n\tget(key: K): ReadonlySet {\n\t\tconst values = this.map.get(key);\n\t\tif (!values) {\n\t\t\treturn new Set();\n\t\t}\n\t\treturn values;\n\t}\n}\n\nexport function mapsStrictEqualIgnoreOrder(a: Map, b: Map): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\tif (a.size !== b.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [key, value] of a) {\n\t\tif (!b.has(key) || b.get(key) !== value) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfor (const [key] of b) {\n\t\tif (!a.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Given a function, returns a function that is only calling that function once.\n */\nexport function createSingleCallFunction(this: unknown, fn: T, fnDidRunCallback?: () => void): T {\n\tconst _this = this;\n\tlet didCall = false;\n\tlet result: unknown;\n\n\treturn function () {\n\t\tif (didCall) {\n\t\t\treturn result;\n\t\t}\n\n\t\tdidCall = true;\n\t\tif (fnDidRunCallback) {\n\t\t\ttry {\n\t\t\t\tresult = fn.apply(_this, arguments);\n\t\t\t} finally {\n\t\t\t\tfnDidRunCallback();\n\t\t\t}\n\t\t} else {\n\t\t\tresult = fn.apply(_this, arguments);\n\t\t}\n\n\t\treturn result;\n\t} as unknown as T;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport namespace Iterable {\n\n\texport function is(thing: any): thing is Iterable {\n\t\treturn thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\n\t}\n\n\tconst _empty: Iterable = Object.freeze([]);\n\texport function empty(): Iterable {\n\t\treturn _empty;\n\t}\n\n\texport function* single(element: T): Iterable {\n\t\tyield element;\n\t}\n\n\texport function wrap(iterableOrElement: Iterable | T): Iterable {\n\t\tif (is(iterableOrElement)) {\n\t\t\treturn iterableOrElement;\n\t\t} else {\n\t\t\treturn single(iterableOrElement);\n\t\t}\n\t}\n\n\texport function from(iterable: Iterable | undefined | null): Iterable {\n\t\treturn iterable || _empty;\n\t}\n\n\texport function* reverse(array: Array): Iterable {\n\t\tfor (let i = array.length - 1; i >= 0; i--) {\n\t\t\tyield array[i];\n\t\t}\n\t}\n\n\texport function isEmpty(iterable: Iterable | undefined | null): boolean {\n\t\treturn !iterable || iterable[Symbol.iterator]().next().done === true;\n\t}\n\n\texport function first(iterable: Iterable): T | undefined {\n\t\treturn iterable[Symbol.iterator]().next().value;\n\t}\n\n\texport function some(iterable: Iterable, predicate: (t: T, i: number) => unknown): boolean {\n\t\tlet i = 0;\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element, i++)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\texport function find(iterable: Iterable, predicate: (t: T) => t is R): R | undefined;\n\texport function find(iterable: Iterable, predicate: (t: T) => boolean): T | undefined;\n\texport function find(iterable: Iterable, predicate: (t: T) => boolean): T | undefined {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\texport function filter(iterable: Iterable, predicate: (t: T) => t is R): Iterable;\n\texport function filter(iterable: Iterable, predicate: (t: T) => boolean): Iterable;\n\texport function* filter(iterable: Iterable, predicate: (t: T) => boolean): Iterable {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\tyield element;\n\t\t\t}\n\t\t}\n\t}\n\n\texport function* map(iterable: Iterable, fn: (t: T, index: number) => R): Iterable {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield fn(element, index++);\n\t\t}\n\t}\n\n\texport function* flatMap(iterable: Iterable, fn: (t: T, index: number) => Iterable): Iterable {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield* fn(element, index++);\n\t\t}\n\t}\n\n\texport function* concat(...iterables: Iterable[]): Iterable {\n\t\tfor (const iterable of iterables) {\n\t\t\tyield* iterable;\n\t\t}\n\t}\n\n\texport function reduce(iterable: Iterable, reducer: (previousValue: R, currentValue: T) => R, initialValue: R): R {\n\t\tlet value = initialValue;\n\t\tfor (const element of iterable) {\n\t\t\tvalue = reducer(value, element);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\n\t */\n\texport function* slice(arr: ReadonlyArray, from: number, to = arr.length): Iterable {\n\t\tif (from < 0) {\n\t\t\tfrom += arr.length;\n\t\t}\n\n\t\tif (to < 0) {\n\t\t\tto += arr.length;\n\t\t} else if (to > arr.length) {\n\t\t\tto = arr.length;\n\t\t}\n\n\t\tfor (; from < to; from++) {\n\t\t\tyield arr[from];\n\t\t}\n\t}\n\n\t/**\n\t * Consumes `atMost` elements from iterable and returns the consumed elements,\n\t * and an iterable for the rest of the elements.\n\t */\n\texport function consume(iterable: Iterable, atMost: number = Number.POSITIVE_INFINITY): [T[], Iterable] {\n\t\tconst consumed: T[] = [];\n\n\t\tif (atMost === 0) {\n\t\t\treturn [consumed, iterable];\n\t\t}\n\n\t\tconst iterator = iterable[Symbol.iterator]();\n\n\t\tfor (let i = 0; i < atMost; i++) {\n\t\t\tconst next = iterator.next();\n\n\t\t\tif (next.done) {\n\t\t\t\treturn [consumed, Iterable.empty()];\n\t\t\t}\n\n\t\t\tconsumed.push(next.value);\n\t\t}\n\n\t\treturn [consumed, { [Symbol.iterator]() { return iterator; } }];\n\t}\n\n\texport async function asyncToArray(iterable: AsyncIterable): Promise {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn Promise.resolve(result);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { compareBy, numberComparator } from 'vs/base/common/arrays';\nimport { groupBy } from 'vs/base/common/collections';\nimport { SetMap } from './map';\nimport { createSingleCallFunction } from 'vs/base/common/functional';\nimport { Iterable } from 'vs/base/common/iterator';\n\n// #region Disposable Tracking\n\n/**\n * Enables logging of potentially leaked disposables.\n *\n * A disposable is considered leaked if it is not disposed or not registered as the child of\n * another disposable. This tracking is very simple an only works for classes that either\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\n */\nconst TRACK_DISPOSABLES = false;\nlet disposableTracker: IDisposableTracker | null = null;\n\nexport interface IDisposableTracker {\n\t/**\n\t * Is called on construction of a disposable.\n\t*/\n\ttrackDisposable(disposable: IDisposable): void;\n\n\t/**\n\t * Is called when a disposable is registered as child of another disposable (e.g. {@link DisposableStore}).\n\t * If parent is `null`, the disposable is removed from its former parent.\n\t*/\n\tsetParent(child: IDisposable, parent: IDisposable | null): void;\n\n\t/**\n\t * Is called after a disposable is disposed.\n\t*/\n\tmarkAsDisposed(disposable: IDisposable): void;\n\n\t/**\n\t * Indicates that the given object is a singleton which does not need to be disposed.\n\t*/\n\tmarkAsSingleton(disposable: IDisposable): void;\n}\n\nexport interface DisposableInfo {\n\tvalue: IDisposable;\n\tsource: string | null;\n\tparent: IDisposable | null;\n\tisSingleton: boolean;\n\tidx: number;\n}\n\nexport class DisposableTracker implements IDisposableTracker {\n\tprivate static idx = 0;\n\n\tprivate readonly livingDisposables = new Map();\n\n\tprivate getDisposableData(d: IDisposable): DisposableInfo {\n\t\tlet val = this.livingDisposables.get(d);\n\t\tif (!val) {\n\t\t\tval = { parent: null, source: null, isSingleton: false, value: d, idx: DisposableTracker.idx++ };\n\t\t\tthis.livingDisposables.set(d, val);\n\t\t}\n\t\treturn val;\n\t}\n\n\ttrackDisposable(d: IDisposable): void {\n\t\tconst data = this.getDisposableData(d);\n\t\tif (!data.source) {\n\t\t\tdata.source =\n\t\t\t\tnew Error().stack!;\n\t\t}\n\t}\n\n\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\tconst data = this.getDisposableData(child);\n\t\tdata.parent = parent;\n\t}\n\n\tmarkAsDisposed(x: IDisposable): void {\n\t\tthis.livingDisposables.delete(x);\n\t}\n\n\tmarkAsSingleton(disposable: IDisposable): void {\n\t\tthis.getDisposableData(disposable).isSingleton = true;\n\t}\n\n\tprivate getRootParent(data: DisposableInfo, cache: Map): DisposableInfo {\n\t\tconst cacheValue = cache.get(data);\n\t\tif (cacheValue) {\n\t\t\treturn cacheValue;\n\t\t}\n\n\t\tconst result = data.parent ? this.getRootParent(this.getDisposableData(data.parent), cache) : data;\n\t\tcache.set(data, result);\n\t\treturn result;\n\t}\n\n\tgetTrackedDisposables(): IDisposable[] {\n\t\tconst rootParentCache = new Map();\n\n\t\tconst leaking = [...this.livingDisposables.entries()]\n\t\t\t.filter(([, v]) => v.source !== null && !this.getRootParent(v, rootParentCache).isSingleton)\n\t\t\t.flatMap(([k]) => k);\n\n\t\treturn leaking;\n\t}\n\n\tcomputeLeakingDisposables(maxReported = 10, preComputedLeaks?: DisposableInfo[]): { leaks: DisposableInfo[]; details: string } | undefined {\n\t\tlet uncoveredLeakingObjs: DisposableInfo[] | undefined;\n\t\tif (preComputedLeaks) {\n\t\t\tuncoveredLeakingObjs = preComputedLeaks;\n\t\t} else {\n\t\t\tconst rootParentCache = new Map();\n\n\t\t\tconst leakingObjects = [...this.livingDisposables.values()]\n\t\t\t\t.filter((info) => info.source !== null && !this.getRootParent(info, rootParentCache).isSingleton);\n\n\t\t\tif (leakingObjects.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst leakingObjsSet = new Set(leakingObjects.map(o => o.value));\n\n\t\t\t// Remove all objects that are a child of other leaking objects. Assumes there are no cycles.\n\t\t\tuncoveredLeakingObjs = leakingObjects.filter(l => {\n\t\t\t\treturn !(l.parent && leakingObjsSet.has(l.parent));\n\t\t\t});\n\n\t\t\tif (uncoveredLeakingObjs.length === 0) {\n\t\t\t\tthrow new Error('There are cyclic diposable chains!');\n\t\t\t}\n\t\t}\n\n\t\tif (!uncoveredLeakingObjs) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tfunction getStackTracePath(leaking: DisposableInfo): string[] {\n\t\t\tfunction removePrefix(array: string[], linesToRemove: (string | RegExp)[]) {\n\t\t\t\twhile (array.length > 0 && linesToRemove.some(regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp))) {\n\t\t\t\t\tarray.shift();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst lines = leaking.source!.split('\\n').map(p => p.trim().replace('at ', '')).filter(l => l !== '');\n\t\t\tremovePrefix(lines, ['Error', /^trackDisposable \\(.*\\)$/, /^DisposableTracker.trackDisposable \\(.*\\)$/]);\n\t\t\treturn lines.reverse();\n\t\t}\n\n\t\tconst stackTraceStarts = new SetMap();\n\t\tfor (const leaking of uncoveredLeakingObjs) {\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tfor (let i = 0; i <= stackTracePath.length; i++) {\n\t\t\t\tstackTraceStarts.add(stackTracePath.slice(0, i).join('\\n'), leaking);\n\t\t\t}\n\t\t}\n\n\t\t// Put earlier leaks first\n\t\tuncoveredLeakingObjs.sort(compareBy(l => l.idx, numberComparator));\n\n\t\tlet message = '';\n\n\t\tlet i = 0;\n\t\tfor (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {\n\t\t\ti++;\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tconst stackTraceFormattedLines = [];\n\n\t\t\tfor (let i = 0; i < stackTracePath.length; i++) {\n\t\t\t\tlet line = stackTracePath[i];\n\t\t\t\tconst starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\\n'));\n\t\t\t\tline = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;\n\n\t\t\t\tconst prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\\n'));\n\t\t\t\tconst continuations = groupBy([...prevStarts].map(d => getStackTracePath(d)[i]), v => v);\n\t\t\t\tdelete continuations[stackTracePath[i]];\n\t\t\t\tfor (const [cont, set] of Object.entries(continuations)) {\n\t\t\t\t\tstackTraceFormattedLines.unshift(` - stacktraces of ${set.length} other leaks continue with ${cont}`);\n\t\t\t\t}\n\n\t\t\t\tstackTraceFormattedLines.unshift(line);\n\t\t\t}\n\n\t\t\tmessage += `\\n\\n\\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\\n${stackTraceFormattedLines.join('\\n')}\\n============================================================\\n\\n`;\n\t\t}\n\n\t\tif (uncoveredLeakingObjs.length > maxReported) {\n\t\t\tmessage += `\\n\\n\\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\\n\\n`;\n\t\t}\n\n\t\treturn { leaks: uncoveredLeakingObjs, details: message };\n\t}\n}\n\nexport function setDisposableTracker(tracker: IDisposableTracker | null): void {\n\tdisposableTracker = tracker;\n}\n\nif (TRACK_DISPOSABLES) {\n\tconst __is_disposable_tracked__ = '__is_disposable_tracked__';\n\tsetDisposableTracker(new class implements IDisposableTracker {\n\t\ttrackDisposable(x: IDisposable): void {\n\t\t\tconst stack = new Error('Potentially leaked disposable').stack!;\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (!(x as any)[__is_disposable_tracked__]) {\n\t\t\t\t\tconsole.log(stack);\n\t\t\t\t}\n\t\t\t}, 3000);\n\t\t}\n\n\t\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\t\tif (child && child !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(child as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmarkAsDisposed(disposable: IDisposable): void {\n\t\t\tif (disposable && disposable !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(disposable as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmarkAsSingleton(disposable: IDisposable): void { }\n\t});\n}\n\nexport function trackDisposable(x: T): T {\n\tdisposableTracker?.trackDisposable(x);\n\treturn x;\n}\n\nexport function markAsDisposed(disposable: IDisposable): void {\n\tdisposableTracker?.markAsDisposed(disposable);\n}\n\nfunction setParentOfDisposable(child: IDisposable, parent: IDisposable | null): void {\n\tdisposableTracker?.setParent(child, parent);\n}\n\nfunction setParentOfDisposables(children: IDisposable[], parent: IDisposable | null): void {\n\tif (!disposableTracker) {\n\t\treturn;\n\t}\n\tfor (const child of children) {\n\t\tdisposableTracker.setParent(child, parent);\n\t}\n}\n\n/**\n * Indicates that the given object is a singleton which does not need to be disposed.\n*/\nexport function markAsSingleton(singleton: T): T {\n\tdisposableTracker?.markAsSingleton(singleton);\n\treturn singleton;\n}\n\n// #endregion\n\n/**\n * An object that performs a cleanup operation when `.dispose()` is called.\n *\n * Some examples of how disposables are used:\n *\n * - An event listener that removes itself when `.dispose()` is called.\n * - A resource such as a file system watcher that cleans up the resource when `.dispose()` is called.\n * - The return value from registering a provider. When `.dispose()` is called, the provider is unregistered.\n */\nexport interface IDisposable {\n\tdispose(): void;\n}\n\n/**\n * Check if `thing` is {@link IDisposable disposable}.\n */\nexport function isDisposable(thing: E): thing is E & IDisposable {\n\treturn typeof thing === 'object' && thing !== null && typeof (thing).dispose === 'function' && (thing).dispose.length === 0;\n}\n\n/**\n * Disposes of the value(s) passed in.\n */\nexport function dispose(disposable: T): T;\nexport function dispose(disposable: T | undefined): T | undefined;\nexport function dispose = Iterable>(disposables: A): A;\nexport function dispose(disposables: Array): Array;\nexport function dispose(disposables: ReadonlyArray): ReadonlyArray;\nexport function dispose(arg: T | Iterable | undefined): any {\n\tif (Iterable.is(arg)) {\n\t\tconst errors: any[] = [];\n\n\t\tfor (const d of arg) {\n\t\t\tif (d) {\n\t\t\t\ttry {\n\t\t\t\t\td.dispose();\n\t\t\t\t} catch (e) {\n\t\t\t\t\terrors.push(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t} else if (errors.length > 1) {\n\t\t\tthrow new AggregateError(errors, 'Encountered errors while disposing of store');\n\t\t}\n\n\t\treturn Array.isArray(arg) ? [] : arg;\n\t} else if (arg) {\n\t\targ.dispose();\n\t\treturn arg;\n\t}\n}\n\nexport function disposeIfDisposable(disposables: Array): Array {\n\tfor (const d of disposables) {\n\t\tif (isDisposable(d)) {\n\t\t\td.dispose();\n\t\t}\n\t}\n\treturn [];\n}\n\n/**\n * Combine multiple disposable values into a single {@link IDisposable}.\n */\nexport function combinedDisposable(...disposables: IDisposable[]): IDisposable {\n\tconst parent = toDisposable(() => dispose(disposables));\n\tsetParentOfDisposables(disposables, parent);\n\treturn parent;\n}\n\n/**\n * Turn a function that implements dispose into an {@link IDisposable}.\n *\n * @param fn Clean up function, guaranteed to be called only **once**.\n */\nexport function toDisposable(fn: () => void): IDisposable {\n\tconst self = trackDisposable({\n\t\tdispose: createSingleCallFunction(() => {\n\t\t\tmarkAsDisposed(self);\n\t\t\tfn();\n\t\t})\n\t});\n\treturn self;\n}\n\n/**\n * Manages a collection of disposable values.\n *\n * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an\n * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a\n * store that has already been disposed of.\n */\nexport class DisposableStore implements IDisposable {\n\n\tstatic DISABLE_DISPOSED_WARNING = false;\n\n\tprivate readonly _toDispose = new Set();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Dispose of all registered disposables and mark this object as disposed.\n\t *\n\t * Any future disposables added to this object will be disposed of on `add`.\n\t */\n\tpublic dispose(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clear();\n\t}\n\n\t/**\n\t * @return `true` if this object has been disposed of.\n\t */\n\tpublic get isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\t/**\n\t * Dispose of all registered disposables but do not mark this object as disposed.\n\t */\n\tpublic clear(): void {\n\t\tif (this._toDispose.size === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._toDispose);\n\t\t} finally {\n\t\t\tthis._toDispose.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Add a new {@link IDisposable disposable} to the collection.\n\t */\n\tpublic add(o: T): T {\n\t\tif (!o) {\n\t\t\treturn o;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\n\t\tsetParentOfDisposable(o, this);\n\t\tif (this._isDisposed) {\n\t\t\tif (!DisposableStore.DISABLE_DISPOSED_WARNING) {\n\t\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._toDispose.add(o);\n\t\t}\n\n\t\treturn o;\n\t}\n\n\t/**\n\t * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the\n\t * disposable even when the disposable is not part in the store.\n\t */\n\tpublic delete(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot dispose a disposable on itself!');\n\t\t}\n\t\tthis._toDispose.delete(o);\n\t\to.dispose();\n\t}\n\n\t/**\n\t * Deletes the value from the store, but does not dispose it.\n\t */\n\tpublic deleteAndLeak(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif (this._toDispose.has(o)) {\n\t\t\tthis._toDispose.delete(o);\n\t\t\tsetParentOfDisposable(o, null);\n\t\t}\n\t}\n}\n\n/**\n * Abstract base class for a {@link IDisposable disposable} object.\n *\n * Subclasses can {@linkcode _register} disposables that will be automatically cleaned up when this object is disposed of.\n */\nexport abstract class Disposable implements IDisposable {\n\n\t/**\n\t * A disposable that does nothing when it is disposed of.\n\t *\n\t * TODO: This should not be a static property.\n\t */\n\tstatic readonly None = Object.freeze({ dispose() { } });\n\n\tprotected readonly _store = new DisposableStore();\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t\tsetParentOfDisposable(this._store, this);\n\t}\n\n\tpublic dispose(): void {\n\t\tmarkAsDisposed(this);\n\n\t\tthis._store.dispose();\n\t}\n\n\t/**\n\t * Adds `o` to the collection of disposables managed by this object.\n\t */\n\tprotected _register(o: T): T {\n\t\tif ((o as unknown as Disposable) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\t\treturn this._store.add(o);\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed.\n *\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\n */\nexport class MutableDisposable implements IDisposable {\n\tprivate _value?: T;\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tget value(): T | undefined {\n\t\treturn this._isDisposed ? undefined : this._value;\n\t}\n\n\tset value(value: T | undefined) {\n\t\tif (this._isDisposed || value === this._value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._value?.dispose();\n\t\tif (value) {\n\t\t\tsetParentOfDisposable(value, this);\n\t\t}\n\t\tthis._value = value;\n\t}\n\n\t/**\n\t * Resets the stored value and disposed of the previously stored value.\n\t */\n\tclear(): void {\n\t\tthis.value = undefined;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tmarkAsDisposed(this);\n\t\tthis._value?.dispose();\n\t\tthis._value = undefined;\n\t}\n\n\t/**\n\t * Clears the value, but does not dispose it.\n\t * The old value is returned.\n\t*/\n\tclearAndLeak(): T | undefined {\n\t\tconst oldValue = this._value;\n\t\tthis._value = undefined;\n\t\tif (oldValue) {\n\t\t\tsetParentOfDisposable(oldValue, null);\n\t\t}\n\t\treturn oldValue;\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed like {@link MutableDisposable}, but the value must\n * exist and cannot be undefined.\n */\nexport class MandatoryMutableDisposable implements IDisposable {\n\tprivate readonly _disposable = new MutableDisposable();\n\tprivate _isDisposed = false;\n\n\tconstructor(initialValue: T) {\n\t\tthis._disposable.value = initialValue;\n\t}\n\n\tget value(): T {\n\t\treturn this._disposable.value!;\n\t}\n\n\tset value(value: T) {\n\t\tif (this._isDisposed || value === this._disposable.value) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposable.value = value;\n\t}\n\n\tdispose() {\n\t\tthis._isDisposed = true;\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class RefCountedDisposable {\n\n\tprivate _counter: number = 1;\n\n\tconstructor(\n\t\tprivate readonly _disposable: IDisposable,\n\t) { }\n\n\tacquire() {\n\t\tthis._counter++;\n\t\treturn this;\n\t}\n\n\trelease() {\n\t\tif (--this._counter === 0) {\n\t\t\tthis._disposable.dispose();\n\t\t}\n\t\treturn this;\n\t}\n}\n\n/**\n * A safe disposable can be `unset` so that a leaked reference (listener)\n * can be cut-off.\n */\nexport class SafeDisposable implements IDisposable {\n\n\tdispose: () => void = () => { };\n\tunset: () => void = () => { };\n\tisset: () => boolean = () => false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tset(fn: Function) {\n\t\tlet callback: Function | undefined = fn;\n\t\tthis.unset = () => callback = undefined;\n\t\tthis.isset = () => callback !== undefined;\n\t\tthis.dispose = () => {\n\t\t\tif (callback) {\n\t\t\t\tcallback();\n\t\t\t\tcallback = undefined;\n\t\t\t\tmarkAsDisposed(this);\n\t\t\t}\n\t\t};\n\t\treturn this;\n\t}\n}\n\nexport interface IReference extends IDisposable {\n\treadonly object: T;\n}\n\nexport abstract class ReferenceCollection {\n\n\tprivate readonly references: Map = new Map();\n\n\tacquire(key: string, ...args: any[]): IReference {\n\t\tlet reference = this.references.get(key);\n\n\t\tif (!reference) {\n\t\t\treference = { counter: 0, object: this.createReferencedObject(key, ...args) };\n\t\t\tthis.references.set(key, reference);\n\t\t}\n\n\t\tconst { object } = reference;\n\t\tconst dispose = createSingleCallFunction(() => {\n\t\t\tif (--reference.counter === 0) {\n\t\t\t\tthis.destroyReferencedObject(key, reference.object);\n\t\t\t\tthis.references.delete(key);\n\t\t\t}\n\t\t});\n\n\t\treference.counter++;\n\n\t\treturn { object, dispose };\n\t}\n\n\tprotected abstract createReferencedObject(key: string, ...args: any[]): T;\n\tprotected abstract destroyReferencedObject(key: string, object: T): void;\n}\n\n/**\n * Unwraps a reference collection of promised values. Makes sure\n * references are disposed whenever promises get rejected.\n */\nexport class AsyncReferenceCollection {\n\n\tconstructor(private referenceCollection: ReferenceCollection>) { }\n\n\tasync acquire(key: string, ...args: any[]): Promise> {\n\t\tconst ref = this.referenceCollection.acquire(key, ...args);\n\n\t\ttry {\n\t\t\tconst object = await ref.object;\n\n\t\t\treturn {\n\t\t\t\tobject,\n\t\t\t\tdispose: () => ref.dispose()\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tref.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport class ImmortalReference implements IReference {\n\tconstructor(public object: T) { }\n\tdispose(): void { /* noop */ }\n}\n\nexport function disposeOnReturn(fn: (store: DisposableStore) => void): void {\n\tconst store = new DisposableStore();\n\ttry {\n\t\tfn(store);\n\t} finally {\n\t\tstore.dispose();\n\t}\n}\n\n/**\n * A map the manages the lifecycle of the values that it stores.\n */\nexport class DisposableMap implements IDisposable {\n\n\tprivate readonly _store = new Map();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Disposes of all stored values and mark this object as disposed.\n\t *\n\t * Trying to use this object after it has been disposed of is an error.\n\t */\n\tdispose(): void {\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clearAndDisposeAll();\n\t}\n\n\t/**\n\t * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.\n\t */\n\tclearAndDisposeAll(): void {\n\t\tif (!this._store.size) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._store.values());\n\t\t} finally {\n\t\t\tthis._store.clear();\n\t\t}\n\t}\n\n\thas(key: K): boolean {\n\t\treturn this._store.has(key);\n\t}\n\n\tget size(): number {\n\t\treturn this._store.size;\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._store.get(key);\n\t}\n\n\tset(key: K, value: V, skipDisposeOnOverwrite = false): void {\n\t\tif (this._isDisposed) {\n\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!').stack);\n\t\t}\n\n\t\tif (!skipDisposeOnOverwrite) {\n\t\t\tthis._store.get(key)?.dispose();\n\t\t}\n\n\t\tthis._store.set(key, value);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map and also dispose of it.\n\t */\n\tdeleteAndDispose(key: K): void {\n\t\tthis._store.get(key)?.dispose();\n\t\tthis._store.delete(key);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map but return it. The caller is\n\t * responsible for disposing of the value.\n\t */\n\tdeleteAndLeak(key: K): V | undefined {\n\t\tconst value = this._store.get(key);\n\t\tthis._store.delete(key);\n\t\treturn value;\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this._store.keys();\n\t}\n\n\tvalues(): IterableIterator {\n\t\treturn this._store.values();\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this._store[Symbol.iterator]();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport type CodeWindow = Window & typeof globalThis & {\n\treadonly vscodeWindowId: number;\n};\n\nexport function ensureCodeWindow(targetWindow: Window, fallbackWindowId: number): asserts targetWindow is CodeWindow {\n}\n\n// eslint-disable-next-line no-restricted-globals\nexport const mainWindow = (typeof window === 'object' ? window : globalThis) as CodeWindow;\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nclass Node {\n\n\tstatic readonly Undefined = new Node(undefined);\n\n\telement: E;\n\tnext: Node;\n\tprev: Node;\n\n\tconstructor(element: E) {\n\t\tthis.element = element;\n\t\tthis.next = Node.Undefined;\n\t\tthis.prev = Node.Undefined;\n\t}\n}\n\nexport class LinkedList {\n\n\tprivate _first: Node = Node.Undefined;\n\tprivate _last: Node = Node.Undefined;\n\tprivate _size: number = 0;\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this._first === Node.Undefined;\n\t}\n\n\tclear(): void {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tconst next = node.next;\n\t\t\tnode.prev = Node.Undefined;\n\t\t\tnode.next = Node.Undefined;\n\t\t\tnode = next;\n\t\t}\n\n\t\tthis._first = Node.Undefined;\n\t\tthis._last = Node.Undefined;\n\t\tthis._size = 0;\n\t}\n\n\tunshift(element: E): () => void {\n\t\treturn this._insert(element, false);\n\t}\n\n\tpush(element: E): () => void {\n\t\treturn this._insert(element, true);\n\t}\n\n\tprivate _insert(element: E, atTheEnd: boolean): () => void {\n\t\tconst newNode = new Node(element);\n\t\tif (this._first === Node.Undefined) {\n\t\t\tthis._first = newNode;\n\t\t\tthis._last = newNode;\n\n\t\t} else if (atTheEnd) {\n\t\t\t// push\n\t\t\tconst oldLast = this._last;\n\t\t\tthis._last = newNode;\n\t\t\tnewNode.prev = oldLast;\n\t\t\toldLast.next = newNode;\n\n\t\t} else {\n\t\t\t// unshift\n\t\t\tconst oldFirst = this._first;\n\t\t\tthis._first = newNode;\n\t\t\tnewNode.next = oldFirst;\n\t\t\toldFirst.prev = newNode;\n\t\t}\n\t\tthis._size += 1;\n\n\t\tlet didRemove = false;\n\t\treturn () => {\n\t\t\tif (!didRemove) {\n\t\t\t\tdidRemove = true;\n\t\t\t\tthis._remove(newNode);\n\t\t\t}\n\t\t};\n\t}\n\n\tshift(): E | undefined {\n\t\tif (this._first === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._first.element;\n\t\t\tthis._remove(this._first);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tpop(): E | undefined {\n\t\tif (this._last === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._last.element;\n\t\t\tthis._remove(this._last);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tprivate _remove(node: Node): void {\n\t\tif (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n\t\t\t// middle\n\t\t\tconst anchor = node.prev;\n\t\t\tanchor.next = node.next;\n\t\t\tnode.next.prev = anchor;\n\n\t\t} else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n\t\t\t// only node\n\t\t\tthis._first = Node.Undefined;\n\t\t\tthis._last = Node.Undefined;\n\n\t\t} else if (node.next === Node.Undefined) {\n\t\t\t// last\n\t\t\tthis._last = this._last.prev!;\n\t\t\tthis._last.next = Node.Undefined;\n\n\t\t} else if (node.prev === Node.Undefined) {\n\t\t\t// first\n\t\t\tthis._first = this._first.next!;\n\t\t\tthis._first.prev = Node.Undefined;\n\t\t}\n\n\t\t// done\n\t\tthis._size -= 1;\n\t}\n\n\t*[Symbol.iterator](): Iterator {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tyield node.element;\n\t\t\tnode = node.next;\n\t\t}\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// fake definition so that the valid layers check won't trip on this\ndeclare const globalThis: { performance?: { now(): number } };\n\nconst hasPerformanceNow = (globalThis.performance && typeof globalThis.performance.now === 'function');\n\nexport class StopWatch {\n\n\tprivate _startTime: number;\n\tprivate _stopTime: number;\n\n\tprivate readonly _now: () => number;\n\n\tpublic static create(highResolution?: boolean): StopWatch {\n\t\treturn new StopWatch(highResolution);\n\t}\n\n\tconstructor(highResolution?: boolean) {\n\t\tthis._now = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance!.now.bind(globalThis.performance);\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic stop(): void {\n\t\tthis._stopTime = this._now();\n\t}\n\n\tpublic reset(): void {\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic elapsed(): number {\n\t\tif (this._stopTime !== -1) {\n\t\t\treturn this._stopTime - this._startTime;\n\t\t}\n\t\treturn this._now() - this._startTime;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from 'vs/base/common/cancellation';\nimport { onUnexpectedError } from 'vs/base/common/errors';\nimport { createSingleCallFunction } from 'vs/base/common/functional';\nimport { combinedDisposable, Disposable, DisposableMap, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { LinkedList } from 'vs/base/common/linkedList';\nimport { IObservable, IObserver } from 'vs/base/common/observable';\nimport { StopWatch } from 'vs/base/common/stopwatch';\nimport { MicrotaskDelay } from 'vs/base/common/symbols';\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a listener is GC'ed without having been disposed. This is a LEAK.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableListenerGCedWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableDisposeWithListenerWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup.\n// See https://github.com/microsoft/vscode/issues/142851\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableSnapshotPotentialLeakWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n/**\n * An event with zero or one parameters that can be subscribed to. The event is a function itself.\n */\nexport interface Event {\n\t(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;\n}\n\nexport namespace Event {\n\texport const None: Event = () => Disposable.None;\n\n\tfunction _addLeakageTraceLogic(options: EmitterOptions) {\n\t\tif (_enableSnapshotPotentialLeakWarning) {\n\t\t\tconst { onDidAddListener: origListenerDidAdd } = options;\n\t\t\tconst stack = Stacktrace.create();\n\t\t\tlet count = 0;\n\t\t\toptions.onDidAddListener = () => {\n\t\t\t\tif (++count === 2) {\n\t\t\t\t\tconsole.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here');\n\t\t\t\t\tstack.print();\n\t\t\t\t}\n\t\t\t\torigListenerDidAdd?.();\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared\n\t * `setTimeout`. The event is converted into a signal (`Event`) to avoid additional object creation as a\n\t * result of merging events and to try prevent race conditions that could arise when using related deferred and\n\t * non-deferred events.\n\t *\n\t * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work\n\t * (eg. latency of keypress to text rendered).\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function defer(event: Event, disposable?: DisposableStore): Event {\n\t\treturn debounce(event, () => void 0, 0, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Given an event, returns another event which only fires once.\n\t *\n\t * @param event The event source for the new event.\n\t */\n\texport function once(event: Event): Event {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\t// we need this, in case the event fires during the listener call\n\t\t\tlet didFire = false;\n\t\t\tlet result: IDisposable | undefined = undefined;\n\t\t\tresult = event(e => {\n\t\t\t\tif (didFire) {\n\t\t\t\t\treturn;\n\t\t\t\t} else if (result) {\n\t\t\t\t\tresult.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tdidFire = true;\n\t\t\t\t}\n\n\t\t\t\treturn listener.call(thisArgs, e);\n\t\t\t}, null, disposables);\n\n\t\t\tif (didFire) {\n\t\t\t\tresult.dispose();\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Maps an event of one type into an event of another type using a mapping function, similar to how\n\t * `Array.prototype.map` works.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param map The mapping function.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function map(event: Event, map: (i: I) => O, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that performs some function on the event object before firing.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param each The function to perform on the event object.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function forEach(event: Event, each: (i: I) => void, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that fires only when some condition is met.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param filter The filter function that defines the condition. The event will fire for the object if this function\n\t * returns true.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function filter(event: Event, filter: (e: T | U) => e is T, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T) => boolean, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T | R) => e is R, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T) => boolean, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Given an event, returns the same event but typed as `Event`.\n\t */\n\texport function signal(event: Event): Event {\n\t\treturn event as Event as Event;\n\t}\n\n\t/**\n\t * Given a collection of events, returns a single event which emits whenever any of the provided events emit.\n\t */\n\texport function any(...events: Event[]): Event;\n\texport function any(...events: Event[]): Event;\n\texport function any(...events: Event[]): Event {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\tconst disposable = combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e))));\n\t\t\treturn addAndReturnDisposable(disposable, disposables);\n\t\t};\n\t}\n\n\t/**\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function reduce(event: Event, merge: (last: O | undefined, event: I) => O, initial?: O, disposable?: DisposableStore): Event {\n\t\tlet output: O | undefined = initial;\n\n\t\treturn map(event, e => {\n\t\t\toutput = merge(output, e);\n\t\t\treturn output;\n\t\t}, disposable);\n\t}\n\n\tfunction snapshot(event: Event, disposable: DisposableStore | undefined): Event {\n\t\tlet listener: IDisposable | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tlistener = event(emitter.fire, emitter);\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tlistener?.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Adds the IDisposable to the store if it's set, and returns it. Useful to\n\t * Event function implementation.\n\t */\n\tfunction addAndReturnDisposable(d: T, store: DisposableStore | IDisposable[] | undefined): T {\n\t\tif (store instanceof Array) {\n\t\t\tstore.push(d);\n\t\t} else if (store) {\n\t\t\tstore.add(d);\n\t\t}\n\t\treturn d;\n\t}\n\n\t/**\n\t * Given an event, creates a new emitter that event that will debounce events based on {@link delay} and give an\n\t * array event object of all events that fired.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The original event to debounce.\n\t * @param merge A function that reduces all events into a single event.\n\t * @param delay The number of milliseconds to debounce.\n\t * @param leading Whether to fire a leading event without debouncing.\n\t * @param flushOnListenerRemove Whether to fire all debounced events when a listener is removed. If this is not\n\t * specified, some events could go missing. Use this if it's important that all events are processed, even if the\n\t * listener gets disposed before the debounced event fires.\n\t * @param leakWarningThreshold See {@link EmitterOptions.leakWarningThreshold}.\n\t * @param disposable A disposable store to register the debounce emitter to.\n\t */\n\texport function debounce(event: Event, merge: (last: T | undefined, event: T) => T, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event;\n\texport function debounce(event: Event, merge: (last: O | undefined, event: I) => O, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event;\n\texport function debounce(event: Event, merge: (last: O | undefined, event: I) => O, delay: number | typeof MicrotaskDelay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold?: number, disposable?: DisposableStore): Event {\n\t\tlet subscription: IDisposable;\n\t\tlet output: O | undefined = undefined;\n\t\tlet handle: any = undefined;\n\t\tlet numDebouncedCalls = 0;\n\t\tlet doFire: (() => void) | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tleakWarningThreshold,\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tsubscription = event(cur => {\n\t\t\t\t\tnumDebouncedCalls++;\n\t\t\t\t\toutput = merge(output, cur);\n\n\t\t\t\t\tif (leading && !handle) {\n\t\t\t\t\t\temitter.fire(output);\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tdoFire = () => {\n\t\t\t\t\t\tconst _output = output;\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t\thandle = undefined;\n\t\t\t\t\t\tif (!leading || numDebouncedCalls > 1) {\n\t\t\t\t\t\t\temitter.fire(_output!);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnumDebouncedCalls = 0;\n\t\t\t\t\t};\n\n\t\t\t\t\tif (typeof delay === 'number') {\n\t\t\t\t\t\tclearTimeout(handle);\n\t\t\t\t\t\thandle = setTimeout(doFire, delay);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (handle === undefined) {\n\t\t\t\t\t\t\thandle = 0;\n\t\t\t\t\t\t\tqueueMicrotask(doFire);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tonWillRemoveListener() {\n\t\t\t\tif (flushOnListenerRemove && numDebouncedCalls > 0) {\n\t\t\t\t\tdoFire?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tdoFire = undefined;\n\t\t\t\tsubscription.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Debounces an event, firing after some delay (default=0) with an array of all event original objects.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function accumulate(event: Event, delay: number = 0, disposable?: DisposableStore): Event {\n\t\treturn Event.debounce(event, (last, e) => {\n\t\t\tif (!last) {\n\t\t\t\treturn [e];\n\t\t\t}\n\t\t\tlast.push(e);\n\t\t\treturn last;\n\t\t}, delay, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate\n\t * event objects from different sources do not fire the same event object.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param equals The equality condition.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t *\n\t * @example\n\t * ```\n\t * // Fire only one time when a single window is opened or focused\n\t * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))\n\t * ```\n\t */\n\texport function latch(event: Event, equals: (a: T, b: T) => boolean = (a, b) => a === b, disposable?: DisposableStore): Event {\n\t\tlet firstCall = true;\n\t\tlet cache: T;\n\n\t\treturn filter(event, value => {\n\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\tfirstCall = false;\n\t\t\tcache = value;\n\t\t\treturn shouldEmit;\n\t\t}, disposable);\n\t}\n\n\t/**\n\t * Splits an event whose parameter is a union type into 2 separate events for each type in the union.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @example\n\t * ```\n\t * const event = new EventEmitter().event;\n\t * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);\n\t * ```\n\t *\n\t * @param event The event source for the new event.\n\t * @param isT A function that determines what event is of the first type.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function split(event: Event, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event, Event] {\n\t\treturn [\n\t\t\tEvent.filter(event, isT, disposable),\n\t\t\tEvent.filter(event, e => !isT(e), disposable) as Event,\n\t\t];\n\t}\n\n\t/**\n\t * Buffers an event until it has a listener attached.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a\n\t * `setTimeout` when the first event listener is added.\n\t * @param _buffer Internal: A source event array used for tests.\n\t *\n\t * @example\n\t * ```\n\t * // Start accumulating events, when the first listener is attached, flush\n\t * // the event after a timeout such that multiple listeners attached before\n\t * // the timeout would receive the event\n\t * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n\t * ```\n\t */\n\texport function buffer(event: Event, flushAfterTimeout = false, _buffer: T[] = [], disposable?: DisposableStore): Event {\n\t\tlet buffer: T[] | null = _buffer.slice();\n\n\t\tlet listener: IDisposable | null = event(e => {\n\t\t\tif (buffer) {\n\t\t\t\tbuffer.push(e);\n\t\t\t} else {\n\t\t\t\temitter.fire(e);\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(listener);\n\t\t}\n\n\t\tconst flush = () => {\n\t\t\tbuffer?.forEach(e => emitter.fire(e));\n\t\t\tbuffer = null;\n\t\t};\n\n\t\tconst emitter = new Emitter({\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tif (!listener) {\n\t\t\t\t\tlistener = event(e => emitter.fire(e));\n\t\t\t\t\tif (disposable) {\n\t\t\t\t\t\tdisposable.add(listener);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidAddFirstListener() {\n\t\t\t\tif (buffer) {\n\t\t\t\t\tif (flushAfterTimeout) {\n\t\t\t\t\t\tsetTimeout(flush);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tflush();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tif (listener) {\n\t\t\t\t\tlistener.dispose();\n\t\t\t\t}\n\t\t\t\tlistener = null;\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(emitter);\n\t\t}\n\n\t\treturn emitter.event;\n\t}\n\t/**\n\t * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.\n\t *\n\t * @example\n\t * ```\n\t * // Normal\n\t * const onEnterPressNormal = Event.filter(\n\t * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),\n\t * e.keyCode === KeyCode.Enter\n\t * ).event;\n\t *\n\t * // Using chain\n\t * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $\n\t * .map(e => new StandardKeyboardEvent(e))\n\t * .filter(e => e.keyCode === KeyCode.Enter)\n\t * );\n\t * ```\n\t */\n\texport function chain(event: Event, sythensize: ($: IChainableSythensis) => IChainableSythensis): Event {\n\t\tconst fn: Event = (listener, thisArgs, disposables) => {\n\t\t\tconst cs = sythensize(new ChainableSynthesis()) as ChainableSynthesis;\n\t\t\treturn event(function (value) {\n\t\t\t\tconst result = cs.evaluate(value);\n\t\t\t\tif (result !== HaltChainable) {\n\t\t\t\t\tlistener.call(thisArgs, result);\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\n\t\treturn fn;\n\t}\n\n\tconst HaltChainable = Symbol('HaltChainable');\n\n\tclass ChainableSynthesis implements IChainableSythensis {\n\t\tprivate readonly steps: ((input: any) => any)[] = [];\n\n\t\tmap(fn: (i: any) => O): this {\n\t\t\tthis.steps.push(fn);\n\t\t\treturn this;\n\t\t}\n\n\t\tforEach(fn: (i: any) => void): this {\n\t\t\tthis.steps.push(v => {\n\t\t\t\tfn(v);\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tfilter(fn: (e: any) => boolean): this {\n\t\t\tthis.steps.push(v => fn(v) ? v : HaltChainable);\n\t\t\treturn this;\n\t\t}\n\n\t\treduce(merge: (last: R | undefined, event: any) => R, initial?: R | undefined): this {\n\t\t\tlet last = initial;\n\t\t\tthis.steps.push(v => {\n\t\t\t\tlast = merge(last, v);\n\t\t\t\treturn last;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tlatch(equals: (a: any, b: any) => boolean = (a, b) => a === b): ChainableSynthesis {\n\t\t\tlet firstCall = true;\n\t\t\tlet cache: any;\n\t\t\tthis.steps.push(value => {\n\t\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\t\tfirstCall = false;\n\t\t\t\tcache = value;\n\t\t\t\treturn shouldEmit ? value : HaltChainable;\n\t\t\t});\n\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic evaluate(value: any) {\n\t\t\tfor (const step of this.steps) {\n\t\t\t\tvalue = step(value);\n\t\t\t\tif (value === HaltChainable) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn value;\n\t\t}\n\t}\n\n\texport interface IChainableSythensis {\n\t\tmap(fn: (i: T) => O): IChainableSythensis;\n\t\tforEach(fn: (i: T) => void): IChainableSythensis;\n\t\tfilter(fn: (e: T) => e is R): IChainableSythensis;\n\t\tfilter(fn: (e: T) => boolean): IChainableSythensis;\n\t\treduce(merge: (last: R, event: T) => R, initial: R): IChainableSythensis;\n\t\treduce(merge: (last: R | undefined, event: T) => R): IChainableSythensis;\n\t\tlatch(equals?: (a: T, b: T) => boolean): IChainableSythensis;\n\t}\n\n\texport interface NodeEventEmitter {\n\t\ton(event: string | symbol, listener: Function): unknown;\n\t\tremoveListener(event: string | symbol, listener: Function): unknown;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a node event emitter.\n\t */\n\texport function fromNodeEventEmitter(emitter: NodeEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.on(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n\t\tconst result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\texport interface DOMEventEmitter {\n\t\taddEventListener(event: string | symbol, listener: Function): void;\n\t\tremoveEventListener(event: string | symbol, listener: Function): void;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a DOM event emitter.\n\t */\n\texport function fromDOMEventEmitter(emitter: DOMEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\n\t\tconst result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * Creates a promise out of an event, using the {@link Event.once} helper.\n\t */\n\texport function toPromise(event: Event): Promise {\n\t\treturn new Promise(resolve => once(event)(resolve));\n\t}\n\n\t/**\n\t * Creates an event out of a promise that fires once when the promise is\n\t * resolved with the result of the promise or `undefined`.\n\t */\n\texport function fromPromise(promise: Promise): Event {\n\t\tconst result = new Emitter();\n\n\t\tpromise.then(res => {\n\t\t\tresult.fire(res);\n\t\t}, () => {\n\t\t\tresult.fire(undefined);\n\t\t}).finally(() => {\n\t\t\tresult.dispose();\n\t\t});\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * A convenience function for forwarding an event to another emitter which\n\t * improves readability.allows Event.forward(event, emitter) instead of `event(e => emitter.fire(e))`.\n\t * @param from The event to forward.\n\t * @param to The emitter to forward the event to.\n\t * @example\n\t * Event.forward(event, emitter);\n\t * // equivalent to\n\t * event(e => emitter.fire(e));\n\t * // equivalent to\n\t * event(emitter.fire, emitter);\n\t */\n\texport function forward(from: Event, to: Emitter): IDisposable {\n\t\treturn from(e => to.fire(e));\n\t}\n\n\t/**\n\t * Adds a listener to an event and calls the listener immediately with undefined as the event object.\n\t *\n\t * @example\n\t * ```\n\t * // Initialize the UI and update it when dataChangeEvent fires\n\t * runAndSubscribe(dataChangeEvent, () => this._updateUI());\n\t * ```\n\t */\n\texport function runAndSubscribe(event: Event, handler: (e: T) => any, initial: T): IDisposable;\n\texport function runAndSubscribe(event: Event, handler: (e: T | undefined) => any): IDisposable;\n\texport function runAndSubscribe(event: Event, handler: (e: T | undefined) => any, initial?: T): IDisposable {\n\t\thandler(initial);\n\t\treturn event(e => handler(e));\n\t}\n\n\tclass EmitterObserver implements IObserver {\n\n\t\treadonly emitter: Emitter;\n\n\t\tprivate _counter = 0;\n\t\tprivate _hasChanged = false;\n\n\t\tconstructor(readonly _observable: IObservable, store: DisposableStore | undefined) {\n\t\t\tconst options: EmitterOptions = {\n\t\t\t\tonWillAddFirstListener: () => {\n\t\t\t\t\t_observable.addObserver(this);\n\t\t\t\t},\n\t\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\t\t_observable.removeObserver(this);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (!store) {\n\t\t\t\t_addLeakageTraceLogic(options);\n\t\t\t}\n\t\t\tthis.emitter = new Emitter(options);\n\t\t\tif (store) {\n\t\t\t\tstore.add(this.emitter);\n\t\t\t}\n\t\t}\n\n\t\tbeginUpdate(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter++;\n\t\t}\n\n\t\thandlePossibleChange(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t}\n\n\t\thandleChange(_observable: IObservable, _change: TChange): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._hasChanged = true;\n\t\t}\n\n\t\tendUpdate(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter--;\n\t\t\tif (this._counter === 0) {\n\t\t\t\tthis._observable.reportChanges();\n\t\t\t\tif (this._hasChanged) {\n\t\t\t\t\tthis._hasChanged = false;\n\t\t\t\t\tthis.emitter.fire(this._observable.get());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Creates an event emitter that is fired when the observable changes.\n\t * Each listeners subscribes to the emitter.\n\t */\n\texport function fromObservable(obs: IObservable, store?: DisposableStore): Event {\n\t\tconst observer = new EmitterObserver(obs, store);\n\t\treturn observer.emitter.event;\n\t}\n\n\t/**\n\t * Each listener is attached to the observable directly.\n\t */\n\texport function fromObservableLight(observable: IObservable): Event {\n\t\treturn (listener, thisArgs, disposables) => {\n\t\t\tlet count = 0;\n\t\t\tlet didChange = false;\n\t\t\tconst observer: IObserver = {\n\t\t\t\tbeginUpdate() {\n\t\t\t\t\tcount++;\n\t\t\t\t},\n\t\t\t\tendUpdate() {\n\t\t\t\t\tcount--;\n\t\t\t\t\tif (count === 0) {\n\t\t\t\t\t\tobservable.reportChanges();\n\t\t\t\t\t\tif (didChange) {\n\t\t\t\t\t\t\tdidChange = false;\n\t\t\t\t\t\t\tlistener.call(thisArgs);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thandlePossibleChange() {\n\t\t\t\t\t// noop\n\t\t\t\t},\n\t\t\t\thandleChange() {\n\t\t\t\t\tdidChange = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tobservable.addObserver(observer);\n\t\t\tobservable.reportChanges();\n\t\t\tconst disposable = {\n\t\t\t\tdispose() {\n\t\t\t\t\tobservable.removeObserver(observer);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(disposable);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(disposable);\n\t\t\t}\n\n\t\t\treturn disposable;\n\t\t};\n\t}\n}\n\nexport interface EmitterOptions {\n\t/**\n\t * Optional function that's called *before* the very first listener is added\n\t */\n\tonWillAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called *after* the very first listener is added\n\t */\n\tonDidAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called after a listener is added\n\t */\n\tonDidAddListener?: Function;\n\t/**\n\t * Optional function that's called *after* remove the very last listener\n\t */\n\tonDidRemoveLastListener?: Function;\n\t/**\n\t * Optional function that's called *before* a listener is removed\n\t */\n\tonWillRemoveListener?: Function;\n\t/**\n\t * Optional function that's called when a listener throws an error. Defaults to\n\t * {@link onUnexpectedError}\n\t */\n\tonListenerError?: (e: any) => void;\n\t/**\n\t * Number of listeners that are allowed before assuming a leak. Default to\n\t * a globally configured value\n\t *\n\t * @see setGlobalLeakWarningThreshold\n\t */\n\tleakWarningThreshold?: number;\n\t/**\n\t * Pass in a delivery queue, which is useful for ensuring\n\t * in order event delivery across multiple emitters.\n\t */\n\tdeliveryQueue?: EventDeliveryQueue;\n\n\t/** ONLY enable this during development */\n\t_profName?: string;\n}\n\n\nexport class EventProfiling {\n\n\tstatic readonly all = new Set();\n\n\tprivate static _idPool = 0;\n\n\treadonly name: string;\n\tpublic listenerCount: number = 0;\n\tpublic invocationCount = 0;\n\tpublic elapsedOverall = 0;\n\tpublic durations: number[] = [];\n\n\tprivate _stopWatch?: StopWatch;\n\n\tconstructor(name: string) {\n\t\tthis.name = `${name}_${EventProfiling._idPool++}`;\n\t\tEventProfiling.all.add(this);\n\t}\n\n\tstart(listenerCount: number): void {\n\t\tthis._stopWatch = new StopWatch();\n\t\tthis.listenerCount = listenerCount;\n\t}\n\n\tstop(): void {\n\t\tif (this._stopWatch) {\n\t\t\tconst elapsed = this._stopWatch.elapsed();\n\t\t\tthis.durations.push(elapsed);\n\t\t\tthis.elapsedOverall += elapsed;\n\t\t\tthis.invocationCount += 1;\n\t\t\tthis._stopWatch = undefined;\n\t\t}\n\t}\n}\n\nlet _globalLeakWarningThreshold = -1;\nexport function setGlobalLeakWarningThreshold(n: number): IDisposable {\n\tconst oldValue = _globalLeakWarningThreshold;\n\t_globalLeakWarningThreshold = n;\n\treturn {\n\t\tdispose() {\n\t\t\t_globalLeakWarningThreshold = oldValue;\n\t\t}\n\t};\n}\n\nclass LeakageMonitor {\n\n\tprivate static _idPool = 1;\n\n\tprivate _stacks: Map | undefined;\n\tprivate _warnCountdown: number = 0;\n\n\tconstructor(\n\t\tprivate readonly _errorHandler: (err: Error) => void,\n\t\treadonly threshold: number,\n\t\treadonly name: string = (LeakageMonitor._idPool++).toString(16).padStart(3, '0')\n\t) { }\n\n\tdispose(): void {\n\t\tthis._stacks?.clear();\n\t}\n\n\tcheck(stack: Stacktrace, listenerCount: number): undefined | (() => void) {\n\n\t\tconst threshold = this.threshold;\n\t\tif (threshold <= 0 || listenerCount < threshold) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (!this._stacks) {\n\t\t\tthis._stacks = new Map();\n\t\t}\n\t\tconst count = (this._stacks.get(stack.value) || 0);\n\t\tthis._stacks.set(stack.value, count + 1);\n\t\tthis._warnCountdown -= 1;\n\n\t\tif (this._warnCountdown <= 0) {\n\t\t\t// only warn on first exceed and then every time the limit\n\t\t\t// is exceeded by 50% again\n\t\t\tthis._warnCountdown = threshold * 0.5;\n\n\t\t\tconst [topStack, topCount] = this.getMostFrequentStack()!;\n\t\t\tconst message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;\n\t\t\tconsole.warn(message);\n\t\t\tconsole.warn(topStack!);\n\n\t\t\tconst error = new ListenerLeakError(message, topStack);\n\t\t\tthis._errorHandler(error);\n\t\t}\n\n\t\treturn () => {\n\t\t\tconst count = (this._stacks!.get(stack.value) || 0);\n\t\t\tthis._stacks!.set(stack.value, count - 1);\n\t\t};\n\t}\n\n\tgetMostFrequentStack(): [string, number] | undefined {\n\t\tif (!this._stacks) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet topStack: [string, number] | undefined;\n\t\tlet topCount: number = 0;\n\t\tfor (const [stack, count] of this._stacks) {\n\t\t\tif (!topStack || topCount < count) {\n\t\t\t\ttopStack = [stack, count];\n\t\t\t\ttopCount = count;\n\t\t\t}\n\t\t}\n\t\treturn topStack;\n\t}\n}\n\nclass Stacktrace {\n\n\tstatic create() {\n\t\tconst err = new Error();\n\t\treturn new Stacktrace(err.stack ?? '');\n\t}\n\n\tprivate constructor(readonly value: string) { }\n\n\tprint() {\n\t\tconsole.warn(this.value.split('\\n').slice(2).join('\\n'));\n\t}\n}\n\n// error that is logged when going over the configured listener threshold\nexport class ListenerLeakError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerLeakError';\n\t\tthis.stack = stack;\n\t}\n}\n\n// SEVERE error that is logged when having gone way over the configured listener\n// threshold so that the emitter refuses to accept more listeners\nexport class ListenerRefusalError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerRefusalError';\n\t\tthis.stack = stack;\n\t}\n}\n\nlet id = 0;\nclass UniqueContainer {\n\tstack?: Stacktrace;\n\tpublic id = id++;\n\tconstructor(public readonly value: T) { }\n}\nconst compactionThreshold = 2;\n\ntype ListenerContainer = UniqueContainer<(data: T) => void>;\ntype ListenerOrListeners = (ListenerContainer | undefined)[] | ListenerContainer;\n\nconst forEachListener = (listeners: ListenerOrListeners, fn: (c: ListenerContainer) => void) => {\n\tif (listeners instanceof UniqueContainer) {\n\t\tfn(listeners);\n\t} else {\n\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\tconst l = listeners[i];\n\t\t\tif (l) {\n\t\t\t\tfn(l);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\nlet _listenerFinalizers: FinalizationRegistry | undefined;\n\nif (_enableListenerGCedWarning) {\n\tconst leaks: string[] = [];\n\n\tsetInterval(() => {\n\t\tif (leaks.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconsole.warn('[LEAKING LISTENERS] GC\\'ed these listeners that were NOT yet disposed:');\n\t\tconsole.warn(leaks.join('\\n'));\n\t\tleaks.length = 0;\n\t}, 3000);\n\n\t_listenerFinalizers = new FinalizationRegistry(heldValue => {\n\t\tif (typeof heldValue === 'string') {\n\t\t\tleaks.push(heldValue);\n\t\t}\n\t});\n}\n\n/**\n * The Emitter can be used to expose an Event to the public\n * to fire it from the insides.\n * Sample:\n\tclass Document {\n\n\t\tprivate readonly _onDidChange = new Emitter<(value:string)=>any>();\n\n\t\tpublic onDidChange = this._onDidChange.event;\n\n\t\t// getter-style\n\t\t// get onDidChange(): Event<(value:string)=>any> {\n\t\t// \treturn this._onDidChange.event;\n\t\t// }\n\n\t\tprivate _doIt() {\n\t\t\t//...\n\t\t\tthis._onDidChange.fire(value);\n\t\t}\n\t}\n */\nexport class Emitter {\n\n\tprivate readonly _options?: EmitterOptions;\n\tprivate readonly _leakageMon?: LeakageMonitor;\n\tprivate readonly _perfMon?: EventProfiling;\n\tprivate _disposed?: true;\n\tprivate _event?: Event;\n\n\t/**\n\t * A listener, or list of listeners. A single listener is the most common\n\t * for event emitters (#185789), so we optimize that special case to avoid\n\t * wrapping it in an array (just like Node.js itself.)\n\t *\n\t * A list of listeners never 'downgrades' back to a plain function if\n\t * listeners are removed, for two reasons:\n\t *\n\t * 1. That's complicated (especially with the deliveryQueue)\n\t * 2. A listener with >1 listener is likely to have >1 listener again at\n\t * some point, and swapping between arrays and functions may[citation needed]\n\t * introduce unnecessary work and garbage.\n\t *\n\t * The array listeners can be 'sparse', to avoid reallocating the array\n\t * whenever any listener is added or removed. If more than `1 / compactionThreshold`\n\t * of the array is empty, only then is it resized.\n\t */\n\tprotected _listeners?: ListenerOrListeners;\n\n\t/**\n\t * Always to be defined if _listeners is an array. It's no longer a true\n\t * queue, but holds the dispatching 'state'. If `fire()` is called on an\n\t * emitter, any work left in the _deliveryQueue is finished first.\n\t */\n\tprivate _deliveryQueue?: EventDeliveryQueuePrivate;\n\tprotected _size = 0;\n\n\tconstructor(options?: EmitterOptions) {\n\t\tthis._options = options;\n\t\tthis._leakageMon = (_globalLeakWarningThreshold > 0 || this._options?.leakWarningThreshold)\n\t\t\t? new LeakageMonitor(options?.onListenerError ?? onUnexpectedError, this._options?.leakWarningThreshold ?? _globalLeakWarningThreshold) :\n\t\t\tundefined;\n\t\tthis._perfMon = this._options?._profName ? new EventProfiling(this._options._profName) : undefined;\n\t\tthis._deliveryQueue = this._options?.deliveryQueue as EventDeliveryQueuePrivate | undefined;\n\t}\n\n\tdispose() {\n\t\tif (!this._disposed) {\n\t\t\tthis._disposed = true;\n\n\t\t\t// It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter\n\t\t\t// alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and\n\t\t\t// unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the\n\t\t\t// the following programming pattern is very popular:\n\t\t\t//\n\t\t\t// const someModel = this._disposables.add(new ModelObject()); // (1) create and register model\n\t\t\t// this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener\n\t\t\t// ...later...\n\t\t\t// this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the \"overall dispose\" is done\n\n\t\t\tif (this._deliveryQueue?.current === this) {\n\t\t\t\tthis._deliveryQueue.reset();\n\t\t\t}\n\t\t\tif (this._listeners) {\n\t\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\t\tconst listeners = this._listeners;\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tforEachListener(listeners, l => l.stack?.print());\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tthis._listeners = undefined;\n\t\t\t\tthis._size = 0;\n\t\t\t}\n\t\t\tthis._options?.onDidRemoveLastListener?.();\n\t\t\tthis._leakageMon?.dispose();\n\t\t}\n\t}\n\n\t/**\n\t * For the public to allow to subscribe\n\t * to events from this Emitter\n\t */\n\tget event(): Event {\n\t\tthis._event ??= (callback: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n\t\t\tif (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {\n\t\t\t\tconst message = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;\n\t\t\t\tconsole.warn(message);\n\n\t\t\t\tconst tuple = this._leakageMon.getMostFrequentStack() ?? ['UNKNOWN stack', -1];\n\t\t\t\tconst error = new ListenerRefusalError(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);\n\t\t\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\t\t\terrorHandler(error);\n\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (this._disposed) {\n\t\t\t\t// todo: should we warn if a listener is added to a disposed emitter? This happens often\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (thisArgs) {\n\t\t\t\tcallback = callback.bind(thisArgs);\n\t\t\t}\n\n\t\t\tconst contained = new UniqueContainer(callback);\n\n\t\t\tlet removeMonitor: Function | undefined;\n\t\t\tlet stack: Stacktrace | undefined;\n\t\t\tif (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {\n\t\t\t\t// check and record this emitter for potential leakage\n\t\t\t\tcontained.stack = Stacktrace.create();\n\t\t\t\tremoveMonitor = this._leakageMon.check(contained.stack, this._size + 1);\n\t\t\t}\n\n\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\tcontained.stack = stack ?? Stacktrace.create();\n\t\t\t}\n\n\t\t\tif (!this._listeners) {\n\t\t\t\tthis._options?.onWillAddFirstListener?.(this);\n\t\t\t\tthis._listeners = contained;\n\t\t\t\tthis._options?.onDidAddFirstListener?.(this);\n\t\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\t\tthis._deliveryQueue ??= new EventDeliveryQueuePrivate();\n\t\t\t\tthis._listeners = [this._listeners, contained];\n\t\t\t} else {\n\t\t\t\tthis._listeners.push(contained);\n\t\t\t}\n\n\t\t\tthis._size++;\n\n\n\t\t\tconst result = toDisposable(() => {\n\t\t\t\t_listenerFinalizers?.unregister(result);\n\t\t\t\tremoveMonitor?.();\n\t\t\t\tthis._removeListener(contained);\n\t\t\t});\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(result);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(result);\n\t\t\t}\n\n\t\t\tif (_listenerFinalizers) {\n\t\t\t\tconst stack = new Error().stack!.split('\\n').slice(2, 3).join('\\n').trim();\n\t\t\t\tconst match = /(file:|vscode-file:\\/\\/vscode-app)?(\\/[^:]*:\\d+:\\d+)/.exec(stack);\n\t\t\t\t_listenerFinalizers.register(result, match?.[2] ?? stack, result);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\n\t\treturn this._event;\n\t}\n\n\tprivate _removeListener(listener: ListenerContainer) {\n\t\tthis._options?.onWillRemoveListener?.(this);\n\n\t\tif (!this._listeners) {\n\t\t\treturn; // expected if a listener gets disposed\n\t\t}\n\n\t\tif (this._size === 1) {\n\t\t\tthis._listeners = undefined;\n\t\t\tthis._options?.onDidRemoveLastListener?.(this);\n\t\t\tthis._size = 0;\n\t\t\treturn;\n\t\t}\n\n\t\t// size > 1 which requires that listeners be a list:\n\t\tconst listeners = this._listeners as (ListenerContainer | undefined)[];\n\n\t\tconst index = listeners.indexOf(listener);\n\t\tif (index === -1) {\n\t\t\tconsole.log('disposed?', this._disposed);\n\t\t\tconsole.log('size?', this._size);\n\t\t\tconsole.log('arr?', JSON.stringify(this._listeners));\n\t\t\tthrow new Error('Attempted to dispose unknown listener');\n\t\t}\n\n\t\tthis._size--;\n\t\tlisteners[index] = undefined;\n\n\t\tconst adjustDeliveryQueue = this._deliveryQueue!.current === this;\n\t\tif (this._size * compactionThreshold <= listeners.length) {\n\t\t\tlet n = 0;\n\t\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\t\tif (listeners[i]) {\n\t\t\t\t\tlisteners[n++] = listeners[i];\n\t\t\t\t} else if (adjustDeliveryQueue) {\n\t\t\t\t\tthis._deliveryQueue!.end--;\n\t\t\t\t\tif (n < this._deliveryQueue!.i) {\n\t\t\t\t\t\tthis._deliveryQueue!.i--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlisteners.length = n;\n\t\t}\n\t}\n\n\tprivate _deliver(listener: undefined | UniqueContainer<(value: T) => void>, value: T) {\n\t\tif (!listener) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\tif (!errorHandler) {\n\t\t\tlistener.value(value);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlistener.value(value);\n\t\t} catch (e) {\n\t\t\terrorHandler(e);\n\t\t}\n\t}\n\n\t/** Delivers items in the queue. Assumes the queue is ready to go. */\n\tprivate _deliverQueue(dq: EventDeliveryQueuePrivate) {\n\t\tconst listeners = dq.current!._listeners! as (ListenerContainer | undefined)[];\n\t\twhile (dq.i < dq.end) {\n\t\t\t// important: dq.i is incremented before calling deliver() because it might reenter deliverQueue()\n\t\t\tthis._deliver(listeners[dq.i++], dq.value as T);\n\t\t}\n\t\tdq.reset();\n\t}\n\n\t/**\n\t * To be kept private to fire an event to\n\t * subscribers\n\t */\n\tfire(event: T): void {\n\t\tif (this._deliveryQueue?.current) {\n\t\t\tthis._deliverQueue(this._deliveryQueue);\n\t\t\tthis._perfMon?.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch\n\t\t}\n\n\t\tthis._perfMon?.start(this._size);\n\n\t\tif (!this._listeners) {\n\t\t\t// no-op\n\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\tthis._deliver(this._listeners, event);\n\t\t} else {\n\t\t\tconst dq = this._deliveryQueue!;\n\t\t\tdq.enqueue(this, event, this._listeners.length);\n\t\t\tthis._deliverQueue(dq);\n\t\t}\n\n\t\tthis._perfMon?.stop();\n\t}\n\n\thasListeners(): boolean {\n\t\treturn this._size > 0;\n\t}\n}\n\nexport interface EventDeliveryQueue {\n\t_isEventDeliveryQueue: true;\n}\n\nexport const createEventDeliveryQueue = (): EventDeliveryQueue => new EventDeliveryQueuePrivate();\n\nclass EventDeliveryQueuePrivate implements EventDeliveryQueue {\n\tdeclare _isEventDeliveryQueue: true;\n\n\t/**\n\t * Index in current's listener list.\n\t */\n\tpublic i = -1;\n\n\t/**\n\t * The last index in the listener's list to deliver.\n\t */\n\tpublic end = 0;\n\n\t/**\n\t * Emitter currently being dispatched on. Emitter._listeners is always an array.\n\t */\n\tpublic current?: Emitter;\n\t/**\n\t * Currently emitting value. Defined whenever `current` is.\n\t */\n\tpublic value?: unknown;\n\n\tpublic enqueue(emitter: Emitter, value: T, end: number) {\n\t\tthis.i = 0;\n\t\tthis.end = end;\n\t\tthis.current = emitter;\n\t\tthis.value = value;\n\t}\n\n\tpublic reset() {\n\t\tthis.i = this.end; // force any current emission loop to stop, mainly for during dispose\n\t\tthis.current = undefined;\n\t\tthis.value = undefined;\n\t}\n}\n\nexport interface IWaitUntil {\n\ttoken: CancellationToken;\n\twaitUntil(thenable: Promise): void;\n}\n\nexport type IWaitUntilData = Omit, 'token'>;\n\nexport class AsyncEmitter extends Emitter {\n\n\tprivate _asyncDeliveryQueue?: LinkedList<[(ev: T) => void, IWaitUntilData]>;\n\n\tasync fireAsync(data: IWaitUntilData, token: CancellationToken, promiseJoin?: (p: Promise, listener: Function) => Promise): Promise {\n\t\tif (!this._listeners) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._asyncDeliveryQueue) {\n\t\t\tthis._asyncDeliveryQueue = new LinkedList();\n\t\t}\n\n\t\tforEachListener(this._listeners, listener => this._asyncDeliveryQueue!.push([listener.value, data]));\n\n\t\twhile (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n\n\t\t\tconst [listener, data] = this._asyncDeliveryQueue.shift()!;\n\t\t\tconst thenables: Promise[] = [];\n\n\t\t\tconst event = {\n\t\t\t\t...data,\n\t\t\t\ttoken,\n\t\t\t\twaitUntil: (p: Promise): void => {\n\t\t\t\t\tif (Object.isFrozen(thenables)) {\n\t\t\t\t\t\tthrow new Error('waitUntil can NOT be called asynchronous');\n\t\t\t\t\t}\n\t\t\t\t\tif (promiseJoin) {\n\t\t\t\t\t\tp = promiseJoin(p, listener);\n\t\t\t\t\t}\n\t\t\t\t\tthenables.push(p);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttry {\n\t\t\t\tlistener(event);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// freeze thenables-collection to enforce sync-calls to\n\t\t\t// wait until and then wait for all thenables to resolve\n\t\t\tObject.freeze(thenables);\n\n\t\t\tawait Promise.allSettled(thenables).then(values => {\n\t\t\t\tfor (const value of values) {\n\t\t\t\t\tif (value.status === 'rejected') {\n\t\t\t\t\t\tonUnexpectedError(value.reason);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n}\n\n\nexport class PauseableEmitter extends Emitter {\n\n\tprivate _isPaused = 0;\n\tprotected _eventQueue = new LinkedList();\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tpublic get isPaused(): boolean {\n\t\treturn this._isPaused !== 0;\n\t}\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\n\tpause(): void {\n\t\tthis._isPaused++;\n\t}\n\n\tresume(): void {\n\t\tif (this._isPaused !== 0 && --this._isPaused === 0) {\n\t\t\tif (this._mergeFn) {\n\t\t\t\t// use the merge function to create a single composite\n\t\t\t\t// event. make a copy in case firing pauses this emitter\n\t\t\t\tif (this._eventQueue.size > 0) {\n\t\t\t\t\tconst events = Array.from(this._eventQueue);\n\t\t\t\t\tthis._eventQueue.clear();\n\t\t\t\t\tsuper.fire(this._mergeFn(events));\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// no merging, fire each event individually and test\n\t\t\t\t// that this emitter isn't paused halfway through\n\t\t\t\twhile (!this._isPaused && this._eventQueue.size !== 0) {\n\t\t\t\t\tsuper.fire(this._eventQueue.shift()!);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (this._size) {\n\t\t\tif (this._isPaused !== 0) {\n\t\t\t\tthis._eventQueue.push(event);\n\t\t\t} else {\n\t\t\t\tsuper.fire(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class DebounceEmitter extends PauseableEmitter {\n\n\tprivate readonly _delay: number;\n\tprivate _handle: any | undefined;\n\n\tconstructor(options: EmitterOptions & { merge: (input: T[]) => T; delay?: number }) {\n\t\tsuper(options);\n\t\tthis._delay = options.delay ?? 100;\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (!this._handle) {\n\t\t\tthis.pause();\n\t\t\tthis._handle = setTimeout(() => {\n\t\t\t\tthis._handle = undefined;\n\t\t\t\tthis.resume();\n\t\t\t}, this._delay);\n\t\t}\n\t\tsuper.fire(event);\n\t}\n}\n\n/**\n * An emitter which queue all events and then process them at the\n * end of the event loop.\n */\nexport class MicrotaskEmitter extends Emitter {\n\tprivate _queuedEvents: T[] = [];\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\toverride fire(event: T): void {\n\n\t\tif (!this.hasListeners()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._queuedEvents.push(event);\n\t\tif (this._queuedEvents.length === 1) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (this._mergeFn) {\n\t\t\t\t\tsuper.fire(this._mergeFn(this._queuedEvents));\n\t\t\t\t} else {\n\t\t\t\t\tthis._queuedEvents.forEach(e => super.fire(e));\n\t\t\t\t}\n\t\t\t\tthis._queuedEvents = [];\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * An event emitter that multiplexes many events into a single event.\n *\n * @example Listen to the `onData` event of all `Thing`s, dynamically adding and removing `Thing`s\n * to the multiplexer as needed.\n *\n * ```typescript\n * const anythingDataMultiplexer = new EventMultiplexer<{ data: string }>();\n *\n * const thingListeners = DisposableMap();\n *\n * thingService.onDidAddThing(thing => {\n * thingListeners.set(thing, anythingDataMultiplexer.add(thing.onData);\n * });\n * thingService.onDidRemoveThing(thing => {\n * thingListeners.deleteAndDispose(thing);\n * });\n *\n * anythingDataMultiplexer.event(e => {\n * console.log('Something fired data ' + e.data)\n * });\n * ```\n */\nexport class EventMultiplexer implements IDisposable {\n\n\tprivate readonly emitter: Emitter;\n\tprivate hasListeners = false;\n\tprivate events: { event: Event; listener: IDisposable | null }[] = [];\n\n\tconstructor() {\n\t\tthis.emitter = new Emitter({\n\t\t\tonWillAddFirstListener: () => this.onFirstListenerAdd(),\n\t\t\tonDidRemoveLastListener: () => this.onLastListenerRemove()\n\t\t});\n\t}\n\n\tget event(): Event {\n\t\treturn this.emitter.event;\n\t}\n\n\tadd(event: Event): IDisposable {\n\t\tconst e = { event: event, listener: null };\n\t\tthis.events.push(e);\n\n\t\tif (this.hasListeners) {\n\t\t\tthis.hook(e);\n\t\t}\n\n\t\tconst dispose = () => {\n\t\t\tif (this.hasListeners) {\n\t\t\t\tthis.unhook(e);\n\t\t\t}\n\n\t\t\tconst idx = this.events.indexOf(e);\n\t\t\tthis.events.splice(idx, 1);\n\t\t};\n\n\t\treturn toDisposable(createSingleCallFunction(dispose));\n\t}\n\n\tprivate onFirstListenerAdd(): void {\n\t\tthis.hasListeners = true;\n\t\tthis.events.forEach(e => this.hook(e));\n\t}\n\n\tprivate onLastListenerRemove(): void {\n\t\tthis.hasListeners = false;\n\t\tthis.events.forEach(e => this.unhook(e));\n\t}\n\n\tprivate hook(e: { event: Event; listener: IDisposable | null }): void {\n\t\te.listener = e.event(r => this.emitter.fire(r));\n\t}\n\n\tprivate unhook(e: { event: Event; listener: IDisposable | null }): void {\n\t\te.listener?.dispose();\n\t\te.listener = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.emitter.dispose();\n\n\t\tfor (const e of this.events) {\n\t\t\te.listener?.dispose();\n\t\t}\n\t\tthis.events = [];\n\t}\n}\n\nexport interface IDynamicListEventMultiplexer extends IDisposable {\n\treadonly event: Event;\n}\nexport class DynamicListEventMultiplexer implements IDynamicListEventMultiplexer {\n\tprivate readonly _store = new DisposableStore();\n\n\treadonly event: Event;\n\n\tconstructor(\n\t\titems: TItem[],\n\t\tonAddItem: Event,\n\t\tonRemoveItem: Event,\n\t\tgetEvent: (item: TItem) => Event\n\t) {\n\t\tconst multiplexer = this._store.add(new EventMultiplexer());\n\t\tconst itemListeners = this._store.add(new DisposableMap());\n\n\t\tfunction addItem(instance: TItem) {\n\t\t\titemListeners.set(instance, multiplexer.add(getEvent(instance)));\n\t\t}\n\n\t\t// Existing items\n\t\tfor (const instance of items) {\n\t\t\taddItem(instance);\n\t\t}\n\n\t\t// Added items\n\t\tthis._store.add(onAddItem(instance => {\n\t\t\taddItem(instance);\n\t\t}));\n\n\t\t// Removed items\n\t\tthis._store.add(onRemoveItem(instance => {\n\t\t\titemListeners.deleteAndDispose(instance);\n\t\t}));\n\n\t\tthis.event = multiplexer.event;\n\t}\n\n\tdispose() {\n\t\tthis._store.dispose();\n\t}\n}\n\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n * emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nexport class EventBufferer {\n\n\tprivate data: { buffers: Function[] }[] = [];\n\n\twrapEvent(event: Event): Event;\n\twrapEvent(event: Event, reduce: (last: T | undefined, event: T) => T): Event;\n\twrapEvent(event: Event, reduce: (last: O | undefined, event: T) => O, initial: O): Event;\n\twrapEvent(event: Event, reduce?: (last: T | O | undefined, event: T) => T | O, initial?: O): Event {\n\t\treturn (listener, thisArgs?, disposables?) => {\n\t\t\treturn event(i => {\n\t\t\t\tconst data = this.data[this.data.length - 1];\n\n\t\t\t\t// Non-reduce scenario\n\t\t\t\tif (!reduce) {\n\t\t\t\t\t// Buffering case\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\tdata.buffers.push(() => listener.call(thisArgs, i));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Not buffering case\n\t\t\t\t\t\tlistener.call(thisArgs, i);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Reduce scenario\n\t\t\t\tconst reduceData = data as typeof data & {\n\t\t\t\t\t/**\n\t\t\t\t\t * The accumulated items that will be reduced.\n\t\t\t\t\t */\n\t\t\t\t\titems?: T[];\n\t\t\t\t\t/**\n\t\t\t\t\t * The reduced result cached to be shared with other listeners.\n\t\t\t\t\t */\n\t\t\t\t\treducedResult?: T | O;\n\t\t\t\t};\n\n\t\t\t\t// Not buffering case\n\t\t\t\tif (!reduceData) {\n\t\t\t\t\t// TODO: Is there a way to cache this reduce call for all listeners?\n\t\t\t\t\tlistener.call(thisArgs, reduce(initial, i));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Buffering case\n\t\t\t\treduceData.items ??= [];\n\t\t\t\treduceData.items.push(i);\n\t\t\t\tif (reduceData.buffers.length === 0) {\n\t\t\t\t\t// Include a single buffered function that will reduce all events when we're done buffering events\n\t\t\t\t\tdata.buffers.push(() => {\n\t\t\t\t\t\t// cache the reduced result so that the value can be shared across all listeners\n\t\t\t\t\t\treduceData.reducedResult ??= initial\n\t\t\t\t\t\t\t? reduceData.items!.reduce(reduce as (last: O | undefined, event: T) => O, initial)\n\t\t\t\t\t\t\t: reduceData.items!.reduce(reduce as (last: T | undefined, event: T) => T);\n\t\t\t\t\t\tlistener.call(thisArgs, reduceData.reducedResult);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\t}\n\n\tbufferEvents(fn: () => R): R {\n\t\tconst data = { buffers: new Array() };\n\t\tthis.data.push(data);\n\t\tconst r = fn();\n\t\tthis.data.pop();\n\t\tdata.buffers.forEach(flush => flush());\n\t\treturn r;\n\t}\n}\n\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nexport class Relay implements IDisposable {\n\n\tprivate listening = false;\n\tprivate inputEvent: Event = Event.None;\n\tprivate inputEventListener: IDisposable = Disposable.None;\n\n\tprivate readonly emitter = new Emitter({\n\t\tonDidAddFirstListener: () => {\n\t\t\tthis.listening = true;\n\t\t\tthis.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n\t\t},\n\t\tonDidRemoveLastListener: () => {\n\t\t\tthis.listening = false;\n\t\t\tthis.inputEventListener.dispose();\n\t\t}\n\t});\n\n\treadonly event: Event = this.emitter.event;\n\n\tset input(event: Event) {\n\t\tthis.inputEvent = event;\n\n\t\tif (this.listening) {\n\t\t\tthis.inputEventListener.dispose();\n\t\t\tthis.inputEventListener = event(this.emitter.fire, this.emitter);\n\t\t}\n\t}\n\n\tdispose() {\n\t\tthis.inputEventListener.dispose();\n\t\tthis.emitter.dispose();\n\t}\n}\n\nexport interface IValueWithChangeEvent {\n\treadonly onDidChange: Event;\n\tget value(): T;\n}\n\nexport class ValueWithChangeEvent implements IValueWithChangeEvent {\n\tpublic static const(value: T): IValueWithChangeEvent {\n\t\treturn new ConstValueWithChangeEvent(value);\n\t}\n\n\tprivate readonly _onDidChange = new Emitter();\n\treadonly onDidChange: Event = this._onDidChange.event;\n\n\tconstructor(private _value: T) { }\n\n\tget value(): T {\n\t\treturn this._value;\n\t}\n\n\tset value(value: T) {\n\t\tif (value !== this._value) {\n\t\t\tthis._value = value;\n\t\t\tthis._onDidChange.fire(undefined);\n\t\t}\n\t}\n}\n\nclass ConstValueWithChangeEvent implements IValueWithChangeEvent {\n\tpublic readonly onDidChange: Event = Event.None;\n\n\tconstructor(readonly value: T) { }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CodeWindow, mainWindow } from 'vs/base/browser/window';\nimport { Emitter } from 'vs/base/common/event';\n\nclass WindowManager {\n\n\tstatic readonly INSTANCE = new WindowManager();\n\n\t// --- Zoom Level\n\n\tprivate readonly mapWindowIdToZoomLevel = new Map();\n\n\tprivate readonly _onDidChangeZoomLevel = new Emitter();\n\treadonly onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\n\n\tgetZoomLevel(targetWindow: Window): number {\n\t\treturn this.mapWindowIdToZoomLevel.get(this.getWindowId(targetWindow)) ?? 0;\n\t}\n\tsetZoomLevel(zoomLevel: number, targetWindow: Window): void {\n\t\tif (this.getZoomLevel(targetWindow) === zoomLevel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst targetWindowId = this.getWindowId(targetWindow);\n\t\tthis.mapWindowIdToZoomLevel.set(targetWindowId, zoomLevel);\n\t\tthis._onDidChangeZoomLevel.fire(targetWindowId);\n\t}\n\n\t// --- Zoom Factor\n\n\tprivate readonly mapWindowIdToZoomFactor = new Map();\n\n\tgetZoomFactor(targetWindow: Window): number {\n\t\treturn this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;\n\t}\n\tsetZoomFactor(zoomFactor: number, targetWindow: Window): void {\n\t\tthis.mapWindowIdToZoomFactor.set(this.getWindowId(targetWindow), zoomFactor);\n\t}\n\n\t// --- Fullscreen\n\n\tprivate readonly _onDidChangeFullscreen = new Emitter();\n\treadonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;\n\n\tprivate readonly mapWindowIdToFullScreen = new Map();\n\n\tsetFullscreen(fullscreen: boolean, targetWindow: Window): void {\n\t\tif (this.isFullscreen(targetWindow) === fullscreen) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst windowId = this.getWindowId(targetWindow);\n\t\tthis.mapWindowIdToFullScreen.set(windowId, fullscreen);\n\t\tthis._onDidChangeFullscreen.fire(windowId);\n\t}\n\tisFullscreen(targetWindow: Window): boolean {\n\t\treturn !!this.mapWindowIdToFullScreen.get(this.getWindowId(targetWindow));\n\t}\n\n\tprivate getWindowId(targetWindow: Window): number {\n\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t}\n}\n\nexport function addMatchMediaChangeListener(targetWindow: Window, query: string | MediaQueryList, callback: (this: MediaQueryList, ev: MediaQueryListEvent) => any): void {\n\tif (typeof query === 'string') {\n\t\tquery = targetWindow.matchMedia(query);\n\t}\n\tquery.addEventListener('change', callback);\n}\n\n/** A zoom index, e.g. 1, 2, 3 */\nexport function setZoomLevel(zoomLevel: number, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setZoomLevel(zoomLevel, targetWindow);\n}\nexport function getZoomLevel(targetWindow: Window): number {\n\treturn WindowManager.INSTANCE.getZoomLevel(targetWindow);\n}\nexport const onDidChangeZoomLevel = WindowManager.INSTANCE.onDidChangeZoomLevel;\n\n/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */\nexport function getZoomFactor(targetWindow: Window): number {\n\treturn WindowManager.INSTANCE.getZoomFactor(targetWindow);\n}\nexport function setZoomFactor(zoomFactor: number, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setZoomFactor(zoomFactor, targetWindow);\n}\n\nexport function setFullscreen(fullscreen: boolean, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setFullscreen(fullscreen, targetWindow);\n}\nexport function isFullscreen(targetWindow: Window): boolean {\n\treturn WindowManager.INSTANCE.isFullscreen(targetWindow);\n}\nexport const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;\n\nconst userAgent = typeof navigator === 'object' ? navigator.userAgent : '';\n\nexport const isFirefox = (userAgent.indexOf('Firefox') >= 0);\nexport const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);\nexport const isChrome = (userAgent.indexOf('Chrome') >= 0);\nexport const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));\nexport const isWebkitWebView = (!isChrome && !isSafari && isWebKit);\nexport const isElectron = (userAgent.indexOf('Electron/') >= 0);\nexport const isAndroid = (userAgent.indexOf('Android') >= 0);\n\nlet standalone = false;\nif (typeof mainWindow.matchMedia === 'function') {\n\tconst standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');\n\tconst fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');\n\tstandalone = standaloneMatchMedia.matches;\n\taddMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {\n\t\t// entering fullscreen would change standaloneMatchMedia.matches to false\n\t\t// if standalone is true (running as PWA) and entering fullscreen, skip this change\n\t\tif (standalone && fullScreenMatchMedia.matches) {\n\t\t\treturn;\n\t\t}\n\t\t// otherwise update standalone (browser to PWA or PWA to browser)\n\t\tstandalone = matches;\n\t});\n}\nexport function isStandalone(): boolean {\n\treturn standalone;\n}\n\n// Visible means that the feature is enabled, not necessarily being rendered\n// e.g. visible is true even in fullscreen mode where the controls are hidden\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible\nexport function isWCOEnabled(): boolean {\n\treturn (navigator as any)?.windowControlsOverlay?.visible;\n}\n\n// Returns the bounding rect of the titlebar area if it is supported and defined\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/getTitlebarAreaRect\nexport function getWCOBoundingRect(): DOMRect | undefined {\n\treturn (navigator as any)?.windowControlsOverlay?.getTitlebarAreaRect();\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as nls from 'vs/nls';\n\nexport const LANGUAGE_DEFAULT = 'en';\n\nlet _isWindows = false;\nlet _isMacintosh = false;\nlet _isLinux = false;\nlet _isLinuxSnap = false;\nlet _isNative = false;\nlet _isWeb = false;\nlet _isElectron = false;\nlet _isIOS = false;\nlet _isCI = false;\nlet _isMobile = false;\nlet _locale: string | undefined = undefined;\nlet _language: string = LANGUAGE_DEFAULT;\nlet _platformLocale: string = LANGUAGE_DEFAULT;\nlet _translationsConfigFile: string | undefined = undefined;\nlet _userAgent: string | undefined = undefined;\n\nexport interface IProcessEnvironment {\n\t[key: string]: string | undefined;\n}\n\n/**\n * This interface is intentionally not identical to node.js\n * process because it also works in sandboxed environments\n * where the process object is implemented differently. We\n * define the properties here that we need for `platform`\n * to work and nothing else.\n */\nexport interface INodeProcess {\n\tplatform: string;\n\tarch: string;\n\tenv: IProcessEnvironment;\n\tversions?: {\n\t\tnode?: string;\n\t\telectron?: string;\n\t\tchrome?: string;\n\t};\n\ttype?: string;\n\tcwd: () => string;\n}\n\ndeclare const process: INodeProcess;\n\nconst $globalThis: any = globalThis;\n\nlet nodeProcess: INodeProcess | undefined = undefined;\nif (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {\n\t// Native environment (sandboxed)\n\tnodeProcess = $globalThis.vscode.process;\n} else if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') {\n\t// Native environment (non-sandboxed)\n\tnodeProcess = process;\n}\n\nconst isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';\nconst isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';\n\ninterface INavigator {\n\tuserAgent: string;\n\tmaxTouchPoints?: number;\n\tlanguage: string;\n}\ndeclare const navigator: INavigator;\n\n// Native environment\nif (typeof nodeProcess === 'object') {\n\t_isWindows = (nodeProcess.platform === 'win32');\n\t_isMacintosh = (nodeProcess.platform === 'darwin');\n\t_isLinux = (nodeProcess.platform === 'linux');\n\t_isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\n\t_isElectron = isElectronProcess;\n\t_isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];\n\t_locale = LANGUAGE_DEFAULT;\n\t_language = LANGUAGE_DEFAULT;\n\tconst rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\n\tif (rawNlsConfig) {\n\t\ttry {\n\t\t\tconst nlsConfig: nls.INLSConfiguration = JSON.parse(rawNlsConfig);\n\t\t\t_locale = nlsConfig.userLocale;\n\t\t\t_platformLocale = nlsConfig.osLocale;\n\t\t\t_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;\n\t\t\t_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;\n\t\t} catch (e) {\n\t\t}\n\t}\n\t_isNative = true;\n}\n\n// Web environment\nelse if (typeof navigator === 'object' && !isElectronRenderer) {\n\t_userAgent = navigator.userAgent;\n\t_isWindows = _userAgent.indexOf('Windows') >= 0;\n\t_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\n\t_isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\n\t_isLinux = _userAgent.indexOf('Linux') >= 0;\n\t_isMobile = _userAgent?.indexOf('Mobi') >= 0;\n\t_isWeb = true;\n\t// VSCODE_GLOBALS: NLS\n\t_language = globalThis._VSCODE_NLS_LANGUAGE || LANGUAGE_DEFAULT;\n\t_locale = navigator.language.toLowerCase();\n\t_platformLocale = _locale;\n}\n\n// Unknown environment\nelse {\n\tconsole.error('Unable to resolve platform.');\n}\n\nexport const enum Platform {\n\tWeb,\n\tMac,\n\tLinux,\n\tWindows\n}\nexport type PlatformName = 'Web' | 'Windows' | 'Mac' | 'Linux';\n\nexport function PlatformToString(platform: Platform): PlatformName {\n\tswitch (platform) {\n\t\tcase Platform.Web: return 'Web';\n\t\tcase Platform.Mac: return 'Mac';\n\t\tcase Platform.Linux: return 'Linux';\n\t\tcase Platform.Windows: return 'Windows';\n\t}\n}\n\nlet _platform: Platform = Platform.Web;\nif (_isMacintosh) {\n\t_platform = Platform.Mac;\n} else if (_isWindows) {\n\t_platform = Platform.Windows;\n} else if (_isLinux) {\n\t_platform = Platform.Linux;\n}\n\nexport const isWindows = _isWindows;\nexport const isMacintosh = _isMacintosh;\nexport const isLinux = _isLinux;\nexport const isLinuxSnap = _isLinuxSnap;\nexport const isNative = _isNative;\nexport const isElectron = _isElectron;\nexport const isWeb = _isWeb;\nexport const isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function');\nexport const webWorkerOrigin = isWebWorker ? $globalThis.origin : undefined;\nexport const isIOS = _isIOS;\nexport const isMobile = _isMobile;\n/**\n * Whether we run inside a CI environment, such as\n * GH actions or Azure Pipelines.\n */\nexport const isCI = _isCI;\nexport const platform = _platform;\nexport const userAgent = _userAgent;\n\n/**\n * The language used for the user interface. The format of\n * the string is all lower case (e.g. zh-tw for Traditional\n * Chinese or de for German)\n */\nexport const language = _language;\n\nexport namespace Language {\n\n\texport function value(): string {\n\t\treturn language;\n\t}\n\n\texport function isDefaultVariant(): boolean {\n\t\tif (language.length === 2) {\n\t\t\treturn language === 'en';\n\t\t} else if (language.length >= 3) {\n\t\t\treturn language[0] === 'e' && language[1] === 'n' && language[2] === '-';\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\texport function isDefault(): boolean {\n\t\treturn language === 'en';\n\t}\n}\n\n/**\n * Desktop: The OS locale or the locale specified by --locale or `argv.json`.\n * Web: matches `platformLocale`.\n *\n * The UI is not necessarily shown in the provided locale.\n */\nexport const locale = _locale;\n\n/**\n * This will always be set to the OS/browser's locale regardless of\n * what was specified otherwise. The format of the string is all\n * lower case (e.g. zh-tw for Traditional Chinese). The UI is not\n * necessarily shown in the provided locale.\n */\nexport const platformLocale = _platformLocale;\n\n/**\n * The translations that are available through language packs.\n */\nexport const translationsConfigFile = _translationsConfigFile;\n\nexport const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);\n\n/**\n * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.\n *\n * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay\n * that browsers set when the nesting level is > 5.\n */\nexport const setTimeout0 = (() => {\n\tif (setTimeout0IsFaster) {\n\t\tinterface IQueueElement {\n\t\t\tid: number;\n\t\t\tcallback: () => void;\n\t\t}\n\t\tconst pending: IQueueElement[] = [];\n\n\t\t$globalThis.addEventListener('message', (e: any) => {\n\t\t\tif (e.data && e.data.vscodeScheduleAsyncWork) {\n\t\t\t\tfor (let i = 0, len = pending.length; i < len; i++) {\n\t\t\t\t\tconst candidate = pending[i];\n\t\t\t\t\tif (candidate.id === e.data.vscodeScheduleAsyncWork) {\n\t\t\t\t\t\tpending.splice(i, 1);\n\t\t\t\t\t\tcandidate.callback();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tlet lastId = 0;\n\t\treturn (callback: () => void) => {\n\t\t\tconst myId = ++lastId;\n\t\t\tpending.push({\n\t\t\t\tid: myId,\n\t\t\t\tcallback: callback\n\t\t\t});\n\t\t\t$globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');\n\t\t};\n\t}\n\treturn (callback: () => void) => setTimeout(callback);\n})();\n\nexport const enum OperatingSystem {\n\tWindows = 1,\n\tMacintosh = 2,\n\tLinux = 3\n}\nexport const OS = (_isMacintosh || _isIOS ? OperatingSystem.Macintosh : (_isWindows ? OperatingSystem.Windows : OperatingSystem.Linux));\n\nlet _isLittleEndian = true;\nlet _isLittleEndianComputed = false;\nexport function isLittleEndian(): boolean {\n\tif (!_isLittleEndianComputed) {\n\t\t_isLittleEndianComputed = true;\n\t\tconst test = new Uint8Array(2);\n\t\ttest[0] = 1;\n\t\ttest[1] = 2;\n\t\tconst view = new Uint16Array(test.buffer);\n\t\t_isLittleEndian = (view[0] === (2 << 8) + 1);\n\t}\n\treturn _isLittleEndian;\n}\n\nexport const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);\nexport const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0);\nexport const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0));\nexport const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0);\nexport const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0);\n\nexport function isBigSurOrNewer(osVersion: string): boolean {\n\treturn parseFloat(osVersion) >= 20;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { mainWindow } from 'vs/base/browser/window';\nimport * as platform from 'vs/base/common/platform';\n\nexport const enum KeyboardSupport {\n\tAlways,\n\tFullScreen,\n\tNone\n}\n\nconst safeNavigator = typeof navigator === 'object' ? navigator : {} as { [key: string]: any };\n\n/**\n * Browser feature we can support in current platform, browser and environment.\n */\nexport const BrowserFeatures = {\n\tclipboard: {\n\t\twriteText: (\n\t\t\tplatform.isNative\n\t\t\t|| (document.queryCommandSupported && document.queryCommandSupported('copy'))\n\t\t\t|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.writeText)\n\t\t),\n\t\treadText: (\n\t\t\tplatform.isNative\n\t\t\t|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.readText)\n\t\t)\n\t},\n\tkeyboard: (() => {\n\t\tif (platform.isNative || browser.isStandalone()) {\n\t\t\treturn KeyboardSupport.Always;\n\t\t}\n\n\t\tif ((safeNavigator).keyboard || browser.isSafari) {\n\t\t\treturn KeyboardSupport.FullScreen;\n\t\t}\n\n\t\treturn KeyboardSupport.None;\n\t})(),\n\n\t// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be\n\t// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n\ttouch: 'ontouchstart' in mainWindow || safeNavigator.maxTouchPoints > 0,\n\tpointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0)\n};\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Virtual Key Codes, the value does not hold any inherent meaning.\n * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n * But these are \"more general\", as they should work across browsers & OS`s.\n */\nexport const enum KeyCode {\n\tDependsOnKbLayout = -1,\n\n\t/**\n\t * Placed first to cover the 0 value of the enum.\n\t */\n\tUnknown = 0,\n\n\tBackspace,\n\tTab,\n\tEnter,\n\tShift,\n\tCtrl,\n\tAlt,\n\tPauseBreak,\n\tCapsLock,\n\tEscape,\n\tSpace,\n\tPageUp,\n\tPageDown,\n\tEnd,\n\tHome,\n\tLeftArrow,\n\tUpArrow,\n\tRightArrow,\n\tDownArrow,\n\tInsert,\n\tDelete,\n\n\tDigit0,\n\tDigit1,\n\tDigit2,\n\tDigit3,\n\tDigit4,\n\tDigit5,\n\tDigit6,\n\tDigit7,\n\tDigit8,\n\tDigit9,\n\n\tKeyA,\n\tKeyB,\n\tKeyC,\n\tKeyD,\n\tKeyE,\n\tKeyF,\n\tKeyG,\n\tKeyH,\n\tKeyI,\n\tKeyJ,\n\tKeyK,\n\tKeyL,\n\tKeyM,\n\tKeyN,\n\tKeyO,\n\tKeyP,\n\tKeyQ,\n\tKeyR,\n\tKeyS,\n\tKeyT,\n\tKeyU,\n\tKeyV,\n\tKeyW,\n\tKeyX,\n\tKeyY,\n\tKeyZ,\n\n\tMeta,\n\tContextMenu,\n\n\tF1,\n\tF2,\n\tF3,\n\tF4,\n\tF5,\n\tF6,\n\tF7,\n\tF8,\n\tF9,\n\tF10,\n\tF11,\n\tF12,\n\tF13,\n\tF14,\n\tF15,\n\tF16,\n\tF17,\n\tF18,\n\tF19,\n\tF20,\n\tF21,\n\tF22,\n\tF23,\n\tF24,\n\n\tNumLock,\n\tScrollLock,\n\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ';:' key\n\t */\n\tSemicolon,\n\t/**\n\t * For any country/region, the '+' key\n\t * For the US standard keyboard, the '=+' key\n\t */\n\tEqual,\n\t/**\n\t * For any country/region, the ',' key\n\t * For the US standard keyboard, the ',<' key\n\t */\n\tComma,\n\t/**\n\t * For any country/region, the '-' key\n\t * For the US standard keyboard, the '-_' key\n\t */\n\tMinus,\n\t/**\n\t * For any country/region, the '.' key\n\t * For the US standard keyboard, the '.>' key\n\t */\n\tPeriod,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '/?' key\n\t */\n\tSlash,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '`~' key\n\t */\n\tBackquote,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '[{' key\n\t */\n\tBracketLeft,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '\\|' key\n\t */\n\tBackslash,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ']}' key\n\t */\n\tBracketRight,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ''\"' key\n\t */\n\tQuote,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t */\n\tOEM_8,\n\t/**\n\t * Either the angle bracket key or the backslash key on the RT 102-key keyboard.\n\t */\n\tIntlBackslash,\n\n\tNumpad0, // VK_NUMPAD0, 0x60, Numeric keypad 0 key\n\tNumpad1, // VK_NUMPAD1, 0x61, Numeric keypad 1 key\n\tNumpad2, // VK_NUMPAD2, 0x62, Numeric keypad 2 key\n\tNumpad3, // VK_NUMPAD3, 0x63, Numeric keypad 3 key\n\tNumpad4, // VK_NUMPAD4, 0x64, Numeric keypad 4 key\n\tNumpad5, // VK_NUMPAD5, 0x65, Numeric keypad 5 key\n\tNumpad6, // VK_NUMPAD6, 0x66, Numeric keypad 6 key\n\tNumpad7, // VK_NUMPAD7, 0x67, Numeric keypad 7 key\n\tNumpad8, // VK_NUMPAD8, 0x68, Numeric keypad 8 key\n\tNumpad9, // VK_NUMPAD9, 0x69, Numeric keypad 9 key\n\n\tNumpadMultiply,\t// VK_MULTIPLY, 0x6A, Multiply key\n\tNumpadAdd,\t\t// VK_ADD, 0x6B, Add key\n\tNUMPAD_SEPARATOR,\t// VK_SEPARATOR, 0x6C, Separator key\n\tNumpadSubtract,\t// VK_SUBTRACT, 0x6D, Subtract key\n\tNumpadDecimal,\t// VK_DECIMAL, 0x6E, Decimal key\n\tNumpadDivide,\t// VK_DIVIDE, 0x6F,\n\n\t/**\n\t * Cover all key codes when IME is processing input.\n\t */\n\tKEY_IN_COMPOSITION,\n\n\tABNT_C1, // Brazilian (ABNT) Keyboard\n\tABNT_C2, // Brazilian (ABNT) Keyboard\n\n\tAudioVolumeMute,\n\tAudioVolumeUp,\n\tAudioVolumeDown,\n\n\tBrowserSearch,\n\tBrowserHome,\n\tBrowserBack,\n\tBrowserForward,\n\n\tMediaTrackNext,\n\tMediaTrackPrevious,\n\tMediaStop,\n\tMediaPlayPause,\n\tLaunchMediaPlayer,\n\tLaunchMail,\n\tLaunchApp2,\n\n\t/**\n\t * VK_CLEAR, 0x0C, CLEAR key\n\t */\n\tClear,\n\n\t/**\n\t * Placed last to cover the length of the enum.\n\t * Please do not depend on this value!\n\t */\n\tMAX_VALUE\n}\n\n/**\n * keyboardEvent.code\n */\nexport const enum ScanCode {\n\tDependsOnKbLayout = -1,\n\tNone,\n\tHyper,\n\tSuper,\n\tFn,\n\tFnLock,\n\tSuspend,\n\tResume,\n\tTurbo,\n\tSleep,\n\tWakeUp,\n\tKeyA,\n\tKeyB,\n\tKeyC,\n\tKeyD,\n\tKeyE,\n\tKeyF,\n\tKeyG,\n\tKeyH,\n\tKeyI,\n\tKeyJ,\n\tKeyK,\n\tKeyL,\n\tKeyM,\n\tKeyN,\n\tKeyO,\n\tKeyP,\n\tKeyQ,\n\tKeyR,\n\tKeyS,\n\tKeyT,\n\tKeyU,\n\tKeyV,\n\tKeyW,\n\tKeyX,\n\tKeyY,\n\tKeyZ,\n\tDigit1,\n\tDigit2,\n\tDigit3,\n\tDigit4,\n\tDigit5,\n\tDigit6,\n\tDigit7,\n\tDigit8,\n\tDigit9,\n\tDigit0,\n\tEnter,\n\tEscape,\n\tBackspace,\n\tTab,\n\tSpace,\n\tMinus,\n\tEqual,\n\tBracketLeft,\n\tBracketRight,\n\tBackslash,\n\tIntlHash,\n\tSemicolon,\n\tQuote,\n\tBackquote,\n\tComma,\n\tPeriod,\n\tSlash,\n\tCapsLock,\n\tF1,\n\tF2,\n\tF3,\n\tF4,\n\tF5,\n\tF6,\n\tF7,\n\tF8,\n\tF9,\n\tF10,\n\tF11,\n\tF12,\n\tPrintScreen,\n\tScrollLock,\n\tPause,\n\tInsert,\n\tHome,\n\tPageUp,\n\tDelete,\n\tEnd,\n\tPageDown,\n\tArrowRight,\n\tArrowLeft,\n\tArrowDown,\n\tArrowUp,\n\tNumLock,\n\tNumpadDivide,\n\tNumpadMultiply,\n\tNumpadSubtract,\n\tNumpadAdd,\n\tNumpadEnter,\n\tNumpad1,\n\tNumpad2,\n\tNumpad3,\n\tNumpad4,\n\tNumpad5,\n\tNumpad6,\n\tNumpad7,\n\tNumpad8,\n\tNumpad9,\n\tNumpad0,\n\tNumpadDecimal,\n\tIntlBackslash,\n\tContextMenu,\n\tPower,\n\tNumpadEqual,\n\tF13,\n\tF14,\n\tF15,\n\tF16,\n\tF17,\n\tF18,\n\tF19,\n\tF20,\n\tF21,\n\tF22,\n\tF23,\n\tF24,\n\tOpen,\n\tHelp,\n\tSelect,\n\tAgain,\n\tUndo,\n\tCut,\n\tCopy,\n\tPaste,\n\tFind,\n\tAudioVolumeMute,\n\tAudioVolumeUp,\n\tAudioVolumeDown,\n\tNumpadComma,\n\tIntlRo,\n\tKanaMode,\n\tIntlYen,\n\tConvert,\n\tNonConvert,\n\tLang1,\n\tLang2,\n\tLang3,\n\tLang4,\n\tLang5,\n\tAbort,\n\tProps,\n\tNumpadParenLeft,\n\tNumpadParenRight,\n\tNumpadBackspace,\n\tNumpadMemoryStore,\n\tNumpadMemoryRecall,\n\tNumpadMemoryClear,\n\tNumpadMemoryAdd,\n\tNumpadMemorySubtract,\n\tNumpadClear,\n\tNumpadClearEntry,\n\tControlLeft,\n\tShiftLeft,\n\tAltLeft,\n\tMetaLeft,\n\tControlRight,\n\tShiftRight,\n\tAltRight,\n\tMetaRight,\n\tBrightnessUp,\n\tBrightnessDown,\n\tMediaPlay,\n\tMediaRecord,\n\tMediaFastForward,\n\tMediaRewind,\n\tMediaTrackNext,\n\tMediaTrackPrevious,\n\tMediaStop,\n\tEject,\n\tMediaPlayPause,\n\tMediaSelect,\n\tLaunchMail,\n\tLaunchApp2,\n\tLaunchApp1,\n\tSelectTask,\n\tLaunchScreenSaver,\n\tBrowserSearch,\n\tBrowserHome,\n\tBrowserBack,\n\tBrowserForward,\n\tBrowserStop,\n\tBrowserRefresh,\n\tBrowserFavorites,\n\tZoomToggle,\n\tMailReply,\n\tMailForward,\n\tMailSend,\n\n\tMAX_VALUE\n}\n\nclass KeyCodeStrMap {\n\n\tpublic _keyCodeToStr: string[];\n\tpublic _strToKeyCode: { [str: string]: KeyCode };\n\n\tconstructor() {\n\t\tthis._keyCodeToStr = [];\n\t\tthis._strToKeyCode = Object.create(null);\n\t}\n\n\tdefine(keyCode: KeyCode, str: string): void {\n\t\tthis._keyCodeToStr[keyCode] = str;\n\t\tthis._strToKeyCode[str.toLowerCase()] = keyCode;\n\t}\n\n\tkeyCodeToStr(keyCode: KeyCode): string {\n\t\treturn this._keyCodeToStr[keyCode];\n\t}\n\n\tstrToKeyCode(str: string): KeyCode {\n\t\treturn this._strToKeyCode[str.toLowerCase()] || KeyCode.Unknown;\n\t}\n}\n\nconst uiMap = new KeyCodeStrMap();\nconst userSettingsUSMap = new KeyCodeStrMap();\nconst userSettingsGeneralMap = new KeyCodeStrMap();\nexport const EVENT_KEY_CODE_MAP: { [keyCode: number]: KeyCode } = new Array(230);\nexport const NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE: { [nativeKeyCode: string]: KeyCode } = {};\nconst scanCodeIntToStr: string[] = [];\nconst scanCodeStrToInt: { [code: string]: number } = Object.create(null);\nconst scanCodeLowerCaseStrToInt: { [code: string]: number } = Object.create(null);\n\nexport const ScanCodeUtils = {\n\tlowerCaseToEnum: (scanCode: string) => scanCodeLowerCaseStrToInt[scanCode] || ScanCode.None,\n\ttoEnum: (scanCode: string) => scanCodeStrToInt[scanCode] || ScanCode.None,\n\ttoString: (scanCode: ScanCode) => scanCodeIntToStr[scanCode] || 'None'\n};\n\n\nexport namespace KeyCodeUtils {\n\texport function toString(keyCode: KeyCode): string {\n\t\treturn uiMap.keyCodeToStr(keyCode);\n\t}\n\texport function fromString(key: string): KeyCode {\n\t\treturn uiMap.strToKeyCode(key);\n\t}\n\n\texport function toUserSettingsUS(keyCode: KeyCode): string {\n\t\treturn userSettingsUSMap.keyCodeToStr(keyCode);\n\t}\n\texport function toUserSettingsGeneral(keyCode: KeyCode): string {\n\t\treturn userSettingsGeneralMap.keyCodeToStr(keyCode);\n\t}\n\texport function fromUserSettings(key: string): KeyCode {\n\t\treturn userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\n\t}\n\n\texport function toElectronAccelerator(keyCode: KeyCode): string | null {\n\t\tif (keyCode >= KeyCode.Numpad0 && keyCode <= KeyCode.NumpadDivide) {\n\t\t\t// [Electron Accelerators] Electron is able to parse numpad keys, but unfortunately it\n\t\t\t// renders them just as regular keys in menus. For example, num0 is rendered as \"0\",\n\t\t\t// numdiv is rendered as \"/\", numsub is rendered as \"-\".\n\t\t\t//\n\t\t\t// This can lead to incredible confusion, as it makes numpad based keybindings indistinguishable\n\t\t\t// from keybindings based on regular keys.\n\t\t\t//\n\t\t\t// We therefore need to fall back to custom rendering for numpad keys.\n\t\t\treturn null;\n\t\t}\n\n\t\tswitch (keyCode) {\n\t\t\tcase KeyCode.UpArrow:\n\t\t\t\treturn 'Up';\n\t\t\tcase KeyCode.DownArrow:\n\t\t\t\treturn 'Down';\n\t\t\tcase KeyCode.LeftArrow:\n\t\t\t\treturn 'Left';\n\t\t\tcase KeyCode.RightArrow:\n\t\t\t\treturn 'Right';\n\t\t}\n\n\t\treturn uiMap.keyCodeToStr(keyCode);\n\t}\n}\n\nexport const enum KeyMod {\n\tCtrlCmd = (1 << 11) >>> 0,\n\tShift = (1 << 10) >>> 0,\n\tAlt = (1 << 9) >>> 0,\n\tWinCtrl = (1 << 8) >>> 0,\n}\n\nexport function KeyChord(firstPart: number, secondPart: number): number {\n\tconst chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\n\treturn (firstPart | chordPart) >>> 0;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from 'vs/base/common/errors';\nimport { KeyCode, ScanCode } from 'vs/base/common/keyCodes';\nimport { OperatingSystem } from 'vs/base/common/platform';\n\n/**\n * Binary encoding strategy:\n * ```\n * 1111 11\n * 5432 1098 7654 3210\n * ---- CSAW KKKK KKKK\n * C = bit 11 = ctrlCmd flag\n * S = bit 10 = shift flag\n * A = bit 9 = alt flag\n * W = bit 8 = winCtrl flag\n * K = bits 0-7 = key code\n * ```\n */\nconst enum BinaryKeybindingsMask {\n\tCtrlCmd = (1 << 11) >>> 0,\n\tShift = (1 << 10) >>> 0,\n\tAlt = (1 << 9) >>> 0,\n\tWinCtrl = (1 << 8) >>> 0,\n\tKeyCode = 0x000000FF\n}\n\nexport function decodeKeybinding(keybinding: number | number[], OS: OperatingSystem): Keybinding | null {\n\tif (typeof keybinding === 'number') {\n\t\tif (keybinding === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tconst firstChord = (keybinding & 0x0000FFFF) >>> 0;\n\t\tconst secondChord = (keybinding & 0xFFFF0000) >>> 16;\n\t\tif (secondChord !== 0) {\n\t\t\treturn new Keybinding([\n\t\t\t\tcreateSimpleKeybinding(firstChord, OS),\n\t\t\t\tcreateSimpleKeybinding(secondChord, OS)\n\t\t\t]);\n\t\t}\n\t\treturn new Keybinding([createSimpleKeybinding(firstChord, OS)]);\n\t} else {\n\t\tconst chords = [];\n\t\tfor (let i = 0; i < keybinding.length; i++) {\n\t\t\tchords.push(createSimpleKeybinding(keybinding[i], OS));\n\t\t}\n\t\treturn new Keybinding(chords);\n\t}\n}\n\nexport function createSimpleKeybinding(keybinding: number, OS: OperatingSystem): KeyCodeChord {\n\n\tconst ctrlCmd = (keybinding & BinaryKeybindingsMask.CtrlCmd ? true : false);\n\tconst winCtrl = (keybinding & BinaryKeybindingsMask.WinCtrl ? true : false);\n\n\tconst ctrlKey = (OS === OperatingSystem.Macintosh ? winCtrl : ctrlCmd);\n\tconst shiftKey = (keybinding & BinaryKeybindingsMask.Shift ? true : false);\n\tconst altKey = (keybinding & BinaryKeybindingsMask.Alt ? true : false);\n\tconst metaKey = (OS === OperatingSystem.Macintosh ? ctrlCmd : winCtrl);\n\tconst keyCode = (keybinding & BinaryKeybindingsMask.KeyCode);\n\n\treturn new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);\n}\n\nexport interface Modifiers {\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n}\n\n/**\n * Represents a chord which uses the `keyCode` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class KeyCodeChord implements Modifiers {\n\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly keyCode: KeyCode\n\t) { }\n\n\tpublic equals(other: Chord): boolean {\n\t\treturn (\n\t\t\tother instanceof KeyCodeChord\n\t\t\t&& this.ctrlKey === other.ctrlKey\n\t\t\t&& this.shiftKey === other.shiftKey\n\t\t\t&& this.altKey === other.altKey\n\t\t\t&& this.metaKey === other.metaKey\n\t\t\t&& this.keyCode === other.keyCode\n\t\t);\n\t}\n\n\tpublic getHashCode(): string {\n\t\tconst ctrl = this.ctrlKey ? '1' : '0';\n\t\tconst shift = this.shiftKey ? '1' : '0';\n\t\tconst alt = this.altKey ? '1' : '0';\n\t\tconst meta = this.metaKey ? '1' : '0';\n\t\treturn `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;\n\t}\n\n\tpublic isModifierKey(): boolean {\n\t\treturn (\n\t\t\tthis.keyCode === KeyCode.Unknown\n\t\t\t|| this.keyCode === KeyCode.Ctrl\n\t\t\t|| this.keyCode === KeyCode.Meta\n\t\t\t|| this.keyCode === KeyCode.Alt\n\t\t\t|| this.keyCode === KeyCode.Shift\n\t\t);\n\t}\n\n\tpublic toKeybinding(): Keybinding {\n\t\treturn new Keybinding([this]);\n\t}\n\n\t/**\n\t * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n\t */\n\tpublic isDuplicateModifierCase(): boolean {\n\t\treturn (\n\t\t\t(this.ctrlKey && this.keyCode === KeyCode.Ctrl)\n\t\t\t|| (this.shiftKey && this.keyCode === KeyCode.Shift)\n\t\t\t|| (this.altKey && this.keyCode === KeyCode.Alt)\n\t\t\t|| (this.metaKey && this.keyCode === KeyCode.Meta)\n\t\t);\n\t}\n}\n\n/**\n * Represents a chord which uses the `code` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class ScanCodeChord implements Modifiers {\n\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly scanCode: ScanCode\n\t) { }\n\n\tpublic equals(other: Chord): boolean {\n\t\treturn (\n\t\t\tother instanceof ScanCodeChord\n\t\t\t&& this.ctrlKey === other.ctrlKey\n\t\t\t&& this.shiftKey === other.shiftKey\n\t\t\t&& this.altKey === other.altKey\n\t\t\t&& this.metaKey === other.metaKey\n\t\t\t&& this.scanCode === other.scanCode\n\t\t);\n\t}\n\n\tpublic getHashCode(): string {\n\t\tconst ctrl = this.ctrlKey ? '1' : '0';\n\t\tconst shift = this.shiftKey ? '1' : '0';\n\t\tconst alt = this.altKey ? '1' : '0';\n\t\tconst meta = this.metaKey ? '1' : '0';\n\t\treturn `S${ctrl}${shift}${alt}${meta}${this.scanCode}`;\n\t}\n\n\t/**\n\t * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n\t */\n\tpublic isDuplicateModifierCase(): boolean {\n\t\treturn (\n\t\t\t(this.ctrlKey && (this.scanCode === ScanCode.ControlLeft || this.scanCode === ScanCode.ControlRight))\n\t\t\t|| (this.shiftKey && (this.scanCode === ScanCode.ShiftLeft || this.scanCode === ScanCode.ShiftRight))\n\t\t\t|| (this.altKey && (this.scanCode === ScanCode.AltLeft || this.scanCode === ScanCode.AltRight))\n\t\t\t|| (this.metaKey && (this.scanCode === ScanCode.MetaLeft || this.scanCode === ScanCode.MetaRight))\n\t\t);\n\t}\n}\n\nexport type Chord = KeyCodeChord | ScanCodeChord;\n\n/**\n * A keybinding is a sequence of chords.\n */\nexport class Keybinding {\n\n\tpublic readonly chords: Chord[];\n\n\tconstructor(chords: Chord[]) {\n\t\tif (chords.length === 0) {\n\t\t\tthrow illegalArgument(`chords`);\n\t\t}\n\t\tthis.chords = chords;\n\t}\n\n\tpublic getHashCode(): string {\n\t\tlet result = '';\n\t\tfor (let i = 0, len = this.chords.length; i < len; i++) {\n\t\t\tif (i !== 0) {\n\t\t\t\tresult += ';';\n\t\t\t}\n\t\t\tresult += this.chords[i].getHashCode();\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic equals(other: Keybinding | null): boolean {\n\t\tif (other === null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.chords.length !== other.chords.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (let i = 0; i < this.chords.length; i++) {\n\t\t\tif (!this.chords[i].equals(other.chords[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\nexport class ResolvedChord {\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly keyLabel: string | null,\n\t\tpublic readonly keyAriaLabel: string | null\n\t) { }\n}\n\nexport type SingleModifierChord = 'ctrl' | 'shift' | 'alt' | 'meta';\n\n/**\n * A resolved keybinding. Consists of one or multiple chords.\n */\nexport abstract class ResolvedKeybinding {\n\t/**\n\t * This prints the binding in a format suitable for displaying in the UI.\n\t */\n\tpublic abstract getLabel(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for ARIA.\n\t */\n\tpublic abstract getAriaLabel(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for electron's accelerators.\n\t * See https://github.com/electron/electron/blob/master/docs/api/accelerator.md\n\t */\n\tpublic abstract getElectronAccelerator(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for user settings.\n\t */\n\tpublic abstract getUserSettingsLabel(): string | null;\n\t/**\n\t * Is the user settings label reflecting the label?\n\t */\n\tpublic abstract isWYSIWYG(): boolean;\n\t/**\n\t * Does the keybinding consist of more than one chord?\n\t */\n\tpublic abstract hasMultipleChords(): boolean;\n\t/**\n\t * Returns the chords that comprise of the keybinding.\n\t */\n\tpublic abstract getChords(): ResolvedChord[];\n\t/**\n\t * Returns the chords as strings useful for dispatching.\n\t * Returns null for modifier only chords.\n\t * @example keybinding \"Shift\" -> null\n\t * @example keybinding (\"D\" with shift == true) -> \"shift+D\"\n\t */\n\tpublic abstract getDispatchChords(): (string | null)[];\n\t/**\n\t * Returns the modifier only chords as strings useful for dispatching.\n\t * Returns null for chords that contain more than one modifier or a regular key.\n\t * @example keybinding \"Shift\" -> \"shift\"\n\t * @example keybinding (\"D\" with shift == true\") -> null\n\t */\n\tpublic abstract getSingleModifierDispatchChords(): (SingleModifierChord | null)[];\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { EVENT_KEY_CODE_MAP, KeyCode, KeyCodeUtils, KeyMod } from 'vs/base/common/keyCodes';\nimport { KeyCodeChord } from 'vs/base/common/keybindings';\nimport * as platform from 'vs/base/common/platform';\n\n\n\nfunction extractKeyCode(e: KeyboardEvent): KeyCode {\n\tif (e.charCode) {\n\t\t// \"keypress\" events mostly\n\t\tconst char = String.fromCharCode(e.charCode).toUpperCase();\n\t\treturn KeyCodeUtils.fromString(char);\n\t}\n\n\tconst keyCode = e.keyCode;\n\n\t// browser quirks\n\tif (keyCode === 3) {\n\t\treturn KeyCode.PauseBreak;\n\t} else if (browser.isFirefox) {\n\t\tswitch (keyCode) {\n\t\t\tcase 59: return KeyCode.Semicolon;\n\t\t\tcase 60:\n\t\t\t\tif (platform.isLinux) { return KeyCode.IntlBackslash; }\n\t\t\t\tbreak;\n\t\t\tcase 61: return KeyCode.Equal;\n\t\t\t// based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys\n\t\t\tcase 107: return KeyCode.NumpadAdd;\n\t\t\tcase 109: return KeyCode.NumpadSubtract;\n\t\t\tcase 173: return KeyCode.Minus;\n\t\t\tcase 224:\n\t\t\t\tif (platform.isMacintosh) { return KeyCode.Meta; }\n\t\t\t\tbreak;\n\t\t}\n\t} else if (browser.isWebKit) {\n\t\tif (platform.isMacintosh && keyCode === 93) {\n\t\t\t// the two meta keys in the Mac have different key codes (91 and 93)\n\t\t\treturn KeyCode.Meta;\n\t\t} else if (!platform.isMacintosh && keyCode === 92) {\n\t\t\treturn KeyCode.Meta;\n\t\t}\n\t}\n\n\t// cross browser keycodes:\n\treturn EVENT_KEY_CODE_MAP[keyCode] || KeyCode.Unknown;\n}\n\nexport interface IKeyboardEvent {\n\n\treadonly _standardKeyboardEventBrand: true;\n\n\treadonly browserEvent: KeyboardEvent;\n\treadonly target: HTMLElement;\n\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n\treadonly altGraphKey: boolean;\n\treadonly keyCode: KeyCode;\n\treadonly code: string;\n\n\t/**\n\t * @internal\n\t */\n\ttoKeyCodeChord(): KeyCodeChord;\n\tequals(keybinding: number): boolean;\n\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nconst ctrlKeyMod = (platform.isMacintosh ? KeyMod.WinCtrl : KeyMod.CtrlCmd);\nconst altKeyMod = KeyMod.Alt;\nconst shiftKeyMod = KeyMod.Shift;\nconst metaKeyMod = (platform.isMacintosh ? KeyMod.CtrlCmd : KeyMod.WinCtrl);\n\nexport function printKeyboardEvent(e: KeyboardEvent): string {\n\tconst modifiers: string[] = [];\n\tif (e.ctrlKey) {\n\t\tmodifiers.push(`ctrl`);\n\t}\n\tif (e.shiftKey) {\n\t\tmodifiers.push(`shift`);\n\t}\n\tif (e.altKey) {\n\t\tmodifiers.push(`alt`);\n\t}\n\tif (e.metaKey) {\n\t\tmodifiers.push(`meta`);\n\t}\n\treturn `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`;\n}\n\nexport function printStandardKeyboardEvent(e: StandardKeyboardEvent): string {\n\tconst modifiers: string[] = [];\n\tif (e.ctrlKey) {\n\t\tmodifiers.push(`ctrl`);\n\t}\n\tif (e.shiftKey) {\n\t\tmodifiers.push(`shift`);\n\t}\n\tif (e.altKey) {\n\t\tmodifiers.push(`alt`);\n\t}\n\tif (e.metaKey) {\n\t\tmodifiers.push(`meta`);\n\t}\n\treturn `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${KeyCodeUtils.toString(e.keyCode)}')`;\n}\n\nexport class StandardKeyboardEvent implements IKeyboardEvent {\n\n\treadonly _standardKeyboardEventBrand = true;\n\n\tpublic readonly browserEvent: KeyboardEvent;\n\tpublic readonly target: HTMLElement;\n\n\tpublic readonly ctrlKey: boolean;\n\tpublic readonly shiftKey: boolean;\n\tpublic readonly altKey: boolean;\n\tpublic readonly metaKey: boolean;\n\tpublic readonly altGraphKey: boolean;\n\tpublic readonly keyCode: KeyCode;\n\tpublic readonly code: string;\n\n\tprivate _asKeybinding: number;\n\tprivate _asKeyCodeChord: KeyCodeChord;\n\n\tconstructor(source: KeyboardEvent) {\n\t\tconst e = source;\n\n\t\tthis.browserEvent = e;\n\t\tthis.target = e.target;\n\n\t\tthis.ctrlKey = e.ctrlKey;\n\t\tthis.shiftKey = e.shiftKey;\n\t\tthis.altKey = e.altKey;\n\t\tthis.metaKey = e.metaKey;\n\t\tthis.altGraphKey = e.getModifierState?.('AltGraph');\n\t\tthis.keyCode = extractKeyCode(e);\n\t\tthis.code = e.code;\n\n\t\t// console.info(e.type + \": keyCode: \" + e.keyCode + \", which: \" + e.which + \", charCode: \" + e.charCode + \", detail: \" + e.detail + \" ====> \" + this.keyCode + ' -- ' + KeyCode[this.keyCode]);\n\n\t\tthis.ctrlKey = this.ctrlKey || this.keyCode === KeyCode.Ctrl;\n\t\tthis.altKey = this.altKey || this.keyCode === KeyCode.Alt;\n\t\tthis.shiftKey = this.shiftKey || this.keyCode === KeyCode.Shift;\n\t\tthis.metaKey = this.metaKey || this.keyCode === KeyCode.Meta;\n\n\t\tthis._asKeybinding = this._computeKeybinding();\n\t\tthis._asKeyCodeChord = this._computeKeyCodeChord();\n\n\t\t// console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);\n\t}\n\n\tpublic preventDefault(): void {\n\t\tif (this.browserEvent && this.browserEvent.preventDefault) {\n\t\t\tthis.browserEvent.preventDefault();\n\t\t}\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tif (this.browserEvent && this.browserEvent.stopPropagation) {\n\t\t\tthis.browserEvent.stopPropagation();\n\t\t}\n\t}\n\n\tpublic toKeyCodeChord(): KeyCodeChord {\n\t\treturn this._asKeyCodeChord;\n\t}\n\n\tpublic equals(other: number): boolean {\n\t\treturn this._asKeybinding === other;\n\t}\n\n\tprivate _computeKeybinding(): number {\n\t\tlet key = KeyCode.Unknown;\n\t\tif (this.keyCode !== KeyCode.Ctrl && this.keyCode !== KeyCode.Shift && this.keyCode !== KeyCode.Alt && this.keyCode !== KeyCode.Meta) {\n\t\t\tkey = this.keyCode;\n\t\t}\n\n\t\tlet result = 0;\n\t\tif (this.ctrlKey) {\n\t\t\tresult |= ctrlKeyMod;\n\t\t}\n\t\tif (this.altKey) {\n\t\t\tresult |= altKeyMod;\n\t\t}\n\t\tif (this.shiftKey) {\n\t\t\tresult |= shiftKeyMod;\n\t\t}\n\t\tif (this.metaKey) {\n\t\t\tresult |= metaKeyMod;\n\t\t}\n\t\tresult |= key;\n\n\t\treturn result;\n\t}\n\n\tprivate _computeKeyCodeChord(): KeyCodeChord {\n\t\tlet key = KeyCode.Unknown;\n\t\tif (this.keyCode !== KeyCode.Ctrl && this.keyCode !== KeyCode.Shift && this.keyCode !== KeyCode.Alt && this.keyCode !== KeyCode.Meta) {\n\t\t\tkey = this.keyCode;\n\t\t}\n\t\treturn new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Represents a window in a possible chain of iframes\n */\ninterface IWindowChainElement {\n\t/**\n\t * The window object for it\n\t */\n\treadonly window: WeakRef;\n\t/**\n\t * The iframe element inside the window.parent corresponding to window\n\t */\n\treadonly iframeElement: Element | null;\n}\n\nconst sameOriginWindowChainCache = new WeakMap();\n\nfunction getParentWindowIfSameOrigin(w: Window): Window | null {\n\tif (!w.parent || w.parent === w) {\n\t\treturn null;\n\t}\n\n\t// Cannot really tell if we have access to the parent window unless we try to access something in it\n\ttry {\n\t\tconst location = w.location;\n\t\tconst parentLocation = w.parent.location;\n\t\tif (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) {\n\t\t\treturn null;\n\t\t}\n\t} catch (e) {\n\t\treturn null;\n\t}\n\n\treturn w.parent;\n}\n\nexport class IframeUtils {\n\n\t/**\n\t * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).\n\t * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.\n\t */\n\tprivate static getSameOriginWindowChain(targetWindow: Window): IWindowChainElement[] {\n\t\tlet windowChainCache = sameOriginWindowChainCache.get(targetWindow);\n\t\tif (!windowChainCache) {\n\t\t\twindowChainCache = [];\n\t\t\tsameOriginWindowChainCache.set(targetWindow, windowChainCache);\n\t\t\tlet w: Window | null = targetWindow;\n\t\t\tlet parent: Window | null;\n\t\t\tdo {\n\t\t\t\tparent = getParentWindowIfSameOrigin(w);\n\t\t\t\tif (parent) {\n\t\t\t\t\twindowChainCache.push({\n\t\t\t\t\t\twindow: new WeakRef(w),\n\t\t\t\t\t\tiframeElement: w.frameElement || null\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twindowChainCache.push({\n\t\t\t\t\t\twindow: new WeakRef(w),\n\t\t\t\t\t\tiframeElement: null\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tw = parent;\n\t\t\t} while (w);\n\t\t}\n\t\treturn windowChainCache.slice(0);\n\t}\n\n\t/**\n\t * Returns the position of `childWindow` relative to `ancestorWindow`\n\t */\n\tpublic static getPositionOfChildWindowRelativeToAncestorWindow(childWindow: Window, ancestorWindow: Window | null) {\n\n\t\tif (!ancestorWindow || childWindow === ancestorWindow) {\n\t\t\treturn {\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0\n\t\t\t};\n\t\t}\n\n\t\tlet top = 0, left = 0;\n\n\t\tconst windowChain = this.getSameOriginWindowChain(childWindow);\n\n\t\tfor (const windowChainEl of windowChain) {\n\t\t\tconst windowInChain = windowChainEl.window.deref();\n\t\t\ttop += windowInChain?.scrollY ?? 0;\n\t\t\tleft += windowInChain?.scrollX ?? 0;\n\n\t\t\tif (windowInChain === ancestorWindow) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!windowChainEl.iframeElement) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst boundingRect = windowChainEl.iframeElement.getBoundingClientRect();\n\t\t\ttop += boundingRect.top;\n\t\t\tleft += boundingRect.left;\n\t\t}\n\n\t\treturn {\n\t\t\ttop: top,\n\t\t\tleft: left\n\t\t};\n\t}\n}\n\n/**\n * Returns a sha-256 composed of `parentOrigin` and `salt` converted to base 32\n */\nexport async function parentOriginHash(parentOrigin: string, salt: string): Promise {\n\t// This same code is also inlined at `src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html`\n\tif (!crypto.subtle) {\n\t\tthrow new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);\n\t}\n\n\tconst strData = JSON.stringify({ parentOrigin, salt });\n\tconst encoder = new TextEncoder();\n\tconst arrData = encoder.encode(strData);\n\tconst hash = await crypto.subtle.digest('sha-256', arrData);\n\treturn sha256AsBase32(hash);\n}\n\nfunction sha256AsBase32(bytes: ArrayBuffer): string {\n\tconst array = Array.from(new Uint8Array(bytes));\n\tconst hexArray = array.map(b => b.toString(16).padStart(2, '0')).join('');\n\t// sha256 has 256 bits, so we need at most ceil(lg(2^256-1)/lg(32)) = 52 chars to represent it in base 32\n\treturn BigInt(`0x${hexArray}`).toString(32).padStart(52, '0');\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { IframeUtils } from 'vs/base/browser/iframe';\nimport * as platform from 'vs/base/common/platform';\n\nexport interface IMouseEvent {\n\treadonly browserEvent: MouseEvent;\n\treadonly leftButton: boolean;\n\treadonly middleButton: boolean;\n\treadonly rightButton: boolean;\n\treadonly buttons: number;\n\treadonly target: HTMLElement;\n\treadonly detail: number;\n\treadonly posx: number;\n\treadonly posy: number;\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n\treadonly timestamp: number;\n\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport class StandardMouseEvent implements IMouseEvent {\n\n\tpublic readonly browserEvent: MouseEvent;\n\n\tpublic readonly leftButton: boolean;\n\tpublic readonly middleButton: boolean;\n\tpublic readonly rightButton: boolean;\n\tpublic readonly buttons: number;\n\tpublic readonly target: HTMLElement;\n\tpublic detail: number;\n\tpublic readonly posx: number;\n\tpublic readonly posy: number;\n\tpublic readonly ctrlKey: boolean;\n\tpublic readonly shiftKey: boolean;\n\tpublic readonly altKey: boolean;\n\tpublic readonly metaKey: boolean;\n\tpublic readonly timestamp: number;\n\n\tconstructor(targetWindow: Window, e: MouseEvent) {\n\t\tthis.timestamp = Date.now();\n\t\tthis.browserEvent = e;\n\t\tthis.leftButton = e.button === 0;\n\t\tthis.middleButton = e.button === 1;\n\t\tthis.rightButton = e.button === 2;\n\t\tthis.buttons = e.buttons;\n\n\t\tthis.target = e.target;\n\n\t\tthis.detail = e.detail || 1;\n\t\tif (e.type === 'dblclick') {\n\t\t\tthis.detail = 2;\n\t\t}\n\t\tthis.ctrlKey = e.ctrlKey;\n\t\tthis.shiftKey = e.shiftKey;\n\t\tthis.altKey = e.altKey;\n\t\tthis.metaKey = e.metaKey;\n\n\t\tif (typeof e.pageX === 'number') {\n\t\t\tthis.posx = e.pageX;\n\t\t\tthis.posy = e.pageY;\n\t\t} else {\n\t\t\t// Probably hit by MSGestureEvent\n\t\t\tthis.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;\n\t\t\tthis.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;\n\t\t}\n\n\t\t// Find the position of the iframe this code is executing in relative to the iframe where the event was captured.\n\t\tconst iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);\n\t\tthis.posx -= iframeOffsets.left;\n\t\tthis.posy -= iframeOffsets.top;\n\t}\n\n\tpublic preventDefault(): void {\n\t\tthis.browserEvent.preventDefault();\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tthis.browserEvent.stopPropagation();\n\t}\n}\n\nexport class DragMouseEvent extends StandardMouseEvent {\n\n\tpublic readonly dataTransfer: DataTransfer;\n\n\tconstructor(targetWindow: Window, e: MouseEvent) {\n\t\tsuper(targetWindow, e);\n\t\tthis.dataTransfer = (e).dataTransfer;\n\t}\n}\n\nexport interface IMouseWheelEvent extends MouseEvent {\n\treadonly wheelDelta: number;\n\treadonly wheelDeltaX: number;\n\treadonly wheelDeltaY: number;\n\n\treadonly deltaX: number;\n\treadonly deltaY: number;\n\treadonly deltaZ: number;\n\treadonly deltaMode: number;\n}\n\ninterface IWebKitMouseWheelEvent {\n\twheelDeltaY: number;\n\twheelDeltaX: number;\n}\n\ninterface IGeckoMouseWheelEvent {\n\tHORIZONTAL_AXIS: number;\n\tVERTICAL_AXIS: number;\n\taxis: number;\n\tdetail: number;\n}\n\nexport class StandardWheelEvent {\n\n\tpublic readonly browserEvent: IMouseWheelEvent | null;\n\tpublic readonly deltaY: number;\n\tpublic readonly deltaX: number;\n\tpublic readonly target: Node;\n\n\tconstructor(e: IMouseWheelEvent | null, deltaX: number = 0, deltaY: number = 0) {\n\n\t\tthis.browserEvent = e || null;\n\t\tthis.target = e ? (e.target || (e).targetNode || e.srcElement) : null;\n\n\t\tthis.deltaY = deltaY;\n\t\tthis.deltaX = deltaX;\n\n\t\tlet shouldFactorDPR: boolean = false;\n\t\tif (browser.isChrome) {\n\t\t\t// Chrome version >= 123 contains the fix to factor devicePixelRatio into the wheel event.\n\t\t\t// See https://chromium.googlesource.com/chromium/src.git/+/be51b448441ff0c9d1f17e0f25c4bf1ab3f11f61\n\t\t\tconst chromeVersionMatch = navigator.userAgent.match(/Chrome\\/(\\d+)/);\n\t\t\tconst chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;\n\t\t\tshouldFactorDPR = chromeMajorVersion <= 122;\n\t\t}\n\n\t\tif (e) {\n\t\t\t// Old (deprecated) wheel events\n\t\t\tconst e1 = e;\n\t\t\tconst e2 = e;\n\t\t\tconst devicePixelRatio = e.view?.devicePixelRatio || 1;\n\n\t\t\t// vertical delta scroll\n\t\t\tif (typeof e1.wheelDeltaY !== 'undefined') {\n\t\t\t\tif (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = e1.wheelDeltaY / 120;\n\t\t\t\t}\n\t\t\t} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {\n\t\t\t\tthis.deltaY = -e2.detail / 3;\n\t\t\t} else if (e.type === 'wheel') {\n\t\t\t\t// Modern wheel event\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n\t\t\t\tconst ev = e;\n\n\t\t\t\tif (ev.deltaMode === ev.DOM_DELTA_LINE) {\n\t\t\t\t\t// the deltas are expressed in lines\n\t\t\t\t\tif (browser.isFirefox && !platform.isMacintosh) {\n\t\t\t\t\t\tthis.deltaY = -e.deltaY / 3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.deltaY = -e.deltaY;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = -e.deltaY / 40;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// horizontal delta scroll\n\t\t\tif (typeof e1.wheelDeltaX !== 'undefined') {\n\t\t\t\tif (browser.isSafari && platform.isWindows) {\n\t\t\t\t\tthis.deltaX = - (e1.wheelDeltaX / 120);\n\t\t\t\t} else if (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaX = e1.wheelDeltaX / 120;\n\t\t\t\t}\n\t\t\t} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {\n\t\t\t\tthis.deltaX = -e.detail / 3;\n\t\t\t} else if (e.type === 'wheel') {\n\t\t\t\t// Modern wheel event\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n\t\t\t\tconst ev = e;\n\n\t\t\t\tif (ev.deltaMode === ev.DOM_DELTA_LINE) {\n\t\t\t\t\t// the deltas are expressed in lines\n\t\t\t\t\tif (browser.isFirefox && !platform.isMacintosh) {\n\t\t\t\t\t\tthis.deltaX = -e.deltaX / 3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.deltaX = -e.deltaX;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaX = -e.deltaX / 40;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Assume a vertical scroll if nothing else worked\n\t\t\tif (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {\n\t\t\t\tif (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaY = e.wheelDelta / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = e.wheelDelta / 120;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic preventDefault(): void {\n\t\tthis.browserEvent?.preventDefault();\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tthis.browserEvent?.stopPropagation();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Can be passed into the Delayed to defer using a microtask\n * */\nexport const MicrotaskDelay = Symbol('MicrotaskDelay');\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';\nimport { BugIndicatingError, CancellationError } from 'vs/base/common/errors';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { setTimeout0 } from 'vs/base/common/platform';\nimport { MicrotaskDelay } from './symbols';\nimport { Lazy } from 'vs/base/common/lazy';\n\nexport function isThenable(obj: unknown): obj is Promise {\n\treturn !!obj && typeof (obj as unknown as Promise).then === 'function';\n}\n\nexport interface CancelablePromise extends Promise {\n\tcancel(): void;\n}\n\nexport function createCancelablePromise(callback: (token: CancellationToken) => Promise): CancelablePromise {\n\tconst source = new CancellationTokenSource();\n\n\tconst thenable = callback(source.token);\n\tconst promise = new Promise((resolve, reject) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tsubscription.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tPromise.resolve(thenable).then(value => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\tresolve(value);\n\t\t}, err => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\treject(err);\n\t\t});\n\t});\n\n\treturn >new class {\n\t\tcancel() {\n\t\t\tsource.cancel();\n\t\t\tsource.dispose();\n\t\t}\n\t\tthen(resolve?: ((value: T) => TResult1 | Promise) | undefined | null, reject?: ((reason: any) => TResult2 | Promise) | undefined | null): Promise {\n\t\t\treturn promise.then(resolve, reject);\n\t\t}\n\t\tcatch(reject?: ((reason: any) => TResult | Promise) | undefined | null): Promise {\n\t\t\treturn this.then(undefined, reject);\n\t\t}\n\t\tfinally(onfinally?: (() => void) | undefined | null): Promise {\n\t\t\treturn promise.finally(onfinally);\n\t\t}\n\t};\n}\n\n/**\n * Returns a promise that resolves with `undefined` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation(promise: Promise, token: CancellationToken): Promise;\n\n/**\n * Returns a promise that resolves with `defaultValue` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation(promise: Promise, token: CancellationToken, defaultValue: T): Promise;\n\nexport function raceCancellation(promise: Promise, token: CancellationToken, defaultValue?: T): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\tresolve(defaultValue);\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled.\n * @see {@link raceCancellation}\n */\nexport function raceCancellationError(promise: Promise, token: CancellationToken): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Returns as soon as one of the promises resolves or rejects and cancels remaining promises\n */\nexport async function raceCancellablePromises(cancellablePromises: CancelablePromise[]): Promise {\n\tlet resolvedPromiseIndex = -1;\n\tconst promises = cancellablePromises.map((promise, index) => promise.then(result => { resolvedPromiseIndex = index; return result; }));\n\ttry {\n\t\tconst result = await Promise.race(promises);\n\t\treturn result;\n\t} finally {\n\t\tcancellablePromises.forEach((cancellablePromise, index) => {\n\t\t\tif (index !== resolvedPromiseIndex) {\n\t\t\t\tcancellablePromise.cancel();\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function raceTimeout(promise: Promise, timeout: number, onTimeout?: () => void): Promise {\n\tlet promiseResolve: ((value: T | undefined) => void) | undefined = undefined;\n\n\tconst timer = setTimeout(() => {\n\t\tpromiseResolve?.(undefined);\n\t\tonTimeout?.();\n\t}, timeout);\n\n\treturn Promise.race([\n\t\tpromise.finally(() => clearTimeout(timer)),\n\t\tnew Promise(resolve => promiseResolve = resolve)\n\t]);\n}\n\nexport function asPromise(callback: () => T | Thenable): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst item = callback();\n\t\tif (isThenable(item)) {\n\t\t\titem.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(item);\n\t\t}\n\t});\n}\n\n/**\n * Creates and returns a new promise, plus its `resolve` and `reject` callbacks.\n *\n * Replace with standardized [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) once it is supported\n */\nexport function promiseWithResolvers(): { promise: Promise; resolve: (value: T | PromiseLike) => void; reject: (err?: any) => void } {\n\tlet resolve: (value: T | PromiseLike) => void;\n\tlet reject: (reason?: any) => void;\n\tconst promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\treturn { promise, resolve: resolve!, reject: reject! };\n}\n\nexport interface ITask {\n\t(): T;\n}\n\n/**\n * A helper to prevent accumulation of sequential async tasks.\n *\n * Imagine a mail man with the sole task of delivering letters. As soon as\n * a letter submitted for delivery, he drives to the destination, delivers it\n * and returns to his base. Imagine that during the trip, N more letters were submitted.\n * When the mail man returns, he picks those N letters and delivers them all in a\n * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.\n *\n * The throttler implements this via the queue() method, by providing it a task\n * factory. Following the example:\n *\n * \t\tconst throttler = new Throttler();\n * \t\tconst letters = [];\n *\n * \t\tfunction deliver() {\n * \t\t\tconst lettersToDeliver = letters;\n * \t\t\tletters = [];\n * \t\t\treturn makeTheTrip(lettersToDeliver);\n * \t\t}\n *\n * \t\tfunction onLetterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tthrottler.queue(deliver);\n * \t\t}\n */\nexport class Throttler implements IDisposable {\n\n\tprivate activePromise: Promise | null;\n\tprivate queuedPromise: Promise | null;\n\tprivate queuedPromiseFactory: ITask> | null;\n\n\tprivate isDisposed = false;\n\n\tconstructor() {\n\t\tthis.activePromise = null;\n\t\tthis.queuedPromise = null;\n\t\tthis.queuedPromiseFactory = null;\n\t}\n\n\tqueue(promiseFactory: ITask>): Promise {\n\t\tif (this.isDisposed) {\n\t\t\treturn Promise.reject(new Error('Throttler is disposed'));\n\t\t}\n\n\t\tif (this.activePromise) {\n\t\t\tthis.queuedPromiseFactory = promiseFactory;\n\n\t\t\tif (!this.queuedPromise) {\n\t\t\t\tconst onComplete = () => {\n\t\t\t\t\tthis.queuedPromise = null;\n\n\t\t\t\t\tif (this.isDisposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = this.queue(this.queuedPromiseFactory!);\n\t\t\t\t\tthis.queuedPromiseFactory = null;\n\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\n\t\t\t\tthis.queuedPromise = new Promise(resolve => {\n\t\t\t\t\tthis.activePromise!.then(onComplete, onComplete).then(resolve);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tthis.queuedPromise!.then(resolve, reject);\n\t\t\t});\n\t\t}\n\n\t\tthis.activePromise = promiseFactory();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.activePromise!.then((result: T) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\tresolve(result);\n\t\t\t}, (err: unknown) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\treject(err);\n\t\t\t});\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class Sequencer {\n\n\tprivate current: Promise = Promise.resolve(null);\n\n\tqueue(promiseTask: ITask>): Promise {\n\t\treturn this.current = this.current.then(() => promiseTask(), () => promiseTask());\n\t}\n}\n\nexport class SequencerByKey {\n\n\tprivate promiseMap = new Map>();\n\n\tqueue(key: TKey, promiseTask: ITask>): Promise {\n\t\tconst runningPromise = this.promiseMap.get(key) ?? Promise.resolve();\n\t\tconst newPromise = runningPromise\n\t\t\t.catch(() => { })\n\t\t\t.then(promiseTask)\n\t\t\t.finally(() => {\n\t\t\t\tif (this.promiseMap.get(key) === newPromise) {\n\t\t\t\t\tthis.promiseMap.delete(key);\n\t\t\t\t}\n\t\t\t});\n\t\tthis.promiseMap.set(key, newPromise);\n\t\treturn newPromise;\n\t}\n}\n\ninterface IScheduledLater extends IDisposable {\n\tisTriggered(): boolean;\n}\n\nconst timeoutDeferred = (timeout: number, fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tconst handle = setTimeout(() => {\n\t\tscheduled = false;\n\t\tfn();\n\t}, timeout);\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => {\n\t\t\tclearTimeout(handle);\n\t\t\tscheduled = false;\n\t\t},\n\t};\n};\n\nconst microtaskDeferred = (fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tqueueMicrotask(() => {\n\t\tif (scheduled) {\n\t\t\tscheduled = false;\n\t\t\tfn();\n\t\t}\n\t});\n\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => { scheduled = false; },\n\t};\n};\n\n/**\n * A helper to delay (debounce) execution of a task that is being requested often.\n *\n * Following the throttler, now imagine the mail man wants to optimize the number of\n * trips proactively. The trip itself can be long, so he decides not to make the trip\n * as soon as a letter is submitted. Instead he waits a while, in case more\n * letters are submitted. After said waiting period, if no letters were submitted, he\n * decides to make the trip. Imagine that N more letters were submitted after the first\n * one, all within a short period of time between each other. Even though N+1\n * submissions occurred, only 1 delivery was made.\n *\n * The delayer offers this behavior via the trigger() method, into which both the task\n * to be executed and the waiting period (delay) must be passed in as arguments. Following\n * the example:\n *\n * \t\tconst delayer = new Delayer(WAITING_PERIOD);\n * \t\tconst letters = [];\n *\n * \t\tfunction letterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tdelayer.trigger(() => { return makeTheTrip(); });\n * \t\t}\n */\nexport class Delayer implements IDisposable {\n\n\tprivate deferred: IScheduledLater | null;\n\tprivate completionPromise: Promise | null;\n\tprivate doResolve: ((value?: any | Promise) => void) | null;\n\tprivate doReject: ((err: any) => void) | null;\n\tprivate task: ITask> | null;\n\n\tconstructor(public defaultDelay: number | typeof MicrotaskDelay) {\n\t\tthis.deferred = null;\n\t\tthis.completionPromise = null;\n\t\tthis.doResolve = null;\n\t\tthis.doReject = null;\n\t\tthis.task = null;\n\t}\n\n\ttrigger(task: ITask>, delay = this.defaultDelay): Promise {\n\t\tthis.task = task;\n\t\tthis.cancelTimeout();\n\n\t\tif (!this.completionPromise) {\n\t\t\tthis.completionPromise = new Promise((resolve, reject) => {\n\t\t\t\tthis.doResolve = resolve;\n\t\t\t\tthis.doReject = reject;\n\t\t\t}).then(() => {\n\t\t\t\tthis.completionPromise = null;\n\t\t\t\tthis.doResolve = null;\n\t\t\t\tif (this.task) {\n\t\t\t\t\tconst task = this.task;\n\t\t\t\t\tthis.task = null;\n\t\t\t\t\treturn task();\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t}\n\n\t\tconst fn = () => {\n\t\t\tthis.deferred = null;\n\t\t\tthis.doResolve?.(null);\n\t\t};\n\n\t\tthis.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);\n\n\t\treturn this.completionPromise;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn !!this.deferred?.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.cancelTimeout();\n\n\t\tif (this.completionPromise) {\n\t\t\tthis.doReject?.(new CancellationError());\n\t\t\tthis.completionPromise = null;\n\t\t}\n\t}\n\n\tprivate cancelTimeout(): void {\n\t\tthis.deferred?.dispose();\n\t\tthis.deferred = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t}\n}\n\n/**\n * A helper to delay execution of a task that is being requested often, while\n * preventing accumulation of consecutive executions, while the task runs.\n *\n * The mail man is clever and waits for a certain amount of time, before going\n * out to deliver letters. While the mail man is going out, more letters arrive\n * and can only be delivered once he is back. Once he is back the mail man will\n * do one more trip to deliver the letters that have accumulated while he was out.\n */\nexport class ThrottledDelayer {\n\n\tprivate delayer: Delayer>;\n\tprivate throttler: Throttler;\n\n\tconstructor(defaultDelay: number) {\n\t\tthis.delayer = new Delayer(defaultDelay);\n\t\tthis.throttler = new Throttler();\n\t}\n\n\ttrigger(promiseFactory: ITask>, delay?: number): Promise {\n\t\treturn this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay) as unknown as Promise;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn this.delayer.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.delayer.cancel();\n\t}\n\n\tdispose(): void {\n\t\tthis.delayer.dispose();\n\t\tthis.throttler.dispose();\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently.\n */\nexport class Barrier {\n\tprivate _isOpen: boolean;\n\tprivate _promise: Promise;\n\tprivate _completePromise!: (v: boolean) => void;\n\n\tconstructor() {\n\t\tthis._isOpen = false;\n\t\tthis._promise = new Promise((c, e) => {\n\t\t\tthis._completePromise = c;\n\t\t});\n\t}\n\n\tisOpen(): boolean {\n\t\treturn this._isOpen;\n\t}\n\n\topen(): void {\n\t\tthis._isOpen = true;\n\t\tthis._completePromise(true);\n\t}\n\n\twait(): Promise {\n\t\treturn this._promise;\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently after a certain period of\n * time or when open is called explicitly\n */\nexport class AutoOpenBarrier extends Barrier {\n\n\tprivate readonly _timeout: any;\n\n\tconstructor(autoOpenTimeMs: number) {\n\t\tsuper();\n\t\tthis._timeout = setTimeout(() => this.open(), autoOpenTimeMs);\n\t}\n\n\toverride open(): void {\n\t\tclearTimeout(this._timeout);\n\t\tsuper.open();\n\t}\n}\n\nexport function timeout(millis: number): CancelablePromise;\nexport function timeout(millis: number, token: CancellationToken): Promise;\nexport function timeout(millis: number, token?: CancellationToken): CancelablePromise | Promise {\n\tif (!token) {\n\t\treturn createCancelablePromise(token => timeout(millis, token));\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst handle = setTimeout(() => {\n\t\t\tdisposable.dispose();\n\t\t\tresolve();\n\t\t}, millis);\n\t\tconst disposable = token.onCancellationRequested(() => {\n\t\t\tclearTimeout(handle);\n\t\t\tdisposable.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t});\n}\n\n/**\n * Creates a timeout that can be disposed using its returned value.\n * @param handler The timeout handler.\n * @param timeout An optional timeout in milliseconds.\n * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.\n *\n * @example\n * const store = new DisposableStore;\n * // Call the timeout after 1000ms at which point it will be automatically\n * // evicted from the store.\n * const timeoutDisposable = disposableTimeout(() => {}, 1000, store);\n *\n * if (foo) {\n * // Cancel the timeout and evict it from store.\n * timeoutDisposable.dispose();\n * }\n */\nexport function disposableTimeout(handler: () => void, timeout = 0, store?: DisposableStore): IDisposable {\n\tconst timer = setTimeout(() => {\n\t\thandler();\n\t\tif (store) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t}, timeout);\n\tconst disposable = toDisposable(() => {\n\t\tclearTimeout(timer);\n\t\tstore?.deleteAndLeak(disposable);\n\t});\n\tstore?.add(disposable);\n\treturn disposable;\n}\n\n/**\n * Runs the provided list of promise factories in sequential order. The returned\n * promise will complete to an array of results from each promise.\n */\n\nexport function sequence(promiseFactories: ITask>[]): Promise {\n\tconst results: T[] = [];\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tfunction next(): Promise | null {\n\t\treturn index < len ? promiseFactories[index++]() : null;\n\t}\n\n\tfunction thenHandler(result: any): Promise {\n\t\tif (result !== undefined && result !== null) {\n\t\t\tresults.push(result);\n\t\t}\n\n\t\tconst n = next();\n\t\tif (n) {\n\t\t\treturn n.then(thenHandler);\n\t\t}\n\n\t\treturn Promise.resolve(results);\n\t}\n\n\treturn Promise.resolve(null).then(thenHandler);\n}\n\nexport function first(promiseFactories: ITask>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null): Promise {\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tconst loop: () => Promise = () => {\n\t\tif (index >= len) {\n\t\t\treturn Promise.resolve(defaultValue);\n\t\t}\n\n\t\tconst factory = promiseFactories[index++];\n\t\tconst promise = Promise.resolve(factory());\n\n\t\treturn promise.then(result => {\n\t\t\tif (shouldStop(result)) {\n\t\t\t\treturn Promise.resolve(result);\n\t\t\t}\n\n\t\t\treturn loop();\n\t\t});\n\t};\n\n\treturn loop();\n}\n\n/**\n * Returns the result of the first promise that matches the \"shouldStop\",\n * running all promises in parallel. Supports cancelable promises.\n */\nexport function firstParallel(promiseList: Promise[], shouldStop?: (t: T) => boolean, defaultValue?: T | null): Promise;\nexport function firstParallel(promiseList: Promise[], shouldStop: (t: T) => t is R, defaultValue?: R | null): Promise;\nexport function firstParallel(promiseList: Promise[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null) {\n\tif (promiseList.length === 0) {\n\t\treturn Promise.resolve(defaultValue);\n\t}\n\n\tlet todo = promiseList.length;\n\tconst finish = () => {\n\t\ttodo = -1;\n\t\tfor (const promise of promiseList) {\n\t\t\t(promise as Partial>).cancel?.();\n\t\t}\n\t};\n\n\treturn new Promise((resolve, reject) => {\n\t\tfor (const promise of promiseList) {\n\t\t\tpromise.then(result => {\n\t\t\t\tif (--todo >= 0 && shouldStop(result)) {\n\t\t\t\t\tfinish();\n\t\t\t\t\tresolve(result);\n\t\t\t\t} else if (todo === 0) {\n\t\t\t\t\tresolve(defaultValue);\n\t\t\t\t}\n\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\tif (--todo >= 0) {\n\t\t\t\t\t\tfinish();\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\t});\n}\n\ninterface ILimitedTaskFactory {\n\tfactory: ITask>;\n\tc: (value: T | Promise) => void;\n\te: (error?: unknown) => void;\n}\n\nexport interface ILimiter {\n\n\treadonly size: number;\n\n\tqueue(factory: ITask>): Promise;\n\n\tclear(): void;\n}\n\n/**\n * A helper to queue N promises and run them all with a max degree of parallelism. The helper\n * ensures that at any time no more than M promises are running at the same time.\n */\nexport class Limiter implements ILimiter {\n\n\tprivate _size = 0;\n\tprivate _isDisposed = false;\n\tprivate runningPromises: number;\n\tprivate readonly maxDegreeOfParalellism: number;\n\tprivate readonly outstandingPromises: ILimitedTaskFactory[];\n\tprivate readonly _onDrained: Emitter;\n\n\tconstructor(maxDegreeOfParalellism: number) {\n\t\tthis.maxDegreeOfParalellism = maxDegreeOfParalellism;\n\t\tthis.outstandingPromises = [];\n\t\tthis.runningPromises = 0;\n\t\tthis._onDrained = new Emitter();\n\t}\n\n\t/**\n\t *\n\t * @returns A promise that resolved when all work is done (onDrained) or when\n\t * there is nothing to do\n\t */\n\twhenIdle(): Promise {\n\t\treturn this.size > 0\n\t\t\t? Event.toPromise(this.onDrained)\n\t\t\t: Promise.resolve();\n\t}\n\n\tget onDrained(): Event {\n\t\treturn this._onDrained.event;\n\t}\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tqueue(factory: ITask>): Promise {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis._size++;\n\n\t\treturn new Promise((c, e) => {\n\t\t\tthis.outstandingPromises.push({ factory, c, e });\n\t\t\tthis.consume();\n\t\t});\n\t}\n\n\tprivate consume(): void {\n\t\twhile (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {\n\t\t\tconst iLimitedTask = this.outstandingPromises.shift()!;\n\t\t\tthis.runningPromises++;\n\n\t\t\tconst promise = iLimitedTask.factory();\n\t\t\tpromise.then(iLimitedTask.c, iLimitedTask.e);\n\t\t\tpromise.then(() => this.consumed(), () => this.consumed());\n\t\t}\n\t}\n\n\tprivate consumed(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.runningPromises--;\n\t\tif (--this._size === 0) {\n\t\t\tthis._onDrained.fire();\n\t\t}\n\n\t\tif (this.outstandingPromises.length > 0) {\n\t\t\tthis.consume();\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis.outstandingPromises.length = 0;\n\t\tthis._size = this.runningPromises;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tthis.outstandingPromises.length = 0; // stop further processing\n\t\tthis._size = 0;\n\t\tthis._onDrained.dispose();\n\t}\n}\n\n/**\n * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.\n */\nexport class Queue extends Limiter {\n\n\tconstructor() {\n\t\tsuper(1);\n\t}\n}\n\n/**\n * Same as `Queue`, ensures that only 1 task is executed at the same time. The difference to `Queue` is that\n * there is only 1 task about to be scheduled next. As such, calling `queue` while a task is executing will\n * replace the currently queued task until it executes.\n *\n * As such, the returned promise may not be from the factory that is passed in but from the next factory that\n * is running after having called `queue`.\n */\nexport class LimitedQueue {\n\n\tprivate readonly sequentializer = new TaskSequentializer();\n\n\tprivate tasks = 0;\n\n\tqueue(factory: ITask>): Promise {\n\t\tif (!this.sequentializer.isRunning()) {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t}\n\n\t\treturn this.sequentializer.queue(() => {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t});\n\t}\n}\n\nexport class TimeoutTimer implements IDisposable {\n\tprivate _token: any;\n\tprivate _isDisposed = false;\n\n\tconstructor();\n\tconstructor(runner: () => void, timeout: number);\n\tconstructor(runner?: () => void, timeout?: number) {\n\t\tthis._token = -1;\n\n\t\tif (typeof runner === 'function' && typeof timeout === 'number') {\n\t\t\tthis.setIfNotSet(runner, timeout);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis._isDisposed = true;\n\t}\n\n\tcancel(): void {\n\t\tif (this._token !== -1) {\n\t\t\tclearTimeout(this._token);\n\t\t\tthis._token = -1;\n\t\t}\n\t}\n\n\tcancelAndSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = -1;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n\n\tsetIfNotSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tif (this._token !== -1) {\n\t\t\t// timer is already set\n\t\t\treturn;\n\t\t}\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = -1;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n}\n\nexport class IntervalTimer implements IDisposable {\n\n\tprivate disposable: IDisposable | undefined = undefined;\n\tprivate isDisposed = false;\n\n\tcancel(): void {\n\t\tthis.disposable?.dispose();\n\t\tthis.disposable = undefined;\n\t}\n\n\tcancelAndSet(runner: () => void, interval: number, context = globalThis): void {\n\t\tif (this.isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tconst handle = context.setInterval(() => {\n\t\t\trunner();\n\t\t}, interval);\n\n\t\tthis.disposable = toDisposable(() => {\n\t\t\tcontext.clearInterval(handle);\n\t\t\tthis.disposable = undefined;\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class RunOnceScheduler implements IDisposable {\n\n\tprotected runner: ((...args: unknown[]) => void) | null;\n\n\tprivate timeoutToken: any;\n\tprivate timeout: number;\n\tprivate timeoutHandler: () => void;\n\n\tconstructor(runner: (...args: any[]) => void, delay: number) {\n\t\tthis.timeoutToken = -1;\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.timeoutHandler = this.onTimeout.bind(this);\n\t}\n\n\t/**\n\t * Dispose RunOnceScheduler\n\t */\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\t/**\n\t * Cancel current scheduled runner (if any).\n\t */\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearTimeout(this.timeoutToken);\n\t\t\tthis.timeoutToken = -1;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tthis.cancel();\n\t\tthis.timeoutToken = setTimeout(this.timeoutHandler, delay);\n\t}\n\n\tget delay(): number {\n\t\treturn this.timeout;\n\t}\n\n\tset delay(value: number) {\n\t\tthis.timeout = value;\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.timeoutToken !== -1;\n\t}\n\n\tflush(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tthis.cancel();\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprivate onTimeout() {\n\t\tthis.timeoutToken = -1;\n\t\tif (this.runner) {\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprotected doRun(): void {\n\t\tthis.runner?.();\n\t}\n}\n\n/**\n * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.\n * > **NOTE**: Only offers 1s resolution.\n *\n * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep\n * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But\n * this scheduler will execute 3hrs **after waking the computer from sleep**.\n */\nexport class ProcessTimeRunOnceScheduler {\n\n\tprivate runner: (() => void) | null;\n\tprivate timeout: number;\n\n\tprivate counter: number;\n\tprivate intervalToken: any;\n\tprivate intervalHandler: () => void;\n\n\tconstructor(runner: () => void, delay: number) {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.counter = 0;\n\t\tthis.intervalToken = -1;\n\t\tthis.intervalHandler = this.onInterval.bind(this);\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearInterval(this.intervalToken);\n\t\t\tthis.intervalToken = -1;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.cancel();\n\t\tthis.counter = Math.ceil(delay / 1000);\n\t\tthis.intervalToken = setInterval(this.intervalHandler, 1000);\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.intervalToken !== -1;\n\t}\n\n\tprivate onInterval() {\n\t\tthis.counter--;\n\t\tif (this.counter > 0) {\n\t\t\t// still need to wait\n\t\t\treturn;\n\t\t}\n\n\t\t// time elapsed\n\t\tclearInterval(this.intervalToken);\n\t\tthis.intervalToken = -1;\n\t\tthis.runner?.();\n\t}\n}\n\nexport class RunOnceWorker extends RunOnceScheduler {\n\n\tprivate units: T[] = [];\n\n\tconstructor(runner: (units: T[]) => void, timeout: number) {\n\t\tsuper(runner, timeout);\n\t}\n\n\twork(unit: T): void {\n\t\tthis.units.push(unit);\n\n\t\tif (!this.isScheduled()) {\n\t\t\tthis.schedule();\n\t\t}\n\t}\n\n\tprotected override doRun(): void {\n\t\tconst units = this.units;\n\t\tthis.units = [];\n\n\t\tthis.runner?.(units);\n\t}\n\n\toverride dispose(): void {\n\t\tthis.units = [];\n\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IThrottledWorkerOptions {\n\n\t/**\n\t * maximum of units the worker will pass onto handler at once\n\t */\n\tmaxWorkChunkSize: number;\n\n\t/**\n\t * maximum of units the worker will keep in memory for processing\n\t */\n\tmaxBufferedWork: number | undefined;\n\n\t/**\n\t * delay before processing the next round of chunks when chunk size exceeds limits\n\t */\n\tthrottleDelay: number;\n}\n\n/**\n * The `ThrottledWorker` will accept units of work `T`\n * to handle. The contract is:\n * * there is a maximum of units the worker can handle at once (via `maxWorkChunkSize`)\n * * there is a maximum of units the worker will keep in memory for processing (via `maxBufferedWork`)\n * * after having handled `maxWorkChunkSize` units, the worker needs to rest (via `throttleDelay`)\n */\nexport class ThrottledWorker extends Disposable {\n\n\tprivate readonly pendingWork: T[] = [];\n\n\tprivate readonly throttler = this._register(new MutableDisposable());\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tprivate options: IThrottledWorkerOptions,\n\t\tprivate readonly handler: (units: T[]) => void\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * The number of work units that are pending to be processed.\n\t */\n\tget pending(): number { return this.pendingWork.length; }\n\n\t/**\n\t * Add units to be worked on. Use `pending` to figure out\n\t * how many units are not yet processed after this method\n\t * was called.\n\t *\n\t * @returns whether the work was accepted or not. If the\n\t * worker is disposed, it will not accept any more work.\n\t * If the number of pending units would become larger\n\t * than `maxPendingWork`, more work will also not be accepted.\n\t */\n\twork(units: readonly T[]): boolean {\n\t\tif (this.disposed) {\n\t\t\treturn false; // work not accepted: disposed\n\t\t}\n\n\t\t// Check for reaching maximum of pending work\n\t\tif (typeof this.options.maxBufferedWork === 'number') {\n\n\t\t\t// Throttled: simple check if pending + units exceeds max pending\n\t\t\tif (this.throttler.value) {\n\t\t\t\tif (this.pending + units.length > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Unthrottled: same as throttled, but account for max chunk getting\n\t\t\t// worked on directly without being pending\n\t\t\telse {\n\t\t\t\tif (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add to pending units first\n\t\tfor (const unit of units) {\n\t\t\tthis.pendingWork.push(unit);\n\t\t}\n\n\t\t// If not throttled, start working directly\n\t\t// Otherwise, when the throttle delay has\n\t\t// past, pending work will be worked again.\n\t\tif (!this.throttler.value) {\n\t\t\tthis.doWork();\n\t\t}\n\n\t\treturn true; // work accepted\n\t}\n\n\tprivate doWork(): void {\n\n\t\t// Extract chunk to handle and handle it\n\t\tthis.handler(this.pendingWork.splice(0, this.options.maxWorkChunkSize));\n\n\t\t// If we have remaining work, schedule it after a delay\n\t\tif (this.pendingWork.length > 0) {\n\t\t\tthis.throttler.value = new RunOnceScheduler(() => {\n\t\t\t\tthis.throttler.clear();\n\n\t\t\t\tthis.doWork();\n\t\t\t}, this.options.throttleDelay);\n\t\t\tthis.throttler.value.schedule();\n\t\t}\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\n\t\tthis.disposed = true;\n\t}\n}\n\n//#region -- run on idle tricks ------------\n\nexport interface IdleDeadline {\n\treadonly didTimeout: boolean;\n\ttimeRemaining(): number;\n}\n\ntype IdleApi = Pick;\n\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n *\n * **Note** that there is `dom.ts#runWhenWindowIdle` which is better suited when running inside a browser\n * context\n */\nexport let runWhenGlobalIdle: (callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\nexport let _runWhenIdle: (targetWindow: IdleApi, callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\n(function () {\n\tif (typeof globalThis.requestIdleCallback !== 'function' || typeof globalThis.cancelIdleCallback !== 'function') {\n\t\t_runWhenIdle = (_targetWindow, runner) => {\n\t\t\tsetTimeout0(() => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst end = Date.now() + 15; // one frame at 64fps\n\t\t\t\tconst deadline: IdleDeadline = {\n\t\t\t\t\tdidTimeout: true,\n\t\t\t\t\ttimeRemaining() {\n\t\t\t\t\t\treturn Math.max(0, end - Date.now());\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\trunner(Object.freeze(deadline));\n\t\t\t});\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t} else {\n\t\t_runWhenIdle = (targetWindow: IdleApi, runner, timeout?) => {\n\t\t\tconst handle: number = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t\ttargetWindow.cancelIdleCallback(handle);\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t}\n\trunWhenGlobalIdle = (runner) => _runWhenIdle(globalThis, runner);\n})();\n\nexport abstract class AbstractIdleValue {\n\n\tprivate readonly _executor: () => void;\n\tprivate readonly _handle: IDisposable;\n\n\tprivate _didRun: boolean = false;\n\tprivate _value?: T;\n\tprivate _error: unknown;\n\n\tconstructor(targetWindow: IdleApi, executor: () => T) {\n\t\tthis._executor = () => {\n\t\t\ttry {\n\t\t\t\tthis._value = executor();\n\t\t\t} catch (err) {\n\t\t\t\tthis._error = err;\n\t\t\t} finally {\n\t\t\t\tthis._didRun = true;\n\t\t\t}\n\t\t};\n\t\tthis._handle = _runWhenIdle(targetWindow, () => this._executor());\n\t}\n\n\tdispose(): void {\n\t\tthis._handle.dispose();\n\t}\n\n\tget value(): T {\n\t\tif (!this._didRun) {\n\t\t\tthis._handle.dispose();\n\t\t\tthis._executor();\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n\n\tget isInitialized(): boolean {\n\t\treturn this._didRun;\n\t}\n}\n\n/**\n * An `IdleValue` that always uses the current window (which might be throttled or inactive)\n *\n * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser\n * context\n */\nexport class GlobalIdleValue extends AbstractIdleValue {\n\n\tconstructor(executor: () => T) {\n\t\tsuper(globalThis, executor);\n\t}\n}\n\n//#endregion\n\nexport async function retry(task: ITask>, delay: number, retries: number): Promise {\n\tlet lastError: Error | undefined;\n\n\tfor (let i = 0; i < retries; i++) {\n\t\ttry {\n\t\t\treturn await task();\n\t\t} catch (error) {\n\t\t\tlastError = error;\n\n\t\t\tawait timeout(delay);\n\t\t}\n\t}\n\n\tthrow lastError;\n}\n\n//#region Task Sequentializer\n\ninterface IRunningTask {\n\treadonly taskId: number;\n\treadonly cancel: () => void;\n\treadonly promise: Promise;\n}\n\ninterface IQueuedTask {\n\treadonly promise: Promise;\n\treadonly promiseResolve: () => void;\n\treadonly promiseReject: (error: Error) => void;\n\trun: ITask>;\n}\n\nexport interface ITaskSequentializerWithRunningTask {\n\treadonly running: Promise;\n}\n\nexport interface ITaskSequentializerWithQueuedTask {\n\treadonly queued: IQueuedTask;\n}\n\n/**\n * @deprecated use `LimitedQueue` instead for an easier to use API\n */\nexport class TaskSequentializer {\n\n\tprivate _running?: IRunningTask;\n\tprivate _queued?: IQueuedTask;\n\n\tisRunning(taskId?: number): this is ITaskSequentializerWithRunningTask {\n\t\tif (typeof taskId === 'number') {\n\t\t\treturn this._running?.taskId === taskId;\n\t\t}\n\n\t\treturn !!this._running;\n\t}\n\n\tget running(): Promise | undefined {\n\t\treturn this._running?.promise;\n\t}\n\n\tcancelRunning(): void {\n\t\tthis._running?.cancel();\n\t}\n\n\trun(taskId: number, promise: Promise, onCancel?: () => void,): Promise {\n\t\tthis._running = { taskId, cancel: () => onCancel?.(), promise };\n\n\t\tpromise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));\n\n\t\treturn promise;\n\t}\n\n\tprivate doneRunning(taskId: number): void {\n\t\tif (this._running && taskId === this._running.taskId) {\n\n\t\t\t// only set running to done if the promise finished that is associated with that taskId\n\t\t\tthis._running = undefined;\n\n\t\t\t// schedule the queued task now that we are free if we have any\n\t\t\tthis.runQueued();\n\t\t}\n\t}\n\n\tprivate runQueued(): void {\n\t\tif (this._queued) {\n\t\t\tconst queued = this._queued;\n\t\t\tthis._queued = undefined;\n\n\t\t\t// Run queued task and complete on the associated promise\n\t\t\tqueued.run().then(queued.promiseResolve, queued.promiseReject);\n\t\t}\n\t}\n\n\t/**\n\t * Note: the promise to schedule as next run MUST itself call `run`.\n\t * Otherwise, this sequentializer will report `false` for `isRunning`\n\t * even when this task is running. Missing this detail means that\n\t * suddenly multiple tasks will run in parallel.\n\t */\n\tqueue(run: ITask>): Promise {\n\n\t\t// this is our first queued task, so we create associated promise with it\n\t\t// so that we can return a promise that completes when the task has\n\t\t// completed.\n\t\tif (!this._queued) {\n\t\t\tconst { promise, resolve: promiseResolve, reject: promiseReject } = promiseWithResolvers();\n\t\t\tthis._queued = {\n\t\t\t\trun,\n\t\t\t\tpromise,\n\t\t\t\tpromiseResolve: promiseResolve!,\n\t\t\t\tpromiseReject: promiseReject!\n\t\t\t};\n\t\t}\n\n\t\t// we have a previous queued task, just overwrite it\n\t\telse {\n\t\t\tthis._queued.run = run;\n\t\t}\n\n\t\treturn this._queued.promise;\n\t}\n\n\thasQueued(): this is ITaskSequentializerWithQueuedTask {\n\t\treturn !!this._queued;\n\t}\n\n\tasync join(): Promise {\n\t\treturn this._queued?.promise ?? this._running?.promise;\n\t}\n}\n\n//#endregion\n\n//#region\n\n/**\n * The `IntervalCounter` allows to count the number\n * of calls to `increment()` over a duration of\n * `interval`. This utility can be used to conditionally\n * throttle a frequent task when a certain threshold\n * is reached.\n */\nexport class IntervalCounter {\n\n\tprivate lastIncrementTime = 0;\n\n\tprivate value = 0;\n\n\tconstructor(private readonly interval: number, private readonly nowFn = () => Date.now()) { }\n\n\tincrement(): number {\n\t\tconst now = this.nowFn();\n\n\t\t// We are outside of the range of `interval` and as such\n\t\t// start counting from 0 and remember the time\n\t\tif (now - this.lastIncrementTime > this.interval) {\n\t\t\tthis.lastIncrementTime = now;\n\t\t\tthis.value = 0;\n\t\t}\n\n\t\tthis.value++;\n\n\t\treturn this.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nexport type ValueCallback = (value: T | Promise) => void;\n\nconst enum DeferredOutcome {\n\tResolved,\n\tRejected\n}\n\n/**\n * Creates a promise whose resolution or rejection can be controlled imperatively.\n */\nexport class DeferredPromise {\n\n\tprivate completeCallback!: ValueCallback;\n\tprivate errorCallback!: (err: unknown) => void;\n\tprivate outcome?: { outcome: DeferredOutcome.Rejected; value: any } | { outcome: DeferredOutcome.Resolved; value: T };\n\n\tpublic get isRejected() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Rejected;\n\t}\n\n\tpublic get isResolved() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved;\n\t}\n\n\tpublic get isSettled() {\n\t\treturn !!this.outcome;\n\t}\n\n\tpublic get value() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved ? this.outcome?.value : undefined;\n\t}\n\n\tpublic readonly p: Promise;\n\n\tconstructor() {\n\t\tthis.p = new Promise((c, e) => {\n\t\t\tthis.completeCallback = c;\n\t\t\tthis.errorCallback = e;\n\t\t});\n\t}\n\n\tpublic complete(value: T) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.completeCallback(value);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Resolved, value };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic error(err: unknown) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.errorCallback(err);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Rejected, value: err };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic cancel() {\n\t\treturn this.error(new CancellationError());\n\t}\n}\n\n//#endregion\n\n//#region Promises\n\nexport namespace Promises {\n\n\t/**\n\t * A drop-in replacement for `Promise.all` with the only difference\n\t * that the method awaits every promise to either fulfill or reject.\n\t *\n\t * Similar to `Promise.all`, only the first error will be returned\n\t * if any.\n\t */\n\texport async function settled(promises: Promise[]): Promise {\n\t\tlet firstError: Error | undefined = undefined;\n\n\t\tconst result = await Promise.all(promises.map(promise => promise.then(value => value, error => {\n\t\t\tif (!firstError) {\n\t\t\t\tfirstError = error;\n\t\t\t}\n\n\t\t\treturn undefined; // do not rethrow so that other promises can settle\n\t\t})));\n\n\t\tif (typeof firstError !== 'undefined') {\n\t\t\tthrow firstError;\n\t\t}\n\n\t\treturn result as unknown as T[]; // cast is needed and protected by the `throw` above\n\t}\n\n\t/**\n\t * A helper to create a new `Promise` with a body that is a promise\n\t * itself. By default, an error that raises from the async body will\n\t * end up as a unhandled rejection, so this utility properly awaits the\n\t * body and rejects the promise as a normal promise does without async\n\t * body.\n\t *\n\t * This method should only be used in rare cases where otherwise `async`\n\t * cannot be used (e.g. when callbacks are involved that require this).\n\t */\n\texport function withAsyncBody(bodyFn: (resolve: (value: T) => unknown, reject: (error: E) => unknown) => Promise): Promise {\n\t\t// eslint-disable-next-line no-async-promise-executor\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tawait bodyFn(resolve, reject);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport class StatefulPromise {\n\tprivate _value: T | undefined = undefined;\n\tget value(): T | undefined { return this._value; }\n\n\tprivate _error: unknown = undefined;\n\tget error(): unknown { return this._error; }\n\n\tprivate _isResolved = false;\n\tget isResolved() { return this._isResolved; }\n\n\tpublic readonly promise: Promise;\n\n\tconstructor(promise: Promise) {\n\t\tthis.promise = promise.then(\n\t\t\tvalue => {\n\t\t\t\tthis._value = value;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tthis._error = error;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\tif (!this._isResolved) {\n\t\t\tthrow new BugIndicatingError('Promise is not resolved yet');\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n}\n\nexport class LazyStatefulPromise {\n\tprivate readonly _promise = new Lazy(() => new StatefulPromise(this._compute()));\n\n\tconstructor(\n\t\tprivate readonly _compute: () => Promise,\n\t) { }\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\treturn this._promise.value.requireValue();\n\t}\n\n\t/**\n\t * Returns the promise (and triggers a computation of the promise if not yet done so).\n\t */\n\tpublic getPromise(): Promise {\n\t\treturn this._promise.value.promise;\n\t}\n\n\t/**\n\t * Reads the current value without triggering a computation of the promise.\n\t */\n\tpublic get currentValue(): T | undefined {\n\t\treturn this._promise.rawValue?.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nconst enum AsyncIterableSourceState {\n\tInitial,\n\tDoneOK,\n\tDoneError,\n}\n\n/**\n * An object that allows to emit async values asynchronously or bring the iterable to an error state using `reject()`.\n * This emitter is valid only for the duration of the executor (until the promise returned by the executor settles).\n */\nexport interface AsyncIterableEmitter {\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitOne(value: T): void;\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitMany(values: T[]): void;\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `reject()` have already been called, this method has no effect.\n\t */\n\treject(error: Error): void;\n}\n\n/**\n * An executor for the `AsyncIterableObject` that has access to an emitter.\n */\nexport interface AsyncIterableExecutor {\n\t/**\n\t * @param emitter An object that allows to emit async values valid only for the duration of the executor.\n\t */\n\t(emitter: AsyncIterableEmitter): void | Promise;\n}\n\n/**\n * A rich implementation for an `AsyncIterable`.\n */\nexport class AsyncIterableObject implements AsyncIterable {\n\n\tpublic static fromArray(items: T[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject((writer) => {\n\t\t\twriter.emitMany(items);\n\t\t});\n\t}\n\n\tpublic static fromPromise(promise: Promise): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\temitter.emitMany(await promise);\n\t\t});\n\t}\n\n\tpublic static fromPromises(promises: Promise[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tawait Promise.all(promises.map(async (p) => emitter.emitOne(await p)));\n\t\t});\n\t}\n\n\tpublic static merge(iterables: AsyncIterable[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tawait Promise.all(iterables.map(async (iterable) => {\n\t\t\t\tfor await (const item of iterable) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}));\n\t\t});\n\t}\n\n\tpublic static EMPTY = AsyncIterableObject.fromArray([]);\n\n\tprivate _state: AsyncIterableSourceState;\n\tprivate _results: T[];\n\tprivate _error: Error | null;\n\tprivate readonly _onReturn?: () => void | Promise;\n\tprivate readonly _onStateChanged: Emitter;\n\n\tconstructor(executor: AsyncIterableExecutor, onReturn?: () => void | Promise) {\n\t\tthis._state = AsyncIterableSourceState.Initial;\n\t\tthis._results = [];\n\t\tthis._error = null;\n\t\tthis._onReturn = onReturn;\n\t\tthis._onStateChanged = new Emitter();\n\n\t\tqueueMicrotask(async () => {\n\t\t\tconst writer: AsyncIterableEmitter = {\n\t\t\t\temitOne: (item) => this.emitOne(item),\n\t\t\t\temitMany: (items) => this.emitMany(items),\n\t\t\t\treject: (error) => this.reject(error)\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tawait Promise.resolve(executor(writer));\n\t\t\t\tthis.resolve();\n\t\t\t} catch (err) {\n\t\t\t\tthis.reject(err);\n\t\t\t} finally {\n\t\t\t\twriter.emitOne = undefined!;\n\t\t\t\twriter.emitMany = undefined!;\n\t\t\t\twriter.reject = undefined!;\n\t\t\t}\n\t\t});\n\t}\n\n\t[Symbol.asyncIterator](): AsyncIterator {\n\t\tlet i = 0;\n\t\treturn {\n\t\t\tnext: async () => {\n\t\t\t\tdo {\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneError) {\n\t\t\t\t\t\tthrow this._error;\n\t\t\t\t\t}\n\t\t\t\t\tif (i < this._results.length) {\n\t\t\t\t\t\treturn { done: false, value: this._results[i++] };\n\t\t\t\t\t}\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneOK) {\n\t\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t\t}\n\t\t\t\t\tawait Event.toPromise(this._onStateChanged.event);\n\t\t\t\t} while (true);\n\t\t\t},\n\t\t\treturn: async () => {\n\t\t\t\tthis._onReturn?.();\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic static map(iterable: AsyncIterable, mapFn: (item: T) => R): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\temitter.emitOne(mapFn(item));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic map(mapFn: (item: T) => R): AsyncIterableObject {\n\t\treturn AsyncIterableObject.map(this, mapFn);\n\t}\n\n\tpublic static filter(iterable: AsyncIterable, filterFn: (item: T) => boolean): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\tif (filterFn(item)) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic filter(filterFn: (item: T) => boolean): AsyncIterableObject {\n\t\treturn AsyncIterableObject.filter(this, filterFn);\n\t}\n\n\tpublic static coalesce(iterable: AsyncIterable): AsyncIterableObject {\n\t\treturn >AsyncIterableObject.filter(iterable, item => !!item);\n\t}\n\n\tpublic coalesce(): AsyncIterableObject> {\n\t\treturn AsyncIterableObject.coalesce(this) as AsyncIterableObject>;\n\t}\n\n\tpublic static async toPromise(iterable: AsyncIterable): Promise {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic toPromise(): Promise {\n\t\treturn AsyncIterableObject.toPromise(this);\n\t}\n\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitOne(value: T): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results.push(value);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitMany(values: T[]): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results = this._results.concat(values);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Calling `resolve()` will mark the result array as complete.\n\t *\n\t * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate resolve(): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneOK;\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate reject(error: Error) {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneError;\n\t\tthis._error = error;\n\t\tthis._onStateChanged.fire();\n\t}\n}\n\nexport class CancelableAsyncIterableObject extends AsyncIterableObject {\n\tconstructor(\n\t\tprivate readonly _source: CancellationTokenSource,\n\t\texecutor: AsyncIterableExecutor\n\t) {\n\t\tsuper(executor);\n\t}\n\n\tcancel(): void {\n\t\tthis._source.cancel();\n\t}\n}\n\nexport function createCancelableAsyncIterable(callback: (token: CancellationToken) => AsyncIterable): CancelableAsyncIterableObject {\n\tconst source = new CancellationTokenSource();\n\tconst innerIterable = callback(source.token);\n\n\treturn new CancelableAsyncIterableObject(source, async (emitter) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(new CancellationError());\n\t\t});\n\t\ttry {\n\t\t\tfor await (const item of innerIterable) {\n\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t// canceled in the meantime\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\temitter.emitOne(item);\n\t\t\t}\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t} catch (err) {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(err);\n\t\t}\n\t});\n}\n\nexport class AsyncIterableSource {\n\n\tprivate readonly _deferred = new DeferredPromise();\n\tprivate readonly _asyncIterable: AsyncIterableObject;\n\n\tprivate _errorFn: (error: Error) => void;\n\tprivate _emitFn: (item: T) => void;\n\n\t/**\n\t *\n\t * @param onReturn A function that will be called when consuming the async iterable\n\t * has finished by the consumer, e.g the for-await-loop has be existed (break, return) early.\n\t * This is NOT called when resolving this source by its owner.\n\t */\n\tconstructor(onReturn?: () => Promise | void) {\n\t\tthis._asyncIterable = new AsyncIterableObject(emitter => {\n\n\t\t\tif (earlyError) {\n\t\t\t\temitter.reject(earlyError);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (earlyItems) {\n\t\t\t\temitter.emitMany(earlyItems);\n\t\t\t}\n\t\t\tthis._errorFn = (error: Error) => emitter.reject(error);\n\t\t\tthis._emitFn = (item: T) => emitter.emitOne(item);\n\t\t\treturn this._deferred.p;\n\t\t}, onReturn);\n\n\t\tlet earlyError: Error | undefined;\n\t\tlet earlyItems: T[] | undefined;\n\n\t\tthis._emitFn = (item: T) => {\n\t\t\tif (!earlyItems) {\n\t\t\t\tearlyItems = [];\n\t\t\t}\n\t\t\tearlyItems.push(item);\n\t\t};\n\t\tthis._errorFn = (error: Error) => {\n\t\t\tif (!earlyError) {\n\t\t\t\tearlyError = error;\n\t\t\t}\n\t\t};\n\t}\n\n\tget asyncIterable(): AsyncIterableObject {\n\t\treturn this._asyncIterable;\n\t}\n\n\tresolve(): void {\n\t\tthis._deferred.complete();\n\t}\n\n\treject(error: Error): void {\n\t\tthis._errorFn(error);\n\t\tthis._deferred.complete();\n\t}\n\n\temitOne(item: T): void {\n\t\tthis._emitFn(item);\n\t}\n}\n\n//#endregion\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from 'vs/base/common/charCode';\nimport { Constants } from 'vs/base/common/uint';\n\nexport function isFalsyOrWhitespace(str: string | undefined): boolean {\n\tif (!str || typeof str !== 'string') {\n\t\treturn true;\n\t}\n\treturn str.trim().length === 0;\n}\n\nconst _formatRegexp = /{(\\d+)}/g;\n\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nexport function format(value: string, ...args: any[]): string {\n\tif (args.length === 0) {\n\t\treturn value;\n\t}\n\treturn value.replace(_formatRegexp, function (match, group) {\n\t\tconst idx = parseInt(group, 10);\n\t\treturn isNaN(idx) || idx < 0 || idx >= args.length ?\n\t\t\tmatch :\n\t\t\targs[idx];\n\t});\n}\n\nconst _format2Regexp = /{([^}]+)}/g;\n\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nexport function format2(template: string, values: Record): string {\n\tif (Object.keys(values).length === 0) {\n\t\treturn template;\n\t}\n\treturn template.replace(_format2Regexp, (match, group) => (values[group] ?? match) as string);\n}\n\n/**\n * Encodes the given value so that it can be used as literal value in html attributes.\n *\n * In other words, computes `$val`, such that `attr` in `
` has the runtime value `value`.\n * This prevents XSS injection.\n */\nexport function htmlAttributeEncodeValue(value: string): string {\n\treturn value.replace(/[<>\"'&]/g, ch => {\n\t\tswitch (ch) {\n\t\t\tcase '<': return '<';\n\t\t\tcase '>': return '>';\n\t\t\tcase '\"': return '"';\n\t\t\tcase '\\'': return ''';\n\t\t\tcase '&': return '&';\n\t\t}\n\t\treturn ch;\n\t});\n}\n\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nexport function escape(html: string): string {\n\treturn html.replace(/[<>&]/g, function (match) {\n\t\tswitch (match) {\n\t\t\tcase '<': return '<';\n\t\t\tcase '>': return '>';\n\t\t\tcase '&': return '&';\n\t\t\tdefault: return match;\n\t\t}\n\t});\n}\n\n/**\n * Escapes regular expression characters in a given string\n */\nexport function escapeRegExpCharacters(value: string): string {\n\treturn value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\n\n/**\n * Counts how often `substr` occurs inside `value`.\n */\nexport function count(value: string, substr: string): number {\n\tlet result = 0;\n\tlet index = value.indexOf(substr);\n\twhile (index !== -1) {\n\t\tresult++;\n\t\tindex = value.indexOf(substr, index + substr.length);\n\t}\n\treturn result;\n}\n\nexport function truncate(value: string, maxLength: number, suffix = '\u2026'): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\treturn `${value.substr(0, maxLength)}${suffix}`;\n}\n\nexport function truncateMiddle(value: string, maxLength: number, suffix = '\u2026'): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\tconst prefixLength = Math.ceil(maxLength / 2) - suffix.length / 2;\n\tconst suffixLength = Math.floor(maxLength / 2) - suffix.length / 2;\n\n\treturn `${value.substr(0, prefixLength)}${suffix}${value.substr(value.length - suffixLength)}`;\n}\n\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nexport function trim(haystack: string, needle: string = ' '): string {\n\tconst trimmed = ltrim(haystack, needle);\n\treturn rtrim(trimmed, needle);\n}\n\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function ltrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length;\n\tif (needleLen === 0 || haystack.length === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = 0;\n\n\twhile (haystack.indexOf(needle, offset) === offset) {\n\t\toffset = offset + needleLen;\n\t}\n\treturn haystack.substring(offset);\n}\n\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function rtrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length,\n\t\thaystackLen = haystack.length;\n\n\tif (needleLen === 0 || haystackLen === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = haystackLen,\n\t\tidx = -1;\n\n\twhile (true) {\n\t\tidx = haystack.lastIndexOf(needle, offset - 1);\n\t\tif (idx === -1 || idx + needleLen !== offset) {\n\t\t\tbreak;\n\t\t}\n\t\tif (idx === 0) {\n\t\t\treturn '';\n\t\t}\n\t\toffset = idx;\n\t}\n\n\treturn haystack.substring(0, offset);\n}\n\nexport function convertSimple2RegExpPattern(pattern: string): string {\n\treturn pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\n\nexport function stripWildcards(pattern: string): string {\n\treturn pattern.replace(/\\*/g, '');\n}\n\nexport interface RegExpOptions {\n\tmatchCase?: boolean;\n\twholeWord?: boolean;\n\tmultiline?: boolean;\n\tglobal?: boolean;\n\tunicode?: boolean;\n}\n\nexport function createRegExp(searchString: string, isRegex: boolean, options: RegExpOptions = {}): RegExp {\n\tif (!searchString) {\n\t\tthrow new Error('Cannot create regex from empty string');\n\t}\n\tif (!isRegex) {\n\t\tsearchString = escapeRegExpCharacters(searchString);\n\t}\n\tif (options.wholeWord) {\n\t\tif (!/\\B/.test(searchString.charAt(0))) {\n\t\t\tsearchString = '\\\\b' + searchString;\n\t\t}\n\t\tif (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n\t\t\tsearchString = searchString + '\\\\b';\n\t\t}\n\t}\n\tlet modifiers = '';\n\tif (options.global) {\n\t\tmodifiers += 'g';\n\t}\n\tif (!options.matchCase) {\n\t\tmodifiers += 'i';\n\t}\n\tif (options.multiline) {\n\t\tmodifiers += 'm';\n\t}\n\tif (options.unicode) {\n\t\tmodifiers += 'u';\n\t}\n\n\treturn new RegExp(searchString, modifiers);\n}\n\nexport function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {\n\t// Exit early if it's one of these special cases which are meant to match\n\t// against an empty string\n\tif (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n\t\treturn false;\n\t}\n\n\t// We check against an empty string. If the regular expression doesn't advance\n\t// (e.g. ends in an endless loop) it will match an empty string.\n\tconst match = regexp.exec('');\n\treturn !!(match && regexp.lastIndex === 0);\n}\n\nexport function splitLines(str: string): string[] {\n\treturn str.split(/\\r\\n|\\r|\\n/);\n}\n\nexport function splitLinesIncludeSeparators(str: string): string[] {\n\tconst linesWithSeparators: string[] = [];\n\tconst splitLinesAndSeparators = str.split(/(\\r\\n|\\r|\\n)/);\n\tfor (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) {\n\t\tlinesWithSeparators.push(splitLinesAndSeparators[2 * i] + (splitLinesAndSeparators[2 * i + 1] ?? ''));\n\t}\n\treturn linesWithSeparators;\n}\n\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function firstNonWhitespaceIndex(str: string): number {\n\tfor (let i = 0, len = str.length; i < len; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nexport function getLeadingWhitespace(str: string, start: number = 0, end: number = str.length): string {\n\tfor (let i = start; i < end; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn str.substring(start, i);\n\t\t}\n\t}\n\treturn str.substring(start, end);\n}\n\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function lastNonWhitespaceIndex(str: string, startIndex: number = str.length - 1): number {\n\tfor (let i = startIndex; i >= 0; i--) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Function that works identically to String.prototype.replace, except, the\n * replace function is allowed to be async and return a Promise.\n */\nexport function replaceAsync(str: string, search: RegExp, replacer: (match: string, ...args: any[]) => Promise): Promise {\n\tconst parts: (string | Promise)[] = [];\n\n\tlet last = 0;\n\tfor (const match of str.matchAll(search)) {\n\t\tparts.push(str.slice(last, match.index));\n\t\tif (match.index === undefined) {\n\t\t\tthrow new Error('match.index should be defined');\n\t\t}\n\n\t\tlast = match.index + match[0].length;\n\t\tparts.push(replacer(match[0], ...match.slice(1), match.index, str, match.groups));\n\t}\n\n\tparts.push(str.slice(last));\n\n\treturn Promise.all(parts).then(p => p.join(''));\n}\n\nexport function compare(a: string, b: string): number {\n\tif (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nexport function compareSubstring(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\t\tconst codeA = a.charCodeAt(aStart);\n\t\tconst codeB = b.charCodeAt(bStart);\n\t\tif (codeA < codeB) {\n\t\t\treturn -1;\n\t\t} else if (codeA > codeB) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nexport function compareIgnoreCase(a: string, b: string): number {\n\treturn compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\n}\n\nexport function compareSubstringIgnoreCase(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\n\t\tlet codeA = a.charCodeAt(aStart);\n\t\tlet codeB = b.charCodeAt(bStart);\n\n\t\tif (codeA === codeB) {\n\t\t\t// equal\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (codeA >= 128 || codeB >= 128) {\n\t\t\t// not ASCII letters -> fallback to lower-casing strings\n\t\t\treturn compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\n\t\t}\n\n\t\t// mapper lower-case ascii letter onto upper-case varinats\n\t\t// [97-122] (lower ascii) --> [65-90] (upper ascii)\n\t\tif (isLowerAsciiLetter(codeA)) {\n\t\t\tcodeA -= 32;\n\t\t}\n\t\tif (isLowerAsciiLetter(codeB)) {\n\t\t\tcodeB -= 32;\n\t\t}\n\n\t\t// compare both code points\n\t\tconst diff = codeA - codeB;\n\t\tif (diff === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn diff;\n\t}\n\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\nexport function isAsciiDigit(code: number): boolean {\n\treturn code >= CharCode.Digit0 && code <= CharCode.Digit9;\n}\n\nexport function isLowerAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.a && code <= CharCode.z;\n}\n\nexport function isUpperAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.A && code <= CharCode.Z;\n}\n\nexport function equalsIgnoreCase(a: string, b: string): boolean {\n\treturn a.length === b.length && compareSubstringIgnoreCase(a, b) === 0;\n}\n\nexport function startsWithIgnoreCase(str: string, candidate: string): boolean {\n\tconst candidateLength = candidate.length;\n\tif (candidate.length > str.length) {\n\t\treturn false;\n\t}\n\n\treturn compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;\n}\n\n/**\n * @returns the length of the common prefix of the two strings.\n */\nexport function commonPrefixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(i) !== b.charCodeAt(i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * @returns the length of the common suffix of the two strings.\n */\nexport function commonSuffixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tconst aLastIndex = a.length - 1;\n\tconst bLastIndex = b.length - 1;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isHighSurrogate(charCode: number): boolean {\n\treturn (0xD800 <= charCode && charCode <= 0xDBFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isLowSurrogate(charCode: number): boolean {\n\treturn (0xDC00 <= charCode && charCode <= 0xDFFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function computeCodePoint(highSurrogate: number, lowSurrogate: number): number {\n\treturn ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\n}\n\n/**\n * get the code point that begins at offset `offset`\n */\nexport function getNextCodePoint(str: string, len: number, offset: number): number {\n\tconst charCode = str.charCodeAt(offset);\n\tif (isHighSurrogate(charCode) && offset + 1 < len) {\n\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\tif (isLowSurrogate(nextCharCode)) {\n\t\t\treturn computeCodePoint(charCode, nextCharCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\n/**\n * get the code point that ends right before offset `offset`\n */\nfunction getPrevCodePoint(str: string, offset: number): number {\n\tconst charCode = str.charCodeAt(offset - 1);\n\tif (isLowSurrogate(charCode) && offset > 1) {\n\t\tconst prevCharCode = str.charCodeAt(offset - 2);\n\t\tif (isHighSurrogate(prevCharCode)) {\n\t\t\treturn computeCodePoint(prevCharCode, charCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\nexport class CodePointIterator {\n\n\tprivate readonly _str: string;\n\tprivate readonly _len: number;\n\tprivate _offset: number;\n\n\tpublic get offset(): number {\n\t\treturn this._offset;\n\t}\n\n\tconstructor(str: string, offset: number = 0) {\n\t\tthis._str = str;\n\t\tthis._len = str.length;\n\t\tthis._offset = offset;\n\t}\n\n\tpublic setOffset(offset: number): void {\n\t\tthis._offset = offset;\n\t}\n\n\tpublic prevCodePoint(): number {\n\t\tconst codePoint = getPrevCodePoint(this._str, this._offset);\n\t\tthis._offset -= (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic nextCodePoint(): number {\n\t\tconst codePoint = getNextCodePoint(this._str, this._len, this._offset);\n\t\tthis._offset += (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic eol(): boolean {\n\t\treturn (this._offset >= this._len);\n\t}\n}\n\nexport const noBreakWhitespace = '\\xa0';\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as strings from 'vs/base/common/strings';\n\n/**\n * Return a hash value for an object.\n */\nexport function hash(obj: any): number {\n\treturn doHash(obj, 0);\n}\n\nexport function doHash(obj: any, hashVal: number): number {\n\tswitch (typeof obj) {\n\t\tcase 'object':\n\t\t\tif (obj === null) {\n\t\t\t\treturn numberHash(349, hashVal);\n\t\t\t} else if (Array.isArray(obj)) {\n\t\t\t\treturn arrayHash(obj, hashVal);\n\t\t\t}\n\t\t\treturn objectHash(obj, hashVal);\n\t\tcase 'string':\n\t\t\treturn stringHash(obj, hashVal);\n\t\tcase 'boolean':\n\t\t\treturn booleanHash(obj, hashVal);\n\t\tcase 'number':\n\t\t\treturn numberHash(obj, hashVal);\n\t\tcase 'undefined':\n\t\t\treturn numberHash(937, hashVal);\n\t\tdefault:\n\t\t\treturn numberHash(617, hashVal);\n\t}\n}\n\nexport function numberHash(val: number, initialHashVal: number): number {\n\treturn (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\n}\n\nfunction booleanHash(b: boolean, initialHashVal: number): number {\n\treturn numberHash(b ? 433 : 863, initialHashVal);\n}\n\nexport function stringHash(s: string, hashVal: number) {\n\thashVal = numberHash(149417, hashVal);\n\tfor (let i = 0, length = s.length; i < length; i++) {\n\t\thashVal = numberHash(s.charCodeAt(i), hashVal);\n\t}\n\treturn hashVal;\n}\n\nfunction arrayHash(arr: any[], initialHashVal: number): number {\n\tinitialHashVal = numberHash(104579, initialHashVal);\n\treturn arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\n}\n\nfunction objectHash(obj: any, initialHashVal: number): number {\n\tinitialHashVal = numberHash(181387, initialHashVal);\n\treturn Object.keys(obj).sort().reduce((hashVal, key) => {\n\t\thashVal = stringHash(key, hashVal);\n\t\treturn doHash(obj[key], hashVal);\n\t}, initialHashVal);\n}\n\nexport class Hasher {\n\n\tprivate _value = 0;\n\n\tget value(): number {\n\t\treturn this._value;\n\t}\n\n\thash(obj: any): number {\n\t\tthis._value = doHash(obj, this._value);\n\t\treturn this._value;\n\t}\n}\n\nconst enum SHA1Constant {\n\tBLOCK_SIZE = 64, // 512 / 8\n\tUNICODE_REPLACEMENT = 0xFFFD,\n}\n\nfunction leftRotate(value: number, bits: number, totalBits: number = 32): number {\n\t// delta + bits = totalBits\n\tconst delta = totalBits - bits;\n\n\t// All ones, expect `delta` zeros aligned to the right\n\tconst mask = ~((1 << delta) - 1);\n\n\t// Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\n\treturn ((value << bits) | ((mask & value) >>> delta)) >>> 0;\n}\n\nfunction fill(dest: Uint8Array, index: number = 0, count: number = dest.byteLength, value: number = 0): void {\n\tfor (let i = 0; i < count; i++) {\n\t\tdest[index + i] = value;\n\t}\n}\n\nfunction leftPad(value: string, length: number, char: string = '0'): string {\n\twhile (value.length < length) {\n\t\tvalue = char + value;\n\t}\n\treturn value;\n}\n\nexport function toHexString(buffer: ArrayBuffer): string;\nexport function toHexString(value: number, bitsize?: number): string;\nexport function toHexString(bufferOrValue: ArrayBuffer | number, bitsize: number = 32): string {\n\tif (bufferOrValue instanceof ArrayBuffer) {\n\t\treturn Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\n\t}\n\n\treturn leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\n}\n\n/**\n * A SHA1 implementation that works with strings and does not allocate.\n */\nexport class StringSHA1 {\n\tprivate static _bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\n\n\tprivate _h0 = 0x67452301;\n\tprivate _h1 = 0xEFCDAB89;\n\tprivate _h2 = 0x98BADCFE;\n\tprivate _h3 = 0x10325476;\n\tprivate _h4 = 0xC3D2E1F0;\n\n\tprivate readonly _buff: Uint8Array;\n\tprivate readonly _buffDV: DataView;\n\tprivate _buffLen: number;\n\tprivate _totalLen: number;\n\tprivate _leftoverHighSurrogate: number;\n\tprivate _finished: boolean;\n\n\tconstructor() {\n\t\tthis._buff = new Uint8Array(SHA1Constant.BLOCK_SIZE + 3 /* to fit any utf-8 */);\n\t\tthis._buffDV = new DataView(this._buff.buffer);\n\t\tthis._buffLen = 0;\n\t\tthis._totalLen = 0;\n\t\tthis._leftoverHighSurrogate = 0;\n\t\tthis._finished = false;\n\t}\n\n\tpublic update(str: string): void {\n\t\tconst strLen = str.length;\n\t\tif (strLen === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst buff = this._buff;\n\t\tlet buffLen = this._buffLen;\n\t\tlet leftoverHighSurrogate = this._leftoverHighSurrogate;\n\t\tlet charCode: number;\n\t\tlet offset: number;\n\n\t\tif (leftoverHighSurrogate !== 0) {\n\t\t\tcharCode = leftoverHighSurrogate;\n\t\t\toffset = -1;\n\t\t\tleftoverHighSurrogate = 0;\n\t\t} else {\n\t\t\tcharCode = str.charCodeAt(0);\n\t\t\toffset = 0;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tlet codePoint = charCode;\n\t\t\tif (strings.isHighSurrogate(charCode)) {\n\t\t\t\tif (offset + 1 < strLen) {\n\t\t\t\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\t\t\t\tif (strings.isLowSurrogate(nextCharCode)) {\n\t\t\t\t\t\toffset++;\n\t\t\t\t\t\tcodePoint = strings.computeCodePoint(charCode, nextCharCode);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// illegal => unicode replacement character\n\t\t\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// last character is a surrogate pair\n\t\t\t\t\tleftoverHighSurrogate = charCode;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (strings.isLowSurrogate(charCode)) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t}\n\n\t\t\tbuffLen = this._push(buff, buffLen, codePoint);\n\t\t\toffset++;\n\t\t\tif (offset < strLen) {\n\t\t\t\tcharCode = str.charCodeAt(offset);\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._buffLen = buffLen;\n\t\tthis._leftoverHighSurrogate = leftoverHighSurrogate;\n\t}\n\n\tprivate _push(buff: Uint8Array, buffLen: number, codePoint: number): number {\n\t\tif (codePoint < 0x0080) {\n\t\t\tbuff[buffLen++] = codePoint;\n\t\t} else if (codePoint < 0x0800) {\n\t\t\tbuff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else if (codePoint < 0x10000) {\n\t\t\tbuff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else {\n\t\t\tbuff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t}\n\n\t\tif (buffLen >= SHA1Constant.BLOCK_SIZE) {\n\t\t\tthis._step();\n\t\t\tbuffLen -= SHA1Constant.BLOCK_SIZE;\n\t\t\tthis._totalLen += SHA1Constant.BLOCK_SIZE;\n\t\t\t// take last 3 in case of UTF8 overflow\n\t\t\tbuff[0] = buff[SHA1Constant.BLOCK_SIZE + 0];\n\t\t\tbuff[1] = buff[SHA1Constant.BLOCK_SIZE + 1];\n\t\t\tbuff[2] = buff[SHA1Constant.BLOCK_SIZE + 2];\n\t\t}\n\n\t\treturn buffLen;\n\t}\n\n\tpublic digest(): string {\n\t\tif (!this._finished) {\n\t\t\tthis._finished = true;\n\t\t\tif (this._leftoverHighSurrogate) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tthis._leftoverHighSurrogate = 0;\n\t\t\t\tthis._buffLen = this._push(this._buff, this._buffLen, SHA1Constant.UNICODE_REPLACEMENT);\n\t\t\t}\n\t\t\tthis._totalLen += this._buffLen;\n\t\t\tthis._wrapUp();\n\t\t}\n\n\t\treturn toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\n\t}\n\n\tprivate _wrapUp(): void {\n\t\tthis._buff[this._buffLen++] = 0x80;\n\t\tfill(this._buff, this._buffLen);\n\n\t\tif (this._buffLen > 56) {\n\t\t\tthis._step();\n\t\t\tfill(this._buff);\n\t\t}\n\n\t\t// this will fit because the mantissa can cover up to 52 bits\n\t\tconst ml = 8 * this._totalLen;\n\n\t\tthis._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\n\t\tthis._buffDV.setUint32(60, ml % 4294967296, false);\n\n\t\tthis._step();\n\t}\n\n\tprivate _step(): void {\n\t\tconst bigBlock32 = StringSHA1._bigBlock32;\n\t\tconst data = this._buffDV;\n\n\t\tfor (let j = 0; j < 64 /* 16*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, data.getUint32(j, false), false);\n\t\t}\n\n\t\tfor (let j = 64; j < 320 /* 80*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\n\t\t}\n\n\t\tlet a = this._h0;\n\t\tlet b = this._h1;\n\t\tlet c = this._h2;\n\t\tlet d = this._h3;\n\t\tlet e = this._h4;\n\n\t\tlet f: number, k: number;\n\t\tlet temp: number;\n\n\t\tfor (let j = 0; j < 80; j++) {\n\t\t\tif (j < 20) {\n\t\t\t\tf = (b & c) | ((~b) & d);\n\t\t\t\tk = 0x5A827999;\n\t\t\t} else if (j < 40) {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0x6ED9EBA1;\n\t\t\t} else if (j < 60) {\n\t\t\t\tf = (b & c) | (b & d) | (c & d);\n\t\t\t\tk = 0x8F1BBCDC;\n\t\t\t} else {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0xCA62C1D6;\n\t\t\t}\n\n\t\t\ttemp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\n\t\t\te = d;\n\t\t\td = c;\n\t\t\tc = leftRotate(b, 30);\n\t\t\tb = a;\n\t\t\ta = temp;\n\t\t}\n\n\t\tthis._h0 = (this._h0 + a) & 0xffffffff;\n\t\tthis._h1 = (this._h1 + b) & 0xffffffff;\n\t\tthis._h2 = (this._h2 + c) & 0xffffffff;\n\t\tthis._h3 = (this._h3 + d) & 0xffffffff;\n\t\tthis._h4 = (this._h4 + e) & 0xffffffff;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { BrowserFeatures } from 'vs/base/browser/canIUse';\nimport { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';\nimport { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';\nimport { AbstractIdleValue, IntervalTimer, TimeoutTimer, _runWhenIdle, IdleDeadline } from 'vs/base/common/async';\nimport { onUnexpectedError } from 'vs/base/common/errors';\nimport * as event from 'vs/base/common/event';\nimport { KeyCode } from 'vs/base/common/keyCodes';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport * as platform from 'vs/base/common/platform';\nimport { hash } from 'vs/base/common/hash';\nimport { CodeWindow, ensureCodeWindow, mainWindow } from 'vs/base/browser/window';\nimport { isPointWithinTriangle } from 'vs/base/common/numbers';\n\nexport interface IRegisteredCodeWindow {\n\treadonly window: CodeWindow;\n\treadonly disposables: DisposableStore;\n}\n\n//# region Multi-Window Support Utilities\n\nexport const {\n\tregisterWindow,\n\tgetWindow,\n\tgetDocument,\n\tgetWindows,\n\tgetWindowsCount,\n\tgetWindowId,\n\tgetWindowById,\n\thasWindow,\n\tonDidRegisterWindow,\n\tonWillUnregisterWindow,\n\tonDidUnregisterWindow\n} = (function () {\n\tconst windows = new Map();\n\n\tensureCodeWindow(mainWindow, 1);\n\tconst mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n\twindows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n\n\tconst onDidRegisterWindow = new event.Emitter();\n\tconst onDidUnregisterWindow = new event.Emitter();\n\tconst onWillUnregisterWindow = new event.Emitter();\n\n\tfunction getWindowById(windowId: number): IRegisteredCodeWindow | undefined;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain: true): IRegisteredCodeWindow;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain?: boolean): IRegisteredCodeWindow | undefined {\n\t\tconst window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n\n\t\treturn window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n\t}\n\n\treturn {\n\t\tonDidRegisterWindow: onDidRegisterWindow.event,\n\t\tonWillUnregisterWindow: onWillUnregisterWindow.event,\n\t\tonDidUnregisterWindow: onDidUnregisterWindow.event,\n\t\tregisterWindow(window: CodeWindow): IDisposable {\n\t\t\tif (windows.has(window.vscodeWindowId)) {\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tconst disposables = new DisposableStore();\n\n\t\t\tconst registeredWindow = {\n\t\t\t\twindow,\n\t\t\t\tdisposables: disposables.add(new DisposableStore())\n\t\t\t};\n\t\t\twindows.set(window.vscodeWindowId, registeredWindow);\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\twindows.delete(window.vscodeWindowId);\n\t\t\t\tonDidUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tdisposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n\t\t\t\tonWillUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tonDidRegisterWindow.fire(registeredWindow);\n\n\t\t\treturn disposables;\n\t\t},\n\t\tgetWindows(): Iterable {\n\t\t\treturn windows.values();\n\t\t},\n\t\tgetWindowsCount(): number {\n\t\t\treturn windows.size;\n\t\t},\n\t\tgetWindowId(targetWindow: Window): number {\n\t\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t\t},\n\t\thasWindow(windowId: number): boolean {\n\t\t\treturn windows.has(windowId);\n\t\t},\n\t\tgetWindowById,\n\t\tgetWindow(e: Node | UIEvent | undefined | null): CodeWindow {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\tif (candidateNode?.ownerDocument?.defaultView) {\n\t\t\t\treturn candidateNode.ownerDocument.defaultView.window as CodeWindow;\n\t\t\t}\n\n\t\t\tconst candidateEvent = e as UIEvent | undefined | null;\n\t\t\tif (candidateEvent?.view) {\n\t\t\t\treturn candidateEvent.view.window as CodeWindow;\n\t\t\t}\n\n\t\t\treturn mainWindow;\n\t\t},\n\t\tgetDocument(e: Node | UIEvent | undefined | null): Document {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\treturn getWindow(candidateNode).document;\n\t\t}\n\t};\n})();\n\n//#endregion\n\nexport function clearNode(node: HTMLElement): void {\n\twhile (node.firstChild) {\n\t\tnode.firstChild.remove();\n\t}\n}\n\n\nexport function clearNodeRecursively(domNode: ChildNode) {\n\twhile (domNode.firstChild) {\n\t\tconst element = domNode.firstChild;\n\t\telement.remove();\n\t\tclearNodeRecursively(element);\n\t}\n}\n\n\nclass DomListener implements IDisposable {\n\n\tprivate _handler: (e: any) => void;\n\tprivate _node: EventTarget;\n\tprivate readonly _type: string;\n\tprivate readonly _options: boolean | AddEventListenerOptions;\n\n\tconstructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {\n\t\tthis._node = node;\n\t\tthis._type = type;\n\t\tthis._handler = handler;\n\t\tthis._options = (options || false);\n\t\tthis._node.addEventListener(this._type, this._handler, this._options);\n\t}\n\n\tdispose(): void {\n\t\tif (!this._handler) {\n\t\t\t// Already disposed\n\t\t\treturn;\n\t\t}\n\n\t\tthis._node.removeEventListener(this._type, this._handler, this._options);\n\n\t\t// Prevent leakers from holding on to the dom or handler func\n\t\tthis._node = null!;\n\t\tthis._handler = null!;\n\t}\n}\n\nexport function addDisposableListener(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable {\n\treturn new DomListener(node, type, handler, useCaptureOrOptions);\n}\n\nexport interface IAddStandardDisposableListenerSignature {\n\t(node: HTMLElement, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointerdown', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointermove', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointerup', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\n}\nfunction _wrapAsStandardMouseEvent(targetWindow: Window, handler: (e: IMouseEvent) => void): (e: MouseEvent) => void {\n\treturn function (e: MouseEvent) {\n\t\treturn handler(new StandardMouseEvent(targetWindow, e));\n\t};\n}\nfunction _wrapAsStandardKeyboardEvent(handler: (e: IKeyboardEvent) => void): (e: KeyboardEvent) => void {\n\treturn function (e: KeyboardEvent) {\n\t\treturn handler(new StandardKeyboardEvent(e));\n\t};\n}\nexport const addStandardDisposableListener: IAddStandardDisposableListenerSignature = function addStandardDisposableListener(node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tlet wrapHandler = handler;\n\n\tif (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n\t\twrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\t} else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n\t\twrapHandler = _wrapAsStandardKeyboardEvent(handler);\n\t}\n\n\treturn addDisposableListener(node, type, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseMoveListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseUpListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\n}\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nexport function runWhenWindowIdle(targetWindow: Window | typeof globalThis, callback: (idle: IdleDeadline) => void, timeout?: number): IDisposable {\n\treturn _runWhenIdle(targetWindow, callback, timeout);\n}\n\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue extends AbstractIdleValue {\n\tconstructor(targetWindow: Window | typeof globalThis, executor: () => T) {\n\t\tsuper(targetWindow, executor);\n\t}\n}\n\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n\nexport function disposableWindowInterval(targetWindow: Window, handler: () => void | boolean /* stop interval */ | Promise, interval: number, iterations?: number): IDisposable {\n\tlet iteration = 0;\n\tconst timer = targetWindow.setInterval(() => {\n\t\titeration++;\n\t\tif ((typeof iterations === 'number' && iteration >= iterations) || handler() === true) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t}, interval);\n\tconst disposable = toDisposable(() => {\n\t\ttargetWindow.clearInterval(timer);\n\t});\n\treturn disposable;\n}\n\nexport class WindowIntervalTimer extends IntervalTimer {\n\n\tprivate readonly defaultTarget?: Window & typeof globalThis;\n\n\t/**\n\t *\n\t * @param node The optional node from which the target window is determined\n\t */\n\tconstructor(node?: Node) {\n\t\tsuper();\n\t\tthis.defaultTarget = node && getWindow(node);\n\t}\n\n\toverride cancelAndSet(runner: () => void, interval: number, targetWindow?: Window & typeof globalThis): void {\n\t\treturn super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n\t}\n}\n\nclass AnimationFrameQueueItem implements IDisposable {\n\n\tprivate _runner: () => void;\n\tpublic priority: number;\n\tprivate _canceled: boolean;\n\n\tconstructor(runner: () => void, priority: number = 0) {\n\t\tthis._runner = runner;\n\t\tthis.priority = priority;\n\t\tthis._canceled = false;\n\t}\n\n\tdispose(): void {\n\t\tthis._canceled = true;\n\t}\n\n\texecute(): void {\n\t\tif (this._canceled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis._runner();\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t}\n\n\t// Sort by priority (largest to lowest)\n\tstatic sort(a: AnimationFrameQueueItem, b: AnimationFrameQueueItem): number {\n\t\treturn b.priority - a.priority;\n\t}\n}\n\n(function () {\n\t/**\n\t * The runners scheduled at the next animation frame\n\t */\n\tconst NEXT_QUEUE = new Map();\n\t/**\n\t * The runners scheduled at the current animation frame\n\t */\n\tconst CURRENT_QUEUE = new Map();\n\t/**\n\t * A flag to keep track if the native requestAnimationFrame was already called\n\t */\n\tconst animFrameRequested = new Map();\n\t/**\n\t * A flag to indicate if currently handling a native requestAnimationFrame callback\n\t */\n\tconst inAnimationFrameRunner = new Map();\n\n\tconst animationFrameRunner = (targetWindowId: number) => {\n\t\tanimFrameRequested.set(targetWindowId, false);\n\n\t\tconst currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\tNEXT_QUEUE.set(targetWindowId, []);\n\n\t\tinAnimationFrameRunner.set(targetWindowId, true);\n\t\twhile (currentQueue.length > 0) {\n\t\t\tcurrentQueue.sort(AnimationFrameQueueItem.sort);\n\t\t\tconst top = currentQueue.shift()!;\n\t\t\ttop.execute();\n\t\t}\n\t\tinAnimationFrameRunner.set(targetWindowId, false);\n\t};\n\n\tscheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority: number = 0) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\n\t\tlet nextQueue = NEXT_QUEUE.get(targetWindowId);\n\t\tif (!nextQueue) {\n\t\t\tnextQueue = [];\n\t\t\tNEXT_QUEUE.set(targetWindowId, nextQueue);\n\t\t}\n\t\tnextQueue.push(item);\n\n\t\tif (!animFrameRequested.get(targetWindowId)) {\n\t\t\tanimFrameRequested.set(targetWindowId, true);\n\t\t\ttargetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n\t\t}\n\n\t\treturn item;\n\t};\n\n\trunAtThisOrScheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority?: number) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tif (inAnimationFrameRunner.get(targetWindowId)) {\n\t\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\t\t\tlet currentQueue = CURRENT_QUEUE.get(targetWindowId);\n\t\t\tif (!currentQueue) {\n\t\t\t\tcurrentQueue = [];\n\t\t\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\t\t}\n\t\t\tcurrentQueue.push(item);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n\t\t}\n\t};\n})();\n\nexport function measure(targetWindow: Window, callback: () => void): IDisposable {\n\treturn scheduleAtNextAnimationFrame(targetWindow, callback, 10000 /* must be early */);\n}\n\nexport function modify(targetWindow: Window, callback: () => void): IDisposable {\n\treturn scheduleAtNextAnimationFrame(targetWindow, callback, -10000 /* must be late */);\n}\n\n/**\n * Add a throttled listener. `handler` is fired at most every 8.33333ms or with the next animation frame (if browser supports it).\n */\nexport interface IEventMerger {\n\t(lastEvent: R | null, currentEvent: E): R;\n}\n\nconst MINIMUM_TIME_MS = 8;\nconst DEFAULT_EVENT_MERGER: IEventMerger = function (lastEvent: Event | null, currentEvent: Event) {\n\treturn currentEvent;\n};\n\nclass TimeoutThrottledDomListener extends Disposable {\n\n\tconstructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) {\n\t\tsuper();\n\n\t\tlet lastEvent: R | null = null;\n\t\tlet lastHandlerTime = 0;\n\t\tconst timeout = this._register(new TimeoutTimer());\n\n\t\tconst invokeHandler = () => {\n\t\t\tlastHandlerTime = (new Date()).getTime();\n\t\t\thandler(lastEvent);\n\t\t\tlastEvent = null;\n\t\t};\n\n\t\tthis._register(addDisposableListener(node, type, (e) => {\n\n\t\t\tlastEvent = eventMerger(lastEvent, e);\n\t\t\tconst elapsedTime = (new Date()).getTime() - lastHandlerTime;\n\n\t\t\tif (elapsedTime >= minimumTimeMs) {\n\t\t\t\ttimeout.cancel();\n\t\t\t\tinvokeHandler();\n\t\t\t} else {\n\t\t\t\ttimeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);\n\t\t\t}\n\t\t}));\n\t}\n}\n\nexport function addDisposableThrottledListener(node: any, type: string, handler: (event: R) => void, eventMerger?: IEventMerger, minimumTimeMs?: number): IDisposable {\n\treturn new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);\n}\n\nexport function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {\n\treturn getWindow(el).getComputedStyle(el, null);\n}\n\nexport function getClientArea(element: HTMLElement, fallback?: HTMLElement): Dimension {\n\tconst elWindow = getWindow(element);\n\tconst elDocument = elWindow.document;\n\n\t// Try with DOM clientWidth / clientHeight\n\tif (element !== elDocument.body) {\n\t\treturn new Dimension(element.clientWidth, element.clientHeight);\n\t}\n\n\t// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n\tif (platform.isIOS && elWindow?.visualViewport) {\n\t\treturn new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n\t}\n\n\t// Try innerWidth / innerHeight\n\tif (elWindow?.innerWidth && elWindow.innerHeight) {\n\t\treturn new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n\t}\n\n\t// Try with document.body.clientWidth / document.body.clientHeight\n\tif (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n\t\treturn new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n\t}\n\n\t// Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n\tif (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n\t\treturn new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n\t}\n\n\tif (fallback) {\n\t\treturn getClientArea(fallback);\n\t}\n\n\tthrow new Error('Unable to figure out browser width and height');\n}\n\nclass SizeUtils {\n\t// Adapted from WinJS\n\t// Converts a CSS positioning string for the specified element to pixels.\n\tprivate static convertToPixels(element: HTMLElement, value: string): number {\n\t\treturn parseFloat(value) || 0;\n\t}\n\n\tprivate static getDimension(element: HTMLElement, cssPropertyName: string, jsPropertyName: string): number {\n\t\tconst computedStyle = getComputedStyle(element);\n\t\tconst value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n\t\treturn SizeUtils.convertToPixels(element, value);\n\t}\n\n\tstatic getBorderLeftWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');\n\t}\n\tstatic getBorderRightWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');\n\t}\n\tstatic getBorderTopWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');\n\t}\n\tstatic getBorderBottomWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');\n\t}\n\n\tstatic getPaddingLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');\n\t}\n\tstatic getPaddingRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-right', 'paddingRight');\n\t}\n\tstatic getPaddingTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-top', 'paddingTop');\n\t}\n\tstatic getPaddingBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');\n\t}\n\n\tstatic getMarginLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-left', 'marginLeft');\n\t}\n\tstatic getMarginTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-top', 'marginTop');\n\t}\n\tstatic getMarginRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-right', 'marginRight');\n\t}\n\tstatic getMarginBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');\n\t}\n}\n\n// ----------------------------------------------------------------------------------------\n// Position & Dimension\n\nexport interface IDimension {\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport class Dimension implements IDimension {\n\n\tstatic readonly None = new Dimension(0, 0);\n\n\tconstructor(\n\t\treadonly width: number,\n\t\treadonly height: number,\n\t) { }\n\n\twith(width: number = this.width, height: number = this.height): Dimension {\n\t\tif (width !== this.width || height !== this.height) {\n\t\t\treturn new Dimension(width, height);\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tstatic is(obj: unknown): obj is IDimension {\n\t\treturn typeof obj === 'object' && typeof (obj).height === 'number' && typeof (obj).width === 'number';\n\t}\n\n\tstatic lift(obj: IDimension): Dimension {\n\t\tif (obj instanceof Dimension) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\treturn new Dimension(obj.width, obj.height);\n\t\t}\n\t}\n\n\tstatic equals(a: Dimension | undefined, b: Dimension | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.width === b.width && a.height === b.height;\n\t}\n}\n\nexport interface IDomPosition {\n\treadonly left: number;\n\treadonly top: number;\n}\n\nexport function getTopLeftOffset(element: HTMLElement): IDomPosition {\n\t// Adapted from WinJS.Utilities.getPosition\n\t// and added borders to the mix\n\n\tlet offsetParent = element.offsetParent;\n\tlet top = element.offsetTop;\n\tlet left = element.offsetLeft;\n\n\twhile (\n\t\t(element = element.parentNode) !== null\n\t\t&& element !== element.ownerDocument.body\n\t\t&& element !== element.ownerDocument.documentElement\n\t) {\n\t\ttop -= element.scrollTop;\n\t\tconst c = isShadowRoot(element) ? null : getComputedStyle(element);\n\t\tif (c) {\n\t\t\tleft -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n\t\t}\n\n\t\tif (element === offsetParent) {\n\t\t\tleft += SizeUtils.getBorderLeftWidth(element);\n\t\t\ttop += SizeUtils.getBorderTopWidth(element);\n\t\t\ttop += element.offsetTop;\n\t\t\tleft += element.offsetLeft;\n\t\t\toffsetParent = element.offsetParent;\n\t\t}\n\t}\n\n\treturn {\n\t\tleft: left,\n\t\ttop: top\n\t};\n}\n\nexport interface IDomNodePagePosition {\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n}\n\nexport function size(element: HTMLElement, width: number | null, height: number | null): void {\n\tif (typeof width === 'number') {\n\t\telement.style.width = `${width}px`;\n\t}\n\n\tif (typeof height === 'number') {\n\t\telement.style.height = `${height}px`;\n\t}\n}\n\nexport function position(element: HTMLElement, top: number, right?: number, bottom?: number, left?: number, position: string = 'absolute'): void {\n\tif (typeof top === 'number') {\n\t\telement.style.top = `${top}px`;\n\t}\n\n\tif (typeof right === 'number') {\n\t\telement.style.right = `${right}px`;\n\t}\n\n\tif (typeof bottom === 'number') {\n\t\telement.style.bottom = `${bottom}px`;\n\t}\n\n\tif (typeof left === 'number') {\n\t\telement.style.left = `${left}px`;\n\t}\n\n\telement.style.position = position;\n}\n\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition {\n\tconst bb = domNode.getBoundingClientRect();\n\tconst window = getWindow(domNode);\n\treturn {\n\t\tleft: bb.left + window.scrollX,\n\t\ttop: bb.top + window.scrollY,\n\t\twidth: bb.width,\n\t\theight: bb.height\n\t};\n}\n\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode: HTMLElement): number {\n\tlet testElement: HTMLElement | null = domNode;\n\tlet zoom = 1.0;\n\tdo {\n\t\tconst elementZoomLevel = (getComputedStyle(testElement) as any).zoom;\n\t\tif (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n\t\t\tzoom *= elementZoomLevel;\n\t\t}\n\n\t\ttestElement = testElement.parentElement;\n\t} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n\n\treturn zoom;\n}\n\n\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.offsetWidth + margin;\n}\n\nexport function getContentWidth(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n\tconst padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n\treturn element.offsetWidth - border - padding;\n}\n\nexport function getTotalScrollWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.scrollWidth + margin;\n}\n\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n\tconst padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n\treturn element.offsetHeight - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n\treturn element.offsetHeight + margin;\n}\n\n// Gets the left coordinate of the specified element relative to the specified parent.\nfunction getRelativeLeft(element: HTMLElement, parent: HTMLElement): number {\n\tif (element === null) {\n\t\treturn 0;\n\t}\n\n\tconst elementPosition = getTopLeftOffset(element);\n\tconst parentPosition = getTopLeftOffset(parent);\n\treturn elementPosition.left - parentPosition.left;\n}\n\nexport function getLargestChildWidth(parent: HTMLElement, children: HTMLElement[]): number {\n\tconst childWidths = children.map((child) => {\n\t\treturn Math.max(getTotalScrollWidth(child), getTotalWidth(child)) + getRelativeLeft(child, parent) || 0;\n\t});\n\tconst maxWidth = Math.max(...childWidths);\n\treturn maxWidth;\n}\n\n// ----------------------------------------------------------------------------------------\n\nexport function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean {\n\treturn Boolean(testAncestor?.contains(testChild));\n}\n\nconst parentFlowToDataKey = 'parentFlowToElementId';\n\n/**\n * Set an explicit parent to use for nodes that are not part of the\n * regular dom structure.\n */\nexport function setParentFlowTo(fromChildElement: HTMLElement, toParentElement: Element): void {\n\tfromChildElement.dataset[parentFlowToDataKey] = toParentElement.id;\n}\n\nfunction getParentFlowToElement(node: HTMLElement): HTMLElement | null {\n\tconst flowToParentId = node.dataset[parentFlowToDataKey];\n\tif (typeof flowToParentId === 'string') {\n\t\treturn node.ownerDocument.getElementById(flowToParentId);\n\t}\n\treturn null;\n}\n\n/**\n * Check if `testAncestor` is an ancestor of `testChild`, observing the explicit\n * parents set by `setParentFlowTo`.\n */\nexport function isAncestorUsingFlowTo(testChild: Node, testAncestor: Node): boolean {\n\tlet node: Node | null = testChild;\n\twhile (node) {\n\t\tif (node === testAncestor) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (isHTMLElement(node)) {\n\t\t\tconst flowToParentElement = getParentFlowToElement(node);\n\t\t\tif (flowToParentElement) {\n\t\t\t\tnode = flowToParentElement;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n\n\treturn false;\n}\n\nexport function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (node.classList.contains(clazz)) {\n\t\t\treturn node;\n\t\t}\n\n\t\tif (stopAtClazzOrNode) {\n\t\t\tif (typeof stopAtClazzOrNode === 'string') {\n\t\t\t\tif (node.classList.contains(stopAtClazzOrNode)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (node === stopAtClazzOrNode) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnode = node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function hasParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): boolean {\n\treturn !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\n\nexport function isShadowRoot(node: Node): node is ShadowRoot {\n\treturn (\n\t\tnode && !!(node).host && !!(node).mode\n\t);\n}\n\nexport function isInShadowDOM(domNode: Node): boolean {\n\treturn !!getShadowRoot(domNode);\n}\n\nexport function getShadowRoot(domNode: Node): ShadowRoot | null {\n\twhile (domNode.parentNode) {\n\t\tif (domNode === domNode.ownerDocument?.body) {\n\t\t\t// reached the body\n\t\t\treturn null;\n\t\t}\n\t\tdomNode = domNode.parentNode;\n\t}\n\treturn isShadowRoot(domNode) ? domNode : null;\n}\n\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement(): Element | null {\n\tlet result = getActiveDocument().activeElement;\n\n\twhile (result?.shadowRoot) {\n\t\tresult = result.shadowRoot.activeElement;\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element: Element): boolean {\n\treturn getActiveElement() === element;\n}\n\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor: Element): boolean {\n\treturn isAncestor(getActiveElement(), ancestor);\n}\n\n/**\n * Returns whether the element is in the active `document`. The active\n * document has focus or will be the main windows document.\n */\nexport function isActiveDocument(element: Element): boolean {\n\treturn element.ownerDocument === getActiveDocument();\n}\n\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main windows document.\n */\nexport function getActiveDocument(): Document {\n\tif (getWindowsCount() <= 1) {\n\t\treturn mainWindow.document;\n\t}\n\n\tconst documents = Array.from(getWindows()).map(({ window }) => window.document);\n\treturn documents.find(doc => doc.hasFocus()) ?? mainWindow.document;\n}\n\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow(): CodeWindow {\n\tconst document = getActiveDocument();\n\treturn (document.defaultView?.window ?? mainWindow) as CodeWindow;\n}\n\nconst globalStylesheets = new Map>();\n\nexport function isGlobalStylesheet(node: Node): boolean {\n\treturn globalStylesheets.has(node as HTMLStyleElement);\n}\n\n/**\n * A version of createStyleSheet which has a unified API to initialize/set the style content.\n */\nexport function createStyleSheet2(): WrappedStyleElement {\n\treturn new WrappedStyleElement();\n}\n\nclass WrappedStyleElement {\n\tprivate _currentCssStyle = '';\n\tprivate _styleSheet: HTMLStyleElement | undefined = undefined;\n\n\tpublic setStyle(cssStyle: string): void {\n\t\tif (cssStyle === this._currentCssStyle) {\n\t\t\treturn;\n\t\t}\n\t\tthis._currentCssStyle = cssStyle;\n\n\t\tif (!this._styleSheet) {\n\t\t\tthis._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);\n\t\t} else {\n\t\t\tthis._styleSheet.innerText = cssStyle;\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._styleSheet) {\n\t\t\tthis._styleSheet.remove();\n\t\t\tthis._styleSheet = undefined;\n\t\t}\n\t}\n}\n\nexport function createStyleSheet(container: HTMLElement = mainWindow.document.head, beforeAppend?: (style: HTMLStyleElement) => void, disposableStore?: DisposableStore): HTMLStyleElement {\n\tconst style = document.createElement('style');\n\tstyle.type = 'text/css';\n\tstyle.media = 'screen';\n\tbeforeAppend?.(style);\n\tcontainer.appendChild(style);\n\n\tif (disposableStore) {\n\t\tdisposableStore.add(toDisposable(() => style.remove()));\n\t}\n\n\t// With as container, the stylesheet becomes global and is tracked\n\t// to support auxiliary windows to clone the stylesheet.\n\tif (container === mainWindow.document.head) {\n\t\tconst globalStylesheetClones = new Set();\n\t\tglobalStylesheets.set(style, globalStylesheetClones);\n\n\t\tfor (const { window: targetWindow, disposables } of getWindows()) {\n\t\t\tif (targetWindow === mainWindow) {\n\t\t\t\tcontinue; // main window is already tracked\n\t\t\t}\n\n\t\t\tconst cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));\n\t\t\tdisposableStore?.add(cloneDisposable);\n\t\t}\n\t}\n\n\treturn style;\n}\n\nexport function cloneGlobalStylesheets(targetWindow: Window): IDisposable {\n\tconst disposables = new DisposableStore();\n\n\tfor (const [globalStylesheet, clonedGlobalStylesheets] of globalStylesheets) {\n\t\tdisposables.add(cloneGlobalStyleSheet(globalStylesheet, clonedGlobalStylesheets, targetWindow));\n\t}\n\n\treturn disposables;\n}\n\nfunction cloneGlobalStyleSheet(globalStylesheet: HTMLStyleElement, globalStylesheetClones: Set, targetWindow: Window): IDisposable {\n\tconst disposables = new DisposableStore();\n\n\tconst clone = globalStylesheet.cloneNode(true) as HTMLStyleElement;\n\ttargetWindow.document.head.appendChild(clone);\n\tdisposables.add(toDisposable(() => clone.remove()));\n\n\tfor (const rule of getDynamicStyleSheetRules(globalStylesheet)) {\n\t\tclone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);\n\t}\n\n\tdisposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {\n\t\tclone.textContent = globalStylesheet.textContent;\n\t}));\n\n\tglobalStylesheetClones.add(clone);\n\tdisposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));\n\n\treturn disposables;\n}\n\ninterface IMutationObserver {\n\tusers: number;\n\treadonly observer: MutationObserver;\n\treadonly onDidMutate: event.Event;\n}\n\nexport const sharedMutationObserver = new class {\n\n\treadonly mutationObservers = new Map>();\n\n\tobserve(target: Node, disposables: DisposableStore, options?: MutationObserverInit): event.Event {\n\t\tlet mutationObserversPerTarget = this.mutationObservers.get(target);\n\t\tif (!mutationObserversPerTarget) {\n\t\t\tmutationObserversPerTarget = new Map();\n\t\t\tthis.mutationObservers.set(target, mutationObserversPerTarget);\n\t\t}\n\n\t\tconst optionsHash = hash(options);\n\t\tlet mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n\t\tif (!mutationObserverPerOptions) {\n\t\t\tconst onDidMutate = new event.Emitter();\n\t\t\tconst observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n\t\t\tobserver.observe(target, options);\n\n\t\t\tconst resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n\t\t\t\tusers: 1,\n\t\t\t\tobserver,\n\t\t\t\tonDidMutate: onDidMutate.event\n\t\t\t};\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tresolvedMutationObserverPerOptions.users -= 1;\n\n\t\t\t\tif (resolvedMutationObserverPerOptions.users === 0) {\n\t\t\t\t\tonDidMutate.dispose();\n\t\t\t\t\tobserver.disconnect();\n\n\t\t\t\t\tmutationObserversPerTarget?.delete(optionsHash);\n\t\t\t\t\tif (mutationObserversPerTarget?.size === 0) {\n\t\t\t\t\t\tthis.mutationObservers.delete(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tmutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n\t\t} else {\n\t\t\tmutationObserverPerOptions.users += 1;\n\t\t}\n\n\t\treturn mutationObserverPerOptions.onDidMutate;\n\t}\n};\n\nexport function createMetaElement(container: HTMLElement = mainWindow.document.head): HTMLMetaElement {\n\treturn createHeadElement('meta', container) as HTMLMetaElement;\n}\n\nexport function createLinkElement(container: HTMLElement = mainWindow.document.head): HTMLLinkElement {\n\treturn createHeadElement('link', container) as HTMLLinkElement;\n}\n\nfunction createHeadElement(tagName: string, container: HTMLElement = mainWindow.document.head): HTMLElement {\n\tconst element = document.createElement(tagName);\n\tcontainer.appendChild(element);\n\treturn element;\n}\n\nlet _sharedStyleSheet: HTMLStyleElement | null = null;\nfunction getSharedStyleSheet(): HTMLStyleElement {\n\tif (!_sharedStyleSheet) {\n\t\t_sharedStyleSheet = createStyleSheet();\n\t}\n\treturn _sharedStyleSheet;\n}\n\nfunction getDynamicStyleSheetRules(style: HTMLStyleElement) {\n\tif (style?.sheet?.rules) {\n\t\t// Chrome, IE\n\t\treturn style.sheet.rules;\n\t}\n\tif (style?.sheet?.cssRules) {\n\t\t// FF\n\t\treturn style.sheet.cssRules;\n\t}\n\treturn [];\n}\n\nexport function createCSSRule(selector: string, cssText: string, style = getSharedStyleSheet()): void {\n\tif (!style || !cssText) {\n\t\treturn;\n\t}\n\n\tstyle.sheet?.insertRule(`${selector} {${cssText}}`, 0);\n\n\t// Apply rule also to all cloned global stylesheets\n\tfor (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n\t\tcreateCSSRule(selector, cssText, clonedGlobalStylesheet);\n\t}\n}\n\nexport function removeCSSRulesContainingSelector(ruleName: string, style = getSharedStyleSheet()): void {\n\tif (!style) {\n\t\treturn;\n\t}\n\n\tconst rules = getDynamicStyleSheetRules(style);\n\tconst toDelete: number[] = [];\n\tfor (let i = 0; i < rules.length; i++) {\n\t\tconst rule = rules[i];\n\t\tif (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {\n\t\t\ttoDelete.push(i);\n\t\t}\n\t}\n\n\tfor (let i = toDelete.length - 1; i >= 0; i--) {\n\t\tstyle.sheet?.deleteRule(toDelete[i]);\n\t}\n\n\t// Remove rules also from all cloned global stylesheets\n\tfor (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n\t\tremoveCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);\n\t}\n}\n\nfunction isCSSStyleRule(rule: CSSRule): rule is CSSStyleRule {\n\treturn typeof (rule as CSSStyleRule).selectorText === 'string';\n}\n\nexport function isHTMLElement(e: unknown): e is HTMLElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;\n}\n\nexport function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLAnchorElement || e instanceof getWindow(e as Node).HTMLAnchorElement;\n}\n\nexport function isHTMLSpanElement(e: unknown): e is HTMLSpanElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLSpanElement || e instanceof getWindow(e as Node).HTMLSpanElement;\n}\n\nexport function isHTMLTextAreaElement(e: unknown): e is HTMLTextAreaElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLTextAreaElement || e instanceof getWindow(e as Node).HTMLTextAreaElement;\n}\n\nexport function isHTMLInputElement(e: unknown): e is HTMLInputElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLInputElement || e instanceof getWindow(e as Node).HTMLInputElement;\n}\n\nexport function isHTMLButtonElement(e: unknown): e is HTMLButtonElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLButtonElement || e instanceof getWindow(e as Node).HTMLButtonElement;\n}\n\nexport function isHTMLDivElement(e: unknown): e is HTMLDivElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLDivElement || e instanceof getWindow(e as Node).HTMLDivElement;\n}\n\nexport function isSVGElement(e: unknown): e is SVGElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof SVGElement || e instanceof getWindow(e as Node).SVGElement;\n}\n\nexport function isMouseEvent(e: unknown): e is MouseEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;\n}\n\nexport function isKeyboardEvent(e: unknown): e is KeyboardEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof KeyboardEvent || e instanceof getWindow(e as UIEvent).KeyboardEvent;\n}\n\nexport function isPointerEvent(e: unknown): e is PointerEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof PointerEvent || e instanceof getWindow(e as UIEvent).PointerEvent;\n}\n\nexport function isDragEvent(e: unknown): e is DragEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof DragEvent || e instanceof getWindow(e as UIEvent).DragEvent;\n}\n\nexport const EventType = {\n\t// Mouse\n\tCLICK: 'click',\n\tAUXCLICK: 'auxclick',\n\tDBLCLICK: 'dblclick',\n\tMOUSE_UP: 'mouseup',\n\tMOUSE_DOWN: 'mousedown',\n\tMOUSE_OVER: 'mouseover',\n\tMOUSE_MOVE: 'mousemove',\n\tMOUSE_OUT: 'mouseout',\n\tMOUSE_ENTER: 'mouseenter',\n\tMOUSE_LEAVE: 'mouseleave',\n\tMOUSE_WHEEL: 'wheel',\n\tPOINTER_UP: 'pointerup',\n\tPOINTER_DOWN: 'pointerdown',\n\tPOINTER_MOVE: 'pointermove',\n\tPOINTER_LEAVE: 'pointerleave',\n\tCONTEXT_MENU: 'contextmenu',\n\tWHEEL: 'wheel',\n\t// Keyboard\n\tKEY_DOWN: 'keydown',\n\tKEY_PRESS: 'keypress',\n\tKEY_UP: 'keyup',\n\t// HTML Document\n\tLOAD: 'load',\n\tBEFORE_UNLOAD: 'beforeunload',\n\tUNLOAD: 'unload',\n\tPAGE_SHOW: 'pageshow',\n\tPAGE_HIDE: 'pagehide',\n\tPASTE: 'paste',\n\tABORT: 'abort',\n\tERROR: 'error',\n\tRESIZE: 'resize',\n\tSCROLL: 'scroll',\n\tFULLSCREEN_CHANGE: 'fullscreenchange',\n\tWK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n\t// Form\n\tSELECT: 'select',\n\tCHANGE: 'change',\n\tSUBMIT: 'submit',\n\tRESET: 'reset',\n\tFOCUS: 'focus',\n\tFOCUS_IN: 'focusin',\n\tFOCUS_OUT: 'focusout',\n\tBLUR: 'blur',\n\tINPUT: 'input',\n\t// Local Storage\n\tSTORAGE: 'storage',\n\t// Drag\n\tDRAG_START: 'dragstart',\n\tDRAG: 'drag',\n\tDRAG_ENTER: 'dragenter',\n\tDRAG_LEAVE: 'dragleave',\n\tDRAG_OVER: 'dragover',\n\tDROP: 'drop',\n\tDRAG_END: 'dragend',\n\t// Animation\n\tANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n\tANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n\tANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n} as const;\n\nexport interface EventLike {\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport function isEventLike(obj: unknown): obj is EventLike {\n\tconst candidate = obj as EventLike | undefined;\n\n\treturn !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\n\nexport const EventHelper = {\n\tstop: (e: T, cancelBubble?: boolean): T => {\n\t\te.preventDefault();\n\t\tif (cancelBubble) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\treturn e;\n\t}\n};\n\nexport interface IFocusTracker extends Disposable {\n\treadonly onDidFocus: event.Event;\n\treadonly onDidBlur: event.Event;\n\trefreshState(): void;\n}\n\nexport function saveParentsScrollTop(node: Element): number[] {\n\tconst r: number[] = [];\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tr[i] = node.scrollTop;\n\t\tnode = node.parentNode;\n\t}\n\treturn r;\n}\n\nexport function restoreParentsScrollTop(node: Element, state: number[]): void {\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tif (node.scrollTop !== state[i]) {\n\t\t\tnode.scrollTop = state[i];\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n}\n\nclass FocusTracker extends Disposable implements IFocusTracker {\n\n\tprivate readonly _onDidFocus = this._register(new event.Emitter());\n\treadonly onDidFocus = this._onDidFocus.event;\n\n\tprivate readonly _onDidBlur = this._register(new event.Emitter());\n\treadonly onDidBlur = this._onDidBlur.event;\n\n\tprivate _refreshStateHandler: () => void;\n\n\tprivate static hasFocusWithin(element: HTMLElement | Window): boolean {\n\t\tif (isHTMLElement(element)) {\n\t\t\tconst shadowRoot = getShadowRoot(element);\n\t\t\tconst activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n\t\t\treturn isAncestor(activeElement, element);\n\t\t} else {\n\t\t\tconst window = element;\n\t\t\treturn isAncestor(window.document.activeElement, window.document);\n\t\t}\n\t}\n\n\tconstructor(element: HTMLElement | Window) {\n\t\tsuper();\n\t\tlet hasFocus = FocusTracker.hasFocusWithin(element);\n\t\tlet loosingFocus = false;\n\n\t\tconst onFocus = () => {\n\t\t\tloosingFocus = false;\n\t\t\tif (!hasFocus) {\n\t\t\t\thasFocus = true;\n\t\t\t\tthis._onDidFocus.fire();\n\t\t\t}\n\t\t};\n\n\t\tconst onBlur = () => {\n\t\t\tif (hasFocus) {\n\t\t\t\tloosingFocus = true;\n\t\t\t\t(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {\n\t\t\t\t\tif (loosingFocus) {\n\t\t\t\t\t\tloosingFocus = false;\n\t\t\t\t\t\thasFocus = false;\n\t\t\t\t\t\tthis._onDidBlur.fire();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t};\n\n\t\tthis._refreshStateHandler = () => {\n\t\t\tconst currentNodeHasFocus = FocusTracker.hasFocusWithin(element);\n\t\t\tif (currentNodeHasFocus !== hasFocus) {\n\t\t\t\tif (hasFocus) {\n\t\t\t\t\tonBlur();\n\t\t\t\t} else {\n\t\t\t\t\tonFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n\t\tthis._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n\t\tif (isHTMLElement(element)) {\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n\t\t}\n\n\t}\n\n\trefreshState() {\n\t\tthis._refreshStateHandler();\n\t}\n}\n\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element: HTMLElement | Window): IFocusTracker {\n\treturn new FocusTracker(element);\n}\n\nexport function after(sibling: HTMLElement, child: T): T {\n\tsibling.after(child);\n\treturn child;\n}\n\nexport function append(parent: HTMLElement, child: T): T;\nexport function append(parent: HTMLElement, ...children: (T | string)[]): void;\nexport function append(parent: HTMLElement, ...children: (T | string)[]): T | void {\n\tparent.append(...children);\n\tif (children.length === 1 && typeof children[0] !== 'string') {\n\t\treturn children[0];\n\t}\n}\n\nexport function prepend(parent: HTMLElement, child: T): T {\n\tparent.insertBefore(child, parent.firstChild);\n\treturn child;\n}\n\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent: HTMLElement, ...children: Array): void {\n\tparent.innerText = '';\n\tappend(parent, ...children);\n}\n\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\n\nexport enum Namespace {\n\tHTML = 'http://www.w3.org/1999/xhtml',\n\tSVG = 'http://www.w3.org/2000/svg'\n}\n\nfunction _$(namespace: Namespace, description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\tconst match = SELECTOR_REGEX.exec(description);\n\n\tif (!match) {\n\t\tthrow new Error('Bad use of emmet');\n\t}\n\n\tconst tagName = match[1] || 'div';\n\tlet result: T;\n\n\tif (namespace !== Namespace.HTML) {\n\t\tresult = document.createElementNS(namespace as string, tagName) as T;\n\t} else {\n\t\tresult = document.createElement(tagName) as unknown as T;\n\t}\n\n\tif (match[3]) {\n\t\tresult.id = match[3];\n\t}\n\tif (match[4]) {\n\t\tresult.className = match[4].replace(/\\./g, ' ').trim();\n\t}\n\n\tif (attrs) {\n\t\tObject.entries(attrs).forEach(([name, value]) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (/^on\\w+$/.test(name)) {\n\t\t\t\t(result)[name] = value;\n\t\t\t} else if (name === 'selected') {\n\t\t\t\tif (value) {\n\t\t\t\t\tresult.setAttribute(name, 'true');\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.setAttribute(name, value);\n\t\t\t}\n\t\t});\n\t}\n\n\tresult.append(...children);\n\n\treturn result as T;\n}\n\nexport function $(description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\treturn _$(Namespace.HTML, description, attrs, ...children);\n}\n\n$.SVG = function (description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\treturn _$(Namespace.SVG, description, attrs, ...children);\n};\n\nexport function join(nodes: Node[], separator: Node | string): Node[] {\n\tconst result: Node[] = [];\n\n\tnodes.forEach((node, index) => {\n\t\tif (index > 0) {\n\t\t\tif (separator instanceof Node) {\n\t\t\t\tresult.push(separator.cloneNode());\n\t\t\t} else {\n\t\t\t\tresult.push(document.createTextNode(separator));\n\t\t\t}\n\t\t}\n\n\t\tresult.push(node);\n\t});\n\n\treturn result;\n}\n\nexport function setVisibility(visible: boolean, ...elements: HTMLElement[]): void {\n\tif (visible) {\n\t\tshow(...elements);\n\t} else {\n\t\thide(...elements);\n\t}\n}\n\nexport function show(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = '';\n\t\telement.removeAttribute('aria-hidden');\n\t}\n}\n\nexport function hide(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = 'none';\n\t\telement.setAttribute('aria-hidden', 'true');\n\t}\n}\n\nfunction findParentWithAttribute(node: Node | null, attribute: string): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (isHTMLElement(node) && node.hasAttribute(attribute)) {\n\t\t\treturn node;\n\t\t}\n\n\t\tnode = node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function removeTabIndexAndUpdateFocus(node: HTMLElement): void {\n\tif (!node || !node.hasAttribute('tabIndex')) {\n\t\treturn;\n\t}\n\n\t// If we are the currently focused element and tabIndex is removed,\n\t// standard DOM behavior is to move focus to the element. We\n\t// typically never want that, rather put focus to the closest element\n\t// in the hierarchy of the parent DOM nodes.\n\tif (node.ownerDocument.activeElement === node) {\n\t\tconst parentFocusable = findParentWithAttribute(node.parentElement, 'tabIndex');\n\t\tparentFocusable?.focus();\n\t}\n\n\tnode.removeAttribute('tabindex');\n}\n\nexport function finalHandler(fn: (event: T) => any): (event: T) => any {\n\treturn e => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tfn(e);\n\t};\n}\n\nexport function domContentLoaded(targetWindow: Window): Promise {\n\treturn new Promise(resolve => {\n\t\tconst readyState = targetWindow.document.readyState;\n\t\tif (readyState === 'complete' || (targetWindow.document && targetWindow.document.body !== null)) {\n\t\t\tresolve(undefined);\n\t\t} else {\n\t\t\tconst listener = () => {\n\t\t\t\ttargetWindow.window.removeEventListener('DOMContentLoaded', listener, false);\n\t\t\t\tresolve();\n\t\t\t};\n\n\t\t\ttargetWindow.window.addEventListener('DOMContentLoaded', listener, false);\n\t\t}\n\t});\n}\n\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window: Window, cssPx: number): number {\n\tconst screenPx = window.devicePixelRatio * cssPx;\n\treturn Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url: string): void {\n\t// By using 'noopener' in the `windowFeatures` argument, the newly created window will\n\t// not be able to use `window.opener` to reach back to the current page.\n\t// See https://stackoverflow.com/a/46958731\n\t// See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n\t// However, this also doesn't allow us to realize if the browser blocked\n\t// the creation of the window.\n\tmainWindow.open(url, '_blank', 'noopener');\n}\n\n/**\n * Open a new window in a popup. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * Note: this does not set {@link window.opener} to null. This is to allow the opened popup to\n * be able to use {@link window.close} to close itself. Because of this, you should only use\n * this function on urls that you trust.\n *\n * In otherwords, you should almost always use {@link windowOpenNoOpener} instead of this function.\n */\nconst popupWidth = 780, popupHeight = 640;\nexport function windowOpenPopup(url: string): void {\n\tconst left = Math.floor(mainWindow.screenLeft + mainWindow.innerWidth / 2 - popupWidth / 2);\n\tconst top = Math.floor(mainWindow.screenTop + mainWindow.innerHeight / 2 - popupHeight / 2);\n\tmainWindow.open(\n\t\turl,\n\t\t'_blank',\n\t\t`width=${popupWidth},height=${popupHeight},top=${top},left=${left}`\n\t);\n}\n\n/**\n * Attempts to open a window and returns whether it succeeded. This technique is\n * not appropriate in certain contexts, like for example when the JS context is\n * executing inside a sandboxed iframe. If it is not necessary to know if the\n * browser blocked the new window, use {@link windowOpenNoOpener}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * See https://github.com/microsoft/monaco-editor/issues/2474\n * See https://mathiasbynens.github.io/rel-noopener/\n *\n * @param url the url to open\n * @param noOpener whether or not to set the {@link window.opener} to null. You should leave the default\n * (true) unless you trust the url that is being opened.\n * @returns boolean indicating if the {@link window.open} call succeeded\n */\nexport function windowOpenWithSuccess(url: string, noOpener = true): boolean {\n\tconst newTab = mainWindow.open();\n\tif (newTab) {\n\t\tif (noOpener) {\n\t\t\t// see `windowOpenNoOpener` for details on why this is important\n\t\t\t(newTab as any).opener = null;\n\t\t}\n\t\tnewTab.location.href = url;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function animate(targetWindow: Window, fn: () => void): IDisposable {\n\tconst step = () => {\n\t\tfn();\n\t\tstepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\t};\n\n\tlet stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\treturn toDisposable(() => stepDisposable.dispose());\n}\n\nexport function asCSSPropertyValue(value: string) {\n\treturn `'${value.replace(/'/g, '%27')}'`;\n}\n\nexport function asCssValueWithDefault(cssPropertyValue: string | undefined, dflt: string): string {\n\tif (cssPropertyValue !== undefined) {\n\t\tconst variableMatch = cssPropertyValue.match(/^\\s*var\\((.+)\\)$/);\n\t\tif (variableMatch) {\n\t\t\tconst varArguments = variableMatch[1].split(',', 2);\n\t\t\tif (varArguments.length === 2) {\n\t\t\t\tdflt = asCssValueWithDefault(varArguments[1].trim(), dflt);\n\t\t\t}\n\t\t\treturn `var(${varArguments[0]}, ${dflt})`;\n\t\t}\n\t\treturn cssPropertyValue;\n\t}\n\treturn dflt;\n}\n\nexport enum DetectedFullscreenMode {\n\n\t/**\n\t * The document is fullscreen, e.g. because an element\n\t * in the document requested to be fullscreen.\n\t */\n\tDOCUMENT = 1,\n\n\t/**\n\t * The browser is fullscreen, e.g. because the user enabled\n\t * native window fullscreen for it.\n\t */\n\tBROWSER\n}\n\nexport interface IDetectedFullscreen {\n\n\t/**\n\t * Figure out if the document is fullscreen or the browser.\n\t */\n\tmode: DetectedFullscreenMode;\n\n\t/**\n\t * Whether we know for sure that we are in fullscreen mode or\n\t * it is a guess.\n\t */\n\tguess: boolean;\n}\n\nexport function detectFullscreen(targetWindow: Window): IDetectedFullscreen | null {\n\n\t// Browser fullscreen: use DOM APIs to detect\n\tif (targetWindow.document.fullscreenElement || (targetWindow.document).webkitFullscreenElement || (targetWindow.document).webkitIsFullScreen) {\n\t\treturn { mode: DetectedFullscreenMode.DOCUMENT, guess: false };\n\t}\n\n\t// There is no standard way to figure out if the browser\n\t// is using native fullscreen. Via checking on screen\n\t// height and comparing that to window height, we can guess\n\t// it though.\n\n\tif (targetWindow.innerHeight === targetWindow.screen.height) {\n\t\t// if the height of the window matches the screen height, we can\n\t\t// safely assume that the browser is fullscreen because no browser\n\t\t// chrome is taking height away (e.g. like toolbars).\n\t\treturn { mode: DetectedFullscreenMode.BROWSER, guess: false };\n\t}\n\n\tif (platform.isMacintosh || platform.isLinux) {\n\t\t// macOS and Linux do not properly report `innerHeight`, only Windows does\n\t\tif (targetWindow.outerHeight === targetWindow.screen.height && targetWindow.outerWidth === targetWindow.screen.width) {\n\t\t\t// if the height of the browser matches the screen height, we can\n\t\t\t// only guess that we are in fullscreen. It is also possible that\n\t\t\t// the user has turned off taskbars in the OS and the browser is\n\t\t\t// simply able to span the entire size of the screen.\n\t\t\treturn { mode: DetectedFullscreenMode.BROWSER, guess: true };\n\t\t}\n\t}\n\n\t// Not in fullscreen\n\treturn null;\n}\n\n/**\n * Convert a Unicode string to a string in which each 16-bit unit occupies only one byte\n *\n * From https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa\n */\nfunction toBinary(str: string): string {\n\tconst codeUnits = new Uint16Array(str.length);\n\tfor (let i = 0; i < codeUnits.length; i++) {\n\t\tcodeUnits[i] = str.charCodeAt(i);\n\t}\n\tlet binary = '';\n\tconst uint8array = new Uint8Array(codeUnits.buffer);\n\tfor (let i = 0; i < uint8array.length; i++) {\n\t\tbinary += String.fromCharCode(uint8array[i]);\n\t}\n\treturn binary;\n}\n\n/**\n * Version of the global `btoa` function that handles multi-byte characters instead\n * of throwing an exception.\n */\nexport function multibyteAwareBtoa(str: string): string {\n\treturn btoa(toBinary(str));\n}\n\ntype ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';\n\nexport interface IModifierKeyStatus {\n\taltKey: boolean;\n\tshiftKey: boolean;\n\tctrlKey: boolean;\n\tmetaKey: boolean;\n\tlastKeyPressed?: ModifierKey;\n\tlastKeyReleased?: ModifierKey;\n\tevent?: KeyboardEvent;\n}\n\nexport class ModifierKeyEmitter extends event.Emitter {\n\n\tprivate readonly _subscriptions = new DisposableStore();\n\tprivate _keyStatus: IModifierKeyStatus;\n\tprivate static instance: ModifierKeyEmitter;\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\n\t\tthis._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n\t}\n\n\tprivate registerListeners(window: Window, disposables: DisposableStore): void {\n\t\tdisposables.add(addDisposableListener(window, 'keydown', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\t// If Alt-key keydown event is repeated, ignore it #112347\n\t\t\t// Only known to be necessary for Alt-Key at the moment #115810\n\t\t\tif (event.keyCode === KeyCode.Alt && e.repeat) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (e.altKey && !this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'alt';\n\t\t\t} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'ctrl';\n\t\t\t} else if (e.metaKey && !this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'meta';\n\t\t\t} else if (e.shiftKey && !this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'shift';\n\t\t\t} else if (event.keyCode !== KeyCode.Alt) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyPressed) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'keyup', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!e.altKey && this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'alt';\n\t\t\t} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'ctrl';\n\t\t\t} else if (!e.metaKey && this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'meta';\n\t\t\t} else if (!e.shiftKey && this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'shift';\n\t\t\t} else {\n\t\t\t\tthis._keyStatus.lastKeyReleased = undefined;\n\t\t\t}\n\n\t\t\tif (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n\t\t\tif (e.buttons) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'blur', () => {\n\t\t\tthis.resetKeyStatus();\n\t\t}));\n\t}\n\n\tget keyStatus(): IModifierKeyStatus {\n\t\treturn this._keyStatus;\n\t}\n\n\tget isModifierPressed(): boolean {\n\t\treturn this._keyStatus.altKey || this._keyStatus.ctrlKey || this._keyStatus.metaKey || this._keyStatus.shiftKey;\n\t}\n\n\t/**\n\t * Allows to explicitly reset the key status based on more knowledge (#109062)\n\t */\n\tresetKeyStatus(): void {\n\t\tthis.doResetKeyStatus();\n\t\tthis.fire(this._keyStatus);\n\t}\n\n\tprivate doResetKeyStatus(): void {\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\t}\n\n\tstatic getInstance() {\n\t\tif (!ModifierKeyEmitter.instance) {\n\t\t\tModifierKeyEmitter.instance = new ModifierKeyEmitter();\n\t\t}\n\n\t\treturn ModifierKeyEmitter.instance;\n\t}\n\n\toverride dispose() {\n\t\tsuper.dispose();\n\t\tthis._subscriptions.dispose();\n\t}\n}\n\nexport function getCookieValue(name: string): string | undefined {\n\tconst match = document.cookie.match('(^|[^;]+)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531\n\n\treturn match ? match.pop() : undefined;\n}\n\nexport interface IDragAndDropObserverCallbacks {\n\treadonly onDragEnter?: (e: DragEvent) => void;\n\treadonly onDragLeave?: (e: DragEvent) => void;\n\treadonly onDrop?: (e: DragEvent) => void;\n\treadonly onDragEnd?: (e: DragEvent) => void;\n\treadonly onDragStart?: (e: DragEvent) => void;\n\treadonly onDrag?: (e: DragEvent) => void;\n\treadonly onDragOver?: (e: DragEvent, dragDuration: number) => void;\n}\n\nexport class DragAndDropObserver extends Disposable {\n\n\t// A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n\t// calls see https://github.com/microsoft/vscode/issues/14470\n\t// when the element has child elements where the events are fired\n\t// repeadedly.\n\tprivate counter: number = 0;\n\n\t// Allows to measure the duration of the drag operation.\n\tprivate dragStartTime = 0;\n\n\tconstructor(private readonly element: HTMLElement, private readonly callbacks: IDragAndDropObserverCallbacks) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (this.callbacks.onDragStart) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_START, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDragStart?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tif (this.callbacks.onDrag) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDrag?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e: DragEvent) => {\n\t\t\tthis.counter++;\n\t\t\tthis.dragStartTime = e.timeStamp;\n\n\t\t\tthis.callbacks.onDragEnter?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => {\n\t\t\te.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n\n\t\t\tthis.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e: DragEvent) => {\n\t\t\tthis.counter--;\n\n\t\t\tif (this.counter === 0) {\n\t\t\t\tthis.dragStartTime = 0;\n\n\t\t\t\tthis.callbacks.onDragLeave?.(e);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_END, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDragEnd?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DROP, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDrop?.(e);\n\t\t}));\n\t}\n}\n\ntype HTMLElementAttributeKeys = Partial<{ [K in keyof T]: T[K] extends Function ? never : T[K] extends object ? HTMLElementAttributeKeys : T[K] }>;\ntype ElementAttributes = HTMLElementAttributeKeys & Record;\ntype RemoveHTMLElement = T extends HTMLElement ? never : T;\ntype UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\ntype ArrayToObj = UnionToIntersection>;\ntype HHTMLElementTagNameMap = HTMLElementTagNameMap & { '': HTMLDivElement };\n\ntype TagToElement = T extends `${infer TStart}#${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends `${infer TStart}.${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends keyof HTMLElementTagNameMap\n\t? HTMLElementTagNameMap[T]\n\t: HTMLElement;\n\ntype TagToElementAndId = TTag extends `${infer TTag}@${infer TId}`\n\t? { element: TagToElement; id: TId }\n\t: { element: TagToElement; id: 'root' };\n\ntype TagToRecord = TagToElementAndId extends { element: infer TElement; id: infer TId }\n\t? Record<(TId extends string ? TId : never) | 'root', TElement>\n\t: never;\n\ntype Child = HTMLElement | string | Record;\n\nconst H_REGEX = /(?[\\w\\-]+)?(?:#(?[\\w\\-]+))?(?(?:\\.(?:[\\w\\-]+))*)(?:@(?(?:[\\w\\_])+))?/;\n\n/**\n * A helper function to create nested dom nodes.\n *\n *\n * ```ts\n * const elements = h('div.code-view', [\n * \th('div.title@title'),\n * \th('div.container', [\n * \t\th('div.gutter@gutterDiv'),\n * \t\th('div@editor'),\n * \t]),\n * ]);\n * const editor = createEditor(elements.editor);\n * ```\n*/\nexport function h\n\t(tag: TTag):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, attributes: Partial>>):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, attributes: Partial>>, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h(tag: string, ...args: [] | [attributes: { $: string } & Partial> | Record, children?: any[]] | [children: any[]]): Record {\n\tlet attributes: { $?: string } & Partial>;\n\tlet children: (Record | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElement(tagName);\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nexport function svgElem\n\t(tag: TTag):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, attributes: Partial>>):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, attributes: Partial>>, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem(tag: string, ...args: [] | [attributes: { $: string } & Partial> | Record, children?: any[]] | [children: any[]]): Record {\n\tlet attributes: { $?: string } & Partial>;\n\tlet children: (Record | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElementNS('http://www.w3.org/2000/svg', tagName) as any as HTMLElement;\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nfunction camelCaseToHyphenCase(str: string) {\n\treturn str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nexport function copyAttributes(from: Element, to: Element, filter?: string[]): void {\n\tfor (const { name, value } of from.attributes) {\n\t\tif (!filter || filter.includes(name)) {\n\t\t\tto.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nfunction copyAttribute(from: Element, to: Element, name: string): void {\n\tconst value = from.getAttribute(name);\n\tif (value) {\n\t\tto.setAttribute(name, value);\n\t} else {\n\t\tto.removeAttribute(name);\n\t}\n}\n\nexport function trackAttributes(from: Element, to: Element, filter?: string[]): IDisposable {\n\tcopyAttributes(from, to, filter);\n\n\tconst disposables = new DisposableStore();\n\n\tdisposables.add(sharedMutationObserver.observe(from, disposables, { attributes: true, attributeFilter: filter })(mutations => {\n\t\tfor (const mutation of mutations) {\n\t\t\tif (mutation.type === 'attributes' && mutation.attributeName) {\n\t\t\t\tcopyAttribute(from, to, mutation.attributeName);\n\t\t\t}\n\t\t}\n\t}));\n\n\treturn disposables;\n}\n\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nexport class SafeTriangle {\n\t// 4 triangles, 2 points (x, y) stored for each\n\tprivate triangles: number[] = [];\n\n\tconstructor(\n\t\tprivate readonly originX: number,\n\t\tprivate readonly originY: number,\n\t\ttarget: HTMLElement\n\t) {\n\t\tconst { top, left, right, bottom } = target.getBoundingClientRect();\n\t\tconst t = this.triangles;\n\t\tlet i = 0;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\t}\n\n\tpublic contains(x: number, y: number) {\n\t\tconst { triangles, originX, originY } = this;\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tif (isPointWithinTriangle(x, y, originX, originY, triangles[2 * i], triangles[2 * i + 1], triangles[2 * i + 2], triangles[2 * i + 3])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport class FastDomNode {\n\n\tprivate _maxWidth: string = '';\n\tprivate _width: string = '';\n\tprivate _height: string = '';\n\tprivate _top: string = '';\n\tprivate _left: string = '';\n\tprivate _bottom: string = '';\n\tprivate _right: string = '';\n\tprivate _paddingTop: string = '';\n\tprivate _paddingLeft: string = '';\n\tprivate _paddingBottom: string = '';\n\tprivate _paddingRight: string = '';\n\tprivate _fontFamily: string = '';\n\tprivate _fontWeight: string = '';\n\tprivate _fontSize: string = '';\n\tprivate _fontStyle: string = '';\n\tprivate _fontFeatureSettings: string = '';\n\tprivate _fontVariationSettings: string = '';\n\tprivate _textDecoration: string = '';\n\tprivate _lineHeight: string = '';\n\tprivate _letterSpacing: string = '';\n\tprivate _className: string = '';\n\tprivate _display: string = '';\n\tprivate _position: string = '';\n\tprivate _visibility: string = '';\n\tprivate _color: string = '';\n\tprivate _backgroundColor: string = '';\n\tprivate _layerHint: boolean = false;\n\tprivate _contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint' = 'none';\n\tprivate _boxShadow: string = '';\n\n\tconstructor(\n\t\tpublic readonly domNode: T\n\t) { }\n\n\tpublic setMaxWidth(_maxWidth: number | string): void {\n\t\tconst maxWidth = numberAsPixels(_maxWidth);\n\t\tif (this._maxWidth === maxWidth) {\n\t\t\treturn;\n\t\t}\n\t\tthis._maxWidth = maxWidth;\n\t\tthis.domNode.style.maxWidth = this._maxWidth;\n\t}\n\n\tpublic setWidth(_width: number | string): void {\n\t\tconst width = numberAsPixels(_width);\n\t\tif (this._width === width) {\n\t\t\treturn;\n\t\t}\n\t\tthis._width = width;\n\t\tthis.domNode.style.width = this._width;\n\t}\n\n\tpublic setHeight(_height: number | string): void {\n\t\tconst height = numberAsPixels(_height);\n\t\tif (this._height === height) {\n\t\t\treturn;\n\t\t}\n\t\tthis._height = height;\n\t\tthis.domNode.style.height = this._height;\n\t}\n\n\tpublic setTop(_top: number | string): void {\n\t\tconst top = numberAsPixels(_top);\n\t\tif (this._top === top) {\n\t\t\treturn;\n\t\t}\n\t\tthis._top = top;\n\t\tthis.domNode.style.top = this._top;\n\t}\n\n\tpublic setLeft(_left: number | string): void {\n\t\tconst left = numberAsPixels(_left);\n\t\tif (this._left === left) {\n\t\t\treturn;\n\t\t}\n\t\tthis._left = left;\n\t\tthis.domNode.style.left = this._left;\n\t}\n\n\tpublic setBottom(_bottom: number | string): void {\n\t\tconst bottom = numberAsPixels(_bottom);\n\t\tif (this._bottom === bottom) {\n\t\t\treturn;\n\t\t}\n\t\tthis._bottom = bottom;\n\t\tthis.domNode.style.bottom = this._bottom;\n\t}\n\n\tpublic setRight(_right: number | string): void {\n\t\tconst right = numberAsPixels(_right);\n\t\tif (this._right === right) {\n\t\t\treturn;\n\t\t}\n\t\tthis._right = right;\n\t\tthis.domNode.style.right = this._right;\n\t}\n\n\tpublic setPaddingTop(_paddingTop: number | string): void {\n\t\tconst paddingTop = numberAsPixels(_paddingTop);\n\t\tif (this._paddingTop === paddingTop) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingTop = paddingTop;\n\t\tthis.domNode.style.paddingTop = this._paddingTop;\n\t}\n\n\tpublic setPaddingLeft(_paddingLeft: number | string): void {\n\t\tconst paddingLeft = numberAsPixels(_paddingLeft);\n\t\tif (this._paddingLeft === paddingLeft) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingLeft = paddingLeft;\n\t\tthis.domNode.style.paddingLeft = this._paddingLeft;\n\t}\n\n\tpublic setPaddingBottom(_paddingBottom: number | string): void {\n\t\tconst paddingBottom = numberAsPixels(_paddingBottom);\n\t\tif (this._paddingBottom === paddingBottom) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingBottom = paddingBottom;\n\t\tthis.domNode.style.paddingBottom = this._paddingBottom;\n\t}\n\n\tpublic setPaddingRight(_paddingRight: number | string): void {\n\t\tconst paddingRight = numberAsPixels(_paddingRight);\n\t\tif (this._paddingRight === paddingRight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingRight = paddingRight;\n\t\tthis.domNode.style.paddingRight = this._paddingRight;\n\t}\n\n\tpublic setFontFamily(fontFamily: string): void {\n\t\tif (this._fontFamily === fontFamily) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontFamily = fontFamily;\n\t\tthis.domNode.style.fontFamily = this._fontFamily;\n\t}\n\n\tpublic setFontWeight(fontWeight: string): void {\n\t\tif (this._fontWeight === fontWeight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontWeight = fontWeight;\n\t\tthis.domNode.style.fontWeight = this._fontWeight;\n\t}\n\n\tpublic setFontSize(_fontSize: number | string): void {\n\t\tconst fontSize = numberAsPixels(_fontSize);\n\t\tif (this._fontSize === fontSize) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontSize = fontSize;\n\t\tthis.domNode.style.fontSize = this._fontSize;\n\t}\n\n\tpublic setFontStyle(fontStyle: string): void {\n\t\tif (this._fontStyle === fontStyle) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontStyle = fontStyle;\n\t\tthis.domNode.style.fontStyle = this._fontStyle;\n\t}\n\n\tpublic setFontFeatureSettings(fontFeatureSettings: string): void {\n\t\tif (this._fontFeatureSettings === fontFeatureSettings) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontFeatureSettings = fontFeatureSettings;\n\t\tthis.domNode.style.fontFeatureSettings = this._fontFeatureSettings;\n\t}\n\n\tpublic setFontVariationSettings(fontVariationSettings: string): void {\n\t\tif (this._fontVariationSettings === fontVariationSettings) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontVariationSettings = fontVariationSettings;\n\t\tthis.domNode.style.fontVariationSettings = this._fontVariationSettings;\n\t}\n\n\tpublic setTextDecoration(textDecoration: string): void {\n\t\tif (this._textDecoration === textDecoration) {\n\t\t\treturn;\n\t\t}\n\t\tthis._textDecoration = textDecoration;\n\t\tthis.domNode.style.textDecoration = this._textDecoration;\n\t}\n\n\tpublic setLineHeight(_lineHeight: number | string): void {\n\t\tconst lineHeight = numberAsPixels(_lineHeight);\n\t\tif (this._lineHeight === lineHeight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._lineHeight = lineHeight;\n\t\tthis.domNode.style.lineHeight = this._lineHeight;\n\t}\n\n\tpublic setLetterSpacing(_letterSpacing: number | string): void {\n\t\tconst letterSpacing = numberAsPixels(_letterSpacing);\n\t\tif (this._letterSpacing === letterSpacing) {\n\t\t\treturn;\n\t\t}\n\t\tthis._letterSpacing = letterSpacing;\n\t\tthis.domNode.style.letterSpacing = this._letterSpacing;\n\t}\n\n\tpublic setClassName(className: string): void {\n\t\tif (this._className === className) {\n\t\t\treturn;\n\t\t}\n\t\tthis._className = className;\n\t\tthis.domNode.className = this._className;\n\t}\n\n\tpublic toggleClassName(className: string, shouldHaveIt?: boolean): void {\n\t\tthis.domNode.classList.toggle(className, shouldHaveIt);\n\t\tthis._className = this.domNode.className;\n\t}\n\n\tpublic setDisplay(display: string): void {\n\t\tif (this._display === display) {\n\t\t\treturn;\n\t\t}\n\t\tthis._display = display;\n\t\tthis.domNode.style.display = this._display;\n\t}\n\n\tpublic setPosition(position: string): void {\n\t\tif (this._position === position) {\n\t\t\treturn;\n\t\t}\n\t\tthis._position = position;\n\t\tthis.domNode.style.position = this._position;\n\t}\n\n\tpublic setVisibility(visibility: string): void {\n\t\tif (this._visibility === visibility) {\n\t\t\treturn;\n\t\t}\n\t\tthis._visibility = visibility;\n\t\tthis.domNode.style.visibility = this._visibility;\n\t}\n\n\tpublic setColor(color: string): void {\n\t\tif (this._color === color) {\n\t\t\treturn;\n\t\t}\n\t\tthis._color = color;\n\t\tthis.domNode.style.color = this._color;\n\t}\n\n\tpublic setBackgroundColor(backgroundColor: string): void {\n\t\tif (this._backgroundColor === backgroundColor) {\n\t\t\treturn;\n\t\t}\n\t\tthis._backgroundColor = backgroundColor;\n\t\tthis.domNode.style.backgroundColor = this._backgroundColor;\n\t}\n\n\tpublic setLayerHinting(layerHint: boolean): void {\n\t\tif (this._layerHint === layerHint) {\n\t\t\treturn;\n\t\t}\n\t\tthis._layerHint = layerHint;\n\t\tthis.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';\n\t}\n\n\tpublic setBoxShadow(boxShadow: string): void {\n\t\tif (this._boxShadow === boxShadow) {\n\t\t\treturn;\n\t\t}\n\t\tthis._boxShadow = boxShadow;\n\t\tthis.domNode.style.boxShadow = boxShadow;\n\t}\n\n\tpublic setContain(contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint'): void {\n\t\tif (this._contain === contain) {\n\t\t\treturn;\n\t\t}\n\t\tthis._contain = contain;\n\t\t(this.domNode.style).contain = this._contain;\n\t}\n\n\tpublic setAttribute(name: string, value: string): void {\n\t\tthis.domNode.setAttribute(name, value);\n\t}\n\n\tpublic removeAttribute(name: string): void {\n\t\tthis.domNode.removeAttribute(name);\n\t}\n\n\tpublic appendChild(child: FastDomNode): void {\n\t\tthis.domNode.appendChild(child.domNode);\n\t}\n\n\tpublic removeChild(child: FastDomNode): void {\n\t\tthis.domNode.removeChild(child.domNode);\n\t}\n}\n\nfunction numberAsPixels(value: number | string): string {\n\treturn (typeof value === 'number' ? `${value}px` : value);\n}\n\nexport function createFastDomNode(domNode: T): FastDomNode {\n\treturn new FastDomNode(domNode);\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\nexport interface IPointerMoveCallback {\n\t(event: PointerEvent): void;\n}\n\nexport interface IOnStopCallback {\n\t(browserEvent?: PointerEvent | KeyboardEvent): void;\n}\n\nexport class GlobalPointerMoveMonitor implements IDisposable {\n\n\tprivate readonly _hooks = new DisposableStore();\n\tprivate _pointerMoveCallback: IPointerMoveCallback | null = null;\n\tprivate _onStopCallback: IOnStopCallback | null = null;\n\n\tpublic dispose(): void {\n\t\tthis.stopMonitoring(false);\n\t\tthis._hooks.dispose();\n\t}\n\n\tpublic stopMonitoring(invokeStopCallback: boolean, browserEvent?: PointerEvent | KeyboardEvent): void {\n\t\tif (!this.isMonitoring()) {\n\t\t\t// Not monitoring\n\t\t\treturn;\n\t\t}\n\n\t\t// Unhook\n\t\tthis._hooks.clear();\n\t\tthis._pointerMoveCallback = null;\n\t\tconst onStopCallback = this._onStopCallback;\n\t\tthis._onStopCallback = null;\n\n\t\tif (invokeStopCallback && onStopCallback) {\n\t\t\tonStopCallback(browserEvent);\n\t\t}\n\t}\n\n\tpublic isMonitoring(): boolean {\n\t\treturn !!this._pointerMoveCallback;\n\t}\n\n\tpublic startMonitoring(\n\t\tinitialElement: Element,\n\t\tpointerId: number,\n\t\tinitialButtons: number,\n\t\tpointerMoveCallback: IPointerMoveCallback,\n\t\tonStopCallback: IOnStopCallback\n\t): void {\n\t\tif (this.isMonitoring()) {\n\t\t\tthis.stopMonitoring(false);\n\t\t}\n\t\tthis._pointerMoveCallback = pointerMoveCallback;\n\t\tthis._onStopCallback = onStopCallback;\n\n\t\tlet eventSource: Element | Window = initialElement;\n\n\t\ttry {\n\t\t\tinitialElement.setPointerCapture(pointerId);\n\t\t\tthis._hooks.add(toDisposable(() => {\n\t\t\t\ttry {\n\t\t\t\t\tinitialElement.releasePointerCapture(pointerId);\n\t\t\t\t} catch (err) {\n\t\t\t\t\t// See https://github.com/microsoft/vscode/issues/161731\n\t\t\t\t\t//\n\t\t\t\t\t// `releasePointerCapture` sometimes fails when being invoked with the exception:\n\t\t\t\t\t// DOMException: Failed to execute 'releasePointerCapture' on 'Element':\n\t\t\t\t\t// No active pointer with the given id is found.\n\t\t\t\t\t//\n\t\t\t\t\t// There's no need to do anything in case of failure\n\t\t\t\t}\n\t\t\t}));\n\t\t} catch (err) {\n\t\t\t// See https://github.com/microsoft/vscode/issues/144584\n\t\t\t// See https://github.com/microsoft/vscode/issues/146947\n\t\t\t// `setPointerCapture` sometimes fails when being invoked\n\t\t\t// from a `mousedown` listener on macOS and Windows\n\t\t\t// and it always fails on Linux with the exception:\n\t\t\t// DOMException: Failed to execute 'setPointerCapture' on 'Element':\n\t\t\t// No active pointer with the given id is found.\n\t\t\t// In case of failure, we bind the listeners on the window\n\t\t\teventSource = dom.getWindow(initialElement);\n\t\t}\n\n\t\tthis._hooks.add(dom.addDisposableListener(\n\t\t\teventSource,\n\t\t\tdom.EventType.POINTER_MOVE,\n\t\t\t(e) => {\n\t\t\t\tif (e.buttons !== initialButtons) {\n\t\t\t\t\t// Buttons state has changed in the meantime\n\t\t\t\t\tthis.stopMonitoring(true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._pointerMoveCallback!(e);\n\t\t\t}\n\t\t));\n\n\t\tthis._hooks.add(dom.addDisposableListener(\n\t\t\teventSource,\n\t\t\tdom.EventType.POINTER_UP,\n\t\t\t(e: PointerEvent) => this.stopMonitoring(true)\n\t\t));\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nfunction createDecorator(mapFn: (fn: Function, key: string) => Function): Function {\n\treturn (target: any, key: string, descriptor: any) => {\n\t\tlet fnKey: string | null = null;\n\t\tlet fn: Function | null = null;\n\n\t\tif (typeof descriptor.value === 'function') {\n\t\t\tfnKey = 'value';\n\t\t\tfn = descriptor.value;\n\t\t} else if (typeof descriptor.get === 'function') {\n\t\t\tfnKey = 'get';\n\t\t\tfn = descriptor.get;\n\t\t}\n\n\t\tif (!fn) {\n\t\t\tthrow new Error('not supported');\n\t\t}\n\n\t\tdescriptor[fnKey!] = mapFn(fn, key);\n\t};\n}\n\nexport function memoize(_target: any, key: string, descriptor: any) {\n\tlet fnKey: string | null = null;\n\tlet fn: Function | null = null;\n\n\tif (typeof descriptor.value === 'function') {\n\t\tfnKey = 'value';\n\t\tfn = descriptor.value;\n\n\t\tif (fn!.length !== 0) {\n\t\t\tconsole.warn('Memoize should only be used in functions with zero parameters');\n\t\t}\n\t} else if (typeof descriptor.get === 'function') {\n\t\tfnKey = 'get';\n\t\tfn = descriptor.get;\n\t}\n\n\tif (!fn) {\n\t\tthrow new Error('not supported');\n\t}\n\n\tconst memoizeKey = `$memoize$${key}`;\n\tdescriptor[fnKey!] = function (...args: any[]) {\n\t\tif (!this.hasOwnProperty(memoizeKey)) {\n\t\t\tObject.defineProperty(this, memoizeKey, {\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: false,\n\t\t\t\tvalue: fn.apply(this, args)\n\t\t\t});\n\t\t}\n\n\t\treturn this[memoizeKey];\n\t};\n}\n\nexport interface IDebounceReducer {\n\t(previousValue: T, ...args: any[]): T;\n}\n\nexport function debounce(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$debounce$${key}`;\n\t\tconst resultKey = `$debounce$result$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\n\t\t\tclearTimeout(this[timerKey]);\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t\targs = [this[resultKey]];\n\t\t\t}\n\n\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\tfn.apply(this, args);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}, delay);\n\t\t};\n\t});\n}\n\nexport function throttle(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$throttle$timer$${key}`;\n\t\tconst resultKey = `$throttle$result$${key}`;\n\t\tconst lastRunKey = `$throttle$lastRun$${key}`;\n\t\tconst pendingKey = `$throttle$pending$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\t\t\tif (this[lastRunKey] === null || this[lastRunKey] === undefined) {\n\t\t\t\tthis[lastRunKey] = -Number.MAX_VALUE;\n\t\t\t}\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t}\n\n\t\t\tif (this[pendingKey]) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextTime = this[lastRunKey] + delay;\n\t\t\tif (nextTime <= Date.now()) {\n\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t} else {\n\t\t\t\tthis[pendingKey] = true;\n\t\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\t\tthis[pendingKey] = false;\n\t\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t\t}, nextTime - Date.now());\n\t\t\t}\n\t\t};\n\t});\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as DomUtils from 'vs/base/browser/dom';\nimport { mainWindow } from 'vs/base/browser/window';\nimport * as arrays from 'vs/base/common/arrays';\nimport { memoize } from 'vs/base/common/decorators';\nimport { Event as EventUtils } from 'vs/base/common/event';\nimport { Disposable, IDisposable, markAsSingleton, toDisposable } from 'vs/base/common/lifecycle';\nimport { LinkedList } from 'vs/base/common/linkedList';\n\nexport namespace EventType {\n\texport const Tap = '-xterm-gesturetap';\n\texport const Change = '-xterm-gesturechange';\n\texport const Start = '-xterm-gesturestart';\n\texport const End = '-xterm-gesturesend';\n\texport const Contextmenu = '-xterm-gesturecontextmenu';\n}\n\ninterface TouchData {\n\tid: number;\n\tinitialTarget: EventTarget;\n\tinitialTimeStamp: number;\n\tinitialPageX: number;\n\tinitialPageY: number;\n\trollingTimestamps: number[];\n\trollingPageX: number[];\n\trollingPageY: number[];\n}\n\nexport interface GestureEvent extends MouseEvent {\n\tinitialTarget: EventTarget | undefined;\n\ttranslationX: number;\n\ttranslationY: number;\n\tpageX: number;\n\tpageY: number;\n\ttapCount: number;\n}\n\ninterface Touch {\n\tidentifier: number;\n\tscreenX: number;\n\tscreenY: number;\n\tclientX: number;\n\tclientY: number;\n\tpageX: number;\n\tpageY: number;\n\tradiusX: number;\n\tradiusY: number;\n\trotationAngle: number;\n\tforce: number;\n\ttarget: Element;\n}\n\ninterface TouchList {\n\t[i: number]: Touch;\n\tlength: number;\n\titem(index: number): Touch;\n\tidentifiedTouch(id: number): Touch;\n}\n\ninterface TouchEvent extends Event {\n\ttouches: TouchList;\n\ttargetTouches: TouchList;\n\tchangedTouches: TouchList;\n}\n\nexport class Gesture extends Disposable {\n\n\tprivate static readonly SCROLL_FRICTION = -0.005;\n\tprivate static INSTANCE: Gesture;\n\tprivate static readonly HOLD_DELAY = 700;\n\n\tprivate dispatched = false;\n\tprivate readonly targets = new LinkedList();\n\tprivate readonly ignoreTargets = new LinkedList();\n\tprivate handle: IDisposable | null;\n\n\tprivate readonly activeTouches: { [id: number]: TouchData };\n\n\tprivate _lastSetTapCountTime: number;\n\n\tprivate static readonly CLEAR_TAP_COUNT_TIME = 400; // ms\n\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis.activeTouches = {};\n\t\tthis.handle = null;\n\t\tthis._lastSetTapCountTime = 0;\n\n\t\tthis._register(EventUtils.runAndSubscribe(DomUtils.onDidRegisterWindow, ({ window, disposables }) => {\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchstart', (e: TouchEvent) => this.onTouchStart(e), { passive: false }));\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchend', (e: TouchEvent) => this.onTouchEnd(window, e)));\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchmove', (e: TouchEvent) => this.onTouchMove(e), { passive: false }));\n\t\t}, { window: mainWindow, disposables: this._store }));\n\t}\n\n\tpublic static addTarget(element: HTMLElement): IDisposable {\n\t\tif (!Gesture.isTouchDevice()) {\n\t\t\treturn Disposable.None;\n\t\t}\n\t\tif (!Gesture.INSTANCE) {\n\t\t\tGesture.INSTANCE = markAsSingleton(new Gesture());\n\t\t}\n\n\t\tconst remove = Gesture.INSTANCE.targets.push(element);\n\t\treturn toDisposable(remove);\n\t}\n\n\tpublic static ignoreTarget(element: HTMLElement): IDisposable {\n\t\tif (!Gesture.isTouchDevice()) {\n\t\t\treturn Disposable.None;\n\t\t}\n\t\tif (!Gesture.INSTANCE) {\n\t\t\tGesture.INSTANCE = markAsSingleton(new Gesture());\n\t\t}\n\n\t\tconst remove = Gesture.INSTANCE.ignoreTargets.push(element);\n\t\treturn toDisposable(remove);\n\t}\n\n\t@memoize\n\tstatic isTouchDevice(): boolean {\n\t\t// `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be\n\t\t// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n\t\treturn 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0;\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this.handle) {\n\t\t\tthis.handle.dispose();\n\t\t\tthis.handle = null;\n\t\t}\n\n\t\tsuper.dispose();\n\t}\n\n\tprivate onTouchStart(e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tif (this.handle) {\n\t\t\tthis.handle.dispose();\n\t\t\tthis.handle = null;\n\t\t}\n\n\t\tfor (let i = 0, len = e.targetTouches.length; i < len; i++) {\n\t\t\tconst touch = e.targetTouches.item(i);\n\n\t\t\tthis.activeTouches[touch.identifier] = {\n\t\t\t\tid: touch.identifier,\n\t\t\t\tinitialTarget: touch.target,\n\t\t\t\tinitialTimeStamp: timestamp,\n\t\t\t\tinitialPageX: touch.pageX,\n\t\t\t\tinitialPageY: touch.pageY,\n\t\t\t\trollingTimestamps: [timestamp],\n\t\t\t\trollingPageX: [touch.pageX],\n\t\t\t\trollingPageY: [touch.pageY]\n\t\t\t};\n\n\t\t\tconst evt = this.newGestureEvent(EventType.Start, touch.target);\n\t\t\tevt.pageX = touch.pageX;\n\t\t\tevt.pageY = touch.pageY;\n\t\t\tthis.dispatchEvent(evt);\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n\n\tprivate onTouchEnd(targetWindow: Window, e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tconst activeTouchCount = Object.keys(this.activeTouches).length;\n\n\t\tfor (let i = 0, len = e.changedTouches.length; i < len; i++) {\n\n\t\t\tconst touch = e.changedTouches.item(i);\n\n\t\t\tif (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n\t\t\t\tconsole.warn('move of an UNKNOWN touch', touch);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst data = this.activeTouches[touch.identifier],\n\t\t\t\tholdTime = Date.now() - data.initialTimeStamp;\n\n\t\t\tif (holdTime < Gesture.HOLD_DELAY\n\t\t\t\t&& Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)!) < 30\n\t\t\t\t&& Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)!) < 30) {\n\n\t\t\t\tconst evt = this.newGestureEvent(EventType.Tap, data.initialTarget);\n\t\t\t\tevt.pageX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tevt.pageY = arrays.tail(data.rollingPageY)!;\n\t\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t} else if (holdTime >= Gesture.HOLD_DELAY\n\t\t\t\t&& Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)!) < 30\n\t\t\t\t&& Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)!) < 30) {\n\n\t\t\t\tconst evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget);\n\t\t\t\tevt.pageX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tevt.pageY = arrays.tail(data.rollingPageY)!;\n\t\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t} else if (activeTouchCount === 1) {\n\t\t\t\tconst finalX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tconst finalY = arrays.tail(data.rollingPageY)!;\n\n\t\t\t\tconst deltaT = arrays.tail(data.rollingTimestamps)! - data.rollingTimestamps[0];\n\t\t\t\tconst deltaX = finalX - data.rollingPageX[0];\n\t\t\t\tconst deltaY = finalY - data.rollingPageY[0];\n\n\t\t\t\t// We need to get all the dispatch targets on the start of the inertia event\n\t\t\t\tconst dispatchTo = [...this.targets].filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget));\n\t\t\t\tthis.inertia(targetWindow, dispatchTo, timestamp,\t// time now\n\t\t\t\t\tMath.abs(deltaX) / deltaT,\t\t\t\t\t\t// speed\n\t\t\t\t\tdeltaX > 0 ? 1 : -1,\t\t\t\t\t\t\t// x direction\n\t\t\t\t\tfinalX,\t\t\t\t\t\t\t\t\t\t\t// x now\n\t\t\t\t\tMath.abs(deltaY) / deltaT, \t\t\t\t\t// y speed\n\t\t\t\t\tdeltaY > 0 ? 1 : -1,\t\t\t\t\t\t\t// y direction\n\t\t\t\t\tfinalY\t\t\t\t\t\t\t\t\t\t\t// y now\n\t\t\t\t);\n\t\t\t}\n\n\n\t\t\tthis.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget));\n\t\t\t// forget about this touch\n\t\t\tdelete this.activeTouches[touch.identifier];\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n\n\tprivate newGestureEvent(type: string, initialTarget?: EventTarget): GestureEvent {\n\t\tconst event = document.createEvent('CustomEvent') as unknown as GestureEvent;\n\t\tevent.initEvent(type, false, true);\n\t\tevent.initialTarget = initialTarget;\n\t\tevent.tapCount = 0;\n\t\treturn event;\n\t}\n\n\tprivate dispatchEvent(event: GestureEvent): void {\n\t\tif (event.type === EventType.Tap) {\n\t\t\tconst currentTime = (new Date()).getTime();\n\t\t\tlet setTapCount = 0;\n\t\t\tif (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) {\n\t\t\t\tsetTapCount = 1;\n\t\t\t} else {\n\t\t\t\tsetTapCount = 2;\n\t\t\t}\n\n\t\t\tthis._lastSetTapCountTime = currentTime;\n\t\t\tevent.tapCount = setTapCount;\n\t\t} else if (event.type === EventType.Change || event.type === EventType.Contextmenu) {\n\t\t\t// tap is canceled by scrolling or context menu\n\t\t\tthis._lastSetTapCountTime = 0;\n\t\t}\n\n\t\tif (event.initialTarget instanceof Node) {\n\t\t\tfor (const ignoreTarget of this.ignoreTargets) {\n\t\t\t\tif (ignoreTarget.contains(event.initialTarget)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst targets: [number, HTMLElement][] = [];\n\t\t\tfor (const target of this.targets) {\n\t\t\t\tif (target.contains(event.initialTarget)) {\n\t\t\t\t\tlet depth = 0;\n\t\t\t\t\tlet now: Node | null = event.initialTarget;\n\t\t\t\t\twhile (now && now !== target) {\n\t\t\t\t\t\tdepth++;\n\t\t\t\t\t\tnow = now.parentElement;\n\t\t\t\t\t}\n\t\t\t\t\ttargets.push([depth, target]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttargets.sort((a, b) => a[0] - b[0]);\n\n\t\t\tfor (const [_, target] of targets) {\n\t\t\t\ttarget.dispatchEvent(event);\n\t\t\t\tthis.dispatched = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate inertia(targetWindow: Window, dispatchTo: readonly EventTarget[], t1: number, vX: number, dirX: number, x: number, vY: number, dirY: number, y: number): void {\n\t\tthis.handle = DomUtils.scheduleAtNextAnimationFrame(targetWindow, () => {\n\t\t\tconst now = Date.now();\n\n\t\t\t// velocity: old speed + accel_over_time\n\t\t\tconst deltaT = now - t1;\n\t\t\tlet delta_pos_x = 0, delta_pos_y = 0;\n\t\t\tlet stopped = true;\n\n\t\t\tvX += Gesture.SCROLL_FRICTION * deltaT;\n\t\t\tvY += Gesture.SCROLL_FRICTION * deltaT;\n\n\t\t\tif (vX > 0) {\n\t\t\t\tstopped = false;\n\t\t\t\tdelta_pos_x = dirX * vX * deltaT;\n\t\t\t}\n\n\t\t\tif (vY > 0) {\n\t\t\t\tstopped = false;\n\t\t\t\tdelta_pos_y = dirY * vY * deltaT;\n\t\t\t}\n\n\t\t\t// dispatch translation event\n\t\t\tconst evt = this.newGestureEvent(EventType.Change);\n\t\t\tevt.translationX = delta_pos_x;\n\t\t\tevt.translationY = delta_pos_y;\n\t\t\tdispatchTo.forEach(d => d.dispatchEvent(evt));\n\n\t\t\tif (!stopped) {\n\t\t\t\tthis.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate onTouchMove(e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tfor (let i = 0, len = e.changedTouches.length; i < len; i++) {\n\n\t\t\tconst touch = e.changedTouches.item(i);\n\n\t\t\tif (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n\t\t\t\tconsole.warn('end of an UNKNOWN touch', touch);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst data = this.activeTouches[touch.identifier];\n\n\t\t\tconst evt = this.newGestureEvent(EventType.Change, data.initialTarget);\n\t\t\tevt.translationX = touch.pageX - arrays.tail(data.rollingPageX)!;\n\t\t\tevt.translationY = touch.pageY - arrays.tail(data.rollingPageY)!;\n\t\t\tevt.pageX = touch.pageX;\n\t\t\tevt.pageY = touch.pageY;\n\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t// only keep a few data points, to average the final speed\n\t\t\tif (data.rollingPageX.length > 3) {\n\t\t\t\tdata.rollingPageX.shift();\n\t\t\t\tdata.rollingPageY.shift();\n\t\t\t\tdata.rollingTimestamps.shift();\n\t\t\t}\n\n\t\t\tdata.rollingPageX.push(touch.pageX);\n\t\t\tdata.rollingPageY.push(touch.pageY);\n\t\t\tdata.rollingTimestamps.push(timestamp);\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';\nimport { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';\nimport { Gesture } from 'vs/base/browser/touch';\nimport { Disposable, IDisposable } from 'vs/base/common/lifecycle';\n\nexport abstract class Widget extends Disposable {\n\n\tprotected onclick(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmousedown(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmouseover(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmouseleave(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_LEAVE, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onkeydown(domNode: HTMLElement, listener: (e: IKeyboardEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));\n\t}\n\n\tprotected onkeyup(domNode: HTMLElement, listener: (e: IKeyboardEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));\n\t}\n\n\tprotected oninput(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener));\n\t}\n\n\tprotected onblur(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener));\n\t}\n\n\tprotected onfocus(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener));\n\t}\n\n\tprotected onchange(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.CHANGE, listener));\n\t}\n\n\tprotected ignoreGesture(domNode: HTMLElement): IDisposable {\n\t\treturn Gesture.ignoreTarget(domNode);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { GlobalPointerMoveMonitor } from 'vs/base/browser/globalPointerMoveMonitor';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport * as dom from 'vs/base/browser/dom';\n\n/**\n * The arrow image size.\n */\nexport const ARROW_IMG_SIZE = 11;\n\nexport interface ScrollbarArrowOptions {\n\tonActivate: () => void;\n\tclassName: string;\n\t// icon: ThemeIcon;\n\n\tbgWidth: number;\n\tbgHeight: number;\n\n\ttop?: number;\n\tleft?: number;\n\tbottom?: number;\n\tright?: number;\n}\n\nexport class ScrollbarArrow extends Widget {\n\n\tprivate _onActivate: () => void;\n\tpublic bgDomNode: HTMLElement;\n\tpublic domNode: HTMLElement;\n\tprivate _pointerdownRepeatTimer: dom.WindowIntervalTimer;\n\tprivate _pointerdownScheduleRepeatTimer: TimeoutTimer;\n\tprivate _pointerMoveMonitor: GlobalPointerMoveMonitor;\n\n\tconstructor(opts: ScrollbarArrowOptions) {\n\t\tsuper();\n\t\tthis._onActivate = opts.onActivate;\n\n\t\tthis.bgDomNode = document.createElement('div');\n\t\tthis.bgDomNode.className = 'arrow-background';\n\t\tthis.bgDomNode.style.position = 'absolute';\n\t\tthis.bgDomNode.style.width = opts.bgWidth + 'px';\n\t\tthis.bgDomNode.style.height = opts.bgHeight + 'px';\n\t\tif (typeof opts.top !== 'undefined') {\n\t\t\tthis.bgDomNode.style.top = '0px';\n\t\t}\n\t\tif (typeof opts.left !== 'undefined') {\n\t\t\tthis.bgDomNode.style.left = '0px';\n\t\t}\n\t\tif (typeof opts.bottom !== 'undefined') {\n\t\t\tthis.bgDomNode.style.bottom = '0px';\n\t\t}\n\t\tif (typeof opts.right !== 'undefined') {\n\t\t\tthis.bgDomNode.style.right = '0px';\n\t\t}\n\n\t\tthis.domNode = document.createElement('div');\n\t\tthis.domNode.className = opts.className;\n\t\t// this.domNode.classList.add(...ThemeIcon.asClassNameArray(opts.icon));\n\n\t\tthis.domNode.style.position = 'absolute';\n\t\tthis.domNode.style.width = ARROW_IMG_SIZE + 'px';\n\t\tthis.domNode.style.height = ARROW_IMG_SIZE + 'px';\n\t\tif (typeof opts.top !== 'undefined') {\n\t\t\tthis.domNode.style.top = opts.top + 'px';\n\t\t}\n\t\tif (typeof opts.left !== 'undefined') {\n\t\t\tthis.domNode.style.left = opts.left + 'px';\n\t\t}\n\t\tif (typeof opts.bottom !== 'undefined') {\n\t\t\tthis.domNode.style.bottom = opts.bottom + 'px';\n\t\t}\n\t\tif (typeof opts.right !== 'undefined') {\n\t\t\tthis.domNode.style.right = opts.right + 'px';\n\t\t}\n\n\t\tthis._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n\t\tthis._register(dom.addStandardDisposableListener(this.bgDomNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n\t\tthis._register(dom.addStandardDisposableListener(this.domNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n\n\t\tthis._pointerdownRepeatTimer = this._register(new dom.WindowIntervalTimer());\n\t\tthis._pointerdownScheduleRepeatTimer = this._register(new TimeoutTimer());\n\t}\n\n\tprivate _arrowPointerDown(e: PointerEvent): void {\n\t\tif (!e.target || !(e.target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst scheduleRepeater = () => {\n\t\t\tthis._pointerdownRepeatTimer.cancelAndSet(() => this._onActivate(), 1000 / 24, dom.getWindow(e));\n\t\t};\n\n\t\tthis._onActivate();\n\t\tthis._pointerdownRepeatTimer.cancel();\n\t\tthis._pointerdownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);\n\n\t\tthis._pointerMoveMonitor.startMonitoring(\n\t\t\te.target,\n\t\t\te.pointerId,\n\t\t\te.buttons,\n\t\t\t(pointerMoveData) => { /* Intentional empty */ },\n\t\t\t() => {\n\t\t\t\tthis._pointerdownRepeatTimer.cancel();\n\t\t\t\tthis._pointerdownScheduleRepeatTimer.cancel();\n\t\t\t}\n\t\t);\n\n\t\te.preventDefault();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, IDisposable } from 'vs/base/common/lifecycle';\n\nexport const enum ScrollbarVisibility {\n\tAuto = 1,\n\tHidden = 2,\n\tVisible = 3\n}\n\nexport interface ScrollEvent {\n\tinSmoothScrolling: boolean;\n\n\toldWidth: number;\n\toldScrollWidth: number;\n\toldScrollLeft: number;\n\n\twidth: number;\n\tscrollWidth: number;\n\tscrollLeft: number;\n\n\toldHeight: number;\n\toldScrollHeight: number;\n\toldScrollTop: number;\n\n\theight: number;\n\tscrollHeight: number;\n\tscrollTop: number;\n\n\twidthChanged: boolean;\n\tscrollWidthChanged: boolean;\n\tscrollLeftChanged: boolean;\n\n\theightChanged: boolean;\n\tscrollHeightChanged: boolean;\n\tscrollTopChanged: boolean;\n}\n\nexport class ScrollState implements IScrollDimensions, IScrollPosition {\n\t_scrollStateBrand: void = undefined;\n\n\tpublic readonly rawScrollLeft: number;\n\tpublic readonly rawScrollTop: number;\n\n\tpublic readonly width: number;\n\tpublic readonly scrollWidth: number;\n\tpublic readonly scrollLeft: number;\n\tpublic readonly height: number;\n\tpublic readonly scrollHeight: number;\n\tpublic readonly scrollTop: number;\n\n\tconstructor(\n\t\tprivate readonly _forceIntegerValues: boolean,\n\t\twidth: number,\n\t\tscrollWidth: number,\n\t\tscrollLeft: number,\n\t\theight: number,\n\t\tscrollHeight: number,\n\t\tscrollTop: number\n\t) {\n\t\tif (this._forceIntegerValues) {\n\t\t\twidth = width | 0;\n\t\t\tscrollWidth = scrollWidth | 0;\n\t\t\tscrollLeft = scrollLeft | 0;\n\t\t\theight = height | 0;\n\t\t\tscrollHeight = scrollHeight | 0;\n\t\t\tscrollTop = scrollTop | 0;\n\t\t}\n\n\t\tthis.rawScrollLeft = scrollLeft; // before validation\n\t\tthis.rawScrollTop = scrollTop; // before validation\n\n\t\tif (width < 0) {\n\t\t\twidth = 0;\n\t\t}\n\t\tif (scrollLeft + width > scrollWidth) {\n\t\t\tscrollLeft = scrollWidth - width;\n\t\t}\n\t\tif (scrollLeft < 0) {\n\t\t\tscrollLeft = 0;\n\t\t}\n\n\t\tif (height < 0) {\n\t\t\theight = 0;\n\t\t}\n\t\tif (scrollTop + height > scrollHeight) {\n\t\t\tscrollTop = scrollHeight - height;\n\t\t}\n\t\tif (scrollTop < 0) {\n\t\t\tscrollTop = 0;\n\t\t}\n\n\t\tthis.width = width;\n\t\tthis.scrollWidth = scrollWidth;\n\t\tthis.scrollLeft = scrollLeft;\n\t\tthis.height = height;\n\t\tthis.scrollHeight = scrollHeight;\n\t\tthis.scrollTop = scrollTop;\n\t}\n\n\tpublic equals(other: ScrollState): boolean {\n\t\treturn (\n\t\t\tthis.rawScrollLeft === other.rawScrollLeft\n\t\t\t&& this.rawScrollTop === other.rawScrollTop\n\t\t\t&& this.width === other.width\n\t\t\t&& this.scrollWidth === other.scrollWidth\n\t\t\t&& this.scrollLeft === other.scrollLeft\n\t\t\t&& this.height === other.height\n\t\t\t&& this.scrollHeight === other.scrollHeight\n\t\t\t&& this.scrollTop === other.scrollTop\n\t\t);\n\t}\n\n\tpublic withScrollDimensions(update: INewScrollDimensions, useRawScrollPositions: boolean): ScrollState {\n\t\treturn new ScrollState(\n\t\t\tthis._forceIntegerValues,\n\t\t\t(typeof update.width !== 'undefined' ? update.width : this.width),\n\t\t\t(typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth),\n\t\t\tuseRawScrollPositions ? this.rawScrollLeft : this.scrollLeft,\n\t\t\t(typeof update.height !== 'undefined' ? update.height : this.height),\n\t\t\t(typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight),\n\t\t\tuseRawScrollPositions ? this.rawScrollTop : this.scrollTop\n\t\t);\n\t}\n\n\tpublic withScrollPosition(update: INewScrollPosition): ScrollState {\n\t\treturn new ScrollState(\n\t\t\tthis._forceIntegerValues,\n\t\t\tthis.width,\n\t\t\tthis.scrollWidth,\n\t\t\t(typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft),\n\t\t\tthis.height,\n\t\t\tthis.scrollHeight,\n\t\t\t(typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop)\n\t\t);\n\t}\n\n\tpublic createScrollEvent(previous: ScrollState, inSmoothScrolling: boolean): ScrollEvent {\n\t\tconst widthChanged = (this.width !== previous.width);\n\t\tconst scrollWidthChanged = (this.scrollWidth !== previous.scrollWidth);\n\t\tconst scrollLeftChanged = (this.scrollLeft !== previous.scrollLeft);\n\n\t\tconst heightChanged = (this.height !== previous.height);\n\t\tconst scrollHeightChanged = (this.scrollHeight !== previous.scrollHeight);\n\t\tconst scrollTopChanged = (this.scrollTop !== previous.scrollTop);\n\n\t\treturn {\n\t\t\tinSmoothScrolling: inSmoothScrolling,\n\t\t\toldWidth: previous.width,\n\t\t\toldScrollWidth: previous.scrollWidth,\n\t\t\toldScrollLeft: previous.scrollLeft,\n\n\t\t\twidth: this.width,\n\t\t\tscrollWidth: this.scrollWidth,\n\t\t\tscrollLeft: this.scrollLeft,\n\n\t\t\toldHeight: previous.height,\n\t\t\toldScrollHeight: previous.scrollHeight,\n\t\t\toldScrollTop: previous.scrollTop,\n\n\t\t\theight: this.height,\n\t\t\tscrollHeight: this.scrollHeight,\n\t\t\tscrollTop: this.scrollTop,\n\n\t\t\twidthChanged: widthChanged,\n\t\t\tscrollWidthChanged: scrollWidthChanged,\n\t\t\tscrollLeftChanged: scrollLeftChanged,\n\n\t\t\theightChanged: heightChanged,\n\t\t\tscrollHeightChanged: scrollHeightChanged,\n\t\t\tscrollTopChanged: scrollTopChanged,\n\t\t};\n\t}\n\n}\n\nexport interface IScrollDimensions {\n\treadonly width: number;\n\treadonly scrollWidth: number;\n\treadonly height: number;\n\treadonly scrollHeight: number;\n}\nexport interface INewScrollDimensions {\n\twidth?: number;\n\tscrollWidth?: number;\n\theight?: number;\n\tscrollHeight?: number;\n}\n\nexport interface IScrollPosition {\n\treadonly scrollLeft: number;\n\treadonly scrollTop: number;\n}\nexport interface ISmoothScrollPosition {\n\treadonly scrollLeft: number;\n\treadonly scrollTop: number;\n\n\treadonly width: number;\n\treadonly height: number;\n}\nexport interface INewScrollPosition {\n\tscrollLeft?: number;\n\tscrollTop?: number;\n}\n\nexport interface IScrollableOptions {\n\t/**\n\t * Define if the scroll values should always be integers.\n\t */\n\tforceIntegerValues: boolean;\n\t/**\n\t * Set the duration (ms) used for smooth scroll animations.\n\t */\n\tsmoothScrollDuration: number;\n\t/**\n\t * A function to schedule an update at the next frame (used for smooth scroll animations).\n\t */\n\tscheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;\n}\n\nexport class Scrollable extends Disposable {\n\n\t_scrollableBrand: void = undefined;\n\n\tprivate _smoothScrollDuration: number;\n\tprivate readonly _scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;\n\tprivate _state: ScrollState;\n\tprivate _smoothScrolling: SmoothScrollingOperation | null;\n\n\tprivate _onScroll = this._register(new Emitter());\n\tpublic readonly onScroll: Event = this._onScroll.event;\n\n\tconstructor(options: IScrollableOptions) {\n\t\tsuper();\n\n\t\tthis._smoothScrollDuration = options.smoothScrollDuration;\n\t\tthis._scheduleAtNextAnimationFrame = options.scheduleAtNextAnimationFrame;\n\t\tthis._state = new ScrollState(options.forceIntegerValues, 0, 0, 0, 0, 0, 0);\n\t\tthis._smoothScrolling = null;\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._smoothScrolling) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tpublic setSmoothScrollDuration(smoothScrollDuration: number): void {\n\t\tthis._smoothScrollDuration = smoothScrollDuration;\n\t}\n\n\tpublic validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition {\n\t\treturn this._state.withScrollPosition(scrollPosition);\n\t}\n\n\tpublic getScrollDimensions(): IScrollDimensions {\n\t\treturn this._state;\n\t}\n\n\tpublic setScrollDimensions(dimensions: INewScrollDimensions, useRawScrollPositions: boolean): void {\n\t\tconst newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);\n\t\tthis._setState(newState, Boolean(this._smoothScrolling));\n\n\t\t// Validate outstanding animated scroll position target\n\t\tthis._smoothScrolling?.acceptScrollDimensions(this._state);\n\t}\n\n\t/**\n\t * Returns the final scroll position that the instance will have once the smooth scroll animation concludes.\n\t * If no scroll animation is occurring, it will return the current scroll position instead.\n\t */\n\tpublic getFutureScrollPosition(): IScrollPosition {\n\t\tif (this._smoothScrolling) {\n\t\t\treturn this._smoothScrolling.to;\n\t\t}\n\t\treturn this._state;\n\t}\n\n\t/**\n\t * Returns the current scroll position.\n\t * Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.\n\t */\n\tpublic getCurrentScrollPosition(): IScrollPosition {\n\t\treturn this._state;\n\t}\n\n\tpublic setScrollPositionNow(update: INewScrollPosition): void {\n\t\t// no smooth scrolling requested\n\t\tconst newState = this._state.withScrollPosition(update);\n\n\t\t// Terminate any outstanding smooth scrolling\n\t\tif (this._smoothScrolling) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t}\n\n\t\tthis._setState(newState, false);\n\t}\n\n\tpublic setScrollPositionSmooth(update: INewScrollPosition, reuseAnimation?: boolean): void {\n\t\tif (this._smoothScrollDuration === 0) {\n\t\t\t// Smooth scrolling not supported.\n\t\t\treturn this.setScrollPositionNow(update);\n\t\t}\n\n\t\tif (this._smoothScrolling) {\n\t\t\t// Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop\n\t\t\tupdate = {\n\t\t\t\tscrollLeft: (typeof update.scrollLeft === 'undefined' ? this._smoothScrolling.to.scrollLeft : update.scrollLeft),\n\t\t\t\tscrollTop: (typeof update.scrollTop === 'undefined' ? this._smoothScrolling.to.scrollTop : update.scrollTop)\n\t\t\t};\n\n\t\t\t// Validate `update`\n\t\t\tconst validTarget = this._state.withScrollPosition(update);\n\n\t\t\tif (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) {\n\t\t\t\t// No need to interrupt or extend the current animation since we're going to the same place\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet newSmoothScrolling: SmoothScrollingOperation;\n\t\t\tif (reuseAnimation) {\n\t\t\t\tnewSmoothScrolling = new SmoothScrollingOperation(this._smoothScrolling.from, validTarget, this._smoothScrolling.startTime, this._smoothScrolling.duration);\n\t\t\t} else {\n\t\t\t\tnewSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration);\n\t\t\t}\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = newSmoothScrolling;\n\t\t} else {\n\t\t\t// Validate `update`\n\t\t\tconst validTarget = this._state.withScrollPosition(update);\n\n\t\t\tthis._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration);\n\t\t}\n\n\t\t// Begin smooth scrolling animation\n\t\tthis._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n\t\t\tif (!this._smoothScrolling) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._smoothScrolling.animationFrameDisposable = null;\n\t\t\tthis._performSmoothScrolling();\n\t\t});\n\t}\n\n\tpublic hasPendingScrollAnimation(): boolean {\n\t\treturn Boolean(this._smoothScrolling);\n\t}\n\n\tprivate _performSmoothScrolling(): void {\n\t\tif (!this._smoothScrolling) {\n\t\t\treturn;\n\t\t}\n\t\tconst update = this._smoothScrolling.tick();\n\t\tconst newState = this._state.withScrollPosition(update);\n\n\t\tthis._setState(newState, true);\n\n\t\tif (!this._smoothScrolling) {\n\t\t\t// Looks like someone canceled the smooth scrolling\n\t\t\t// from the scroll event handler\n\t\t\treturn;\n\t\t}\n\n\t\tif (update.isDone) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// Continue smooth scrolling animation\n\t\tthis._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n\t\t\tif (!this._smoothScrolling) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._smoothScrolling.animationFrameDisposable = null;\n\t\t\tthis._performSmoothScrolling();\n\t\t});\n\t}\n\n\tprivate _setState(newState: ScrollState, inSmoothScrolling: boolean): void {\n\t\tconst oldState = this._state;\n\t\tif (oldState.equals(newState)) {\n\t\t\t// no change\n\t\t\treturn;\n\t\t}\n\t\tthis._state = newState;\n\t\tthis._onScroll.fire(this._state.createScrollEvent(oldState, inSmoothScrolling));\n\t}\n}\n\nexport class SmoothScrollingUpdate {\n\n\tpublic readonly scrollLeft: number;\n\tpublic readonly scrollTop: number;\n\tpublic readonly isDone: boolean;\n\n\tconstructor(scrollLeft: number, scrollTop: number, isDone: boolean) {\n\t\tthis.scrollLeft = scrollLeft;\n\t\tthis.scrollTop = scrollTop;\n\t\tthis.isDone = isDone;\n\t}\n\n}\n\ninterface IAnimation {\n\t(completion: number): number;\n}\n\nfunction createEaseOutCubic(from: number, to: number): IAnimation {\n\tconst delta = to - from;\n\treturn function (completion: number): number {\n\t\treturn from + delta * easeOutCubic(completion);\n\t};\n}\n\nfunction createComposed(a: IAnimation, b: IAnimation, cut: number): IAnimation {\n\treturn function (completion: number): number {\n\t\tif (completion < cut) {\n\t\t\treturn a(completion / cut);\n\t\t}\n\t\treturn b((completion - cut) / (1 - cut));\n\t};\n}\n\nexport class SmoothScrollingOperation {\n\n\tpublic readonly from: ISmoothScrollPosition;\n\tpublic to: ISmoothScrollPosition;\n\tpublic readonly duration: number;\n\tpublic readonly startTime: number;\n\tpublic animationFrameDisposable: IDisposable | null;\n\n\tprivate scrollLeft!: IAnimation;\n\tprivate scrollTop!: IAnimation;\n\n\tconstructor(from: ISmoothScrollPosition, to: ISmoothScrollPosition, startTime: number, duration: number) {\n\t\tthis.from = from;\n\t\tthis.to = to;\n\t\tthis.duration = duration;\n\t\tthis.startTime = startTime;\n\n\t\tthis.animationFrameDisposable = null;\n\n\t\tthis._initAnimations();\n\t}\n\n\tprivate _initAnimations(): void {\n\t\tthis.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);\n\t\tthis.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);\n\t}\n\n\tprivate _initAnimation(from: number, to: number, viewportSize: number): IAnimation {\n\t\tconst delta = Math.abs(from - to);\n\t\tif (delta > 2.5 * viewportSize) {\n\t\t\tlet stop1: number, stop2: number;\n\t\t\tif (from < to) {\n\t\t\t\t// scroll to 75% of the viewportSize\n\t\t\t\tstop1 = from + 0.75 * viewportSize;\n\t\t\t\tstop2 = to - 0.75 * viewportSize;\n\t\t\t} else {\n\t\t\t\tstop1 = from - 0.75 * viewportSize;\n\t\t\t\tstop2 = to + 0.75 * viewportSize;\n\t\t\t}\n\t\t\treturn createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);\n\t\t}\n\t\treturn createEaseOutCubic(from, to);\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this.animationFrameDisposable !== null) {\n\t\t\tthis.animationFrameDisposable.dispose();\n\t\t\tthis.animationFrameDisposable = null;\n\t\t}\n\t}\n\n\tpublic acceptScrollDimensions(state: ScrollState): void {\n\t\tthis.to = state.withScrollPosition(this.to);\n\t\tthis._initAnimations();\n\t}\n\n\tpublic tick(): SmoothScrollingUpdate {\n\t\treturn this._tick(Date.now());\n\t}\n\n\tprotected _tick(now: number): SmoothScrollingUpdate {\n\t\tconst completion = (now - this.startTime) / this.duration;\n\n\t\tif (completion < 1) {\n\t\t\tconst newScrollLeft = this.scrollLeft(completion);\n\t\t\tconst newScrollTop = this.scrollTop(completion);\n\t\t\treturn new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);\n\t\t}\n\n\t\treturn new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);\n\t}\n\n\tpublic combine(from: ISmoothScrollPosition, to: ISmoothScrollPosition, duration: number): SmoothScrollingOperation {\n\t\treturn SmoothScrollingOperation.start(from, to, duration);\n\t}\n\n\tpublic static start(from: ISmoothScrollPosition, to: ISmoothScrollPosition, duration: number): SmoothScrollingOperation {\n\t\t// +10 / -10 : pretend the animation already started for a quicker response to a scroll request\n\t\tduration = duration + 10;\n\t\tconst startTime = Date.now() - 10;\n\n\t\treturn new SmoothScrollingOperation(from, to, startTime, duration);\n\t}\n}\n\nfunction easeInCubic(t: number) {\n\treturn Math.pow(t, 3);\n}\n\nfunction easeOutCubic(t: number) {\n\treturn 1 - easeInCubic(1 - t);\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { FastDomNode } from 'vs/base/browser/fastDomNode';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { ScrollbarVisibility } from 'vs/base/common/scrollable';\n\nexport class ScrollbarVisibilityController extends Disposable {\n\tprivate _visibility: ScrollbarVisibility;\n\tprivate _visibleClassName: string;\n\tprivate _invisibleClassName: string;\n\tprivate _domNode: FastDomNode | null;\n\tprivate _rawShouldBeVisible: boolean;\n\tprivate _shouldBeVisible: boolean;\n\tprivate _isNeeded: boolean;\n\tprivate _isVisible: boolean;\n\tprivate _revealTimer: TimeoutTimer;\n\n\tconstructor(visibility: ScrollbarVisibility, visibleClassName: string, invisibleClassName: string) {\n\t\tsuper();\n\t\tthis._visibility = visibility;\n\t\tthis._visibleClassName = visibleClassName;\n\t\tthis._invisibleClassName = invisibleClassName;\n\t\tthis._domNode = null;\n\t\tthis._isVisible = false;\n\t\tthis._isNeeded = false;\n\t\tthis._rawShouldBeVisible = false;\n\t\tthis._shouldBeVisible = false;\n\t\tthis._revealTimer = this._register(new TimeoutTimer());\n\t}\n\n\tpublic setVisibility(visibility: ScrollbarVisibility): void {\n\t\tif (this._visibility !== visibility) {\n\t\t\tthis._visibility = visibility;\n\t\t\tthis._updateShouldBeVisible();\n\t\t}\n\t}\n\n\t// ----------------- Hide / Reveal\n\n\tpublic setShouldBeVisible(rawShouldBeVisible: boolean): void {\n\t\tthis._rawShouldBeVisible = rawShouldBeVisible;\n\t\tthis._updateShouldBeVisible();\n\t}\n\n\tprivate _applyVisibilitySetting(): boolean {\n\t\tif (this._visibility === ScrollbarVisibility.Hidden) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this._visibility === ScrollbarVisibility.Visible) {\n\t\t\treturn true;\n\t\t}\n\t\treturn this._rawShouldBeVisible;\n\t}\n\n\tprivate _updateShouldBeVisible(): void {\n\t\tconst shouldBeVisible = this._applyVisibilitySetting();\n\n\t\tif (this._shouldBeVisible !== shouldBeVisible) {\n\t\t\tthis._shouldBeVisible = shouldBeVisible;\n\t\t\tthis.ensureVisibility();\n\t\t}\n\t}\n\n\tpublic setIsNeeded(isNeeded: boolean): void {\n\t\tif (this._isNeeded !== isNeeded) {\n\t\t\tthis._isNeeded = isNeeded;\n\t\t\tthis.ensureVisibility();\n\t\t}\n\t}\n\n\tpublic setDomNode(domNode: FastDomNode): void {\n\t\tthis._domNode = domNode;\n\t\tthis._domNode.setClassName(this._invisibleClassName);\n\n\t\t// Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration\n\t\tthis.setShouldBeVisible(false);\n\t}\n\n\tpublic ensureVisibility(): void {\n\n\t\tif (!this._isNeeded) {\n\t\t\t// Nothing to be rendered\n\t\t\tthis._hide(false);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._shouldBeVisible) {\n\t\t\tthis._reveal();\n\t\t} else {\n\t\t\tthis._hide(true);\n\t\t}\n\t}\n\n\tprivate _reveal(): void {\n\t\tif (this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = true;\n\n\t\t// The CSS animation doesn't play otherwise\n\t\tthis._revealTimer.setIfNotSet(() => {\n\t\t\tthis._domNode?.setClassName(this._visibleClassName);\n\t\t}, 0);\n\t}\n\n\tprivate _hide(withFadeAway: boolean): void {\n\t\tthis._revealTimer.cancel();\n\t\tif (!this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = false;\n\t\tthis._domNode?.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : ''));\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { createFastDomNode, FastDomNode } from 'vs/base/browser/fastDomNode';\nimport { GlobalPointerMoveMonitor } from 'vs/base/browser/globalPointerMoveMonitor';\nimport { StandardWheelEvent } from 'vs/base/browser/mouseEvent';\nimport { ScrollbarArrow, ScrollbarArrowOptions } from 'vs/base/browser/ui/scrollbar/scrollbarArrow';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { ScrollbarVisibilityController } from 'vs/base/browser/ui/scrollbar/scrollbarVisibilityController';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport * as platform from 'vs/base/common/platform';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable';\n\n/**\n * The orthogonal distance to the slider at which dragging \"resets\". This implements \"snapping\"\n */\nconst POINTER_DRAG_RESET_DISTANCE = 140;\n\nexport interface ISimplifiedPointerEvent {\n\tbuttons: number;\n\tpageX: number;\n\tpageY: number;\n}\n\nexport interface ScrollbarHost {\n\tonMouseWheel(mouseWheelEvent: StandardWheelEvent): void;\n\tonDragStart(): void;\n\tonDragEnd(): void;\n}\n\nexport interface AbstractScrollbarOptions {\n\tlazyRender: boolean;\n\thost: ScrollbarHost;\n\tscrollbarState: ScrollbarState;\n\tvisibility: ScrollbarVisibility;\n\textraScrollbarClassName: string;\n\tscrollable: Scrollable;\n\tscrollByPage: boolean;\n}\n\nexport abstract class AbstractScrollbar extends Widget {\n\n\tprotected _host: ScrollbarHost;\n\tprotected _scrollable: Scrollable;\n\tprotected _scrollByPage: boolean;\n\tprivate _lazyRender: boolean;\n\tprotected _scrollbarState: ScrollbarState;\n\tprotected _visibilityController: ScrollbarVisibilityController;\n\tprivate _pointerMoveMonitor: GlobalPointerMoveMonitor;\n\n\tpublic domNode: FastDomNode;\n\tpublic slider!: FastDomNode;\n\n\tprotected _shouldRender: boolean;\n\n\tconstructor(opts: AbstractScrollbarOptions) {\n\t\tsuper();\n\t\tthis._lazyRender = opts.lazyRender;\n\t\tthis._host = opts.host;\n\t\tthis._scrollable = opts.scrollable;\n\t\tthis._scrollByPage = opts.scrollByPage;\n\t\tthis._scrollbarState = opts.scrollbarState;\n\t\tthis._visibilityController = this._register(new ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName));\n\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\tthis._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n\t\tthis._shouldRender = true;\n\t\tthis.domNode = createFastDomNode(document.createElement('div'));\n\t\tthis.domNode.setAttribute('role', 'presentation');\n\t\tthis.domNode.setAttribute('aria-hidden', 'true');\n\n\t\tthis._visibilityController.setDomNode(this.domNode);\n\t\tthis.domNode.setPosition('absolute');\n\n\t\tthis._register(dom.addDisposableListener(this.domNode.domNode, dom.EventType.POINTER_DOWN, (e: PointerEvent) => this._domNodePointerDown(e)));\n\t}\n\n\t// ----------------- creation\n\n\t/**\n\t * Creates the dom node for an arrow & adds it to the container\n\t */\n\tprotected _createArrow(opts: ScrollbarArrowOptions): void {\n\t\tconst arrow = this._register(new ScrollbarArrow(opts));\n\t\tthis.domNode.domNode.appendChild(arrow.bgDomNode);\n\t\tthis.domNode.domNode.appendChild(arrow.domNode);\n\t}\n\n\t/**\n\t * Creates the slider dom node, adds it to the container & hooks up the events\n\t */\n\tprotected _createSlider(top: number, left: number, width: number | undefined, height: number | undefined): void {\n\t\tthis.slider = createFastDomNode(document.createElement('div'));\n\t\tthis.slider.setClassName('slider');\n\t\tthis.slider.setPosition('absolute');\n\t\tthis.slider.setTop(top);\n\t\tthis.slider.setLeft(left);\n\t\tif (typeof width === 'number') {\n\t\t\tthis.slider.setWidth(width);\n\t\t}\n\t\tif (typeof height === 'number') {\n\t\t\tthis.slider.setHeight(height);\n\t\t}\n\t\tthis.slider.setLayerHinting(true);\n\t\tthis.slider.setContain('strict');\n\n\t\tthis.domNode.domNode.appendChild(this.slider.domNode);\n\n\t\tthis._register(dom.addDisposableListener(\n\t\t\tthis.slider.domNode,\n\t\t\tdom.EventType.POINTER_DOWN,\n\t\t\t(e: PointerEvent) => {\n\t\t\t\tif (e.button === 0) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tthis._sliderPointerDown(e);\n\t\t\t\t}\n\t\t\t}\n\t\t));\n\n\t\tthis.onclick(this.slider.domNode, e => {\n\t\t\tif (e.leftButton) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t});\n\t}\n\n\t// ----------------- Update state\n\n\tprotected _onElementSize(visibleSize: number): boolean {\n\t\tif (this._scrollbarState.setVisibleSize(visibleSize)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _onElementScrollSize(elementScrollSize: number): boolean {\n\t\tif (this._scrollbarState.setScrollSize(elementScrollSize)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _onElementScrollPosition(elementScrollPosition: number): boolean {\n\t\tif (this._scrollbarState.setScrollPosition(elementScrollPosition)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\t// ----------------- rendering\n\n\tpublic beginReveal(): void {\n\t\tthis._visibilityController.setShouldBeVisible(true);\n\t}\n\n\tpublic beginHide(): void {\n\t\tthis._visibilityController.setShouldBeVisible(false);\n\t}\n\n\tpublic render(): void {\n\t\tif (!this._shouldRender) {\n\t\t\treturn;\n\t\t}\n\t\tthis._shouldRender = false;\n\n\t\tthis._renderDomNode(this._scrollbarState.getRectangleLargeSize(), this._scrollbarState.getRectangleSmallSize());\n\t\tthis._updateSlider(this._scrollbarState.getSliderSize(), this._scrollbarState.getArrowSize() + this._scrollbarState.getSliderPosition());\n\t}\n\t// ----------------- DOM events\n\n\tprivate _domNodePointerDown(e: PointerEvent): void {\n\t\tif (e.target !== this.domNode.domNode) {\n\t\t\treturn;\n\t\t}\n\t\tthis._onPointerDown(e);\n\t}\n\n\tpublic delegatePointerDown(e: PointerEvent): void {\n\t\tconst domTop = this.domNode.domNode.getClientRects()[0].top;\n\t\tconst sliderStart = domTop + this._scrollbarState.getSliderPosition();\n\t\tconst sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize();\n\t\tconst pointerPos = this._sliderPointerPosition(e);\n\t\tif (sliderStart <= pointerPos && pointerPos <= sliderStop) {\n\t\t\t// Act as if it was a pointer down on the slider\n\t\t\tif (e.button === 0) {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._sliderPointerDown(e);\n\t\t\t}\n\t\t} else {\n\t\t\t// Act as if it was a pointer down on the scrollbar\n\t\t\tthis._onPointerDown(e);\n\t\t}\n\t}\n\n\tprivate _onPointerDown(e: PointerEvent): void {\n\t\tlet offsetX: number;\n\t\tlet offsetY: number;\n\t\tif (e.target === this.domNode.domNode && typeof e.offsetX === 'number' && typeof e.offsetY === 'number') {\n\t\t\toffsetX = e.offsetX;\n\t\t\toffsetY = e.offsetY;\n\t\t} else {\n\t\t\tconst domNodePosition = dom.getDomNodePagePosition(this.domNode.domNode);\n\t\t\toffsetX = e.pageX - domNodePosition.left;\n\t\t\toffsetY = e.pageY - domNodePosition.top;\n\t\t}\n\n\t\tconst offset = this._pointerDownRelativePosition(offsetX, offsetY);\n\t\tthis._setDesiredScrollPositionNow(\n\t\t\tthis._scrollByPage\n\t\t\t\t? this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(offset)\n\t\t\t\t: this._scrollbarState.getDesiredScrollPositionFromOffset(offset)\n\t\t);\n\n\t\tif (e.button === 0) {\n\t\t\t// left button\n\t\t\te.preventDefault();\n\t\t\tthis._sliderPointerDown(e);\n\t\t}\n\t}\n\n\tprivate _sliderPointerDown(e: PointerEvent): void {\n\t\tif (!e.target || !(e.target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst initialPointerPosition = this._sliderPointerPosition(e);\n\t\tconst initialPointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(e);\n\t\tconst initialScrollbarState = this._scrollbarState.clone();\n\t\tthis.slider.toggleClassName('active', true);\n\n\t\tthis._pointerMoveMonitor.startMonitoring(\n\t\t\te.target,\n\t\t\te.pointerId,\n\t\t\te.buttons,\n\t\t\t(pointerMoveData: PointerEvent) => {\n\t\t\t\tconst pointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(pointerMoveData);\n\t\t\t\tconst pointerOrthogonalDelta = Math.abs(pointerOrthogonalPosition - initialPointerOrthogonalPosition);\n\n\t\t\t\tif (platform.isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE) {\n\t\t\t\t\t// The pointer has wondered away from the scrollbar => reset dragging\n\t\t\t\t\tthis._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst pointerPosition = this._sliderPointerPosition(pointerMoveData);\n\t\t\t\tconst pointerDelta = pointerPosition - initialPointerPosition;\n\t\t\t\tthis._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(pointerDelta));\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.slider.toggleClassName('active', false);\n\t\t\t\tthis._host.onDragEnd();\n\t\t\t}\n\t\t);\n\n\t\tthis._host.onDragStart();\n\t}\n\n\tprivate _setDesiredScrollPositionNow(_desiredScrollPosition: number): void {\n\n\t\tconst desiredScrollPosition: INewScrollPosition = {};\n\t\tthis.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition);\n\n\t\tthis._scrollable.setScrollPositionNow(desiredScrollPosition);\n\t}\n\n\tpublic updateScrollbarSize(scrollbarSize: number): void {\n\t\tthis._updateScrollbarSize(scrollbarSize);\n\t\tthis._scrollbarState.setScrollbarSize(scrollbarSize);\n\t\tthis._shouldRender = true;\n\t\tif (!this._lazyRender) {\n\t\t\tthis.render();\n\t\t}\n\t}\n\n\tpublic isNeeded(): boolean {\n\t\treturn this._scrollbarState.isNeeded();\n\t}\n\n\t// ----------------- Overwrite these\n\n\tprotected abstract _renderDomNode(largeSize: number, smallSize: number): void;\n\tprotected abstract _updateSlider(sliderSize: number, sliderPosition: number): void;\n\n\tprotected abstract _pointerDownRelativePosition(offsetX: number, offsetY: number): number;\n\tprotected abstract _sliderPointerPosition(e: ISimplifiedPointerEvent): number;\n\tprotected abstract _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number;\n\tprotected abstract _updateScrollbarSize(size: number): void;\n\n\tpublic abstract writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged.\n */\nconst MINIMUM_SLIDER_SIZE = 20;\n\nexport class ScrollbarState {\n\n\t/**\n\t * For the vertical scrollbar: the width.\n\t * For the horizontal scrollbar: the height.\n\t */\n\tprivate _scrollbarSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the height of the pair horizontal scrollbar.\n\t * For the horizontal scrollbar: the width of the pair vertical scrollbar.\n\t */\n\tprivate _oppositeScrollbarSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the height of the scrollbar's arrows.\n\t * For the horizontal scrollbar: the width of the scrollbar's arrows.\n\t */\n\tprivate readonly _arrowSize: number;\n\n\t// --- variables\n\t/**\n\t * For the vertical scrollbar: the viewport height.\n\t * For the horizontal scrollbar: the viewport width.\n\t */\n\tprivate _visibleSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the scroll height.\n\t * For the horizontal scrollbar: the scroll width.\n\t */\n\tprivate _scrollSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the scroll top.\n\t * For the horizontal scrollbar: the scroll left.\n\t */\n\tprivate _scrollPosition: number;\n\n\t// --- computed variables\n\n\t/**\n\t * `visibleSize` - `oppositeScrollbarSize`\n\t */\n\tprivate _computedAvailableSize: number;\n\t/**\n\t * (`scrollSize` > 0 && `scrollSize` > `visibleSize`)\n\t */\n\tprivate _computedIsNeeded: boolean;\n\n\tprivate _computedSliderSize: number;\n\tprivate _computedSliderRatio: number;\n\tprivate _computedSliderPosition: number;\n\n\tconstructor(arrowSize: number, scrollbarSize: number, oppositeScrollbarSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) {\n\t\tthis._scrollbarSize = Math.round(scrollbarSize);\n\t\tthis._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n\t\tthis._arrowSize = Math.round(arrowSize);\n\n\t\tthis._visibleSize = visibleSize;\n\t\tthis._scrollSize = scrollSize;\n\t\tthis._scrollPosition = scrollPosition;\n\n\t\tthis._computedAvailableSize = 0;\n\t\tthis._computedIsNeeded = false;\n\t\tthis._computedSliderSize = 0;\n\t\tthis._computedSliderRatio = 0;\n\t\tthis._computedSliderPosition = 0;\n\n\t\tthis._refreshComputedValues();\n\t}\n\n\tpublic clone(): ScrollbarState {\n\t\treturn new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n\t}\n\n\tpublic setVisibleSize(visibleSize: number): boolean {\n\t\tconst iVisibleSize = Math.round(visibleSize);\n\t\tif (this._visibleSize !== iVisibleSize) {\n\t\t\tthis._visibleSize = iVisibleSize;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollSize(scrollSize: number): boolean {\n\t\tconst iScrollSize = Math.round(scrollSize);\n\t\tif (this._scrollSize !== iScrollSize) {\n\t\t\tthis._scrollSize = iScrollSize;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollPosition(scrollPosition: number): boolean {\n\t\tconst iScrollPosition = Math.round(scrollPosition);\n\t\tif (this._scrollPosition !== iScrollPosition) {\n\t\t\tthis._scrollPosition = iScrollPosition;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollbarSize(scrollbarSize: number): void {\n\t\tthis._scrollbarSize = Math.round(scrollbarSize);\n\t}\n\n\tpublic setOppositeScrollbarSize(oppositeScrollbarSize: number): void {\n\t\tthis._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n\t}\n\n\tprivate static _computeValues(oppositeScrollbarSize: number, arrowSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) {\n\t\tconst computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);\n\t\tconst computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);\n\t\tconst computedIsNeeded = (scrollSize > 0 && scrollSize > visibleSize);\n\n\t\tif (!computedIsNeeded) {\n\t\t\t// There is no need for a slider\n\t\t\treturn {\n\t\t\t\tcomputedAvailableSize: Math.round(computedAvailableSize),\n\t\t\t\tcomputedIsNeeded: computedIsNeeded,\n\t\t\t\tcomputedSliderSize: Math.round(computedRepresentableSize),\n\t\t\t\tcomputedSliderRatio: 0,\n\t\t\t\tcomputedSliderPosition: 0,\n\t\t\t};\n\t\t}\n\n\t\t// We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise\n\t\tconst computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize)));\n\n\t\t// The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize`\n\t\t// in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`.\n\t\tconst computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);\n\t\tconst computedSliderPosition = (scrollPosition * computedSliderRatio);\n\n\t\treturn {\n\t\t\tcomputedAvailableSize: Math.round(computedAvailableSize),\n\t\t\tcomputedIsNeeded: computedIsNeeded,\n\t\t\tcomputedSliderSize: Math.round(computedSliderSize),\n\t\t\tcomputedSliderRatio: computedSliderRatio,\n\t\t\tcomputedSliderPosition: Math.round(computedSliderPosition),\n\t\t};\n\t}\n\n\tprivate _refreshComputedValues(): void {\n\t\tconst r = ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n\t\tthis._computedAvailableSize = r.computedAvailableSize;\n\t\tthis._computedIsNeeded = r.computedIsNeeded;\n\t\tthis._computedSliderSize = r.computedSliderSize;\n\t\tthis._computedSliderRatio = r.computedSliderRatio;\n\t\tthis._computedSliderPosition = r.computedSliderPosition;\n\t}\n\n\tpublic getArrowSize(): number {\n\t\treturn this._arrowSize;\n\t}\n\n\tpublic getScrollPosition(): number {\n\t\treturn this._scrollPosition;\n\t}\n\n\tpublic getRectangleLargeSize(): number {\n\t\treturn this._computedAvailableSize;\n\t}\n\n\tpublic getRectangleSmallSize(): number {\n\t\treturn this._scrollbarSize;\n\t}\n\n\tpublic isNeeded(): boolean {\n\t\treturn this._computedIsNeeded;\n\t}\n\n\tpublic getSliderSize(): number {\n\t\treturn this._computedSliderSize;\n\t}\n\n\tpublic getSliderPosition(): number {\n\t\treturn this._computedSliderPosition;\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider.\n\t * `offset` is based on the same coordinate system as the `sliderPosition`.\n\t */\n\tpublic getDesiredScrollPositionFromOffset(offset: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;\n\t\treturn Math.round(desiredSliderPosition / this._computedSliderRatio);\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` from if offset is before or after the slider position.\n\t * If offset is before slider, treat as a page up (or left). If after, page down (or right).\n\t * `offset` and `_computedSliderPosition` are based on the same coordinate system.\n\t * `_visibleSize` corresponds to a \"page\" of lines in the returned coordinate system.\n\t */\n\tpublic getDesiredScrollPositionFromOffsetPaged(offset: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst correctedOffset = offset - this._arrowSize; // compensate if has arrows\n\t\tlet desiredScrollPosition = this._scrollPosition;\n\t\tif (correctedOffset < this._computedSliderPosition) {\n\t\t\tdesiredScrollPosition -= this._visibleSize; // page up/left\n\t\t} else {\n\t\t\tdesiredScrollPosition += this._visibleSize; // page down/right\n\t\t}\n\t\treturn desiredScrollPosition;\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` such that the slider moves by `delta`.\n\t */\n\tpublic getDesiredScrollPositionFromDelta(delta: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst desiredSliderPosition = this._computedSliderPosition + delta;\n\t\treturn Math.round(desiredSliderPosition / this._computedSliderRatio);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { AbstractScrollbar, ISimplifiedPointerEvent, ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';\n\n\n\n\nexport class HorizontalScrollbar extends AbstractScrollbar {\n\n\tconstructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) {\n\t\tconst scrollDimensions = scrollable.getScrollDimensions();\n\t\tconst scrollPosition = scrollable.getCurrentScrollPosition();\n\t\tsuper({\n\t\t\tlazyRender: options.lazyRender,\n\t\t\thost: host,\n\t\t\tscrollbarState: new ScrollbarState(\n\t\t\t\t(options.horizontalHasArrows ? options.arrowSize : 0),\n\t\t\t\t(options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize),\n\t\t\t\t(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize),\n\t\t\t\tscrollDimensions.width,\n\t\t\t\tscrollDimensions.scrollWidth,\n\t\t\t\tscrollPosition.scrollLeft\n\t\t\t),\n\t\t\tvisibility: options.horizontal,\n\t\t\textraScrollbarClassName: 'horizontal',\n\t\t\tscrollable: scrollable,\n\t\t\tscrollByPage: options.scrollByPage\n\t\t});\n\n\t\tif (options.horizontalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n\t\t\t// const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n\t\t\t// const scrollbarDelta = (options.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2;\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonLeft,\n\t\t\t// \ttop: scrollbarDelta,\n\t\t\t// \tleft: arrowDelta,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.arrowSize,\n\t\t\t// \tbgHeight: options.horizontalScrollbarSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 1, 0)),\n\t\t\t// });\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonRight,\n\t\t\t// \ttop: scrollbarDelta,\n\t\t\t// \tleft: undefined,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: arrowDelta,\n\t\t\t// \tbgWidth: options.arrowSize,\n\t\t\t// \tbgHeight: options.horizontalScrollbarSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, -1, 0)),\n\t\t\t// });\n\t\t}\n\n\t\tthis._createSlider(Math.floor((options.horizontalScrollbarSize - options.horizontalSliderSize) / 2), 0, undefined, options.horizontalSliderSize);\n\t}\n\n\tprotected _updateSlider(sliderSize: number, sliderPosition: number): void {\n\t\tthis.slider.setWidth(sliderSize);\n\t\tthis.slider.setLeft(sliderPosition);\n\t}\n\n\tprotected _renderDomNode(largeSize: number, smallSize: number): void {\n\t\tthis.domNode.setWidth(largeSize);\n\t\tthis.domNode.setHeight(smallSize);\n\t\tthis.domNode.setLeft(0);\n\t\tthis.domNode.setBottom(0);\n\t}\n\n\tpublic onDidScroll(e: ScrollEvent): boolean {\n\t\tthis._shouldRender = this._onElementScrollSize(e.scrollWidth) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementScrollPosition(e.scrollLeft) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementSize(e.width) || this._shouldRender;\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _pointerDownRelativePosition(offsetX: number, offsetY: number): number {\n\t\treturn offsetX;\n\t}\n\n\tprotected _sliderPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageX;\n\t}\n\n\tprotected _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageY;\n\t}\n\n\tprotected _updateScrollbarSize(size: number): void {\n\t\tthis.slider.setHeight(size);\n\t}\n\n\tpublic writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {\n\t\ttarget.scrollLeft = scrollPosition;\n\t}\n\n\tpublic updateOptions(options: ScrollableElementResolvedOptions): void {\n\t\tthis.updateScrollbarSize(options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize);\n\t\tthis._scrollbarState.setOppositeScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n\t\tthis._visibilityController.setVisibility(options.horizontal);\n\t\tthis._scrollByPage = options.scrollByPage;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { AbstractScrollbar, ISimplifiedPointerEvent, ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';\n\n\n\nexport class VerticalScrollbar extends AbstractScrollbar {\n\n\tconstructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) {\n\t\tconst scrollDimensions = scrollable.getScrollDimensions();\n\t\tconst scrollPosition = scrollable.getCurrentScrollPosition();\n\t\tsuper({\n\t\t\tlazyRender: options.lazyRender,\n\t\t\thost: host,\n\t\t\tscrollbarState: new ScrollbarState(\n\t\t\t\t(options.verticalHasArrows ? options.arrowSize : 0),\n\t\t\t\t(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize),\n\t\t\t\t// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n\t\t\t\t0,\n\t\t\t\tscrollDimensions.height,\n\t\t\t\tscrollDimensions.scrollHeight,\n\t\t\t\tscrollPosition.scrollTop\n\t\t\t),\n\t\t\tvisibility: options.vertical,\n\t\t\textraScrollbarClassName: 'vertical',\n\t\t\tscrollable: scrollable,\n\t\t\tscrollByPage: options.scrollByPage\n\t\t});\n\n\t\tif (options.verticalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n\t\t\t// const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n\t\t\t// const scrollbarDelta = (options.verticalScrollbarSize - ARROW_IMG_SIZE) / 2;\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonUp,\n\t\t\t// \ttop: arrowDelta,\n\t\t\t// \tleft: scrollbarDelta,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.verticalScrollbarSize,\n\t\t\t// \tbgHeight: options.arrowSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, 1)),\n\t\t\t// });\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonDown,\n\t\t\t// \ttop: undefined,\n\t\t\t// \tleft: scrollbarDelta,\n\t\t\t// \tbottom: arrowDelta,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.verticalScrollbarSize,\n\t\t\t// \tbgHeight: options.arrowSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, -1)),\n\t\t\t// });\n\t\t}\n\n\t\tthis._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined);\n\t}\n\n\tprotected _updateSlider(sliderSize: number, sliderPosition: number): void {\n\t\tthis.slider.setHeight(sliderSize);\n\t\tthis.slider.setTop(sliderPosition);\n\t}\n\n\tprotected _renderDomNode(largeSize: number, smallSize: number): void {\n\t\tthis.domNode.setWidth(smallSize);\n\t\tthis.domNode.setHeight(largeSize);\n\t\tthis.domNode.setRight(0);\n\t\tthis.domNode.setTop(0);\n\t}\n\n\tpublic onDidScroll(e: ScrollEvent): boolean {\n\t\tthis._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementSize(e.height) || this._shouldRender;\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _pointerDownRelativePosition(offsetX: number, offsetY: number): number {\n\t\treturn offsetY;\n\t}\n\n\tprotected _sliderPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageY;\n\t}\n\n\tprotected _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageX;\n\t}\n\n\tprotected _updateScrollbarSize(size: number): void {\n\t\tthis.slider.setWidth(size);\n\t}\n\n\tpublic writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {\n\t\ttarget.scrollTop = scrollPosition;\n\t}\n\n\tpublic updateOptions(options: ScrollableElementResolvedOptions): void {\n\t\tthis.updateScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n\t\t// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n\t\tthis._scrollbarState.setOppositeScrollbarSize(0);\n\t\tthis._visibilityController.setVisibility(options.vertical);\n\t\tthis._scrollByPage = options.scrollByPage;\n\t}\n\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getZoomFactor, isChrome } from 'vs/base/browser/browser';\nimport * as dom from 'vs/base/browser/dom';\nimport { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';\nimport { IMouseEvent, IMouseWheelEvent, StandardWheelEvent } from 'vs/base/browser/mouseEvent';\nimport { ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { HorizontalScrollbar } from 'vs/base/browser/ui/scrollbar/horizontalScrollbar';\nimport { ScrollableElementChangeOptions, ScrollableElementCreationOptions, ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { VerticalScrollbar } from 'vs/base/browser/ui/scrollbar/verticalScrollbar';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { IDisposable, dispose } from 'vs/base/common/lifecycle';\nimport * as platform from 'vs/base/common/platform';\nimport { INewScrollDimensions, INewScrollPosition, IScrollDimensions, IScrollPosition, ScrollEvent, Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable';\n// import 'vs/css!./media/scrollbars';\n\nconst HIDE_TIMEOUT = 500;\nconst SCROLL_WHEEL_SENSITIVITY = 50;\nconst SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true;\n\nexport interface IOverviewRulerLayoutInfo {\n\tparent: HTMLElement;\n\tinsertBefore: HTMLElement;\n}\n\nclass MouseWheelClassifierItem {\n\tpublic timestamp: number;\n\tpublic deltaX: number;\n\tpublic deltaY: number;\n\tpublic score: number;\n\n\tconstructor(timestamp: number, deltaX: number, deltaY: number) {\n\t\tthis.timestamp = timestamp;\n\t\tthis.deltaX = deltaX;\n\t\tthis.deltaY = deltaY;\n\t\tthis.score = 0;\n\t}\n}\n\nexport class MouseWheelClassifier {\n\n\tpublic static readonly INSTANCE = new MouseWheelClassifier();\n\n\tprivate readonly _capacity: number;\n\tprivate _memory: MouseWheelClassifierItem[];\n\tprivate _front: number;\n\tprivate _rear: number;\n\n\tconstructor() {\n\t\tthis._capacity = 5;\n\t\tthis._memory = [];\n\t\tthis._front = -1;\n\t\tthis._rear = -1;\n\t}\n\n\tpublic isPhysicalMouseWheel(): boolean {\n\t\tif (this._front === -1 && this._rear === -1) {\n\t\t\t// no elements\n\t\t\treturn false;\n\t\t}\n\n\t\t// 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ...\n\t\tlet remainingInfluence = 1;\n\t\tlet score = 0;\n\t\tlet iteration = 1;\n\n\t\tlet index = this._rear;\n\t\tdo {\n\t\t\tconst influence = (index === this._front ? remainingInfluence : Math.pow(2, -iteration));\n\t\t\tremainingInfluence -= influence;\n\t\t\tscore += this._memory[index].score * influence;\n\n\t\t\tif (index === this._front) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tindex = (this._capacity + index - 1) % this._capacity;\n\t\t\titeration++;\n\t\t} while (true);\n\n\t\treturn (score <= 0.5);\n\t}\n\n\tpublic acceptStandardWheelEvent(e: StandardWheelEvent): void {\n\t\tif (isChrome) {\n\t\t\tconst targetWindow = dom.getWindow(e.browserEvent);\n\t\t\tconst pageZoomFactor = getZoomFactor(targetWindow);\n\t\t\t// On Chrome, the incoming delta events are multiplied with the OS zoom factor.\n\t\t\t// The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account.\n\t\t\tthis.accept(Date.now(), e.deltaX * pageZoomFactor, e.deltaY * pageZoomFactor);\n\t\t} else {\n\t\t\tthis.accept(Date.now(), e.deltaX, e.deltaY);\n\t\t}\n\t}\n\n\tpublic accept(timestamp: number, deltaX: number, deltaY: number): void {\n\t\tlet previousItem = null;\n\t\tconst item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY);\n\n\t\tif (this._front === -1 && this._rear === -1) {\n\t\t\tthis._memory[0] = item;\n\t\t\tthis._front = 0;\n\t\t\tthis._rear = 0;\n\t\t} else {\n\t\t\tpreviousItem = this._memory[this._rear];\n\n\t\t\tthis._rear = (this._rear + 1) % this._capacity;\n\t\t\tif (this._rear === this._front) {\n\t\t\t\t// Drop oldest\n\t\t\t\tthis._front = (this._front + 1) % this._capacity;\n\t\t\t}\n\t\t\tthis._memory[this._rear] = item;\n\t\t}\n\n\t\titem.score = this._computeScore(item, previousItem);\n\t}\n\n\t/**\n\t * A score between 0 and 1 for `item`.\n\t * - a score towards 0 indicates that the source appears to be a physical mouse wheel\n\t * - a score towards 1 indicates that the source appears to be a touchpad or magic mouse, etc.\n\t */\n\tprivate _computeScore(item: MouseWheelClassifierItem, previousItem: MouseWheelClassifierItem | null): number {\n\n\t\tif (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) {\n\t\t\t// both axes exercised => definitely not a physical mouse wheel\n\t\t\treturn 1;\n\t\t}\n\n\t\tlet score: number = 0.5;\n\n\t\tif (!this._isAlmostInt(item.deltaX) || !this._isAlmostInt(item.deltaY)) {\n\t\t\t// non-integer deltas => indicator that this is not a physical mouse wheel\n\t\t\tscore += 0.25;\n\t\t}\n\n\t\t// Non-accelerating scroll => indicator that this is a physical mouse wheel\n\t\t// These can be identified by seeing whether they are the module of one another.\n\t\tif (previousItem) {\n\t\t\tconst absDeltaX = Math.abs(item.deltaX);\n\t\t\tconst absDeltaY = Math.abs(item.deltaY);\n\n\t\t\tconst absPreviousDeltaX = Math.abs(previousItem.deltaX);\n\t\t\tconst absPreviousDeltaY = Math.abs(previousItem.deltaY);\n\n\t\t\t// Min 1 to avoid division by zero, module 1 will still be 0.\n\t\t\tconst minDeltaX = Math.max(Math.min(absDeltaX, absPreviousDeltaX), 1);\n\t\t\tconst minDeltaY = Math.max(Math.min(absDeltaY, absPreviousDeltaY), 1);\n\n\t\t\tconst maxDeltaX = Math.max(absDeltaX, absPreviousDeltaX);\n\t\t\tconst maxDeltaY = Math.max(absDeltaY, absPreviousDeltaY);\n\n\t\t\tconst isSameModulo = (maxDeltaX % minDeltaX === 0 && maxDeltaY % minDeltaY === 0);\n\t\t\tif (isSameModulo) {\n\t\t\t\tscore -= 0.5;\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(Math.max(score, 0), 1);\n\t}\n\n\tprivate _isAlmostInt(value: number): boolean {\n\t\tconst delta = Math.abs(Math.round(value) - value);\n\t\treturn (delta < 0.01);\n\t}\n}\n\nexport abstract class AbstractScrollableElement extends Widget {\n\n\tprivate readonly _options: ScrollableElementResolvedOptions;\n\tprotected readonly _scrollable: Scrollable;\n\tprivate readonly _verticalScrollbar: VerticalScrollbar;\n\tprivate readonly _horizontalScrollbar: HorizontalScrollbar;\n\tprivate readonly _domNode: HTMLElement;\n\n\tprivate readonly _leftShadowDomNode: FastDomNode | null;\n\tprivate readonly _topShadowDomNode: FastDomNode | null;\n\tprivate readonly _topLeftShadowDomNode: FastDomNode | null;\n\n\tprivate readonly _listenOnDomNode: HTMLElement;\n\n\tprivate _mouseWheelToDispose: IDisposable[];\n\n\tprivate _isDragging: boolean;\n\tprivate _mouseIsOver: boolean;\n\n\tprivate readonly _hideTimeout: TimeoutTimer;\n\tprivate _shouldRender: boolean;\n\n\tprivate _revealOnScroll: boolean;\n\n\tprivate readonly _onScroll = this._register(new Emitter());\n\tpublic readonly onScroll: Event = this._onScroll.event;\n\n\tprivate readonly _onWillScroll = this._register(new Emitter());\n\tpublic readonly onWillScroll: Event = this._onWillScroll.event;\n\n\tpublic get options(): Readonly {\n\t\treturn this._options;\n\t}\n\n\tprotected constructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable) {\n\t\tsuper();\n\t\t// HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n\t\t// element.style.overflow = 'hidden';\n\t\tthis._options = resolveOptions(options);\n\t\tthis._scrollable = scrollable;\n\n\t\tthis._register(this._scrollable.onScroll((e) => {\n\t\t\tthis._onWillScroll.fire(e);\n\t\t\tthis._onDidScroll(e);\n\t\t\tthis._onScroll.fire(e);\n\t\t}));\n\n\t\tconst scrollbarHost: ScrollbarHost = {\n\t\t\tonMouseWheel: (mouseWheelEvent: StandardWheelEvent) => this._onMouseWheel(mouseWheelEvent),\n\t\t\tonDragStart: () => this._onDragStart(),\n\t\t\tonDragEnd: () => this._onDragEnd(),\n\t\t};\n\t\tthis._verticalScrollbar = this._register(new VerticalScrollbar(this._scrollable, this._options, scrollbarHost));\n\t\tthis._horizontalScrollbar = this._register(new HorizontalScrollbar(this._scrollable, this._options, scrollbarHost));\n\n\t\tthis._domNode = document.createElement('div');\n\t\tthis._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n\t\tthis._domNode.setAttribute('role', 'presentation');\n\t\tthis._domNode.style.position = 'relative';\n\t\t// HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n\t\t// this._domNode.style.overflow = 'hidden';\n\t\tthis._domNode.appendChild(element);\n\t\tthis._domNode.appendChild(this._horizontalScrollbar.domNode.domNode);\n\t\tthis._domNode.appendChild(this._verticalScrollbar.domNode.domNode);\n\n\t\tif (this._options.useShadows) {\n\t\t\tthis._leftShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._leftShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._leftShadowDomNode.domNode);\n\n\t\t\tthis._topShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._topShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._topShadowDomNode.domNode);\n\n\t\t\tthis._topLeftShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._topLeftShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._topLeftShadowDomNode.domNode);\n\t\t} else {\n\t\t\tthis._leftShadowDomNode = null;\n\t\t\tthis._topShadowDomNode = null;\n\t\t\tthis._topLeftShadowDomNode = null;\n\t\t}\n\n\t\tthis._listenOnDomNode = this._options.listenOnDomNode || this._domNode;\n\n\t\tthis._mouseWheelToDispose = [];\n\t\tthis._setListeningToMouseWheel(this._options.handleMouseWheel);\n\n\t\tthis.onmouseover(this._listenOnDomNode, (e) => this._onMouseOver(e));\n\t\tthis.onmouseleave(this._listenOnDomNode, (e) => this._onMouseLeave(e));\n\n\t\tthis._hideTimeout = this._register(new TimeoutTimer());\n\t\tthis._isDragging = false;\n\t\tthis._mouseIsOver = false;\n\n\t\tthis._shouldRender = true;\n\n\t\tthis._revealOnScroll = true;\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n\t\tsuper.dispose();\n\t}\n\n\t/**\n\t * Get the generated 'scrollable' dom node\n\t */\n\tpublic getDomNode(): HTMLElement {\n\t\treturn this._domNode;\n\t}\n\n\tpublic getOverviewRulerLayoutInfo(): IOverviewRulerLayoutInfo {\n\t\treturn {\n\t\t\tparent: this._domNode,\n\t\t\tinsertBefore: this._verticalScrollbar.domNode.domNode,\n\t\t};\n\t}\n\n\t/**\n\t * Delegate a pointer down event to the vertical scrollbar.\n\t * This is to help with clicking somewhere else and having the scrollbar react.\n\t */\n\tpublic delegateVerticalScrollbarPointerDown(browserEvent: PointerEvent): void {\n\t\tthis._verticalScrollbar.delegatePointerDown(browserEvent);\n\t}\n\n\tpublic getScrollDimensions(): IScrollDimensions {\n\t\treturn this._scrollable.getScrollDimensions();\n\t}\n\n\tpublic setScrollDimensions(dimensions: INewScrollDimensions): void {\n\t\tthis._scrollable.setScrollDimensions(dimensions, false);\n\t}\n\n\t/**\n\t * Update the class name of the scrollable element.\n\t */\n\tpublic updateClassName(newClassName: string): void {\n\t\tthis._options.className = newClassName;\n\t\t// Defaults are different on Macs\n\t\tif (platform.isMacintosh) {\n\t\t\tthis._options.className += ' mac';\n\t\t}\n\t\tthis._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n\t}\n\n\t/**\n\t * Update configuration options for the scrollbar.\n\t */\n\tpublic updateOptions(newOptions: ScrollableElementChangeOptions): void {\n\t\tif (typeof newOptions.handleMouseWheel !== 'undefined') {\n\t\t\tthis._options.handleMouseWheel = newOptions.handleMouseWheel;\n\t\t\tthis._setListeningToMouseWheel(this._options.handleMouseWheel);\n\t\t}\n\t\tif (typeof newOptions.mouseWheelScrollSensitivity !== 'undefined') {\n\t\t\tthis._options.mouseWheelScrollSensitivity = newOptions.mouseWheelScrollSensitivity;\n\t\t}\n\t\tif (typeof newOptions.fastScrollSensitivity !== 'undefined') {\n\t\t\tthis._options.fastScrollSensitivity = newOptions.fastScrollSensitivity;\n\t\t}\n\t\tif (typeof newOptions.scrollPredominantAxis !== 'undefined') {\n\t\t\tthis._options.scrollPredominantAxis = newOptions.scrollPredominantAxis;\n\t\t}\n\t\tif (typeof newOptions.horizontal !== 'undefined') {\n\t\t\tthis._options.horizontal = newOptions.horizontal;\n\t\t}\n\t\tif (typeof newOptions.vertical !== 'undefined') {\n\t\t\tthis._options.vertical = newOptions.vertical;\n\t\t}\n\t\tif (typeof newOptions.horizontalScrollbarSize !== 'undefined') {\n\t\t\tthis._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize;\n\t\t}\n\t\tif (typeof newOptions.verticalScrollbarSize !== 'undefined') {\n\t\t\tthis._options.verticalScrollbarSize = newOptions.verticalScrollbarSize;\n\t\t}\n\t\tif (typeof newOptions.scrollByPage !== 'undefined') {\n\t\t\tthis._options.scrollByPage = newOptions.scrollByPage;\n\t\t}\n\t\tthis._horizontalScrollbar.updateOptions(this._options);\n\t\tthis._verticalScrollbar.updateOptions(this._options);\n\n\t\tif (!this._options.lazyRender) {\n\t\t\tthis._render();\n\t\t}\n\t}\n\n\tpublic setRevealOnScroll(value: boolean) {\n\t\tthis._revealOnScroll = value;\n\t}\n\n\tpublic delegateScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {\n\t\tthis._onMouseWheel(new StandardWheelEvent(browserEvent));\n\t}\n\n\t// -------------------- mouse wheel scrolling --------------------\n\n\tprivate _setListeningToMouseWheel(shouldListen: boolean): void {\n\t\tconst isListening = (this._mouseWheelToDispose.length > 0);\n\n\t\tif (isListening === shouldListen) {\n\t\t\t// No change\n\t\t\treturn;\n\t\t}\n\n\t\t// Stop listening (if necessary)\n\t\tthis._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n\n\t\t// Start listening (if necessary)\n\t\tif (shouldListen) {\n\t\t\tconst onMouseWheel = (browserEvent: IMouseWheelEvent) => {\n\t\t\t\tthis._onMouseWheel(new StandardWheelEvent(browserEvent));\n\t\t\t};\n\n\t\t\tthis._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { passive: false }));\n\t\t}\n\t}\n\n\tprivate _onMouseWheel(e: StandardWheelEvent): void {\n\t\tif (e.browserEvent?.defaultPrevented) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst classifier = MouseWheelClassifier.INSTANCE;\n\t\tif (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) {\n\t\t\tclassifier.acceptStandardWheelEvent(e);\n\t\t}\n\n\t\t// useful for creating unit tests:\n\t\t// console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`);\n\n\t\tlet didScroll = false;\n\n\t\tif (e.deltaY || e.deltaX) {\n\t\t\tlet deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity;\n\t\t\tlet deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity;\n\n\t\t\tif (this._options.scrollPredominantAxis) {\n\t\t\t\tif (this._options.scrollYToX && deltaX + deltaY === 0) {\n\t\t\t\t\t// when configured to map Y to X and we both see\n\t\t\t\t\t// no dominant axis and X and Y are competing with\n\t\t\t\t\t// identical values into opposite directions, we\n\t\t\t\t\t// ignore the delta as we cannot make a decision then\n\t\t\t\t\tdeltaX = deltaY = 0;\n\t\t\t\t} else if (Math.abs(deltaY) >= Math.abs(deltaX)) {\n\t\t\t\t\tdeltaX = 0;\n\t\t\t\t} else {\n\t\t\t\t\tdeltaY = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._options.flipAxes) {\n\t\t\t\t[deltaY, deltaX] = [deltaX, deltaY];\n\t\t\t}\n\n\t\t\t// Convert vertical scrolling to horizontal if shift is held, this\n\t\t\t// is handled at a higher level on Mac\n\t\t\tconst shiftConvert = !platform.isMacintosh && e.browserEvent && e.browserEvent.shiftKey;\n\t\t\tif ((this._options.scrollYToX || shiftConvert) && !deltaX) {\n\t\t\t\tdeltaX = deltaY;\n\t\t\t\tdeltaY = 0;\n\t\t\t}\n\n\t\t\tif (e.browserEvent && e.browserEvent.altKey) {\n\t\t\t\t// fastScrolling\n\t\t\t\tdeltaX = deltaX * this._options.fastScrollSensitivity;\n\t\t\t\tdeltaY = deltaY * this._options.fastScrollSensitivity;\n\t\t\t}\n\n\t\t\tconst futureScrollPosition = this._scrollable.getFutureScrollPosition();\n\n\t\t\tlet desiredScrollPosition: INewScrollPosition = {};\n\t\t\tif (deltaY) {\n\t\t\t\tconst deltaScrollTop = SCROLL_WHEEL_SENSITIVITY * deltaY;\n\t\t\t\t// Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n\t\t\t\tconst desiredScrollTop = futureScrollPosition.scrollTop - (deltaScrollTop < 0 ? Math.floor(deltaScrollTop) : Math.ceil(deltaScrollTop));\n\t\t\t\tthis._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop);\n\t\t\t}\n\t\t\tif (deltaX) {\n\t\t\t\tconst deltaScrollLeft = SCROLL_WHEEL_SENSITIVITY * deltaX;\n\t\t\t\t// Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n\t\t\t\tconst desiredScrollLeft = futureScrollPosition.scrollLeft - (deltaScrollLeft < 0 ? Math.floor(deltaScrollLeft) : Math.ceil(deltaScrollLeft));\n\t\t\t\tthis._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft);\n\t\t\t}\n\n\t\t\t// Check that we are scrolling towards a location which is valid\n\t\t\tdesiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition);\n\n\t\t\tif (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) {\n\n\t\t\t\tconst canPerformSmoothScroll = (\n\t\t\t\t\tSCROLL_WHEEL_SMOOTH_SCROLL_ENABLED\n\t\t\t\t\t&& this._options.mouseWheelSmoothScroll\n\t\t\t\t\t&& classifier.isPhysicalMouseWheel()\n\t\t\t\t);\n\n\t\t\t\tif (canPerformSmoothScroll) {\n\t\t\t\t\tthis._scrollable.setScrollPositionSmooth(desiredScrollPosition);\n\t\t\t\t} else {\n\t\t\t\t\tthis._scrollable.setScrollPositionNow(desiredScrollPosition);\n\t\t\t\t}\n\n\t\t\t\tdidScroll = true;\n\t\t\t}\n\t\t}\n\n\t\tlet consumeMouseWheel = didScroll;\n\t\tif (!consumeMouseWheel && this._options.alwaysConsumeMouseWheel) {\n\t\t\tconsumeMouseWheel = true;\n\t\t}\n\t\tif (!consumeMouseWheel && this._options.consumeMouseWheelIfScrollbarIsNeeded && (this._verticalScrollbar.isNeeded() || this._horizontalScrollbar.isNeeded())) {\n\t\t\tconsumeMouseWheel = true;\n\t\t}\n\n\t\tif (consumeMouseWheel) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\tprivate _onDidScroll(e: ScrollEvent): void {\n\t\tthis._shouldRender = this._horizontalScrollbar.onDidScroll(e) || this._shouldRender;\n\t\tthis._shouldRender = this._verticalScrollbar.onDidScroll(e) || this._shouldRender;\n\n\t\tif (this._options.useShadows) {\n\t\t\tthis._shouldRender = true;\n\t\t}\n\n\t\tif (this._revealOnScroll) {\n\t\t\tthis._reveal();\n\t\t}\n\n\t\tif (!this._options.lazyRender) {\n\t\t\tthis._render();\n\t\t}\n\t}\n\n\t/**\n\t * Render / mutate the DOM now.\n\t * Should be used together with the ctor option `lazyRender`.\n\t */\n\tpublic renderNow(): void {\n\t\tif (!this._options.lazyRender) {\n\t\t\tthrow new Error('Please use `lazyRender` together with `renderNow`!');\n\t\t}\n\n\t\tthis._render();\n\t}\n\n\tprivate _render(): void {\n\t\tif (!this._shouldRender) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._shouldRender = false;\n\n\t\tthis._horizontalScrollbar.render();\n\t\tthis._verticalScrollbar.render();\n\n\t\tif (this._options.useShadows) {\n\t\t\tconst scrollState = this._scrollable.getCurrentScrollPosition();\n\t\t\tconst enableTop = scrollState.scrollTop > 0;\n\t\t\tconst enableLeft = scrollState.scrollLeft > 0;\n\n\t\t\tconst leftClassName = (enableLeft ? ' left' : '');\n\t\t\tconst topClassName = (enableTop ? ' top' : '');\n\t\t\tconst topLeftClassName = (enableLeft || enableTop ? ' top-left-corner' : '');\n\t\t\tthis._leftShadowDomNode!.setClassName(`shadow${leftClassName}`);\n\t\t\tthis._topShadowDomNode!.setClassName(`shadow${topClassName}`);\n\t\t\tthis._topLeftShadowDomNode!.setClassName(`shadow${topLeftClassName}${topClassName}${leftClassName}`);\n\t\t}\n\t}\n\n\t// -------------------- fade in / fade out --------------------\n\n\tprivate _onDragStart(): void {\n\t\tthis._isDragging = true;\n\t\tthis._reveal();\n\t}\n\n\tprivate _onDragEnd(): void {\n\t\tthis._isDragging = false;\n\t\tthis._hide();\n\t}\n\n\tprivate _onMouseLeave(e: IMouseEvent): void {\n\t\tthis._mouseIsOver = false;\n\t\tthis._hide();\n\t}\n\n\tprivate _onMouseOver(e: IMouseEvent): void {\n\t\tthis._mouseIsOver = true;\n\t\tthis._reveal();\n\t}\n\n\tprivate _reveal(): void {\n\t\tthis._verticalScrollbar.beginReveal();\n\t\tthis._horizontalScrollbar.beginReveal();\n\t\tthis._scheduleHide();\n\t}\n\n\tprivate _hide(): void {\n\t\tif (!this._mouseIsOver && !this._isDragging) {\n\t\t\tthis._verticalScrollbar.beginHide();\n\t\t\tthis._horizontalScrollbar.beginHide();\n\t\t}\n\t}\n\n\tprivate _scheduleHide(): void {\n\t\tif (!this._mouseIsOver && !this._isDragging) {\n\t\t\tthis._hideTimeout.cancelAndSet(() => this._hide(), HIDE_TIMEOUT);\n\t\t}\n\t}\n}\n\nexport class ScrollableElement extends AbstractScrollableElement {\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions) {\n\t\toptions = options || {};\n\t\toptions.mouseWheelSmoothScroll = false;\n\t\tconst scrollable = new Scrollable({\n\t\t\tforceIntegerValues: true,\n\t\t\tsmoothScrollDuration: 0,\n\t\t\tscheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n\t\t});\n\t\tsuper(element, options, scrollable);\n\t\tthis._register(scrollable);\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition): void {\n\t\tthis._scrollable.setScrollPositionNow(update);\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n}\n\nexport class SmoothScrollableElement extends AbstractScrollableElement {\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable) {\n\t\tsuper(element, options, scrollable);\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition & { reuseAnimation?: boolean }): void {\n\t\tif (update.reuseAnimation) {\n\t\t\tthis._scrollable.setScrollPositionSmooth(update, update.reuseAnimation);\n\t\t} else {\n\t\t\tthis._scrollable.setScrollPositionNow(update);\n\t\t}\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n\n}\n\nexport class DomScrollableElement extends AbstractScrollableElement {\n\n\tprivate _element: HTMLElement;\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions) {\n\t\toptions = options || {};\n\t\toptions.mouseWheelSmoothScroll = false;\n\t\tconst scrollable = new Scrollable({\n\t\t\tforceIntegerValues: false, // See https://github.com/microsoft/vscode/issues/139877\n\t\t\tsmoothScrollDuration: 0,\n\t\t\tscheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n\t\t});\n\t\tsuper(element, options, scrollable);\n\t\tthis._register(scrollable);\n\t\tthis._element = element;\n\t\tthis._register(this.onScroll((e) => {\n\t\t\tif (e.scrollTopChanged) {\n\t\t\t\tthis._element.scrollTop = e.scrollTop;\n\t\t\t}\n\t\t\tif (e.scrollLeftChanged) {\n\t\t\t\tthis._element.scrollLeft = e.scrollLeft;\n\t\t\t}\n\t\t}));\n\t\tthis.scanDomNode();\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition): void {\n\t\tthis._scrollable.setScrollPositionNow(update);\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n\n\tpublic scanDomNode(): void {\n\t\t// width, scrollLeft, scrollWidth, height, scrollTop, scrollHeight\n\t\tthis.setScrollDimensions({\n\t\t\twidth: this._element.clientWidth,\n\t\t\tscrollWidth: this._element.scrollWidth,\n\t\t\theight: this._element.clientHeight,\n\t\t\tscrollHeight: this._element.scrollHeight\n\t\t});\n\t\tthis.setScrollPosition({\n\t\t\tscrollLeft: this._element.scrollLeft,\n\t\t\tscrollTop: this._element.scrollTop,\n\t\t});\n\t}\n}\n\nfunction resolveOptions(opts: ScrollableElementCreationOptions): ScrollableElementResolvedOptions {\n\tconst result: ScrollableElementResolvedOptions = {\n\t\tlazyRender: (typeof opts.lazyRender !== 'undefined' ? opts.lazyRender : false),\n\t\tclassName: (typeof opts.className !== 'undefined' ? opts.className : ''),\n\t\tuseShadows: (typeof opts.useShadows !== 'undefined' ? opts.useShadows : true),\n\t\thandleMouseWheel: (typeof opts.handleMouseWheel !== 'undefined' ? opts.handleMouseWheel : true),\n\t\tflipAxes: (typeof opts.flipAxes !== 'undefined' ? opts.flipAxes : false),\n\t\tconsumeMouseWheelIfScrollbarIsNeeded: (typeof opts.consumeMouseWheelIfScrollbarIsNeeded !== 'undefined' ? opts.consumeMouseWheelIfScrollbarIsNeeded : false),\n\t\talwaysConsumeMouseWheel: (typeof opts.alwaysConsumeMouseWheel !== 'undefined' ? opts.alwaysConsumeMouseWheel : false),\n\t\tscrollYToX: (typeof opts.scrollYToX !== 'undefined' ? opts.scrollYToX : false),\n\t\tmouseWheelScrollSensitivity: (typeof opts.mouseWheelScrollSensitivity !== 'undefined' ? opts.mouseWheelScrollSensitivity : 1),\n\t\tfastScrollSensitivity: (typeof opts.fastScrollSensitivity !== 'undefined' ? opts.fastScrollSensitivity : 5),\n\t\tscrollPredominantAxis: (typeof opts.scrollPredominantAxis !== 'undefined' ? opts.scrollPredominantAxis : true),\n\t\tmouseWheelSmoothScroll: (typeof opts.mouseWheelSmoothScroll !== 'undefined' ? opts.mouseWheelSmoothScroll : true),\n\t\tarrowSize: (typeof opts.arrowSize !== 'undefined' ? opts.arrowSize : 11),\n\n\t\tlistenOnDomNode: (typeof opts.listenOnDomNode !== 'undefined' ? opts.listenOnDomNode : null),\n\n\t\thorizontal: (typeof opts.horizontal !== 'undefined' ? opts.horizontal : ScrollbarVisibility.Auto),\n\t\thorizontalScrollbarSize: (typeof opts.horizontalScrollbarSize !== 'undefined' ? opts.horizontalScrollbarSize : 10),\n\t\thorizontalSliderSize: (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : 0),\n\t\thorizontalHasArrows: (typeof opts.horizontalHasArrows !== 'undefined' ? opts.horizontalHasArrows : false),\n\n\t\tvertical: (typeof opts.vertical !== 'undefined' ? opts.vertical : ScrollbarVisibility.Auto),\n\t\tverticalScrollbarSize: (typeof opts.verticalScrollbarSize !== 'undefined' ? opts.verticalScrollbarSize : 10),\n\t\tverticalHasArrows: (typeof opts.verticalHasArrows !== 'undefined' ? opts.verticalHasArrows : false),\n\t\tverticalSliderSize: (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : 0),\n\n\t\tscrollByPage: (typeof opts.scrollByPage !== 'undefined' ? opts.scrollByPage : false)\n\t};\n\n\tresult.horizontalSliderSize = (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : result.horizontalScrollbarSize);\n\tresult.verticalSliderSize = (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : result.verticalScrollbarSize);\n\n\t// Defaults are different on Macs\n\tif (platform.isMacintosh) {\n\t\tresult.className += ' mac';\n\t}\n\n\treturn result;\n}\n", "/**\n * Copyright (c) 2024 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { ViewportConstants } from 'browser/shared/Constants';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';\nimport { CoreMouseEventType } from 'common/Types';\nimport { scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';\nimport { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';\nimport type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';\n\nexport class Viewport extends Disposable {\n\n protected _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n private _scrollableElement: SmoothScrollableElement;\n private _styleElement: HTMLStyleElement;\n\n private _queuedAnimationFrame?: number;\n private _latestYDisp?: number;\n private _isSyncing: boolean = false;\n private _isHandlingScroll: boolean = false;\n private _suppressOnScrollHandler: boolean = false;\n\n constructor(\n element: HTMLElement,\n screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService,\n @ICoreMouseService coreMouseService: ICoreMouseService,\n @IThemeService themeService: IThemeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n const scrollable = this._register(new Scrollable({\n forceIntegerValues: false,\n smoothScrollDuration: this._optionsService.rawOptions.smoothScrollDuration,\n // This is used over `IRenderService.addRefreshCallback` since it can be canceled\n scheduleAtNextAnimationFrame: cb => scheduleAtNextAnimationFrame(coreBrowserService.window, cb)\n }));\n this._register(this._optionsService.onSpecificOptionChange('smoothScrollDuration', () => {\n scrollable.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration);\n }));\n\n this._scrollableElement = this._register(new SmoothScrollableElement(screenElement, {\n vertical: ScrollbarVisibility.Auto,\n horizontal: ScrollbarVisibility.Hidden,\n useShadows: false,\n mouseWheelSmoothScroll: true,\n ...this._getChangeOptions()\n }, scrollable));\n this._register(this._optionsService.onMultipleOptionChange([\n 'scrollSensitivity',\n 'fastScrollSensitivity',\n 'overviewRuler'\n ], () => this._scrollableElement.updateOptions(this._getChangeOptions())));\n // Don't handle mouse wheel if wheel events are supported by the current mouse prototcol\n this._register(coreMouseService.onProtocolChange(type => {\n this._scrollableElement.updateOptions({\n handleMouseWheel: !(type & CoreMouseEventType.WHEEL)\n });\n }));\n\n this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });\n this._register(Event.runAndSubscribe(themeService.onChangeColors, () => {\n this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;\n }));\n element.appendChild(this._scrollableElement.getDomNode());\n this._register(toDisposable(() => this._scrollableElement.getDomNode().remove()));\n\n this._styleElement = coreBrowserService.mainDocument.createElement('style');\n screenElement.appendChild(this._styleElement);\n this._register(toDisposable(() => this._styleElement.remove()));\n this._register(Event.runAndSubscribe(themeService.onChangeColors, () => {\n this._styleElement.textContent = [\n `.xterm .xterm-scrollable-element > .scrollbar > .slider {`,\n ` background: ${themeService.colors.scrollbarSliderBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,\n ` background: ${themeService.colors.scrollbarSliderHoverBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,\n ` background: ${themeService.colors.scrollbarSliderActiveBackground.css};`,\n `}`\n ].join('\\n');\n }));\n\n this._register(this._bufferService.onResize(() => this._queueSync()));\n this._register(this._bufferService.buffers.onBufferActivate(() => this._queueSync()));\n this._register(this._bufferService.onScroll(() => this._sync()));\n\n this._register(this._scrollableElement.onScroll(e => this._handleScroll(e)));\n }\n\n public scrollLines(disp: number): void {\n const pos = this._scrollableElement.getScrollPosition();\n this._scrollableElement.setScrollPosition({\n reuseAnimation: true,\n scrollTop: pos.scrollTop + disp * this._renderService.dimensions.css.cell.height\n });\n }\n\n public scrollToLine(line: number, disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll) {\n this._latestYDisp = line;\n }\n this._scrollableElement.setScrollPosition({\n reuseAnimation: !disableSmoothScroll,\n scrollTop: line * this._renderService.dimensions.css.cell.height\n });\n }\n\n private _getChangeOptions(): ScrollableElementChangeOptions {\n return {\n mouseWheelScrollSensitivity: this._optionsService.rawOptions.scrollSensitivity,\n fastScrollSensitivity: this._optionsService.rawOptions.fastScrollSensitivity,\n verticalScrollbarSize: this._optionsService.rawOptions.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH\n };\n }\n\n private _queueSync(ydisp?: number): void {\n // Update state\n if (ydisp !== undefined) {\n this._latestYDisp = ydisp;\n }\n\n // Don't queue more than one callback\n if (this._queuedAnimationFrame !== undefined) {\n return;\n }\n this._queuedAnimationFrame = this._renderService.addRefreshCallback(() => {\n this._queuedAnimationFrame = undefined;\n this._sync(this._latestYDisp);\n });\n }\n\n private _sync(ydisp: number = this._bufferService.buffer.ydisp): void {\n if (!this._renderService || this._isSyncing) {\n return;\n }\n this._isSyncing = true;\n\n // Ignore any onScroll event that happens as a result of dimensions changing as this should\n // never cause a scrollLines call, only setScrollPosition can do that.\n this._suppressOnScrollHandler = true;\n this._scrollableElement.setScrollDimensions({\n height: this._renderService.dimensions.css.canvas.height,\n scrollHeight: this._renderService.dimensions.css.cell.height * this._bufferService.buffer.lines.length\n });\n this._suppressOnScrollHandler = false;\n\n // If ydisp has been changed by some other copmonent (input/buffer), then stop animating smooth\n // scroll and scroll there immediately.\n if (ydisp !== this._latestYDisp) {\n this._scrollableElement.setScrollPosition({\n scrollTop: ydisp * this._renderService.dimensions.css.cell.height\n });\n }\n\n this._isSyncing = false;\n }\n\n private _handleScroll(e: ScrollEvent): void {\n if (!this._renderService) {\n return;\n }\n if (this._isHandlingScroll || this._suppressOnScrollHandler) {\n return;\n }\n this._isHandlingScroll = true;\n const newRow = Math.round(e.scrollTop / this._renderService.dimensions.css.cell.height);\n const diff = newRow - this._bufferService.buffer.ydisp;\n if (diff !== 0) {\n this._latestYDisp = newRow;\n this._onRequestScrollLines.fire(diff);\n }\n this._isHandlingScroll = false;\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services';\n\nexport class BufferDecorationRenderer extends Disposable {\n private readonly _container: HTMLElement;\n private readonly _decorationElements: Map = new Map();\n\n private _animationFrame: number | undefined;\n private _altBufferIsActive: boolean = false;\n private _dimensionsChanged: boolean = false;\n\n constructor(\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n this._container = document.createElement('div');\n this._container.classList.add('xterm-decoration-container');\n this._screenElement.appendChild(this._container);\n\n this._register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations()));\n this._register(this._renderService.onDimensionsChange(() => {\n this._dimensionsChanged = true;\n this._queueRefresh();\n }));\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt;\n }));\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh()));\n this._register(this._decorationService.onDecorationRemoved(decoration => this._removeDecoration(decoration)));\n this._register(toDisposable(() => {\n this._container.remove();\n this._decorationElements.clear();\n }));\n }\n\n private _queueRefresh(): void {\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._renderService.addRefreshCallback(() => {\n this._doRefreshDecorations();\n this._animationFrame = undefined;\n });\n }\n\n private _doRefreshDecorations(): void {\n for (const decoration of this._decorationService.decorations) {\n this._renderDecoration(decoration);\n }\n this._dimensionsChanged = false;\n }\n\n private _renderDecoration(decoration: IInternalDecoration): void {\n this._refreshStyle(decoration);\n if (this._dimensionsChanged) {\n this._refreshXPosition(decoration);\n }\n }\n\n private _createElement(decoration: IInternalDecoration): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.classList.add('xterm-decoration');\n element.classList.toggle('xterm-decoration-top-layer', decoration?.options?.layer === 'top');\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${(decoration.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n\n const x = decoration.options.x ?? 0;\n if (x && x > this._bufferService.cols) {\n // exceeded the container width, so hide\n element.style.display = 'none';\n }\n this._refreshXPosition(decoration, element);\n\n return element;\n }\n\n private _refreshStyle(decoration: IInternalDecoration): void {\n const line = decoration.marker.line - this._bufferService.buffers.active.ydisp;\n if (line < 0 || line >= this._bufferService.rows) {\n // outside of viewport\n if (decoration.element) {\n decoration.element.style.display = 'none';\n decoration.onRenderEmitter.fire(decoration.element);\n }\n } else {\n let element = this._decorationElements.get(decoration);\n if (!element) {\n element = this._createElement(decoration);\n decoration.element = element;\n this._decorationElements.set(decoration, element);\n this._container.appendChild(element);\n decoration.onDispose(() => {\n this._decorationElements.delete(decoration);\n element!.remove();\n });\n }\n element.style.display = this._altBufferIsActive ? 'none' : 'block';\n if (!this._altBufferIsActive) {\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${line * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n }\n decoration.onRenderEmitter.fire(element);\n }\n }\n\n private _refreshXPosition(decoration: IInternalDecoration, element: HTMLElement | undefined = decoration.element): void {\n if (!element) {\n return;\n }\n const x = decoration.options.x ?? 0;\n if ((decoration.options.anchor || 'left') === 'right') {\n element.style.right = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n } else {\n element.style.left = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n }\n }\n\n private _removeDecoration(decoration: IInternalDecoration): void {\n this._decorationElements.get(decoration)?.remove();\n this._decorationElements.delete(decoration);\n decoration.dispose();\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInternalDecoration } from 'common/services/Services';\n\nexport interface IColorZoneStore {\n readonly zones: IColorZone[];\n clear(): void;\n addDecoration(decoration: IInternalDecoration): void;\n /**\n * Sets the amount of padding in lines that will be added between zones, if new lines intersect\n * the padding they will be merged into the same zone.\n */\n setPadding(padding: { [position: string]: number }): void;\n}\n\nexport interface IColorZone {\n /** Color in a format supported by canvas' fillStyle. */\n color: string;\n position: 'full' | 'left' | 'center' | 'right' | undefined;\n startBufferLine: number;\n endBufferLine: number;\n}\n\ninterface IMinimalDecorationForColorZone {\n marker: Pick;\n options: Pick;\n}\n\nexport class ColorZoneStore implements IColorZoneStore {\n private _zones: IColorZone[] = [];\n\n // The zone pool is used to keep zone objects from being freed between clearing the color zone\n // store and fetching the zones. This helps reduce GC pressure since the color zones are\n // accumulated on potentially every scroll event.\n private _zonePool: IColorZone[] = [];\n private _zonePoolIndex = 0;\n\n private _linePadding: { [position: string]: number } = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n };\n\n public get zones(): IColorZone[] {\n // Trim the zone pool to free unused memory\n this._zonePool.length = Math.min(this._zonePool.length, this._zones.length);\n return this._zones;\n }\n\n public clear(): void {\n this._zones.length = 0;\n this._zonePoolIndex = 0;\n }\n\n public addDecoration(decoration: IMinimalDecorationForColorZone): void {\n if (!decoration.options.overviewRulerOptions) {\n return;\n }\n for (const z of this._zones) {\n if (z.color === decoration.options.overviewRulerOptions.color &&\n z.position === decoration.options.overviewRulerOptions.position) {\n if (this._lineIntersectsZone(z, decoration.marker.line)) {\n return;\n }\n if (this._lineAdjacentToZone(z, decoration.marker.line, decoration.options.overviewRulerOptions.position)) {\n this._addLineToZone(z, decoration.marker.line);\n return;\n }\n }\n }\n // Create using zone pool if possible\n if (this._zonePoolIndex < this._zonePool.length) {\n this._zonePool[this._zonePoolIndex].color = decoration.options.overviewRulerOptions.color;\n this._zonePool[this._zonePoolIndex].position = decoration.options.overviewRulerOptions.position;\n this._zonePool[this._zonePoolIndex].startBufferLine = decoration.marker.line;\n this._zonePool[this._zonePoolIndex].endBufferLine = decoration.marker.line;\n this._zones.push(this._zonePool[this._zonePoolIndex++]);\n return;\n }\n // Create\n this._zones.push({\n color: decoration.options.overviewRulerOptions.color,\n position: decoration.options.overviewRulerOptions.position,\n startBufferLine: decoration.marker.line,\n endBufferLine: decoration.marker.line\n });\n this._zonePool.push(this._zones[this._zones.length - 1]);\n this._zonePoolIndex++;\n }\n\n public setPadding(padding: { [position: string]: number }): void {\n this._linePadding = padding;\n }\n\n private _lineIntersectsZone(zone: IColorZone, line: number): boolean {\n return (\n line >= zone.startBufferLine &&\n line <= zone.endBufferLine\n );\n }\n\n private _lineAdjacentToZone(zone: IColorZone, line: number, position: IColorZone['position']): boolean {\n return (\n (line >= zone.startBufferLine - this._linePadding[position || 'full']) &&\n (line <= zone.endBufferLine + this._linePadding[position || 'full'])\n );\n }\n\n private _addLineToZone(zone: IColorZone, line: number): void {\n zone.startBufferLine = Math.min(zone.startBufferLine, line);\n zone.endBufferLine = Math.max(zone.endBufferLine, line);\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';\n\nconst enum Constants {\n OVERVIEW_RULER_BORDER_WIDTH = 1\n}\n\n// Helper objects to avoid excessive calculation and garbage collection during rendering. These are\n// static values for each render and can be accessed using the decoration position as the key.\nconst drawHeight = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawWidth = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawX = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\n\nexport class OverviewRulerRenderer extends Disposable {\n private readonly _canvas: HTMLCanvasElement;\n private readonly _ctx: CanvasRenderingContext2D;\n private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();\n private get _width(): number {\n return this._optionsService.options.overviewRuler?.width || 0;\n }\n private _animationFrame: number | undefined;\n\n private _shouldUpdateDimensions: boolean | undefined = true;\n private _shouldUpdateAnchor: boolean | undefined = true;\n private _lastKnownBufferLength: number = 0;\n\n private _containerHeight: number | undefined;\n\n constructor(\n private readonly _viewportElement: HTMLElement,\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IThemeService private readonly _themeService: IThemeService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n this._canvas = this._coreBrowserService.mainDocument.createElement('canvas');\n this._canvas.classList.add('xterm-decoration-overview-ruler');\n this._refreshCanvasDimensions();\n this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement);\n this._register(toDisposable(() => this._canvas?.remove()));\n\n const ctx = this._canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Ctx cannot be null');\n } else {\n this._ctx = ctx;\n }\n\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));\n this._register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));\n\n this._register(this._renderService.onRenderedViewportChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._canvas!.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';\n }));\n this._register(this._bufferService.onScroll(() => {\n if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {\n this._refreshDrawHeightConstants();\n this._refreshColorZonePadding();\n }\n }));\n\n // Container height changed\n this._register(this._renderService.onRender((): void => {\n if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {\n this._queueRefresh(true);\n this._containerHeight = this._screenElement.clientHeight;\n }\n }));\n\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));\n this._register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));\n this._register(this._themeService.onChangeColors(() => this._queueRefresh()));\n this._queueRefresh(true);\n }\n\n private _refreshDrawConstants(): void {\n // width\n const outerWidth = Math.floor((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n const innerWidth = Math.ceil((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n drawWidth.full = this._canvas.width;\n drawWidth.left = outerWidth;\n drawWidth.center = innerWidth;\n drawWidth.right = outerWidth;\n // height\n this._refreshDrawHeightConstants();\n // x\n drawX.full = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.left = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.center = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left;\n drawX.right = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left + drawWidth.center;\n }\n\n private _refreshDrawHeightConstants(): void {\n drawHeight.full = Math.round(2 * this._coreBrowserService.dpr);\n // Calculate actual pixels per line\n const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length;\n // Clamp actual pixels within a range\n const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * this._coreBrowserService.dpr);\n drawHeight.left = nonFullHeight;\n drawHeight.center = nonFullHeight;\n drawHeight.right = nonFullHeight;\n }\n\n private _refreshColorZonePadding(): void {\n this._colorZoneStore.setPadding({\n full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.full),\n left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.left),\n center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.center),\n right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.right)\n });\n this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length;\n }\n\n private _refreshCanvasDimensions(): void {\n this._canvas.style.width = `${this._width}px`;\n this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr);\n this._canvas.style.height = `${this._screenElement.clientHeight}px`;\n this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr);\n this._refreshDrawConstants();\n this._refreshColorZonePadding();\n }\n\n private _refreshDecorations(): void {\n if (this._shouldUpdateDimensions) {\n this._refreshCanvasDimensions();\n }\n this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\n this._colorZoneStore.clear();\n for (const decoration of this._decorationService.decorations) {\n this._colorZoneStore.addDecoration(decoration);\n }\n this._ctx.lineWidth = 1;\n this._renderRulerOutline();\n const zones = this._colorZoneStore.zones;\n for (const zone of zones) {\n if (zone.position !== 'full') {\n this._renderColorZone(zone);\n }\n }\n for (const zone of zones) {\n if (zone.position === 'full') {\n this._renderColorZone(zone);\n }\n }\n this._shouldUpdateDimensions = false;\n this._shouldUpdateAnchor = false;\n }\n\n private _renderRulerOutline(): void {\n this._ctx.fillStyle = this._themeService.colors.overviewRulerBorder.css;\n this._ctx.fillRect(0, 0, Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n if (this._optionsService.rawOptions.overviewRuler.showTopBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, 0, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, Constants.OVERVIEW_RULER_BORDER_WIDTH);\n }\n if (this._optionsService.rawOptions.overviewRuler.showBottomBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n }\n }\n\n private _renderColorZone(zone: IColorZone): void {\n this._ctx.fillStyle = zone.color;\n this._ctx.fillRect(\n /* x */ drawX[zone.position || 'full'],\n /* y */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n (zone.startBufferLine / this._bufferService.buffers.active.lines.length) - drawHeight[zone.position || 'full'] / 2\n ),\n /* w */ drawWidth[zone.position || 'full'],\n /* h */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n ((zone.endBufferLine - zone.startBufferLine) / this._bufferService.buffers.active.lines.length) + drawHeight[zone.position || 'full']\n )\n );\n }\n\n private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {\n this._shouldUpdateDimensions = updateCanvasDimensions || this._shouldUpdateDimensions;\n this._shouldUpdateAnchor = updateAnchor || this._shouldUpdateAnchor;\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {\n this._refreshDecorations();\n this._animationFrame = undefined;\n });\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * C0 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C0 {\n /** Null (Caret = ^@, C = \\0) */\n export const NUL = '\\x00';\n /** Start of Heading (Caret = ^A) */\n export const SOH = '\\x01';\n /** Start of Text (Caret = ^B) */\n export const STX = '\\x02';\n /** End of Text (Caret = ^C) */\n export const ETX = '\\x03';\n /** End of Transmission (Caret = ^D) */\n export const EOT = '\\x04';\n /** Enquiry (Caret = ^E) */\n export const ENQ = '\\x05';\n /** Acknowledge (Caret = ^F) */\n export const ACK = '\\x06';\n /** Bell (Caret = ^G, C = \\a) */\n export const BEL = '\\x07';\n /** Backspace (Caret = ^H, C = \\b) */\n export const BS = '\\x08';\n /** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \\t) */\n export const HT = '\\x09';\n /** Line Feed (Caret = ^J, C = \\n) */\n export const LF = '\\x0a';\n /** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \\v) */\n export const VT = '\\x0b';\n /** Form Feed (Caret = ^L, C = \\f) */\n export const FF = '\\x0c';\n /** Carriage Return (Caret = ^M, C = \\r) */\n export const CR = '\\x0d';\n /** Shift Out (Caret = ^N) */\n export const SO = '\\x0e';\n /** Shift In (Caret = ^O) */\n export const SI = '\\x0f';\n /** Data Link Escape (Caret = ^P) */\n export const DLE = '\\x10';\n /** Device Control One (XON) (Caret = ^Q) */\n export const DC1 = '\\x11';\n /** Device Control Two (Caret = ^R) */\n export const DC2 = '\\x12';\n /** Device Control Three (XOFF) (Caret = ^S) */\n export const DC3 = '\\x13';\n /** Device Control Four (Caret = ^T) */\n export const DC4 = '\\x14';\n /** Negative Acknowledge (Caret = ^U) */\n export const NAK = '\\x15';\n /** Synchronous Idle (Caret = ^V) */\n export const SYN = '\\x16';\n /** End of Transmission Block (Caret = ^W) */\n export const ETB = '\\x17';\n /** Cancel (Caret = ^X) */\n export const CAN = '\\x18';\n /** End of Medium (Caret = ^Y) */\n export const EM = '\\x19';\n /** Substitute (Caret = ^Z) */\n export const SUB = '\\x1a';\n /** Escape (Caret = ^[, C = \\e) */\n export const ESC = '\\x1b';\n /** File Separator (Caret = ^\\) */\n export const FS = '\\x1c';\n /** Group Separator (Caret = ^]) */\n export const GS = '\\x1d';\n /** Record Separator (Caret = ^^) */\n export const RS = '\\x1e';\n /** Unit Separator (Caret = ^_) */\n export const US = '\\x1f';\n /** Space */\n export const SP = '\\x20';\n /** Delete (Caret = ^?) */\n export const DEL = '\\x7f';\n}\n\n/**\n * C1 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C1 {\n /** padding character */\n export const PAD = '\\x80';\n /** High Octet Preset */\n export const HOP = '\\x81';\n /** Break Permitted Here */\n export const BPH = '\\x82';\n /** No Break Here */\n export const NBH = '\\x83';\n /** Index */\n export const IND = '\\x84';\n /** Next Line */\n export const NEL = '\\x85';\n /** Start of Selected Area */\n export const SSA = '\\x86';\n /** End of Selected Area */\n export const ESA = '\\x87';\n /** Horizontal Tabulation Set */\n export const HTS = '\\x88';\n /** Horizontal Tabulation With Justification */\n export const HTJ = '\\x89';\n /** Vertical Tabulation Set */\n export const VTS = '\\x8a';\n /** Partial Line Down */\n export const PLD = '\\x8b';\n /** Partial Line Up */\n export const PLU = '\\x8c';\n /** Reverse Index */\n export const RI = '\\x8d';\n /** Single-Shift 2 */\n export const SS2 = '\\x8e';\n /** Single-Shift 3 */\n export const SS3 = '\\x8f';\n /** Device Control String */\n export const DCS = '\\x90';\n /** Private Use 1 */\n export const PU1 = '\\x91';\n /** Private Use 2 */\n export const PU2 = '\\x92';\n /** Set Transmit State */\n export const STS = '\\x93';\n /** Destructive backspace, intended to eliminate ambiguity about meaning of BS. */\n export const CCH = '\\x94';\n /** Message Waiting */\n export const MW = '\\x95';\n /** Start of Protected Area */\n export const SPA = '\\x96';\n /** End of Protected Area */\n export const EPA = '\\x97';\n /** Start of String */\n export const SOS = '\\x98';\n /** Single Graphic Character Introducer */\n export const SGCI = '\\x99';\n /** Single Character Introducer */\n export const SCI = '\\x9a';\n /** Control Sequence Introducer */\n export const CSI = '\\x9b';\n /** String Terminator */\n export const ST = '\\x9c';\n /** Operating System Command */\n export const OSC = '\\x9d';\n /** Privacy Message */\n export const PM = '\\x9e';\n /** Application Program Command */\n export const APC = '\\x9f';\n}\nexport namespace C1_ESCAPED {\n export const ST = `${C0.ESC}\\\\`;\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderService } from 'browser/services/Services';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { C0 } from 'common/data/EscapeSequences';\n\ninterface IPosition {\n start: number;\n end: number;\n}\n\n/**\n * Encapsulates the logic for handling compositionstart, compositionupdate and compositionend\n * events, displaying the in-progress composition to the UI and forwarding the final composition\n * to the handler.\n */\nexport class CompositionHelper {\n /**\n * Whether input composition is currently happening, eg. via a mobile keyboard, speech input or\n * IME. This variable determines whether the compositionText should be displayed on the UI.\n */\n private _isComposing: boolean;\n public get isComposing(): boolean { return this._isComposing; }\n\n /**\n * The position within the input textarea's value of the current composition.\n */\n private _compositionPosition: IPosition;\n\n /**\n * Whether a composition is in the process of being sent, setting this to false will cancel any\n * in-progress composition.\n */\n private _isSendingComposition: boolean;\n\n /**\n * Data already sent due to keydown event.\n */\n private _dataAlreadySent: string;\n\n constructor(\n private readonly _textarea: HTMLTextAreaElement,\n private readonly _compositionView: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreService private readonly _coreService: ICoreService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n this._isComposing = false;\n this._isSendingComposition = false;\n this._compositionPosition = { start: 0, end: 0 };\n this._dataAlreadySent = '';\n }\n\n /**\n * Handles the compositionstart event, activating the composition view.\n */\n public compositionstart(): void {\n this._isComposing = true;\n this._compositionPosition.start = this._textarea.value.length;\n this._compositionView.textContent = '';\n this._dataAlreadySent = '';\n this._compositionView.classList.add('active');\n }\n\n /**\n * Handles the compositionupdate event, updating the composition view.\n * @param ev The event.\n */\n public compositionupdate(ev: Pick): void {\n this._compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(() => {\n this._compositionPosition.end = this._textarea.value.length;\n }, 0);\n }\n\n /**\n * Handles the compositionend event, hiding the composition view and sending the composition to\n * the handler.\n */\n public compositionend(): void {\n this._finalizeComposition(true);\n }\n\n /**\n * Handles the keydown event, routing any necessary events to the CompositionHelper functions.\n * @param ev The keydown event.\n * @returns Whether the Terminal should continue processing the keydown event.\n */\n public keydown(ev: KeyboardEvent): boolean {\n if (this._isComposing || this._isSendingComposition) {\n if (ev.keyCode === 229) {\n // Continue composing if the keyCode is the \"composition character\"\n return false;\n }\n if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n // Continue composing if the keyCode is a modifier key\n return false;\n }\n // Finish composition immediately. This is mainly here for the case where enter is\n // pressed and the handler needs to be triggered before the command is executed.\n this._finalizeComposition(false);\n }\n\n if (ev.keyCode === 229) {\n // If the \"composition character\" is used but gets to this point it means a non-composition\n // character (eg. numbers and punctuation) was pressed when the IME was active.\n this._handleAnyTextareaChanges();\n return false;\n }\n\n return true;\n }\n\n /**\n * Finalizes the composition, resuming regular input actions. This is called when a composition\n * is ending.\n * @param waitForPropagation Whether to wait for events to propagate before sending\n * the input. This should be false if a non-composition keystroke is entered before the\n * compositionend event is triggered, such as enter, so that the composition is sent before\n * the command is executed.\n */\n private _finalizeComposition(waitForPropagation: boolean): void {\n this._compositionView.classList.remove('active');\n this._isComposing = false;\n\n if (!waitForPropagation) {\n // Cancel any delayed composition send requests and send the input immediately.\n this._isSendingComposition = false;\n const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);\n this._coreService.triggerDataEvent(input, true);\n } else {\n // Make a deep copy of the composition position here as a new compositionstart event may\n // fire before the setTimeout executes.\n const currentCompositionPosition = {\n start: this._compositionPosition.start,\n end: this._compositionPosition.end\n };\n\n // Since composition* events happen before the changes take place in the textarea on most\n // browsers, use a setTimeout with 0ms time to allow the native compositionend event to\n // complete. This ensures the correct character is retrieved.\n // This solution was used because:\n // - The compositionend event's data property is unreliable, at least on Chromium\n // - The last compositionupdate event's data property does not always accurately describe\n // the character, a counter example being Korean where an ending consonsant can move to\n // the following character if the following input is a vowel.\n this._isSendingComposition = true;\n setTimeout(() => {\n // Ensure that the input has not already been sent\n if (this._isSendingComposition) {\n this._isSendingComposition = false;\n let input;\n // Add length of data already sent due to keydown event,\n // otherwise input characters can be duplicated. (Issue #3191)\n currentCompositionPosition.start += this._dataAlreadySent.length;\n if (this._isComposing) {\n // Use the start position of the new composition to get the string\n // if a new composition has started.\n input = this._textarea.value.substring(currentCompositionPosition.start, this._compositionPosition.start);\n } else {\n // Don't use the end position here in order to pick up any characters after the\n // composition has finished, for example when typing a non-composition character\n // (eg. 2) after a composition character.\n input = this._textarea.value.substring(currentCompositionPosition.start);\n }\n if (input.length > 0) {\n this._coreService.triggerDataEvent(input, true);\n }\n }\n }, 0);\n }\n }\n\n /**\n * Apply any changes made to the textarea after the current event chain is allowed to complete.\n * This should be called when not currently composing but a keydown event with the \"composition\n * character\" (229) is triggered, in order to allow non-composition text to be entered when an\n * IME is active.\n */\n private _handleAnyTextareaChanges(): void {\n const oldValue = this._textarea.value;\n setTimeout(() => {\n // Ignore if a composition has started since the timeout\n if (!this._isComposing) {\n const newValue = this._textarea.value;\n\n const diff = newValue.replace(oldValue, '');\n\n this._dataAlreadySent = diff;\n\n if (newValue.length > oldValue.length) {\n this._coreService.triggerDataEvent(diff, true);\n } else if (newValue.length < oldValue.length) {\n this._coreService.triggerDataEvent(`${C0.DEL}`, true);\n } else if ((newValue.length === oldValue.length) && (newValue !== oldValue)) {\n this._coreService.triggerDataEvent(newValue, true);\n }\n\n }\n }, 0);\n }\n\n /**\n * Positions the composition view on top of the cursor and the textarea just below it (so the\n * IME helper dialog is positioned correctly).\n * @param dontRecurse Whether to use setTimeout to recursively trigger another update, this is\n * necessary as the IME events across browsers are not consistently triggered.\n */\n public updateCompositionElements(dontRecurse?: boolean): void {\n if (!this._isComposing) {\n return;\n }\n\n if (this._bufferService.buffer.isCursorInViewport) {\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const cursorTop = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n this._compositionView.style.left = cursorLeft + 'px';\n this._compositionView.style.top = cursorTop + 'px';\n this._compositionView.style.height = cellHeight + 'px';\n this._compositionView.style.lineHeight = cellHeight + 'px';\n this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + 'px';\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n const compositionViewBounds = this._compositionView.getBoundingClientRect();\n this._textarea.style.left = cursorLeft + 'px';\n this._textarea.style.top = cursorTop + 'px';\n // Ensure the text area is at least 1x1, otherwise certain IMEs may break\n this._textarea.style.width = Math.max(compositionViewBounds.width, 1) + 'px';\n this._textarea.style.height = Math.max(compositionViewBounds.height, 1) + 'px';\n this._textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n\n if (!dontRecurse) {\n setTimeout(() => this.updateCompositionElements(true), 0);\n }\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ninterface INavigator {\n userAgent: string;\n language: string;\n platform: string;\n}\n\n// We're declaring a navigator global here as we expect it in all runtimes (node and browser), but\n// we want this module to live in common.\ndeclare const navigator: INavigator;\ndeclare const process: unknown;\n\nexport const isNode = (typeof process !== 'undefined' && 'title' in (process as any)) ? true : false;\nconst userAgent = (isNode) ? 'node' : navigator.userAgent;\nconst platform = (isNode) ? 'node' : navigator.platform;\n\nexport const isFirefox = userAgent.includes('Firefox');\nexport const isLegacyEdge = userAgent.includes('Edge');\nexport const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);\nexport function getSafariVersion(): number {\n if (!isSafari) {\n return 0;\n }\n const majorVersion = userAgent.match(/Version\\/(\\d+)/);\n if (majorVersion === null || majorVersion.length < 2) {\n return 0;\n }\n return parseInt(majorVersion[1]);\n}\n\n// Find the users platform. We use this to interpret the meta key\n// and ISO third level shifts.\n// http://stackoverflow.com/q/19877924/577598\nexport const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform);\nexport const isIpad = platform === 'iPad';\nexport const isIphone = platform === 'iPhone';\nexport const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);\nexport const isLinux = platform.indexOf('Linux') >= 0;\n// Note that when this is true, isLinux will also be true.\nexport const isChromeOS = /\\bCrOS\\b/.test(userAgent);\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isFirefox, isLegacyEdge } from 'common/Platform';\n\nexport const INVERTED_DEFAULT_COLOR = 257;\n\nexport const DIM_OPACITY = 0.5;\n// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge\n// would result in truncated text (Issue 3353). Using 'bottom' for Chrome would result in slightly\n// unaligned Powerline fonts (PR 3356#issuecomment-850928179).\nexport const TEXT_BASELINE: CanvasTextBaseline = isFirefox || isLegacyEdge ? 'bottom' : 'ideographic';\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColor, IColorRGB } from 'common/Types';\n\nlet $r = 0;\nlet $g = 0;\nlet $b = 0;\nlet $a = 0;\n\nexport const NULL_COLOR: IColor = {\n css: '#00000000',\n rgba: 0\n};\n\n/**\n * Helper functions where the source type is \"channels\" (individual color channels as numbers).\n */\nexport namespace channels {\n export function toCss(r: number, g: number, b: number, a?: number): string {\n if (a !== undefined) {\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}${toPaddedHex(a)}`;\n }\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}`;\n }\n\n export function toRgba(r: number, g: number, b: number, a: number = 0xFF): number {\n // Note: The aggregated number is RGBA32 (BE), thus needs to be converted to ABGR32\n // on LE systems, before it can be used for direct 32-bit buffer writes.\n // >>> 0 forces an unsigned int\n return (r << 24 | g << 16 | b << 8 | a) >>> 0;\n }\n\n export function toColor(r: number, g: number, b: number, a?: number): IColor {\n return {\n css: channels.toCss(r, g, b, a),\n rgba: channels.toRgba(r, g, b, a)\n };\n }\n}\n\n/**\n * Helper functions where the source type is `IColor`.\n */\nexport namespace color {\n export function blend(bg: IColor, fg: IColor): IColor {\n $a = (fg.rgba & 0xFF) / 255;\n if ($a === 1) {\n return {\n css: fg.css,\n rgba: fg.rgba\n };\n }\n const fgR = (fg.rgba >> 24) & 0xFF;\n const fgG = (fg.rgba >> 16) & 0xFF;\n const fgB = (fg.rgba >> 8) & 0xFF;\n const bgR = (bg.rgba >> 24) & 0xFF;\n const bgG = (bg.rgba >> 16) & 0xFF;\n const bgB = (bg.rgba >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n const css = channels.toCss($r, $g, $b);\n const rgba = channels.toRgba($r, $g, $b);\n return { css, rgba };\n }\n\n export function isOpaque(color: IColor): boolean {\n return (color.rgba & 0xFF) === 0xFF;\n }\n\n export function ensureContrastRatio(bg: IColor, fg: IColor, ratio: number): IColor | undefined {\n const result = rgba.ensureContrastRatio(bg.rgba, fg.rgba, ratio);\n if (!result) {\n return undefined;\n }\n return channels.toColor(\n (result >> 24 & 0xFF),\n (result >> 16 & 0xFF),\n (result >> 8 & 0xFF)\n );\n }\n\n export function opaque(color: IColor): IColor {\n const rgbaColor = (color.rgba | 0xFF) >>> 0;\n [$r, $g, $b] = rgba.toChannels(rgbaColor);\n return {\n css: channels.toCss($r, $g, $b),\n rgba: rgbaColor\n };\n }\n\n export function opacity(color: IColor, opacity: number): IColor {\n $a = Math.round(opacity * 0xFF);\n [$r, $g, $b] = rgba.toChannels(color.rgba);\n return {\n css: channels.toCss($r, $g, $b, $a),\n rgba: channels.toRgba($r, $g, $b, $a)\n };\n }\n\n export function multiplyOpacity(color: IColor, factor: number): IColor {\n $a = color.rgba & 0xFF;\n return opacity(color, ($a * factor) / 0xFF);\n }\n\n export function toColorRGB(color: IColor): IColorRGB {\n return [(color.rgba >> 24) & 0xFF, (color.rgba >> 16) & 0xFF, (color.rgba >> 8) & 0xFF];\n }\n}\n\n/**\n * Helper functions where the source type is \"css\" (string: '#rgb', '#rgba', '#rrggbb',\n * '#rrggbbaa').\n */\nexport namespace css {\n // Attempt to set get the shared canvas context\n let $ctx: CanvasRenderingContext2D | undefined;\n let $litmusColor: CanvasGradient | undefined;\n try {\n // This is guaranteed to run in the first window, so document should be correct\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext('2d', {\n willReadFrequently: true\n });\n if (ctx) {\n $ctx = ctx;\n $ctx.globalCompositeOperation = 'copy';\n $litmusColor = $ctx.createLinearGradient(0, 0, 1, 1);\n }\n }\n catch {\n // noop\n }\n\n /**\n * Converts a css string to an IColor, this should handle all valid CSS color strings and will\n * throw if it's invalid. The ideal format to use is `#rrggbb[aa]` as it's the fastest to parse.\n *\n * Only `#rgb[a]`, `#rrggbb[aa]`, `rgb()` and `rgba()` formats are supported when run in a Node\n * environment.\n */\n export function toColor(css: string): IColor {\n // Formats: #rgb[a] and #rrggbb[aa]\n if (css.match(/#[\\da-f]{3,8}/i)) {\n switch (css.length) {\n case 4: { // #rgb\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n return channels.toColor($r, $g, $b);\n }\n case 5: { // #rgba\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n $a = parseInt(css.slice(4, 5).repeat(2), 16);\n return channels.toColor($r, $g, $b, $a);\n }\n case 7: // #rrggbb\n return {\n css,\n rgba: (parseInt(css.slice(1), 16) << 8 | 0xFF) >>> 0\n };\n case 9: // #rrggbbaa\n return {\n css,\n rgba: parseInt(css.slice(1), 16) >>> 0\n };\n }\n }\n\n // Formats: rgb() or rgba()\n const rgbaMatch = css.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);\n if (rgbaMatch) {\n $r = parseInt(rgbaMatch[1]);\n $g = parseInt(rgbaMatch[2]);\n $b = parseInt(rgbaMatch[3]);\n $a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);\n return channels.toColor($r, $g, $b, $a);\n }\n\n // Validate the context is available for canvas-based color parsing\n if (!$ctx || !$litmusColor) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Validate the color using canvas fillStyle\n // See https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles\n $ctx.fillStyle = $litmusColor;\n $ctx.fillStyle = css;\n if (typeof $ctx.fillStyle !== 'string') {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n $ctx.fillRect(0, 0, 1, 1);\n [$r, $g, $b, $a] = $ctx.getImageData(0, 0, 1, 1).data;\n\n // Validate the color is non-transparent as color hue gets lost when drawn to the canvas\n if ($a !== 0xFF) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Extract the color from the canvas' fillStyle property which exposes the color value in rgba()\n // format\n // See https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color\n return {\n rgba: channels.toRgba($r, $g, $b, $a),\n css\n };\n }\n}\n\n/**\n * Helper functions where the source type is \"rgb\" (number: 0xrrggbb).\n */\nexport namespace rgb {\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param rgb The color to use.\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance(rgb: number): number {\n return relativeLuminance2(\n (rgb >> 16) & 0xFF,\n (rgb >> 8 ) & 0xFF,\n (rgb ) & 0xFF);\n }\n\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param r The red channel (0x00 to 0xFF).\n * @param g The green channel (0x00 to 0xFF).\n * @param b The blue channel (0x00 to 0xFF).\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance2(r: number, g: number, b: number): number {\n const rs = r / 255;\n const gs = g / 255;\n const bs = b / 255;\n const rr = rs <= 0.03928 ? rs / 12.92 : Math.pow((rs + 0.055) / 1.055, 2.4);\n const rg = gs <= 0.03928 ? gs / 12.92 : Math.pow((gs + 0.055) / 1.055, 2.4);\n const rb = bs <= 0.03928 ? bs / 12.92 : Math.pow((bs + 0.055) / 1.055, 2.4);\n return rr * 0.2126 + rg * 0.7152 + rb * 0.0722;\n }\n}\n\n/**\n * Helper functions where the source type is \"rgba\" (number: 0xrrggbbaa).\n */\nexport namespace rgba {\n export function blend(bg: number, fg: number): number {\n $a = (fg & 0xFF) / 0xFF;\n if ($a === 1) {\n return fg;\n }\n const fgR = (fg >> 24) & 0xFF;\n const fgG = (fg >> 16) & 0xFF;\n const fgB = (fg >> 8) & 0xFF;\n const bgR = (bg >> 24) & 0xFF;\n const bgG = (bg >> 16) & 0xFF;\n const bgB = (bg >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n return channels.toRgba($r, $g, $b);\n }\n\n /**\n * Given a foreground color and a background color, either increase or reduce the luminance of the\n * foreground color until the specified contrast ratio is met. If pure white or black is hit\n * without the contrast ratio being met, go the other direction using the background color as the\n * foreground color and take either the first or second result depending on which has the higher\n * contrast ratio.\n *\n * `undefined` will be returned if the contrast ratio is already met.\n *\n * @param bgRgba The background color in rgba format.\n * @param fgRgba The foreground color in rgba format.\n * @param ratio The contrast ratio to achieve.\n */\n export function ensureContrastRatio(bgRgba: number, fgRgba: number, ratio: number): number | undefined {\n const bgL = rgb.relativeLuminance(bgRgba >> 8);\n const fgL = rgb.relativeLuminance(fgRgba >> 8);\n const cr = contrastRatio(bgL, fgL);\n if (cr < ratio) {\n if (fgL < bgL) {\n const resultA = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n const resultA = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n return undefined;\n }\n\n export function reduceLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to reducing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR > 0 || fgG > 0 || fgB > 0)) {\n // Reduce by 10% until the ratio is hit\n fgR -= Math.max(0, Math.ceil(fgR * 0.1));\n fgG -= Math.max(0, Math.ceil(fgG * 0.1));\n fgB -= Math.max(0, Math.ceil(fgB * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function increaseLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to increasing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR < 0xFF || fgG < 0xFF || fgB < 0xFF)) {\n // Increase by 10% until the ratio is hit\n fgR = Math.min(0xFF, fgR + Math.ceil((255 - fgR) * 0.1));\n fgG = Math.min(0xFF, fgG + Math.ceil((255 - fgG) * 0.1));\n fgB = Math.min(0xFF, fgB + Math.ceil((255 - fgB) * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function toChannels(value: number): [number, number, number, number] {\n return [(value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF];\n }\n}\n\nexport function toPaddedHex(c: number): string {\n const s = c.toString(16);\n return s.length < 2 ? '0' + s : s;\n}\n\n/**\n * Gets the contrast ratio between two relative luminance values.\n * @param l1 The first relative luminance.\n * @param l2 The first relative luminance.\n * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef\n */\nexport function contrastRatio(l1: number, l2: number): number {\n if (l1 < l2) {\n return (l2 + 0.05) / (l1 + 0.05);\n }\n return (l1 + 0.05) / (l2 + 0.05);\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, CharData } from 'common/Types';\nimport { ICharacterJoiner } from 'browser/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WHITESPACE_CELL_CHAR, Content } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService } from 'common/services/Services';\nimport { ICharacterJoinerService } from 'browser/services/Services';\n\nexport class JoinedCellData extends AttributeData implements ICellData {\n private _width: number;\n // .content carries no meaning for joined CellData, simply nullify it\n // thus we have to overload all other .content accessors\n public content: number = 0;\n public fg: number;\n public bg: number;\n public combinedData: string = '';\n\n constructor(firstCell: ICellData, chars: string, width: number) {\n super();\n this.fg = firstCell.fg;\n this.bg = firstCell.bg;\n this.combinedData = chars;\n this._width = width;\n }\n\n public isCombined(): number {\n // always mark joined cell data as combined\n return Content.IS_COMBINED_MASK;\n }\n\n public getWidth(): number {\n return this._width;\n }\n\n public getChars(): string {\n return this.combinedData;\n }\n\n public getCode(): number {\n // code always gets the highest possible fake codepoint (read as -1)\n // this is needed as code is used by caches as identifier\n return 0x1FFFFF;\n }\n\n public setFromCharData(value: CharData): void {\n throw new Error('not implemented');\n }\n\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n\nexport class CharacterJoinerService implements ICharacterJoinerService {\n public serviceBrand: undefined;\n\n private _characterJoiners: ICharacterJoiner[] = [];\n private _nextCharacterJoinerId: number = 0;\n private _workCell: CellData = new CellData();\n\n constructor(\n @IBufferService private _bufferService: IBufferService\n ) { }\n\n public register(handler: (text: string) => [number, number][]): number {\n const joiner: ICharacterJoiner = {\n id: this._nextCharacterJoinerId++,\n handler\n };\n\n this._characterJoiners.push(joiner);\n return joiner.id;\n }\n\n public deregister(joinerId: number): boolean {\n for (let i = 0; i < this._characterJoiners.length; i++) {\n if (this._characterJoiners[i].id === joinerId) {\n this._characterJoiners.splice(i, 1);\n return true;\n }\n }\n\n return false;\n }\n\n public getJoinedCharacters(row: number): [number, number][] {\n if (this._characterJoiners.length === 0) {\n return [];\n }\n\n const line = this._bufferService.buffer.lines.get(row);\n if (!line || line.length === 0) {\n return [];\n }\n\n const ranges: [number, number][] = [];\n const lineStr = line.translateToString(true);\n\n // Because some cells can be represented by multiple javascript characters,\n // we track the cell and the string indexes separately. This allows us to\n // translate the string ranges we get from the joiners back into cell ranges\n // for use when rendering\n let rangeStartColumn = 0;\n let currentStringIndex = 0;\n let rangeStartStringIndex = 0;\n let rangeAttrFG = line.getFg(0);\n let rangeAttrBG = line.getBg(0);\n\n for (let x = 0; x < line.getTrimmedLength(); x++) {\n line.loadCell(x, this._workCell);\n\n if (this._workCell.getWidth() === 0) {\n // If this character is of width 0, skip it.\n continue;\n }\n\n // End of range\n if (this._workCell.fg !== rangeAttrFG || this._workCell.bg !== rangeAttrBG) {\n // If we ended up with a sequence of more than one character,\n // look for ranges to join.\n if (x - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n // Reset our markers for a new range.\n rangeStartColumn = x;\n rangeStartStringIndex = currentStringIndex;\n rangeAttrFG = this._workCell.fg;\n rangeAttrBG = this._workCell.bg;\n }\n\n currentStringIndex += this._workCell.getChars().length || WHITESPACE_CELL_CHAR.length;\n }\n\n // Process any trailing ranges.\n if (this._bufferService.cols - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n return ranges;\n }\n\n /**\n * Given a segment of a line of text, find all ranges of text that should be\n * joined in a single rendering unit. Ranges are internally converted to\n * column ranges, rather than string ranges.\n * @param line String representation of the full line of text\n * @param startIndex Start position of the range to search in the string (inclusive)\n * @param endIndex End position of the range to search in the string (exclusive)\n */\n private _getJoinedRanges(line: string, startIndex: number, endIndex: number, lineData: IBufferLine, startCol: number): [number, number][] {\n const text = line.substring(startIndex, endIndex);\n // At this point we already know that there is at least one joiner so\n // we can just pull its value and assign it directly rather than\n // merging it into an empty array, which incurs unnecessary writes.\n let allJoinedRanges: [number, number][] = [];\n try {\n allJoinedRanges = this._characterJoiners[0].handler(text);\n } catch (error) {\n console.error(error);\n }\n for (let i = 1; i < this._characterJoiners.length; i++) {\n // We merge any overlapping ranges across the different joiners\n try {\n const joinerRanges = this._characterJoiners[i].handler(text);\n for (let j = 0; j < joinerRanges.length; j++) {\n CharacterJoinerService._mergeRanges(allJoinedRanges, joinerRanges[j]);\n }\n } catch (error) {\n console.error(error);\n }\n }\n this._stringRangesToCellRanges(allJoinedRanges, lineData, startCol);\n return allJoinedRanges;\n }\n\n /**\n * Modifies the provided ranges in-place to adjust for variations between\n * string length and cell width so that the range represents a cell range,\n * rather than the string range the joiner provides.\n * @param ranges String ranges containing start (inclusive) and end (exclusive) index\n * @param line Cell data for the relevant line in the terminal\n * @param startCol Offset within the line to start from\n */\n private _stringRangesToCellRanges(ranges: [number, number][], line: IBufferLine, startCol: number): void {\n let currentRangeIndex = 0;\n let currentRangeStarted = false;\n let currentStringIndex = 0;\n let currentRange = ranges[currentRangeIndex];\n\n // If we got through all of the ranges, stop searching\n if (!currentRange) {\n return;\n }\n\n for (let x = startCol; x < this._bufferService.cols; x++) {\n const width = line.getWidth(x);\n const length = line.getString(x).length || WHITESPACE_CELL_CHAR.length;\n\n // We skip zero-width characters when creating the string to join the text\n // so we do the same here\n if (width === 0) {\n continue;\n }\n\n // Adjust the start of the range\n if (!currentRangeStarted && currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n }\n\n // Adjust the end of the range\n if (currentRange[1] <= currentStringIndex) {\n currentRange[1] = x;\n\n // We're finished with this range, so we move to the next one\n currentRange = ranges[++currentRangeIndex];\n\n // If there are no more ranges left, stop searching\n if (!currentRange) {\n break;\n }\n\n // Ranges can be on adjacent characters. Because the end index of the\n // ranges are exclusive, this means that the index for the start of a\n // range can be the same as the end index of the previous range. To\n // account for the start of the next range, we check here just in case.\n if (currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n } else {\n currentRangeStarted = false;\n }\n }\n\n // Adjust the string index based on the character length to line up with\n // the column adjustment\n currentStringIndex += length;\n }\n\n // If there is still a range left at the end, it must extend all the way to\n // the end of the line.\n if (currentRange) {\n currentRange[1] = this._bufferService.cols;\n }\n }\n\n /**\n * Merges the range defined by the provided start and end into the list of\n * existing ranges. The merge is done in place on the existing range for\n * performance and is also returned.\n * @param ranges Existing range list\n * @param newRange Tuple of two numbers representing the new range to merge in.\n * @returns The ranges input with the new range merged in place\n */\n private static _mergeRanges(ranges: [number, number][], newRange: [number, number]): [number, number][] {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, newRange);\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRange[0], range[0]);\n return ranges;\n }\n\n if (newRange[0] < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRange[0], range[0]);\n inRange = true;\n }\n\n // Case 4: New range starts after the search range\n continue;\n } else {\n if (newRange[1] <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRange[1];\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRange[1], range[1]);\n ranges.splice(i, 1);\n return ranges;\n }\n\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRange[1];\n } else {\n // Case 9: New range starts after the last existing range\n ranges.push(newRange);\n }\n\n return ranges;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDimensions, IRenderDimensions } from 'browser/renderer/shared/Types';\n\nexport function throwIfFalsy(value: T | undefined | null): T {\n if (!value) {\n throw new Error('value must not be falsy');\n }\n return value;\n}\n\nexport function isPowerlineGlyph(codepoint: number): boolean {\n // Only return true for Powerline symbols which require\n // different padding and should be excluded from minimum contrast\n // ratio standards\n return 0xE0A4 <= codepoint && codepoint <= 0xE0D6;\n}\n\nexport function isRestrictedPowerlineGlyph(codepoint: number): boolean {\n return 0xE0B0 <= codepoint && codepoint <= 0xE0B7;\n}\n\nfunction isNerdFontGlyph(codepoint: number): boolean {\n return 0xE000 <= codepoint && codepoint <= 0xF8FF;\n}\n\nfunction isBoxOrBlockGlyph(codepoint: number): boolean {\n return 0x2500 <= codepoint && codepoint <= 0x259F;\n}\n\nexport function isEmoji(codepoint: number): boolean {\n return (\n codepoint >= 0x1F600 && codepoint <= 0x1F64F || // Emoticons\n codepoint >= 0x1F300 && codepoint <= 0x1F5FF || // Misc Symbols and Pictographs\n codepoint >= 0x1F680 && codepoint <= 0x1F6FF || // Transport and Map\n codepoint >= 0x2600 && codepoint <= 0x26FF || // Misc symbols\n codepoint >= 0x2700 && codepoint <= 0x27BF || // Dingbats\n codepoint >= 0xFE00 && codepoint <= 0xFE0F || // Variation Selectors\n codepoint >= 0x1F900 && codepoint <= 0x1F9FF || // Supplemental Symbols and Pictographs\n codepoint >= 0x1F1E6 && codepoint <= 0x1F1FF\n );\n}\n\nexport function allowRescaling(codepoint: number | undefined, width: number, glyphSizeX: number, deviceCellWidth: number): boolean {\n return (\n // Is single cell width\n width === 1 &&\n // Glyph exceeds cell bounds, add 50% to avoid hurting readability by rescaling glyphs that\n // barely overlap\n glyphSizeX > Math.ceil(deviceCellWidth * 1.5) &&\n // Never rescale ascii\n codepoint !== undefined && codepoint > 0xFF &&\n // Never rescale emoji\n !isEmoji(codepoint) &&\n // Never rescale powerline or nerd fonts\n !isPowerlineGlyph(codepoint) && !isNerdFontGlyph(codepoint)\n );\n}\n\nexport function treatGlyphAsBackgroundColor(codepoint: number): boolean {\n return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);\n}\n\nexport function createRenderDimensions(): IRenderDimensions {\n return {\n css: {\n canvas: createDimension(),\n cell: createDimension()\n },\n device: {\n canvas: createDimension(),\n cell: createDimension(),\n char: {\n width: 0,\n height: 0,\n left: 0,\n top: 0\n }\n }\n };\n}\n\nfunction createDimension(): IDimensions {\n return {\n width: 0,\n height: 0\n };\n}\n\nexport function computeNextVariantOffset(cellWidth: number, lineWidth: number, currentOffset: number = 0): number {\n return (cellWidth - (Math.round(lineWidth) * 2 - currentOffset)) % (Math.round(lineWidth) * 2);\n}\n", "/**\n * Copyright (c) 2018, 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, IColor } from 'common/Types';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { channels, color } from 'common/Color';\nimport { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { JoinedCellData } from 'browser/services/CharacterJoinerService';\nimport { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { IColorContrastCache } from 'browser/Types';\n\n\nexport const enum RowCss {\n BOLD_CLASS = 'xterm-bold',\n DIM_CLASS = 'xterm-dim',\n ITALIC_CLASS = 'xterm-italic',\n UNDERLINE_CLASS = 'xterm-underline',\n OVERLINE_CLASS = 'xterm-overline',\n STRIKETHROUGH_CLASS = 'xterm-strikethrough',\n CURSOR_CLASS = 'xterm-cursor',\n CURSOR_BLINK_CLASS = 'xterm-cursor-blink',\n CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block',\n CURSOR_STYLE_OUTLINE_CLASS = 'xterm-cursor-outline',\n CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar',\n CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline'\n}\n\n\nexport class DomRendererRowFactory {\n private _workCell: CellData = new CellData();\n\n private _selectionStart: [number, number] | undefined;\n private _selectionEnd: [number, number] | undefined;\n private _columnSelectMode: boolean = false;\n\n public defaultSpacing = 0;\n\n constructor(\n private readonly _document: Document,\n @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @ICoreService private readonly _coreService: ICoreService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IThemeService private readonly _themeService: IThemeService\n ) {}\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionStart = start;\n this._selectionEnd = end;\n this._columnSelectMode = columnSelectMode;\n }\n\n public createRow(\n lineData: IBufferLine,\n row: number,\n isCursorRow: boolean,\n cursorStyle: string | undefined,\n cursorInactiveStyle: string | undefined,\n cursorX: number,\n cursorBlink: boolean,\n cellWidth: number,\n widthCache: WidthCache,\n linkStart: number,\n linkEnd: number\n ): HTMLSpanElement[] {\n\n const elements: HTMLSpanElement[] = [];\n const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);\n const colors = this._themeService.colors;\n\n let lineLength = lineData.getNoBgTrimmedLength();\n if (isCursorRow && lineLength < cursorX + 1) {\n lineLength = cursorX + 1;\n }\n\n let charElement: HTMLSpanElement | undefined;\n let cellAmount = 0;\n let text = '';\n let oldBg = 0;\n let oldFg = 0;\n let oldExt = 0;\n let oldLinkHover: number | boolean = false;\n let oldSpacing = 0;\n let oldIsInSelection: boolean = false;\n let spacing = 0;\n const classes: string[] = [];\n\n const hasHover = linkStart !== -1 && linkEnd !== -1;\n\n for (let x = 0; x < lineLength; x++) {\n lineData.loadCell(x, this._workCell);\n let width = this._workCell.getWidth();\n\n // The character to the left is a wide character, drawing is owned by the char at x-1\n if (width === 0) {\n continue;\n }\n\n // If true, indicates that the current character(s) to draw were joined.\n let isJoined = false;\n let lastCharX = x;\n\n // Process any joined character ranges as needed. Because of how the\n // ranges are produced, we know that they are valid for the characters\n // and attributes of our input.\n let cell = this._workCell;\n if (joinedRanges.length > 0 && x === joinedRanges[0][0]) {\n isJoined = true;\n const range = joinedRanges.shift()!;\n\n // We already know the exact start and end column of the joined range,\n // so we get the string and width representing it directly\n cell = new JoinedCellData(\n this._workCell,\n lineData.translateToString(true, range[0], range[1]),\n range[1] - range[0]\n );\n\n // Skip over the cells occupied by this range in the loop\n lastCharX = range[1] - 1;\n\n // Recalculate width\n width = cell.getWidth();\n }\n\n const isInSelection = this._isCellInSelection(x, row);\n const isCursorCell = isCursorRow && x === cursorX;\n const isLinkHover = hasHover && x >= linkStart && x <= linkEnd;\n\n let isDecorated = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n isDecorated = true;\n });\n\n // get chars to render for this cell\n let chars = cell.getChars() || WHITESPACE_CELL_CHAR;\n if (chars === ' ' && (cell.isUnderline() || cell.isOverline())) {\n chars = '\\xa0';\n }\n\n // lookup char render width and calc spacing\n spacing = width * cellWidth - widthCache.get(chars, cell.isBold(), cell.isItalic());\n\n if (!charElement) {\n charElement = this._document.createElement('span');\n } else {\n /**\n * chars can only be merged on existing span if:\n * - existing span only contains mergeable chars (cellAmount != 0)\n * - bg did not change (or both are in selection)\n * - fg did not change (or both are in selection and selection fg is set)\n * - ext did not change\n * - underline from hover state did not change\n * - cell content renders to same letter-spacing\n * - cell is not cursor\n */\n if (\n cellAmount\n && (\n (isInSelection && oldIsInSelection)\n || (!isInSelection && !oldIsInSelection && cell.bg === oldBg)\n )\n && (\n (isInSelection && oldIsInSelection && colors.selectionForeground)\n || cell.fg === oldFg\n )\n && cell.extended.ext === oldExt\n && isLinkHover === oldLinkHover\n && spacing === oldSpacing\n && !isCursorCell\n && !isJoined\n && !isDecorated\n ) {\n // no span alterations, thus only account chars skipping all code below\n if (cell.isInvisible()) {\n text += WHITESPACE_CELL_CHAR;\n } else {\n text += chars;\n }\n cellAmount++;\n continue;\n } else {\n /**\n * cannot merge:\n * - apply left-over text to old span\n * - create new span, reset state holders cellAmount & text\n */\n if (cellAmount) {\n charElement.textContent = text;\n }\n charElement = this._document.createElement('span');\n cellAmount = 0;\n text = '';\n }\n }\n // preserve conditions for next merger eval round\n oldBg = cell.bg;\n oldFg = cell.fg;\n oldExt = cell.extended.ext;\n oldLinkHover = isLinkHover;\n oldSpacing = spacing;\n oldIsInSelection = isInSelection;\n\n if (isJoined) {\n // The DOM renderer colors the background of the cursor but for ligatures all cells are\n // joined. The workaround here is to show a cursor around the whole ligature so it shows up,\n // the cursor looks the same when on any character of the ligature though\n if (cursorX >= x && cursorX <= lastCharX) {\n cursorX = x;\n }\n }\n\n if (!this._coreService.isCursorHidden && isCursorCell && this._coreService.isCursorInitialized) {\n classes.push(RowCss.CURSOR_CLASS);\n if (this._coreBrowserService.isFocused) {\n if (cursorBlink) {\n classes.push(RowCss.CURSOR_BLINK_CLASS);\n }\n classes.push(\n cursorStyle === 'bar'\n ? RowCss.CURSOR_STYLE_BAR_CLASS\n : cursorStyle === 'underline'\n ? RowCss.CURSOR_STYLE_UNDERLINE_CLASS\n : RowCss.CURSOR_STYLE_BLOCK_CLASS\n );\n } else {\n if (cursorInactiveStyle) {\n switch (cursorInactiveStyle) {\n case 'outline':\n classes.push(RowCss.CURSOR_STYLE_OUTLINE_CLASS);\n break;\n case 'block':\n classes.push(RowCss.CURSOR_STYLE_BLOCK_CLASS);\n break;\n case 'bar':\n classes.push(RowCss.CURSOR_STYLE_BAR_CLASS);\n break;\n case 'underline':\n classes.push(RowCss.CURSOR_STYLE_UNDERLINE_CLASS);\n break;\n default:\n break;\n }\n }\n }\n }\n\n if (cell.isBold()) {\n classes.push(RowCss.BOLD_CLASS);\n }\n\n if (cell.isItalic()) {\n classes.push(RowCss.ITALIC_CLASS);\n }\n\n if (cell.isDim()) {\n classes.push(RowCss.DIM_CLASS);\n }\n\n if (cell.isInvisible()) {\n text = WHITESPACE_CELL_CHAR;\n } else {\n text = cell.getChars() || WHITESPACE_CELL_CHAR;\n }\n\n if (cell.isUnderline()) {\n classes.push(`${RowCss.UNDERLINE_CLASS}-${cell.extended.underlineStyle}`);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n if (!cell.isUnderlineColorDefault()) {\n if (cell.isUnderlineColorRGB()) {\n charElement.style.textDecorationColor = `rgb(${AttributeData.toColorRGB(cell.getUnderlineColor()).join(',')})`;\n } else {\n let fg = cell.getUnderlineColor();\n if (this._optionsService.rawOptions.drawBoldTextInBrightColors && cell.isBold() && fg < 8) {\n fg += 8;\n }\n charElement.style.textDecorationColor = colors.ansi[fg].css;\n }\n }\n }\n\n if (cell.isOverline()) {\n classes.push(RowCss.OVERLINE_CLASS);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n }\n\n if (cell.isStrikethrough()) {\n classes.push(RowCss.STRIKETHROUGH_CLASS);\n }\n\n // apply link hover underline late, effectively overrides any previous text-decoration\n // settings\n if (isLinkHover) {\n charElement.style.textDecoration = 'underline';\n }\n\n let fg = cell.getFgColor();\n let fgColorMode = cell.getFgColorMode();\n let bg = cell.getBgColor();\n let bgColorMode = cell.getBgColorMode();\n const isInverse = !!cell.isInverse();\n if (isInverse) {\n const temp = fg;\n fg = bg;\n bg = temp;\n const temp2 = fgColorMode;\n fgColorMode = bgColorMode;\n bgColorMode = temp2;\n }\n\n // Apply any decoration foreground/background overrides, this must happen after inverse has\n // been applied\n let bgOverride: IColor | undefined;\n let fgOverride: IColor | undefined;\n let isTop = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n if (d.options.layer !== 'top' && isTop) {\n return;\n }\n if (d.backgroundColorRGB) {\n bgColorMode = Attributes.CM_RGB;\n bg = d.backgroundColorRGB.rgba >> 8 & 0xFFFFFF;\n bgOverride = d.backgroundColorRGB;\n }\n if (d.foregroundColorRGB) {\n fgColorMode = Attributes.CM_RGB;\n fg = d.foregroundColorRGB.rgba >> 8 & 0xFFFFFF;\n fgOverride = d.foregroundColorRGB;\n }\n isTop = d.options.layer === 'top';\n });\n\n // Apply selection\n if (!isTop && isInSelection) {\n // If in the selection, force the element to be above the selection to improve contrast and\n // support opaque selections. The applies background is not actually needed here as\n // selection is drawn in a seperate container, the main purpose of this to ensuring minimum\n // contrast ratio\n bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque;\n bg = bgOverride.rgba >> 8 & 0xFFFFFF;\n bgColorMode = Attributes.CM_RGB;\n // Since an opaque selection is being rendered, the selection pretends to be a decoration to\n // ensure text is drawn above the selection.\n isTop = true;\n // Apply selection foreground if applicable\n if (colors.selectionForeground) {\n fgColorMode = Attributes.CM_RGB;\n fg = colors.selectionForeground.rgba >> 8 & 0xFFFFFF;\n fgOverride = colors.selectionForeground;\n }\n }\n\n // If it's a top decoration, render above the selection\n if (isTop) {\n classes.push('xterm-decoration-top');\n }\n\n // Background\n let resolvedBg: IColor;\n switch (bgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n resolvedBg = colors.ansi[bg];\n classes.push(`xterm-bg-${bg}`);\n break;\n case Attributes.CM_RGB:\n resolvedBg = channels.toColor(bg >> 16, bg >> 8 & 0xFF, bg & 0xFF);\n this._addStyle(charElement, `background-color:#${padStart((bg >>> 0).toString(16), '0', 6)}`);\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (isInverse) {\n resolvedBg = colors.foreground;\n classes.push(`xterm-bg-${INVERTED_DEFAULT_COLOR}`);\n } else {\n resolvedBg = colors.background;\n }\n }\n\n // If there is no background override by now it's the original color, so apply dim if needed\n if (!bgOverride) {\n if (cell.isDim()) {\n bgOverride = color.multiplyOpacity(resolvedBg, 0.5);\n }\n }\n\n // Foreground\n switch (fgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) {\n fg += 8;\n }\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.ansi[fg], cell, bgOverride, undefined)) {\n classes.push(`xterm-fg-${fg}`);\n }\n break;\n case Attributes.CM_RGB:\n const color = channels.toColor(\n (fg >> 16) & 0xFF,\n (fg >> 8) & 0xFF,\n (fg ) & 0xFF\n );\n if (!this._applyMinimumContrast(charElement, resolvedBg, color, cell, bgOverride, fgOverride)) {\n this._addStyle(charElement, `color:#${padStart(fg.toString(16), '0', 6)}`);\n }\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.foreground, cell, bgOverride, fgOverride)) {\n if (isInverse) {\n classes.push(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);\n }\n }\n }\n\n // apply CSS classes\n // slightly faster than using classList by omitting\n // checks for doubled entries (code above should not have doublets)\n if (classes.length) {\n charElement.className = classes.join(' ');\n classes.length = 0;\n }\n\n // exclude conditions for cell merging - never merge these\n if (!isCursorCell && !isJoined && !isDecorated) {\n cellAmount++;\n } else {\n charElement.textContent = text;\n }\n // apply letter-spacing rule\n if (spacing !== this.defaultSpacing) {\n charElement.style.letterSpacing = `${spacing}px`;\n }\n\n elements.push(charElement);\n x = lastCharX;\n }\n\n // postfix text of last merged span\n if (charElement && cellAmount) {\n charElement.textContent = text;\n }\n\n return elements;\n }\n\n private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor, cell: ICellData, bgOverride: IColor | undefined, fgOverride: IColor | undefined): boolean {\n if (this._optionsService.rawOptions.minimumContrastRatio === 1 || treatGlyphAsBackgroundColor(cell.getCode())) {\n return false;\n }\n\n // Try get from cache first, only use the cache when there are no decoration overrides\n const cache = this._getContrastCache(cell);\n let adjustedColor: IColor | undefined | null = undefined;\n if (!bgOverride && !fgOverride) {\n adjustedColor = cache.getColor(bg.rgba, fg.rgba);\n }\n\n // Calculate and store in cache\n if (adjustedColor === undefined) {\n // Dim cells only require half the contrast, otherwise they wouldn't be distinguishable from\n // non-dim cells\n const ratio = this._optionsService.rawOptions.minimumContrastRatio / (cell.isDim() ? 2 : 1);\n adjustedColor = color.ensureContrastRatio(bgOverride || bg, fgOverride || fg, ratio);\n cache.setColor((bgOverride || bg).rgba, (fgOverride || fg).rgba, adjustedColor ?? null);\n }\n\n if (adjustedColor) {\n this._addStyle(element, `color:${adjustedColor.css}`);\n return true;\n }\n\n return false;\n }\n\n private _getContrastCache(cell: ICellData): IColorContrastCache {\n if (cell.isDim()) {\n return this._themeService.colors.halfContrastCache;\n }\n return this._themeService.colors.contrastCache;\n }\n\n private _addStyle(element: HTMLElement, style: string): void {\n element.setAttribute('style', `${element.getAttribute('style') || ''}${style};`);\n }\n\n private _isCellInSelection(x: number, y: number): boolean {\n const start = this._selectionStart;\n const end = this._selectionEnd;\n if (!start || !end) {\n return false;\n }\n if (this._columnSelectMode) {\n if (start[0] <= end[0]) {\n return x >= start[0] && y >= start[1] &&\n x < end[0] && y <= end[1];\n }\n return x < start[0] && y >= start[1] &&\n x >= end[0] && y <= end[1];\n }\n return (y > start[1] && y < end[1]) ||\n (start[1] === end[1] && y === start[1] && x >= start[0] && x < end[0]) ||\n (start[1] < end[1] && y === end[1] && x < end[0]) ||\n (start[1] < end[1] && y === start[1] && x >= start[0]);\n }\n}\n\nfunction padStart(text: string, padChar: string, length: number): string {\n while (text.length < length) {\n text = padChar + text;\n }\n return text;\n}\n", "/**\n * Copyright (c) 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { FontWeight } from 'common/services/Services';\n\n\nexport const enum WidthCacheSettings {\n /** sentinel for unset values in flat cache */\n FLAT_UNSET = -9999,\n /** size of flat cache, size-1 equals highest codepoint handled by flat */\n FLAT_SIZE = 256,\n /** char repeat for measuring */\n REPEAT = 32\n}\n\n\nconst enum FontVariant {\n REGULAR = 0,\n BOLD = 1,\n ITALIC = 2,\n BOLD_ITALIC = 3\n}\n\n\nexport class WidthCache implements IDisposable {\n // flat cache for regular variant up to CacheSettings.FLAT_SIZE\n // NOTE: ~4x faster access than holey (serving >>80% of terminal content)\n // It has a small memory footprint (only 1MB for full BMP caching),\n // still the sweet spot is not reached before touching 32k different codepoints,\n // thus we store the remaining <<20% of terminal data in a holey structure.\n protected _flat = new Float32Array(WidthCacheSettings.FLAT_SIZE);\n\n // holey cache for bold, italic and bold&italic for any string\n // FIXME: can grow really big over time (~8.5 MB for full BMP caching),\n // so a shared API across terminals is needed\n protected _holey: Map | undefined;\n\n private _font = '';\n private _fontSize = 0;\n private _weight: FontWeight = 'normal';\n private _weightBold: FontWeight = 'bold';\n private _container: HTMLDivElement;\n private _measureElements: HTMLSpanElement[] = [];\n\n constructor(_document: Document, _helperContainer: HTMLElement) {\n this._container = _document.createElement('div');\n this._container.classList.add('xterm-width-cache-measure-container');\n this._container.setAttribute('aria-hidden', 'true');\n // SP should stack in spans\n this._container.style.whiteSpace = 'pre';\n // avoid undercuts in non-monospace fonts from kerning\n this._container.style.fontKerning = 'none';\n\n const regular = _document.createElement('span');\n regular.classList.add('xterm-char-measure-element');\n\n const bold = _document.createElement('span');\n bold.classList.add('xterm-char-measure-element');\n bold.style.fontWeight = 'bold';\n\n const italic = _document.createElement('span');\n italic.classList.add('xterm-char-measure-element');\n italic.style.fontStyle = 'italic';\n\n const boldItalic = _document.createElement('span');\n boldItalic.classList.add('xterm-char-measure-element');\n boldItalic.style.fontWeight = 'bold';\n boldItalic.style.fontStyle = 'italic';\n\n // NOTE: must be in order of FontVariant\n this._measureElements = [regular, bold, italic, boldItalic];\n this._container.appendChild(regular);\n this._container.appendChild(bold);\n this._container.appendChild(italic);\n this._container.appendChild(boldItalic);\n\n _helperContainer.appendChild(this._container);\n\n this.clear();\n }\n\n public dispose(): void {\n this._container.remove(); // remove elements from DOM\n this._measureElements.length = 0; // release element refs\n this._holey = undefined; // free cache memory via GC\n }\n\n /**\n * Clear the width cache.\n */\n public clear(): void {\n this._flat.fill(WidthCacheSettings.FLAT_UNSET);\n // .clear() has some overhead, re-assign instead (>3 times faster)\n this._holey = new Map();\n }\n\n /**\n * Set the font for measuring.\n * Must be called for any changes on font settings.\n * Also clears the cache.\n */\n public setFont(font: string, fontSize: number, weight: FontWeight, weightBold: FontWeight): void {\n // skip if nothing changed\n if (font === this._font\n && fontSize === this._fontSize\n && weight === this._weight\n && weightBold === this._weightBold\n ) {\n return;\n }\n\n this._font = font;\n this._fontSize = fontSize;\n this._weight = weight;\n this._weightBold = weightBold;\n\n this._container.style.fontFamily = this._font;\n this._container.style.fontSize = `${this._fontSize}px`;\n this._measureElements[FontVariant.REGULAR].style.fontWeight = `${weight}`;\n this._measureElements[FontVariant.BOLD].style.fontWeight = `${weightBold}`;\n this._measureElements[FontVariant.ITALIC].style.fontWeight = `${weight}`;\n this._measureElements[FontVariant.BOLD_ITALIC].style.fontWeight = `${weightBold}`;\n\n this.clear();\n }\n\n /**\n * Get the render width for cell content `c` with current font settings.\n * `variant` denotes the font variant to be used.\n */\n public get(c: string, bold: boolean | number, italic: boolean | number): number {\n let cp = 0;\n if (!bold && !italic && c.length === 1 && (cp = c.charCodeAt(0)) < WidthCacheSettings.FLAT_SIZE) {\n if (this._flat[cp] !== WidthCacheSettings.FLAT_UNSET) {\n return this._flat[cp];\n }\n const width = this._measure(c, 0);\n if (width > 0) {\n this._flat[cp] = width;\n }\n return width;\n }\n let key = c;\n if (bold) key += 'B';\n if (italic) key += 'I';\n let width = this._holey!.get(key);\n if (width === undefined) {\n let variant = 0;\n if (bold) variant |= FontVariant.BOLD;\n if (italic) variant |= FontVariant.ITALIC;\n width = this._measure(c, variant);\n if (width > 0) {\n this._holey!.set(key, width);\n }\n }\n return width;\n }\n\n protected _measure(c: string, variant: FontVariant): number {\n const el = this._measureElements[variant];\n el.textContent = c.repeat(WidthCacheSettings.REPEAT);\n return el.offsetWidth / WidthCacheSettings.REPEAT;\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminal } from 'browser/Types';\nimport { ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { Terminal } from '@xterm/xterm';\n\nclass SelectionRenderModel implements ISelectionRenderModel {\n public hasSelection!: boolean;\n public columnSelectMode!: boolean;\n public viewportStartRow!: number;\n public viewportEndRow!: number;\n public viewportCappedStartRow!: number;\n public viewportCappedEndRow!: number;\n public startCol!: number;\n public endCol!: number;\n public selectionStart: [number, number] | undefined;\n public selectionEnd: [number, number] | undefined;\n\n constructor() {\n this.clear();\n }\n\n public clear(): void {\n this.hasSelection = false;\n this.columnSelectMode = false;\n this.viewportStartRow = 0;\n this.viewportEndRow = 0;\n this.viewportCappedStartRow = 0;\n this.viewportCappedEndRow = 0;\n this.startCol = 0;\n this.endCol = 0;\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n }\n\n public update(terminal: ITerminal, start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean = false): void {\n this.selectionStart = start;\n this.selectionEnd = end;\n // Selection does not exist\n if (!start || !end || (start[0] === end[0] && start[1] === end[1])) {\n this.clear();\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportY = terminal.buffers.active.ydisp;\n const viewportStartRow = start[1] - viewportY;\n const viewportEndRow = end[1] - viewportY;\n const viewportCappedStartRow = Math.max(viewportStartRow, 0);\n const viewportCappedEndRow = Math.min(viewportEndRow, terminal.rows - 1);\n\n // No need to draw the selection\n if (viewportCappedStartRow >= terminal.rows || viewportCappedEndRow < 0) {\n this.clear();\n return;\n }\n\n this.hasSelection = true;\n this.columnSelectMode = columnSelectMode;\n this.viewportStartRow = viewportStartRow;\n this.viewportEndRow = viewportEndRow;\n this.viewportCappedStartRow = viewportCappedStartRow;\n this.viewportCappedEndRow = viewportCappedEndRow;\n this.startCol = start[0];\n this.endCol = end[0];\n }\n\n public isCellSelected(terminal: Terminal, x: number, y: number): boolean {\n if (!this.hasSelection) {\n return false;\n }\n y -= terminal.buffer.active.viewportY;\n if (this.columnSelectMode) {\n if (this.startCol <= this.endCol) {\n return x >= this.startCol && y >= this.viewportCappedStartRow &&\n x < this.endCol && y <= this.viewportCappedEndRow;\n }\n return x < this.startCol && y >= this.viewportCappedStartRow &&\n x >= this.endCol && y <= this.viewportCappedEndRow;\n }\n return (y > this.viewportStartRow && y < this.viewportEndRow) ||\n (this.viewportStartRow === this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportEndRow && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol);\n }\n}\n\nexport function createSelectionRenderModel(): ISelectionRenderModel {\n return new SelectionRenderModel();\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { DomRendererRowFactory, RowCss } from 'browser/renderer/dom/DomRendererRowFactory';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';\nimport { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';\nimport { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';\nimport { color } from 'common/Color';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\n\nconst TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';\nconst ROW_CONTAINER_CLASS = 'xterm-rows';\nconst FG_CLASS_PREFIX = 'xterm-fg-';\nconst BG_CLASS_PREFIX = 'xterm-bg-';\nconst FOCUS_CLASS = 'xterm-focus';\nconst SELECTION_CLASS = 'xterm-selection';\n\nlet nextTerminalId = 1;\n\n/**\n * The standard renderer and fallback for when the webgl addon is slow. This is not meant to be\n * particularly fast and will even lack some features such as custom glyphs, hoever this is more\n * reliable as webgl may not work on some machines.\n */\nexport class DomRenderer extends Disposable implements IRenderer {\n private _rowFactory: DomRendererRowFactory;\n private _terminalClass: number = nextTerminalId++;\n\n private _themeStyleElement!: HTMLStyleElement;\n private _dimensionsStyleElement!: HTMLStyleElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[] = [];\n private _selectionContainer: HTMLElement;\n private _widthCache: WidthCache;\n private _selectionRenderModel: ISelectionRenderModel = createSelectionRenderModel();\n\n public dimensions: IRenderDimensions;\n\n public readonly onRequestRedraw = this._register(new Emitter()).event;\n\n constructor(\n private readonly _terminal: ITerminal,\n private readonly _document: Document,\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _viewportElement: HTMLElement,\n private readonly _helperContainer: HTMLElement,\n private readonly _linkifier2: ILinkifier2,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService private readonly _themeService: IThemeService\n ) {\n super();\n this._rowContainer = this._document.createElement('div');\n this._rowContainer.classList.add(ROW_CONTAINER_CLASS);\n this._rowContainer.style.lineHeight = 'normal';\n this._rowContainer.setAttribute('aria-hidden', 'true');\n this._refreshRowElements(this._bufferService.cols, this._bufferService.rows);\n this._selectionContainer = this._document.createElement('div');\n this._selectionContainer.classList.add(SELECTION_CLASS);\n this._selectionContainer.setAttribute('aria-hidden', 'true');\n\n this.dimensions = createRenderDimensions();\n this._updateDimensions();\n this._register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));\n\n this._register(this._themeService.onChangeColors(e => this._injectCss(e)));\n this._injectCss(this._themeService.colors);\n\n this._rowFactory = instantiationService.createInstance(DomRendererRowFactory, document);\n\n this._element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);\n this._screenElement.appendChild(this._rowContainer);\n this._screenElement.appendChild(this._selectionContainer);\n\n this._register(this._linkifier2.onShowLinkUnderline(e => this._handleLinkHover(e)));\n this._register(this._linkifier2.onHideLinkUnderline(e => this._handleLinkLeave(e)));\n\n this._register(toDisposable(() => {\n this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);\n\n // Outside influences such as React unmounts may manipulate the DOM before our disposal.\n // https://github.com/xtermjs/xterm.js/issues/2960\n this._rowContainer.remove();\n this._selectionContainer.remove();\n this._widthCache.dispose();\n this._themeStyleElement.remove();\n this._dimensionsStyleElement.remove();\n }));\n\n this._widthCache = new WidthCache(this._document, this._helperContainer);\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n private _updateDimensions(): void {\n const dpr = this._coreBrowserService.dpr;\n this.dimensions.device.char.width = this._charSizeService.width * dpr;\n this.dimensions.device.char.height = Math.ceil(this._charSizeService.height * dpr);\n this.dimensions.device.cell.width = this.dimensions.device.char.width + Math.round(this._optionsService.rawOptions.letterSpacing);\n this.dimensions.device.cell.height = Math.floor(this.dimensions.device.char.height * this._optionsService.rawOptions.lineHeight);\n this.dimensions.device.char.left = 0;\n this.dimensions.device.char.top = 0;\n this.dimensions.device.canvas.width = this.dimensions.device.cell.width * this._bufferService.cols;\n this.dimensions.device.canvas.height = this.dimensions.device.cell.height * this._bufferService.rows;\n this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / dpr);\n this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / dpr);\n this.dimensions.css.cell.width = this.dimensions.css.canvas.width / this._bufferService.cols;\n this.dimensions.css.cell.height = this.dimensions.css.canvas.height / this._bufferService.rows;\n\n for (const element of this._rowElements) {\n element.style.width = `${this.dimensions.css.canvas.width}px`;\n element.style.height = `${this.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this.dimensions.css.cell.height}px`;\n // Make sure rows don't overflow onto following row\n element.style.overflow = 'hidden';\n }\n\n if (!this._dimensionsStyleElement) {\n this._dimensionsStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._dimensionsStyleElement);\n }\n\n const styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} span {` +\n ` display: inline-block;` + // TODO: find workaround for inline-block (creates ~20% render penalty)\n ` height: 100%;` +\n ` vertical-align: top;` +\n `}`;\n\n this._dimensionsStyleElement.textContent = styles;\n\n this._selectionContainer.style.height = this._viewportElement.style.height;\n this._screenElement.style.width = `${this.dimensions.css.canvas.width}px`;\n this._screenElement.style.height = `${this.dimensions.css.canvas.height}px`;\n }\n\n private _injectCss(colors: ReadonlyColorSet): void {\n if (!this._themeStyleElement) {\n this._themeStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._themeStyleElement);\n }\n\n // Base CSS\n let styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +\n ` color: ${colors.foreground.css};` +\n ` font-family: ${this._optionsService.rawOptions.fontFamily};` +\n ` font-size: ${this._optionsService.rawOptions.fontSize}px;` +\n ` font-kerning: none;` +\n ` white-space: pre` +\n `}`;\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .xterm-dim {` +\n ` color: ${color.multiplyOpacity(colors.foreground, 0.5).css};` +\n `}`;\n // Text styles\n styles +=\n `${this._terminalSelector} span:not(.${RowCss.BOLD_CLASS}) {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeight};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.BOLD_CLASS} {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeightBold};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.ITALIC_CLASS} {` +\n ` font-style: italic;` +\n `}`;\n // Blink animation\n const blinkAnimationUnderlineId = `blink_underline_${this._terminalClass}`;\n const blinkAnimationBarId = `blink_bar_${this._terminalClass}`;\n const blinkAnimationBlockId = `blink_block_${this._terminalClass}`;\n styles +=\n `@keyframes ${blinkAnimationUnderlineId} {` +\n ` 50% {` +\n ` border-bottom-style: hidden;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBarId} {` +\n ` 50% {` +\n ` box-shadow: none;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBlockId} {` +\n ` 0% {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n ` }` +\n ` 50% {` +\n ` background-color: inherit;` +\n ` color: ${colors.cursor.css};` +\n ` }` +\n `}`;\n // Cursor\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` animation: ${blinkAnimationUnderlineId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` animation: ${blinkAnimationBarId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` animation: ${blinkAnimationBlockId} 1s step-end infinite;` +\n `}` +\n // !important helps fix an issue where the cursor will not render on top of the selection,\n // however it's very hard to fix this issue and retain the blink animation without the use of\n // !important. So this edge case fails when cursor blink is on.\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS}:not(.${RowCss.CURSOR_BLINK_CLASS}) {` +\n ` background-color: ${colors.cursor.css} !important;` +\n ` color: ${colors.cursorAccent.css} !important;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_OUTLINE_CLASS} {` +\n ` outline: 1px solid ${colors.cursor.css};` +\n ` outline-offset: -1px;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${colors.cursor.css} inset;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` border-bottom: 1px ${colors.cursor.css};` +\n ` border-bottom-style: solid;` +\n ` height: calc(100% - 1px);` +\n `}`;\n // Selection\n styles +=\n `${this._terminalSelector} .${SELECTION_CLASS} {` +\n ` position: absolute;` +\n ` top: 0;` +\n ` left: 0;` +\n ` z-index: 1;` +\n ` pointer-events: none;` +\n `}` +\n `${this._terminalSelector}.focus .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionBackgroundOpaque.css};` +\n `}` +\n `${this._terminalSelector} .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionInactiveBackgroundOpaque.css};` +\n `}`;\n // Colors\n for (const [i, c] of colors.ansi.entries()) {\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i} { color: ${c.css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(c, 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${i} { background-color: ${c.css}; }`;\n }\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { color: ${color.opaque(colors.background).css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(color.opaque(colors.background), 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { background-color: ${colors.foreground.css}; }`;\n\n this._themeStyleElement.textContent = styles;\n }\n\n /**\n * default letter spacing\n * Due to rounding issues in dimensions dpr calc glyph might render\n * slightly too wide or too narrow. The method corrects the stacking offsets\n * by applying a default letter-spacing for all chars.\n * The value gets passed to the row factory to avoid setting this value again\n * (render speedup is roughly 10%).\n */\n private _setDefaultSpacing(): void {\n // measure same char as in CharSizeService to get the base deviation\n const spacing = this.dimensions.css.cell.width - this._widthCache.get('W', false, false);\n this._rowContainer.style.letterSpacing = `${spacing}px`;\n this._rowFactory.defaultSpacing = spacing;\n }\n\n public handleDevicePixelRatioChange(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n private _refreshRowElements(cols: number, rows: number): void {\n // Add missing elements\n for (let i = this._rowElements.length; i <= rows; i++) {\n const row = this._document.createElement('div');\n this._rowContainer.appendChild(row);\n this._rowElements.push(row);\n }\n // Remove excess elements\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n }\n\n public handleResize(cols: number, rows: number): void {\n this._refreshRowElements(cols, rows);\n this._updateDimensions();\n this.handleSelectionChanged(this._selectionRenderModel.selectionStart, this._selectionRenderModel.selectionEnd, this._selectionRenderModel.columnSelectMode);\n }\n\n public handleCharSizeChanged(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n public handleBlur(): void {\n this._rowContainer.classList.remove(FOCUS_CLASS);\n this.renderRows(0, this._bufferService.rows - 1);\n }\n\n public handleFocus(): void {\n this._rowContainer.classList.add(FOCUS_CLASS);\n this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y);\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n // Remove all selections\n this._selectionContainer.replaceChildren();\n this._rowFactory.handleSelectionChanged(start, end, columnSelectMode);\n this.renderRows(0, this._bufferService.rows - 1);\n\n // Selection does not exist\n if (!start || !end) {\n return;\n }\n\n this._selectionRenderModel.update(this._terminal, start, end, columnSelectMode);\n if (!this._selectionRenderModel.hasSelection) {\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportStartRow = this._selectionRenderModel.viewportStartRow;\n const viewportEndRow = this._selectionRenderModel.viewportEndRow;\n const viewportCappedStartRow = this._selectionRenderModel.viewportCappedStartRow;\n const viewportCappedEndRow = this._selectionRenderModel.viewportCappedEndRow;\n\n // Create the selections\n const documentFragment = this._document.createDocumentFragment();\n\n if (columnSelectMode) {\n const isXFlipped = start[0] > end[0];\n documentFragment.appendChild(\n this._createSelectionElement(viewportCappedStartRow, isXFlipped ? end[0] : start[0], isXFlipped ? start[0] : end[0], viewportCappedEndRow - viewportCappedStartRow + 1)\n );\n } else {\n // Draw first row\n const startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n const endCol = viewportCappedStartRow === viewportEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n // Draw middle rows\n const middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount));\n // Draw final row\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n // Only draw viewportEndRow if it's not the same as viewporttartRow\n const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol));\n }\n }\n this._selectionContainer.appendChild(documentFragment);\n }\n\n /**\n * Creates a selection element at the specified position.\n * @param row The row of the selection.\n * @param colStart The start column.\n * @param colEnd The end columns.\n */\n private _createSelectionElement(row: number, colStart: number, colEnd: number, rowCount: number = 1): HTMLElement {\n const element = this._document.createElement('div');\n const left = colStart * this.dimensions.css.cell.width;\n let width = this.dimensions.css.cell.width * (colEnd - colStart);\n if (left + width > this.dimensions.css.canvas.width) {\n width = this.dimensions.css.canvas.width - left;\n }\n\n element.style.height = `${rowCount * this.dimensions.css.cell.height}px`;\n element.style.top = `${row * this.dimensions.css.cell.height}px`;\n element.style.left = `${left}px`;\n element.style.width = `${width}px`;\n return element;\n }\n\n public handleCursorMove(): void {\n // No-op, the cursor is drawn when rows are drawn\n }\n\n private _handleOptionsChanged(): void {\n // Force a refresh\n this._updateDimensions();\n // Refresh CSS\n this._injectCss(this._themeService.colors);\n // update spacing cache\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n public clear(): void {\n for (const e of this._rowElements) {\n /**\n * NOTE: This used to be `e.innerText = '';` but that doesn't work when using `jsdom` and\n * `@testing-library/react`\n *\n * references:\n * - https://github.com/testing-library/react-testing-library/issues/1146\n * - https://github.com/jsdom/jsdom/issues/1245\n */\n e.replaceChildren();\n }\n }\n\n public renderRows(start: number, end: number): void {\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, this._bufferService.cols - 1);\n const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n for (let y = start; y <= end; y++) {\n const row = y + buffer.ydisp;\n const rowElement = this._rowElements[y];\n const lineData = buffer.lines.get(row);\n if (!rowElement || !lineData) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n lineData,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n -1,\n -1\n )\n );\n }\n }\n\n private get _terminalSelector(): string {\n return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`;\n }\n\n private _handleLinkHover(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true);\n }\n\n private _handleLinkLeave(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, false);\n }\n\n private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {\n /**\n * NOTE: The linkifier may send out of viewport y-values if:\n * - negative y-value: the link started at a higher line\n * - y-value >= maxY: the link ends at a line below viewport\n *\n * For negative y-values we can simply adjust x = 0,\n * as higher up link start means, that everything from\n * (0,0) is a link under top-down-left-right char progression\n *\n * Additionally there might be a small chance of out-of-sync x|y-values\n * from a race condition of render updates vs. link event handler execution:\n * - (sync) resize: chances terminal buffer in sync, schedules render update async\n * - (async) link handler race condition: new buffer metrics, but still on old render state\n * - (async) render update: brings term metrics and render state back in sync\n */\n // clip coords into viewport\n if (y < 0) x = 0;\n if (y2 < 0) x2 = 0;\n const maxY = this._bufferService.rows - 1;\n y = Math.max(Math.min(y, maxY), 0);\n y2 = Math.max(Math.min(y2, maxY), 0);\n\n cols = Math.min(cols, this._bufferService.cols);\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, cols - 1);\n const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n // refresh rows within link range\n for (let i = y; i <= y2; ++i) {\n const row = i + buffer.ydisp;\n const rowElement = this._rowElements[i];\n const bufferline = buffer.lines.get(row);\n if (!rowElement || !bufferline) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n bufferline,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n enabled ? (i === y ? x : 0) : -1,\n enabled ? ((i === y2 ? x2 : cols) - 1) : -1\n )\n );\n }\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService } from 'common/services/Services';\nimport { ICharSizeService } from 'browser/services/Services';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\nexport class CharSizeService extends Disposable implements ICharSizeService {\n public serviceBrand: undefined;\n\n public width: number = 0;\n public height: number = 0;\n private _measureStrategy: IMeasureStrategy;\n\n public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }\n\n private readonly _onCharSizeChange = this._register(new Emitter());\n public readonly onCharSizeChange = this._onCharSizeChange.event;\n\n constructor(\n document: Document,\n parentElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n try {\n this._measureStrategy = this._register(new TextMetricsMeasureStrategy(this._optionsService));\n } catch {\n this._measureStrategy = this._register(new DomMeasureStrategy(document, parentElement, this._optionsService));\n }\n this._register(this._optionsService.onMultipleOptionChange(['fontFamily', 'fontSize'], () => this.measure()));\n }\n\n public measure(): void {\n const result = this._measureStrategy.measure();\n if (result.width !== this.width || result.height !== this.height) {\n this.width = result.width;\n this.height = result.height;\n this._onCharSizeChange.fire();\n }\n }\n}\n\ninterface IMeasureStrategy {\n measure(): Readonly;\n}\n\ninterface IMeasureResult {\n width: number;\n height: number;\n}\n\nconst enum DomMeasureStrategyConstants {\n REPEAT = 32\n}\n\nabstract class BaseMeasureStategy extends Disposable implements IMeasureStrategy {\n protected _result: IMeasureResult = { width: 0, height: 0 };\n\n protected _validateAndSet(width: number | undefined, height: number | undefined): void {\n // If values are 0 then the element is likely currently display:none, in which case we should\n // retain the previous value.\n if (width !== undefined && width > 0 && height !== undefined && height > 0) {\n this._result.width = width;\n this._result.height = height;\n }\n }\n\n public abstract measure(): Readonly;\n}\n\nclass DomMeasureStrategy extends BaseMeasureStategy {\n private _measureElement: HTMLElement;\n\n constructor(\n private _document: Document,\n private _parentElement: HTMLElement,\n private _optionsService: IOptionsService\n ) {\n super();\n this._measureElement = this._document.createElement('span');\n this._measureElement.classList.add('xterm-char-measure-element');\n this._measureElement.textContent = 'W'.repeat(DomMeasureStrategyConstants.REPEAT);\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._measureElement.style.whiteSpace = 'pre';\n this._measureElement.style.fontKerning = 'none';\n this._parentElement.appendChild(this._measureElement);\n }\n\n public measure(): Readonly {\n this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;\n\n // Note that this triggers a synchronous layout\n this._validateAndSet(Number(this._measureElement.offsetWidth) / DomMeasureStrategyConstants.REPEAT, Number(this._measureElement.offsetHeight));\n\n return this._result;\n }\n}\n\nclass TextMetricsMeasureStrategy extends BaseMeasureStategy {\n private _canvas: OffscreenCanvas;\n private _ctx: OffscreenCanvasRenderingContext2D;\n\n constructor(\n private _optionsService: IOptionsService\n ) {\n super();\n // This will throw if any required API is not supported\n this._canvas = new OffscreenCanvas(100, 100);\n this._ctx = this._canvas.getContext('2d')!;\n const a = this._ctx.measureText('W');\n if (!('width' in a && 'fontBoundingBoxAscent' in a && 'fontBoundingBoxDescent' in a)) {\n throw new Error('Required font metrics not supported');\n }\n }\n\n public measure(): Readonly {\n this._ctx.font = `${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;\n const metrics = this._ctx.measureText('W');\n this._validateAndSet(metrics.width, metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent);\n return this._result;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService } from './Services';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\nexport class CoreBrowserService extends Disposable implements ICoreBrowserService {\n public serviceBrand: undefined;\n\n private _isFocused = false;\n private _cachedIsFocused: boolean | undefined = undefined;\n private _screenDprMonitor = this._register(new ScreenDprMonitor(this._window));\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n private readonly _onWindowChange = this._register(new Emitter());\n public readonly onWindowChange = this._onWindowChange.event;\n\n constructor(\n private _textarea: HTMLTextAreaElement,\n private _window: Window & typeof globalThis,\n public readonly mainDocument: Document\n ) {\n super();\n\n // Monitor device pixel ratio\n this._register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));\n this._register(Event.forward(this._screenDprMonitor.onDprChange, this._onDprChange));\n\n this._register(addDisposableListener(this._textarea, 'focus', () => this._isFocused = true));\n this._register(addDisposableListener(this._textarea, 'blur', () => this._isFocused = false));\n }\n\n public get window(): Window & typeof globalThis {\n return this._window;\n }\n\n public set window(value: Window & typeof globalThis) {\n if (this._window !== value) {\n this._window = value;\n this._onWindowChange.fire(this._window);\n }\n }\n\n public get dpr(): number {\n return this.window.devicePixelRatio;\n }\n\n public get isFocused(): boolean {\n if (this._cachedIsFocused === undefined) {\n this._cachedIsFocused = this._isFocused && this._textarea.ownerDocument.hasFocus();\n queueMicrotask(() => this._cachedIsFocused = undefined);\n }\n return this._cachedIsFocused;\n }\n}\n\n\n/**\n * The screen device pixel ratio monitor allows listening for when the\n * window.devicePixelRatio value changes. This is done not with polling but with\n * the use of window.matchMedia to watch media queries. When the event fires,\n * the listener will be reattached using a different media query to ensure that\n * any further changes will _register.\n *\n * The listener should fire on both window zoom changes and switching to a\n * monitor with a different DPI.\n */\nclass ScreenDprMonitor extends Disposable {\n private _currentDevicePixelRatio: number;\n private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined;\n private _resolutionMediaMatchList: MediaQueryList | undefined;\n private _windowResizeListener = this._register(new MutableDisposable());\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n\n constructor(private _parentWindow: Window) {\n super();\n\n // Initialize listener and dpr value\n this._outerListener = () => this._setDprAndFireIfDiffers();\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._updateDpr();\n\n // Monitor active window resize\n this._setWindowResizeListener();\n\n // Setup additional disposables\n this._register(toDisposable(() => this.clearListener()));\n }\n\n\n public setWindow(parentWindow: Window): void {\n this._parentWindow = parentWindow;\n this._setWindowResizeListener();\n this._setDprAndFireIfDiffers();\n }\n\n private _setWindowResizeListener(): void {\n this._windowResizeListener.value = addDisposableListener(this._parentWindow, 'resize', () => this._setDprAndFireIfDiffers());\n }\n\n private _setDprAndFireIfDiffers(): void {\n if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) {\n this._onDprChange.fire(this._parentWindow.devicePixelRatio);\n }\n this._updateDpr();\n }\n\n private _updateDpr(): void {\n if (!this._outerListener) {\n return;\n }\n\n // Clear listeners for old DPR\n this._resolutionMediaMatchList?.removeListener(this._outerListener);\n\n // Add listeners for new DPR\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`);\n this._resolutionMediaMatchList.addListener(this._outerListener);\n }\n\n public clearListener(): void {\n if (!this._resolutionMediaMatchList || !this._outerListener) {\n return;\n }\n this._resolutionMediaMatchList.removeListener(this._outerListener);\n this._resolutionMediaMatchList = undefined;\n this._outerListener = undefined;\n }\n}\n", "import { ILinkProvider, ILinkProviderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDisposable } from 'common/Types';\n\nexport class LinkProviderService extends Disposable implements ILinkProviderService {\n declare public serviceBrand: undefined;\n\n public readonly linkProviders: ILinkProvider[] = [];\n\n constructor() {\n super();\n this._register(toDisposable(() => this.linkProviders.length = 0));\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n this.linkProviders.push(linkProvider);\n return {\n dispose: () => {\n // Remove the link provider from the list\n const providerIndex = this.linkProviders.indexOf(linkProvider);\n\n if (providerIndex !== -1) {\n this.linkProviders.splice(providerIndex, 1);\n }\n }\n };\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function getCoordsRelativeToElement(window: Pick, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {\n const rect = element.getBoundingClientRect();\n const elementStyle = window.getComputedStyle(element);\n const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'));\n const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'));\n return [\n event.clientX - rect.left - leftPadding,\n event.clientY - rect.top - topPadding\n ];\n}\n\n/**\n * Gets coordinates within the terminal for a particular mouse event. The result\n * is returned as an array in the form [x, y] instead of an object as it's a\n * little faster and this function is used in some low level code.\n * @param window The window object the element belongs to.\n * @param event The mouse event.\n * @param element The terminal's container element.\n * @param colCount The number of columns in the terminal.\n * @param rowCount The number of rows n the terminal.\n * @param hasValidCharSize Whether there is a valid character size available.\n * @param cssCellWidth The cell width device pixel render dimensions.\n * @param cssCellHeight The cell height device pixel render dimensions.\n * @param isSelection Whether the request is for the selection or not. This will\n * apply an offset to the x value such that the left half of the cell will\n * select that cell and the right half will select the next cell.\n */\nexport function getCoords(window: Pick, event: Pick, element: HTMLElement, colCount: number, rowCount: number, hasValidCharSize: boolean, cssCellWidth: number, cssCellHeight: number, isSelection?: boolean): [number, number] | undefined {\n // Coordinates cannot be measured if there are no valid\n if (!hasValidCharSize) {\n return undefined;\n }\n\n const coords = getCoordsRelativeToElement(window, event, element);\n if (!coords) {\n return undefined;\n }\n\n coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);\n coords[1] = Math.ceil(coords[1] / cssCellHeight);\n\n // Ensure coordinates are within the terminal viewport. Note that selections\n // need an addition point of precision to cover the end point (as characters\n // cover half of one char and half of the next).\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0));\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount);\n\n return coords;\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharSizeService, IRenderService, IMouseService } from './Services';\nimport { getCoords, getCoordsRelativeToElement } from 'browser/input/Mouse';\n\nexport class MouseService implements IMouseService {\n public serviceBrand: undefined;\n\n constructor(\n @IRenderService private readonly _renderService: IRenderService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService\n ) {\n }\n\n public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {\n return getCoords(\n window,\n event,\n element,\n colCount,\n rowCount,\n this._charSizeService.hasValidSize,\n this._renderService.dimensions.css.cell.width,\n this._renderService.dimensions.css.cell.height,\n isSelection\n );\n }\n\n public getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined {\n const coords = getCoordsRelativeToElement(window, event, element);\n if (!this._charSizeService.hasValidSize) {\n return undefined;\n }\n coords[0] = Math.min(Math.max(coords[0], 0), this._renderService.dimensions.css.canvas.width - 1);\n coords[1] = Math.min(Math.max(coords[1], 0), this._renderService.dimensions.css.canvas.height - 1);\n return {\n col: Math.floor(coords[0] / this._renderService.dimensions.css.cell.width),\n row: Math.floor(coords[1] / this._renderService.dimensions.css.cell.height),\n x: Math.floor(coords[0]),\n y: Math.floor(coords[1])\n };\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { ICoreBrowserService } from 'browser/services/Services';\n\n/**\n * Debounces calls to render terminal rows using animation frames.\n */\nexport class RenderDebouncer implements IRenderDebouncerWithCallback {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n private _animationFrame: number | undefined;\n private _refreshCallbacks: FrameRequestCallback[] = [];\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _coreBrowserService: ICoreBrowserService\n ) {\n }\n\n public dispose(): void {\n if (this._animationFrame) {\n this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n this._refreshCallbacks.push(callback);\n if (!this._animationFrame) {\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n return this._animationFrame;\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart !== undefined ? rowStart : 0;\n rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n if (this._animationFrame) {\n return;\n }\n\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n\n private _innerRefresh(): void {\n this._animationFrame = undefined;\n\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n this._runRefreshCallbacks();\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n this._runRefreshCallbacks();\n }\n\n private _runRefreshCallbacks(): void {\n for (const callback of this._refreshCallbacks) {\n callback(0);\n }\n this._refreshCallbacks = [];\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isNode } from 'common/Platform';\n\ninterface ITaskQueue {\n /**\n * Adds a task to the queue which will run in a future idle callback.\n * To avoid perceivable stalls on the mainthread, tasks with heavy workload\n * should split their work into smaller pieces and return `true` to get\n * called again until the work is done (on falsy return value).\n */\n enqueue(task: () => boolean | void): void;\n\n /**\n * Flushes the queue, running all remaining tasks synchronously.\n */\n flush(): void;\n\n /**\n * Clears any remaining tasks from the queue, these will not be run.\n */\n clear(): void;\n}\n\ninterface ITaskDeadline {\n timeRemaining(): number;\n}\ntype CallbackWithDeadline = (deadline: ITaskDeadline) => void;\n\nabstract class TaskQueue implements ITaskQueue {\n private _tasks: (() => boolean | void)[] = [];\n private _idleCallback?: number;\n private _i = 0;\n\n protected abstract _requestCallback(callback: CallbackWithDeadline): number;\n protected abstract _cancelCallback(identifier: number): void;\n\n public enqueue(task: () => boolean | void): void {\n this._tasks.push(task);\n this._start();\n }\n\n public flush(): void {\n while (this._i < this._tasks.length) {\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n }\n this.clear();\n }\n\n public clear(): void {\n if (this._idleCallback) {\n this._cancelCallback(this._idleCallback);\n this._idleCallback = undefined;\n }\n this._i = 0;\n this._tasks.length = 0;\n }\n\n private _start(): void {\n if (!this._idleCallback) {\n this._idleCallback = this._requestCallback(this._process.bind(this));\n }\n }\n\n private _process(deadline: ITaskDeadline): void {\n this._idleCallback = undefined;\n let taskDuration = 0;\n let longestTask = 0;\n let lastDeadlineRemaining = deadline.timeRemaining();\n let deadlineRemaining = 0;\n while (this._i < this._tasks.length) {\n taskDuration = Date.now();\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n // other than performance.now, Date.now might not be stable (changes on wall clock changes),\n // this is not an issue here as a clock change during a short running task is very unlikely\n // in case it still happened and leads to negative duration, simply assume 1 msec\n taskDuration = Math.max(1, Date.now() - taskDuration);\n longestTask = Math.max(taskDuration, longestTask);\n // Guess the following task will take a similar time to the longest task in this batch, allow\n // additional room to try avoid exceeding the deadline\n deadlineRemaining = deadline.timeRemaining();\n if (longestTask * 1.5 > deadlineRemaining) {\n // Warn when the time exceeding the deadline is over 20ms, if this happens in practice the\n // task should be split into sub-tasks to ensure the UI remains responsive.\n if (lastDeadlineRemaining - taskDuration < -20) {\n console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(lastDeadlineRemaining - taskDuration))}ms`);\n }\n this._start();\n return;\n }\n lastDeadlineRemaining = deadlineRemaining;\n }\n this.clear();\n }\n}\n\n/**\n * A queue of that runs tasks over several tasks via setTimeout, trying to maintain above 60 frames\n * per second. The tasks will run in the order they are enqueued, but they will run some time later,\n * and care should be taken to ensure they're non-urgent and will not introduce race conditions.\n */\nexport class PriorityTaskQueue extends TaskQueue {\n protected _requestCallback(callback: CallbackWithDeadline): number {\n return setTimeout(() => callback(this._createDeadline(16)));\n }\n\n protected _cancelCallback(identifier: number): void {\n clearTimeout(identifier);\n }\n\n private _createDeadline(duration: number): ITaskDeadline {\n const end = Date.now() + duration;\n return {\n timeRemaining: () => Math.max(0, end - Date.now())\n };\n }\n}\n\nclass IdleTaskQueueInternal extends TaskQueue {\n protected _requestCallback(callback: IdleRequestCallback): number {\n return requestIdleCallback(callback);\n }\n\n protected _cancelCallback(identifier: number): void {\n cancelIdleCallback(identifier);\n }\n}\n\n/**\n * A queue of that runs tasks over several idle callbacks, trying to respect the idle callback's\n * deadline given by the environment. The tasks will run in the order they are enqueued, but they\n * will run some time later, and care should be taken to ensure they're non-urgent and will not\n * introduce race conditions.\n *\n * This reverts to a {@link PriorityTaskQueue} if the environment does not support idle callbacks.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdleTaskQueue = (!isNode && 'requestIdleCallback' in window) ? IdleTaskQueueInternal : PriorityTaskQueue;\n\n/**\n * An object that tracks a single debounced task that will run on the next idle frame. When called\n * multiple times, only the last set task will run.\n */\nexport class DebouncedIdleTask {\n private _queue: ITaskQueue;\n\n constructor() {\n this._queue = new IdleTaskQueue();\n }\n\n public set(task: () => boolean | void): void {\n this._queue.clear();\n this._queue.enqueue(task);\n }\n\n public flush(): void {\n this._queue.flush();\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { DebouncedIdleTask } from 'common/TaskQueue';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\ninterface ISelectionState {\n start: [number, number] | undefined;\n end: [number, number] | undefined;\n columnSelectMode: boolean;\n}\n\nexport class RenderService extends Disposable implements IRenderService {\n public serviceBrand: undefined;\n\n private _renderer: MutableDisposable = this._register(new MutableDisposable());\n private _renderDebouncer: IRenderDebouncerWithCallback;\n private _pausedResizeTask = new DebouncedIdleTask();\n private _observerDisposable = this._register(new MutableDisposable());\n\n private _isPaused: boolean = false;\n private _needsFullRefresh: boolean = false;\n private _isNextRenderRedrawOnly: boolean = true;\n private _needsSelectionRefresh: boolean = false;\n private _canvasWidth: number = 0;\n private _canvasHeight: number = 0;\n private _selectionState: ISelectionState = {\n start: undefined,\n end: undefined,\n columnSelectMode: false\n };\n\n private readonly _onDimensionsChange = this._register(new Emitter());\n public readonly onDimensionsChange = this._onDimensionsChange.event;\n private readonly _onRenderedViewportChange = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;\n private readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onRefreshRequest = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRefreshRequest = this._onRefreshRequest.event;\n\n public get dimensions(): IRenderDimensions { return this._renderer.value!.dimensions; }\n\n constructor(\n private _rowCount: number,\n screenElement: HTMLElement,\n @IOptionsService optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IDecorationService decorationService: IDecorationService,\n @IBufferService bufferService: IBufferService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService,\n @IThemeService themeService: IThemeService\n ) {\n super();\n\n this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end), coreBrowserService);\n this._register(this._renderDebouncer);\n\n this._register(coreBrowserService.onDprChange(() => this.handleDevicePixelRatioChange()));\n\n this._register(bufferService.onResize(() => this._fullRefresh()));\n this._register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear()));\n this._register(optionsService.onOptionChange(() => this._handleOptionsChanged()));\n this._register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged()));\n\n // Do a full refresh whenever any decoration is added or removed. This may not actually result\n // in changes but since decorations should be used sparingly or added/removed all in the same\n // frame this should have minimal performance impact.\n this._register(decorationService.onDecorationRegistered(() => this._fullRefresh()));\n this._register(decorationService.onDecorationRemoved(() => this._fullRefresh()));\n\n // Clear the renderer when the a change that could affect glyphs occurs\n this._register(optionsService.onMultipleOptionChange([\n 'customGlyphs',\n 'drawBoldTextInBrightColors',\n 'letterSpacing',\n 'lineHeight',\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'fontWeightBold',\n 'minimumContrastRatio',\n 'rescaleOverlappingGlyphs'\n ], () => {\n this.clear();\n this.handleResize(bufferService.cols, bufferService.rows);\n this._fullRefresh();\n }));\n\n // Refresh the cursor line when the cursor changes\n this._register(optionsService.onMultipleOptionChange([\n 'cursorBlink',\n 'cursorStyle'\n ], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, true)));\n\n this._register(themeService.onChangeColors(() => this._fullRefresh()));\n\n this._registerIntersectionObserver(coreBrowserService.window, screenElement);\n this._register(coreBrowserService.onWindowChange((w) => this._registerIntersectionObserver(w, screenElement)));\n }\n\n private _registerIntersectionObserver(w: Window & typeof globalThis, screenElement: HTMLElement): void {\n // Detect whether IntersectionObserver is detected and enable renderer pause\n // and resume based on terminal visibility if so\n if ('IntersectionObserver' in w) {\n const observer = new w.IntersectionObserver(e => this._handleIntersectionChange(e[e.length - 1]), { threshold: 0 });\n observer.observe(screenElement);\n this._observerDisposable.value = toDisposable(() => observer.disconnect());\n }\n }\n\n private _handleIntersectionChange(entry: IntersectionObserverEntry): void {\n this._isPaused = entry.isIntersecting === undefined ? (entry.intersectionRatio === 0) : !entry.isIntersecting;\n\n // Terminal was hidden on open\n if (!this._isPaused && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n\n if (!this._isPaused && this._needsFullRefresh) {\n this._pausedResizeTask.flush();\n this.refreshRows(0, this._rowCount - 1);\n this._needsFullRefresh = false;\n }\n }\n\n public refreshRows(start: number, end: number, isRedrawOnly: boolean = false): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n return;\n }\n if (!isRedrawOnly) {\n this._isNextRenderRedrawOnly = false;\n }\n this._renderDebouncer.refresh(start, end, this._rowCount);\n }\n\n private _renderRows(start: number, end: number): void {\n if (!this._renderer.value) {\n return;\n }\n\n // Since this is debounced, a resize event could have happened between the time a refresh was\n // requested and when this triggers. Clamp the values of start and end to ensure they're valid\n // given the current viewport state.\n start = Math.min(start, this._rowCount - 1);\n end = Math.min(end, this._rowCount - 1);\n\n // Render\n this._renderer.value.renderRows(start, end);\n\n // Update selection if needed\n if (this._needsSelectionRefresh) {\n this._renderer.value.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode);\n this._needsSelectionRefresh = false;\n }\n\n // Fire render event only if it was not a redraw\n if (!this._isNextRenderRedrawOnly) {\n this._onRenderedViewportChange.fire({ start, end });\n }\n this._onRender.fire({ start, end });\n this._isNextRenderRedrawOnly = true;\n }\n\n public resize(cols: number, rows: number): void {\n this._rowCount = rows;\n this._fireOnCanvasResize();\n }\n\n private _handleOptionsChanged(): void {\n if (!this._renderer.value) {\n return;\n }\n this.refreshRows(0, this._rowCount - 1);\n this._fireOnCanvasResize();\n }\n\n private _fireOnCanvasResize(): void {\n if (!this._renderer.value) {\n return;\n }\n // Don't fire the event if the dimensions haven't changed\n if (this._renderer.value.dimensions.css.canvas.width === this._canvasWidth && this._renderer.value.dimensions.css.canvas.height === this._canvasHeight) {\n return;\n }\n this._onDimensionsChange.fire(this._renderer.value.dimensions);\n }\n\n public hasRenderer(): boolean {\n return !!this._renderer.value;\n }\n\n public setRenderer(renderer: IRenderer): void {\n this._renderer.value = renderer;\n // If the value was not set, the terminal is being disposed so ignore it\n if (this._renderer.value) {\n this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));\n\n // Force a refresh\n this._needsSelectionRefresh = true;\n this._fullRefresh();\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n return this._renderDebouncer.addRefreshCallback(callback);\n }\n\n private _fullRefresh(): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n } else {\n this.refreshRows(0, this._rowCount - 1);\n }\n }\n\n public clearTextureAtlas(): void {\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.clearTextureAtlas?.();\n this._fullRefresh();\n }\n\n public handleDevicePixelRatioChange(): void {\n // Force char size measurement as DomMeasureStrategy(getBoundingClientRect) is not stable\n // when devicePixelRatio changes\n this._charSizeService.measure();\n\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.handleDevicePixelRatioChange();\n this.refreshRows(0, this._rowCount - 1);\n }\n\n public handleResize(cols: number, rows: number): void {\n if (!this._renderer.value) {\n return;\n }\n if (this._isPaused) {\n this._pausedResizeTask.set(() => this._renderer.value?.handleResize(cols, rows));\n } else {\n this._renderer.value.handleResize(cols, rows);\n }\n this._fullRefresh();\n }\n\n // TODO: Is this useful when we have onResize?\n public handleCharSizeChanged(): void {\n this._renderer.value?.handleCharSizeChanged();\n }\n\n public handleBlur(): void {\n this._renderer.value?.handleBlur();\n }\n\n public handleFocus(): void {\n this._renderer.value?.handleFocus();\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionState.start = start;\n this._selectionState.end = end;\n this._selectionState.columnSelectMode = columnSelectMode;\n this._renderer.value?.handleSelectionChanged(start, end, columnSelectMode);\n }\n\n public handleCursorMove(): void {\n this._renderer.value?.handleCursorMove();\n }\n\n public clear(): void {\n this._renderer.value?.clear();\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { C0 } from 'common/data/EscapeSequences';\nimport { IBufferService } from 'common/services/Services';\n\nconst enum Direction {\n UP = 'A',\n DOWN = 'B',\n RIGHT = 'C',\n LEFT = 'D'\n}\n\n/**\n * Concatenates all the arrow sequences together.\n * Resets the starting row to an unwrapped row, moves to the requested row,\n * then moves to requested col.\n */\nexport function moveToCellSequence(targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startX = bufferService.buffer.x;\n const startY = bufferService.buffer.y;\n\n // The alt buffer should try to navigate between rows\n if (!bufferService.buffer.hasScrollback) {\n return resetStartingRow(startX, startY, targetX, targetY, bufferService, applicationCursor) +\n moveToRequestedRow(startY, targetY, bufferService, applicationCursor) +\n moveToRequestedCol(startX, startY, targetX, targetY, bufferService, applicationCursor);\n }\n\n // Only move horizontally for the normal buffer\n let direction;\n if (startY === targetY) {\n direction = startX > targetX ? Direction.LEFT : Direction.RIGHT;\n return repeat(Math.abs(startX - targetX), sequence(direction, applicationCursor));\n }\n direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;\n const rowDifference = Math.abs(startY - targetY);\n const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +\n (rowDifference - 1) * bufferService.cols + 1 /* wrap around 1 row */ +\n colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);\n return repeat(cellsToMove, sequence(direction, applicationCursor));\n}\n\n/**\n * Find the number of cols from a row beginning to a col.\n */\nfunction colsFromRowBeginning(currX: number, bufferService: IBufferService): number {\n return currX - 1;\n}\n\n/**\n * Find the number of cols from a col to row end.\n */\nfunction colsFromRowEnd(currX: number, bufferService: IBufferService): number {\n return bufferService.cols - currX;\n}\n\n/**\n * If the initial position of the cursor is on a row that is wrapped, move the\n * cursor up to the first row that is not wrapped to have accurate vertical\n * positioning.\n */\nfunction resetStartingRow(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length === 0) {\n return '';\n }\n return repeat(bufferLine(\n startX, startY, startX,\n startY - wrappedRowsForRow(startY, bufferService), false, bufferService\n ).length, sequence(Direction.LEFT, applicationCursor));\n}\n\n/**\n * Using the reset starting and ending row, move to the requested row,\n * ignoring wrapped rows\n */\nfunction moveToRequestedRow(startY: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n const rowsToMove = Math.abs(startRow - endRow) - wrappedRowsCount(startY, targetY, bufferService);\n\n return repeat(rowsToMove, sequence(verticalDirection(startY, targetY), applicationCursor));\n}\n\n/**\n * Move to the requested col on the ending row\n */\nfunction moveToRequestedCol(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n let startRow;\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n const endRow = targetY;\n const direction = horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor);\n\n return repeat(bufferLine(\n startX, startRow, targetX, endRow,\n direction === Direction.RIGHT, bufferService\n ).length, sequence(direction, applicationCursor));\n}\n\n/**\n * Utility functions\n */\n\n/**\n * Calculates the number of wrapped rows between the unwrapped starting and\n * ending rows. These rows need to ignored since the cursor skips over them.\n */\nfunction wrappedRowsCount(startY: number, targetY: number, bufferService: IBufferService): number {\n let wrappedRows = 0;\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n for (let i = 0; i < Math.abs(startRow - endRow); i++) {\n const direction = verticalDirection(startY, targetY) === Direction.UP ? -1 : 1;\n const line = bufferService.buffer.lines.get(startRow + (direction * i));\n if (line?.isWrapped) {\n wrappedRows++;\n }\n }\n\n return wrappedRows;\n}\n\n/**\n * Calculates the number of wrapped rows that make up a given row.\n * @param currentRow The row to determine how many wrapped rows make it up\n */\nfunction wrappedRowsForRow(currentRow: number, bufferService: IBufferService): number {\n let rowCount = 0;\n let line = bufferService.buffer.lines.get(currentRow);\n let lineWraps = line?.isWrapped;\n\n while (lineWraps && currentRow >= 0 && currentRow < bufferService.rows) {\n rowCount++;\n line = bufferService.buffer.lines.get(--currentRow);\n lineWraps = line?.isWrapped;\n }\n\n return rowCount;\n}\n\n/**\n * Direction determiners\n */\n\n/**\n * Determines if the right or left arrow is needed\n */\nfunction horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {\n let startRow;\n if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n if ((startX < targetX &&\n startRow <= targetY) || // down/right or same y/right\n (startX >= targetX &&\n startRow < targetY)) { // down/left or same y/left\n return Direction.RIGHT;\n }\n return Direction.LEFT;\n}\n\n/**\n * Determines if the up or down arrow is needed\n */\nfunction verticalDirection(startY: number, targetY: number): Direction {\n return startY > targetY ? Direction.UP : Direction.DOWN;\n}\n\n/**\n * Constructs the string of chars in the buffer from a starting row and col\n * to an ending row and col\n * @param startCol The starting column position\n * @param startRow The starting row position\n * @param endCol The ending column position\n * @param endRow The ending row position\n * @param forward Direction to move\n */\nfunction bufferLine(\n startCol: number,\n startRow: number,\n endCol: number,\n endRow: number,\n forward: boolean,\n bufferService: IBufferService\n): string {\n let currentCol = startCol;\n let currentRow = startRow;\n let bufferStr = '';\n\n while (currentCol !== endCol || currentRow !== endRow) {\n currentCol += forward ? 1 : -1;\n\n if (forward && currentCol > bufferService.cols - 1) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n currentCol = 0;\n startCol = 0;\n currentRow++;\n } else if (!forward && currentCol < 0) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, 0, startCol + 1\n );\n currentCol = bufferService.cols - 1;\n startCol = currentCol;\n currentRow--;\n }\n }\n\n return bufferStr + bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n}\n\n/**\n * Constructs the escape sequence for clicking an arrow\n * @param direction The direction to move\n */\nfunction sequence(direction: Direction, applicationCursor: boolean): string {\n const mod = applicationCursor ? 'O' : '[';\n return C0.ESC + mod + direction;\n}\n\n/**\n * Returns a string repeated a given number of times\n * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n * @param count The number of times to repeat the string\n * @param str The string that is to be repeated\n */\nfunction repeat(count: number, str: string): string {\n count = Math.floor(count);\n let rpt = '';\n for (let i = 0; i < count; i++) {\n rpt += str;\n }\n return rpt;\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService } from 'common/services/Services';\n\n/**\n * Represents a selection within the buffer. This model only cares about column\n * and row coordinates, not wide characters.\n */\nexport class SelectionModel {\n /**\n * Whether select all is currently active.\n */\n public isSelectAllActive: boolean = false;\n\n /**\n * The minimal length of the selection from the start position. When double\n * clicking on a word, the word will be selected which makes the selection\n * start at the start of the word and makes this variable the length.\n */\n public selectionStartLength: number = 0;\n\n /**\n * The [x, y] position the selection starts at.\n */\n public selectionStart: [number, number] | undefined;\n\n /**\n * The [x, y] position the selection ends at.\n */\n public selectionEnd: [number, number] | undefined;\n\n constructor(\n private _bufferService: IBufferService\n ) {\n }\n\n /**\n * Clears the current selection.\n */\n public clearSelection(): void {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n }\n\n /**\n * The final selection start, taking into consideration select all.\n */\n public get finalSelectionStart(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n }\n\n /**\n * The final selection end, taking into consideration select all, double click\n * word selection and triple click line selection.\n */\n public get finalSelectionEnd(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];\n }\n\n if (!this.selectionStart) {\n return undefined;\n }\n\n // Use the selection start + length if the end doesn't exist or they're reversed\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n // Ensure the trailing EOL isn't included when the selection ends on the right edge\n if (startPlusLength % this._bufferService.cols === 0) {\n return [this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols) - 1];\n }\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [startPlusLength, this.selectionStart[1]];\n }\n\n // Ensure the the word/line is selected after a double/triple click\n if (this.selectionStartLength) {\n // Select the larger of the two when start and end are on the same line\n if (this.selectionEnd[1] === this.selectionStart[1]) {\n // Keep the whole wrapped word/line selected if the content wraps multiple lines\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [Math.max(startPlusLength, this.selectionEnd[0]), this.selectionEnd[1]];\n }\n }\n return this.selectionEnd;\n }\n\n /**\n * Returns whether the selection start and end are reversed.\n */\n public areSelectionValuesReversed(): boolean {\n const start = this.selectionStart;\n const end = this.selectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n * @returns Whether a refresh is necessary.\n */\n public handleTrim(amount: number): boolean {\n // Adjust the selection position based on the trimmed amount.\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n\n // The selection has moved off the buffer, clear it.\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n\n // If the selection start is trimmed, ensure the start column is 0.\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange } from '@xterm/xterm';\n\nexport function getRangeLength(range: IBufferRange, bufferCols: number): number {\n if (range.start.y > range.end.y) {\n throw new Error(`Buffer range end (${range.end.x}, ${range.end.y}) cannot be before start (${range.start.x}, ${range.start.y})`);\n }\n return bufferCols * (range.end.y - range.start.y) + (range.end.x - range.start.x + 1);\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILinkifier2 } from 'browser/Types';\nimport { getCoordsRelativeToElement } from 'browser/input/Mouse';\nimport { moveToCellSequence } from 'browser/input/MoveToCell';\nimport { SelectionModel } from 'browser/selection/SelectionModel';\nimport { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport * as Browser from 'common/Platform';\nimport { IBufferLine, IDisposable } from 'common/Types';\nimport { getRangeLength } from 'common/buffer/BufferRange';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * The number of pixels the mouse needs to be above or below the viewport in\n * order to scroll at the maximum speed.\n */\nconst DRAG_SCROLL_MAX_THRESHOLD = 50;\n\n/**\n * The maximum scrolling speed\n */\nconst DRAG_SCROLL_MAX_SPEED = 15;\n\n/**\n * The number of milliseconds between drag scroll updates.\n */\nconst DRAG_SCROLL_INTERVAL = 50;\n\n/**\n * The maximum amount of time that can have elapsed for an alt click to move the\n * cursor.\n */\nconst ALT_CLICK_MOVE_CURSOR_TIME = 500;\n\nconst NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nconst ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\n\n/**\n * Represents a position of a word on a line.\n */\ninterface IWordPosition {\n start: number;\n length: number;\n}\n\n/**\n * A selection mode, this drives how the selection behaves on mouse move.\n */\nexport const enum SelectionMode {\n NORMAL,\n WORD,\n LINE,\n COLUMN\n}\n\n/**\n * A class that manages the selection of the terminal. With help from\n * SelectionModel, SelectionService handles with all logic associated with\n * dealing with the selection, including handling mouse interaction, wide\n * characters and fetching the actual text within the selection. Rendering is\n * not handled by the SelectionService but the onRedrawRequest event is fired\n * when the selection is ready to be redrawn (on an animation frame).\n */\nexport class SelectionService extends Disposable implements ISelectionService {\n public serviceBrand: undefined;\n\n protected _model: SelectionModel;\n\n /**\n * The amount to scroll every drag scroll update (depends on how far the mouse\n * drag is above or below the terminal).\n */\n private _dragScrollAmount: number = 0;\n\n /**\n * The current selection mode.\n */\n protected _activeSelectionMode: SelectionMode;\n\n /**\n * A setInterval timer that is active while the mouse is down whose callback\n * scrolls the viewport when necessary.\n */\n private _dragScrollIntervalTimer: number | undefined;\n\n /**\n * The animation frame ID used for refreshing the selection.\n */\n private _refreshAnimationFrame: number | undefined;\n\n /**\n * Whether selection is enabled.\n */\n private _enabled = true;\n\n private _mouseMoveListener: EventListener;\n private _mouseUpListener: EventListener;\n private _trimListener: IDisposable;\n private _workCell: CellData = new CellData();\n\n private _mouseDownTimeStamp: number = 0;\n private _oldHasSelection: boolean = false;\n private _oldSelectionStart: [number, number] | undefined = undefined;\n private _oldSelectionEnd: [number, number] | undefined = undefined;\n\n private readonly _onLinuxMouseSelection = this._register(new Emitter());\n public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;\n private readonly _onRedrawRequest = this._register(new Emitter());\n public readonly onRequestRedraw = this._onRedrawRequest.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _linkifier: ILinkifier2,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IMouseService private readonly _mouseService: IMouseService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n\n // Init listeners\n this._mouseMoveListener = event => this._handleMouseMove(event as MouseEvent);\n this._mouseUpListener = event => this._handleMouseUp(event as MouseEvent);\n this._coreService.onUserInput(() => {\n if (this.hasSelection) {\n this.clearSelection();\n }\n });\n this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._handleTrim(amount));\n this._register(this._bufferService.buffers.onBufferActivate(e => this._handleBufferActivate(e)));\n\n this.enable();\n\n this._model = new SelectionModel(this._bufferService);\n this._activeSelectionMode = SelectionMode.NORMAL;\n\n this._register(toDisposable(() => {\n this._removeMouseDownListeners();\n }));\n }\n\n public reset(): void {\n this.clearSelection();\n }\n\n /**\n * Disables the selection manager. This is useful for when terminal mouse\n * are enabled.\n */\n public disable(): void {\n this.clearSelection();\n this._enabled = false;\n }\n\n /**\n * Enable the selection manager.\n */\n public enable(): void {\n this._enabled = true;\n }\n\n public get selectionStart(): [number, number] | undefined { return this._model.finalSelectionStart; }\n public get selectionEnd(): [number, number] | undefined { return this._model.finalSelectionEnd; }\n\n /**\n * Gets whether there is an active text selection.\n */\n public get hasSelection(): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }\n\n /**\n * Gets the text currently selected.\n */\n public get selectionText(): string {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n\n const buffer = this._bufferService.buffer;\n const result: string[] = [];\n\n if (this._activeSelectionMode === SelectionMode.COLUMN) {\n // Ignore zero width selections\n if (start[0] === end[0]) {\n return '';\n }\n\n // For column selection it's not enough to rely on final selection's swapping of reversed\n // values, it also needs the x coordinates to swap independently of the y coordinate is needed\n const startCol = start[0] < end[0] ? start[0] : end[0];\n const endCol = start[0] < end[0] ? end[0] : start[0];\n for (let i = start[1]; i <= end[1]; i++) {\n const lineText = buffer.translateBufferLineToString(i, true, startCol, endCol);\n result.push(lineText);\n }\n } else {\n // Get first row\n const startRowEndCol = start[1] === end[1] ? end[0] : undefined;\n result.push(buffer.translateBufferLineToString(start[1], true, start[0], startRowEndCol));\n\n // Get middle rows\n for (let i = start[1] + 1; i <= end[1] - 1; i++) {\n const bufferLine = buffer.lines.get(i);\n const lineText = buffer.translateBufferLineToString(i, true);\n if (bufferLine?.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n\n // Get final row\n if (start[1] !== end[1]) {\n const bufferLine = buffer.lines.get(end[1]);\n const lineText = buffer.translateBufferLineToString(end[1], true, 0, end[0]);\n if (bufferLine && bufferLine!.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n }\n\n // Format string by replacing non-breaking space chars with regular spaces\n // and joining the array into a multi-line string.\n const formattedResult = result.map(line => {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isWindows ? '\\r\\n' : '\\n');\n\n return formattedResult;\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Queues a refresh, redrawing the selection on the next opportunity.\n * @param isLinuxMouseSelection Whether the selection should be registered as a new\n * selection on Linux.\n */\n public refresh(isLinuxMouseSelection?: boolean): void {\n // Queue the refresh for the renderer\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh());\n }\n\n // If the platform is Linux and the refresh call comes from a mouse event,\n // we need to update the selection for middle click to paste selection.\n if (Browser.isLinux && isLinuxMouseSelection) {\n const selectionText = this.selectionText;\n if (selectionText.length) {\n this._onLinuxMouseSelection.fire(this.selectionText);\n }\n }\n }\n\n /**\n * Fires the refresh event, causing consumers to pick it up and redraw the\n * selection state.\n */\n private _refresh(): void {\n this._refreshAnimationFrame = undefined;\n this._onRedrawRequest.fire({\n start: this._model.finalSelectionStart,\n end: this._model.finalSelectionEnd,\n columnSelectMode: this._activeSelectionMode === SelectionMode.COLUMN\n });\n }\n\n /**\n * Checks if the current click was inside the current selection\n * @param event The mouse event\n */\n private _isClickInSelection(event: MouseEvent): boolean {\n const coords = this._getMouseBufferCoords(event);\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n\n if (!start || !end || !coords) {\n return false;\n }\n\n return this._areCoordsInSelection(coords, start, end);\n }\n\n public isCellInSelection(x: number, y: number): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return this._areCoordsInSelection([x, y], start, end);\n }\n\n protected _areCoordsInSelection(coords: [number, number], start: [number, number], end: [number, number]): boolean {\n return (coords[1] > start[1] && coords[1] < end[1]) ||\n (start[1] === end[1] && coords[1] === start[1] && coords[0] >= start[0] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === end[1] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === start[1] && coords[0] >= start[0]);\n }\n\n /**\n * Selects word at the current mouse event coordinates.\n * @param event The mouse event.\n */\n private _selectWordAtCursor(event: MouseEvent, allowWhitespaceOnlySelection: boolean): boolean {\n // Check if there is a link under the cursor first and select that if so\n const range = this._linkifier.currentLink?.link?.range;\n if (range) {\n this._model.selectionStart = [range.start.x - 1, range.start.y - 1];\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n this._model.selectionEnd = undefined;\n return true;\n }\n\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._selectWordAt(coords, allowWhitespaceOnlySelection);\n this._model.selectionEnd = undefined;\n return true;\n }\n return false;\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._model.isSelectAllActive = true;\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n public selectLines(start: number, end: number): void {\n this._model.clearSelection();\n start = Math.max(start, 0);\n end = Math.min(end, this._bufferService.buffer.lines.length - 1);\n this._model.selectionStart = [0, start];\n this._model.selectionEnd = [this._bufferService.cols, end];\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n */\n private _handleTrim(amount: number): void {\n const needsRefresh = this._model.handleTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n }\n\n /**\n * Gets the 0-based [x, y] buffer coordinates of the current mouse event.\n * @param event The mouse event.\n */\n private _getMouseBufferCoords(event: MouseEvent): [number, number] | undefined {\n const coords = this._mouseService.getCoords(event, this._screenElement, this._bufferService.cols, this._bufferService.rows, true);\n if (!coords) {\n return undefined;\n }\n\n // Convert to 0-based\n coords[0]--;\n coords[1]--;\n\n // Convert viewport coords to buffer coords\n coords[1] += this._bufferService.buffer.ydisp;\n return coords;\n }\n\n /**\n * Gets the amount the viewport should be scrolled based on how far out of the\n * terminal the mouse is.\n * @param event The mouse event.\n */\n private _getMouseEventScrollAmount(event: MouseEvent): number {\n let offset = getCoordsRelativeToElement(this._coreBrowserService.window, event, this._screenElement)[1];\n const terminalHeight = this._renderService.dimensions.css.canvas.height;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\n }\n\n offset = Math.min(Math.max(offset, -DRAG_SCROLL_MAX_THRESHOLD), DRAG_SCROLL_MAX_THRESHOLD);\n offset /= DRAG_SCROLL_MAX_THRESHOLD;\n return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));\n }\n\n /**\n * Returns whether the selection manager should force selection, regardless of\n * whether the terminal is in mouse events mode.\n * @param event The mouse event.\n */\n public shouldForceSelection(event: MouseEvent): boolean {\n if (Browser.isMac) {\n return event.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection;\n }\n\n return event.shiftKey;\n }\n\n /**\n * Handles te mousedown event, setting up for a new selection.\n * @param event The mousedown event.\n */\n public handleMouseDown(event: MouseEvent): void {\n this._mouseDownTimeStamp = event.timeStamp;\n // If we have selection, we want the context menu on right click even if the\n // terminal is in mouse mode.\n if (event.button === 2 && this.hasSelection) {\n return;\n }\n\n // Only action the primary button\n if (event.button !== 0) {\n return;\n }\n\n // Allow selection when using a specific modifier key, even when disabled\n if (!this._enabled) {\n if (!this.shouldForceSelection(event)) {\n return;\n }\n\n // Don't send the mouse down event to the current process, we want to select\n event.stopPropagation();\n }\n\n // Tell the browser not to start a regular selection\n event.preventDefault();\n\n // Reset drag scroll state\n this._dragScrollAmount = 0;\n\n if (this._enabled && event.shiftKey) {\n this._handleIncrementalClick(event);\n } else {\n if (event.detail === 1) {\n this._handleSingleClick(event);\n } else if (event.detail === 2) {\n this._handleDoubleClick(event);\n } else if (event.detail === 3) {\n this._handleTripleClick(event);\n }\n }\n\n this._addMouseDownListeners();\n this.refresh(true);\n }\n\n /**\n * Adds listeners when mousedown is triggered.\n */\n private _addMouseDownListeners(): void {\n // Listen on the document so that dragging outside of viewport works\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n }\n this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), DRAG_SCROLL_INTERVAL);\n }\n\n /**\n * Removes the listeners that are registered when mousedown is triggered.\n */\n private _removeMouseDownListeners(): void {\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n }\n this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = undefined;\n }\n\n /**\n * Performs an incremental click, setting the selection end position to the mouse\n * position.\n * @param event The mouse event.\n */\n private _handleIncrementalClick(event: MouseEvent): void {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n }\n\n /**\n * Performs a single click, resetting relevant state and setting the selection\n * start position.\n * @param event The mouse event.\n */\n private _handleSingleClick(event: MouseEvent): void {\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;\n\n // Initialize the new selection\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (!this._model.selectionStart) {\n return;\n }\n this._model.selectionEnd = undefined;\n\n // Ensure the line exists\n const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);\n if (!line) {\n return;\n }\n\n // Return early if the click event is not in the buffer (eg. in scroll bar)\n if (line.length === this._model.selectionStart[0]) {\n return;\n }\n\n // If the mouse is over the second half of a wide character, adjust the\n // selection to cover the whole character\n if (line.hasWidth(this._model.selectionStart[0]) === 0) {\n this._model.selectionStart[0]++;\n }\n }\n\n /**\n * Performs a double click, selecting the current word.\n * @param event The mouse event.\n */\n private _handleDoubleClick(event: MouseEvent): void {\n if (this._selectWordAtCursor(event, true)) {\n this._activeSelectionMode = SelectionMode.WORD;\n }\n }\n\n /**\n * Performs a triple click, selecting the current line and activating line\n * select mode.\n * @param event The mouse event.\n */\n private _handleTripleClick(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n }\n\n /**\n * Returns whether the selection manager should operate in column select mode\n * @param event the mouse or keyboard event\n */\n public shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean {\n return event.altKey && !(Browser.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection);\n }\n\n /**\n * Handles the mousemove event when the mouse button is down, recording the\n * end of the selection and refreshing the selection.\n * @param event The mousemove event.\n */\n private _handleMouseMove(event: MouseEvent): void {\n // If the mousemove listener is active it means that a selection is\n // currently being made, we should stop propagation to prevent mouse events\n // to be sent to the pty.\n event.stopImmediatePropagation();\n\n // Do nothing if there is no selection start, this can happen if the first\n // click in the terminal is an incremental click\n if (!this._model.selectionStart) {\n return;\n }\n\n // Record the previous position so we know whether to redraw the selection\n // at the end.\n const previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n\n // Set the initial selection end based on the mouse coordinates\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (!this._model.selectionEnd) {\n this.refresh(true);\n return;\n }\n\n // Select the entire line if line select mode is active.\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n } else {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n } else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n\n // Determine the amount of scrolling that will happen.\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n } else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n }\n\n // If the character is a wide character include the cell to the right in the\n // selection. Note that selections at the very end of the line will never\n // have a character.\n const buffer = this._bufferService.buffer;\n if (this._model.selectionEnd[1] < buffer.lines.length) {\n const line = buffer.lines.get(this._model.selectionEnd[1]);\n if (line && line.hasWidth(this._model.selectionEnd[0]) === 0) {\n if (this._model.selectionEnd[0] < this._bufferService.cols) {\n this._model.selectionEnd[0]++;\n }\n }\n }\n\n // Only draw here if the selection changes.\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n }\n\n /**\n * The callback that occurs every DRAG_SCROLL_INTERVAL ms that does the\n * scrolling of the viewport.\n */\n private _dragScroll(): void {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n } else {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }\n\n /**\n * Handles the mouseup event, removing the mousedown listeners.\n * @param event The mouseup event.\n */\n private _handleMouseUp(event: MouseEvent): void {\n const timeElapsed = event.timeStamp - this._mouseDownTimeStamp;\n\n this._removeMouseDownListeners();\n\n if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME && event.altKey && this._optionsService.rawOptions.altClickMovesCursor) {\n if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {\n const coordinates = this._mouseService.getCoords(\n event,\n this._element,\n this._bufferService.cols,\n this._bufferService.rows,\n false\n );\n if (coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) {\n const sequence = moveToCellSequence(coordinates[0] - 1, coordinates[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);\n this._coreService.triggerDataEvent(sequence, true);\n }\n }\n } else {\n this._fireEventIfSelectionChanged();\n }\n }\n\n private _fireEventIfSelectionChanged(): void {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n const hasSelection = !!start && !!end && (start[0] !== end[0] || start[1] !== end[1]);\n\n if (!hasSelection) {\n if (this._oldHasSelection) {\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n return;\n }\n\n // Sanity check, these should not be undefined as there is a selection\n if (!start || !end) {\n return;\n }\n\n if (!this._oldSelectionStart || !this._oldSelectionEnd || (\n start[0] !== this._oldSelectionStart[0] || start[1] !== this._oldSelectionStart[1] ||\n end[0] !== this._oldSelectionEnd[0] || end[1] !== this._oldSelectionEnd[1])) {\n\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n }\n\n private _fireOnSelectionChange(start: [number, number] | undefined, end: [number, number] | undefined, hasSelection: boolean): void {\n this._oldSelectionStart = start;\n this._oldSelectionEnd = end;\n this._oldHasSelection = hasSelection;\n this._onSelectionChange.fire();\n }\n\n private _handleBufferActivate(e: {activeBuffer: IBuffer, inactiveBuffer: IBuffer}): void {\n this.clearSelection();\n // Only adjust the selection on trim, shiftElements is rarely used (only in\n // reverseIndex) and delete in a splice is only ever used when the same\n // number of elements was just added. Given this is could actually be\n // beneficial to leave the selection as is for these cases.\n this._trimListener.dispose();\n this._trimListener = e.activeBuffer.lines.onTrim(amount => this._handleTrim(amount));\n }\n\n /**\n * Converts a viewport column (0 to cols - 1) to the character index on the\n * buffer line, the latter takes into account wide and null characters.\n * @param bufferLine The buffer line to use.\n * @param x The x index in the buffer line to convert.\n */\n private _convertViewportColToCharacterIndex(bufferLine: IBufferLine, x: number): number {\n let charIndex = x;\n for (let i = 0; x >= i; i++) {\n const length = bufferLine.loadCell(i, this._workCell).getChars().length;\n if (this._workCell.getWidth() === 0) {\n // Wide characters aren't included in the line string so decrement the\n // index so the index is back on the wide character.\n charIndex--;\n } else if (length > 1 && x !== i) {\n // Emojis take up multiple characters, so adjust accordingly. For these\n // we don't want ot include the character at the column as we're\n // returning the start index in the string, not the end index.\n charIndex += length - 1;\n }\n }\n return charIndex;\n }\n\n public setSelection(col: number, row: number, length: number): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this._model.selectionStart = [col, row];\n this._model.selectionStartLength = length;\n this.refresh();\n this._fireEventIfSelectionChanged();\n }\n\n public rightClickSelect(ev: MouseEvent): void {\n if (!this._isClickInSelection(ev)) {\n if (this._selectWordAtCursor(ev, false)) {\n this.refresh(true);\n }\n this._fireEventIfSelectionChanged();\n }\n }\n\n /**\n * Gets positional information for the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean, followWrappedLinesAbove: boolean = true, followWrappedLinesBelow: boolean = true): IWordPosition | undefined {\n // Ensure coords are within viewport (eg. not within scroll bar)\n if (coords[0] >= this._bufferService.cols) {\n return undefined;\n }\n\n const buffer = this._bufferService.buffer;\n const bufferLine = buffer.lines.get(coords[1]);\n if (!bufferLine) {\n return undefined;\n }\n\n const line = buffer.translateBufferLineToString(coords[1], false);\n\n // Get actual index, taking into consideration wide characters\n let startIndex = this._convertViewportColToCharacterIndex(bufferLine, coords[0]);\n let endIndex = startIndex;\n\n // Record offset to be used later\n const charOffset = coords[0] - startIndex;\n let leftWideCharCount = 0;\n let rightWideCharCount = 0;\n let leftLongCharOffset = 0;\n let rightLongCharOffset = 0;\n\n if (line.charAt(startIndex) === ' ') {\n // Expand until non-whitespace is hit\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n } else {\n // Expand until whitespace is hit. This algorithm works by scanning left\n // and right from the starting position, keeping both the index format\n // (line) and the column format (bufferLine) in sync. When a wide\n // character is hit, it is recorded and the column index is adjusted.\n let startCol = coords[0];\n let endCol = coords[0];\n\n // Consider the initial position, skip it and increment the wide char\n // variable\n if (bufferLine.getWidth(startCol) === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine.getWidth(endCol) === 2) {\n rightWideCharCount++;\n endCol++;\n }\n\n // Adjust the end index for characters whose length are > 1 (emojis)\n const length = bufferLine.getString(endCol).length;\n if (length > 1) {\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n\n // Expand the string in both directions until a space is hit\n while (startCol > 0 && startIndex > 0 && !this._isCharWordSeparator(bufferLine.loadCell(startCol - 1, this._workCell))) {\n bufferLine.loadCell(startCol - 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 0) {\n // If the next character is a wide char, record it and skip the column\n leftWideCharCount++;\n startCol--;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n leftLongCharOffset += length - 1;\n startIndex -= length - 1;\n }\n startIndex--;\n startCol--;\n }\n while (endCol < bufferLine.length && endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine.loadCell(endCol + 1, this._workCell))) {\n bufferLine.loadCell(endCol + 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 2) {\n // If the next character is a wide char, record it and skip the column\n rightWideCharCount++;\n endCol++;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n endIndex++;\n endCol++;\n }\n }\n\n // Incremenet the end index so it is at the start of the next character\n endIndex++;\n\n // Calculate the start _column_, converting the the string indexes back to\n // column coordinates.\n let start =\n startIndex // The index of the selection's start char in the line string\n + charOffset // The difference between the initial char's column and index\n - leftWideCharCount // The number of wide chars left of the initial char\n + leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n\n // Calculate the length in _columns_, converting the the string indexes back\n // to column coordinates.\n let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols\n endIndex // The index of the selection's end char in the line string\n - startIndex // The index of the selection's start char in the line string\n + leftWideCharCount // The number of wide chars left of the initial char\n + rightWideCharCount // The number of wide chars right of the initial char (inclusive)\n - leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n - rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)\n\n if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {\n return undefined;\n }\n\n // Recurse upwards if the line is wrapped and the word wraps to the above line\n if (followWrappedLinesAbove) {\n if (start === 0 && bufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const previousBufferLine = buffer.lines.get(coords[1] - 1);\n if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);\n if (previousLineWordPosition) {\n const offset = this._bufferService.cols - previousLineWordPosition.start;\n start -= offset;\n length += offset;\n }\n }\n }\n }\n\n // Recurse downwards if the line is wrapped and the word wraps to the next line\n if (followWrappedLinesBelow) {\n if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const nextBufferLine = buffer.lines.get(coords[1] + 1);\n if (nextBufferLine?.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);\n if (nextLineWordPosition) {\n length += nextLineWordPosition.length;\n }\n }\n }\n }\n\n return { start, length };\n }\n\n /**\n * Selects the word at the coordinates specified.\n * @param coords The coordinates to get the word at.\n * @param allowWhitespaceOnlySelection If whitespace should be selected\n */\n protected _selectWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): void {\n const wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection);\n if (wordPosition) {\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n coords[1]--;\n }\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n }\n }\n\n /**\n * Sets the selection end to the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _selectToWordAt(coords: [number, number]): void {\n const wordPosition = this._getWordAt(coords, true);\n if (wordPosition) {\n let endRow = coords[1];\n\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n endRow--;\n }\n\n // Adjust wrapped length value, this only needs to happen when values are reversed as in that\n // case we're interested in the start of the word, not the end\n if (!this._model.areSelectionValuesReversed()) {\n while (wordPosition.start + wordPosition.length > this._bufferService.cols) {\n wordPosition.length -= this._bufferService.cols;\n endRow++;\n }\n }\n\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : wordPosition.start + wordPosition.length, endRow];\n }\n }\n\n /**\n * Gets whether the character is considered a word separator by the select\n * word logic.\n * @param cell The cell to check.\n */\n private _isCharWordSeparator(cell: CellData): boolean {\n // Zero width characters are never separators as they are always to the\n // right of wide characters\n if (cell.getWidth() === 0) {\n return false;\n }\n return this._optionsService.rawOptions.wordSeparator.indexOf(cell.getChars()) >= 0;\n }\n\n /**\n * Selects the line specified.\n * @param line The line index.\n */\n protected _selectLineAt(line: number): void {\n const wrappedRange = this._bufferService.buffer.getWrappedRangeForLine(line);\n const range: IBufferRange = {\n start: { x: 0, y: wrappedRange.first },\n end: { x: this._bufferService.cols - 1, y: wrappedRange.last }\n };\n this._model.selectionStart = [0, wrappedRange.first];\n this._model.selectionEnd = undefined;\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport class TwoKeyMap {\n private _data: { [bg: string | number]: { [fg: string | number]: TValue | undefined } | undefined } = {};\n\n public set(first: TFirst, second: TSecond, value: TValue): void {\n if (!this._data[first]) {\n this._data[first] = {};\n }\n this._data[first as string | number]![second] = value;\n }\n\n public get(first: TFirst, second: TSecond): TValue | undefined {\n return this._data[first as string | number] ? this._data[first as string | number]![second] : undefined;\n }\n\n public clear(): void {\n this._data = {};\n }\n}\n\nexport class FourKeyMap {\n private _data: TwoKeyMap> = new TwoKeyMap();\n\n public set(first: TFirst, second: TSecond, third: TThird, fourth: TFourth, value: TValue): void {\n if (!this._data.get(first, second)) {\n this._data.set(first, second, new TwoKeyMap());\n }\n this._data.get(first, second)!.set(third, fourth, value);\n }\n\n public get(first: TFirst, second: TSecond, third: TThird, fourth: TFourth): TValue | undefined {\n return this._data.get(first, second)?.get(third, fourth);\n }\n\n public clear(): void {\n this._data.clear();\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColorContrastCache } from 'browser/Types';\nimport { IColor } from 'common/Types';\nimport { TwoKeyMap } from 'common/MultiKeyMap';\n\nexport class ColorContrastCache implements IColorContrastCache {\n private _color: TwoKeyMap = new TwoKeyMap();\n private _css: TwoKeyMap = new TwoKeyMap();\n\n public setCss(bg: number, fg: number, value: string | null): void {\n this._css.set(bg, fg, value);\n }\n\n public getCss(bg: number, fg: number): string | null | undefined {\n return this._css.get(bg, fg);\n }\n\n public setColor(bg: number, fg: number, value: IColor | null): void {\n this._color.set(bg, fg, value);\n }\n\n public getColor(bg: number, fg: number): IColor | null | undefined {\n return this._color.get(bg, fg);\n }\n\n public clear(): void {\n this._color.clear();\n this._css.clear();\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm';\nimport { channels, css } from 'common/Color';\nimport type { Event } from 'vs/base/common/event';\n\n/**\n * A portion of the public API that are implemented identially internally and simply passed through.\n */\ntype InternalPassthroughApis = Omit;\n\nexport interface ITerminal extends InternalPassthroughApis, ICoreTerminal {\n screenElement: HTMLElement | undefined;\n browser: IBrowser;\n buffer: IBuffer;\n linkifier: ILinkifier2 | undefined;\n options: Required;\n\n onBlur: Event;\n onFocus: Event;\n onA11yChar: Event;\n onA11yTab: Event;\n onWillOpen: Event;\n\n cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | void;\n}\n\nexport type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;\nexport type CustomWheelEventHandler = (event: WheelEvent) => boolean;\n\nexport type LineData = CharData[];\n\nexport interface ICompositionHelper {\n readonly isComposing: boolean;\n compositionstart(): void;\n compositionupdate(ev: CompositionEvent): void;\n compositionend(): void;\n updateCompositionElements(dontRecurse?: boolean): void;\n keydown(ev: KeyboardEvent): boolean;\n}\n\nexport interface IBrowser {\n isNode: boolean;\n userAgent: string;\n platform: string;\n isFirefox: boolean;\n isMac: boolean;\n isIpad: boolean;\n isIphone: boolean;\n isWindows: boolean;\n}\n\nexport interface IColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n cursorAccent: IColor;\n selectionForeground: IColor | undefined;\n selectionBackgroundTransparent: IColor;\n /** The selection blended on top of background. */\n selectionBackgroundOpaque: IColor;\n selectionInactiveBackgroundTransparent: IColor;\n selectionInactiveBackgroundOpaque: IColor;\n scrollbarSliderBackground: IColor;\n scrollbarSliderHoverBackground: IColor;\n scrollbarSliderActiveBackground: IColor;\n overviewRulerBorder: IColor;\n ansi: IColor[];\n /** Maps original colors to colors that respect minimum contrast ratio. */\n contrastCache: IColorContrastCache;\n /** Maps original colors to colors that respect _half_ of the minimum contrast ratio. */\n halfContrastCache: IColorContrastCache;\n}\n\nexport type ReadonlyColorSet = Readonly> & { ansi: Readonly['ansi']> };\n\nexport interface IColorContrastCache {\n clear(): void;\n setCss(bg: number, fg: number, value: string | null): void;\n getCss(bg: number, fg: number): string | null | undefined;\n setColor(bg: number, fg: number, value: IColor | null): void;\n getColor(bg: number, fg: number): IColor | null | undefined;\n}\n\nexport interface IPartialColorSet {\n foreground: IColor;\n background: IColor;\n cursor?: IColor;\n cursorAccent?: IColor;\n selectionBackground?: IColor;\n ansi: IColor[];\n}\n\nexport interface IViewport extends IDisposable {\n scrollBarWidth: number;\n readonly onRequestScrollLines: Event<{ amount: number, suppressScrollEvent: boolean }>;\n syncScrollArea(immediate?: boolean, force?: boolean): void;\n getLinesScrolled(ev: WheelEvent): number;\n getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement };\n handleWheel(ev: WheelEvent): boolean;\n handleTouchStart(ev: TouchEvent): void;\n handleTouchMove(ev: TouchEvent): boolean;\n scrollLines(disp: number): void; // todo api name?\n reset(): void;\n}\n\nexport interface ILinkifierEvent {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n cols: number;\n fg: number | undefined;\n}\n\ninterface ILinkState {\n decorations: ILinkDecorations;\n isHovered: boolean;\n}\nexport interface ILinkWithState {\n link: ILink;\n state?: ILinkState;\n}\n\nexport interface ILinkifier2 extends IDisposable {\n onShowLinkUnderline: Event;\n onHideLinkUnderline: Event;\n readonly currentLink: ILinkWithState | undefined;\n}\n\nexport interface ILink {\n range: IBufferRange;\n text: string;\n decorations?: ILinkDecorations;\n activate(event: MouseEvent, text: string): void;\n hover?(event: MouseEvent, text: string): void;\n leave?(event: MouseEvent, text: string): void;\n dispose?(): void;\n}\n\nexport interface ILinkDecorations {\n pointerCursor: boolean;\n underline: boolean;\n}\n\nexport interface IBufferRange {\n start: IBufferCellPosition;\n end: IBufferCellPosition;\n}\n\nexport interface IBufferCellPosition {\n x: number;\n y: number;\n}\n\nexport type CharacterJoinerHandler = (text: string) => [number, number][];\n\nexport interface ICharacterJoiner {\n id: number;\n handler: CharacterJoinerHandler;\n}\n\nexport interface IRenderDebouncer extends IDisposable {\n refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void;\n}\n\nexport interface IRenderDebouncerWithCallback extends IRenderDebouncer {\n addRefreshCallback(callback: FrameRequestCallback): number;\n}\n\nexport interface IBufferElementProvider {\n provideBufferElements(): DocumentFragment | HTMLElement;\n}\n\n// An IIFE to generate DEFAULT_ANSI_COLORS.\nexport const DEFAULT_ANSI_COLORS = Object.freeze((() => {\n const colors = [\n // dark:\n css.toColor('#2e3436'),\n css.toColor('#cc0000'),\n css.toColor('#4e9a06'),\n css.toColor('#c4a000'),\n css.toColor('#3465a4'),\n css.toColor('#75507b'),\n css.toColor('#06989a'),\n css.toColor('#d3d7cf'),\n // bright:\n css.toColor('#555753'),\n css.toColor('#ef2929'),\n css.toColor('#8ae234'),\n css.toColor('#fce94f'),\n css.toColor('#729fcf'),\n css.toColor('#ad7fa8'),\n css.toColor('#34e2e2'),\n css.toColor('#eeeeec')\n ];\n\n // Fill in the remaining 240 ANSI colors.\n // Generate colors (16-231)\n const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];\n for (let i = 0; i < 216; i++) {\n const r = v[(i / 36) % 6 | 0];\n const g = v[(i / 6) % 6 | 0];\n const b = v[i % 6];\n colors.push({\n css: channels.toCss(r, g, b),\n rgba: channels.toRgba(r, g, b)\n });\n }\n\n // Generate greys (232-255)\n for (let i = 0; i < 24; i++) {\n const c = 8 + i * 10;\n colors.push({\n css: channels.toCss(c, c, c),\n rgba: channels.toRgba(c, c, c)\n });\n }\n\n return colors;\n})());\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ColorContrastCache } from 'browser/ColorContrastCache';\nimport { IThemeService } from 'browser/services/Services';\nimport { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';\nimport { color, css, NULL_COLOR } from 'common/Color';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IOptionsService, ITheme } from 'common/services/Services';\nimport { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';\nimport { Emitter } from 'vs/base/common/event';\n\ninterface IRestoreColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n ansi: IColor[];\n}\n\n\nconst DEFAULT_FOREGROUND = css.toColor('#ffffff');\nconst DEFAULT_BACKGROUND = css.toColor('#000000');\nconst DEFAULT_CURSOR = css.toColor('#ffffff');\nconst DEFAULT_CURSOR_ACCENT = DEFAULT_BACKGROUND;\nconst DEFAULT_SELECTION = {\n css: 'rgba(255, 255, 255, 0.3)',\n rgba: 0xFFFFFF4D\n};\nconst DEFAULT_OVERVIEW_RULER_BORDER = DEFAULT_FOREGROUND;\n\nexport class ThemeService extends Disposable implements IThemeService {\n public serviceBrand: undefined;\n\n private _colors: IColorSet;\n private _contrastCache: IColorContrastCache = new ColorContrastCache();\n private _halfContrastCache: IColorContrastCache = new ColorContrastCache();\n private _restoreColors!: IRestoreColorSet;\n\n public get colors(): ReadonlyColorSet { return this._colors; }\n\n private readonly _onChangeColors = this._register(new Emitter());\n public readonly onChangeColors = this._onChangeColors.event;\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n\n this._colors = {\n foreground: DEFAULT_FOREGROUND,\n background: DEFAULT_BACKGROUND,\n cursor: DEFAULT_CURSOR,\n cursorAccent: DEFAULT_CURSOR_ACCENT,\n selectionForeground: undefined,\n selectionBackgroundTransparent: DEFAULT_SELECTION,\n selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,\n selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n scrollbarSliderBackground: color.opacity(DEFAULT_FOREGROUND, 0.2),\n scrollbarSliderHoverBackground: color.opacity(DEFAULT_FOREGROUND, 0.4),\n scrollbarSliderActiveBackground: color.opacity(DEFAULT_FOREGROUND, 0.5),\n overviewRulerBorder: DEFAULT_FOREGROUND,\n ansi: DEFAULT_ANSI_COLORS.slice(),\n contrastCache: this._contrastCache,\n halfContrastCache: this._halfContrastCache\n };\n this._updateRestoreColors();\n this._setTheme(this._optionsService.rawOptions.theme);\n\n this._register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));\n this._register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));\n }\n\n /**\n * Sets the terminal's theme.\n * @param theme The theme to use. If a partial theme is provided then default\n * colors will be used where colors are not defined.\n */\n private _setTheme(theme: ITheme = {}): void {\n const colors = this._colors;\n colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND);\n colors.background = parseColor(theme.background, DEFAULT_BACKGROUND);\n colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR);\n colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT);\n colors.selectionBackgroundTransparent = parseColor(theme.selectionBackground, DEFAULT_SELECTION);\n colors.selectionBackgroundOpaque = color.blend(colors.background, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundTransparent = parseColor(theme.selectionInactiveBackground, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundOpaque = color.blend(colors.background, colors.selectionInactiveBackgroundTransparent);\n colors.selectionForeground = theme.selectionForeground ? parseColor(theme.selectionForeground, NULL_COLOR) : undefined;\n if (colors.selectionForeground === NULL_COLOR) {\n colors.selectionForeground = undefined;\n }\n\n /**\n * If selection color is opaque, blend it with background with 0.3 opacity\n * Issue #2737\n */\n if (color.isOpaque(colors.selectionBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionBackgroundTransparent = color.opacity(colors.selectionBackgroundTransparent, opacity);\n }\n if (color.isOpaque(colors.selectionInactiveBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);\n }\n colors.scrollbarSliderBackground = parseColor(theme.scrollbarSliderBackground, color.opacity(colors.foreground, 0.2));\n colors.scrollbarSliderHoverBackground = parseColor(theme.scrollbarSliderHoverBackground, color.opacity(colors.foreground, 0.4));\n colors.scrollbarSliderActiveBackground = parseColor(theme.scrollbarSliderActiveBackground, color.opacity(colors.foreground, 0.5));\n colors.overviewRulerBorder = parseColor(theme.overviewRulerBorder, DEFAULT_OVERVIEW_RULER_BORDER);\n colors.ansi = DEFAULT_ANSI_COLORS.slice();\n colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);\n colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);\n colors.ansi[2] = parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);\n colors.ansi[3] = parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);\n colors.ansi[4] = parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);\n colors.ansi[5] = parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);\n colors.ansi[6] = parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);\n colors.ansi[7] = parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);\n colors.ansi[8] = parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);\n colors.ansi[9] = parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);\n colors.ansi[10] = parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);\n colors.ansi[11] = parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);\n colors.ansi[12] = parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);\n colors.ansi[13] = parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);\n colors.ansi[14] = parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);\n colors.ansi[15] = parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);\n if (theme.extendedAnsi) {\n const colorCount = Math.min(colors.ansi.length - 16, theme.extendedAnsi.length);\n for (let i = 0; i < colorCount; i++) {\n colors.ansi[i + 16] = parseColor(theme.extendedAnsi[i], DEFAULT_ANSI_COLORS[i + 16]);\n }\n }\n // Clear our the cache\n this._contrastCache.clear();\n this._halfContrastCache.clear();\n this._updateRestoreColors();\n this._onChangeColors.fire(this.colors);\n }\n\n public restoreColor(slot?: AllColorIndex): void {\n this._restoreColor(slot);\n this._onChangeColors.fire(this.colors);\n }\n\n private _restoreColor(slot: AllColorIndex | undefined): void {\n // unset slot restores all ansi colors\n if (slot === undefined) {\n for (let i = 0; i < this._restoreColors.ansi.length; ++i) {\n this._colors.ansi[i] = this._restoreColors.ansi[i];\n }\n return;\n }\n switch (slot) {\n case SpecialColorIndex.FOREGROUND:\n this._colors.foreground = this._restoreColors.foreground;\n break;\n case SpecialColorIndex.BACKGROUND:\n this._colors.background = this._restoreColors.background;\n break;\n case SpecialColorIndex.CURSOR:\n this._colors.cursor = this._restoreColors.cursor;\n break;\n default:\n this._colors.ansi[slot] = this._restoreColors.ansi[slot];\n }\n }\n\n public modifyColors(callback: (colors: IColorSet) => void): void {\n callback(this._colors);\n // Assume the change happened\n this._onChangeColors.fire(this.colors);\n }\n\n private _updateRestoreColors(): void {\n this._restoreColors = {\n foreground: this._colors.foreground,\n background: this._colors.background,\n cursor: this._colors.cursor,\n ansi: this._colors.ansi.slice()\n };\n }\n}\n\nfunction parseColor(\n cssString: string | undefined,\n fallback: IColor\n): IColor {\n if (cssString !== undefined) {\n try {\n return css.toColor(cssString);\n } catch {\n // no-op\n }\n }\n return fallback;\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInstantiationService, IServiceIdentifier } from 'common/services/Services';\nimport { getServiceDependencies } from 'common/services/ServiceRegistry';\n\nexport class ServiceCollection {\n\n private _entries = new Map, any>();\n\n constructor(...entries: [IServiceIdentifier, any][]) {\n for (const [id, service] of entries) {\n this.set(id, service);\n }\n }\n\n public set(id: IServiceIdentifier, instance: T): T {\n const result = this._entries.get(id);\n this._entries.set(id, instance);\n return result;\n }\n\n public forEach(callback: (id: IServiceIdentifier, instance: any) => any): void {\n for (const [key, value] of this._entries.entries()) {\n callback(key, value);\n }\n }\n\n public has(id: IServiceIdentifier): boolean {\n return this._entries.has(id);\n }\n\n public get(id: IServiceIdentifier): T | undefined {\n return this._entries.get(id);\n }\n}\n\nexport class InstantiationService implements IInstantiationService {\n public serviceBrand: undefined;\n\n private readonly _services: ServiceCollection = new ServiceCollection();\n\n constructor() {\n this._services.set(IInstantiationService, this);\n }\n\n public setService(id: IServiceIdentifier, instance: T): void {\n this._services.set(id, instance);\n }\n\n public getService(id: IServiceIdentifier): T | undefined {\n return this._services.get(id);\n }\n\n public createInstance(ctor: any, ...args: any[]): T {\n const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);\n\n const serviceArgs: any[] = [];\n for (const dependency of serviceDependencies) {\n const service = this._services.get(dependency.id);\n if (!service) {\n throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`);\n }\n serviceArgs.push(service);\n }\n\n const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;\n\n // check for argument mismatches, adjust static args if needed\n if (args.length !== firstServiceArgPos) {\n throw new Error(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);\n }\n\n // now create the instance\n return new ctor(...[...args, ...serviceArgs]);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { ILogService, IOptionsService, LogLevelEnum } from 'common/services/Services';\n\ntype LogType = (message?: any, ...optionalParams: any[]) => void;\n\ninterface IConsole {\n log: LogType;\n error: LogType;\n info: LogType;\n trace: LogType;\n warn: LogType;\n}\n\n// console is available on both node.js and browser contexts but the common\n// module doesn't depend on them so we need to explicitly declare it.\ndeclare const console: IConsole;\n\nconst optionsKeyToLogLevel: { [key: string]: LogLevelEnum } = {\n trace: LogLevelEnum.TRACE,\n debug: LogLevelEnum.DEBUG,\n info: LogLevelEnum.INFO,\n warn: LogLevelEnum.WARN,\n error: LogLevelEnum.ERROR,\n off: LogLevelEnum.OFF\n};\n\nconst LOG_PREFIX = 'xterm.js: ';\n\nexport class LogService extends Disposable implements ILogService {\n public serviceBrand: any;\n\n private _logLevel: LogLevelEnum = LogLevelEnum.OFF;\n public get logLevel(): LogLevelEnum { return this._logLevel; }\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this._updateLogLevel();\n this._register(this._optionsService.onSpecificOptionChange('logLevel', () => this._updateLogLevel()));\n\n // For trace logging, assume the latest created log service is valid\n traceLogger = this;\n }\n\n private _updateLogLevel(): void {\n this._logLevel = optionsKeyToLogLevel[this._optionsService.rawOptions.logLevel];\n }\n\n private _evalLazyOptionalParams(optionalParams: any[]): void {\n for (let i = 0; i < optionalParams.length; i++) {\n if (typeof optionalParams[i] === 'function') {\n optionalParams[i] = optionalParams[i]();\n }\n }\n }\n\n private _log(type: LogType, message: string, optionalParams: any[]): void {\n this._evalLazyOptionalParams(optionalParams);\n type.call(console, (this._optionsService.options.logger ? '' : LOG_PREFIX) + message, ...optionalParams);\n }\n\n public trace(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.TRACE) {\n this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public debug(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.DEBUG) {\n this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public info(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.INFO) {\n this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, message, optionalParams);\n }\n }\n\n public warn(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.WARN) {\n this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, message, optionalParams);\n }\n }\n\n public error(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.ERROR) {\n this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, message, optionalParams);\n }\n }\n}\n\nlet traceLogger: ILogService;\nexport function setTraceLogger(logger: ILogService): void {\n traceLogger = logger;\n}\n\n/**\n * A decorator that can be used to automatically log trace calls to the decorated function.\n */\nexport function traceCall(_target: any, key: string, descriptor: any): any {\n if (typeof descriptor.value !== 'function') {\n throw new Error('not supported');\n }\n const fnKey = 'value';\n const fn = descriptor.value;\n descriptor[fnKey] = function (...args: any[]) {\n // Early exit\n if (traceLogger.logLevel !== LogLevelEnum.TRACE) {\n return fn.apply(this, args);\n }\n\n traceLogger.trace(`GlyphRenderer#${fn.name}(${args.map(e => JSON.stringify(e)).join(', ')})`);\n const result = fn.apply(this, args);\n traceLogger.trace(`GlyphRenderer#${fn.name} return`, result);\n return result;\n };\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICircularList } from 'common/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\nexport interface IInsertEvent {\n index: number;\n amount: number;\n}\n\nexport interface IDeleteEvent {\n index: number;\n amount: number;\n}\n\n/**\n * Represents a circular list; a list with a maximum size that wraps around when push is called,\n * overriding values at the start of the list.\n */\nexport class CircularList extends Disposable implements ICircularList {\n protected _array: (T | undefined)[];\n private _startIndex: number;\n private _length: number;\n\n public readonly onDeleteEmitter = this._register(new Emitter());\n public readonly onDelete = this.onDeleteEmitter.event;\n public readonly onInsertEmitter = this._register(new Emitter());\n public readonly onInsert = this.onInsertEmitter.event;\n public readonly onTrimEmitter = this._register(new Emitter());\n public readonly onTrim = this.onTrimEmitter.event;\n\n constructor(\n private _maxLength: number\n ) {\n super();\n this._array = new Array(this._maxLength);\n this._startIndex = 0;\n this._length = 0;\n }\n\n public get maxLength(): number {\n return this._maxLength;\n }\n\n public set maxLength(newMaxLength: number) {\n // There was no change in maxLength, return early.\n if (this._maxLength === newMaxLength) {\n return;\n }\n\n // Reconstruct array, starting at index 0. Only transfer values from the\n // indexes 0 to length.\n const newArray = new Array(newMaxLength);\n for (let i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._maxLength = newMaxLength;\n this._startIndex = 0;\n }\n\n public get length(): number {\n return this._length;\n }\n\n public set length(newLength: number) {\n if (newLength > this._length) {\n for (let i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n }\n\n /**\n * Gets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index of the value to get.\n * @returns The value corresponding to the index.\n */\n public get(index: number): T | undefined {\n return this._array[this._getCyclicIndex(index)];\n }\n\n /**\n * Sets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index to set.\n * @param value The value to set.\n */\n public set(index: number, value: T | undefined): void {\n this._array[this._getCyclicIndex(index)] = value;\n }\n\n /**\n * Pushes a new value onto the list, wrapping around to the start of the array, overriding index 0\n * if the maximum length is reached.\n * @param value The value to push onto the list.\n */\n public push(value: T): void {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this._maxLength) {\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n } else {\n this._length++;\n }\n }\n\n /**\n * Advance ringbuffer index and return current element for recycling.\n * Note: The buffer must be full for this method to work.\n * @throws When the buffer is not full.\n */\n public recycle(): T {\n if (this._length !== this._maxLength) {\n throw new Error('Can only recycle when the buffer is full');\n }\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n return this._array[this._getCyclicIndex(this._length - 1)]!;\n }\n\n /**\n * Ringbuffer is at max length.\n */\n public get isFull(): boolean {\n return this._length === this._maxLength;\n }\n\n /**\n * Removes and returns the last value on the list.\n * @returns The popped value.\n */\n public pop(): T | undefined {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n }\n\n /**\n * Deletes and/or inserts items at a particular index (in that order). Unlike\n * Array.prototype.splice, this operation does not return the deleted items as a new array in\n * order to save creating a new array. Note that this operation may shift all values in the list\n * in the worst case.\n * @param start The index to delete and/or insert.\n * @param deleteCount The number of elements to delete.\n * @param items The items to insert.\n */\n public splice(start: number, deleteCount: number, ...items: T[]): void {\n // Delete items\n if (deleteCount) {\n for (let i = start; i < this._length - deleteCount; i++) {\n this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];\n }\n this._length -= deleteCount;\n this.onDeleteEmitter.fire({ index: start, amount: deleteCount });\n }\n\n // Add items\n for (let i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (let i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (items.length) {\n this.onInsertEmitter.fire({ index: start, amount: items.length });\n }\n\n // Adjust length as needed\n if (this._length + items.length > this._maxLength) {\n const countToTrim = (this._length + items.length) - this._maxLength;\n this._startIndex += countToTrim;\n this._length = this._maxLength;\n this.onTrimEmitter.fire(countToTrim);\n } else {\n this._length += items.length;\n }\n }\n\n /**\n * Trims a number of items from the start of the list.\n * @param count The number of items to remove.\n */\n public trimStart(count: number): void {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.onTrimEmitter.fire(count);\n }\n\n public shiftElements(start: number, count: number, offset: number): void {\n if (count <= 0) {\n return;\n }\n if (start < 0 || start >= this._length) {\n throw new Error('start argument out of range');\n }\n if (start + offset < 0) {\n throw new Error('Cannot shift elements in list beyond index 0');\n }\n\n if (offset > 0) {\n for (let i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n const expandListBy = (start + count + offset) - this._length;\n if (expandListBy > 0) {\n this._length += expandListBy;\n while (this._length > this._maxLength) {\n this._length--;\n this._startIndex++;\n this.onTrimEmitter.fire(1);\n }\n }\n } else {\n for (let i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n }\n\n /**\n * Gets the cyclic index for the specified regular index. The cyclic index can then be used on the\n * backing array to get the element associated with the regular index.\n * @param index The regular index.\n * @returns The cyclic index.\n */\n private _getCyclicIndex(index: number): number {\n return (this._startIndex + index) % this._maxLength;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { CellData } from 'common/buffer/CellData';\nimport { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\n\n/**\n * buffer memory layout:\n *\n * | uint32_t | uint32_t | uint32_t |\n * | `content` | `FG` | `BG` |\n * | wcwidth(2) comb(1) codepoint(21) | flags(8) R(8) G(8) B(8) | flags(8) R(8) G(8) B(8) |\n */\n\n\n/** typed array slots taken by one cell */\nconst CELL_SIZE = 3;\n\n/**\n * Cell member indices.\n *\n * Direct access:\n * `content = data[column * CELL_SIZE + Cell.CONTENT];`\n * `fg = data[column * CELL_SIZE + Cell.FG];`\n * `bg = data[column * CELL_SIZE + Cell.BG];`\n */\nconst enum Cell {\n CONTENT = 0,\n FG = 1, // currently simply holds all known attrs\n BG = 2 // currently unused\n}\n\nexport const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());\n\n// Work variables to avoid garbage collection\nlet $startIndex = 0;\n\n/** Factor when to cleanup underlying array buffer after shrinking. */\nconst CLEANUP_THRESHOLD = 2;\n\n/**\n * Typed array based bufferline implementation.\n *\n * There are 2 ways to insert data into the cell buffer:\n * - `setCellFromCodepoint` + `addCodepointToCell`\n * Use these for data that is already UTF32.\n * Used during normal input in `InputHandler` for faster buffer access.\n * - `setCell`\n * This method takes a CellData object and stores the data in the buffer.\n * Use `CellData.fromCharData` to create the CellData object (e.g. from JS string).\n *\n * To retrieve data from the buffer use either one of the primitive methods\n * (if only one particular value is needed) or `loadCell`. For `loadCell` in a loop\n * memory allocs / GC pressure can be greatly reduced by reusing the CellData object.\n */\nexport class BufferLine implements IBufferLine {\n protected _data: Uint32Array;\n protected _combined: {[index: number]: string} = {};\n protected _extendedAttrs: {[index: number]: IExtendedAttrs | undefined} = {};\n public length: number;\n\n constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {\n this._data = new Uint32Array(cols * CELL_SIZE);\n const cell = fillCellData || CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n for (let i = 0; i < cols; ++i) {\n this.setCell(i, cell);\n }\n this.length = cols;\n }\n\n /**\n * Get cell data CharData.\n * @deprecated\n */\n public get(index: number): CharData {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n return [\n this._data[index * CELL_SIZE + Cell.FG],\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index]\n : (cp) ? stringFromCodePoint(cp) : '',\n content >> Content.WIDTH_SHIFT,\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index].charCodeAt(this._combined[index].length - 1)\n : cp\n ];\n }\n\n /**\n * Set cell data from CharData.\n * @deprecated\n */\n public set(index: number, value: CharData): void {\n this._data[index * CELL_SIZE + Cell.FG] = value[CHAR_DATA_ATTR_INDEX];\n if (value[CHAR_DATA_CHAR_INDEX].length > 1) {\n this._combined[index] = value[1];\n this._data[index * CELL_SIZE + Cell.CONTENT] = index | Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n } else {\n this._data[index * CELL_SIZE + Cell.CONTENT] = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n\n /**\n * primitive getters\n * use these when only one value is needed, otherwise use `loadCell`\n */\n public getWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT;\n }\n\n /** Test whether content has width. */\n public hasWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.WIDTH_MASK;\n }\n\n /** Get FG cell component. */\n public getFg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.FG];\n }\n\n /** Get BG cell component. */\n public getBg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG];\n }\n\n /**\n * Test whether contains any chars.\n * Basically an empty has no content, but other cells might differ in FG/BG\n * from real empty cells.\n */\n public hasContent(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK;\n }\n\n /**\n * Get codepoint of the cell.\n * To be in line with `code` in CharData this either returns\n * a single UTF32 codepoint or the last codepoint of a combined string.\n */\n public getCodePoint(index: number): number {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index].charCodeAt(this._combined[index].length - 1);\n }\n return content & Content.CODEPOINT_MASK;\n }\n\n /** Test whether the cell contains a combined string. */\n public isCombined(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.IS_COMBINED_MASK;\n }\n\n /** Returns the string content of the cell. */\n public getString(index: number): string {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index];\n }\n if (content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(content & Content.CODEPOINT_MASK);\n }\n // return empty string for empty cells\n return '';\n }\n\n /** Get state of protected flag. */\n public isProtected(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG] & BgFlags.PROTECTED;\n }\n\n /**\n * Load data at `index` into `cell`. This is used to access cells in a way that's more friendly\n * to GC as it significantly reduced the amount of new objects/references needed.\n */\n public loadCell(index: number, cell: ICellData): ICellData {\n $startIndex = index * CELL_SIZE;\n cell.content = this._data[$startIndex + Cell.CONTENT];\n cell.fg = this._data[$startIndex + Cell.FG];\n cell.bg = this._data[$startIndex + Cell.BG];\n if (cell.content & Content.IS_COMBINED_MASK) {\n cell.combinedData = this._combined[index];\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n cell.extended = this._extendedAttrs[index]!;\n }\n return cell;\n }\n\n /**\n * Set data at `index` to `cell`.\n */\n public setCell(index: number, cell: ICellData): void {\n if (cell.content & Content.IS_COMBINED_MASK) {\n this._combined[index] = cell.combinedData;\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = cell.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = cell.content;\n this._data[index * CELL_SIZE + Cell.FG] = cell.fg;\n this._data[index * CELL_SIZE + Cell.BG] = cell.bg;\n }\n\n /**\n * Set cell data from input handler.\n * Since the input handler see the incoming chars as UTF32 codepoints,\n * it gets an optimized access method.\n */\n public setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void {\n if (attrs.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = attrs.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = codePoint | (width << Content.WIDTH_SHIFT);\n this._data[index * CELL_SIZE + Cell.FG] = attrs.fg;\n this._data[index * CELL_SIZE + Cell.BG] = attrs.bg;\n }\n\n /**\n * Add a codepoint to a cell from input handler.\n * During input stage combining chars with a width of 0 follow and stack\n * onto a leading char. Since we already set the attrs\n * by the previous `setDataFromCodePoint` call, we can omit it here.\n */\n public addCodepointToCell(index: number, codePoint: number, width: number): void {\n let content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n // we already have a combined string, simply add\n this._combined[index] += stringFromCodePoint(codePoint);\n } else {\n if (content & Content.CODEPOINT_MASK) {\n // normal case for combining chars:\n // - move current leading char + new one into combined string\n // - set combined flag\n this._combined[index] = stringFromCodePoint(content & Content.CODEPOINT_MASK) + stringFromCodePoint(codePoint);\n content &= ~Content.CODEPOINT_MASK; // set codepoint in buffer to 0\n content |= Content.IS_COMBINED_MASK;\n } else {\n // should not happen - we actually have no data in the cell yet\n // simply set the data in the cell buffer with a width of 1\n content = codePoint | (1 << Content.WIDTH_SHIFT);\n }\n }\n if (width) {\n content &= ~Content.WIDTH_MASK;\n content |= width << Content.WIDTH_SHIFT;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = content;\n }\n\n public insertCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n\n // handle fullwidth at pos: reset cell one to the left if pos is second cell of a wide char\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = this.length - pos - n - 1; i >= 0; --i) {\n this.setCell(pos + n + i, this.loadCell(pos + i, cell));\n }\n for (let i = 0; i < n; ++i) {\n this.setCell(pos + i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at line end: reset last cell if it is first cell of a wide char\n if (this.getWidth(this.length - 1) === 2) {\n this.setCellFromCodepoint(this.length - 1, 0, 1, fillCellData);\n }\n }\n\n public deleteCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = 0; i < this.length - pos - n; ++i) {\n this.setCell(pos + i, this.loadCell(pos + n + i, cell));\n }\n for (let i = this.length - n; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at pos:\n // - reset pos-1 if wide char\n // - reset pos if width==0 (previous second cell of a wide char)\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n if (this.getWidth(pos) === 0 && !this.hasContent(pos)) {\n this.setCellFromCodepoint(pos, 0, 1, fillCellData);\n }\n }\n\n public replaceCells(start: number, end: number, fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n if (start && this.getWidth(start - 1) === 2 && !this.isProtected(start - 1)) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n if (end < this.length && this.getWidth(end - 1) === 2 && !this.isProtected(end)) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n while (start < end && start < this.length) {\n if (!this.isProtected(start)) {\n this.setCell(start, fillCellData);\n }\n start++;\n }\n return;\n }\n\n // handle fullwidth at start: reset cell one to the left if start is second cell of a wide char\n if (start && this.getWidth(start - 1) === 2) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n // handle fullwidth at last cell + 1: reset to empty cell if it is second part of a wide char\n if (end < this.length && this.getWidth(end - 1) === 2) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n\n while (start < end && start < this.length) {\n this.setCell(start++, fillCellData);\n }\n }\n\n /**\n * Resize BufferLine to `cols` filling excess cells with `fillCellData`.\n * The underlying array buffer will not change if there is still enough space\n * to hold the new buffer line data.\n * Returns a boolean indicating, whether a `cleanupMemory` call would free\n * excess memory (true after shrinking > CLEANUP_THRESHOLD).\n */\n public resize(cols: number, fillCellData: ICellData): boolean {\n if (cols === this.length) {\n return this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n const uint32Cells = cols * CELL_SIZE;\n if (cols > this.length) {\n if (this._data.buffer.byteLength >= uint32Cells * 4) {\n // optimization: avoid alloc and data copy if buffer has enough room\n this._data = new Uint32Array(this._data.buffer, 0, uint32Cells);\n } else {\n // slow path: new alloc and full data copy\n const data = new Uint32Array(uint32Cells);\n data.set(this._data);\n this._data = data;\n }\n for (let i = this.length; i < cols; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n // optimization: just shrink the view on existing buffer\n this._data = this._data.subarray(0, uint32Cells);\n // Remove any cut off combined data\n const keys = Object.keys(this._combined);\n for (let i = 0; i < keys.length; i++) {\n const key = parseInt(keys[i], 10);\n if (key >= cols) {\n delete this._combined[key];\n }\n }\n // remove any cut off extended attributes\n const extKeys = Object.keys(this._extendedAttrs);\n for (let i = 0; i < extKeys.length; i++) {\n const key = parseInt(extKeys[i], 10);\n if (key >= cols) {\n delete this._extendedAttrs[key];\n }\n }\n }\n this.length = cols;\n return uint32Cells * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n\n /**\n * Cleanup underlying array buffer.\n * A cleanup will be triggered if the array buffer exceeds the actual used\n * memory by a factor of CLEANUP_THRESHOLD.\n * Returns 0 or 1 indicating whether a cleanup happened.\n */\n public cleanupMemory(): number {\n if (this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength) {\n const data = new Uint32Array(this._data.length);\n data.set(this._data);\n this._data = data;\n return 1;\n }\n return 0;\n }\n\n /** fill a line with fillCharData */\n public fill(fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n for (let i = 0; i < this.length; ++i) {\n if (!this.isProtected(i)) {\n this.setCell(i, fillCellData);\n }\n }\n return;\n }\n this._combined = {};\n this._extendedAttrs = {};\n for (let i = 0; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n /** alter to a full copy of line */\n public copyFrom(line: BufferLine): void {\n if (this.length !== line.length) {\n this._data = new Uint32Array(line._data);\n } else {\n // use high speed copy if lengths are equal\n this._data.set(line._data);\n }\n this.length = line.length;\n this._combined = {};\n for (const el in line._combined) {\n this._combined[el] = line._combined[el];\n }\n this._extendedAttrs = {};\n for (const el in line._extendedAttrs) {\n this._extendedAttrs[el] = line._extendedAttrs[el];\n }\n this.isWrapped = line.isWrapped;\n }\n\n /** create a new clone */\n public clone(): IBufferLine {\n const newLine = new BufferLine(0);\n newLine._data = new Uint32Array(this._data);\n newLine.length = this.length;\n for (const el in this._combined) {\n newLine._combined[el] = this._combined[el];\n }\n for (const el in this._extendedAttrs) {\n newLine._extendedAttrs[el] = this._extendedAttrs[el];\n }\n newLine.isWrapped = this.isWrapped;\n return newLine;\n }\n\n public getTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public getNoBgTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK) || (this._data[i * CELL_SIZE + Cell.BG] & Attributes.CM_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number, applyInReverse: boolean): void {\n const srcData = src._data;\n if (applyInReverse) {\n for (let cell = length - 1; cell >= 0; cell--) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n } else {\n for (let cell = 0; cell < length; cell++) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n }\n\n // Move any combined data over as needed, FIXME: repeat for extended attrs\n const srcCombinedKeys = Object.keys(src._combined);\n for (let i = 0; i < srcCombinedKeys.length; i++) {\n const key = parseInt(srcCombinedKeys[i], 10);\n if (key >= srcCol) {\n this._combined[key - srcCol + destCol] = src._combined[key];\n }\n }\n }\n\n /**\n * Translates the buffer line to a string.\n *\n * @param trimRight Whether to trim any empty cells on the right.\n * @param startCol The column to start the string (0-based inclusive).\n * @param endCol The column to end the string (0-based exclusive).\n * @param outColumns if specified, this array will be filled with column numbers such that\n * `returnedString[i]` is displayed at `outColumns[i]` column. `outColumns[returnedString.length]`\n * is where the character following `returnedString` will be displayed.\n *\n * When a single cell is translated to multiple UTF-16 code units (e.g. surrogate pair) in the\n * returned string, the corresponding entries in `outColumns` will have the same column number.\n */\n public translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string {\n startCol = startCol ?? 0;\n endCol = endCol ?? this.length;\n if (trimRight) {\n endCol = Math.min(endCol, this.getTrimmedLength());\n }\n if (outColumns) {\n outColumns.length = 0;\n }\n let result = '';\n while (startCol < endCol) {\n const content = this._data[startCol * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n const chars = (content & Content.IS_COMBINED_MASK) ? this._combined[startCol] : (cp) ? stringFromCodePoint(cp) : WHITESPACE_CELL_CHAR;\n result += chars;\n if (outColumns) {\n for (let i = 0; i < chars.length; ++i) {\n outColumns.push(startCol);\n }\n }\n startCol += (content >> Content.WIDTH_SHIFT) || 1; // always advance by at least 1\n }\n if (outColumns) {\n outColumns.push(startCol);\n }\n return result;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { BufferLine } from 'common/buffer/BufferLine';\nimport { CircularList } from 'common/CircularList';\nimport { IBufferLine, ICellData } from 'common/Types';\n\nexport interface INewLayoutResult {\n layout: number[];\n countRemoved: number;\n}\n\n/**\n * Evaluates and returns indexes to be removed after a reflow larger occurs. Lines will be removed\n * when a wrapped line unwraps.\n * @param lines The buffer lines.\n * @param oldCols The columns before resize\n * @param newCols The columns after resize.\n * @param bufferAbsoluteY The absolute y position of the cursor (baseY + cursorY).\n * @param nullCell The cell data to use when filling in empty cells.\n */\nexport function reflowLargerGetLinesToRemove(lines: CircularList, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData): number[] {\n // Gather all BufferLines that need to be removed from the Buffer here so that they can be\n // batched up and only committed once\n const toRemove: number[] = [];\n\n for (let y = 0; y < lines.length - 1; y++) {\n // Check if this row is wrapped\n let i = y;\n let nextLine = lines.get(++i) as BufferLine;\n if (!nextLine.isWrapped) {\n continue;\n }\n\n // Check how many lines it's wrapped for\n const wrappedLines: BufferLine[] = [lines.get(y) as BufferLine];\n while (i < lines.length && nextLine.isWrapped) {\n wrappedLines.push(nextLine);\n nextLine = lines.get(++i) as BufferLine;\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up wrapped\n // lines with the cursor\n if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {\n y += wrappedLines.length - 1;\n continue;\n }\n\n // Copy buffer data to new locations\n let destLineIndex = 0;\n let destCol = getWrappedLineTrimmedLength(wrappedLines, destLineIndex, oldCols);\n let srcLineIndex = 1;\n let srcCol = 0;\n while (srcLineIndex < wrappedLines.length) {\n const srcTrimmedTineLength = getWrappedLineTrimmedLength(wrappedLines, srcLineIndex, oldCols);\n const srcRemainingCells = srcTrimmedTineLength - srcCol;\n const destRemainingCells = newCols - destCol;\n const cellsToCopy = Math.min(srcRemainingCells, destRemainingCells);\n\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol, destCol, cellsToCopy, false);\n\n destCol += cellsToCopy;\n if (destCol === newCols) {\n destLineIndex++;\n destCol = 0;\n }\n srcCol += cellsToCopy;\n if (srcCol === srcTrimmedTineLength) {\n srcLineIndex++;\n srcCol = 0;\n }\n\n // Make sure the last cell isn't wide, if it is copy it to the current dest\n if (destCol === 0 && destLineIndex !== 0) {\n if (wrappedLines[destLineIndex - 1].getWidth(newCols - 1) === 2) {\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[destLineIndex - 1], newCols - 1, destCol++, 1, false);\n // Null out the end of the last row\n wrappedLines[destLineIndex - 1].setCell(newCols - 1, nullCell);\n }\n }\n }\n\n // Clear out remaining cells or fragments could remain;\n wrappedLines[destLineIndex].replaceCells(destCol, newCols, nullCell);\n\n // Work backwards and remove any rows at the end that only contain null cells\n let countToRemove = 0;\n for (let i = wrappedLines.length - 1; i > 0; i--) {\n if (i > destLineIndex || wrappedLines[i].getTrimmedLength() === 0) {\n countToRemove++;\n } else {\n break;\n }\n }\n\n if (countToRemove > 0) {\n toRemove.push(y + wrappedLines.length - countToRemove); // index\n toRemove.push(countToRemove);\n }\n\n y += wrappedLines.length - 1;\n }\n return toRemove;\n}\n\n/**\n * Creates and return the new layout for lines given an array of indexes to be removed.\n * @param lines The buffer lines.\n * @param toRemove The indexes to remove.\n */\nexport function reflowLargerCreateNewLayout(lines: CircularList, toRemove: number[]): INewLayoutResult {\n const layout: number[] = [];\n // First iterate through the list and get the actual indexes to use for rows\n let nextToRemoveIndex = 0;\n let nextToRemoveStart = toRemove[nextToRemoveIndex];\n let countRemovedSoFar = 0;\n for (let i = 0; i < lines.length; i++) {\n if (nextToRemoveStart === i) {\n const countToRemove = toRemove[++nextToRemoveIndex];\n\n // Tell markers that there was a deletion\n lines.onDeleteEmitter.fire({\n index: i - countRemovedSoFar,\n amount: countToRemove\n });\n\n i += countToRemove - 1;\n countRemovedSoFar += countToRemove;\n nextToRemoveStart = toRemove[++nextToRemoveIndex];\n } else {\n layout.push(i);\n }\n }\n return {\n layout,\n countRemoved: countRemovedSoFar\n };\n}\n\n/**\n * Applies a new layout to the buffer. This essentially does the same as many splice calls but it's\n * done all at once in a single iteration through the list since splice is very expensive.\n * @param lines The buffer lines.\n * @param newLayout The new layout to apply.\n */\nexport function reflowLargerApplyNewLayout(lines: CircularList, newLayout: number[]): void {\n // Record original lines so they don't get overridden when we rearrange the list\n const newLayoutLines: BufferLine[] = [];\n for (let i = 0; i < newLayout.length; i++) {\n newLayoutLines.push(lines.get(newLayout[i]) as BufferLine);\n }\n\n // Rearrange the list\n for (let i = 0; i < newLayoutLines.length; i++) {\n lines.set(i, newLayoutLines[i]);\n }\n lines.length = newLayout.length;\n}\n\n/**\n * Gets the new line lengths for a given wrapped line. The purpose of this function it to pre-\n * compute the wrapping points since wide characters may need to be wrapped onto the following line.\n * This function will return an array of numbers of where each line wraps to, the resulting array\n * will only contain the values `newCols` (when the line does not end with a wide character) and\n * `newCols - 1` (when the line does end with a wide character), except for the last value which\n * will contain the remaining items to fill the line.\n *\n * Calling this with a `newCols` value of `1` will lock up.\n *\n * @param wrappedLines The wrapped lines to evaluate.\n * @param oldCols The columns before resize.\n * @param newCols The columns after resize.\n */\nexport function reflowSmallerGetNewLineLengths(wrappedLines: BufferLine[], oldCols: number, newCols: number): number[] {\n const newLineLengths: number[] = [];\n const cellsNeeded = wrappedLines.map((l, i) => getWrappedLineTrimmedLength(wrappedLines, i, oldCols)).reduce((p, c) => p + c);\n\n // Use srcCol and srcLine to find the new wrapping point, use that to get the cellsAvailable and\n // linesNeeded\n let srcCol = 0;\n let srcLine = 0;\n let cellsAvailable = 0;\n while (cellsAvailable < cellsNeeded) {\n if (cellsNeeded - cellsAvailable < newCols) {\n // Add the final line and exit the loop\n newLineLengths.push(cellsNeeded - cellsAvailable);\n break;\n }\n srcCol += newCols;\n const oldTrimmedLength = getWrappedLineTrimmedLength(wrappedLines, srcLine, oldCols);\n if (srcCol > oldTrimmedLength) {\n srcCol -= oldTrimmedLength;\n srcLine++;\n }\n const endsWithWide = wrappedLines[srcLine].getWidth(srcCol - 1) === 2;\n if (endsWithWide) {\n srcCol--;\n }\n const lineLength = endsWithWide ? newCols - 1 : newCols;\n newLineLengths.push(lineLength);\n cellsAvailable += lineLength;\n }\n\n return newLineLengths;\n}\n\nexport function getWrappedLineTrimmedLength(lines: BufferLine[], i: number, cols: number): number {\n // If this is the last row in the wrapped line, get the actual trimmed length\n if (i === lines.length - 1) {\n return lines[i].getTrimmedLength();\n }\n // Detect whether the following line starts with a wide character and the end of the current line\n // is null, if so then we can be pretty sure the null character should be excluded from the line\n // length]\n const endsInNull = !(lines[i].hasContent(cols - 1)) && lines[i].getWidth(cols - 1) === 1;\n const followingLineStartsWithWide = lines[i + 1].getWidth(0) === 2;\n if (endsInNull && followingLineStartsWithWide) {\n return cols - 1;\n }\n return cols;\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable, IMarker } from 'common/Types';\nimport { Emitter } from 'vs/base/common/event';\nimport { dispose } from 'vs/base/common/lifecycle';\n\nexport class Marker implements IMarker {\n private static _nextId = 1;\n\n public isDisposed: boolean = false;\n private readonly _disposables: IDisposable[] = [];\n\n private readonly _id: number = Marker._nextId++;\n public get id(): number { return this._id; }\n\n private readonly _onDispose = this.register(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n constructor(\n public line: number\n ) {\n }\n\n public dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.line = -1;\n // Emit before super.dispose such that dispose listeners get a change to react\n this._onDispose.fire();\n dispose(this._disposables);\n this._disposables.length = 0;\n }\n\n public register(disposable: T): T {\n this._disposables.push(disposable);\n return disposable;\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharset } from 'common/Types';\n\n/**\n * The character sets supported by the terminal. These enable several languages\n * to be represented within the terminal with only 8-bit encoding. See ISO 2022\n * for a discussion on character sets. Only VT100 character sets are supported.\n */\nexport const CHARSETS: { [key: string]: ICharset | undefined } = {};\n\n/**\n * The default character set, US.\n */\nexport const DEFAULT_CHARSET: ICharset | undefined = CHARSETS['B'];\n\n/**\n * DEC Special Character and Line Drawing Set.\n * Reference: http://vt100.net/docs/vt102-ug/table5-13.html\n * A lot of curses apps use this if they see TERM=xterm.\n * testing: echo -e '\\e(0a\\e(B'\n * The xterm output sometimes seems to conflict with the\n * reference above. xterm seems in line with the reference\n * when running vttest however.\n * The table below now uses xterm's output from vttest.\n */\nCHARSETS['0'] = {\n '`': '\\u25c6', // '\u25C6'\n 'a': '\\u2592', // '\u2592'\n 'b': '\\u2409', // '\u2409' (HT)\n 'c': '\\u240c', // '\u240C' (FF)\n 'd': '\\u240d', // '\u240D' (CR)\n 'e': '\\u240a', // '\u240A' (LF)\n 'f': '\\u00b0', // '\u00B0'\n 'g': '\\u00b1', // '\u00B1'\n 'h': '\\u2424', // '\u2424' (NL)\n 'i': '\\u240b', // '\u240B' (VT)\n 'j': '\\u2518', // '\u2518'\n 'k': '\\u2510', // '\u2510'\n 'l': '\\u250c', // '\u250C'\n 'm': '\\u2514', // '\u2514'\n 'n': '\\u253c', // '\u253C'\n 'o': '\\u23ba', // '\u23BA'\n 'p': '\\u23bb', // '\u23BB'\n 'q': '\\u2500', // '\u2500'\n 'r': '\\u23bc', // '\u23BC'\n 's': '\\u23bd', // '\u23BD'\n 't': '\\u251c', // '\u251C'\n 'u': '\\u2524', // '\u2524'\n 'v': '\\u2534', // '\u2534'\n 'w': '\\u252c', // '\u252C'\n 'x': '\\u2502', // '\u2502'\n 'y': '\\u2264', // '\u2264'\n 'z': '\\u2265', // '\u2265'\n '{': '\\u03c0', // '\u03C0'\n '|': '\\u2260', // '\u2260'\n '}': '\\u00a3', // '\u00A3'\n '~': '\\u00b7' // '\u00B7'\n};\n\n/**\n * British character set\n * ESC (A\n * Reference: http://vt100.net/docs/vt220-rm/table2-5.html\n */\nCHARSETS['A'] = {\n '#': '\u00A3'\n};\n\n/**\n * United States character set\n * ESC (B\n */\nCHARSETS['B'] = undefined;\n\n/**\n * Dutch character set\n * ESC (4\n * Reference: http://vt100.net/docs/vt220-rm/table2-6.html\n */\nCHARSETS['4'] = {\n '#': '\u00A3',\n '@': '\u00BE',\n '[': 'ij',\n '\\\\': '\u00BD',\n ']': '|',\n '{': '\u00A8',\n '|': 'f',\n '}': '\u00BC',\n '~': '\u00B4'\n};\n\n/**\n * Finnish character set\n * ESC (C or ESC (5\n * Reference: http://vt100.net/docs/vt220-rm/table2-7.html\n */\nCHARSETS['C'] =\nCHARSETS['5'] = {\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E9',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * French character set\n * ESC (R\n * Reference: http://vt100.net/docs/vt220-rm/table2-8.html\n */\nCHARSETS['R'] = {\n '#': '\u00A3',\n '@': '\u00E0',\n '[': '\u00B0',\n '\\\\': '\u00E7',\n ']': '\u00A7',\n '{': '\u00E9',\n '|': '\u00F9',\n '}': '\u00E8',\n '~': '\u00A8'\n};\n\n/**\n * French Canadian character set\n * ESC (Q\n * Reference: http://vt100.net/docs/vt220-rm/table2-9.html\n */\nCHARSETS['Q'] = {\n '@': '\u00E0',\n '[': '\u00E2',\n '\\\\': '\u00E7',\n ']': '\u00EA',\n '^': '\u00EE',\n '`': '\u00F4',\n '{': '\u00E9',\n '|': '\u00F9',\n '}': '\u00E8',\n '~': '\u00FB'\n};\n\n/**\n * German character set\n * ESC (K\n * Reference: http://vt100.net/docs/vt220-rm/table2-10.html\n */\nCHARSETS['K'] = {\n '@': '\u00A7',\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00DC',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00FC',\n '~': '\u00DF'\n};\n\n/**\n * Italian character set\n * ESC (Y\n * Reference: http://vt100.net/docs/vt220-rm/table2-11.html\n */\nCHARSETS['Y'] = {\n '#': '\u00A3',\n '@': '\u00A7',\n '[': '\u00B0',\n '\\\\': '\u00E7',\n ']': '\u00E9',\n '`': '\u00F9',\n '{': '\u00E0',\n '|': '\u00F2',\n '}': '\u00E8',\n '~': '\u00EC'\n};\n\n/**\n * Norwegian/Danish character set\n * ESC (E or ESC (6\n * Reference: http://vt100.net/docs/vt220-rm/table2-12.html\n */\nCHARSETS['E'] =\nCHARSETS['6'] = {\n '@': '\u00C4',\n '[': '\u00C6',\n '\\\\': '\u00D8',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E4',\n '{': '\u00E6',\n '|': '\u00F8',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * Spanish character set\n * ESC (Z\n * Reference: http://vt100.net/docs/vt220-rm/table2-13.html\n */\nCHARSETS['Z'] = {\n '#': '\u00A3',\n '@': '\u00A7',\n '[': '\u00A1',\n '\\\\': '\u00D1',\n ']': '\u00BF',\n '{': '\u00B0',\n '|': '\u00F1',\n '}': '\u00E7'\n};\n\n/**\n * Swedish character set\n * ESC (H or ESC (7\n * Reference: http://vt100.net/docs/vt220-rm/table2-14.html\n */\nCHARSETS['H'] =\nCHARSETS['7'] = {\n '@': '\u00C9',\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E9',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * Swiss character set\n * ESC (=\n * Reference: http://vt100.net/docs/vt220-rm/table2-15.html\n */\nCHARSETS['='] = {\n '#': '\u00F9',\n '@': '\u00E0',\n '[': '\u00E9',\n '\\\\': '\u00E7',\n ']': '\u00EA',\n '^': '\u00EE',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n '_': '\u00E8',\n '`': '\u00F4',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00FC',\n '~': '\u00FB'\n};\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CircularList, IInsertEvent } from 'common/CircularList';\nimport { IdleTaskQueue } from 'common/TaskQueue';\nimport { IAttributeData, IBufferLine, ICellData, ICharset } from 'common/Types';\nimport { ExtendedAttrs } from 'common/buffer/AttributeData';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths } from 'common/buffer/BufferReflow';\nimport { CellData } from 'common/buffer/CellData';\nimport { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from 'common/buffer/Constants';\nimport { Marker } from 'common/buffer/Marker';\nimport { IBuffer } from 'common/buffer/Types';\nimport { DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\nexport const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1\n\n/**\n * This class represents a terminal buffer (an internal state of the terminal), where the\n * following information is stored (in high-level):\n * - text content of this particular buffer\n * - cursor position\n * - scroll position\n */\nexport class Buffer implements IBuffer {\n public lines: CircularList;\n public ydisp: number = 0;\n public ybase: number = 0;\n public y: number = 0;\n public x: number = 0;\n public scrollBottom: number;\n public scrollTop: number;\n public tabs: { [column: number]: boolean | undefined } = {};\n public savedY: number = 0;\n public savedX: number = 0;\n public savedCurAttrData = DEFAULT_ATTR_DATA.clone();\n public savedCharset: ICharset | undefined = DEFAULT_CHARSET;\n public markers: Marker[] = [];\n private _nullCell: ICellData = CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);\n private _cols: number;\n private _rows: number;\n private _isClearing: boolean = false;\n\n constructor(\n private _hasScrollback: boolean,\n private _optionsService: IOptionsService,\n private _bufferService: IBufferService\n ) {\n this._cols = this._bufferService.cols;\n this._rows = this._bufferService.rows;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n public getNullCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._nullCell.fg = attr.fg;\n this._nullCell.bg = attr.bg;\n this._nullCell.extended = attr.extended;\n } else {\n this._nullCell.fg = 0;\n this._nullCell.bg = 0;\n this._nullCell.extended = new ExtendedAttrs();\n }\n return this._nullCell;\n }\n\n public getWhitespaceCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._whitespaceCell.fg = attr.fg;\n this._whitespaceCell.bg = attr.bg;\n this._whitespaceCell.extended = attr.extended;\n } else {\n this._whitespaceCell.fg = 0;\n this._whitespaceCell.bg = 0;\n this._whitespaceCell.extended = new ExtendedAttrs();\n }\n return this._whitespaceCell;\n }\n\n public getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {\n return new BufferLine(this._bufferService.cols, this.getNullCell(attr), isWrapped);\n }\n\n public get hasScrollback(): boolean {\n return this._hasScrollback && this.lines.maxLength > this._rows;\n }\n\n public get isCursorInViewport(): boolean {\n const absoluteY = this.ybase + this.y;\n const relativeY = absoluteY - this.ydisp;\n return (relativeY >= 0 && relativeY < this._rows);\n }\n\n /**\n * Gets the correct buffer length based on the rows provided, the terminal's\n * scrollback and whether this buffer is flagged to have scrollback or not.\n * @param rows The terminal rows to use in the calculation.\n */\n private _getCorrectBufferLength(rows: number): number {\n if (!this._hasScrollback) {\n return rows;\n }\n\n const correctBufferLength = rows + this._optionsService.rawOptions.scrollback;\n\n return correctBufferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBufferLength;\n }\n\n /**\n * Fills the buffer's viewport with blank lines.\n */\n public fillViewportRows(fillAttr?: IAttributeData): void {\n if (this.lines.length === 0) {\n if (fillAttr === undefined) {\n fillAttr = DEFAULT_ATTR_DATA;\n }\n let i = this._rows;\n while (i--) {\n this.lines.push(this.getBlankLine(fillAttr));\n }\n }\n }\n\n /**\n * Clears the buffer to it's initial state, discarding all previous data.\n */\n public clear(): void {\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n this.x = 0;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n /**\n * Resizes the buffer, adjusting its data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n // store reference to null cell with default attrs\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n\n // count bufferlines with overly big memory to be cleaned afterwards\n let dirtyMemoryLines = 0;\n\n // Increase max length if needed before adjustments to allow space to fill\n // as required.\n const newMaxLength = this._getCorrectBufferLength(newRows);\n if (newMaxLength > this.lines.maxLength) {\n this.lines.maxLength = newMaxLength;\n }\n\n // if (this._cols > newCols) {\n // console.log('increase!');\n // }\n\n // The following adjustments should only happen if the buffer has been\n // initialized/filled.\n if (this.lines.length > 0) {\n // Deal with columns increasing (reducing needs to happen after reflow)\n if (this._cols < newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n\n // Resize rows in both directions as needed\n let addToY = 0;\n if (this._rows < newRows) {\n for (let y = this._rows; y < newRows; y++) {\n if (this.lines.length < newRows + this.ybase) {\n if (this._optionsService.rawOptions.windowsMode || this._optionsService.rawOptions.windowsPty.backend !== undefined || this._optionsService.rawOptions.windowsPty.buildNumber !== undefined) {\n // Just add the new missing rows on Windows as conpty reprints the screen with it's\n // view of the world. Once a line enters scrollback for conpty it remains there\n this.lines.push(new BufferLine(newCols, nullCell));\n } else {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n // There is room above the buffer and there are no empty elements below the line,\n // scroll up\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n // Viewport is at the top of the buffer, must increase downwards\n this.ydisp--;\n }\n } else {\n // Add a blank line if there is no buffer left at the top to scroll to, or if there\n // are blank lines after the cursor\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n }\n }\n }\n } else { // (this._rows >= newRows)\n for (let y = this._rows; y > newRows; y--) {\n if (this.lines.length > newRows + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n // The line is a blank line below the cursor, remove it\n this.lines.pop();\n } else {\n // The line is the cursor, scroll down\n this.ybase++;\n this.ydisp++;\n }\n }\n }\n }\n\n // Reduce max length if needed after adjustments, this is done after as it\n // would otherwise cut data from the bottom of the buffer.\n if (newMaxLength < this.lines.maxLength) {\n // Trim from the top of the buffer and adjust ybase and ydisp.\n const amountToTrim = this.lines.length - newMaxLength;\n if (amountToTrim > 0) {\n this.lines.trimStart(amountToTrim);\n this.ybase = Math.max(this.ybase - amountToTrim, 0);\n this.ydisp = Math.max(this.ydisp - amountToTrim, 0);\n this.savedY = Math.max(this.savedY - amountToTrim, 0);\n }\n this.lines.maxLength = newMaxLength;\n }\n\n // Make sure that the cursor stays on screen\n this.x = Math.min(this.x, newCols - 1);\n this.y = Math.min(this.y, newRows - 1);\n if (addToY) {\n this.y += addToY;\n }\n this.savedX = Math.min(this.savedX, newCols - 1);\n\n this.scrollTop = 0;\n }\n\n this.scrollBottom = newRows - 1;\n\n if (this._isReflowEnabled) {\n this._reflow(newCols, newRows);\n\n // Trim the end of the line off if cols shrunk\n if (this._cols > newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n }\n\n this._cols = newCols;\n this._rows = newRows;\n\n this._memoryCleanupQueue.clear();\n // schedule memory cleanup only, if more than 10% of the lines are affected\n if (dirtyMemoryLines > 0.1 * this.lines.length) {\n this._memoryCleanupPosition = 0;\n this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup());\n }\n }\n\n private _memoryCleanupQueue = new IdleTaskQueue();\n private _memoryCleanupPosition = 0;\n\n private _batchedMemoryCleanup(): boolean {\n let normalRun = true;\n if (this._memoryCleanupPosition >= this.lines.length) {\n // cleanup made it once through all lines, thus rescan in loop below to also catch shifted\n // lines, which should finish rather quick if there are no more cleanups pending\n this._memoryCleanupPosition = 0;\n normalRun = false;\n }\n let counted = 0;\n while (this._memoryCleanupPosition < this.lines.length) {\n counted += this.lines.get(this._memoryCleanupPosition++)!.cleanupMemory();\n // cleanup max 100 lines per batch\n if (counted > 100) {\n return true;\n }\n }\n // normal runs always need another rescan afterwards\n // if we made it here with normalRun=false, we are in a final run\n // and can end the cleanup task for sure\n return normalRun;\n }\n\n private get _isReflowEnabled(): boolean {\n const windowsPty = this._optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber) {\n return this._hasScrollback && windowsPty.backend === 'conpty' && windowsPty.buildNumber >= 21376;\n }\n return this._hasScrollback && !this._optionsService.rawOptions.windowsMode;\n }\n\n private _reflow(newCols: number, newRows: number): void {\n if (this._cols === newCols) {\n return;\n }\n\n // Iterate through rows, ignore the last one as it cannot be wrapped\n if (newCols > this._cols) {\n this._reflowLarger(newCols, newRows);\n } else {\n this._reflowSmaller(newCols, newRows);\n }\n }\n\n private _reflowLarger(newCols: number, newRows: number): void {\n const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA));\n if (toRemove.length > 0) {\n const newLayoutResult = reflowLargerCreateNewLayout(this.lines, toRemove);\n reflowLargerApplyNewLayout(this.lines, newLayoutResult.layout);\n this._reflowLargerAdjustViewport(newCols, newRows, newLayoutResult.countRemoved);\n }\n }\n\n private _reflowLargerAdjustViewport(newCols: number, newRows: number, countRemoved: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Adjust viewport based on number of items removed\n let viewportAdjustments = countRemoved;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y > 0) {\n this.y--;\n }\n if (this.lines.length < newRows) {\n // Add an extra row at the bottom of the viewport\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n } else {\n if (this.ydisp === this.ybase) {\n this.ydisp--;\n }\n this.ybase--;\n }\n }\n this.savedY = Math.max(this.savedY - countRemoved, 0);\n }\n\n private _reflowSmaller(newCols: number, newRows: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Gather all BufferLines that need to be inserted into the Buffer here so that they can be\n // batched up and only committed once\n const toInsert = [];\n let countToInsert = 0;\n // Go backwards as many lines may be trimmed and this will avoid considering them\n for (let y = this.lines.length - 1; y >= 0; y--) {\n // Check whether this line is a problem\n let nextLine = this.lines.get(y) as BufferLine;\n if (!nextLine || !nextLine.isWrapped && nextLine.getTrimmedLength() <= newCols) {\n continue;\n }\n\n // Gather wrapped lines and adjust y to be the starting line\n const wrappedLines: BufferLine[] = [nextLine];\n while (nextLine.isWrapped && y > 0) {\n nextLine = this.lines.get(--y) as BufferLine;\n wrappedLines.unshift(nextLine);\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n const absoluteY = this.ybase + this.y;\n if (absoluteY >= y && absoluteY < y + wrappedLines.length) {\n continue;\n }\n\n const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();\n const destLineLengths = reflowSmallerGetNewLineLengths(wrappedLines, this._cols, newCols);\n const linesToAdd = destLineLengths.length - wrappedLines.length;\n let trimmedLines: number;\n if (this.ybase === 0 && this.y !== this.lines.length - 1) {\n // If the top section of the buffer is not yet filled\n trimmedLines = Math.max(0, this.y - this.lines.maxLength + linesToAdd);\n } else {\n trimmedLines = Math.max(0, this.lines.length - this.lines.maxLength + linesToAdd);\n }\n\n // Add the new lines\n const newLines: BufferLine[] = [];\n for (let i = 0; i < linesToAdd; i++) {\n const newLine = this.getBlankLine(DEFAULT_ATTR_DATA, true) as BufferLine;\n newLines.push(newLine);\n }\n if (newLines.length > 0) {\n toInsert.push({\n // countToInsert here gets the actual index, taking into account other inserted items.\n // using this we can iterate through the list forwards\n start: y + wrappedLines.length + countToInsert,\n newLines\n });\n countToInsert += newLines.length;\n }\n wrappedLines.push(...newLines);\n\n // Copy buffer data to new locations, this needs to happen backwards to do in-place\n let destLineIndex = destLineLengths.length - 1; // Math.floor(cellsNeeded / newCols);\n let destCol = destLineLengths[destLineIndex]; // cellsNeeded % newCols;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n let srcLineIndex = wrappedLines.length - linesToAdd - 1;\n let srcCol = lastLineLength;\n while (srcLineIndex >= 0) {\n const cellsToCopy = Math.min(srcCol, destCol);\n if (wrappedLines[destLineIndex] === undefined) {\n // Sanity check that the line exists, this has been known to fail for an unknown reason\n // which would stop the reflow from happening if an exception would throw.\n break;\n }\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol - cellsToCopy, destCol - cellsToCopy, cellsToCopy, true);\n destCol -= cellsToCopy;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n srcCol -= cellsToCopy;\n if (srcCol === 0) {\n srcLineIndex--;\n const wrappedLinesIndex = Math.max(srcLineIndex, 0);\n srcCol = getWrappedLineTrimmedLength(wrappedLines, wrappedLinesIndex, this._cols);\n }\n }\n\n // Null out the end of the line ends if a wide character wrapped to the following line\n for (let i = 0; i < wrappedLines.length; i++) {\n if (destLineLengths[i] < newCols) {\n wrappedLines[i].setCell(destLineLengths[i], nullCell);\n }\n }\n\n // Adjust viewport as needed\n let viewportAdjustments = linesToAdd - trimmedLines;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y < newRows - 1) {\n this.y++;\n this.lines.pop();\n } else {\n this.ybase++;\n this.ydisp++;\n }\n } else {\n // Ensure ybase does not exceed its maximum value\n if (this.ybase < Math.min(this.lines.maxLength, this.lines.length + countToInsert) - newRows) {\n if (this.ybase === this.ydisp) {\n this.ydisp++;\n }\n this.ybase++;\n }\n }\n }\n this.savedY = Math.min(this.savedY + linesToAdd, this.ybase + newRows - 1);\n }\n\n // Rearrange lines in the buffer if there are any insertions, this is done at the end rather\n // than earlier so that it's a single O(n) pass through the buffer, instead of O(n^2) from many\n // costly calls to CircularList.splice.\n if (toInsert.length > 0) {\n // Record buffer insert events and then play them back backwards so that the indexes are\n // correct\n const insertEvents: IInsertEvent[] = [];\n\n // Record original lines so they don't get overridden when we rearrange the list\n const originalLines: BufferLine[] = [];\n for (let i = 0; i < this.lines.length; i++) {\n originalLines.push(this.lines.get(i) as BufferLine);\n }\n const originalLinesLength = this.lines.length;\n\n let originalLineIndex = originalLinesLength - 1;\n let nextToInsertIndex = 0;\n let nextToInsert = toInsert[nextToInsertIndex];\n this.lines.length = Math.min(this.lines.maxLength, this.lines.length + countToInsert);\n let countInsertedSoFar = 0;\n for (let i = Math.min(this.lines.maxLength - 1, originalLinesLength + countToInsert - 1); i >= 0; i--) {\n if (nextToInsert && nextToInsert.start > originalLineIndex + countInsertedSoFar) {\n // Insert extra lines here, adjusting i as needed\n for (let nextI = nextToInsert.newLines.length - 1; nextI >= 0; nextI--) {\n this.lines.set(i--, nextToInsert.newLines[nextI]);\n }\n i++;\n\n // Create insert events for later\n insertEvents.push({\n index: originalLineIndex + 1,\n amount: nextToInsert.newLines.length\n });\n\n countInsertedSoFar += nextToInsert.newLines.length;\n nextToInsert = toInsert[++nextToInsertIndex];\n } else {\n this.lines.set(i, originalLines[originalLineIndex--]);\n }\n }\n\n // Update markers\n let insertCountEmitted = 0;\n for (let i = insertEvents.length - 1; i >= 0; i--) {\n insertEvents[i].index += insertCountEmitted;\n this.lines.onInsertEmitter.fire(insertEvents[i]);\n insertCountEmitted += insertEvents[i].amount;\n }\n const amountToTrim = Math.max(0, originalLinesLength + countToInsert - this.lines.maxLength);\n if (amountToTrim > 0) {\n this.lines.onTrimEmitter.fire(amountToTrim);\n }\n }\n }\n\n /**\n * Translates a buffer line to a string, with optional start and end columns.\n * Wide characters will count as two columns in the resulting string. This\n * function is useful for getting the actual text underneath the raw selection\n * position.\n * @param lineIndex The absolute index of the line being translated.\n * @param trimRight Whether to trim whitespace to the right.\n * @param startCol The column to start at.\n * @param endCol The column to end at.\n */\n public translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol: number = 0, endCol?: number): string {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return '';\n }\n return line.translateToString(trimRight, startCol, endCol);\n }\n\n public getWrappedRangeForLine(y: number): { first: number, last: number } {\n let first = y;\n let last = y;\n // Scan upwards for wrapped lines\n while (first > 0 && this.lines.get(first)!.isWrapped) {\n first--;\n }\n // Scan downwards for wrapped lines\n while (last + 1 < this.lines.length && this.lines.get(last + 1)!.isWrapped) {\n last++;\n }\n return { first, last };\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n if (i !== null && i !== undefined) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n } else {\n this.tabs = {};\n i = 0;\n }\n\n for (; i < this._cols; i += this._optionsService.rawOptions.tabStopWidth) {\n this.tabs[i] = true;\n }\n }\n\n /**\n * Move the cursor to the previous tab stop from the given position (default is current).\n * @param x The position to move the cursor to the previous tab stop.\n */\n public prevStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[--x] && x > 0);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Move the cursor one tab stop forward from the given position (default is current).\n * @param x The position to move the cursor one tab stop forward.\n */\n public nextStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[++x] && x < this._cols);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Clears markers on single line.\n * @param y The line to clear.\n */\n public clearMarkers(y: number): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n if (this.markers[i].line === y) {\n this.markers[i].dispose();\n this.markers.splice(i--, 1);\n }\n }\n this._isClearing = false;\n }\n\n /**\n * Clears markers on all lines\n */\n public clearAllMarkers(): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n this.markers[i].dispose();\n }\n this.markers.length = 0;\n this._isClearing = false;\n }\n\n public addMarker(y: number): Marker {\n const marker = new Marker(y);\n this.markers.push(marker);\n marker.register(this.lines.onTrim(amount => {\n marker.line -= amount;\n // The marker should be disposed when the line is trimmed from the buffer\n if (marker.line < 0) {\n marker.dispose();\n }\n }));\n marker.register(this.lines.onInsert(event => {\n if (marker.line >= event.index) {\n marker.line += event.amount;\n }\n }));\n marker.register(this.lines.onDelete(event => {\n // Delete the marker if it's within the range\n if (marker.line >= event.index && marker.line < event.index + event.amount) {\n marker.dispose();\n }\n\n // Shift the marker if it's after the deleted range\n if (marker.line > event.index) {\n marker.line -= event.amount;\n }\n }));\n marker.register(marker.onDispose(() => this._removeMarker(marker)));\n return marker;\n }\n\n private _removeMarker(marker: Marker): void {\n if (!this._isClearing) {\n this.markers.splice(this.markers.indexOf(marker), 1);\n }\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IAttributeData } from 'common/Types';\nimport { Buffer } from 'common/buffer/Buffer';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and\n * provides also utilities for working with them.\n */\nexport class BufferSet extends Disposable implements IBufferSet {\n private _normal!: Buffer;\n private _alt!: Buffer;\n private _activeBuffer!: Buffer;\n\n private readonly _onBufferActivate = this._register(new Emitter<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>());\n public readonly onBufferActivate = this._onBufferActivate.event;\n\n /**\n * Create a new BufferSet for the given terminal.\n */\n constructor(\n private readonly _optionsService: IOptionsService,\n private readonly _bufferService: IBufferService\n ) {\n super();\n this.reset();\n this._register(this._optionsService.onSpecificOptionChange('scrollback', () => this.resize(this._bufferService.cols, this._bufferService.rows)));\n this._register(this._optionsService.onSpecificOptionChange('tabStopWidth', () => this.setupTabStops()));\n }\n\n public reset(): void {\n this._normal = new Buffer(true, this._optionsService, this._bufferService);\n this._normal.fillViewportRows();\n\n // The alt buffer should never have scrollback.\n // See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer\n this._alt = new Buffer(false, this._optionsService, this._bufferService);\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n\n this.setupTabStops();\n }\n\n /**\n * Returns the alt Buffer of the BufferSet\n */\n public get alt(): Buffer {\n return this._alt;\n }\n\n /**\n * Returns the currently active Buffer of the BufferSet\n */\n public get active(): Buffer {\n return this._activeBuffer;\n }\n\n /**\n * Returns the normal Buffer of the BufferSet\n */\n public get normal(): Buffer {\n return this._normal;\n }\n\n /**\n * Sets the normal Buffer of the BufferSet as its currently active Buffer\n */\n public activateNormalBuffer(): void {\n if (this._activeBuffer === this._normal) {\n return;\n }\n this._normal.x = this._alt.x;\n this._normal.y = this._alt.y;\n // The alt buffer should always be cleared when we switch to the normal\n // buffer. This frees up memory since the alt buffer should always be new\n // when activated.\n this._alt.clearAllMarkers();\n this._alt.clear();\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n }\n\n /**\n * Sets the alt Buffer of the BufferSet as its currently active Buffer\n */\n public activateAltBuffer(fillAttr?: IAttributeData): void {\n if (this._activeBuffer === this._alt) {\n return;\n }\n // Since the alt buffer is always cleared when the normal buffer is\n // activated, we want to fill it when switching to it.\n this._alt.fillViewportRows(fillAttr);\n this._alt.x = this._normal.x;\n this._alt.y = this._normal.y;\n this._activeBuffer = this._alt;\n this._onBufferActivate.fire({\n activeBuffer: this._alt,\n inactiveBuffer: this._normal\n });\n }\n\n /**\n * Resizes both normal and alt buffers, adjusting their data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n this._normal.resize(newCols, newRows);\n this._alt.resize(newCols, newRows);\n this.setupTabStops(newCols);\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n this._normal.setupTabStops(i);\n this._alt.setupTabStops(i);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IAttributeData, IBufferLine } from 'common/Types';\nimport { BufferSet } from 'common/buffer/BufferSet';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nexport const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars\nexport const MINIMUM_ROWS = 1;\n\nexport class BufferService extends Disposable implements IBufferService {\n public serviceBrand: any;\n\n public cols: number;\n public rows: number;\n public buffers: IBufferSet;\n /** Whether the user is scrolling (locks the scroll position) */\n public isUserScrolling: boolean = false;\n\n private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n\n public get buffer(): IBuffer { return this.buffers.active; }\n\n /** An IBufferline to clone/copy from for new blank lines */\n private _cachedBlankLine: IBufferLine | undefined;\n\n constructor(@IOptionsService optionsService: IOptionsService) {\n super();\n this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);\n this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);\n this.buffers = this._register(new BufferSet(optionsService, this));\n }\n\n public resize(cols: number, rows: number): void {\n this.cols = cols;\n this.rows = rows;\n this.buffers.resize(cols, rows);\n // TODO: This doesn't fire when scrollback changes - add a resize event to BufferSet and forward\n // event\n this._onResize.fire({ cols, rows });\n }\n\n public reset(): void {\n this.buffers.reset();\n this.isUserScrolling = false;\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n const buffer = this.buffer;\n\n let newLine: IBufferLine | undefined;\n newLine = this._cachedBlankLine;\n if (!newLine || newLine.length !== this.cols || newLine.getFg(0) !== eraseAttr.fg || newLine.getBg(0) !== eraseAttr.bg) {\n newLine = buffer.getBlankLine(eraseAttr, isWrapped);\n this._cachedBlankLine = newLine;\n }\n newLine.isWrapped = isWrapped;\n\n const topRow = buffer.ybase + buffer.scrollTop;\n const bottomRow = buffer.ybase + buffer.scrollBottom;\n\n if (buffer.scrollTop === 0) {\n // Determine whether the buffer is going to be trimmed after insertion.\n const willBufferBeTrimmed = buffer.lines.isFull;\n\n // Insert the line using the fastest method\n if (bottomRow === buffer.lines.length - 1) {\n if (willBufferBeTrimmed) {\n buffer.lines.recycle().copyFrom(newLine);\n } else {\n buffer.lines.push(newLine.clone());\n }\n } else {\n buffer.lines.splice(bottomRow + 1, 0, newLine.clone());\n }\n\n // Only adjust ybase and ydisp when the buffer is not trimmed\n if (!willBufferBeTrimmed) {\n buffer.ybase++;\n // Only scroll the ydisp with ybase if the user has not scrolled up\n if (!this.isUserScrolling) {\n buffer.ydisp++;\n }\n } else {\n // When the buffer is full and the user has scrolled up, keep the text\n // stable unless ydisp is right at the top\n if (this.isUserScrolling) {\n buffer.ydisp = Math.max(buffer.ydisp - 1, 0);\n }\n }\n } else {\n // scrollTop is non-zero which means no line will be going to the\n // scrollback, instead we can just shift them in-place.\n const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;\n buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);\n buffer.lines.set(bottomRow, newLine.clone());\n }\n\n // Move the viewport to the bottom of the buffer unless the user is\n // scrolling.\n if (!this.isUserScrolling) {\n buffer.ydisp = buffer.ybase;\n }\n\n this._onScroll.fire(buffer.ydisp);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used\n * to avoid unwanted events being handled by the viewport when the event was triggered from the\n * viewport originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n const buffer = this.buffer;\n if (disp < 0) {\n if (buffer.ydisp === 0) {\n return;\n }\n this.isUserScrolling = true;\n } else if (disp + buffer.ydisp >= buffer.ybase) {\n this.isUserScrolling = false;\n }\n\n const oldYdisp = buffer.ydisp;\n buffer.ydisp = Math.max(Math.min(buffer.ydisp + disp, buffer.ybase), 0);\n\n // No change occurred, don't trigger scroll/refresh\n if (oldYdisp === buffer.ydisp) {\n return;\n }\n\n if (!suppressScrollEvent) {\n this._onScroll.fire(buffer.ydisp);\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { isMac } from 'common/Platform';\nimport { CursorStyle, IDisposable } from 'common/Types';\nimport { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nexport const DEFAULT_OPTIONS: Readonly> = {\n cols: 80,\n rows: 24,\n cursorBlink: false,\n cursorStyle: 'block',\n cursorWidth: 1,\n cursorInactiveStyle: 'outline',\n customGlyphs: true,\n drawBoldTextInBrightColors: true,\n documentOverride: null,\n fastScrollModifier: 'alt',\n fastScrollSensitivity: 5,\n fontFamily: 'courier-new, courier, monospace',\n fontSize: 15,\n fontWeight: 'normal',\n fontWeightBold: 'bold',\n ignoreBracketedPasteMode: false,\n lineHeight: 1.0,\n letterSpacing: 0,\n linkHandler: null,\n logLevel: 'info',\n logger: null,\n scrollback: 1000,\n scrollOnUserInput: true,\n scrollSensitivity: 1,\n screenReaderMode: false,\n smoothScrollDuration: 0,\n macOptionIsMeta: false,\n macOptionClickForcesSelection: false,\n minimumContrastRatio: 1,\n disableStdin: false,\n allowProposedApi: false,\n allowTransparency: false,\n tabStopWidth: 8,\n theme: {},\n rescaleOverlappingGlyphs: false,\n rightClickSelectsWord: isMac,\n windowOptions: {},\n windowsMode: false,\n windowsPty: {},\n wordSeparator: ' ()[]{}\\',\"`',\n altClickMovesCursor: true,\n convertEol: false,\n termName: 'xterm',\n cancelEvents: false,\n overviewRuler: {}\n};\n\nconst FONT_WEIGHT_OPTIONS: Extract[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\nexport class OptionsService extends Disposable implements IOptionsService {\n public serviceBrand: any;\n\n public readonly rawOptions: Required;\n public options: Required;\n\n private readonly _onOptionChange = this._register(new Emitter());\n public readonly onOptionChange = this._onOptionChange.event;\n\n constructor(options: Partial) {\n super();\n // set the default value of each option\n const defaultOptions = { ...DEFAULT_OPTIONS };\n for (const key in options) {\n if (key in defaultOptions) {\n try {\n const newValue = options[key];\n defaultOptions[key] = this._sanitizeAndValidateOption(key, newValue);\n } catch (e) {\n console.error(e);\n }\n }\n }\n\n // set up getters and setters for each option\n this.rawOptions = defaultOptions;\n this.options = { ... defaultOptions };\n this._setupOptions();\n\n // Clear out options that could link outside xterm.js as they could easily cause an embedder\n // memory leak\n this._register(toDisposable(() => {\n this.rawOptions.linkHandler = null;\n this.rawOptions.documentOverride = null;\n }));\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onSpecificOptionChange(key: T, listener: (value: ITerminalOptions[T]) => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (eventKey === key) {\n listener(this.rawOptions[key]);\n }\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (keys.indexOf(eventKey) !== -1) {\n listener();\n }\n });\n }\n\n private _setupOptions(): void {\n const getter = (propName: string): any => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n return this.rawOptions[propName];\n };\n\n const setter = (propName: string, value: any): void => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n\n value = this._sanitizeAndValidateOption(propName, value);\n // Don't fire an option change event if they didn't change\n if (this.rawOptions[propName] !== value) {\n this.rawOptions[propName] = value;\n this._onOptionChange.fire(propName);\n }\n };\n\n for (const propName in this.rawOptions) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this.options, propName, desc);\n }\n }\n\n private _sanitizeAndValidateOption(key: string, value: any): any {\n switch (key) {\n case 'cursorStyle':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n if (!isCursorStyle(value)) {\n throw new Error(`\"${value}\" is not a valid value for ${key}`);\n }\n break;\n case 'wordSeparator':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n break;\n case 'fontWeight':\n case 'fontWeightBold':\n if (typeof value === 'number' && 1 <= value && value <= 1000) {\n // already valid numeric value\n break;\n }\n value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];\n break;\n case 'cursorWidth':\n value = Math.floor(value);\n // Fall through for bounds check\n case 'lineHeight':\n case 'tabStopWidth':\n if (value < 1) {\n throw new Error(`${key} cannot be less than 1, value: ${value}`);\n }\n break;\n case 'minimumContrastRatio':\n value = Math.max(1, Math.min(21, Math.round(value * 10) / 10));\n break;\n case 'scrollback':\n value = Math.min(value, 4294967295);\n if (value < 0) {\n throw new Error(`${key} cannot be less than 0, value: ${value}`);\n }\n break;\n case 'fastScrollSensitivity':\n case 'scrollSensitivity':\n if (value <= 0) {\n throw new Error(`${key} cannot be less than or equal to 0, value: ${value}`);\n }\n break;\n case 'rows':\n case 'cols':\n if (!value && value !== 0) {\n throw new Error(`${key} must be numeric, value: ${value}`);\n }\n break;\n case 'windowsPty':\n value = value ?? {};\n break;\n }\n return value;\n }\n}\n\nfunction isCursorStyle(value: unknown): value is CursorStyle {\n return value === 'block' || value === 'underline' || value === 'bar';\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/*\n * A simple utility for cloning values\n */\nexport function clone(val: T, depth: number = 5): T {\n if (typeof val !== 'object') {\n return val;\n }\n\n // If we're cloning an array, use an array as the base, otherwise use an object\n const clonedObject: any = Array.isArray(val) ? [] : {};\n\n for (const key in val) {\n // Recursively clone eack item unless we're at the maximum depth\n clonedObject[key] = depth <= 1 ? val[key] : (val[key] && clone(val[key], depth - 1));\n }\n\n return clonedObject as T;\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { clone } from 'common/Clone';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { IDecPrivateModes, IModes } from 'common/Types';\nimport { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nconst DEFAULT_MODES: IModes = Object.freeze({\n insertMode: false\n});\n\nconst DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({\n applicationCursorKeys: false,\n applicationKeypad: false,\n bracketedPasteMode: false,\n origin: false,\n reverseWraparound: false,\n sendFocus: false,\n wraparound: true // defaults: xterm - true, vt100 - false\n});\n\nexport class CoreService extends Disposable implements ICoreService {\n public serviceBrand: any;\n\n public isCursorInitialized: boolean = false;\n public isCursorHidden: boolean = false;\n public modes: IModes;\n public decPrivateModes: IDecPrivateModes;\n\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n private readonly _onUserInput = this._register(new Emitter());\n public readonly onUserInput = this._onUserInput.event;\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onRequestScrollToBottom = this._register(new Emitter());\n public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ILogService private readonly _logService: ILogService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public reset(): void {\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public triggerDataEvent(data: string, wasUserInput: boolean = false): void {\n // Prevents all events to pty process if stdin is disabled\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n\n // Input is being sent to the terminal, the terminal should focus the prompt.\n const buffer = this._bufferService.buffer;\n if (wasUserInput && this._optionsService.rawOptions.scrollOnUserInput && buffer.ybase !== buffer.ydisp) {\n this._onRequestScrollToBottom.fire();\n }\n\n // Fire onUserInput so listeners can react as well (eg. clear selection)\n if (wasUserInput) {\n this._onUserInput.fire();\n }\n\n // Fire onData API\n this._logService.debug(`sending data \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onData.fire(data);\n }\n\n public triggerBinaryEvent(data: string): void {\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n this._logService.debug(`sending binary \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onBinary.fire(data);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';\nimport { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * Supported default protocols.\n */\nconst DEFAULT_PROTOCOLS: { [key: string]: ICoreMouseProtocol } = {\n /**\n * NONE\n * Events: none\n * Modifiers: none\n */\n NONE: {\n events: CoreMouseEventType.NONE,\n restrict: () => false\n },\n /**\n * X10\n * Events: mousedown\n * Modifiers: none\n */\n X10: {\n events: CoreMouseEventType.DOWN,\n restrict: (e: ICoreMouseEvent) => {\n // no wheel, no move, no up\n if (e.button === CoreMouseButton.WHEEL || e.action !== CoreMouseAction.DOWN) {\n return false;\n }\n // no modifiers\n e.ctrl = false;\n e.alt = false;\n e.shift = false;\n return true;\n }\n },\n /**\n * VT200\n * Events: mousedown / mouseup / wheel\n * Modifiers: all\n */\n VT200: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL,\n restrict: (e: ICoreMouseEvent) => {\n // no move\n if (e.action === CoreMouseAction.MOVE) {\n return false;\n }\n return true;\n }\n },\n /**\n * DRAG\n * Events: mousedown / mouseup / wheel / mousedrag\n * Modifiers: all\n */\n DRAG: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL | CoreMouseEventType.DRAG,\n restrict: (e: ICoreMouseEvent) => {\n // no move without button\n if (e.action === CoreMouseAction.MOVE && e.button === CoreMouseButton.NONE) {\n return false;\n }\n return true;\n }\n },\n /**\n * ANY\n * Events: all mouse related events\n * Modifiers: all\n */\n ANY: {\n events:\n CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL\n | CoreMouseEventType.DRAG | CoreMouseEventType.MOVE,\n restrict: (e: ICoreMouseEvent) => true\n }\n};\n\nconst enum Modifiers {\n SHIFT = 4,\n ALT = 8,\n CTRL = 16\n}\n\n// helper for default encoders to generate the event code.\nfunction eventCode(e: ICoreMouseEvent, isSGR: boolean): number {\n let code = (e.ctrl ? Modifiers.CTRL : 0) | (e.shift ? Modifiers.SHIFT : 0) | (e.alt ? Modifiers.ALT : 0);\n if (e.button === CoreMouseButton.WHEEL) {\n code |= 64;\n code |= e.action;\n } else {\n code |= e.button & 3;\n if (e.button & 4) {\n code |= 64;\n }\n if (e.button & 8) {\n code |= 128;\n }\n if (e.action === CoreMouseAction.MOVE) {\n code |= CoreMouseAction.MOVE;\n } else if (e.action === CoreMouseAction.UP && !isSGR) {\n // special case - only SGR can report button on release\n // all others have to go with NONE\n code |= CoreMouseButton.NONE;\n }\n }\n return code;\n}\n\nconst S = String.fromCharCode;\n\n/**\n * Supported default encodings.\n */\nconst DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {\n /**\n * DEFAULT - CSI M Pb Px Py\n * Single byte encoding for coords and event code.\n * Can encode values up to 223 (1-based).\n */\n DEFAULT: (e: ICoreMouseEvent) => {\n const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32];\n // supress mouse report if we exceed addressible range\n // Note this is handled differently by emulators\n // - xterm: sends 0;0 coords instead\n // - vte, konsole: no report\n if (params[0] > 255 || params[1] > 255 || params[2] > 255) {\n return '';\n }\n return `\\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`;\n },\n /**\n * SGR - CSI < Pb ; Px ; Py M|m\n * No encoding limitation.\n * Can report button on release and works with a well formed sequence.\n */\n SGR: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`;\n },\n SGR_PIXELS: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.x};${e.y}${final}`;\n }\n};\n\n/**\n * CoreMouseService\n *\n * Provides mouse tracking reports with different protocols and encodings.\n * - protocols: NONE (default), X10, VT200, DRAG, ANY\n * - encodings: DEFAULT, SGR (UTF8, URXVT removed in #2507)\n *\n * Custom protocols/encodings can be added by `addProtocol` / `addEncoding`.\n * To activate a protocol/encoding, set `activeProtocol` / `activeEncoding`.\n * Switching a protocol will send a notification event `onProtocolChange`\n * with a list of needed events to track.\n *\n * The service handles the mouse tracking state and decides whether to send\n * a tracking report to the backend based on protocol and encoding limitations.\n * To send a mouse event call `triggerMouseEvent`.\n */\nexport class CoreMouseService extends Disposable implements ICoreMouseService {\n public serviceBrand: any;\n\n private _protocols: { [name: string]: ICoreMouseProtocol } = {};\n private _encodings: { [name: string]: CoreMouseEncoding } = {};\n private _activeProtocol: string = '';\n private _activeEncoding: string = '';\n private _lastEvent: ICoreMouseEvent | null = null;\n\n private readonly _onProtocolChange = this._register(new Emitter());\n public readonly onProtocolChange = this._onProtocolChange.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService\n ) {\n super();\n // register default protocols and encodings\n for (const name of Object.keys(DEFAULT_PROTOCOLS)) this.addProtocol(name, DEFAULT_PROTOCOLS[name]);\n for (const name of Object.keys(DEFAULT_ENCODINGS)) this.addEncoding(name, DEFAULT_ENCODINGS[name]);\n // call reset to set defaults\n this.reset();\n }\n\n public addProtocol(name: string, protocol: ICoreMouseProtocol): void {\n this._protocols[name] = protocol;\n }\n\n public addEncoding(name: string, encoding: CoreMouseEncoding): void {\n this._encodings[name] = encoding;\n }\n\n public get activeProtocol(): string {\n return this._activeProtocol;\n }\n\n public get areMouseEventsActive(): boolean {\n return this._protocols[this._activeProtocol].events !== 0;\n }\n\n public set activeProtocol(name: string) {\n if (!this._protocols[name]) {\n throw new Error(`unknown protocol \"${name}\"`);\n }\n this._activeProtocol = name;\n this._onProtocolChange.fire(this._protocols[name].events);\n }\n\n public get activeEncoding(): string {\n return this._activeEncoding;\n }\n\n public set activeEncoding(name: string) {\n if (!this._encodings[name]) {\n throw new Error(`unknown encoding \"${name}\"`);\n }\n this._activeEncoding = name;\n }\n\n public reset(): void {\n this.activeProtocol = 'NONE';\n this.activeEncoding = 'DEFAULT';\n this._lastEvent = null;\n }\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n public triggerMouseEvent(e: ICoreMouseEvent): boolean {\n // range check for col/row\n if (e.col < 0 || e.col >= this._bufferService.cols\n || e.row < 0 || e.row >= this._bufferService.rows) {\n return false;\n }\n\n // filter nonsense combinations of button + action\n if (e.button === CoreMouseButton.WHEEL && e.action === CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button === CoreMouseButton.NONE && e.action !== CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button !== CoreMouseButton.WHEEL && (e.action === CoreMouseAction.LEFT || e.action === CoreMouseAction.RIGHT)) {\n return false;\n }\n\n // report 1-based coords\n e.col++;\n e.row++;\n\n // debounce move events at grid or pixel level\n if (e.action === CoreMouseAction.MOVE\n && this._lastEvent\n && this._equalEvents(this._lastEvent, e, this._activeEncoding === 'SGR_PIXELS')\n ) {\n return false;\n }\n\n // apply protocol restrictions\n if (!this._protocols[this._activeProtocol].restrict(e)) {\n return false;\n }\n\n // encode report and send\n const report = this._encodings[this._activeEncoding](e);\n if (report) {\n // always send DEFAULT as binary data\n if (this._activeEncoding === 'DEFAULT') {\n this._coreService.triggerBinaryEvent(report);\n } else {\n this._coreService.triggerDataEvent(report, true);\n }\n }\n\n this._lastEvent = e;\n\n return true;\n }\n\n public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {\n return {\n down: !!(events & CoreMouseEventType.DOWN),\n up: !!(events & CoreMouseEventType.UP),\n drag: !!(events & CoreMouseEventType.DRAG),\n move: !!(events & CoreMouseEventType.MOVE),\n wheel: !!(events & CoreMouseEventType.WHEEL)\n };\n }\n\n private _equalEvents(e1: ICoreMouseEvent, e2: ICoreMouseEvent, pixels: boolean): boolean {\n if (pixels) {\n if (e1.x !== e2.x) return false;\n if (e1.y !== e2.y) return false;\n } else {\n if (e1.col !== e2.col) return false;\n if (e1.row !== e2.row) return false;\n }\n if (e1.button !== e2.button) return false;\n if (e1.action !== e2.action) return false;\n if (e1.ctrl !== e2.ctrl) return false;\n if (e1.alt !== e2.alt) return false;\n if (e1.shift !== e2.shift) return false;\n return true;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\n\nconst BMP_COMBINING = [\n [0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489],\n [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2],\n [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603],\n [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670],\n [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED],\n [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A],\n [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902],\n [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D],\n [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981],\n [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD],\n [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C],\n [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D],\n [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC],\n [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD],\n [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C],\n [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D],\n [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0],\n [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48],\n [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC],\n [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD],\n [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D],\n [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6],\n [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E],\n [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC],\n [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35],\n [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E],\n [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97],\n [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030],\n [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039],\n [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F],\n [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753],\n [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD],\n [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD],\n [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922],\n [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B],\n [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34],\n [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42],\n [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF],\n [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063],\n [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F],\n [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B],\n [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F],\n [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB]\n];\nconst HIGH_COMBINING = [\n [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F],\n [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169],\n [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD],\n [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F],\n [0xE0100, 0xE01EF]\n];\n\n// BMP lookup table, lazy initialized during first addon loading\nlet table: Uint8Array;\n\nfunction bisearch(ucs: number, data: number[][]): boolean {\n let min = 0;\n let max = data.length - 1;\n let mid;\n if (ucs < data[0][0] || ucs > data[max][1]) {\n return false;\n }\n while (max >= min) {\n mid = (min + max) >> 1;\n if (ucs > data[mid][1]) {\n min = mid + 1;\n } else if (ucs < data[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n}\n\nexport class UnicodeV6 implements IUnicodeVersionProvider {\n public readonly version = '6';\n\n constructor() {\n // init lookup table once\n if (!table) {\n table = new Uint8Array(65536);\n table.fill(1);\n table[0] = 0;\n // control chars\n table.fill(0, 1, 32);\n table.fill(0, 0x7f, 0xa0);\n\n // apply wide char rules first\n // wide chars\n table.fill(2, 0x1100, 0x1160);\n table[0x2329] = 2;\n table[0x232a] = 2;\n table.fill(2, 0x2e80, 0xa4d0);\n table[0x303f] = 1; // wrongly in last line\n\n table.fill(2, 0xac00, 0xd7a4);\n table.fill(2, 0xf900, 0xfb00);\n table.fill(2, 0xfe10, 0xfe1a);\n table.fill(2, 0xfe30, 0xfe70);\n table.fill(2, 0xff00, 0xff61);\n table.fill(2, 0xffe0, 0xffe7);\n\n // apply combining last to ensure we overwrite\n // wrongly wide set chars:\n // the original algo evals combining first and falls\n // through to wide check so we simply do here the opposite\n // combining 0\n for (let r = 0; r < BMP_COMBINING.length; ++r) {\n table.fill(0, BMP_COMBINING[r][0], BMP_COMBINING[r][1] + 1);\n }\n }\n }\n\n public wcwidth(num: number): UnicodeCharWidth {\n if (num < 32) return 0;\n if (num < 127) return 1;\n if (num < 65536) return table[num] as UnicodeCharWidth;\n if (bisearch(num, HIGH_COMBINING)) return 0;\n if ((num >= 0x20000 && num <= 0x2fffd) || (num >= 0x30000 && num <= 0x3fffd)) return 2;\n return 1;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n let width = this.wcwidth(codepoint);\n let shouldJoin = width === 0 && preceding !== 0;\n if (shouldJoin) {\n const oldWidth = UnicodeService.extractWidth(preceding);\n if (oldWidth === 0) {\n shouldJoin = false;\n } else if (oldWidth > width) {\n width = oldWidth;\n }\n }\n return UnicodeService.createPropertyValue(0, width, shouldJoin);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { UnicodeV6 } from 'common/input/UnicodeV6';\nimport { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { Emitter } from 'vs/base/common/event';\n\nexport class UnicodeService implements IUnicodeService {\n public serviceBrand: any;\n\n private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);\n private _active: string = '';\n private _activeProvider: IUnicodeVersionProvider;\n\n private readonly _onChange = new Emitter();\n public readonly onChange = this._onChange.event;\n\n public static extractShouldJoin(value: UnicodeCharProperties): boolean {\n return (value & 1) !== 0;\n }\n public static extractWidth(value: UnicodeCharProperties): UnicodeCharWidth {\n return ((value >> 1) & 0x3) as UnicodeCharWidth;\n }\n public static extractCharKind(value: UnicodeCharProperties): number {\n return value >> 3;\n }\n public static createPropertyValue(state: number, width: number, shouldJoin: boolean = false): UnicodeCharProperties {\n return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);\n }\n\n constructor() {\n const defaultProvider = new UnicodeV6();\n this.register(defaultProvider);\n this._active = defaultProvider.version;\n this._activeProvider = defaultProvider;\n }\n\n public dispose(): void {\n this._onChange.dispose();\n }\n\n public get versions(): string[] {\n return Object.keys(this._providers);\n }\n\n public get activeVersion(): string {\n return this._active;\n }\n\n public set activeVersion(version: string) {\n if (!this._providers[version]) {\n throw new Error(`unknown Unicode version \"${version}\"`);\n }\n this._active = version;\n this._activeProvider = this._providers[version];\n this._onChange.fire(version);\n }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._providers[provider.version] = provider;\n }\n\n /**\n * Unicode version dependent interface.\n */\n public wcwidth(num: number): UnicodeCharWidth {\n return this._activeProvider.wcwidth(num);\n }\n\n public getStringCellWidth(s: string): number {\n let result = 0;\n let precedingInfo = 0;\n const length = s.length;\n for (let i = 0; i < length; ++i) {\n let code = s.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n // this should not happen with strings retrieved from\n // Buffer.translateToString as it converts from UTF-32\n // and therefore always should contain the second part\n // for any other string we still have to handle it somehow:\n // simply treat the lonely surrogate first as a single char (UCS-2 behavior)\n return result + this.wcwidth(code);\n }\n const second = s.charCodeAt(i);\n // convert surrogate pair to high codepoint only for valid second part (UTF-16)\n // otherwise treat them independently (UCS-2 behavior)\n if (0xDC00 <= second && second <= 0xDFFF) {\n code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n result += this.wcwidth(second);\n }\n }\n const currentInfo = this.charProperties(code, precedingInfo);\n let chWidth = UnicodeService.extractWidth(currentInfo);\n if (UnicodeService.extractShouldJoin(currentInfo)) {\n chWidth -= UnicodeService.extractWidth(precedingInfo);\n }\n result += chWidth;\n precedingInfo = currentInfo;\n }\n return result;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n return this._activeProvider.charProperties(codepoint, preceding);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharsetService } from 'common/services/Services';\nimport { ICharset } from 'common/Types';\n\nexport class CharsetService implements ICharsetService {\n public serviceBrand: any;\n\n public charset: ICharset | undefined;\n public glevel: number = 0;\n\n private _charsets: (ICharset | undefined)[] = [];\n\n public reset(): void {\n this.charset = undefined;\n this._charsets = [];\n this.glevel = 0;\n }\n\n public setgLevel(g: number): void {\n this.glevel = g;\n this.charset = this._charsets[g];\n }\n\n public setgCharset(g: number, charset: ICharset | undefined): void {\n this._charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';\nimport { IBufferService } from 'common/services/Services';\n\nexport function updateWindowsModeWrappedState(bufferService: IBufferService): void {\n // Winpty does not support wraparound mode which means that lines will never\n // be marked as wrapped. This causes issues for things like copying a line\n // retaining the wrapped new line characters or if consumers are listening\n // in on the data stream.\n //\n // The workaround for this is to listen to every incoming line feed and mark\n // the line as wrapped if the last character in the previous line is not a\n // space. This is certainly not without its problems, but generally on\n // Windows when text reaches the end of the terminal it's likely going to be\n // wrapped.\n const line = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y - 1);\n const lastChar = line?.get(bufferService.cols - 1);\n\n const nextLine = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y);\n if (nextLine && lastChar) {\n nextLine.isWrapped = (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IParams, ParamsArray } from 'common/parser/Types';\n\n// max value supported for a single param/subparam (clamped to positive int32 range)\nconst MAX_VALUE = 0x7FFFFFFF;\n// max allowed subparams for a single sequence (hardcoded limitation)\nconst MAX_SUBPARAMS = 256;\n\n/**\n * Params storage class.\n * This type is used by the parser to accumulate sequence parameters and sub parameters\n * and transmit them to the input handler actions.\n *\n * NOTES:\n * - params object for action handlers is borrowed, use `.toArray` or `.clone` to get a copy\n * - never read beyond `params.length - 1` (likely to contain arbitrary data)\n * - `.getSubParams` returns a borrowed typed array, use `.getSubParamsAll` for cloned sub params\n * - hardcoded limitations:\n * - max. value for a single (sub) param is 2^31 - 1 (greater values are clamped to that)\n * - max. 256 sub params possible\n * - negative values are not allowed beside -1 (placeholder for default value)\n *\n * About ZDM (Zero Default Mode):\n * ZDM is not orchestrated by this class. If the parser is in ZDM,\n * it should add 0 for empty params, otherwise -1. This does not apply\n * to subparams, empty subparams should always be added with -1.\n */\nexport class Params implements IParams {\n // params store and length\n public params: Int32Array;\n public length: number;\n\n // sub params store and length\n protected _subParams: Int32Array;\n protected _subParamsLength: number;\n\n // sub params offsets from param: param idx --> [start, end] offset\n private _subParamsIdx: Uint16Array;\n private _rejectDigits: boolean;\n private _rejectSubDigits: boolean;\n private _digitIsSub: boolean;\n\n /**\n * Create a `Params` type from JS array representation.\n */\n public static fromArray(values: ParamsArray): Params {\n const params = new Params();\n if (!values.length) {\n return params;\n }\n // skip leading sub params\n for (let i = (Array.isArray(values[0])) ? 1 : 0; i < values.length; ++i) {\n const value = values[i];\n if (Array.isArray(value)) {\n for (let k = 0; k < value.length; ++k) {\n params.addSubParam(value[k]);\n }\n } else {\n params.addParam(value);\n }\n }\n return params;\n }\n\n /**\n * @param maxLength max length of storable parameters\n * @param maxSubParamsLength max length of storable sub parameters\n */\n constructor(public maxLength: number = 32, public maxSubParamsLength: number = 32) {\n if (maxSubParamsLength > MAX_SUBPARAMS) {\n throw new Error('maxSubParamsLength must not be greater than 256');\n }\n this.params = new Int32Array(maxLength);\n this.length = 0;\n this._subParams = new Int32Array(maxSubParamsLength);\n this._subParamsLength = 0;\n this._subParamsIdx = new Uint16Array(maxLength);\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Clone object.\n */\n public clone(): Params {\n const newParams = new Params(this.maxLength, this.maxSubParamsLength);\n newParams.params.set(this.params);\n newParams.length = this.length;\n newParams._subParams.set(this._subParams);\n newParams._subParamsLength = this._subParamsLength;\n newParams._subParamsIdx.set(this._subParamsIdx);\n newParams._rejectDigits = this._rejectDigits;\n newParams._rejectSubDigits = this._rejectSubDigits;\n newParams._digitIsSub = this._digitIsSub;\n return newParams;\n }\n\n /**\n * Get a JS array representation of the current parameters and sub parameters.\n * The array is structured as follows:\n * sequence: \"1;2:3:4;5::6\"\n * array : [1, 2, [3, 4], 5, [-1, 6]]\n */\n public toArray(): ParamsArray {\n const res: ParamsArray = [];\n for (let i = 0; i < this.length; ++i) {\n res.push(this.params[i]);\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n res.push(Array.prototype.slice.call(this._subParams, start, end));\n }\n }\n return res;\n }\n\n /**\n * Reset to initial empty state.\n */\n public reset(): void {\n this.length = 0;\n this._subParamsLength = 0;\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Add a parameter value.\n * `Params` only stores up to `maxLength` parameters, any later\n * parameter will be ignored.\n * Note: VT devices only stored up to 16 values, xterm seems to\n * store up to 30.\n */\n public addParam(value: number): void {\n this._digitIsSub = false;\n if (this.length >= this.maxLength) {\n this._rejectDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;\n this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;\n }\n\n /**\n * Add a sub parameter value.\n * The sub parameter is automatically associated with the last parameter value.\n * Thus it is not possible to add a subparameter without any parameter added yet.\n * `Params` only stores up to `subParamsLength` sub parameters, any later\n * sub parameter will be ignored.\n */\n public addSubParam(value: number): void {\n this._digitIsSub = true;\n if (!this.length) {\n return;\n }\n if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength) {\n this._rejectSubDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;\n this._subParamsIdx[this.length - 1]++;\n }\n\n /**\n * Whether parameter at index `idx` has sub parameters.\n */\n public hasSubParams(idx: number): boolean {\n return ((this._subParamsIdx[idx] & 0xFF) - (this._subParamsIdx[idx] >> 8) > 0);\n }\n\n /**\n * Return sub parameters for parameter at index `idx`.\n * Note: The values are borrowed, thus you need to copy\n * the values if you need to hold them in nonlocal scope.\n */\n public getSubParams(idx: number): Int32Array | null {\n const start = this._subParamsIdx[idx] >> 8;\n const end = this._subParamsIdx[idx] & 0xFF;\n if (end - start > 0) {\n return this._subParams.subarray(start, end);\n }\n return null;\n }\n\n /**\n * Return all sub parameters as {idx: subparams} mapping.\n * Note: The values are not borrowed.\n */\n public getSubParamsAll(): {[idx: number]: Int32Array} {\n const result: {[idx: number]: Int32Array} = {};\n for (let i = 0; i < this.length; ++i) {\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n result[i] = this._subParams.slice(start, end);\n }\n }\n return result;\n }\n\n /**\n * Add a single digit value to current parameter.\n * This is used by the parser to account digits on a char by char basis.\n */\n public addDigit(value: number): void {\n let length;\n if (this._rejectDigits\n || !(length = this._digitIsSub ? this._subParamsLength : this.length)\n || (this._digitIsSub && this._rejectSubDigits)\n ) {\n return;\n }\n\n const store = this._digitIsSub ? this._subParams : this.params;\n const cur = store[length - 1];\n store[length - 1] = ~cur ? Math.min(cur * 10 + value, MAX_VALUE) : value;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';\nimport { OscState, PAYLOAD_LIMIT } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IOscHandler[] = [];\n\nexport class OscParser implements IOscParser {\n private _state = OscState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: OscFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public registerHandler(ident: number, handler: IOscHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n public setHandlerFallback(handler: OscFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // force cleanup handlers if payload was already sent\n if (this._state === OscState.PAYLOAD) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].end(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = OscState.ID;\n }\n\n /**\n * Put data to current OSC command.\n * Expects the identifier of the OSC command in the form\n * OSC id ; payload ST/BEL\n * Payload chunks are not further processed and get\n * directly passed to the handlers.\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === OscState.ABORT) {\n return;\n }\n if (this._state === OscState.ID) {\n while (start < end) {\n const code = data[start++];\n if (code === 0x3b) {\n this._state = OscState.PAYLOAD;\n this._start();\n break;\n }\n if (code < 0x30 || 0x39 < code) {\n this._state = OscState.ABORT;\n return;\n }\n if (this._id === -1) {\n this._id = 0;\n }\n this._id = this._id * 10 + code - 48;\n }\n }\n if (this._state === OscState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an OSC command.\n * Whether the OSC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean, promiseResult: boolean = true): void | Promise {\n if (this._state === OscState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== OscState.ABORT) {\n // if we are still in ID state and get an early end\n // means that the command has no payload thus we still have\n // to announce START and send END right after\n if (this._state === OscState.ID) {\n this._start();\n }\n\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers\n // we always have to call .end for proper cleanup,\n // here we use `success` to indicate whether a handler should execute\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as OSC handlers.\n */\nexport class OscHandler implements IOscHandler {\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean | Promise) { }\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n if (ret instanceof Promise) {\n // need to hold data until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { Params } from 'common/parser/Params';\nimport { PAYLOAD_LIMIT } from 'common/parser/Constants';\n\nconst EMPTY_HANDLERS: IDcsHandler[] = [];\n\nexport class DcsParser implements IDcsParser {\n private _handlers: IHandlerCollection = Object.create(null);\n private _active: IDcsHandler[] = EMPTY_HANDLERS;\n private _ident: number = 0;\n private _handlerFb: DcsFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public registerHandler(ident: number, handler: IDcsHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public reset(): void {\n // force cleanup leftover handlers\n if (this._active.length) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].unhook(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n\n public hook(ident: number, params: IParams): void {\n // always reset leftover handlers\n this.reset();\n this._ident = ident;\n this._active = this._handlers[ident] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._ident, 'HOOK', params);\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].hook(params);\n }\n }\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public unhook(success: boolean, promiseResult: boolean = true): void | Promise {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'UNHOOK', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers (fallThrough for async)\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n}\n\n// predefine empty params as [0] (ZDM)\nconst EMPTY_PARAMS = new Params();\nEMPTY_PARAMS.addParam(0);\n\n/**\n * Convenient class to create a DCS handler from a single callback function.\n * Note: The payload is currently limited to 50 MB (hardcoded).\n */\nexport class DcsHandler implements IDcsHandler {\n private _data = '';\n private _params: IParams = EMPTY_PARAMS;\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string, params: IParams) => boolean | Promise) { }\n\n public hook(params: IParams): void {\n // since we need to preserve params until `unhook`, we have to clone it\n // (only borrowed from parser and spans multiple parser states)\n // perf optimization:\n // clone only, if we have non empty params, otherwise stick with default\n this._params = (params.length > 1 || params.params[0]) ? params.clone() : EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public unhook(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data, this._params);\n if (ret instanceof Promise) {\n // need to hold data and params until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType } from 'common/parser/Types';\nimport { ParserState, ParserAction } from 'common/parser/Constants';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { Params } from 'common/parser/Params';\nimport { OscParser } from 'common/parser/OscParser';\nimport { DcsParser } from 'common/parser/DcsParser';\n\n/**\n * Table values are generated like this:\n * index: currentState << TableValue.INDEX_STATE_SHIFT | charCode\n * value: action << TableValue.TRANSITION_ACTION_SHIFT | nextState\n */\nconst enum TableAccess {\n TRANSITION_ACTION_SHIFT = 4,\n TRANSITION_STATE_MASK = 15,\n INDEX_STATE_SHIFT = 8\n}\n\n/**\n * Transition table for EscapeSequenceParser.\n */\nexport class TransitionTable {\n public table: Uint8Array;\n\n constructor(length: number) {\n this.table = new Uint8Array(length);\n }\n\n /**\n * Set default transition.\n * @param action default action\n * @param next default next state\n */\n public setDefault(action: ParserAction, next: ParserState): void {\n this.table.fill(action << TableAccess.TRANSITION_ACTION_SHIFT | next);\n }\n\n /**\n * Add a transition to the transition table.\n * @param code input character code\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public add(code: number, state: ParserState, action: ParserAction, next: ParserState): void {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | code] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n\n /**\n * Add transitions for multiple input character codes.\n * @param codes input character code array\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public addMany(codes: number[], state: ParserState, action: ParserAction, next: ParserState): void {\n for (let i = 0; i < codes.length; i++) {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | codes[i]] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n }\n}\n\n\n// Pseudo-character placeholder for printable non-ascii characters (unicode).\nconst NON_ASCII_PRINTABLE = 0xA0;\n\n\n/**\n * VT500 compatible transition table.\n * Taken from https://vt100.net/emu/dec_ansi_parser.\n */\nexport const VT500_TRANSITION_TABLE = (function (): TransitionTable {\n const table: TransitionTable = new TransitionTable(4095);\n\n // range macro for byte\n const BYTE_VALUES = 256;\n const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);\n const r = (start: number, end: number): number[] => blueprint.slice(start, end);\n\n // Default definitions.\n const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded\n const EXECUTABLES = r(0x00, 0x18);\n EXECUTABLES.push(0x19);\n EXECUTABLES.push.apply(EXECUTABLES, r(0x1c, 0x20));\n\n const states: number[] = r(ParserState.GROUND, ParserState.DCS_PASSTHROUGH + 1);\n let state: any;\n\n // set default transition\n table.setDefault(ParserAction.ERROR, ParserState.GROUND);\n // printables\n table.addMany(PRINTABLES, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n // global anywhere rules\n for (state in states) {\n table.addMany([0x18, 0x1a, 0x99, 0x9a], state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x80, 0x90), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x90, 0x98), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.add(0x9c, state, ParserAction.IGNORE, ParserState.GROUND); // ST as terminator\n table.add(0x1b, state, ParserAction.CLEAR, ParserState.ESCAPE); // ESC\n table.add(0x9d, state, ParserAction.OSC_START, ParserState.OSC_STRING); // OSC\n table.addMany([0x98, 0x9e, 0x9f], state, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9b, state, ParserAction.CLEAR, ParserState.CSI_ENTRY); // CSI\n table.add(0x90, state, ParserAction.CLEAR, ParserState.DCS_ENTRY); // DCS\n }\n // rules for executables and 7f\n table.addMany(EXECUTABLES, ParserState.GROUND, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(EXECUTABLES, ParserState.ESCAPE, ParserAction.EXECUTE, ParserState.ESCAPE);\n table.add(0x7f, ParserState.ESCAPE, ParserAction.IGNORE, ParserState.ESCAPE);\n table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n table.addMany(EXECUTABLES, ParserState.CSI_ENTRY, ParserAction.EXECUTE, ParserState.CSI_ENTRY);\n table.add(0x7f, ParserState.CSI_ENTRY, ParserAction.IGNORE, ParserState.CSI_ENTRY);\n table.addMany(EXECUTABLES, ParserState.CSI_PARAM, ParserAction.EXECUTE, ParserState.CSI_PARAM);\n table.add(0x7f, ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_PARAM);\n table.addMany(EXECUTABLES, ParserState.CSI_IGNORE, ParserAction.EXECUTE, ParserState.CSI_IGNORE);\n table.addMany(EXECUTABLES, ParserState.CSI_INTERMEDIATE, ParserAction.EXECUTE, ParserState.CSI_INTERMEDIATE);\n table.add(0x7f, ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.ESCAPE_INTERMEDIATE, ParserAction.EXECUTE, ParserState.ESCAPE_INTERMEDIATE);\n table.add(0x7f, ParserState.ESCAPE_INTERMEDIATE, ParserAction.IGNORE, ParserState.ESCAPE_INTERMEDIATE);\n // osc\n table.add(0x5d, ParserState.ESCAPE, ParserAction.OSC_START, ParserState.OSC_STRING);\n table.addMany(PRINTABLES, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(0x7f, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.addMany([0x9c, 0x1b, 0x18, 0x1a, 0x07], ParserState.OSC_STRING, ParserAction.OSC_END, ParserState.GROUND);\n table.addMany(r(0x1c, 0x20), ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n // sos/pm/apc does nothing\n table.addMany([0x58, 0x5e, 0x5f], ParserState.ESCAPE, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(PRINTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(EXECUTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9c, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.GROUND);\n table.add(0x7f, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n // csi entries\n table.add(0x5b, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.CSI_ENTRY);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_ENTRY, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_ENTRY, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_PARAM, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_PARAM, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x20, 0x40), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(0x7f, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.CSI_INTERMEDIATE, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_INTERMEDIATE, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_PARAM, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n // esc_intermediate\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE_INTERMEDIATE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x30, 0x7f), ParserState.ESCAPE_INTERMEDIATE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x50), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x51, 0x58), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany([0x59, 0x5a, 0x5c], ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x60, 0x7f), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n // dcs entry\n table.add(0x50, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.DCS_ENTRY);\n table.addMany(EXECUTABLES, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.add(0x7f, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x20, 0x30), ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_ENTRY, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_PARAM);\n table.addMany(EXECUTABLES, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x80), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(EXECUTABLES, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.add(0x7f, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_PARAM, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_PARAM, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.add(0x7f, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_INTERMEDIATE, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_INTERMEDIATE, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_PARAM, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_ENTRY, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(EXECUTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.addMany(PRINTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(0x7f, ParserState.DCS_PASSTHROUGH, ParserAction.IGNORE, ParserState.DCS_PASSTHROUGH);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.DCS_PASSTHROUGH, ParserAction.DCS_UNHOOK, ParserState.GROUND);\n // special handling of unicode chars\n table.add(NON_ASCII_PRINTABLE, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n table.add(NON_ASCII_PRINTABLE, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(NON_ASCII_PRINTABLE, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n return table;\n})();\n\n\n/**\n * EscapeSequenceParser.\n * This class implements the ANSI/DEC compatible parser described by\n * Paul Williams (https://vt100.net/emu/dec_ansi_parser).\n *\n * To implement custom ANSI compliant escape sequences it is not needed to\n * alter this parser, instead consider registering a custom handler.\n * For non ANSI compliant sequences change the transition table with\n * the optional `transitions` constructor argument and\n * reimplement the `parse` method.\n *\n * This parser is currently hardcoded to operate in ZDM (Zero Default Mode)\n * as suggested by the original parser, thus empty parameters are set to 0.\n * This this is not in line with the latest ECMA-48 specification\n * (ZDM was part of the early specs and got completely removed later on).\n *\n * Other than the original parser from vt100.net this parser supports\n * sub parameters in digital parameters separated by colons. Empty sub parameters\n * are set to -1 (no ZDM for sub parameters).\n *\n * About prefix and intermediate bytes:\n * This parser follows the assumptions of the vt100.net parser with these restrictions:\n * - only one prefix byte is allowed as first parameter byte, byte range 0x3c .. 0x3f\n * - max. two intermediates are respected, byte range 0x20 .. 0x2f\n * Note that this is not in line with ECMA-48 which does not limit either of those.\n * Furthermore ECMA-48 allows the prefix byte range at any param byte position. Currently\n * there are no known sequences that follow the broader definition of the specification.\n *\n * TODO: implement error recovery hook via error handler return values\n */\nexport class EscapeSequenceParser extends Disposable implements IEscapeSequenceParser {\n public initialState: number;\n public currentState: number;\n public precedingJoinState: number; // UnicodeJoinProperties\n\n // buffers over several parse calls\n protected _params: Params;\n protected _collect: number;\n\n // handler lookup containers\n protected _printHandler: PrintHandlerType;\n protected _executeHandlers: { [flag: number]: ExecuteHandlerType };\n protected _csiHandlers: IHandlerCollection;\n protected _escHandlers: IHandlerCollection;\n protected readonly _oscParser: IOscParser;\n protected readonly _dcsParser: IDcsParser;\n protected _errorHandler: (state: IParsingState) => IParsingState;\n\n // fallback handlers\n protected _printHandlerFb: PrintFallbackHandlerType;\n protected _executeHandlerFb: ExecuteFallbackHandlerType;\n protected _csiHandlerFb: CsiFallbackHandlerType;\n protected _escHandlerFb: EscFallbackHandlerType;\n protected _errorHandlerFb: (state: IParsingState) => IParsingState;\n\n // parser stack save for async handler support\n protected _parseStack: IParserStackState = {\n state: ParserStackType.NONE,\n handlers: [],\n handlerPos: 0,\n transition: 0,\n chunkPos: 0\n };\n\n constructor(\n protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE\n ) {\n super();\n\n this.initialState = ParserState.GROUND;\n this.currentState = this.initialState;\n this._params = new Params(); // defaults to 32 storable params/subparams\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n\n // set default fallback handlers and handler lookup containers\n this._printHandlerFb = (data, start, end): void => { };\n this._executeHandlerFb = (code: number): void => { };\n this._csiHandlerFb = (ident: number, params: IParams): void => { };\n this._escHandlerFb = (ident: number): void => { };\n this._errorHandlerFb = (state: IParsingState): IParsingState => state;\n this._printHandler = this._printHandlerFb;\n this._executeHandlers = Object.create(null);\n this._csiHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n this._register(toDisposable(() => {\n this._csiHandlers = Object.create(null);\n this._executeHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n }));\n this._oscParser = this._register(new OscParser());\n this._dcsParser = this._register(new DcsParser());\n this._errorHandler = this._errorHandlerFb;\n\n // swallow 7bit ST (ESC+\\)\n this.registerEscHandler({ final: '\\\\' }, () => true);\n }\n\n protected _identifier(id: IFunctionIdentifier, finalRange: number[] = [0x40, 0x7e]): number {\n let res = 0;\n if (id.prefix) {\n if (id.prefix.length > 1) {\n throw new Error('only one byte as prefix supported');\n }\n res = id.prefix.charCodeAt(0);\n if (res && 0x3c > res || res > 0x3f) {\n throw new Error('prefix must be in range 0x3c .. 0x3f');\n }\n }\n if (id.intermediates) {\n if (id.intermediates.length > 2) {\n throw new Error('only two bytes as intermediates are supported');\n }\n for (let i = 0; i < id.intermediates.length; ++i) {\n const intermediate = id.intermediates.charCodeAt(i);\n if (0x20 > intermediate || intermediate > 0x2f) {\n throw new Error('intermediate must be in range 0x20 .. 0x2f');\n }\n res <<= 8;\n res |= intermediate;\n }\n }\n if (id.final.length !== 1) {\n throw new Error('final must be a single byte');\n }\n const finalCode = id.final.charCodeAt(0);\n if (finalRange[0] > finalCode || finalCode > finalRange[1]) {\n throw new Error(`final must be in range ${finalRange[0]} .. ${finalRange[1]}`);\n }\n res <<= 8;\n res |= finalCode;\n\n return res;\n }\n\n public identToString(ident: number): string {\n const res: string[] = [];\n while (ident) {\n res.push(String.fromCharCode(ident & 0xFF));\n ident >>= 8;\n }\n return res.reverse().join('');\n }\n\n public setPrintHandler(handler: PrintHandlerType): void {\n this._printHandler = handler;\n }\n public clearPrintHandler(): void {\n this._printHandler = this._printHandlerFb;\n }\n\n public registerEscHandler(id: IFunctionIdentifier, handler: EscHandlerType): IDisposable {\n const ident = this._identifier(id, [0x30, 0x7e]);\n if (this._escHandlers[ident] === undefined) {\n this._escHandlers[ident] = [];\n }\n const handlerList = this._escHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearEscHandler(id: IFunctionIdentifier): void {\n if (this._escHandlers[this._identifier(id, [0x30, 0x7e])]) delete this._escHandlers[this._identifier(id, [0x30, 0x7e])];\n }\n public setEscHandlerFallback(handler: EscFallbackHandlerType): void {\n this._escHandlerFb = handler;\n }\n\n public setExecuteHandler(flag: string, handler: ExecuteHandlerType): void {\n this._executeHandlers[flag.charCodeAt(0)] = handler;\n }\n public clearExecuteHandler(flag: string): void {\n if (this._executeHandlers[flag.charCodeAt(0)]) delete this._executeHandlers[flag.charCodeAt(0)];\n }\n public setExecuteHandlerFallback(handler: ExecuteFallbackHandlerType): void {\n this._executeHandlerFb = handler;\n }\n\n public registerCsiHandler(id: IFunctionIdentifier, handler: CsiHandlerType): IDisposable {\n const ident = this._identifier(id);\n if (this._csiHandlers[ident] === undefined) {\n this._csiHandlers[ident] = [];\n }\n const handlerList = this._csiHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearCsiHandler(id: IFunctionIdentifier): void {\n if (this._csiHandlers[this._identifier(id)]) delete this._csiHandlers[this._identifier(id)];\n }\n public setCsiHandlerFallback(callback: (ident: number, params: IParams) => void): void {\n this._csiHandlerFb = callback;\n }\n\n public registerDcsHandler(id: IFunctionIdentifier, handler: IDcsHandler): IDisposable {\n return this._dcsParser.registerHandler(this._identifier(id), handler);\n }\n public clearDcsHandler(id: IFunctionIdentifier): void {\n this._dcsParser.clearHandler(this._identifier(id));\n }\n public setDcsHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._dcsParser.setHandlerFallback(handler);\n }\n\n public registerOscHandler(ident: number, handler: IOscHandler): IDisposable {\n return this._oscParser.registerHandler(ident, handler);\n }\n public clearOscHandler(ident: number): void {\n this._oscParser.clearHandler(ident);\n }\n public setOscHandlerFallback(handler: OscFallbackHandlerType): void {\n this._oscParser.setHandlerFallback(handler);\n }\n\n public setErrorHandler(callback: (state: IParsingState) => IParsingState): void {\n this._errorHandler = callback;\n }\n public clearErrorHandler(): void {\n this._errorHandler = this._errorHandlerFb;\n }\n\n /**\n * Reset parser to initial values.\n *\n * This can also be used to lift the improper continuation error condition\n * when dealing with async handlers. Use this only as a last resort to silence\n * that error when the terminal has no pending data to be processed. Note that\n * the interrupted async handler might continue its work in the future messing\n * up the terminal state even further.\n */\n public reset(): void {\n this.currentState = this.initialState;\n this._oscParser.reset();\n this._dcsParser.reset();\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n // abort pending continuation from async handler\n // Here the RESET type indicates, that the next parse call will\n // ignore any saved stack, instead continues sync with next codepoint from GROUND\n if (this._parseStack.state !== ParserStackType.NONE) {\n this._parseStack.state = ParserStackType.RESET;\n this._parseStack.handlers = []; // also release handlers ref\n }\n }\n\n /**\n * Async parse support.\n */\n protected _preserveStack(\n state: ParserStackType,\n handlers: ResumableHandlersType,\n handlerPos: number,\n transition: number,\n chunkPos: number\n ): void {\n this._parseStack.state = state;\n this._parseStack.handlers = handlers;\n this._parseStack.handlerPos = handlerPos;\n this._parseStack.transition = transition;\n this._parseStack.chunkPos = chunkPos;\n }\n\n /**\n * Parse UTF32 codepoints in `data` up to `length`.\n *\n * Note: For several actions with high data load the parsing is optimized\n * by using local read ahead loops with hardcoded conditions to\n * avoid costly table lookups. Make sure that any change of table values\n * will be reflected in the loop conditions as well and vice versa.\n * Affected states/actions:\n * - GROUND:PRINT\n * - CSI_PARAM:PARAM\n * - DCS_PARAM:PARAM\n * - OSC_STRING:OSC_PUT\n * - DCS_PASSTHROUGH:DCS_PUT\n *\n * Note on asynchronous handler support:\n * Any handler returning a promise will be treated as asynchronous.\n * To keep the in-band blocking working for async handlers, `parse` pauses execution,\n * creates a stack save and returns the promise to the caller.\n * For proper continuation of the paused state it is important\n * to await the promise resolving. On resolve the parse must be repeated\n * with the same chunk of data and the resolved value in `promiseResult`\n * until no promise is returned.\n *\n * Important: With only sync handlers defined, parsing is completely synchronous as well.\n * As soon as an async handler is involved, synchronous parsing is not possible anymore.\n *\n * Boilerplate for proper parsing of multiple chunks with async handlers:\n *\n * ```typescript\n * async function parseMultipleChunks(chunks: Uint32Array[]): Promise {\n * for (const chunk of chunks) {\n * let result: void | Promise;\n * let prev: boolean | undefined;\n * while (result = parser.parse(chunk, chunk.length, prev)) {\n * prev = await result;\n * }\n * }\n * // finished parsing all chunks...\n * }\n * ```\n */\n public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise {\n let code = 0;\n let transition = 0;\n let start = 0;\n let handlerResult: void | boolean | Promise;\n\n // resume from async handler\n if (this._parseStack.state) {\n // allow sync parser reset even in continuation mode\n // Note: can be used to recover parser from improper continuation error below\n if (this._parseStack.state === ParserStackType.RESET) {\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1; // continue with next codepoint in GROUND\n } else {\n if (promiseResult === undefined || this._parseStack.state === ParserStackType.FAIL) {\n /**\n * Reject further parsing on improper continuation after pausing. This is a really bad\n * condition with screwed up execution order and prolly messed up terminal state,\n * therefore we exit hard with an exception and reject any further parsing.\n *\n * Note: With `Terminal.write` usage this exception should never occur, as the top level\n * calls are guaranteed to handle async conditions properly. If you ever encounter this\n * exception in your terminal integration it indicates, that you injected data chunks to\n * `InputHandler.parse` or `EscapeSequenceParser.parse` synchronously without waiting for\n * continuation of a running async handler.\n *\n * It is possible to get rid of this error by calling `reset`. But dont rely on that, as\n * the pending async handler still might mess up the terminal later. Instead fix the\n * faulty async handling, so this error will not be thrown anymore.\n */\n this._parseStack.state = ParserStackType.FAIL;\n throw new Error('improper continuation due to previous async handler, giving up parsing');\n }\n\n // we have to resume the old handler loop if:\n // - return value of the promise was `false`\n // - handlers are not exhausted yet\n const handlers = this._parseStack.handlers;\n let handlerPos = this._parseStack.handlerPos - 1;\n switch (this._parseStack.state) {\n case ParserStackType.CSI:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as CsiHandlerType[])[handlerPos](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.ESC:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as EscHandlerType[])[handlerPos]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.DCS:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserStackType.OSC:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n }\n // cleanup before continuing with the main sync loop\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1;\n this.precedingJoinState = 0;\n this.currentState = this._parseStack.transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n\n // continue with main sync loop\n\n // process input string\n for (let i = start; i < length; ++i) {\n code = data[i];\n\n // normal transition & action lookup\n transition = this._transitions.table[this.currentState << TableAccess.INDEX_STATE_SHIFT | (code < 0xa0 ? code : NON_ASCII_PRINTABLE)];\n switch (transition >> TableAccess.TRANSITION_ACTION_SHIFT) {\n case ParserAction.PRINT:\n // read ahead with loop unrolling\n // Note: 0x20 (SP) is included, 0x7F (DEL) is excluded\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.EXECUTE:\n if (this._executeHandlers[code]) this._executeHandlers[code]();\n else this._executeHandlerFb(code);\n this.precedingJoinState = 0;\n break;\n case ParserAction.IGNORE:\n break;\n case ParserAction.ERROR:\n const inject: IParsingState = this._errorHandler(\n {\n position: i,\n code,\n currentState: this.currentState,\n collect: this._collect,\n params: this._params,\n abort: false\n });\n if (inject.abort) return;\n // inject values: currently not implemented\n break;\n case ParserAction.CSI_DISPATCH:\n // Trigger CSI Handler\n const handlers = this._csiHandlers[this._collect << 8 | code];\n let j = handlers ? handlers.length - 1 : -1;\n for (; j >= 0; j--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlers[j](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.CSI, handlers, j, transition, i);\n return handlerResult;\n }\n }\n if (j < 0) {\n this._csiHandlerFb(this._collect << 8 | code, this._params);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.PARAM:\n // inner loop: digits (0x30 - 0x39) and ; (0x3b) and : (0x3a)\n do {\n switch (code) {\n case 0x3b:\n this._params.addParam(0); // ZDM\n break;\n case 0x3a:\n this._params.addSubParam(-1);\n break;\n default: // 0x30 - 0x39\n this._params.addDigit(code - 48);\n }\n } while (++i < length && (code = data[i]) > 0x2f && code < 0x3c);\n i--;\n break;\n case ParserAction.COLLECT:\n this._collect <<= 8;\n this._collect |= code;\n break;\n case ParserAction.ESC_DISPATCH:\n const handlersEsc = this._escHandlers[this._collect << 8 | code];\n let jj = handlersEsc ? handlersEsc.length - 1 : -1;\n for (; jj >= 0; jj--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlersEsc[jj]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.ESC, handlersEsc, jj, transition, i);\n return handlerResult;\n }\n }\n if (jj < 0) {\n this._escHandlerFb(this._collect << 8 | code);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.CLEAR:\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserAction.DCS_HOOK:\n this._dcsParser.hook(this._collect << 8 | code, this._params);\n break;\n case ParserAction.DCS_PUT:\n // inner loop - exit DCS_PUT: 0x18, 0x1a, 0x1b, 0x7f, 0x80 - 0x9f\n // unhook triggered by: 0x1b, 0x9c (success) and 0x18, 0x1a (abort)\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._dcsParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.DCS_UNHOOK:\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.DCS, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n case ParserAction.OSC_START:\n this._oscParser.start();\n break;\n case ParserAction.OSC_PUT:\n // inner loop: 0x20 (SP) included, 0x7F (DEL) included\n for (let j = i + 1; ; j++) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._oscParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.OSC_END:\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.OSC, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n }\n this.currentState = transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n\n// 'rgb:' rule - matching: r/g/b | rr/gg/bb | rrr/ggg/bbb | rrrr/gggg/bbbb (hex digits)\nconst RGB_REX = /^([\\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})$/;\n// '#...' rule - matching any hex digits\nconst HASH_REX = /^[\\da-f]+$/;\n\n/**\n * Parse color spec to RGB values (8 bit per channel).\n * See `man xparsecolor` for details about certain format specifications.\n *\n * Supported formats:\n * - rgb:// with , , in h | hh | hhh | hhhh\n * - #RGB, #RRGGBB, #RRRGGGBBB, #RRRRGGGGBBBB\n *\n * All other formats like rgbi: or device-independent string specifications\n * with float numbering are not supported.\n */\nexport function parseColor(data: string): [number, number, number] | undefined {\n if (!data) return;\n // also handle uppercases\n let low = data.toLowerCase();\n if (low.indexOf('rgb:') === 0) {\n // 'rgb:' specifier\n low = low.slice(4);\n const m = RGB_REX.exec(low);\n if (m) {\n const base = m[1] ? 15 : m[4] ? 255 : m[7] ? 4095 : 65535;\n return [\n Math.round(parseInt(m[1] || m[4] || m[7] || m[10], 16) / base * 255),\n Math.round(parseInt(m[2] || m[5] || m[8] || m[11], 16) / base * 255),\n Math.round(parseInt(m[3] || m[6] || m[9] || m[12], 16) / base * 255)\n ];\n }\n } else if (low.indexOf('#') === 0) {\n // '#' specifier\n low = low.slice(1);\n if (HASH_REX.exec(low) && [3, 6, 9, 12].includes(low.length)) {\n const adv = low.length / 3;\n const result: [number, number, number] = [0, 0, 0];\n for (let i = 0; i < 3; ++i) {\n const c = parseInt(low.slice(adv * i, adv * i + adv), 16);\n result[i] = adv === 1 ? c << 4 : adv === 2 ? c : adv === 3 ? c >> 4 : c >> 8;\n }\n return result;\n }\n }\n\n // Named colors are currently not supported due to the large addition to the xterm.js bundle size\n // they would add. In order to support named colors, we would need some way of optionally loading\n // additional payloads so startup/download time is not bloated (see #3530).\n}\n\n// pad hex output to requested bit width\nfunction pad(n: number, bits: number): string {\n const s = n.toString(16);\n const s2 = s.length < 2 ? '0' + s : s;\n switch (bits) {\n case 4:\n return s[0];\n case 8:\n return s2;\n case 12:\n return (s2 + s2).slice(0, 3);\n default:\n return s2 + s2;\n }\n}\n\n/**\n * Convert a given color to rgb:../../.. string of `bits` depth.\n */\nexport function toRgbString(color: [number, number, number], bits: number = 16): string {\n const [r, g, b] = color;\n return `rgb:${pad(r, bits)}/${pad(g, bits)}/${pad(b, bits)}`;\n}\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from 'common/Types';\nimport { C0, C1 } from 'common/data/EscapeSequences';\nimport { CHARSETS, DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from 'common/input/TextDecoder';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from 'common/parser/Types';\nimport { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { ICoreService, IBufferService, IOptionsService, ILogService, ICoreMouseService, ICharsetService, IUnicodeService, LogLevelEnum, IOscLinkService } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { OscHandler } from 'common/parser/OscParser';\nimport { DcsHandler } from 'common/parser/DcsParser';\nimport { IBuffer } from 'common/buffer/Types';\nimport { parseColor } from 'common/input/XParseColor';\nimport { Emitter } from 'vs/base/common/event';\n\n/**\n * Map collect to glevel. Used in `selectCharset`.\n */\nconst GLEVEL: { [key: string]: number } = { '(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2 };\n\n/**\n * VT commands done by the parser - FIXME: move this to the parser?\n */\n// @vt: #Y ESC CSI \"Control Sequence Introducer\" \"ESC [\" \"Start of a CSI sequence.\"\n// @vt: #Y ESC OSC \"Operating System Command\" \"ESC ]\" \"Start of an OSC sequence.\"\n// @vt: #Y ESC DCS \"Device Control String\" \"ESC P\" \"Start of a DCS sequence.\"\n// @vt: #Y ESC ST \"String Terminator\" \"ESC \\\" \"Terminator used for string type sequences.\"\n// @vt: #Y ESC PM \"Privacy Message\" \"ESC ^\" \"Start of a privacy message.\"\n// @vt: #Y ESC APC \"Application Program Command\" \"ESC _\" \"Start of an APC sequence.\"\n// @vt: #Y C1 CSI \"Control Sequence Introducer\" \"\\x9B\" \"Start of a CSI sequence.\"\n// @vt: #Y C1 OSC \"Operating System Command\" \"\\x9D\" \"Start of an OSC sequence.\"\n// @vt: #Y C1 DCS \"Device Control String\" \"\\x90\" \"Start of a DCS sequence.\"\n// @vt: #Y C1 ST \"String Terminator\" \"\\x9C\" \"Terminator used for string type sequences.\"\n// @vt: #Y C1 PM \"Privacy Message\" \"\\x9E\" \"Start of a privacy message.\"\n// @vt: #Y C1 APC \"Application Program Command\" \"\\x9F\" \"Start of an APC sequence.\"\n// @vt: #Y C0 NUL \"Null\" \"\\0, \\x00\" \"NUL is ignored.\"\n// @vt: #Y C0 ESC \"Escape\" \"\\e, \\x1B\" \"Start of a sequence. Cancels any other sequence.\"\n\n/**\n * Document xterm VT features here that are currently unsupported\n */\n// @vt: #E[Supported via @xterm/addon-image.] DCS SIXEL \"SIXEL Graphics\" \"DCS Ps ; Ps ; Ps ; q \tPt ST\" \"Draw SIXEL image.\"\n// @vt: #N DCS DECUDK \"User Defined Keys\" \"DCS Ps ; Ps \\| Pt ST\" \"Definitions for user-defined keys.\"\n// @vt: #N DCS XTGETTCAP \"Request Terminfo String\" \"DCS + q Pt ST\" \"Request Terminfo String.\"\n// @vt: #N DCS XTSETTCAP \"Set Terminfo Data\" \"DCS + p Pt ST\" \"Set Terminfo Data.\"\n// @vt: #N OSC 1 \"Set Icon Name\" \"OSC 1 ; Pt BEL\" \"Set icon name.\"\n\n/**\n * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher.\n */\nconst MAX_PARSEBUFFER_LENGTH = 131072;\n\n/**\n * Limit length of title and icon name stacks.\n */\nconst STACK_LIMIT = 10;\n\n// map params to window option\nfunction paramToWindowOption(n: number, opts: IWindowOptions): boolean {\n if (n > 24) {\n return opts.setWinLines || false;\n }\n switch (n) {\n case 1: return !!opts.restoreWin;\n case 2: return !!opts.minimizeWin;\n case 3: return !!opts.setWinPosition;\n case 4: return !!opts.setWinSizePixels;\n case 5: return !!opts.raiseWin;\n case 6: return !!opts.lowerWin;\n case 7: return !!opts.refreshWin;\n case 8: return !!opts.setWinSizeChars;\n case 9: return !!opts.maximizeWin;\n case 10: return !!opts.fullscreenWin;\n case 11: return !!opts.getWinState;\n case 13: return !!opts.getWinPosition;\n case 14: return !!opts.getWinSizePixels;\n case 15: return !!opts.getScreenSizePixels;\n case 16: return !!opts.getCellSizePixels;\n case 18: return !!opts.getWinSizeChars;\n case 19: return !!opts.getScreenSizeChars;\n case 20: return !!opts.getIconTitle;\n case 21: return !!opts.getWinTitle;\n case 22: return !!opts.pushTitle;\n case 23: return !!opts.popTitle;\n case 24: return !!opts.setWinLines;\n }\n return false;\n}\n\nexport enum WindowsOptionsReportType {\n GET_WIN_SIZE_PIXELS = 0,\n GET_CELL_SIZE_PIXELS = 1\n}\n\n// create a warning log if an async handler takes longer than the limit (in ms)\nconst SLOW_ASYNC_LIMIT = 5000;\n\n// Work variables to avoid garbage collection\nlet $temp = 0;\n\n/**\n * The terminal's standard implementation of IInputHandler, this handles all\n * input from the Parser.\n *\n * Refer to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html to understand\n * each function's header comment.\n */\nexport class InputHandler extends Disposable implements IInputHandler {\n private _parseBuffer: Uint32Array = new Uint32Array(4096);\n private _stringDecoder: StringToUtf32 = new StringToUtf32();\n private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32();\n private _windowTitle = '';\n private _iconName = '';\n private _dirtyRowTracker: IDirtyRowTracker;\n protected _windowTitleStack: string[] = [];\n protected _iconNameStack: string[] = [];\n\n private _curAttrData: IAttributeData = DEFAULT_ATTR_DATA.clone();\n public getAttrData(): IAttributeData { return this._curAttrData; }\n private _eraseAttrDataInternal: IAttributeData = DEFAULT_ATTR_DATA.clone();\n\n private _activeBuffer: IBuffer;\n\n private readonly _onRequestBell = this._register(new Emitter());\n public readonly onRequestBell = this._onRequestBell.event;\n private readonly _onRequestRefreshRows = this._register(new Emitter<{ start: number, end: number } | undefined>());\n public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;\n private readonly _onRequestReset = this._register(new Emitter());\n public readonly onRequestReset = this._onRequestReset.event;\n private readonly _onRequestSendFocus = this._register(new Emitter());\n public readonly onRequestSendFocus = this._onRequestSendFocus.event;\n private readonly _onRequestSyncScrollBar = this._register(new Emitter());\n public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;\n private readonly _onRequestWindowsOptionsReport = this._register(new Emitter());\n public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;\n\n private readonly _onA11yChar = this._register(new Emitter());\n public readonly onA11yChar = this._onA11yChar.event;\n private readonly _onA11yTab = this._register(new Emitter());\n public readonly onA11yTab = this._onA11yTab.event;\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onColor = this._register(new Emitter());\n public readonly onColor = this._onColor.event;\n\n private _parseStack: IParseStack = {\n paused: false,\n cursorStartX: 0,\n cursorStartY: 0,\n decodedLength: 0,\n position: 0\n };\n\n constructor(\n private readonly _bufferService: IBufferService,\n private readonly _charsetService: ICharsetService,\n private readonly _coreService: ICoreService,\n private readonly _logService: ILogService,\n private readonly _optionsService: IOptionsService,\n private readonly _oscLinkService: IOscLinkService,\n private readonly _coreMouseService: ICoreMouseService,\n private readonly _unicodeService: IUnicodeService,\n private readonly _parser: IEscapeSequenceParser = new EscapeSequenceParser()\n ) {\n super();\n this._register(this._parser);\n this._dirtyRowTracker = new DirtyRowTracker(this._bufferService);\n\n // Track properties used in performance critical code manually to avoid using slow getters\n this._activeBuffer = this._bufferService.buffer;\n this._register(this._bufferService.buffers.onBufferActivate(e => this._activeBuffer = e.activeBuffer));\n\n /**\n * custom fallback handlers\n */\n this._parser.setCsiHandlerFallback((ident, params) => {\n this._logService.debug('Unknown CSI code: ', { identifier: this._parser.identToString(ident), params: params.toArray() });\n });\n this._parser.setEscHandlerFallback(ident => {\n this._logService.debug('Unknown ESC code: ', { identifier: this._parser.identToString(ident) });\n });\n this._parser.setExecuteHandlerFallback(code => {\n this._logService.debug('Unknown EXECUTE code: ', { code });\n });\n this._parser.setOscHandlerFallback((identifier, action, data) => {\n this._logService.debug('Unknown OSC code: ', { identifier, action, data });\n });\n this._parser.setDcsHandlerFallback((ident, action, payload) => {\n if (action === 'HOOK') {\n payload = payload.toArray();\n }\n this._logService.debug('Unknown DCS code: ', { identifier: this._parser.identToString(ident), action, payload });\n });\n\n /**\n * print handler\n */\n this._parser.setPrintHandler((data, start, end) => this.print(data, start, end));\n\n /**\n * CSI handler\n */\n this._parser.registerCsiHandler({ final: '@' }, params => this.insertChars(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: '@' }, params => this.scrollLeft(params));\n this._parser.registerCsiHandler({ final: 'A' }, params => this.cursorUp(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'A' }, params => this.scrollRight(params));\n this._parser.registerCsiHandler({ final: 'B' }, params => this.cursorDown(params));\n this._parser.registerCsiHandler({ final: 'C' }, params => this.cursorForward(params));\n this._parser.registerCsiHandler({ final: 'D' }, params => this.cursorBackward(params));\n this._parser.registerCsiHandler({ final: 'E' }, params => this.cursorNextLine(params));\n this._parser.registerCsiHandler({ final: 'F' }, params => this.cursorPrecedingLine(params));\n this._parser.registerCsiHandler({ final: 'G' }, params => this.cursorCharAbsolute(params));\n this._parser.registerCsiHandler({ final: 'H' }, params => this.cursorPosition(params));\n this._parser.registerCsiHandler({ final: 'I' }, params => this.cursorForwardTab(params));\n this._parser.registerCsiHandler({ final: 'J' }, params => this.eraseInDisplay(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'J' }, params => this.eraseInDisplay(params, true));\n this._parser.registerCsiHandler({ final: 'K' }, params => this.eraseInLine(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'K' }, params => this.eraseInLine(params, true));\n this._parser.registerCsiHandler({ final: 'L' }, params => this.insertLines(params));\n this._parser.registerCsiHandler({ final: 'M' }, params => this.deleteLines(params));\n this._parser.registerCsiHandler({ final: 'P' }, params => this.deleteChars(params));\n this._parser.registerCsiHandler({ final: 'S' }, params => this.scrollUp(params));\n this._parser.registerCsiHandler({ final: 'T' }, params => this.scrollDown(params));\n this._parser.registerCsiHandler({ final: 'X' }, params => this.eraseChars(params));\n this._parser.registerCsiHandler({ final: 'Z' }, params => this.cursorBackwardTab(params));\n this._parser.registerCsiHandler({ final: '`' }, params => this.charPosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'a' }, params => this.hPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'b' }, params => this.repeatPrecedingCharacter(params));\n this._parser.registerCsiHandler({ final: 'c' }, params => this.sendDeviceAttributesPrimary(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'c' }, params => this.sendDeviceAttributesSecondary(params));\n this._parser.registerCsiHandler({ final: 'd' }, params => this.linePosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'e' }, params => this.vPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'f' }, params => this.hVPosition(params));\n this._parser.registerCsiHandler({ final: 'g' }, params => this.tabClear(params));\n this._parser.registerCsiHandler({ final: 'h' }, params => this.setMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'h' }, params => this.setModePrivate(params));\n this._parser.registerCsiHandler({ final: 'l' }, params => this.resetMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'l' }, params => this.resetModePrivate(params));\n this._parser.registerCsiHandler({ final: 'm' }, params => this.charAttributes(params));\n this._parser.registerCsiHandler({ final: 'n' }, params => this.deviceStatus(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'n' }, params => this.deviceStatusPrivate(params));\n this._parser.registerCsiHandler({ intermediates: '!', final: 'p' }, params => this.softReset(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'q' }, params => this.setCursorStyle(params));\n this._parser.registerCsiHandler({ final: 'r' }, params => this.setScrollRegion(params));\n this._parser.registerCsiHandler({ final: 's' }, params => this.saveCursor(params));\n this._parser.registerCsiHandler({ final: 't' }, params => this.windowOptions(params));\n this._parser.registerCsiHandler({ final: 'u' }, params => this.restoreCursor(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '}' }, params => this.insertColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '~' }, params => this.deleteColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\"', final: 'q' }, params => this.selectProtected(params));\n this._parser.registerCsiHandler({ intermediates: '$', final: 'p' }, params => this.requestMode(params, true));\n this._parser.registerCsiHandler({ prefix: '?', intermediates: '$', final: 'p' }, params => this.requestMode(params, false));\n\n /**\n * execute handler\n */\n this._parser.setExecuteHandler(C0.BEL, () => this.bell());\n this._parser.setExecuteHandler(C0.LF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.VT, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.FF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn());\n this._parser.setExecuteHandler(C0.BS, () => this.backspace());\n this._parser.setExecuteHandler(C0.HT, () => this.tab());\n this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());\n this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());\n // FIXME: What do to with missing? Old code just added those to print.\n\n this._parser.setExecuteHandler(C1.IND, () => this.index());\n this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());\n this._parser.setExecuteHandler(C1.HTS, () => this.tabSet());\n\n /**\n * OSC handler\n */\n // 0 - icon name + title\n this._parser.registerOscHandler(0, new OscHandler(data => { this.setTitle(data); this.setIconName(data); return true; }));\n // 1 - icon name\n this._parser.registerOscHandler(1, new OscHandler(data => this.setIconName(data)));\n // 2 - title\n this._parser.registerOscHandler(2, new OscHandler(data => this.setTitle(data)));\n // 3 - set property X in the form \"prop=value\"\n // 4 - Change Color Number\n this._parser.registerOscHandler(4, new OscHandler(data => this.setOrReportIndexedColor(data)));\n // 5 - Change Special Color Number\n // 6 - Enable/disable Special Color Number c\n // 7 - current directory? (not in xterm spec, see https://gitlab.com/gnachman/iterm2/issues/3939)\n // 8 - create hyperlink (not in xterm spec, see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)\n this._parser.registerOscHandler(8, new OscHandler(data => this.setHyperlink(data)));\n // 10 - Change VT100 text foreground color to Pt.\n this._parser.registerOscHandler(10, new OscHandler(data => this.setOrReportFgColor(data)));\n // 11 - Change VT100 text background color to Pt.\n this._parser.registerOscHandler(11, new OscHandler(data => this.setOrReportBgColor(data)));\n // 12 - Change text cursor color to Pt.\n this._parser.registerOscHandler(12, new OscHandler(data => this.setOrReportCursorColor(data)));\n // 13 - Change mouse foreground color to Pt.\n // 14 - Change mouse background color to Pt.\n // 15 - Change Tektronix foreground color to Pt.\n // 16 - Change Tektronix background color to Pt.\n // 17 - Change highlight background color to Pt.\n // 18 - Change Tektronix cursor color to Pt.\n // 19 - Change highlight foreground color to Pt.\n // 46 - Change Log File to Pt.\n // 50 - Set Font to Pt.\n // 51 - reserved for Emacs shell.\n // 52 - Manipulate Selection Data.\n // 104 ; c - Reset Color Number c.\n this._parser.registerOscHandler(104, new OscHandler(data => this.restoreIndexedColor(data)));\n // 105 ; c - Reset Special Color Number c.\n // 106 ; c; f - Enable/disable Special Color Number c.\n // 110 - Reset VT100 text foreground color.\n this._parser.registerOscHandler(110, new OscHandler(data => this.restoreFgColor(data)));\n // 111 - Reset VT100 text background color.\n this._parser.registerOscHandler(111, new OscHandler(data => this.restoreBgColor(data)));\n // 112 - Reset text cursor color.\n this._parser.registerOscHandler(112, new OscHandler(data => this.restoreCursorColor(data)));\n // 113 - Reset mouse foreground color.\n // 114 - Reset mouse background color.\n // 115 - Reset Tektronix foreground color.\n // 116 - Reset Tektronix background color.\n // 117 - Reset highlight color.\n // 118 - Reset Tektronix cursor color.\n // 119 - Reset highlight foreground color.\n\n /**\n * ESC handlers\n */\n this._parser.registerEscHandler({ final: '7' }, () => this.saveCursor());\n this._parser.registerEscHandler({ final: '8' }, () => this.restoreCursor());\n this._parser.registerEscHandler({ final: 'D' }, () => this.index());\n this._parser.registerEscHandler({ final: 'E' }, () => this.nextLine());\n this._parser.registerEscHandler({ final: 'H' }, () => this.tabSet());\n this._parser.registerEscHandler({ final: 'M' }, () => this.reverseIndex());\n this._parser.registerEscHandler({ final: '=' }, () => this.keypadApplicationMode());\n this._parser.registerEscHandler({ final: '>' }, () => this.keypadNumericMode());\n this._parser.registerEscHandler({ final: 'c' }, () => this.fullReset());\n this._parser.registerEscHandler({ final: 'n' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: 'o' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '|' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '}' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: '~' }, () => this.setgLevel(1));\n this._parser.registerEscHandler({ intermediates: '%', final: '@' }, () => this.selectDefaultCharset());\n this._parser.registerEscHandler({ intermediates: '%', final: 'G' }, () => this.selectDefaultCharset());\n for (const flag in CHARSETS) {\n this._parser.registerEscHandler({ intermediates: '(', final: flag }, () => this.selectCharset('(' + flag));\n this._parser.registerEscHandler({ intermediates: ')', final: flag }, () => this.selectCharset(')' + flag));\n this._parser.registerEscHandler({ intermediates: '*', final: flag }, () => this.selectCharset('*' + flag));\n this._parser.registerEscHandler({ intermediates: '+', final: flag }, () => this.selectCharset('+' + flag));\n this._parser.registerEscHandler({ intermediates: '-', final: flag }, () => this.selectCharset('-' + flag));\n this._parser.registerEscHandler({ intermediates: '.', final: flag }, () => this.selectCharset('.' + flag));\n this._parser.registerEscHandler({ intermediates: '/', final: flag }, () => this.selectCharset('/' + flag)); // TODO: supported?\n }\n this._parser.registerEscHandler({ intermediates: '#', final: '8' }, () => this.screenAlignmentPattern());\n\n /**\n * error handler\n */\n this._parser.setErrorHandler((state: IParsingState) => {\n this._logService.error('Parsing error: ', state);\n return state;\n });\n\n /**\n * DCS handler\n */\n this._parser.registerDcsHandler({ intermediates: '$', final: 'q' }, new DcsHandler((data, params) => this.requestStatusString(data, params)));\n }\n\n /**\n * Async parse support.\n */\n private _preserveStack(cursorStartX: number, cursorStartY: number, decodedLength: number, position: number): void {\n this._parseStack.paused = true;\n this._parseStack.cursorStartX = cursorStartX;\n this._parseStack.cursorStartY = cursorStartY;\n this._parseStack.decodedLength = decodedLength;\n this._parseStack.position = position;\n }\n\n private _logSlowResolvingAsync(p: Promise): void {\n // log a limited warning about an async handler taking too long\n if (this._logService.logLevel <= LogLevelEnum.WARN) {\n Promise.race([p, new Promise((res, rej) => setTimeout(() => rej('#SLOW_TIMEOUT'), SLOW_ASYNC_LIMIT))])\n .catch(err => {\n if (err !== '#SLOW_TIMEOUT') {\n throw err;\n }\n console.warn(`async parser handler taking longer than ${SLOW_ASYNC_LIMIT} ms`);\n });\n }\n }\n\n private _getCurrentLinkId(): number {\n return this._curAttrData.extended.urlId;\n }\n\n /**\n * Parse call with async handler support.\n *\n * Whether the stack state got preserved for the next call, is indicated by the return value:\n * - undefined (void):\n * all handlers were sync, no stack save, continue normally with next chunk\n * - Promise\\:\n * execution stopped at async handler, stack saved, continue with same chunk and the promise\n * resolve value as `promiseResult` until the method returns `undefined`\n *\n * Note: This method should only be called by `Terminal.write` to ensure correct execution order\n * and proper continuation of async parser handlers.\n */\n public parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise {\n let result: void | Promise;\n let cursorStartX = this._activeBuffer.x;\n let cursorStartY = this._activeBuffer.y;\n let start = 0;\n const wasPaused = this._parseStack.paused;\n\n if (wasPaused) {\n // assumption: _parseBuffer never mutates between async calls\n if (result = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, promiseResult)) {\n this._logSlowResolvingAsync(result);\n return result;\n }\n cursorStartX = this._parseStack.cursorStartX;\n cursorStartY = this._parseStack.cursorStartY;\n this._parseStack.paused = false;\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n start = this._parseStack.position + MAX_PARSEBUFFER_LENGTH;\n }\n }\n\n // Log debug data, the log level gate is to prevent extra work in this hot path\n if (this._logService.logLevel <= LogLevelEnum.DEBUG) {\n this._logService.debug(`parsing data${typeof data === 'string' ? ` \"${data}\"` : ` \"${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}\"`}`, typeof data === 'string'\n ? data.split('').map(e => e.charCodeAt(0))\n : data\n );\n }\n\n // resize input buffer if needed\n if (this._parseBuffer.length < data.length) {\n if (this._parseBuffer.length < MAX_PARSEBUFFER_LENGTH) {\n this._parseBuffer = new Uint32Array(Math.min(data.length, MAX_PARSEBUFFER_LENGTH));\n }\n }\n\n // Clear the dirty row service so we know which lines changed as a result of parsing\n // Important: do not clear between async calls, otherwise we lost pending update information.\n if (!wasPaused) {\n this._dirtyRowTracker.clearRange();\n }\n\n // process big data in smaller chunks\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n for (let i = start; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {\n const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length;\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer)\n : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, i);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n } else {\n if (!wasPaused) {\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data, this._parseBuffer)\n : this._utf8Decoder.decode(data, this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, 0);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n }\n\n if (this._activeBuffer.x !== cursorStartX || this._activeBuffer.y !== cursorStartY) {\n this._onCursorMove.fire();\n }\n\n // Refresh any dirty rows accumulated as part of parsing, fire only for rows within the\n // _viewport_ which is relative to ydisp, not relative to ybase.\n const viewportEnd = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n const viewportStart = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n if (viewportStart < this._bufferService.rows) {\n this._onRequestRefreshRows.fire({\n start: Math.min(viewportStart, this._bufferService.rows - 1),\n end: Math.min(viewportEnd, this._bufferService.rows - 1)\n });\n }\n }\n\n public print(data: Uint32Array, start: number, end: number): void {\n let code: number;\n let chWidth: number;\n const charset = this._charsetService.charset;\n const screenReaderMode = this._optionsService.rawOptions.screenReaderMode;\n const cols = this._bufferService.cols;\n const wraparoundMode = this._coreService.decPrivateModes.wraparound;\n const insertMode = this._coreService.modes.insertMode;\n const curAttr = this._curAttrData;\n let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n // handle wide chars: reset start_cell-1 if we would overwrite the second cell of a wide char\n if (this._activeBuffer.x && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, curAttr);\n }\n\n let precedingJoinState = this._parser.precedingJoinState;\n for (let pos = start; pos < end; ++pos) {\n code = data[pos];\n\n // get charset replacement character\n // charset is only defined for ASCII, therefore we only\n // search for an replacement char if code < 127\n if (code < 127 && charset) {\n const ch = charset[String.fromCharCode(code)];\n if (ch) {\n code = ch.charCodeAt(0);\n }\n }\n\n const currentInfo = this._unicodeService.charProperties(code, precedingJoinState);\n chWidth = UnicodeService.extractWidth(currentInfo);\n const shouldJoin = UnicodeService.extractShouldJoin(currentInfo);\n const oldWidth = shouldJoin ? UnicodeService.extractWidth(precedingJoinState) : 0;\n precedingJoinState = currentInfo;\n\n if (screenReaderMode) {\n this._onA11yChar.fire(stringFromCodePoint(code));\n }\n if (this._getCurrentLinkId()) {\n this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y);\n }\n\n // goto next line if ch would overflow\n // NOTE: To avoid costly width checks here,\n // the terminal does not allow a cols < 2.\n if (this._activeBuffer.x + chWidth - oldWidth > cols) {\n // autowrap - DECAWM\n // automatically wraps to the beginning of the next line\n if (wraparoundMode) {\n const oldRow = bufferRow;\n let oldCol = this._activeBuffer.x - oldWidth;\n this._activeBuffer.x = oldWidth;\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData(), true);\n } else {\n if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n // The line already exists (eg. the initial viewport), mark it as a\n // wrapped line\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = true;\n }\n // row changed, get it again\n bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n if (oldWidth > 0 && bufferRow instanceof BufferLine) {\n // Combining character widens 1 column to 2.\n // Move old character to next line.\n bufferRow.copyCellsFrom(oldRow as BufferLine,\n oldCol, 0, oldWidth, false);\n }\n // clear left over cells to the right\n while (oldCol < cols) {\n oldRow.setCellFromCodepoint(oldCol++, 0, 1, curAttr);\n }\n } else {\n this._activeBuffer.x = cols - 1;\n if (chWidth === 2) {\n // FIXME: check for xterm behavior\n // What to do here? We got a wide char that does not fit into last cell\n continue;\n }\n }\n }\n\n // insert combining char at last cursor position\n // this._activeBuffer.x should never be 0 for a combining char\n // since they always follow a cell consuming char\n // therefore we can test for this._activeBuffer.x to avoid overflow left\n if (shouldJoin && this._activeBuffer.x) {\n const offset = bufferRow.getWidth(this._activeBuffer.x - 1) ? 1 : 2;\n // if empty cell after fullwidth, need to go 2 cells back\n // it is save to step 2 cells back here\n // since an empty cell is only set by fullwidth chars\n bufferRow.addCodepointToCell(this._activeBuffer.x - offset,\n code, chWidth);\n for (let delta = chWidth - oldWidth; --delta >= 0; ) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n continue;\n }\n\n // insert mode: move characters to right\n if (insertMode) {\n // right shift cells according to the width\n bufferRow.insertCells(this._activeBuffer.x, chWidth - oldWidth, this._activeBuffer.getNullCell(curAttr));\n // test last cell - since the last cell has only room for\n // a halfwidth char any fullwidth shifted there is lost\n // and will be set to empty cell\n if (bufferRow.getWidth(cols - 1) === 2) {\n bufferRow.setCellFromCodepoint(cols - 1, NULL_CELL_CODE, NULL_CELL_WIDTH, curAttr);\n }\n }\n\n // write current char to buffer and advance cursor\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, code, chWidth, curAttr);\n\n // fullwidth char - also set next cell to placeholder stub and advance cursor\n // for graphemes bigger than fullwidth we can simply loop to zero\n // we already made sure above, that this._activeBuffer.x + chWidth will not overflow right\n if (chWidth > 0) {\n while (--chWidth) {\n // other than a regular empty cell a cell following a wide char has no width\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n }\n }\n\n this._parser.precedingJoinState = precedingJoinState;\n\n // handle wide chars: reset cell to the right if it is second cell of a wide char\n if (this._activeBuffer.x < cols && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x) === 0 && !bufferRow.hasContent(this._activeBuffer.x)) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x, 0, 1, curAttr);\n }\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Forward registerCsiHandler from parser.\n */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n if (id.final === 't' && !id.prefix && !id.intermediates) {\n // security: always check whether window option is allowed\n return this._parser.registerCsiHandler(id, params => {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n return callback(params);\n });\n }\n return this._parser.registerCsiHandler(id, callback);\n }\n\n /**\n * Forward registerDcsHandler from parser.\n */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._parser.registerDcsHandler(id, new DcsHandler(callback));\n }\n\n /**\n * Forward registerEscHandler from parser.\n */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._parser.registerEscHandler(id, callback);\n }\n\n /**\n * Forward registerOscHandler from parser.\n */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._parser.registerOscHandler(ident, new OscHandler(callback));\n }\n\n /**\n * BEL\n * Bell (Ctrl-G).\n *\n * @vt: #Y C0 BEL \"Bell\" \"\\a, \\x07\" \"Ring the bell.\"\n * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`\n * and `ITerminalOptions.bellSound`.\n */\n public bell(): boolean {\n this._onRequestBell.fire();\n return true;\n }\n\n /**\n * LF\n * Line Feed or New Line (NL). (LF is Ctrl-J).\n *\n * @vt: #Y C0 LF \"Line Feed\" \"\\n, \\x0A\" \"Move the cursor one row down, scrolling if needed.\"\n * Scrolling is restricted to scroll margins and will only happen on the bottom line.\n *\n * @vt: #Y C0 VT \"Vertical Tabulation\" \"\\v, \\x0B\" \"Treated as LF.\"\n * @vt: #Y C0 FF \"Form Feed\" \"\\f, \\x0C\" \"Treated as LF.\"\n */\n public lineFeed(): boolean {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._optionsService.rawOptions.convertEol) {\n this._activeBuffer.x = 0;\n }\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n } else {\n // There was an explicit line feed (not just a carriage return), so clear the wrapped state of\n // the line. This is particularly important on conpty/Windows where revisiting lines to\n // reprint is common, especially on resize. Note that the windowsMode wrapped line heuristics\n // can mess with this so windowsMode should be disabled, which is recommended on Windows build\n // 21376 and above.\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (this._activeBuffer.x >= this._bufferService.cols) {\n this._activeBuffer.x--;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n this._onLineFeed.fire();\n return true;\n }\n\n /**\n * CR\n * Carriage Return (Ctrl-M).\n *\n * @vt: #Y C0 CR \"Carriage Return\" \"\\r, \\x0D\" \"Move the cursor to the beginning of the row.\"\n */\n public carriageReturn(): boolean {\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * BS\n * Backspace (Ctrl-H).\n *\n * @vt: #Y C0 BS \"Backspace\" \"\\b, \\x08\" \"Move the cursor one position to the left.\"\n * By default it is not possible to move the cursor past the leftmost position.\n * If `reverse wrap-around` (`CSI ? 45 h`) is set, a previous soft line wrap (DECAWM)\n * can be undone with BS within the scroll margins. In that case the cursor will wrap back\n * to the end of the previous row. Note that it is not possible to peek back into the scrollbuffer\n * with the cursor, thus at the home position (top-leftmost cell) this has no effect.\n */\n public backspace(): boolean {\n // reverse wrap-around is disabled\n if (!this._coreService.decPrivateModes.reverseWraparound) {\n this._restrictCursor();\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n }\n return true;\n }\n\n // reverse wrap-around is enabled\n // other than for normal operation mode, reverse wrap-around allows the cursor\n // to be at x=cols to be able to address the last cell of a row by BS\n this._restrictCursor(this._bufferService.cols);\n\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n } else {\n /**\n * reverse wrap-around handling:\n * Our implementation deviates from xterm on purpose. Details:\n * - only previous soft NLs can be reversed (isWrapped=true)\n * - only works within scrollborders (top/bottom, left/right not yet supported)\n * - cannot peek into scrollbuffer\n * - any cursor movement sequence keeps working as expected\n */\n if (this._activeBuffer.x === 0\n && this._activeBuffer.y > this._activeBuffer.scrollTop\n && this._activeBuffer.y <= this._activeBuffer.scrollBottom\n && this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)?.isWrapped) {\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n this._activeBuffer.y--;\n this._activeBuffer.x = this._bufferService.cols - 1;\n // find last taken cell - last cell can have 3 different states:\n // - hasContent(true) + hasWidth(1): narrow char - we are done\n // - hasWidth(0): second part of wide char - we are done\n // - hasContent(false) + hasWidth(1): empty cell due to early wrapping wide char, go one\n // cell further back\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n if (line.hasWidth(this._activeBuffer.x) && !line.hasContent(this._activeBuffer.x)) {\n this._activeBuffer.x--;\n // We do this only once, since width=1 + hasContent=false currently happens only once\n // before early wrapping of a wide char.\n // This needs to be fixed once we support graphemes taking more than 2 cells.\n }\n }\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * TAB\n * Horizontal Tab (HT) (Ctrl-I).\n *\n * @vt: #Y C0 HT \"Horizontal Tabulation\" \"\\t, \\x09\" \"Move the cursor to the next character tab stop.\"\n */\n public tab(): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n const originalX = this._activeBuffer.x;\n this._activeBuffer.x = this._activeBuffer.nextStop();\n if (this._optionsService.rawOptions.screenReaderMode) {\n this._onA11yTab.fire(this._activeBuffer.x - originalX);\n }\n return true;\n }\n\n /**\n * SO\n * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the\n * G1 character set.\n *\n * @vt: #P[Only limited ISO-2022 charset support.] C0 SO \"Shift Out\" \"\\x0E\" \"Switch to an alternative character set.\"\n */\n public shiftOut(): boolean {\n this._charsetService.setgLevel(1);\n return true;\n }\n\n /**\n * SI\n * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0\n * character set (the default).\n *\n * @vt: #Y C0 SI \"Shift In\" \"\\x0F\" \"Return to regular character set after Shift Out.\"\n */\n public shiftIn(): boolean {\n this._charsetService.setgLevel(0);\n return true;\n }\n\n /**\n * Restrict cursor to viewport size / scroll margin (origin mode).\n */\n private _restrictCursor(maxCol: number = this._bufferService.cols - 1): void {\n this._activeBuffer.x = Math.min(maxCol, Math.max(0, this._activeBuffer.x));\n this._activeBuffer.y = this._coreService.decPrivateModes.origin\n ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y))\n : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y));\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set absolute cursor position.\n */\n private _setCursor(x: number, y: number): void {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._coreService.decPrivateModes.origin) {\n this._activeBuffer.x = x;\n this._activeBuffer.y = this._activeBuffer.scrollTop + y;\n } else {\n this._activeBuffer.x = x;\n this._activeBuffer.y = y;\n }\n this._restrictCursor();\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set relative cursor position.\n */\n private _moveCursor(x: number, y: number): void {\n // for relative changes we have to make sure we are within 0 .. cols/rows - 1\n // before calculating the new position\n this._restrictCursor();\n this._setCursor(this._activeBuffer.x + x, this._activeBuffer.y + y);\n }\n\n /**\n * CSI Ps A\n * Cursor Up Ps Times (default = 1) (CUU).\n *\n * @vt: #Y CSI CUU \"Cursor Up\" \"CSI Ps A\" \"Move cursor `Ps` times up (default=1).\"\n * If the cursor would pass the top scroll margin, it will stop there.\n */\n public cursorUp(params: IParams): boolean {\n // stop at scrollTop\n const diffToTop = this._activeBuffer.y - this._activeBuffer.scrollTop;\n if (diffToTop >= 0) {\n this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));\n } else {\n this._moveCursor(0, -(params.params[0] || 1));\n }\n return true;\n }\n\n /**\n * CSI Ps B\n * Cursor Down Ps Times (default = 1) (CUD).\n *\n * @vt: #Y CSI CUD \"Cursor Down\" \"CSI Ps B\" \"Move cursor `Ps` times down (default=1).\"\n * If the cursor would pass the bottom scroll margin, it will stop there.\n */\n public cursorDown(params: IParams): boolean {\n // stop at scrollBottom\n const diffToBottom = this._activeBuffer.scrollBottom - this._activeBuffer.y;\n if (diffToBottom >= 0) {\n this._moveCursor(0, Math.min(diffToBottom, params.params[0] || 1));\n } else {\n this._moveCursor(0, params.params[0] || 1);\n }\n return true;\n }\n\n /**\n * CSI Ps C\n * Cursor Forward Ps Times (default = 1) (CUF).\n *\n * @vt: #Y CSI CUF \"Cursor Forward\" \"CSI Ps C\" \"Move cursor `Ps` times forward (default=1).\"\n */\n public cursorForward(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Ps D\n * Cursor Backward Ps Times (default = 1) (CUB).\n *\n * @vt: #Y CSI CUB \"Cursor Backward\" \"CSI Ps D\" \"Move cursor `Ps` times backward (default=1).\"\n */\n public cursorBackward(params: IParams): boolean {\n this._moveCursor(-(params.params[0] || 1), 0);\n return true;\n }\n\n /**\n * CSI Ps E\n * Cursor Next Line Ps Times (default = 1) (CNL).\n * Other than cursorDown (CUD) also set the cursor to first column.\n *\n * @vt: #Y CSI CNL \"Cursor Next Line\" \"CSI Ps E\" \"Move cursor `Ps` times down (default=1) and to the first column.\"\n * Same as CUD, additionally places the cursor at the first column.\n */\n public cursorNextLine(params: IParams): boolean {\n this.cursorDown(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps F\n * Cursor Previous Line Ps Times (default = 1) (CPL).\n * Other than cursorUp (CUU) also set the cursor to first column.\n *\n * @vt: #Y CSI CPL \"Cursor Backward\" \"CSI Ps F\" \"Move cursor `Ps` times up (default=1) and to the first column.\"\n * Same as CUU, additionally places the cursor at the first column.\n */\n public cursorPrecedingLine(params: IParams): boolean {\n this.cursorUp(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps G\n * Cursor Character Absolute [column] (default = [row,1]) (CHA).\n *\n * @vt: #Y CSI CHA \"Cursor Horizontal Absolute\" \"CSI Ps G\" \"Move cursor to `Ps`-th column of the active row (default=1).\"\n */\n public cursorCharAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps ; Ps H\n * Cursor Position [row;column] (default = [1,1]) (CUP).\n *\n * @vt: #Y CSI CUP \"Cursor Position\" \"CSI Ps ; Ps H\" \"Set cursor to position [`Ps`, `Ps`] (default = [1, 1]).\"\n * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins.\n * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport.\n * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`.\n */\n public cursorPosition(params: IParams): boolean {\n this._setCursor(\n // col\n (params.length >= 2) ? (params.params[1] || 1) - 1 : 0,\n // row\n (params.params[0] || 1) - 1\n );\n return true;\n }\n\n /**\n * CSI Pm ` Character Position Absolute\n * [column] (default = [row,1]) (HPA).\n * Currently same functionality as CHA.\n *\n * @vt: #Y CSI HPA \"Horizontal Position Absolute\" \"CSI Ps ` \" \"Same as CHA.\"\n */\n public charPosAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Pm a Character Position Relative\n * [columns] (default = [row,col+1]) (HPR)\n *\n * @vt: #Y CSI HPR \"Horizontal Position Relative\" \"CSI Ps a\" \"Same as CUF.\"\n */\n public hPositionRelative(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Pm d Vertical Position Absolute (VPA)\n * [row] (default = [1,column])\n *\n * @vt: #Y CSI VPA \"Vertical Position Absolute\" \"CSI Ps d\" \"Move cursor to `Ps`-th row (default=1).\"\n */\n public linePosAbsolute(params: IParams): boolean {\n this._setCursor(this._activeBuffer.x, (params.params[0] || 1) - 1);\n return true;\n }\n\n /**\n * CSI Pm e Vertical Position Relative (VPR)\n * [rows] (default = [row+1,column])\n * reuse CSI Ps B ?\n *\n * @vt: #Y CSI VPR \"Vertical Position Relative\" \"CSI Ps e\" \"Move cursor `Ps` times down (default=1).\"\n */\n public vPositionRelative(params: IParams): boolean {\n this._moveCursor(0, params.params[0] || 1);\n return true;\n }\n\n /**\n * CSI Ps ; Ps f\n * Horizontal and Vertical Position [row;column] (default =\n * [1,1]) (HVP).\n * Same as CUP.\n *\n * @vt: #Y CSI HVP \"Horizontal and Vertical Position\" \"CSI Ps ; Ps f\" \"Same as CUP.\"\n */\n public hVPosition(params: IParams): boolean {\n this.cursorPosition(params);\n return true;\n }\n\n /**\n * CSI Ps g Tab Clear (TBC).\n * Ps = 0 -> Clear Current Column (default).\n * Ps = 3 -> Clear All.\n * Potentially:\n * Ps = 2 -> Clear Stops on Line.\n * http://vt100.net/annarbor/aaa-ug/section6.html\n *\n * @vt: #Y CSI TBC \"Tab Clear\" \"CSI Ps g\" \"Clear tab stops at current position (0) or all (3) (default=0).\"\n * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported.\n */\n public tabClear(params: IParams): boolean {\n const param = params.params[0];\n if (param === 0) {\n delete this._activeBuffer.tabs[this._activeBuffer.x];\n } else if (param === 3) {\n this._activeBuffer.tabs = {};\n }\n return true;\n }\n\n /**\n * CSI Ps I\n * Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).\n *\n * @vt: #Y CSI CHT \"Cursor Horizontal Tabulation\" \"CSI Ps I\" \"Move cursor `Ps` times tabs forward (default=1).\"\n */\n public cursorForwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.nextStop();\n }\n return true;\n }\n\n /**\n * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).\n *\n * @vt: #Y CSI CBT \"Cursor Backward Tabulation\" \"CSI Ps Z\" \"Move cursor `Ps` tabs backward (default=1).\"\n */\n public cursorBackwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.prevStop();\n }\n return true;\n }\n\n /**\n * CSI Ps \" q Select Character Protection Attribute (DECSCA).\n *\n * @vt: #Y CSI DECSCA \"Select Character Protection Attribute\" \"CSI Ps \" q\" \"Whether DECSED and DECSEL can erase (0=default, 2) or not (1).\"\n */\n public selectProtected(params: IParams): boolean {\n const p = params.params[0];\n if (p === 1) this._curAttrData.bg |= BgFlags.PROTECTED;\n if (p === 2 || p === 0) this._curAttrData.bg &= ~BgFlags.PROTECTED;\n return true;\n }\n\n\n /**\n * Helper method to erase cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal.\n * @param y The row index relative to the viewport.\n * @param start The start x index of the range to be erased.\n * @param end The end x index of the range to be erased (exclusive).\n * @param clearWrap clear the isWrapped flag\n * @param respectProtect Whether to respect the protection attribute (DECSCA).\n */\n private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.replaceCells(\n start,\n end,\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n respectProtect\n );\n if (clearWrap) {\n line.isWrapped = false;\n }\n }\n\n /**\n * Helper method to reset cells in a terminal row. The cell gets replaced with the eraseChar of\n * the terminal and the isWrapped property is set to false.\n * @param y row index\n */\n private _resetBufferLine(y: number, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);\n if (line) {\n line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), respectProtect);\n this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + y);\n line.isWrapped = false;\n }\n }\n\n /**\n * CSI Ps J Erase in Display (ED).\n * Ps = 0 -> Erase Below (default).\n * Ps = 1 -> Erase Above.\n * Ps = 2 -> Erase All.\n * Ps = 3 -> Erase Saved Lines (xterm).\n * CSI ? Ps J\n * Erase in Display (DECSED).\n * Ps = 0 -> Selective Erase Below (default).\n * Ps = 1 -> Selective Erase Above.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI ED \"Erase In Display\" \"CSI Ps J\" \"Erase various parts of the viewport.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | ------------------------------------------------------------ |\n * | 0 | Erase from the cursor through the end of the viewport. |\n * | 1 | Erase from the beginning of the viewport through the cursor. |\n * | 2 | Erase complete viewport. |\n * | 3 | Erase scrollback. |\n *\n * @vt: #Y CSI DECSED \"Selective Erase In Display\" \"CSI ? Ps J\" \"Same as ED with respecting protection flag.\"\n */\n public eraseInDisplay(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n let j;\n switch (params.params[0]) {\n case 0:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n for (; j < this._bufferService.rows; j++) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(j);\n break;\n case 1:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n // Deleted front part of line and everything before. This line will no longer be wrapped.\n this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, respectProtect);\n if (this._activeBuffer.x + 1 >= this._bufferService.cols) {\n // Deleted entire previous line. This next line can no longer be wrapped.\n this._activeBuffer.lines.get(j + 1)!.isWrapped = false;\n }\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 2:\n j = this._bufferService.rows;\n this._dirtyRowTracker.markDirty(j - 1);\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 3:\n // Clear scrollback (everything not in viewport)\n const scrollBackSize = this._activeBuffer.lines.length - this._bufferService.rows;\n if (scrollBackSize > 0) {\n this._activeBuffer.lines.trimStart(scrollBackSize);\n this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - scrollBackSize, 0);\n this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - scrollBackSize, 0);\n // Force a scroll event to refresh viewport\n this._onScroll.fire(0);\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI Ps K Erase in Line (EL).\n * Ps = 0 -> Erase to Right (default).\n * Ps = 1 -> Erase to Left.\n * Ps = 2 -> Erase All.\n * CSI ? Ps K\n * Erase in Line (DECSEL).\n * Ps = 0 -> Selective Erase to Right (default).\n * Ps = 1 -> Selective Erase to Left.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI EL \"Erase In Line\" \"CSI Ps K\" \"Erase various parts of the active row.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | -------------------------------------------------------- |\n * | 0 | Erase from the cursor through the end of the row. |\n * | 1 | Erase from the beginning of the line through the cursor. |\n * | 2 | Erase complete line. |\n *\n * @vt: #Y CSI DECSEL \"Selective Erase In Line\" \"CSI ? Ps K\" \"Same as EL with respecting protecting flag.\"\n */\n public eraseInLine(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n switch (params.params[0]) {\n case 0:\n this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n break;\n case 1:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, respectProtect);\n break;\n case 2:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, respectProtect);\n break;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps L\n * Insert Ps Line(s) (default = 1) (IL).\n *\n * @vt: #Y CSI IL \"Insert Line\" \"CSI Ps L\" \"Insert `Ps` blank lines at active row (default=1).\"\n * For every inserted line at the scroll top one line at the scroll bottom gets removed.\n * The cursor is set to the first column.\n * IL has no effect if the cursor is outside the scroll margins.\n */\n public insertLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n const scrollBottomRowsOffset = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n const scrollBottomAbsolute = this._bufferService.rows - 1 + this._activeBuffer.ybase - scrollBottomRowsOffset + 1;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1L\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(scrollBottomAbsolute - 1, 1);\n this._activeBuffer.lines.splice(row, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps M\n * Delete Ps Line(s) (default = 1) (DL).\n *\n * @vt: #Y CSI DL \"Delete Line\" \"CSI Ps M\" \"Delete `Ps` lines at active row (default=1).\"\n * For every deleted line at the scroll top one blank line at the scroll bottom gets appended.\n * The cursor is set to the first column.\n * DL has no effect if the cursor is outside the scroll margins.\n */\n public deleteLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n let j: number;\n j = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n j = this._bufferService.rows - 1 + this._activeBuffer.ybase - j;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1M\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(row, 1);\n this._activeBuffer.lines.splice(j, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps @\n * Insert Ps (Blank) Character(s) (default = 1) (ICH).\n *\n * @vt: #Y CSI ICH \"Insert Characters\" \"CSI Ps @\" \"Insert `Ps` (blank) characters (default = 1).\"\n * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the\n * blank characters. Text between the cursor and right margin moves to the right. Characters moved\n * past the right margin are lost.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public insertChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.insertCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps P\n * Delete Ps Character(s) (default = 1) (DCH).\n *\n * @vt: #Y CSI DCH \"Delete Character\" \"CSI Ps P\" \"Delete `Ps` characters (default=1).\"\n * As characters are deleted, the remaining characters between the cursor and right margin move to\n * the left. Character attributes move with the characters. The terminal adds blank characters at\n * the right margin.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public deleteChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.deleteCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps S Scroll up Ps lines (default = 1) (SU).\n *\n * @vt: #Y CSI SU \"Scroll Up\" \"CSI Ps S\" \"Scroll `Ps` lines up (default=1).\"\n *\n *\n * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm)\n */\n public scrollUp(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps T Scroll down Ps lines (default = 1) (SD).\n *\n * @vt: #Y CSI SD \"Scroll Down\" \"CSI Ps T\" \"Scroll `Ps` lines down (default=1).\"\n */\n public scrollDown(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP @ Scroll left Ps columns (default = 1) (SL) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/00\n * Parameter default value: Pn = 1\n * SL causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the left; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always left shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SL \"Scroll Left\" \"CSI Ps SP @\" \"Scroll viewport `Ps` times to the left.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the left.\n * SL has no effect outside of the scroll margins.\n */\n public scrollLeft(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP A Scroll right Ps columns (default = 1) (SR) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/01\n * Parameter default value: Pn = 1\n * SR causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the right; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always right shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SR \"Scroll Right\" \"CSI Ps SP A\" \"Scroll viewport `Ps` times to the right.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the right.\n * Content at the right margin is lost.\n * SL has no effect outside of the scroll margins.\n */\n public scrollRight(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' }\n * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.\n *\n * @vt: #Y CSI DECIC \"Insert Columns\" \"CSI Ps ' }\" \"Insert `Ps` columns at cursor position.\"\n * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll\n * margins, moving content to the right. Content at the right margin is lost. DECIC has no effect\n * outside the scrolling margins.\n */\n public insertColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' ~\n * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.\n *\n * @vt: #Y CSI DECDC \"Delete Columns\" \"CSI Ps ' ~\" \"Delete `Ps` columns at cursor position.\"\n * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins,\n * moving content to the left. Blank columns are added at the right margin.\n * DECDC has no effect outside the scrolling margins.\n */\n public deleteColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps X\n * Erase Ps Character(s) (default = 1) (ECH).\n *\n * @vt: #Y CSI ECH \"Erase Character\" \"CSI Ps X\" \"Erase `Ps` characters from current cursor position to the right (default=1).\"\n * ED erases `Ps` characters from current cursor position to the right.\n * ED works inside or outside the scrolling margins.\n */\n public eraseChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.replaceCells(\n this._activeBuffer.x,\n this._activeBuffer.x + (params.params[0] || 1),\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps b Repeat the preceding graphic character Ps times (REP).\n * From ECMA 48 (@see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf)\n * Notation: (Pn)\n * Representation: CSI Pn 06/02\n * Parameter default value: Pn = 1\n * REP is used to indicate that the preceding character in the data stream,\n * if it is a graphic character (represented by one or more bit combinations) including SPACE,\n * is to be repeated n times, where n equals the value of Pn.\n * If the character preceding REP is a control function or part of a control function,\n * the effect of REP is not defined by this Standard.\n *\n * We extend xterm's behavior to allow repeating entire grapheme clusters.\n * This isn't 100% xterm-compatible, but it seems saner and more useful.\n * - text attrs are applied normally\n * - wrap around is respected\n * - any valid sequence resets the carried forward char\n *\n * Note: To get reset on a valid sequence working correctly without much runtime penalty, the\n * preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`.\n *\n * @vt: #Y CSI REP \"Repeat Preceding Character\" \"CSI Ps b\" \"Repeat preceding character `Ps` times (default=1).\"\n * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is\n * set. REP has no effect if the sequence does not follow a printable ASCII character\n * (NOOP for any other sequence in between or NON ASCII characters).\n */\n public repeatPrecedingCharacter(params: IParams): boolean {\n const joinState = this._parser.precedingJoinState;\n if (!joinState) {\n return true;\n }\n // call print to insert the chars and handle correct wrapping\n const length = params.params[0] || 1;\n const chWidth = UnicodeService.extractWidth(joinState);\n const x = this._activeBuffer.x - chWidth;\n const bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n const text = bufferRow.getString(x);\n const data = new Uint32Array(text.length * length);\n let idata = 0;\n for (let itext = 0; itext < text.length; ) {\n const ch = text.codePointAt(itext) || 0;\n data[idata++] = ch;\n itext += ch > 0xffff ? 2 : 1;\n }\n let tlength = idata;\n for (let i = 1; i < length; ++i) {\n data.copyWithin(tlength, 0, idata);\n tlength += idata;\n }\n this.print(data, 0, tlength);\n return true;\n }\n\n /**\n * CSI Ps c Send Device Attributes (Primary DA).\n * Ps = 0 or omitted -> request attributes from terminal. The\n * response depends on the decTerminalID resource setting.\n * -> CSI ? 1 ; 2 c (``VT100 with Advanced Video Option'')\n * -> CSI ? 1 ; 0 c (``VT101 with No Options'')\n * -> CSI ? 6 c (``VT102'')\n * -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')\n * The VT100-style response parameters do not mean anything by\n * themselves. VT220 parameters do, telling the host what fea-\n * tures the terminal supports:\n * Ps = 1 -> 132-columns.\n * Ps = 2 -> Printer.\n * Ps = 6 -> Selective erase.\n * Ps = 8 -> User-defined keys.\n * Ps = 9 -> National replacement character sets.\n * Ps = 1 5 -> Technical characters.\n * Ps = 2 2 -> ANSI color, e.g., VT525.\n * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode).\n *\n * @vt: #Y CSI DA1 \"Primary Device Attributes\" \"CSI c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesPrimary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n if (this._is('xterm') || this._is('rxvt-unicode') || this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?1;2c');\n } else if (this._is('linux')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?6c');\n }\n return true;\n }\n\n /**\n * CSI > Ps c\n * Send Device Attributes (Secondary DA).\n * Ps = 0 or omitted -> request the terminal's identification\n * code. The response depends on the decTerminalID resource set-\n * ting. It should apply only to VT220 and up, but xterm extends\n * this to VT100.\n * -> CSI > Pp ; Pv ; Pc c\n * where Pp denotes the terminal type\n * Pp = 0 -> ``VT100''.\n * Pp = 1 -> ``VT220''.\n * and Pv is the firmware version (for xterm, this was originally\n * the XFree86 patch number, starting with 95). In a DEC termi-\n * nal, Pc indicates the ROM cartridge registration number and is\n * always zero.\n * More information:\n * xterm/charproc.c - line 2012, for more information.\n * vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)\n *\n * @vt: #Y CSI DA2 \"Secondary Device Attributes\" \"CSI > c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesSecondary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n // xterm and urxvt\n // seem to spit this\n // out around ~370 times (?).\n if (this._is('xterm')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>0;276;0c');\n } else if (this._is('rxvt-unicode')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>85;95;0c');\n } else if (this._is('linux')) {\n // not supported by linux console.\n // linux console echoes parameters.\n this._coreService.triggerDataEvent(params.params[0] + 'c');\n } else if (this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>83;40003;0c');\n }\n return true;\n }\n\n /**\n * Evaluate if the current terminal is the given argument.\n * @param term The terminal name to evaluate\n */\n private _is(term: string): boolean {\n return (this._optionsService.rawOptions.termName + '').indexOf(term) === 0;\n }\n\n /**\n * CSI Pm h Set Mode (SM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Insert Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Automatic Newline (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI SM \"Set Mode\" \"CSI Pm h\" \"Set various terminal modes.\"\n * Supported param values by SM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Insert Mode (IRM). | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Automatic Newline (LNM). | #Y |\n */\n public setMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = true;\n break;\n case 20:\n this._optionsService.options.convertEol = true;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm h\n * DEC Private Mode Set (DECSET).\n * Ps = 1 -> Application Cursor Keys (DECCKM).\n * Ps = 2 -> Designate USASCII for character sets G0-G3\n * (DECANM), and set VT100 mode.\n * Ps = 3 -> 132 Column Mode (DECCOLM).\n * Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).\n * Ps = 5 -> Reverse Video (DECSCNM).\n * Ps = 6 -> Origin Mode (DECOM).\n * Ps = 7 -> Wraparound Mode (DECAWM).\n * Ps = 8 -> Auto-repeat Keys (DECARM).\n * Ps = 9 -> Send Mouse X & Y on button press. See the sec-\n * tion Mouse Tracking.\n * Ps = 1 0 -> Show toolbar (rxvt).\n * Ps = 1 2 -> Start Blinking Cursor (att610).\n * Ps = 1 8 -> Print form feed (DECPFF).\n * Ps = 1 9 -> Set print extent to full screen (DECPEX).\n * Ps = 2 5 -> Show Cursor (DECTCEM).\n * Ps = 3 0 -> Show scrollbar (rxvt).\n * Ps = 3 5 -> Enable font-shifting functions (rxvt).\n * Ps = 3 8 -> Enter Tektronix Mode (DECTEK).\n * Ps = 4 0 -> Allow 80 -> 132 Mode.\n * Ps = 4 1 -> more(1) fix (see curses resource).\n * Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-\n * RCM).\n * Ps = 4 4 -> Turn On Margin Bell.\n * Ps = 4 5 -> Reverse-wraparound Mode.\n * Ps = 4 6 -> Start Logging. This is normally disabled by a\n * compile-time option.\n * Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 6 6 -> Application keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends backspace (DECBKM).\n * Ps = 1 0 0 0 -> Send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Enable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).\n * Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Interpret \"meta\" key, sets eighth bit.\n * (enables the eightBitInput resource).\n * Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-\n * Lock keys. (This enables the numLock resource).\n * Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This\n * enables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete\n * key.\n * Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This\n * enables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Keep selection even if not highlighted.\n * (This enables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Enable Urgency window manager hint when\n * Control-G is received. (This enables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Enable raising of the window when Control-G\n * is received. (enables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate\n * Screen Buffer, clearing it first. (This may be disabled by\n * the titeInhibit resource). This combines the effects of the 1\n * 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based\n * applications rather than the 4 7 mode.\n * Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Set Sun function-key mode.\n * Ps = 1 0 5 2 -> Set HP function-key mode.\n * Ps = 1 0 5 3 -> Set SCO function-key mode.\n * Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Set VT220 keyboard emulation.\n * Ps = 2 0 0 4 -> Set bracketed paste mode.\n * Modes:\n * http: *vt100.net/docs/vt220-rm/chapter4.html\n *\n * @vt: #P[See below for supported modes.] CSI DECSET \"DEC Private Set Mode\" \"CSI ? Pm h\" \"Set various terminal attributes.\"\n * Supported param values by DECSET:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | --------|\n * | 1 | Application Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | #Y |\n * | 3 | 132 Column Mode (DECCOLM). | #Y |\n * | 6 | Origin Mode (DECOM). | #Y |\n * | 7 | Auto-wrap Mode (DECAWM). | #Y |\n * | 8 | Auto-repeat Keys (DECARM). Always on. | #N |\n * | 9 | X10 xterm mouse protocol. | #Y |\n * | 12 | Start Blinking Cursor. | #Y |\n * | 25 | Show Cursor (DECTCEM). | #Y |\n * | 45 | Reverse wrap-around. | #Y |\n * | 47 | Use Alternate Screen Buffer. | #Y |\n * | 66 | Application keypad (DECNKM). | #Y |\n * | 1000 | X11 xterm mouse protocol. | #Y |\n * | 1002 | Use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Use All Motion Mouse Tracking. | #Y |\n * | 1004 | Send FocusIn/FocusOut events | #Y |\n * | 1005 | Enable UTF-8 Mouse Mode. | #N |\n * | 1006 | Enable SGR Mouse Mode. | #Y |\n * | 1015 | Enable urxvt Mouse Mode. | #N |\n * | 1016 | Enable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Alternate Screen Buffer. | #Y |\n * | 1048 | Save cursor as in DECSC. | #Y |\n * | 1049 | Save cursor and switch to alternate buffer clearing it. | #P[Does not clear the alternate buffer.] |\n * | 2004 | Set bracketed paste mode. | #Y |\n *\n *\n * FIXME: implement DECSCNM, 1049 should clear altbuffer\n */\n public setModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = true;\n break;\n case 2:\n this._charsetService.setgCharset(0, DEFAULT_CHARSET);\n this._charsetService.setgCharset(1, DEFAULT_CHARSET);\n this._charsetService.setgCharset(2, DEFAULT_CHARSET);\n this._charsetService.setgCharset(3, DEFAULT_CHARSET);\n // set VT100 mode here\n break;\n case 3:\n /**\n * DECCOLM - 132 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(132, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = true;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = true;\n break;\n case 12:\n this._optionsService.options.cursorBlink = true;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = true;\n break;\n case 66:\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n // no release, no motion, no wheel, no modifiers.\n this._coreMouseService.activeProtocol = 'X10';\n break;\n case 1000: // vt200 mouse\n // no motion.\n this._coreMouseService.activeProtocol = 'VT200';\n break;\n case 1002: // button event mouse\n this._coreMouseService.activeProtocol = 'DRAG';\n break;\n case 1003: // any event mouse\n // any event - sends motion events,\n // even if there is no button held down.\n this._coreMouseService.activeProtocol = 'ANY';\n break;\n case 1004: // send focusin/focusout events\n // focusin: ^[[I\n // focusout: ^[[O\n this._coreService.decPrivateModes.sendFocus = true;\n this._onRequestSendFocus.fire();\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'SGR';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'SGR_PIXELS';\n break;\n case 25: // show cursor\n this._coreService.isCursorHidden = false;\n break;\n case 1048: // alt screen cursor\n this.saveCursor();\n break;\n case 1049: // alt screen buffer cursor\n this.saveCursor();\n // FALL-THROUGH\n case 47: // alt screen buffer\n case 1047: // alt screen buffer\n this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = true;\n break;\n }\n }\n return true;\n }\n\n\n /**\n * CSI Pm l Reset Mode (RM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Replace Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Normal Linefeed (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI RM \"Reset Mode\" \"CSI Pm l\" \"Set various terminal attributes.\"\n * Supported param values by RM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Replace Mode (IRM). (default) | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Normal Linefeed (LNM). | #Y |\n *\n *\n * FIXME: why is LNM commented out?\n */\n public resetMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = false;\n break;\n case 20:\n this._optionsService.options.convertEol = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm l\n * DEC Private Mode Reset (DECRST).\n * Ps = 1 -> Normal Cursor Keys (DECCKM).\n * Ps = 2 -> Designate VT52 mode (DECANM).\n * Ps = 3 -> 80 Column Mode (DECCOLM).\n * Ps = 4 -> Jump (Fast) Scroll (DECSCLM).\n * Ps = 5 -> Normal Video (DECSCNM).\n * Ps = 6 -> Normal Cursor Mode (DECOM).\n * Ps = 7 -> No Wraparound Mode (DECAWM).\n * Ps = 8 -> No Auto-repeat Keys (DECARM).\n * Ps = 9 -> Don't send Mouse X & Y on button press.\n * Ps = 1 0 -> Hide toolbar (rxvt).\n * Ps = 1 2 -> Stop Blinking Cursor (att610).\n * Ps = 1 8 -> Don't print form feed (DECPFF).\n * Ps = 1 9 -> Limit print to scrolling region (DECPEX).\n * Ps = 2 5 -> Hide Cursor (DECTCEM).\n * Ps = 3 0 -> Don't show scrollbar (rxvt).\n * Ps = 3 5 -> Disable font-shifting functions (rxvt).\n * Ps = 4 0 -> Disallow 80 -> 132 Mode.\n * Ps = 4 1 -> No more(1) fix (see curses resource).\n * Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-\n * NRCM).\n * Ps = 4 4 -> Turn Off Margin Bell.\n * Ps = 4 5 -> No Reverse-wraparound Mode.\n * Ps = 4 6 -> Stop Logging. (This is normally disabled by a\n * compile-time option).\n * Ps = 4 7 -> Use Normal Screen Buffer.\n * Ps = 6 6 -> Numeric keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends delete (DECBKM).\n * Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Disable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Don't scroll to bottom on tty output\n * (rxvt).\n * Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Don't interpret \"meta\" key. (This disables\n * the eightBitInput resource).\n * Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-\n * Lock keys. (This disables the numLock resource).\n * Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.\n * (This disables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad\n * Delete key.\n * Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.\n * (This disables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Do not keep selection when not highlighted.\n * (This disables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Disable Urgency window manager hint when\n * Control-G is received. (This disables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Disable raising of the window when Control-\n * G is received. (This disables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen\n * first if in the Alternate Screen. (This may be disabled by\n * the titeInhibit resource).\n * Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor\n * as in DECRC. (This may be disabled by the titeInhibit\n * resource). This combines the effects of the 1 0 4 7 and 1 0\n * 4 8 modes. Use this with terminfo-based applications rather\n * than the 4 7 mode.\n * Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Reset Sun function-key mode.\n * Ps = 1 0 5 2 -> Reset HP function-key mode.\n * Ps = 1 0 5 3 -> Reset SCO function-key mode.\n * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.\n * Ps = 2 0 0 4 -> Reset bracketed paste mode.\n *\n * @vt: #P[See below for supported modes.] CSI DECRST \"DEC Private Reset Mode\" \"CSI ? Pm l\" \"Reset various terminal attributes.\"\n * Supported param values by DECRST:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | ------- |\n * | 1 | Normal Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate VT52 mode (DECANM). | #N |\n * | 3 | 80 Column Mode (DECCOLM). | #B[Switches to old column width instead of 80.] |\n * | 6 | Normal Cursor Mode (DECOM). | #Y |\n * | 7 | No Wraparound Mode (DECAWM). | #Y |\n * | 8 | No Auto-repeat Keys (DECARM). | #N |\n * | 9 | Don't send Mouse X & Y on button press. | #Y |\n * | 12 | Stop Blinking Cursor. | #Y |\n * | 25 | Hide Cursor (DECTCEM). | #Y |\n * | 45 | No reverse wrap-around. | #Y |\n * | 47 | Use Normal Screen Buffer. | #Y |\n * | 66 | Numeric keypad (DECNKM). | #Y |\n * | 1000 | Don't send Mouse reports. | #Y |\n * | 1002 | Don't use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Don't use All Motion Mouse Tracking. | #Y |\n * | 1004 | Don't send FocusIn/FocusOut events. | #Y |\n * | 1005 | Disable UTF-8 Mouse Mode. | #N |\n * | 1006 | Disable SGR Mouse Mode. | #Y |\n * | 1015 | Disable urxvt Mouse Mode. | #N |\n * | 1016 | Disable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | #Y |\n * | 1048 | Restore cursor as in DECRC. | #Y |\n * | 1049 | Use Normal Screen Buffer and restore cursor. | #Y |\n * | 2004 | Reset bracketed paste mode. | #Y |\n *\n *\n * FIXME: DECCOLM is currently broken (already fixed in window options PR)\n */\n public resetModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = false;\n break;\n case 3:\n /**\n * DECCOLM - 80 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(80, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = false;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = false;\n break;\n case 12:\n this._optionsService.options.cursorBlink = false;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = false;\n break;\n case 66:\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n case 1000: // vt200 mouse\n case 1002: // button event mouse\n case 1003: // any event mouse\n this._coreMouseService.activeProtocol = 'NONE';\n break;\n case 1004: // send focusin/focusout events\n this._coreService.decPrivateModes.sendFocus = false;\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 25: // hide cursor\n this._coreService.isCursorHidden = true;\n break;\n case 1048: // alt screen cursor\n this.restoreCursor();\n break;\n case 1049: // alt screen buffer cursor\n // FALL-THROUGH\n case 47: // normal screen buffer\n case 1047: // normal screen buffer - clearing it first\n // Ensure the selection manager has the correct buffer\n this._bufferService.buffers.activateNormalBuffer();\n if (params.params[i] === 1049) {\n this.restoreCursor();\n }\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI Ps $ p Request ANSI Mode (DECRQM).\n *\n * Reports CSI Ps; Pm $ y (DECRPM), where Ps is the mode number as in SM/RM,\n * and Pm is the mode value:\n * 0 - not recognized\n * 1 - set\n * 2 - reset\n * 3 - permanently set\n * 4 - permanently reset\n *\n * @vt: #Y CSI DECRQM \"Request Mode\" \"CSI Ps $p\" \"Request mode state.\"\n * Returns a report as `CSI Ps; Pm $ y` (DECRPM), where `Ps` is the mode number as in SM/RM\n * or DECSET/DECRST, and `Pm` is the mode value:\n * - 0: not recognized\n * - 1: set\n * - 2: reset\n * - 3: permanently set\n * - 4: permanently reset\n *\n * For modes not understood xterm.js always returns `notRecognized`. In general this means,\n * that a certain operation mode is not implemented and cannot be used.\n *\n * Modes changing the active terminal buffer (47, 1047, 1049) are not subqueried\n * and only report, whether the alternate buffer is set.\n *\n * Mouse encodings and mouse protocols are handled mutual exclusive,\n * thus only one of each of those can be set at a given time.\n *\n * There is a chance, that some mode reports are not fully in line with xterm.js' behavior,\n * e.g. if the default implementation already exposes a certain behavior. If you find\n * discrepancies in the mode reports, please file a bug.\n */\n public requestMode(params: IParams, ansi: boolean): boolean {\n // return value as in DECRPM\n const enum V {\n NOT_RECOGNIZED = 0,\n SET = 1,\n RESET = 2,\n PERMANENTLY_SET = 3,\n PERMANENTLY_RESET = 4\n }\n\n // access helpers\n const dm = this._coreService.decPrivateModes;\n const { activeProtocol: mouseProtocol, activeEncoding: mouseEncoding } = this._coreMouseService;\n const cs = this._coreService;\n const { buffers, cols } = this._bufferService;\n const { active, alt } = buffers;\n const opts = this._optionsService.rawOptions;\n\n const f = (m: number, v: V): boolean => {\n cs.triggerDataEvent(`${C0.ESC}[${ansi ? '' : '?'}${m};${v}$y`);\n return true;\n };\n const b2v = (value: boolean): V => value ? V.SET : V.RESET;\n\n const p = params.params[0];\n\n if (ansi) {\n if (p === 2) return f(p, V.PERMANENTLY_RESET);\n if (p === 4) return f(p, b2v(cs.modes.insertMode));\n if (p === 12) return f(p, V.PERMANENTLY_SET);\n if (p === 20) return f(p, b2v(opts.convertEol));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n if (p === 1) return f(p, b2v(dm.applicationCursorKeys));\n if (p === 3) return f(p, opts.windowOptions.setWinLines ? (cols === 80 ? V.RESET : cols === 132 ? V.SET : V.NOT_RECOGNIZED) : V.NOT_RECOGNIZED);\n if (p === 6) return f(p, b2v(dm.origin));\n if (p === 7) return f(p, b2v(dm.wraparound));\n if (p === 8) return f(p, V.PERMANENTLY_SET);\n if (p === 9) return f(p, b2v(mouseProtocol === 'X10'));\n if (p === 12) return f(p, b2v(opts.cursorBlink));\n if (p === 25) return f(p, b2v(!cs.isCursorHidden));\n if (p === 45) return f(p, b2v(dm.reverseWraparound));\n if (p === 66) return f(p, b2v(dm.applicationKeypad));\n if (p === 67) return f(p, V.PERMANENTLY_RESET);\n if (p === 1000) return f(p, b2v(mouseProtocol === 'VT200'));\n if (p === 1002) return f(p, b2v(mouseProtocol === 'DRAG'));\n if (p === 1003) return f(p, b2v(mouseProtocol === 'ANY'));\n if (p === 1004) return f(p, b2v(dm.sendFocus));\n if (p === 1005) return f(p, V.PERMANENTLY_RESET);\n if (p === 1006) return f(p, b2v(mouseEncoding === 'SGR'));\n if (p === 1015) return f(p, V.PERMANENTLY_RESET);\n if (p === 1016) return f(p, b2v(mouseEncoding === 'SGR_PIXELS'));\n if (p === 1048) return f(p, V.SET); // xterm always returns SET here\n if (p === 47 || p === 1047 || p === 1049) return f(p, b2v(active === alt));\n if (p === 2004) return f(p, b2v(dm.bracketedPasteMode));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n /**\n * Helper to write color information packed with color mode.\n */\n private _updateAttrColor(color: number, mode: number, c1: number, c2: number, c3: number): number {\n if (mode === 2) {\n color |= Attributes.CM_RGB;\n color &= ~Attributes.RGB_MASK;\n color |= AttributeData.fromColorRGB([c1, c2, c3]);\n } else if (mode === 5) {\n color &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n color |= Attributes.CM_P256 | (c1 & 0xff);\n }\n return color;\n }\n\n /**\n * Helper to extract and apply color params/subparams.\n * Returns advance for params index.\n */\n private _extractColor(params: IParams, pos: number, attr: IAttributeData): number {\n // normalize params\n // meaning: [target, CM, ign, val, val, val]\n // RGB : [ 38/48, 2, ign, r, g, b]\n // P256 : [ 38/48, 5, ign, v, ign, ign]\n const accu = [0, 0, -1, 0, 0, 0];\n\n // alignment placeholder for non color space sequences\n let cSpace = 0;\n\n // return advance we took in params\n let advance = 0;\n\n do {\n accu[advance + cSpace] = params.params[pos + advance];\n if (params.hasSubParams(pos + advance)) {\n const subparams = params.getSubParams(pos + advance)!;\n let i = 0;\n do {\n if (accu[1] === 5) {\n cSpace = 1;\n }\n accu[advance + i + 1 + cSpace] = subparams[i];\n } while (++i < subparams.length && i + advance + 1 + cSpace < accu.length);\n break;\n }\n // exit early if can decide color mode with semicolons\n if ((accu[1] === 5 && advance + cSpace >= 2)\n || (accu[1] === 2 && advance + cSpace >= 5)) {\n break;\n }\n // offset colorSpace slot for semicolon mode\n if (accu[1]) {\n cSpace = 1;\n }\n } while (++advance + pos < params.length && advance + cSpace < accu.length);\n\n // set default values to 0\n for (let i = 2; i < accu.length; ++i) {\n if (accu[i] === -1) {\n accu[i] = 0;\n }\n }\n\n // apply colors\n switch (accu[0]) {\n case 38:\n attr.fg = this._updateAttrColor(attr.fg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 48:\n attr.bg = this._updateAttrColor(attr.bg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 58:\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = this._updateAttrColor(attr.extended.underlineColor, accu[1], accu[3], accu[4], accu[5]);\n }\n\n return advance;\n }\n\n /**\n * SGR 4 subparams:\n * 4:0 - equal to SGR 24 (turn off all underline)\n * 4:1 - equal to SGR 4 (single underline)\n * 4:2 - equal to SGR 21 (double underline)\n * 4:3 - curly underline\n * 4:4 - dotted underline\n * 4:5 - dashed underline\n */\n private _processUnderline(style: number, attr: IAttributeData): void {\n // treat extended attrs as immutable, thus always clone from old one\n // this is needed since the buffer only holds references to it\n attr.extended = attr.extended.clone();\n\n // default to 1 == single underline\n if (!~style || style > 5) {\n style = 1;\n }\n attr.extended.underlineStyle = style;\n attr.fg |= FgFlags.UNDERLINE;\n\n // 0 deactivates underline\n if (style === 0) {\n attr.fg &= ~FgFlags.UNDERLINE;\n }\n\n // update HAS_EXTENDED in BG\n attr.updateExtended();\n }\n\n private _processSGR0(attr: IAttributeData): void {\n attr.fg = DEFAULT_ATTR_DATA.fg;\n attr.bg = DEFAULT_ATTR_DATA.bg;\n attr.extended = attr.extended.clone();\n // Reset underline style and color. Note that we don't want to reset other\n // fields such as the url id.\n attr.extended.underlineStyle = UnderlineStyle.NONE;\n attr.extended.underlineColor &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.updateExtended();\n }\n\n /**\n * CSI Pm m Character Attributes (SGR).\n *\n * @vt: #P[See below for supported attributes.] CSI SGR \"Select Graphic Rendition\" \"CSI Pm m\" \"Set/Reset various text attributes.\"\n * SGR selects one or more character attributes at the same time. Multiple params (up to 32)\n * are applied in order from left to right. The changed attributes are applied to all new\n * characters received. If you move characters in the viewport by scrolling or any other means,\n * then the attributes move with the characters.\n *\n * Supported param values by SGR:\n *\n * | Param | Meaning | Support |\n * | --------- | -------------------------------------------------------- | ------- |\n * | 0 | Normal (default). Resets any other preceding SGR. | #Y |\n * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | #Y |\n * | 2 | Faint, decreased intensity. | #Y |\n * | 3 | Italic. | #Y |\n * | 4 | Underlined (see below for style support). | #Y |\n * | 5 | Slowly blinking. | #N |\n * | 6 | Rapidly blinking. | #N |\n * | 7 | Inverse. Flips foreground and background color. | #Y |\n * | 8 | Invisible (hidden). | #Y |\n * | 9 | Crossed-out characters (strikethrough). | #Y |\n * | 21 | Doubly underlined. | #Y |\n * | 22 | Normal (neither bold nor faint). | #Y |\n * | 23 | No italic. | #Y |\n * | 24 | Not underlined. | #Y |\n * | 25 | Steady (not blinking). | #Y |\n * | 27 | Positive (not inverse). | #Y |\n * | 28 | Visible (not hidden). | #Y |\n * | 29 | Not Crossed-out (strikethrough). | #Y |\n * | 30 | Foreground color: Black. | #Y |\n * | 31 | Foreground color: Red. | #Y |\n * | 32 | Foreground color: Green. | #Y |\n * | 33 | Foreground color: Yellow. | #Y |\n * | 34 | Foreground color: Blue. | #Y |\n * | 35 | Foreground color: Magenta. | #Y |\n * | 36 | Foreground color: Cyan. | #Y |\n * | 37 | Foreground color: White. | #Y |\n * | 38 | Foreground color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 39 | Foreground color: Default (original). | #Y |\n * | 40 | Background color: Black. | #Y |\n * | 41 | Background color: Red. | #Y |\n * | 42 | Background color: Green. | #Y |\n * | 43 | Background color: Yellow. | #Y |\n * | 44 | Background color: Blue. | #Y |\n * | 45 | Background color: Magenta. | #Y |\n * | 46 | Background color: Cyan. | #Y |\n * | 47 | Background color: White. | #Y |\n * | 48 | Background color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 49 | Background color: Default (original). | #Y |\n * | 53 | Overlined. | #Y |\n * | 55 | Not Overlined. | #Y |\n * | 58 | Underline color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y |\n * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y |\n *\n * Underline supports subparams to denote the style in the form `4 : x`:\n *\n * | x | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | No underline. Same as `SGR 24 m`. | #Y |\n * | 1 | Single underline. Same as `SGR 4 m`. | #Y |\n * | 2 | Double underline. | #Y |\n * | 3 | Curly underline. | #Y |\n * | 4 | Dotted underline. | #Y |\n * | 5 | Dashed underline. | #Y |\n * | other | Single underline. Same as `SGR 4 m`. | #Y |\n *\n * Extended colors are supported for foreground (Ps=38), background (Ps=48) and underline (Ps=58)\n * as follows:\n *\n * | Ps + 1 | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | Implementation defined. | #N |\n * | 1 | Transparent. | #N |\n * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | #Y |\n * | 3 | CMY color. | #N |\n * | 4 | CMYK color. | #N |\n * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | #Y |\n *\n *\n * FIXME: blinking is implemented in attrs, but not working in renderers?\n * FIXME: remove dead branch for p=100\n */\n public charAttributes(params: IParams): boolean {\n // Optimize a single SGR0.\n if (params.length === 1 && params.params[0] === 0) {\n this._processSGR0(this._curAttrData);\n return true;\n }\n\n const l = params.length;\n let p;\n const attr = this._curAttrData;\n\n for (let i = 0; i < l; i++) {\n p = params.params[i];\n if (p >= 30 && p <= 37) {\n // fg color 8\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 30);\n } else if (p >= 40 && p <= 47) {\n // bg color 8\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 40);\n } else if (p >= 90 && p <= 97) {\n // fg color 16\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 90) | 8;\n } else if (p >= 100 && p <= 107) {\n // bg color 16\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 100) | 8;\n } else if (p === 0) {\n // default\n this._processSGR0(attr);\n } else if (p === 1) {\n // bold text\n attr.fg |= FgFlags.BOLD;\n } else if (p === 3) {\n // italic text\n attr.bg |= BgFlags.ITALIC;\n } else if (p === 4) {\n // underlined text\n attr.fg |= FgFlags.UNDERLINE;\n this._processUnderline(params.hasSubParams(i) ? params.getSubParams(i)![0] : UnderlineStyle.SINGLE, attr);\n } else if (p === 5) {\n // blink\n attr.fg |= FgFlags.BLINK;\n } else if (p === 7) {\n // inverse and positive\n // test with: echo -e '\\e[31m\\e[42mhello\\e[7mworld\\e[27mhi\\e[m'\n attr.fg |= FgFlags.INVERSE;\n } else if (p === 8) {\n // invisible\n attr.fg |= FgFlags.INVISIBLE;\n } else if (p === 9) {\n // strikethrough\n attr.fg |= FgFlags.STRIKETHROUGH;\n } else if (p === 2) {\n // dimmed text\n attr.bg |= BgFlags.DIM;\n } else if (p === 21) {\n // double underline\n this._processUnderline(UnderlineStyle.DOUBLE, attr);\n } else if (p === 22) {\n // not bold nor faint\n attr.fg &= ~FgFlags.BOLD;\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 23) {\n // not italic\n attr.bg &= ~BgFlags.ITALIC;\n } else if (p === 24) {\n // not underlined\n attr.fg &= ~FgFlags.UNDERLINE;\n this._processUnderline(UnderlineStyle.NONE, attr);\n } else if (p === 25) {\n // not blink\n attr.fg &= ~FgFlags.BLINK;\n } else if (p === 27) {\n // not inverse\n attr.fg &= ~FgFlags.INVERSE;\n } else if (p === 28) {\n // not invisible\n attr.fg &= ~FgFlags.INVISIBLE;\n } else if (p === 29) {\n // not strikethrough\n attr.fg &= ~FgFlags.STRIKETHROUGH;\n } else if (p === 39) {\n // reset fg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 49) {\n // reset bg\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 38 || p === 48 || p === 58) {\n // fg color 256 and RGB\n i += this._extractColor(params, i, attr);\n } else if (p === 53) {\n // overline\n attr.bg |= BgFlags.OVERLINE;\n } else if (p === 55) {\n // not overline\n attr.bg &= ~BgFlags.OVERLINE;\n } else if (p === 59) {\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = -1;\n attr.updateExtended();\n } else if (p === 100) { // FIXME: dead branch, p=100 already handled above!\n // reset fg/bg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else {\n this._logService.debug('Unknown SGR attribute: %d.', p);\n }\n }\n return true;\n }\n\n /**\n * CSI Ps n Device Status Report (DSR).\n * Ps = 5 -> Status Report. Result (``OK'') is\n * CSI 0 n\n * Ps = 6 -> Report Cursor Position (CPR) [row;column].\n * Result is\n * CSI r ; c R\n * CSI ? Ps n\n * Device Status Report (DSR, DEC-specific).\n * Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI\n * ? r ; c R (assumes page is zero).\n * Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).\n * or CSI ? 1 1 n (not ready).\n * Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)\n * or CSI ? 2 1 n (locked).\n * Ps = 2 6 -> Report Keyboard status as\n * CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote key-\n * board ready and LK01 respectively.\n * Ps = 5 3 -> Report Locator status as\n * CSI ? 5 3 n Locator available, if compiled-in, or\n * CSI ? 5 0 n No Locator, if not.\n *\n * @vt: #Y CSI DSR \"Device Status Report\" \"CSI Ps n\" \"Request cursor position (CPR) with `Ps` = 6.\"\n */\n public deviceStatus(params: IParams): boolean {\n switch (params.params[0]) {\n case 5:\n // status report\n this._coreService.triggerDataEvent(`${C0.ESC}[0n`);\n break;\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[${y};${x}R`);\n break;\n }\n return true;\n }\n\n // @vt: #P[Only CPR is supported.] CSI DECDSR \"DEC Device Status Report\" \"CSI ? Ps n\" \"Only CPR is supported (same as DSR).\"\n public deviceStatusPrivate(params: IParams): boolean {\n // modern xterm doesnt seem to\n // respond to any of these except ?6, 6, and 5\n switch (params.params[0]) {\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${y};${x}R`);\n break;\n case 15:\n // no printer\n // this.handler(C0.ESC + '[?11n');\n break;\n case 25:\n // dont support user defined keys\n // this.handler(C0.ESC + '[?21n');\n break;\n case 26:\n // north american keyboard\n // this.handler(C0.ESC + '[?27;1;0;0n');\n break;\n case 53:\n // no dec locator/mouse\n // this.handler(C0.ESC + '[?50n');\n break;\n }\n return true;\n }\n\n /**\n * CSI ! p Soft terminal reset (DECSTR).\n * http://vt100.net/docs/vt220-rm/table4-10.html\n *\n * @vt: #Y CSI DECSTR \"Soft Terminal Reset\" \"CSI ! p\" \"Reset several terminal attributes to initial state.\"\n * There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full\n * terminal bootstrap, DECSTR only resets certain attributes. For most needs DECSTR should be\n * sufficient.\n *\n * The following terminal attributes are reset to default values:\n * - IRM is reset (dafault = false)\n * - scroll margins are reset (default = viewport size)\n * - erase attributes are reset to default\n * - charsets are reset\n * - DECSC data is reset to initial values\n * - DECOM is reset to absolute mode\n *\n *\n * FIXME: there are several more attributes missing (see VT520 manual)\n */\n public softReset(params: IParams): boolean {\n this._coreService.isCursorHidden = false;\n this._onRequestSyncScrollBar.fire();\n this._activeBuffer.scrollTop = 0;\n this._activeBuffer.scrollBottom = this._bufferService.rows - 1;\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._coreService.reset();\n this._charsetService.reset();\n\n // reset DECSC data\n this._activeBuffer.savedX = 0;\n this._activeBuffer.savedY = this._activeBuffer.ybase;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n\n // reset DECOM\n this._coreService.decPrivateModes.origin = false;\n return true;\n }\n\n /**\n * CSI Ps SP q Set cursor style (DECSCUSR, VT520).\n * Ps = 0 -> blinking block.\n * Ps = 1 -> blinking block (default).\n * Ps = 2 -> steady block.\n * Ps = 3 -> blinking underline.\n * Ps = 4 -> steady underline.\n * Ps = 5 -> blinking bar (xterm).\n * Ps = 6 -> steady bar (xterm).\n *\n * @vt: #Y CSI DECSCUSR \"Set Cursor Style\" \"CSI Ps SP q\" \"Set cursor style.\"\n * Supported cursor styles:\n * - empty, 0 or 1: steady block\n * - 2: blink block\n * - 3: steady underline\n * - 4: blink underline\n * - 5: steady bar\n * - 6: blink bar\n */\n public setCursorStyle(params: IParams): boolean {\n const param = params.params[0] || 1;\n switch (param) {\n case 1:\n case 2:\n this._optionsService.options.cursorStyle = 'block';\n break;\n case 3:\n case 4:\n this._optionsService.options.cursorStyle = 'underline';\n break;\n case 5:\n case 6:\n this._optionsService.options.cursorStyle = 'bar';\n break;\n }\n const isBlinking = param % 2 === 1;\n this._optionsService.options.cursorBlink = isBlinking;\n return true;\n }\n\n /**\n * CSI Ps ; Ps r\n * Set Scrolling Region [top;bottom] (default = full size of win-\n * dow) (DECSTBM).\n *\n * @vt: #Y CSI DECSTBM \"Set Top and Bottom Margin\" \"CSI Ps ; Ps r\" \"Set top and bottom margins of the viewport [top;bottom] (default = viewport size).\"\n */\n public setScrollRegion(params: IParams): boolean {\n const top = params.params[0] || 1;\n let bottom: number;\n\n if (params.length < 2 || (bottom = params.params[1]) > this._bufferService.rows || bottom === 0) {\n bottom = this._bufferService.rows;\n }\n\n if (bottom > top) {\n this._activeBuffer.scrollTop = top - 1;\n this._activeBuffer.scrollBottom = bottom - 1;\n this._setCursor(0, 0);\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps ; Ps t - Various window manipulations and reports (xterm)\n *\n * Note: Only those listed below are supported. All others are left to integrators and\n * need special treatment based on the embedding environment.\n *\n * Ps = 1 4 supported\n * Report xterm text area size in pixels.\n * Result is CSI 4 ; height ; width t\n * Ps = 14 ; 2 not implemented\n * Ps = 16 supported\n * Report xterm character cell size in pixels.\n * Result is CSI 6 ; height ; width t\n * Ps = 18 supported\n * Report the size of the text area in characters.\n * Result is CSI 8 ; height ; width t\n * Ps = 20 supported\n * Report xterm window's icon label.\n * Result is OSC L label ST\n * Ps = 21 supported\n * Report xterm window's title.\n * Result is OSC l label ST\n * Ps = 22 ; 0 -> Save xterm icon and window title on stack. supported\n * Ps = 22 ; 1 -> Save xterm icon title on stack. supported\n * Ps = 22 ; 2 -> Save xterm window title on stack. supported\n * Ps = 23 ; 0 -> Restore xterm icon and window title from stack. supported\n * Ps = 23 ; 1 -> Restore xterm icon title from stack. supported\n * Ps = 23 ; 2 -> Restore xterm window title from stack. supported\n * Ps >= 24 not implemented\n */\n public windowOptions(params: IParams): boolean {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n const second = (params.length > 1) ? params.params[1] : 0;\n switch (params.params[0]) {\n case 14: // GetWinSizePixels, returns CSI 4 ; height ; width t\n if (second !== 2) {\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_WIN_SIZE_PIXELS);\n }\n break;\n case 16: // GetCellSizePixels, returns CSI 6 ; height ; width t\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_CELL_SIZE_PIXELS);\n break;\n case 18: // GetWinSizeChars, returns CSI 8 ; height ; width t\n if (this._bufferService) {\n this._coreService.triggerDataEvent(`${C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);\n }\n break;\n case 22: // PushTitle\n if (second === 0 || second === 2) {\n this._windowTitleStack.push(this._windowTitle);\n if (this._windowTitleStack.length > STACK_LIMIT) {\n this._windowTitleStack.shift();\n }\n }\n if (second === 0 || second === 1) {\n this._iconNameStack.push(this._iconName);\n if (this._iconNameStack.length > STACK_LIMIT) {\n this._iconNameStack.shift();\n }\n }\n break;\n case 23: // PopTitle\n if (second === 0 || second === 2) {\n if (this._windowTitleStack.length) {\n this.setTitle(this._windowTitleStack.pop()!);\n }\n }\n if (second === 0 || second === 1) {\n if (this._iconNameStack.length) {\n this.setIconName(this._iconNameStack.pop()!);\n }\n }\n break;\n }\n return true;\n }\n\n\n /**\n * CSI s\n * ESC 7\n * Save cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCOSC \"Save Cursor\" \"CSI s\" \"Save cursor position, charmap and text attributes.\"\n * @vt: #Y ESC SC \"Save Cursor\" \"ESC 7\" \"Save cursor position, charmap and text attributes.\"\n */\n public saveCursor(params?: IParams): boolean {\n this._activeBuffer.savedX = this._activeBuffer.x;\n this._activeBuffer.savedY = this._activeBuffer.ybase + this._activeBuffer.y;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n return true;\n }\n\n\n /**\n * CSI u\n * ESC 8\n * Restore cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCORC \"Restore Cursor\" \"CSI u\" \"Restore cursor position, charmap and text attributes.\"\n * @vt: #Y ESC RC \"Restore Cursor\" \"ESC 8\" \"Restore cursor position, charmap and text attributes.\"\n */\n public restoreCursor(params?: IParams): boolean {\n this._activeBuffer.x = this._activeBuffer.savedX || 0;\n this._activeBuffer.y = Math.max(this._activeBuffer.savedY - this._activeBuffer.ybase, 0);\n this._curAttrData.fg = this._activeBuffer.savedCurAttrData.fg;\n this._curAttrData.bg = this._activeBuffer.savedCurAttrData.bg;\n this._charsetService.charset = (this as any)._savedCharset;\n if (this._activeBuffer.savedCharset) {\n this._charsetService.charset = this._activeBuffer.savedCharset;\n }\n this._restrictCursor();\n return true;\n }\n\n\n /**\n * OSC 2; ST (set window title)\n * Proxy to set window title.\n *\n * @vt: #P[Icon name is not exposed.] OSC 0 \"Set Windows Title and Icon Name\" \"OSC 0 ; Pt BEL\" \"Set window title and icon name.\"\n * Icon name is not supported. For Window Title see below.\n *\n * @vt: #Y OSC 2 \"Set Windows Title\" \"OSC 2 ; Pt BEL\" \"Set window title.\"\n * xterm.js does not manipulate the title directly, instead exposes changes via the event\n * `Terminal.onTitleChange`.\n */\n public setTitle(data: string): boolean {\n this._windowTitle = data;\n this._onTitleChange.fire(data);\n return true;\n }\n\n /**\n * OSC 1; ST\n * Note: Icon name is not exposed.\n */\n public setIconName(data: string): boolean {\n this._iconName = data;\n return true;\n }\n\n /**\n * OSC 4; ; ST (set ANSI color to )\n *\n * @vt: #Y OSC 4 \"Set ANSI color\" \"OSC 4 ; c ; spec BEL\" \"Change color number `c` to the color specified by `spec`.\"\n * `c` is the color index between 0 and 255. The color format of `spec` is derived from\n * `XParseColor` (see OSC 10 for supported formats). There may be multipe `c ; spec` pairs present\n * in the same instruction. If `spec` contains `?` the terminal returns a sequence with the\n * currently set color.\n */\n public setOrReportIndexedColor(data: string): boolean {\n const event: IColorEvent = [];\n const slots = data.split(';');\n while (slots.length > 1) {\n const idx = slots.shift() as string;\n const spec = slots.shift() as string;\n if (/^\\d+$/.exec(idx)) {\n const index = parseInt(idx);\n if (isValidColorIndex(index)) {\n if (spec === '?') {\n event.push({ type: ColorRequestType.REPORT, index });\n } else {\n const color = parseColor(spec);\n if (color) {\n event.push({ type: ColorRequestType.SET, index, color });\n }\n }\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 8 ; ; ST - create hyperlink\n * OSC 8 ; ; ST - finish hyperlink\n *\n * Test case:\n *\n * ```sh\n * printf '\\e]8;;http://example.com\\e\\\\This is a link\\e]8;;\\e\\\\\\n'\n * ```\n *\n * @vt: #Y OSC 8 \"Create hyperlink\" \"OSC 8 ; params ; uri BEL\" \"Create a hyperlink to `uri` using `params`.\"\n * `uri` is a hyperlink starting with `http://`, `https://`, `ftp://`, `file://` or `mailto://`. `params` is an\n * optional list of key=value assignments, separated by the : character.\n * Example: `id=xyz123:foo=bar:baz=quux`.\n * Currently only the id key is defined. Cells that share the same ID and URI share hover\n * feedback. Use `OSC 8 ; ; BEL` to finish the current hyperlink.\n */\n public setHyperlink(data: string): boolean {\n // Arg parsing is special cases to support unencoded semi-colons in the URIs (#4944)\n const idx = data.indexOf(';');\n if (idx === -1) {\n // malformed sequence, just return as handled\n return true;\n }\n const id = data.slice(0, idx).trim();\n const uri = data.slice(idx + 1);\n if (uri) {\n return this._createHyperlink(id, uri);\n }\n if (id.trim()) {\n return false;\n }\n return this._finishHyperlink();\n }\n\n private _createHyperlink(params: string, uri: string): boolean {\n // It's legal to open a new hyperlink without explicitly finishing the previous one\n if (this._getCurrentLinkId()) {\n this._finishHyperlink();\n }\n const parsedParams = params.split(':');\n let id: string | undefined;\n const idParamIndex = parsedParams.findIndex(e => e.startsWith('id='));\n if (idParamIndex !== -1) {\n id = parsedParams[idParamIndex].slice(3) || undefined;\n }\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id, uri });\n this._curAttrData.updateExtended();\n return true;\n }\n\n private _finishHyperlink(): boolean {\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = 0;\n this._curAttrData.updateExtended();\n return true;\n }\n\n // special colors - OSC 10 | 11 | 12\n private _specialColors = [SpecialColorIndex.FOREGROUND, SpecialColorIndex.BACKGROUND, SpecialColorIndex.CURSOR];\n\n /**\n * Apply colors requests for special colors in OSC 10 | 11 | 12.\n * Since these commands are stacking from multiple parameters,\n * we handle them in a loop with an entry offset to `_specialColors`.\n */\n private _setOrReportSpecialColor(data: string, offset: number): boolean {\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i, ++offset) {\n if (offset >= this._specialColors.length) break;\n if (slots[i] === '?') {\n this._onColor.fire([{ type: ColorRequestType.REPORT, index: this._specialColors[offset] }]);\n } else {\n const color = parseColor(slots[i]);\n if (color) {\n this._onColor.fire([{ type: ColorRequestType.SET, index: this._specialColors[offset], color }]);\n }\n }\n }\n return true;\n }\n\n /**\n * OSC 10 ; | ST - set or query default foreground color\n *\n * @vt: #Y OSC 10 \"Set or query default foreground color\" \"OSC 10 ; Pt BEL\" \"Set or query default foreground color.\"\n * To set the color, the following color specification formats are supported:\n * - `rgb://` for `, , ` in `h | hh | hhh | hhhh`, where\n * `h` is a single hexadecimal digit (case insignificant). The different widths scale\n * from 4 bit (`h`) to 16 bit (`hhhh`) and get converted to 8 bit (`hh`).\n * - `#RGB` - 4 bits per channel, expanded to `#R0G0B0`\n * - `#RRGGBB` - 8 bits per channel\n * - `#RRRGGGBBB` - 12 bits per channel, truncated to `#RRGGBB`\n * - `#RRRRGGGGBBBB` - 16 bits per channel, truncated to `#RRGGBB`\n *\n * **Note:** X11 named colors are currently unsupported.\n *\n * If `Pt` contains `?` instead of a color specification, the terminal\n * returns a sequence with the current default foreground color\n * (use that sequence to restore the color after changes).\n *\n * **Note:** Other than xterm, xterm.js does not support OSC 12 - 19.\n * Therefore stacking multiple `Pt` separated by `;` only works for the first two entries.\n */\n public setOrReportFgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 0);\n }\n\n /**\n * OSC 11 ; | ST - set or query default background color\n *\n * @vt: #Y OSC 11 \"Set or query default background color\" \"OSC 11 ; Pt BEL\" \"Same as OSC 10, but for default background.\"\n */\n public setOrReportBgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 1);\n }\n\n /**\n * OSC 12 ; | ST - set or query default cursor color\n *\n * @vt: #Y OSC 12 \"Set or query default cursor color\" \"OSC 12 ; Pt BEL\" \"Same as OSC 10, but for default cursor color.\"\n */\n public setOrReportCursorColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 2);\n }\n\n /**\n * OSC 104 ; ST - restore ANSI color \n *\n * @vt: #Y OSC 104 \"Reset ANSI color\" \"OSC 104 ; c BEL\" \"Reset color number `c` to themed color.\"\n * `c` is the color index between 0 and 255. This function restores the default color for `c` as\n * specified by the loaded theme. Any number of `c` parameters may be given.\n * If no parameters are given, the entire indexed color table will be reset.\n */\n public restoreIndexedColor(data: string): boolean {\n if (!data) {\n this._onColor.fire([{ type: ColorRequestType.RESTORE }]);\n return true;\n }\n const event: IColorEvent = [];\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i) {\n if (/^\\d+$/.exec(slots[i])) {\n const index = parseInt(slots[i]);\n if (isValidColorIndex(index)) {\n event.push({ type: ColorRequestType.RESTORE, index });\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 110 ST - restore default foreground color\n *\n * @vt: #Y OSC 110 \"Restore default foreground color\" \"OSC 110 BEL\" \"Restore default foreground to themed color.\"\n */\n public restoreFgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.FOREGROUND }]);\n return true;\n }\n\n /**\n * OSC 111 ST - restore default background color\n *\n * @vt: #Y OSC 111 \"Restore default background color\" \"OSC 111 BEL\" \"Restore default background to themed color.\"\n */\n public restoreBgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.BACKGROUND }]);\n return true;\n }\n\n /**\n * OSC 112 ST - restore default cursor color\n *\n * @vt: #Y OSC 112 \"Restore default cursor color\" \"OSC 112 BEL\" \"Restore default cursor to themed color.\"\n */\n public restoreCursorColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.CURSOR }]);\n return true;\n }\n\n /**\n * ESC E\n * C1.NEL\n * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)\n * Moves cursor to first position on next line.\n *\n * @vt: #Y C1 NEL \"Next Line\" \"\\x85\" \"Move the cursor to the beginning of the next row.\"\n * @vt: #Y ESC NEL \"Next Line\" \"ESC E\" \"Move the cursor to the beginning of the next row.\"\n */\n public nextLine(): boolean {\n this._activeBuffer.x = 0;\n this.index();\n return true;\n }\n\n /**\n * ESC =\n * DEC mnemonic: DECKPAM (https://vt100.net/docs/vt510-rm/DECKPAM.html)\n * Enables the numeric keypad to send application sequences to the host.\n */\n public keypadApplicationMode(): boolean {\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC >\n * DEC mnemonic: DECKPNM (https://vt100.net/docs/vt510-rm/DECKPNM.html)\n * Enables the keypad to send numeric characters to the host.\n */\n public keypadNumericMode(): boolean {\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC % @\n * ESC % G\n * Select default character set. UTF-8 is not supported (string are unicode anyways)\n * therefore ESC % G does the same.\n */\n public selectDefaultCharset(): boolean {\n this._charsetService.setgLevel(0);\n this._charsetService.setgCharset(0, DEFAULT_CHARSET); // US (default)\n return true;\n }\n\n /**\n * ESC ( C\n * Designate G0 Character Set, VT100, ISO 2022.\n * ESC ) C\n * Designate G1 Character Set (ISO 2022, VT100).\n * ESC * C\n * Designate G2 Character Set (ISO 2022, VT220).\n * ESC + C\n * Designate G3 Character Set (ISO 2022, VT220).\n * ESC - C\n * Designate G1 Character Set (VT300).\n * ESC . C\n * Designate G2 Character Set (VT300).\n * ESC / C\n * Designate G3 Character Set (VT300). C = A -> ISO Latin-1 Supplemental. - Supported?\n */\n public selectCharset(collectAndFlag: string): boolean {\n if (collectAndFlag.length !== 2) {\n this.selectDefaultCharset();\n return true;\n }\n if (collectAndFlag[0] === '/') {\n return true; // TODO: Is this supported?\n }\n this._charsetService.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] || DEFAULT_CHARSET);\n return true;\n }\n\n /**\n * ESC D\n * C1.IND\n * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)\n * Moves the cursor down one line in the same column.\n *\n * @vt: #Y C1 IND \"Index\" \"\\x84\" \"Move the cursor one line down scrolling if needed.\"\n * @vt: #Y ESC IND \"Index\" \"ESC D\" \"Move the cursor one line down scrolling if needed.\"\n */\n public index(): boolean {\n this._restrictCursor();\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * ESC H\n * C1.HTS\n * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html)\n * Sets a horizontal tab stop at the column position indicated by\n * the value of the active column when the terminal receives an HTS.\n *\n * @vt: #Y C1 HTS \"Horizontal Tabulation Set\" \"\\x88\" \"Places a tab stop at the current cursor position.\"\n * @vt: #Y ESC HTS \"Horizontal Tabulation Set\" \"ESC H\" \"Places a tab stop at the current cursor position.\"\n */\n public tabSet(): boolean {\n this._activeBuffer.tabs[this._activeBuffer.x] = true;\n return true;\n }\n\n /**\n * ESC M\n * C1.RI\n * DEC mnemonic: HTS\n * Moves the cursor up one line in the same column. If the cursor is at the top margin,\n * the page scrolls down.\n *\n * @vt: #Y ESC IR \"Reverse Index\" \"ESC M\" \"Move the cursor one line up scrolling if needed.\"\n */\n public reverseIndex(): boolean {\n this._restrictCursor();\n if (this._activeBuffer.y === this._activeBuffer.scrollTop) {\n // possibly move the code below to term.reverseScroll();\n // test: echo -ne '\\e[1;1H\\e[44m\\eM\\e[0m'\n // blankLine(true) is xterm/linux behavior\n const scrollRegionHeight = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;\n this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, scrollRegionHeight, 1);\n this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n } else {\n this._activeBuffer.y--;\n this._restrictCursor(); // quickfix to not run out of bounds\n }\n return true;\n }\n\n /**\n * ESC c\n * DEC mnemonic: RIS (https://vt100.net/docs/vt510-rm/RIS.html)\n * Reset to initial state.\n */\n public fullReset(): boolean {\n this._parser.reset();\n this._onRequestReset.fire();\n return true;\n }\n\n public reset(): void {\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._eraseAttrDataInternal = DEFAULT_ATTR_DATA.clone();\n }\n\n /**\n * back_color_erase feature for xterm.\n */\n private _eraseAttrData(): IAttributeData {\n this._eraseAttrDataInternal.bg &= ~(Attributes.CM_MASK | 0xFFFFFF);\n this._eraseAttrDataInternal.bg |= this._curAttrData.bg & ~0xFC000000;\n return this._eraseAttrDataInternal;\n }\n\n /**\n * ESC n\n * ESC o\n * ESC |\n * ESC }\n * ESC ~\n * DEC mnemonic: LS (https://vt100.net/docs/vt510-rm/LS.html)\n * When you use a locking shift, the character set remains in GL or GR until\n * you use another locking shift. (partly supported)\n */\n public setgLevel(level: number): boolean {\n this._charsetService.setgLevel(level);\n return true;\n }\n\n /**\n * ESC # 8\n * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html)\n * This control function fills the complete screen area with\n * a test pattern (E) used for adjusting screen alignment.\n *\n * @vt: #Y ESC DECALN \"Screen Alignment Pattern\" \"ESC # 8\" \"Fill viewport with a test pattern (E).\"\n */\n public screenAlignmentPattern(): boolean {\n // prepare cell data\n const cell = new CellData();\n cell.content = 1 << Content.WIDTH_SHIFT | 'E'.charCodeAt(0);\n cell.fg = this._curAttrData.fg;\n cell.bg = this._curAttrData.bg;\n\n\n this._setCursor(0, 0);\n for (let yOffset = 0; yOffset < this._bufferService.rows; ++yOffset) {\n const row = this._activeBuffer.ybase + this._activeBuffer.y + yOffset;\n const line = this._activeBuffer.lines.get(row);\n if (line) {\n line.fill(cell);\n line.isWrapped = false;\n }\n }\n this._dirtyRowTracker.markAllDirty();\n this._setCursor(0, 0);\n return true;\n }\n\n\n /**\n * DCS $ q Pt ST\n * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html)\n * Request Status String (DECRQSS), VT420 and up.\n * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html)\n *\n * @vt: #P[Limited support, see below.] DCS DECRQSS \"Request Selection or Setting\" \"DCS $ q Pt ST\" \"Request several terminal settings.\"\n * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the\n * corresponding CSI string, `ESC P 0 ST` for invalid requests.\n *\n * Supported requests and responses:\n *\n * | Type | Request | Response (`Pt`) |\n * | -------------------------------- | ----------------- | ----------------------------------------------------- |\n * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) |\n * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ps ; Ps r` |\n * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Ps SP q` |\n * | Protection Attribute (DECSCA) | `DCS $ q \" q ST` | `Ps \" q` (DECSCA 2 is reported as Ps = 0) |\n * | Conformance Level (DECSCL) | `DCS $ q \" p ST` | always reporting `61 ; 1 \" p` (DECSCL is unsupported) |\n *\n *\n * TODO:\n * - fix SGR report\n * - either check which conformance is better suited or remove the report completely\n * --> we are currently a mixture of all up to VT400 but dont follow anyone strictly\n */\n public requestStatusString(data: string, params: IParams): boolean {\n const f = (s: string): boolean => {\n this._coreService.triggerDataEvent(`${C0.ESC}${s}${C0.ESC}\\\\`);\n return true;\n };\n\n // access helpers\n const b = this._bufferService.buffer;\n const opts = this._optionsService.rawOptions;\n const STYLES: { [key: string]: number } = { 'block': 2, 'underline': 4, 'bar': 6 };\n\n if (data === '\"q') return f(`P1$r${this._curAttrData.isProtected() ? 1 : 0}\"q`);\n if (data === '\"p') return f(`P1$r61;1\"p`);\n if (data === 'r') return f(`P1$r${b.scrollTop + 1};${b.scrollBottom + 1}r`);\n // FIXME: report real SGR settings instead of 0m\n if (data === 'm') return f(`P1$r0m`);\n if (data === ' q') return f(`P1$r${STYLES[opts.cursorStyle] - (opts.cursorBlink ? 1 : 0)} q`);\n return f(`P0$r`);\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n this._dirtyRowTracker.markRangeDirty(y1, y2);\n }\n}\n\nexport interface IDirtyRowTracker {\n readonly start: number;\n readonly end: number;\n\n clearRange(): void;\n markDirty(y: number): void;\n markRangeDirty(y1: number, y2: number): void;\n markAllDirty(): void;\n}\n\nclass DirtyRowTracker implements IDirtyRowTracker {\n public start!: number;\n public end!: number;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n this.clearRange();\n }\n\n public clearRange(): void {\n this.start = this._bufferService.buffer.y;\n this.end = this._bufferService.buffer.y;\n }\n\n public markDirty(y: number): void {\n if (y < this.start) {\n this.start = y;\n } else if (y > this.end) {\n this.end = y;\n }\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n if (y1 > y2) {\n $temp = y1;\n y1 = y2;\n y2 = $temp;\n }\n if (y1 < this.start) {\n this.start = y1;\n }\n if (y2 > this.end) {\n this.end = y2;\n }\n }\n\n public markAllDirty(): void {\n this.markRangeDirty(0, this._bufferService.rows - 1);\n }\n}\n\nexport function isValidColorIndex(value: number): value is ColorIndex {\n return 0 <= value && value < 256;\n}\n", "\n/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\ndeclare const setTimeout: (handler: () => void, timeout?: number) => void;\n\n/**\n * Safety watermark to avoid memory exhaustion and browser engine crash on fast data input.\n * Enable flow control to avoid this limit and make sure that your backend correctly\n * propagates this to the underlying pty. (see docs for further instructions)\n * Since this limit is meant as a safety parachute to prevent browser crashs,\n * it is set to a very high number. Typically xterm.js gets unresponsive with\n * a 100 times lower number (>500 kB).\n */\nconst DISCARD_WATERMARK = 50000000; // ~50 MB\n\n/**\n * The max number of ms to spend on writes before allowing the renderer to\n * catch up with a 0ms setTimeout. A value of < 33 to keep us close to\n * 30fps, and a value of < 16 to try to run at 60fps. Of course, the real FPS\n * depends on the time it takes for the renderer to draw the frame.\n */\nconst WRITE_TIMEOUT_MS = 12;\n\n/**\n * Threshold of max held chunks in the write buffer, that were already processed.\n * This is a tradeoff between extensive write buffer shifts (bad runtime) and high\n * memory consumption by data thats not used anymore.\n */\nconst WRITE_BUFFER_LENGTH_THRESHOLD = 50;\n\nexport class WriteBuffer extends Disposable {\n private _writeBuffer: (string | Uint8Array)[] = [];\n private _callbacks: ((() => void) | undefined)[] = [];\n private _pendingData = 0;\n private _bufferOffset = 0;\n private _isSyncWriting = false;\n private _syncCalls = 0;\n private _didUserInput = false;\n\n private readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise) {\n super();\n }\n\n public handleUserInput(): void {\n this._didUserInput = true;\n }\n\n /**\n * @deprecated Unreliable, to be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n // stop writeSync recursions with maxSubsequentCalls argument\n // This is dangerous to use as it will lose the current data chunk\n // and return immediately.\n if (maxSubsequentCalls !== undefined && this._syncCalls > maxSubsequentCalls) {\n // comment next line if a whole loop block should only contain x `writeSync` calls\n // (total flat vs. deep nested limit)\n this._syncCalls = 0;\n return;\n }\n // append chunk to buffer\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(undefined);\n\n // increase recursion counter\n this._syncCalls++;\n // exit early if another writeSync loop is active\n if (this._isSyncWriting) {\n return;\n }\n this._isSyncWriting = true;\n\n // force sync processing on pending data chunks to avoid in-band data scrambling\n // does the same as innerWrite but without event loop\n // we have to do it here as single loop steps to not corrupt loop subject\n // by another writeSync call triggered from _action\n let chunk: string | Uint8Array | undefined;\n while (chunk = this._writeBuffer.shift()) {\n this._action(chunk);\n const cb = this._callbacks.shift();\n if (cb) cb();\n }\n // reset to avoid reprocessing of chunks with scheduled innerWrite call\n // stopping scheduled innerWrite by offset > length condition\n this._pendingData = 0;\n this._bufferOffset = 0x7FFFFFFF;\n\n // allow another writeSync to loop\n this._isSyncWriting = false;\n this._syncCalls = 0;\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n if (this._pendingData > DISCARD_WATERMARK) {\n throw new Error('write data discarded, use flow control to avoid losing data');\n }\n\n // schedule chunk processing for next event loop run\n if (!this._writeBuffer.length) {\n this._bufferOffset = 0;\n\n // If this is the first write call after the user has done some input,\n // parse it immediately to minimize input latency,\n // otherwise schedule for the next event\n if (this._didUserInput) {\n this._didUserInput = false;\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n this._innerWrite();\n return;\n }\n\n setTimeout(() => this._innerWrite());\n }\n\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n }\n\n /**\n * Inner write call, that enters the sliced chunk processing by timing.\n *\n * `lastTime` indicates, when the last _innerWrite call had started.\n * It is used to aggregate async handler execution under a timeout constraint\n * effectively lowering the redrawing needs, schematically:\n *\n * macroTask _innerWrite:\n * if (Date.now() - (lastTime | 0) < WRITE_TIMEOUT_MS):\n * schedule microTask _innerWrite(lastTime)\n * else:\n * schedule macroTask _innerWrite(0)\n *\n * overall execution order on task queues:\n *\n * macrotasks: [...] --> _innerWrite(0) --> [...] --> screenUpdate --> [...]\n * m t: |\n * i a: [...]\n * c s: |\n * r k: while < timeout:\n * o s: _innerWrite(timeout)\n *\n * `promiseResult` depicts the promise resolve value of an async handler.\n * This value gets carried forward through all saved stack states of the\n * paused parser for proper continuation.\n *\n * Note, for pure sync code `lastTime` and `promiseResult` have no meaning.\n */\n protected _innerWrite(lastTime: number = 0, promiseResult: boolean = true): void {\n const startTime = lastTime || Date.now();\n while (this._writeBuffer.length > this._bufferOffset) {\n const data = this._writeBuffer[this._bufferOffset];\n const result = this._action(data, promiseResult);\n if (result) {\n /**\n * If we get a promise as return value, we re-schedule the continuation\n * as thenable on the promise and exit right away.\n *\n * The exit here means, that we block input processing at the current active chunk,\n * the exact execution position within the chunk is preserved by the saved\n * stack content in InputHandler and EscapeSequenceParser.\n *\n * Resuming happens automatically from that saved stack state.\n * Also the resolved promise value is passed along the callstack to\n * `EscapeSequenceParser.parse` to correctly resume the stopped handler loop.\n *\n * Exceptions on async handlers will be logged to console async, but do not interrupt\n * the input processing (continues with next handler at the current input position).\n */\n\n /**\n * If a promise takes long to resolve, we should schedule continuation behind setTimeout.\n * This might already be too late, if our .then enters really late (executor + prev thens\n * took very long). This cannot be solved here for the handler itself (it is the handlers\n * responsibility to slice hard work), but we can at least schedule a screen update as we\n * gain control.\n */\n const continuation: (r: boolean) => void = (r: boolean) => Date.now() - startTime >= WRITE_TIMEOUT_MS\n ? setTimeout(() => this._innerWrite(0, r))\n : this._innerWrite(startTime, r);\n\n /**\n * Optimization considerations:\n * The continuation above favors FPS over throughput by eval'ing `startTime` on resolve.\n * This might schedule too many screen updates with bad throughput drops (in case a slow\n * resolving handler sliced its work properly behind setTimeout calls). We cannot spot\n * this condition here, also the renderer has no way to spot nonsense updates either.\n * FIXME: A proper fix for this would track the FPS at the renderer entry level separately.\n *\n * If favoring of FPS shows bad throughtput impact, use the following instead. It favors\n * throughput by eval'ing `startTime` upfront pulling at least one more chunk into the\n * current microtask queue (executed before setTimeout).\n */\n // const continuation: (r: boolean) => void = Date.now() - startTime >= WRITE_TIMEOUT_MS\n // ? r => setTimeout(() => this._innerWrite(0, r))\n // : r => this._innerWrite(startTime, r);\n\n // Handle exceptions synchronously to current band position, idea:\n // 1. spawn a single microtask which we allow to throw hard\n // 2. spawn a promise immediately resolving to `true`\n // (executed on the same queue, thus properly aligned before continuation happens)\n result.catch(err => {\n queueMicrotask(() => {throw err;});\n return Promise.resolve(false);\n }).then(continuation);\n return;\n }\n\n const cb = this._callbacks[this._bufferOffset];\n if (cb) cb();\n this._bufferOffset++;\n this._pendingData -= data.length;\n\n if (Date.now() - startTime >= WRITE_TIMEOUT_MS) {\n break;\n }\n }\n if (this._writeBuffer.length > this._bufferOffset) {\n // Allow renderer to catch up before processing the next batch\n // trim already processed chunks if we are above threshold\n if (this._bufferOffset > WRITE_BUFFER_LENGTH_THRESHOLD) {\n this._writeBuffer = this._writeBuffer.slice(this._bufferOffset);\n this._callbacks = this._callbacks.slice(this._bufferOffset);\n this._bufferOffset = 0;\n }\n setTimeout(() => this._innerWrite());\n } else {\n this._writeBuffer.length = 0;\n this._callbacks.length = 0;\n this._pendingData = 0;\n this._bufferOffset = 0;\n }\n this._onWriteParsed.fire();\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, IOscLinkService } from 'common/services/Services';\nimport { IMarker, IOscLinkData } from 'common/Types';\n\nexport class OscLinkService implements IOscLinkService {\n public serviceBrand: any;\n\n private _nextId = 1;\n\n /**\n * A map of the link key to link entry. This is used to add additional lines to links with ids.\n */\n private _entriesWithId: Map = new Map();\n\n /**\n * A map of the link id to the link entry. The \"link id\" (number) which is the numberic\n * representation of a unique link should not be confused with \"id\" (string) which comes in with\n * `id=` in the OSC link's properties.\n */\n private _dataByLinkId: Map = new Map();\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n }\n\n public registerLink(data: IOscLinkData): number {\n const buffer = this._bufferService.buffer;\n\n // Links with no id will only ever be registered a single time\n if (data.id === undefined) {\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryNoId = {\n data,\n id: this._nextId++,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n // Add the line to the link if it already exists\n const castData = data as Required;\n const key = this._getEntryIdKey(castData);\n const match = this._entriesWithId.get(key);\n if (match) {\n this.addLineToLink(match.id, buffer.ybase + buffer.y);\n return match.id;\n }\n\n // Create the link\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryWithId = {\n id: this._nextId++,\n key: this._getEntryIdKey(castData),\n data: castData,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._entriesWithId.set(entry.key, entry);\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n public addLineToLink(linkId: number, y: number): void {\n const entry = this._dataByLinkId.get(linkId);\n if (!entry) {\n return;\n }\n if (entry.lines.every(e => e.line !== y)) {\n const marker = this._bufferService.buffer.addMarker(y);\n entry.lines.push(marker);\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n }\n }\n\n public getLinkData(linkId: number): IOscLinkData | undefined {\n return this._dataByLinkId.get(linkId)?.data;\n }\n\n private _getEntryIdKey(linkData: Required): string {\n return `${linkData.id};;${linkData.uri}`;\n }\n\n private _removeMarkerFromLink(entry: IOscLinkEntryNoId | IOscLinkEntryWithId, marker: IMarker): void {\n const index = entry.lines.indexOf(marker);\n if (index === -1) {\n return;\n }\n entry.lines.splice(index, 1);\n if (entry.lines.length === 0) {\n if (entry.data.id !== undefined) {\n this._entriesWithId.delete((entry as IOscLinkEntryWithId).key);\n }\n this._dataByLinkId.delete(entry.id);\n }\n }\n}\n\ninterface IOscLinkEntry {\n data: T;\n id: number;\n lines: IMarker[];\n}\n\ninterface IOscLinkEntryNoId extends IOscLinkEntry {\n}\n\ninterface IOscLinkEntryWithId extends IOscLinkEntry> {\n key: string;\n}\n", "/**\n * Copyright (c) 2014-2020 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from 'common/services/Services';\nimport { InstantiationService } from 'common/services/InstantiationService';\nimport { LogService } from 'common/services/LogService';\nimport { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';\nimport { OptionsService } from 'common/services/OptionsService';\nimport { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';\nimport { CoreService } from 'common/services/CoreService';\nimport { CoreMouseService } from 'common/services/CoreMouseService';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { CharsetService } from 'common/services/CharsetService';\nimport { updateWindowsModeWrappedState } from 'common/WindowsMode';\nimport { IFunctionIdentifier, IParams } from 'common/parser/Types';\nimport { IBufferSet } from 'common/buffer/Types';\nimport { InputHandler } from 'common/InputHandler';\nimport { WriteBuffer } from 'common/input/WriteBuffer';\nimport { OscLinkService } from 'common/services/OscLinkService';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\n// Only trigger this warning a single time per session\nlet hasWriteSyncWarnHappened = false;\n\nexport abstract class CoreTerminal extends Disposable implements ICoreTerminal {\n protected readonly _instantiationService: IInstantiationService;\n protected readonly _bufferService: IBufferService;\n protected readonly _logService: ILogService;\n protected readonly _charsetService: ICharsetService;\n protected readonly _oscLinkService: IOscLinkService;\n\n public readonly coreMouseService: ICoreMouseService;\n public readonly coreService: ICoreService;\n public readonly unicodeService: IUnicodeService;\n public readonly optionsService: IOptionsService;\n\n protected _inputHandler: InputHandler;\n private _writeBuffer: WriteBuffer;\n private _windowsWrappingHeuristics = this._register(new MutableDisposable());\n\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n protected _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n protected readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n /**\n * Internally we track the source of the scroll but this is meaningless outside the library so\n * it's filtered out.\n */\n protected _onScrollApi?: Emitter;\n protected _onScroll = this._register(new Emitter());\n public get onScroll(): Event {\n if (!this._onScrollApi) {\n this._onScrollApi = this._register(new Emitter());\n this._onScroll.event(ev => {\n this._onScrollApi?.fire(ev.position);\n });\n }\n return this._onScrollApi.event;\n }\n\n public get cols(): number { return this._bufferService.cols; }\n public get rows(): number { return this._bufferService.rows; }\n public get buffers(): IBufferSet { return this._bufferService.buffers; }\n public get options(): Required { return this.optionsService.options; }\n public set options(options: ITerminalOptions) {\n for (const key in options) {\n this.optionsService.options[key] = options[key];\n }\n }\n\n constructor(\n options: Partial\n ) {\n super();\n\n // Setup and initialize services\n this._instantiationService = new InstantiationService();\n this.optionsService = this._register(new OptionsService(options));\n this._instantiationService.setService(IOptionsService, this.optionsService);\n this._bufferService = this._register(this._instantiationService.createInstance(BufferService));\n this._instantiationService.setService(IBufferService, this._bufferService);\n this._logService = this._register(this._instantiationService.createInstance(LogService));\n this._instantiationService.setService(ILogService, this._logService);\n this.coreService = this._register(this._instantiationService.createInstance(CoreService));\n this._instantiationService.setService(ICoreService, this.coreService);\n this.coreMouseService = this._register(this._instantiationService.createInstance(CoreMouseService));\n this._instantiationService.setService(ICoreMouseService, this.coreMouseService);\n this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));\n this._instantiationService.setService(IUnicodeService, this.unicodeService);\n this._charsetService = this._instantiationService.createInstance(CharsetService);\n this._instantiationService.setService(ICharsetService, this._charsetService);\n this._oscLinkService = this._instantiationService.createInstance(OscLinkService);\n this._instantiationService.setService(IOscLinkService, this._oscLinkService);\n\n\n // Register input handler and handle/forward events\n this._inputHandler = this._register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));\n this._register(Event.forward(this._inputHandler.onLineFeed, this._onLineFeed));\n this._register(this._inputHandler);\n\n // Setup listeners\n this._register(Event.forward(this._bufferService.onResize, this._onResize));\n this._register(Event.forward(this.coreService.onData, this._onData));\n this._register(Event.forward(this.coreService.onBinary, this._onBinary));\n this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));\n this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));\n this._register(this.optionsService.onMultipleOptionChange(['windowsMode', 'windowsPty'], () => this._handleWindowsPtyOptionChange()));\n this._register(this._bufferService.onScroll(() => {\n this._onScroll.fire({ position: this._bufferService.buffer.ydisp });\n this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);\n }));\n // Setup WriteBuffer\n this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));\n this._register(Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._writeBuffer.write(data, callback);\n }\n\n /**\n * Write data to terminal synchonously.\n *\n * This method is unreliable with async parser handlers, thus should not\n * be used anymore. If you need blocking semantics on data input consider\n * `write` with a callback instead.\n *\n * @deprecated Unreliable, will be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n if (this._logService.logLevel <= LogLevelEnum.WARN && !hasWriteSyncWarnHappened) {\n this._logService.warn('writeSync is unreliable and will be removed soon.');\n hasWriteSyncWarnHappened = true;\n }\n this._writeBuffer.writeSync(data, maxSubsequentCalls);\n }\n\n public input(data: string, wasUserInput: boolean = true): void {\n this.coreService.triggerDataEvent(data, wasUserInput);\n }\n\n public resize(x: number, y: number): void {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n x = Math.max(x, MINIMUM_COLS);\n y = Math.max(y, MINIMUM_ROWS);\n\n this._bufferService.resize(x, y);\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n this._bufferService.scroll(eraseAttr, isWrapped);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used to avoid\n * unwanted events being handled by the viewport when the event was triggered from the viewport\n * originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n this._bufferService.scrollLines(disp, suppressScrollEvent);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n /** Add handler for ESC escape sequence. See xterm.d.ts for details. */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._inputHandler.registerEscHandler(id, callback);\n }\n\n /** Add handler for DCS escape sequence. See xterm.d.ts for details. */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerDcsHandler(id, callback);\n }\n\n /** Add handler for CSI escape sequence. See xterm.d.ts for details. */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerCsiHandler(id, callback);\n }\n\n /** Add handler for OSC escape sequence. See xterm.d.ts for details. */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._inputHandler.registerOscHandler(ident, callback);\n }\n\n protected _setup(): void {\n this._handleWindowsPtyOptionChange();\n }\n\n public reset(): void {\n this._inputHandler.reset();\n this._bufferService.reset();\n this._charsetService.reset();\n this.coreService.reset();\n this.coreMouseService.reset();\n }\n\n\n private _handleWindowsPtyOptionChange(): void {\n let value = false;\n const windowsPty = this.optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber !== undefined && windowsPty.buildNumber !== undefined) {\n value = !!(windowsPty.backend === 'conpty' && windowsPty.buildNumber < 21376);\n } else if (this.optionsService.rawOptions.windowsMode) {\n value = true;\n }\n if (value) {\n this._enableWindowsWrappingHeuristics();\n } else {\n this._windowsWrappingHeuristics.clear();\n }\n }\n\n protected _enableWindowsWrappingHeuristics(): void {\n if (!this._windowsWrappingHeuristics.value) {\n const disposables: IDisposable[] = [];\n disposables.push(this.onLineFeed(updateWindowsModeWrappedState.bind(null, this._bufferService)));\n disposables.push(this.registerCsiHandler({ final: 'H' }, () => {\n updateWindowsModeWrappedState(this._bufferService);\n return false;\n }));\n this._windowsWrappingHeuristics.value = toDisposable(() => {\n for (const d of disposables) {\n d.dispose();\n }\n });\n }\n }\n}\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n// reg + shift key mappings for digits and special chars\nconst KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {\n // digits 0-9\n 48: ['0', ')'],\n 49: ['1', '!'],\n 50: ['2', '@'],\n 51: ['3', '#'],\n 52: ['4', '$'],\n 53: ['5', '%'],\n 54: ['6', '^'],\n 55: ['7', '&'],\n 56: ['8', '*'],\n 57: ['9', '('],\n\n // special chars\n 186: [';', ':'],\n 187: ['=', '+'],\n 188: [',', '<'],\n 189: ['-', '_'],\n 190: ['.', '>'],\n 191: ['/', '?'],\n 192: ['`', '~'],\n 219: ['[', '{'],\n 220: ['\\\\', '|'],\n 221: [']', '}'],\n 222: ['\\'', '\"']\n};\n\nexport function evaluateKeyboardEvent(\n ev: IKeyboardEvent,\n applicationCursorMode: boolean,\n isMac: boolean,\n macOptionIsMeta: boolean\n): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n // Whether to cancel event propagation (NOTE: this may not be needed since the event is\n // canceled at the end of keyDown\n cancel: false,\n // The new key even to emit\n key: undefined\n };\n const modifiers = (ev.shiftKey ? 1 : 0) | (ev.altKey ? 2 : 0) | (ev.ctrlKey ? 4 : 0) | (ev.metaKey ? 8 : 0);\n switch (ev.keyCode) {\n case 0:\n if (ev.key === 'UIKeyInputUpArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n }\n else if (ev.key === 'UIKeyInputLeftArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n }\n else if (ev.key === 'UIKeyInputRightArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n }\n else if (ev.key === 'UIKeyInputDownArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n }\n break;\n case 8:\n // backspace\n result.key = ev.ctrlKey ? '\\b' : C0.DEL; // ^H or ^?\n if (ev.altKey) {\n result.key = C0.ESC + result.key;\n }\n break;\n case 9:\n // tab\n if (ev.shiftKey) {\n result.key = C0.ESC + '[Z';\n break;\n }\n result.key = C0.HT;\n result.cancel = true;\n break;\n case 13:\n // return/enter\n result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;\n result.cancel = true;\n break;\n case 27:\n // escape\n result.key = C0.ESC;\n if (ev.altKey) {\n result.key = C0.ESC + C0.ESC;\n }\n result.cancel = true;\n break;\n case 37:\n // left-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'D';\n // HACK: Make Alt + left-arrow behave like Ctrl + left-arrow: move one word backwards\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3D') {\n result.key = C0.ESC + (isMac ? 'b' : '[1;5D');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n break;\n case 39:\n // right-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'C';\n // HACK: Make Alt + right-arrow behave like Ctrl + right-arrow: move one word forward\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3C') {\n result.key = C0.ESC + (isMac ? 'f' : '[1;5C');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n break;\n case 38:\n // up-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A';\n // HACK: Make Alt + up-arrow behave like Ctrl + up-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3A') {\n result.key = C0.ESC + '[1;5A';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n break;\n case 40:\n // down-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B';\n // HACK: Make Alt + down-arrow behave like Ctrl + down-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3B') {\n result.key = C0.ESC + '[1;5B';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n break;\n case 45:\n // insert\n if (!ev.shiftKey && !ev.ctrlKey) {\n // or + are used to\n // copy-paste on some systems.\n result.key = C0.ESC + '[2~';\n }\n break;\n case 46:\n // delete\n if (modifiers) {\n result.key = C0.ESC + '[3;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[3~';\n }\n break;\n case 36:\n // home\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'H';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OH';\n } else {\n result.key = C0.ESC + '[H';\n }\n break;\n case 35:\n // end\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'F';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OF';\n } else {\n result.key = C0.ESC + '[F';\n }\n break;\n case 33:\n // page up\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_UP;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[5;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[5~';\n }\n break;\n case 34:\n // page down\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_DOWN;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[6;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[6~';\n }\n break;\n case 112:\n // F1-F12\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'P';\n } else {\n result.key = C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n } else {\n result.key = C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'R';\n } else {\n result.key = C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'S';\n } else {\n result.key = C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = C0.ESC + '[15;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = C0.ESC + '[17;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = C0.ESC + '[18;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = C0.ESC + '[19;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = C0.ESC + '[20;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = C0.ESC + '[21;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = C0.ESC + '[23;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = C0.ESC + '[24;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[24~';\n }\n break;\n default:\n // a-z and space\n if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = String.fromCharCode(ev.keyCode - 64);\n } else if (ev.keyCode === 32) {\n result.key = C0.NUL;\n } else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n // escape, file sep, group sep, record sep, unit sep\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n } else if (ev.keyCode === 56) {\n result.key = C0.DEL;\n } else if (ev.keyCode === 219) {\n result.key = C0.ESC;\n } else if (ev.keyCode === 220) {\n result.key = C0.FS;\n } else if (ev.keyCode === 221) {\n result.key = C0.GS;\n }\n } else if ((!isMac || macOptionIsMeta) && ev.altKey && !ev.metaKey) {\n // On macOS this is a third level shift when !macOptionIsMeta. Use instead.\n const keyMapping = KEYCODE_KEY_MAPPINGS[ev.keyCode];\n const key = keyMapping?.[!ev.shiftKey ? 0 : 1];\n if (key) {\n result.key = C0.ESC + key;\n } else if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n const keyCode = ev.ctrlKey ? ev.keyCode - 64 : ev.keyCode + 32;\n let keyString = String.fromCharCode(keyCode);\n if (ev.shiftKey) {\n keyString = keyString.toUpperCase();\n }\n result.key = C0.ESC + keyString;\n } else if (ev.keyCode === 32) {\n result.key = C0.ESC + (ev.ctrlKey ? C0.NUL : ' ');\n } else if (ev.key === 'Dead' && ev.code.startsWith('Key')) {\n // Reference: https://github.com/xtermjs/xterm.js/issues/3725\n // Alt will produce a \"dead key\" (initate composition) with some\n // of the letters in US layout (e.g. N/E/U).\n // It's safe to match against Key* since no other `code` values begin with \"Key\".\n // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values#code_values_on_mac\n let keyString = ev.code.slice(3, 4);\n if (!ev.shiftKey) {\n keyString = keyString.toLowerCase();\n }\n result.key = C0.ESC + keyString;\n result.cancel = true;\n }\n } else if (isMac && !ev.altKey && !ev.ctrlKey && !ev.shiftKey && ev.metaKey) {\n if (ev.keyCode === 65) { // cmd + a\n result.type = KeyboardResultType.SELECT_ALL;\n }\n } else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.keyCode >= 48 && ev.key.length === 1) {\n // Include only keys that that result in a _single_ character; don't include num lock,\n // volume up, etc.\n result.key = ev.key;\n } else if (ev.key && ev.ctrlKey) {\n if (ev.key === '_') { // ^_\n result.key = C0.US;\n }\n if (ev.key === '@') { // ^ + shift + 2 = ^ + @\n result.key = C0.NUL;\n }\n }\n break;\n }\n\n return result;\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IdleTaskQueue } from 'common/TaskQueue';\n\n// Work variables to avoid garbage collection.\nlet i = 0;\n\n/**\n * A generic list that is maintained in sorted order and allows values with duplicate keys. Deferred\n * batch insertion and deletion is used to significantly reduce the time it takes to insert and\n * delete a large amount of items in succession. This list is based on binary search and as such\n * locating a key will take O(log n) amortized, this includes the by key iterator.\n */\nexport class SortedList {\n private _array: T[] = [];\n\n private readonly _insertedValues: T[] = [];\n private readonly _flushInsertedTask = new IdleTaskQueue();\n private _isFlushingInserted = false;\n\n private readonly _deletedIndices: number[] = [];\n private readonly _flushDeletedTask = new IdleTaskQueue();\n private _isFlushingDeleted = false;\n\n constructor(\n private readonly _getKey: (value: T) => number\n ) {\n }\n\n public clear(): void {\n this._array.length = 0;\n this._insertedValues.length = 0;\n this._flushInsertedTask.clear();\n this._isFlushingInserted = false;\n this._deletedIndices.length = 0;\n this._flushDeletedTask.clear();\n this._isFlushingDeleted = false;\n }\n\n public insert(value: T): void {\n this._flushCleanupDeleted();\n if (this._insertedValues.length === 0) {\n this._flushInsertedTask.enqueue(() => this._flushInserted());\n }\n this._insertedValues.push(value);\n }\n\n private _flushInserted(): void {\n const sortedAddedValues = this._insertedValues.sort((a, b) => this._getKey(a) - this._getKey(b));\n let sortedAddedValuesIndex = 0;\n let arrayIndex = 0;\n\n const newArray = new Array(this._array.length + this._insertedValues.length);\n\n for (let newArrayIndex = 0; newArrayIndex < newArray.length; newArrayIndex++) {\n if (arrayIndex >= this._array.length || this._getKey(sortedAddedValues[sortedAddedValuesIndex]) <= this._getKey(this._array[arrayIndex])) {\n newArray[newArrayIndex] = sortedAddedValues[sortedAddedValuesIndex];\n sortedAddedValuesIndex++;\n } else {\n newArray[newArrayIndex] = this._array[arrayIndex++];\n }\n }\n\n this._array = newArray;\n this._insertedValues.length = 0;\n }\n\n private _flushCleanupInserted(): void {\n if (!this._isFlushingInserted && this._insertedValues.length > 0) {\n this._flushInsertedTask.flush();\n }\n }\n\n public delete(value: T): boolean {\n this._flushCleanupInserted();\n if (this._array.length === 0) {\n return false;\n }\n const key = this._getKey(value);\n if (key === undefined) {\n return false;\n }\n i = this._search(key);\n if (i === -1) {\n return false;\n }\n if (this._getKey(this._array[i]) !== key) {\n return false;\n }\n do {\n if (this._array[i] === value) {\n if (this._deletedIndices.length === 0) {\n this._flushDeletedTask.enqueue(() => this._flushDeleted());\n }\n this._deletedIndices.push(i);\n return true;\n }\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n return false;\n }\n\n private _flushDeleted(): void {\n this._isFlushingDeleted = true;\n const sortedDeletedIndices = this._deletedIndices.sort((a, b) => a - b);\n let sortedDeletedIndicesIndex = 0;\n const newArray = new Array(this._array.length - sortedDeletedIndices.length);\n let newArrayIndex = 0;\n for (let i = 0; i < this._array.length; i++) {\n if (sortedDeletedIndices[sortedDeletedIndicesIndex] === i) {\n sortedDeletedIndicesIndex++;\n } else {\n newArray[newArrayIndex++] = this._array[i];\n }\n }\n this._array = newArray;\n this._deletedIndices.length = 0;\n this._isFlushingDeleted = false;\n }\n\n private _flushCleanupDeleted(): void {\n if (!this._isFlushingDeleted && this._deletedIndices.length > 0) {\n this._flushDeletedTask.flush();\n }\n }\n\n public *getKeyIterator(key: number): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n yield this._array[i];\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public forEachByKey(key: number, callback: (value: T) => void): void {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n callback(this._array[i]);\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public values(): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n // Duplicate the array to avoid issues when _array changes while iterating\n return [...this._array].values();\n }\n\n private _search(key: number): number {\n let min = 0;\n let max = this._array.length - 1;\n while (max >= min) {\n let mid = (min + max) >> 1;\n const midKey = this._getKey(this._array[mid]);\n if (midKey > key) {\n max = mid - 1;\n } else if (midKey < key) {\n min = mid + 1;\n } else {\n // key in list, walk to lowest duplicate\n while (mid > 0 && this._getKey(this._array[mid - 1]) === key) {\n mid--;\n }\n return mid;\n }\n }\n // key not in list\n // still return closest min (also used as insert position)\n return min;\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { css } from 'common/Color';\nimport { Disposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDecorationService, IInternalDecoration } from 'common/services/Services';\nimport { SortedList } from 'common/SortedList';\nimport { IColor } from 'common/Types';\nimport { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';\nimport { Emitter } from 'vs/base/common/event';\n\n// Work variables to avoid garbage collection\nlet $xmin = 0;\nlet $xmax = 0;\n\nexport class DecorationService extends Disposable implements IDecorationService {\n public serviceBrand: any;\n\n /**\n * A list of all decorations, sorted by the marker's line value. This relies on the fact that\n * while marker line values do change, they should all change by the same amount so this should\n * never become out of order.\n */\n private readonly _decorations: SortedList = new SortedList(e => e?.marker.line);\n\n private readonly _onDecorationRegistered = this._register(new Emitter());\n public readonly onDecorationRegistered = this._onDecorationRegistered.event;\n private readonly _onDecorationRemoved = this._register(new Emitter());\n public readonly onDecorationRemoved = this._onDecorationRemoved.event;\n\n public get decorations(): IterableIterator { return this._decorations.values(); }\n\n constructor() {\n super();\n\n this._register(toDisposable(() => this.reset()));\n }\n\n public registerDecoration(options: IDecorationOptions): IDecoration | undefined {\n if (options.marker.isDisposed) {\n return undefined;\n }\n const decoration = new Decoration(options);\n if (decoration) {\n const markerDispose = decoration.marker.onDispose(() => decoration.dispose());\n const listener = decoration.onDispose(() => {\n listener.dispose();\n if (decoration) {\n if (this._decorations.delete(decoration)) {\n this._onDecorationRemoved.fire(decoration);\n }\n markerDispose.dispose();\n }\n });\n this._decorations.insert(decoration);\n this._onDecorationRegistered.fire(decoration);\n }\n return decoration;\n }\n\n public reset(): void {\n for (const d of this._decorations.values()) {\n d.dispose();\n }\n this._decorations.clear();\n }\n\n public *getDecorationsAtCell(x: number, line: number, layer?: 'bottom' | 'top'): IterableIterator {\n let xmin = 0;\n let xmax = 0;\n for (const d of this._decorations.getKeyIterator(line)) {\n xmin = d.options.x ?? 0;\n xmax = xmin + (d.options.width ?? 1);\n if (x >= xmin && x < xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n yield d;\n }\n }\n }\n\n public forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void {\n this._decorations.forEachByKey(line, d => {\n $xmin = d.options.x ?? 0;\n $xmax = $xmin + (d.options.width ?? 1);\n if (x >= $xmin && x < $xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n callback(d);\n }\n });\n }\n}\n\nclass Decoration extends DisposableStore implements IInternalDecoration {\n public readonly marker: IMarker;\n public element: HTMLElement | undefined;\n\n public readonly onRenderEmitter = this.add(new Emitter());\n public readonly onRender = this.onRenderEmitter.event;\n private readonly _onDispose = this.add(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n private _cachedBg: IColor | undefined | null = null;\n public get backgroundColorRGB(): IColor | undefined {\n if (this._cachedBg === null) {\n if (this.options.backgroundColor) {\n this._cachedBg = css.toColor(this.options.backgroundColor);\n } else {\n this._cachedBg = undefined;\n }\n }\n return this._cachedBg;\n }\n\n private _cachedFg: IColor | undefined | null = null;\n public get foregroundColorRGB(): IColor | undefined {\n if (this._cachedFg === null) {\n if (this.options.foregroundColor) {\n this._cachedFg = css.toColor(this.options.foregroundColor);\n } else {\n this._cachedFg = undefined;\n }\n }\n return this._cachedFg;\n }\n\n constructor(\n public readonly options: IDecorationOptions\n ) {\n super();\n this.marker = options.marker;\n if (this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position) {\n this.options.overviewRulerOptions.position = 'full';\n }\n }\n\n public override dispose(): void {\n this._onDispose.fire();\n super.dispose();\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nconst RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second\n\nimport { IRenderDebouncer } from 'browser/Types';\n\n/**\n * Debounces calls to update screen readers to update at most once configurable interval of time.\n */\nexport class TimeBasedDebouncer implements IRenderDebouncer {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n\n // The last moment that the Terminal was refreshed at\n private _lastRefreshMs = 0;\n // Whether a trailing refresh should be triggered due to a refresh request that was throttled\n private _additionalRefreshRequested = false;\n\n private _refreshTimeoutID: number | undefined;\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _debounceThresholdMS = RENDER_DEBOUNCE_THRESHOLD_MS\n ) {\n }\n\n public dispose(): void {\n if (this._refreshTimeoutID) {\n clearTimeout(this._refreshTimeoutID);\n }\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart !== undefined ? rowStart : 0;\n rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n // Only refresh if the time since last refresh is above a threshold, otherwise wait for\n // enough time to pass before refreshing again.\n const refreshRequestTime: number = Date.now();\n if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {\n // Enough time has lapsed since the last refresh; refresh immediately\n this._lastRefreshMs = refreshRequestTime;\n this._innerRefresh();\n } else if (!this._additionalRefreshRequested) {\n // This is the first additional request throttled; set up trailing refresh\n const elapsed = refreshRequestTime - this._lastRefreshMs;\n const waitPeriodBeforeTrailingRefresh = this._debounceThresholdMS - elapsed;\n this._additionalRefreshRequested = true;\n\n this._refreshTimeoutID = window.setTimeout(() => {\n this._lastRefreshMs = Date.now();\n this._innerRefresh();\n this._additionalRefreshRequested = false;\n this._refreshTimeoutID = undefined; // No longer need to clear the timeout\n }, waitPeriodBeforeTrailingRefresh);\n }\n }\n\n private _innerRefresh(): void {\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n }\n}\n\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { ITerminal, IRenderDebouncer } from 'browser/Types';\nimport { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';\nimport { Disposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IInstantiationService } from 'common/services/Services';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nconst MAX_ROWS_TO_READ = 20;\n\nconst enum BoundaryPosition {\n TOP,\n BOTTOM\n}\n\n// Turn this on to unhide the accessibility tree and display it under\n// (instead of overlapping with) the terminal.\nconst DEBUG = false;\n\nexport class AccessibilityManager extends Disposable {\n private _debugRootContainer: HTMLElement | undefined;\n private _accessibilityContainer: HTMLElement;\n\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[];\n private _rowColumns: WeakMap = new WeakMap();\n\n private _liveRegion: HTMLElement;\n private _liveRegionLineCount: number = 0;\n private _liveRegionDebouncer: IRenderDebouncer;\n\n private _topBoundaryFocusListener: (e: FocusEvent) => void;\n private _bottomBoundaryFocusListener: (e: FocusEvent) => void;\n\n /**\n * This queue has a character pushed to it for keys that are pressed, if the\n * next character added to the terminal is equal to the key char then it is\n * not announced (added to live region) because it has already been announced\n * by the textarea event (which cannot be canceled). There are some race\n * condition cases if there is typing while data is streaming, but this covers\n * the main case of typing into the prompt and inputting the answer to a\n * question (Y/N, etc.).\n */\n private _charsToConsume: string[] = [];\n\n private _charsToAnnounce: string = '';\n\n constructor(\n private readonly _terminal: ITerminal,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n const doc = this._coreBrowserService.mainDocument;\n this._accessibilityContainer = doc.createElement('div');\n this._accessibilityContainer.classList.add('xterm-accessibility');\n\n this._rowContainer = doc.createElement('div');\n this._rowContainer.setAttribute('role', 'list');\n this._rowContainer.classList.add('xterm-accessibility-tree');\n this._rowElements = [];\n for (let i = 0; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n\n this._topBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.TOP);\n this._bottomBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.BOTTOM);\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._accessibilityContainer.appendChild(this._rowContainer);\n\n this._liveRegion = doc.createElement('div');\n this._liveRegion.classList.add('live-region');\n this._liveRegion.setAttribute('aria-live', 'assertive');\n this._accessibilityContainer.appendChild(this._liveRegion);\n this._liveRegionDebouncer = this._register(new TimeBasedDebouncer(this._renderRows.bind(this)));\n\n if (!this._terminal.element) {\n throw new Error('Cannot enable accessibility before Terminal.open');\n }\n\n if (DEBUG) {\n this._accessibilityContainer.classList.add('debug');\n this._rowContainer.classList.add('debug');\n\n // Use a `
` container so that the css will still apply.\n this._debugRootContainer = doc.createElement('div');\n this._debugRootContainer.classList.add('xterm');\n\n this._debugRootContainer.appendChild(doc.createTextNode('------start a11y------'));\n this._debugRootContainer.appendChild(this._accessibilityContainer);\n this._debugRootContainer.appendChild(doc.createTextNode('------end a11y------'));\n\n this._terminal.element.insertAdjacentElement('afterend', this._debugRootContainer);\n } else {\n this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityContainer);\n }\n\n this._register(this._terminal.onResize(e => this._handleResize(e.rows)));\n this._register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));\n this._register(this._terminal.onScroll(() => this._refreshRows()));\n // Line feed is an issue as the prompt won't be read out after a command is run\n this._register(this._terminal.onA11yChar(char => this._handleChar(char)));\n this._register(this._terminal.onLineFeed(() => this._handleChar('\\n')));\n this._register(this._terminal.onA11yTab(spaceCount => this._handleTab(spaceCount)));\n this._register(this._terminal.onKey(e => this._handleKey(e.key)));\n this._register(this._terminal.onBlur(() => this._clearLiveRegion()));\n this._register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));\n this._register(addDisposableListener(doc, 'selectionchange', () => this._handleSelectionChange()));\n this._register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions()));\n\n this._refreshRowsDimensions();\n this._refreshRows();\n this._register(toDisposable(() => {\n if (DEBUG) {\n this._debugRootContainer!.remove();\n } else {\n this._accessibilityContainer.remove();\n }\n this._rowElements.length = 0;\n }));\n }\n\n private _handleTab(spaceCount: number): void {\n for (let i = 0; i < spaceCount; i++) {\n this._handleChar(' ');\n }\n }\n\n private _handleChar(char: string): void {\n if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {\n if (this._charsToConsume.length > 0) {\n // Have the screen reader ignore the char if it was just input\n const shiftedChar = this._charsToConsume.shift();\n if (shiftedChar !== char) {\n this._charsToAnnounce += char;\n }\n } else {\n this._charsToAnnounce += char;\n }\n\n if (char === '\\n') {\n this._liveRegionLineCount++;\n if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {\n this._liveRegion.textContent += Strings.tooMuchOutput.get();\n }\n }\n }\n }\n\n private _clearLiveRegion(): void {\n this._liveRegion.textContent = '';\n this._liveRegionLineCount = 0;\n }\n\n private _handleKey(keyChar: string): void {\n this._clearLiveRegion();\n // Only add the char if there is no control character.\n if (!/\\p{Control}/u.test(keyChar)) {\n this._charsToConsume.push(keyChar);\n }\n }\n\n private _refreshRows(start?: number, end?: number): void {\n this._liveRegionDebouncer.refresh(start, end, this._terminal.rows);\n }\n\n private _renderRows(start: number, end: number): void {\n const buffer: IBuffer = this._terminal.buffer;\n const setSize = buffer.lines.length.toString();\n for (let i = start; i <= end; i++) {\n const line = buffer.lines.get(buffer.ydisp + i);\n const columns: number[] = [];\n const lineData = line?.translateToString(true, undefined, undefined, columns) || '';\n const posInSet = (buffer.ydisp + i + 1).toString();\n const element = this._rowElements[i];\n if (element) {\n if (lineData.length === 0) {\n element.innerText = '\\u00a0';\n this._rowColumns.set(element, [0, 1]);\n } else {\n element.textContent = lineData;\n this._rowColumns.set(element, columns);\n }\n element.setAttribute('aria-posinset', posInSet);\n element.setAttribute('aria-setsize', setSize);\n this._alignRowWidth(element);\n }\n }\n this._announceCharacters();\n }\n\n private _announceCharacters(): void {\n if (this._charsToAnnounce.length === 0) {\n return;\n }\n this._liveRegion.textContent += this._charsToAnnounce;\n this._charsToAnnounce = '';\n }\n\n private _handleBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {\n const boundaryElement = e.target as HTMLElement;\n const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];\n\n // Don't scroll if the buffer top has reached the end in that direction\n const posInSet = boundaryElement.getAttribute('aria-posinset');\n const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;\n if (posInSet === lastRowPos) {\n return;\n }\n\n // Don't scroll when the last focused item was not the second row (focus is going the other\n // direction)\n if (e.relatedTarget !== beforeBoundaryElement) {\n return;\n }\n\n // Remove old boundary element from array\n let topBoundaryElement: HTMLElement;\n let bottomBoundaryElement: HTMLElement;\n if (position === BoundaryPosition.TOP) {\n topBoundaryElement = boundaryElement;\n bottomBoundaryElement = this._rowElements.pop()!;\n this._rowContainer.removeChild(bottomBoundaryElement);\n } else {\n topBoundaryElement = this._rowElements.shift()!;\n bottomBoundaryElement = boundaryElement;\n this._rowContainer.removeChild(topBoundaryElement);\n }\n\n // Remove listeners from old boundary elements\n topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);\n bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Add new element to array/DOM\n if (position === BoundaryPosition.TOP) {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.unshift(newElement);\n this._rowContainer.insertAdjacentElement('afterbegin', newElement);\n } else {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.push(newElement);\n this._rowContainer.appendChild(newElement);\n }\n\n // Add listeners to new boundary elements\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Scroll up\n this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);\n\n // Focus new boundary before element\n this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();\n\n // Prevent the standard behavior\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n private _handleSelectionChange(): void {\n if (this._rowElements.length === 0) {\n return;\n }\n\n const selection = this._coreBrowserService.mainDocument.getSelection();\n if (!selection) {\n return;\n }\n\n if (selection.isCollapsed) {\n // Only do something when the anchorNode is inside the row container. This\n // behavior mirrors what we do with mouse --- if the mouse clicks\n // somewhere outside of the terminal, we don't clear the selection.\n if (this._rowContainer.contains(selection.anchorNode)) {\n this._terminal.clearSelection();\n }\n return;\n }\n\n if (!selection.anchorNode || !selection.focusNode) {\n console.error('anchorNode and/or focusNode are null');\n return;\n }\n\n // Sort the two selection points in document order.\n let begin = { node: selection.anchorNode, offset: selection.anchorOffset };\n let end = { node: selection.focusNode, offset: selection.focusOffset };\n if ((begin.node.compareDocumentPosition(end.node) & Node.DOCUMENT_POSITION_PRECEDING) || (begin.node === end.node && begin.offset > end.offset) ) {\n [begin, end] = [end, begin];\n }\n\n // Clamp begin/end to the inside of the row container.\n if (begin.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING)) {\n begin = { node: this._rowElements[0].childNodes[0], offset: 0 };\n }\n if (!this._rowContainer.contains(begin.node)) {\n // This happens when `begin` is below the last row.\n return;\n }\n const lastRowElement = this._rowElements.slice(-1)[0];\n if (end.node.compareDocumentPosition(lastRowElement) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING)) {\n end = {\n node: lastRowElement,\n offset: lastRowElement.textContent?.length ?? 0\n };\n }\n if (!this._rowContainer.contains(end.node)) {\n // This happens when `end` is above the first row.\n return;\n }\n\n const toRowColumn = ({ node, offset }: typeof begin): {row: number, column: number} | null => {\n // `node` is either the row element or the Text node inside it.\n const rowElement: any = node instanceof Text ? node.parentNode : node;\n let row = parseInt(rowElement?.getAttribute('aria-posinset'), 10) - 1;\n if (isNaN(row)) {\n console.warn('row is invalid. Race condition?');\n return null;\n }\n\n const columns = this._rowColumns.get(rowElement);\n if (!columns) {\n console.warn('columns is null. Race condition?');\n return null;\n }\n\n let column = offset < columns.length ? columns[offset] : columns.slice(-1)[0] + 1;\n if (column >= this._terminal.cols) {\n ++row;\n column = 0;\n }\n return {\n row,\n column\n };\n };\n\n const beginRowColumn = toRowColumn(begin);\n const endRowColumn = toRowColumn(end);\n\n if (!beginRowColumn || !endRowColumn) {\n return;\n }\n\n if (beginRowColumn.row > endRowColumn.row || (beginRowColumn.row === endRowColumn.row && beginRowColumn.column >= endRowColumn.column)) {\n // This should not happen unless we have some bugs.\n throw new Error('invalid range');\n }\n\n this._terminal.select(\n beginRowColumn.column,\n beginRowColumn.row,\n (endRowColumn.row - beginRowColumn.row) * this._terminal.cols - beginRowColumn.column + endRowColumn.column\n );\n }\n\n private _handleResize(rows: number): void {\n // Remove bottom boundary listener\n this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Grow rows as required\n for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n // Shrink rows as required\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n\n // Add bottom boundary listener\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n }\n\n private _createAccessibilityTreeNode(): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.setAttribute('role', 'listitem');\n element.tabIndex = -1;\n this._refreshRowDimensions(element);\n return element;\n }\n\n private _refreshRowsDimensions(): void {\n if (!this._renderService.dimensions.css.cell.height) {\n return;\n }\n Object.assign(this._accessibilityContainer.style, {\n width: `${this._renderService.dimensions.css.canvas.width}px`,\n fontSize: `${this._terminal.options.fontSize}px`\n });\n if (this._rowElements.length !== this._terminal.rows) {\n this._handleResize(this._terminal.rows);\n }\n for (let i = 0; i < this._terminal.rows; i++) {\n this._refreshRowDimensions(this._rowElements[i]);\n this._alignRowWidth(this._rowElements[i]);\n }\n }\n\n private _refreshRowDimensions(element: HTMLElement): void {\n element.style.height = `${this._renderService.dimensions.css.cell.height}px`;\n }\n\n /**\n * Scale the width of a row so that each of the character is (mostly) aligned\n * with the actual rendering. This will allow the screen reader to draw\n * selection outline at the correct position.\n *\n * On top of using the \"monospace\" font and correct font size, the scaling\n * here is necessary to handle characters that are not covered by the font\n * (e.g. CJK).\n */\n private _alignRowWidth(element: HTMLElement): void {\n element.style.transform = '';\n const width = element.getBoundingClientRect().width;\n const lastColumn = this._rowColumns.get(element)?.slice(-1)?.[0];\n if (!lastColumn) {\n return;\n }\n const targetWidth = lastColumn * this._renderService.dimensions.css.cell.width;\n element.style.transform = `scaleX(${targetWidth / width})`;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';\nimport { Disposable, dispose, toDisposable } from 'vs/base/common/lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { IBufferService } from 'common/services/Services';\nimport { ILinkProviderService, IMouseService, IRenderService } from './services/Services';\nimport { Emitter } from 'vs/base/common/event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nexport class Linkifier extends Disposable implements ILinkifier2 {\n public get currentLink(): ILinkWithState | undefined { return this._currentLink; }\n protected _currentLink: ILinkWithState | undefined;\n private _mouseDownLink: ILinkWithState | undefined;\n private _lastMouseEvent: MouseEvent | undefined;\n private _linkCacheDisposables: IDisposable[] = [];\n private _lastBufferCell: IBufferCellPosition | undefined;\n private _isMouseOut: boolean = true;\n private _wasResized: boolean = false;\n private _activeProviderReplies: Map | undefined;\n private _activeLine: number = -1;\n\n private readonly _onShowLinkUnderline = this._register(new Emitter());\n public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;\n private readonly _onHideLinkUnderline = this._register(new Emitter());\n public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;\n\n constructor(\n private readonly _element: HTMLElement,\n @IMouseService private readonly _mouseService: IMouseService,\n @IRenderService private readonly _renderService: IRenderService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ILinkProviderService private readonly _linkProviderService: ILinkProviderService\n ) {\n super();\n this._register(toDisposable(() => {\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n this._lastMouseEvent = undefined;\n // Clear out link providers as they could easily cause an embedder memory leak\n this._activeProviderReplies?.clear();\n }));\n // Listen to resize to catch the case where it's resized and the cursor is out of the viewport.\n this._register(this._bufferService.onResize(() => {\n this._clearCurrentLink();\n this._wasResized = true;\n }));\n this._register(addDisposableListener(this._element, 'mouseleave', () => {\n this._isMouseOut = true;\n this._clearCurrentLink();\n }));\n this._register(addDisposableListener(this._element, 'mousemove', this._handleMouseMove.bind(this)));\n this._register(addDisposableListener(this._element, 'mousedown', this._handleMouseDown.bind(this)));\n this._register(addDisposableListener(this._element, 'mouseup', this._handleMouseUp.bind(this)));\n }\n\n private _handleMouseMove(event: MouseEvent): void {\n this._lastMouseEvent = event;\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n this._isMouseOut = false;\n\n // Ignore the event if it's an embedder created hover widget\n const composedPath = event.composedPath() as HTMLElement[];\n for (let i = 0; i < composedPath.length; i++) {\n const target = composedPath[i];\n // Hit Terminal.element, break and continue\n if (target.classList.contains('xterm')) {\n break;\n }\n // It's a hover, don't respect hover event\n if (target.classList.contains('xterm-hover')) {\n return;\n }\n }\n\n if (!this._lastBufferCell || (position.x !== this._lastBufferCell.x || position.y !== this._lastBufferCell.y)) {\n this._handleHover(position);\n this._lastBufferCell = position;\n }\n }\n\n private _handleHover(position: IBufferCellPosition): void {\n // TODO: This currently does not cache link provider results across wrapped lines, activeLine\n // should be something like `activeRange: {startY, endY}`\n // Check if we need to clear the link\n if (this._activeLine !== position.y || this._wasResized) {\n this._clearCurrentLink();\n this._askForLink(position, false);\n this._wasResized = false;\n return;\n }\n\n // Check the if the link is in the mouse position\n const isCurrentLinkInPosition = this._currentLink && this._linkAtPosition(this._currentLink.link, position);\n if (!isCurrentLinkInPosition) {\n this._clearCurrentLink();\n this._askForLink(position, true);\n }\n }\n\n private _askForLink(position: IBufferCellPosition, useLineCache: boolean): void {\n if (!this._activeProviderReplies || !useLineCache) {\n this._activeProviderReplies?.forEach(reply => {\n reply?.forEach(linkWithState => {\n if (linkWithState.link.dispose) {\n linkWithState.link.dispose();\n }\n });\n });\n this._activeProviderReplies = new Map();\n this._activeLine = position.y;\n }\n let linkProvided = false;\n\n // There is no link cached, so ask for one\n for (const [i, linkProvider] of this._linkProviderService.linkProviders.entries()) {\n if (useLineCache) {\n const existingReply = this._activeProviderReplies?.get(i);\n // If there isn't a reply, the provider hasn't responded yet.\n\n // TODO: If there isn't a reply yet it means that the provider is still resolving. Ensuring\n // provideLinks isn't triggered again saves ILink.hover firing twice though. This probably\n // needs promises to get fixed\n if (existingReply) {\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n }\n } else {\n linkProvider.provideLinks(position.y, (links: ILink[] | undefined) => {\n if (this._isMouseOut) {\n return;\n }\n const linksWithState: ILinkWithState[] | undefined = links?.map(link => ({ link }));\n this._activeProviderReplies?.set(i, linksWithState);\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n\n // If all providers have responded, remove lower priority links that intersect ranges of\n // higher priority links\n if (this._activeProviderReplies?.size === this._linkProviderService.linkProviders.length) {\n this._removeIntersectingLinks(position.y, this._activeProviderReplies);\n }\n });\n }\n }\n }\n\n private _removeIntersectingLinks(y: number, replies: Map): void {\n const occupiedCells = new Set();\n for (let i = 0; i < replies.size; i++) {\n const providerReply = replies.get(i);\n if (!providerReply) {\n continue;\n }\n for (let i = 0; i < providerReply.length; i++) {\n const linkWithState = providerReply[i];\n const startX = linkWithState.link.range.start.y < y ? 0 : linkWithState.link.range.start.x;\n const endX = linkWithState.link.range.end.y > y ? this._bufferService.cols : linkWithState.link.range.end.x;\n for (let x = startX; x <= endX; x++) {\n if (occupiedCells.has(x)) {\n providerReply.splice(i--, 1);\n break;\n }\n occupiedCells.add(x);\n }\n }\n }\n }\n\n private _checkLinkProviderResult(index: number, position: IBufferCellPosition, linkProvided: boolean): boolean {\n if (!this._activeProviderReplies) {\n return linkProvided;\n }\n\n const links = this._activeProviderReplies.get(index);\n\n // Check if every provider before this one has come back undefined\n let hasLinkBefore = false;\n for (let j = 0; j < index; j++) {\n if (!this._activeProviderReplies.has(j) || this._activeProviderReplies.get(j)) {\n hasLinkBefore = true;\n }\n }\n\n // If all providers with higher priority came back undefined, then this provider's link for\n // the position should be used\n if (!hasLinkBefore && links) {\n const linkAtPosition = links.find(link => this._linkAtPosition(link.link, position));\n if (linkAtPosition) {\n linkProvided = true;\n this._handleNewLink(linkAtPosition);\n }\n }\n\n // Check if all the providers have responded\n if (this._activeProviderReplies.size === this._linkProviderService.linkProviders.length && !linkProvided) {\n // Respect the order of the link providers\n for (let j = 0; j < this._activeProviderReplies.size; j++) {\n const currentLink = this._activeProviderReplies.get(j)?.find(link => this._linkAtPosition(link.link, position));\n if (currentLink) {\n linkProvided = true;\n this._handleNewLink(currentLink);\n break;\n }\n }\n }\n\n return linkProvided;\n }\n\n private _handleMouseDown(): void {\n this._mouseDownLink = this._currentLink;\n }\n\n private _handleMouseUp(event: MouseEvent): void {\n if (!this._currentLink) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n\n if (this._mouseDownLink && linkEquals(this._mouseDownLink.link, this._currentLink.link) && this._linkAtPosition(this._currentLink.link, position)) {\n this._currentLink.link.activate(event, this._currentLink.link.text);\n }\n }\n\n private _clearCurrentLink(startRow?: number, endRow?: number): void {\n if (!this._currentLink || !this._lastMouseEvent) {\n return;\n }\n\n // If we have a start and end row, check that the link is within it\n if (!startRow || !endRow || (this._currentLink.link.range.start.y >= startRow && this._currentLink.link.range.end.y <= endRow)) {\n this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent);\n this._currentLink = undefined;\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n }\n }\n\n private _handleNewLink(linkWithState: ILinkWithState): void {\n if (!this._lastMouseEvent) {\n return;\n }\n\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);\n\n if (!position) {\n return;\n }\n\n // Trigger hover if the we have a link at the position\n if (this._linkAtPosition(linkWithState.link, position)) {\n this._currentLink = linkWithState;\n this._currentLink.state = {\n decorations: {\n underline: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.underline,\n pointerCursor: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.pointerCursor\n },\n isHovered: true\n };\n this._linkHover(this._element, linkWithState.link, this._lastMouseEvent);\n\n // Add listener for tracking decorations changes\n linkWithState.link.decorations = {} as ILinkDecorations;\n Object.defineProperties(linkWithState.link.decorations, {\n pointerCursor: {\n get: () => this._currentLink?.state?.decorations.pointerCursor,\n set: v => {\n if (this._currentLink?.state && this._currentLink.state.decorations.pointerCursor !== v) {\n this._currentLink.state.decorations.pointerCursor = v;\n if (this._currentLink.state.isHovered) {\n this._element.classList.toggle('xterm-cursor-pointer', v);\n }\n }\n }\n },\n underline: {\n get: () => this._currentLink?.state?.decorations.underline,\n set: v => {\n if (this._currentLink?.state && this._currentLink?.state?.decorations.underline !== v) {\n this._currentLink.state.decorations.underline = v;\n if (this._currentLink.state.isHovered) {\n this._fireUnderlineEvent(linkWithState.link, v);\n }\n }\n }\n }\n });\n\n // Listen to viewport changes to re-render the link under the cursor (only when the line the\n // link is on changes)\n this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {\n // Sanity check, this shouldn't happen in practice as this listener would be disposed\n if (!this._currentLink) {\n return;\n }\n // When start is 0 a scroll most likely occurred, make sure links above the fold also get\n // cleared.\n const start = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;\n const end = this._bufferService.buffer.ydisp + 1 + e.end;\n // Only clear the link if the viewport change happened on this line\n if (this._currentLink.link.range.start.y >= start && this._currentLink.link.range.end.y <= end) {\n this._clearCurrentLink(start, end);\n if (this._lastMouseEvent) {\n // re-eval previously active link after changes\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService!);\n if (position) {\n this._askForLink(position, false);\n }\n }\n }\n }));\n }\n }\n\n protected _linkHover(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = true;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, true);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.add('xterm-cursor-pointer');\n }\n }\n\n if (link.hover) {\n link.hover(event, link.text);\n }\n }\n\n private _fireUnderlineEvent(link: ILink, showEvent: boolean): void {\n const range = link.range;\n const scrollOffset = this._bufferService.buffer.ydisp;\n const event = this._createLinkUnderlineEvent(range.start.x - 1, range.start.y - scrollOffset - 1, range.end.x, range.end.y - scrollOffset - 1, undefined);\n const emitter = showEvent ? this._onShowLinkUnderline : this._onHideLinkUnderline;\n emitter.fire(event);\n }\n\n protected _linkLeave(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = false;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, false);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.remove('xterm-cursor-pointer');\n }\n }\n\n if (link.leave) {\n link.leave(event, link.text);\n }\n }\n\n /**\n * Check if the buffer position is within the link\n * @param link\n * @param position\n */\n private _linkAtPosition(link: ILink, position: IBufferCellPosition): boolean {\n const lower = link.range.start.y * this._bufferService.cols + link.range.start.x;\n const upper = link.range.end.y * this._bufferService.cols + link.range.end.x;\n const current = position.y * this._bufferService.cols + position.x;\n return (lower <= current && current <= upper);\n }\n\n /**\n * Get the buffer position from a mouse event\n * @param event\n */\n private _positionFromMouseEvent(event: MouseEvent, element: HTMLElement, mouseService: IMouseService): IBufferCellPosition | undefined {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }\n\n private _createLinkUnderlineEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {\n return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };\n }\n}\n\nfunction linkEquals(a: ILink, b: ILink): boolean {\n return (\n a.text === b.text &&\n a.range.start.x === b.range.start.x &&\n a.range.start.y === b.range.start.y &&\n a.range.end.x === b.range.end.x &&\n a.range.end.y === b.range.end.y\n );\n}\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker } from '@xterm/xterm';\nimport { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'browser/Clipboard';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { OscLinkProvider } from 'browser/OscLinkProvider';\nimport { CharacterJoinerHandler, CustomKeyEventHandler, CustomWheelEventHandler, IBrowser, IBufferRange, ICompositionHelper, ILinkifier2, ITerminal } from 'browser/Types';\nimport { Viewport } from 'browser/Viewport';\nimport { BufferDecorationRenderer } from 'browser/decorations/BufferDecorationRenderer';\nimport { OverviewRulerRenderer } from 'browser/decorations/OverviewRulerRenderer';\nimport { CompositionHelper } from 'browser/input/CompositionHelper';\nimport { DomRenderer } from 'browser/renderer/dom/DomRenderer';\nimport { IRenderer } from 'browser/renderer/shared/Types';\nimport { CharSizeService } from 'browser/services/CharSizeService';\nimport { CharacterJoinerService } from 'browser/services/CharacterJoinerService';\nimport { CoreBrowserService } from 'browser/services/CoreBrowserService';\nimport { LinkProviderService } from 'browser/services/LinkProviderService';\nimport { MouseService } from 'browser/services/MouseService';\nimport { RenderService } from 'browser/services/RenderService';\nimport { SelectionService } from 'browser/services/SelectionService';\nimport { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, ILinkProviderService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';\nimport { ThemeService } from 'browser/services/ThemeService';\nimport { channels, color } from 'common/Color';\nimport { CoreTerminal } from 'common/CoreTerminal';\nimport * as Browser from 'common/Platform';\nimport { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from 'common/Types';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IBuffer } from 'common/buffer/Types';\nimport { C0, C1_ESCAPED } from 'common/data/EscapeSequences';\nimport { evaluateKeyboardEvent } from 'common/input/Keyboard';\nimport { toRgbString } from 'common/input/XParseColor';\nimport { DecorationService } from 'common/services/DecorationService';\nimport { IDecorationService } from 'common/services/Services';\nimport { WindowsOptionsReportType } from '../common/InputHandler';\nimport { AccessibilityManager } from './AccessibilityManager';\nimport { Linkifier } from './Linkifier';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\nexport class CoreBrowserTerminal extends CoreTerminal implements ITerminal {\n public textarea: HTMLTextAreaElement | undefined;\n public element: HTMLElement | undefined;\n public screenElement: HTMLElement | undefined;\n\n private _document: Document | undefined;\n private _viewportElement: HTMLElement | undefined;\n private _helperContainer: HTMLElement | undefined;\n private _compositionView: HTMLElement | undefined;\n\n private readonly _linkifier: MutableDisposable = this._register(new MutableDisposable());\n public get linkifier(): ILinkifier2 | undefined { return this._linkifier.value; }\n private _overviewRulerRenderer: OverviewRulerRenderer | undefined;\n private _viewport: Viewport | undefined;\n\n public browser: IBrowser = Browser as any;\n\n private _customKeyEventHandler: CustomKeyEventHandler | undefined;\n private _customWheelEventHandler: CustomWheelEventHandler | undefined;\n\n // Browser services\n private _decorationService: DecorationService;\n private _linkProviderService: ILinkProviderService;\n\n // Optional browser services\n private _charSizeService: ICharSizeService | undefined;\n private _coreBrowserService: ICoreBrowserService | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _themeService: IThemeService | undefined;\n private _characterJoinerService: ICharacterJoinerService | undefined;\n private _selectionService: ISelectionService | undefined;\n\n /**\n * Records whether the keydown event has already been handled and triggered a data event, if so\n * the keypress event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyDownHandled: boolean = false;\n\n /**\n * Records whether a keydown event has occured since the last keyup event, i.e. whether a key\n * is currently \"pressed\".\n */\n private _keyDownSeen: boolean = false;\n\n /**\n * Records whether the keypress event has already been handled and triggered a data event, if so\n * the input event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyPressHandled: boolean = false;\n\n /**\n * Records whether there has been a keydown event for a dead key without a corresponding keydown\n * event for the composed/alternative character. If we cancel the keydown event for the dead key,\n * no events will be emitted for the final character.\n */\n private _unprocessedDeadKey: boolean = false;\n\n private _compositionHelper: ICompositionHelper | undefined;\n private _accessibilityManager: MutableDisposable = this._register(new MutableDisposable());\n\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onKey = this._register(new Emitter<{ key: string, domEvent: KeyboardEvent }>());\n public readonly onKey = this._onKey.event;\n private readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onBell = this._register(new Emitter());\n public readonly onBell = this._onBell.event;\n\n private _onFocus = this._register(new Emitter());\n public get onFocus(): Event { return this._onFocus.event; }\n private _onBlur = this._register(new Emitter());\n public get onBlur(): Event { return this._onBlur.event; }\n private _onA11yCharEmitter = this._register(new Emitter());\n public get onA11yChar(): Event { return this._onA11yCharEmitter.event; }\n private _onA11yTabEmitter = this._register(new Emitter());\n public get onA11yTab(): Event { return this._onA11yTabEmitter.event; }\n private _onWillOpen = this._register(new Emitter());\n public get onWillOpen(): Event { return this._onWillOpen.event; }\n\n constructor(\n options: Partial = {}\n ) {\n super(options);\n\n this._setup();\n\n this._decorationService = this._instantiationService.createInstance(DecorationService);\n this._instantiationService.setService(IDecorationService, this._decorationService);\n this._linkProviderService = this._instantiationService.createInstance(LinkProviderService);\n this._instantiationService.setService(ILinkProviderService, this._linkProviderService);\n this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(OscLinkProvider));\n\n // Setup InputHandler listeners\n this._register(this._inputHandler.onRequestBell(() => this._onBell.fire()));\n this._register(this._inputHandler.onRequestRefreshRows((e) => this.refresh(e?.start ?? 0, e?.end ?? (this.rows - 1))));\n this._register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));\n this._register(this._inputHandler.onRequestReset(() => this.reset()));\n this._register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));\n this._register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));\n this._register(Event.forward(this._inputHandler.onCursorMove, this._onCursorMove));\n this._register(Event.forward(this._inputHandler.onTitleChange, this._onTitleChange));\n this._register(Event.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));\n this._register(Event.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));\n\n // Setup listeners\n this._register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));\n\n this._register(toDisposable(() => {\n this._customKeyEventHandler = undefined;\n this.element?.parentNode?.removeChild(this.element);\n }));\n }\n\n /**\n * Handle color event from inputhandler for OSC 4|104 | 10|110 | 11|111 | 12|112.\n * An event from OSC 4|104 may contain multiple set or report requests, and multiple\n * or none restore requests (resetting all),\n * while an event from OSC 10|110 | 11|111 | 12|112 always contains a single request.\n */\n private _handleColorEvent(event: IColorEvent): void {\n if (!this._themeService) return;\n for (const req of event) {\n let acc: 'foreground' | 'background' | 'cursor' | 'ansi';\n let ident = '';\n switch (req.index) {\n case SpecialColorIndex.FOREGROUND: // OSC 10 | 110\n acc = 'foreground';\n ident = '10';\n break;\n case SpecialColorIndex.BACKGROUND: // OSC 11 | 111\n acc = 'background';\n ident = '11';\n break;\n case SpecialColorIndex.CURSOR: // OSC 12 | 112\n acc = 'cursor';\n ident = '12';\n break;\n default: // OSC 4 | 104\n // we can skip the [0..255] range check here (already done in inputhandler)\n acc = 'ansi';\n ident = '4;' + req.index;\n }\n switch (req.type) {\n case ColorRequestType.REPORT:\n const colorRgb = color.toColorRGB(acc === 'ansi'\n ? this._themeService.colors.ansi[req.index]\n : this._themeService.colors[acc]);\n this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(colorRgb)}${C1_ESCAPED.ST}`);\n break;\n case ColorRequestType.SET:\n if (acc === 'ansi') {\n this._themeService.modifyColors(colors => colors.ansi[req.index] = channels.toColor(...req.color));\n } else {\n const narrowedAcc = acc;\n this._themeService.modifyColors(colors => colors[narrowedAcc] = channels.toColor(...req.color));\n }\n break;\n case ColorRequestType.RESTORE:\n this._themeService.restoreColor(req.index);\n break;\n }\n }\n }\n\n protected _setup(): void {\n super._setup();\n\n this._customKeyEventHandler = undefined;\n }\n\n /**\n * Convenience property to active buffer.\n */\n public get buffer(): IBuffer {\n return this.buffers.active;\n }\n\n /**\n * Focus the terminal. Delegates focus handling to the terminal's DOM element.\n */\n public focus(): void {\n if (this.textarea) {\n this.textarea.focus({ preventScroll: true });\n }\n }\n\n private _handleScreenReaderModeOptionChange(value: boolean): void {\n if (value) {\n if (!this._accessibilityManager.value && this._renderService) {\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n } else {\n this._accessibilityManager.clear();\n }\n }\n\n /**\n * Binds the desired focus behavior on a given terminal object.\n */\n private _handleTextAreaFocus(ev: FocusEvent): void {\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n }\n this.element!.classList.add('focus');\n this._showCursor();\n this._onFocus.fire();\n }\n\n /**\n * Blur the terminal, calling the blur function on the terminal's underlying\n * textarea.\n */\n public blur(): void {\n return this.textarea?.blur();\n }\n\n /**\n * Binds the desired blur behavior on a given terminal object.\n */\n private _handleTextAreaBlur(): void {\n // Text can safely be removed on blur. Doing it earlier could interfere with\n // screen readers reading it out.\n this.textarea!.value = '';\n this.refresh(this.buffer.y, this.buffer.y);\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n this.element!.classList.remove('focus');\n this._onBlur.fire();\n }\n\n private _syncTextArea(): void {\n if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper!.isComposing || !this._renderService) {\n return;\n }\n const cursorY = this.buffer.ybase + this.buffer.y;\n const bufferLine = this.buffer.lines.get(cursorY);\n if (!bufferLine) {\n return;\n }\n const cursorX = Math.min(this.buffer.x, this.cols - 1);\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const width = bufferLine.getWidth(cursorX);\n const cellWidth = this._renderService.dimensions.css.cell.width * width;\n const cursorTop = this.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n this.textarea.style.left = cursorLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = cellWidth + 'px';\n this.textarea.style.height = cellHeight + 'px';\n this.textarea.style.lineHeight = cellHeight + 'px';\n this.textarea.style.zIndex = '-5';\n }\n\n /**\n * Initialize default behavior\n */\n private _initGlobal(): void {\n this._bindKeys();\n\n // Bind clipboard functionality\n this._register(addDisposableListener(this.element!, 'copy', (event: ClipboardEvent) => {\n // If mouse events are active it means the selection manager is disabled and\n // copy should be handled by the host program.\n if (!this.hasSelection()) {\n return;\n }\n copyHandler(event, this._selectionService!);\n }));\n const pasteHandlerWrapper = (event: ClipboardEvent): void => handlePasteEvent(event, this.textarea!, this.coreService, this.optionsService);\n this._register(addDisposableListener(this.textarea!, 'paste', pasteHandlerWrapper));\n this._register(addDisposableListener(this.element!, 'paste', pasteHandlerWrapper));\n\n // Handle right click context menus\n if (Browser.isFirefox) {\n // Firefox doesn't appear to fire the contextmenu event on right click\n this._register(addDisposableListener(this.element!, 'mousedown', (event: MouseEvent) => {\n if (event.button === 2) {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }\n }));\n } else {\n this._register(addDisposableListener(this.element!, 'contextmenu', (event: MouseEvent) => {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }));\n }\n\n // Move the textarea under the cursor when middle clicking on Linux to ensure\n // middle click to paste selection works. This only appears to work in Chrome\n // at the time is writing.\n if (Browser.isLinux) {\n // Use auxclick event over mousedown the latter doesn't seem to work. Note\n // that the regular click event doesn't fire for the middle mouse button.\n this._register(addDisposableListener(this.element!, 'auxclick', (event: MouseEvent) => {\n if (event.button === 1) {\n moveTextAreaUnderMouseCursor(event, this.textarea!, this.screenElement!);\n }\n }));\n }\n }\n\n /**\n * Apply key handling to the terminal\n */\n private _bindKeys(): void {\n this._register(addDisposableListener(this.textarea!, 'keyup', (ev: KeyboardEvent) => this._keyUp(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));\n this._register(addDisposableListener(this.textarea!, 'compositionstart', () => this._compositionHelper!.compositionstart()));\n this._register(addDisposableListener(this.textarea!, 'compositionupdate', (e: CompositionEvent) => this._compositionHelper!.compositionupdate(e)));\n this._register(addDisposableListener(this.textarea!, 'compositionend', () => this._compositionHelper!.compositionend()));\n this._register(addDisposableListener(this.textarea!, 'input', (ev: InputEvent) => this._inputEvent(ev), true));\n this._register(this.onRender(() => this._compositionHelper!.updateCompositionElements()));\n }\n\n /**\n * Opens the terminal within an element.\n *\n * @param parent The element to create the terminal within.\n */\n public open(parent: HTMLElement): void {\n if (!parent) {\n throw new Error('Terminal requires a parent element.');\n }\n\n if (!parent.isConnected) {\n this._logService.debug('Terminal.open was called on an element that was not attached to the DOM');\n }\n\n // If the terminal is already opened\n if (this.element?.ownerDocument.defaultView && this._coreBrowserService) {\n // Adjust the window if needed\n if (this.element.ownerDocument.defaultView !== this._coreBrowserService.window) {\n this._coreBrowserService.window = this.element.ownerDocument.defaultView;\n }\n return;\n }\n\n this._document = parent.ownerDocument;\n if (this.options.documentOverride && this.options.documentOverride instanceof Document) {\n this._document = this.optionsService.rawOptions.documentOverride as Document;\n }\n\n // Create main element container\n this.element = this._document.createElement('div');\n this.element.dir = 'ltr'; // xterm.css assumes LTR\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n parent.appendChild(this.element);\n\n // Performance: Use a document fragment to build the terminal\n // viewport and helper elements detached from the DOM\n const fragment = this._document.createDocumentFragment();\n this._viewportElement = this._document.createElement('div');\n this._viewportElement.classList.add('xterm-viewport');\n fragment.appendChild(this._viewportElement);\n\n this.screenElement = this._document.createElement('div');\n this.screenElement.classList.add('xterm-screen');\n this._register(addDisposableListener(this.screenElement, 'mousemove', (ev: MouseEvent) => this.updateCursorStyle(ev)));\n // Create the container that will hold helpers like the textarea for\n // capturing DOM Events. Then produce the helpers.\n this._helperContainer = this._document.createElement('div');\n this._helperContainer.classList.add('xterm-helpers');\n this.screenElement.appendChild(this._helperContainer);\n fragment.appendChild(this.screenElement);\n\n this.textarea = this._document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\n this.textarea.setAttribute('aria-label', Strings.promptLabel.get());\n if (!Browser.isChromeOS) {\n // ChromeVox on ChromeOS does not like this. See\n // https://issuetracker.google.com/issues/260170397\n this.textarea.setAttribute('aria-multiline', 'false');\n }\n this.textarea.setAttribute('autocorrect', 'off');\n this.textarea.setAttribute('autocapitalize', 'off');\n this.textarea.setAttribute('spellcheck', 'false');\n this.textarea.tabIndex = 0;\n\n // Register the core browser service before the generic textarea handlers are registered so it\n // handles them first. Otherwise the renderers may use the wrong focus state.\n this._coreBrowserService = this._register(this._instantiationService.createInstance(CoreBrowserService,\n this.textarea,\n parent.ownerDocument.defaultView ?? window,\n // Force unsafe null in node.js environment for tests\n this._document ?? (typeof window !== 'undefined') ? window.document : null as any\n ));\n this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);\n\n this._register(addDisposableListener(this.textarea, 'focus', (ev: FocusEvent) => this._handleTextAreaFocus(ev)));\n this._register(addDisposableListener(this.textarea, 'blur', () => this._handleTextAreaBlur()));\n this._helperContainer.appendChild(this.textarea);\n\n this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);\n this._instantiationService.setService(ICharSizeService, this._charSizeService);\n\n this._themeService = this._instantiationService.createInstance(ThemeService);\n this._instantiationService.setService(IThemeService, this._themeService);\n\n this._characterJoinerService = this._instantiationService.createInstance(CharacterJoinerService);\n this._instantiationService.setService(ICharacterJoinerService, this._characterJoinerService);\n\n this._renderService = this._register(this._instantiationService.createInstance(RenderService, this.rows, this.screenElement));\n this._instantiationService.setService(IRenderService, this._renderService);\n this._register(this._renderService.onRenderedViewportChange(e => this._onRender.fire(e)));\n this.onResize(e => this._renderService!.resize(e.cols, e.rows));\n\n this._compositionView = this._document.createElement('div');\n this._compositionView.classList.add('composition-view');\n this._compositionHelper = this._instantiationService.createInstance(CompositionHelper, this.textarea, this._compositionView);\n this._helperContainer.appendChild(this._compositionView);\n\n this._mouseService = this._instantiationService.createInstance(MouseService);\n this._instantiationService.setService(IMouseService, this._mouseService);\n\n const linkifier = this._linkifier.value = this._register(this._instantiationService.createInstance(Linkifier, this.screenElement));\n\n // Performance: Add viewport and helper elements from the fragment\n this.element.appendChild(fragment);\n\n try {\n this._onWillOpen.fire(this.element);\n }\n catch { /* fails to load addon for some reason */ }\n if (!this._renderService.hasRenderer()) {\n this._renderService.setRenderer(this._createRenderer());\n }\n\n this._register(this.onCursorMove(() => {\n this._renderService!.handleCursorMove();\n this._syncTextArea();\n }));\n this._register(this.onResize(() => this._renderService!.handleResize(this.cols, this.rows)));\n this._register(this.onBlur(() => this._renderService!.handleBlur()));\n this._register(this.onFocus(() => this._renderService!.handleFocus()));\n\n this._viewport = this._register(this._instantiationService.createInstance(Viewport, this.element, this.screenElement));\n this._register(this._viewport.onRequestScrollLines(e => {\n super.scrollLines(e, false);\n this.refresh(0, this.rows - 1);\n }));\n\n this._selectionService = this._register(this._instantiationService.createInstance(SelectionService,\n this.element,\n this.screenElement,\n linkifier\n ));\n this._instantiationService.setService(ISelectionService, this._selectionService);\n this._register(this._selectionService.onRequestScrollLines(e => this.scrollLines(e.amount, e.suppressScrollEvent)));\n this._register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire()));\n this._register(this._selectionService.onRequestRedraw(e => this._renderService!.handleSelectionChanged(e.start, e.end, e.columnSelectMode)));\n this._register(this._selectionService.onLinuxMouseSelection(text => {\n // If there's a new selection, put it into the textarea, focus and select it\n // in order to register it as a selection on the OS. This event is fired\n // only on Linux to enable middle click to paste selection.\n this.textarea!.value = text;\n this.textarea!.focus();\n this.textarea!.select();\n }));\n this._register(this._onScroll.event(() => this._selectionService!.refresh()));\n\n this._register(this._instantiationService.createInstance(BufferDecorationRenderer, this.screenElement));\n this._register(addDisposableListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.handleMouseDown(e)));\n\n // apply mouse event classes set by escape codes before terminal was attached\n if (this.coreMouseService.areMouseEventsActive) {\n this._selectionService.disable();\n this.element.classList.add('enable-mouse-events');\n } else {\n this._selectionService.enable();\n }\n\n if (this.options.screenReaderMode) {\n // Note that this must be done *after* the renderer is created in order to\n // ensure the correct order of the dprchange event\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n this._register(this.optionsService.onSpecificOptionChange('screenReaderMode', e => this._handleScreenReaderModeOptionChange(e)));\n\n if (this.options.overviewRuler.width) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n this.optionsService.onSpecificOptionChange('overviewRuler', value => {\n if (!this._overviewRulerRenderer && value && this._viewportElement && this.screenElement) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n });\n // Measure the character size\n this._charSizeService.measure();\n\n // Setup loop that draws to screen\n this.refresh(0, this.rows - 1);\n\n // Initialize global actions that need to be taken on the document.\n this._initGlobal();\n\n // Listen for mouse events and translate\n // them into terminal mouse protocols.\n this.bindMouse();\n }\n\n private _createRenderer(): IRenderer {\n return this._instantiationService.createInstance(DomRenderer, this, this._document!, this.element!, this.screenElement!, this._viewportElement!, this._helperContainer!, this.linkifier!);\n }\n\n /**\n * Bind certain mouse events to the terminal.\n * By default only 3 button + wheel up/down is ativated. For higher buttons\n * no mouse report will be created. Typically the standard actions will be active.\n *\n * There are several reasons not to enable support for higher buttons/wheel:\n * - Button 4 and 5 are typically used for history back and forward navigation,\n * there is no straight forward way to supress/intercept those standard actions.\n * - Support for higher buttons does not work in some platform/browser combinations.\n * - Left/right wheel was not tested.\n * - Emulators vary in mouse button support, typically only 3 buttons and\n * wheel up/down work reliable.\n *\n * TODO: Move mouse event code into its own file.\n */\n public bindMouse(): void {\n const self = this;\n const el = this.element!;\n\n // send event to CoreMouseService\n function sendEvent(ev: MouseEvent | WheelEvent): boolean {\n // get mouse coordinates\n const pos = self._mouseService!.getMouseReportCoords(ev, self.screenElement!);\n if (!pos) {\n return false;\n }\n\n let but: CoreMouseButton;\n let action: CoreMouseAction | undefined;\n switch ((ev as any).overrideType || ev.type) {\n case 'mousemove':\n action = CoreMouseAction.MOVE;\n if (ev.buttons === undefined) {\n // buttons is not supported on macOS, try to get a value from button instead\n but = CoreMouseButton.NONE;\n if (ev.button !== undefined) {\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n }\n } else {\n // according to MDN buttons only reports up to button 5 (AUX2)\n but = ev.buttons & 1 ? CoreMouseButton.LEFT :\n ev.buttons & 4 ? CoreMouseButton.MIDDLE :\n ev.buttons & 2 ? CoreMouseButton.RIGHT :\n CoreMouseButton.NONE; // fallback to NONE\n }\n break;\n case 'mouseup':\n action = CoreMouseAction.UP;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'mousedown':\n action = CoreMouseAction.DOWN;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'wheel':\n if (self._customWheelEventHandler && self._customWheelEventHandler(ev as WheelEvent) === false) {\n return false;\n }\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n action = deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN;\n but = CoreMouseButton.WHEEL;\n break;\n default:\n // dont handle other event types by accident\n return false;\n }\n\n // exit if we cannot determine valid button/action values\n // do nothing for higher buttons than wheel\n if (action === undefined || but === undefined || but > CoreMouseButton.WHEEL) {\n return false;\n }\n\n return self.coreMouseService.triggerMouseEvent({\n col: pos.col,\n row: pos.row,\n x: pos.x,\n y: pos.y,\n button: but,\n action,\n ctrl: ev.ctrlKey,\n alt: ev.altKey,\n shift: ev.shiftKey\n });\n }\n\n /**\n * Event listener state handling.\n * We listen to the onProtocolChange event of CoreMouseService and put\n * requested listeners in `requestedEvents`. With this the listeners\n * have all bits to do the event listener juggling.\n * Note: 'mousedown' currently is \"always on\" and not managed\n * by onProtocolChange.\n */\n const requestedEvents: { [key: string]: ((ev: MouseEvent | WheelEvent) => void) | null } = {\n mouseup: null,\n wheel: null,\n mousedrag: null,\n mousemove: null\n };\n const eventListeners: { [key: string]: (ev: any) => void | boolean } = {\n mouseup: (ev: MouseEvent) => {\n sendEvent(ev);\n if (!ev.buttons) {\n // if no other button is held remove global handlers\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }\n return this.cancel(ev);\n },\n wheel: (ev: WheelEvent) => {\n sendEvent(ev);\n return this.cancel(ev, true);\n },\n mousedrag: (ev: MouseEvent) => {\n // deal only with move while a button is held\n if (ev.buttons) {\n sendEvent(ev);\n }\n },\n mousemove: (ev: MouseEvent) => {\n // deal only with move without any button\n if (!ev.buttons) {\n sendEvent(ev);\n }\n }\n };\n this._register(this.coreMouseService.onProtocolChange(events => {\n // apply global changes on events\n if (events) {\n if (this.optionsService.rawOptions.logLevel === 'debug') {\n this._logService.debug('Binding to mouse events:', this.coreMouseService.explainEvents(events));\n }\n this.element!.classList.add('enable-mouse-events');\n this._selectionService!.disable();\n } else {\n this._logService.debug('Unbinding from mouse events.');\n this.element!.classList.remove('enable-mouse-events');\n this._selectionService!.enable();\n }\n\n // add/remove handlers from requestedEvents\n\n if (!(events & CoreMouseEventType.MOVE)) {\n el.removeEventListener('mousemove', requestedEvents.mousemove!);\n requestedEvents.mousemove = null;\n } else if (!requestedEvents.mousemove) {\n el.addEventListener('mousemove', eventListeners.mousemove);\n requestedEvents.mousemove = eventListeners.mousemove;\n }\n\n if (!(events & CoreMouseEventType.WHEEL)) {\n el.removeEventListener('wheel', requestedEvents.wheel!);\n requestedEvents.wheel = null;\n } else if (!requestedEvents.wheel) {\n el.addEventListener('wheel', eventListeners.wheel, { passive: false });\n requestedEvents.wheel = eventListeners.wheel;\n }\n\n if (!(events & CoreMouseEventType.UP)) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n requestedEvents.mouseup = null;\n } else if (!requestedEvents.mouseup) {\n requestedEvents.mouseup = eventListeners.mouseup;\n }\n\n if (!(events & CoreMouseEventType.DRAG)) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag!);\n requestedEvents.mousedrag = null;\n } else if (!requestedEvents.mousedrag) {\n requestedEvents.mousedrag = eventListeners.mousedrag;\n }\n }));\n // force initial onProtocolChange so we dont miss early mouse requests\n this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol;\n\n /**\n * \"Always on\" event listeners.\n */\n this._register(addDisposableListener(el, 'mousedown', (ev: MouseEvent) => {\n ev.preventDefault();\n this.focus();\n\n // Don't send the mouse button to the pty if mouse events are disabled or\n // if the selection manager is having selection forced (ie. a modifier is\n // held).\n if (!this.coreMouseService.areMouseEventsActive || this._selectionService!.shouldForceSelection(ev)) {\n return;\n }\n\n sendEvent(ev);\n\n // Register additional global handlers which should keep reporting outside\n // of the terminal element.\n // Note: Other emulators also do this for 'mousedown' while a button\n // is held, we currently limit 'mousedown' to the terminal only.\n if (requestedEvents.mouseup) {\n this._document!.addEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.addEventListener('mousemove', requestedEvents.mousedrag);\n }\n\n return this.cancel(ev);\n }));\n\n this._register(addDisposableListener(el, 'wheel', (ev: WheelEvent) => {\n // do nothing, if app side handles wheel itself\n if (requestedEvents.wheel) return;\n\n if (this._customWheelEventHandler && this._customWheelEventHandler(ev) === false) {\n return false;\n }\n\n if (!this.buffer.hasScrollback) {\n // Convert wheel events into up/down events when the buffer does not have scrollback, this\n // enables scrolling in apps hosted in the alt buffer such as vim or tmux even when mouse\n // events are not enabled.\n // This used implementation used get the actual lines/partial lines scrolled from the\n // viewport but since moving to the new viewport implementation has been simplified to\n // simply send a single up or down sequence.\n\n // Do nothing if there's no vertical scroll\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n\n // Construct and send sequences\n const sequence = C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? 'O' : '[') + (ev.deltaY < 0 ? 'A' : 'B');\n this.coreService.triggerDataEvent(sequence, true);\n return this.cancel(ev, true);\n }\n }, { passive: false }));\n }\n\n\n /**\n * Tells the renderer to refresh terminal content between two rows (inclusive) at the next\n * opportunity.\n * @param start The row to start from (between 0 and this.rows - 1).\n * @param end The row to end at (between start and this.rows - 1).\n */\n public refresh(start: number, end: number): void {\n this._renderService?.refreshRows(start, end);\n }\n\n /**\n * Change the cursor style for different selection modes\n */\n public updateCursorStyle(ev: KeyboardEvent | MouseEvent): void {\n if (this._selectionService?.shouldColumnSelect(ev)) {\n this.element!.classList.add('column-select');\n } else {\n this.element!.classList.remove('column-select');\n }\n }\n\n /**\n * Display the cursor element\n */\n private _showCursor(): void {\n if (!this.coreService.isCursorInitialized) {\n this.coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }\n\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n // All scrollLines methods need to go via the viewport in order to support smooth scroll\n if (this._viewport) {\n this._viewport.scrollLines(disp);\n } else {\n super.scrollLines(disp, suppressScrollEvent);\n }\n this.refresh(0, this.rows - 1);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll && this._viewport) {\n this._viewport.scrollToLine(this.buffer.ybase, true);\n } else {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n public paste(data: string): void {\n paste(data, this.textarea!, this.coreService, this.optionsService);\n }\n\n public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {\n this._customKeyEventHandler = customKeyEventHandler;\n }\n\n public attachCustomWheelEventHandler(customWheelEventHandler: CustomWheelEventHandler): void {\n this._customWheelEventHandler = customWheelEventHandler;\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._linkProviderService.registerLinkProvider(linkProvider);\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n const joinerId = this._characterJoinerService.register(handler);\n this.refresh(0, this.rows - 1);\n return joinerId;\n }\n\n public deregisterCharacterJoiner(joinerId: number): void {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n if (this._characterJoinerService.deregister(joinerId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n\n public get markers(): IMarker[] {\n return this.buffer.markers;\n }\n\n public registerMarker(cursorYOffset: number): IMarker {\n return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);\n }\n\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n return this._decorationService.registerDecoration(decorationOptions);\n }\n\n /**\n * Gets whether the terminal has an active selection.\n */\n public hasSelection(): boolean {\n return this._selectionService ? this._selectionService.hasSelection : false;\n }\n\n /**\n * Selects text within the terminal.\n * @param column The column the selection starts at..\n * @param row The row the selection starts at.\n * @param length The length of the selection.\n */\n public select(column: number, row: number, length: number): void {\n this._selectionService!.setSelection(column, row, length);\n }\n\n /**\n * Gets the terminal's current selection, this is useful for implementing copy\n * behavior outside of xterm.js.\n */\n public getSelection(): string {\n return this._selectionService ? this._selectionService.selectionText : '';\n }\n\n public getSelectionPosition(): IBufferRange | undefined {\n if (!this._selectionService || !this._selectionService.hasSelection) {\n return undefined;\n }\n\n return {\n start: {\n x: this._selectionService.selectionStart![0],\n y: this._selectionService.selectionStart![1]\n },\n end: {\n x: this._selectionService.selectionEnd![0],\n y: this._selectionService.selectionEnd![1]\n }\n };\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._selectionService?.clearSelection();\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._selectionService?.selectAll();\n }\n\n public selectLines(start: number, end: number): void {\n this._selectionService?.selectLines(start, end);\n }\n\n /**\n * Handle a keydown [KeyboardEvent].\n *\n * [KeyboardEvent]: https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n */\n protected _keyDown(event: KeyboardEvent): boolean | undefined {\n this._keyDownHandled = false;\n this._keyDownSeen = true;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {\n return false;\n }\n\n // Ignore composing with Alt key on Mac when macOptionIsMeta is enabled\n const shouldIgnoreComposition = this.browser.isMac && this.options.macOptionIsMeta && event.altKey;\n\n if (!shouldIgnoreComposition && !this._compositionHelper!.keydown(event)) {\n if (this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp) {\n this.scrollToBottom(true);\n }\n return false;\n }\n\n if (!shouldIgnoreComposition && (event.key === 'Dead' || event.key === 'AltGraph')) {\n this._unprocessedDeadKey = true;\n }\n\n const result = evaluateKeyboardEvent(event, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);\n\n this.updateCursorStyle(event);\n\n if (result.type === KeyboardResultType.PAGE_DOWN || result.type === KeyboardResultType.PAGE_UP) {\n const scrollCount = this.rows - 1;\n this.scrollLines(result.type === KeyboardResultType.PAGE_UP ? -scrollCount : scrollCount);\n return this.cancel(event, true);\n }\n\n if (result.type === KeyboardResultType.SELECT_ALL) {\n this.selectAll();\n }\n\n if (this._isThirdLevelShift(this.browser, event)) {\n return true;\n }\n\n if (result.cancel) {\n // The event is canceled at the end already, is this necessary?\n this.cancel(event, true);\n }\n\n if (!result.key) {\n return true;\n }\n\n // HACK: Process A-Z in the keypress event to fix an issue with macOS IMEs where lower case\n // letters cannot be input while caps lock is on.\n if (event.key && !event.ctrlKey && !event.altKey && !event.metaKey && event.key.length === 1) {\n if (event.key.charCodeAt(0) >= 65 && event.key.charCodeAt(0) <= 90) {\n return true;\n }\n }\n\n if (this._unprocessedDeadKey) {\n this._unprocessedDeadKey = false;\n return true;\n }\n\n // If ctrl+c or enter is being sent, clear out the textarea. This is done so that screen readers\n // will announce deleted characters. This will not work 100% of the time but it should cover\n // most scenarios.\n if (result.key === C0.ETX || result.key === C0.CR) {\n this.textarea!.value = '';\n }\n\n this._onKey.fire({ key: result.key, domEvent: event });\n this._showCursor();\n this.coreService.triggerDataEvent(result.key, true);\n\n // Cancel events when not in screen reader mode so events don't get bubbled up and handled by\n // other listeners. When screen reader mode is enabled, we don't cancel them (unless ctrl or alt\n // is also depressed) so that the cursor textarea can be updated, which triggers the screen\n // reader to read it.\n if (!this.optionsService.rawOptions.screenReaderMode || event.altKey || event.ctrlKey) {\n return this.cancel(event, true);\n }\n\n this._keyDownHandled = true;\n }\n\n private _isThirdLevelShift(browser: IBrowser, ev: KeyboardEvent): boolean {\n const thirdLevelKey =\n (browser.isMac && !this.options.macOptionIsMeta && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.altKey && ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.getModifierState('AltGraph'));\n\n if (ev.type === 'keypress') {\n return thirdLevelKey;\n }\n\n // Don't invoke for arrows, pageDown, home, backspace, etc. (on non-keypress events)\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n }\n\n protected _keyUp(ev: KeyboardEvent): void {\n this._keyDownSeen = false;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return;\n }\n\n if (!wasModifierKeyOnlyEvent(ev)) {\n this.focus();\n }\n\n this.updateCursorStyle(ev);\n this._keyPressHandled = false;\n }\n\n /**\n * Handle a keypress event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n * @param ev The keypress event to be handled.\n */\n protected _keyPress(ev: KeyboardEvent): boolean {\n let key;\n\n this._keyPressHandled = false;\n\n if (this._keyDownHandled) {\n return false;\n }\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return false;\n }\n\n this.cancel(ev);\n\n if (ev.charCode) {\n key = ev.charCode;\n } else if (ev.which === null || ev.which === undefined) {\n key = ev.keyCode;\n } else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n } else {\n return false;\n }\n\n if (!key || (\n (ev.altKey || ev.ctrlKey || ev.metaKey) && !this._isThirdLevelShift(this.browser, ev)\n )) {\n return false;\n }\n\n key = String.fromCharCode(key);\n\n this._onKey.fire({ key, domEvent: ev });\n this._showCursor();\n this.coreService.triggerDataEvent(key, true);\n\n this._keyPressHandled = true;\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n return true;\n }\n\n /**\n * Handle an input event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/Web/API/InputEvent\n * @param ev The input event to be handled.\n */\n protected _inputEvent(ev: InputEvent): boolean {\n // Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to\n // support reading out character input which can doubling up input characters\n // Based on these event traces: https://github.com/xtermjs/xterm.js/issues/3679\n if (ev.data && ev.inputType === 'insertText' && (!ev.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {\n if (this._keyPressHandled) {\n return false;\n }\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n const text = ev.data;\n this.coreService.triggerDataEvent(text, true);\n\n this.cancel(ev);\n return true;\n }\n\n return false;\n }\n\n /**\n * Resizes the terminal.\n *\n * @param x The number of columns to resize to.\n * @param y The number of rows to resize to.\n */\n public resize(x: number, y: number): void {\n if (x === this.cols && y === this.rows) {\n // Check if we still need to measure the char size (fixes #785).\n if (this._charSizeService && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n return;\n }\n\n super.resize(x, y);\n }\n\n private _afterResize(x: number, y: number): void {\n this._charSizeService?.measure();\n }\n\n /**\n * Clear the entire buffer, making the prompt line the new first line.\n */\n public clear(): void {\n if (this.buffer.ybase === 0 && this.buffer.y === 0) {\n // Don't clear if it's already clear\n return;\n }\n this.buffer.clearAllMarkers();\n this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);\n this.buffer.lines.length = 1;\n this.buffer.ydisp = 0;\n this.buffer.ybase = 0;\n this.buffer.y = 0;\n for (let i = 1; i < this.rows; i++) {\n this.buffer.lines.push(this.buffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n // IMPORTANT: Fire scroll event before viewport is reset. This ensures embedders get the clear\n // scroll event and that the viewport's state will be valid for immediate writes.\n this._onScroll.fire({ position: this.buffer.ydisp });\n this.refresh(0, this.rows - 1);\n }\n\n /**\n * Reset terminal.\n * Note: Calling this directly from JS is synchronous but does not clear\n * input buffers and does not reset the parser, thus the terminal will\n * continue to apply pending input data.\n * If you need in band reset (synchronous with input data) consider\n * using DECSTR (soft reset, CSI ! p) or RIS instead (hard reset, ESC c).\n */\n public reset(): void {\n /**\n * Since _setup handles a full terminal creation, we have to carry forward\n * a few things that should not reset.\n */\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n const customKeyEventHandler = this._customKeyEventHandler;\n\n this._setup();\n super.reset();\n this._selectionService?.reset();\n this._decorationService.reset();\n\n // reattach\n this._customKeyEventHandler = customKeyEventHandler;\n\n // do a full screen refresh\n this.refresh(0, this.rows - 1);\n }\n\n public clearTextureAtlas(): void {\n this._renderService?.clearTextureAtlas();\n }\n\n private _reportFocus(): void {\n if (this.element?.classList.contains('focus')) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n } else {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n }\n\n private _reportWindowsOptions(type: WindowsOptionsReportType): void {\n if (!this._renderService) {\n return;\n }\n\n switch (type) {\n case WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:\n const canvasWidth = this._renderService.dimensions.css.canvas.width.toFixed(0);\n const canvasHeight = this._renderService.dimensions.css.canvas.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[4;${canvasHeight};${canvasWidth}t`);\n break;\n case WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:\n const cellWidth = this._renderService.dimensions.css.cell.width.toFixed(0);\n const cellHeight = this._renderService.dimensions.css.cell.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[6;${cellHeight};${cellWidth}t`);\n break;\n }\n }\n\n // TODO: Remove cancel function and cancelEvents option\n public cancel(ev: MouseEvent | WheelEvent | KeyboardEvent | InputEvent, force?: boolean): boolean | undefined {\n if (!this.options.cancelEvents && !force) {\n return;\n }\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n}\n\n/**\n * Helpers\n */\n\nfunction wasModifierKeyOnlyEvent(ev: KeyboardEvent): boolean {\n return ev.keyCode === 16 || // Shift\n ev.keyCode === 17 || // Ctrl\n ev.keyCode === 18; // Alt\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminalAddon, IDisposable, Terminal } from '@xterm/xterm';\n\nexport interface ILoadedAddon {\n instance: ITerminalAddon;\n dispose: () => void;\n isDisposed: boolean;\n}\n\nexport class AddonManager implements IDisposable {\n protected _addons: ILoadedAddon[] = [];\n\n public dispose(): void {\n for (let i = this._addons.length - 1; i >= 0; i--) {\n this._addons[i].instance.dispose();\n }\n }\n\n public loadAddon(terminal: Terminal, instance: ITerminalAddon): void {\n const loadedAddon: ILoadedAddon = {\n instance,\n dispose: instance.dispose,\n isDisposed: false\n };\n this._addons.push(loadedAddon);\n instance.dispose = () => this._wrappedAddonDispose(loadedAddon);\n instance.activate(terminal as any);\n }\n\n private _wrappedAddonDispose(loadedAddon: ILoadedAddon): void {\n if (loadedAddon.isDisposed) {\n // Do nothing if already disposed\n return;\n }\n let index = -1;\n for (let i = 0; i < this._addons.length; i++) {\n if (this._addons[i] === loadedAddon) {\n index = i;\n break;\n }\n }\n if (index === -1) {\n throw new Error('Could not dispose an addon that has not been loaded');\n }\n loadedAddon.isDisposed = true;\n loadedAddon.dispose.apply(loadedAddon.instance);\n this._addons.splice(index, 1);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferLine, ICellData } from 'common/Types';\nimport { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';\n\nexport class BufferLineApiView implements IBufferLineApi {\n constructor(private _line: IBufferLine) { }\n\n public get isWrapped(): boolean { return this._line.isWrapped; }\n public get length(): number { return this._line.length; }\n public getCell(x: number, cell?: IBufferCellApi): IBufferCellApi | undefined {\n if (x < 0 || x >= this._line.length) {\n return undefined;\n }\n\n if (cell) {\n this._line.loadCell(x, cell as ICellData);\n return cell;\n }\n return this._line.loadCell(x, new CellData());\n }\n public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {\n return this._line.translateToString(trimRight, startColumn, endColumn);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';\nimport { IBuffer } from 'common/buffer/Types';\nimport { BufferLineApiView } from 'common/public/BufferLineApiView';\nimport { CellData } from 'common/buffer/CellData';\n\nexport class BufferApiView implements IBufferApi {\n constructor(\n private _buffer: IBuffer,\n public readonly type: 'normal' | 'alternate'\n ) { }\n\n public init(buffer: IBuffer): BufferApiView {\n this._buffer = buffer;\n return this;\n }\n\n public get cursorY(): number { return this._buffer.y; }\n public get cursorX(): number { return this._buffer.x; }\n public get viewportY(): number { return this._buffer.ydisp; }\n public get baseY(): number { return this._buffer.ybase; }\n public get length(): number { return this._buffer.lines.length; }\n public getLine(y: number): IBufferLineApi | undefined {\n const line = this._buffer.lines.get(y);\n if (!line) {\n return undefined;\n }\n return new BufferLineApiView(line);\n }\n public getNullCell(): IBufferCellApi { return new CellData(); }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';\nimport { BufferApiView } from 'common/public/BufferApiView';\nimport { ICoreTerminal } from 'common/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { Emitter } from 'vs/base/common/event';\n\nexport class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {\n private _normal: BufferApiView;\n private _alternate: BufferApiView;\n\n private readonly _onBufferChange = this._register(new Emitter());\n public readonly onBufferChange = this._onBufferChange.event;\n\n constructor(private _core: ICoreTerminal) {\n super();\n this._normal = new BufferApiView(this._core.buffers.normal, 'normal');\n this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');\n this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));\n }\n public get active(): IBufferApi {\n if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }\n if (this._core.buffers.active === this._core.buffers.alt) { return this.alternate; }\n throw new Error('Active buffer is neither normal nor alternate');\n }\n public get normal(): IBufferApi {\n return this._normal.init(this._core.buffers.normal);\n }\n public get alternate(): IBufferApi {\n return this._alternate.init(this._core.buffers.alt);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParams } from 'common/parser/Types';\nimport { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class ParserApi implements IParser {\n constructor(private _core: ICoreTerminal) { }\n\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n }\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerCsiHandler(id, callback);\n }\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerDcsHandler(id, (data: string, params: IParams) => callback(data, params.toArray()));\n }\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerDcsHandler(id, callback);\n }\n public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this._core.registerEscHandler(id, handler);\n }\n public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this.registerEscHandler(id, handler);\n }\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerOscHandler(ident, callback);\n }\n public addOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this.registerOscHandler(ident, callback);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreTerminal } from 'common/Types';\nimport { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';\n\nexport class UnicodeApi implements IUnicodeHandling {\n constructor(private _core: ICoreTerminal) { }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._core.unicodeService.register(provider);\n }\n\n public get versions(): string[] {\n return this._core.unicodeService.versions;\n }\n\n public get activeVersion(): string {\n return this._core.unicodeService.activeVersion;\n }\n\n public set activeVersion(version: string) {\n this._core.unicodeService.activeVersion = version;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';\nimport { IBufferRange, ITerminal } from 'browser/Types';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { ITerminalOptions } from 'common/Types';\nimport { AddonManager } from 'common/public/AddonManager';\nimport { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';\nimport { ParserApi } from 'common/public/ParserApi';\nimport { UnicodeApi } from 'common/public/UnicodeApi';\nimport { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';\nimport type { Event } from 'vs/base/common/event';\n\n/**\n * The set of options that only have an effect when set in the Terminal constructor.\n */\nconst CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];\n\nlet $value = 0;\n\nexport class Terminal extends Disposable implements ITerminalApi {\n private _core: ITerminal;\n private _addonManager: AddonManager;\n private _parser: IParser | undefined;\n private _buffer: BufferNamespaceApi | undefined;\n private _publicOptions: Required;\n\n constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions) {\n super();\n\n this._core = this._register(new TerminalCore(options));\n this._addonManager = this._register(new AddonManager());\n\n this._publicOptions = { ... this._core.options };\n const getter = (propName: string): any => {\n return this._core.options[propName];\n };\n const setter = (propName: string, value: any): void => {\n this._checkReadonlyOptions(propName);\n this._core.options[propName] = value;\n };\n\n for (const propName in this._core.options) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this._publicOptions, propName, desc);\n }\n }\n\n private _checkReadonlyOptions(propName: string): void {\n // Throw an error if any constructor only option is modified\n // from terminal.options\n // Modifications from anywhere else are allowed\n if (CONSTRUCTOR_ONLY_OPTIONS.includes(propName)) {\n throw new Error(`Option \"${propName}\" can only be set in the constructor`);\n }\n }\n\n private _checkProposedApi(): void {\n if (!this._core.optionsService.rawOptions.allowProposedApi) {\n throw new Error('You must set the allowProposedApi option to true to use proposed API');\n }\n }\n\n public get onBell(): Event { return this._core.onBell; }\n public get onBinary(): Event { return this._core.onBinary; }\n public get onCursorMove(): Event { return this._core.onCursorMove; }\n public get onData(): Event { return this._core.onData; }\n public get onKey(): Event<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n public get onLineFeed(): Event { return this._core.onLineFeed; }\n public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }\n public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }\n public get onScroll(): Event { return this._core.onScroll; }\n public get onSelectionChange(): Event { return this._core.onSelectionChange; }\n public get onTitleChange(): Event { return this._core.onTitleChange; }\n public get onWriteParsed(): Event { return this._core.onWriteParsed; }\n\n public get element(): HTMLElement | undefined { return this._core.element; }\n public get parser(): IParser {\n if (!this._parser) {\n this._parser = new ParserApi(this._core);\n }\n return this._parser;\n }\n public get unicode(): IUnicodeHandling {\n this._checkProposedApi();\n return new UnicodeApi(this._core);\n }\n public get textarea(): HTMLTextAreaElement | undefined { return this._core.textarea; }\n public get rows(): number { return this._core.rows; }\n public get cols(): number { return this._core.cols; }\n public get buffer(): IBufferNamespaceApi {\n if (!this._buffer) {\n this._buffer = this._register(new BufferNamespaceApi(this._core));\n }\n return this._buffer;\n }\n public get markers(): ReadonlyArray {\n this._checkProposedApi();\n return this._core.markers;\n }\n public get modes(): IModes {\n const m = this._core.coreService.decPrivateModes;\n let mouseTrackingMode: 'none' | 'x10' | 'vt200' | 'drag' | 'any' = 'none';\n switch (this._core.coreMouseService.activeProtocol) {\n case 'X10': mouseTrackingMode = 'x10'; break;\n case 'VT200': mouseTrackingMode = 'vt200'; break;\n case 'DRAG': mouseTrackingMode = 'drag'; break;\n case 'ANY': mouseTrackingMode = 'any'; break;\n }\n return {\n applicationCursorKeysMode: m.applicationCursorKeys,\n applicationKeypadMode: m.applicationKeypad,\n bracketedPasteMode: m.bracketedPasteMode,\n insertMode: this._core.coreService.modes.insertMode,\n mouseTrackingMode: mouseTrackingMode,\n originMode: m.origin,\n reverseWraparoundMode: m.reverseWraparound,\n sendFocusMode: m.sendFocus,\n wraparoundMode: m.wraparound\n };\n }\n public get options(): Required {\n return this._publicOptions;\n }\n public set options(options: ITerminalOptions) {\n for (const propName in options) {\n this._publicOptions[propName] = options[propName];\n }\n }\n public blur(): void {\n this._core.blur();\n }\n public focus(): void {\n this._core.focus();\n }\n public input(data: string, wasUserInput: boolean = true): void {\n this._core.input(data, wasUserInput);\n }\n public resize(columns: number, rows: number): void {\n this._verifyIntegers(columns, rows);\n this._core.resize(columns, rows);\n }\n public open(parent: HTMLElement): void {\n this._core.open(parent);\n }\n public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {\n this._core.attachCustomKeyEventHandler(customKeyEventHandler);\n }\n public attachCustomWheelEventHandler(customWheelEventHandler: (event: WheelEvent) => boolean): void {\n this._core.attachCustomWheelEventHandler(customWheelEventHandler);\n }\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._core.registerLinkProvider(linkProvider);\n }\n public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {\n this._checkProposedApi();\n return this._core.registerCharacterJoiner(handler);\n }\n public deregisterCharacterJoiner(joinerId: number): void {\n this._checkProposedApi();\n this._core.deregisterCharacterJoiner(joinerId);\n }\n public registerMarker(cursorYOffset: number = 0): IMarker {\n this._verifyIntegers(cursorYOffset);\n return this._core.registerMarker(cursorYOffset);\n }\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n this._checkProposedApi();\n this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0);\n return this._core.registerDecoration(decorationOptions);\n }\n public hasSelection(): boolean {\n return this._core.hasSelection();\n }\n public select(column: number, row: number, length: number): void {\n this._verifyIntegers(column, row, length);\n this._core.select(column, row, length);\n }\n public getSelection(): string {\n return this._core.getSelection();\n }\n public getSelectionPosition(): IBufferRange | undefined {\n return this._core.getSelectionPosition();\n }\n public clearSelection(): void {\n this._core.clearSelection();\n }\n public selectAll(): void {\n this._core.selectAll();\n }\n public selectLines(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.selectLines(start, end);\n }\n public dispose(): void {\n super.dispose();\n }\n public scrollLines(amount: number): void {\n this._verifyIntegers(amount);\n this._core.scrollLines(amount);\n }\n public scrollPages(pageCount: number): void {\n this._verifyIntegers(pageCount);\n this._core.scrollPages(pageCount);\n }\n public scrollToTop(): void {\n this._core.scrollToTop();\n }\n public scrollToBottom(): void {\n this._core.scrollToBottom();\n }\n public scrollToLine(line: number): void {\n this._verifyIntegers(line);\n this._core.scrollToLine(line);\n }\n public clear(): void {\n this._core.clear();\n }\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data, callback);\n }\n public writeln(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data);\n this._core.write('\\r\\n', callback);\n }\n public paste(data: string): void {\n this._core.paste(data);\n }\n public refresh(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.refresh(start, end);\n }\n public reset(): void {\n this._core.reset();\n }\n public clearTextureAtlas(): void {\n this._core.clearTextureAtlas();\n }\n public loadAddon(addon: ITerminalAddon): void {\n this._addonManager.loadAddon(this, addon);\n }\n public static get strings(): ILocalizableStrings {\n // A wrapper is required here because esbuild prevents setting an `export let`\n return {\n get promptLabel(): string { return Strings.promptLabel.get(); },\n set promptLabel(value: string) { Strings.promptLabel.set(value); },\n get tooMuchOutput(): string { return Strings.tooMuchOutput.get(); },\n set tooMuchOutput(value: string) { Strings.tooMuchOutput.set(value); }\n };\n }\n\n private _verifyIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value === Infinity || isNaN($value) || $value % 1 !== 0) {\n throw new Error('This API only accepts integers');\n }\n }\n }\n\n private _verifyPositiveIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value && ($value === Infinity || isNaN($value) || $value % 1 !== 0 || $value < 0)) {\n throw new Error('This API only accepts positive integers');\n }\n }\n }\n}\n"], + "mappings": ";;;;;;;;;;;;;;;;qSAOA,IAAIA,GAAsB,iBACpBC,GAAc,CAClB,IAAK,IAAMD,GACX,IAAME,GAAkBF,GAAsBE,CAChD,EAEIC,GAAwB,iEACtBC,GAAgB,CACpB,IAA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GAAY,IAAI,CAAG,EAC9D,IAAI,YAAY7B,EAAe,CAAU6B,GAAY,IAAI7B,CAAK,CAAG,EACjE,IAAI,eAAwB,CAAE,OAAe8B,GAAc,IAAI,CAAG,EAClE,IAAI,cAAc9B,EAAe,CAAU8B,GAAc,IAAI9B,CAAK,CAAG,CACvE,CACF,CAEQ,mBAAmB+B,EAAwB,CACjD,IAAKxC,MAAUwC,EACb,GAAIxC,KAAW,KAAY,MAAMA,EAAM,GAAKA,GAAS,IAAM,EACzD,MAAM,IAAI,MAAM,gCAAgC,CAGtD,CAEQ,2BAA2BwC,EAAwB,CACzD,IAAKxC,MAAUwC,EACb,GAAIxC,KAAWA,KAAW,KAAY,MAAMA,EAAM,GAAKA,GAAS,IAAM,GAAKA,GAAS,GAClF,MAAM,IAAI,MAAM,yCAAyC,CAG/D,CACF", + "names": ["promptLabelInternal", "promptLabel", "value", "tooMuchOutputInternal", "tooMuchOutput", "prepareTextForTerminal", "text", "bracketTextForPaste", "bracketedPasteMode", "copyHandler", "ev", "selectionService", "handlePasteEvent", "textarea", "coreService", "optionsService", "paste", "moveTextAreaUnderMouseCursor", "screenElement", "pos", "left", "top", "rightClickHandler", "shouldSelectWord", "stringFromCodePoint", "codePoint", "utf32ToString", "data", "start", "end", "result", "i", "codepoint", "StringToUtf32", "input", "target", "length", "size", "startPos", "second", "code", "Utf8ToUtf32", "byte1", "byte2", "byte3", "byte4", "discardInterim", "cp", "pos", "tmp", "type", "missing", "fourStop", "NULL_CELL_CHAR", "WHITESPACE_CELL_CHAR", "AttributeData", "_AttributeData", "ExtendedAttrs", "value", "newObj", "_ExtendedAttrs", "ext", "urlId", "val", "CellData", "_CellData", "AttributeData", "ExtendedAttrs", "value", "obj", "stringFromCodePoint", "combined", "code", "second", "DI_TARGET", "DI_DEPENDENCIES", "serviceRegistry", "getServiceDependencies", "ctor", "createDecorator", "id", "decorator", "target", "key", "index", "storeServiceDependency", "IBufferService", "createDecorator", "ICoreMouseService", "ICoreService", "ICharsetService", "IInstantiationService", "ILogService", "createDecorator", "IOptionsService", "IOscLinkService", "IUnicodeService", "IDecorationService", "OscLinkProvider", "_bufferService", "_optionsService", "_oscLinkService", "y", "callback", "line", "result", "linkHandler", "cell", "CellData", "lineLength", "currentLinkId", "currentStart", "finishLink", "x", "text", "range", "ignoreLink", "parsed", "e", "defaultActivate", "__decorateClass", "__decorateParam", "IBufferService", "IOptionsService", "IOscLinkService", "uri", "newWindow", "ICharSizeService", "createDecorator", "ICoreBrowserService", "IMouseService", "IRenderService", "ISelectionService", "ICharacterJoinerService", "IThemeService", "ILinkProviderService", "ErrorHandler", "e", "ErrorNoTelemetry", "listener", "newUnexpectedErrorHandler", "errorHandler", "onUnexpectedError", "e", "isCancellationError", "errorHandler", "canceledName", "isCancellationError", "error", "CancellationError", "illegalArgument", "name", "ErrorNoTelemetry", "_ErrorNoTelemetry", "msg", "err", "result", "BugIndicatingError", "_BugIndicatingError", "message", "findLastIdxMonotonous", "array", "predicate", "startIdx", "endIdxEx", "i", "j", "k", "_MonotonousArray", "_array", "predicate", "item", "idx", "findLastIdxMonotonous", "MonotonousArray", "tail", "array", "n", "CompareResult", "isLessThan", "result", "isLessThanOrEqual", "isGreaterThan", "isNeitherLessOrGreaterThan", "compareBy", "selector", "comparator", "a", "b", "numberComparator", "a", "b", "_CallbackIterable", "iterate", "handler", "item", "result", "predicate", "cb", "mapFn", "comparator", "first", "CompareResult", "_callback", "CallbackIterable", "groupBy", "data", "groupFn", "result", "element", "key", "target", "_a", "_b", "SetWithKey", "values", "toKey", "value", "key", "entry", "callbackfn", "thisArg", "SetMap", "key", "value", "values", "fn", "createSingleCallFunction", "fn", "fnDidRunCallback", "_this", "didCall", "result", "Iterable", "is", "thing", "_empty", "empty", "single", "element", "wrap", "iterableOrElement", "from", "iterable", "reverse", "array", "i", "isEmpty", "first", "some", "predicate", "find", "filter", "map", "fn", "index", "flatMap", "concat", "iterables", "reduce", "reducer", "initialValue", "value", "slice", "arr", "to", "consume", "atMost", "consumed", "iterator", "next", "asyncToArray", "result", "item", "TRACK_DISPOSABLES", "disposableTracker", "_DisposableTracker", "d", "val", "data", "child", "parent", "x", "disposable", "cache", "cacheValue", "result", "rootParentCache", "v", "k", "maxReported", "preComputedLeaks", "uncoveredLeakingObjs", "leakingObjects", "info", "leakingObjsSet", "o", "l", "getStackTracePath", "leaking", "removePrefix", "array", "linesToRemove", "regexp", "lines", "p", "stackTraceStarts", "SetMap", "stackTracePath", "i", "compareBy", "numberComparator", "message", "stackTraceFormattedLines", "line", "prevStarts", "continuations", "groupBy", "cont", "set", "DisposableTracker", "setDisposableTracker", "tracker", "__is_disposable_tracked__", "stack", "Disposable", "trackDisposable", "markAsDisposed", "setParentOfDisposable", "setParentOfDisposables", "children", "markAsSingleton", "singleton", "dispose", "arg", "Iterable", "errors", "d", "e", "combinedDisposable", "disposables", "parent", "toDisposable", "dispose", "setParentOfDisposables", "fn", "self", "trackDisposable", "createSingleCallFunction", "markAsDisposed", "_DisposableStore", "o", "setParentOfDisposable", "DisposableStore", "Disposable", "MutableDisposable", "value", "oldValue", "mainWindow", "_Node", "element", "Node", "LinkedList", "node", "next", "atTheEnd", "newNode", "oldLast", "oldFirst", "didRemove", "res", "anchor", "hasPerformanceNow", "StopWatch", "_StopWatch", "highResolution", "_enableListenerGCedWarning", "_enableDisposeWithListenerWarning", "_enableSnapshotPotentialLeakWarning", "Event", "Disposable", "_addLeakageTraceLogic", "options", "origListenerDidAdd", "stack", "Stacktrace", "count", "defer", "event", "disposable", "debounce", "once", "listener", "thisArgs", "disposables", "didFire", "result", "e", "map", "snapshot", "i", "forEach", "each", "filter", "signal", "any", "events", "combinedDisposable", "addAndReturnDisposable", "reduce", "merge", "initial", "output", "emitter", "Emitter", "d", "store", "delay", "leading", "flushOnListenerRemove", "leakWarningThreshold", "subscription", "handle", "numDebouncedCalls", "doFire", "cur", "_output", "accumulate", "last", "latch", "equals", "a", "b", "firstCall", "cache", "value", "shouldEmit", "split", "isT", "buffer", "flushAfterTimeout", "_buffer", "flush", "chain", "sythensize", "cs", "ChainableSynthesis", "HaltChainable", "fn", "v", "step", "fromNodeEventEmitter", "eventName", "id", "args", "onFirstListenerAdd", "onLastListenerRemove", "fromDOMEventEmitter", "toPromise", "resolve", "fromPromise", "promise", "res", "forward", "from", "to", "runAndSubscribe", "handler", "EmitterObserver", "_observable", "_change", "fromObservable", "obs", "fromObservableLight", "observable", "didChange", "observer", "DisposableStore", "_EventProfiling", "name", "listenerCount", "StopWatch", "elapsed", "EventProfiling", "_globalLeakWarningThreshold", "_LeakageMonitor", "_errorHandler", "threshold", "name", "stack", "listenerCount", "count", "topStack", "topCount", "message", "error", "ListenerLeakError", "LeakageMonitor", "Stacktrace", "_Stacktrace", "value", "err", "ListenerRefusalError", "id", "UniqueContainer", "compactionThreshold", "forEachListener", "listeners", "fn", "i", "l", "_listenerFinalizers", "_enableListenerGCedWarning", "leaks", "heldValue", "Emitter", "options", "_globalLeakWarningThreshold", "onUnexpectedError", "EventProfiling", "_enableDisposeWithListenerWarning", "callback", "thisArgs", "disposables", "tuple", "Disposable", "contained", "removeMonitor", "EventDeliveryQueuePrivate", "result", "toDisposable", "DisposableStore", "match", "listener", "index", "adjustDeliveryQueue", "errorHandler", "e", "dq", "event", "EventDeliveryQueuePrivate", "emitter", "value", "end", "_WindowManager", "Emitter", "targetWindow", "zoomLevel", "targetWindowId", "zoomFactor", "fullscreen", "windowId", "WindowManager", "addMatchMediaChangeListener", "query", "callback", "onDidChangeZoomLevel", "WindowManager", "getZoomFactor", "targetWindow", "onDidChangeFullscreen", "WindowManager", "userAgent", "isFirefox", "isWebKit", "isChrome", "isSafari", "isElectron", "userAgent", "isAndroid", "standalone", "mainWindow", "standaloneMatchMedia", "fullScreenMatchMedia", "addMatchMediaChangeListener", "matches", "isStandalone", "LANGUAGE_DEFAULT", "_isWindows", "_isMacintosh", "_isLinux", "_isLinuxSnap", "_isNative", "_isWeb", "_isElectron", "_isIOS", "_isCI", "_isMobile", "_locale", "_language", "_platformLocale", "_translationsConfigFile", "_userAgent", "$globalThis", "nodeProcess", "isElectronProcess", "isElectronRenderer", "rawNlsConfig", "nlsConfig", "_platform", "_isMacintosh", "_isWindows", "_isLinux", "isWindows", "isMacintosh", "isLinux", "isNative", "_isNative", "isWebWorker", "_isWeb", "$globalThis", "webWorkerOrigin", "userAgent", "_userAgent", "language", "_language", "Language", "value", "isDefaultVariant", "isDefault", "setTimeout0IsFaster", "$globalThis", "setTimeout0", "pending", "len", "candidate", "lastId", "callback", "myId", "isChrome", "userAgent", "isFirefox", "isSafari", "isEdge", "isAndroid", "safeNavigator", "BrowserFeatures", "isNative", "isStandalone", "isSafari", "mainWindow", "KeyCodeStrMap", "keyCode", "str", "uiMap", "userSettingsUSMap", "userSettingsGeneralMap", "EVENT_KEY_CODE_MAP", "KeyCodeUtils", "toString", "keyCode", "uiMap", "fromString", "key", "toUserSettingsUS", "userSettingsUSMap", "toUserSettingsGeneral", "userSettingsGeneralMap", "fromUserSettings", "toElectronAccelerator", "KeyCodeChord", "_KeyCodeChord", "ctrlKey", "shiftKey", "altKey", "metaKey", "keyCode", "other", "ctrl", "shift", "alt", "meta", "Keybinding", "Keybinding", "chords", "illegalArgument", "result", "i", "len", "other", "extractKeyCode", "e", "char", "KeyCodeUtils", "keyCode", "isFirefox", "isLinux", "isMacintosh", "isWebKit", "EVENT_KEY_CODE_MAP", "ctrlKeyMod", "altKeyMod", "shiftKeyMod", "metaKeyMod", "StandardKeyboardEvent", "source", "extractKeyCode", "other", "key", "result", "ctrlKeyMod", "altKeyMod", "shiftKeyMod", "metaKeyMod", "KeyCodeChord", "sameOriginWindowChainCache", "getParentWindowIfSameOrigin", "w", "location", "parentLocation", "IframeUtils", "targetWindow", "windowChainCache", "parent", "childWindow", "ancestorWindow", "top", "left", "windowChain", "windowChainEl", "windowInChain", "boundingRect", "StandardMouseEvent", "targetWindow", "iframeOffsets", "IframeUtils", "StandardWheelEvent", "e", "deltaX", "deltaY", "shouldFactorDPR", "isChrome", "chromeVersionMatch", "e1", "e2", "devicePixelRatio", "ev", "isFirefox", "isMacintosh", "isSafari", "isWindows", "shortcutEvent", "callback", "context", "handle", "CancellationToken", "isCancellationToken", "thing", "MutableToken", "Event", "Emitter", "MicrotaskDelay", "TimeoutTimer", "runner", "timeout", "BugIndicatingError", "IntervalTimer", "interval", "context", "handle", "toDisposable", "runWhenGlobalIdle", "_runWhenIdle", "_targetWindow", "runner", "setTimeout0", "disposed", "end", "targetWindow", "timeout", "handle", "Promises", "settled", "promises", "firstError", "result", "promise", "value", "error", "withAsyncBody", "bodyFn", "resolve", "reject", "_AsyncIterableObject", "items", "writer", "promise", "emitter", "promises", "p", "iterables", "iterable", "item", "executor", "onReturn", "Emitter", "error", "err", "i", "Event", "mapFn", "filterFn", "result", "value", "values", "AsyncIterableObject", "isHighSurrogate", "charCode", "isLowSurrogate", "computeCodePoint", "highSurrogate", "lowSurrogate", "hash", "obj", "doHash", "hashVal", "numberHash", "arrayHash", "objectHash", "stringHash", "booleanHash", "val", "initialHashVal", "b", "i", "length", "arr", "item", "key", "leftRotate", "value", "bits", "totalBits", "delta", "mask", "fill", "dest", "index", "count", "i", "leftPad", "length", "char", "toHexString", "bufferOrValue", "bitsize", "b", "_StringSHA1", "str", "strLen", "buff", "buffLen", "leftoverHighSurrogate", "charCode", "offset", "codePoint", "isHighSurrogate", "nextCharCode", "isLowSurrogate", "computeCodePoint", "ml", "bigBlock32", "data", "j", "a", "c", "d", "e", "f", "k", "temp", "StringSHA1", "registerWindow", "getWindow", "getDocument", "getWindows", "getWindowsCount", "getWindowId", "getWindowById", "hasWindow", "onDidRegisterWindow", "onWillUnregisterWindow", "onDidUnregisterWindow", "windows", "mainWindow", "mainWindowRegistration", "DisposableStore", "Emitter", "windowId", "fallbackToMain", "window", "Disposable", "disposables", "registeredWindow", "toDisposable", "addDisposableListener", "EventType", "targetWindow", "e", "candidateNode", "candidateEvent", "DomListener", "node", "type", "handler", "options", "addDisposableListener", "useCaptureOrOptions", "_wrapAsStandardMouseEvent", "targetWindow", "StandardMouseEvent", "_wrapAsStandardKeyboardEvent", "e", "StandardKeyboardEvent", "addStandardDisposableListener", "useCapture", "wrapHandler", "getWindow", "runAtThisOrScheduleAtNextAnimationFrame", "scheduleAtNextAnimationFrame", "WindowIntervalTimer", "IntervalTimer", "node", "getWindow", "runner", "interval", "targetWindow", "AnimationFrameQueueItem", "priority", "e", "onUnexpectedError", "a", "b", "NEXT_QUEUE", "CURRENT_QUEUE", "animFrameRequested", "inAnimationFrameRunner", "animationFrameRunner", "targetWindowId", "currentQueue", "scheduleAtNextAnimationFrame", "getWindowId", "item", "nextQueue", "runAtThisOrScheduleAtNextAnimationFrame", "_Dimension", "width", "height", "obj", "a", "b", "Dimension", "getDomNodePagePosition", "domNode", "bb", "window", "getWindow", "sharedMutationObserver", "target", "disposables", "options", "mutationObserversPerTarget", "optionsHash", "hash", "mutationObserverPerOptions", "onDidMutate", "Emitter", "observer", "mutations", "resolvedMutationObserverPerOptions", "toDisposable", "EventType", "isWebKit", "SELECTOR_REGEX", "_$", "namespace", "description", "attrs", "children", "match", "SELECTOR_REGEX", "tagName", "result", "name", "value", "$", "FastDomNode", "domNode", "_maxWidth", "maxWidth", "numberAsPixels", "_width", "width", "_height", "height", "_top", "top", "_left", "left", "_bottom", "bottom", "_right", "right", "_paddingTop", "paddingTop", "_paddingLeft", "paddingLeft", "_paddingBottom", "paddingBottom", "_paddingRight", "paddingRight", "fontFamily", "fontWeight", "_fontSize", "fontSize", "fontStyle", "fontFeatureSettings", "fontVariationSettings", "textDecoration", "_lineHeight", "lineHeight", "_letterSpacing", "letterSpacing", "className", "shouldHaveIt", "display", "position", "visibility", "color", "backgroundColor", "layerHint", "boxShadow", "contain", "name", "value", "child", "createFastDomNode", "GlobalPointerMoveMonitor", "DisposableStore", "invokeStopCallback", "browserEvent", "onStopCallback", "initialElement", "pointerId", "initialButtons", "pointerMoveCallback", "eventSource", "toDisposable", "getWindow", "addDisposableListener", "EventType", "e", "memoize", "_target", "key", "descriptor", "fnKey", "fn", "memoizeKey", "args", "EventType", "_Gesture", "Disposable", "LinkedList", "Event", "onDidRegisterWindow", "window", "disposables", "addDisposableListener", "e", "mainWindow", "element", "markAsSingleton", "remove", "toDisposable", "timestamp", "i", "len", "touch", "evt", "targetWindow", "activeTouchCount", "data", "holdTime", "tail", "finalX", "finalY", "deltaT", "deltaX", "deltaY", "dispatchTo", "t", "type", "initialTarget", "event", "currentTime", "setTapCount", "ignoreTarget", "targets", "target", "depth", "now", "a", "b", "_", "t1", "vX", "dirX", "x", "vY", "dirY", "y", "scheduleAtNextAnimationFrame", "delta_pos_x", "delta_pos_y", "stopped", "d", "__decorateClass", "memoize", "Gesture", "Widget", "Disposable", "domNode", "listener", "addDisposableListener", "EventType", "e", "StandardMouseEvent", "getWindow", "StandardKeyboardEvent", "Gesture", "ARROW_IMG_SIZE", "ScrollbarArrow", "Widget", "opts", "GlobalPointerMoveMonitor", "addStandardDisposableListener", "EventType", "WindowIntervalTimer", "TimeoutTimer", "e", "scheduleRepeater", "getWindow", "pointerMoveData", "ScrollState", "_ScrollState", "_forceIntegerValues", "width", "scrollWidth", "scrollLeft", "height", "scrollHeight", "scrollTop", "other", "update", "useRawScrollPositions", "previous", "inSmoothScrolling", "widthChanged", "scrollWidthChanged", "scrollLeftChanged", "heightChanged", "scrollHeightChanged", "scrollTopChanged", "Scrollable", "Disposable", "options", "Emitter", "smoothScrollDuration", "scrollPosition", "dimensions", "newState", "reuseAnimation", "validTarget", "newSmoothScrolling", "SmoothScrollingOperation", "oldState", "SmoothScrollingUpdate", "isDone", "createEaseOutCubic", "from", "to", "delta", "completion", "easeOutCubic", "createComposed", "a", "b", "cut", "_SmoothScrollingOperation", "startTime", "duration", "viewportSize", "stop1", "stop2", "state", "now", "newScrollLeft", "newScrollTop", "easeInCubic", "t", "ScrollbarVisibilityController", "Disposable", "visibility", "visibleClassName", "invisibleClassName", "TimeoutTimer", "rawShouldBeVisible", "shouldBeVisible", "isNeeded", "domNode", "withFadeAway", "POINTER_DRAG_RESET_DISTANCE", "AbstractScrollbar", "Widget", "opts", "ScrollbarVisibilityController", "GlobalPointerMoveMonitor", "createFastDomNode", "addDisposableListener", "EventType", "arrow", "ScrollbarArrow", "top", "left", "width", "height", "e", "visibleSize", "elementScrollSize", "elementScrollPosition", "domTop", "sliderStart", "sliderStop", "pointerPos", "offsetX", "offsetY", "domNodePosition", "getDomNodePagePosition", "offset", "initialPointerPosition", "initialPointerOrthogonalPosition", "initialScrollbarState", "pointerMoveData", "pointerOrthogonalPosition", "pointerOrthogonalDelta", "isWindows", "pointerDelta", "_desiredScrollPosition", "desiredScrollPosition", "scrollbarSize", "ScrollbarState", "_ScrollbarState", "arrowSize", "scrollbarSize", "oppositeScrollbarSize", "visibleSize", "scrollSize", "scrollPosition", "iVisibleSize", "iScrollSize", "iScrollPosition", "computedAvailableSize", "computedRepresentableSize", "computedIsNeeded", "computedSliderSize", "computedSliderRatio", "computedSliderPosition", "r", "offset", "desiredSliderPosition", "correctedOffset", "desiredScrollPosition", "delta", "HorizontalScrollbar", "AbstractScrollbar", "scrollable", "options", "host", "scrollDimensions", "scrollPosition", "ScrollbarState", "sliderSize", "sliderPosition", "largeSize", "smallSize", "e", "offsetX", "offsetY", "size", "target", "VerticalScrollbar", "AbstractScrollbar", "scrollable", "options", "host", "scrollDimensions", "scrollPosition", "ScrollbarState", "sliderSize", "sliderPosition", "largeSize", "smallSize", "e", "offsetX", "offsetY", "size", "target", "HIDE_TIMEOUT", "SCROLL_WHEEL_SENSITIVITY", "SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED", "MouseWheelClassifierItem", "timestamp", "deltaX", "deltaY", "_MouseWheelClassifier", "remainingInfluence", "score", "iteration", "index", "influence", "e", "isChrome", "targetWindow", "getWindow", "pageZoomFactor", "getZoomFactor", "previousItem", "item", "absDeltaX", "absDeltaY", "absPreviousDeltaX", "absPreviousDeltaY", "minDeltaX", "minDeltaY", "maxDeltaX", "maxDeltaY", "value", "MouseWheelClassifier", "AbstractScrollableElement", "Widget", "element", "options", "scrollable", "Emitter", "resolveOptions", "scrollbarHost", "mouseWheelEvent", "VerticalScrollbar", "HorizontalScrollbar", "createFastDomNode", "TimeoutTimer", "dispose", "browserEvent", "dimensions", "newClassName", "isMacintosh", "newOptions", "StandardWheelEvent", "shouldListen", "onMouseWheel", "addDisposableListener", "EventType", "classifier", "didScroll", "shiftConvert", "futureScrollPosition", "desiredScrollPosition", "deltaScrollTop", "desiredScrollTop", "deltaScrollLeft", "desiredScrollLeft", "consumeMouseWheel", "scrollState", "enableTop", "enableLeft", "leftClassName", "topClassName", "topLeftClassName", "SmoothScrollableElement", "AbstractScrollableElement", "element", "options", "scrollable", "update", "resolveOptions", "opts", "result", "isMacintosh", "Viewport", "Disposable", "element", "screenElement", "_bufferService", "coreBrowserService", "coreMouseService", "themeService", "_optionsService", "_renderService", "Emitter", "scrollable", "Scrollable", "cb", "scheduleAtNextAnimationFrame", "SmoothScrollableElement", "type", "Event", "toDisposable", "e", "disp", "pos", "line", "disableSmoothScroll", "ydisp", "newRow", "diff", "__decorateClass", "__decorateParam", "IBufferService", "ICoreBrowserService", "ICoreMouseService", "IThemeService", "IOptionsService", "IRenderService", "BufferDecorationRenderer", "Disposable", "_screenElement", "_bufferService", "_coreBrowserService", "_decorationService", "_renderService", "decoration", "toDisposable", "element", "x", "line", "__decorateClass", "__decorateParam", "IBufferService", "ICoreBrowserService", "IDecorationService", "IRenderService", "ColorZoneStore", "decoration", "z", "padding", "zone", "line", "position", "drawHeight", "drawWidth", "drawX", "OverviewRulerRenderer", "Disposable", "_viewportElement", "_screenElement", "_bufferService", "_decorationService", "_renderService", "_optionsService", "_themeService", "_coreBrowserService", "ColorZoneStore", "toDisposable", "ctx", "outerWidth", "innerWidth", "pixelsPerLine", "nonFullHeight", "decoration", "zones", "zone", "updateCanvasDimensions", "updateAnchor", "__decorateClass", "__decorateParam", "IBufferService", "IDecorationService", "IRenderService", "IOptionsService", "IThemeService", "ICoreBrowserService", "C0", "C1", "C1_ESCAPED", "CompositionHelper", "_textarea", "_compositionView", "_bufferService", "_optionsService", "_coreService", "_renderService", "ev", "waitForPropagation", "currentCompositionPosition", "input", "oldValue", "newValue", "diff", "C0", "dontRecurse", "cursorX", "cellHeight", "cursorTop", "cursorLeft", "compositionViewBounds", "__decorateClass", "__decorateParam", "IBufferService", "IOptionsService", "ICoreService", "IRenderService", "Platform_exports", "__export", "getSafariVersion", "isChromeOS", "isFirefox", "isIpad", "isIphone", "isLegacyEdge", "isLinux", "isMac", "isNode", "isSafari", "isWindows", "userAgent", "platform", "majorVersion", "INVERTED_DEFAULT_COLOR", "$r", "$g", "$b", "$a", "NULL_COLOR", "channels", "toCss", "g", "b", "a", "toPaddedHex", "toRgba", "toColor", "color", "blend", "bg", "fg", "fgR", "fgG", "fgB", "bgR", "bgG", "bgB", "css", "rgba", "isOpaque", "ensureContrastRatio", "ratio", "result", "opaque", "rgbaColor", "opacity", "multiplyOpacity", "factor", "toColorRGB", "$ctx", "$litmusColor", "canvas", "ctx", "rgbaMatch", "rgb", "relativeLuminance", "relativeLuminance2", "r", "rs", "gs", "bs", "rr", "rg", "rb", "bgRgba", "fgRgba", "bgL", "fgL", "contrastRatio", "resultA", "reduceLuminance", "resultARatio", "resultB", "increaseLuminance", "resultBRatio", "cr", "toChannels", "value", "c", "s", "l1", "l2", "JoinedCellData", "AttributeData", "firstCell", "chars", "width", "value", "CharacterJoinerService", "_bufferService", "CellData", "handler", "joiner", "joinerId", "i", "row", "line", "ranges", "lineStr", "rangeStartColumn", "currentStringIndex", "rangeStartStringIndex", "rangeAttrFG", "rangeAttrBG", "x", "joinedRanges", "WHITESPACE_CELL_CHAR", "startIndex", "endIndex", "lineData", "startCol", "text", "allJoinedRanges", "error", "joinerRanges", "j", "currentRangeIndex", "currentRangeStarted", "currentRange", "length", "newRange", "inRange", "range", "__decorateClass", "__decorateParam", "IBufferService", "isPowerlineGlyph", "codepoint", "isBoxOrBlockGlyph", "codepoint", "treatGlyphAsBackgroundColor", "codepoint", "isPowerlineGlyph", "isBoxOrBlockGlyph", "createRenderDimensions", "createDimension", "DomRendererRowFactory", "_document", "_characterJoinerService", "_optionsService", "_coreBrowserService", "_coreService", "_decorationService", "_themeService", "CellData", "start", "end", "columnSelectMode", "lineData", "row", "isCursorRow", "cursorStyle", "cursorInactiveStyle", "cursorX", "cursorBlink", "cellWidth", "widthCache", "linkStart", "linkEnd", "elements", "joinedRanges", "colors", "lineLength", "charElement", "cellAmount", "text", "oldBg", "oldFg", "oldExt", "oldLinkHover", "oldSpacing", "oldIsInSelection", "spacing", "classes", "hasHover", "x", "width", "isJoined", "lastCharX", "cell", "range", "JoinedCellData", "isInSelection", "isCursorCell", "isLinkHover", "isDecorated", "d", "chars", "WHITESPACE_CELL_CHAR", "AttributeData", "fg", "fgColorMode", "bg", "bgColorMode", "isInverse", "temp", "temp2", "bgOverride", "fgOverride", "isTop", "resolvedBg", "channels", "padStart", "INVERTED_DEFAULT_COLOR", "color", "element", "treatGlyphAsBackgroundColor", "cache", "adjustedColor", "ratio", "style", "y", "__decorateClass", "__decorateParam", "ICharacterJoinerService", "IOptionsService", "ICoreBrowserService", "ICoreService", "IDecorationService", "IThemeService", "padChar", "length", "WidthCache", "_document", "_helperContainer", "regular", "bold", "italic", "boldItalic", "font", "fontSize", "weight", "weightBold", "c", "cp", "width", "key", "variant", "el", "SelectionRenderModel", "terminal", "start", "end", "columnSelectMode", "viewportY", "viewportStartRow", "viewportEndRow", "viewportCappedStartRow", "viewportCappedEndRow", "x", "y", "createSelectionRenderModel", "TERMINAL_CLASS_PREFIX", "ROW_CONTAINER_CLASS", "FG_CLASS_PREFIX", "BG_CLASS_PREFIX", "FOCUS_CLASS", "SELECTION_CLASS", "nextTerminalId", "DomRenderer", "Disposable", "_terminal", "_document", "_element", "_screenElement", "_viewportElement", "_helperContainer", "_linkifier2", "instantiationService", "_charSizeService", "_optionsService", "_bufferService", "_coreBrowserService", "_themeService", "createSelectionRenderModel", "Emitter", "createRenderDimensions", "e", "DomRendererRowFactory", "toDisposable", "WidthCache", "dpr", "element", "styles", "colors", "color", "blinkAnimationUnderlineId", "blinkAnimationBarId", "blinkAnimationBlockId", "i", "c", "INVERTED_DEFAULT_COLOR", "spacing", "cols", "rows", "row", "start", "end", "columnSelectMode", "viewportStartRow", "viewportEndRow", "viewportCappedStartRow", "viewportCappedEndRow", "documentFragment", "isXFlipped", "startCol", "endCol", "middleRowsCount", "colStart", "colEnd", "rowCount", "left", "width", "buffer", "cursorAbsoluteY", "cursorX", "cursorBlink", "cursorStyle", "cursorInactiveStyle", "y", "rowElement", "lineData", "x", "x2", "y2", "enabled", "maxY", "bufferline", "__decorateClass", "__decorateParam", "IInstantiationService", "ICharSizeService", "IOptionsService", "IBufferService", "ICoreBrowserService", "IThemeService", "CharSizeService", "Disposable", "document", "parentElement", "_optionsService", "Emitter", "TextMetricsMeasureStrategy", "DomMeasureStrategy", "result", "__decorateClass", "__decorateParam", "IOptionsService", "BaseMeasureStategy", "Disposable", "width", "height", "DomMeasureStrategy", "_document", "_parentElement", "_optionsService", "TextMetricsMeasureStrategy", "a", "metrics", "CoreBrowserService", "Disposable", "_textarea", "_window", "mainDocument", "ScreenDprMonitor", "Emitter", "w", "Event", "addDisposableListener", "value", "_parentWindow", "MutableDisposable", "toDisposable", "parentWindow", "LinkProviderService", "Disposable", "toDisposable", "linkProvider", "providerIndex", "getCoordsRelativeToElement", "window", "event", "element", "rect", "elementStyle", "leftPadding", "topPadding", "getCoords", "colCount", "rowCount", "hasValidCharSize", "cssCellWidth", "cssCellHeight", "isSelection", "coords", "MouseService", "_renderService", "_charSizeService", "event", "element", "colCount", "rowCount", "isSelection", "getCoords", "coords", "getCoordsRelativeToElement", "__decorateClass", "__decorateParam", "IRenderService", "ICharSizeService", "RenderDebouncer", "_renderCallback", "_coreBrowserService", "callback", "rowStart", "rowEnd", "rowCount", "start", "end", "TaskQueue", "task", "deadline", "taskDuration", "longestTask", "lastDeadlineRemaining", "deadlineRemaining", "PriorityTaskQueue", "callback", "identifier", "duration", "end", "IdleTaskQueueInternal", "IdleTaskQueue", "isNode", "DebouncedIdleTask", "RenderService", "Disposable", "_rowCount", "screenElement", "optionsService", "_charSizeService", "decorationService", "bufferService", "coreBrowserService", "themeService", "MutableDisposable", "DebouncedIdleTask", "Emitter", "RenderDebouncer", "start", "end", "w", "observer", "e", "toDisposable", "entry", "isRedrawOnly", "cols", "rows", "renderer", "callback", "columnSelectMode", "__decorateClass", "__decorateParam", "IOptionsService", "ICharSizeService", "IDecorationService", "IBufferService", "ICoreBrowserService", "IThemeService", "moveToCellSequence", "targetX", "targetY", "bufferService", "applicationCursor", "startX", "startY", "resetStartingRow", "moveToRequestedRow", "moveToRequestedCol", "direction", "repeat", "sequence", "rowDifference", "cellsToMove", "colsFromRowEnd", "colsFromRowBeginning", "currX", "bufferLine", "wrappedRowsForRow", "startRow", "endRow", "rowsToMove", "wrappedRowsCount", "verticalDirection", "horizontalDirection", "wrappedRows", "i", "currentRow", "rowCount", "line", "lineWraps", "startCol", "endCol", "forward", "currentCol", "bufferStr", "mod", "C0", "count", "str", "rpt", "SelectionModel", "_bufferService", "startPlusLength", "start", "end", "amount", "getRangeLength", "range", "bufferCols", "DRAG_SCROLL_MAX_THRESHOLD", "DRAG_SCROLL_MAX_SPEED", "DRAG_SCROLL_INTERVAL", "ALT_CLICK_MOVE_CURSOR_TIME", "NON_BREAKING_SPACE_CHAR", "ALL_NON_BREAKING_SPACE_REGEX", "SelectionService", "Disposable", "_element", "_screenElement", "_linkifier", "_bufferService", "_coreService", "_mouseService", "_optionsService", "_renderService", "_coreBrowserService", "CellData", "Emitter", "event", "amount", "e", "SelectionModel", "toDisposable", "start", "end", "buffer", "result", "startCol", "endCol", "i", "lineText", "startRowEndCol", "bufferLine", "line", "ALL_NON_BREAKING_SPACE_REGEX", "isWindows", "isLinuxMouseSelection", "isLinux", "coords", "x", "y", "allowWhitespaceOnlySelection", "range", "getRangeLength", "offset", "getCoordsRelativeToElement", "terminalHeight", "DRAG_SCROLL_MAX_THRESHOLD", "DRAG_SCROLL_MAX_SPEED", "isMac", "DRAG_SCROLL_INTERVAL", "previousSelectionEnd", "timeElapsed", "ALT_CLICK_MOVE_CURSOR_TIME", "coordinates", "sequence", "moveToCellSequence", "hasSelection", "charIndex", "length", "col", "row", "ev", "followWrappedLinesAbove", "followWrappedLinesBelow", "startIndex", "endIndex", "charOffset", "leftWideCharCount", "rightWideCharCount", "leftLongCharOffset", "rightLongCharOffset", "previousBufferLine", "previousLineWordPosition", "nextBufferLine", "nextLineWordPosition", "wordPosition", "endRow", "cell", "wrappedRange", "__decorateClass", "__decorateParam", "IBufferService", "ICoreService", "IMouseService", "IOptionsService", "IRenderService", "ICoreBrowserService", "TwoKeyMap", "first", "second", "value", "ColorContrastCache", "TwoKeyMap", "bg", "fg", "value", "DEFAULT_ANSI_COLORS", "colors", "css", "v", "i", "r", "g", "b", "channels", "c", "DEFAULT_FOREGROUND", "css", "DEFAULT_BACKGROUND", "DEFAULT_CURSOR", "DEFAULT_CURSOR_ACCENT", "DEFAULT_SELECTION", "DEFAULT_OVERVIEW_RULER_BORDER", "ThemeService", "Disposable", "_optionsService", "ColorContrastCache", "Emitter", "color", "DEFAULT_ANSI_COLORS", "theme", "colors", "parseColor", "NULL_COLOR", "colorCount", "i", "slot", "callback", "__decorateClass", "__decorateParam", "IOptionsService", "cssString", "fallback", "ServiceCollection", "entries", "id", "service", "instance", "result", "callback", "key", "value", "InstantiationService", "IInstantiationService", "ctor", "args", "serviceDependencies", "getServiceDependencies", "a", "b", "serviceArgs", "dependency", "firstServiceArgPos", "optionsKeyToLogLevel", "LOG_PREFIX", "LogService", "Disposable", "_optionsService", "traceLogger", "optionalParams", "type", "message", "__decorateClass", "__decorateParam", "IOptionsService", "CircularList", "Disposable", "_maxLength", "Emitter", "newMaxLength", "newArray", "i", "newLength", "index", "value", "start", "deleteCount", "items", "countToTrim", "count", "offset", "expandListBy", "CELL_SIZE", "DEFAULT_ATTR_DATA", "AttributeData", "$startIndex", "CLEANUP_THRESHOLD", "BufferLine", "_BufferLine", "cols", "fillCellData", "isWrapped", "CELL_SIZE", "cell", "CellData", "NULL_CELL_CHAR", "i", "index", "content", "cp", "stringFromCodePoint", "value", "codePoint", "width", "attrs", "pos", "n", "start", "end", "respectProtect", "uint32Cells", "data", "keys", "key", "extKeys", "line", "el", "newLine", "src", "srcCol", "destCol", "length", "applyInReverse", "srcData", "srcCombinedKeys", "trimRight", "startCol", "endCol", "outColumns", "result", "chars", "WHITESPACE_CELL_CHAR", "reflowLargerGetLinesToRemove", "lines", "oldCols", "newCols", "bufferAbsoluteY", "nullCell", "toRemove", "y", "i", "nextLine", "wrappedLines", "destLineIndex", "destCol", "getWrappedLineTrimmedLength", "srcLineIndex", "srcCol", "srcTrimmedTineLength", "srcRemainingCells", "destRemainingCells", "cellsToCopy", "countToRemove", "reflowLargerCreateNewLayout", "layout", "nextToRemoveIndex", "nextToRemoveStart", "countRemovedSoFar", "reflowLargerApplyNewLayout", "newLayout", "newLayoutLines", "reflowSmallerGetNewLineLengths", "newLineLengths", "cellsNeeded", "l", "p", "c", "srcLine", "cellsAvailable", "oldTrimmedLength", "endsWithWide", "lineLength", "cols", "endsInNull", "followingLineStartsWithWide", "_Marker", "line", "Emitter", "dispose", "disposable", "Marker", "CHARSETS", "DEFAULT_CHARSET", "MAX_BUFFER_SIZE", "Buffer", "_hasScrollback", "_optionsService", "_bufferService", "DEFAULT_ATTR_DATA", "DEFAULT_CHARSET", "CellData", "NULL_CELL_CHAR", "WHITESPACE_CELL_CHAR", "IdleTaskQueue", "CircularList", "attr", "ExtendedAttrs", "isWrapped", "BufferLine", "relativeY", "rows", "correctBufferLength", "fillAttr", "i", "newCols", "newRows", "nullCell", "dirtyMemoryLines", "newMaxLength", "addToY", "y", "amountToTrim", "normalRun", "counted", "windowsPty", "toRemove", "reflowLargerGetLinesToRemove", "newLayoutResult", "reflowLargerCreateNewLayout", "reflowLargerApplyNewLayout", "countRemoved", "viewportAdjustments", "toInsert", "countToInsert", "nextLine", "wrappedLines", "absoluteY", "lastLineLength", "destLineLengths", "reflowSmallerGetNewLineLengths", "linesToAdd", "trimmedLines", "newLines", "newLine", "destLineIndex", "destCol", "srcLineIndex", "srcCol", "cellsToCopy", "wrappedLinesIndex", "getWrappedLineTrimmedLength", "insertEvents", "originalLines", "originalLinesLength", "originalLineIndex", "nextToInsertIndex", "nextToInsert", "countInsertedSoFar", "nextI", "insertCountEmitted", "lineIndex", "trimRight", "startCol", "endCol", "line", "first", "last", "x", "marker", "Marker", "amount", "event", "BufferSet", "Disposable", "_optionsService", "_bufferService", "Emitter", "Buffer", "fillAttr", "newCols", "newRows", "i", "MINIMUM_COLS", "MINIMUM_ROWS", "BufferService", "Disposable", "optionsService", "Emitter", "BufferSet", "cols", "rows", "eraseAttr", "isWrapped", "buffer", "newLine", "topRow", "bottomRow", "willBufferBeTrimmed", "scrollRegionHeight", "disp", "suppressScrollEvent", "oldYdisp", "__decorateClass", "__decorateParam", "IOptionsService", "DEFAULT_OPTIONS", "isMac", "FONT_WEIGHT_OPTIONS", "OptionsService", "Disposable", "options", "Emitter", "defaultOptions", "key", "newValue", "e", "toDisposable", "listener", "eventKey", "keys", "getter", "propName", "setter", "value", "desc", "isCursorStyle", "clone", "val", "depth", "clonedObject", "key", "DEFAULT_MODES", "DEFAULT_DEC_PRIVATE_MODES", "CoreService", "Disposable", "_bufferService", "_logService", "_optionsService", "Emitter", "clone", "data", "wasUserInput", "buffer", "e", "__decorateClass", "__decorateParam", "IBufferService", "ILogService", "IOptionsService", "DEFAULT_PROTOCOLS", "e", "eventCode", "e", "isSGR", "code", "S", "DEFAULT_ENCODINGS", "params", "final", "CoreMouseService", "Disposable", "_bufferService", "_coreService", "Emitter", "name", "DEFAULT_PROTOCOLS", "protocol", "encoding", "report", "events", "e1", "e2", "pixels", "__decorateClass", "__decorateParam", "IBufferService", "ICoreService", "BMP_COMBINING", "HIGH_COMBINING", "table", "bisearch", "ucs", "data", "min", "max", "mid", "UnicodeV6", "r", "num", "codepoint", "preceding", "width", "shouldJoin", "oldWidth", "UnicodeService", "UnicodeService", "_UnicodeService", "Emitter", "defaultProvider", "UnicodeV6", "value", "state", "width", "shouldJoin", "version", "provider", "num", "s", "result", "precedingInfo", "length", "i", "code", "second", "currentInfo", "chWidth", "codepoint", "preceding", "CharsetService", "g", "charset", "updateWindowsModeWrappedState", "bufferService", "lastChar", "nextLine", "MAX_VALUE", "MAX_SUBPARAMS", "Params", "_Params", "maxLength", "maxSubParamsLength", "values", "params", "value", "k", "newParams", "res", "i", "start", "end", "idx", "result", "length", "store", "cur", "EMPTY_HANDLERS", "OscParser", "ident", "handler", "handlerList", "handlerIndex", "j", "data", "start", "end", "utf32ToString", "code", "success", "promiseResult", "handlerResult", "fallThrough", "OscHandler", "_handler", "ret", "res", "EMPTY_HANDLERS", "DcsParser", "ident", "handler", "handlerList", "handlerIndex", "j", "params", "data", "start", "end", "utf32ToString", "success", "promiseResult", "handlerResult", "fallThrough", "EMPTY_PARAMS", "Params", "DcsHandler", "_handler", "ret", "res", "TransitionTable", "length", "action", "next", "code", "state", "codes", "i", "NON_ASCII_PRINTABLE", "VT500_TRANSITION_TABLE", "table", "blueprint", "unused", "r", "start", "end", "PRINTABLES", "EXECUTABLES", "states", "EscapeSequenceParser", "Disposable", "_transitions", "Params", "data", "ident", "params", "toDisposable", "OscParser", "DcsParser", "id", "finalRange", "res", "intermediate", "finalCode", "handler", "handlerList", "handlerIndex", "flag", "callback", "handlers", "handlerPos", "transition", "chunkPos", "promiseResult", "handlerResult", "j", "handlersEsc", "jj", "RGB_REX", "HASH_REX", "parseColor", "data", "low", "m", "base", "adv", "result", "i", "c", "pad", "n", "bits", "s", "s2", "toRgbString", "color", "r", "g", "b", "GLEVEL", "MAX_PARSEBUFFER_LENGTH", "STACK_LIMIT", "paramToWindowOption", "n", "opts", "SLOW_ASYNC_LIMIT", "$temp", "InputHandler", "Disposable", "_bufferService", "_charsetService", "_coreService", "_logService", "_optionsService", "_oscLinkService", "_coreMouseService", "_unicodeService", "_parser", "EscapeSequenceParser", "StringToUtf32", "Utf8ToUtf32", "DEFAULT_ATTR_DATA", "Emitter", "DirtyRowTracker", "e", "ident", "params", "code", "identifier", "action", "data", "payload", "start", "end", "C0", "C1", "OscHandler", "flag", "CHARSETS", "state", "DcsHandler", "cursorStartX", "cursorStartY", "decodedLength", "position", "p", "res", "rej", "err", "promiseResult", "result", "wasPaused", "MAX_PARSEBUFFER_LENGTH", "i", "len", "viewportEnd", "viewportStart", "chWidth", "charset", "screenReaderMode", "cols", "wraparoundMode", "insertMode", "curAttr", "bufferRow", "precedingJoinState", "pos", "ch", "currentInfo", "UnicodeService", "shouldJoin", "oldWidth", "stringFromCodePoint", "oldRow", "oldCol", "BufferLine", "offset", "delta", "id", "callback", "paramToWindowOption", "line", "originalX", "maxCol", "x", "y", "diffToTop", "diffToBottom", "param", "clearWrap", "respectProtect", "j", "scrollBackSize", "row", "scrollBottomRowsOffset", "scrollBottomAbsolute", "joinState", "length", "text", "idata", "itext", "tlength", "term", "DEFAULT_CHARSET", "ansi", "V", "dm", "mouseProtocol", "mouseEncoding", "cs", "buffers", "active", "alt", "opts", "f", "m", "v", "b2v", "value", "color", "mode", "c1", "c2", "c3", "AttributeData", "attr", "accu", "cSpace", "advance", "subparams", "style", "l", "isBlinking", "top", "bottom", "second", "STACK_LIMIT", "event", "slots", "idx", "spec", "index", "isValidColorIndex", "parseColor", "uri", "parsedParams", "idParamIndex", "collectAndFlag", "GLEVEL", "scrollRegionHeight", "level", "cell", "CellData", "yOffset", "s", "b", "STYLES", "y1", "y2", "__decorateClass", "__decorateParam", "IBufferService", "DISCARD_WATERMARK", "WRITE_TIMEOUT_MS", "WRITE_BUFFER_LENGTH_THRESHOLD", "WriteBuffer", "Disposable", "_action", "Emitter", "data", "maxSubsequentCalls", "chunk", "cb", "callback", "lastTime", "promiseResult", "startTime", "result", "continuation", "r", "err", "OscLinkService", "_bufferService", "data", "buffer", "marker", "entry", "castData", "key", "match", "linkId", "y", "e", "linkData", "index", "__decorateClass", "__decorateParam", "IBufferService", "hasWriteSyncWarnHappened", "CoreTerminal", "Disposable", "options", "MutableDisposable", "Emitter", "InstantiationService", "OptionsService", "IOptionsService", "BufferService", "IBufferService", "LogService", "ILogService", "CoreService", "ICoreService", "CoreMouseService", "ICoreMouseService", "UnicodeService", "IUnicodeService", "CharsetService", "ICharsetService", "OscLinkService", "IOscLinkService", "InputHandler", "Event", "WriteBuffer", "data", "promiseResult", "ev", "key", "callback", "maxSubsequentCalls", "wasUserInput", "x", "y", "MINIMUM_COLS", "MINIMUM_ROWS", "eraseAttr", "isWrapped", "disp", "suppressScrollEvent", "pageCount", "disableSmoothScroll", "line", "scrollAmount", "id", "ident", "value", "windowsPty", "disposables", "updateWindowsModeWrappedState", "toDisposable", "d", "KEYCODE_KEY_MAPPINGS", "evaluateKeyboardEvent", "ev", "applicationCursorMode", "isMac", "macOptionIsMeta", "result", "modifiers", "C0", "key", "keyCode", "keyString", "i", "SortedList", "_getKey", "IdleTaskQueue", "value", "sortedAddedValues", "a", "b", "sortedAddedValuesIndex", "arrayIndex", "newArray", "newArrayIndex", "key", "sortedDeletedIndices", "sortedDeletedIndicesIndex", "callback", "min", "max", "mid", "midKey", "$xmin", "$xmax", "DecorationService", "Disposable", "SortedList", "Emitter", "toDisposable", "options", "decoration", "Decoration", "markerDispose", "listener", "d", "x", "line", "layer", "xmin", "xmax", "callback", "DisposableStore", "css", "RENDER_DEBOUNCE_THRESHOLD_MS", "TimeBasedDebouncer", "_renderCallback", "_debounceThresholdMS", "rowStart", "rowEnd", "rowCount", "refreshRequestTime", "elapsed", "waitPeriodBeforeTrailingRefresh", "start", "end", "MAX_ROWS_TO_READ", "DEBUG", "AccessibilityManager", "Disposable", "_terminal", "instantiationService", "_coreBrowserService", "_renderService", "doc", "i", "e", "TimeBasedDebouncer", "char", "spaceCount", "addDisposableListener", "toDisposable", "MAX_ROWS_TO_READ", "tooMuchOutput", "keyChar", "start", "end", "buffer", "setSize", "line", "columns", "lineData", "posInSet", "element", "position", "boundaryElement", "beforeBoundaryElement", "lastRowPos", "topBoundaryElement", "bottomBoundaryElement", "newElement", "selection", "begin", "lastRowElement", "toRowColumn", "node", "offset", "rowElement", "row", "column", "beginRowColumn", "endRowColumn", "rows", "width", "lastColumn", "targetWidth", "__decorateClass", "__decorateParam", "IInstantiationService", "ICoreBrowserService", "IRenderService", "Linkifier", "Disposable", "_element", "_mouseService", "_renderService", "_bufferService", "_linkProviderService", "Emitter", "toDisposable", "dispose", "addDisposableListener", "event", "position", "composedPath", "i", "target", "useLineCache", "reply", "linkWithState", "linkProvided", "linkProvider", "links", "linksWithState", "link", "y", "replies", "occupiedCells", "providerReply", "startX", "endX", "x", "index", "hasLinkBefore", "j", "linkAtPosition", "currentLink", "linkEquals", "startRow", "endRow", "v", "e", "start", "end", "element", "showEvent", "range", "scrollOffset", "lower", "upper", "current", "mouseService", "coords", "x1", "y1", "x2", "y2", "fg", "__decorateClass", "__decorateParam", "IMouseService", "IRenderService", "IBufferService", "ILinkProviderService", "a", "b", "CoreBrowserTerminal", "CoreTerminal", "options", "MutableDisposable", "Platform_exports", "Emitter", "DecorationService", "IDecorationService", "LinkProviderService", "ILinkProviderService", "OscLinkProvider", "e", "type", "event", "Event", "toDisposable", "req", "acc", "ident", "colorRgb", "color", "C0", "toRgbString", "C1_ESCAPED", "colors", "channels", "narrowedAcc", "value", "AccessibilityManager", "ev", "cursorY", "bufferLine", "cursorX", "cellHeight", "width", "cellWidth", "cursorTop", "cursorLeft", "addDisposableListener", "copyHandler", "pasteHandlerWrapper", "handlePasteEvent", "isFirefox", "rightClickHandler", "isLinux", "moveTextAreaUnderMouseCursor", "parent", "fragment", "promptLabel", "isChromeOS", "CoreBrowserService", "ICoreBrowserService", "CharSizeService", "ICharSizeService", "ThemeService", "IThemeService", "CharacterJoinerService", "ICharacterJoinerService", "RenderService", "IRenderService", "CompositionHelper", "MouseService", "IMouseService", "linkifier", "Linkifier", "Viewport", "SelectionService", "ISelectionService", "text", "BufferDecorationRenderer", "OverviewRulerRenderer", "DomRenderer", "self", "el", "sendEvent", "pos", "but", "action", "deltaY", "requestedEvents", "eventListeners", "events", "sequence", "start", "end", "disp", "suppressScrollEvent", "pageCount", "disableSmoothScroll", "line", "scrollAmount", "data", "paste", "customKeyEventHandler", "customWheelEventHandler", "linkProvider", "handler", "joinerId", "cursorYOffset", "decorationOptions", "column", "row", "length", "shouldIgnoreComposition", "result", "evaluateKeyboardEvent", "scrollCount", "browser", "thirdLevelKey", "wasModifierKeyOnlyEvent", "key", "x", "y", "i", "DEFAULT_ATTR_DATA", "canvasWidth", "canvasHeight", "force", "AddonManager", "i", "terminal", "instance", "loadedAddon", "index", "BufferLineApiView", "_line", "x", "cell", "CellData", "trimRight", "startColumn", "endColumn", "BufferApiView", "_buffer", "type", "buffer", "y", "line", "BufferLineApiView", "CellData", "BufferNamespaceApi", "Disposable", "_core", "Emitter", "BufferApiView", "ParserApi", "_core", "id", "callback", "params", "data", "handler", "ident", "UnicodeApi", "_core", "provider", "version", "CONSTRUCTOR_ONLY_OPTIONS", "$value", "Terminal", "Disposable", "options", "CoreBrowserTerminal", "AddonManager", "getter", "propName", "setter", "value", "desc", "ParserApi", "UnicodeApi", "BufferNamespaceApi", "m", "mouseTrackingMode", "data", "wasUserInput", "columns", "rows", "parent", "customKeyEventHandler", "customWheelEventHandler", "linkProvider", "handler", "joinerId", "cursorYOffset", "decorationOptions", "column", "row", "length", "start", "end", "amount", "pageCount", "line", "callback", "addon", "promptLabel", "tooMuchOutput", "values"] +} diff --git a/src/public/build/polymer.json b/src/public/build/polymer.json index 1a00663..dd5eba7 100644 --- a/src/public/build/polymer.json +++ b/src/public/build/polymer.json @@ -6,6 +6,12 @@ ], "extraDependencies": [ "bower_components/webcomponentsjs/*.js", + "node_modules/@webcontainer/api/dist/*.js", + "node_modules/@webcontainer/api/dist/vendor/*.js", + "node_modules/@webcontainer/api/dist/utils/*.js", + "node_modules/@webcontainer/api/dist/internal/*.js", + "node_modules/@xterm/xterm/lib/*", + "node_modules/@xterm/addon-fit/lib/*", "node_modules/@polymer/app-layout/*/*.js", "node_modules/@polymer/**/*.js", "node_modules/@polymer/marked-element/node_modules/marked/lib/marked.js", diff --git a/src/public/wc-registry.json b/src/public/wc-registry.json index 0ef140d..a6f8142 100644 --- a/src/public/wc-registry.json +++ b/src/public/wc-registry.json @@ -1 +1 @@ -{"focus-trap":"@a11y/focus-trap/focus-trap.js","local-time":"@github/time-elements/dist/local-time-element.js","relative-time":"@github/time-elements/dist/relative-time-element.js","time-ago":"@github/time-elements/dist/time-ago-element.js","time-until":"@github/time-elements/dist/time-until-element.js","model-viewer":"@google/model-viewer/dist/model-viewer.js","a11y-carousel":"@haxtheweb/a11y-carousel/a11y-carousel.js","a11y-carousel-button":"@haxtheweb/a11y-carousel/lib/a11y-carousel-button.js","a11y-collapse":"@haxtheweb/a11y-collapse/a11y-collapse.js","a11y-collapse-group":"@haxtheweb/a11y-collapse/lib/a11y-collapse-group.js","a11y-compare-image":"@haxtheweb/a11y-compare-image/a11y-compare-image.js","a11y-details":"@haxtheweb/a11y-details/a11y-details.js","a11y-figure":"@haxtheweb/a11y-figure/a11y-figure.js","a11y-gif-player":"@haxtheweb/a11y-gif-player/a11y-gif-player.js","a11y-media-player":"@haxtheweb/a11y-media-player/a11y-media-player.js","a11y-media-button":"@haxtheweb/a11y-media-player/lib/a11y-media-button.js","a11y-media-play-button":"@haxtheweb/a11y-media-player/lib/a11y-media-play-button.js","a11y-media-state-manager":"@haxtheweb/a11y-media-player/lib/a11y-media-state-manager.js","a11y-media-transcript-cue":"@haxtheweb/a11y-media-player/lib/a11y-media-transcript-cue.js","a11y-media-youtube":"@haxtheweb/a11y-media-player/lib/a11y-media-youtube.js","a11y-menu-button":"@haxtheweb/a11y-menu-button/a11y-menu-button.js","a11y-menu-button-item":"@haxtheweb/a11y-menu-button/lib/a11y-menu-button-item.js","a11y-tabs":"@haxtheweb/a11y-tabs/a11y-tabs.js","a11y-tab":"@haxtheweb/a11y-tabs/lib/a11y-tab.js","absolute-position-behavior":"@haxtheweb/absolute-position-behavior/absolute-position-behavior.js","absolute-position-state-manager":"@haxtheweb/absolute-position-behavior/lib/absolute-position-state-manager.js","accent-card":"@haxtheweb/accent-card/accent-card.js","aframe-player":"@haxtheweb/aframe-player/aframe-player.js","air-horn":"@haxtheweb/air-horn/air-horn.js","app-hax":"@haxtheweb/app-hax/app-hax.js","app-hax-theme":"@haxtheweb/app-hax/lib/app-hax-theme.js","random-word":"@haxtheweb/app-hax/lib/random-word/random-word.js","rpg-character-toast":"@haxtheweb/app-hax/lib/rpg-character-toast/rpg-character-toast.js","app-hax-button":"@haxtheweb/app-hax/lib/v1/app-hax-button.js","app-hax-hat-progress":"@haxtheweb/app-hax/lib/v1/app-hax-hat-progress.js","app-hax-label":"@haxtheweb/app-hax/lib/v1/app-hax-label.js","app-hax-search-bar":"@haxtheweb/app-hax/lib/v1/app-hax-search-bar.js","app-hax-search-results":"@haxtheweb/app-hax/lib/v1/app-hax-search-results.js","app-hax-site-bar":"@haxtheweb/app-hax/lib/v1/app-hax-site-bar.js","app-hax-site-button":"@haxtheweb/app-hax/lib/v1/app-hax-site-button.js","app-hax-site-details":"@haxtheweb/app-hax/lib/v1/app-hax-site-details.js","app-hax-site-login":"@haxtheweb/app-hax/lib/v1/app-hax-site-login.js","app-hax-steps":"@haxtheweb/app-hax/lib/v1/app-hax-steps.js","app-hax-toast":"@haxtheweb/app-hax/lib/v1/app-hax-toast.js","app-hax-top-bar":"@haxtheweb/app-hax/lib/v1/app-hax-top-bar.js","app-hax-user-menu-button":"@haxtheweb/app-hax/lib/v1/app-hax-user-menu-button.js","app-hax-user-menu":"@haxtheweb/app-hax/lib/v1/app-hax-user-menu.js","app-hax-wired-toggle":"@haxtheweb/app-hax/lib/v1/app-hax-wired-toggle.js","app-hax-backend-api":"@haxtheweb/app-hax/lib/v1/AppHaxBackendAPI.js","app-hax-router":"@haxtheweb/app-hax/lib/v1/AppHaxRouter.js","wired-darkmode-toggle":"@haxtheweb/app-hax/lib/wired-darkmode-toggle/wired-darkmode-toggle.js","audio-player":"@haxtheweb/audio-player/audio-player.js","awesome-explosion":"@haxtheweb/awesome-explosion/awesome-explosion.js","b-r":"@haxtheweb/b-r/b-r.js","barcode-reader":"@haxtheweb/barcode-reader/barcode-reader.js","beaker-broker":"@haxtheweb/beaker-broker/beaker-broker.js","bootstrap-theme":"@haxtheweb/bootstrap-theme/bootstrap-theme.js","bootstrap-breadcrumb":"@haxtheweb/bootstrap-theme/lib/BootstrapBreadcrumb.js","bootstrap-footer":"@haxtheweb/bootstrap-theme/lib/BootstrapFooter.js","bootstrap-search":"@haxtheweb/bootstrap-theme/lib/BootstrapSearch.js","chartist-render":"@haxtheweb/chartist-render/chartist-render.js","chat-agent":"@haxtheweb/chat-agent/chat-agent.js","chat-button":"@haxtheweb/chat-agent/lib/chat-button.js","chat-control-bar":"@haxtheweb/chat-agent/lib/chat-control-bar.js","chat-developer-panel":"@haxtheweb/chat-agent/lib/chat-developer-panel.js","chat-input":"@haxtheweb/chat-agent/lib/chat-input.js","chat-interface":"@haxtheweb/chat-agent/lib/chat-interface.js","chat-message":"@haxtheweb/chat-agent/lib/chat-message.js","chat-suggestion":"@haxtheweb/chat-agent/lib/chat-suggestion.js","check-it-out":"@haxtheweb/check-it-out/check-it-out.js","citation-element":"@haxtheweb/citation-element/citation-element.js","clean-one":"@haxtheweb/clean-one/clean-one.js","clean-one-search-box":"@haxtheweb/clean-one/lib/clean-one-search-box.js","clean-two":"@haxtheweb/clean-two/clean-two.js","cms-hax":"@haxtheweb/cms-hax/cms-hax.js","cms-block":"@haxtheweb/cms-hax/lib/cms-block.js","cms-entity":"@haxtheweb/cms-hax/lib/cms-entity.js","cms-token":"@haxtheweb/cms-hax/lib/cms-token.js","cms-views":"@haxtheweb/cms-hax/lib/cms-views.js","code-editor":"@haxtheweb/code-editor/code-editor.js","code-pen-button":"@haxtheweb/code-editor/lib/code-pen-button.js","monaco-element":"@haxtheweb/code-editor/lib/monaco-element/monaco-element.js","code-sample":"@haxtheweb/code-sample/code-sample.js","collection-list":"@haxtheweb/collection-list/collection-list.js","collection-item":"@haxtheweb/collection-list/lib/collection-item.js","collection-row":"@haxtheweb/collection-list/lib/collection-row.js","collections-theme-banner":"@haxtheweb/collection-list/lib/collections-theme-banner.js","collections-theme":"@haxtheweb/collection-list/lib/collections-theme.js","count-up":"@haxtheweb/count-up/count-up.js","course-design":"@haxtheweb/course-design/course-design.js","activity-box":"@haxtheweb/course-design/lib/activity-box.js","block-quote":"@haxtheweb/course-design/lib/block-quote.js","course-intro-header":"@haxtheweb/course-design/lib/course-intro-header.js","course-intro-lesson-plan":"@haxtheweb/course-design/lib/course-intro-lesson-plan.js","course-intro-lesson-plans":"@haxtheweb/course-design/lib/course-intro-lesson-plans.js","course-intro":"@haxtheweb/course-design/lib/course-intro.js","ebook-button":"@haxtheweb/course-design/lib/ebook-button.js","learning-component":"@haxtheweb/course-design/lib/learning-component.js","lrn-h5p":"@haxtheweb/course-design/lib/lrn-h5p.js","responsive-iframe":"@haxtheweb/course-design/lib/responsive-iframe.js","worksheet-download":"@haxtheweb/course-design/lib/worksheet-download.js","course-model":"@haxtheweb/course-model/course-model.js","model-info":"@haxtheweb/course-model/lib/model-info.js","model-option":"@haxtheweb/course-model/lib/model-option.js","csv-render":"@haxtheweb/csv-render/csv-render.js","d-d-d":"@haxtheweb/d-d-d/d-d-d.js","d-d-docs":"@haxtheweb/d-d-d/lib/d-d-docs.js","ddd-brochure-theme":"@haxtheweb/d-d-d/lib/ddd-brochure-theme.js","mini-map":"@haxtheweb/d-d-d/lib/mini-map.js","data-viz":"@haxtheweb/data-viz/data-viz.js","date-card":"@haxtheweb/date-card/date-card.js","date-chip":"@haxtheweb/date-card/lib/date-chip.js","discord-embed":"@haxtheweb/discord-embed/discord-embed.js","disqus-embed":"@haxtheweb/disqus-embed/disqus-embed.js","haxcms-site-disqus":"@haxtheweb/disqus-embed/lib/haxcms-site-disqus.js","documentation-player":"@haxtheweb/documentation-player/documentation-player.js","dynamic-import-registry":"@haxtheweb/dynamic-import-registry/dynamic-import-registry.js","editable-outline":"@haxtheweb/editable-outline/editable-outline.js","editable-table":"@haxtheweb/editable-table/editable-table.js","editable-table-display":"@haxtheweb/editable-table/lib/editable-table-display.js","editable-table-edit":"@haxtheweb/editable-table/lib/editable-table-edit.js","editable-table-editor-rowcol":"@haxtheweb/editable-table/lib/editable-table-editor-rowcol.js","editable-table-filter":"@haxtheweb/editable-table/lib/editable-table-filter.js","editable-table-sort":"@haxtheweb/editable-table/lib/editable-table-sort.js","elmsln-loading":"@haxtheweb/elmsln-loading/elmsln-loading.js","enhanced-text":"@haxtheweb/enhanced-text/enhanced-text.js","event-badge":"@haxtheweb/event-badge/event-badge.js","example-hax-element":"@haxtheweb/example-hax-element/example-hax-element.js","example-haxcms-theme":"@haxtheweb/example-haxcms-theme/example-haxcms-theme.js","figure-label":"@haxtheweb/figure-label/figure-label.js","file-system-broker":"@haxtheweb/file-system-broker/file-system-broker.js","docx-file-system-broker":"@haxtheweb/file-system-broker/lib/docx-file-system-broker.js","xlsx-file-system-broker":"@haxtheweb/file-system-broker/lib/xlsx-file-system-broker.js","fill-in-the-blanks":"@haxtheweb/fill-in-the-blanks/fill-in-the-blanks.js","flash-card":"@haxtheweb/flash-card/flash-card.js","flash-card-answer-box":"@haxtheweb/flash-card/lib/flash-card-answer-box.js","flash-card-image-prompt":"@haxtheweb/flash-card/lib/flash-card-prompt-img.js","flash-card-set":"@haxtheweb/flash-card/lib/flash-card-set.js","fluid-type":"@haxtheweb/fluid-type/fluid-type.js","full-width-image":"@haxtheweb/full-width-image/full-width-image.js","fullscreen-behaviors":"@haxtheweb/fullscreen-behaviors/fullscreen-behaviors.js","future-terminal-text":"@haxtheweb/future-terminal-text/future-terminal-text.js","future-terminal-text-lite":"@haxtheweb/future-terminal-text/lib/future-terminal-text-lite.js","git-corner":"@haxtheweb/git-corner/git-corner.js","github-preview":"@haxtheweb/github-preview/github-preview.js","wc-markdown":"@haxtheweb/github-preview/lib/wc-markdown.js","grade-book":"@haxtheweb/grade-book/grade-book.js","grade-book-lite":"@haxtheweb/grade-book/lib/grade-book-lite.js","grade-book-pop-up":"@haxtheweb/grade-book/lib/grade-book-pop-up.js","grade-book-store":"@haxtheweb/grade-book/lib/grade-book-store.js","grade-book-student-block":"@haxtheweb/grade-book/lib/grade-book-student-block.js","grade-book-table":"@haxtheweb/grade-book/lib/grade-book-table.js","letter-grade-picker":"@haxtheweb/grade-book/lib/letter-grade-picker.js","letter-grade":"@haxtheweb/grade-book/lib/letter-grade.js","grid-plate":"@haxtheweb/grid-plate/grid-plate.js","h-a-x":"@haxtheweb/h-a-x/h-a-x.js","h5p-element":"@haxtheweb/h5p-element/h5p-element.js","h5p-wrapped-element":"@haxtheweb/h5p-element/lib/h5p-wrapped-element.js","hal-9000":"@haxtheweb/hal-9000/hal-9000.js","hal-9000-ui":"@haxtheweb/hal-9000/lib/hal-9000-ui/hal-9000-ui.js","hax-body":"@haxtheweb/hax-body/hax-body.js","hax-app-picker":"@haxtheweb/hax-body/lib/hax-app-picker.js","hax-app-search":"@haxtheweb/hax-body/lib/hax-app-search.js","hax-app":"@haxtheweb/hax-body/lib/hax-app.js","hax-autoloader":"@haxtheweb/hax-body/lib/hax-autoloader.js","hax-cancel-dialog":"@haxtheweb/hax-body/lib/hax-cancel-dialog.js","hax-context-item-textop":"@haxtheweb/hax-body/lib/hax-context-item-textop.js","hax-context-item":"@haxtheweb/hax-body/lib/hax-context-item.js","hax-element-demo":"@haxtheweb/hax-body/lib/hax-element-demo.js","hax-export-dialog":"@haxtheweb/hax-body/lib/hax-export-dialog.js","hax-gizmo-browser":"@haxtheweb/hax-body/lib/hax-gizmo-browser.js","hax-map":"@haxtheweb/hax-body/lib/hax-map.js","hax-picker":"@haxtheweb/hax-body/lib/hax-picker.js","hax-plate-context":"@haxtheweb/hax-body/lib/hax-plate-context.js","hax-preferences-dialog":"@haxtheweb/hax-body/lib/hax-preferences-dialog.js","hax-stax-browser":"@haxtheweb/hax-body/lib/hax-stax-browser.js","hax-store":"@haxtheweb/hax-body/lib/hax-store.js","hax-text-editor-button":"@haxtheweb/hax-body/lib/hax-text-editor-button.js","hax-text-editor-paste-button":"@haxtheweb/hax-body/lib/hax-text-editor-paste-button.js","hax-text-editor-toolbar":"@haxtheweb/hax-body/lib/hax-text-editor-toolbar.js","hax-text-editor":"@haxtheweb/hax-body/lib/hax-text-editor.js","hax-toolbar-item":"@haxtheweb/hax-body/lib/hax-toolbar-item.js","hax-toolbar-menu":"@haxtheweb/hax-body/lib/hax-toolbar-menu.js","hax-toolbar":"@haxtheweb/hax-body/lib/hax-toolbar.js","hax-tray-button":"@haxtheweb/hax-body/lib/hax-tray-button.js","hax-tray-upload":"@haxtheweb/hax-body/lib/hax-tray-upload.js","hax-tray":"@haxtheweb/hax-body/lib/hax-tray.js","hax-ui-styles":"@haxtheweb/hax-body/lib/hax-ui-styles.js","hax-upload-field":"@haxtheweb/hax-body/lib/hax-upload-field.js","hax-view-source":"@haxtheweb/hax-body/lib/hax-view-source.js","hax-cloud":"@haxtheweb/hax-cloud/hax-cloud.js","hax-logo":"@haxtheweb/hax-logo/hax-logo.js","haxcms-backend-beaker":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-beaker.js","haxcms-backend-demo":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-demo.js","haxcms-backend-nodejs":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-nodejs.js","haxcms-backend-php":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-php.js","haxcms-backend-userfs":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-userfs.js","haxcms-darkmode-toggle":"@haxtheweb/haxcms-elements/lib/core/haxcms-darkmode-toggle.js","haxcms-editor-builder":"@haxtheweb/haxcms-elements/lib/core/haxcms-editor-builder.js","haxcms-outline-editor-dialog":"@haxtheweb/haxcms-elements/lib/core/haxcms-outline-editor-dialog.js","haxcms-share-dialog":"@haxtheweb/haxcms-elements/lib/core/haxcms-share-dialog.js","haxcms-site-builder":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-builder.js","haxcms-site-dashboard":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-dashboard.js","haxcms-site-editor-ui":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-editor-ui.js","haxcms-site-editor":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-editor.js","haxcms-site-insights":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-insights.js","haxcms-site-router":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js","haxcms-site-store":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-store.js","haxcms-toast":"@haxtheweb/haxcms-elements/lib/core/haxcms-toast.js","haxcms-button-add":"@haxtheweb/haxcms-elements/lib/core/micros/haxcms-button-add.js","haxcms-basic-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-basic-theme.js","haxcms-blank-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-blank-theme.js","haxcms-minimalist-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-minimalist-theme.js","haxcms-print-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-print-theme.js","haxcms-slide-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-slide-theme.js","haxcms-user-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-user-theme.js","haxcms-page-get-started":"@haxtheweb/haxcms-elements/lib/core/ui/haxcms-page-get-started.js","haxcms-dev-theme":"@haxtheweb/haxcms-elements/lib/development/haxcms-dev-theme.js","haxcms-theme-developer":"@haxtheweb/haxcms-elements/lib/development/haxcms-theme-developer.js","site-active-fields":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-active-fields.js","site-active-tags":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-active-tags.js","site-active-title":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-active-title.js","site-git-corner":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-git-corner.js","site-share-widget":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-share-widget.js","site-children-block":"@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-children-block.js","site-outline-block":"@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-outline-block.js","site-recent-content-block":"@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-recent-content-block.js","site-drawer":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-drawer.js","site-footer":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-footer.js","site-modal":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-modal.js","site-region":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-region.js","active-when-visible":"@haxtheweb/haxcms-elements/lib/ui-components/magic/active-when-visible.js","site-ai-chat":"@haxtheweb/haxcms-elements/lib/ui-components/magic/site-ai-chat.js","site-collection-list":"@haxtheweb/haxcms-elements/lib/ui-components/magic/site-collection-list.js","site-view":"@haxtheweb/haxcms-elements/lib/ui-components/magic/site-view.js","site-breadcrumb":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-breadcrumb.js","site-dot-indicator":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-dot-indicator.js","site-menu-button":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-menu-button.js","site-menu-content":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-menu-content.js","site-menu":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-menu.js","site-top-menu":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-top-menu.js","site-query-menu-slice":"@haxtheweb/haxcms-elements/lib/ui-components/query/site-query-menu-slice.js","site-query":"@haxtheweb/haxcms-elements/lib/ui-components/query/site-query.js","site-render-query":"@haxtheweb/haxcms-elements/lib/ui-components/query/site-render-query.js","site-views-route":"@haxtheweb/haxcms-elements/lib/ui-components/routes/site-views-route.js","site-print-button":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-print-button.js","site-remote-content":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-remote-content.js","site-rss-button":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-rss-button.js","site-search":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-search.js","site-title":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-title.js","site-uuid-link":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-uuid-link.js","basic-template":"@haxtheweb/haxcms-elements/lib/ui-components/templates/basic-template.js","minimalist-template":"@haxtheweb/haxcms-elements/lib/ui-components/templates/minimalist-template.js","haxor-slevin":"@haxtheweb/haxor-slevin/haxor-slevin.js","hex-picker":"@haxtheweb/hex-picker/hex-picker.js","hexagon-loader":"@haxtheweb/hexagon-loader/hexagon-loader.js","hex-a-gon":"@haxtheweb/hexagon-loader/lib/hex-a-gon.js","html-block":"@haxtheweb/html-block/html-block.js","i18n-manager":"@haxtheweb/i18n-manager/i18n-manager.js","iframe-loader":"@haxtheweb/iframe-loader/iframe-loader.js","loading-indicator":"@haxtheweb/iframe-loader/lib/loading-indicator.js","image-compare-slider":"@haxtheweb/image-compare-slider/image-compare-slider.js","image-inspector":"@haxtheweb/image-inspector/image-inspector.js","img-pan-zoom":"@haxtheweb/img-pan-zoom/img-pan-zoom.js","img-loader":"@haxtheweb/img-pan-zoom/lib/img-loader.js","img-view-modal":"@haxtheweb/img-view-modal/img-view-modal.js","img-view-viewer":"@haxtheweb/img-view-modal/lib/img-view-viewer.js","inline-audio":"@haxtheweb/inline-audio/inline-audio.js","json-editor":"@haxtheweb/json-editor/json-editor.js","json-outline-schema":"@haxtheweb/json-outline-schema/json-outline-schema.js","jos-render":"@haxtheweb/json-outline-schema/lib/jos-render.js","jwt-login":"@haxtheweb/jwt-login/jwt-login.js","la-tex":"@haxtheweb/la-tex/la-tex.js","lazy-image":"@haxtheweb/lazy-image-helpers/lazy-image-helpers.js","lazy-import-discover":"@haxtheweb/lazy-import-discover/lazy-import-discover.js","learn-two-theme":"@haxtheweb/learn-two-theme/learn-two-theme.js","lesson-overview":"@haxtheweb/lesson-overview/lesson-overview.js","lesson-highlight":"@haxtheweb/lesson-overview/lib/lesson-highlight.js","license-element":"@haxtheweb/license-element/license-element.js","lorem-data":"@haxtheweb/lorem-data/lorem-data.js","lrn-gitgraph":"@haxtheweb/lrn-gitgraph/lrn-gitgraph.js","lrn-math":"@haxtheweb/lrn-math/lrn-math.js","lrn-table":"@haxtheweb/lrn-table/lrn-table.js","lrn-vocab":"@haxtheweb/lrn-vocab/lrn-vocab.js","lrndesign-avatar":"@haxtheweb/lrndesign-avatar/lrndesign-avatar.js","lrndesign-bar":"@haxtheweb/lrndesign-chart/lib/lrndesign-bar.js","lrndesign-line":"@haxtheweb/lrndesign-chart/lib/lrndesign-line.js","lrndesign-pie":"@haxtheweb/lrndesign-chart/lib/lrndesign-pie.js","lrndesign-imagemap-hotspot":"@haxtheweb/lrndesign-imagemap/lib/lrndesign-imagemap-hotspot.js","lrndesign-imagemap":"@haxtheweb/lrndesign-imagemap/lrndesign-imagemap.js","lrndesign-sidenote":"@haxtheweb/lrndesign-sidenote/lrndesign-sidenote.js","lrndesign-timeline":"@haxtheweb/lrndesign-timeline/lrndesign-timeline.js","lrs-bridge-haxcms":"@haxtheweb/lrs-elements/lib/lrs-bridge-haxcms.js","lrs-bridge":"@haxtheweb/lrs-elements/lib/lrs-bridge.js","lrs-emitter":"@haxtheweb/lrs-elements/lib/lrs-emitter.js","lunr-search":"@haxtheweb/lunr-search/lunr-search.js","map-menu-builder":"@haxtheweb/map-menu/lib/map-menu-builder.js","map-menu-container":"@haxtheweb/map-menu/lib/map-menu-container.js","map-menu-header":"@haxtheweb/map-menu/lib/map-menu-header.js","map-menu-item":"@haxtheweb/map-menu/lib/map-menu-item.js","map-menu-submenu":"@haxtheweb/map-menu/lib/map-menu-submenu.js","map-menu":"@haxtheweb/map-menu/map-menu.js","mark-the-words":"@haxtheweb/mark-the-words/mark-the-words.js","matching-question":"@haxtheweb/matching-question/matching-question.js","md-block":"@haxtheweb/md-block/md-block.js","media-image":"@haxtheweb/media-image/media-image.js","media-quote":"@haxtheweb/media-quote/media-quote.js","meme-maker":"@haxtheweb/meme-maker/meme-maker.js","badge-sticker":"@haxtheweb/merit-badge/lib/badge-sticker.js","date-title":"@haxtheweb/merit-badge/lib/date-title.js","locked-badge":"@haxtheweb/merit-badge/lib/locked-badge.js","merit-badge":"@haxtheweb/merit-badge/merit-badge.js","micro-copy-heading":"@haxtheweb/micro-copy-heading/micro-copy-heading.js","micro-frontend-registry":"@haxtheweb/micro-frontend-registry/micro-frontend-registry.js","moar-sarcasm":"@haxtheweb/moar-sarcasm/moar-sarcasm.js","moment-element":"@haxtheweb/moment-element/moment-element.js","confetti-container":"@haxtheweb/multiple-choice/lib/confetti-container.js","short-answer-question":"@haxtheweb/multiple-choice/lib/short-answer-question.js","true-false-question":"@haxtheweb/multiple-choice/lib/true-false-question.js","multiple-choice":"@haxtheweb/multiple-choice/multiple-choice.js","midi-player":"@haxtheweb/music-player/lib/html-midi-player.js","music-player":"@haxtheweb/music-player/music-player.js","mutation-observer-import":"@haxtheweb/mutation-observer-import-mixin/mutation-observer-import-mixin.js","oer-schema":"@haxtheweb/oer-schema/oer-schema.js","opt-img":"@haxtheweb/opt-img/opt-img.js","outline-designer":"@haxtheweb/outline-designer/outline-designer.js","outline-player":"@haxtheweb/outline-player/outline-player.js","page-anchor":"@haxtheweb/page-break/lib/page-anchor.js","page-break-manager":"@haxtheweb/page-break/lib/page-break-manager.js","page-break-outline":"@haxtheweb/page-break/lib/page-break-outline.js","page-break":"@haxtheweb/page-break/page-break.js","page-contents-menu":"@haxtheweb/page-contents-menu/page-contents-menu.js","page-flag-comment":"@haxtheweb/page-flag/lib/page-flag-comment.js","page-flag":"@haxtheweb/page-flag/page-flag.js","page-scroll-position":"@haxtheweb/page-scroll-position/page-scroll-position.js","page-section":"@haxtheweb/page-section/page-section.js","paper-avatar":"@haxtheweb/paper-avatar/paper-avatar.js","paper-input-flagged":"@haxtheweb/paper-input-flagged/paper-input-flagged.js","paper-icon-step":"@haxtheweb/paper-stepper/lib/paper-icon-step.js","paper-icon-stepper":"@haxtheweb/paper-stepper/lib/paper-icon-stepper.js","paper-step":"@haxtheweb/paper-stepper/lib/paper-step.js","paper-stepper":"@haxtheweb/paper-stepper/paper-stepper.js","parallax-image":"@haxtheweb/parallax-image/parallax-image.js","pdf-browser-viewer":"@haxtheweb/pdf-browser-viewer/pdf-browser-viewer.js","person-testimonial":"@haxtheweb/person-testimonial/person-testimonial.js","place-holder":"@haxtheweb/place-holder/place-holder.js","play-list":"@haxtheweb/play-list/play-list.js","polaris-cta":"@haxtheweb/polaris-theme/lib/polaris-cta.js","polaris-invent-theme":"@haxtheweb/polaris-theme/lib/polaris-invent-theme.js","polaris-mark":"@haxtheweb/polaris-theme/lib/polaris-mark.js","polaris-story-card":"@haxtheweb/polaris-theme/lib/polaris-story-card.js","polaris-tile":"@haxtheweb/polaris-theme/lib/polaris-tile.js","polaris-theme":"@haxtheweb/polaris-theme/polaris-theme.js","portal-launcher":"@haxtheweb/portal-launcher/portal-launcher.js","post-card-photo":"@haxtheweb/post-card/lib/PostCardPhoto.js","post-card-postmark":"@haxtheweb/post-card/lib/PostCardPostmark.js","post-card-stamp":"@haxtheweb/post-card/lib/PostCardStamp.js","post-card":"@haxtheweb/post-card/post-card.js","pouch-db":"@haxtheweb/pouch-db/pouch-db.js","course-card":"@haxtheweb/product-card/lib/course-card.js","hax-element-card-list":"@haxtheweb/product-card/lib/hax-element-card-list.js","hax-element-list-selector":"@haxtheweb/product-card/lib/hax-element-list-selector.js","product-banner":"@haxtheweb/product-card/lib/product-banner.js","product-card":"@haxtheweb/product-card/product-card.js","product-glance":"@haxtheweb/product-glance/product-glance.js","product-offering":"@haxtheweb/product-offering/product-offering.js","progress-donut":"@haxtheweb/progress-donut/progress-donut.js","promise-progress-lite":"@haxtheweb/promise-progress/lib/promise-progress-lite.js","wc-preload-progress":"@haxtheweb/promise-progress/lib/wc-preload-progress.js","promise-progress":"@haxtheweb/promise-progress/promise-progress.js","qr-code":"@haxtheweb/q-r/lib/qr-code.js","q-r":"@haxtheweb/q-r/q-r.js","relative-heading-lite":"@haxtheweb/relative-heading/lib/relative-heading-lite.js","relative-heading-state-manager":"@haxtheweb/relative-heading/lib/relative-heading-state-manager.js","relative-heading":"@haxtheweb/relative-heading/relative-heading.js","performance-detect":"@haxtheweb/replace-tag/lib/PerformanceDetect.js","replace-tag":"@haxtheweb/replace-tag/replace-tag.js","responsive-grid-clear":"@haxtheweb/responsive-grid/lib/responsive-grid-clear.js","responsive-grid-col":"@haxtheweb/responsive-grid/lib/responsive-grid-col.js","responsive-grid-row":"@haxtheweb/responsive-grid/lib/responsive-grid-row.js","responsive-utility-element":"@haxtheweb/responsive-utility/lib/responsive-utility-element.js","responsive-utility":"@haxtheweb/responsive-utility/responsive-utility.js","retro-card":"@haxtheweb/retro-card/retro-card.js","rich-text-editor-button":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-button.js","rich-text-editor-emoji-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-emoji-picker.js","rich-text-editor-heading-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-heading-picker.js","rich-text-editor-icon-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-icon-picker.js","rich-text-editor-image":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-image.js","rich-text-editor-link":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-link.js","rich-text-editor-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-picker.js","rich-text-editor-prompt-button":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-prompt-button.js","rich-text-editor-source-code":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-source-code.js","rich-text-editor-symbol-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-symbol-picker.js","rich-text-editor-underline":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-underline.js","rich-text-editor-unlink":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-unlink.js","rich-text-editor-clipboard":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-clipboard.js","rich-text-editor-highlight":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-highlight.js","rich-text-editor-prompt":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-prompt.js","rich-text-editor-source":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-source.js","rich-text-editor-breadcrumbs":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-breadcrumbs.js","rich-text-editor-toolbar-full":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-toolbar-full.js","rich-text-editor-toolbar-mini":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-toolbar-mini.js","rich-text-editor-toolbar":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-toolbar.js","rich-text-editor":"@haxtheweb/rich-text-editor/rich-text-editor.js","rpg-character":"@haxtheweb/rpg-character/rpg-character.js","runkit-embed":"@haxtheweb/runkit-embed/runkit-embed.js","scroll-button":"@haxtheweb/scroll-button/scroll-button.js","self-check":"@haxtheweb/self-check/self-check.js","shadow-style":"@haxtheweb/shadow-style/shadow-style.js","simple-autocomplete-text-trigger":"@haxtheweb/simple-autocomplete/lib/simple-autocomplete-text-trigger.js","simple-autocomplete":"@haxtheweb/simple-autocomplete/simple-autocomplete.js","simple-blog-card":"@haxtheweb/simple-blog-card/simple-blog-card.js","simple-blog-footer":"@haxtheweb/simple-blog/lib/simple-blog-footer.js","simple-blog-header":"@haxtheweb/simple-blog/lib/simple-blog-header.js","simple-blog-listing":"@haxtheweb/simple-blog/lib/simple-blog-listing.js","simple-blog-overview":"@haxtheweb/simple-blog/lib/simple-blog-overview.js","simple-blog-post":"@haxtheweb/simple-blog/lib/simple-blog-post.js","simple-blog":"@haxtheweb/simple-blog/simple-blog.js","simple-colors-shared-styles":"@haxtheweb/simple-colors-shared-styles/simple-colors-shared-styles.js","simple-colors-swatch-info":"@haxtheweb/simple-colors/lib/demo/simple-colors-swatch-info.js","simple-colors-swatches":"@haxtheweb/simple-colors/lib/demo/simple-colors-swatches.js","simple-colors-picker":"@haxtheweb/simple-colors/lib/simple-colors-picker.js","simple-colors-polymer":"@haxtheweb/simple-colors/lib/simple-colors-polymer.js","simple-colors":"@haxtheweb/simple-colors/simple-colors.js","simple-cta":"@haxtheweb/simple-cta/simple-cta.js","simple-datetime":"@haxtheweb/simple-datetime/simple-datetime.js","simple-emoji":"@haxtheweb/simple-emoji/simple-emoji.js","simple-fields-array-item":"@haxtheweb/simple-fields/lib/simple-fields-array-item.js","simple-fields-array":"@haxtheweb/simple-fields/lib/simple-fields-array.js","simple-fields-code":"@haxtheweb/simple-fields/lib/simple-fields-code.js","simple-fields-combo":"@haxtheweb/simple-fields/lib/simple-fields-combo.js","simple-fields-container":"@haxtheweb/simple-fields/lib/simple-fields-container.js","simple-fields-field":"@haxtheweb/simple-fields/lib/simple-fields-field.js","simple-fields-fieldset":"@haxtheweb/simple-fields/lib/simple-fields-fieldset.js","simple-fields-form-lite":"@haxtheweb/simple-fields/lib/simple-fields-form-lite.js","simple-fields-form":"@haxtheweb/simple-fields/lib/simple-fields-form.js","simple-fields-html-block":"@haxtheweb/simple-fields/lib/simple-fields-html-block.js","simple-fields-lite":"@haxtheweb/simple-fields/lib/simple-fields-lite.js","simple-fields-tab":"@haxtheweb/simple-fields/lib/simple-fields-tab.js","simple-fields-tabs":"@haxtheweb/simple-fields/lib/simple-fields-tabs.js","simple-fields-tag-list":"@haxtheweb/simple-fields/lib/simple-fields-tag-list.js","simple-fields-upload":"@haxtheweb/simple-fields/lib/simple-fields-upload.js","simple-fields-url-combo-item":"@haxtheweb/simple-fields/lib/simple-fields-url-combo-item.js","simple-fields-url-combo":"@haxtheweb/simple-fields/lib/simple-fields-url-combo.js","simple-tag-lite":"@haxtheweb/simple-fields/lib/simple-tag-lite.js","simple-tag":"@haxtheweb/simple-fields/lib/simple-tag.js","simple-tags":"@haxtheweb/simple-fields/lib/simple-tags.js","simple-fields":"@haxtheweb/simple-fields/simple-fields.js","simple-icon-picker":"@haxtheweb/simple-icon-picker/simple-icon-picker.js","simple-icon-button-lite":"@haxtheweb/simple-icon/lib/simple-icon-button-lite.js","simple-icon-button":"@haxtheweb/simple-icon/lib/simple-icon-button.js","simple-icon-lite":"@haxtheweb/simple-icon/lib/simple-icon-lite.js","simple-iconset-demo":"@haxtheweb/simple-icon/lib/simple-iconset-demo.js","simple-iconset":"@haxtheweb/simple-icon/lib/simple-iconset.js","simple-icon":"@haxtheweb/simple-icon/simple-icon.js","simple-img":"@haxtheweb/simple-img/simple-img.js","simple-camera-snap":"@haxtheweb/simple-login/lib/simple-camera-snap.js","simple-login-avatar":"@haxtheweb/simple-login/lib/simple-login-avatar.js","simple-login-camera":"@haxtheweb/simple-login/lib/simple-login-camera.js","simple-login":"@haxtheweb/simple-login/simple-login.js","simple-modal-template":"@haxtheweb/simple-modal/lib/simple-modal-template.js","simple-modal":"@haxtheweb/simple-modal/simple-modal.js","simple-emoji-picker":"@haxtheweb/simple-picker/lib/simple-emoji-picker.js","simple-picker-option":"@haxtheweb/simple-picker/lib/simple-picker-option.js","simple-symbol-picker":"@haxtheweb/simple-picker/lib/simple-symbol-picker.js","simple-picker":"@haxtheweb/simple-picker/simple-picker.js","simple-popover-manager":"@haxtheweb/simple-popover/lib/simple-popover-manager.js","simple-popover-selection":"@haxtheweb/simple-popover/lib/simple-popover-selection.js","simple-tour":"@haxtheweb/simple-popover/lib/simple-tour.js","simple-popover":"@haxtheweb/simple-popover/simple-popover.js","simple-progress":"@haxtheweb/simple-progress/simple-progress.js","simple-range-input":"@haxtheweb/simple-range-input/simple-range-input.js","simple-search-content":"@haxtheweb/simple-search/lib/simple-search-content.js","simple-search-match":"@haxtheweb/simple-search/lib/simple-search-match.js","simple-search":"@haxtheweb/simple-search/simple-search.js","simple-toast-el":"@haxtheweb/simple-toast/lib/simple-toast-el.js","simple-toast":"@haxtheweb/simple-toast/simple-toast.js","simple-button-grid":"@haxtheweb/simple-toolbar/lib/simple-button-grid.js","simple-toolbar-button-group":"@haxtheweb/simple-toolbar/lib/simple-toolbar-button-group.js","simple-toolbar-button":"@haxtheweb/simple-toolbar/lib/simple-toolbar-button.js","simple-toolbar-field":"@haxtheweb/simple-toolbar/lib/simple-toolbar-field.js","simple-toolbar-menu-item":"@haxtheweb/simple-toolbar/lib/simple-toolbar-menu-item.js","simple-toolbar-menu":"@haxtheweb/simple-toolbar/lib/simple-toolbar-menu.js","simple-toolbar-more-button":"@haxtheweb/simple-toolbar/lib/simple-toolbar-more-button.js","simple-toolbar":"@haxtheweb/simple-toolbar/simple-toolbar.js","simple-tooltip":"@haxtheweb/simple-tooltip/simple-tooltip.js","social-share-link":"@haxtheweb/social-share-link/social-share-link.js","sorting-option":"@haxtheweb/sorting-question/lib/sorting-option.js","sorting-question":"@haxtheweb/sorting-question/sorting-question.js","spotify-embed":"@haxtheweb/spotify-embed/spotify-embed.js","star-rating":"@haxtheweb/star-rating/star-rating.js","stop-note":"@haxtheweb/stop-note/stop-note.js","super-daemon-row":"@haxtheweb/super-daemon/lib/super-daemon-row.js","super-daemon-search":"@haxtheweb/super-daemon/lib/super-daemon-search.js","super-daemon-toast":"@haxtheweb/super-daemon/lib/super-daemon-toast.js","super-daemon-ui":"@haxtheweb/super-daemon/lib/super-daemon-ui.js","super-daemon":"@haxtheweb/super-daemon/super-daemon.js","tagging-question":"@haxtheweb/tagging-question/tagging-question.js","terrible-best-themes":"@haxtheweb/terrible-themes/lib/terrible-best-themes.js","terrible-outlet-themes":"@haxtheweb/terrible-themes/lib/terrible-outlet-themes.js","terrible-productionz-themes":"@haxtheweb/terrible-themes/lib/terrible-productionz-themes.js","terrible-resume-themes":"@haxtheweb/terrible-themes/lib/terrible-resume-themes.js","terrible-themes":"@haxtheweb/terrible-themes/terrible-themes.js","training-button":"@haxtheweb/training-theme/lib/training-button.js","training-top":"@haxtheweb/training-theme/lib/training-top.js","training-theme":"@haxtheweb/training-theme/training-theme.js","twitter-embed-vanilla":"@haxtheweb/twitter-embed/lib/twitter-embed-vanilla.js","twitter-embed":"@haxtheweb/twitter-embed/twitter-embed.js","type-writer":"@haxtheweb/type-writer/type-writer.js","undo-manager":"@haxtheweb/undo-manager/undo-manager.js","unity-webgl":"@haxtheweb/unity-webgl/unity-webgl.js","user-action":"@haxtheweb/user-action/user-action.js","user-scaffold":"@haxtheweb/user-scaffold/user-scaffold.js","lecture-anchor":"@haxtheweb/video-player/lib/lecture-anchor.js","lecture-player":"@haxtheweb/video-player/lib/lecture-player.js","video-player":"@haxtheweb/video-player/video-player.js","vocab-term":"@haxtheweb/vocab-term/vocab-term.js","voice-recorder":"@haxtheweb/voice-recorder/voice-recorder.js","wc-registry":"@haxtheweb/wc-autoload/wc-autoload.js","wikipedia-query":"@haxtheweb/wikipedia-query/wikipedia-query.js","word-count":"@haxtheweb/word-count/word-count.js","wysiwyg-hax":"@haxtheweb/wysiwyg-hax/wysiwyg-hax.js","lit-virtualizer":"@lit-labs/virtualizer/lit-virtualizer.js","app-box":"@polymer/app-layout/app-box/app-box.js","app-drawer-layout":"@polymer/app-layout/app-drawer-layout/app-drawer-layout.js","app-drawer":"@polymer/app-layout/app-drawer/app-drawer.js","app-header-layout":"@polymer/app-layout/app-header-layout/app-header-layout.js","app-header":"@polymer/app-layout/app-header/app-header.js","x-container":"@polymer/app-layout/app-scroll-effects/test/x-container.js","app-toolbar":"@polymer/app-layout/app-toolbar/app-toolbar.js","iron-a11y-announcer":"@polymer/iron-a11y-announcer/iron-a11y-announcer.js","iron-a11y-keys":"@polymer/iron-a11y-keys/iron-a11y-keys.js","iron-ajax":"@polymer/iron-ajax/iron-ajax.js","iron-request":"@polymer/iron-ajax/iron-request.js","iron-autogrow-textarea":"@polymer/iron-autogrow-textarea/iron-autogrow-textarea.js","iron-component-page":"@polymer/iron-component-page/iron-component-page.js","demo-snippet":"@polymer/iron-demo-helpers/demo-snippet.js","url-bar":"@polymer/iron-demo-helpers/url-bar.js","iron-doc-api":"@polymer/iron-doc-viewer/iron-doc-api.js","iron-doc-behavior":"@polymer/iron-doc-viewer/iron-doc-behavior.js","iron-doc-class":"@polymer/iron-doc-viewer/iron-doc-class.js","iron-doc-demo":"@polymer/iron-doc-viewer/iron-doc-demo.js","iron-doc-element":"@polymer/iron-doc-viewer/iron-doc-element.js","iron-doc-function":"@polymer/iron-doc-viewer/iron-doc-function.js","iron-doc-hide-bar":"@polymer/iron-doc-viewer/iron-doc-hide-bar.js","iron-doc-mixin":"@polymer/iron-doc-viewer/iron-doc-mixin.js","iron-doc-module":"@polymer/iron-doc-viewer/iron-doc-module.js","iron-doc-namespace":"@polymer/iron-doc-viewer/iron-doc-namespace.js","iron-doc-nav":"@polymer/iron-doc-viewer/iron-doc-nav.js","iron-doc-property":"@polymer/iron-doc-viewer/iron-doc-property.js","iron-doc-summary":"@polymer/iron-doc-viewer/iron-doc-summary.js","iron-doc-viewer":"@polymer/iron-doc-viewer/iron-doc-viewer.js","iron-icon":"@polymer/iron-icon/iron-icon.js","iron-iconset-svg":"@polymer/iron-iconset-svg/iron-iconset-svg.js","iron-image":"@polymer/iron-image/iron-image.js","iron-input":"@polymer/iron-input/iron-input.js","iron-list":"@polymer/iron-list/iron-list.js","iron-location":"@polymer/iron-location/iron-location.js","iron-query-params":"@polymer/iron-location/iron-query-params.js","iron-media-query":"@polymer/iron-media-query/iron-media-query.js","iron-meta":"@polymer/iron-meta/iron-meta.js","iron-overlay-backdrop":"@polymer/iron-overlay-behavior/iron-overlay-backdrop.js","iron-pages":"@polymer/iron-pages/iron-pages.js","x-app":"@polymer/iron-resizable-behavior/demo/src/x-app.js","x-puck":"@polymer/iron-resizable-behavior/demo/src/x-puck.js","iron-selector":"@polymer/iron-selector/iron-selector.js","marked-element":"@polymer/marked-element/marked-element.js","cascaded-animation":"@polymer/neon-animation/animations/cascaded-animation.js","fade-in-animation":"@polymer/neon-animation/animations/fade-in-animation.js","fade-out-animation":"@polymer/neon-animation/animations/fade-out-animation.js","hero-animation":"@polymer/neon-animation/animations/hero-animation.js","opaque-animation":"@polymer/neon-animation/animations/opaque-animation.js","reverse-ripple-animation":"@polymer/neon-animation/animations/reverse-ripple-animation.js","ripple-animation":"@polymer/neon-animation/animations/ripple-animation.js","scale-down-animation":"@polymer/neon-animation/animations/scale-down-animation.js","scale-up-animation":"@polymer/neon-animation/animations/scale-up-animation.js","slide-down-animation":"@polymer/neon-animation/animations/slide-down-animation.js","slide-from-bottom-animation":"@polymer/neon-animation/animations/slide-from-bottom-animation.js","slide-from-left-animation":"@polymer/neon-animation/animations/slide-from-left-animation.js","slide-from-right-animation":"@polymer/neon-animation/animations/slide-from-right-animation.js","slide-from-top-animation":"@polymer/neon-animation/animations/slide-from-top-animation.js","slide-left-animation":"@polymer/neon-animation/animations/slide-left-animation.js","slide-right-animation":"@polymer/neon-animation/animations/slide-right-animation.js","slide-up-animation":"@polymer/neon-animation/animations/slide-up-animation.js","transform-animation":"@polymer/neon-animation/animations/transform-animation.js","x-card":"@polymer/neon-animation/demo/card/x-card.js","x-cards-list":"@polymer/neon-animation/demo/card/x-cards-list.js","my-animatable":"@polymer/neon-animation/demo/doc/my-animatable.js","my-dialog":"@polymer/neon-animation/demo/doc/my-dialog.js","animated-dropdown":"@polymer/neon-animation/demo/dropdown/animated-dropdown.js","animated-grid":"@polymer/neon-animation/demo/load/animated-grid.js","fullsize-page-with-card":"@polymer/neon-animation/demo/grid/fullsize-page-with-card.js","full-view":"@polymer/neon-animation/demo/list/full-view.js","list-demo":"@polymer/neon-animation/demo/list/list-demo.js","list-view":"@polymer/neon-animation/demo/list/list-view.js","full-page":"@polymer/neon-animation/demo/load/full-page.js","circles-page":"@polymer/neon-animation/demo/tiles/circles-page.js","squares-page":"@polymer/neon-animation/demo/tiles/squares-page.js","neon-animatable":"@polymer/neon-animation/neon-animatable.js","neon-animated-pages":"@polymer/neon-animation/neon-animated-pages.js","paper-card":"@polymer/paper-card/paper-card.js","paper-dialog-scrollable":"@polymer/paper-dialog-scrollable/paper-dialog-scrollable.js","paper-dialog":"@polymer/paper-dialog/paper-dialog.js","paper-icon-button-light":"@polymer/paper-icon-button/paper-icon-button-light.js","paper-icon-button":"@polymer/paper-icon-button/paper-icon-button.js","paper-input-char-counter":"@polymer/paper-input/paper-input-char-counter.js","paper-input-container":"@polymer/paper-input/paper-input-container.js","paper-input-error":"@polymer/paper-input/paper-input-error.js","paper-input":"@polymer/paper-input/paper-input.js","paper-textarea":"@polymer/paper-input/paper-textarea.js","paper-icon-item":"@polymer/paper-item/paper-icon-item.js","paper-item-body":"@polymer/paper-item/paper-item-body.js","paper-item":"@polymer/paper-item/paper-item.js","paper-progress":"@polymer/paper-progress/paper-progress.js","paper-ripple":"@polymer/paper-ripple/paper-ripple.js","paper-spinner-lite":"@polymer/paper-spinner/paper-spinner-lite.js","paper-spinner":"@polymer/paper-spinner/paper-spinner.js","paper-toast":"@polymer/paper-toast/paper-toast.js","array-selector":"@polymer/polymer/lib/elements/array-selector.js","custom-style":"@polymer/polymer/lib/elements/custom-style.js","dom-bind":"@polymer/polymer/lib/elements/dom-bind.js","dom-if":"@polymer/polymer/lib/elements/dom-if.js","dom-module":"@polymer/polymer/lib/elements/dom-module.js","dom-repeat":"@polymer/polymer/lib/elements/dom-repeat.js","prism-highlighter":"@polymer/prism-element/prism-highlighter.js","vaadin-button":"@vaadin/vaadin-button/src/vaadin-button.js","vaadin-checkbox-group":"@vaadin/vaadin-checkbox/src/vaadin-checkbox-group.js","vaadin-checkbox":"@vaadin/vaadin-checkbox/src/vaadin-checkbox.js","vaadin-grid-column-group":"@vaadin/vaadin-grid/src/vaadin-grid-column-group.js","vaadin-grid-column":"@vaadin/vaadin-grid/src/vaadin-grid-column.js","vaadin-grid-filter-column":"@vaadin/vaadin-grid/src/vaadin-grid-filter-column.js","vaadin-grid-filter":"@vaadin/vaadin-grid/src/vaadin-grid-filter.js","vaadin-grid-scroller":"@vaadin/vaadin-grid/src/vaadin-grid-scroller.js","vaadin-grid-selection-column":"@vaadin/vaadin-grid/src/vaadin-grid-selection-column.js","vaadin-grid-sort-column":"@vaadin/vaadin-grid/src/vaadin-grid-sort-column.js","vaadin-grid-sorter":"@vaadin/vaadin-grid/src/vaadin-grid-sorter.js","vaadin-grid-templatizer":"@vaadin/vaadin-grid/src/vaadin-grid-templatizer.js","vaadin-grid-tree-column":"@vaadin/vaadin-grid/src/vaadin-grid-tree-column.js","vaadin-grid-tree-toggle":"@vaadin/vaadin-grid/src/vaadin-grid-tree-toggle.js","vaadin-grid":"@vaadin/vaadin-grid/src/vaadin-grid.js","vaadin-lumo-styles":"@vaadin/vaadin-lumo-styles/version.js","vaadin-material-styles":"@vaadin/vaadin-material-styles/version.js","vaadin-progress-bar":"@vaadin/vaadin-progress-bar/src/vaadin-progress-bar.js","vaadin-email-field":"@vaadin/vaadin-text-field/src/vaadin-email-field.js","vaadin-integer-field":"@vaadin/vaadin-text-field/src/vaadin-integer-field.js","vaadin-number-field":"@vaadin/vaadin-text-field/src/vaadin-number-field.js","vaadin-password-field":"@vaadin/vaadin-text-field/src/vaadin-password-field.js","vaadin-text-area":"@vaadin/vaadin-text-field/src/vaadin-text-area.js","vaadin-text-field":"@vaadin/vaadin-text-field/src/vaadin-text-field.js","vaadin-upload-file":"@vaadin/vaadin-upload/src/vaadin-upload-file.js","vaadin-upload":"@vaadin/vaadin-upload/src/vaadin-upload.js","scrollable-component":"scrollable-component/index.js","web-dialog":"web-dialog/web-dialog.js"} \ No newline at end of file +{"focus-trap":"@a11y/focus-trap/focus-trap.js","local-time":"@github/time-elements/dist/local-time-element.js","relative-time":"@github/time-elements/dist/relative-time-element.js","time-ago":"@github/time-elements/dist/time-ago-element.js","time-until":"@github/time-elements/dist/time-until-element.js","model-viewer":"@google/model-viewer/dist/model-viewer.js","a11y-carousel":"@haxtheweb/a11y-carousel/a11y-carousel.js","a11y-carousel-button":"@haxtheweb/a11y-carousel/lib/a11y-carousel-button.js","a11y-collapse":"@haxtheweb/a11y-collapse/a11y-collapse.js","a11y-collapse-group":"@haxtheweb/a11y-collapse/lib/a11y-collapse-group.js","a11y-compare-image":"@haxtheweb/a11y-compare-image/a11y-compare-image.js","a11y-details":"@haxtheweb/a11y-details/a11y-details.js","a11y-figure":"@haxtheweb/a11y-figure/a11y-figure.js","a11y-gif-player":"@haxtheweb/a11y-gif-player/a11y-gif-player.js","a11y-media-player":"@haxtheweb/a11y-media-player/a11y-media-player.js","a11y-media-button":"@haxtheweb/a11y-media-player/lib/a11y-media-button.js","a11y-media-play-button":"@haxtheweb/a11y-media-player/lib/a11y-media-play-button.js","a11y-media-state-manager":"@haxtheweb/a11y-media-player/lib/a11y-media-state-manager.js","a11y-media-transcript-cue":"@haxtheweb/a11y-media-player/lib/a11y-media-transcript-cue.js","a11y-media-youtube":"@haxtheweb/a11y-media-player/lib/a11y-media-youtube.js","a11y-menu-button":"@haxtheweb/a11y-menu-button/a11y-menu-button.js","a11y-menu-button-item":"@haxtheweb/a11y-menu-button/lib/a11y-menu-button-item.js","a11y-tabs":"@haxtheweb/a11y-tabs/a11y-tabs.js","a11y-tab":"@haxtheweb/a11y-tabs/lib/a11y-tab.js","absolute-position-behavior":"@haxtheweb/absolute-position-behavior/absolute-position-behavior.js","absolute-position-state-manager":"@haxtheweb/absolute-position-behavior/lib/absolute-position-state-manager.js","accent-card":"@haxtheweb/accent-card/accent-card.js","aframe-player":"@haxtheweb/aframe-player/aframe-player.js","air-horn":"@haxtheweb/air-horn/air-horn.js","app-hax":"@haxtheweb/app-hax/app-hax.js","app-hax-theme":"@haxtheweb/app-hax/lib/app-hax-theme.js","random-word":"@haxtheweb/app-hax/lib/random-word/random-word.js","rpg-character-toast":"@haxtheweb/app-hax/lib/rpg-character-toast/rpg-character-toast.js","app-hax-button":"@haxtheweb/app-hax/lib/v1/app-hax-button.js","app-hax-hat-progress":"@haxtheweb/app-hax/lib/v1/app-hax-hat-progress.js","app-hax-label":"@haxtheweb/app-hax/lib/v1/app-hax-label.js","app-hax-search-bar":"@haxtheweb/app-hax/lib/v1/app-hax-search-bar.js","app-hax-search-results":"@haxtheweb/app-hax/lib/v1/app-hax-search-results.js","app-hax-site-bar":"@haxtheweb/app-hax/lib/v1/app-hax-site-bar.js","app-hax-site-button":"@haxtheweb/app-hax/lib/v1/app-hax-site-button.js","app-hax-site-details":"@haxtheweb/app-hax/lib/v1/app-hax-site-details.js","app-hax-site-login":"@haxtheweb/app-hax/lib/v1/app-hax-site-login.js","app-hax-steps":"@haxtheweb/app-hax/lib/v1/app-hax-steps.js","app-hax-toast":"@haxtheweb/app-hax/lib/v1/app-hax-toast.js","app-hax-top-bar":"@haxtheweb/app-hax/lib/v1/app-hax-top-bar.js","app-hax-user-menu-button":"@haxtheweb/app-hax/lib/v1/app-hax-user-menu-button.js","app-hax-user-menu":"@haxtheweb/app-hax/lib/v1/app-hax-user-menu.js","app-hax-wired-toggle":"@haxtheweb/app-hax/lib/v1/app-hax-wired-toggle.js","app-hax-backend-api":"@haxtheweb/app-hax/lib/v1/AppHaxBackendAPI.js","app-hax-router":"@haxtheweb/app-hax/lib/v1/AppHaxRouter.js","wired-darkmode-toggle":"@haxtheweb/app-hax/lib/wired-darkmode-toggle/wired-darkmode-toggle.js","audio-player":"@haxtheweb/audio-player/audio-player.js","awesome-explosion":"@haxtheweb/awesome-explosion/awesome-explosion.js","b-r":"@haxtheweb/b-r/b-r.js","barcode-reader":"@haxtheweb/barcode-reader/barcode-reader.js","beaker-broker":"@haxtheweb/beaker-broker/beaker-broker.js","bootstrap-theme":"@haxtheweb/bootstrap-theme/bootstrap-theme.js","bootstrap-breadcrumb":"@haxtheweb/bootstrap-theme/lib/BootstrapBreadcrumb.js","bootstrap-footer":"@haxtheweb/bootstrap-theme/lib/BootstrapFooter.js","bootstrap-search":"@haxtheweb/bootstrap-theme/lib/BootstrapSearch.js","chartist-render":"@haxtheweb/chartist-render/chartist-render.js","chat-agent":"@haxtheweb/chat-agent/chat-agent.js","chat-button":"@haxtheweb/chat-agent/lib/chat-button.js","chat-control-bar":"@haxtheweb/chat-agent/lib/chat-control-bar.js","chat-developer-panel":"@haxtheweb/chat-agent/lib/chat-developer-panel.js","chat-input":"@haxtheweb/chat-agent/lib/chat-input.js","chat-interface":"@haxtheweb/chat-agent/lib/chat-interface.js","chat-message":"@haxtheweb/chat-agent/lib/chat-message.js","chat-suggestion":"@haxtheweb/chat-agent/lib/chat-suggestion.js","check-it-out":"@haxtheweb/check-it-out/check-it-out.js","citation-element":"@haxtheweb/citation-element/citation-element.js","clean-one":"@haxtheweb/clean-one/clean-one.js","clean-one-search-box":"@haxtheweb/clean-one/lib/clean-one-search-box.js","clean-two":"@haxtheweb/clean-two/clean-two.js","cms-hax":"@haxtheweb/cms-hax/cms-hax.js","cms-block":"@haxtheweb/cms-hax/lib/cms-block.js","cms-entity":"@haxtheweb/cms-hax/lib/cms-entity.js","cms-token":"@haxtheweb/cms-hax/lib/cms-token.js","cms-views":"@haxtheweb/cms-hax/lib/cms-views.js","code-editor":"@haxtheweb/code-editor/code-editor.js","code-pen-button":"@haxtheweb/code-editor/lib/code-pen-button.js","monaco-element":"@haxtheweb/code-editor/lib/monaco-element/monaco-element.js","code-sample":"@haxtheweb/code-sample/code-sample.js","collection-list":"@haxtheweb/collection-list/collection-list.js","collection-item":"@haxtheweb/collection-list/lib/collection-item.js","collection-row":"@haxtheweb/collection-list/lib/collection-row.js","collections-theme-banner":"@haxtheweb/collection-list/lib/collections-theme-banner.js","collections-theme":"@haxtheweb/collection-list/lib/collections-theme.js","count-up":"@haxtheweb/count-up/count-up.js","course-design":"@haxtheweb/course-design/course-design.js","activity-box":"@haxtheweb/course-design/lib/activity-box.js","block-quote":"@haxtheweb/course-design/lib/block-quote.js","course-intro-header":"@haxtheweb/course-design/lib/course-intro-header.js","course-intro-lesson-plan":"@haxtheweb/course-design/lib/course-intro-lesson-plan.js","course-intro-lesson-plans":"@haxtheweb/course-design/lib/course-intro-lesson-plans.js","course-intro":"@haxtheweb/course-design/lib/course-intro.js","ebook-button":"@haxtheweb/course-design/lib/ebook-button.js","learning-component":"@haxtheweb/course-design/lib/learning-component.js","lrn-h5p":"@haxtheweb/course-design/lib/lrn-h5p.js","responsive-iframe":"@haxtheweb/course-design/lib/responsive-iframe.js","worksheet-download":"@haxtheweb/course-design/lib/worksheet-download.js","course-model":"@haxtheweb/course-model/course-model.js","model-info":"@haxtheweb/course-model/lib/model-info.js","model-option":"@haxtheweb/course-model/lib/model-option.js","csv-render":"@haxtheweb/csv-render/csv-render.js","d-d-d":"@haxtheweb/d-d-d/d-d-d.js","d-d-docs":"@haxtheweb/d-d-d/lib/d-d-docs.js","ddd-brochure-theme":"@haxtheweb/d-d-d/lib/ddd-brochure-theme.js","mini-map":"@haxtheweb/d-d-d/lib/mini-map.js","data-viz":"@haxtheweb/data-viz/data-viz.js","date-card":"@haxtheweb/date-card/date-card.js","date-chip":"@haxtheweb/date-card/lib/date-chip.js","discord-embed":"@haxtheweb/discord-embed/discord-embed.js","disqus-embed":"@haxtheweb/disqus-embed/disqus-embed.js","haxcms-site-disqus":"@haxtheweb/disqus-embed/lib/haxcms-site-disqus.js","documentation-player":"@haxtheweb/documentation-player/documentation-player.js","dynamic-import-registry":"@haxtheweb/dynamic-import-registry/dynamic-import-registry.js","editable-outline":"@haxtheweb/editable-outline/editable-outline.js","editable-table":"@haxtheweb/editable-table/editable-table.js","editable-table-display":"@haxtheweb/editable-table/lib/editable-table-display.js","editable-table-edit":"@haxtheweb/editable-table/lib/editable-table-edit.js","editable-table-editor-rowcol":"@haxtheweb/editable-table/lib/editable-table-editor-rowcol.js","editable-table-filter":"@haxtheweb/editable-table/lib/editable-table-filter.js","editable-table-sort":"@haxtheweb/editable-table/lib/editable-table-sort.js","elmsln-loading":"@haxtheweb/elmsln-loading/elmsln-loading.js","enhanced-text":"@haxtheweb/enhanced-text/enhanced-text.js","event-badge":"@haxtheweb/event-badge/event-badge.js","example-hax-element":"@haxtheweb/example-hax-element/example-hax-element.js","example-haxcms-theme":"@haxtheweb/example-haxcms-theme/example-haxcms-theme.js","figure-label":"@haxtheweb/figure-label/figure-label.js","file-system-broker":"@haxtheweb/file-system-broker/file-system-broker.js","docx-file-system-broker":"@haxtheweb/file-system-broker/lib/docx-file-system-broker.js","xlsx-file-system-broker":"@haxtheweb/file-system-broker/lib/xlsx-file-system-broker.js","fill-in-the-blanks":"@haxtheweb/fill-in-the-blanks/fill-in-the-blanks.js","flash-card":"@haxtheweb/flash-card/flash-card.js","flash-card-answer-box":"@haxtheweb/flash-card/lib/flash-card-answer-box.js","flash-card-image-prompt":"@haxtheweb/flash-card/lib/flash-card-prompt-img.js","flash-card-set":"@haxtheweb/flash-card/lib/flash-card-set.js","fluid-type":"@haxtheweb/fluid-type/fluid-type.js","full-width-image":"@haxtheweb/full-width-image/full-width-image.js","fullscreen-behaviors":"@haxtheweb/fullscreen-behaviors/fullscreen-behaviors.js","future-terminal-text":"@haxtheweb/future-terminal-text/future-terminal-text.js","future-terminal-text-lite":"@haxtheweb/future-terminal-text/lib/future-terminal-text-lite.js","git-corner":"@haxtheweb/git-corner/git-corner.js","github-preview":"@haxtheweb/github-preview/github-preview.js","wc-markdown":"@haxtheweb/github-preview/lib/wc-markdown.js","grade-book":"@haxtheweb/grade-book/grade-book.js","grade-book-lite":"@haxtheweb/grade-book/lib/grade-book-lite.js","grade-book-pop-up":"@haxtheweb/grade-book/lib/grade-book-pop-up.js","grade-book-store":"@haxtheweb/grade-book/lib/grade-book-store.js","grade-book-student-block":"@haxtheweb/grade-book/lib/grade-book-student-block.js","grade-book-table":"@haxtheweb/grade-book/lib/grade-book-table.js","letter-grade-picker":"@haxtheweb/grade-book/lib/letter-grade-picker.js","letter-grade":"@haxtheweb/grade-book/lib/letter-grade.js","grid-plate":"@haxtheweb/grid-plate/grid-plate.js","h-a-x":"@haxtheweb/h-a-x/h-a-x.js","h5p-element":"@haxtheweb/h5p-element/h5p-element.js","h5p-wrapped-element":"@haxtheweb/h5p-element/lib/h5p-wrapped-element.js","hal-9000":"@haxtheweb/hal-9000/hal-9000.js","hal-9000-ui":"@haxtheweb/hal-9000/lib/hal-9000-ui/hal-9000-ui.js","hax-body":"@haxtheweb/hax-body/hax-body.js","hax-app-picker":"@haxtheweb/hax-body/lib/hax-app-picker.js","hax-app-search":"@haxtheweb/hax-body/lib/hax-app-search.js","hax-app":"@haxtheweb/hax-body/lib/hax-app.js","hax-autoloader":"@haxtheweb/hax-body/lib/hax-autoloader.js","hax-cancel-dialog":"@haxtheweb/hax-body/lib/hax-cancel-dialog.js","hax-context-item-textop":"@haxtheweb/hax-body/lib/hax-context-item-textop.js","hax-context-item":"@haxtheweb/hax-body/lib/hax-context-item.js","hax-element-demo":"@haxtheweb/hax-body/lib/hax-element-demo.js","hax-export-dialog":"@haxtheweb/hax-body/lib/hax-export-dialog.js","hax-gizmo-browser":"@haxtheweb/hax-body/lib/hax-gizmo-browser.js","hax-map":"@haxtheweb/hax-body/lib/hax-map.js","hax-picker":"@haxtheweb/hax-body/lib/hax-picker.js","hax-plate-context":"@haxtheweb/hax-body/lib/hax-plate-context.js","hax-preferences-dialog":"@haxtheweb/hax-body/lib/hax-preferences-dialog.js","hax-stax-browser":"@haxtheweb/hax-body/lib/hax-stax-browser.js","hax-store":"@haxtheweb/hax-body/lib/hax-store.js","hax-text-editor-button":"@haxtheweb/hax-body/lib/hax-text-editor-button.js","hax-text-editor-paste-button":"@haxtheweb/hax-body/lib/hax-text-editor-paste-button.js","hax-text-editor-toolbar":"@haxtheweb/hax-body/lib/hax-text-editor-toolbar.js","hax-text-editor":"@haxtheweb/hax-body/lib/hax-text-editor.js","hax-toolbar-item":"@haxtheweb/hax-body/lib/hax-toolbar-item.js","hax-toolbar-menu":"@haxtheweb/hax-body/lib/hax-toolbar-menu.js","hax-toolbar":"@haxtheweb/hax-body/lib/hax-toolbar.js","hax-tray-button":"@haxtheweb/hax-body/lib/hax-tray-button.js","hax-tray-upload":"@haxtheweb/hax-body/lib/hax-tray-upload.js","hax-tray":"@haxtheweb/hax-body/lib/hax-tray.js","hax-ui-styles":"@haxtheweb/hax-body/lib/hax-ui-styles.js","hax-upload-field":"@haxtheweb/hax-body/lib/hax-upload-field.js","hax-view-source":"@haxtheweb/hax-body/lib/hax-view-source.js","hax-cloud":"@haxtheweb/hax-cloud/hax-cloud.js","hax-logo":"@haxtheweb/hax-logo/hax-logo.js","haxcms-backend-beaker":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-beaker.js","haxcms-backend-demo":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-demo.js","haxcms-backend-nodejs":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-nodejs.js","haxcms-backend-php":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-php.js","haxcms-backend-userfs":"@haxtheweb/haxcms-elements/lib/core/backends/haxcms-backend-userfs.js","haxcms-darkmode-toggle":"@haxtheweb/haxcms-elements/lib/core/haxcms-darkmode-toggle.js","haxcms-editor-builder":"@haxtheweb/haxcms-elements/lib/core/haxcms-editor-builder.js","haxcms-outline-editor-dialog":"@haxtheweb/haxcms-elements/lib/core/haxcms-outline-editor-dialog.js","haxcms-share-dialog":"@haxtheweb/haxcms-elements/lib/core/haxcms-share-dialog.js","haxcms-site-builder":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-builder.js","haxcms-site-dashboard":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-dashboard.js","haxcms-site-editor-ui":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-editor-ui.js","haxcms-site-editor":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-editor.js","haxcms-site-insights":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-insights.js","haxcms-site-router":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-router.js","haxcms-site-store":"@haxtheweb/haxcms-elements/lib/core/haxcms-site-store.js","haxcms-toast":"@haxtheweb/haxcms-elements/lib/core/haxcms-toast.js","haxcms-button-add":"@haxtheweb/haxcms-elements/lib/core/micros/haxcms-button-add.js","haxcms-basic-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-basic-theme.js","haxcms-blank-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-blank-theme.js","haxcms-minimalist-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-minimalist-theme.js","haxcms-print-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-print-theme.js","haxcms-slide-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-slide-theme.js","haxcms-user-theme":"@haxtheweb/haxcms-elements/lib/core/themes/haxcms-user-theme.js","haxcms-page-get-started":"@haxtheweb/haxcms-elements/lib/core/ui/haxcms-page-get-started.js","haxcms-dev-theme":"@haxtheweb/haxcms-elements/lib/development/haxcms-dev-theme.js","haxcms-theme-developer":"@haxtheweb/haxcms-elements/lib/development/haxcms-theme-developer.js","site-active-fields":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-active-fields.js","site-active-tags":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-active-tags.js","site-active-title":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-active-title.js","site-git-corner":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-git-corner.js","site-share-widget":"@haxtheweb/haxcms-elements/lib/ui-components/active-item/site-share-widget.js","site-children-block":"@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-children-block.js","site-outline-block":"@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-outline-block.js","site-recent-content-block":"@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-recent-content-block.js","site-drawer":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-drawer.js","site-footer":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-footer.js","site-modal":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-modal.js","site-region":"@haxtheweb/haxcms-elements/lib/ui-components/layout/site-region.js","active-when-visible":"@haxtheweb/haxcms-elements/lib/ui-components/magic/active-when-visible.js","site-ai-chat":"@haxtheweb/haxcms-elements/lib/ui-components/magic/site-ai-chat.js","site-collection-list":"@haxtheweb/haxcms-elements/lib/ui-components/magic/site-collection-list.js","site-view":"@haxtheweb/haxcms-elements/lib/ui-components/magic/site-view.js","site-breadcrumb":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-breadcrumb.js","site-dot-indicator":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-dot-indicator.js","site-menu-button":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-menu-button.js","site-menu-content":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-menu-content.js","site-menu":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-menu.js","site-top-menu":"@haxtheweb/haxcms-elements/lib/ui-components/navigation/site-top-menu.js","site-query-menu-slice":"@haxtheweb/haxcms-elements/lib/ui-components/query/site-query-menu-slice.js","site-query":"@haxtheweb/haxcms-elements/lib/ui-components/query/site-query.js","site-render-query":"@haxtheweb/haxcms-elements/lib/ui-components/query/site-render-query.js","site-views-route":"@haxtheweb/haxcms-elements/lib/ui-components/routes/site-views-route.js","site-print-button":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-print-button.js","site-remote-content":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-remote-content.js","site-rss-button":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-rss-button.js","site-search":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-search.js","site-title":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-title.js","site-uuid-link":"@haxtheweb/haxcms-elements/lib/ui-components/site/site-uuid-link.js","basic-template":"@haxtheweb/haxcms-elements/lib/ui-components/templates/basic-template.js","minimalist-template":"@haxtheweb/haxcms-elements/lib/ui-components/templates/minimalist-template.js","haxor-slevin":"@haxtheweb/haxor-slevin/haxor-slevin.js","hex-picker":"@haxtheweb/hex-picker/hex-picker.js","hexagon-loader":"@haxtheweb/hexagon-loader/hexagon-loader.js","hex-a-gon":"@haxtheweb/hexagon-loader/lib/hex-a-gon.js","html-block":"@haxtheweb/html-block/html-block.js","i18n-manager":"@haxtheweb/i18n-manager/i18n-manager.js","iframe-loader":"@haxtheweb/iframe-loader/iframe-loader.js","loading-indicator":"@haxtheweb/iframe-loader/lib/loading-indicator.js","image-compare-slider":"@haxtheweb/image-compare-slider/image-compare-slider.js","image-inspector":"@haxtheweb/image-inspector/image-inspector.js","img-pan-zoom":"@haxtheweb/img-pan-zoom/img-pan-zoom.js","img-loader":"@haxtheweb/img-pan-zoom/lib/img-loader.js","img-view-modal":"@haxtheweb/img-view-modal/img-view-modal.js","img-view-viewer":"@haxtheweb/img-view-modal/lib/img-view-viewer.js","inline-audio":"@haxtheweb/inline-audio/inline-audio.js","json-editor":"@haxtheweb/json-editor/json-editor.js","json-outline-schema":"@haxtheweb/json-outline-schema/json-outline-schema.js","jos-render":"@haxtheweb/json-outline-schema/lib/jos-render.js","jwt-login":"@haxtheweb/jwt-login/jwt-login.js","la-tex":"@haxtheweb/la-tex/la-tex.js","lazy-image":"@haxtheweb/lazy-image-helpers/lazy-image-helpers.js","lazy-import-discover":"@haxtheweb/lazy-import-discover/lazy-import-discover.js","learn-two-theme":"@haxtheweb/learn-two-theme/learn-two-theme.js","lesson-overview":"@haxtheweb/lesson-overview/lesson-overview.js","lesson-highlight":"@haxtheweb/lesson-overview/lib/lesson-highlight.js","license-element":"@haxtheweb/license-element/license-element.js","lorem-data":"@haxtheweb/lorem-data/lorem-data.js","lrn-gitgraph":"@haxtheweb/lrn-gitgraph/lrn-gitgraph.js","lrn-math":"@haxtheweb/lrn-math/lrn-math.js","lrn-table":"@haxtheweb/lrn-table/lrn-table.js","lrn-vocab":"@haxtheweb/lrn-vocab/lrn-vocab.js","lrndesign-avatar":"@haxtheweb/lrndesign-avatar/lrndesign-avatar.js","lrndesign-bar":"@haxtheweb/lrndesign-chart/lib/lrndesign-bar.js","lrndesign-line":"@haxtheweb/lrndesign-chart/lib/lrndesign-line.js","lrndesign-pie":"@haxtheweb/lrndesign-chart/lib/lrndesign-pie.js","lrndesign-imagemap-hotspot":"@haxtheweb/lrndesign-imagemap/lib/lrndesign-imagemap-hotspot.js","lrndesign-imagemap":"@haxtheweb/lrndesign-imagemap/lrndesign-imagemap.js","lrndesign-sidenote":"@haxtheweb/lrndesign-sidenote/lrndesign-sidenote.js","lrndesign-timeline":"@haxtheweb/lrndesign-timeline/lrndesign-timeline.js","lrs-bridge-haxcms":"@haxtheweb/lrs-elements/lib/lrs-bridge-haxcms.js","lrs-bridge":"@haxtheweb/lrs-elements/lib/lrs-bridge.js","lrs-emitter":"@haxtheweb/lrs-elements/lib/lrs-emitter.js","lunr-search":"@haxtheweb/lunr-search/lunr-search.js","map-menu-builder":"@haxtheweb/map-menu/lib/map-menu-builder.js","map-menu-container":"@haxtheweb/map-menu/lib/map-menu-container.js","map-menu-header":"@haxtheweb/map-menu/lib/map-menu-header.js","map-menu-item":"@haxtheweb/map-menu/lib/map-menu-item.js","map-menu-submenu":"@haxtheweb/map-menu/lib/map-menu-submenu.js","map-menu":"@haxtheweb/map-menu/map-menu.js","mark-the-words":"@haxtheweb/mark-the-words/mark-the-words.js","matching-question":"@haxtheweb/matching-question/matching-question.js","md-block":"@haxtheweb/md-block/md-block.js","media-image":"@haxtheweb/media-image/media-image.js","media-quote":"@haxtheweb/media-quote/media-quote.js","meme-maker":"@haxtheweb/meme-maker/meme-maker.js","badge-sticker":"@haxtheweb/merit-badge/lib/badge-sticker.js","date-title":"@haxtheweb/merit-badge/lib/date-title.js","locked-badge":"@haxtheweb/merit-badge/lib/locked-badge.js","merit-badge":"@haxtheweb/merit-badge/merit-badge.js","micro-copy-heading":"@haxtheweb/micro-copy-heading/micro-copy-heading.js","micro-frontend-registry":"@haxtheweb/micro-frontend-registry/micro-frontend-registry.js","moar-sarcasm":"@haxtheweb/moar-sarcasm/moar-sarcasm.js","moment-element":"@haxtheweb/moment-element/moment-element.js","confetti-container":"@haxtheweb/multiple-choice/lib/confetti-container.js","short-answer-question":"@haxtheweb/multiple-choice/lib/short-answer-question.js","true-false-question":"@haxtheweb/multiple-choice/lib/true-false-question.js","multiple-choice":"@haxtheweb/multiple-choice/multiple-choice.js","midi-player":"@haxtheweb/music-player/lib/html-midi-player.js","music-player":"@haxtheweb/music-player/music-player.js","mutation-observer-import":"@haxtheweb/mutation-observer-import-mixin/mutation-observer-import-mixin.js","oer-schema":"@haxtheweb/oer-schema/oer-schema.js","opt-img":"@haxtheweb/opt-img/opt-img.js","outline-designer":"@haxtheweb/outline-designer/outline-designer.js","outline-player":"@haxtheweb/outline-player/outline-player.js","page-anchor":"@haxtheweb/page-break/lib/page-anchor.js","page-break-manager":"@haxtheweb/page-break/lib/page-break-manager.js","page-break-outline":"@haxtheweb/page-break/lib/page-break-outline.js","page-break":"@haxtheweb/page-break/page-break.js","page-contents-menu":"@haxtheweb/page-contents-menu/page-contents-menu.js","page-flag-comment":"@haxtheweb/page-flag/lib/page-flag-comment.js","page-flag":"@haxtheweb/page-flag/page-flag.js","page-scroll-position":"@haxtheweb/page-scroll-position/page-scroll-position.js","page-section":"@haxtheweb/page-section/page-section.js","paper-avatar":"@haxtheweb/paper-avatar/paper-avatar.js","paper-input-flagged":"@haxtheweb/paper-input-flagged/paper-input-flagged.js","paper-icon-step":"@haxtheweb/paper-stepper/lib/paper-icon-step.js","paper-icon-stepper":"@haxtheweb/paper-stepper/lib/paper-icon-stepper.js","paper-step":"@haxtheweb/paper-stepper/lib/paper-step.js","paper-stepper":"@haxtheweb/paper-stepper/paper-stepper.js","parallax-image":"@haxtheweb/parallax-image/parallax-image.js","pdf-browser-viewer":"@haxtheweb/pdf-browser-viewer/pdf-browser-viewer.js","person-testimonial":"@haxtheweb/person-testimonial/person-testimonial.js","place-holder":"@haxtheweb/place-holder/place-holder.js","play-list":"@haxtheweb/play-list/play-list.js","polaris-cta":"@haxtheweb/polaris-theme/lib/polaris-cta.js","polaris-invent-theme":"@haxtheweb/polaris-theme/lib/polaris-invent-theme.js","polaris-mark":"@haxtheweb/polaris-theme/lib/polaris-mark.js","polaris-story-card":"@haxtheweb/polaris-theme/lib/polaris-story-card.js","polaris-tile":"@haxtheweb/polaris-theme/lib/polaris-tile.js","polaris-theme":"@haxtheweb/polaris-theme/polaris-theme.js","portal-launcher":"@haxtheweb/portal-launcher/portal-launcher.js","post-card-photo":"@haxtheweb/post-card/lib/PostCardPhoto.js","post-card-postmark":"@haxtheweb/post-card/lib/PostCardPostmark.js","post-card-stamp":"@haxtheweb/post-card/lib/PostCardStamp.js","post-card":"@haxtheweb/post-card/post-card.js","pouch-db":"@haxtheweb/pouch-db/pouch-db.js","course-card":"@haxtheweb/product-card/lib/course-card.js","hax-element-card-list":"@haxtheweb/product-card/lib/hax-element-card-list.js","hax-element-list-selector":"@haxtheweb/product-card/lib/hax-element-list-selector.js","product-banner":"@haxtheweb/product-card/lib/product-banner.js","product-card":"@haxtheweb/product-card/product-card.js","product-glance":"@haxtheweb/product-glance/product-glance.js","product-offering":"@haxtheweb/product-offering/product-offering.js","progress-donut":"@haxtheweb/progress-donut/progress-donut.js","promise-progress-lite":"@haxtheweb/promise-progress/lib/promise-progress-lite.js","wc-preload-progress":"@haxtheweb/promise-progress/lib/wc-preload-progress.js","promise-progress":"@haxtheweb/promise-progress/promise-progress.js","qr-code":"@haxtheweb/q-r/lib/qr-code.js","q-r":"@haxtheweb/q-r/q-r.js","relative-heading-lite":"@haxtheweb/relative-heading/lib/relative-heading-lite.js","relative-heading-state-manager":"@haxtheweb/relative-heading/lib/relative-heading-state-manager.js","relative-heading":"@haxtheweb/relative-heading/relative-heading.js","performance-detect":"@haxtheweb/replace-tag/lib/PerformanceDetect.js","replace-tag":"@haxtheweb/replace-tag/replace-tag.js","responsive-grid-clear":"@haxtheweb/responsive-grid/lib/responsive-grid-clear.js","responsive-grid-col":"@haxtheweb/responsive-grid/lib/responsive-grid-col.js","responsive-grid-row":"@haxtheweb/responsive-grid/lib/responsive-grid-row.js","responsive-utility-element":"@haxtheweb/responsive-utility/lib/responsive-utility-element.js","responsive-utility":"@haxtheweb/responsive-utility/responsive-utility.js","retro-card":"@haxtheweb/retro-card/retro-card.js","rich-text-editor-button":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-button.js","rich-text-editor-emoji-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-emoji-picker.js","rich-text-editor-heading-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-heading-picker.js","rich-text-editor-icon-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-icon-picker.js","rich-text-editor-image":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-image.js","rich-text-editor-link":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-link.js","rich-text-editor-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-picker.js","rich-text-editor-prompt-button":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-prompt-button.js","rich-text-editor-source-code":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-source-code.js","rich-text-editor-symbol-picker":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-symbol-picker.js","rich-text-editor-underline":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-underline.js","rich-text-editor-unlink":"@haxtheweb/rich-text-editor/lib/buttons/rich-text-editor-unlink.js","rich-text-editor-clipboard":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-clipboard.js","rich-text-editor-highlight":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-highlight.js","rich-text-editor-prompt":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-prompt.js","rich-text-editor-source":"@haxtheweb/rich-text-editor/lib/singletons/rich-text-editor-source.js","rich-text-editor-breadcrumbs":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-breadcrumbs.js","rich-text-editor-toolbar-full":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-toolbar-full.js","rich-text-editor-toolbar-mini":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-toolbar-mini.js","rich-text-editor-toolbar":"@haxtheweb/rich-text-editor/lib/toolbars/rich-text-editor-toolbar.js","rich-text-editor":"@haxtheweb/rich-text-editor/rich-text-editor.js","rpg-character":"@haxtheweb/rpg-character/rpg-character.js","runkit-embed":"@haxtheweb/runkit-embed/runkit-embed.js","scroll-button":"@haxtheweb/scroll-button/scroll-button.js","self-check":"@haxtheweb/self-check/self-check.js","shadow-style":"@haxtheweb/shadow-style/shadow-style.js","simple-autocomplete-text-trigger":"@haxtheweb/simple-autocomplete/lib/simple-autocomplete-text-trigger.js","simple-autocomplete":"@haxtheweb/simple-autocomplete/simple-autocomplete.js","simple-blog-card":"@haxtheweb/simple-blog-card/simple-blog-card.js","simple-blog-footer":"@haxtheweb/simple-blog/lib/simple-blog-footer.js","simple-blog-header":"@haxtheweb/simple-blog/lib/simple-blog-header.js","simple-blog-listing":"@haxtheweb/simple-blog/lib/simple-blog-listing.js","simple-blog-overview":"@haxtheweb/simple-blog/lib/simple-blog-overview.js","simple-blog-post":"@haxtheweb/simple-blog/lib/simple-blog-post.js","simple-blog":"@haxtheweb/simple-blog/simple-blog.js","simple-colors-shared-styles":"@haxtheweb/simple-colors-shared-styles/simple-colors-shared-styles.js","simple-colors-swatch-info":"@haxtheweb/simple-colors/lib/demo/simple-colors-swatch-info.js","simple-colors-swatches":"@haxtheweb/simple-colors/lib/demo/simple-colors-swatches.js","simple-colors-picker":"@haxtheweb/simple-colors/lib/simple-colors-picker.js","simple-colors-polymer":"@haxtheweb/simple-colors/lib/simple-colors-polymer.js","simple-colors":"@haxtheweb/simple-colors/simple-colors.js","simple-cta":"@haxtheweb/simple-cta/simple-cta.js","simple-datetime":"@haxtheweb/simple-datetime/simple-datetime.js","simple-emoji":"@haxtheweb/simple-emoji/simple-emoji.js","simple-fields-array-item":"@haxtheweb/simple-fields/lib/simple-fields-array-item.js","simple-fields-array":"@haxtheweb/simple-fields/lib/simple-fields-array.js","simple-fields-code":"@haxtheweb/simple-fields/lib/simple-fields-code.js","simple-fields-combo":"@haxtheweb/simple-fields/lib/simple-fields-combo.js","simple-fields-container":"@haxtheweb/simple-fields/lib/simple-fields-container.js","simple-fields-field":"@haxtheweb/simple-fields/lib/simple-fields-field.js","simple-fields-fieldset":"@haxtheweb/simple-fields/lib/simple-fields-fieldset.js","simple-fields-form-lite":"@haxtheweb/simple-fields/lib/simple-fields-form-lite.js","simple-fields-form":"@haxtheweb/simple-fields/lib/simple-fields-form.js","simple-fields-html-block":"@haxtheweb/simple-fields/lib/simple-fields-html-block.js","simple-fields-lite":"@haxtheweb/simple-fields/lib/simple-fields-lite.js","simple-fields-tab":"@haxtheweb/simple-fields/lib/simple-fields-tab.js","simple-fields-tabs":"@haxtheweb/simple-fields/lib/simple-fields-tabs.js","simple-fields-tag-list":"@haxtheweb/simple-fields/lib/simple-fields-tag-list.js","simple-fields-upload":"@haxtheweb/simple-fields/lib/simple-fields-upload.js","simple-fields-url-combo-item":"@haxtheweb/simple-fields/lib/simple-fields-url-combo-item.js","simple-fields-url-combo":"@haxtheweb/simple-fields/lib/simple-fields-url-combo.js","simple-tag-lite":"@haxtheweb/simple-fields/lib/simple-tag-lite.js","simple-tag":"@haxtheweb/simple-fields/lib/simple-tag.js","simple-tags":"@haxtheweb/simple-fields/lib/simple-tags.js","simple-fields":"@haxtheweb/simple-fields/simple-fields.js","simple-icon-picker":"@haxtheweb/simple-icon-picker/simple-icon-picker.js","simple-icon-button-lite":"@haxtheweb/simple-icon/lib/simple-icon-button-lite.js","simple-icon-button":"@haxtheweb/simple-icon/lib/simple-icon-button.js","simple-icon-lite":"@haxtheweb/simple-icon/lib/simple-icon-lite.js","simple-iconset-demo":"@haxtheweb/simple-icon/lib/simple-iconset-demo.js","simple-iconset":"@haxtheweb/simple-icon/lib/simple-iconset.js","simple-icon":"@haxtheweb/simple-icon/simple-icon.js","simple-img":"@haxtheweb/simple-img/simple-img.js","simple-camera-snap":"@haxtheweb/simple-login/lib/simple-camera-snap.js","simple-login-avatar":"@haxtheweb/simple-login/lib/simple-login-avatar.js","simple-login-camera":"@haxtheweb/simple-login/lib/simple-login-camera.js","simple-login":"@haxtheweb/simple-login/simple-login.js","simple-modal-template":"@haxtheweb/simple-modal/lib/simple-modal-template.js","simple-modal":"@haxtheweb/simple-modal/simple-modal.js","simple-emoji-picker":"@haxtheweb/simple-picker/lib/simple-emoji-picker.js","simple-picker-option":"@haxtheweb/simple-picker/lib/simple-picker-option.js","simple-symbol-picker":"@haxtheweb/simple-picker/lib/simple-symbol-picker.js","simple-picker":"@haxtheweb/simple-picker/simple-picker.js","simple-popover-manager":"@haxtheweb/simple-popover/lib/simple-popover-manager.js","simple-popover-selection":"@haxtheweb/simple-popover/lib/simple-popover-selection.js","simple-tour":"@haxtheweb/simple-popover/lib/simple-tour.js","simple-popover":"@haxtheweb/simple-popover/simple-popover.js","simple-progress":"@haxtheweb/simple-progress/simple-progress.js","simple-range-input":"@haxtheweb/simple-range-input/simple-range-input.js","simple-search-content":"@haxtheweb/simple-search/lib/simple-search-content.js","simple-search-match":"@haxtheweb/simple-search/lib/simple-search-match.js","simple-search":"@haxtheweb/simple-search/simple-search.js","simple-toast-el":"@haxtheweb/simple-toast/lib/simple-toast-el.js","simple-toast":"@haxtheweb/simple-toast/simple-toast.js","simple-button-grid":"@haxtheweb/simple-toolbar/lib/simple-button-grid.js","simple-toolbar-button-group":"@haxtheweb/simple-toolbar/lib/simple-toolbar-button-group.js","simple-toolbar-button":"@haxtheweb/simple-toolbar/lib/simple-toolbar-button.js","simple-toolbar-field":"@haxtheweb/simple-toolbar/lib/simple-toolbar-field.js","simple-toolbar-menu-item":"@haxtheweb/simple-toolbar/lib/simple-toolbar-menu-item.js","simple-toolbar-menu":"@haxtheweb/simple-toolbar/lib/simple-toolbar-menu.js","simple-toolbar-more-button":"@haxtheweb/simple-toolbar/lib/simple-toolbar-more-button.js","simple-toolbar":"@haxtheweb/simple-toolbar/simple-toolbar.js","simple-tooltip":"@haxtheweb/simple-tooltip/simple-tooltip.js","social-share-link":"@haxtheweb/social-share-link/social-share-link.js","sorting-option":"@haxtheweb/sorting-question/lib/sorting-option.js","sorting-question":"@haxtheweb/sorting-question/sorting-question.js","spotify-embed":"@haxtheweb/spotify-embed/spotify-embed.js","star-rating":"@haxtheweb/star-rating/star-rating.js","stop-note":"@haxtheweb/stop-note/stop-note.js","super-daemon-row":"@haxtheweb/super-daemon/lib/super-daemon-row.js","super-daemon-search":"@haxtheweb/super-daemon/lib/super-daemon-search.js","super-daemon-toast":"@haxtheweb/super-daemon/lib/super-daemon-toast.js","super-daemon-ui":"@haxtheweb/super-daemon/lib/super-daemon-ui.js","super-daemon":"@haxtheweb/super-daemon/super-daemon.js","tagging-question":"@haxtheweb/tagging-question/tagging-question.js","terrible-best-themes":"@haxtheweb/terrible-themes/lib/terrible-best-themes.js","terrible-outlet-themes":"@haxtheweb/terrible-themes/lib/terrible-outlet-themes.js","terrible-productionz-themes":"@haxtheweb/terrible-themes/lib/terrible-productionz-themes.js","terrible-resume-themes":"@haxtheweb/terrible-themes/lib/terrible-resume-themes.js","terrible-themes":"@haxtheweb/terrible-themes/terrible-themes.js","training-button":"@haxtheweb/training-theme/lib/training-button.js","training-top":"@haxtheweb/training-theme/lib/training-top.js","training-theme":"@haxtheweb/training-theme/training-theme.js","twitter-embed-vanilla":"@haxtheweb/twitter-embed/lib/twitter-embed-vanilla.js","twitter-embed":"@haxtheweb/twitter-embed/twitter-embed.js","type-writer":"@haxtheweb/type-writer/type-writer.js","undo-manager":"@haxtheweb/undo-manager/undo-manager.js","unity-webgl":"@haxtheweb/unity-webgl/unity-webgl.js","user-action":"@haxtheweb/user-action/user-action.js","user-scaffold":"@haxtheweb/user-scaffold/user-scaffold.js","lecture-anchor":"@haxtheweb/video-player/lib/lecture-anchor.js","lecture-player":"@haxtheweb/video-player/lib/lecture-player.js","video-player":"@haxtheweb/video-player/video-player.js","vocab-term":"@haxtheweb/vocab-term/vocab-term.js","voice-recorder":"@haxtheweb/voice-recorder/voice-recorder.js","wc-registry":"@haxtheweb/wc-autoload/wc-autoload.js","web-container":"@haxtheweb/web-container/web-container.js","wikipedia-query":"@haxtheweb/wikipedia-query/wikipedia-query.js","word-count":"@haxtheweb/word-count/word-count.js","wysiwyg-hax":"@haxtheweb/wysiwyg-hax/wysiwyg-hax.js","lit-virtualizer":"@lit-labs/virtualizer/lit-virtualizer.js","app-box":"@polymer/app-layout/app-box/app-box.js","app-drawer-layout":"@polymer/app-layout/app-drawer-layout/app-drawer-layout.js","app-drawer":"@polymer/app-layout/app-drawer/app-drawer.js","app-header-layout":"@polymer/app-layout/app-header-layout/app-header-layout.js","app-header":"@polymer/app-layout/app-header/app-header.js","x-container":"@polymer/app-layout/app-scroll-effects/test/x-container.js","app-toolbar":"@polymer/app-layout/app-toolbar/app-toolbar.js","iron-a11y-announcer":"@polymer/iron-a11y-announcer/iron-a11y-announcer.js","iron-a11y-keys":"@polymer/iron-a11y-keys/iron-a11y-keys.js","iron-ajax":"@polymer/iron-ajax/iron-ajax.js","iron-request":"@polymer/iron-ajax/iron-request.js","iron-autogrow-textarea":"@polymer/iron-autogrow-textarea/iron-autogrow-textarea.js","iron-component-page":"@polymer/iron-component-page/iron-component-page.js","demo-snippet":"@polymer/iron-demo-helpers/demo-snippet.js","url-bar":"@polymer/iron-demo-helpers/url-bar.js","iron-doc-api":"@polymer/iron-doc-viewer/iron-doc-api.js","iron-doc-behavior":"@polymer/iron-doc-viewer/iron-doc-behavior.js","iron-doc-class":"@polymer/iron-doc-viewer/iron-doc-class.js","iron-doc-demo":"@polymer/iron-doc-viewer/iron-doc-demo.js","iron-doc-element":"@polymer/iron-doc-viewer/iron-doc-element.js","iron-doc-function":"@polymer/iron-doc-viewer/iron-doc-function.js","iron-doc-hide-bar":"@polymer/iron-doc-viewer/iron-doc-hide-bar.js","iron-doc-mixin":"@polymer/iron-doc-viewer/iron-doc-mixin.js","iron-doc-module":"@polymer/iron-doc-viewer/iron-doc-module.js","iron-doc-namespace":"@polymer/iron-doc-viewer/iron-doc-namespace.js","iron-doc-nav":"@polymer/iron-doc-viewer/iron-doc-nav.js","iron-doc-property":"@polymer/iron-doc-viewer/iron-doc-property.js","iron-doc-summary":"@polymer/iron-doc-viewer/iron-doc-summary.js","iron-doc-viewer":"@polymer/iron-doc-viewer/iron-doc-viewer.js","iron-icon":"@polymer/iron-icon/iron-icon.js","iron-iconset-svg":"@polymer/iron-iconset-svg/iron-iconset-svg.js","iron-image":"@polymer/iron-image/iron-image.js","iron-input":"@polymer/iron-input/iron-input.js","iron-list":"@polymer/iron-list/iron-list.js","iron-location":"@polymer/iron-location/iron-location.js","iron-query-params":"@polymer/iron-location/iron-query-params.js","iron-media-query":"@polymer/iron-media-query/iron-media-query.js","iron-meta":"@polymer/iron-meta/iron-meta.js","iron-overlay-backdrop":"@polymer/iron-overlay-behavior/iron-overlay-backdrop.js","iron-pages":"@polymer/iron-pages/iron-pages.js","x-app":"@polymer/iron-resizable-behavior/demo/src/x-app.js","x-puck":"@polymer/iron-resizable-behavior/demo/src/x-puck.js","iron-selector":"@polymer/iron-selector/iron-selector.js","marked-element":"@polymer/marked-element/marked-element.js","cascaded-animation":"@polymer/neon-animation/animations/cascaded-animation.js","fade-in-animation":"@polymer/neon-animation/animations/fade-in-animation.js","fade-out-animation":"@polymer/neon-animation/animations/fade-out-animation.js","hero-animation":"@polymer/neon-animation/animations/hero-animation.js","opaque-animation":"@polymer/neon-animation/animations/opaque-animation.js","reverse-ripple-animation":"@polymer/neon-animation/animations/reverse-ripple-animation.js","ripple-animation":"@polymer/neon-animation/animations/ripple-animation.js","scale-down-animation":"@polymer/neon-animation/animations/scale-down-animation.js","scale-up-animation":"@polymer/neon-animation/animations/scale-up-animation.js","slide-down-animation":"@polymer/neon-animation/animations/slide-down-animation.js","slide-from-bottom-animation":"@polymer/neon-animation/animations/slide-from-bottom-animation.js","slide-from-left-animation":"@polymer/neon-animation/animations/slide-from-left-animation.js","slide-from-right-animation":"@polymer/neon-animation/animations/slide-from-right-animation.js","slide-from-top-animation":"@polymer/neon-animation/animations/slide-from-top-animation.js","slide-left-animation":"@polymer/neon-animation/animations/slide-left-animation.js","slide-right-animation":"@polymer/neon-animation/animations/slide-right-animation.js","slide-up-animation":"@polymer/neon-animation/animations/slide-up-animation.js","transform-animation":"@polymer/neon-animation/animations/transform-animation.js","x-card":"@polymer/neon-animation/demo/card/x-card.js","x-cards-list":"@polymer/neon-animation/demo/card/x-cards-list.js","my-animatable":"@polymer/neon-animation/demo/doc/my-animatable.js","my-dialog":"@polymer/neon-animation/demo/doc/my-dialog.js","animated-dropdown":"@polymer/neon-animation/demo/dropdown/animated-dropdown.js","animated-grid":"@polymer/neon-animation/demo/load/animated-grid.js","fullsize-page-with-card":"@polymer/neon-animation/demo/grid/fullsize-page-with-card.js","full-view":"@polymer/neon-animation/demo/list/full-view.js","list-demo":"@polymer/neon-animation/demo/list/list-demo.js","list-view":"@polymer/neon-animation/demo/list/list-view.js","full-page":"@polymer/neon-animation/demo/load/full-page.js","circles-page":"@polymer/neon-animation/demo/tiles/circles-page.js","squares-page":"@polymer/neon-animation/demo/tiles/squares-page.js","neon-animatable":"@polymer/neon-animation/neon-animatable.js","neon-animated-pages":"@polymer/neon-animation/neon-animated-pages.js","paper-card":"@polymer/paper-card/paper-card.js","paper-dialog-scrollable":"@polymer/paper-dialog-scrollable/paper-dialog-scrollable.js","paper-dialog":"@polymer/paper-dialog/paper-dialog.js","paper-icon-button-light":"@polymer/paper-icon-button/paper-icon-button-light.js","paper-icon-button":"@polymer/paper-icon-button/paper-icon-button.js","paper-input-char-counter":"@polymer/paper-input/paper-input-char-counter.js","paper-input-container":"@polymer/paper-input/paper-input-container.js","paper-input-error":"@polymer/paper-input/paper-input-error.js","paper-input":"@polymer/paper-input/paper-input.js","paper-textarea":"@polymer/paper-input/paper-textarea.js","paper-icon-item":"@polymer/paper-item/paper-icon-item.js","paper-item-body":"@polymer/paper-item/paper-item-body.js","paper-item":"@polymer/paper-item/paper-item.js","paper-progress":"@polymer/paper-progress/paper-progress.js","paper-ripple":"@polymer/paper-ripple/paper-ripple.js","paper-spinner-lite":"@polymer/paper-spinner/paper-spinner-lite.js","paper-spinner":"@polymer/paper-spinner/paper-spinner.js","paper-toast":"@polymer/paper-toast/paper-toast.js","array-selector":"@polymer/polymer/lib/elements/array-selector.js","custom-style":"@polymer/polymer/lib/elements/custom-style.js","dom-bind":"@polymer/polymer/lib/elements/dom-bind.js","dom-if":"@polymer/polymer/lib/elements/dom-if.js","dom-module":"@polymer/polymer/lib/elements/dom-module.js","dom-repeat":"@polymer/polymer/lib/elements/dom-repeat.js","prism-highlighter":"@polymer/prism-element/prism-highlighter.js","vaadin-button":"@vaadin/vaadin-button/src/vaadin-button.js","vaadin-checkbox-group":"@vaadin/vaadin-checkbox/src/vaadin-checkbox-group.js","vaadin-checkbox":"@vaadin/vaadin-checkbox/src/vaadin-checkbox.js","vaadin-grid-column-group":"@vaadin/vaadin-grid/src/vaadin-grid-column-group.js","vaadin-grid-column":"@vaadin/vaadin-grid/src/vaadin-grid-column.js","vaadin-grid-filter-column":"@vaadin/vaadin-grid/src/vaadin-grid-filter-column.js","vaadin-grid-filter":"@vaadin/vaadin-grid/src/vaadin-grid-filter.js","vaadin-grid-scroller":"@vaadin/vaadin-grid/src/vaadin-grid-scroller.js","vaadin-grid-selection-column":"@vaadin/vaadin-grid/src/vaadin-grid-selection-column.js","vaadin-grid-sort-column":"@vaadin/vaadin-grid/src/vaadin-grid-sort-column.js","vaadin-grid-sorter":"@vaadin/vaadin-grid/src/vaadin-grid-sorter.js","vaadin-grid-templatizer":"@vaadin/vaadin-grid/src/vaadin-grid-templatizer.js","vaadin-grid-tree-column":"@vaadin/vaadin-grid/src/vaadin-grid-tree-column.js","vaadin-grid-tree-toggle":"@vaadin/vaadin-grid/src/vaadin-grid-tree-toggle.js","vaadin-grid":"@vaadin/vaadin-grid/src/vaadin-grid.js","vaadin-lumo-styles":"@vaadin/vaadin-lumo-styles/version.js","vaadin-material-styles":"@vaadin/vaadin-material-styles/version.js","vaadin-progress-bar":"@vaadin/vaadin-progress-bar/src/vaadin-progress-bar.js","vaadin-email-field":"@vaadin/vaadin-text-field/src/vaadin-email-field.js","vaadin-integer-field":"@vaadin/vaadin-text-field/src/vaadin-integer-field.js","vaadin-number-field":"@vaadin/vaadin-text-field/src/vaadin-number-field.js","vaadin-password-field":"@vaadin/vaadin-text-field/src/vaadin-password-field.js","vaadin-text-area":"@vaadin/vaadin-text-field/src/vaadin-text-area.js","vaadin-text-field":"@vaadin/vaadin-text-field/src/vaadin-text-field.js","vaadin-upload-file":"@vaadin/vaadin-upload/src/vaadin-upload-file.js","vaadin-upload":"@vaadin/vaadin-upload/src/vaadin-upload.js","scrollable-component":"scrollable-component/index.js","web-dialog":"web-dialog/web-dialog.js"} \ No newline at end of file