diff --git a/css/main.css b/css/main.css index cdd6fa3..c6b3a0b 100644 --- a/css/main.css +++ b/css/main.css @@ -139,3 +139,227 @@ tbody { stroke-dashoffset: -600; } } + +.sidenav { + height: 100%; + width: 0; + position: fixed; + z-index: 30; + top: 0; + right: -1px; + background-color: #000; + border-left: 1px solid #444; + overflow-x: hidden; + padding-top: 60px; + transition: .5s; + font-family: courier-new,courier,monospace; + font-size: 20px; + color: #818181; + opacity: .4 +} + +.sidenav:hover { + opacity: 1 +} + +.sidenav a { + text-decoration: none; + color: #818181; + transition: .3s; + padding: 8px 8px 8px 32px; + overflow-y: hidden; +} + +.sidenav .leftarrow { + float: left; + font-size: 12px; + padding: 2px 0 0 25px +} + +.sidenav .netTraffic .leftarrow { + padding-left: 25px; + color: #4e9a06; +} + +.sidenav .rightarrow { + float: right; + font-size: 12px; + padding: 2px 25px 0 0 +} + +.sidenav .netTraffic .rightarrow{ + padding-right: 35px; + color: #c4a000; +} + +.sidenav .middle { + padding: 0; + text-align: center; + width: 150px; + font-size: 18px; + display: inline-block +} + +.sidenav .title { + width: 240px; + text-align: center; + display: block +} + +.sidenav .title.large { + font-size: 22px; + font-weight: 700 +} + +.sidenav hr { + background-color: #424242; + height: 1px; + border: 0 +} + +.offcanvas a:focus,.sidenav a:hover { + color: #f1f1f1 +} + +.sidenav .closebtn { + position: absolute; + top: -8px; + right: 0; + font-size: 36px; + margin-left: 50px +} + +#main { + transition: margin-left .5s; + padding: 20px +} + +@media screen and (max-height:450px) { + .sidenav { + padding-top: 15px + } + + .sidenav a { + font-size: 18px + } +} + +span.gear { + position: absolute; + top: 0; + z-index: 20; + right: 30px; + color: #ddd; + font-size: 28px; + opacity: .5; + transition: 1s +} + +span.gear:hover { + text-shadow: 0 0 2px #fff; + opacity: 1 +} + +.fileUpload { + position: relative; + overflow: visible; + margin: 10px +} + +.fileUpload.nomargin { + margin: 0 0 0 45px; + position: absolute +} + +.fileUpload input.upload { + position: absolute; + top: 0; + right: 0; + margin: 0; + padding: 0; + font-size: 20px; + cursor: pointer; + opacity: 0; + filter: alpha(opacity=0) +} + +span.tooltiptext { + width: 175px; + background-color: #333; + height: 10px; + text-align: center; + padding: 0 0 10px; + margin-left: 25px; + font-size: 15px; + border-radius: 6px; + position: absolute; + top: 25px; + opacity: 0; + transition: opacity .5s linear +} + +.fileUpload:hover .tooltiptext { + opacity: 1 +} + +.fileUpload.nomargin .tooltiptext { + margin-left: -8px +} + +input[type=number] { + border: 0; + border-bottom: solid 2px #888; + margin-left: 15px; + width: 40px; + transition: border .3s; + background: 0 0; + color: #818181; + text-align: center; + outline: 0; + -moz-appearance: textfield +} + +input[type=number].large { + margin-left: 50px +} + +.fileUpload:hover input[type=number] { + border-bottom: solid 2px #aaa +} + +.sidenav input[type=text] { + border: 0; + border-bottom: solid 2px #888; + margin-left: 20px; + width: 180px; + transition: border .3s; + background: 0 0; + color: #818181; + text-align: center; + outline: 0; + font-family: courier-new, courier, monospace; + font-size: 12px +} + +.fileUpload:hover input[type=text] { + border-bottom: solid 2px #aaa +} + +input::-webkit-inner-spin-button,input::-webkit-outer-spin-button { + -webkit-appearance: none +} + +.hostKeyImg { + width: 235px; + font-size: 14px; + white-space: pre; + text-align: center; + display: block; + font-family: monospace !important; + height: 320px; +} + +.footer { + position: relative; + bottom: 80px; +} diff --git a/css/xterm.css b/css/xterm.css index 68e18fe..7ddcc2d 100644 --- a/css/xterm.css +++ b/css/xterm.css @@ -1,49 +1,41 @@ /** -* xterm.js: xterm, in the browser -* Copyright (c) 2014-2016, SourceLair Private Company (www.sourcelair.com (MIT License) -* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) -* https://github.com/chjj/term.js -* -* 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. -*/ + * 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. + */ -html, body { - overflow: hidden; - overflow: -moz-scrollbars-none; - -ms-overflow-style: none; - background-color: #000; -} - -::-webkit-scrollbar { - display: none -} +/** + * Default styles for xterm.js + */ .xterm { - font-family: courier-new, courier, monospace; font-feature-settings: "liga" 0; position: relative; user-select: none; @@ -63,21 +55,21 @@ html, body { * The z-index of the helpers must be higher than the canvases in order for * IMEs to appear on top. */ - z-index: 10; + z-index: 5; } .xterm .xterm-helper-textarea { - /* - * HACK: to fix IE's blinking cursor - * Move textarea out of the screen to the far left, so that the cursor is not visible. - */ + 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: -10; + z-index: -5; /** Prevent wrapping so the IME appears against the textarea at the correct position */ white-space: nowrap; overflow: hidden; @@ -108,8 +100,6 @@ html, body { left: 0; top: 0; bottom: 0; - - overflow: -moz-scrollbars-none; } .xterm .xterm-screen { @@ -126,242 +116,56 @@ html, body { visibility: hidden; } -.xterm .xterm-char-measure-element { +.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:not(.enable-mouse-events) { +.xterm { cursor: text; } -.sidenav { - height: 100%; - width: 0; - position: fixed; - z-index: 3; - top: 0; - right: -1px; - background-color: #000; - border-left: 1px solid #444; - overflow-x: hidden; - padding-top: 60px; - transition: .5s; - font-family: courier-new,courier,monospace; - font-size: 20px; - color: #818181; - opacity: .4 -} - -.sidenav:hover { - opacity: 1 -} - -.sidenav a { - text-decoration: none; - color: #818181; - transition: .3s; - padding: 8px 8px 8px 32px; - overflow-y: hidden; -} - -.sidenav .leftarrow { - float: left; - font-size: 12px; - padding: 2px 0 0 25px -} - -.sidenav .netTraffic .leftarrow { - padding-left: 25px; - color: #4e9a06; -} - -.sidenav .rightarrow { - float: right; - font-size: 12px; - padding: 2px 25px 0 0 -} - -.sidenav .netTraffic .rightarrow{ - padding-right: 35px; - color: #c4a000; -} - -.sidenav .middle { - padding: 0; - text-align: center; - width: 150px; - font-size: 18px; - display: inline-block -} - -.sidenav .title { - width: 240px; - text-align: center; - display: block -} - -.sidenav .title.large { - font-size: 22px; - font-weight: 700 -} - -.sidenav hr { - background-color: #424242; - height: 1px; - border: 0 -} - -.offcanvas a:focus,.sidenav a:hover { - color: #f1f1f1 -} - -.sidenav .closebtn { - position: absolute; - top: -8px; - right: 0; - font-size: 36px; - margin-left: 50px -} - -#main { - transition: margin-left .5s; - padding: 20px -} - -@media screen and (max-height:450px) { - .sidenav { - padding-top: 15px - } - - .sidenav a { - font-size: 18px - } -} - -span.gear { - position: absolute; - top: 0; - z-index: 1; - right: 5px; - color: #ddd; - font-size: 28px; - opacity: .5; - transition: 1s -} - -span.gear:hover { - text-shadow: 0 0 2px #fff; - opacity: 1 +.xterm.enable-mouse-events { + /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */ + cursor: default; } -.fileUpload { - position: relative; - overflow: visible; - margin: 10px +.xterm.xterm-cursor-pointer { + cursor: pointer; } -.fileUpload.nomargin { - margin: 0 0 0 45px; - position: absolute +.xterm.column-select.focus { + /* Column selection mode */ + cursor: crosshair; } -.fileUpload input.upload { +.xterm .xterm-accessibility, +.xterm .xterm-message { position: absolute; + left: 0; top: 0; + bottom: 0; right: 0; - margin: 0; - padding: 0; - font-size: 20px; - cursor: pointer; - opacity: 0; - filter: alpha(opacity=0) + z-index: 10; + color: transparent; } -span.tooltiptext { - width: 175px; - background-color: #333; - height: 10px; - text-align: center; - padding: 0 0 10px; - margin-left: 25px; - font-size: 15px; - border-radius: 6px; +.xterm .live-region { position: absolute; - top: 25px; - opacity: 0; - transition: opacity .5s linear -} - -.fileUpload:hover .tooltiptext { - opacity: 1 -} - -.fileUpload.nomargin .tooltiptext { - margin-left: -8px -} - -input[type=number] { - border: 0; - border-bottom: solid 2px #888; - margin-left: 15px; - width: 40px; - transition: border .3s; - background: 0 0; - color: #818181; - text-align: center; - outline: 0; - -moz-appearance: textfield -} - -input[type=number].large { - margin-left: 50px -} - -.fileUpload:hover input[type=number] { - border-bottom: solid 2px #aaa -} - -.sidenav input[type=text] { - border: 0; - border-bottom: solid 2px #888; - margin-left: 20px; - width: 180px; - transition: border .3s; - background: 0 0; - color: #818181; - text-align: center; - outline: 0; - font-family: courier-new, courier, monospace; - font-size: 12px -} - -.fileUpload:hover input[type=text] { - border-bottom: solid 2px #aaa -} - -input::-webkit-inner-spin-button,input::-webkit-outer-spin-button { - -webkit-appearance: none + left: -9999px; + width: 1px; + height: 1px; + overflow: hidden; } -.hostKeyImg { - width: 235px; - font-size: 14px; - white-space: pre; - text-align: center; - display: block; - font-family: monospace !important; - height: 320px; +.xterm-dim { + opacity: 0.5; } -.footer { - position: relative; - bottom: 80px; +.xterm-underline { + text-decoration: underline; } diff --git a/fastbuild b/fastbuild new file mode 100755 index 0000000..baff479 --- /dev/null +++ b/fastbuild @@ -0,0 +1,50 @@ +# +# for development reasons I didnt want a minimised set of files to debug, +# so this little script builds the libraries in a fast and unobscure way. +# Does not minify or need a java closure compiler. + +rm -f js/combinedJS.comb.js + +cat \ +js/defines.js \ +js/src/BigInteger.min.js \ +js/src/Hash.min.js \ +js/src/aes.min.js \ +js/src/randomart.js \ +js/src/struct.min.js \ +js/src/utilities.min.js \ +js/dhKex.js \ +js/transport.js \ +js/src/xterm-addon-fit.js \ +js/auth_handler.js \ +js/crypto.js \ +js/message.js \ +js/parceler.js \ +js/rsaKey.js \ +js/src/xterm.js \ +js/settings.js \ +js/SSHyClient.js \ +>> js/combinedJS.comb.js + +rm -f js/combinedLibs.comb.js + +cat \ +js/defines.js \ +js/src/BigInteger.min.js \ +js/src/Hash.min.js \ +js/src/aes.min.js \ +js/src/randomart.js \ +js/src/struct.min.js \ +js/src/utilities.min.js \ +js/dhKex.js \ +js/transport.js \ +js/src/xterm-addon-fit.js \ +js/auth_handler.js \ +js/crypto.js \ +js/message.js \ +js/parceler.js \ +js/rsaKey.js \ +js/src/xterm.js \ +js/settings.js \ +>> js/combinedLibs.comb.js + diff --git a/index.html b/index.html index d02a4c3..8c2361b 100644 --- a/index.html +++ b/index.html @@ -7,10 +7,12 @@ - - - + + + -
+
× Terminal Options diff --git a/js/SSHyClient.js b/js/SSHyClient.js index 3768492..01563f7 100644 --- a/js/SSHyClient.js +++ b/js/SSHyClient.js @@ -6,6 +6,33 @@ - Starts xterm.js and SSHyClient.Transport */ var ws, transport, term = null; +var fitAddon = null; +var wsproxyEncoding = null; + +// Really struggling to encode string as a binary array buffer +// this technique seems to work, but why! +// Adapted from the following +// https://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers +// https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String +// +function ab2str(buf) { + return String.fromCharCode.apply(null, new Uint8Array(buf)); +} + +function str2ab(str) { + var buf = new ArrayBuffer(str.length*1); // 2 bytes for each char + var bufView = new Uint8Array(buf); + for (var i=0, strLen=str.length; i `; - // Apply fit addon - fit.apply(Terminal) - // After the page loads start up the SSH client startSSHy(); }; @@ -93,9 +117,15 @@ window.onbeforeunload = function() { }; // Recalculates the terminal Columns / Rows and sends new size to SSH server + xtermjs function resize() { - if (term) { - term.fit() - } + if (term) { + // Calculate best rows and columns for the div + fitAddon.fit(); + // Let the SSH session know the new size + transport.auth.mod_pty('window-change', term.cols, term.rows); + // Update the side panel + document.getElementById('termCols').value = term.cols; + document.getElementById('termRows').value = term.rows; + } } // Toggles the settings navigator function toggleNav(size){ @@ -115,7 +145,18 @@ function startSSHy() { document.title = "SSHy Client"; // Opens the websocket! - ws = new WebSocket(wsproxyURL, 'base64'); + + if (wsproxyEncoding == 'binary') { + } else { + wsproxyEncoding = 'base64'; + } + + if (wsproxyEncoding == 'binary') { + ws = new WebSocket(wsproxyURL); + ws.binaryType = "arraybuffer"; + } else { + ws = new WebSocket(wsproxyURL, 'base64'); + } // Sets up websocket listeners ws.onopen = function(e) { @@ -130,8 +171,13 @@ function startSSHy() { }; // Send all recieved messages to SSHyClient.Transport.handle() ws.onmessage = function(e) { + if (wsproxyEncoding == 'binary') { + // ArrayBuffer to String + transport.parceler.handle(ab2str(e.data)); + } else { // Convert the recieved data from base64 to a string - transport.parceler.handle(atob(e.data)); + transport.parceler.handle(atob(e.data)); + } }; // Whenever the websocket is closed make sure to display an error if appropriate ws.onclose = function(e) { @@ -153,30 +199,39 @@ function startSSHy() { }; // Just a little abstraction from ws.send ws.sendB64 = function(e){ + if (wsproxyEncoding == 'binary') { + this.send(str2ab(e)); + + transport.parceler.transmitData += e.length; + transport.settings.setNetTraffic(transport.parceler.transmitData, false); + } else { this.send(btoa(e)); transport.parceler.transmitData += e.length; transport.settings.setNetTraffic(transport.parceler.transmitData, false); + } }; } // Initialises xtermjs function termInit() { // Define the terminal rows/cols term = new Terminal({ - cols: 80, - rows: 24 + //cols: 80, + //rows: 24 }); + fitAddon = new FitAddon(); + term.loadAddon(fitAddon); // start xterm.js term.open(document.getElementById('terminal'), true); - term.fit() + fitAddon.fit() term.focus() - // set the terminal size on settings menu document.getElementById('termCols').value = term.cols; document.getElementById('termRows').value = term.rows; // Sets the default colorScheme to material transport.settings.setColorScheme(1); + } // Binds custom listener functions to xtermjs's Terminal object function startxtermjs() { @@ -188,49 +243,82 @@ function startxtermjs() { } // sets up some listeners for the terminal (keydown, paste) - term.textarea.onkeydown = function(e) { + term.onData((data) => { + if (!ws || !transport || !transport.auth.authenticated) { + // If no connection dont send, and unauthenticated connections handled + // elsewhere + return; + } + if (data.length > 5000) { + // Apparently long strings kill SSHyClient.parceler, although it is + // probably best to sort that there rather than here... + var blocks; + blocks = splitSlice(data); + //console.log("ondata length ",blocks.length); + for (var i = 0; i < blocks.length; i++) { + //console.log("ondata block ",i,blocks[i].charCodeAt(0)) + transport.expect_key(blocks[i]); + } + } else { + //console.log("ondata ",data.charCodeAt(0), data.substr(1)) + transport.expect_key(data); + } + }); + term.attachCustomKeyEventHandler(e=> { // Sanity Checks + if (e.type != 'keydown') {return;} + + // If websocket is closed, ran out of attempts to authenticate, or just + // waiting to confirm the username and password, dont forward keys if (!ws || !transport || transport.auth.failedAttempts >= 5 || transport.auth.awaitingAuthentication) { - return; + return false; } - var pressedKey /** IE isn't very good so it displays one character keys as full names in .key EG - e.key = " " to e.key = "Spacebar" so assuming .char is one character we'll use that instead **/ - if (e.char && e.char.length == 1) { - pressedKey = e.char; - } else { - pressedKey = e.key - } - - // So we don't spam single control characters - if (pressedKey.length > 1 && (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) && pressedKey != "Backspace") { - return; + if (e.char && e.char.length == 1) { + pressedKey = e.char; + } else { + pressedKey = e.key } - if (!transport.auth.authenticated) { - // Other clients doesn't allow control characters during authentication - if (e.altKey || e.ctrlKey || e.metaKey) { - return; + if (pressedKey.length == 1 && (e.shiftKey && e.ctrlKey)) { + // allows ctrl + shift + v for pasting + // and dont forward those keys to the terminal + if (e.key == 'V') { + return false; } + } - // so we can't input stuff like 'ArrowUp' - if(pressedKey.length > 1 && (e.keyCode != 13 && e.keyCode != 8)){ - return; - } + // onData does the majority of sending keys for transport + if (transport.auth.authenticated) { + return; + } + // Not yet authenticated + + // For usernames and passwords only named keys Delete and Enter is ok + // so we can't input stuff like 'ArrowUp' + if ((pressedKey.length > 1) && (e.keyCode != 13 && e.keyCode != 8)){ + return; + } + // Other clients doesn't allow control characters during authentication + if (e.altKey || e.ctrlKey || e.metaKey) { + return; + } /* while termPassword is undefined, add all input to termUsername when it becomes defined then change targets to transport.auth.termPassword */ switch (e.keyCode) { case 8: // backspace if (transport.auth.termPassword === undefined) { if (transport.auth.termUsername.length > 0) { - termBackspace(term) + term.write("\b \b"); transport.auth.termUsername = transport.auth.termUsername.slice(0, transport.auth.termUsername.length - 1); } } else { transport.auth.termPassword = transport.auth.termPassword.slice(0, transport.auth.termPassword.length - 1); } + return false; break; case 13: // enter if (transport.auth.termPassword === undefined) { @@ -239,8 +327,8 @@ function startxtermjs() { } else { term.write('\n\r'); transport.auth.ssh_connection(); - return; } + return false; break; default: if (transport.auth.termPassword === undefined) { @@ -250,62 +338,6 @@ function startxtermjs() { transport.auth.termPassword += pressedKey; } } - return; - } - - // We've already authenticated so now any keypress is a command for the SSH server - var command; - - // Decides if the keypress is an alphanumeric character or needs escaping - if (pressedKey.length == 1 && (!(e.altKey || e.ctrlKey || e.metaKey) || (e.altKey && e.ctrlKey))) { - command = pressedKey; - } else if (pressedKey.length == 1 && (e.shiftKey && e.ctrlKey)) { - // allows ctrl + shift + v for pasting - if (e.key != 'V') { - e.preventDefault(); - return; - } - } else { - //xtermjs is kind enough to evaluate our special characters instead of having to translate every char ourself - command = term._evaluateKeyEscapeSequence(e).key; - } - - // Decide if we're going to locally' echo this key or not - if (transport.settings.localEcho) { - transport.settings.parseKey(e); - } - /* Regardless of local echo we still want a reply to confirm / update terminal - could be controversial? but putty does this too (each key press shows up twice) - Instead we're checking the our locally echoed key and replacing it if the - recieved key !== locally echoed key */ - return command === null ? null : transport.expect_key(command); - }; - - term.textarea.onpaste = function(ev) { - var text - - // Yay IE11 stuff! - if ( window.clipboardData && window.clipboardData.getData ) { - text = window.clipboardData.getData('Text') - } else if ( ev.clipboardData && ev.clipboardData.getData ) { - text = ev.clipboardData.getData('text/plain'); - } - - if (text) { - // Just don't allow more than 1 million characters to be pasted. - if(text.length < 1000000){ - if (text.length > 5000) { - // If its a long string then chunk it down to reduce load on SSHyClient.parceler - text = splitSlice(text); - for (var i = 0; i < text.length; i++) { - transport.expect_key(text[i]); - } - return; - } - transport.expect_key(text); - } else { - alert('Error: Pasting large strings is not permitted.'); - } - } - }; + return false; + }); } diff --git a/js/combinedJS.comb.js b/js/combinedJS.comb.js index 4a30daf..e6d8b33 100644 --- a/js/combinedJS.comb.js +++ b/js/combinedJS.comb.js @@ -1,400 +1,3334 @@ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,a,h){b!=Array.prototype&&b!=Object.prototype&&(b[a]=h.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this); -$jscomp.polyfill=function(b,a,h,d){if(a){h=$jscomp.global;b=b.split(".");for(d=0;d>>24]<<24^f[k>>16&255]<<16^f[k>>8&255]<<8^f[k&255],0===b%a&&(k=k<<8^k>>>24^l<<24,l=l<<1^283*(l>>7));h[b]=h[b-a]^k}for(a=0;b;a++,b--)k=h[a&3?b:b-4],d[a]=4>=b||4>a?k:m[0][f[k>>>24]]^m[1][f[k>>16&255]]^m[2][f[k>> -8&255]]^m[3][f[k&255]]};sjcl.cipher.aes.MODE_CBC=2;sjcl.cipher.aes.MODE_CTR=6; -sjcl.cipher.aes.prototype={encrypt:function(b,a,h){a=this.mode==sjcl.cipher.aes.MODE_CBC?a:[];for(var d=[],f=0;fl;l++)m[l]^=a[l];a=sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(m),0))}else for(a=sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(toByteArray(h.increment())),0)),l=0;16>l;l++)a[l]^=m[l];d=d.concat(a)}return d},decrypt:function(b,a){for(var h=[],d=0;dm;m++)ct[m]^=a[m];a=f}h=h.concat(ct)}return h},_tables:[[[],[],[],[],[]],[[],[],[],[],[]]],_precompute:function(){var b=this._tables[0],a=this._tables[1],h=b[4],d=a[4],f,m,l,k=[],e=[],g;for(f=0;256>f;f++)e[(k[f]=f<<1^283*(f>>7))^f]=f;for(m=l=0;!h[m];m^=g||1,l=e[l]||1){var c=l^l<<1^l<<2^l<<3^l<<4;c=c>>8^c&255^99;h[m]=c;d[c]=m;var n=k[f= -k[g=k[m]]];var p=16843009*n^65537*f^257*g^16843008*m;n=257*k[c]^16843008*c;for(f=0;4>f;f++)b[f][m]=n=n<<24^n>>>8,a[f][c]=p=p<<24^p>>>8}for(f=0;5>f;f++)b[f]=b[f].slice(0),a[f]=a[f].slice(0)},_crypt:function(b,a){if(4!==b.length)throw"invalid aes block size";var h=this._key[a],d=b[0]^h[0],f=b[a?3:1]^h[1],m=b[2]^h[2];b=b[a?1:3]^h[3];var l=h.length/4-2,k,e=4,g=[0,0,0,0];var c=this._tables[a];var n=c[0],p=c[1],q=c[2],r=c[3],t=c[4];for(k=0;k>>24]^p[f>>16&255]^q[m>>8&255]^r[b&255]^h[e];var y= -n[f>>>24]^p[m>>16&255]^q[b>>8&255]^r[d&255]^h[e+1];var v=n[m>>>24]^p[b>>16&255]^q[d>>8&255]^r[f&255]^h[e+2];b=n[b>>>24]^p[d>>16&255]^q[f>>8&255]^r[m&255]^h[e+3];e+=4;d=c;f=y;m=v}for(k=0;4>k;k++)g[a?3&-k:k]=t[d>>>24]<<24^t[f>>16&255]<<16^t[m>>8&255]<<8^t[b&255]^h[e++],c=d,d=f,f=m,m=b,b=c;return g}};sjcl.codec={}; -sjcl.codec.bytes={fromBits:function(b){var a=[],h=sjcl.bitArray.bitLength(b),d,f;for(d=0;d>>24),f<<=8;return a},toBits:function(b){var a=[],h,d=0;for(h=0;h>=15;0<=--g;){var u=this[b]&32767,n=this[b++]>>15,d=a*u+n*k;u=k*u+((d&32767)<<15)+c[e]+(l&1073741823);l=(u>>>30)+(d>>>15)+a*n+(l>>>30);c[e++]= -u&1073741823}return l}function f(b,a,c,e,l,k){var g=a&16383;for(a>>=14;0<=--k;){var u=this[b]&16383,n=this[b++]>>14,d=a*u+n*g;u=g*u+((d&16383)<<14)+c[e]+l;l=(u>>28)+(d>>14)+a*n;c[e++]=u&268435455}return l}function m(b,a){b=C[b.charCodeAt(a)];return null==b?-1:b}function l(b){var c=a();c.fromInt(b);return c}function k(b){var a=1,c;0!=(c=b>>>16)&&(b=c,a+=16);0!=(c=b>>8)&&(b=c,a+=8);0!=(c=b>>4)&&(b=c,a+=4);0!=(c=b>>2)&&(b=c,a+=2);0!=b>>1&&(a+=1);return a}function e(b){this.m=b}function g(b){this.m=b; -this.mp=b.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=z;++z)C[v++]=z;v=97;for(z=10;36>z;++z)C[v++]=z;v=65;for(z=10;36>z;++z)C[v++]=z;e.prototype.convert=function(b){return 0>b.s||0<=b.compareTo(this.m)?b.mod(this.m):b};e.prototype.revert=function(b){return b};e.prototype.reduce=function(b){b.divRemTo(this.m,null,b)};e.prototype.mulTo=function(b,a,c){b.multiplyTo(a,c);this.reduce(c)};e.prototype.sqrTo= -function(b,a){b.squareTo(a);this.reduce(a)};g.prototype.convert=function(c){var e=a();c.abs().dlShiftTo(this.m.t,e);e.divRemTo(this.m,null,e);0>c.s&&0>15)*this.mpl&this.um)<<15)&b.DM;c=a+this.m.t;for(b[c]+=this.m.am(0,e,b,a,0,this.m.t);b[c]>= -b.DV;)b[c]-=b.DV,b[++c]++}b.clamp();b.drShiftTo(this.m.t,b);0<=b.compareTo(this.m)&&b.subTo(this.m,b)};g.prototype.mulTo=function(b,a,c){b.multiplyTo(a,c);this.reduce(c)};g.prototype.sqrTo=function(b,a){b.squareTo(a);this.reduce(a)};b.prototype.copyTo=function(b){for(var a=this.t-1;0<=a;--a)b[a]=this[a];b.t=this.t;b.s=this.s};b.prototype.fromInt=function(b){this.t=1;this.s=0>b?-1:0;0b?this[0]=b+DV:this.t=0};b.prototype.fromString=function(a,c){if(16==c)c=4;else if(8==c)c=3;else if(256== -c)c=8;else if(2==c)c=1;else if(32==c)c=5;else if(4==c)c=2;else{this.fromRadix(a,c);return}this.s=this.t=0;for(var e=a.length,l=!1,g=0;0<=--e;){var k=8==c?a[e]&255:m(a,e);0>k?"-"==a.charAt(e)&&(l=!0):(l=!1,0==g?this[this.t++]=k:g+c>this.DB?(this[this.t-1]|=(k&(1<>this.DB-g):this[this.t-1]|=k<=this.DB&&(g-=this.DB))}8==c&&0!=(a[0]&128)&&(this.s=-1,0>e|g,g=(this[k]&l)<=this.t)a.t=0;else{b%=this.DB;var e=this.DB-b,l=(1<>b;for(var g=c+1;g>b;0>=this.DB;if(b.t>=this.DB;e+=this.s}else{for(e+=this.s;c>=this.DB;e-=b.s}a.s=0>e?-1:0;-1>e?a[c++]=this.DV+e:0=a.DV&&(b[c+a.t]-=a.DV,b[c+a.t+1]=1)}0=l.t)){var n=this.abs();if(n.t>this.F2:0),h=this.FV/p;p=(1<< -this.F1)/p;var u=1<f&&b.ZERO.subTo(g,g)}}}};b.prototype.invDigit=function(){if(1>this.t)return 0; -var b=this[0];if(0==(b&1))return 0;var a=b&3;a=a*(2-(b&15)*a)&15;a=a*(2-(b&255)*a)&255;a=a*(2-((b&65535)*a&65535))&65535;a=a*(2-b*a%this.DV)%this.DV;return 0c)return b.ONE;var g=a(),l=a(),n=e.convert(this),d=k(c)-1;for(n.copyTo(g);0<=--d;)if(e.sqrTo(g,l),0<(c&1<this.s)return"-"+ -this.negate().toString(b);if(16==b)b=4;else if(8==b)b=3;else if(2==b)b=1;else if(32==b)b=5;else if(4==b)b=2;else return this.toRadix(b);var a=(1<>k)&&(e=!0,g="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=l;)k>(k+=this.DB-b)):(c=this[l]>>(k-=b)&a,0>=k&&(k+=this.DB,--l)),0this.s?this.negate():this};b.prototype.compareTo=function(b){var a=this.s-b.s;if(0!=a)return a;var c=this.t;a=c-b.t;if(0!=a)return a;for(;0<=--c;)if(0!=(a=this[c]-b[c]))return a;return 0};b.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+k(this[this.t-1]^this.s&this.DM)};b.prototype.mod=function(c){var e=a();this.abs().divRemTo(c,null,e);0>this.s&&0b||a.isEven()?new e(a):new g(a);return this.exp(b,a)};b.ZERO=l(0);b.ONE=l(1);r.prototype.convert=t;r.prototype.revert=t;r.prototype.mulTo=function(b,a,c){b.multiplyTo(a,c)};r.prototype.sqrTo=function(b,a){b.squareTo(a)};y.prototype.convert=function(b){if(0>b.s||b.t>2*this.m.t)return b.mod(this.m);if(0>b.compareTo(this.m))return b;var c=a();b.copyTo(c);this.reduce(c);return c};y.prototype.revert=function(b){return b};y.prototype.reduce=function(b){b.drShiftTo(this.m.t- -1,this.r2);b.t>this.m.t+1&&(b.t=this.m.t+1,b.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>b.compareTo(this.r2);)b.dAddOffset(1,this.m.t+1);for(b.subTo(this.r2,b);0<=b.compareTo(this.m);)b.subTo(this.m,b)};y.prototype.mulTo=function(b,a,c){b.multiplyTo(a,c);this.reduce(c)};y.prototype.sqrTo=function(b,a){b.squareTo(a);this.reduce(a)};var x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109, -113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],B=67108864/x[x.length-1];b.prototype.chunkSize=function(b){return Math.floor(Math.LN2*this.DB/Math.log(b))};b.prototype.toRadix=function(b){null==b&&(b=10);if(0==this.signum()||2>b||36f?"-"==a.charAt(d)&&0==this.signum()&&(l=!0):(n=c*n+f,++k>=e&&(this.dMultiply(g),this.dAddOffset(n,0),n=k=0))}0a)this.fromInt(1);else for(this.fromNumber(a,e),this.testBit(a-1)||this.bitwiseTo(b.ONE.shiftLeft(a-1),n,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(b.ONE.shiftLeft(a-1),this);else{e=[];var g=a&7;e.length=(a>>3)+1;c.nextBytes(e);e[0]=0>=this.DB;if(b.t>=this.DB;e+=this.s}else{for(e+= -this.s;c>=this.DB;e+=b.s}a.s=0>e?-1:0;0e&&(a[c++]=this.DV+e);a.t=c;a.clamp()};b.prototype.dMultiply=function(b){this[this.t]=this.am(0,b-1,this,0,0,this.t);++this.t;this.clamp()};b.prototype.dAddOffset=function(b,a){if(0!=b){for(;this.t<=a;)this[this.t++]=0;for(this[a]+=b;this[a]>=this.DV;)this[a]-=this.DV,++a>=this.t&&(this[this.t++]=0),++this[a]}};b.prototype.multiplyLowerTo=function(b,a,c){var e=Math.min(this.t+b.t,a);c.s=0;for(c.t=e;0=b)return 0;var a=this.DV%b,c=0>this.s?b-1:0;if(0=g)return!1;var l=e.shiftRight(g);c=c+1>>1;c>x.length&&(c=x.length);for(var k=a(),n=0;nthis.s){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24};b.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16};b.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};b.prototype.toByteArray=function(){var b=this.t,a=[];a[0]=this.s;var c=this.DB- -b*this.DB%8,e,g=0;if(0>c)!=(this.s&this.DM)>>c&&(a[g++]=e|this.s<c?(e=(this[b]&(1<>(c+=this.DB-8)):(e=this[b]>>(c-=8)&255,0>=c&&(c+=this.DB,--b)),0!=(e&128)&&(e|=-256),0==g&&(this.s&128)!=(e&128)&&++g,0this.compareTo(b)?this:b};b.prototype.max=function(b){return 0b?this.rShiftTo(-b,c):this.lShiftTo(b,c);return c};b.prototype.shiftRight=function(b){var c= -a();0>b?this.lShiftTo(-b,c):this.rShiftTo(b,c);return c};b.prototype.getLowestSetBit=function(){for(var b=0;b>=16,c+=16);0==(b&255)&&(b>>=8,c+=8);0==(b&15)&&(b>>=4,c+=4);0==(b&3)&&(b>>=2,c+=2);0==(b&1)&&++c;b=c}return a+b}return 0>this.s?this.t*this.DB:-1};b.prototype.bitCount=function(){for(var b=0,a=this.s&this.DM,c=0;c=this.t?0!=this.s:0!=(this[a]&1<=n)return d;var f=18>n?1:48>n?3:144>n?4:768>n?5:6;c=8>n?new e(c):c.isEven()?new y(c):new g(c);var m=[],p=3,h=f-1,r=(1<=h?t=b[q]>>n-h&r:(t=(b[q]&(1<>this.DB+n-h));for(p=f;0==(t&1);)t>>=1,--p;0>(n-=p)&&(n+=this.DB,--q);if(v)m[t].copyTo(d),v=!1;else{for(;1--n&&(n=this.DB-1,--q)}return c.revert(d)};b.prototype.modInverse=function(c){var a=c.isEven();if(this.isEven()&&a||0==c.signum())return b.ZERO;for(var e= -c.clone(),g=this.clone(),k=l(1),n=l(0),d=l(0),f=l(1);0!=e.signum();){for(;e.isEven();)e.rShiftTo(1,e),a?(k.isEven()&&n.isEven()||(k.addTo(this,k),n.subTo(c,n)),k.rShiftTo(1,k)):n.isEven()||n.subTo(c,n),n.rShiftTo(1,n);for(;g.isEven();)g.rShiftTo(1,g),a?(d.isEven()&&f.isEven()||(d.addTo(this,d),f.subTo(c,f)),d.rShiftTo(1,d)):f.isEven()||f.subTo(c,f),f.rShiftTo(1,f);0<=e.compareTo(g)?(e.subTo(g,e),a&&k.subTo(d,k),n.subTo(f,n)):(g.subTo(e,g),a&&d.subTo(k,d),f.subTo(n,f))}if(0!=g.compareTo(b.ONE))return b.ZERO; -if(0<=f.compareTo(c))return f.subtract(c);if(0>f.signum())f.addTo(c,f);else return f;return 0>f.signum()?f.add(c):f};b.prototype.pow=function(b){return this.exp(b,new r)};b.prototype.gcd=function(b){var c=0>this.s?this.negate():this.clone();b=0>b.s?b.negate():b.clone();if(0>c.compareTo(b)){var a=c;c=b;b=a}a=c.getLowestSetBit();var e=b.getLowestSetBit();if(0>e)return c;a>5]|=128<<24-h%32;a[(h+64>>>9<<4)+15]=h;for(h=0;hq;q++){if(16>q)b[q]=a[h+q];else{var r=b[q-3]^b[q-8]^b[q-14]^b[q-16];b[q]=r<<1|r>>>31}r=(d<<5|d>>>27)+k+(b[q]>>>0)+(20>q?(f&m|~f&l)+1518500249:40>q?(f^m^l)+1859775393:60>q?(f&m|f&l|m&l)-1894007588:(f^m^l)-899497514); -k=l;l=m;m=f<<30|f>>>2;f=d;d=r}d+=e;f+=g;m+=c;l+=n;k+=p}return fromByteArray(wordsToBytes([d,f,m,l,k]))}};SSHyClient.hash.SHA256=function(b){this.data=b||"";this.digest_size=32}; -SSHyClient.hash.SHA256.prototype={digest:function(){var b=toByteArray(this.data),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, -2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],h=bytesToWords(b),d=8*b.length;b=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];var f=[],m,l;h[d>>5]|=128<<24-d%32;h[(d+64>>9<<4)+15]=d;for(m=0;ml;l++){if(16>l)f[l]=h[l+m];else{var r=f[l-15];var t=f[l-2];f[l]=((r<<25|r>>>7)^(r<<14|r>>>18)^r>>>3)+(f[l-7]>>>0)+((t<<15|t>>>17)^(t<<13|t>>>19)^t>>>10)+(f[l-16]>>>0)}t=d&k^d&e^k&e;var y=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22);r=(q>>>0)+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&n^~c&p)+a[l]+(f[l]>>>0);t=y+t;q=p;p=n;n=c;c=g+r>>>0;g=e;e=k;k=d;d=r+t>>>0}b[0]+=d;b[1]+=k;b[2]+=e;b[3]+=g;b[4]+=c;b[5]+=n;b[6]+=p;b[7]+=q}return fromByteArray(wordsToBytes(b))}}; -SSHyClient.hash.HMAC=function(b,a,h){h=digestmod="SHA-1"==h?SSHyClient.hash.SHA1:SSHyClient.hash.SHA256;var d=new h,f=new h;64m;++m)h[m]^=92,b[m]^=54;d.data+=fromByteArray(h);f.data+=fromByteArray(b);f.data+=a;d.data+=f.digest();return d.digest()}; -SSHyClient.hash.MD5=function(b){var a=toByteArray(b);b=bytesToWords(a);var h=8*a.length;a=1732584193;for(var d=-271733879,f=-1732584194,m=271733878,l=0;l>>24)&16711935|(b[l]<<24|b[l]>>>8)&4278255360;b[h>>>5]|=128<>>9<<4)+14]=h;h=function(b,c,a,e,g,l,k){b=b+(c&a|~c&e)+(g>>>0)+k;return(b<>>32-l)+c};var k=function(b,c,a,e,g,l,k){b=b+(c&e|a&~e)+(g>>>0)+k;return(b<>>32-l)+c},e=function(b,c,a,e,g,l,k){b=b+(c^a^e)+(g>>>0)+k;return(b<>>32-l)+c}, -g=function(b,c,a,e,g,l,k){b=b+(a^(c|~e))+(g>>>0)+k;return(b<>>32-l)+c};for(l=0;l>>0;d=d+n>>>0;f=f+p>>>0;m=m+q>>>0}var r=function(b){if(b.constructor==Number)return(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;for(var c=0;cf;f+=2){var l=b>>f&3;switch(l){case 0:case 1:0>>24&255), -h+=String.fromCharCode(a>>>16&255),h+=String.fromCharCode(a>>>8&255);case "B":h+=String.fromCharCode(a&255)}return h},unpack:function(b,a){var h=[],d=0,f=0;switch(b){case "Q":f=new BigInteger("0",10);f=f.add((new BigInteger(a.charCodeAt(0).toString(),10)).shiftLeft(56));f=f.add((new BigInteger(a.charCodeAt(1).toString(),10)).shiftLeft(48));f=f.add((new BigInteger(a.charCodeAt(2).toString(),10)).shiftLeft(40));f=f.add((new BigInteger(a.charCodeAt(3).toString(),10)).shiftLeft(32));f=f.add((new BigInteger(a.charCodeAt(4).toString(), -10)).shiftLeft(24));f=f.add((new BigInteger(a.charCodeAt(5).toString(),10)).shiftLeft(16));f=f.add((new BigInteger(a.charCodeAt(6).toString(),10)).shiftLeft(8));f=f.add((new BigInteger(a.charCodeAt(7).toString(),10)).shiftLeft(0));h.push(f);break;case "I":f+=a.charCodeAt(0)<<24>>>0,f+=a.charCodeAt(1)<<16>>>0,f+=a.charCodeAt(2)<<8>>>0,d+=3;case "B":f+=a.charCodeAt(0+d)<<0>>>0,h.push(f)}return h}};function inflate_long(b){var a=new BigInteger("0",10);b.length%4&&(b=Array(4-b.length%4+1).join("\x00")+b);for(var h=0;hh.charCodeAt(0)&&(h="\u00ff"+h));return h}function toByteArray(b){for(var a=new Uint8Array(b.length),h=0;h>>5]|=(b[h]&255)<<24-d%32;return a}function wordsToBytes(b){for(var a=[],h=0;h<32*b.length;h+=8)a.push(b[h>>>5]>>>24-h%32&255);return a} -function setCharAt(b,a,h){return b.substring(0,a)+h+b.substring(a+1)}function fromUtf8(b){for(var a="",h=toByteArray(b),d=0;d=f){var m=h[++d];f=(f&31)<<6|m&63}else if(224<=f&&239>=f){m=h[++d];var l=h[++d];f=(f&15)<<12|(m&63)<<6|l&63}else 128<=f&&(f=".");a+=String.fromCharCode(f)}return a}function read_rng(b){return String.fromCharCode.apply(null,window.crypto.getRandomValues(new Uint8Array(b)))} -function filter(b,a){b=b.split(",");for(var h=0;ha?0:255;a=0>a?-1*a:a;var d=h>>16,f=h>>8&255;h&=255;return"#"+(16777216+65536*(Math.round((b-d)*a)+d)+256*(Math.round((b-f)*a)+f)+(Math.round((b-h)*a)+h)).toString(16).slice(1)} -function ascii2hex(b){for(var a="",h=0;hthis._terminal.rows},enumerable:!0,configurable:!0});Object.defineProperty(a.prototype,"isCursorInViewport",{get:function(){var a=this.ybase+this.y-this.ydisp;return 0<=a&&ad.MAX_BUFFER_SIZE?d.MAX_BUFFER_SIZE:a};a.prototype.fillViewportRows=function(){if(0===this._lines.length)for(var a=this._terminal.rows;a--;)this.lines.push(this._terminal.blankLine())};a.prototype.clear=function(){this.x=this.y=this.ybase=this.ydisp=0;this._lines=new f.CircularList(this._getCorrectBufferLength(this._terminal.rows));this.scrollTop=0;this.scrollBottom=this._terminal.rows-1;this.setupTabStops()};a.prototype.resize=function(a,k){var e=this._getCorrectBufferLength(k); -e>this._lines.maxLength&&(this._lines.maxLength=e);if(0k;c--)this._lines.length>k+this.ybase&&(this._lines.length>this.ybase+this.y+1?this._lines.pop():(this.ybase++,this.ydisp++));e=m&&a--,g>=m&&f--):1m&&(a+=h[d.CHAR_DATA_CHAR_INDEX].length-1),g>m&&(f+=h[d.CHAR_DATA_CHAR_INDEX].length-1))}return k&&(k=c.search(/\s+$/),-1!==k&&(f=Math.min(f,k)),f<=a)?"":c.substring(a, -f)};a.prototype.setupTabStops=function(a){null!=a?this.tabs[a]||(a=this.prevStop(a)):(this.tabs={},a=0);for(;a=this._terminal.cols?this._terminal.cols-1:0>a?0:a};a.prototype.nextStop=function(a){null==a&&(a=this.x);for(;!this.tabs[++a]&&a=this._terminal.cols?this._terminal.cols-1:0>a?0:a};return a}(); -d.Buffer=a},{"./utils/CircularList":32}],2:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,e){a.__proto__=e}||function(a,e){for(var g in e)e.hasOwnProperty(g)&&(a[g]=e[g])};return function(k,e){function g(){this.constructor=k}a(k,e);k.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./Buffer");a=function(a){function k(e){var g=a.call(this)|| -this;g._terminal=e;g._normal=new m.Buffer(g._terminal,!0);g._normal.fillViewportRows();g._alt=new m.Buffer(g._terminal,!1);g._activeBuffer=g._normal;g.setupTabStops();return g}f(k,a);Object.defineProperty(k.prototype,"alt",{get:function(){return this._alt},enumerable:!0,configurable:!0});Object.defineProperty(k.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!0,configurable:!0});Object.defineProperty(k.prototype,"normal",{get:function(){return this._normal},enumerable:!0, -configurable:!0});k.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._alt.clear(),this._activeBuffer=this._normal,this.emit("activate",{activeBuffer:this._normal,inactiveBuffer:this._alt}))};k.prototype.activateAltBuffer=function(){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(),this._activeBuffer=this._alt,this.emit("activate",{activeBuffer:this._alt,inactiveBuffer:this._normal}))};k.prototype.resize=function(a,g){this._normal.resize(a,g);this._alt.resize(a, -g)};k.prototype.setupTabStops=function(a){this._normal.setupTabStops(a);this._alt.setupTabStops(a)};return k}(a("./EventEmitter").EventEmitter);d.BufferSet=a},{"./Buffer":1,"./EventEmitter":7}],3:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});d.wcwidth=function(a){function d(a,e){var c=0,g=e.length-1;if(ae[g][1])return!1;for(;g>=c;){var k=c+g>>1;if(a>e[k][1])c=k+1;else if(ac)return e|0;if(127>c)return 1;var n;if(!(n=g)){g="undefined"===typeof Uint32Array?Array(4096):new Uint32Array(4096);for(n=0;4096>n;++n){for(var f=0,m=16;m--;){f<<=2;var h=16*n+m;h=0===h?a.nul:32>h||127<=h&&160>h?a.control:d(h,l)?0:4352<=h&&(4447>= -h||9001===h||9002===h||11904<=h&&42191>=h&&12351!==h||44032<=h&&55203>=h||63744<=h&&64255>=h||65040<=h&&65049>=h||65072<=h&&65135>=h||65280<=h&&65376>=h||65504<=h&&65510>=h)?2:1;f|=h}g[n]=f}n=g}if(65536>c)return n[c>>4]>>((c&15)<<1)&3;c=d(c,k)?0:131072<=c&&196605>=c||196608<=c&&262141>=c?2:1;return c}}({nul:0,control:0})},{}],4:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});d.CHARSETS={};d.DEFAULT_CHARSET=d.CHARSETS.B;d.CHARSETS["0"]={"`":"\u25c6",a:"\u2592",b:"\t",c:"\f",d:"\r", -e:"\n",f:"\u00b0",g:"\u00b1",h:"\u2424",i:"\x0B",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","}":"\u00a3","~":"\u00b7"};d.CHARSETS.A={"#":"\u00a3"};d.CHARSETS.B=null;d.CHARSETS["4"]={"#":"\u00a3","@":"\u00be","[":"ij","\\":"\u00bd","]":"|","{":"\u00a8","|":"f","}":"\u00bc","~":"\u00b4"};d.CHARSETS.C=d.CHARSETS["5"]={"[":"\u00c4","\\":"\u00d6", -"]":"\u00c5","^":"\u00dc","`":"\u00e9","{":"\u00e4","|":"\u00f6","}":"\u00e5","~":"\u00fc"};d.CHARSETS.R={"#":"\u00a3","@":"\u00e0","[":"\u00b0","\\":"\u00e7","]":"\u00a7","{":"\u00e9","|":"\u00f9","}":"\u00e8","~":"\u00a8"};d.CHARSETS.Q={"@":"\u00e0","[":"\u00e2","\\":"\u00e7","]":"\u00ea","^":"\u00ee","`":"\u00f4","{":"\u00e9","|":"\u00f9","}":"\u00e8","~":"\u00fb"};d.CHARSETS.K={"@":"\u00a7","[":"\u00c4","\\":"\u00d6","]":"\u00dc","{":"\u00e4","|":"\u00f6","}":"\u00fc","~":"\u00df"};d.CHARSETS.Y= -{"#":"\u00a3","@":"\u00a7","[":"\u00b0","\\":"\u00e7","]":"\u00e9","`":"\u00f9","{":"\u00e0","|":"\u00f2","}":"\u00e8","~":"\u00ec"};d.CHARSETS.E=d.CHARSETS["6"]={"@":"\u00c4","[":"\u00c6","\\":"\u00d8","]":"\u00c5","^":"\u00dc","`":"\u00e4","{":"\u00e6","|":"\u00f8","}":"\u00e5","~":"\u00fc"};d.CHARSETS.Z={"#":"\u00a3","@":"\u00a7","[":"\u00a1","\\":"\u00d1","]":"\u00bf","{":"\u00b0","|":"\u00f1","}":"\u00e7"};d.CHARSETS.H=d.CHARSETS["7"]={"@":"\u00c9","[":"\u00c4","\\":"\u00d6","]":"\u00c5","^":"\u00dc", -"`":"\u00e9","{":"\u00e4","|":"\u00f6","}":"\u00e5","~":"\u00fc"};d.CHARSETS["="]={"#":"\u00f9","@":"\u00e0","[":"\u00e9","\\":"\u00e7","]":"\u00ea","^":"\u00ee",_:"\u00e8","`":"\u00f4","{":"\u00e4","|":"\u00f6","}":"\u00fc","~":"\u00fb"}},{}],5:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=function(){function a(a,l,k){this.textarea=a;this.compositionView=l;this.terminal=k;this.isSendingComposition=this.isComposing=!1;this.compositionPosition={start:null,end:null}}a.prototype.compositionstart= -function(){this.isComposing=!0;this.compositionPosition.start=this.textarea.value.length;this.compositionView.textContent="";this.compositionView.classList.add("active")};a.prototype.compositionupdate=function(a){var l=this;this.compositionView.textContent=a.data;this.updateCompositionElements();setTimeout(function(){l.compositionPosition.end=l.textarea.value.length},0)};a.prototype.compositionend=function(){this.finalizeComposition(!0)};a.prototype.keydown=function(a){if(this.isComposing||this.isSendingComposition){if(229=== -a.keyCode||16===a.keyCode||17===a.keyCode||18===a.keyCode)return!1;this.finalizeComposition(!1)}return 229===a.keyCode?(this.handleAnyTextareaChanges(),!1):!0};a.prototype.finalizeComposition=function(a){var l=this;this.compositionView.classList.remove("active");this.isComposing=!1;this.clearTextareaPosition();if(a){var k=this.compositionPosition.start,e=this.compositionPosition.end;this.isSendingComposition=!0;setTimeout(function(){if(l.isSendingComposition){l.isSendingComposition=!1;var a=l.isComposing? -l.textarea.value.substring(k,e):l.textarea.value.substring(k);l.terminal.handler(a)}},0)}else this.isSendingComposition=!1,a=this.textarea.value.substring(this.compositionPosition.start,this.compositionPosition.end),this.terminal.handler(a)};a.prototype.handleAnyTextareaChanges=function(){var a=this,l=this.textarea.value;setTimeout(function(){if(!a.isComposing){var k=a.textarea.value.replace(l,"");0=this._terminal.cols)if(this._terminal.wraparoundMode)this._terminal.buffer.x=0,this._terminal.buffer.y++,this._terminal.buffer.y>this._terminal.buffer.scrollBottom?(this._terminal.buffer.y--,this._terminal.scroll(!0)):this._terminal.buffer.lines.get(this._terminal.buffer.y).isWrapped=!0;else if(2=== -g)return;c=this._terminal.buffer.y+this._terminal.buffer.ybase;if(this._terminal.insertMode)for(var k=0;kthis._terminal.buffer.scrollBottom&&(this._terminal.buffer.y--,this._terminal.scroll());this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--;this._terminal.emit("linefeed")};a.prototype.carriageReturn=function(){this._terminal.buffer.x=0};a.prototype.backspace=function(){0a&&(a=1);for(var c=this._terminal.buffer.y+this._terminal.buffer.ybase,e=this._terminal.buffer.x,g=[this._terminal.eraseAttr()," ",1,32];a--&&ea&&(a=1);this._terminal.buffer.y-=a;0>this._terminal.buffer.y&&(this._terminal.buffer.y=0)};a.prototype.cursorDown= -function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y+=a;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1);this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--};a.prototype.cursorForward=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x+=a;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.cursorBackward=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x>=this._terminal.cols&& -this._terminal.buffer.x--;this._terminal.buffer.x-=a;0>this._terminal.buffer.x&&(this._terminal.buffer.x=0)};a.prototype.cursorNextLine=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y+=a;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1);this._terminal.buffer.x=0};a.prototype.cursorPrecedingLine=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y-=a;0>this._terminal.buffer.y&&(this._terminal.buffer.y=0);this._terminal.buffer.x=0};a.prototype.cursorCharAbsolute= -function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x=a-1};a.prototype.cursorPosition=function(a){var c=a[0]-1;a=2<=a.length?a[1]-1:0;0>c?c=0:c>=this._terminal.rows&&(c=this._terminal.rows-1);0>a?a=0:a>=this._terminal.cols&&(a=this._terminal.cols-1);this._terminal.buffer.x=a;this._terminal.buffer.y=c};a.prototype.cursorForwardTab=function(a){for(a=a[0]||1;a--;)this._terminal.buffer.x=this._terminal.buffer.nextStop()};a.prototype.eraseInDisplay=function(a){switch(a[0]){case 0:this._terminal.eraseRight(this._terminal.buffer.x, -this._terminal.buffer.y);for(a=this._terminal.buffer.y+1;aa&&(a=1);for(var c=this._terminal.buffer.y+this._terminal.buffer.ybase, -e=this._terminal.rows-1+this._terminal.buffer.ybase-(this._terminal.rows-1-this._terminal.buffer.scrollBottom)+1;a--;)this._terminal.buffer.lines.splice(e-1,1),this._terminal.buffer.lines.splice(c,0,this._terminal.blankLine(!0));this._terminal.updateRange(this._terminal.buffer.y);this._terminal.updateRange(this._terminal.buffer.scrollBottom)};a.prototype.deleteLines=function(a){a=a[0];1>a&&(a=1);var c=this._terminal.buffer.y+this._terminal.buffer.ybase;var e=this._terminal.rows-1-this._terminal.buffer.scrollBottom; -for(e=this._terminal.rows-1+this._terminal.buffer.ybase-e;a--;)this._terminal.buffer.lines.splice(c,1),this._terminal.buffer.lines.splice(e,0,this._terminal.blankLine(!0));this._terminal.updateRange(this._terminal.buffer.y);this._terminal.updateRange(this._terminal.buffer.scrollBottom)};a.prototype.deleteChars=function(a){a=a[0];1>a&&(a=1);for(var c=this._terminal.buffer.y+this._terminal.buffer.ybase,e=[this._terminal.eraseAttr()," ",1,32];a--;)this._terminal.buffer.lines.get(c).splice(this._terminal.buffer.x, -1),this._terminal.buffer.lines.get(c).push(e);this._terminal.updateRange(this._terminal.buffer.y)};a.prototype.scrollUp=function(a){for(a=a[0]||1;a--;)this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollTop,1),this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollBottom,0,this._terminal.blankLine());this._terminal.updateRange(this._terminal.buffer.scrollTop);this._terminal.updateRange(this._terminal.buffer.scrollBottom)}; -a.prototype.scrollDown=function(a){for(a=a[0]||1;a--;)this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollBottom,1),this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollTop,0,this._terminal.blankLine());this._terminal.updateRange(this._terminal.buffer.scrollTop);this._terminal.updateRange(this._terminal.buffer.scrollBottom)};a.prototype.eraseChars=function(a){a=a[0];1>a&&(a=1);for(var c=this._terminal.buffer.y+this._terminal.buffer.ybase, -e=this._terminal.buffer.x,g=[this._terminal.eraseAttr()," ",1,32];a--&&ea&&(a=1);this._terminal.buffer.x=a-1;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.HPositionRelative=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x+= -a;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.repeatPrecedingCharacter=function(a){a=a[0]||1;for(var c=this._terminal.buffer.lines.get(this._terminal.buffer.ybase+this._terminal.buffer.y),e=c[this._terminal.buffer.x-1]||[this._terminal.defAttr," ",1,32];a--;)c[this._terminal.buffer.x++]=e};a.prototype.sendDeviceAttributes=function(a){0"===this._terminal.prefix&&(this._terminal.is("xterm")?this._terminal.send(f.C0.ESC+ -"[>0;276;0c"):this._terminal.is("rxvt-unicode")?this._terminal.send(f.C0.ESC+"[>85;95;0c"):this._terminal.is("linux")?this._terminal.send(a[0]+"c"):this._terminal.is("screen")&&this._terminal.send(f.C0.ESC+"[>83;40003;0c")):this._terminal.is("xterm")||this._terminal.is("rxvt-unicode")||this._terminal.is("screen")?this._terminal.send(f.C0.ESC+"[?1;2c"):this._terminal.is("linux")&&this._terminal.send(f.C0.ESC+"[?6c"))};a.prototype.linePosAbsolute=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y= -a-1;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1)};a.prototype.VPositionRelative=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y+=a;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1);this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--};a.prototype.HVPosition=function(a){1>a[0]&&(a[0]=1);1>a[1]&&(a[1]=1);this._terminal.buffer.y=a[0]-1;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y= -this._terminal.rows-1);this._terminal.buffer.x=a[1]-1;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.tabClear=function(a){a=a[0];0>=a?delete this._terminal.buffer.tabs[this._terminal.buffer.x]:3===a&&(this._terminal.buffer.tabs={})};a.prototype.setMode=function(a){if(1>18,g=this._terminal.curAttr>>9&511,l=this._terminal.curAttr&511,d,f=0;f=d?g=d-30:40<=d&&47>=d?l=d-40:90<=d&&97>=d?(d+=8,g=d-90):100<=d&&107>=d?(d+=8,l=d-100):0===d?(e=this._terminal.defAttr>> -18,g=this._terminal.defAttr>>9&511,l=this._terminal.defAttr&511):1===d?e|=k.FLAGS.BOLD:4===d?e|=k.FLAGS.UNDERLINE:5===d?e|=k.FLAGS.BLINK:7===d?e|=k.FLAGS.INVERSE:8===d?e|=k.FLAGS.INVISIBLE:2===d?e|=k.FLAGS.DIM:22===d?(e&=~k.FLAGS.BOLD,e&=~k.FLAGS.DIM):24===d?e&=~k.FLAGS.UNDERLINE:25===d?e&=~k.FLAGS.BLINK:27===d?e&=~k.FLAGS.INVERSE:28===d?e&=~k.FLAGS.INVISIBLE:39===d?g=this._terminal.defAttr>>9&511:49===d?l=this._terminal.defAttr&511:38===d?2===a[f+1]?(f+=2,g=this._terminal.matchColor(a[f]&255,a[f+ -1]&255,a[f+2]&255),-1===g&&(g=511),f+=2):5===a[f+1]&&(f+=2,g=d=a[f]&255):48===d?2===a[f+1]?(f+=2,l=this._terminal.matchColor(a[f]&255,a[f+1]&255,a[f+2]&255),-1===l&&(l=511),f+=2):5===a[f+1]&&(f+=2,l=d=a[f]&255):100===d?(g=this._terminal.defAttr>>9&511,l=this._terminal.defAttr&511):this._terminal.error("Unknown SGR attribute: %d.",d);this._terminal.curAttr=e<<18|g<<9|l}};a.prototype.deviceStatus=function(a){if(!this._terminal.prefix)switch(a[0]){case 5:this._terminal.send(f.C0.ESC+"[0n");break;case 6:this._terminal.send(f.C0.ESC+ -"["+(this._terminal.buffer.y+1)+";"+(this._terminal.buffer.x+1)+"R")}else if("?"===this._terminal.prefix)switch(a[0]){case 6:this._terminal.send(f.C0.ESC+"[?"+(this._terminal.buffer.y+1)+";"+(this._terminal.buffer.x+1)+"R")}};a.prototype.softReset=function(a){this._terminal.cursorHidden=!1;this._terminal.insertMode=!1;this._terminal.originMode=!1;this._terminal.wraparoundMode=!0;this._terminal.applicationKeypad=!1;this._terminal.viewport.syncScrollArea();this._terminal.applicationCursor=!1;this._terminal.buffer.scrollTop= -0;this._terminal.buffer.scrollBottom=this._terminal.rows-1;this._terminal.curAttr=this._terminal.defAttr;this._terminal.buffer.x=this._terminal.buffer.y=0;this._terminal.charset=null;this._terminal.glevel=0;this._terminal.charsets=[null]};a.prototype.setCursorStyle=function(a){a=1>a[0]?1:a[0];switch(a){case 1:case 2:this._terminal.setOption("cursorStyle","block");break;case 3:case 4:this._terminal.setOption("cursorStyle","underline");break;case 5:case 6:this._terminal.setOption("cursorStyle","bar")}this._terminal.setOption("cursorBlink", -1===a%2)};a.prototype.setScrollRegion=function(a){this._terminal.prefix||(this._terminal.buffer.scrollTop=(a[0]||1)-1,this._terminal.buffer.scrollBottom=(a[1]&&a[1]<=this._terminal.rows?a[1]:this._terminal.rows)-1,this._terminal.buffer.x=0,this._terminal.buffer.y=0)};a.prototype.saveCursor=function(a){this._terminal.buffer.savedX=this._terminal.buffer.x;this._terminal.buffer.savedY=this._terminal.buffer.y};a.prototype.restoreCursor=function(a){this._terminal.buffer.x=this._terminal.buffer.savedX|| -0;this._terminal.buffer.y=this._terminal.buffer.savedY||0};return a}();d.InputHandler=a},{"./Buffer":1,"./CharWidth":3,"./Charsets":4,"./EscapeSequences":6,"./renderer/Types":28}],9:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,c){for(var e in c)c.hasOwnProperty(e)&&(a[e]=c[e])};return function(e,c){function g(){this.constructor=e}a(e,c);e.prototype=null===c?Object.create(c):(g.prototype= -c.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./Types"),l=a("./input/MouseZoneManager"),k=/(?:^|[^\da-z\.-]+)((https?:\/\/)((([\da-z\.-]+)\.([a-z\.]{2,6}))|((\d{1,3}\.){3}\d{1,3})|(localhost))(:\d{1,5})?(\/[\/\w\.\-%~]*)*(\?[0-9\w\[\]\(\)\/\?\!#@$%&'*+,:;~\=\.\-]*)?(#[0-9\w\[\]\(\)\/\?\!#@$%&'*+,:;~\=\.\-]*)?)($|[^\/\w\.\-%]+)/;a=function(a){function e(c){var e=a.call(this)||this;e._terminal=c;e._linkMatchers=[];e._nextLinkMatcherId=0;e._rowsToLinkify={start:null, -end:null};e.registerLinkMatcher(k,null,{matchIndex:1});return e}f(e,a);e.prototype.attachToDom=function(a){this._mouseZoneManager=a};e.prototype.linkifyRows=function(a,g){var c=this;this._mouseZoneManager&&(null===this._rowsToLinkify.start?(this._rowsToLinkify.start=a,this._rowsToLinkify.end=g):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,a),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,g)),this._mouseZoneManager.clearAll(a,g),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId), -this._rowsTimeoutId=setTimeout(function(){return c._linkifyRows()},e.TIME_BEFORE_LINKIFY))};e.prototype._linkifyRows=function(){this._rowsTimeoutId=null;for(var a=this._rowsToLinkify.start;a<=this._rowsToLinkify.end;a++)this._linkifyRow(a);this._rowsToLinkify.start=null;this._rowsToLinkify.end=null};e.prototype.setHypertextLinkHandler=function(a){this._linkMatchers[0].handler=a};e.prototype.setHypertextValidationCallback=function(a){this._linkMatchers[0].validationCallback=a};e.prototype.registerLinkMatcher= -function(a,e,g){void 0===g&&(g={});if(0!==this._nextLinkMatcherId&&!e)throw Error("handler must be defined");a={id:this._nextLinkMatcherId++,regex:a,handler:e,matchIndex:g.matchIndex,validationCallback:g.validationCallback,hoverTooltipCallback:g.tooltipCallback,hoverLeaveCallback:g.leaveCallback,willLinkActivate:g.willLinkActivate,priority:g.priority||0};this._addLinkMatcherToList(a);return a.id};e.prototype._addLinkMatcherToList=function(a){if(0===this._linkMatchers.length)this._linkMatchers.push(a); -else{for(var c=this._linkMatchers.length-1;0<=c;c--)if(a.priority<=this._linkMatchers[c].priority){this._linkMatchers.splice(c+1,0,a);return}this._linkMatchers.splice(0,0,a)}};e.prototype.deregisterLinkMatcher=function(a){for(var c=1;c=this._terminal.buffer.lines.length)){c=this._terminal.buffer.translateBufferLineToString(c, -!1);for(var e=0;e":function(a){return a.setPrefix(">")}, -"!":function(a){return a.setPrefix("!")},0:function(a){return a.setParam(10*a.getParam())},1:function(a){return a.setParam(10*a.getParam()+1)},2:function(a){return a.setParam(10*a.getParam()+2)},3:function(a){return a.setParam(10*a.getParam()+3)},4:function(a){return a.setParam(10*a.getParam()+4)},5:function(a){return a.setParam(10*a.getParam()+5)},6:function(a){return a.setParam(10*a.getParam()+6)},7:function(a){return a.setParam(10*a.getParam()+7)},8:function(a){return a.setParam(10*a.getParam()+ -8)},9:function(a){return a.setParam(10*a.getParam()+9)},$:function(a){return a.setPostfix("$")},'"':function(a){return a.setPostfix('"')}," ":function(a){return a.setPostfix(" ")},"'":function(a){return a.setPostfix("'")},";":function(a){return a.finalizeParam()}};e[f.C0.CAN]=function(a){return a.setState(c.NORMAL)};var g={"@":function(a,c,e){return a.insertChars(c)},A:function(a,c,e){return a.cursorUp(c)},B:function(a,c,e){return a.cursorDown(c)},C:function(a,c,e){return a.cursorForward(c)},D:function(a, -c,e){return a.cursorBackward(c)},E:function(a,c,e){return a.cursorNextLine(c)},F:function(a,c,e){return a.cursorPrecedingLine(c)},G:function(a,c,e){return a.cursorCharAbsolute(c)},H:function(a,c,e){return a.cursorPosition(c)},I:function(a,c,e){return a.cursorForwardTab(c)},J:function(a,c,e){return a.eraseInDisplay(c)},K:function(a,c,e){return a.eraseInLine(c)},L:function(a,c,e){return a.insertLines(c)},M:function(a,c,e){return a.deleteLines(c)},P:function(a,c,e){return a.deleteChars(c)},S:function(a, -c,e){return a.scrollUp(c)},T:function(a,c,e){2>c.length&&!e&&a.scrollDown(c)},X:function(a,c,e){return a.eraseChars(c)},Z:function(a,c,e){return a.cursorBackwardTab(c)},"`":function(a,c,e){return a.charPosAbsolute(c)},a:function(a,c,e){return a.HPositionRelative(c)},b:function(a,c,e){return a.repeatPrecedingCharacter(c)},c:function(a,c,e){return a.sendDeviceAttributes(c)},d:function(a,c,e){return a.linePosAbsolute(c)},e:function(a,c,e){return a.VPositionRelative(c)},f:function(a,c,e){return a.HVPosition(c)}, -g:function(a,c,e){return a.tabClear(c)},h:function(a,c,e){return a.setMode(c)},l:function(a,c,e){return a.resetMode(c)},m:function(a,c,e){return a.charAttributes(c)},n:function(a,c,e){return a.deviceStatus(c)},p:function(a,c,e){switch(e){case "!":a.softReset(c)}},q:function(a,c,e,g){" "===g&&a.setCursorStyle(c)},r:function(a,c){return a.setScrollRegion(c)},s:function(a,c){return a.saveCursor(c)},u:function(a,c){return a.restoreCursor(c)}};g[f.C0.CAN]=function(a,e,g,k,d){return d.setState(c.NORMAL)}; -var c;(function(a){a[a.NORMAL=0]="NORMAL";a[a.ESCAPED=1]="ESCAPED";a[a.CSI_PARAM=2]="CSI_PARAM";a[a.CSI=3]="CSI";a[a.OSC=4]="OSC";a[a.CHARSET=5]="CHARSET";a[a.DCS=6]="DCS";a[a.IGNORE=7]="IGNORE"})(c=d.ParserState||(d.ParserState={}));a=function(){function a(a,e){this._inputHandler=a;this._terminal=e;this._state=c.NORMAL}a.prototype.parse=function(a){var d=a.length,h=this._terminal.buffer.x,n=this._terminal.buffer.y;this._terminal.debug&&this._terminal.log("data: "+a);this._position=0;this._terminal.surrogate_high&& -(a=this._terminal.surrogate_high+a,this._terminal.surrogate_high="");for(;this._position=v){var C=a.charCodeAt(this._position+1);if(isNaN(C)){this._terminal.surrogate_high=p;continue}v=1024*(v-55296)+(C-56320)+65536;p+=a.charAt(this._position+1)}if(!(56320<=v&&57343>=v))switch(this._state){case c.NORMAL:if(p in l)l[p](this,this._inputHandler);else this._inputHandler.addChar(p,v);break;case c.ESCAPED:if(p in -k){k[p](this,this._terminal);break}switch(p){case "(":case ")":case "*":case "+":case "-":case ".":switch(p){case "(":this._terminal.gcharset=0;break;case ")":this._terminal.gcharset=1;break;case "*":this._terminal.gcharset=2;break;case "+":this._terminal.gcharset=3;break;case "-":this._terminal.gcharset=1;break;case ".":this._terminal.gcharset=2}this._state=c.CHARSET;break;case "/":this._terminal.gcharset=3;this._state=c.CHARSET;this._position--;break;case "N":this._state=c.NORMAL;break;case "O":this._state= -c.NORMAL;break;case "n":this._terminal.setgLevel(2);this._state=c.NORMAL;break;case "o":this._terminal.setgLevel(3);this._state=c.NORMAL;break;case "|":this._terminal.setgLevel(3);this._state=c.NORMAL;break;case "}":this._terminal.setgLevel(2);this._state=c.NORMAL;break;case "~":this._terminal.setgLevel(1);this._state=c.NORMAL;break;case "7":this._inputHandler.saveCursor();this._state=c.NORMAL;break;case "8":this._inputHandler.restoreCursor();this._state=c.NORMAL;break;case "#":this._state=c.NORMAL; -this._position++;break;case "H":this._terminal.tabSet();this._state=c.NORMAL;break;case "=":this._terminal.log("Serial port requested application keypad.");this._terminal.applicationKeypad=!0;this._terminal.viewport&&this._terminal.viewport.syncScrollArea();this._state=c.NORMAL;break;case ">":this._terminal.log("Switching back to normal keypad.");this._terminal.applicationKeypad=!1;this._terminal.viewport&&this._terminal.viewport.syncScrollArea();this._state=c.NORMAL;break;default:this._state=c.NORMAL, -this._terminal.error("Unknown ESC control: %s.",p)}break;case c.CHARSET:p in m.CHARSETS?(v=m.CHARSETS[p],"/"===p&&this.skipNextChar()):v=m.DEFAULT_CHARSET;this._terminal.setgCharset(this._terminal.gcharset,v);this._terminal.gcharset=null;this._state=c.NORMAL;break;case c.OSC:if(p===f.C0.ESC||p===f.C0.BEL){p===f.C0.ESC&&this._position++;this._terminal.params.push(this._terminal.currentParam);switch(this._terminal.params[0]){case 0:case 1:case 2:this._terminal.params[1]&&(this._terminal.title=this._terminal.params[1], -this._terminal.handleTitle(this._terminal.title))}this._terminal.params=[];this._terminal.currentParam=0;this._state=c.NORMAL}else this._terminal.params.length?this._terminal.currentParam+=p:"0"<=p&&"9">=p?this._terminal.currentParam=10*this._terminal.currentParam+p.charCodeAt(0)-48:";"===p&&(this._terminal.params.push(this._terminal.currentParam),this._terminal.currentParam="");break;case c.CSI_PARAM:if(p in e){e[p](this);break}this.finalizeParam();this._state=c.CSI;case c.CSI:p in g?(this._terminal.debug&& -this._terminal.log("CSI "+(this._terminal.prefix?this._terminal.prefix:"")+" "+(this._terminal.params?this._terminal.params.join(";"):"")+" "+(this._terminal.postfix?this._terminal.postfix:"")+" "+p),g[p](this._inputHandler,this._terminal.params,this._terminal.prefix,this._terminal.postfix,this)):this._terminal.error("Unknown CSI code: %s.",p);this._state=c.NORMAL;this._terminal.prefix="";this._terminal.postfix="";break;case c.DCS:if(p===f.C0.ESC||p===f.C0.BEL){p===f.C0.ESC&&this._position++;switch(this._terminal.prefix){case "":break; -case "$q":p=this._terminal.currentParam;v=!1;switch(p){case '"q':p='0"q';break;case '"p':p='61"p';break;case "r":p=""+(this._terminal.buffer.scrollTop+1)+";"+(this._terminal.buffer.scrollBottom+1)+"r";break;case "m":p="0m";break;default:this._terminal.error("Unknown DCS Pt: %s.",p),p=""}this._terminal.send(f.C0.ESC+"P"+ +v+"$r"+p+f.C0.ESC+"\\");break;case "+p":break;case "+q":p=this._terminal.currentParam;v=!1;this._terminal.send(f.C0.ESC+"P"+ +v+"+r"+p+f.C0.ESC+"\\");break;default:this._terminal.error("Unknown DCS prefix: %s.", -this._terminal.prefix)}this._terminal.currentParam=0;this._terminal.prefix="";this._state=c.NORMAL}else this._terminal.currentParam?this._terminal.currentParam+=p:this._terminal.prefix||"$"===p||"+"===p?2===this._terminal.prefix.length?this._terminal.currentParam=p:this._terminal.prefix+=p:this._terminal.currentParam=p;break;case c.IGNORE:if(p===f.C0.ESC||p===f.C0.BEL)p===f.C0.ESC&&this._position++,this._state=c.NORMAL}}this._terminal.buffer.x===h&&this._terminal.buffer.y===n||this._terminal.emit("cursormove"); -return this._state};a.prototype.setState=function(a){this._state=a};a.prototype.setPrefix=function(a){this._terminal.prefix=a};a.prototype.setPostfix=function(a){this._terminal.postfix=a};a.prototype.setParam=function(a){this._terminal.currentParam=a};a.prototype.getParam=function(){return this._terminal.currentParam};a.prototype.finalizeParam=function(){this._terminal.params.push(this._terminal.currentParam);this._terminal.currentParam=0};a.prototype.skipNextChar=function(){this._position++};return a}(); -d.Parser=a},{"./Charsets":4,"./EscapeSequences":6}],11:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,c){for(var e in c)c.hasOwnProperty(e)&&(a[e]=c[e])};return function(c,e){function g(){this.constructor=c}a(c,e);c.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./utils/MouseHelper"),l=a("./shared/utils/Browser"); -h=a("./EventEmitter");var k=a("./SelectionModel"),e=a("./Buffer"),g=a("./handlers/AltClickHandler");a=String.fromCharCode(160);var c=new RegExp(a,"g"),n;(function(a){a[a.NORMAL=0]="NORMAL";a[a.WORD=1]="WORD";a[a.LINE=2]="LINE"})(n||(n={}));a=function(a){function d(c,e){var g=a.call(this)||this;g._terminal=c;g._charMeasure=e;g._enabled=!0;g._initListeners();g.enable();g._model=new k.SelectionModel(c);g._activeSelectionMode=n.NORMAL;return g}f(d,a);Object.defineProperty(d.prototype,"_buffer",{get:function(){return this._terminal.buffers.active}, -enumerable:!0,configurable:!0});d.prototype._initListeners=function(){var a=this;this._mouseMoveListener=function(c){return a._onMouseMove(c)};this._mouseUpListener=function(c){return a._onMouseUp(c)};this._trimListener=function(c){return a._onTrim(c)};this.initBuffersListeners()};d.prototype.initBuffersListeners=function(){var a=this;this._terminal.buffer.lines.on("trim",this._trimListener);this._terminal.buffers.on("activate",function(c){return a._onBufferActivate(c)})};d.prototype.disable=function(){this.clearSelection(); -this._enabled=!1};d.prototype.enable=function(){this._enabled=!0};Object.defineProperty(d.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"hasSelection",{get:function(){var a=this._model.finalSelectionStart,c=this._model.finalSelectionEnd;return a&&c?a[0]!==c[0]||a[1]!== -c[1]:!1},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"selectionText",{get:function(){var a=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;if(!a||!e)return"";var g=[];g.push(this._buffer.translateBufferLineToString(a[1],!0,a[0],a[1]===e[1]?e[0]:null));for(var d=a[1]+1;d<=e[1]-1;d++){var k=this._buffer.lines.get(d),f=this._buffer.translateBufferLineToString(d,!0);k.isWrapped?g[g.length-1]+=f:g.push(f)}a[1]!==e[1]&&(k=this._buffer.lines.get(e[1]),f=this._buffer.translateBufferLineToString(e[1], -!0,0,e[0]),k.isWrapped?g[g.length-1]+=f:g.push(f));return g.map(function(a){return a.replace(c," ")}).join(l.isMSWindows?"\r\n":"\n")},enumerable:!0,configurable:!0});d.prototype.clearSelection=function(){this._model.clearSelection();this._removeMouseDownListeners();this.refresh()};d.prototype.refresh=function(a){var c=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return c._refresh()}));l.isLinux&&a&&this.selectionText.length&&this.emit("newselection", -this.selectionText)};d.prototype._refresh=function(){this._refreshAnimationFrame=null;this.emit("refresh",{start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd})};d.prototype.isClickInSelection=function(a){a=this._getMouseBufferCoords(a);var c=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;return c&&e?a[1]>c[1]&&a[1]c[0]&&a[0]c&&(a-=c);a=Math.min(Math.max(a,-50),50);a/=50;return a/Math.abs(a)+Math.round(14*a)};d.prototype.shouldForceSelection=function(a){return l.isMac?a.altKey:a.shiftKey};d.prototype.onMouseDown=function(a){this._mouseDownTimeStamp=a.timeStamp;if((2!== -a.button||!this.hasSelection)&&0===a.button){if(!this._enabled){if(!this.shouldForceSelection(a))return;a.stopPropagation()}a.preventDefault();this._dragScrollAmount=0;this._enabled&&a.shiftKey?this._onIncrementalClick(a):1===a.detail?this._onSingleClick(a):2===a.detail?this._onDoubleClick(a):3===a.detail&&this._onTripleClick(a);this._addMouseDownListeners();this.refresh(!0)}};d.prototype._addMouseDownListeners=function(){var a=this;this._terminal.element.ownerDocument.addEventListener("mousemove", -this._mouseMoveListener);this._terminal.element.ownerDocument.addEventListener("mouseup",this._mouseUpListener);this._dragScrollIntervalTimer=setInterval(function(){return a._dragScroll()},50)};d.prototype._removeMouseDownListeners=function(){this._terminal.element.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener);this._terminal.element.ownerDocument.removeEventListener("mouseup",this._mouseUpListener);clearInterval(this._dragScrollIntervalTimer);this._dragScrollIntervalTimer= -null};d.prototype._onIncrementalClick=function(a){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(a))};d.prototype._onSingleClick=function(a){this._model.selectionStartLength=0;this._model.isSelectAllActive=!1;this._activeSelectionMode=n.NORMAL;this._model.selectionStart=this._getMouseBufferCoords(a);this._model.selectionStart&&(this._model.selectionEnd=null,(a=this._buffer.lines.get(this._model.selectionStart[1]))&&(a.length>=this._model.selectionStart[0]||0===a[this._model.selectionStart[0]][e.CHAR_DATA_WIDTH_INDEX]&& -this._model.selectionStart[0]++))};d.prototype._onDoubleClick=function(a){if(a=this._getMouseBufferCoords(a))this._activeSelectionMode=n.WORD,this._selectWordAt(a,!0)};d.prototype._onTripleClick=function(a){if(a=this._getMouseBufferCoords(a))this._activeSelectionMode=n.LINE,this._selectLineAt(a[1])};d.prototype._onMouseMove=function(a){a.stopImmediatePropagation();var c=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;this._model.selectionEnd=this._getMouseBufferCoords(a); -this._model.selectionEnd?(this._activeSelectionMode===n.LINE?this._model.selectionEnd[0]=this._model.selectionEnd[1]this._dragScrollAmount&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=this.selectionText.length&&500>c?(new g.AltClickHandler(a,this._terminal)).move():this.hasSelection&&this._terminal.emit("selection")};d.prototype._onBufferActivate=function(a){this.clearSelection();a.inactiveBuffer.lines.off("trim",this._trimListener);a.activeBuffer.lines.on("trim",this._trimListener)};d.prototype._convertViewportColToCharacterIndex=function(a,c){for(var g=c[0],d=0;c[0]>= -d;d++){var k=a[d];0===k[e.CHAR_DATA_WIDTH_INDEX]?g--:1d[1]||a[1]===d[1]&&a[0]>d[0]:!1};a.prototype.onTrim=function(a){this.selectionStart&&(this.selectionStart[1]-= -a);this.selectionEnd&&(this.selectionEnd[1]-=a);if(this.selectionEnd&&0>this.selectionEnd[1])return this.clearSelection(),!0;this.selectionStart&&0>this.selectionStart[1]&&(this.selectionStart[1]=0);return!1};return a}();d.SelectionModel=a},{}],13:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,c){for(var e in c)c.hasOwnProperty(e)&&(a[e]=c[e])};return function(c,e){function g(){this.constructor= -c}a(c,e);c.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./BufferSet"),l=a("./Buffer"),k=a("./CompositionHelper");h=a("./EventEmitter");var e=a("./Viewport"),g=a("./handlers/Clipboard"),c=a("./EscapeSequences"),n=a("./InputHandler"),p=a("./Parser"),q=a("./renderer/Renderer"),r=a("./Linkifier"),t=a("./SelectionManager"),y=a("./utils/CharMeasure"),v=a("./shared/utils/Browser"),C=a("./utils/MouseHelper"),z=a("./utils/Sounds"), -x=a("./renderer/ColorManager"),B=a("./input/MouseZoneManager"),u="undefined"!==typeof window?window.document:null,A={cols:80,rows:24,convertEol:!1,termName:"xterm",cursorBlink:!1,cursorStyle:"block",bellSound:z.BELL_SOUND,bellStyle:"none",enableBold:!0,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,letterSpacing:0,scrollback:1E3,screenKeys:!1,debug:!1,macOptionIsMeta:!1,cancelEvents:!1,disableStdin:!1,useFlowControl:!1,allowTransparency:!1, -tabStopWidth:8,theme:null,rightClickSelectsWord:v.isMac};a=function(a){function d(c){void 0===c&&(c={});var e=a.call(this)||this;e.browser=v;e.options=c;e.setup();return e}f(d,a);d.prototype.setup=function(){var a=this;Object.keys(A).forEach(function(c){null==a.options[c]&&(a.options[c]=A[c]);a[c]=a.options[c]});this.parent=u?u.body:null;this.cols=this.options.cols;this.rows=this.options.rows;if(this.options.handler)this.on("data",this.options.handler);this.cursorState=0;this.cursorHidden=!1;this.sendDataQueue= -"";this.customKeyEventHandler=null;this.insertMode=this.originMode=this.applicationCursor=this.applicationKeypad=!1;this.wraparoundMode=!0;this.bracketedPasteMode=!1;this.gcharset=this.charset=null;this.glevel=0;this.charsets=[null];this.writable=this.readable=!0;this.curAttr=this.defAttr=131840;this.params=[];this.currentParam=0;this.postfix=this.prefix="";this.writeBuffer=[];this.writeStopped=this.xoffSentToCatchUp=this.writeInProgress=!1;this.surrogateHigh="";this.userScrolling=!1;this.inputHandler= -new n.InputHandler(this);this.parser=new p.Parser(this.inputHandler,this);this.renderer=this.renderer||null;this.selectionManager=this.selectionManager||null;this.linkifier=this.linkifier||new r.Linkifier(this);this._mouseZoneManager=this._mouseZoneManager||null;this.buffers=new m.BufferSet(this);this.selectionManager&&(this.selectionManager.clearSelection(),this.selectionManager.initBuffersListeners())};Object.defineProperty(d.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!0, -configurable:!0});d.prototype.eraseAttr=function(){return this.defAttr&-512|this.curAttr&511};d.prototype.focus=function(){this.textarea&&this.textarea.focus()};Object.defineProperty(d.prototype,"isFocused",{get:function(){return u.activeElement===this.textarea},enumerable:!0,configurable:!0});d.prototype.getOption=function(a){if(!(a in A))throw Error('No option with key "'+a+'"');return"undefined"!==typeof this.options[a]?this.options[a]:this[a]};d.prototype.setOption=function(a,c){if(!(a in A))throw Error('No option with key "'+ -a+'"');switch(a){case "bellStyle":c||(c="none");break;case "cursorStyle":c||(c="block");break;case "fontWeight":c||(c="normal");break;case "fontWeightBold":c||(c="bold");break;case "lineHeight":if(1>c){console.warn(a+" cannot be less than 1, value: "+c);return}case "tabStopWidth":if(1>c){console.warn(a+" cannot be less than 1, value: "+c);return}break;case "theme":if(this.renderer){this._setTheme(c);return}break;case "scrollback":c=Math.min(c,l.MAX_BUFFER_SIZE);if(0>c){console.warn(a+" cannot be less than 0, value: "+ -c);return}if(this.options[a]!==c){var e=this.rows+c;if(this.buffer.lines.length>e){e=this.buffer.lines.length-e;var d=0>this.buffer.ydisp-e;this.buffer.lines.trimStart(e);this.buffer.ybase=Math.max(this.buffer.ybase-e,0);this.buffer.ydisp=Math.max(this.buffer.ydisp-e,0);d&&this.refresh(0,this.rows-1)}}}this[a]=c;this.options[a]=c;switch(a){case "fontFamily":case "fontSize":this.renderer.clear();this.charMeasure.measure(this.options);break;case "enableBold":case "letterSpacing":case "lineHeight":case "fontWeight":case "fontWeightBold":a= -"fontWeight"===a||"fontWeightBold"===a||"enableBold"===a,this.renderer.clear(),this.renderer.onResize(this.cols,this.rows,a),this.refresh(0,this.rows-1);case "scrollback":this.buffers.resize(this.cols,this.rows);this.viewport.syncScrollArea();break;case "tabStopWidth":this.buffers.setupTabStops();break;case "bellSound":case "bellStyle":this.syncBellSound()}if(this.renderer)this.renderer.onOptionsChanged()};d.prototype._onTextAreaFocus=function(){this.sendFocus&&this.send(c.C0.ESC+"[I");this.element.classList.add("focus"); -this.showCursor();this.emit("focus")};d.prototype.blur=function(){return this.textarea.blur()};d.prototype._onTextAreaBlur=function(){this.refresh(this.buffer.y,this.buffer.y);this.sendFocus&&this.send(c.C0.ESC+"[O");this.element.classList.remove("focus");this.emit("blur")};d.prototype.initGlobal=function(){var a=this;this.bindKeys();w(this.element,"copy",function(c){a.hasSelection()&&g.copyHandler(c,a,a.selectionManager)});var c=function(c){return g.pasteHandler(c,a)};w(this.textarea,"paste",c); -w(this.element,"paste",c);v.isFirefox?w(this.element,"mousedown",function(c){2===c.button&&g.rightClickHandler(c,a.textarea,a.selectionManager,a.options.rightClickSelectsWord)}):w(this.element,"contextmenu",function(c){g.rightClickHandler(c,a.textarea,a.selectionManager,a.options.rightClickSelectsWord)});v.isLinux&&w(this.element,"auxclick",function(c){1===c.button&&g.moveTextAreaUnderMouseCursor(c,a.textarea)})};d.prototype.bindKeys=function(){var a=this,c=this;w(this.element,"keydown",function(a){u.activeElement=== -this&&c._keyDown(a)},!0);w(this.element,"keypress",function(a){u.activeElement===this&&c._keyPress(a)},!0);w(this.element,"keyup",function(c){16!==c.keyCode&&17!==c.keyCode&&18!==c.keyCode&&a.focus()},!0);w(this.textarea,"keydown",function(c){a._keyDown(c)},!0);w(this.textarea,"keypress",function(c){a._keyPress(c);a.textarea.value=""},!0);w(this.textarea,"compositionstart",function(){return a.compositionHelper.compositionstart()});w(this.textarea,"compositionupdate",function(c){return a.compositionHelper.compositionupdate(c)}); -w(this.textarea,"compositionend",function(){return a.compositionHelper.compositionend()});this.on("refresh",function(){return a.compositionHelper.updateCompositionElements()});this.on("refresh",function(c){return a.queueLinkification(c.start,c.end)})};d.prototype.open=function(a){var c=this;this.parent=a||this.parent;if(!this.parent)throw Error("Terminal requires a parent element.");this.context=this.parent.ownerDocument.defaultView;this.document=this.parent.ownerDocument;this.body=this.document.body; -this.element=this.document.createElement("div");this.element.classList.add("terminal");this.element.classList.add("xterm");this.element.setAttribute("tabindex","0");this.parent.appendChild(this.element);a=u.createDocumentFragment();this.viewportElement=u.createElement("div");this.viewportElement.classList.add("xterm-viewport");a.appendChild(this.viewportElement);this.viewportScrollArea=u.createElement("div");this.viewportScrollArea.classList.add("xterm-scroll-area");this.viewportElement.appendChild(this.viewportScrollArea); -this.screenElement=u.createElement("div");this.screenElement.classList.add("xterm-screen");this.helperContainer=u.createElement("div");this.helperContainer.classList.add("xterm-helpers");this.screenElement.appendChild(this.helperContainer);a.appendChild(this.screenElement);this._mouseZoneManager=new B.MouseZoneManager(this);this.on("scroll",function(){return c._mouseZoneManager.clearAll()});this.linkifier.attachToDom(this._mouseZoneManager);this.textarea=u.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"); -this.textarea.setAttribute("autocorrect","off");this.textarea.setAttribute("autocapitalize","off");this.textarea.setAttribute("spellcheck","false");this.textarea.tabIndex=0;this.textarea.addEventListener("focus",function(){return c._onTextAreaFocus()});this.textarea.addEventListener("blur",function(){return c._onTextAreaBlur()});this.helperContainer.appendChild(this.textarea);this.compositionView=u.createElement("div");this.compositionView.classList.add("composition-view");this.compositionHelper= -new k.CompositionHelper(this.textarea,this.compositionView,this);this.helperContainer.appendChild(this.compositionView);this.charSizeStyleElement=u.createElement("style");this.helperContainer.appendChild(this.charSizeStyleElement);this.charMeasure=new y.CharMeasure(u,this.helperContainer);this.syncBellSound();this.element.appendChild(a);this.renderer=new q.Renderer(this,this.options.theme);this.options.theme=null;this.viewport=new e.Viewport(this,this.viewportElement,this.viewportScrollArea,this.charMeasure); -this.viewport.onThemeChanged(this.renderer.colorManager.colors);this.on("cursormove",function(){return c.renderer.onCursorMove()});this.on("resize",function(){return c.renderer.onResize(c.cols,c.rows,!1)});this.on("blur",function(){return c.renderer.onBlur()});this.on("focus",function(){return c.renderer.onFocus()});this.charMeasure.on("charsizechanged",function(){return c.renderer.onResize(c.cols,c.rows,!0)});this.renderer.on("resize",function(a){return c.viewport.syncScrollArea()});this.selectionManager= -new t.SelectionManager(this,this.charMeasure);this.element.addEventListener("mousedown",function(a){return c.selectionManager.onMouseDown(a)});this.selectionManager.on("refresh",function(a){return c.renderer.onSelectionChanged(a.start,a.end)});this.selectionManager.on("newselection",function(a){c.textarea.value=a;c.textarea.focus();c.textarea.select()});this.on("scroll",function(){c.viewport.syncScrollArea();c.selectionManager.refresh()});this.viewportElement.addEventListener("scroll",function(){return c.selectionManager.refresh()}); -this.mouseHelper=new C.MouseHelper(this.renderer);this.charMeasure.measure(this.options);this.refresh(0,this.rows-1);this.initGlobal();this.bindMouse()};d.prototype._setTheme=function(a){a=this.renderer.setTheme(a);if(this.viewport)this.viewport.onThemeChanged(a)};d.applyAddon=function(a){a.apply(d)};d.prototype.bindMouse=function(){function a(a){switch(a.overrideType||a.type){case "mousedown":var c=null!=a.button?+a.button:null!=a.which?a.which-1:null;v.isMSIE&&(c=1===c?0:4===c?1:c);break;case "mouseup":c= -3;break;case "DOMMouseScroll":c=0>a.detail?64:65;break;case "wheel":c=0c?a.push(c):(2047>6),a.push(128|c&63)):255===c?a.push(0):(127a){if(0===this.buffer.ydisp)return; -this.userScrolling=!0}else a+this.buffer.ydisp>=this.buffer.ybase&&(this.userScrolling=!1);var e=this.buffer.ydisp;this.buffer.ydisp=Math.max(Math.min(this.buffer.ydisp+a,this.buffer.ybase),0);e!==this.buffer.ydisp&&(c||this.emit("scroll",this.buffer.ydisp),this.refresh(0,this.rows-1))};d.prototype.scrollPages=function(a){this.scrollLines(a*(this.rows-1))};d.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)};d.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase- -this.buffer.ydisp)};d.prototype.write=function(a){var e=this;this.writeBuffer.push(a);this.options.useFlowControl&&!this.xoffSentToCatchUp&&5<=this.writeBuffer.length&&(this.send(c.C0.DC3),this.xoffSentToCatchUp=!0);!this.writeInProgress&&0=a.keyCode?e.key=c.C0.ESC+String.fromCharCode(a.keyCode+32):192===a.keyCode?e.key=c.C0.ESC+"`":48<=a.keyCode&&57>=a.keyCode&&(e.key=c.C0.ESC+(a.keyCode-48)):65<=a.keyCode&&90>=a.keyCode?e.key=String.fromCharCode(a.keyCode-64):32===a.keyCode?e.key=String.fromCharCode(0):51<=a.keyCode&& -55>=a.keyCode?e.key=String.fromCharCode(a.keyCode-51+27):56===a.keyCode?e.key=String.fromCharCode(127):219===a.keyCode?e.key=String.fromCharCode(27):220===a.keyCode?e.key=String.fromCharCode(28):221===a.keyCode&&(e.key=String.fromCharCode(29))}return e};d.prototype.setgLevel=function(a){this.glevel=a;this.charset=this.charsets[a]};d.prototype.setgCharset=function(a,c){this.charsets[a]=c;this.glevel===a&&(this.charset=c)};d.prototype._keyPress=function(a){if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(a))return!1; -this.cancel(a);if(a.charCode)var c=a.charCode;else if(null==a.which)c=a.keyCode;else if(0!==a.which&&0!==a.charCode)c=a.which;else return!1;if(!c||(a.altKey||a.ctrlKey||a.metaKey)&&!this._isThirdLevelShift(this.browser,a))return!1;c=String.fromCharCode(c);this.emit("keypress",c,a);this.emit("key",c,a);this.showCursor();this.handler(c);return!0};d.prototype.send=function(a){var c=this;this.sendDataQueue||setTimeout(function(){c.handler(c.sendDataQueue);c.sendDataQueue=""},1);this.sendDataQueue+=a}; -d.prototype.bell=function(){var a=this;this.emit("bell");this.soundBell()&&this.bellAudioElement.play();this.visualBell()&&(this.element.classList.add("visual-bell-active"),clearTimeout(this.visualBellTimer),this.visualBellTimer=window.setTimeout(function(){a.element.classList.remove("visual-bell-active")},200))};d.prototype.log=function(a,c){this.options.debug&&this.context.console&&this.context.console.log&&this.context.console.log(a,c)};d.prototype.error=function(a,c){this.options.debug&&this.context.console&& -this.context.console.error&&this.context.console.error(a,c)};d.prototype.resize=function(a,c){isNaN(a)||isNaN(c)||(a===this.cols&&c===this.rows?this.charMeasure.width&&this.charMeasure.height||this.charMeasure.measure(this.options):(1>a&&(a=1),1>c&&(c=1),this.buffers.resize(a,c),this.cols=a,this.rows=c,this.buffers.setupTabStops(this.cols),this.charMeasure.measure(this.options),this.refresh(0,this.rows-1),this.emit("resize",{cols:a,rows:c})))};d.prototype.updateRange=function(a){athis.refreshEnd&&(this.refreshEnd=a)};d.prototype.maxRange=function(){this.refreshStart=0;this.refreshEnd=this.rows-1};d.prototype.eraseRight=function(a,c){var e=this.buffer.lines.get(this.buffer.ybase+c);if(e){for(var d=[this.eraseAttr()," ",1,32];athis.buffer.scrollBottom&&(this.buffer.y--,this.scroll());this.buffer.x>=this.cols&&this.buffer.x--};d.prototype.reverseIndex=function(){this.buffer.y===this.buffer.scrollTop?(this.buffer.lines.shiftElements(this.buffer.y+this.buffer.ybase,this.buffer.scrollBottom-this.buffer.scrollTop,1),this.buffer.lines.set(this.buffer.y+this.buffer.ybase,this.blankLine(!0)),this.updateRange(this.buffer.scrollTop),this.updateRange(this.buffer.scrollBottom)): -this.buffer.y--};d.prototype.reset=function(){this.options.rows=this.rows;this.options.cols=this.cols;var a=this.customKeyEventHandler,c=this.inputHandler;this.setup();this.customKeyEventHandler=a;this.inputHandler=c;this.refresh(0,this.rows-1);this.viewport.syncScrollArea()};d.prototype.tabSet=function(){this.buffer.tabs[this.buffer.x]=!0};d.prototype.cancel=function(a,c){if(this.options.cancelEvents||c)return a.preventDefault(),a.stopPropagation(),!1};d.prototype.matchColor=function(a,c,e){var d= -a<<16|c<<8|e;if(null!=E[d])a=E[d];else{for(var g=Infinity,k=-1,l=0,f,h,m;le;e++)a.push([c[e/36%6|0],c[e/6%6|0],c[e%6]]);for(e=0;24>e;e++)c=8+10*e,a.push([c,c,c]);return a}(),E={}},{"./Buffer":1,"./BufferSet":2,"./CompositionHelper":5,"./EscapeSequences":6,"./EventEmitter":7,"./InputHandler":8,"./Linkifier":9,"./Parser":10,"./SelectionManager":11,"./Viewport":15,"./handlers/Clipboard":17,"./input/MouseZoneManager":18,"./renderer/ColorManager":21, -"./renderer/Renderer":25,"./shared/utils/Browser":30,"./utils/CharMeasure":31,"./utils/MouseHelper":33,"./utils/Sounds":35}],14:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=d.LinkHoverEventTypes||(d.LinkHoverEventTypes={});a.HOVER="linkhover";a.TOOLTIP="linktooltip";a.LEAVE="linkleave"},{}],15:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=function(){function a(a,d,k,e){var g=this;this.terminal=a;this.viewportElement=d;this.scrollArea=k;this.charMeasure= -e;this.lastRecordedBufferHeight=this.lastRecordedViewportHeight=this.lastRecordedBufferLength=this.currentRowHeight=this.scrollBarWidth=0;this.scrollBarWidth=this.viewportElement.offsetWidth-this.scrollArea.offsetWidth||15;this.viewportElement.addEventListener("scroll",this.onScroll.bind(this));setTimeout(function(){return g.syncScrollArea()},0)}a.prototype.onThemeChanged=function(a){this.viewportElement.style.backgroundColor=a.background};a.prototype.refresh=function(){if(0=this._endCol&&athis._endRow?l.Up:l.Down};a.prototype._bufferLine=function(a,d,c,k,l){for(var e=a,g="";e!==c||d!==k;)e+=l?1:-1,l&&e>this._terminal.cols-1?(g+=this._terminal.buffer.translateBufferLineToString(d,!1,a,e),a=e=0,d++):!l&&0>e&&(g+=this._terminal.buffer.translateBufferLineToString(d,!1,0,a+1),a=e=this._terminal.cols-1,d--);return g+this._terminal.buffer.translateBufferLineToString(d,!1,a,e)};a.prototype._sequence=function(a){return m.C0.ESC+(this._terminal.applicationCursor? -"O":"[")+a};return a}();d.AltClickHandler=a},{"../EscapeSequences":6}],17:[function(a,h,d){function f(a,e){return e?a.replace(/\r?\n/g,"\r"):a}function m(a,e){return e?"\u001b[200~"+a+"\u001b[201~":a}function l(a,e){e.style.position="fixed";e.style.width="20px";e.style.height="20px";e.style.left=a.clientX-10+"px";e.style.top=a.clientY-10+"px";e.style.zIndex="1000";e.focus();setTimeout(function(){e.style.position=null;e.style.width=null;e.style.height=null;e.style.left=null;e.style.top=null;e.style.zIndex= -null},200)}Object.defineProperty(d,"__esModule",{value:!0});d.prepareTextForTerminal=f;d.bracketTextForPaste=m;d.copyHandler=function(a,e,d){e.browser.isMSIE?window.clipboardData.setData("Text",d.selectionText):a.clipboardData.setData("text/plain",d.selectionText);a.preventDefault()};d.pasteHandler=function(a,e){a.stopPropagation();var d=function(c){c=f(c,e.browser.isMSWindows);c=m(c,e.bracketedPasteMode);e.handler(c);e.textarea.value="";e.emit("paste",c);e.cancel(a)};if(e.browser.isMSIE){if(window.clipboardData){var c= -window.clipboardData.getData("Text");d(c)}}else a.clipboardData&&(c=a.clipboardData.getData("text/plain"),d(c))};d.moveTextAreaUnderMouseCursor=l;d.rightClickHandler=function(a,e,d,c){l(a,e);c&&!d.isClickInSelection(a)&&d.selectWordAtCursor(a);e.value=d.selectionText;e.select()}},{}],18:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=function(){function a(a){var d=this;this._terminal=a;this._zones=[];this._areZonesActive=!1;this._currentZone=this._tooltipTimeout=null;this._lastHoverCoords= -[null,null];this._terminal.element.addEventListener("mousedown",function(a){return d._onMouseDown(a)});this._mouseMoveListener=function(a){return d._onMouseMove(a)};this._clickListener=function(a){return d._onClick(a)}}a.prototype.add=function(a){this._zones.push(a);1===this._zones.length&&this._activate()};a.prototype.clearAll=function(a,d){if(0!==this._zones.length){d||(a=0,d=this._terminal.rows-1);for(var k=0;ka&&e.y<=d+1&&(this._currentZone&&this._currentZone=== -e&&(this._currentZone.leaveCallback(),this._currentZone=null),this._zones.splice(k--,1))}0===this._zones.length&&this._deactivate()}};a.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._terminal.element.addEventListener("mousemove",this._mouseMoveListener),this._terminal.element.addEventListener("click",this._clickListener))};a.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._terminal.element.removeEventListener("mousemove",this._mouseMoveListener), -this._terminal.element.removeEventListener("click",this._clickListener))};a.prototype._onMouseMove=function(a){if(this._lastHoverCoords[0]!==a.pageX||this._lastHoverCoords[1]!==a.pageY)this._onHover(a),this._lastHoverCoords=[a.pageX,a.pageY]};a.prototype._onHover=function(a){var d=this,k=this._findZoneEventAt(a);k!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=null,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),k&&(this._currentZone=k,k.hoverCallback&& -k.hoverCallback(a),this._tooltipTimeout=setTimeout(function(){return d._onTooltip(a)},500)))};a.prototype._onTooltip=function(a){this._tooltipTimeout=null;var d=this._findZoneEventAt(a);d&&d.tooltipCallback&&d.tooltipCallback(a)};a.prototype._onMouseDown=function(a){if(this._areZonesActive){var d=this._findZoneEventAt(a);d&&d.willLinkActivate(a)&&(a.preventDefault(),a.stopImmediatePropagation())}};a.prototype._onClick=function(a){var d=this._findZoneEventAt(a);d&&(d.clickCallback(a),a.preventDefault(), -a.stopImmediatePropagation())};a.prototype._findZoneEventAt=function(a){a=this._terminal.mouseHelper.getCoords(a,this._terminal.screenElement,this._terminal.charMeasure,this._terminal.options.lineHeight,this._terminal.cols,this._terminal.rows);if(!a)return null;for(var d=0;da[0])return k}return null};return a}();d.MouseZoneManager=a;a=function(){return function(a,d,l,k,e,g,c,h){this.x1=a;this.x2=d;this.y=l;this.clickCallback= -k;this.hoverCallback=e;this.tooltipCallback=g;this.leaveCallback=c;this.willLinkActivate=h}}();d.MouseZone=a},{}],19:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});var f=a("./CharAtlas"),m=a("../Buffer");d.INVERTED_DEFAULT_COLOR=-1;a=function(){function a(a,e,d,c,l){this._container=a;this._alpha=c;this._colors=l;this._scaledCharTop=this._scaledCharLeft=this._scaledCellHeight=this._scaledCellWidth=this._scaledCharHeight=this._scaledCharWidth=0;this._canvas=document.createElement("canvas"); -this._canvas.classList.add("xterm-"+e+"-layer");this._canvas.style.zIndex=d.toString();this._initCanvas();this._container.appendChild(this._canvas)}a.prototype._initCanvas=function(){this._ctx=this._canvas.getContext("2d",{alpha:this._alpha});this._alpha||this.clearAll()};a.prototype.onOptionsChanged=function(a){};a.prototype.onBlur=function(a){};a.prototype.onFocus=function(a){};a.prototype.onCursorMove=function(a){};a.prototype.onGridChanged=function(a,e,d){};a.prototype.onSelectionChanged=function(a, -e,d){};a.prototype.onThemeChanged=function(a,e){this._refreshCharAtlas(a,e)};a.prototype.setTransparency=function(a,e){if(e!==this._alpha){var d=this._canvas;this._alpha=e;this._canvas=this._canvas.cloneNode();this._initCanvas();this._container.replaceChild(this._canvas,d);this._refreshCharAtlas(a,this._colors);this.onGridChanged(a,0,a.rows-1)}};a.prototype._refreshCharAtlas=function(a,e){var d=this;0>=this._scaledCharWidth&&0>=this._scaledCharHeight||(this._charAtlas=null,a=f.acquireCharAtlas(a, -e,this._scaledCharWidth,this._scaledCharHeight),a instanceof HTMLCanvasElement?this._charAtlas=a:a.then(function(a){return d._charAtlas=a}))};a.prototype.resize=function(a,e,d){this._scaledCellWidth=e.scaledCellWidth;this._scaledCellHeight=e.scaledCellHeight;this._scaledCharWidth=e.scaledCharWidth;this._scaledCharHeight=e.scaledCharHeight;this._scaledCharLeft=e.scaledCharLeft;this._scaledCharTop=e.scaledCharTop;this._canvas.width=e.scaledCanvasWidth;this._canvas.height=e.scaledCanvasHeight;this._canvas.style.width= -e.canvasWidth+"px";this._canvas.style.height=e.canvasHeight+"px";this._alpha||this.clearAll();d&&this._refreshCharAtlas(a,this._colors)};a.prototype.fillCells=function(a,e,d,c){this._ctx.fillRect(a*this._scaledCellWidth,e*this._scaledCellHeight,d*this._scaledCellWidth,c*this._scaledCellHeight)};a.prototype.fillBottomLineAtCells=function(a,e,d){void 0===d&&(d=1);this._ctx.fillRect(a*this._scaledCellWidth,(e+1)*this._scaledCellHeight-window.devicePixelRatio-1,d*this._scaledCellWidth,window.devicePixelRatio)}; -a.prototype.fillLeftLineAtCell=function(a,e){this._ctx.fillRect(a*this._scaledCellWidth,e*this._scaledCellHeight,window.devicePixelRatio,this._scaledCellHeight)};a.prototype.strokeRectAtCell=function(a,e,d,c){this._ctx.lineWidth=window.devicePixelRatio;this._ctx.strokeRect(a*this._scaledCellWidth+window.devicePixelRatio/2,e*this._scaledCellHeight+window.devicePixelRatio/2,d*this._scaledCellWidth-window.devicePixelRatio,c*this._scaledCellHeight-window.devicePixelRatio)};a.prototype.clearAll=function(){this._alpha? -this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))};a.prototype.clearCells=function(a,e,d,c){this._alpha?this._ctx.clearRect(a*this._scaledCellWidth,e*this._scaledCellHeight,d*this._scaledCellWidth,c*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background,this._ctx.fillRect(a*this._scaledCellWidth,e*this._scaledCellHeight,d*this._scaledCellWidth,c*this._scaledCellHeight))}; -a.prototype.fillCharTrueColor=function(a,e,d,c){this._ctx.font=this._getFont(a,!1);this._ctx.textBaseline="top";this._clipRow(a,c);this._ctx.fillText(e[m.CHAR_DATA_CHAR_INDEX],d*this._scaledCellWidth+this._scaledCharLeft,c*this._scaledCellHeight+this._scaledCharTop)};a.prototype.drawChar=function(a,e,d,c,l,h,m,r,t,y){var g=0;256>m?g=m+2:t&&a.options.enableBold&&(g=1);this._charAtlas&&256>d&&(1m&&(8>m||t)||256<=m)&&256<=r?(e=this._scaledCharWidth+f.CHAR_ATLAS_CELL_SPACING,c=this._scaledCharHeight+ -f.CHAR_ATLAS_CELL_SPACING,y&&(this._ctx.globalAlpha=.5),t&&!a.options.enableBold&&1c?this._colors.ansi[c]:this._colors.foreground;this._clipRow(a,f);m&&(this._ctx.globalAlpha=.5);this._ctx.fillText(e,l*this._scaledCellWidth+this._scaledCharLeft,f*this._scaledCellHeight+this._scaledCharTop);this._ctx.restore()};a.prototype._clipRow=function(a,e){this._ctx.beginPath();this._ctx.rect(0,e*this._scaledCellHeight,a.cols*this._scaledCellWidth,this._scaledCellHeight);this._ctx.clip()};a.prototype._getFont=function(a,e){return(e?a.options.fontWeightBold: -a.options.fontWeight)+" "+a.options.fontSize*window.devicePixelRatio+"px "+a.options.fontFamily};return a}();d.BaseRenderLayer=a},{"../Buffer":1,"./CharAtlas":20}],20:[function(a,h,d){function f(a,d,c,k){k={foreground:k.foreground,background:k.background,cursor:null,cursorAccent:null,selection:null,ansi:k.ansi.slice(0,16)};return{scaledCharWidth:a,scaledCharHeight:d,fontFamily:c.options.fontFamily,fontSize:c.options.fontSize,fontWeight:c.options.fontWeight,fontWeightBold:c.options.fontWeightBold, -allowTransparency:c.options.allowTransparency,colors:k}}function m(a,d){for(var c=0;ca.length? -"0"+a:a}Object.defineProperty(d,"__esModule",{value:!0});d.DEFAULT_ANSI_COLORS="#2e3436 #cc0000 #4e9a06 #c4a000 #3465a4 #75507b #06989a #d3d7cf #555753 #ef2929 #8ae234 #fce94f #729fcf #ad7fa8 #34e2e2 #eeeeec".split(" ");a=function(){function a(){for(var a=d.DEFAULT_ANSI_COLORS.slice(),k=[0,95,135,175,215,255],e=0;216>e;e++){var g=f(k[e/36%6|0]),c=f(k[e/6%6|0]),h=f(k[e%6]);a.push("#"+g+c+h)}for(e=0;24>e;e++)k=f(8+10*e),a.push("#"+k+k+k);this.colors={foreground:"#ffffff",background:"#000000",cursor:"#ffffff", -cursorAccent:"#000000",selection:"rgba(255, 255, 255, 0.3)",ansi:a}}a.prototype.setTheme=function(a){this.colors.foreground=a.foreground||"#ffffff";this.colors.background=a.background||"#000000";this.colors.cursor=a.cursor||"#ffffff";this.colors.cursorAccent=a.cursorAccent||"#000000";this.colors.selection=a.selection||"rgba(255, 255, 255, 0.3)";this.colors.ansi[0]=a.black||d.DEFAULT_ANSI_COLORS[0];this.colors.ansi[1]=a.red||d.DEFAULT_ANSI_COLORS[1];this.colors.ansi[2]=a.green||d.DEFAULT_ANSI_COLORS[2]; -this.colors.ansi[3]=a.yellow||d.DEFAULT_ANSI_COLORS[3];this.colors.ansi[4]=a.blue||d.DEFAULT_ANSI_COLORS[4];this.colors.ansi[5]=a.magenta||d.DEFAULT_ANSI_COLORS[5];this.colors.ansi[6]=a.cyan||d.DEFAULT_ANSI_COLORS[6];this.colors.ansi[7]=a.white||d.DEFAULT_ANSI_COLORS[7];this.colors.ansi[8]=a.brightBlack||d.DEFAULT_ANSI_COLORS[8];this.colors.ansi[9]=a.brightRed||d.DEFAULT_ANSI_COLORS[9];this.colors.ansi[10]=a.brightGreen||d.DEFAULT_ANSI_COLORS[10];this.colors.ansi[11]=a.brightYellow||d.DEFAULT_ANSI_COLORS[11]; -this.colors.ansi[12]=a.brightBlue||d.DEFAULT_ANSI_COLORS[12];this.colors.ansi[13]=a.brightMagenta||d.DEFAULT_ANSI_COLORS[13];this.colors.ansi[14]=a.brightCyan||d.DEFAULT_ANSI_COLORS[14];this.colors.ansi[15]=a.brightWhite||d.DEFAULT_ANSI_COLORS[15]};return a}();d.ColorManager=a},{}],22:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c])};return function(e, -d){function c(){this.constructor=e}a(e,d);e.prototype=null===d?Object.create(d):(c.prototype=d.prototype,new c)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("../Buffer");a=function(a){function e(e,c,d){e=a.call(this,e,"cursor",c,!0,d)||this;e._state={x:null,y:null,isFocused:null,style:null,width:null};e._cursorRenderers={bar:e._renderBarCursor.bind(e),block:e._renderBlockCursor.bind(e),underline:e._renderUnderlineCursor.bind(e)};return e}f(e,a);e.prototype.resize=function(e,c,d){a.prototype.resize.call(this, -e,c,d);this._state={x:null,y:null,isFocused:null,style:null,width:null}};e.prototype.reset=function(a){this._clearCursor();this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=null,this.onOptionsChanged(a))};e.prototype.onBlur=function(a){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause();a.refresh(a.buffer.y,a.buffer.y)};e.prototype.onFocus=function(a){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume(a):a.refresh(a.buffer.y, -a.buffer.y)};e.prototype.onOptionsChanged=function(a){var c=this;a.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new l(a,function(){c._render(a,!0)})):(this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=null),a.refresh(a.buffer.y,a.buffer.y))};e.prototype.onCursorMove=function(a){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation(a)};e.prototype.onGridChanged=function(a,c,e){!this._cursorBlinkStateManager|| -this._cursorBlinkStateManager.isPaused?this._render(a,!1):this._cursorBlinkStateManager.restartBlinkAnimation(a)};e.prototype._render=function(a,c){if(!a.cursorState||a.cursorHidden)this._clearCursor();else{var e=a.buffer.ybase+a.buffer.y;c=e-a.buffer.ydisp;if(0>c||c>=a.rows)this._clearCursor();else if(e=a.buffer.lines.get(e)[a.buffer.x])if(a.isFocused)if(this._cursorBlinkStateManager&&!this._cursorBlinkStateManager.isCursorVisible)this._clearCursor();else{if(this._state){if(this._state.x===a.buffer.x&& -this._state.y===c&&this._state.isFocused===a.isFocused&&this._state.style===a.options.cursorStyle&&this._state.width===e[m.CHAR_DATA_WIDTH_INDEX])return;this._clearCursor()}this._ctx.save();this._cursorRenderers[a.options.cursorStyle||"block"](a,a.buffer.x,c,e);this._ctx.restore();this._state.x=a.buffer.x;this._state.y=c;this._state.isFocused=!1;this._state.style=a.options.cursorStyle;this._state.width=e[m.CHAR_DATA_WIDTH_INDEX]}else this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor, -this._renderBlurCursor(a,a.buffer.x,c,e),this._ctx.restore(),this._state.x=a.buffer.x,this._state.y=c,this._state.isFocused=!1,this._state.style=a.options.cursorStyle,this._state.width=e[m.CHAR_DATA_WIDTH_INDEX]}};e.prototype._clearCursor=function(){this._state&&(this.clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:null,y:null,isFocused:null,style:null,width:null})};e.prototype._renderBarCursor=function(a,c,e,d){this._ctx.save();this._ctx.fillStyle=this._colors.cursor;this.fillLeftLineAtCell(c, -e);this._ctx.restore()};e.prototype._renderBlockCursor=function(a,c,e,d){this._ctx.save();this._ctx.fillStyle=this._colors.cursor;this.fillCells(c,e,d[m.CHAR_DATA_WIDTH_INDEX],1);this._ctx.fillStyle=this._colors.cursorAccent;this.fillCharTrueColor(a,d,c,e);this._ctx.restore()};e.prototype._renderUnderlineCursor=function(a,c,e,d){this._ctx.save();this._ctx.fillStyle=this._colors.cursor;this.fillBottomLineAtCells(c,e);this._ctx.restore()};e.prototype._renderBlurCursor=function(a,c,e,d){this._ctx.save(); -this._ctx.strokeStyle=this._colors.cursor;this.strokeRectAtCell(c,e,d[m.CHAR_DATA_WIDTH_INDEX],1);this._ctx.restore()};return e}(a("./BaseRenderLayer").BaseRenderLayer);d.CursorRenderLayer=a;var l=function(){function a(a,d){this.renderCallback=d;this.isCursorVisible=!0;a.isFocused&&this._restartInterval()}Object.defineProperty(a.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!0,configurable:!0});a.prototype.dispose=function(){this._blinkInterval&& -(window.clearInterval(this._blinkInterval),this._blinkInterval=null);this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=null);this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=null)};a.prototype.restartBlinkAnimation=function(a){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){e.renderCallback(); -e._animationFrame=null})))};a.prototype._restartInterval=function(a){var e=this;void 0===a&&(a=600);this._blinkInterval&&window.clearInterval(this._blinkInterval);this._blinkStartTimeout=setTimeout(function(){if(e._animationTimeRestarted){var a=600-(Date.now()-e._animationTimeRestarted);e._animationTimeRestarted=null;if(0e&&(e=this._refreshRowsQueue[d].end)}this._refreshRowsQueue=[];this._refreshAnimationFrame=null;c=Math.max(c,0);e=Math.min(e,this._terminal.rows-1);this._renderLayers.forEach(function(d){return d.onGridChanged(a._terminal, -c,e)});this._terminal.emit("refresh",{start:c,end:e})};d.prototype._updateDimensions=function(){this._terminal.charMeasure.width&&this._terminal.charMeasure.height&&(this.dimensions.scaledCharWidth=Math.floor(this._terminal.charMeasure.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._terminal.charMeasure.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._terminal.options.lineHeight),this.dimensions.scaledCharTop= -1===this._terminal.options.lineHeight?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._terminal.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._terminal.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._terminal.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._terminal.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight= -Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._terminal.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._terminal.cols)};return d}(h.EventEmitter);d.Renderer=a},{"../EventEmitter":7,"../utils/ScreenDprMonitor":34,"./ColorManager":21,"./CursorRenderLayer":22,"./LinkRenderLayer":24,"./SelectionRenderLayer":26, -"./TextRenderLayer":27}],26:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])};return function(d,k){function e(){this.constructor=d}a(d,k);d.prototype=null===k?Object.create(k):(e.prototype=k.prototype,new e)}}();Object.defineProperty(d,"__esModule",{value:!0});a=function(a){function d(d,e,g){d=a.call(this,d,"selection",e,!0,g)||this;d._state= -{start:null,end:null};return d}f(d,a);d.prototype.resize=function(d,e,g){a.prototype.resize.call(this,d,e,g);this._state={start:null,end:null}};d.prototype.reset=function(a){this._state.start&&this._state.end&&(this._state={start:null,end:null},this.clearAll())};d.prototype.onSelectionChanged=function(a,e,d){if(this._state.start!==e&&this._state.end!==d&&(this.clearAll(),e&&d)){var c=e[1]-a.buffer.ydisp,g=d[1]-a.buffer.ydisp,f=Math.max(c,0),k=Math.min(g,a.rows-1);if(!(f>=a.rows||0>k)){c=c===f?e[0]: -0;var l=f===k?d[0]:a.cols;this._ctx.fillStyle=this._colors.selection;this.fillCells(c,f,l-c,1);this.fillCells(0,f+1,a.cols,Math.max(k-f-1,0));f!==k&&this.fillCells(0,k,g===k?d[0]:a.cols,1);this._state.start=[e[0],e[1]];this._state.end=[d[0],d[1]]}}};return d}(a("./BaseRenderLayer").BaseRenderLayer);d.SelectionRenderLayer=a},{"./BaseRenderLayer":19}],27:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,e){a.__proto__=e}|| -function(a,e){for(var c in e)e.hasOwnProperty(c)&&(a[c]=e[c])};return function(c,e){function d(){this.constructor=c}a(c,e);c.prototype=null===e?Object.create(e):(d.prototype=e.prototype,new d)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("../Buffer"),l=a("./Types"),k=a("./GridCache"),e=a("./BaseRenderLayer");a=function(a){function c(c,e,d,g){c=a.call(this,c,"text",e,g,d)||this;c._characterOverlapCache={};c._state=new k.GridCache;return c}f(c,a);c.prototype.resize=function(c,e,d){a.prototype.resize.call(this, -c,e,d);d=this._getFont(c,!1);if(this._characterWidth!==e.scaledCharWidth||this._characterFont!==d)this._characterWidth=e.scaledCharWidth,this._characterFont=d,this._characterOverlapCache={};this._state.clear();this._state.resize(c.cols,c.rows)};c.prototype.reset=function(a){this._state.clear();this.clearAll()};c.prototype.onGridChanged=function(a,c,d){if(0!==this._state.cache.length)for(;c<=d;c++){var g=a.buffer.lines.get(c+a.buffer.ydisp);this.clearCells(0,c,a.cols,1);for(var f=0;f>18,u=p&511,A=256<=u,w=B&l.FLAGS.INVISIBLE,D=B&l.FLAGS.INVERSE;!h||32===h&&A&&!D||w||(0!==q&&this._isOverlapping(k)&&f>9&511,D&&(D=u,u=k,k=D,256===k&&(k=e.INVERTED_DEFAULT_COLOR),257===u&&(u=e.INVERTED_DEFAULT_COLOR)),256>u&&(this._ctx.save(),this._ctx.fillStyle= -u===e.INVERTED_DEFAULT_COLOR?this._colors.foreground:this._colors.ansi[u],this.fillCells(f,c,q,1),this._ctx.restore()),this._ctx.save(),B&l.FLAGS.BOLD&&(this._ctx.font=this._getFont(a,!0),8>k&&(k+=8)),B&l.FLAGS.UNDERLINE&&(this._ctx.fillStyle=k===e.INVERTED_DEFAULT_COLOR?this._colors.background:256>k?this._colors.ansi[k]:this._colors.foreground,this.fillBottomLineAtCells(f,c)),this.drawChar(a,n,h,q,f,c,k,u,!!(B&l.FLAGS.BOLD),!!(B&l.FLAGS.DIM)),this._ctx.restore())}}}};c.prototype.onOptionsChanged= -function(a){this.setTransparency(a,a.options.allowTransparency)};c.prototype._isOverlapping=function(a){if(1!==a[m.CHAR_DATA_WIDTH_INDEX]||256>a[m.CHAR_DATA_CODE_INDEX])return!1;a=a[m.CHAR_DATA_CHAR_INDEX];if(this._characterOverlapCache.hasOwnProperty(a))return this._characterOverlapCache[a];this._ctx.save();this._ctx.font=this._characterFont;var c=Math.floor(this._ctx.measureText(a).width)>this._characterWidth;this._ctx.restore();return this._characterOverlapCache[a]=c};c.prototype._clearChar=function(a, -c){var e=1,d=this._state.cache[a][c];d&&2===d[m.CHAR_DATA_WIDTH_INDEX]&&(e=2);this.clearCells(a,c,e,1)};return c}(e.BaseRenderLayer);d.TextRenderLayer=a},{"../Buffer":1,"./BaseRenderLayer":19,"./GridCache":23,"./Types":28}],28:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=d.FLAGS||(d.FLAGS={});a[a.BOLD=1]="BOLD";a[a.UNDERLINE=2]="UNDERLINE";a[a.BLINK=4]="BLINK";a[a.INVERSE=8]="INVERSE";a[a.INVISIBLE=16]="INVISIBLE";a[a.DIM=32]="DIM"},{}],29:[function(a,h,d){function f(a,e,d, -c){for(var g=0;gq;q++)e.save(),e.beginPath(),e.rect(q*c,0,c,k),e.clip(),e.fillText(String.fromCharCode(q),q*c,0),e.restore();e.save();e.font=m(g.fontWeightBold,g);for(q=0;256>q;q++)e.save(),e.beginPath(),e.rect(q*c,k,c,k),e.clip(),e.fillText(String.fromCharCode(q),q*c,k),e.restore();e.restore();e.font=m(g.fontWeight,g);for(var r=0;16>r;r++){8===r&&(e.font=m(g.fontWeightBold,g));var t=(r+ -2)*k;for(q=0;256>q;q++)e.save(),e.beginPath(),e.rect(q*c,t,c,k),e.clip(),e.fillStyle=g.ansiColors[r],e.fillText(String.fromCharCode(q),q*c,t),e.restore()}e.restore();if(!("createImageBitmap"in a)||l.isFirefox)return h instanceof HTMLCanvasElement?h:new Promise(function(a){return a(h.transferToImageBitmap())});c=e.getImageData(0,0,h.width,h.height);k=parseInt(g.background.substr(1,2),16);e=parseInt(g.background.substr(3,2),16);g=parseInt(g.background.substr(5,2),16);f(c,k,e,g);return a.createImageBitmap(c)}}, -{"./utils/Browser":30}],30:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});h=(a="undefined"===typeof navigator?!0:!1)?"node":navigator.userAgent;a=a?"node":navigator.platform;d.isFirefox=!!~h.indexOf("Firefox");d.isMSIE=!!~h.indexOf("MSIE")||!!~h.indexOf("Trident");h=0<=["Macintosh","MacIntel","MacPPC","Mac68K"].indexOf(a);d.isMac=h;d.isIpad="iPad"===a;d.isIphone="iPhone"===a;h=0<=["Windows","Win16","Win32","WinCE"].indexOf(a);d.isMSWindows=h;d.isLinux=0<=a.indexOf("Linux")},{}], -31:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])};return function(d,f){function e(){this.constructor=d}a(d,f);d.prototype=null===f?Object.create(f):(e.prototype=f.prototype,new e)}}();Object.defineProperty(d,"__esModule",{value:!0});a=function(a){function d(d,e){var g=a.call(this)||this;g._document=d;g._parentElement=e;g._measureElement= -g._document.createElement("span");g._measureElement.style.position="absolute";g._measureElement.style.top="0";g._measureElement.style.left="-9999em";g._measureElement.style.lineHeight="normal";g._measureElement.textContent="W";g._measureElement.setAttribute("aria-hidden","true");g._parentElement.appendChild(g._measureElement);return g}f(d,a);Object.defineProperty(d.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"height",{get:function(){return this._height}, -enumerable:!0,configurable:!0});d.prototype.measure=function(a){this._measureElement.style.fontFamily=a.fontFamily;this._measureElement.style.fontSize=a.fontSize+"px";a=this._measureElement.getBoundingClientRect();0===a.width||0===a.height||this._width===a.width&&this._height===a.height||(this._width=a.width,this._height=Math.ceil(a.height),this.emit("charsizechanged"))};return d}(a("../EventEmitter").EventEmitter);d.CharMeasure=a},{"../EventEmitter":7}],32:[function(a,h,d){var f=this&&this.__extends|| -function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])};return function(d,f){function e(){this.constructor=d}a(d,f);d.prototype=null===f?Object.create(f):(e.prototype=f.prototype,new e)}}();Object.defineProperty(d,"__esModule",{value:!0});a=function(a){function d(d){var e=a.call(this)||this;e._maxLength=d;e._array=Array(e._maxLength);e._startIndex=0;e._length=0;return e}f(d,a);Object.defineProperty(d.prototype, -"maxLength",{get:function(){return this._maxLength},set:function(a){if(this._maxLength!==a){for(var e=Array(a),d=0;dthis._length)for(var e=this._length;e=a;c--)this._array[this._getCyclicIndex(c+d.length)]=this._array[this._getCyclicIndex(c)];for(c=0;cthis.maxLength?(d=this._length+d.length-this.maxLength,this._startIndex+=d,this._length=this.maxLength,this.emit("trim",d)):this._length+=d.length}};d.prototype.trimStart=function(a){a>this._length&&(a=this._length);this._startIndex+=a;this._length-=a;this.emit("trim",a)};d.prototype.shiftElements=function(a,e,d){if(!(0>=e)){if(0>a||a>=this._length)throw Error("start argument out of range");if(0>a+d)throw Error("Cannot shift elements in list beyond index 0");if(0this.maxLength;)this._length--,this._startIndex++,this.emit("trim",1)}else for(c=0;c>=1;for(;!(h=read_rng(a),h=String.fromCharCode(h[0].charCodeAt(0)&d)+h.substring(1),h=inflate_long(h,1),0b?a+Array(b-a.length+1).join("\x00"):a},get_int:function(){return struct.unpack("I",this.get_bytes(4))[0]},get_string:function(){return this.get_bytes(this.get_int())},get_mpint:function(){return inflate_long(this.get_string())},add_bytes:function(b){this.packet+=b;return this},add_boolean:function(b){this.add_bytes(!0=== -b?"\u0001":"\x00");return this},add_int:function(b){this.packet+=struct.pack("I",b);return this},add_mpint:function(b){this.add_string(deflate_long(b));return this},add_string:function(b){this.add_int(b.length);this.packet+=b;return this}};SSHyClient.parceler=function(b,a){this.socket=b;this.transport=a;this.encrypting=!1;this.hmacSHAVersion=this.inbound_iv=this.inbound_enc_key=this.inbound_mac_key=this.inbound_cipher=this.outbound_enc_iv=this.outbound_enc_key=this.outbound_mac_key=this.outbound_cipher=null;this.outbound_sequence_num=this.inbound_sequence_num=this.macSize=0;this.block_size=8;this.prevHeader=this.inbound_buffer="";this.windowSize=SSHyClient.WINDOW_SIZE;this.recieveData=this.transmitData=0}; -SSHyClient.parceler.prototype={send:function(b){packet=this.pack_message(b.toString());this.encrypting&&(packet=this.outbound_cipher.encrypt(packet)+SSHyClient.hash.HMAC(this.outbound_mac_key,struct.pack("I",this.outbound_sequence_num)+packet,this.hmacSHAVersion));this.socket.sendB64(packet);this.outbound_sequence_num++},pack_message:function(b){var a=3+this.block_size-(b.length+8)%this.block_size;b=struct.pack("I",b.length+a+1)+struct.pack("B",a)+b;return b+=this.encrypting?read_rng(a):Array(a+1).join("\x00")}, -handle:function(b){this.recieveData+=b.length;this.transport.settings.setNetTraffic(transport.parceler.recieveData,!0);if(this.encrypting)this.inbound_buffer+=b,this.decrypt();else if(this.transport.remote_version)this.inbound_buffer+=b,this.decrypt(b);else this.transport.handler_table[0](this.transport,b)},decrypt:function(){for(var b=" ",a;null!==b;){if(this.prevHeader)a=this.prevHeader,this.prevHeader="";else{a=this.read_ibuffer();if(!a)break;this.encrypting&&(a=this.inbound_cipher.decrypt(a))}var h= -struct.unpack("I",a.substring(0,4))[0],d=a.substring(4);b=this.read_ibuffer(h+this.macSize-d.length);if(!b){this.prevHeader=a;break}a=b.substring(0,h-d.length);this.encrypting&&(a=this.inbound_cipher.decrypt(a));a=d+a;if(this.macSize){d=b.substring(h-d.length);var f=struct.pack("I",this.inbound_sequence_num)+struct.pack("I",h)+a;if(SSHyClient.hash.HMAC(this.inbound_mac_key,f,this.hmacSHAVersion)!=d)throw this.transport.disconnect(),"Inbound MAC verification failed - Mismatched MAC";}this.inbound_sequence_num++; -this.windowSize-=h;0>=this.windowSize&&this.transport.winAdjust();this.transport.handle_dec(a)}},read_ibuffer:function(b){b=void 0===b?this.block_size:b;if(this.inbound_buffer.lengththis.shellString.length||(-1!==this.shellString.indexOf("]0;fish")?(this.shellString="",this.fsHintLeave=SSHyClient.fishFsHintLeave):-1!==this.shellString.indexOf("@")&&(this.shellString="",this.fsHintLeave= -SSHyClient.bashFsHintLeave)))},setLocalEcho:function(b){this.localEcho=Math.min(Math.max(this.localEcho+=b,0),2);document.getElementById("currentLEcho").innerHTML=["Force Off","Auto","Force On"][this.localEcho];b=document.getElementById("autoEchoState");1===this.localEcho?(b.style.visibility="visible",b.innerHTML="State: "+(!1===this.autoEchoState?"Disabled":"Enabled")):b.style.visibility="hidden"},parseLocalEcho:function(b){if(1===this.localEcho){var a=performance.now();if(!(100>a-this.autoEchoTimeout))if(b= -b.substring(0,64),!this.autoEchoState)-1!=b.indexOf(this.fsHintLeave)&&-1!=b.indexOf("@")&&(this.autoEchoState=!0,this.autoEchoElement.innerHTML="State: Enabled",this.autoEchoTimeout=a);else if(-1!=b.indexOf(this.fsHintEnter)||-1!=b.toLowerCase().indexOf("password"))this.autoEchoState=!1,this.autoEchoElement.innerHTML="State: Disabled",this.autoEchoTimeout=a}},parseKey:function(b){1===this.localEcho&&!1===this.autoEchoState||1i;i++)a.deleteRule(13);"Tango"=== -h?(this.colorTango=!0,document.getElementById("currentColor").innerHTML="Tango"):(a.insertRule("html, body {background-color: "+b.background+" !important;}",13),a.insertRule(".sidenav {background-color: "+modColorPercent(b.background,-.2)+" !important;}",13),a.insertRule(".brightgreen {color: "+b.brightGreen+" !important;}",13),a.insertRule(".brightyellow {color: "+b.brightYellow+" !important;}",13),this.colorTango=!1,document.getElementById("currentColor").innerHTML=void 0===h?"Custom":h)},importXresources:function(){var b= -new FileReader,a=document.getElementById("Xresources").files[0];b.readAsText(a);b.onload=function(){var h=b.result.split("\n");h=h.sort((new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})).compare);colScheme=[];for(var d=0;dthis.colorNames.length-1||0>this.colorCounter)this.colorCounter=1===b?0:this.colorNames.length-1;this.setColorScheme(this.colorCounter)},modFontSize:function(b){this.fontSize+=b;term.setOption("fontSize",this.fontSize);document.getElementById("currentFontSize").innerHTML= -transport.settings.fontSize+"px";term.fit();transport.auth.mod_pty("window-change",term.cols,term.rows)},modTerm:function(b,a){b?term.resize(term.cols,a):term.resize(a,term.rows);transport.auth.mod_pty("window-change",term.cols,term.rows)},setNetTraffic:function(b,a){if(this.sidenavElementState){switch(!0){case 1024>b:b+="Bytes";break;case 1024<=b&&1048576>b:b=(b/1024).toFixed(3)+"KB";break;case 1048576<=b&&1073741824>b:b=(b/1048576).toFixed(3)+"MB";break;default:b=(b/1073741824).toFixed(3)+"GB"}element= -!0===a?this.rxElement:this.txElement;element.innerHTML=b}}};var ws,transport,term=null;window.msCrypto&&(window.crypto={},window.crypto.getRandomValues=function(b){return window.msCrypto.getRandomValues(b)},Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:Array.prototype.slice}));var resizeInterval; -window.onload=function(){document.body.innerHTML+='
\n\t\t\t\t\t\t\t\t\t×\n\t\t\t\t\t\t\t\t\tTerminal Options\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\tFont Size\n\t\t\t\t\t\t\t\t\t<--\n\t\t\t\t\t\t\t\t\t16px\n\t\t\t\t\t\t\t\t\t--\x3e\n\t\t\t\t\t\t\t\t\tTerminal Size\n\t\t\t\t\t\t\t\t\tCols:\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tRows:\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tLocal Echo\n\t\t\t\t\t\t\t\t\t<--\n\t\t\t\t\t\t\t\t\t--\x3e\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\tState: Enabled\n\t\t\t\t\t\t\t\t\t\tForce Off\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\tColours\n\t\t\t\t\t\t\t\t\t<--\n\t\t\t\t\t\t\t\t\tMonokai\n\t\t\t\t\t\t\t\t\t--\x3e\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\tFormat: Xresources\n\t\t\t\t\t\t\t\t\t\tUpload\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\tKeep Alive\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t0 to disable\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t seconds\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\tNetwork Traffic\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\trx: \n\t\t\t\t\t\t\t\t\t\ttx: \n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t';fit.apply(Terminal); -startSSHy()};window.onresize=function(){clearTimeout(resizeInterval);resizeInterval=setTimeout(resize,400)};window.onbeforeunload=function(){(ws||transport)&&transport.disconnect()};function resize(){term&&term.fit()} -function toggleNav(b){document.getElementById("settingsNav").style.width=b;if(transport.settings.sidenavElementState=b)transport.settings.setNetTraffic(transport.parceler.recieveData,!0),transport.settings.setNetTraffic(transport.parceler.transmitData,!1);b=document.getElementById("gear").style;b.visibility="hidden"===b.visibility?"visible":"hidden"} -function startSSHy(){document.title="SSHy Client";ws=new WebSocket(wsproxyURL,"base64");ws.onopen=function(b){transport=new SSHyClient.Transport(ws);transport.settings.rsaCheckEnabled=!1};ws.onmessage=function(b){transport.parceler.handle(atob(b.data))};ws.onclose=function(b){term?transport.closing||(term.write("\n\n\rWebsocket connection to "+transport.auth.hostname+" was unexpectedly closed."),transport.settings.keepAliveInterval||term.write("\n\n\rThis was likely caused by he remote SSH server timing out the session due to inactivity.\r\n- Session Keep Alive interval can be set in the settings to prevent this behaviour.")): -(termInit(),term.write("WebSocket connection failed: Error in connection establishment: code "+b.code))};ws.sendB64=function(b){this.send(btoa(b));transport.parceler.transmitData+=b.length;transport.settings.setNetTraffic(transport.parceler.transmitData,!1)}} -function termInit(){term=new Terminal({cols:80,rows:24});term.open(document.getElementById("terminal"),!0);term.fit();term.focus();document.getElementById("termCols").value=term.cols;document.getElementById("termRows").value=term.rows;transport.settings.setColorScheme(1)} -function startxtermjs(){termInit();transport.auth.authenticated||term.write("Login as: ");term.textarea.onkeydown=function(b){if(ws&&transport&&!(5<=transport.auth.failedAttempts)&&!transport.auth.awaitingAuthentication){var a=b.char&&1==b.char.length?b.char:b.key;if(!(1a.length)if(5E3a;a++)b.add_string(this.preferred_algorithms[a]),b.add_string(this.preferred_algorithms[a]);b.add_boolean(!1);b.add_int(0);this.local_kex_message=b=b.toString();this.send_packet(b)},parse_kex_reply:function(b){b=new SSHyClient.Message(b);b.get_bytes(17);var a=filter(this.preferred_algorithms[0],b.get_string().split(",")),h=filter(this.preferred_algorithms[1],b.get_string().split(","));b.get_string();var d=filter(this.preferred_algorithms[2],b.get_string().split(","));b.get_string(); -b=filter(this.preferred_algorithms[3],b.get_string().split(","));if(!(a&&h&&d&&b))throw"Chosen Algs = kex="+a+", keys="+h+", cipher="+d+", mac="+b;this.preferred_kex=this.kex_info[a](this);this.preferred_mac=this.mac_info[b](this)},generate_key:function(b,a){var h=new SSHyClient.Message;h.add_mpint(SSHyClient.kex.K);h.add_bytes(SSHyClient.kex.H);h.add_bytes(b);h.add_bytes(SSHyClient.kex.sessionId);return"SHA-1"==this.preferred_kex.SHAVersion?(new SSHyClient.hash.SHA1(h.toString())).digest().substring(0, -a):(new SSHyClient.hash.SHA256(h.toString())).digest().substring(0,a)},activate_encryption:function(){this.parceler.block_size=16;this.parceler.macSize=this.preferred_hash;this.parceler.outbound_enc_iv=this.generate_key("A",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.outbound_enc_key=this.generate_key("C",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.outbound_mac_key=this.generate_key("E",this.parceler.macSize,this.preferred_kex.SHAVersion);this.parceler.outbound_cipher= -new SSHyClient.crypto.AES(this.parceler.outbound_enc_key,SSHyClient.AES_CTR,this.parceler.outbound_enc_iv,new SSHyClient.crypto.counter(8*this.parceler.block_size,inflate_long(this.parceler.outbound_enc_iv)));this.parceler.inbound_enc_iv=this.generate_key("B",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.inbound_enc_key=this.generate_key("D",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.inbound_mac_key=this.generate_key("F",this.parceler.macSize,this.preferred_kex.SHAVersion); -this.parceler.inbound_cipher=new SSHyClient.crypto.AES(this.parceler.inbound_enc_key,SSHyClient.AES_CTR,this.parceler.inbound_enc_iv,new SSHyClient.crypto.counter(8*this.parceler.block_size,inflate_long(this.parceler.inbound_enc_iv)));this.parceler.encrypting=!0;this.auth.request_auth()},handle_dec:function(b){b=this.cut_padding(b);try{this.handler_table[b.substring(0,1).charCodeAt(0)](this,b)}catch(a){console.log(a),console.log("Error! code - "+b.substring(0,1).charCodeAt(0)+" does not exist!")}}, -str_to_bytes:function(b){return unescape(encodeURIComponent(b))},expect_key:function(b){if(b){var a=new SSHyClient.Message;a.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_DATA));a.add_int(0);a.add_string(this.str_to_bytes(b.toString()));this.parceler.send(a)}},send_new_keys:function(b){b=new SSHyClient.Message;b.add_bytes(String.fromCharCode(SSHyClient.MSG_NEW_KEYS));this.send_packet(b)}}; +SSHyClient = { + // Global Defines + MSG_DISCONNECT: 1, + MSG_IGNORE: 2, + MSG_UNIMPLEMENTED: 3, + MSG_DEBUG: 4, + MSG_SERVICE_REQUEST: 5, + MSG_SERVICE_ACCEPT: 6, + + MSG_KEX_INIT: 20, + MSG_NEW_KEYS: 21, + MSG_KEXDH_INIT: 30, + MSG_KEXDH_GEX_GROUP: 31, + MSG_KEXDH_GEX_INIT: 32, + MSG_KEXDH_GEX_REPLY: 33, + MSG_KEXDH_GEX_REQUEST: 34, + + MSG_USERAUTH_REQUEST: 50, + MSG_USERAUTH_FAILURE: 51, + MSG_USERAUTH_SUCCESS: 52, + MSG_USERAUTH_BANNER: 53, + + MSG_GLOBAL_REQUEST: 80, + MSG_REQUEST_SUCCESS: 81, + MSG_REQUEST_FAILURE: 82, + + MSG_CHANNEL_OPEN: 90, + MSG_CHANNEL_OPEN_SUCCESS: 91, + MSG_CHANNEL_OPEN_FAILURE: 92, + MSG_CHANNEL_WINDOW_ADJUST: 93, + MSG_CHANNEL_DATA: 94, + MSG_CHANNEL_EXTENDED_DATA: 95, + MSG_CHANNEL_EOF: 96, + MSG_CHANNEL_CLOSE: 97, + MSG_CHANNEL_REQUEST: 98, + MSG_CHANNEL_SUCCESS: 99, + MSG_CHANNEL_FAILURE: 100, + + WINDOW_SIZE: 40674, // Coppied from Putty + MAX_PACKET_SIZE: 16384, + + AES_CBC: 2, + AES_CTR: 6, + + /* Fish Binding */ + fishFsHintLeave: "\x1b\x5b\x33\x32", + /* Bash Binding */ + bashFsHintLeave: "\x1b\x5d\x30\x3b" +}; +var BigInteger = function() { + function e(a, b, c) { + null != a && ("number" == typeof a ? this.fromNumber(a, b, c) : null == b && "string" != typeof a ? this.fromString(a, 256) : this.fromString(a, b)) + } + + function l() { + return new e(null) + } + + function F(a, b, c, d, k, e) { + for (; 0 <= --e;) { + var f = b * this[a++] + c[d] + k; + k = Math.floor(f / 67108864); + c[d++] = f & 67108863 + } + return k + } + + function G(a, b, c, d, k, e) { + var f = b & 32767; + for (b >>= 15; 0 <= --e;) { + var g = this[a] & 32767, + l = this[a++] >> 15, + m = b * g + l * f, + g = f * g + ((m & 32767) << 15) + c[d] + (k & 1073741823); + k = (g >>> 30) + (m >>> 15) + b * l + (k >>> 30); + c[d++] = + g & 1073741823 + } + return k + } + + function H(a, b, c, d, k, e) { + var f = b & 16383; + for (b >>= 14; 0 <= --e;) { + var g = this[a] & 16383, + l = this[a++] >> 14, + m = b * g + l * f, + g = f * g + ((m & 16383) << 14) + c[d] + k; + k = (g >> 28) + (m >> 14) + b * l; + c[d++] = g & 268435455 + } + return k + } + + function B(a, b) { + var c = y[a.charCodeAt(b)]; + return null == c ? -1 : c + } + + function t(a) { + var b = l(); + b.fromInt(a); + return b + } + + function z(a) { + var b = 1, + c; + 0 != (c = a >>> 16) && (a = c, b += 16); + 0 != (c = a >> 8) && (a = c, b += 8); + 0 != (c = a >> 4) && (a = c, b += 4); + 0 != (c = a >> 2) && (a = c, b += 2); + 0 != a >> 1 && (b += 1); + return b + } + + function u(a) { + this.m = a + } + + function w(a) { + this.m = + a; + this.mp = a.invDigit(); + this.mpl = this.mp & 32767; + this.mph = this.mp >> 15; + this.um = (1 << a.DB - 15) - 1; + this.mt2 = 2 * a.t + } + + function I(a, b) { + return a & b + } + + function A(a, b) { + return a | b + } + + function C(a, b) { + return a ^ b + } + + function D(a, b) { + return a & ~b + } + + function v() {} + + function E(a) { + return a + } + + function x(a) { + this.r2 = l(); + this.q3 = l(); + e.ONE.dlShiftTo(2 * a.t, this.r2); + this.mu = this.r2.divide(a); + this.m = a + } + var m; + "Microsoft Internet Explorer" == navigator.appName ? (e.prototype.am = G, m = 30) : "Netscape" != navigator.appName ? (e.prototype.am = F, m = 26) : (e.prototype.am = + H, m = 28); + e.prototype.DB = m; + e.prototype.DM = (1 << m) - 1; + e.prototype.DV = 1 << m; + e.prototype.FV = Math.pow(2, 52); + e.prototype.F1 = 52 - m; + e.prototype.F2 = 2 * m - 52; + var y = [], + n; + m = 48; + for (n = 0; 9 >= n; ++n) y[m++] = n; + m = 97; + for (n = 10; 36 > n; ++n) y[m++] = n; + m = 65; + for (n = 10; 36 > n; ++n) y[m++] = n; + u.prototype.convert = function(a) { + return 0 > a.s || 0 <= a.compareTo(this.m) ? a.mod(this.m) : a + }; + u.prototype.revert = function(a) { + return a + }; + u.prototype.reduce = function(a) { + a.divRemTo(this.m, null, a) + }; + u.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c); + this.reduce(c) + }; + u.prototype.sqrTo = + function(a, b) { + a.squareTo(b); + this.reduce(b) + }; + w.prototype.convert = function(a) { + var b = l(); + a.abs().dlShiftTo(this.m.t, b); + b.divRemTo(this.m, null, b); + 0 > a.s && 0 < b.compareTo(e.ZERO) && this.m.subTo(b, b); + return b + }; + w.prototype.revert = function(a) { + var b = l(); + a.copyTo(b); + this.reduce(b); + return b + }; + w.prototype.reduce = function(a) { + for (; a.t <= this.mt2;) a[a.t++] = 0; + for (var b = 0; b < this.m.t; ++b) { + var c = a[b] & 32767, + d = c * this.mpl + ((c * this.mph + (a[b] >> 15) * this.mpl & this.um) << 15) & a.DM, + c = b + this.m.t; + for (a[c] += this.m.am(0, d, a, b, 0, this.m.t); a[c] >= + a.DV;) a[c] -= a.DV, a[++c]++ + } + a.clamp(); + a.drShiftTo(this.m.t, a); + 0 <= a.compareTo(this.m) && a.subTo(this.m, a) + }; + w.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c); + this.reduce(c) + }; + w.prototype.sqrTo = function(a, b) { + a.squareTo(b); + this.reduce(b) + }; + e.prototype.copyTo = function(a) { + for (var b = this.t - 1; 0 <= b; --b) a[b] = this[b]; + a.t = this.t; + a.s = this.s + }; + e.prototype.fromInt = function(a) { + this.t = 1; + this.s = 0 > a ? -1 : 0; + 0 < a ? this[0] = a : -1 > a ? this[0] = a + DV : this.t = 0 + }; + e.prototype.fromString = function(a, b) { + var c; + if (16 == b) c = 4; + else if (8 == b) c = 3; + else if (256 == + b) c = 8; + else if (2 == b) c = 1; + else if (32 == b) c = 5; + else if (4 == b) c = 2; + else { + this.fromRadix(a, b); + return + } + this.s = this.t = 0; + for (var d = a.length, k = !1, f = 0; 0 <= --d;) { + var h = 8 == c ? a[d] & 255 : B(a, d); + 0 > h ? "-" == a.charAt(d) && (k = !0) : (k = !1, 0 == f ? this[this.t++] = h : f + c > this.DB ? (this[this.t - 1] |= (h & (1 << this.DB - f) - 1) << f, this[this.t++] = h >> this.DB - f) : this[this.t - 1] |= h << f, f += c, f >= this.DB && (f -= this.DB)) + } + 8 == c && 0 != (a[0] & 128) && (this.s = -1, 0 < f && (this[this.t - 1] |= (1 << this.DB - f) - 1 << f)); + this.clamp(); + k && e.ZERO.subTo(this, this) + }; + e.prototype.clamp = function() { + for (var a = + this.s & this.DM; 0 < this.t && this[this.t - 1] == a;) --this.t + }; + e.prototype.dlShiftTo = function(a, b) { + var c; + for (c = this.t - 1; 0 <= c; --c) b[c + a] = this[c]; + for (c = a - 1; 0 <= c; --c) b[c] = 0; + b.t = this.t + a; + b.s = this.s + }; + e.prototype.drShiftTo = function(a, b) { + for (var c = a; c < this.t; ++c) b[c - a] = this[c]; + b.t = Math.max(this.t - a, 0); + b.s = this.s + }; + e.prototype.lShiftTo = function(a, b) { + var c = a % this.DB, + d = this.DB - c, + e = (1 << d) - 1, + f = Math.floor(a / this.DB), + h = this.s << c & this.DM, + g; + for (g = this.t - 1; 0 <= g; --g) b[g + f + 1] = this[g] >> d | h, h = (this[g] & e) << c; + for (g = f - 1; 0 <= g; --g) b[g] = + 0; + b[f] = h; + b.t = this.t + f + 1; + b.s = this.s; + b.clamp() + }; + e.prototype.rShiftTo = function(a, b) { + b.s = this.s; + var c = Math.floor(a / this.DB); + if (c >= this.t) b.t = 0; + else { + var d = a % this.DB, + e = this.DB - d, + f = (1 << d) - 1; + b[0] = this[c] >> d; + for (var h = c + 1; h < this.t; ++h) b[h - c - 1] |= (this[h] & f) << e, b[h - c] = this[h] >> d; + 0 < d && (b[this.t - c - 1] |= (this.s & f) << e); + b.t = this.t - c; + b.clamp() + } + }; + e.prototype.subTo = function(a, b) { + for (var c = 0, d = 0, e = Math.min(a.t, this.t); c < e;) d += this[c] - a[c], b[c++] = d & this.DM, d >>= this.DB; + if (a.t < this.t) { + for (d -= a.s; c < this.t;) d += this[c], b[c++] = + d & this.DM, d >>= this.DB; + d += this.s + } else { + for (d += this.s; c < a.t;) d -= a[c], b[c++] = d & this.DM, d >>= this.DB; + d -= a.s + } + b.s = 0 > d ? -1 : 0; - 1 > d ? b[c++] = this.DV + d : 0 < d && (b[c++] = d); + b.t = c; + b.clamp() + }; + e.prototype.multiplyTo = function(a, b) { + var c = this.abs(), + d = a.abs(), + k = c.t; + for (b.t = k + d.t; 0 <= --k;) b[k] = 0; + for (k = 0; k < d.t; ++k) b[k + c.t] = c.am(0, d[k], b, k, 0, c.t); + b.s = 0; + b.clamp(); + this.s != a.s && e.ZERO.subTo(b, b) + }; + e.prototype.squareTo = function(a) { + for (var b = this.abs(), c = a.t = 2 * b.t; 0 <= --c;) a[c] = 0; + for (c = 0; c < b.t - 1; ++c) { + var d = b.am(c, b[c], a, 2 * c, 0, 1); + (a[c + + b.t] += b.am(c + 1, 2 * b[c], a, 2 * c + 1, d, b.t - c - 1)) >= b.DV && (a[c + b.t] -= b.DV, a[c + b.t + 1] = 1) + } + 0 < a.t && (a[a.t - 1] += b.am(c, b[c], a, 2 * c, 0, 1)); + a.s = 0; + a.clamp() + }; + e.prototype.divRemTo = function(a, b, c) { + var d = a.abs(); + if (!(0 >= d.t)) { + var k = this.abs(); + if (k.t < d.t) null != b && b.fromInt(0), null != c && this.copyTo(c); + else { + null == c && (c = l()); + var f = l(), + h = this.s; + a = a.s; + var g = this.DB - z(d[d.t - 1]); + 0 < g ? (d.lShiftTo(g, f), k.lShiftTo(g, c)) : (d.copyTo(f), k.copyTo(c)); + d = f.t; + k = f[d - 1]; + if (0 != k) { + var m = k * (1 << this.F1) + (1 < d ? f[d - 2] >> this.F2 : 0), + p = this.FV / m, + m = (1 << + this.F1) / m, + n = 1 << this.F2, + r = c.t, + t = r - d, + q = null == b ? l() : b; + f.dlShiftTo(t, q); + 0 <= c.compareTo(q) && (c[c.t++] = 1, c.subTo(q, c)); + e.ONE.dlShiftTo(d, q); + for (q.subTo(f, f); f.t < d;) f[f.t++] = 0; + for (; 0 <= --t;) { + var u = c[--r] == k ? this.DM : Math.floor(c[r] * p + (c[r - 1] + n) * m); + if ((c[r] += f.am(0, u, c, t, 0, d)) < u) + for (f.dlShiftTo(t, q), c.subTo(q, c); c[r] < --u;) c.subTo(q, c) + } + null != b && (c.drShiftTo(d, b), h != a && e.ZERO.subTo(b, b)); + c.t = d; + c.clamp(); + 0 < g && c.rShiftTo(g, c); + 0 > h && e.ZERO.subTo(c, c) + } + } + } + }; + e.prototype.invDigit = function() { + if (1 > this.t) return 0; + var a = + this[0]; + if (0 == (a & 1)) return 0; + var b = a & 3, + b = b * (2 - (a & 15) * b) & 15, + b = b * (2 - (a & 255) * b) & 255, + b = b * (2 - ((a & 65535) * b & 65535)) & 65535, + b = b * (2 - a * b % this.DV) % this.DV; + return 0 < b ? this.DV - b : -b + }; + e.prototype.isEven = function() { + return 0 == (0 < this.t ? this[0] & 1 : this.s) + }; + e.prototype.exp = function(a, b) { + if (4294967295 < a || 1 > a) return e.ONE; + var c = l(), + d = l(), + k = b.convert(this), + f = z(a) - 1; + for (k.copyTo(c); 0 <= --f;) + if (b.sqrTo(c, d), 0 < (a & 1 << f)) b.mulTo(d, k, c); + else var h = c, + c = d, + d = h; + return b.revert(c) + }; + e.prototype.toString = function(a) { + if (0 > this.s) return "-" + + this.negate().toString(a); + if (16 == a) a = 4; + else if (8 == a) a = 3; + else if (2 == a) a = 1; + else if (32 == a) a = 5; + else if (4 == a) a = 2; + else return this.toRadix(a); + var b = (1 << a) - 1, + c, d = !1, + e = "", + f = this.t, + h = this.DB - f * this.DB % a; + if (0 < f--) + for (h < this.DB && 0 < (c = this[f] >> h) && (d = !0, e = "0123456789abcdefghijklmnopqrstuvwxyz".charAt(c)); 0 <= f;) h < a ? (c = (this[f] & (1 << h) - 1) << a - h, c |= this[--f] >> (h += this.DB - a)) : (c = this[f] >> (h -= a) & b, 0 >= h && (h += this.DB, --f)), 0 < c && (d = !0), d && (e += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(c)); + return d ? e : "0" + }; + e.prototype.negate = + function() { + var a = l(); + e.ZERO.subTo(this, a); + return a + }; + e.prototype.abs = function() { + return 0 > this.s ? this.negate() : this + }; + e.prototype.compareTo = function(a) { + var b = this.s - a.s; + if (0 != b) return b; + var c = this.t, + b = c - a.t; + if (0 != b) return b; + for (; 0 <= --c;) + if (0 != (b = this[c] - a[c])) return b; + return 0 + }; + e.prototype.bitLength = function() { + return 0 >= this.t ? 0 : this.DB * (this.t - 1) + z(this[this.t - 1] ^ this.s & this.DM) + }; + e.prototype.mod = function(a) { + var b = l(); + this.abs().divRemTo(a, null, b); + 0 > this.s && 0 < b.compareTo(e.ZERO) && a.subTo(b, b); + return b + }; + e.prototype.modPowInt = function(a, b) { + var c; + c = 256 > a || b.isEven() ? new u(b) : new w(b); + return this.exp(a, c) + }; + e.ZERO = t(0); + e.ONE = t(1); + v.prototype.convert = E; + v.prototype.revert = E; + v.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c) + }; + v.prototype.sqrTo = function(a, b) { + a.squareTo(b) + }; + x.prototype.convert = function(a) { + if (0 > a.s || a.t > 2 * this.m.t) return a.mod(this.m); + if (0 > a.compareTo(this.m)) return a; + var b = l(); + a.copyTo(b); + this.reduce(b); + return b + }; + x.prototype.revert = function(a) { + return a + }; + x.prototype.reduce = function(a) { + a.drShiftTo(this.m.t - + 1, this.r2); + a.t > this.m.t + 1 && (a.t = this.m.t + 1, a.clamp()); + this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); + for (this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); 0 > a.compareTo(this.r2);) a.dAddOffset(1, this.m.t + 1); + for (a.subTo(this.r2, a); 0 <= a.compareTo(this.m);) a.subTo(this.m, a) + }; + x.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c); + this.reduce(c) + }; + x.prototype.sqrTo = function(a, b) { + a.squareTo(b); + this.reduce(b) + }; + var p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, + 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509 + ], + J = 67108864 / p[p.length - 1]; + e.prototype.chunkSize = function(a) { + return Math.floor(Math.LN2 * this.DB / Math.log(a)) + }; + e.prototype.toRadix = function(a) { + null == a && (a = 10); + if (0 == this.signum() || 2 > a || 36 < a) return "0"; + var b = this.chunkSize(a), + b = Math.pow(a, + b), + c = t(b), + d = l(), + e = l(), + f = ""; + for (this.divRemTo(c, d, e); 0 < d.signum();) f = (b + e.intValue()).toString(a).substr(1) + f, d.divRemTo(c, d, e); + return e.intValue().toString(a) + f + }; + e.prototype.fromRadix = function(a, b) { + this.fromInt(0); + null == b && (b = 10); + for (var c = this.chunkSize(b), d = Math.pow(b, c), k = !1, f = 0, h = 0, g = 0; g < a.length; ++g) { + var l = B(a, g); + 0 > l ? "-" == a.charAt(g) && 0 == this.signum() && (k = !0) : (h = b * h + l, ++f >= c && (this.dMultiply(d), this.dAddOffset(h, 0), h = f = 0)) + } + 0 < f && (this.dMultiply(Math.pow(b, f)), this.dAddOffset(h, 0)); + k && e.ZERO.subTo(this, + this) + }; + e.prototype.fromNumber = function(a, b, c) { + if ("number" == typeof b) + if (2 > a) this.fromInt(1); + else + for (this.fromNumber(a, c), this.testBit(a - 1) || this.bitwiseTo(e.ONE.shiftLeft(a - 1), A, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(b);) this.dAddOffset(2, 0), this.bitLength() > a && this.subTo(e.ONE.shiftLeft(a - 1), this); + else { + c = []; + var d = a & 7; + c.length = (a >> 3) + 1; + b.nextBytes(c); + c[0] = 0 < d ? c[0] & (1 << d) - 1 : 0; + this.fromString(c, 256) + } + }; + e.prototype.bitwiseTo = function(a, b, c) { + var d, e, f = Math.min(a.t, this.t); + for (d = + 0; d < f; ++d) c[d] = b(this[d], a[d]); + if (a.t < this.t) { + e = a.s & this.DM; + for (d = f; d < this.t; ++d) c[d] = b(this[d], e); + c.t = this.t + } else { + e = this.s & this.DM; + for (d = f; d < a.t; ++d) c[d] = b(e, a[d]); + c.t = a.t + } + c.s = b(this.s, a.s); + c.clamp() + }; + e.prototype.changeBit = function(a, b) { + var c = e.ONE.shiftLeft(a); + this.bitwiseTo(c, b, c); + return c + }; + e.prototype.addTo = function(a, b) { + for (var c = 0, d = 0, e = Math.min(a.t, this.t); c < e;) d += this[c] + a[c], b[c++] = d & this.DM, d >>= this.DB; + if (a.t < this.t) { + for (d += a.s; c < this.t;) d += this[c], b[c++] = d & this.DM, d >>= this.DB; + d += this.s + } else { + for (d += + this.s; c < a.t;) d += a[c], b[c++] = d & this.DM, d >>= this.DB; + d += a.s + } + b.s = 0 > d ? -1 : 0; + 0 < d ? b[c++] = d : -1 > d && (b[c++] = this.DV + d); + b.t = c; + b.clamp() + }; + e.prototype.dMultiply = function(a) { + this[this.t] = this.am(0, a - 1, this, 0, 0, this.t); + ++this.t; + this.clamp() + }; + e.prototype.dAddOffset = function(a, b) { + if (0 != a) { + for (; this.t <= b;) this[this.t++] = 0; + for (this[b] += a; this[b] >= this.DV;) this[b] -= this.DV, ++b >= this.t && (this[this.t++] = 0), ++this[b] + } + }; + e.prototype.multiplyLowerTo = function(a, b, c) { + var d = Math.min(this.t + a.t, b); + c.s = 0; + for (c.t = d; 0 < d;) c[--d] = + 0; + var e; + for (e = c.t - this.t; d < e; ++d) c[d + this.t] = this.am(0, a[d], c, d, 0, this.t); + for (e = Math.min(a.t, b); d < e; ++d) this.am(0, a[d], c, d, 0, b - d); + c.clamp() + }; + e.prototype.multiplyUpperTo = function(a, b, c) { + --b; + var d = c.t = this.t + a.t - b; + for (c.s = 0; 0 <= --d;) c[d] = 0; + for (d = Math.max(b - this.t, 0); d < a.t; ++d) c[this.t + d - b] = this.am(b - d, a[d], c, 0, 0, this.t + d - b); + c.clamp(); + c.drShiftTo(1, c) + }; + e.prototype.modInt = function(a) { + if (0 >= a) return 0; + var b = this.DV % a, + c = 0 > this.s ? a - 1 : 0; + if (0 < this.t) + if (0 == b) c = this[0] % a; + else + for (var d = this.t - 1; 0 <= d; --d) c = (b * + c + this[d]) % a; + return c + }; + e.prototype.millerRabin = function(a) { + var b = this.subtract(e.ONE), + c = b.getLowestSetBit(); + if (0 >= c) return !1; + var d = b.shiftRight(c); + a = a + 1 >> 1; + a > p.length && (a = p.length); + for (var k = l(), f = 0; f < a; ++f) { + k.fromInt(p[f]); + var h = k.modPow(d, this); + if (0 != h.compareTo(e.ONE) && 0 != h.compareTo(b)) { + for (var g = 1; g++ < c && 0 != h.compareTo(b);) + if (h = h.modPowInt(2, this), 0 == h.compareTo(e.ONE)) return !1; + if (0 != h.compareTo(b)) return !1 + } + } + return !0 + }; + e.prototype.clone = function() { + var a = l(); + this.copyTo(a); + return a + }; + e.prototype.intValue = + function() { + if (0 > this.s) { + if (1 == this.t) return this[0] - this.DV; + if (0 == this.t) return -1 + } else { + if (1 == this.t) return this[0]; + if (0 == this.t) return 0 + } + return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0] + }; + e.prototype.byteValue = function() { + return 0 == this.t ? this.s : this[0] << 24 >> 24 + }; + e.prototype.shortValue = function() { + return 0 == this.t ? this.s : this[0] << 16 >> 16 + }; + e.prototype.signum = function() { + return 0 > this.s ? -1 : 0 >= this.t || 1 == this.t && 0 >= this[0] ? 0 : 1 + }; + e.prototype.toByteArray = function() { + var a = this.t, + b = []; + b[0] = this.s; + var c = this.DB - + a * this.DB % 8, + d, e = 0; + if (0 < a--) + for (c < this.DB && (d = this[a] >> c) != (this.s & this.DM) >> c && (b[e++] = d | this.s << this.DB - c); 0 <= a;) + if (8 > c ? (d = (this[a] & (1 << c) - 1) << 8 - c, d |= this[--a] >> (c += this.DB - 8)) : (d = this[a] >> (c -= 8) & 255, 0 >= c && (c += this.DB, --a)), 0 != (d & 128) && (d |= -256), 0 == e && (this.s & 128) != (d & 128) && ++e, 0 < e || d != this.s) b[e++] = d; + return b + }; + e.prototype.equals = function(a) { + return 0 == this.compareTo(a) + }; + e.prototype.min = function(a) { + return 0 > this.compareTo(a) ? this : a + }; + e.prototype.max = function(a) { + return 0 < this.compareTo(a) ? this : a + }; + e.prototype.and = + function(a) { + var b = l(); + this.bitwiseTo(a, I, b); + return b + }; + e.prototype.or = function(a) { + var b = l(); + this.bitwiseTo(a, A, b); + return b + }; + e.prototype.xor = function(a) { + var b = l(); + this.bitwiseTo(a, C, b); + return b + }; + e.prototype.andNot = function(a) { + var b = l(); + this.bitwiseTo(a, D, b); + return b + }; + e.prototype.not = function() { + for (var a = l(), b = 0; b < this.t; ++b) a[b] = this.DM & ~this[b]; + a.t = this.t; + a.s = ~this.s; + return a + }; + e.prototype.shiftLeft = function(a) { + var b = l(); + 0 > a ? this.rShiftTo(-a, b) : this.lShiftTo(a, b); + return b + }; + e.prototype.shiftRight = function(a) { + var b = + l(); + 0 > a ? this.lShiftTo(-a, b) : this.rShiftTo(a, b); + return b + }; + e.prototype.getLowestSetBit = function() { + for (var a = 0; a < this.t; ++a) + if (0 != this[a]) { + var b = a * this.DB; + a = this[a]; + if (0 == a) a = -1; + else { + var c = 0; + 0 == (a & 65535) && (a >>= 16, c += 16); + 0 == (a & 255) && (a >>= 8, c += 8); + 0 == (a & 15) && (a >>= 4, c += 4); + 0 == (a & 3) && (a >>= 2, c += 2); + 0 == (a & 1) && ++c; + a = c + } + return b + a + } + return 0 > this.s ? this.t * this.DB : -1 + }; + e.prototype.bitCount = function() { + for (var a = 0, b = this.s & this.DM, c = 0; c < this.t; ++c) { + for (var d = this[c] ^ b, e = 0; 0 != d;) d &= d - 1, ++e; + a += e + } + return a + }; + e.prototype.testBit = + function(a) { + var b = Math.floor(a / this.DB); + return b >= this.t ? 0 != this.s : 0 != (this[b] & 1 << a % this.DB) + }; + e.prototype.setBit = function(a) { + return this.changeBit(a, A) + }; + e.prototype.clearBit = function(a) { + return this.changeBit(a, D) + }; + e.prototype.flipBit = function(a) { + return this.changeBit(a, C) + }; + e.prototype.add = function(a) { + var b = l(); + this.addTo(a, b); + return b + }; + e.prototype.subtract = function(a) { + var b = l(); + this.subTo(a, b); + return b + }; + e.prototype.multiply = function(a) { + var b = l(); + this.multiplyTo(a, b); + return b + }; + e.prototype.divide = function(a) { + var b = + l(); + this.divRemTo(a, b, null); + return b + }; + e.prototype.remainder = function(a) { + var b = l(); + this.divRemTo(a, null, b); + return b + }; + e.prototype.divideAndRemainder = function(a) { + var b = l(), + c = l(); + this.divRemTo(a, b, c); + return [b, c] + }; + e.prototype.modPow = function(a, b) { + var c = a.bitLength(), + d, e = t(1), + f; + if (0 >= c) return e; + d = 18 > c ? 1 : 48 > c ? 3 : 144 > c ? 4 : 768 > c ? 5 : 6; + f = 8 > c ? new u(b) : b.isEven() ? new x(b) : new w(b); + var h = [], + g = 3, + m = d - 1, + p = (1 << d) - 1; + h[1] = f.convert(this); + if (1 < d) + for (c = l(), f.sqrTo(h[1], c); g <= p;) h[g] = l(), f.mulTo(c, h[g - 2], h[g]), g += 2; + for (var n = + a.t - 1, r, v = !0, q = l(), c = z(a[n]) - 1; 0 <= n;) { + c >= m ? r = a[n] >> c - m & p : (r = (a[n] & (1 << c + 1) - 1) << m - c, 0 < n && (r |= a[n - 1] >> this.DB + c - m)); + for (g = d; 0 == (r & 1);) r >>= 1, --g; + 0 > (c -= g) && (c += this.DB, --n); + if (v) h[r].copyTo(e), v = !1; + else { + for (; 1 < g;) f.sqrTo(e, q), f.sqrTo(q, e), g -= 2; + 0 < g ? f.sqrTo(e, q) : (g = e, e = q, q = g); + f.mulTo(q, h[r], e) + } + for (; 0 <= n && 0 == (a[n] & 1 << c);) f.sqrTo(e, q), g = e, e = q, q = g, 0 > --c && (c = this.DB - 1, --n) + } + return f.revert(e) + }; + e.prototype.modInverse = function(a) { + var b = a.isEven(); + if (this.isEven() && b || 0 == a.signum()) return e.ZERO; + for (var c = a.clone(), + d = this.clone(), k = t(1), f = t(0), h = t(0), g = t(1); 0 != c.signum();) { + for (; c.isEven();) c.rShiftTo(1, c), b ? (k.isEven() && f.isEven() || (k.addTo(this, k), f.subTo(a, f)), k.rShiftTo(1, k)) : f.isEven() || f.subTo(a, f), f.rShiftTo(1, f); + for (; d.isEven();) d.rShiftTo(1, d), b ? (h.isEven() && g.isEven() || (h.addTo(this, h), g.subTo(a, g)), h.rShiftTo(1, h)) : g.isEven() || g.subTo(a, g), g.rShiftTo(1, g); + 0 <= c.compareTo(d) ? (c.subTo(d, c), b && k.subTo(h, k), f.subTo(g, f)) : (d.subTo(c, d), b && h.subTo(k, h), g.subTo(f, g)) + } + if (0 != d.compareTo(e.ONE)) return e.ZERO; + if (0 <= g.compareTo(a)) return g.subtract(a); + if (0 > g.signum()) g.addTo(a, g); + else return g; + return 0 > g.signum() ? g.add(a) : g + }; + e.prototype.pow = function(a) { + return this.exp(a, new v) + }; + e.prototype.gcd = function(a) { + var b = 0 > this.s ? this.negate() : this.clone(); + a = 0 > a.s ? a.negate() : a.clone(); + if (0 > b.compareTo(a)) { + var c = b, + b = a; + a = c + } + var c = b.getLowestSetBit(), + d = a.getLowestSetBit(); + if (0 > d) return b; + c < d && (d = c); + 0 < d && (b.rShiftTo(d, b), a.rShiftTo(d, a)); + for (; 0 < b.signum();) 0 < (c = b.getLowestSetBit()) && b.rShiftTo(c, b), 0 < (c = a.getLowestSetBit()) && + a.rShiftTo(c, a), 0 <= b.compareTo(a) ? (b.subTo(a, b), b.rShiftTo(1, b)) : (a.subTo(b, a), a.rShiftTo(1, a)); + 0 < d && a.lShiftTo(d, a); + return a + }; + e.prototype.isProbablePrime = function(a) { + var b, c = this.abs(); + if (1 == c.t && c[0] <= p[p.length - 1]) { + for (b = 0; b < p.length; ++b) + if (c[0] == p[b]) return !0; + return !1 + } + if (c.isEven()) return !1; + for (b = 1; b < p.length;) { + for (var d = p[b], e = b + 1; e < p.length && d < J;) d *= p[e++]; + for (d = c.modInt(d); b < e;) + if (0 == d % p[b++]) return !1 + } + return c.millerRabin(a) + }; + return { + BigInteger: e + } + }(), + BigInteger = BigInteger.BigInteger; +SSHyClient.hash = {}; + +SSHyClient.hash.SHA1 = function(a) { + this.data = a || ""; + this.digest_size = 20 +}; +SSHyClient.hash.SHA1.prototype = { + digest: function() { + var a = toByteArray(this.data), + h = bytesToWords(a), + f = 8 * a.length, + a = [], + g = 1732584193, + c = -271733879, + d = -1732584194, + e = 271733878, + k = -1009589776; + h[f >> 5] |= 128 << 24 - f % 32; + h[(f + 64 >>> 9 << 4) + 15] = f; + for (f = 0; f < h.length; f += 16) { + for (var m = g, n = c, p = d, q = e, r = k, b = 0; 80 > b; b++) { + if (16 > b) a[b] = h[f + b]; + else { + var l = a[b - 3] ^ a[b - 8] ^ a[b - 14] ^ a[b - 16]; + a[b] = l << 1 | l >>> 31 + } + l = (g << 5 | g >>> 27) + k + (a[b] >>> 0) + (20 > b ? (c & d | ~c & e) + 1518500249 : 40 > b ? (c ^ d ^ e) + 1859775393 : 60 > b ? (c & d | c & e | d & e) - 1894007588 : (c ^ d ^ e) - 899497514); + k = e; + e = d; + d = c << 30 | c >>> 2; + c = g; + g = l + } + g += m; + c += n; + d += p; + e += q; + k += r + } + return fromByteArray(wordsToBytes([g, c, d, e, k])) + } +}; + +SSHyClient.hash.SHA256 = function(a) { + this.data = a || "" + this.digest_size = 32 +} +SSHyClient.hash.SHA256.prototype = { + digest: function() { + var hashData = toByteArray(this.data); + + // Constants + var K = [ 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 ]; + + var m = bytesToWords(hashData), + l = hashData.length * 8, + H = [ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ], + w = [], + a, b, c, d, e, f, g, h, i, j, + t1, t2; + + // Padding + m[l >> 5] |= 0x80 << (24 - l % 32); + m[((l + 64 >> 9) << 4) + 15] = l; + + for (var i = 0; i < m.length; i += 16) { + a = H[0]; + b = H[1]; + c = H[2]; + d = H[3]; + e = H[4]; + f = H[5]; + g = H[6]; + h = H[7]; + + for (var j = 0; j < 64; j++) { + if (j < 16) { + w[j] = m[j + i]; + } else { + var gamma0x = w[j - 15], + gamma1x = w[j - 2], + gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ + ((gamma0x << 14) | (gamma0x >>> 18)) ^ + (gamma0x >>> 3), + gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ + ((gamma1x << 13) | (gamma1x >>> 19)) ^ + (gamma1x >>> 10); + + w[j] = gamma0 + (w[j - 7] >>> 0) + + gamma1 + (w[j - 16] >>> 0); + } + + var ch = e & f ^ ~e & g, + maj = a & b ^ a & c ^ b & c, + sigma0 = ((a << 30) | (a >>> 2)) ^ + ((a << 19) | (a >>> 13)) ^ + ((a << 10) | (a >>> 22)), + sigma1 = ((e << 26) | (e >>> 6)) ^ + ((e << 21) | (e >>> 11)) ^ + ((e << 7) | (e >>> 25)); + + t1 = (h >>> 0) + sigma1 + ch + (K[j]) + (w[j] >>> 0); + t2 = sigma0 + maj; + + h = g; + g = f; + f = e; + e = (d + t1) >>> 0; + d = c; + c = b; + b = a; + a = (t1 + t2) >>> 0; + } + + H[0] += a; + H[1] += b; + H[2] += c; + H[3] += d; + H[4] += e; + H[5] += f; + H[6] += g; + H[7] += h; + } + + return fromByteArray(wordsToBytes(H)); + } + } + +SSHyClient.hash.HMAC = function(a, g, SHAVersion) { + var b = digestmod = SHAVersion == 'SHA-1' ? SSHyClient.hash.SHA1 : SSHyClient.hash.SHA256, + d = new b, + e = new b; + 64 < a.length && (a = (new b(a)).digest()); + a += Array(64 - a.length + 1).join("\x00"); + for (var b = toByteArray(a).slice(0), f = toByteArray(a).slice(0), c = 0; 64 > c; ++c) b[c] ^= 92, f[c] ^= 54; + d.data += fromByteArray(b) + e.data += fromByteArray(f); + e.data += g; + d.data += e.digest(); + return d.digest() +}; + +SSHyClient.hash.MD5 = function(data){ + var hashData = toByteArray(data); + + var m = bytesToWords(hashData), + l = hashData.length * 8, + a = 1732584193, + b = -271733879, + c = -1732584194, + d = 271733878; + + // Swap endian + for (var i = 0; i < m.length; i++) { + m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | + ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; + } + + // Padding + m[l >>> 5] |= 0x80 << (l % 32); + m[(((l + 64) >>> 9) << 4) + 14] = l; + + // Method shortcuts + var FF = function (a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + var GG = function (a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + var HH = function (a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + var II = function (a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + + for (var i = 0; i < m.length; i += 16) { + var aa = a, + bb = b, + cc = c, + dd = d; + + a = FF(a, b, c, d, m[i+ 0], 7, -680876936); + d = FF(d, a, b, c, m[i+ 1], 12, -389564586); + c = FF(c, d, a, b, m[i+ 2], 17, 606105819); + b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); + a = FF(a, b, c, d, m[i+ 4], 7, -176418897); + d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); + c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); + b = FF(b, c, d, a, m[i+ 7], 22, -45705983); + a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); + d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); + c = FF(c, d, a, b, m[i+10], 17, -42063); + b = FF(b, c, d, a, m[i+11], 22, -1990404162); + a = FF(a, b, c, d, m[i+12], 7, 1804603682); + d = FF(d, a, b, c, m[i+13], 12, -40341101); + c = FF(c, d, a, b, m[i+14], 17, -1502002290); + b = FF(b, c, d, a, m[i+15], 22, 1236535329); + + a = GG(a, b, c, d, m[i+ 1], 5, -165796510); + d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); + c = GG(c, d, a, b, m[i+11], 14, 643717713); + b = GG(b, c, d, a, m[i+ 0], 20, -373897302); + a = GG(a, b, c, d, m[i+ 5], 5, -701558691); + d = GG(d, a, b, c, m[i+10], 9, 38016083); + c = GG(c, d, a, b, m[i+15], 14, -660478335); + b = GG(b, c, d, a, m[i+ 4], 20, -405537848); + a = GG(a, b, c, d, m[i+ 9], 5, 568446438); + d = GG(d, a, b, c, m[i+14], 9, -1019803690); + c = GG(c, d, a, b, m[i+ 3], 14, -187363961); + b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); + a = GG(a, b, c, d, m[i+13], 5, -1444681467); + d = GG(d, a, b, c, m[i+ 2], 9, -51403784); + c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); + b = GG(b, c, d, a, m[i+12], 20, -1926607734); + + a = HH(a, b, c, d, m[i+ 5], 4, -378558); + d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); + c = HH(c, d, a, b, m[i+11], 16, 1839030562); + b = HH(b, c, d, a, m[i+14], 23, -35309556); + a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); + d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); + c = HH(c, d, a, b, m[i+ 7], 16, -155497632); + b = HH(b, c, d, a, m[i+10], 23, -1094730640); + a = HH(a, b, c, d, m[i+13], 4, 681279174); + d = HH(d, a, b, c, m[i+ 0], 11, -358537222); + c = HH(c, d, a, b, m[i+ 3], 16, -722521979); + b = HH(b, c, d, a, m[i+ 6], 23, 76029189); + a = HH(a, b, c, d, m[i+ 9], 4, -640364487); + d = HH(d, a, b, c, m[i+12], 11, -421815835); + c = HH(c, d, a, b, m[i+15], 16, 530742520); + b = HH(b, c, d, a, m[i+ 2], 23, -995338651); + + a = II(a, b, c, d, m[i+ 0], 6, -198630844); + d = II(d, a, b, c, m[i+ 7], 10, 1126891415); + c = II(c, d, a, b, m[i+14], 15, -1416354905); + b = II(b, c, d, a, m[i+ 5], 21, -57434055); + a = II(a, b, c, d, m[i+12], 6, 1700485571); + d = II(d, a, b, c, m[i+ 3], 10, -1894986606); + c = II(c, d, a, b, m[i+10], 15, -1051523); + b = II(b, c, d, a, m[i+ 1], 21, -2054922799); + a = II(a, b, c, d, m[i+ 8], 6, 1873313359); + d = II(d, a, b, c, m[i+15], 10, -30611744); + c = II(c, d, a, b, m[i+ 6], 15, -1560198380); + b = II(b, c, d, a, m[i+13], 21, 1309151649); + a = II(a, b, c, d, m[i+ 4], 6, -145523070); + d = II(d, a, b, c, m[i+11], 10, -1120210379); + c = II(c, d, a, b, m[i+ 2], 15, 718787259); + b = II(b, c, d, a, m[i+ 9], 21, -343485551); + + a = (a + aa) >>> 0; + b = (b + bb) >>> 0; + c = (c + cc) >>> 0; + d = (d + dd) >>> 0; + } + + var rotl = function (n, b) { + return (n << b) | (n >>> (32 - b)); + }; + + var endian = function (n) { + // If number given, swap endian + if (n.constructor == Number) { + return rotl(n, 8) & 0x00FF00FF | + rotl(n, 24) & 0xFF00FF00; + } + + // Else, assume array and swap all items + for (var i = 0; i < n.length; i++) { + n[i] = endian(n[i]); + } + return n; + }; + + return fromByteArray(wordsToBytes(endian([a, b, c, d]))); +}; +sjcl = { + cipher: {} +}; +sjcl.cipher.aes = function(e, d) { + this._tables[0][0][0] || this._precompute(); + this.mode = d; + var c, b, a, f, g, h = this._tables[0][4], + n = this._tables[1]; + b = e.length; + var l = 1; + if (4 !== b && 6 !== b && 8 !== b) throw "invalid aes key size"; + this._key = [f = e.slice(0), g = []]; + for (c = b; c < 4 * b + 28; c++) { + a = f[c - 1]; + if (0 === c % b || 8 === b && 4 === c % b) a = h[a >>> 24] << 24 ^ h[a >> 16 & 255] << 16 ^ h[a >> 8 & 255] << 8 ^ h[a & 255], 0 === c % b && (a = a << 8 ^ a >>> 24 ^ l << 24, l = l << 1 ^ 283 * (l >> 7)); + f[c] = f[c - b] ^ a + } + for (b = 0; c; b++, c--) a = f[b & 3 ? c : c - 4], g[b] = 4 >= c || 4 > b ? a : n[0][h[a >>> 24]] ^ n[1][h[a >> 16 & 255]] ^ n[2][h[a >> + 8 & 255]] ^ n[3][h[a & 255]] +}; +sjcl.cipher.aes.MODE_CBC = 2; +sjcl.cipher.aes.MODE_CTR = 6; +sjcl.cipher.aes.prototype = { + encrypt: function(e, d, c) { + d = this.mode == sjcl.cipher.aes.MODE_CBC ? d : []; + for (var b = [], a = 0; a < e.length / 16; a++) { + var f = e.slice(16 * a, 16 * (a + 1)); + if (this.mode == sjcl.cipher.aes.MODE_CBC) { + for (var g = 0; 16 > g; g++) f[g] ^= d[g]; + d = sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(f), 0)) + } else + for (d = sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(toByteArray(c.increment())), 0)), g = 0; 16 > g; g++) d[g] ^= f[g]; + b = b.concat(d) + } + return b + }, + decrypt: function(e, d) { + for (var c = [], b = 0; b < e.length / + 16; b++) { + var a = e.slice(16 * b, 16 * (b + 1)); + ct = sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(a), 1)); + if (this.mode == sjcl.cipher.aes.MODE_CBC) { + for (var f = 0; 16 > f; f++) ct[f] ^= d[f]; + d = a + } + c = c.concat(ct) + } + return c + }, + _tables: [ + [ + [], + [], + [], + [], + [] + ], + [ + [], + [], + [], + [], + [] + ] + ], + _precompute: function() { + var e = this._tables[0], + d = this._tables[1], + c = e[4], + b = d[4], + a, f, g, h = [], + n = [], + l, p, k, m; + for (a = 0; 256 > a; a++) n[(h[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a; + for (f = g = 0; !c[f]; f ^= l || 1, g = n[g] || 1) + for (k = g ^ g << 1 ^ g << 2 ^ g << 3 ^ g << 4, k = k >> 8 ^ k & 255 ^ 99, c[f] = k, b[k] = f, p = h[a = + h[l = h[f]]], m = 16843009 * p ^ 65537 * a ^ 257 * l ^ 16843008 * f, p = 257 * h[k] ^ 16843008 * k, a = 0; 4 > a; a++) e[a][f] = p = p << 24 ^ p >>> 8, d[a][k] = m = m << 24 ^ m >>> 8; + for (a = 0; 5 > a; a++) e[a] = e[a].slice(0), d[a] = d[a].slice(0) + }, + _crypt: function(e, d) { + if (4 !== e.length) throw "invalid aes block size"; + var c = this._key[d], + b = e[0] ^ c[0], + a = e[d ? 3 : 1] ^ c[1], + f = e[2] ^ c[2], + g = e[d ? 1 : 3] ^ c[3], + h, n, l, p = c.length / 4 - 2, + k, m = 4, + w = [0, 0, 0, 0]; + h = this._tables[d]; + var q = h[0], + r = h[1], + t = h[2], + u = h[3], + v = h[4]; + for (k = 0; k < p; k++) h = q[b >>> 24] ^ r[a >> 16 & 255] ^ t[f >> 8 & 255] ^ u[g & 255] ^ c[m], n = q[a >>> 24] ^ r[f >> + 16 & 255] ^ t[g >> 8 & 255] ^ u[b & 255] ^ c[m + 1], l = q[f >>> 24] ^ r[g >> 16 & 255] ^ t[b >> 8 & 255] ^ u[a & 255] ^ c[m + 2], g = q[g >>> 24] ^ r[b >> 16 & 255] ^ t[a >> 8 & 255] ^ u[f & 255] ^ c[m + 3], m += 4, b = h, a = n, f = l; + for (k = 0; 4 > k; k++) w[d ? 3 & -k : k] = v[b >>> 24] << 24 ^ v[a >> 16 & 255] << 16 ^ v[f >> 8 & 255] << 8 ^ v[g & 255] ^ c[m++], h = b, b = a, a = f, f = g, g = h; + return w + } +}; +sjcl.codec = {}; +sjcl.codec.bytes = { + fromBits: function(e) { + var d = [], + c = sjcl.bitArray.bitLength(e), + b, a; + for (b = 0; b < c / 8; b++) 0 === (b & 3) && (a = e[b / 4]), d.push(a >>> 24), a <<= 8; + return d + }, + toBits: function(e) { + var d = [], + c, b = 0; + for (c = 0; c < e.length; c++) b = b << 8 | e[c], 3 === (c & 3) && (d.push(b), b = 0); + c & 3 && d.push(sjcl.bitArray.partial(8 * (c & 3), b)); + return d + } +}; +sjcl.bitArray = { + bitLength: function(e) { + var d = e.length; + return 0 === d ? 0 : 32 * (d - 1) + sjcl.bitArray.getPartial(e[d - 1]) + }, + partial: function(e, d, c) { + return 32 === e ? d : (c ? d | 0 : d << 32 - e) + 1099511627776 * e + }, + getPartial: function(e) { + return Math.round(e / 1099511627776) || 32 + } +}; +/* + Slightly modified version of [randomart](https://github.com/purpliminal/randomart) + to run in web browsers based on SSH RSA keys +*/ + +var symbols = { + "-2": "E", + "-1": "S", + "0": " ", + "1": ".", + "2": "o", + "3": "+", + "4": "=", + "5": "*", + "6": "B", + "7": "O", + "8": "X", + "9": "@", + "10": "%", + "11": "&", + "12": "#", + "13": "/", + "14": "^" +}; + +var bounds = { + width: 17, + height: 9 +}; + +function createBoard(bounds) { + var result = []; + + for (var i = 0; i < bounds.width; i++) { + result[i] = []; + for (var j = 0; j < bounds.height; j++) { + result[i][j] = 0; + } + } + return result; +} + +function generateBoard(data) { + var board = createBoard(bounds); + + var x = Math.floor(bounds.width / 2); + var y = Math.floor(bounds.height / 2); + + board[x][y] = -1; + + data.forEach( + function(b) { + for (var s = 0; s < 8; s += 2) { + var d = (b >> s) & 3; + + switch (d) { + case 0: // up + case 1: + if (y > 0) y--; + break; + case 2: // down + case 3: + if (y < (bounds.height - 1)) y++; + break; + } + switch (d) { + case 0: // left + case 2: + if (x > 0) x--; + break; + case 1: // right + case 3: + if (x < (bounds.width - 1)) x++; + break; + } + + if (board[x][y] >= 0) board[x][y]++; + } + } + ); + + board[x][y] = -2; + return board; +} + +function boardToString(board) { + result = []; + + for (var i = 0; i < bounds.height; i++) { + result[i] = []; + for (var j = 0; j < bounds.width; j++) { + result[i][j] = symbols[board[j][i]] || symbols[0]; + } + // Add | to start and end of result[i] + result[i] = '|' + result[i].join('') + '|'; + } + result.splice(0, 0, '\n+---[ RSA2048 ]---+'); + result.push('+-----------------+'); + return result.join('\n'); +} + +function randomart(data) { + var buffer = []; + for(var i = 0, length = data.length; i < length; i++){ + buffer.push('0x' + data[i]); + } + // Write the board to HTML + document.getElementById('hostKeyImg').innerHTML = boardToString(generateBoard(buffer)); + return; +} +var struct = { + pack: function(e, a) { + var b = ""; + switch (e) { + case "Q": + var d = new BigInteger("ff", 16), + b = b + String.fromCharCode(a.shiftRight(56).and(d)), + b = b + String.fromCharCode(a.shiftRight(48).and(d)), + b = b + String.fromCharCode(a.shiftRight(40).and(d)), + b = b + String.fromCharCode(a.shiftRight(32).and(d)), + b = b + String.fromCharCode(a.shiftRight(24).and(d)), + b = b + String.fromCharCode(a.shiftRight(16).and(d)), + b = b + String.fromCharCode(a.shiftRight(8).and(d)), + b = b + String.fromCharCode(a.and(d)); + break; + case "I": + b += String.fromCharCode(a >>> + 24 & 255), b += String.fromCharCode(a >>> 16 & 255), b += String.fromCharCode(a >>> 8 & 255); + case "B": + b += String.fromCharCode(a & 255) + } + return b + }, + unpack: function(e, a) { + var b = [], + d = 0, + c = 0; + switch (e) { + case "Q": + c = new BigInteger("0", 10); + c = c.add((new BigInteger(a.charCodeAt(0).toString(), 10)).shiftLeft(56)); + c = c.add((new BigInteger(a.charCodeAt(1).toString(), 10)).shiftLeft(48)); + c = c.add((new BigInteger(a.charCodeAt(2).toString(), 10)).shiftLeft(40)); + c = c.add((new BigInteger(a.charCodeAt(3).toString(), 10)).shiftLeft(32)); + c = c.add((new BigInteger(a.charCodeAt(4).toString(), + 10)).shiftLeft(24)); + c = c.add((new BigInteger(a.charCodeAt(5).toString(), 10)).shiftLeft(16)); + c = c.add((new BigInteger(a.charCodeAt(6).toString(), 10)).shiftLeft(8)); + c = c.add((new BigInteger(a.charCodeAt(7).toString(), 10)).shiftLeft(0)); + b.push(c); + break; + case "I": + c += a.charCodeAt(0) << 24 >>> 0, c += a.charCodeAt(1) << 16 >>> 0, c += a.charCodeAt(2) << 8 >>> 0, d += 3; + case "B": + c += a.charCodeAt(0 + d) << 0 >>> 0, b.push(c) + } + return b + } +}; +function inflate_long(a) { + var c = new BigInteger("0", 10); + a.length % 4 && (a = Array(4 - a.length % 4 + 1).join("\x00") + a); + for (var b = 0; b < a.length; b += 4) + c = c.shiftLeft(32), c = c.add(new BigInteger(struct.unpack("I", a.substring(b, b + 4))[0].toString(), 10)); + return c +} + +function deflate_long(a, c) { + a = "number" == typeof a ? new BigInteger(a.toString(), 10) : a.clone(); + c = void 0 == c ? !0 : c; + for (var b = "", d = new BigInteger("-1", 10), f = new BigInteger("ffffffff", 16); !a.equals(BigInteger.ZERO) && !a.equals(d);) b = struct.pack("I", a.and(f)) + b, a = a.shiftRight(32); + for (var f = !1, e = 0; e < b.length; ++e) { + if (a.equals(BigInteger.ZERO) && "\x00" != b.charAt(e)) { + f = !0; + break + } + if (a.equals(d) && "\u00ff" != b.charAt(e)) { + f = !0; + break + } + } + f || (e = 0, b = a.equals(BigInteger.ZERO) ? "\x00" : "\u00ff"); + b = b.substring(e); + c && (a.equals(BigInteger.ZERO) && + 128 <= b.charCodeAt(0) && (b = "\x00" + b), a.equals(d) && 128 > b.charCodeAt(0) && (b = "\u00ff" + b)); + return b +} +// Converts strings to byte arrays +function toByteArray(a) { + var bufView = new Uint8Array(a.length); + for (var i=0; i < a.length; i++) { + bufView[i] = a.charCodeAt(i); + } + return bufView; +} +// Converts byte arrays to strings +function fromByteArray(a) { + return String.fromCharCode.apply(null, new Uint8Array(a)); +} +// Converts bytes to words +function bytesToWords(a) { + for (var c = [], b = 0, d = 0; b < a.length; b++, d += 8) c[d >>> 5] |= (a[b] & 255) << 24 - d % 32; + return c +} +// Converts words to bytes +function wordsToBytes(a) { + for (var c = [], b = 0; b < 32 * a.length; b += 8) c.push(a[b >>> 5] >>> 24 - b % 32 & 255); + return c +} +// Used to set specific values for the AES counter +function setCharAt(a, c, b) { + return a.substring(0, c) + b + a.substring(c + 1) +}; +// Converts UTF-8 strings to raw encoding that xtemrm.js can handle +function fromUtf8(str) { + var res = ''; + var bytes = toByteArray(str); + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + if (c >= 0x00C0 && c <= 0x00DF) { + var c2 = bytes[++i]; + c = ((c & 0x1F) << 6) | (c2 & 0x3F); + } else if (c >= 0x00E0 && c <= 0x00EF) { + var c2 = bytes[++i]; + var c3 = bytes[++i]; + c = ((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F); + } else if (c >= 0x0080) { + c = '.'; // Invalid encoding, unprintable character + } + res += String.fromCharCode(c); + } + return res; + } +// returns a b byte random number +function read_rng(b) { + return String.fromCharCode.apply(null, window.crypto.getRandomValues(new Uint8Array(b))) +} +// Used for filtering algorithms and selecting the algorithms to be used during kex_init +function filter(client, server) { + client = client.split(',') + for (var x = 0; x < client.length; ++x) { + if (server.indexOf(client[x]) != -1) { + return client[x]; + } + } +} +// Used to split large chunks of text pasted into the client into managable portions +function splitSlice(str, len = 5000) { + var ret = [ ]; + for (var offset = 0, strLen = str.length; offset < strLen; offset += len) { + ret.push(str.slice(offset, len + offset)); + } + return ret; +} +// Modifies a hex color by percent (+/-) light/darkness +function modColorPercent(color, percent) { + var f=parseInt(color.slice(1),16),t=percent<0?0:255,p=percent<0?percent*-1:percent,R=f>>16,G=f>>8&0x00FF,B=f&0x0000FF; + return "#"+(0x1000000+(Math.round((t-R)*p)+R)*0x10000+(Math.round((t-G)*p)+G)*0x100+(Math.round((t-B)*p)+B)).toString(16).slice(1); +} +// Converts an ascii string to hex encoded string +function ascii2hex(a) { + for (var c = "", b = 0; b < a.length; b++) c = 1 == a.charCodeAt(b).toString(16).length ? c + ("0" + a.charCodeAt(b).toString(16)) : c + ("" + a.charCodeAt(b).toString(16)); + return c; +} + +// Moves the cursor back one and deletes a character from xtermjs term +function termBackspace(term) { + term.write('\b'); + term.eraseRight(term.buffers._terminal.buffer.x - 1, term.buffers._terminal.buffer.y); +}SSHyClient.kex = { + K: null, // Our secret key K generated by our preferred_kex algorithm + H: null, // A hash used for encryption key generation by the preferred_keys algorithm + sessionId: null // Session identifier; should be the same as H until a rekey event +}; + +function verifyKey(host_key, sig){ + var rsa = new SSHyClient.RSAKey(new SSHyClient.Message(host_key)); + if(!rsa.verify(SSHyClient.kex.H, new SSHyClient.Message(sig))){ + transport.disconnect(); + throw 'RSA signature verification failed, disconnecting.'; + } +} + +SSHyClient.kex.DiffieHellman = function(transport, group, SHAVersion){ + this.transport = transport; + this.SHAVersion = SHAVersion; + this.group = group; + + // Using group to determine what type of DH; 0= GEX; 1=g1; 14=g14 + if(this.group === undefined){ + this.p = this.q = this.g = this.x = this.e = this.f = null; + + this.minBits = 1024; + this.maxBits = 8192; + this.preferredBits = 2048; + return; + } else if(this.group === 1){ + this.p = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16); + } else if(this.group === 14){ + this.p = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16); + } + + // These only apply to DH group 1 and 14 + this.x = this.e = this.f = new BigInteger('0', 10); + this.G = new BigInteger("2", 10); +}; + +SSHyClient.kex.DiffieHellman.prototype = { + start: function() { + var m = new SSHyClient.Message(); + + if(this.group === undefined){ + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEXDH_GEX_REQUEST)); + m.add_int(this.minBits); + m.add_int(this.preferredBits); + m.add_int(this.maxBits); + } else { + // generates our 128 bit random number + this.x = inflate_long(read_rng(128)); + + // Now we calculate e = (g=2) ^ x mod p + this.e = this.G.modPow(this.x, this.p); + + // Now we create the message and send it + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEXDH_INIT)); + m.add_mpint(this.e); + } + + this.transport.send_packet(m); + }, + + parse_reply: function(ptype, r) { + if(this.group === undefined && ptype == SSHyClient.MSG_KEXDH_GEX_GROUP){ + this.parse_gex_group(r); + return; + } + this.handleDHReply(r); + }, + + handleDHReply: function(r){ + // convert r into message format for deconstruction + r = new SSHyClient.Message(r); + + // get the host key, f and signature from the message + var host_key = r.get_string(); + if(transport.settings.rsaCheckEnabled){ + // Now lets make sure that the host_key is recognised, firstly we'll pre-fetch all the data we require (ip/port/rsaKey) + var key = wsproxyURL.split('/')[3]; + // Cache the hexified host key + var hexHostKey = ascii2hex(host_key); + // Generate the short MD5'd key for randomart and confirm + var shortKey = ascii2hex(SSHyClient.hash.MD5(host_key)).match(/.{2}/g); + + // Create the randomArt image + randomart(shortKey); + + // Since we've got everthing we need lets see if the key exists already + var localObj = localStorage.getItem(key); + + if(localObj){ + // Check all the details match.. they should but Sanity + if(localObj != hexHostKey){ + if(confirm('WARNING - POTENTIAL SECURITY BREACH!\r\n\nThe server\s host key does not match the one SSHy has cached in local storage. This means that either the server administrator has changed the host key, or you have actually connected to another computer pretending to be the server.\r\nThe new rsa2 key fingerprint is:\r\nssh-rsa 2048 ' + shortKey.join(':') + '\r\nIf you were expecting this change and trust the new key, hit `Ok` to add the key to SSHy\'s cache and carry on connecting.\r\nIf you do not trust this new key, hit `Cancel` to abandon the connection')){ + // User has agree'd to the new host key so lets save it for them + localStorage.setItem(key, hexHostKey); + } else { + // Close the connection + ws.close(); + throw 'Error: Locally stored rsa key does not match remote key'; + } + } + } else { + // Prompt the user just like they are in puTTy + if(confirm('The server\'s host key is not cached in local storage. You have no guarentee that the server is the computer you think it is.\n\rThe server\'s rsa2 key finterprint is:\r\nssh-rsa 2048 ' + shortKey.join(':') + '\r\nIf you trust the host, hit `Ok` to add the key to SSHy\'s cache and carry on connecting.\r\nIf you do not trust this host, hit `Cancel` to abandon the connection')){ + // User has confirmed it is correct so save the RSA key + localStorage.setItem(key, hexHostKey); + } else { + // need to disconnect and kill the connection + ws.close(); + throw 'User has declined the rsa-key and closed the connection'; + } + } + } + + this.f = r.get_mpint(); + + var sig = r.get_string(); + // calculate our shared secret key (K) using f + var K = this.f.modPow(this.x, this.p); + + /* + Now we need to generate H = hash(V_C || V_S || I_C || I_S || K_S || e || f || K) + where V_ = identification string, K_ = public host key, I_ = SSH_MSG_KEXINIT message + */ + var m = new SSHyClient.Message(); + m.add_string(this.transport.local_version); + m.add_string(this.transport.remote_version); + m.add_string(this.transport.local_kex_message); + m.add_string(this.transport.remote_kex_message); + m.add_string(host_key); + // Only add these if we're using DH GEX + if(this.group === undefined){ + m.add_int(this.minBits); + m.add_int(this.preferredBits); + m.add_int(this.maxBits); + m.add_mpint(this.p); + m.add_mpint(this.g); + } + m.add_mpint(this.e); + m.add_mpint(this.f); + m.add_mpint(K); + + SSHyClient.kex.K = K; + SSHyClient.kex.sessionId = SSHyClient.kex.H = this.SHAVersion == 'SHA-1' ? new SSHyClient.hash.SHA1(m.toString()).digest() : new SSHyClient.hash.SHA256(m.toString()).digest(); + if(transport.settings.rsaCheckEnabled){ + verifyKey(host_key, sig); + } + this.transport.send_new_keys(); + }, + + // generates our secret x + generate_x: function() { + var q = this.p.subtract(BigInteger.ONE); + q = q.divide(new BigInteger("2", 10)); + + var qnorm = deflate_long(q, 0); + var qhbyte = qnorm[0].charCodeAt(0); + var bytes = qnorm.length; + var qmask = 0xff; + while (!(qhbyte & 0x80)) { + qhbyte <<= 1; + qmask >>= 1; + } + var x; + while (true) { + var x_bytes = read_rng(bytes); + x_bytes = String.fromCharCode(x_bytes[0].charCodeAt(0) & qmask) + x_bytes.substring(1); + x = inflate_long(x_bytes, 1); + if (x.compareTo(BigInteger.ONE) > 0 && q.compareTo(x) > 0) { + break; + } + } + this.x = x; + }, + // gets the prime and group from parse_reply and generates our secret number e + parse_gex_group: function(m) { + m = new SSHyClient.Message(m); + this.p = m.get_mpint(); + this.g = m.get_mpint(); + + this.generate_x(); + + this.e = this.g.modPow(this.x, this.p); + + m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEXDH_GEX_INIT)); + m.add_mpint(this.e); + this.transport.send_packet(m); + } +}; +SSHyClient.Transport = function(ws, settings) { + this.local_version = 'SSH-2.0-SSHyClient'; + this.remote_version = ''; + + // Kex variables + this.local_kex_message = null; // Our local kex init message containing algorithm negotiation + this.remote_kex_message = null; // The remote servers ^ + + // Our supported Algorithms + this.preferred_algorithms = ['diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha256,diffie-hellman-group1-sha1', + 'ssh-rsa', + 'aes128-ctr', + 'hmac-sha2-256,hmac-sha1', + 'none', + '' + ]; + + // Objects storing references to our different algorithm modules + this.preferred_kex = null; + this.preferred_mac = null; + this.preferred_hash = null; + + // Other SSHyClient module classes + this.parceler = new SSHyClient.parceler(ws, this); + this.auth = new SSHyClient.auth(this.parceler); + this.settings = settings === undefined ? new SSHyClient.settings() : settings; + + this.lastKey = ''; + + this.closing = false; +}; + +SSHyClient.Transport.prototype = { + /* Lookup table for all of our supported KEX algorithms + - Called by kex_info[ id] + - returns KEX algorithm */ + kex_info: { + 'diffie-hellman-group1-sha1': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 1, 'SHA-1'); + }, + 'diffie-hellman-group14-sha1': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 14, 'SHA-1'); + }, + 'diffie-hellman-group-exchange-sha1': function(self) { + return new SSHyClient.kex.DiffieHellman(self, undefined, 'SHA-1'); + }, + 'diffie-hellman-group1-sha256': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 1, 'SHA-256'); + }, + 'diffie-hellman-group14-sha256': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 14, 'SHA-256'); + }, + 'diffie-hellman-group-exchange-sha256': function(self) { + return new SSHyClient.kex.DiffieHellman(self, undefined, 'SHA-256'); + } + }, + /* Lookup table for all of our supported MAC algorithms + Called by kex_info[ id] */ + mac_info: { + 'hmac-sha1': function(self) { + self.parceler.hmacSHAVersion = 'SHA-1'; + self.preferred_hash = 20; + return; + }, + 'hmac-sha2-256': function(self) { + self.parceler.hmacSHAVersion = 'SHA-256'; + self.preferred_hash = 32; + return; + } + }, + /* + A table storing various function calls corresponding to the Message ID numbers defined [https://www.ietf.org/rfc/rfc4250.txt] + called like : + `handler_table[id]( SSHyClient.transport, message)` + */ + handler_table: { + /* Sends our local SSH version to the SSH server */ + 0: function(self, m){ + // Directly interface with the websocket + self.parceler.socket.sendB64(self.local_version + '\r\n'); + // Slice off the '/r/n' from the end of our remote version + self.remote_version = m.slice(0, m.length - 2); + self.send_kex_init(); + return; + }, + /* SSH_MSG_DISCONNECT - sent by the SSH server when the connection is gracefully closed */ + 1: function(self, m) { + self.disconnect(); + return; + }, + /* SSH_MSG_IGNORE - sent by the SSH server when keys are not to be echoed */ + 2: function(self, m) { + return; + }, + /* SSH_MSG_UNIMPLEMENTED - sent by the server to indicate a function is not implemented on the remote */ + 3: function(self, m) { + return; + }, + /* SSH_MSG_SERVICE_ACCEPT: sent by the SSH server after the client request's a service (post-kex) */ + 6: function(self, m) { + var service = new SSHyClient.Message(m.slice(1)).get_string(); + // Check th type of message sent by the server and start the appropriate service + if (service == "ssh-userauth") { + self.auth.ssh_connection(); + } + return; + }, + /* SSH_MSG_KEXINIT: sent by the server after algorithm negotiation - contains server's keys and hash */ + 20: function(self, m) { + // Remote_kex_message must have no padding or length meta data so we have to strip that out + self.parse_kex_reply(m); + self.remote_kex_message = m; // we need this later for calculating H + self.preferred_kex.start(); + return; + }, + /* SSH_MSG_NEWKEYS: sent by the server to inform us that it will use encryption from now on */ + 21: function(self){ + self.activate_encryption(); + return; + }, + /* SSH_MSG_KEX_DH_GEX_GROUP: used for DH GroupEx when negotiating which group to use */ + 31: function(self, m) { + /* Since we're just extracting data from r in parse_reply, we don't need to do the processing to remove the padding + and can just remove the first 1 byte (message code) */ + self.preferred_kex.parse_reply(31, m.slice(1)); + return; + }, + /* SSH_MSG_KEX_DH_GEX_REPLY: used for DH GroupEx, sent by the server - contains server's keys and hash */ + 33: function(self, m) { + self.preferred_kex.parse_reply(33, m.slice(1)); + return; + }, + /* SSH_MSG_USERAUTH_FAILURE: sent by the server when there is a complete or partial failure with user authentication */ + 51: function(self, m) { + self.auth.awaitingAuthentication = false; + self.auth.authFailure(); + return; + }, + /* SSH_MSG_USERAUTH_SUCCESS: sent by the server when an authentication attempt succeeds */ + 52: function(self, m) { + self.auth.authenticated = true; + self.auth.awaitingAuthentication = false; + self.auth.auth_success(true); + return; + }, + /* SSH_MSG_GLOBAL_REQUEST: sent by the server to request information, server sends its hostkey after user-auth + but RSA keys (TODO) aren't implemented so for now we can ignore this message */ + 80: function(self, m) { + return; + }, + /* SSH_MSG_CHANNEL_OPEN_CONFIRMATION: sent by the server to inform the client that a new channel has been opened */ + 91: function(self, m) { + self.auth.channelOpened = true; + resize() + self.auth.mod_pty('pty-req', term.cols, term.rows, 'xterm'); + return; + }, + /* SSH_MSG_CHANNEL_WINDOW_ADJUST: sent by the server to inform the client of the maximum window size (bytes) */ + 93: function(self, m) { + return; + }, + /* SSH_MSG_CHANNEL_DATA: text sent by the server which is displayed by writing to the terminal */ + 94: function(self, m) { + // Slice the heading 9 bytes and send the remaining xterm sequence to the terminal + var str = m.slice(9); + + // Local Echo module + if(self.settings.localEcho){ + // Inspect the packet for identifying shell type + self.settings.testShell(str); + // Inspect the packet for fullscreen applications + self.settings.parseLocalEcho(str); + if (self.lastKey) { + /* If packet data == lastkey pressed do nothing, otherwise delete last key in term + and write the returned packet data */ + if (str == self.lastKey.substring(0,1)) { + self.lastKey = self.lastKey.slice(1); + return; + } + self.lastKey = self.lastKey.slice(1); + term.write('\b'); + } + } + // Convert str and write it to console + term.write(fromUtf8(str)); + return; + }, + /* SSH_MSG_CHANNEL_EOF: sent by the server indicating no more data will be sent to the channel*/ + 96: function(self, m) { + return; + }, + /* SSH_MSG_CHANNEL_CLOSE: sent by the server to indicate the channel is now closed; the SSH connection remains open*/ + 97: function(self, m) { + self.disconnect(); + return; + }, + /* SSH_MSG_CHANNEL_REQUEST: sent by the server to request a new channel, as the client we can just ignore this*/ + 98: function(self, m) { + return; + } + }, + + /* + Once the SSH server has transmitted its full window size it gets locked up and cannot send more data + until the window has been readjusted. + + Using WINDOW_SIZE from puTTy + */ + winAdjust: function() { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_WINDOW_ADJUST)); + m.add_int(0); + m.add_int(SSHyClient.WINDOW_SIZE); + + this.send_packet(m.toString()); + this.parceler.windowSize = SSHyClient.WINDOW_SIZE; + }, + // Disconnect the web client from the server with a given error code (11 - SSH_DISCONNECT_BY_APPLICATION ) + disconnect: function(reason) { + this.closing = true; + reason = reason === undefined ? 11 : reason; + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_DISCONNECT)); + m.add_int(reason); + this.send_packet(m.toString()); + ws.close(); + term.write("\r\nConnection to " + this.auth.hostname + " closed. Code - " + reason); + }, + // Sends a null packet to the SSH server to keep the connection alive + keepAlive: function(){ + // Make sure the websocket is still open + if(ws.readyState === 3){ + return; + } + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_IGNORE)); + m.add_string(''); + + transport.send_packet(m.toString()); + }, + /* Cuts the padding 00's off the end of a message by reading the padding length + - param m + returns */ + cut_padding: function(m) { + return m.substring(1, m.length - m[0].charCodeAt(0)); + }, + // Sends the raw packet to the parceler to be encapsulated and sent via websocket + send_packet: function(m) { + this.parceler.send(m); + }, + // Initiates the key exchange process by sending our supported algorithms & ciphers + send_kex_init: function() { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEX_INIT)); + // add 16 random bytes + m.add_bytes(read_rng(16)); + m.add_string(this.preferred_algorithms[0]); // Preferred Kex + m.add_string(this.preferred_algorithms[1]); // Preferred Server keys + // Adds cipher, mac, compression and languages twice + for(var i = 2; i < 6; i++){ + m.add_string(this.preferred_algorithms[i]); + m.add_string(this.preferred_algorithms[i]); + } + + m.add_boolean(false); // Kex guessing + m.add_int(0); + + m = m.toString(); + //save a copy for calculating H later + this.local_kex_message = m; + + this.send_packet(m); + }, + // Parses the server's kex init and selects best fit algorithms & ciphers + parse_kex_reply: function(m) { + m = new SSHyClient.Message(m); + // Cuts the 16 byte random cookie and message flags from the beginning + m.get_bytes(17); + + // Gets the supported algorithms, ignoring repeated keys/cipher algorithms + var kex = filter(this.preferred_algorithms[0], m.get_string().split(',')); + var keys = filter(this.preferred_algorithms[1], m.get_string().split(',')); + m.get_string(); + var cipher = filter(this.preferred_algorithms[2], m.get_string().split(',')); + m.get_string(); + var mac = filter(this.preferred_algorithms[3], m.get_string().split(',')); + + // Sanity checking to make sure nessesary algorithms have been negotiated + if (!kex || !keys || !cipher || !mac) { + var missing = ''; + if (!kex) { + missing += "KEX Algorithm,"; + } + if (!keys) { + missing += "Host Keys,"; + } + if (!cipher) { + missing += "Encryption Cipher,"; + } + if (!mac) { + missing += "MAC Algorithm"; + } + + //term.write("Incompatable SSH server (no compatable - " + missing + " )"); + throw "Chosen Algs = kex=" + kex + ", keys=" + keys + ", cipher=" + cipher + ", mac=" + mac; + } + // Set those preferred Algs + this.preferred_kex = this.kex_info[kex](this); + this.preferred_mac = this.mac_info[mac](this); + }, + + /* Takes a character and size then generates a key to be used by ssh + A = Initial IV client -> server + C = Encryption Key client -> server + E = Integrity Key client -> server + */ + generate_key: function(char, size) { + var m = new SSHyClient.Message(); + m.add_mpint(SSHyClient.kex.K); + m.add_bytes(SSHyClient.kex.H); + m.add_bytes(char); + m.add_bytes(SSHyClient.kex.sessionId); + + return this.preferred_kex.SHAVersion == 'SHA-1' ? new SSHyClient.hash.SHA1(m.toString()).digest().substring(0, size) : new SSHyClient.hash.SHA256(m.toString()).digest().substring(0, size); + }, + // Sets up the keys and ciphers that the parceler will use + activate_encryption: function() { + this.parceler.block_size = 16; + this.parceler.macSize = this.preferred_hash; + + // Generate the keys we need for encryption and HMAC + this.parceler.outbound_enc_iv = this.generate_key('A', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.outbound_enc_key = this.generate_key('C', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.outbound_mac_key = this.generate_key('E', this.parceler.macSize, this.preferred_kex.SHAVersion); + + this.parceler.outbound_cipher = new SSHyClient.crypto.AES(this.parceler.outbound_enc_key, + SSHyClient.AES_CTR, + this.parceler.outbound_enc_iv, + new SSHyClient.crypto.counter(this.parceler.block_size * 8, inflate_long(this.parceler.outbound_enc_iv))); + + this.parceler.inbound_enc_iv = this.generate_key('B', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.inbound_enc_key = this.generate_key('D', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.inbound_mac_key = this.generate_key('F', this.parceler.macSize, this.preferred_kex.SHAVersion); + + this.parceler.inbound_cipher = new SSHyClient.crypto.AES(this.parceler.inbound_enc_key, + SSHyClient.AES_CTR, + this.parceler.inbound_enc_iv, + new SSHyClient.crypto.counter(this.parceler.block_size * 8, inflate_long(this.parceler.inbound_enc_iv))); + + // signal to the parceler that we want to encrypt and decypt + this.parceler.encrypting = true; + + this.auth.request_auth(); + }, + // Takes an arbitrary packet and processes it to be looked up by the handler_table + handle_dec: function(m) { + // Cut the padding off + m = this.cut_padding(m); + // Should now be in format [ptype][message] + try { + this.handler_table[m.substring(0, 1).charCodeAt(0)](this, m); + } catch (err) { + console.log(err); + console.log("Error! code - " + m.substring(0, 1).charCodeAt(0) + " does not exist!"); + } + }, + str_to_bytes: function(s) { + return unescape(encodeURIComponent(s)) + }, + // Takes a char or string and sends it to the SSH server + expect_key: function(command) { + // Make sure a non-null command is being sent + if(!command){ + return; + } + // encapsulates a character or command and sends it to the SSH server + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_DATA)); + m.add_int(0); + m.add_string(this.str_to_bytes(command.toString())); + + this.parceler.send(m); + }, + // Sends the new keys message signaling we're using the generated keys from now on + send_new_keys: function(SHAVersion) { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_NEW_KEYS)); + + this.send_packet(m); + } +}; +/** + * Copyright (c) 2017 The xterm.js authors. All rights reserved. + * @license MIT + */ + +var MINIMUM_COLS = 2; +var MINIMUM_ROWS = 1; +var FitAddon = /** @class */ (function () { + 'use strict'; + function FitAddon() { + } + FitAddon.prototype.activate = function (terminal) { + this._terminal = terminal; + }; + FitAddon.prototype.dispose = function () { }; + FitAddon.prototype.fit = function () { + var dims = this.proposeDimensions(); + if (!dims || !this._terminal) { + return; + } + // TODO: Remove reliance on private API + var core = this._terminal._core; + // Force a full render + if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) { + core._renderService.clear(); + this._terminal.resize(dims.cols, dims.rows); + } + }; + FitAddon.prototype.proposeDimensions = function () { + if (!this._terminal) { + return undefined; + } + if (!this._terminal.element || !this._terminal.element.parentElement) { + return undefined; + } + // TODO: Remove reliance on private API + var core = this._terminal._core; + if (core._renderService.dimensions.actualCellWidth === 0 || core._renderService.dimensions.actualCellHeight === 0) { + return undefined; + } + var parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement); + var parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')); + var parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'))); + var elementStyle = window.getComputedStyle(this._terminal.element); + var elementPadding = { + top: parseInt(elementStyle.getPropertyValue('padding-top')), + bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')), + right: parseInt(elementStyle.getPropertyValue('padding-right')), + left: parseInt(elementStyle.getPropertyValue('padding-left')) + }; + var elementPaddingVer = elementPadding.top + elementPadding.bottom; + var elementPaddingHor = elementPadding.right + elementPadding.left; + var availableHeight = parentElementHeight - elementPaddingVer; + var availableWidth = parentElementWidth - elementPaddingHor - core.viewport.scrollBarWidth; + var geometry = { + cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / core._renderService.dimensions.actualCellWidth)), + rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / core._renderService.dimensions.actualCellHeight)) + }; + return geometry; + }; + return FitAddon; +}()); + +SSHyClient.auth = function(parceler) { + this.parceler = parceler; // We shouldn't need anything from the transport handler + this.authenticated = null; + this.awaitingAuthentication = false; + this.hostname = wsproxyURL ? wsproxyURL.split('/')[2].split(':')[0] : ''; + this.termUsername = ''; + this.termPassword = undefined; + this.failedAttempts = 0; + this.channelOpened = false; +}; + +SSHyClient.auth.prototype = { + // Requests we want to authenticate ourselves with the SSH server + request_auth: function() { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_SERVICE_REQUEST)); + m.add_string('ssh-userauth'); + this.parceler.send(m); + }, + // Sends the username and password provided by index.html + ssh_connection: function() { + if(!this.termUsername || !this.termPassword){ + // If no termUser or termPass has been set then we are likely using the wrapper + if(!term){ + startxtermjs(); + } + return; + } + + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_USERAUTH_REQUEST)); + m.add_string(this.termUsername); + m.add_string("ssh-connection"); + m.add_string("password"); + m.add_boolean(false); + m.add_string(this.termPassword); + + this.awaitingAuthentication = true; + + this.parceler.send(m); + }, + // Called on successful or partially successful SSH connection authentications + auth_success: function(success) { + if (success) { + // Change the window title + document.title = this.termUsername + '@' + this.hostname; + // Purge the username and password + this.termUsername = ''; + this.termPassword = undefined; + // Make sure xtermjs has been initialised + if(!term){ + startxtermjs(); + } + // Starts up the keep alive interval to 240s + transport.settings.setKeepAlive(240); + document.getElementById('keepAlive').value = 240; + // We've been authenticated, lets open a channel + this.open_channel('session'); + } + // TODO: implement follow on tries for authentication (keyboard/public key) + }, + // Opens a channel - generally called right after authenticating with the SSH server + open_channel: function(type, onsuccess) { + onsuccess = onsuccess === undefined ? null : onsuccess; + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_OPEN)); + m.add_string(type); + m.add_int(1); + m.add_int(SSHyClient.WINDOW_SIZE); + m.add_int(SSHyClient.MAX_PACKET_SIZE); + + this.parceler.send(m); + }, + // Requests a pseudo-terminal, defaulting to xterm if no other terminal emulator is provided when type == "pty-req" + // Sends the remote server our terminal rows/cols settings, called by window.resize() when type == "window-change" + mod_pty: function(type, width, height, term) { + if (!this.channelOpened) { + return; + } + + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_REQUEST)); + m.add_int(0); + m.add_string(type); + m.add_boolean(false); // we don't want any enviroment vars to be returned + if (term) { + m.add_string(term); + } + m.add_int(width); + m.add_int(height); + // pixel data, which is overwritten by the above height and width + m.add_int(0); + m.add_int(0); + + if (term) { + // Don't sent any special terminal modes + m.add_string(''); + } + + this.parceler.send(m); + + if (term) { + // invokes the shell session right after sending the packet + this.invoke_shell(); + } + }, + // Invokes the interactive terminal using the pseudo-terminal channel + invoke_shell: function() { + // Craft the shell invocation packet + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_REQUEST)); + m.add_int(0); + m.add_string('shell'); + m.add_boolean(false); + + this.parceler.send(m); + // Start xterm.js + if (this.termPassword === undefined) { + term.write('\n\r'); + return; + } + startxtermjs(); + }, + // Called on unsuccessful SSH connection authentication + authFailure: function() { + if(term){ + term.write("Access Denied\r\n"); + // if we've failed authentication more than 5 times than disconect and warn the user + if (++this.failedAttempts >= 5) { + term.write("Too many failed authentication attempts"); + transport.disconnect(); + return; + } + term.write(this.termUsername + '@' + this.hostname + '\'s password:'); + this.termPassword = ''; + } else { + display_error('Invalid Username or Password'); + } + } +}; +SSHyClient.crypto = {}; + +// AES wrapper for Libs/aes.min.js (SJCL) +SSHyClient.crypto.AES = function(key, mode, iv, counter) { + // Setup our cipher and give it the key and mode + this.cipher = new sjcl.cipher.aes(sjcl.codec.bytes.toBits(toByteArray(key)), mode); + this.mode = mode; + // some support for CBC mode - however not fully implemented + if (this.mode == SSHyClient.AES_CBC) { + this.iv = toByteArray(iv); + } + this.counter = counter; +}; + +SSHyClient.crypto.AES.prototype = { + encrypt: function(plaintext) { + // encrypt the plaintext! + var ciphertext = this.cipher.encrypt(toByteArray(plaintext), this.iv, this.counter); + if (this.mode == SSHyClient.AES_CBC) { + // take the last 16 bytes for our IV + this.iv = ciphertext.slice(-16); + } + // convert the ciphertext from an array of bytes back into text + return fromByteArray(ciphertext); + }, + + decrypt: function(ciphertext) { + var plaintext; + ciphertext = toByteArray(ciphertext); + // do different stuff for CTR & CBC mode + if (this.mode == SSHyClient.AES_CBC) { + plaintext = this.cipher.decrypt(ciphertext, this.iv); + this.iv = ciphertext.slice(-16); + } else { + plaintext = this.cipher.encrypt(ciphertext, this.iv, this.counter); + } + return fromByteArray(plaintext); + } +}; +// Defines our custom counter +SSHyClient.crypto.counter = function(num, init) { + init = init === undefined ? 1 : init; + + this.blocksize = num / 8; + this.overflow = 0; + + // setup the initial counter value depending on if we recieved a number or not. + if (init === 0) { + this.value = new array(this.blocksize + 1).join('\xFF'); + } else { + var val = deflate_long(init.subtract(BigInteger.ONE), false); + this.value = new Array(this.blocksize - val.length + 1).join('\x00') + val; + } +}; + +SSHyClient.crypto.counter.prototype = { + // increment the current counter + increment: function() { + var i = this.blocksize; + while (i--) { + var count = String.fromCharCode((this.value.charCodeAt(i) + 1) % 256); + this.value = setCharAt(this.value, i, count); + if (count != '\x00') { + return this.value; + } + } + + // Deals with counter resetting / overflowing + var x = deflate_long(this.overflow, false); + this.value = new Array(this.blocksize - x.length + 1).join('\x00') + x; + return this.value; + + } +}; +/* + Implementation of SSHv2 Message + + Each packet is a stream of bytes that encode a combinatiuon of strings, integers, booleans + and multipoint integers. + + This class builds or breaks down a bytes stream with the implemented functions + +*/ + +SSHyClient.Message = function(content) { + this.position = 0; + + this.packet = content === undefined ? String() : String(content); +}; + +SSHyClient.Message.prototype = { + toString: function() { + return this.packet; + }, + + get_bytes: function(n) { + var b = this.packet.substring(this.position, this.position + n); + this.position += n; + if (b.length < n && n < 1048576) { // n < 1Mb + return b + new Array(n - b.length + 1).join('\x00'); + } + return b; + }, + + get_int: function() { + return struct.unpack('I', this.get_bytes(4))[0]; + }, + + get_string: function() { + return this.get_bytes(this.get_int()); + }, + + get_mpint: function() { + return inflate_long(this.get_string()); + }, + + add_bytes: function(d) { + this.packet += d; + return this; + }, + + add_boolean: function(b) { + this.add_bytes(b === true ? '\x01' : '\x00'); + return this; + }, + + add_int: function(i) { + this.packet += struct.pack('I', i); + return this; + }, + + add_mpint: function(d) { + this.add_string(deflate_long(d)); + return this; + }, + + add_string: function(d) { + this.add_int(d.length); + this.packet += d; + return this; + } +}; +SSHyClient.parceler = function(web_socket, transport) { + this.socket = web_socket; + this.transport = transport; + this.encrypting = false; + + // Encryption & Mac variables + this.outbound_enc_iv = this.outbound_enc_key = this.outbound_mac_key = this.outbound_cipher= null; + + this.inbound_iv = this.inbound_enc_key = this.inbound_mac_key = this.inbound_cipher = null; + + this.hmacSHAVersion = null; + this.macSize = 0; + + this.outbound_sequence_num = this.inbound_sequence_num = 0; + this.block_size = 8; + + this.prevHeader = this.inbound_buffer = ''; + + this.windowSize = SSHyClient.WINDOW_SIZE; + + /* Stores the recieved and transmitted data in bytes; + possible integer overflow however would need to exchange 8.1PetaBytes of data*/ + this.recieveData = this.transmitData = 0; +}; + +SSHyClient.parceler.prototype = { + // Send / Encrypt messages to the websocket proxy + send: function(data) { + // Encapsulate the data with padding and length + packet = this.pack_message(data.toString()); + + if (this.encrypting) { + // Encrypt the encapsulated packet + var encrypted_packet = this.outbound_cipher.encrypt(packet); + + // Add the mac hash & pack the sequence number + packet = encrypted_packet + SSHyClient.hash.HMAC(this.outbound_mac_key, struct.pack('I', this.outbound_sequence_num) + packet, this.hmacSHAVersion); + } + + // Now send it as a base64 string + this.socket.sendB64(packet); + + this.outbound_sequence_num++; + }, + + // Calculates and adds the packet length, padding length and padding to the message + pack_message: function(data) { + var padding = 3 + this.block_size - ((data.length + 8) % this.block_size); + + // Adds the message length, padding length and data together + var packet = struct.pack('I', data.length + padding + 1) + struct.pack('B', padding) + data; + + // RFC says we should use random bytes but we should only need if we are encrypting. Otherwise it is a waste of time + packet += this.encrypting ? read_rng(padding) : new Array(padding + 1).join('\x00'); + + return packet; + }, + // Handles inbound traffic over the socket + handle: function(r) { + // Add the packet length to the parceler's rx + this.recieveData += r.length; + this.transport.settings.setNetTraffic(transport.parceler.recieveData, true); + /* Checking for encryption first since it will be the most common check + - Parceler should send decrypted message ( -packet length -padding length -padding ) to transport.handle_dec() + from there it should be send to the relevant handler (auth/control) */ + if (this.encrypting) { + this.inbound_buffer += r; + this.decrypt(); + return; + } + + /* If we don't have a remote_version then send our version and set the remote_version */ + if (!this.transport.remote_version) { + var end = r.indexOf('\r\n'); + if (end != -1) { + var rv = r.slice(0, end+2); + this.transport.handler_table[0](this.transport, rv); + r = r.slice(end+2); + } // else that would be bad and probably we should die here + if (r.length<=0) { return; } + } + + this.inbound_buffer += r; + this.decrypt(r); + }, + // Decrypt messages from the SSH server + decrypt: function() { + // Since we cannot guarentee that we will be decyrpting zero, one or multiple packets we have to rely on this.read_ibuffer() + var buffer = ' '; + var header; + while (buffer !== null) { + // If there isn'ta previous header then we need to get one + if (!this.prevHeader) { + // Read [this.block_size] from the inbound buffer + header = this.read_ibuffer(); + if (!header) { // just for safety + return; + } + // Only need to decrypt it if we've enabled encryption + if(this.encrypting){ + header = this.inbound_cipher.decrypt(header); + } + } else { + header = this.prevHeader; + this.prevHeader = ''; + } + // Unpack the packet size from the decrypted header + var packet_size = struct.unpack('I', header.substring(0, 4))[0]; + // We can store the start of our message for later now + var leftover = header.substring(4); + + // Attempt to read [packet_size] from inbound buffer; returns null on failure + buffer = this.read_ibuffer(packet_size + this.macSize - leftover.length); + if (!buffer) { + // Couldn't read [packet_size] so store the prevHeader + this.prevHeader = header; + return; + } + // Get the packet body and mac length from the buffer + var packet = buffer.substring(0, packet_size - leftover.length); + + // Decrypt the packet + if(this.encrypting){ + packet = this.inbound_cipher.decrypt(packet); + } + + // Prepend our leftover header + packet = leftover + packet; + + /* + Now lets verify the MAC - just to make sure! + - To do this we will get the MAC from the message and generate our own MAC, then compare the two. + */ + if(this.macSize){ + var mac = buffer.substring(packet_size - leftover.length); + var mac_payload = struct.pack('I', this.inbound_sequence_num) + struct.pack('I', packet_size) + packet; + var our_mac = SSHyClient.hash.HMAC(this.inbound_mac_key, mac_payload, this.hmacSHAVersion); + if (our_mac != mac) { + // Oops something went wrong, lets close the connection + this.transport.disconnect(); + throw "Inbound MAC verification failed - Mismatched MAC"; + } + } + + // Increment the sequence number + this.inbound_sequence_num++; + + // calculate how much window size we have left + this.windowSize -= packet_size; + + // If we've run out of window size then readjust it + if (this.windowSize <= 0) { + this.transport.winAdjust(); + } + // Send the decoded packet to the transport handler + this.transport.handle_dec(packet); + } + }, + // Read [bytes] from the inbound buffer + read_ibuffer: function(bytes) { // if we don't feed it any arguments we are only wanting one block anyway + bytes = bytes === undefined ? this.block_size : bytes; + if (this.inbound_buffer.length < bytes) { + return null; + } + + var out = this.inbound_buffer.substring(0, bytes); + // Remove the bytes we're taking from the buffer + this.inbound_buffer = this.inbound_buffer.substring(bytes); + return out; + } +}; +SSHyClient.RSAKey = function(msg){ + msg.get_string(); + this.e = msg.get_mpint(); + this.n = msg.get_mpint(); +}; + +SSHyClient.RSAKey.prototype = { + /* Turn a 20-byte SHA1 hash into a blob of data as large as the key's N, + using PKCS1's \"emsa-pkcs1-v1_5\" encoding. */ + pkcs1imify : function(data) { + var SHA1_DIGESTINFO = '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14'; + var filler = new Array(deflate_long(this.n, 0).length - SHA1_DIGESTINFO.length - data.length - 3 + 1).join('\xff'); + return '\x00\x01' + filler + '\x00' + SHA1_DIGESTINFO + data; + }, + /* Compares data (hash H) with the SSH server's signature + returns true if match, false otherwise.*/ + verify : function(data, SSHsig) { + if (SSHsig.get_string() != 'ssh-rsa') { + return false; + } + var sigData = inflate_long(SSHsig.get_string(), true); + var hashObj = inflate_long(this.pkcs1imify(new SSHyClient.hash.SHA1(data).digest()), true); + + return sigData.modPow(this.e, this.n).equals(hashObj); + }, +}; + +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(self,(function(){return(()=>{"use strict";var e={4567:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;var o=r(9042),s=r(6114),a=r(6193),c=r(3656),l=r(844),h=r(5596),u=r(9631),f=function(e){function t(t,r){var i=e.call(this)||this;i._terminal=t,i._renderService=r,i._liveRegionLineCount=0,i._charsToConsume=[],i._charsToAnnounce="",i._accessibilityTreeRoot=document.createElement("div"),i._accessibilityTreeRoot.classList.add("xterm-accessibility"),i._rowContainer=document.createElement("div"),i._rowContainer.setAttribute("role","list"),i._rowContainer.classList.add("xterm-accessibility-tree"),i._rowElements=[];for(var n=0;ne;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),s.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)}),0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,s.isMac&&u.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var r=this._terminal.buffer,i=r.lines.length.toString(),n=e;n<=t;n++){var o=r.translateBufferLineToString(r.ydisp+n,!0),s=(r.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===o.length?a.innerText=" ":a.textContent=o,a.setAttribute("aria-posinset",s),a.setAttribute("aria-setsize",i))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e{function r(e){return e.replace(/\r?\n/g,"\r")}function i(e,t){return t?"[200~"+e+"[201~":e}function n(e,t,n){e=i(e=r(e),n.decPrivateModes.bracketedPasteMode),n.triggerDataEvent(e,!0),t.value=""}function o(e,t,r){var i=r.getBoundingClientRect(),n=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=n+"px",t.style.top=o+"px",t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=i,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,r){e.stopPropagation(),e.clipboardData&&n(e.clipboardData.getData("text/plain"),t,r)},t.paste=n,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,r,i,n){o(e,t,r),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}},4774:(e,t)=>{var r,i,n,o;function s(e){var t=e.toString(16);return t.length<2?"0"+t:t}function a(e,t){return e>>0}}(r=t.channels||(t.channels={})),(i=t.color||(t.color={})).blend=function(e,t){var i=(255&t.rgba)/255;if(1===i)return{css:t.css,rgba:t.rgba};var n=t.rgba>>24&255,o=t.rgba>>16&255,s=t.rgba>>8&255,a=e.rgba>>24&255,c=e.rgba>>16&255,l=e.rgba>>8&255,h=a+Math.round((n-a)*i),u=c+Math.round((o-c)*i),f=l+Math.round((s-l)*i);return{css:r.toCss(h,u,f),rgba:r.toRgba(h,u,f)}},i.isOpaque=function(e){return 255==(255&e.rgba)},i.ensureContrastRatio=function(e,t,r){var i=o.ensureContrastRatio(e.rgba,t.rgba,r);if(i)return o.toColor(i>>24&255,i>>16&255,i>>8&255)},i.opaque=function(e){var t=(255|e.rgba)>>>0,i=o.toChannels(t),n=i[0],s=i[1],a=i[2];return{css:r.toCss(n,s,a),rgba:t}},i.opacity=function(e,t){var i=Math.round(255*t),n=o.toChannels(e.rgba),s=n[0],a=n[1],c=n[2];return{css:r.toCss(s,a,c,i),rgba:r.toRgba(s,a,c,i)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,r){var i=e/255,n=t/255,o=r/255;return.2126*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(n=t.rgb||(t.rgb={})),function(e){function t(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u0||l>0||h>0);)c-=Math.max(0,Math.ceil(.1*c)),l-=Math.max(0,Math.ceil(.1*l)),h-=Math.max(0,Math.ceil(.1*h)),u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));return(c<<24|l<<16|h<<8|255)>>>0}function i(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u>>0}e.ensureContrastRatio=function(e,r,o){var s=n.relativeLuminance(e>>8),c=n.relativeLuminance(r>>8);if(a(s,c)>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i){return{css:r.toCss(e,t,i),rgba:r.toRgba(e,t,i)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=s,t.contrastRatio=a},7239:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;var r=function(){function e(){this._color={},this._rgba={}}return e.prototype.clear=function(){this._color={},this._rgba={}},e.prototype.setCss=function(e,t,r){this._rgba[e]||(this._rgba[e]={}),this._rgba[e][t]=r},e.prototype.getCss=function(e,t){return this._rgba[e]?this._rgba[e][t]:void 0},e.prototype.setColor=function(e,t,r){this._color[e]||(this._color[e]={}),this._color[e][t]=r},e.prototype.getColor=function(e,t){return this._color[e]?this._color[e][t]:void 0},e}();t.ColorContrastCache=r},5680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorManager=t.DEFAULT_ANSI_COLORS=void 0;var i=r(4774),n=r(7239),o=i.css.toColor("#ffffff"),s=i.css.toColor("#000000"),a=i.css.toColor("#ffffff"),c=i.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var e=[i.css.toColor("#2e3436"),i.css.toColor("#cc0000"),i.css.toColor("#4e9a06"),i.css.toColor("#c4a000"),i.css.toColor("#3465a4"),i.css.toColor("#75507b"),i.css.toColor("#06989a"),i.css.toColor("#d3d7cf"),i.css.toColor("#555753"),i.css.toColor("#ef2929"),i.css.toColor("#8ae234"),i.css.toColor("#fce94f"),i.css.toColor("#729fcf"),i.css.toColor("#ad7fa8"),i.css.toColor("#34e2e2"),i.css.toColor("#eeeeec")],t=[0,95,135,175,215,255],r=0;r<216;r++){var n=t[r/36%6|0],o=t[r/6%6|0],s=t[r%6];e.push({css:i.channels.toCss(n,o,s),rgba:i.channels.toRgba(n,o,s)})}for(r=0;r<24;r++){var a=8+10*r;e.push({css:i.channels.toCss(a,a,a),rgba:i.channels.toRgba(a,a,a)})}return e}());var h=function(){function e(e,r){this.allowTransparency=r;var h=e.createElement("canvas");h.width=1,h.height=1;var u=h.getContext("2d");if(!u)throw new Error("Could not get rendering context");this._ctx=u,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new n.ColorContrastCache,this.colors={foreground:o,background:s,cursor:a,cursorAccent:c,selectionTransparent:l,selectionOpaque:i.color.blend(s,l),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return e.prototype.onOptionsChange=function(e){"minimumContrastRatio"===e&&this._contrastCache.clear()},e.prototype.setTheme=function(e){void 0===e&&(e={}),this.colors.foreground=this._parseColor(e.foreground,o),this.colors.background=this._parseColor(e.background,s),this.colors.cursor=this._parseColor(e.cursor,a,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,c,!0),this.colors.selectionTransparent=this._parseColor(e.selection,l,!0),this.colors.selectionOpaque=i.color.blend(this.colors.background,this.colors.selectionTransparent),i.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=i.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(e.black,t.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,t.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,t.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,t.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,t.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,t.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,t.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,t.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},e.prototype._parseColor=function(e,t,r){if(void 0===r&&(r=this.allowTransparency),void 0===e)return t;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=e,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+e+" is invalid using fallback "+t.css),t;this._ctx.fillRect(0,0,1,1);var n=this._ctx.getImageData(0,0,1,1).data;if(255!==n[3]){if(!r)return console.warn("Color: "+e+" is using transparency, but allowTransparency is false. Using fallback "+t.css+"."),t;var o=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map((function(e){return Number(e)})),s=o[0],a=o[1],c=o[2],l=o[3],h=Math.round(255*l);return{rgba:i.channels.toRgba(s,a,c,h),css:e}}return{css:this._ctx.fillStyle,rgba:i.channels.toRgba(n[0],n[1],n[2],n[3])}},e}();t.ColorManager=h},9631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,r,i){e.addEventListener(t,r,i);var n=!1;return{dispose:function(){n||(n=!0,e.removeEventListener(t,r,i))}}}},3551:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var o=r(8460),s=r(2585),a=function(){function e(e,t,r){this._bufferService=e,this._logService=t,this._unicodeService=r,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new o.EventEmitter,this._onHideLinkUnderline=new o.EventEmitter,this._onLinkTooltip=new o.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,r){var i=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=r):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,r)),this._mouseZoneManager.clearAll(t,r),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return i._linkifyRows()}),e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var r=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,i=Math.ceil(2e3/this._bufferService.cols),n=this._bufferService.buffer.iterator(!1,t,r,i,i);n.hasNext();)for(var o=n.next(),s=0;s=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t>9&511:void 0;r.validationCallback?r.validationCallback(a,(function(e){n._rowsTimeoutId||e&&n._addLink(l[1],l[0]-n._bufferService.buffer.ydisp,a,r,f)})):c._addLink(l[1],l[0]-c._bufferService.buffer.ydisp,a,r,f)},c=this;null!==(i=o.exec(t))&&"break"!==a(););},e.prototype._addLink=function(e,t,r,i,n){var o=this;if(this._mouseZoneManager&&this._element){var s=this._unicodeService.getStringCellWidth(r),a=e%this._bufferService.cols,l=t+Math.floor(e/this._bufferService.cols),h=(a+s)%this._bufferService.cols,u=l+Math.floor((a+s)/this._bufferService.cols);0===h&&(h=this._bufferService.cols,u--),this._mouseZoneManager.add(new c(a+1,l+1,h+1,u+1,(function(e){if(i.handler)return i.handler(e,r);var t=window.open();t?(t.opener=null,t.location.href=r):console.warn("Opening link blocked as opener could not be cleared")}),(function(){o._onShowLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.add("xterm-cursor-pointer")}),(function(e){o._onLinkTooltip.fire(o._createLinkHoverEvent(a,l,h,u,n)),i.hoverTooltipCallback&&i.hoverTooltipCallback(e,r,{start:{x:a,y:l},end:{x:h,y:u}})}),(function(){o._onHideLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.remove("xterm-cursor-pointer"),i.hoverLeaveCallback&&i.hoverLeaveCallback()}),(function(e){return!i.willLinkActivate||i.willLinkActivate(e,r)})))}},e.prototype._createLinkHoverEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},e._timeBeforeLatency=200,e=i([n(0,s.IBufferService),n(1,s.ILogService),n(2,s.IUnicodeService)],e)}();t.Linkifier=a;var c=function(e,t,r,i,n,o,s,a,c){this.x1=e,this.y1=t,this.x2=r,this.y2=i,this.clickCallback=n,this.hoverCallback=o,this.tooltipCallback=s,this.leaveCallback=a,this.willLinkActivate=c};t.MouseZone=c},6465:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var a=r(2585),c=r(8460),l=r(844),h=r(3656),u=function(e){function t(t){var r=e.call(this)||this;return r._bufferService=t,r._linkProviders=[],r._linkCacheDisposables=[],r._isMouseOut=!0,r._activeLine=-1,r._onShowLinkUnderline=r.register(new c.EventEmitter),r._onHideLinkUnderline=r.register(new c.EventEmitter),r.register(l.getDisposeArrayDisposable(r._linkCacheDisposables)),r}return n(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var r=t._linkProviders.indexOf(e);-1!==r&&t._linkProviders.splice(r,1)}}},t.prototype.attachToDom=function(e,t,r){var i=this;this._element=e,this._mouseService=t,this._renderService=r,this.register(h.addDisposableDomListener(this._element,"mouseleave",(function(){i._isMouseOut=!0,i._clearCurrentLink()}))),this.register(h.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(h.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var r=e.composedPath(),i=0;ie?this._bufferService.cols:s.link.range.end.x,l=a;l<=c;l++){if(r.has(l)){n.splice(o--,1);break}r.add(l)}}},t.prototype._checkLinkProviderResult=function(e,t,r){var i,n=this;if(!this._activeProviderReplies)return r;for(var o=this._activeProviderReplies.get(e),s=!1,a=0;a=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,l.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(e.link,r)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.pointerCursor},set:function(e){var r,i;(null===(r=t._currentLink)||void 0===r?void 0:r.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(i=t._element)||void 0===i||i.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.underline},set:function(r){var i,n,o;(null===(i=t._currentLink)||void 0===i?void 0:i.state)&&(null===(o=null===(n=t._currentLink)||void 0===n?void 0:n.state)||void 0===o?void 0:o.decorations.underline)!==r&&(t._currentLink.state.decorations.underline=r,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,r))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange((function(e){var r=0===e.start?0:e.start+1+t._bufferService.buffer.ydisp;t._clearCurrentLink(r,e.end+1+t._bufferService.buffer.ydisp)}))))}},t.prototype._linkHover=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var r=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)},t.prototype._linkLeave=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)},t.prototype._linkAtPosition=function(e,t){var r=e.range.start.y===e.range.end.y,i=e.range.start.yt.y;return(r&&e.range.start.x<=t.x&&e.range.end.x>=t.x||i&&e.range.end.x>=t.x||n&&e.range.start.x<=t.x||i&&n)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,r){var i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},o([s(0,a.IBufferService)],t)}(l.Disposable);t.Linkifier2=u},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},6954:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s){var a=e.call(this)||this;return a._element=t,a._screenElement=r,a._bufferService=i,a._mouseService=n,a._selectionService=o,a._optionsService=s,a._zones=[],a._areZonesActive=!1,a._lastHoverCoords=[void 0,void 0],a._initialSelectionLength=0,a.register(c.addDisposableDomListener(a._element,"mousedown",(function(e){return a._onMouseDown(e)}))),a._mouseMoveListener=function(e){return a._onMouseMove(e)},a._mouseLeaveListener=function(e){return a._onMouseLeave(e)},a._clickListener=function(e){return a._onClick(e)},a}return n(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var r=0;re&&i.y1<=t+1||i.y2>e&&i.y2<=t+1||i.y1t+1)&&(this._currentZone&&this._currentZone===i&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(r--,1))}0===this._zones.length&&this._deactivate()}},t.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},t.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,r=this._findZoneEventAt(e);r!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),r&&(this._currentZone=r,r.hoverCallback&&r.hoverCallback(e),this._tooltipTimeout=window.setTimeout((function(){return t._onTooltip(e)}),this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),r=this._getSelectionLength();t&&r===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var r=t[0],i=t[1],n=0;n=o.x1&&r=o.x1||i===o.y2&&ro.y1&&i{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0;var r=function(){function e(e){this._renderCallback=e}return e.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.refresh=function(e,t,r){var i=this;this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){return i._innerRefresh()})))},e.prototype._innerRefresh=function(){if(void 0!==this._rowStart&&void 0!==this._rowEnd&&void 0!==this._rowCount){var e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(e,t)}},e}();t.RenderDebouncer=r},5596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._currentDevicePixelRatio=window.devicePixelRatio,t}return n(t,e),t.prototype.setListener=function(e){var t=this;this._listener&&this.clearListener(),this._listener=e,this._outerListener=function(){t._listener&&(t._listener(window.devicePixelRatio,t._currentDevicePixelRatio),t._updateDpr())},this._updateDpr()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.clearListener()},t.prototype._updateDpr=function(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},t.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},t}(r(844).Disposable);t.ScreenDprMonitor=o},3236:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var o=r(2950),s=r(1680),a=r(3614),c=r(2584),l=r(5435),h=r(3525),u=r(3551),f=r(9312),_=r(6114),d=r(3656),p=r(9042),v=r(357),g=r(6954),y=r(4567),b=r(1296),S=r(7399),m=r(8460),C=r(8437),w=r(5680),E=r(3230),L=r(4725),A=r(428),R=r(8934),k=r(6465),x=r(5114),D=r(8969),T=r(4774),O="undefined"!=typeof window?window.document:null,M=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.browser=_,r._keyDownHandled=!1,r._onCursorMove=new m.EventEmitter,r._onKey=new m.EventEmitter,r._onRender=new m.EventEmitter,r._onSelectionChange=new m.EventEmitter,r._onTitleChange=new m.EventEmitter,r._onFocus=new m.EventEmitter,r._onBlur=new m.EventEmitter,r._onA11yCharEmitter=new m.EventEmitter,r._onA11yTabEmitter=new m.EventEmitter,r._setup(),r.linkifier=r._instantiationService.createInstance(u.Linkifier),r.linkifier2=r.register(r._instantiationService.createInstance(k.Linkifier2)),r.register(r._inputHandler.onRequestBell((function(){return r.bell()}))),r.register(r._inputHandler.onRequestRefreshRows((function(e,t){return r.refresh(e,t)}))),r.register(r._inputHandler.onRequestReset((function(){return r.reset()}))),r.register(r._inputHandler.onRequestScroll((function(e,t){return r.scroll(e,t||void 0)}))),r.register(r._inputHandler.onRequestWindowsOptionsReport((function(e){return r._reportWindowsOptions(e)}))),r.register(r._inputHandler.onAnsiColorChange((function(e){return r._changeAnsiColor(e)}))),r.register(m.forwardEvent(r._inputHandler.onCursorMove,r._onCursorMove)),r.register(m.forwardEvent(r._inputHandler.onTitleChange,r._onTitleChange)),r.register(m.forwardEvent(r._inputHandler.onA11yChar,r._onA11yCharEmitter)),r.register(m.forwardEvent(r._inputHandler.onA11yTab,r._onA11yTabEmitter)),r.register(r._bufferService.onResize((function(e){return r._afterResize(e.cols,e.rows)}))),r}return n(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),t.prototype._changeAnsiColor=function(e){var t,r,i=this;this._colorManager&&(e.colors.forEach((function(e){var t=T.rgba.toColor(e.red,e.green,e.blue);i._colorManager.colors.ansi[e.colorIndex]=t})),null===(t=this._renderService)||void 0===t||t.setColors(this._colorManager.colors),null===(r=this.viewport)||void 0===r||r.onThemeChange(this._colorManager.colors))},t.prototype.dispose=function(){var t,r,i;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._renderService)||void 0===t||t.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},null===(i=null===(r=this.element)||void 0===r?void 0:r.parentNode)||void 0===i||i.removeChild(this.element))},t.prototype._setup=function(){e.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(t.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),t.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},t.prototype._updateOptions=function(t){var r,i,n,o;switch(e.prototype._updateOptions.call(this,t),t){case"fontFamily":case"fontSize":null===(r=this._renderService)||void 0===r||r.clear(),null===(i=this._charSizeService)||void 0===i||i.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":null===(n=this.viewport)||void 0===n||n.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)):(null===(o=this._accessibilityManager)||void 0===o||o.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},t.prototype._onTextAreaFocus=function(e){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},t.prototype.blur=function(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()},t.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},t.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var e=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),t=this._bufferService.buffer.y*e,r=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=r+"px",this.textarea.style.top=t+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=e+"px",this.textarea.style.lineHeight=e+"px",this.textarea.style.zIndex="-5"}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register(d.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&a.copyHandler(t,e._selectionService)})));var t=function(t){return a.handlePasteEvent(t,e.textarea,e._coreService)};this.register(d.addDisposableDomListener(this.textarea,"paste",t)),this.register(d.addDisposableDomListener(this.element,"paste",t)),_.isFirefox?this.register(d.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register(d.addDisposableDomListener(this.element,"contextmenu",(function(t){a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),_.isLinux&&this.register(d.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&a.moveTextAreaUnderMouseCursor(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register(d.addDisposableDomListener(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register(d.addDisposableDomListener(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register(d.addDisposableDomListener(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return e._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(t){return e._queueLinkification(t.start,t.end)})))},t.prototype.open=function(e){var t=this;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),this.element.setAttribute("role","document"),e.appendChild(this.element);var r=O.createDocumentFragment();this._viewportElement=O.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this._viewportScrollArea=O.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=O.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=O.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement),this.textarea=O.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),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.register(d.addDisposableDomListener(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register(d.addDisposableDomListener(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var i=this._instantiationService.createInstance(x.CoreBrowserService,this.textarea);this._instantiationService.setService(L.ICoreBrowserService,i),this._charSizeService=this._instantiationService.createInstance(A.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._compositionView=O.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(r),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(O,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme);var n=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,n,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange((function(e){return t._onRender.fire(e)}))),this.onResize((function(e){return t._renderService.resize(e.cols,e.rows)})),this._soundService=this._instantiationService.createInstance(v.SoundService),this._instantiationService.setService(L.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(s.Viewport,(function(e,r){return t.scrollLines(e,r)}),this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar((function(){return t.viewport.syncScrollArea()}))),this.register(this.viewport),this.register(this.onCursorMove((function(){t._renderService.onCursorMove(),t._syncTextArea()}))),this.register(this.onResize((function(){return t._renderService.onResize(t.cols,t.rows)}))),this.register(this.onBlur((function(){return t._renderService.onBlur()}))),this.register(this.onFocus((function(){return t._renderService.onFocus()}))),this.register(this._renderService.onDimensionsChange((function(){return t.viewport.syncScrollArea()}))),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((function(e){return t.scrollLines(e.amount,e.suppressScrollEvent)}))),this.register(this._selectionService.onSelectionChange((function(){return t._onSelectionChange.fire()}))),this.register(this._selectionService.onRequestRedraw((function(e){return t._renderService.onSelectionChanged(e.start,e.end,e.columnSelectMode)}))),this.register(this._selectionService.onLinuxMouseSelection((function(e){t.textarea.value=e,t.textarea.focus(),t.textarea.select()}))),this.register(this.onScroll((function(){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register(d.addDisposableDomListener(this._viewportElement,"scroll",(function(){return t._selectionService.refresh()}))),this._mouseZoneManager=this._instantiationService.createInstance(g.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return t._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(d.addDisposableDomListener(this.element,"mousedown",(function(e){return t._selectionService.onMouseDown(e)}))),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},t.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(h.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(b.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},t.prototype._setTheme=function(e){var t,r,i;this._theme=e,null===(t=this._colorManager)||void 0===t||t.setTheme(e),null===(r=this._renderService)||void 0===r||r.setColors(this._colorManager.colors),null===(i=this.viewport)||void 0===i||i.onThemeChange(this._colorManager.colors)},t.prototype.bindMouse=function(){var e=this,t=this,r=this.element;function i(e){var r,i,n=t._mouseService.getRawByteCoords(e,t.screenElement,t.cols,t.rows);if(!n)return!1;switch(e.overrideType||e.type){case"mousemove":i=32,void 0===e.buttons?(r=3,void 0!==e.button&&(r=e.button<3?e.button:3)):r=1&e.buttons?0:4&e.buttons?1:2&e.buttons?2:3;break;case"mouseup":i=0,r=e.button<3?e.button:3;break;case"mousedown":i=1,r=e.button<3?e.button:3;break;case"wheel":0!==e.deltaY&&(i=e.deltaY<0?0:1),r=4;break;default:return!1}return!(void 0===i||void 0===r||r>4)&&t._coreMouseService.triggerMouseEvent({col:n.x-33,row:n.y-33,button:r,action:i,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o=function(t){return i(t),t.buttons||(e._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.removeEventListener("mousemove",n.mousedrag)),e.cancel(t)},s=function(t){return i(t),t.preventDefault(),e.cancel(t)},a=function(e){e.buttons&&i(e)},l=function(e){e.buttons||i(e)};this.register(this._coreMouseService.onProtocolChange((function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?n.mousemove||(r.addEventListener("mousemove",l),n.mousemove=l):(r.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&t?n.wheel||(r.addEventListener("wheel",s,{passive:!1}),n.wheel=s):(r.removeEventListener("wheel",n.wheel),n.wheel=null),2&t?n.mouseup||(n.mouseup=o):(e._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&t?n.mousedrag||(n.mousedrag=a):(e._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)}))),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(d.addDisposableDomListener(r,"mousedown",(function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return i(t),n.mouseup&&e._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.addEventListener("mousemove",n.mousedrag),e.cancel(t)}))),this.register(d.addDisposableDomListener(r,"wheel",(function(t){if(n.wheel);else if(!e.buffer.hasScrollback){var r=e.viewport.getLinesScrolled(t);if(0===r)return;for(var i=c.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),o="",s=0;s47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,r){t!==this.cols||r!==this.rows?e.prototype.resize.call(this,t,r):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var r,i;null===(r=this._charSizeService)||void 0===r||r.measure(),null===(i=this.viewport)||void 0===i||i.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){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(var e=1;e=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s,a){var l=e.call(this)||this;return l._scrollLines=t,l._viewportElement=r,l._scrollArea=i,l._bufferService=n,l._optionsService=o,l._charSizeService=s,l._renderService=a,l.scrollBarWidth=0,l._currentRowHeight=0,l._lastRecordedBufferLength=0,l._lastRecordedViewportHeight=0,l._lastRecordedBufferHeight=0,l._lastTouchY=0,l._lastScrollTop=0,l._wheelPartialScroll=0,l._refreshAnimationFrame=null,l._ignoreNextScrollEvent=!1,l.scrollBarWidth=l._viewportElement.offsetWidth-l._scrollArea.offsetWidth||15,l.register(c.addDisposableDomListener(l._viewportElement,"scroll",l._onScroll.bind(l))),setTimeout((function(){return l.syncScrollArea()}),0),l}return n(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===t&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)}else this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){var r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&r0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var r=this._optionsService.options.fastScrollModifier;return"alt"===r&&t.altKey||"ctrl"===r&&t.ctrlKey||"shift"===r&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},o([s(3,h.IBufferService),s(4,h.IOptionsService),s(5,l.ICharSizeService),s(6,l.IRenderService)],t)}(a.Disposable);t.Viewport=u},2950:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var o=r(4725),s=r(2585),a=function(){function e(e,t,r,i,n,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._charSizeService=n,this._coreService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((function(){t._compositionPosition.end=t._textarea.value.length}),0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var r={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((function(){if(t._isSendingComposition){t._isSendingComposition=!1;var e;r.start+=t._dataAlreadySent.length,(e=t._isComposing?t._textarea.value.substring(r.start,r.end):t._textarea.value.substring(r.start)).length>0&&t._coreService.triggerDataEvent(e,!0)}}),0)}else{this._isSendingComposition=!1;var i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout((function(){if(!e._isComposing){var r=e._textarea.value.replace(t,"");r.length>0&&(e._dataAlreadySent=r,e._coreService.triggerDataEvent(r,!0))}}),0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var r=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),i=this._bufferService.buffer.y*r,n=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=o.width+"px",this._textarea.style.height=o.height+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},i([n(2,s.IBufferService),n(3,s.IOptionsService),n(4,o.ICharSizeService),n(5,s.ICoreService)],e)}();t.CompositionHelper=a},9806:(e,t)=>{function r(e,t){var r=t.getBoundingClientRect();return[e.clientX-r.left,e.clientY-r.top]}Object.defineProperty(t,"__esModule",{value:!0}),t.getRawByteCoords=t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=r,t.getCoords=function(e,t,i,n,o,s,a,c){if(o){var l=r(e,t);if(l)return l[0]=Math.ceil((l[0]+(c?s/2:0))/s),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),i+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),n),l}},t.getRawByteCoords=function(e){if(e)return{x:e[0]+32,y:e[1]+32}}},9504:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var i=r(2584);function n(e,t,r,i){var n=e-o(r,e),a=t-o(r,t);return l(Math.abs(n-a)-function(e,t,r){for(var i=0,n=e-o(r,e),a=t-o(r,t),c=0;c=0&&tt?"A":"B"}function a(e,t,r,i,n,o){for(var s=e,a=t,c="";s!==r||a!==i;)s+=n?1:-1,n&&s>o.cols-1?(c+=o.buffer.translateBufferLineToString(a,!1,e,s),s=0,e=0,a++):!n&&s<0&&(c+=o.buffer.translateBufferLineToString(a,!1,0,e+1),e=s=o.cols-1,a--);return c+o.buffer.translateBufferLineToString(a,!1,e,s)}function c(e,t){var r=t?"O":"[";return i.C0.ESC+r+e}function l(e,t){e=Math.floor(e);for(var r="",i=0;i0?i-o(s,i):t;var f=i,_=function(e,t,r,i,s,a){var c;return c=n(r,i,s,a).length>0?i-o(s,i):t,e=r&&ce?"D":"C",l(Math.abs(h-e),c(s,i));s=u>t?"D":"C";var f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:h,r)+(f-1)*r.cols+1+((u>t?h:e)-1),c(s,i))}},244:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var r=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var r=this,i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=function(){return r._wrappedAddonDispose(i)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var i=r(511),n=r(3236),o=r(9042),s=r(8460),a=r(244),c=function(){function e(e){this._core=new n.Terminal(e),this._addonManager=new a.AddonManager}return e.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(e.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new f(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unicode",{get:function(){return this._checkProposedApi(),new _(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._checkProposedApi(),this._buffer||(this._buffer=new h(this._core)),this._buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),e.prototype.blur=function(){this._core.blur()},e.prototype.focus=function(){this._core.focus()},e.prototype.resize=function(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)},e.prototype.open=function(e){this._core.open(e)},e.prototype.attachCustomKeyEventHandler=function(e){this._core.attachCustomKeyEventHandler(e)},e.prototype.registerLinkMatcher=function(e,t,r){return this._checkProposedApi(),this._core.registerLinkMatcher(e,t,r)},e.prototype.deregisterLinkMatcher=function(e){this._checkProposedApi(),this._core.deregisterLinkMatcher(e)},e.prototype.registerLinkProvider=function(e){return this._checkProposedApi(),this._core.registerLinkProvider(e)},e.prototype.registerCharacterJoiner=function(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)},e.prototype.deregisterCharacterJoiner=function(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)},e.prototype.registerMarker=function(e){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)},e.prototype.addMarker=function(e){return this.registerMarker(e)},e.prototype.hasSelection=function(){return this._core.hasSelection()},e.prototype.select=function(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)},e.prototype.getSelection=function(){return this._core.getSelection()},e.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},e.prototype.clearSelection=function(){this._core.clearSelection()},e.prototype.selectAll=function(){this._core.selectAll()},e.prototype.selectLines=function(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)},e.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},e.prototype.scrollLines=function(e){this._verifyIntegers(e),this._core.scrollLines(e)},e.prototype.scrollPages=function(e){this._verifyIntegers(e),this._core.scrollPages(e)},e.prototype.scrollToTop=function(){this._core.scrollToTop()},e.prototype.scrollToBottom=function(){this._core.scrollToBottom()},e.prototype.scrollToLine=function(e){this._verifyIntegers(e),this._core.scrollToLine(e)},e.prototype.clear=function(){this._core.clear()},e.prototype.write=function(e,t){this._core.write(e,t)},e.prototype.writeUtf8=function(e,t){this._core.write(e,t)},e.prototype.writeln=function(e,t){this._core.write(e),this._core.write("\r\n",t)},e.prototype.paste=function(e){this._core.paste(e)},e.prototype.getOption=function(e){return this._core.optionsService.getOption(e)},e.prototype.setOption=function(e,t){this._core.optionsService.setOption(e,t)},e.prototype.refresh=function(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)},e.prototype.reset=function(){this._core.reset()},e.prototype.loadAddon=function(e){return this._addonManager.loadAddon(this,e)},Object.defineProperty(e,"strings",{get:function(){return o},enumerable:!1,configurable:!0}),e.prototype._verifyIntegers=function(){for(var e=[],t=0;t=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new i.CellData)},e.prototype.translateToString=function(e,t,r){return this._line.translateToString(e,t,r)},e}(),f=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,(function(e){return t(e.toArray())}))},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,(function(e,r){return t(e,r.toArray())}))},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),_=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},1546:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var i=r(643),n=r(8803),o=r(1420),s=r(3734),a=r(1752),c=r(4774),l=r(9631),h=function(){function e(e,t,r,i,n,o,s,a){this._container=e,this._alpha=i,this._colors=n,this._rendererId=o,this._bufferService=s,this._optionsService=a,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+t+"-layer"),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;l.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=a.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,r){void 0===r&&(r=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=o.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,r,i){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,r){void 0===r&&(r=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,r*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,r){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*r,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,r,i){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,r*this._scaledCellWidth-window.devicePixelRatio,i*this._scaledCellHeight-window.devicePixelRatio)},e.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},e.prototype._clearCells=function(e,t,r,i){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,r){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(r),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,r){var o,s,a=this._getContrastColor(e);a||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,r,a):(e.isInverse()?(o=e.isBgDefault()?n.INVERTED_DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?n.INVERTED_DEFAULT_COLOR:e.getFgColor()):(s=e.isBgDefault()?i.DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?i.DEFAULT_COLOR:e.getFgColor()),o+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||i.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||i.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=s,this._currentGlyphIdentifier.fg=o,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,r))},e.prototype._drawUncachedChars=function(e,t,r,i){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(i)this._ctx.fillStyle=i.css;else if(e.isBgDefault())this._ctx.fillStyle=c.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var o=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8&&(o+=8),this._ctx.fillStyle=this._colors.ansi[o].css}else if(i)this._ctx.fillStyle=i.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var a=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}this._clipRow(r),e.isDim()&&(this._ctx.globalAlpha=n.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var r=e.getFgColor(),i=e.getFgColorMode(),n=e.getBgColor(),o=e.getBgColorMode(),s=!!e.isInverse(),a=!!e.isInverse();if(s){var l=r;r=n,n=l;var h=i;i=o,o=h}var u=this._resolveBackgroundRgba(o,n,s),f=this._resolveForegroundRgba(i,r,s,a),_=c.rgba.ensureContrastRatio(u,f,this._optionsService.options.minimumContrastRatio);if(_){var d={css:c.channels.toCss(_>>24&255,_>>16&255,_>>8&255),rgba:_};return this._colors.contrastCache.setColor(e.bg,e.fg,d),d}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,r){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,r,i){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&i&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=h},5879:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerRegistry=t.JoinedCellData=void 0;var o=r(3734),s=r(643),a=r(511),c=function(e){function t(t,r,i){var n=e.call(this)||this;return n.content=0,n.combinedData="",n.fg=t.fg,n.bg=t.bg,n.combinedData=r,n._width=i,n}return n(t,e),t.prototype.isCombined=function(){return 2097152},t.prototype.getWidth=function(){return this._width},t.prototype.getChars=function(){return this.combinedData},t.prototype.getCode=function(){return 2097151},t.prototype.setFromCharData=function(e){throw new Error("not implemented")},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(o.AttributeData);t.JoinedCellData=c;var l=function(){function e(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}return e.prototype.registerCharacterJoiner=function(e){var t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id},e.prototype.deregisterCharacterJoiner=function(e){for(var t=0;t1)for(var u=this._getJoinedRanges(i,a,o,t,n),f=0;f1)for(u=this._getJoinedRanges(i,a,o,t,n),f=0;f=this._bufferService.rows)this._clearCursor();else{var i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(i,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var n=this._optionsService.options.cursorStyle;return n&&"block"!==n?this._cursorRenderers[n](i,r,this._cell):this._renderBlurCursor(i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=n,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===i&&this._state.y===r&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},t.prototype._renderBarCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,r.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(r,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,r){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,r.getWidth(),1),this._ctx.restore()},t}(o.BaseRenderLayer);t.CursorRenderLayer=c;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=void 0}))))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=a),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0})),t._blinkInterval=window.setInterval((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0}))}),a)}),e)},e.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},3700:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var r=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var r=0;r0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===s.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&a.is256Color(e.fg)?this._ctx.fillStyle=this._colors.ansi[e.fg].css:this._ctx.fillStyle=this._colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(var t=e.y1+1;t=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var a=r(9596),c=r(4149),l=r(2512),h=r(5098),u=r(5879),f=r(844),_=r(4725),d=r(2585),p=r(1420),v=r(8460),g=1,y=function(e){function t(t,r,i,n,o,s,f,_,d){var p=e.call(this)||this;p._colors=t,p._screenElement=r,p._bufferService=o,p._charSizeService=s,p._optionsService=f,p._id=g++,p._onRequestRedraw=new v.EventEmitter;var y=p._optionsService.options.allowTransparency;return p._characterJoinerRegistry=new u.CharacterJoinerRegistry(p._bufferService),p._renderLayers=[new a.TextRenderLayer(p._screenElement,0,p._colors,p._characterJoinerRegistry,y,p._id,p._bufferService,f),new c.SelectionRenderLayer(p._screenElement,1,p._colors,p._id,p._bufferService,f),new h.LinkRenderLayer(p._screenElement,2,p._colors,p._id,i,n,p._bufferService,f),new l.CursorRenderLayer(p._screenElement,3,p._colors,p._id,p._onRequestRedraw,p._bufferService,f,_,d)],p.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},p._devicePixelRatio=window.devicePixelRatio,p._updateDimensions(),p.onOptionsChanged(),p}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,r=this._renderLayers;t{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e}},4149:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;var o=function(e){function t(t,r,i,n,o,s){var a=e.call(this,t,"selection",r,!0,i,n,o,s)||this;return a._clearState(),a}return n(t,e),t.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._clearState()},t.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},t.prototype.onSelectionChanged=function(e,t,r){if(this._didStateChange(e,t,r,this._bufferService.buffer.ydisp))if(this._clearAll(),e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(o>=this._bufferService.rows||s<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=this._colors.selectionTransparent.css,r){var a=e[0],c=t[0]-a,l=s-o+1;this._fillCells(a,o,c,l)}else{a=i===o?e[0]:0;var h=o===n?t[0]:this._bufferService.cols;this._fillCells(a,o,h-a,1);var u=Math.max(s-o-1,0);if(this._fillCells(0,o+1,this._bufferService.cols,u),o!==s){var f=n===s?t[0]:this._bufferService.cols;this._fillCells(0,s,f,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=r,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,r,i){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||r!==this._state.columnSelectMode||i!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(r(1546).BaseRenderLayer);t.SelectionRenderLayer=o},9596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.TextRenderLayer=void 0;var o=r(3700),s=r(1546),a=r(3734),c=r(643),l=r(5879),h=r(511),u=function(e){function t(t,r,i,n,s,a,c,l){var u=e.call(this,t,"text",r,s,i,a,c,l)||this;return u._characterWidth=0,u._characterFont="",u._characterOverlapCache={},u._workCell=new h.CellData,u._state=new o.GridCache,u._characterJoinerRegistry=n,u}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t);var r=this._getFont(!1,!1);this._characterWidth===t.scaledCharWidth&&this._characterFont===r||(this._characterWidth=t.scaledCharWidth,this._characterFont=r,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},t.prototype.reset=function(){this._state.clear(),this._clearAll()},t.prototype._forEachCell=function(e,t,r,i){for(var n=e;n<=t;n++)for(var o=n+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.lines.get(o),a=r?r.getJoinedCharacters(o):[],h=0;h0&&h===a[0][0]){f=!0;var d=a.shift();u=new l.JoinedCellData(this._workCell,s.translateToString(!0,d[0],d[1]),d[1]-d[0]),_=d[1]-1}!f&&this._isOverlapping(u)&&_this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=r,r},t}(s.BaseRenderLayer);t.TextRenderLayer=u},9616:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCharAtlas=void 0;var r=function(){function e(){this._didWarmUp=!1}return e.prototype.dispose=function(){},e.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},e.prototype._doWarmUp=function(){},e.prototype.beginFrame=function(){},e}();t.BaseCharAtlas=r},1420:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var i=r(2040),n=r(1906),o=[];t.acquireCharAtlas=function(e,t,r,s,a){for(var c=i.generateConfig(s,a,e,r),l=0;l=0){if(i.configEquals(u.config,c))return u.atlas;1===u.ownedBy.length?(u.atlas.dispose(),o.splice(l,1)):u.ownedBy.splice(h,1);break}}for(l=0;l{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;var i=r(643);t.generateConfig=function(e,t,r,i){var n={foreground:i.foreground,background:i.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:i.ansi};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:e,scaledCharHeight:t,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,colors:n}},t.configEquals=function(e,t){for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.CHAR_ATLAS_CELL_SPACING=1},1906:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NoneCharAtlas=t.DynamicCharAtlas=t.getGlyphCacheKey=void 0;var o=r(8803),s=r(9616),a=r(5680),c=r(7001),l=r(6114),h=r(1752),u=r(4774),f={css:"rgba(0, 0, 0, 0)",rgba:0};function _(e){return e.code<<21|e.bg<<12|e.fg<<3|(e.bold?0:4)+(e.dim?0:2)+(e.italic?0:1)}t.getGlyphCacheKey=_;var d=function(e){function t(t,r){var i=e.call(this)||this;i._config=r,i._drawToCacheCount=0,i._glyphsWaitingOnBitmap=[],i._bitmapCommitTimeout=null,i._bitmap=null,i._cacheCanvas=t.createElement("canvas"),i._cacheCanvas.width=1024,i._cacheCanvas.height=1024,i._cacheCtx=h.throwIfFalsy(i._cacheCanvas.getContext("2d",{alpha:!0}));var n=t.createElement("canvas");n.width=i._config.scaledCharWidth,n.height=i._config.scaledCharHeight,i._tmpCtx=h.throwIfFalsy(n.getContext("2d",{alpha:i._config.allowTransparency})),i._width=Math.floor(1024/i._config.scaledCharWidth),i._height=Math.floor(1024/i._config.scaledCharHeight);var o=i._width*i._height;return i._cacheMap=new c.LRUMap(o),i._cacheMap.prealloc(o),i}return n(t,e),t.prototype.dispose=function(){null!==this._bitmapCommitTimeout&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},t.prototype.beginFrame=function(){this._drawToCacheCount=0},t.prototype.draw=function(e,t,r,i){if(32===t.code)return!0;if(!this._canCache(t))return!1;var n=_(t),o=this._cacheMap.get(n);if(null!=o)return this._drawFromCache(e,o,r,i),!0;if(this._drawToCacheCount<100){var s;s=this._cacheMap.size>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,s=0;s{Object.defineProperty(t,"__esModule",{value:!0}),t.LRUMap=void 0;var r=function(){function e(e){this.capacity=e,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return e.prototype._unlinkNode=function(e){var t=e.prev,r=e.next;e===this._head&&(this._head=r),e===this._tail&&(this._tail=t),null!==t&&(t.next=r),null!==r&&(r.prev=t)},e.prototype._appendNode=function(e){var t=this._tail;null!==t&&(t.next=e),e.prev=t,e.next=null,this._tail=e,null===this._head&&(this._head=e)},e.prototype.prealloc=function(e){for(var t=this._nodePool,r=0;r=this.capacity)r=this._head,this._unlinkNode(r),delete this._map[r.key],r.key=e,r.value=t,this._map[e]=r;else{var i=this._nodePool;i.length>0?((r=i.pop()).key=e,r.value=t):r={prev:null,next:null,key:e,value:t},this._map[e]=r,this.size++}this._appendNode(r)},e}();t.LRUMap=r},1296:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var a=r(3787),c=r(8803),l=r(844),h=r(4725),u=r(2585),f=r(8460),_=r(4774),d=r(9631),p="xterm-dom-renderer-owner-",v="xterm-fg-",g="xterm-bg-",y="xterm-focus",b=1,S=function(e){function t(t,r,i,n,o,s,c,l,h){var u=e.call(this)||this;return u._colors=t,u._element=r,u._screenElement=i,u._viewportElement=n,u._linkifier=o,u._linkifier2=s,u._charSizeService=c,u._optionsService=l,u._bufferService=h,u._terminalClass=b++,u._rowElements=[],u._rowContainer=document.createElement("div"),u._rowContainer.classList.add("xterm-rows"),u._rowContainer.style.lineHeight="normal",u._rowContainer.setAttribute("aria-hidden","true"),u._refreshRowElements(u._bufferService.cols,u._bufferService.rows),u._selectionContainer=document.createElement("div"),u._selectionContainer.classList.add("xterm-selection"),u._selectionContainer.setAttribute("aria-hidden","true"),u.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},u._updateDimensions(),u._injectCss(),u._rowFactory=new a.DomRendererRowFactory(document,u._optionsService,u._colors),u._element.classList.add(p+u._terminalClass),u._screenElement.appendChild(u._rowContainer),u._screenElement.appendChild(u._selectionContainer),u._linkifier.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u._linkifier2.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier2.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new f.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove(p+this._terminalClass),d.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var e=0,t=this._rowElements;et;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove(y)},t.prototype.onFocus=function(){this._rowContainer.classList.add(y)},t.prototype.onSelectionChanged=function(e,t,r){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(!(o>=this._bufferService.rows||s<0)){var a=document.createDocumentFragment();if(r)a.appendChild(this._createSelectionElement(o,e[0],t[0],s-o+1));else{var c=i===o?e[0]:0,l=o===n?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,c,l));var h=s-o-1;if(a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,h)),o!==s){var u=n===s?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,0,u))}}this._selectionContainer.appendChild(a)}}},t.prototype._createSelectionElement=function(e,t,r,i){void 0===i&&(i=1);var n=document.createElement("div");return n.style.height=i*this.dimensions.actualCellHeight+"px",n.style.top=e*this.dimensions.actualCellHeight+"px",n.style.left=t*this.dimensions.actualCellWidth+"px",n.style.width=this.dimensions.actualCellWidth*(r-t)+"px",n},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e=n&&(e=0,r++)}},o([s(6,h.ICharSizeService),s(7,u.IOptionsService),s(8,u.IBufferService)],t)}(l.Disposable);t.DomRenderer=S},3787:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var i=r(8803),n=r(643),o=r(511),s=r(4774);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var a=function(){function e(e,t,r){this._document=e,this._optionsService=t,this._colors=r,this._workCell=new o.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,r,o,a,l,h,u){for(var f=this._document.createDocumentFragment(),_=0,d=Math.min(e.length,u)-1;d>=0;d--)if(e.loadCell(d,this._workCell).getCode()!==n.NULL_CELL_CODE||r&&d===a){_=d+1;break}for(d=0;d<_;d++){e.loadCell(d,this._workCell);var p=this._workCell.getWidth();if(0!==p){var v=this._document.createElement("span");if(p>1&&(v.style.width=h*p+"px"),r&&d===a)switch(v.classList.add(t.CURSOR_CLASS),l&&v.classList.add(t.CURSOR_BLINK_CLASS),o){case"bar":v.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":v.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:v.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&v.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&v.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&v.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&v.classList.add(t.UNDERLINE_CLASS),this._workCell.isInvisible()?v.textContent=n.WHITESPACE_CELL_CHAR:v.textContent=this._workCell.getChars()||n.WHITESPACE_CELL_CHAR;var g=this._workCell.getFgColor(),y=this._workCell.getFgColorMode(),b=this._workCell.getBgColor(),S=this._workCell.getBgColorMode(),m=!!this._workCell.isInverse();if(m){var C=g;g=b,b=C;var w=y;y=S,S=w}switch(y){case 16777216:case 33554432:this._workCell.isBold()&&g<8&&this._optionsService.options.drawBoldTextInBrightColors&&(g+=8),this._applyMinimumContrast(v,this._colors.background,this._colors.ansi[g])||v.classList.add("xterm-fg-"+g);break;case 50331648:var E=s.rgba.toColor(g>>16&255,g>>8&255,255&g);this._applyMinimumContrast(v,this._colors.background,E)||this._addStyle(v,"color:#"+c(g.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(v,this._colors.background,this._colors.foreground)||m&&v.classList.add("xterm-fg-"+i.INVERTED_DEFAULT_COLOR)}switch(S){case 16777216:case 33554432:v.classList.add("xterm-bg-"+b);break;case 50331648:this._addStyle(v,"background-color:#"+c(b.toString(16),"0",6));break;case 0:default:m&&v.classList.add("xterm-bg-"+i.INVERTED_DEFAULT_COLOR)}f.appendChild(v)}}return f},e.prototype._applyMinimumContrast=function(e,t,r){if(1===this._optionsService.options.minimumContrastRatio)return!1;var i=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===i&&(i=s.color.ensureContrastRatio(t,r,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=i?i:null)),!!i&&(this._addStyle(e,"color:"+i.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function c(e,t,r){for(;e.length{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0;var r=function(){function e(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}return e.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(e.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=r},428:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var o=r(2585),s=r(8460),a=function(){function e(e,t,r){this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=new s.EventEmitter,this._measureStrategy=new c(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},i([n(2,o.IOptionsService)],e)}();t.CharSizeService=a;var c=function(){function e(e,t,r){this._document=e,this._parentElement=t,this._optionsService=r,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},5114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var r=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return(this._textarea.getRootNode?this._textarea.getRootNode():document).activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=r},8934:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var o=r(4725),s=r(9806),a=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,r,i,n){return s.getCoords(e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,n)},e.prototype.getRawByteCoords=function(e,t,r,i){var n=this.getCoords(e,t,r,i);return s.getRawByteCoords(n)},i([n(0,o.IRenderService),n(1,o.ICharSizeService)],e)}();t.MouseService=a},3230:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var a=r(6193),c=r(8460),l=r(844),h=r(5596),u=r(3656),f=r(2585),_=r(4725),d=function(e){function t(t,r,i,n,o,s){var l=e.call(this)||this;if(l._renderer=t,l._rowCount=r,l._charSizeService=o,l._isPaused=!1,l._needsFullRefresh=!1,l._isNextRenderRedrawOnly=!0,l._needsSelectionRefresh=!1,l._canvasWidth=0,l._canvasHeight=0,l._selectionState={start:void 0,end:void 0,columnSelectMode:!1},l._onDimensionsChange=new c.EventEmitter,l._onRender=new c.EventEmitter,l._onRefreshRequest=new c.EventEmitter,l.register({dispose:function(){return l._renderer.dispose()}}),l._renderDebouncer=new a.RenderDebouncer((function(e,t){return l._renderRows(e,t)})),l.register(l._renderDebouncer),l._screenDprMonitor=new h.ScreenDprMonitor,l._screenDprMonitor.setListener((function(){return l.onDevicePixelRatioChange()})),l.register(l._screenDprMonitor),l.register(s.onResize((function(e){return l._fullRefresh()}))),l.register(n.onOptionChange((function(){return l._renderer.onOptionsChanged()}))),l.register(l._charSizeService.onCharSizeChange((function(){return l.onCharSizeChanged()}))),l._renderer.onRequestRedraw((function(e){return l.refreshRows(e.start,e.end,!0)})),l.register(u.addDisposableDomListener(window,"resize",(function(){return l.onDevicePixelRatioChange()}))),"IntersectionObserver"in window){var f=new IntersectionObserver((function(e){return l._onIntersectionChange(e[e.length-1])}),{threshold:0});f.observe(i),l.register({dispose:function(){return f.disconnect()}})}return l}return n(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,r){void 0===r&&(r=!1),this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw((function(e){return t.refreshRows(e.start,e.end,!0)})),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.onSelectionChanged(e,t,r)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},o([s(3,f.IOptionsService),s(4,_.ICharSizeService),s(5,f.IBufferService)],t)}(l.Disposable);t.RenderService=d},9312:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var a=r(6114),c=r(456),l=r(511),h=r(8460),u=r(4725),f=r(2585),_=r(9806),d=r(9504),p=r(844),v=String.fromCharCode(160),g=new RegExp(v,"g"),y=function(e){function t(t,r,i,n,o,s,a){var u=e.call(this)||this;return u._element=t,u._screenElement=r,u._bufferService=i,u._coreService=n,u._mouseService=o,u._optionsService=s,u._renderService=a,u._dragScrollAmount=0,u._enabled=!0,u._workCell=new l.CellData,u._mouseDownTimeStamp=0,u._oldHasSelection=!1,u._oldSelectionStart=void 0,u._oldSelectionEnd=void 0,u._onLinuxMouseSelection=u.register(new h.EventEmitter),u._onRedrawRequest=u.register(new h.EventEmitter),u._onSelectionChange=u.register(new h.EventEmitter),u._onRequestScrollLines=u.register(new h.EventEmitter),u._mouseMoveListener=function(e){return u._onMouseMove(e)},u._mouseUpListener=function(e){return u._onMouseUp(e)},u._coreService.onUserInput((function(){u.hasSelection&&u.clearSelection()})),u._trimListener=u._bufferService.buffer.lines.onTrim((function(e){return u._onTrim(e)})),u.register(u._bufferService.buffers.onBufferActivate((function(e){return u._onBufferActivate(e)}))),u.enable(),u._model=new c.SelectionModel(u._bufferService),u._activeSelectionMode=0,u}return n(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var r=this._bufferService.buffer,i=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var n=e[1];n<=t[1];n++){var o=r.translateBufferLineToString(n,!0,e[0],t[0]);i.push(o)}}else{var s=e[1]===t[1]?t[0]:void 0;for(i.push(r.translateBufferLineToString(e[1],!0,e[0],s)),n=e[1]+1;n<=t[1]-1;n++){var c=r.lines.get(n);o=r.translateBufferLineToString(n,!0),c&&c.isWrapped?i[i.length-1]+=o:i.push(o)}e[1]!==t[1]&&(c=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]),c&&c.isWrapped?i[i.length-1]+=o:i.push(o))}return i.map((function(e){return e.replace(g," ")})).join(a.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame((function(){return t._refresh()}))),a.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype._isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!(r&&i&&t)&&this._areCoordsInSelection(t,r,i)},t.prototype._areCoordsInSelection=function(e,t,r){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]},t.prototype._selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=_.getCoordsRelativeToElement(e,this._screenElement)[1],r=this._renderService.dimensions.canvasHeight;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return a.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval((function(){return e._dragScroll()}),50)},t.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(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){this._model.selectionEnd=void 0;var t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(a.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var r=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(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.getOption("altClickMovesCursor")){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&void 0!==r[0]&&void 0!==r[1]){var i=d.moveToCellSequence(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()},t.prototype._fireEventIfSelectionChanged=function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);r?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,r)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,r)},t.prototype._fireOnSelectionChange=function(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((function(e){return t._onTrim(e)}))},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var r=t[0],i=0;t[0]>=i;i++){var n=e.loadCell(i,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:n>1&&t[0]!==i&&(r+=n-1)}return r},t.prototype.setSelection=function(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh()},t.prototype.rightClickSelect=function(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e),this._fireEventIfSelectionChanged())},t.prototype._getWordAt=function(e,t,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),!(e[0]>=this._bufferService.cols)){var n=this._bufferService.buffer,o=n.lines.get(e[1]);if(o){var s=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e),c=a,l=e[0]-a,h=0,u=0,f=0,_=0;if(" "===s.charAt(a)){for(;a>0&&" "===s.charAt(a-1);)a--;for(;c1&&(_+=v-1,c+=v-1);d>0&&a>0&&!this._isCharWordSeparator(o.loadCell(d-1,this._workCell));){o.loadCell(d-1,this._workCell);var g=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,d--):g>1&&(f+=g-1,a-=g-1),a--,d--}for(;p1&&(_+=y-1,c+=y-1),c++,p++}}c++;var b=a+l-h+f,S=Math.min(this._bufferService.cols,c-a+h+u-f-_);if(t||""!==s.slice(a,c).trim()){if(r&&0===b&&32!==o.getCodePoint(0)){var m=n.lines.get(e[1]-1);if(m&&o.isWrapped&&32!==m.getCodePoint(this._bufferService.cols-1)){var C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){var w=this._bufferService.cols-C.start;b-=w,S+=w}}}if(i&&b+S===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){var E=n.lines.get(e[1]+1);if(E&&E.isWrapped&&32!==E.getCodePoint(0)){var L=this._getWordAt([0,e[1]+1],!1,!1,!0);L&&(S+=L.length)}}return{start:b,length:S}}}}},t.prototype._selectWordAt=function(e,t){var r=this._getWordAt(e,t);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}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var r=e[1];t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},o([s(2,f.IBufferService),s(3,f.ICoreService),s(4,u.IMouseService),s(5,f.IOptionsService),s(6,u.IRenderService)],t)}(p.Disposable);t.SelectionService=y},4725:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var i=r(8343);t.ICharSizeService=i.createDecorator("CharSizeService"),t.ICoreBrowserService=i.createDecorator("CoreBrowserService"),t.IMouseService=i.createDecorator("MouseService"),t.IRenderService=i.createDecorator("RenderService"),t.ISelectionService=i.createDecorator("SelectionService"),t.ISoundService=i.createDecorator("SoundService")},357:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var o=r(2585),s=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var r=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),(function(e){r.buffer=e,r.connect(t.destination),r.start(0)}))}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),r=t.length,i=new Uint8Array(r),n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;var i=r(8460),n=function(){function e(e){this._maxLength=e,this.onDeleteEmitter=new i.EventEmitter,this.onInsertEmitter=new i.EventEmitter,this.onTrimEmitter=new i.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(e.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(e){if(this._maxLength!==e){for(var t=new Array(e),r=0;rthis._length)for(var t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(n=0;nthis._maxLength){var o=this._length+r.length-this._maxLength;this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)}else this._length+=r.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,r){if(!(t<=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(var i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));var n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(i=0;i{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,r){if(void 0===r&&(r=5),"object"!=typeof t)return t;var i=Array.isArray(t)?[]:{};for(var n in t)i[n]=r<=1?t[n]:t[n]?e(t[n],r-1):t[n];return i}},8969:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;var o=r(844),s=r(2585),a=r(4348),c=r(7866),l=r(744),h=r(7302),u=r(6975),f=r(8460),_=r(1753),d=r(3730),p=r(1480),v=r(7994),g=r(9282),y=r(5435),b=r(5981),S=function(e){function t(t){var r=e.call(this)||this;return r._onBinary=new f.EventEmitter,r._onData=new f.EventEmitter,r._onLineFeed=new f.EventEmitter,r._onResize=new f.EventEmitter,r._onScroll=new f.EventEmitter,r._instantiationService=new a.InstantiationService,r.optionsService=new h.OptionsService(t),r._instantiationService.setService(s.IOptionsService,r.optionsService),r._bufferService=r.register(r._instantiationService.createInstance(l.BufferService)),r._instantiationService.setService(s.IBufferService,r._bufferService),r._logService=r._instantiationService.createInstance(c.LogService),r._instantiationService.setService(s.ILogService,r._logService),r._coreService=r.register(r._instantiationService.createInstance(u.CoreService,(function(){return r.scrollToBottom()}))),r._instantiationService.setService(s.ICoreService,r._coreService),r._coreMouseService=r._instantiationService.createInstance(_.CoreMouseService),r._instantiationService.setService(s.ICoreMouseService,r._coreMouseService),r._dirtyRowService=r._instantiationService.createInstance(d.DirtyRowService),r._instantiationService.setService(s.IDirtyRowService,r._dirtyRowService),r.unicodeService=r._instantiationService.createInstance(p.UnicodeService),r._instantiationService.setService(s.IUnicodeService,r.unicodeService),r._charsetService=r._instantiationService.createInstance(v.CharsetService),r._instantiationService.setService(s.ICharsetService,r._charsetService),r._inputHandler=new y.InputHandler(r._bufferService,r._charsetService,r._coreService,r._dirtyRowService,r._logService,r.optionsService,r._coreMouseService,r.unicodeService),r.register(f.forwardEvent(r._inputHandler.onLineFeed,r._onLineFeed)),r.register(r._inputHandler),r.register(f.forwardEvent(r._bufferService.onResize,r._onResize)),r.register(f.forwardEvent(r._coreService.onData,r._onData)),r.register(f.forwardEvent(r._coreService.onBinary,r._onBinary)),r.register(r.optionsService.onOptionChange((function(e){return r._updateOptions(e)}))),r._writeBuffer=new b.WriteBuffer((function(e){return r._inputHandler.parse(e)})),r}return n(t,e),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)},t.prototype.write=function(e,t){this._writeBuffer.write(e,t)},t.prototype.writeSync=function(e){this._writeBuffer.writeSync(e)},t.prototype.resize=function(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,l.MINIMUM_COLS),t=Math.max(t,l.MINIMUM_ROWS),this._bufferService.resize(e,t))},t.prototype.scroll=function(e,t){void 0===t&&(t=!1);var r,i=this._bufferService.buffer;(r=this._cachedBlankLine)&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;var n=i.ybase+i.scrollTop,o=i.ybase+i.scrollBottom;if(0===i.scrollTop){var s=i.lines.isFull;o===i.lines.length-1?s?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(o+1,0,r.clone()),s?this._bufferService.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this._bufferService.isUserScrolling||i.ydisp++)}else{var a=o-n+1;i.lines.shiftElements(n+1,a-1,-1),i.lines.set(o,r.clone())}this._bufferService.isUserScrolling||(i.ydisp=i.ybase),this._dirtyRowService.markRangeDirty(i.scrollTop,i.scrollBottom),this._onScroll.fire(i.ydisp)},t.prototype.scrollLines=function(e,t){var r=this._bufferService.buffer;if(e<0){if(0===r.ydisp)return;this._bufferService.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this._bufferService.isUserScrolling=!1);var i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},t.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},t.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},t.prototype.scrollToLine=function(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},t.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},t.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},t.prototype._updateOptions=function(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},(function(){return g.updateWindowsModeWrappedState(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,r=t;e{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0;var r=function(){function e(){this._listeners=[],this._disposed=!1}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){if(!e._disposed)for(var r=0;r24)return t.setWinLines||!1;switch(e){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}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(o=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var C=function(){function e(e,t,r,i){this._bufferService=e,this._coreService=t,this._logService=r,this._optionsService=i,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,r){this._data=h.concat(this._data,e.subarray(t,r))},e.prototype.unhook=function(e){if(!e)return this._data=new Uint32Array(0),!0;var t=u.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r0"q'+s.C0.ESC+"\\");break;case'"p':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r61;1"p'+s.C0.ESC+"\\");break;case"r":var r=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+r+s.C0.ESC+"\\");break;case"m":this._coreService.triggerDataEvent(s.C0.ESC+"P1$r0m"+s.C0.ESC+"\\");break;case" q":var i={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];i-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+i+" q"+s.C0.ESC+"\\");break;default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(s.C0.ESC+"P0$r"+s.C0.ESC+"\\")}return!0},e}(),w=function(e){function t(t,r,i,n,o,l,h,d,v){void 0===v&&(v=new c.EscapeSequenceParser);var y=e.call(this)||this;y._bufferService=t,y._charsetService=r,y._coreService=i,y._dirtyRowService=n,y._logService=o,y._optionsService=l,y._coreMouseService=h,y._unicodeService=d,y._parser=v,y._parseBuffer=new Uint32Array(4096),y._stringDecoder=new u.StringToUtf32,y._utf8Decoder=new u.Utf8ToUtf32,y._workCell=new p.CellData,y._windowTitle="",y._iconName="",y._windowTitleStack=[],y._iconNameStack=[],y._curAttrData=f.DEFAULT_ATTR_DATA.clone(),y._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),y._onRequestBell=new _.EventEmitter,y._onRequestRefreshRows=new _.EventEmitter,y._onRequestReset=new _.EventEmitter,y._onRequestScroll=new _.EventEmitter,y._onRequestSyncScrollBar=new _.EventEmitter,y._onRequestWindowsOptionsReport=new _.EventEmitter,y._onA11yChar=new _.EventEmitter,y._onA11yTab=new _.EventEmitter,y._onCursorMove=new _.EventEmitter,y._onLineFeed=new _.EventEmitter,y._onScroll=new _.EventEmitter,y._onTitleChange=new _.EventEmitter,y._onAnsiColorChange=new _.EventEmitter,y.register(y._parser),y._parser.setCsiHandlerFallback((function(e,t){y._logService.debug("Unknown CSI code: ",{identifier:y._parser.identToString(e),params:t.toArray()})})),y._parser.setEscHandlerFallback((function(e){y._logService.debug("Unknown ESC code: ",{identifier:y._parser.identToString(e)})})),y._parser.setExecuteHandlerFallback((function(e){y._logService.debug("Unknown EXECUTE code: ",{code:e})})),y._parser.setOscHandlerFallback((function(e,t,r){y._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:r})})),y._parser.setDcsHandlerFallback((function(e,t,r){"HOOK"===t&&(r=r.toArray()),y._logService.debug("Unknown DCS code: ",{identifier:y._parser.identToString(e),action:t,payload:r})})),y._parser.setPrintHandler((function(e,t,r){return y.print(e,t,r)})),y._parser.registerCsiHandler({final:"@"},(function(e){return y.insertChars(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"@"},(function(e){return y.scrollLeft(e)})),y._parser.registerCsiHandler({final:"A"},(function(e){return y.cursorUp(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"A"},(function(e){return y.scrollRight(e)})),y._parser.registerCsiHandler({final:"B"},(function(e){return y.cursorDown(e)})),y._parser.registerCsiHandler({final:"C"},(function(e){return y.cursorForward(e)})),y._parser.registerCsiHandler({final:"D"},(function(e){return y.cursorBackward(e)})),y._parser.registerCsiHandler({final:"E"},(function(e){return y.cursorNextLine(e)})),y._parser.registerCsiHandler({final:"F"},(function(e){return y.cursorPrecedingLine(e)})),y._parser.registerCsiHandler({final:"G"},(function(e){return y.cursorCharAbsolute(e)})),y._parser.registerCsiHandler({final:"H"},(function(e){return y.cursorPosition(e)})),y._parser.registerCsiHandler({final:"I"},(function(e){return y.cursorForwardTab(e)})),y._parser.registerCsiHandler({final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({prefix:"?",final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({prefix:"?",final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({final:"L"},(function(e){return y.insertLines(e)})),y._parser.registerCsiHandler({final:"M"},(function(e){return y.deleteLines(e)})),y._parser.registerCsiHandler({final:"P"},(function(e){return y.deleteChars(e)})),y._parser.registerCsiHandler({final:"S"},(function(e){return y.scrollUp(e)})),y._parser.registerCsiHandler({final:"T"},(function(e){return y.scrollDown(e)})),y._parser.registerCsiHandler({final:"X"},(function(e){return y.eraseChars(e)})),y._parser.registerCsiHandler({final:"Z"},(function(e){return y.cursorBackwardTab(e)})),y._parser.registerCsiHandler({final:"`"},(function(e){return y.charPosAbsolute(e)})),y._parser.registerCsiHandler({final:"a"},(function(e){return y.hPositionRelative(e)})),y._parser.registerCsiHandler({final:"b"},(function(e){return y.repeatPrecedingCharacter(e)})),y._parser.registerCsiHandler({final:"c"},(function(e){return y.sendDeviceAttributesPrimary(e)})),y._parser.registerCsiHandler({prefix:">",final:"c"},(function(e){return y.sendDeviceAttributesSecondary(e)})),y._parser.registerCsiHandler({final:"d"},(function(e){return y.linePosAbsolute(e)})),y._parser.registerCsiHandler({final:"e"},(function(e){return y.vPositionRelative(e)})),y._parser.registerCsiHandler({final:"f"},(function(e){return y.hVPosition(e)})),y._parser.registerCsiHandler({final:"g"},(function(e){return y.tabClear(e)})),y._parser.registerCsiHandler({final:"h"},(function(e){return y.setMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"h"},(function(e){return y.setModePrivate(e)})),y._parser.registerCsiHandler({final:"l"},(function(e){return y.resetMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"l"},(function(e){return y.resetModePrivate(e)})),y._parser.registerCsiHandler({final:"m"},(function(e){return y.charAttributes(e)})),y._parser.registerCsiHandler({final:"n"},(function(e){return y.deviceStatus(e)})),y._parser.registerCsiHandler({prefix:"?",final:"n"},(function(e){return y.deviceStatusPrivate(e)})),y._parser.registerCsiHandler({intermediates:"!",final:"p"},(function(e){return y.softReset(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"q"},(function(e){return y.setCursorStyle(e)})),y._parser.registerCsiHandler({final:"r"},(function(e){return y.setScrollRegion(e)})),y._parser.registerCsiHandler({final:"s"},(function(e){return y.saveCursor(e)})),y._parser.registerCsiHandler({final:"t"},(function(e){return y.windowOptions(e)})),y._parser.registerCsiHandler({final:"u"},(function(e){return y.restoreCursor(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"}"},(function(e){return y.insertColumns(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"~"},(function(e){return y.deleteColumns(e)})),y._parser.setExecuteHandler(s.C0.BEL,(function(){return y.bell()})),y._parser.setExecuteHandler(s.C0.LF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.VT,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.FF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.CR,(function(){return y.carriageReturn()})),y._parser.setExecuteHandler(s.C0.BS,(function(){return y.backspace()})),y._parser.setExecuteHandler(s.C0.HT,(function(){return y.tab()})),y._parser.setExecuteHandler(s.C0.SO,(function(){return y.shiftOut()})),y._parser.setExecuteHandler(s.C0.SI,(function(){return y.shiftIn()})),y._parser.setExecuteHandler(s.C1.IND,(function(){return y.index()})),y._parser.setExecuteHandler(s.C1.NEL,(function(){return y.nextLine()})),y._parser.setExecuteHandler(s.C1.HTS,(function(){return y.tabSet()})),y._parser.registerOscHandler(0,new g.OscHandler((function(e){return y.setTitle(e),y.setIconName(e),!0}))),y._parser.registerOscHandler(1,new g.OscHandler((function(e){return y.setIconName(e)}))),y._parser.registerOscHandler(2,new g.OscHandler((function(e){return y.setTitle(e)}))),y._parser.registerOscHandler(4,new g.OscHandler((function(e){return y.setAnsiColor(e)}))),y._parser.registerEscHandler({final:"7"},(function(){return y.saveCursor()})),y._parser.registerEscHandler({final:"8"},(function(){return y.restoreCursor()})),y._parser.registerEscHandler({final:"D"},(function(){return y.index()})),y._parser.registerEscHandler({final:"E"},(function(){return y.nextLine()})),y._parser.registerEscHandler({final:"H"},(function(){return y.tabSet()})),y._parser.registerEscHandler({final:"M"},(function(){return y.reverseIndex()})),y._parser.registerEscHandler({final:"="},(function(){return y.keypadApplicationMode()})),y._parser.registerEscHandler({final:">"},(function(){return y.keypadNumericMode()})),y._parser.registerEscHandler({final:"c"},(function(){return y.fullReset()})),y._parser.registerEscHandler({final:"n"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"o"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"|"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"}"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"~"},(function(){return y.setgLevel(1)})),y._parser.registerEscHandler({intermediates:"%",final:"@"},(function(){return y.selectDefaultCharset()})),y._parser.registerEscHandler({intermediates:"%",final:"G"},(function(){return y.selectDefaultCharset()}));var b=function(e){S._parser.registerEscHandler({intermediates:"(",final:e},(function(){return y.selectCharset("("+e)})),S._parser.registerEscHandler({intermediates:")",final:e},(function(){return y.selectCharset(")"+e)})),S._parser.registerEscHandler({intermediates:"*",final:e},(function(){return y.selectCharset("*"+e)})),S._parser.registerEscHandler({intermediates:"+",final:e},(function(){return y.selectCharset("+"+e)})),S._parser.registerEscHandler({intermediates:"-",final:e},(function(){return y.selectCharset("-"+e)})),S._parser.registerEscHandler({intermediates:".",final:e},(function(){return y.selectCharset("."+e)})),S._parser.registerEscHandler({intermediates:"/",final:e},(function(){return y.selectCharset("/"+e)}))},S=this;for(var m in a.CHARSETS)b(m);return y._parser.registerEscHandler({intermediates:"#",final:"8"},(function(){return y.screenAlignmentPattern()})),y._parser.setErrorHandler((function(e){return y._logService.error("Parsing error: ",e),e})),y._parser.registerDcsHandler({intermediates:"$",final:"q"},new C(y._bufferService,y._coreService,y._logService,y._optionsService)),y}return n(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onAnsiColorChange",{get:function(){return this._onAnsiColorChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,r=t.x,i=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.lengthS)for(var n=0;n0&&2===_.getWidth(o.x-1)&&_.setCellFromCodePoint(o.x-1,0,1,f.fg,f.bg,f.extended);for(var p=t;p=c)if(l){for(;o.x=this._bufferService.rows&&(o.y=this._bufferService.rows-1),o.lines.get(o.ybase+o.y).isWrapped=!0),_=o.lines.get(o.ybase+o.y)}else if(o.x=c-1,2===n)continue;if(h&&(_.insertCells(o.x,n,o.getNullCell(f),f),2===_.getWidth(c-1)&&_.setCellFromCodePoint(c-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,f.fg,f.bg,f.extended)),_.setCellFromCodePoint(o.x++,i,n,f.fg,f.bg,f.extended),n>0)for(;--n;)_.setCellFromCodePoint(o.x++,0,0,f.fg,f.bg,f.extended)}else _.getWidth(o.x-1)?_.addCodepointToCell(o.x-1,i):_.addCodepointToCell(o.x-2,i)}r-t>0&&(_.loadCell(o.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),o.x0&&0===_.getWidth(o.x)&&!_.hasContent(o.x)&&_.setCellFromCodePoint(o.x,0,1,f.fg,f.bg,f.extended),this._dirtyRowService.markDirty(o.y)},t.prototype.addCsiHandler=function(e,t){var r=this;return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(function(e){return!m(e.params[0],r._optionsService.options.windowOptions)||t(e)}))},t.prototype.addDcsHandler=function(e,t){return this._parser.registerDcsHandler(e,new y.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.registerEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.registerOscHandler(e,new g.OscHandler(t))},t.prototype.bell=function(){return this._onRequestBell.fire(),!0},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;return this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire(),!0},t.prototype.carriageReturn=function(){return this._bufferService.buffer.x=0,!0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),t.x>0&&t.x--,!0;if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var r=t.lines.get(t.ybase+t.y);r.hasWidth(t.x)&&!r.hasContent(t.x)&&t.x--}return this._restrictCursor(),!0},t.prototype.tab=function(){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;var e=this._bufferService.buffer.x;return this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e),!0},t.prototype.shiftOut=function(){return this._charsetService.setgLevel(1),!0},t.prototype.shiftIn=function(){return this._charsetService.setgLevel(0),!0},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0},t.prototype.cursorForward=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.cursorBackward=function(e){return this._moveCursor(-(e.params[0]||1),0),!0},t.prototype.cursorNextLine=function(e){return this.cursorDown(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorPrecedingLine=function(e){return this.cursorUp(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorCharAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.cursorPosition=function(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0},t.prototype.charPosAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.hPositionRelative=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.linePosAbsolute=function(e){return this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1),!0},t.prototype.vPositionRelative=function(e){return this._moveCursor(0,e.params[0]||1),!0},t.prototype.hVPosition=function(e){return this.cursorPosition(e),!0},t.prototype.tabClear=function(e){var t=e.params[0];return 0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={}),!0},t.prototype.cursorForwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop();return!0},t.prototype.cursorBackwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1,r=this._bufferService.buffer;t--;)r.x=r.prevStop();return!0},t.prototype._eraseInBufferLine=function(e,t,r,i){void 0===i&&(i=!1);var n=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);n.replaceCells(t,r,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i&&(n.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowService.markDirty(t-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var r=this._bufferService.buffer.lines.length-this._bufferService.rows;r>0&&(this._bufferService.buffer.lines.trimStart(r),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-r,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-r,0),this._onScroll.fire(0))}return!0},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}return this._dirtyRowService.markDirty(this._bufferService.buffer.y),!0},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,r=this._bufferService.buffer;if(r.y>r.scrollBottom||r.yr.scrollBottom||r.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0},t.prototype.sendDeviceAttributesSecondary=function(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t=2||2===i[1]&&o+n>=5)break;i[1]&&(n=1)}while(++o+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg,!0;for(var t,r=e.length,i=this._curAttrData,n=0;n=30&&t<=37?(i.fg&=-50331904,i.fg|=16777216|t-30):t>=40&&t<=47?(i.bg&=-50331904,i.bg|=16777216|t-40):t>=90&&t<=97?(i.fg&=-50331904,i.fg|=16777224|t-90):t>=100&&t<=107?(i.bg&=-50331904,i.bg|=16777224|t-100):0===t?(i.fg=f.DEFAULT_ATTR_DATA.fg,i.bg=f.DEFAULT_ATTR_DATA.bg):1===t?i.fg|=134217728:3===t?i.bg|=67108864:4===t?(i.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,i)):5===t?i.fg|=536870912:7===t?i.fg|=67108864:8===t?i.fg|=1073741824:2===t?i.bg|=134217728:21===t?this._processUnderline(2,i):22===t?(i.fg&=-134217729,i.bg&=-134217729):23===t?i.bg&=-67108865:24===t?i.fg&=-268435457:25===t?i.fg&=-536870913:27===t?i.fg&=-67108865:28===t?i.fg&=-1073741825:39===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):49===t?(i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?n+=this._extractColor(e,n,i):59===t?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):100===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t);return!0},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(s.C0.ESC+"[0n");break;case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"["+t+";"+r+"R")}return!0},t.prototype.deviceStatusPrivate=function(e){switch(e.params[0]){case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"[?"+t+";"+r+"R")}return!0},t.prototype.softReset=function(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){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"}var r=t%2==1;return this._optionsService.options.cursorBlink=r,!0},t.prototype.setScrollRegion=function(e){var t,r=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>r&&(this._bufferService.buffer.scrollTop=r-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0)),!0},t.prototype.windowOptions=function(e){if(!m(e.params[0],this._optionsService.options.windowOptions))return!0;var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(o.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(o.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(s.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0},t.prototype.saveCursor=function(e){return this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,!0},t.prototype.restoreCursor=function(e){return this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor(),!0},t.prototype.setTitle=function(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0},t.prototype.setIconName=function(e){return this._iconName=e,!0},t.prototype._parseAnsiColorChange=function(e){for(var t,r={colors:[]},i=/(\d+);rgb:([0-9a-f]{2})\/([0-9a-f]{2})\/([0-9a-f]{2})/gi;null!==(t=i.exec(e));)r.colors.push({colorIndex:parseInt(t[1]),red:parseInt(t[2],16),green:parseInt(t[3],16),blue:parseInt(t[4],16)});return 0===r.colors.length?null:r},t.prototype.setAnsiColor=function(e){var t=this._parseAnsiColorChange(e);return t?this._onAnsiColorChange.fire(t):this._logService.warn("Expected format ;rgb:// but got data: "+e),!0},t.prototype.nextLine=function(){return this._bufferService.buffer.x=0,this.index(),!0},t.prototype.keypadApplicationMode=function(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0},t.prototype.keypadNumericMode=function(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0},t.prototype.selectDefaultCharset=function(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),!0},t.prototype.selectCharset=function(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(b[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET),!0)},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;return this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor(),!0},t.prototype.tabSet=function(){return this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0,!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;if(e.y===e.scrollTop){var t=e.scrollBottom-e.scrollTop;e.lines.shiftElements(e.ybase+e.y,t,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)}else e.y--,this._restrictCursor();return!0},t.prototype.fullReset=function(){return this._parser.reset(),this._onRequestReset.fire(),!0},t.prototype.reset=function(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){return this._charsetService.setgLevel(e),!0},t.prototype.screenAlignmentPattern=function(){var e=new p.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.Disposable=void 0;var r=function(){function e(){this._disposables=[],this._isDisposed=!1}return e.prototype.dispose=function(){this._isDisposed=!0;for(var e=0,t=this._disposables;e{Object.defineProperty(t,"__esModule",{value:!0}),t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isFirefox=void 0;var r="undefined"==typeof navigator,i=r?"node":navigator.userAgent,n=r?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),t.isIpad="iPad"===n,t.isIphone="iPhone"===n,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),t.isLinux=n.indexOf("Linux")>=0},8273:(e,t)=>{function r(e,t,r,i){if(void 0===r&&(r=0),void 0===i&&(i=e.length),r>=e.length)return e;r=(e.length+r)%e.length,i=i>=e.length?e.length:(e.length+i)%e.length;for(var n=r;n{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;var i=r(643);t.updateWindowsModeWrappedState=function(e){var t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),r=null==t?void 0:t.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&r&&(n.isWrapped=r[i.CHAR_DATA_CODE_INDEX]!==i.NULL_CELL_CODE&&r[i.CHAR_DATA_CODE_INDEX]!==i.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;var r=function(){function e(){this.fg=0,this.bg=0,this.extended=new i}return e.toColorRGB=function(e){return[e>>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.prototype.getUnderlineColor=function(){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()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=r;var i=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=i},9092:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var i=r(6349),n=r(8437),o=r(511),s=r(643),a=r(4634),c=r(4863),l=r(7116),h=r(3734);t.MAX_BUFFER_SIZE=4294967295;var u=function(){function e(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=l.DEFAULT_CHARSET,this.markers=[],this._nullCell=o.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]),this._whitespaceCell=o.CellData.fromCharData([0,s.WHITESPACE_CELL_CHAR,s.WHITESPACE_CELL_WIDTH,s.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=n.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},e.prototype.resize=function(e,t){var r=this.getNullCell(n.DEFAULT_ATTR_DATA),i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,r)));else for(a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(o=0;othis._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var r=a.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(r.length>0){var i=a.reflowLargerCreateNewLayout(this.lines,r);a.reflowLargerApplyNewLayout(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,r){for(var i=this.getNullCell(n.DEFAULT_ATTR_DATA),o=r;o-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;s--){var c=this.lines.get(s);if(!(!c||!c.isWrapped&&c.getTrimmedLength()<=e)){for(var l=[c];c.isWrapped&&s>0;)c=this.lines.get(--s),l.unshift(c);var h=this.ybase+this.y;if(!(h>=s&&h0&&(i.push({start:s+l.length+o,newLines:p}),o+=p.length),l.push.apply(l,p);var y=_.length-1,b=_[y];0===b&&(b=_[--y]);for(var S=l.length-d-1,m=f;S>=0;){var C=Math.min(m,b);if(l[y].copyCellsFrom(l[S],m-C,b-C,C,!0),0==(b-=C)&&(b=_[--y]),0==(m-=C)){S--;var w=Math.max(S,0);m=a.getWrappedLineTrimmedLength(l,w,this._cols)}}for(v=0;v0;)0===this.ybase?this.y0){var L=[],A=[];for(v=0;v=0;v--)if(D&&D.start>k+T){for(var O=D.newLines.length-1;O>=0;O--)this.lines.set(v--,D.newLines[O]);v++,L.push({index:k+1,amount:D.newLines.length}),T+=D.newLines.length,D=i[++x]}else this.lines.set(v,A[k--]);var M=0;for(v=L.length-1;v>=0;v--)L[v].index+=M,this.lines.onInsertEmitter.fire(L[v]),M+=L[v].amount;var P=Math.max(0,R+o-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}},e.prototype.stringIndexToBufferIndex=function(e,t,r){for(void 0===r&&(r=!1);t;){var i=this.lines.get(e);if(!i)return[-1,-1];for(var n=r?i.getTrimmedLength():i.length,o=0;o0&&this.lines.get(t).isWrapped;)t--;for(;r+10;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,r=new c.Marker(e);return this.markers.push(r),r.register(this.lines.onTrim((function(e){r.line-=e,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((function(e){r.line>=e.index&&(r.line+=e.amount)}))),r.register(this.lines.onDelete((function(e){r.line>=e.index&&r.linee.index&&(r.line-=e.amount)}))),r.register(r.onDispose((function(){return t._removeMarker(r)}))),r},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,r,i,n){return new f(this,e,t,r,i,n)},e}();t.Buffer=u;var f=function(){function e(e,t,r,i,n,o){void 0===r&&(r=0),void 0===i&&(i=e.lines.length),void 0===n&&(n=0),void 0===o&&(o=0),this._buffer=e,this._trimRight=t,this._startIndex=r,this._endIndex=i,this._startOverscan=n,this._endOverscan=o,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",r=e.first;r<=e.last;++r)t+=this._buffer.translateBufferLineToString(r,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=f},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;var i=r(482),n=r(643),o=r(511),s=r(3734);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);var a=function(){function e(e,t,r){void 0===r&&(r=!1),this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);for(var i=t||o.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]),s=0;s>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]},e.prototype.set=function(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?i.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var r=3*e;return t.content=this._data[r+0],t.fg=this._data[r+1],t.bg=this._data[r+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,r,i,n,o){268435456&n&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=i,this._data[3*e+2]=n},e.prototype.addCodepointToCell=function(e,t){var r=this._data[3*e+0];2097152&r?this._combined[e]+=i.stringFromCodePoint(t):(2097151&r?(this._combined[e]=i.stringFromCodePoint(2097151&r)+i.stringFromCodePoint(t),r&=-2097152,r|=2097152):r=t|1<<22,this._data[3*e+0]=r)},e.prototype.insertCells=function(e,t,r,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new s.ExtendedAttrs),t=0;--a)this.setCell(e+t+a,this.loadCell(e+a,n));for(a=0;athis.length){var r=new Uint32Array(3*e);this.length&&(3*e=e&&delete this._combined[o]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,r,i,n){var o=e._data;if(n)for(var s=i-1;s>=0;s--)for(var a=0;a<3;a++)this._data[3*(r+s)+a]=o[3*(t+s)+a];else for(s=0;s=t&&(this._combined[l-t+r]=e._combined[l])}},e.prototype.translateToString=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===r&&(r=this.length),e&&(r=Math.min(r,this.getTrimmedLength()));for(var o="";t>22||1}return o},e}();t.BufferLine=a},4634:(e,t)=>{function r(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();var i=!e[t].hasContent(r-1)&&1===e[t].getWidth(r-1),n=2===e[t+1].getWidth(0);return i&&n?r-1:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,i,n,o){for(var s=[],a=0;a=a&&n0&&(S>u||0===h[S].getTrimmedLength());S--)b++;b>0&&(s.push(a+h.length-b),s.push(b)),a+=h.length-1}}}return s},t.reflowLargerCreateNewLayout=function(e,t){for(var r=[],i=0,n=t[i],o=0,s=0;sl&&(s-=l,a++);var h=2===e[a].getWidth(s-1);h&&s--;var u=h?i-1:i;n.push(u),c+=u}return n},t.getWrappedLineTrimmedLength=r},5295:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var o=r(9092),s=r(8460),a=function(e){function t(t,r){var i=e.call(this)||this;return i._optionsService=t,i._bufferService=r,i._onBufferActivate=i.register(new s.EventEmitter),i.reset(),i}return n(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this.setupTabStops()},Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},t.prototype.activateAltBuffer=function(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}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(r(844).Disposable);t.BufferSet=a},511:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;var o=r(482),s=r(643),a=r(3734),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.content=0,t.fg=0,t.bg=0,t.extended=new a.ExtendedAttrs,t.combinedData="",t}return n(t,e),t.fromCharData=function(e){var r=new t;return r.setFromCharData(e),r},t.prototype.isCombined=function(){return 2097152&this.content},t.prototype.getWidth=function(){return this.content>>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?o.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[s.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[s.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[s.CHAR_DATA_CHAR_INDEX].length){var r=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){var i=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(r-55296)+i-56320+65536|e[s.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[s.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[s.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[s.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(a.AttributeData);t.CellData=c},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=256,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var o=r(8460),s=function(e){function t(r){var i=e.call(this)||this;return i.line=r,i._id=t._nextId++,i.isDisposed=!1,i._onDispose=new o.EventEmitter,i}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),e.prototype.dispose.call(this))},t._nextId=1,t}(r(844).Disposable);t.Marker=s},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,(i=t.C0||(t.C0={})).NUL="\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="",i.BS="\b",i.HT="\t",i.LF="\n",i.VT="\v",i.FF="\f",i.CR="\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL="",(r=t.C1||(t.C1={})).PAD="€",r.HOP="",r.BPH="‚",r.NBH="ƒ",r.IND="„",r.NEL="…",r.SSA="†",r.ESA="‡",r.HTS="ˆ",r.HTJ="‰",r.VTS="Š",r.PLD="‹",r.PLU="Œ",r.RI="",r.SS2="Ž",r.SS3="",r.DCS="",r.PU1="‘",r.PU2="’",r.STS="“",r.CCH="”",r.MW="•",r.SPA="–",r.EPA="—",r.SOS="˜",r.SGCI="™",r.SCI="š",r.CSI="›",r.ST="œ",r.OSC="",r.PM="ž",r.APC="Ÿ"},7399:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;var i=r(2584),n={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,r,o){var s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B");break;case 8:if(e.shiftKey){s.key=i.C0.BS;break}if(e.altKey){s.key=i.C0.ESC+i.C0.DEL;break}s.key=i.C0.DEL;break;case 9:if(e.shiftKey){s.key=i.C0.ESC+"[Z";break}s.key=i.C0.HT,s.cancel=!0;break;case 13:s.key=e.altKey?i.C0.ESC+i.C0.CR:i.C0.CR,s.cancel=!0;break;case 27:s.key=i.C0.ESC,e.altKey&&(s.key=i.C0.ESC+i.C0.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"D",s.key===i.C0.ESC+"[1;3D"&&(s.key=i.C0.ESC+(r?"b":"[1;5D"))):s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"C",s.key===i.C0.ESC+"[1;3C"&&(s.key=i.C0.ESC+(r?"f":"[1;5C"))):s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"A",r||s.key!==i.C0.ESC+"[1;3A"||(s.key=i.C0.ESC+"[1;5A")):s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"B",r||s.key!==i.C0.ESC+"[1;3B"||(s.key=i.C0.ESC+"[1;5B")):s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=i.C0.ESC+"[2~");break;case 46:s.key=a?i.C0.ESC+"[3;"+(a+1)+"~":i.C0.ESC+"[3~";break;case 36:s.key=a?i.C0.ESC+"[1;"+(a+1)+"H":t?i.C0.ESC+"OH":i.C0.ESC+"[H";break;case 35:s.key=a?i.C0.ESC+"[1;"+(a+1)+"F":t?i.C0.ESC+"OF":i.C0.ESC+"[F";break;case 33:e.shiftKey?s.type=2:s.key=i.C0.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:s.key=i.C0.ESC+"[6~";break;case 112:s.key=a?i.C0.ESC+"[1;"+(a+1)+"P":i.C0.ESC+"OP";break;case 113:s.key=a?i.C0.ESC+"[1;"+(a+1)+"Q":i.C0.ESC+"OQ";break;case 114:s.key=a?i.C0.ESC+"[1;"+(a+1)+"R":i.C0.ESC+"OR";break;case 115:s.key=a?i.C0.ESC+"[1;"+(a+1)+"S":i.C0.ESC+"OS";break;case 116:s.key=a?i.C0.ESC+"[15;"+(a+1)+"~":i.C0.ESC+"[15~";break;case 117:s.key=a?i.C0.ESC+"[17;"+(a+1)+"~":i.C0.ESC+"[17~";break;case 118:s.key=a?i.C0.ESC+"[18;"+(a+1)+"~":i.C0.ESC+"[18~";break;case 119:s.key=a?i.C0.ESC+"[19;"+(a+1)+"~":i.C0.ESC+"[19~";break;case 120:s.key=a?i.C0.ESC+"[20;"+(a+1)+"~":i.C0.ESC+"[20~";break;case 121:s.key=a?i.C0.ESC+"[21;"+(a+1)+"~":i.C0.ESC+"[21~";break;case 122:s.key=a?i.C0.ESC+"[23;"+(a+1)+"~":i.C0.ESC+"[23~";break;case 123:s.key=a?i.C0.ESC+"[24;"+(a+1)+"~":i.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(r&&!o||!e.altKey||e.metaKey)!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?s.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(s.key=i.C0.US):65===e.keyCode&&(s.type=1);else{var c=n[e.keyCode],l=c&&c[e.shiftKey?1:0];if(l)s.key=i.C0.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){var h=e.ctrlKey?e.keyCode-64:e.keyCode+32;s.key=i.C0.ESC+String.fromCharCode(h)}}else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=i.C0.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=i.C0.DEL:219===e.keyCode?s.key=i.C0.ESC:220===e.keyCode?s.key=i.C0.FS:221===e.keyCode&&(s.key=i.C0.GS)}return s}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=e.length);for(var i="",n=t;n65535?(o-=65536,i+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i};var r=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i=0,n=0;this._interim&&(56320<=(a=e.charCodeAt(n++))&&a<=57343?t[i++]=1024*(this._interim-55296)+a-56320+65536:(t[i++]=this._interim,t[i++]=a),this._interim=0);for(var o=n;o=r)return this._interim=s,i;var a;56320<=(a=e.charCodeAt(o))&&a<=57343?t[i++]=1024*(s-55296)+a-56320+65536:(t[i++]=s,t[i++]=a)}else 65279!==s&&(t[i++]=s)}return i},e}();t.StringToUtf32=r;var i=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i,n,o,s,a=0,c=0,l=0;if(this.interim[0]){var h=!1,u=this.interim[0];u&=192==(224&u)?31:224==(240&u)?15:7;for(var f=0,_=void 0;(_=63&this.interim[++f])&&f<4;)u<<=6,u|=_;for(var d=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,p=d-f;l=r)return 0;if(128!=(192&(_=e[l++]))){l--,h=!0;break}this.interim[f++]=_,u<<=6,u|=63&_}h||(2===d?u<128?l--:t[a++]=u:3===d?u<2048||u>=55296&&u<=57343||65279===u||(t[a++]=u):u<65536||u>1114111||(t[a++]=u)),this.interim.fill(0)}for(var v=r-4,g=l;g=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if((c=(31&i)<<6|63&n)<128){g--;continue}t[a++]=c}else if(224==(240&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if((c=(15&i)<<12|(63&n)<<6|63&o)<2048||c>=55296&&c<=57343||65279===c)continue;t[a++]=c}else if(240==(248&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,this.interim[2]=o,a;if(128!=(192&(s=e[g++]))){g--;continue}if((c=(7&i)<<18|(63&n)<<12|(63&o)<<6|63&s)<65536||c>1114111)continue;t[a++]=c}}return a},e}();t.Utf8ToUtf32=i},225:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var i,n=r(8273),o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],a=function(){function e(){if(this.version="6",!i){i=new Uint8Array(65536),n.fill(i,1),i[0]=0,n.fill(i,0,1,32),n.fill(i,0,127,160),n.fill(i,2,4352,4448),i[9001]=2,i[9002]=2,n.fill(i,2,11904,42192),i[12351]=1,n.fill(i,2,44032,55204),n.fill(i,2,63744,64256),n.fill(i,2,65040,65050),n.fill(i,2,65072,65136),n.fill(i,2,65280,65377),n.fill(i,2,65504,65511);for(var e=0;et[n][1])return!1;for(;n>=i;)if(e>t[r=i+n>>1][1])i=r+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=a},5981:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var r=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout((function(){return r._innerWrite()}))),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var r=this._writeBuffer[this._bufferOffset],i=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(r),this._pendingData-=r.length,i&&i(),Date.now()-t>=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((function(){return e._innerWrite()}),0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=r},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var i=r(482),n=r(8742),o=r(5770),s=[],a=function(){function e(){this._handlers=Object.create(null),this._active=s,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=s},e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=s,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||s,this._active.length)for(var r=this._active.length-1;r>=0;r--)this._active[r].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,r){if(this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._ident,"PUT",i.utf32ToString(e,t,r))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=s,this._ident=0},e}();t.DcsParser=a;var c=new n.Params;c.addParam(0);var l=function(){function e(e){this._handler=e,this._data="",this._params=c,this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.length>1||e.params[0]?e.clone():c,this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=i.utf32ToString(e,t,r),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params)),this._params=c,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},2015:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var o=r(844),s=r(8273),a=r(8742),c=r(6242),l=r(6351),h=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){s.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,r,i){this.table[t<<8|e]=r<<4|i},e.prototype.addMany=function(e,t,r,i){for(var n=0;n1)throw new Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&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(var i=0;in||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");var o=e.final.charCodeAt(0);if(t[0]>o||o>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(r<<=8)|o},r.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},r.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},r.prototype.setPrintHandler=function(e){this._printHandler=e},r.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},r.prototype.registerEscHandler=function(e,t){var r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);var i=this._escHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},r.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},r.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},r.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},r.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},r.prototype.registerCsiHandler=function(e,t){var r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);var i=this._csiHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},r.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},r.prototype.registerDcsHandler=function(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)},r.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},r.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},r.prototype.registerOscHandler=function(e,t){return this._oscParser.registerHandler(e,t)},r.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},r.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},r.prototype.setErrorHandler=function(e){this._errorHandler=e},r.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},r.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},r.prototype.parse=function(e,t){for(var r=0,i=0,n=this.currentState,o=this._oscParser,s=this._dcsParser,a=this._collect,c=this._params,l=this._transitions.table,h=0;h>4){case 2:for(var f=h+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=0&&!_[d](c);d--);d<0&&this._csiHandlerFb(a<<8|r,c),this.precedingCodepoint=0;break;case 8:do{switch(r){case 59:c.addParam(0);break;case 58:c.addSubParam(-1);break;default:c.addDigit(r-48)}}while(++h47&&r<60);h--;break;case 9:a<<=8,a|=r;break;case 10:for(var p=this._escHandlers[a<<8|r],v=p?p.length-1:-1;v>=0&&!p[v]();v--);v<0&&this._escHandlerFb(a<<8|r),this.precedingCodepoint=0;break;case 11:c.reset(),c.addParam(0),a=0;break;case 12:s.hook(a<<8|r,c);break;case 13:for(var g=h+1;;++g)if(g>=t||24===(r=e[g])||26===r||27===r||r>127&&r=t||(r=e[y])<32||r>127&&r{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;var i=r(5770),n=r(482),o=[],s=function(){function e(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=o},e.prototype.reset=function(){2===this._state&&this.end(!1),this._active=o,this._id=-1,this._state=0},e.prototype._start=function(){if(this._active=this._handlers[this._id]||o,this._active.length)for(var e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,r){if(this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r);else this._handlerFb(this._id,"PUT",n.utf32ToString(e,t,r))},e.prototype._end=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].end(e);t--);for(t--;t>=0;t--)this._active[t].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._state=1},e.prototype.put=function(e,t,r){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,r)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._active=o,this._id=-1,this._state=0)},e}();t.OscParser=s;var a=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=n.utf32ToString(e,t,r),this._data.length>i.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=a},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;var r=2147483647,i=function(){function e(e,t){if(void 0===e&&(e=32),void 0===t&&(t=32),this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var r=new e;if(!t.length)return r;for(var i=t[0]instanceof Array?1:0;i>8,i=255&this._subParamsIdx[t];i-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,i))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>r?r:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>r?r:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-t>0?this._subParams.subarray(t,r):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t>8,i=255&this._subParamsIdx[t];i-r>0&&(e[t]=this._subParams.slice(r,i))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var i=this._digitIsSub?this._subParams:this.params,n=i[t-1];i[t-1]=~n?Math.min(10*n+e,r):e}},e}();t.Params=i},744:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var a=r(2585),c=r(5295),l=r(8460),h=r(844);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var u=function(e){function r(r){var i=e.call(this)||this;return i._optionsService=r,i.isUserScrolling=!1,i._onResize=new l.EventEmitter,i.cols=Math.max(r.options.cols,t.MINIMUM_COLS),i.rows=Math.max(r.options.rows,t.MINIMUM_ROWS),i.buffers=new c.BufferSet(r,i),i}return n(r,e),Object.defineProperty(r.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),r.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},r.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},r.prototype.reset=function(){this.buffers.reset(),this.isUserScrolling=!1},o([s(0,a.IOptionsService)],r)}(h.Disposable);t.BufferService=u},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var r=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=r},1753:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var o=r(2585),s=r(8460),a={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function c(e,t){var r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||t||(r|=3)),r}var l=String.fromCharCode,h={DEFAULT:function(e){var t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":""+l(t[0])+l(t[1])+l(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"[<"+c(e,!0)+";"+e.col+";"+e.row+t}},u=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new s.EventEmitter,this._lastEvent=null;for(var r=0,i=Object.keys(a);r=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},i([n(0,o.IBufferService),n(1,o.ICoreService)],e)}();t.CoreMouseService=u},6975:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var a=r(2585),c=r(8460),l=r(1439),h=r(844),u=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),_=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o._bufferService=r,o._logService=i,o._optionsService=n,o.isCursorInitialized=!1,o.isCursorHidden=!1,o._onData=o.register(new c.EventEmitter),o._onUserInput=o.register(new c.EventEmitter),o._onBinary=o.register(new c.EventEmitter),o._scrollToBottom=t,o.register({dispose:function(){return o._scrollToBottom=void 0}}),o.modes=l.clone(u),o.decPrivateModes=l.clone(f),o}return n(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=l.clone(u),this.decPrivateModes=l.clone(f)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var r=this._bufferService.buffer;r.ybase!==r.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onBinary.fire(e))},o([s(1,a.IBufferService),s(2,a.ILogService),s(3,a.IOptionsService)],t)}(h.Disposable);t.CoreService=_},3730:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var o=r(2585),s=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){ethis._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var r=e;e=t,t=r}ethis._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},i([n(0,o.IBufferService)],e)}();t.DirtyRowService=s},4348:function(e,t,r){var i=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t0?n[0].index:t.length;if(t.length!==u)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(u+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,i([void 0],i(t,s))))},e}();t.InstantiationService=a},7866:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var i=r(8460),n=r(6114),o=r(1439);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:t.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1});var s=["normal","bold","100","200","300","400","500","600","700","800","900"],a=["cols","rows"],c=function(){function e(e){this._onOptionChange=new i.EventEmitter,this.options=o.clone(t.DEFAULT_OPTIONS);for(var r=0,n=Object.keys(e);r{function r(e,t,r){t.di$target===t?t.di$dependencies.push({id:e,index:r}):(t.di$dependencies=[{id:e,index:r}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);var i=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");r(i,e,n)};return i.toString=function(){return e},t.serviceRegistry.set(e,i),i}},2585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IUnicodeService=t.IOptionsService=t.ILogService=t.IInstantiationService=t.IDirtyRowService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;var i=r(8343);t.IBufferService=i.createDecorator("BufferService"),t.ICoreMouseService=i.createDecorator("CoreMouseService"),t.ICoreService=i.createDecorator("CoreService"),t.ICharsetService=i.createDecorator("CharsetService"),t.IDirtyRowService=i.createDecorator("DirtyRowService"),t.IInstantiationService=i.createDecorator("InstantiationService"),t.ILogService=i.createDecorator("LogService"),t.IOptionsService=i.createDecorator("OptionsService"),t.IUnicodeService=i.createDecorator("UnicodeService")},1480:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;var i=r(8460),n=r(225),o=function(){function e(){this._providers=Object.create(null),this._active="",this._onChange=new i.EventEmitter;var e=new n.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}return Object.defineProperty(e.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._active},set:function(e){if(!this._providers[e])throw new Error('unknown Unicode version "'+e+'"');this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)},enumerable:!1,configurable:!0}),e.prototype.register=function(e){this._providers[e.version]=e},e.prototype.wcwidth=function(e){return this._activeProvider.wcwidth(e)},e.prototype.getStringCellWidth=function(e){for(var t=0,r=e.length,i=0;i=r)return t+this.wcwidth(n);var o=e.charCodeAt(i);56320<=o&&o<=57343?n=1024*(n-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(n)}return t},e}();t.UnicodeService=o}},t={};return function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}(4389)})()})); +//# sourceMappingURL=xterm.js.map + +SSHyClient.settings = function() { + // Local echo reduces latency on regular key presses to aruond 0.04s compared to ~0.2s without it + this.localEcho = 0; // 0 - off; 1 - auto; 2 - on + + /* Default the bindings to bash */ + this.fsHintEnter = "\x1b\x5b\x3f\x31"; // seems to be the same for all shells + this.fsHintLeave = SSHyClient.bashFsHintLeave; + + this.autoEchoState = false; // false = no echoing ; true = echoing + this.autoEchoTimeout = 0; // stores the time of last autoecho change + + this.blockedKeys = [':']; // while localecho(force-on) don't echo these keys + + this.keepAliveInterval = undefined; // stores the setInterval() reference + + this.fontSize = 16; + + this.colorTango = true + this.colorNames = Object.keys(this.colorSchemes); + this.colorCounter = 0; // Stores the current index of the theme loaded in colorSchemes + + this.shellString = ''; // Used to buffer shell identifications ie ']0;fish' or 'user@host$' + + this.sidenavElementState = 0; // Stores the state of the sidenav (0 - closed, [x] - true) + // Caches the DOM elements + this.rxElement = document.getElementById('rxTraffic'); + this.txElement = document.getElementById('txTraffic'); + this.autoEchoElement = document.getElementById('autoEchoState'); + + this.rsaCheckEnabled = true; +}; +SSHyClient.settings.prototype = { + // All our supported terminal color themes in [bg, color1, .... , color15, cursor, fg] + colorSchemes: [ + ['Solarized', {background:"#002b36", black:"#002b36", red:"#dc322f", green:"#859900", yellow:"#b58900", blue:"#268bd2", magenta:"#6c71c4", cyan:"#2aa198", white:"#93a1a1", brightBlack:"#657b83", brightRed:"#dc322f", brightGreen:"#859900", brightYellow:"#b58900", brightBlue:"#268bd2", brightMagenta:"#6c71c4", brightCyan:"#2aa198", brightWhite:"#fdf6e3", cursor:"#93a1a1", foreground:"#93a1a1"}], + ['Material', {background:"#263238", black:"#263238", red:"#ff9800", green:"#8bc34a", yellow:"#ffc107", blue:"#03a9f4", magenta:"#e91e63", cyan:"#009688", white:"#cfd8dc", brightBlack:"#37474f", brightRed:"#ffa74d", brightGreen:"#9ccc65", brightYellow:"#ffa000", brightBlue:"#81d4fa", brightMagenta:"#ad1457", brightCyan:"#26a69a", brightWhite:"#eceff1", cursor:"#eceff1", foreground:"#eceff1"}], + ['Monokai', {background:"#272822", black:"#272822", red:"#dc2566", green:"#8fc029", yellow:"#d4c96e", blue:"#55bcce", magenta:"#9358fe", cyan:"#56b7a5", white:"#acada1", brightBlack:"#76715e", brightRed:"#fa2772", brightGreen:"#a7e22e", brightYellow:"#e7db75", brightBlue:"#66d9ee", brightMagenta:"#ae82ff", brightCyan:"#66efd5", brightWhite:"#cfd0c2", cursor:"#f1ebeb", foreground:"#f1ebeb"}], + ['Ashes', {background:"#1c2023", black:"#1c2023", red:"#c7ae95", green:"#95c7ae", yellow:"#aec795", blue:"#ae95c7", magenta:"#c795ae", cyan:"#95aec7", white:"#c7ccd1", brightBlack:"#747c84", brightRed:"#c7ae95", brightGreen:"#95c7ae", brightYellow:"#aec795", brightBlue:"#ae95c7", brightMagenta:"#c795ae", brightCyan:"#95aec7", brightWhite:"#f3f4f5", cursor:"#c7ccd1", foreground:"#c7ccd1"}], + ['Google', {background:"#ffffff", black:"#ffffff", red:"#cc342b", green:"#198844", yellow:"#fba922", blue:"#3971ed", magenta:"#a36ac7", cyan:"#3971ed", white:"#c5c8c6", brightBlack:"#969896", brightRed:"#cc342b", brightGreen:"#198844", brightYellow:"#fba922", brightBlue:"#3971ed", brightMagenta:"#a36ac7", brightCyan:"#3971ed", brightWhite:"#ffffff", cursor:"#373b41", foreground:"#373b41"}], + ['Mono Light', {background:"#f7f7f7", black:"#f7f7f7", red:"#7c7c7c", green:"#8e8e8e", yellow:"#a0a0a0", blue:"#686868", magenta:"#747474", cyan:"#868686", white:"#b9b9b9", brightBlack:"#525252", brightRed:"#7c7c7c", brightGreen:"#8e8e8e", brightYellow:"#a0a0a0", brightBlue:"#686868", brightMagenta:"#747474", brightCyan:"#868686", brightWhite:"#f7f7f7", cursor:"#464646", foreground:"#464646"}], + ['Mono Dark', {background:"#000000", black:"#000000", red:"#6b6b6b", green:"#c4c4c4", yellow:"#b3b3b3", blue:"#999999", magenta:"#717171", cyan:"#8a8a8a", white:"#b5cabb", brightBlack:"#202020", brightRed:"#464646", brightGreen:"#f8f8f8", brightYellow:"#eeeeee", brightBlue:"#7c7c7c", brightMagenta:"#adadad", brightCyan:"#c0c0c0", brightWhite:"#99ac9e", cursor:"#ffffff", foreground:"#ffffff"}], + ['Tango', {}] + ], + + // Takes a single character and identifies shell type + testShell: function(r) { + // Check that we're adding the start of a string + if (r.substring(0, 2).indexOf(']') === -1 && (this.shellString.length === 0 || this.shellString.length > ']0;fish'.length)) { + this.shellString = ''; + return; + } + + this.shellString += r; + + // Don't bother checking if we don't have enough characters for a match + if (this.shellString.length < 7) { + return; + } + // Check for fish + if (this.shellString.indexOf(']0;fish') !== -1) { + this.shellString = ''; + this.fsHintLeave = SSHyClient.fishFsHintLeave; + return; + } + + // Catch all for bash + if (this.shellString.indexOf('@') !== -1) { + this.shellString = ''; + this.fsHintLeave = SSHyClient.bashFsHintLeave; + return; + } + }, + // Toggles Local Echo on and off + setLocalEcho: function(dir) { + // Clamp the setting between 0 and 2 + this.localEcho = Math.min(Math.max(this.localEcho += dir, 0), 2); + + // Change the displayed mode to the string at 'this.localEcho' of array + document.getElementById('currentLEcho').innerHTML = ["Force Off", "Auto", "Force On"][this.localEcho]; + + // If we're using auto echo mode, change the auto state tooltiptext + var element = document.getElementById('autoEchoState'); + if (this.localEcho === 1) { + element.style.visibility = 'visible'; + element.innerHTML = "State: " + (this.autoEchoState === false ? 'Disabled' : 'Enabled'); + } else { + element.style.visibility = 'hidden'; + } + }, + + // Parses a given message (r) for signs to enable or disable local echo + parseLocalEcho: function(r) { + // if we're using auto mode + if (this.localEcho === 1) { + // Caching this since it takes a long time to get at least twice + var timeout = performance.now(); + // Don't continue if we've changed state in the previous 0.1s + if (timeout - this.autoEchoTimeout < 100) { + return; + } + // We only need to examine the beginning of most messages so just take the first 64 bytes to improve performance + r = r.substring(0, 64); + if (!this.autoEchoState) { + // Search for '@' aswell so we catch on 'user@hostname' aswell + if (r.indexOf(this.fsHintLeave) != -1 && r.indexOf('@') != -1) { + this.autoEchoState = true; + // Change the Settings UI + this.autoEchoElement.innerHTML = "State: Enabled"; + this.autoEchoTimeout = timeout; + } + } else { + // check for 'password' incase we are inputting a password + if (r.indexOf(this.fsHintEnter) != -1 || r.toLowerCase().indexOf('password') != -1) { + this.autoEchoState = false; + this.autoEchoElement.innerHTML = "State: Disabled"; + this.autoEchoTimeout = timeout; + } + } + } + return; + }, + // Parses a keydown event to determine if we can safely echo the key. + parseKey: function(e) { + // Don't continue to write the key if auto echoing is disabled + if (this.localEcho === 1 && this.autoEchoState === false) { + return; + } + // Make sure the key isn't a special one eg 'ArrowUp', a blocked key or a control character + if (e.key.length > 1 || this.blockedKeys.includes(e.key) || (e.altKey || e.ctrlKey || e.metaKey)) { + return; + } + // Incase someone is typing very fast don't echo to perserve servers formatting. + if (!transport.lastKey) { + term.write(e.key); + } + transport.lastKey += e.key; + }, + // Sets the keep alive iterval or clears a current interval based on 'time' + setKeepAlive: function(time) { + // changes 'time' into seconds & floors time to stop 0.00001s ect + time = time === undefined ? 0 : Math.floor(time) * 1000; + // if there is an interval setup then clear it + if (time === 0 || this.keepAliveInterval !== undefined) { + clearInterval(this.keepAliveInterval); + this.keepAliveInterval = undefined; + if (!time) { + return; + } + } + // otherwise create a new interval + this.keepAliveInterval = setInterval(transport.keepAlive, time); + }, + // Set xtermjs's color scheme to the given color + setColorScheme: function(colIndex) { + // Gets a reference to xterm.css + var term_style = document.styleSheets[0]; + var themeName = this.colorSchemes[colIndex][0] + var themeColors = this.colorSchemes[colIndex][1] + + // Interact with xtermjs + if (term) { + term.setOption('theme',themeColors) + } + + // Remove the old CSS rules if its a custom theme + if(!this.colorTango){ + for (i = 0; i < 4; i++) { + term_style.deleteRule(13); + } + } + + if(themeName === 'Tango') { + this.colorTango = true; + document.getElementById('currentColor').innerHTML = 'Tango'; + return; + } + + // Adds html background colour + term_style.insertRule('html, body {background-color: ' + themeColors.background + ' !important;}', 13); + // Changes the sidenav color + term_style.insertRule('.sidenav {background-color: ' + modColorPercent(themeColors.background, -0.2) + ' !important;}', 13); + // Changes the rx and tx color to 10 and 11 + term_style.insertRule('.brightgreen {color: ' + themeColors.brightGreen + ' !important;}', 13); + term_style.insertRule('.brightyellow {color: ' + themeColors.brightYellow + ' !important;}', 13); + + this.colorTango = false; + + document.getElementById('currentColor').innerHTML = themeName === undefined ? 'Custom' : themeName; + }, + + importXresources: function() { + var reader = new FileReader(); + var element = document.getElementById('Xresources').files[0]; + reader.readAsText(element); + reader.onload = function() { + var file = reader.result; + var lines = file.split("\n"); + // natural sort the Xresources list to bg, 1 - 15, cur, fg colours + lines = lines.sort(new Intl.Collator(undefined, { + numeric: true, + sensitivity: 'base' + }).compare); + + colScheme = []; + + for (var i = 0; i < lines.length; i++) { + // Regex the line for a color code #xxx or #xxxxxx + var result = lines[i].match(/#([0-9a-f]{3}){1,2}/ig); + if (result) { + colScheme.push(result[0]); + // If we've added 19 colors then stop and display it? + if (colScheme.length >= 19) { + break; + } + } + } + + // Make sure the new color scheme has the required amount of colours + if (colScheme.length !== 19) { + return alert('Uploaded file could not be parsed correctly.'); + } + + // lastly we need to sort it into a dict instead of list + colScheme = {background: colScheme[0],black: colScheme[1],red: colScheme[2],green: colScheme[3],yellow: colScheme[4],blue: colScheme[5],magenta: colScheme[6],cyan: colScheme[7],white: colScheme[8],brightBlack: colScheme[9],brightRed: colScheme[10],brightGreen: colScheme[11],brightYellow: colScheme[12],brightBlue: colScheme[13],brightMagenta: colScheme[14],brightCyan: colScheme[15],brightWhite: colScheme[16],cursor: colScheme[17],foreground: colScheme[18]} + colName = element.name === '.Xresources' ? 'custom' : element.name.split('.')[0] + + // Add to the colorSchemes list + transport.settings.colorSchemes.push([colName, colScheme]) + // Get the new key + transport.settings.colorNames = Object.keys(transport.settings.colorSchemes); + transport.settings.setColorScheme(transport.settings.colorSchemes.length-1) + }; + }, + // Cycle the color counter and set the current colors to new index + cycleColorSchemes: function(dir) { + // Cycles through (0 -> colorSchemes.length - 1) where dir = 1 is incrementing and dir = false decrements + this.colorCounter = dir === 0 ? --this.colorCounter : ++this.colorCounter; + if (this.colorCounter > this.colorNames.length - 1 || this.colorCounter < 0) { + this.colorCounter = dir === 1 ? 0 : this.colorNames.length - 1; + } + // Set color scheme to (colorList [ colorNames [ counter ]]) + this.setColorScheme(this.colorCounter) + }, + // Modify the font size of the terminal + modFontSize: function(sign) { + this.fontSize += sign; + term.setOption('fontSize', this.fontSize) + + document.getElementById("currentFontSize").innerHTML = transport.settings.fontSize + 'px'; + // Recalculate rows/cols + fitAddon.fit() + transport.auth.mod_pty('window-change', term.cols, term.rows); + }, + // Sets the terminal size where id= 0-> cols ; 1-> rows + modTerm: function(id, newAmount) { + if (!id) { + term.resize(newAmount, term.rows); + } else { + term.resize(term.cols, newAmount); + } + + transport.auth.mod_pty('window-change', term.cols, term.rows); + }, + // Changes the network traffic setting to reflect transmitted or recieved data + setNetTraffic: function(value, dir) { + // No point recalculating if the sidenav is closed + if (!this.sidenavElementState) { + return; + } + // Convert the 'value' into the correct units + switch (true) { + case value < 1024: + value = value + 'Bytes'; + break; + case (value >= 1024 && value < 1048576): + value = (value / 1024).toFixed(3) + 'KB'; + break; + case (value >= 1048576 && value < 1073741824): + value = (value / 1048576).toFixed(3) + 'MB'; + break; + default: + // Just going to stop at Gb since its unlikely to go above that + value = (value / 1073741824).toFixed(3) + 'GB'; + } + // Set the target element we we're going to change. + element = dir === true ? this.rxElement : this.txElement; + element.innerHTML = value; + } +}; + +/* + An alternative starting script used by 'wrapper.html' + + - Modifies the minimal 'wrapper.html' to include a settings UI + - Sets up the websocket connection and other page bindings + - Starts xterm.js and SSHyClient.Transport +*/ +var ws, transport, term = null; +var fitAddon = null; +var wsproxyEncoding = null; + +// Really struggling to encode string as a binary array buffer +// this technique seems to work, but why! +// Adapted from the following +// https://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers +// https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String +// +function ab2str(buf) { + return String.fromCharCode.apply(null, new Uint8Array(buf)); +} + +function str2ab(str) { + var buf = new ArrayBuffer(str.length*1); // 2 bytes for each char + var bufView = new Uint8Array(buf); + for (var i=0, strLen=str.length; i window.msCrypto.getRandomValues() + window.crypto = {} + window.crypto.getRandomValues = function(a) { return window.msCrypto.getRandomValues(a); } + + // PolyFill Uint8Array.slice() for IE 11 for sjcl AES + if (!Uint8Array.prototype.slice) { + Object.defineProperty(Uint8Array.prototype, 'slice', { + value: Array.prototype.slice + }); + } +} + +// Stores timeouts for window.onresize() +var resizeInterval; +window.onload = function() { + // Appending the settings UI to keep 'wrapper.html' as small as possible for cgi builds on Linuxzoo.net + document.body.innerHTML += `
+ × + Terminal Options +
+ Font Size + \<-- + 16px + --\> + Terminal Size + Cols: + + + Rows: + + + Local Echo + \<-- + --\> +
+ State: Enabled + Force Off +
+ Colours + \<-- + Monokai + --\> +
+ Format: Xresources + Upload + +
+ Keep Alive +
+ 0 to disable + + seconds +
+ Network Traffic +
+ rx: + tx: +
+ +
+ `; + + // After the page loads start up the SSH client + startSSHy(); +}; +// Sets up a bind for every time the web browser is resized +window.onresize = function(){ + clearTimeout(resizeInterval); + resizeInterval = setTimeout(resize, 400); +}; +// Run every time the page is refreshed / closed to disconnect from the SSH server +window.onbeforeunload = function() { + if (ws || transport) { + transport.disconnect(); + } +}; +// Recalculates the terminal Columns / Rows and sends new size to SSH server + xtermjs +function resize() { + if (term) { + // Calculate best rows and columns for the div + fitAddon.fit(); + // Let the SSH session know the new size + transport.auth.mod_pty('window-change', term.cols, term.rows); + // Update the side panel + document.getElementById('termCols').value = term.cols; + document.getElementById('termRows').value = term.rows; + } +} +// Toggles the settings navigator +function toggleNav(size){ + document.getElementById("settingsNav").style.width = size; + transport.settings.sidenavElementState = size; + // We need to update the network traffic whenever the nav is re-opened + if(size){ + transport.settings.setNetTraffic(transport.parceler.recieveData, true); + transport.settings.setNetTraffic(transport.parceler.transmitData, false); + } + var element = document.getElementById("gear").style; + element.visibility = element.visibility === "hidden" ? "visible" : "hidden"; +} +// Starts the SSH client in scripts/transport.js +function startSSHy() { + // Initialise the window title + document.title = "SSHy Client"; + + // Opens the websocket! + + if (wsproxyEncoding == 'binary') { + } else { + wsproxyEncoding = 'base64'; + } + + if (wsproxyEncoding == 'binary') { + ws = new WebSocket(wsproxyURL); + ws.binaryType = "arraybuffer"; + } else { + ws = new WebSocket(wsproxyURL, 'base64'); + } + + // Sets up websocket listeners + ws.onopen = function(e) { + transport = new SSHyClient.Transport(ws); + + /* + !! Enables or disables RSA Host checking !! + Since Linuxzoo changes host every time there is no reason to use it + */ + + transport.settings.rsaCheckEnabled = false; + }; + // Send all recieved messages to SSHyClient.Transport.handle() + ws.onmessage = function(e) { + if (wsproxyEncoding == 'binary') { + // ArrayBuffer to String + transport.parceler.handle(ab2str(e.data)); + } else { + // Convert the recieved data from base64 to a string + transport.parceler.handle(atob(e.data)); + } + }; + // Whenever the websocket is closed make sure to display an error if appropriate + ws.onclose = function(e) { + if(term){ + // Don't display an error if SSH transport has already detected a graceful exit + if(transport.closing){ + return; + } + term.write('\n\n\rWebsocket connection to ' + transport.auth.hostname + ' was unexpectedly closed.'); + // If there is no keepAliveInterval then inform users they can use it + if(!transport.settings.keepAliveInterval){ + term.write('\n\n\rThis was likely caused by he remote SSH server timing out the session due to inactivity.\r\n- Session Keep Alive interval can be set in the settings to prevent this behaviour.'); + } + } else { + // Since no terminal exists we need to initialse one before being able to write the error + termInit(); + term.write('WebSocket connection failed: Error in connection establishment: code ' + e.code); + } + }; + // Just a little abstraction from ws.send + ws.sendB64 = function(e){ + if (wsproxyEncoding == 'binary') { + this.send(str2ab(e)); + + transport.parceler.transmitData += e.length; + transport.settings.setNetTraffic(transport.parceler.transmitData, false); + } else { + this.send(btoa(e)); + + transport.parceler.transmitData += e.length; + transport.settings.setNetTraffic(transport.parceler.transmitData, false); + } + }; +} +// Initialises xtermjs +function termInit() { + // Define the terminal rows/cols + term = new Terminal({ + //cols: 80, + //rows: 24 + }); + + fitAddon = new FitAddon(); + term.loadAddon(fitAddon); + // start xterm.js + term.open(document.getElementById('terminal'), true); + fitAddon.fit() + term.focus() + // set the terminal size on settings menu + document.getElementById('termCols').value = term.cols; + document.getElementById('termRows').value = term.rows; + // Sets the default colorScheme to material + transport.settings.setColorScheme(1); + +} +// Binds custom listener functions to xtermjs's Terminal object +function startxtermjs() { + termInit(); + + // if we haven't authenticated yet we're doing an interactive login + if (!transport.auth.authenticated) { + term.write('Login as: '); + } + + // sets up some listeners for the terminal (keydown, paste) + term.onData((data) => { + if (!ws || !transport || !transport.auth.authenticated) { + // If no connection dont send, and unauthenticated connections handled + // elsewhere + return; + } + if (data.length > 5000) { + // Apparently long strings kill SSHyClient.parceler, although it is + // probably best to sort that there rather than here... + var blocks; + blocks = splitSlice(data); + //console.log("ondata length ",blocks.length); + for (var i = 0; i < blocks.length; i++) { + //console.log("ondata block ",i,blocks[i].charCodeAt(0)) + transport.expect_key(blocks[i]); + } + } else { + //console.log("ondata ",data.charCodeAt(0), data.substr(1)) + transport.expect_key(data); + } + }); + term.attachCustomKeyEventHandler(e=> { + // Sanity Checks + if (e.type != 'keydown') {return;} + + // If websocket is closed, ran out of attempts to authenticate, or just + // waiting to confirm the username and password, dont forward keys + if (!ws || !transport || transport.auth.failedAttempts >= 5 || transport.auth.awaitingAuthentication) { + return false; + } + var pressedKey + /** IE isn't very good so it displays one character keys as full names in .key + EG - e.key = " " to e.key = "Spacebar" + so assuming .char is one character we'll use that instead **/ + if (e.char && e.char.length == 1) { + pressedKey = e.char; + } else { + pressedKey = e.key + } + + if (pressedKey.length == 1 && (e.shiftKey && e.ctrlKey)) { + // allows ctrl + shift + v for pasting + // and dont forward those keys to the terminal + if (e.key == 'V') { + return false; + } + } + + // onData does the majority of sending keys for transport + if (transport.auth.authenticated) { + return; + } + // Not yet authenticated + + // For usernames and passwords only named keys Delete and Enter is ok + // so we can't input stuff like 'ArrowUp' + if ((pressedKey.length > 1) && (e.keyCode != 13 && e.keyCode != 8)){ + return; + } + // Other clients doesn't allow control characters during authentication + if (e.altKey || e.ctrlKey || e.metaKey) { + return; + } + /* while termPassword is undefined, add all input to termUsername + when it becomes defined then change targets to transport.auth.termPassword */ + switch (e.keyCode) { + case 8: // backspace + if (transport.auth.termPassword === undefined) { + if (transport.auth.termUsername.length > 0) { + term.write("\b \b"); + transport.auth.termUsername = transport.auth.termUsername.slice(0, transport.auth.termUsername.length - 1); + } + } else { + transport.auth.termPassword = transport.auth.termPassword.slice(0, transport.auth.termPassword.length - 1); + } + return false; + break; + case 13: // enter + if (transport.auth.termPassword === undefined) { + term.write("\n\r" + transport.auth.termUsername + '@' + transport.auth.hostname + '\'s password:'); + transport.auth.termPassword = ''; + } else { + term.write('\n\r'); + transport.auth.ssh_connection(); + } + return false; + break; + default: + if (transport.auth.termPassword === undefined) { + transport.auth.termUsername += pressedKey; + term.write(pressedKey); + } else { + transport.auth.termPassword += pressedKey; + } + } + return false; + }); +} diff --git a/js/combinedLibs.comb.js b/js/combinedLibs.comb.js index 88a4502..642d8b5 100644 --- a/js/combinedLibs.comb.js +++ b/js/combinedLibs.comb.js @@ -1,390 +1,2991 @@ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,a,h){c!=Array.prototype&&c!=Object.prototype&&(c[a]=h.value)};$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this); -$jscomp.polyfill=function(c,a,h,d){if(a){h=$jscomp.global;c=c.split(".");for(d=0;d>>24]<<24^f[k>>16&255]<<16^f[k>>8&255]<<8^f[k&255],0===c%a&&(k=k<<8^k>>>24^l<<24,l=l<<1^283*(l>>7));h[c]=h[c-a]^k}for(a=0;c;a++,c--)k=h[a&3?c:c-4],d[a]=4>=c||4>a?k:m[0][f[k>>>24]]^m[1][f[k>>16&255]]^m[2][f[k>> -8&255]]^m[3][f[k&255]]};sjcl.cipher.aes.MODE_CBC=2;sjcl.cipher.aes.MODE_CTR=6; -sjcl.cipher.aes.prototype={encrypt:function(c,a,h){a=this.mode==sjcl.cipher.aes.MODE_CBC?a:[];for(var d=[],f=0;fl;l++)m[l]^=a[l];a=sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(m),0))}else for(a=sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(toByteArray(h.increment())),0)),l=0;16>l;l++)a[l]^=m[l];d=d.concat(a)}return d},decrypt:function(c,a){for(var h=[],d=0;dm;m++)ct[m]^=a[m];a=f}h=h.concat(ct)}return h},_tables:[[[],[],[],[],[]],[[],[],[],[],[]]],_precompute:function(){var c=this._tables[0],a=this._tables[1],h=c[4],d=a[4],f,m,l,k=[],e=[],g;for(f=0;256>f;f++)e[(k[f]=f<<1^283*(f>>7))^f]=f;for(m=l=0;!h[m];m^=g||1,l=e[l]||1){var b=l^l<<1^l<<2^l<<3^l<<4;b=b>>8^b&255^99;h[m]=b;d[b]=m;var n=k[f= -k[g=k[m]]];var p=16843009*n^65537*f^257*g^16843008*m;n=257*k[b]^16843008*b;for(f=0;4>f;f++)c[f][m]=n=n<<24^n>>>8,a[f][b]=p=p<<24^p>>>8}for(f=0;5>f;f++)c[f]=c[f].slice(0),a[f]=a[f].slice(0)},_crypt:function(c,a){if(4!==c.length)throw"invalid aes block size";var h=this._key[a],d=c[0]^h[0],f=c[a?3:1]^h[1],m=c[2]^h[2];c=c[a?1:3]^h[3];var l=h.length/4-2,k,e=4,g=[0,0,0,0];var b=this._tables[a];var n=b[0],p=b[1],q=b[2],r=b[3],t=b[4];for(k=0;k>>24]^p[f>>16&255]^q[m>>8&255]^r[c&255]^h[e];var y= -n[f>>>24]^p[m>>16&255]^q[c>>8&255]^r[d&255]^h[e+1];var v=n[m>>>24]^p[c>>16&255]^q[d>>8&255]^r[f&255]^h[e+2];c=n[c>>>24]^p[d>>16&255]^q[f>>8&255]^r[m&255]^h[e+3];e+=4;d=b;f=y;m=v}for(k=0;4>k;k++)g[a?3&-k:k]=t[d>>>24]<<24^t[f>>16&255]<<16^t[m>>8&255]<<8^t[c&255]^h[e++],b=d,d=f,f=m,m=c,c=b;return g}};sjcl.codec={}; -sjcl.codec.bytes={fromBits:function(c){var a=[],h=sjcl.bitArray.bitLength(c),d,f;for(d=0;d>>24),f<<=8;return a},toBits:function(c){var a=[],h,d=0;for(h=0;h>=15;0<=--g;){var u=this[c]&32767,n=this[c++]>>15,d=a*u+n*k;u=k*u+((d&32767)<<15)+b[e]+(l&1073741823);l=(u>>>30)+(d>>>15)+a*n+(l>>>30);b[e++]= -u&1073741823}return l}function f(c,a,b,e,l,k){var g=a&16383;for(a>>=14;0<=--k;){var u=this[c]&16383,n=this[c++]>>14,d=a*u+n*g;u=g*u+((d&16383)<<14)+b[e]+l;l=(u>>28)+(d>>14)+a*n;b[e++]=u&268435455}return l}function m(c,a){c=C[c.charCodeAt(a)];return null==c?-1:c}function l(c){var b=a();b.fromInt(c);return b}function k(c){var a=1,b;0!=(b=c>>>16)&&(c=b,a+=16);0!=(b=c>>8)&&(c=b,a+=8);0!=(b=c>>4)&&(c=b,a+=4);0!=(b=c>>2)&&(c=b,a+=2);0!=c>>1&&(a+=1);return a}function e(c){this.m=c}function g(c){this.m=c; -this.mp=c.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=z;++z)C[v++]=z;v=97;for(z=10;36>z;++z)C[v++]=z;v=65;for(z=10;36>z;++z)C[v++]=z;e.prototype.convert=function(c){return 0>c.s||0<=c.compareTo(this.m)?c.mod(this.m):c};e.prototype.revert=function(c){return c};e.prototype.reduce=function(c){c.divRemTo(this.m,null,c)};e.prototype.mulTo=function(c,a,b){c.multiplyTo(a,b);this.reduce(b)};e.prototype.sqrTo= -function(c,a){c.squareTo(a);this.reduce(a)};g.prototype.convert=function(b){var e=a();b.abs().dlShiftTo(this.m.t,e);e.divRemTo(this.m,null,e);0>b.s&&0>15)*this.mpl&this.um)<<15)&c.DM;b=a+this.m.t;for(c[b]+=this.m.am(0,e,c,a,0,this.m.t);c[b]>= -c.DV;)c[b]-=c.DV,c[++b]++}c.clamp();c.drShiftTo(this.m.t,c);0<=c.compareTo(this.m)&&c.subTo(this.m,c)};g.prototype.mulTo=function(c,a,b){c.multiplyTo(a,b);this.reduce(b)};g.prototype.sqrTo=function(c,a){c.squareTo(a);this.reduce(a)};c.prototype.copyTo=function(c){for(var a=this.t-1;0<=a;--a)c[a]=this[a];c.t=this.t;c.s=this.s};c.prototype.fromInt=function(c){this.t=1;this.s=0>c?-1:0;0c?this[0]=c+DV:this.t=0};c.prototype.fromString=function(a,b){if(16==b)b=4;else if(8==b)b=3;else if(256== -b)b=8;else if(2==b)b=1;else if(32==b)b=5;else if(4==b)b=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,l=!1,g=0;0<=--e;){var k=8==b?a[e]&255:m(a,e);0>k?"-"==a.charAt(e)&&(l=!0):(l=!1,0==g?this[this.t++]=k:g+b>this.DB?(this[this.t-1]|=(k&(1<>this.DB-g):this[this.t-1]|=k<=this.DB&&(g-=this.DB))}8==b&&0!=(a[0]&128)&&(this.s=-1,0>e|g,g=(this[k]&l)<=this.t)a.t=0;else{c%=this.DB;var e=this.DB-c,l=(1<>c;for(var g=b+1;g>c;0>=this.DB;if(c.t>=this.DB;e+=this.s}else{for(e+=this.s;b>=this.DB;e-=c.s}a.s=0>e?-1:0;-1>e?a[b++]=this.DV+e:0=a.DV&&(c[b+a.t]-=a.DV,c[b+a.t+1]=1)}0=l.t)){var n=this.abs();if(n.t>this.F2:0),h=this.FV/p;p=(1<< -this.F1)/p;var u=1<f&&c.ZERO.subTo(g,g)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0; -var c=this[0];if(0==(c&1))return 0;var a=c&3;a=a*(2-(c&15)*a)&15;a=a*(2-(c&255)*a)&255;a=a*(2-((c&65535)*a&65535))&65535;a=a*(2-c*a%this.DV)%this.DV;return 0b)return c.ONE;var g=a(),l=a(),n=e.convert(this),d=k(b)-1;for(n.copyTo(g);0<=--d;)if(e.sqrTo(g,l),0<(b&1<this.s)return"-"+ -this.negate().toString(c);if(16==c)c=4;else if(8==c)c=3;else if(2==c)c=1;else if(32==c)c=5;else if(4==c)c=2;else return this.toRadix(c);var a=(1<>k)&&(e=!0,g="0123456789abcdefghijklmnopqrstuvwxyz".charAt(b));0<=l;)k>(k+=this.DB-c)):(b=this[l]>>(k-=c)&a,0>=k&&(k+=this.DB,--l)),0this.s?this.negate():this};c.prototype.compareTo=function(c){var a=this.s-c.s;if(0!=a)return a;var b=this.t;a=b-c.t;if(0!=a)return a;for(;0<=--b;)if(0!=(a=this[b]-c[b]))return a;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+k(this[this.t-1]^this.s&this.DM)};c.prototype.mod=function(b){var e=a();this.abs().divRemTo(b,null,e);0>this.s&&0c||a.isEven()?new e(a):new g(a);return this.exp(c,a)};c.ZERO=l(0);c.ONE=l(1);r.prototype.convert=t;r.prototype.revert=t;r.prototype.mulTo=function(c,a,b){c.multiplyTo(a,b)};r.prototype.sqrTo=function(c,a){c.squareTo(a)};y.prototype.convert=function(c){if(0>c.s||c.t>2*this.m.t)return c.mod(this.m);if(0>c.compareTo(this.m))return c;var b=a();c.copyTo(b);this.reduce(b);return b};y.prototype.revert=function(c){return c};y.prototype.reduce=function(c){c.drShiftTo(this.m.t- -1,this.r2);c.t>this.m.t+1&&(c.t=this.m.t+1,c.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>c.compareTo(this.r2);)c.dAddOffset(1,this.m.t+1);for(c.subTo(this.r2,c);0<=c.compareTo(this.m);)c.subTo(this.m,c)};y.prototype.mulTo=function(c,a,b){c.multiplyTo(a,b);this.reduce(b)};y.prototype.sqrTo=function(c,a){c.squareTo(a);this.reduce(a)};var x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109, -113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],B=67108864/x[x.length-1];c.prototype.chunkSize=function(c){return Math.floor(Math.LN2*this.DB/Math.log(c))};c.prototype.toRadix=function(c){null==c&&(c=10);if(0==this.signum()||2>c||36f?"-"==a.charAt(d)&&0==this.signum()&&(l=!0):(n=b*n+f,++k>=e&&(this.dMultiply(g),this.dAddOffset(n,0),n=k=0))}0a)this.fromInt(1);else for(this.fromNumber(a,e),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),n,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{e=[];var g=a&7;e.length=(a>>3)+1;b.nextBytes(e);e[0]=0>=this.DB;if(c.t>=this.DB;e+=this.s}else{for(e+= -this.s;b>=this.DB;e+=c.s}a.s=0>e?-1:0;0e&&(a[b++]=this.DV+e);a.t=b;a.clamp()};c.prototype.dMultiply=function(c){this[this.t]=this.am(0,c-1,this,0,0,this.t);++this.t;this.clamp()};c.prototype.dAddOffset=function(c,a){if(0!=c){for(;this.t<=a;)this[this.t++]=0;for(this[a]+=c;this[a]>=this.DV;)this[a]-=this.DV,++a>=this.t&&(this[this.t++]=0),++this[a]}};c.prototype.multiplyLowerTo=function(c,a,b){var e=Math.min(this.t+c.t,a);b.s=0;for(b.t=e;0=c)return 0;var a=this.DV%c,b=0>this.s?c-1:0;if(0=g)return!1;var l=e.shiftRight(g);b=b+1>>1;b>x.length&&(b=x.length);for(var k=a(),n=0;nthis.s){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24};c.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};c.prototype.toByteArray=function(){var c=this.t,a=[];a[0]=this.s;var b=this.DB- -c*this.DB%8,e,g=0;if(0>b)!=(this.s&this.DM)>>b&&(a[g++]=e|this.s<b?(e=(this[c]&(1<>(b+=this.DB-8)):(e=this[c]>>(b-=8)&255,0>=b&&(b+=this.DB,--c)),0!=(e&128)&&(e|=-256),0==g&&(this.s&128)!=(e&128)&&++g,0this.compareTo(c)?this:c};c.prototype.max=function(c){return 0c?this.rShiftTo(-c,b):this.lShiftTo(c,b);return b};c.prototype.shiftRight=function(c){var b= -a();0>c?this.lShiftTo(-c,b):this.rShiftTo(c,b);return b};c.prototype.getLowestSetBit=function(){for(var c=0;c>=16,b+=16);0==(c&255)&&(c>>=8,b+=8);0==(c&15)&&(c>>=4,b+=4);0==(c&3)&&(c>>=2,b+=2);0==(c&1)&&++b;c=b}return a+c}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var c=0,b=this.s&this.DM,a=0;a=this.t?0!=this.s:0!=(this[a]&1<=n)return d;var f=18>n?1:48>n?3:144>n?4:768>n?5:6;b=8>n?new e(b):b.isEven()?new y(b):new g(b);var m=[],p=3,h=f-1,r=(1<=h?t=c[q]>>n-h&r:(t=(c[q]&(1<>this.DB+n-h));for(p=f;0==(t&1);)t>>=1,--p;0>(n-=p)&&(n+=this.DB,--q);if(v)m[t].copyTo(d),v=!1;else{for(;1--n&&(n=this.DB-1,--q)}return b.revert(d)};c.prototype.modInverse=function(b){var a=b.isEven();if(this.isEven()&&a||0==b.signum())return c.ZERO;for(var e= -b.clone(),g=this.clone(),k=l(1),n=l(0),d=l(0),f=l(1);0!=e.signum();){for(;e.isEven();)e.rShiftTo(1,e),a?(k.isEven()&&n.isEven()||(k.addTo(this,k),n.subTo(b,n)),k.rShiftTo(1,k)):n.isEven()||n.subTo(b,n),n.rShiftTo(1,n);for(;g.isEven();)g.rShiftTo(1,g),a?(d.isEven()&&f.isEven()||(d.addTo(this,d),f.subTo(b,f)),d.rShiftTo(1,d)):f.isEven()||f.subTo(b,f),f.rShiftTo(1,f);0<=e.compareTo(g)?(e.subTo(g,e),a&&k.subTo(d,k),n.subTo(f,n)):(g.subTo(e,g),a&&d.subTo(k,d),f.subTo(n,f))}if(0!=g.compareTo(c.ONE))return c.ZERO; -if(0<=f.compareTo(b))return f.subtract(b);if(0>f.signum())f.addTo(b,f);else return f;return 0>f.signum()?f.add(b):f};c.prototype.pow=function(c){return this.exp(c,new r)};c.prototype.gcd=function(c){var b=0>this.s?this.negate():this.clone();c=0>c.s?c.negate():c.clone();if(0>b.compareTo(c)){var a=b;b=c;c=a}a=b.getLowestSetBit();var e=c.getLowestSetBit();if(0>e)return b;a>5]|=128<<24-h%32;a[(h+64>>>9<<4)+15]=h;for(h=0;hq;q++){if(16>q)c[q]=a[h+q];else{var r=c[q-3]^c[q-8]^c[q-14]^c[q-16];c[q]=r<<1|r>>>31}r=(d<<5|d>>>27)+k+(c[q]>>>0)+(20>q?(f&m|~f&l)+1518500249:40>q?(f^m^l)+1859775393:60>q?(f&m|f&l|m&l)-1894007588:(f^m^l)-899497514); -k=l;l=m;m=f<<30|f>>>2;f=d;d=r}d+=e;f+=g;m+=b;l+=n;k+=p}return fromByteArray(wordsToBytes([d,f,m,l,k]))}};SSHyClient.hash.SHA256=function(c){this.data=c||"";this.digest_size=32}; -SSHyClient.hash.SHA256.prototype={digest:function(){var c=toByteArray(this.data),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, -2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],h=bytesToWords(c),d=8*c.length;c=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];var f=[],m,l;h[d>>5]|=128<<24-d%32;h[(d+64>>9<<4)+15]=d;for(m=0;ml;l++){if(16>l)f[l]=h[l+m];else{var r=f[l-15];var t=f[l-2];f[l]=((r<<25|r>>>7)^(r<<14|r>>>18)^r>>>3)+(f[l-7]>>>0)+((t<<15|t>>>17)^(t<<13|t>>>19)^t>>>10)+(f[l-16]>>>0)}t=d&k^d&e^k&e;var y=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22);r=(q>>>0)+((b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25))+(b&n^~b&p)+a[l]+(f[l]>>>0);t=y+t;q=p;p=n;n=b;b=g+r>>>0;g=e;e=k;k=d;d=r+t>>>0}c[0]+=d;c[1]+=k;c[2]+=e;c[3]+=g;c[4]+=b;c[5]+=n;c[6]+=p;c[7]+=q}return fromByteArray(wordsToBytes(c))}}; -SSHyClient.hash.HMAC=function(c,a,h){h=digestmod="SHA-1"==h?SSHyClient.hash.SHA1:SSHyClient.hash.SHA256;var d=new h,f=new h;64m;++m)h[m]^=92,c[m]^=54;d.data+=fromByteArray(h);f.data+=fromByteArray(c);f.data+=a;d.data+=f.digest();return d.digest()}; -SSHyClient.hash.MD5=function(c){var a=toByteArray(c);c=bytesToWords(a);var h=8*a.length;a=1732584193;for(var d=-271733879,f=-1732584194,m=271733878,l=0;l>>24)&16711935|(c[l]<<24|c[l]>>>8)&4278255360;c[h>>>5]|=128<>>9<<4)+14]=h;h=function(c,b,a,e,g,l,k){c=c+(b&a|~b&e)+(g>>>0)+k;return(c<>>32-l)+b};var k=function(c,b,a,e,g,l,k){c=c+(b&e|a&~e)+(g>>>0)+k;return(c<>>32-l)+b},e=function(c,b,a,e,g,l,k){c=c+(b^a^e)+(g>>>0)+k;return(c<>>32-l)+b}, -g=function(c,b,a,e,g,l,k){c=c+(a^(b|~e))+(g>>>0)+k;return(c<>>32-l)+b};for(l=0;l>>0;d=d+n>>>0;f=f+p>>>0;m=m+q>>>0}var r=function(c){if(c.constructor==Number)return(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;for(var b=0;bf;f+=2){var l=c>>f&3;switch(l){case 0:case 1:0>>24&255), -h+=String.fromCharCode(a>>>16&255),h+=String.fromCharCode(a>>>8&255);case "B":h+=String.fromCharCode(a&255)}return h},unpack:function(c,a){var h=[],d=0,f=0;switch(c){case "Q":f=new BigInteger("0",10);f=f.add((new BigInteger(a.charCodeAt(0).toString(),10)).shiftLeft(56));f=f.add((new BigInteger(a.charCodeAt(1).toString(),10)).shiftLeft(48));f=f.add((new BigInteger(a.charCodeAt(2).toString(),10)).shiftLeft(40));f=f.add((new BigInteger(a.charCodeAt(3).toString(),10)).shiftLeft(32));f=f.add((new BigInteger(a.charCodeAt(4).toString(), -10)).shiftLeft(24));f=f.add((new BigInteger(a.charCodeAt(5).toString(),10)).shiftLeft(16));f=f.add((new BigInteger(a.charCodeAt(6).toString(),10)).shiftLeft(8));f=f.add((new BigInteger(a.charCodeAt(7).toString(),10)).shiftLeft(0));h.push(f);break;case "I":f+=a.charCodeAt(0)<<24>>>0,f+=a.charCodeAt(1)<<16>>>0,f+=a.charCodeAt(2)<<8>>>0,d+=3;case "B":f+=a.charCodeAt(0+d)<<0>>>0,h.push(f)}return h}};function inflate_long(c){var a=new BigInteger("0",10);c.length%4&&(c=Array(4-c.length%4+1).join("\x00")+c);for(var h=0;hh.charCodeAt(0)&&(h="\u00ff"+h));return h}function toByteArray(c){for(var a=new Uint8Array(c.length),h=0;h>>5]|=(c[h]&255)<<24-d%32;return a}function wordsToBytes(c){for(var a=[],h=0;h<32*c.length;h+=8)a.push(c[h>>>5]>>>24-h%32&255);return a} -function setCharAt(c,a,h){return c.substring(0,a)+h+c.substring(a+1)}function fromUtf8(c){for(var a="",h=toByteArray(c),d=0;d=f){var m=h[++d];f=(f&31)<<6|m&63}else if(224<=f&&239>=f){m=h[++d];var l=h[++d];f=(f&15)<<12|(m&63)<<6|l&63}else 128<=f&&(f=".");a+=String.fromCharCode(f)}return a}function read_rng(c){return String.fromCharCode.apply(null,window.crypto.getRandomValues(new Uint8Array(c)))} -function filter(c,a){c=c.split(",");for(var h=0;ha?0:255;a=0>a?-1*a:a;var d=h>>16,f=h>>8&255;h&=255;return"#"+(16777216+65536*(Math.round((c-d)*a)+d)+256*(Math.round((c-f)*a)+f)+(Math.round((c-h)*a)+h)).toString(16).slice(1)} -function ascii2hex(c){for(var a="",h=0;hthis._terminal.rows},enumerable:!0,configurable:!0});Object.defineProperty(a.prototype,"isCursorInViewport",{get:function(){var a=this.ybase+this.y-this.ydisp;return 0<=a&&ad.MAX_BUFFER_SIZE?d.MAX_BUFFER_SIZE:a};a.prototype.fillViewportRows=function(){if(0===this._lines.length)for(var a=this._terminal.rows;a--;)this.lines.push(this._terminal.blankLine())};a.prototype.clear=function(){this.x=this.y=this.ybase=this.ydisp=0;this._lines=new f.CircularList(this._getCorrectBufferLength(this._terminal.rows));this.scrollTop=0;this.scrollBottom=this._terminal.rows-1;this.setupTabStops()};a.prototype.resize=function(a,k){var e=this._getCorrectBufferLength(k); -e>this._lines.maxLength&&(this._lines.maxLength=e);if(0k;b--)this._lines.length>k+this.ybase&&(this._lines.length>this.ybase+this.y+1?this._lines.pop():(this.ybase++,this.ydisp++));e=m&&a--,g>=m&&f--):1m&&(a+=h[d.CHAR_DATA_CHAR_INDEX].length-1),g>m&&(f+=h[d.CHAR_DATA_CHAR_INDEX].length-1))}return k&&(k=b.search(/\s+$/),-1!==k&&(f=Math.min(f,k)),f<=a)?"":b.substring(a, -f)};a.prototype.setupTabStops=function(a){null!=a?this.tabs[a]||(a=this.prevStop(a)):(this.tabs={},a=0);for(;a=this._terminal.cols?this._terminal.cols-1:0>a?0:a};a.prototype.nextStop=function(a){null==a&&(a=this.x);for(;!this.tabs[++a]&&a=this._terminal.cols?this._terminal.cols-1:0>a?0:a};return a}(); -d.Buffer=a},{"./utils/CircularList":32}],2:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,e){a.__proto__=e}||function(a,e){for(var g in e)e.hasOwnProperty(g)&&(a[g]=e[g])};return function(k,e){function g(){this.constructor=k}a(k,e);k.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./Buffer");a=function(a){function k(e){var g=a.call(this)|| -this;g._terminal=e;g._normal=new m.Buffer(g._terminal,!0);g._normal.fillViewportRows();g._alt=new m.Buffer(g._terminal,!1);g._activeBuffer=g._normal;g.setupTabStops();return g}f(k,a);Object.defineProperty(k.prototype,"alt",{get:function(){return this._alt},enumerable:!0,configurable:!0});Object.defineProperty(k.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!0,configurable:!0});Object.defineProperty(k.prototype,"normal",{get:function(){return this._normal},enumerable:!0, -configurable:!0});k.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._alt.clear(),this._activeBuffer=this._normal,this.emit("activate",{activeBuffer:this._normal,inactiveBuffer:this._alt}))};k.prototype.activateAltBuffer=function(){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(),this._activeBuffer=this._alt,this.emit("activate",{activeBuffer:this._alt,inactiveBuffer:this._normal}))};k.prototype.resize=function(a,g){this._normal.resize(a,g);this._alt.resize(a, -g)};k.prototype.setupTabStops=function(a){this._normal.setupTabStops(a);this._alt.setupTabStops(a)};return k}(a("./EventEmitter").EventEmitter);d.BufferSet=a},{"./Buffer":1,"./EventEmitter":7}],3:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});d.wcwidth=function(a){function d(a,e){var b=0,g=e.length-1;if(ae[g][1])return!1;for(;g>=b;){var k=b+g>>1;if(a>e[k][1])b=k+1;else if(ab)return e|0;if(127>b)return 1;var n;if(!(n=g)){g="undefined"===typeof Uint32Array?Array(4096):new Uint32Array(4096);for(n=0;4096>n;++n){for(var f=0,m=16;m--;){f<<=2;var h=16*n+m;h=0===h?a.nul:32>h||127<=h&&160>h?a.control:d(h,l)?0:4352<=h&&(4447>= -h||9001===h||9002===h||11904<=h&&42191>=h&&12351!==h||44032<=h&&55203>=h||63744<=h&&64255>=h||65040<=h&&65049>=h||65072<=h&&65135>=h||65280<=h&&65376>=h||65504<=h&&65510>=h)?2:1;f|=h}g[n]=f}n=g}if(65536>b)return n[b>>4]>>((b&15)<<1)&3;b=d(b,k)?0:131072<=b&&196605>=b||196608<=b&&262141>=b?2:1;return b}}({nul:0,control:0})},{}],4:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});d.CHARSETS={};d.DEFAULT_CHARSET=d.CHARSETS.B;d.CHARSETS["0"]={"`":"\u25c6",a:"\u2592",b:"\t",c:"\f",d:"\r", -e:"\n",f:"\u00b0",g:"\u00b1",h:"\u2424",i:"\x0B",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","}":"\u00a3","~":"\u00b7"};d.CHARSETS.A={"#":"\u00a3"};d.CHARSETS.B=null;d.CHARSETS["4"]={"#":"\u00a3","@":"\u00be","[":"ij","\\":"\u00bd","]":"|","{":"\u00a8","|":"f","}":"\u00bc","~":"\u00b4"};d.CHARSETS.C=d.CHARSETS["5"]={"[":"\u00c4","\\":"\u00d6", -"]":"\u00c5","^":"\u00dc","`":"\u00e9","{":"\u00e4","|":"\u00f6","}":"\u00e5","~":"\u00fc"};d.CHARSETS.R={"#":"\u00a3","@":"\u00e0","[":"\u00b0","\\":"\u00e7","]":"\u00a7","{":"\u00e9","|":"\u00f9","}":"\u00e8","~":"\u00a8"};d.CHARSETS.Q={"@":"\u00e0","[":"\u00e2","\\":"\u00e7","]":"\u00ea","^":"\u00ee","`":"\u00f4","{":"\u00e9","|":"\u00f9","}":"\u00e8","~":"\u00fb"};d.CHARSETS.K={"@":"\u00a7","[":"\u00c4","\\":"\u00d6","]":"\u00dc","{":"\u00e4","|":"\u00f6","}":"\u00fc","~":"\u00df"};d.CHARSETS.Y= -{"#":"\u00a3","@":"\u00a7","[":"\u00b0","\\":"\u00e7","]":"\u00e9","`":"\u00f9","{":"\u00e0","|":"\u00f2","}":"\u00e8","~":"\u00ec"};d.CHARSETS.E=d.CHARSETS["6"]={"@":"\u00c4","[":"\u00c6","\\":"\u00d8","]":"\u00c5","^":"\u00dc","`":"\u00e4","{":"\u00e6","|":"\u00f8","}":"\u00e5","~":"\u00fc"};d.CHARSETS.Z={"#":"\u00a3","@":"\u00a7","[":"\u00a1","\\":"\u00d1","]":"\u00bf","{":"\u00b0","|":"\u00f1","}":"\u00e7"};d.CHARSETS.H=d.CHARSETS["7"]={"@":"\u00c9","[":"\u00c4","\\":"\u00d6","]":"\u00c5","^":"\u00dc", -"`":"\u00e9","{":"\u00e4","|":"\u00f6","}":"\u00e5","~":"\u00fc"};d.CHARSETS["="]={"#":"\u00f9","@":"\u00e0","[":"\u00e9","\\":"\u00e7","]":"\u00ea","^":"\u00ee",_:"\u00e8","`":"\u00f4","{":"\u00e4","|":"\u00f6","}":"\u00fc","~":"\u00fb"}},{}],5:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=function(){function a(a,l,k){this.textarea=a;this.compositionView=l;this.terminal=k;this.isSendingComposition=this.isComposing=!1;this.compositionPosition={start:null,end:null}}a.prototype.compositionstart= -function(){this.isComposing=!0;this.compositionPosition.start=this.textarea.value.length;this.compositionView.textContent="";this.compositionView.classList.add("active")};a.prototype.compositionupdate=function(a){var l=this;this.compositionView.textContent=a.data;this.updateCompositionElements();setTimeout(function(){l.compositionPosition.end=l.textarea.value.length},0)};a.prototype.compositionend=function(){this.finalizeComposition(!0)};a.prototype.keydown=function(a){if(this.isComposing||this.isSendingComposition){if(229=== -a.keyCode||16===a.keyCode||17===a.keyCode||18===a.keyCode)return!1;this.finalizeComposition(!1)}return 229===a.keyCode?(this.handleAnyTextareaChanges(),!1):!0};a.prototype.finalizeComposition=function(a){var l=this;this.compositionView.classList.remove("active");this.isComposing=!1;this.clearTextareaPosition();if(a){var k=this.compositionPosition.start,e=this.compositionPosition.end;this.isSendingComposition=!0;setTimeout(function(){if(l.isSendingComposition){l.isSendingComposition=!1;var a=l.isComposing? -l.textarea.value.substring(k,e):l.textarea.value.substring(k);l.terminal.handler(a)}},0)}else this.isSendingComposition=!1,a=this.textarea.value.substring(this.compositionPosition.start,this.compositionPosition.end),this.terminal.handler(a)};a.prototype.handleAnyTextareaChanges=function(){var a=this,l=this.textarea.value;setTimeout(function(){if(!a.isComposing){var k=a.textarea.value.replace(l,"");0=this._terminal.cols)if(this._terminal.wraparoundMode)this._terminal.buffer.x=0,this._terminal.buffer.y++,this._terminal.buffer.y>this._terminal.buffer.scrollBottom?(this._terminal.buffer.y--,this._terminal.scroll(!0)):this._terminal.buffer.lines.get(this._terminal.buffer.y).isWrapped=!0;else if(2=== -g)return;b=this._terminal.buffer.y+this._terminal.buffer.ybase;if(this._terminal.insertMode)for(var k=0;kthis._terminal.buffer.scrollBottom&&(this._terminal.buffer.y--,this._terminal.scroll());this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--;this._terminal.emit("linefeed")};a.prototype.carriageReturn=function(){this._terminal.buffer.x=0};a.prototype.backspace=function(){0a&&(a=1);for(var b=this._terminal.buffer.y+this._terminal.buffer.ybase,e=this._terminal.buffer.x,g=[this._terminal.eraseAttr()," ",1,32];a--&&ea&&(a=1);this._terminal.buffer.y-=a;0>this._terminal.buffer.y&&(this._terminal.buffer.y=0)};a.prototype.cursorDown= -function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y+=a;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1);this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--};a.prototype.cursorForward=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x+=a;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.cursorBackward=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x>=this._terminal.cols&& -this._terminal.buffer.x--;this._terminal.buffer.x-=a;0>this._terminal.buffer.x&&(this._terminal.buffer.x=0)};a.prototype.cursorNextLine=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y+=a;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1);this._terminal.buffer.x=0};a.prototype.cursorPrecedingLine=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y-=a;0>this._terminal.buffer.y&&(this._terminal.buffer.y=0);this._terminal.buffer.x=0};a.prototype.cursorCharAbsolute= -function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x=a-1};a.prototype.cursorPosition=function(a){var b=a[0]-1;a=2<=a.length?a[1]-1:0;0>b?b=0:b>=this._terminal.rows&&(b=this._terminal.rows-1);0>a?a=0:a>=this._terminal.cols&&(a=this._terminal.cols-1);this._terminal.buffer.x=a;this._terminal.buffer.y=b};a.prototype.cursorForwardTab=function(a){for(a=a[0]||1;a--;)this._terminal.buffer.x=this._terminal.buffer.nextStop()};a.prototype.eraseInDisplay=function(a){switch(a[0]){case 0:this._terminal.eraseRight(this._terminal.buffer.x, -this._terminal.buffer.y);for(a=this._terminal.buffer.y+1;aa&&(a=1);for(var b=this._terminal.buffer.y+this._terminal.buffer.ybase, -e=this._terminal.rows-1+this._terminal.buffer.ybase-(this._terminal.rows-1-this._terminal.buffer.scrollBottom)+1;a--;)this._terminal.buffer.lines.splice(e-1,1),this._terminal.buffer.lines.splice(b,0,this._terminal.blankLine(!0));this._terminal.updateRange(this._terminal.buffer.y);this._terminal.updateRange(this._terminal.buffer.scrollBottom)};a.prototype.deleteLines=function(a){a=a[0];1>a&&(a=1);var b=this._terminal.buffer.y+this._terminal.buffer.ybase;var e=this._terminal.rows-1-this._terminal.buffer.scrollBottom; -for(e=this._terminal.rows-1+this._terminal.buffer.ybase-e;a--;)this._terminal.buffer.lines.splice(b,1),this._terminal.buffer.lines.splice(e,0,this._terminal.blankLine(!0));this._terminal.updateRange(this._terminal.buffer.y);this._terminal.updateRange(this._terminal.buffer.scrollBottom)};a.prototype.deleteChars=function(a){a=a[0];1>a&&(a=1);for(var b=this._terminal.buffer.y+this._terminal.buffer.ybase,e=[this._terminal.eraseAttr()," ",1,32];a--;)this._terminal.buffer.lines.get(b).splice(this._terminal.buffer.x, -1),this._terminal.buffer.lines.get(b).push(e);this._terminal.updateRange(this._terminal.buffer.y)};a.prototype.scrollUp=function(a){for(a=a[0]||1;a--;)this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollTop,1),this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollBottom,0,this._terminal.blankLine());this._terminal.updateRange(this._terminal.buffer.scrollTop);this._terminal.updateRange(this._terminal.buffer.scrollBottom)}; -a.prototype.scrollDown=function(a){for(a=a[0]||1;a--;)this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollBottom,1),this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollTop,0,this._terminal.blankLine());this._terminal.updateRange(this._terminal.buffer.scrollTop);this._terminal.updateRange(this._terminal.buffer.scrollBottom)};a.prototype.eraseChars=function(a){a=a[0];1>a&&(a=1);for(var b=this._terminal.buffer.y+this._terminal.buffer.ybase, -e=this._terminal.buffer.x,g=[this._terminal.eraseAttr()," ",1,32];a--&&ea&&(a=1);this._terminal.buffer.x=a-1;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.HPositionRelative=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.x+= -a;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.repeatPrecedingCharacter=function(a){a=a[0]||1;for(var b=this._terminal.buffer.lines.get(this._terminal.buffer.ybase+this._terminal.buffer.y),e=b[this._terminal.buffer.x-1]||[this._terminal.defAttr," ",1,32];a--;)b[this._terminal.buffer.x++]=e};a.prototype.sendDeviceAttributes=function(a){0"===this._terminal.prefix&&(this._terminal.is("xterm")?this._terminal.send(f.C0.ESC+ -"[>0;276;0c"):this._terminal.is("rxvt-unicode")?this._terminal.send(f.C0.ESC+"[>85;95;0c"):this._terminal.is("linux")?this._terminal.send(a[0]+"c"):this._terminal.is("screen")&&this._terminal.send(f.C0.ESC+"[>83;40003;0c")):this._terminal.is("xterm")||this._terminal.is("rxvt-unicode")||this._terminal.is("screen")?this._terminal.send(f.C0.ESC+"[?1;2c"):this._terminal.is("linux")&&this._terminal.send(f.C0.ESC+"[?6c"))};a.prototype.linePosAbsolute=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y= -a-1;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1)};a.prototype.VPositionRelative=function(a){a=a[0];1>a&&(a=1);this._terminal.buffer.y+=a;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1);this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--};a.prototype.HVPosition=function(a){1>a[0]&&(a[0]=1);1>a[1]&&(a[1]=1);this._terminal.buffer.y=a[0]-1;this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y= -this._terminal.rows-1);this._terminal.buffer.x=a[1]-1;this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)};a.prototype.tabClear=function(a){a=a[0];0>=a?delete this._terminal.buffer.tabs[this._terminal.buffer.x]:3===a&&(this._terminal.buffer.tabs={})};a.prototype.setMode=function(a){if(1>18,g=this._terminal.curAttr>>9&511,l=this._terminal.curAttr&511,d,f=0;f=d?g=d-30:40<=d&&47>=d?l=d-40:90<=d&&97>=d?(d+=8,g=d-90):100<=d&&107>=d?(d+=8,l=d-100):0===d?(e=this._terminal.defAttr>> -18,g=this._terminal.defAttr>>9&511,l=this._terminal.defAttr&511):1===d?e|=k.FLAGS.BOLD:4===d?e|=k.FLAGS.UNDERLINE:5===d?e|=k.FLAGS.BLINK:7===d?e|=k.FLAGS.INVERSE:8===d?e|=k.FLAGS.INVISIBLE:2===d?e|=k.FLAGS.DIM:22===d?(e&=~k.FLAGS.BOLD,e&=~k.FLAGS.DIM):24===d?e&=~k.FLAGS.UNDERLINE:25===d?e&=~k.FLAGS.BLINK:27===d?e&=~k.FLAGS.INVERSE:28===d?e&=~k.FLAGS.INVISIBLE:39===d?g=this._terminal.defAttr>>9&511:49===d?l=this._terminal.defAttr&511:38===d?2===a[f+1]?(f+=2,g=this._terminal.matchColor(a[f]&255,a[f+ -1]&255,a[f+2]&255),-1===g&&(g=511),f+=2):5===a[f+1]&&(f+=2,g=d=a[f]&255):48===d?2===a[f+1]?(f+=2,l=this._terminal.matchColor(a[f]&255,a[f+1]&255,a[f+2]&255),-1===l&&(l=511),f+=2):5===a[f+1]&&(f+=2,l=d=a[f]&255):100===d?(g=this._terminal.defAttr>>9&511,l=this._terminal.defAttr&511):this._terminal.error("Unknown SGR attribute: %d.",d);this._terminal.curAttr=e<<18|g<<9|l}};a.prototype.deviceStatus=function(a){if(!this._terminal.prefix)switch(a[0]){case 5:this._terminal.send(f.C0.ESC+"[0n");break;case 6:this._terminal.send(f.C0.ESC+ -"["+(this._terminal.buffer.y+1)+";"+(this._terminal.buffer.x+1)+"R")}else if("?"===this._terminal.prefix)switch(a[0]){case 6:this._terminal.send(f.C0.ESC+"[?"+(this._terminal.buffer.y+1)+";"+(this._terminal.buffer.x+1)+"R")}};a.prototype.softReset=function(a){this._terminal.cursorHidden=!1;this._terminal.insertMode=!1;this._terminal.originMode=!1;this._terminal.wraparoundMode=!0;this._terminal.applicationKeypad=!1;this._terminal.viewport.syncScrollArea();this._terminal.applicationCursor=!1;this._terminal.buffer.scrollTop= -0;this._terminal.buffer.scrollBottom=this._terminal.rows-1;this._terminal.curAttr=this._terminal.defAttr;this._terminal.buffer.x=this._terminal.buffer.y=0;this._terminal.charset=null;this._terminal.glevel=0;this._terminal.charsets=[null]};a.prototype.setCursorStyle=function(a){a=1>a[0]?1:a[0];switch(a){case 1:case 2:this._terminal.setOption("cursorStyle","block");break;case 3:case 4:this._terminal.setOption("cursorStyle","underline");break;case 5:case 6:this._terminal.setOption("cursorStyle","bar")}this._terminal.setOption("cursorBlink", -1===a%2)};a.prototype.setScrollRegion=function(a){this._terminal.prefix||(this._terminal.buffer.scrollTop=(a[0]||1)-1,this._terminal.buffer.scrollBottom=(a[1]&&a[1]<=this._terminal.rows?a[1]:this._terminal.rows)-1,this._terminal.buffer.x=0,this._terminal.buffer.y=0)};a.prototype.saveCursor=function(a){this._terminal.buffer.savedX=this._terminal.buffer.x;this._terminal.buffer.savedY=this._terminal.buffer.y};a.prototype.restoreCursor=function(a){this._terminal.buffer.x=this._terminal.buffer.savedX|| -0;this._terminal.buffer.y=this._terminal.buffer.savedY||0};return a}();d.InputHandler=a},{"./Buffer":1,"./CharWidth":3,"./Charsets":4,"./EscapeSequences":6,"./renderer/Types":28}],9:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var e in b)b.hasOwnProperty(e)&&(a[e]=b[e])};return function(e,b){function g(){this.constructor=e}a(e,b);e.prototype=null===b?Object.create(b):(g.prototype= -b.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./Types"),l=a("./input/MouseZoneManager"),k=/(?:^|[^\da-z\.-]+)((https?:\/\/)((([\da-z\.-]+)\.([a-z\.]{2,6}))|((\d{1,3}\.){3}\d{1,3})|(localhost))(:\d{1,5})?(\/[\/\w\.\-%~]*)*(\?[0-9\w\[\]\(\)\/\?\!#@$%&'*+,:;~\=\.\-]*)?(#[0-9\w\[\]\(\)\/\?\!#@$%&'*+,:;~\=\.\-]*)?)($|[^\/\w\.\-%]+)/;a=function(a){function e(b){var e=a.call(this)||this;e._terminal=b;e._linkMatchers=[];e._nextLinkMatcherId=0;e._rowsToLinkify={start:null, -end:null};e.registerLinkMatcher(k,null,{matchIndex:1});return e}f(e,a);e.prototype.attachToDom=function(a){this._mouseZoneManager=a};e.prototype.linkifyRows=function(a,g){var b=this;this._mouseZoneManager&&(null===this._rowsToLinkify.start?(this._rowsToLinkify.start=a,this._rowsToLinkify.end=g):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,a),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,g)),this._mouseZoneManager.clearAll(a,g),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId), -this._rowsTimeoutId=setTimeout(function(){return b._linkifyRows()},e.TIME_BEFORE_LINKIFY))};e.prototype._linkifyRows=function(){this._rowsTimeoutId=null;for(var a=this._rowsToLinkify.start;a<=this._rowsToLinkify.end;a++)this._linkifyRow(a);this._rowsToLinkify.start=null;this._rowsToLinkify.end=null};e.prototype.setHypertextLinkHandler=function(a){this._linkMatchers[0].handler=a};e.prototype.setHypertextValidationCallback=function(a){this._linkMatchers[0].validationCallback=a};e.prototype.registerLinkMatcher= -function(a,e,g){void 0===g&&(g={});if(0!==this._nextLinkMatcherId&&!e)throw Error("handler must be defined");a={id:this._nextLinkMatcherId++,regex:a,handler:e,matchIndex:g.matchIndex,validationCallback:g.validationCallback,hoverTooltipCallback:g.tooltipCallback,hoverLeaveCallback:g.leaveCallback,willLinkActivate:g.willLinkActivate,priority:g.priority||0};this._addLinkMatcherToList(a);return a.id};e.prototype._addLinkMatcherToList=function(a){if(0===this._linkMatchers.length)this._linkMatchers.push(a); -else{for(var b=this._linkMatchers.length-1;0<=b;b--)if(a.priority<=this._linkMatchers[b].priority){this._linkMatchers.splice(b+1,0,a);return}this._linkMatchers.splice(0,0,a)}};e.prototype.deregisterLinkMatcher=function(a){for(var b=1;b=this._terminal.buffer.lines.length)){b=this._terminal.buffer.translateBufferLineToString(b, -!1);for(var e=0;e":function(a){return a.setPrefix(">")}, -"!":function(a){return a.setPrefix("!")},0:function(a){return a.setParam(10*a.getParam())},1:function(a){return a.setParam(10*a.getParam()+1)},2:function(a){return a.setParam(10*a.getParam()+2)},3:function(a){return a.setParam(10*a.getParam()+3)},4:function(a){return a.setParam(10*a.getParam()+4)},5:function(a){return a.setParam(10*a.getParam()+5)},6:function(a){return a.setParam(10*a.getParam()+6)},7:function(a){return a.setParam(10*a.getParam()+7)},8:function(a){return a.setParam(10*a.getParam()+ -8)},9:function(a){return a.setParam(10*a.getParam()+9)},$:function(a){return a.setPostfix("$")},'"':function(a){return a.setPostfix('"')}," ":function(a){return a.setPostfix(" ")},"'":function(a){return a.setPostfix("'")},";":function(a){return a.finalizeParam()}};e[f.C0.CAN]=function(a){return a.setState(b.NORMAL)};var g={"@":function(a,b,e){return a.insertChars(b)},A:function(a,b,e){return a.cursorUp(b)},B:function(a,b,e){return a.cursorDown(b)},C:function(a,b,e){return a.cursorForward(b)},D:function(a, -b,e){return a.cursorBackward(b)},E:function(a,b,e){return a.cursorNextLine(b)},F:function(a,b,e){return a.cursorPrecedingLine(b)},G:function(a,b,e){return a.cursorCharAbsolute(b)},H:function(a,b,e){return a.cursorPosition(b)},I:function(a,b,e){return a.cursorForwardTab(b)},J:function(a,b,e){return a.eraseInDisplay(b)},K:function(a,b,e){return a.eraseInLine(b)},L:function(a,b,e){return a.insertLines(b)},M:function(a,b,e){return a.deleteLines(b)},P:function(a,b,e){return a.deleteChars(b)},S:function(a, -b,e){return a.scrollUp(b)},T:function(a,b,e){2>b.length&&!e&&a.scrollDown(b)},X:function(a,b,e){return a.eraseChars(b)},Z:function(a,b,e){return a.cursorBackwardTab(b)},"`":function(a,b,e){return a.charPosAbsolute(b)},a:function(a,b,e){return a.HPositionRelative(b)},b:function(a,b,e){return a.repeatPrecedingCharacter(b)},c:function(a,b,e){return a.sendDeviceAttributes(b)},d:function(a,b,e){return a.linePosAbsolute(b)},e:function(a,b,e){return a.VPositionRelative(b)},f:function(a,b,e){return a.HVPosition(b)}, -g:function(a,b,e){return a.tabClear(b)},h:function(a,b,e){return a.setMode(b)},l:function(a,b,e){return a.resetMode(b)},m:function(a,b,e){return a.charAttributes(b)},n:function(a,b,e){return a.deviceStatus(b)},p:function(a,b,e){switch(e){case "!":a.softReset(b)}},q:function(a,b,e,g){" "===g&&a.setCursorStyle(b)},r:function(a,b){return a.setScrollRegion(b)},s:function(a,b){return a.saveCursor(b)},u:function(a,b){return a.restoreCursor(b)}};g[f.C0.CAN]=function(a,e,g,k,d){return d.setState(b.NORMAL)}; -var b;(function(a){a[a.NORMAL=0]="NORMAL";a[a.ESCAPED=1]="ESCAPED";a[a.CSI_PARAM=2]="CSI_PARAM";a[a.CSI=3]="CSI";a[a.OSC=4]="OSC";a[a.CHARSET=5]="CHARSET";a[a.DCS=6]="DCS";a[a.IGNORE=7]="IGNORE"})(b=d.ParserState||(d.ParserState={}));a=function(){function a(a,e){this._inputHandler=a;this._terminal=e;this._state=b.NORMAL}a.prototype.parse=function(a){var d=a.length,h=this._terminal.buffer.x,n=this._terminal.buffer.y;this._terminal.debug&&this._terminal.log("data: "+a);this._position=0;this._terminal.surrogate_high&& -(a=this._terminal.surrogate_high+a,this._terminal.surrogate_high="");for(;this._position=v){var C=a.charCodeAt(this._position+1);if(isNaN(C)){this._terminal.surrogate_high=p;continue}v=1024*(v-55296)+(C-56320)+65536;p+=a.charAt(this._position+1)}if(!(56320<=v&&57343>=v))switch(this._state){case b.NORMAL:if(p in l)l[p](this,this._inputHandler);else this._inputHandler.addChar(p,v);break;case b.ESCAPED:if(p in -k){k[p](this,this._terminal);break}switch(p){case "(":case ")":case "*":case "+":case "-":case ".":switch(p){case "(":this._terminal.gcharset=0;break;case ")":this._terminal.gcharset=1;break;case "*":this._terminal.gcharset=2;break;case "+":this._terminal.gcharset=3;break;case "-":this._terminal.gcharset=1;break;case ".":this._terminal.gcharset=2}this._state=b.CHARSET;break;case "/":this._terminal.gcharset=3;this._state=b.CHARSET;this._position--;break;case "N":this._state=b.NORMAL;break;case "O":this._state= -b.NORMAL;break;case "n":this._terminal.setgLevel(2);this._state=b.NORMAL;break;case "o":this._terminal.setgLevel(3);this._state=b.NORMAL;break;case "|":this._terminal.setgLevel(3);this._state=b.NORMAL;break;case "}":this._terminal.setgLevel(2);this._state=b.NORMAL;break;case "~":this._terminal.setgLevel(1);this._state=b.NORMAL;break;case "7":this._inputHandler.saveCursor();this._state=b.NORMAL;break;case "8":this._inputHandler.restoreCursor();this._state=b.NORMAL;break;case "#":this._state=b.NORMAL; -this._position++;break;case "H":this._terminal.tabSet();this._state=b.NORMAL;break;case "=":this._terminal.log("Serial port requested application keypad.");this._terminal.applicationKeypad=!0;this._terminal.viewport&&this._terminal.viewport.syncScrollArea();this._state=b.NORMAL;break;case ">":this._terminal.log("Switching back to normal keypad.");this._terminal.applicationKeypad=!1;this._terminal.viewport&&this._terminal.viewport.syncScrollArea();this._state=b.NORMAL;break;default:this._state=b.NORMAL, -this._terminal.error("Unknown ESC control: %s.",p)}break;case b.CHARSET:p in m.CHARSETS?(v=m.CHARSETS[p],"/"===p&&this.skipNextChar()):v=m.DEFAULT_CHARSET;this._terminal.setgCharset(this._terminal.gcharset,v);this._terminal.gcharset=null;this._state=b.NORMAL;break;case b.OSC:if(p===f.C0.ESC||p===f.C0.BEL){p===f.C0.ESC&&this._position++;this._terminal.params.push(this._terminal.currentParam);switch(this._terminal.params[0]){case 0:case 1:case 2:this._terminal.params[1]&&(this._terminal.title=this._terminal.params[1], -this._terminal.handleTitle(this._terminal.title))}this._terminal.params=[];this._terminal.currentParam=0;this._state=b.NORMAL}else this._terminal.params.length?this._terminal.currentParam+=p:"0"<=p&&"9">=p?this._terminal.currentParam=10*this._terminal.currentParam+p.charCodeAt(0)-48:";"===p&&(this._terminal.params.push(this._terminal.currentParam),this._terminal.currentParam="");break;case b.CSI_PARAM:if(p in e){e[p](this);break}this.finalizeParam();this._state=b.CSI;case b.CSI:p in g?(this._terminal.debug&& -this._terminal.log("CSI "+(this._terminal.prefix?this._terminal.prefix:"")+" "+(this._terminal.params?this._terminal.params.join(";"):"")+" "+(this._terminal.postfix?this._terminal.postfix:"")+" "+p),g[p](this._inputHandler,this._terminal.params,this._terminal.prefix,this._terminal.postfix,this)):this._terminal.error("Unknown CSI code: %s.",p);this._state=b.NORMAL;this._terminal.prefix="";this._terminal.postfix="";break;case b.DCS:if(p===f.C0.ESC||p===f.C0.BEL){p===f.C0.ESC&&this._position++;switch(this._terminal.prefix){case "":break; -case "$q":p=this._terminal.currentParam;v=!1;switch(p){case '"q':p='0"q';break;case '"p':p='61"p';break;case "r":p=""+(this._terminal.buffer.scrollTop+1)+";"+(this._terminal.buffer.scrollBottom+1)+"r";break;case "m":p="0m";break;default:this._terminal.error("Unknown DCS Pt: %s.",p),p=""}this._terminal.send(f.C0.ESC+"P"+ +v+"$r"+p+f.C0.ESC+"\\");break;case "+p":break;case "+q":p=this._terminal.currentParam;v=!1;this._terminal.send(f.C0.ESC+"P"+ +v+"+r"+p+f.C0.ESC+"\\");break;default:this._terminal.error("Unknown DCS prefix: %s.", -this._terminal.prefix)}this._terminal.currentParam=0;this._terminal.prefix="";this._state=b.NORMAL}else this._terminal.currentParam?this._terminal.currentParam+=p:this._terminal.prefix||"$"===p||"+"===p?2===this._terminal.prefix.length?this._terminal.currentParam=p:this._terminal.prefix+=p:this._terminal.currentParam=p;break;case b.IGNORE:if(p===f.C0.ESC||p===f.C0.BEL)p===f.C0.ESC&&this._position++,this._state=b.NORMAL}}this._terminal.buffer.x===h&&this._terminal.buffer.y===n||this._terminal.emit("cursormove"); -return this._state};a.prototype.setState=function(a){this._state=a};a.prototype.setPrefix=function(a){this._terminal.prefix=a};a.prototype.setPostfix=function(a){this._terminal.postfix=a};a.prototype.setParam=function(a){this._terminal.currentParam=a};a.prototype.getParam=function(){return this._terminal.currentParam};a.prototype.finalizeParam=function(){this._terminal.params.push(this._terminal.currentParam);this._terminal.currentParam=0};a.prototype.skipNextChar=function(){this._position++};return a}(); -d.Parser=a},{"./Charsets":4,"./EscapeSequences":6}],11:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var e in b)b.hasOwnProperty(e)&&(a[e]=b[e])};return function(b,e){function g(){this.constructor=b}a(b,e);b.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./utils/MouseHelper"),l=a("./shared/utils/Browser"); -h=a("./EventEmitter");var k=a("./SelectionModel"),e=a("./Buffer"),g=a("./handlers/AltClickHandler");a=String.fromCharCode(160);var b=new RegExp(a,"g"),n;(function(a){a[a.NORMAL=0]="NORMAL";a[a.WORD=1]="WORD";a[a.LINE=2]="LINE"})(n||(n={}));a=function(a){function d(b,e){var g=a.call(this)||this;g._terminal=b;g._charMeasure=e;g._enabled=!0;g._initListeners();g.enable();g._model=new k.SelectionModel(b);g._activeSelectionMode=n.NORMAL;return g}f(d,a);Object.defineProperty(d.prototype,"_buffer",{get:function(){return this._terminal.buffers.active}, -enumerable:!0,configurable:!0});d.prototype._initListeners=function(){var a=this;this._mouseMoveListener=function(b){return a._onMouseMove(b)};this._mouseUpListener=function(b){return a._onMouseUp(b)};this._trimListener=function(b){return a._onTrim(b)};this.initBuffersListeners()};d.prototype.initBuffersListeners=function(){var a=this;this._terminal.buffer.lines.on("trim",this._trimListener);this._terminal.buffers.on("activate",function(b){return a._onBufferActivate(b)})};d.prototype.disable=function(){this.clearSelection(); -this._enabled=!1};d.prototype.enable=function(){this._enabled=!0};Object.defineProperty(d.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"hasSelection",{get:function(){var a=this._model.finalSelectionStart,b=this._model.finalSelectionEnd;return a&&b?a[0]!==b[0]||a[1]!== -b[1]:!1},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"selectionText",{get:function(){var a=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;if(!a||!e)return"";var g=[];g.push(this._buffer.translateBufferLineToString(a[1],!0,a[0],a[1]===e[1]?e[0]:null));for(var d=a[1]+1;d<=e[1]-1;d++){var k=this._buffer.lines.get(d),f=this._buffer.translateBufferLineToString(d,!0);k.isWrapped?g[g.length-1]+=f:g.push(f)}a[1]!==e[1]&&(k=this._buffer.lines.get(e[1]),f=this._buffer.translateBufferLineToString(e[1], -!0,0,e[0]),k.isWrapped?g[g.length-1]+=f:g.push(f));return g.map(function(a){return a.replace(b," ")}).join(l.isMSWindows?"\r\n":"\n")},enumerable:!0,configurable:!0});d.prototype.clearSelection=function(){this._model.clearSelection();this._removeMouseDownListeners();this.refresh()};d.prototype.refresh=function(a){var b=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return b._refresh()}));l.isLinux&&a&&this.selectionText.length&&this.emit("newselection", -this.selectionText)};d.prototype._refresh=function(){this._refreshAnimationFrame=null;this.emit("refresh",{start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd})};d.prototype.isClickInSelection=function(a){a=this._getMouseBufferCoords(a);var b=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;return b&&e?a[1]>b[1]&&a[1]b[0]&&a[0]b&&(a-=b);a=Math.min(Math.max(a,-50),50);a/=50;return a/Math.abs(a)+Math.round(14*a)};d.prototype.shouldForceSelection=function(a){return l.isMac?a.altKey:a.shiftKey};d.prototype.onMouseDown=function(a){this._mouseDownTimeStamp=a.timeStamp;if((2!== -a.button||!this.hasSelection)&&0===a.button){if(!this._enabled){if(!this.shouldForceSelection(a))return;a.stopPropagation()}a.preventDefault();this._dragScrollAmount=0;this._enabled&&a.shiftKey?this._onIncrementalClick(a):1===a.detail?this._onSingleClick(a):2===a.detail?this._onDoubleClick(a):3===a.detail&&this._onTripleClick(a);this._addMouseDownListeners();this.refresh(!0)}};d.prototype._addMouseDownListeners=function(){var a=this;this._terminal.element.ownerDocument.addEventListener("mousemove", -this._mouseMoveListener);this._terminal.element.ownerDocument.addEventListener("mouseup",this._mouseUpListener);this._dragScrollIntervalTimer=setInterval(function(){return a._dragScroll()},50)};d.prototype._removeMouseDownListeners=function(){this._terminal.element.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener);this._terminal.element.ownerDocument.removeEventListener("mouseup",this._mouseUpListener);clearInterval(this._dragScrollIntervalTimer);this._dragScrollIntervalTimer= -null};d.prototype._onIncrementalClick=function(a){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(a))};d.prototype._onSingleClick=function(a){this._model.selectionStartLength=0;this._model.isSelectAllActive=!1;this._activeSelectionMode=n.NORMAL;this._model.selectionStart=this._getMouseBufferCoords(a);this._model.selectionStart&&(this._model.selectionEnd=null,(a=this._buffer.lines.get(this._model.selectionStart[1]))&&(a.length>=this._model.selectionStart[0]||0===a[this._model.selectionStart[0]][e.CHAR_DATA_WIDTH_INDEX]&& -this._model.selectionStart[0]++))};d.prototype._onDoubleClick=function(a){if(a=this._getMouseBufferCoords(a))this._activeSelectionMode=n.WORD,this._selectWordAt(a,!0)};d.prototype._onTripleClick=function(a){if(a=this._getMouseBufferCoords(a))this._activeSelectionMode=n.LINE,this._selectLineAt(a[1])};d.prototype._onMouseMove=function(a){a.stopImmediatePropagation();var b=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;this._model.selectionEnd=this._getMouseBufferCoords(a); -this._model.selectionEnd?(this._activeSelectionMode===n.LINE?this._model.selectionEnd[0]=this._model.selectionEnd[1]this._dragScrollAmount&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=this.selectionText.length&&500>b?(new g.AltClickHandler(a,this._terminal)).move():this.hasSelection&&this._terminal.emit("selection")};d.prototype._onBufferActivate=function(a){this.clearSelection();a.inactiveBuffer.lines.off("trim",this._trimListener);a.activeBuffer.lines.on("trim",this._trimListener)};d.prototype._convertViewportColToCharacterIndex=function(a,b){for(var g=b[0],d=0;b[0]>= -d;d++){var k=a[d];0===k[e.CHAR_DATA_WIDTH_INDEX]?g--:1d[1]||a[1]===d[1]&&a[0]>d[0]:!1};a.prototype.onTrim=function(a){this.selectionStart&&(this.selectionStart[1]-= -a);this.selectionEnd&&(this.selectionEnd[1]-=a);if(this.selectionEnd&&0>this.selectionEnd[1])return this.clearSelection(),!0;this.selectionStart&&0>this.selectionStart[1]&&(this.selectionStart[1]=0);return!1};return a}();d.SelectionModel=a},{}],13:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var e in b)b.hasOwnProperty(e)&&(a[e]=b[e])};return function(b,e){function g(){this.constructor= -b}a(b,e);b.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("./BufferSet"),l=a("./Buffer"),k=a("./CompositionHelper");h=a("./EventEmitter");var e=a("./Viewport"),g=a("./handlers/Clipboard"),b=a("./EscapeSequences"),n=a("./InputHandler"),p=a("./Parser"),q=a("./renderer/Renderer"),r=a("./Linkifier"),t=a("./SelectionManager"),y=a("./utils/CharMeasure"),v=a("./shared/utils/Browser"),C=a("./utils/MouseHelper"),z=a("./utils/Sounds"), -x=a("./renderer/ColorManager"),B=a("./input/MouseZoneManager"),u="undefined"!==typeof window?window.document:null,A={cols:80,rows:24,convertEol:!1,termName:"xterm",cursorBlink:!1,cursorStyle:"block",bellSound:z.BELL_SOUND,bellStyle:"none",enableBold:!0,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,letterSpacing:0,scrollback:1E3,screenKeys:!1,debug:!1,macOptionIsMeta:!1,cancelEvents:!1,disableStdin:!1,useFlowControl:!1,allowTransparency:!1, -tabStopWidth:8,theme:null,rightClickSelectsWord:v.isMac};a=function(a){function d(b){void 0===b&&(b={});var e=a.call(this)||this;e.browser=v;e.options=b;e.setup();return e}f(d,a);d.prototype.setup=function(){var a=this;Object.keys(A).forEach(function(b){null==a.options[b]&&(a.options[b]=A[b]);a[b]=a.options[b]});this.parent=u?u.body:null;this.cols=this.options.cols;this.rows=this.options.rows;if(this.options.handler)this.on("data",this.options.handler);this.cursorState=0;this.cursorHidden=!1;this.sendDataQueue= -"";this.customKeyEventHandler=null;this.insertMode=this.originMode=this.applicationCursor=this.applicationKeypad=!1;this.wraparoundMode=!0;this.bracketedPasteMode=!1;this.gcharset=this.charset=null;this.glevel=0;this.charsets=[null];this.writable=this.readable=!0;this.curAttr=this.defAttr=131840;this.params=[];this.currentParam=0;this.postfix=this.prefix="";this.writeBuffer=[];this.writeStopped=this.xoffSentToCatchUp=this.writeInProgress=!1;this.surrogateHigh="";this.userScrolling=!1;this.inputHandler= -new n.InputHandler(this);this.parser=new p.Parser(this.inputHandler,this);this.renderer=this.renderer||null;this.selectionManager=this.selectionManager||null;this.linkifier=this.linkifier||new r.Linkifier(this);this._mouseZoneManager=this._mouseZoneManager||null;this.buffers=new m.BufferSet(this);this.selectionManager&&(this.selectionManager.clearSelection(),this.selectionManager.initBuffersListeners())};Object.defineProperty(d.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!0, -configurable:!0});d.prototype.eraseAttr=function(){return this.defAttr&-512|this.curAttr&511};d.prototype.focus=function(){this.textarea&&this.textarea.focus()};Object.defineProperty(d.prototype,"isFocused",{get:function(){return u.activeElement===this.textarea},enumerable:!0,configurable:!0});d.prototype.getOption=function(a){if(!(a in A))throw Error('No option with key "'+a+'"');return"undefined"!==typeof this.options[a]?this.options[a]:this[a]};d.prototype.setOption=function(a,b){if(!(a in A))throw Error('No option with key "'+ -a+'"');switch(a){case "bellStyle":b||(b="none");break;case "cursorStyle":b||(b="block");break;case "fontWeight":b||(b="normal");break;case "fontWeightBold":b||(b="bold");break;case "lineHeight":if(1>b){console.warn(a+" cannot be less than 1, value: "+b);return}case "tabStopWidth":if(1>b){console.warn(a+" cannot be less than 1, value: "+b);return}break;case "theme":if(this.renderer){this._setTheme(b);return}break;case "scrollback":b=Math.min(b,l.MAX_BUFFER_SIZE);if(0>b){console.warn(a+" cannot be less than 0, value: "+ -b);return}if(this.options[a]!==b){var e=this.rows+b;if(this.buffer.lines.length>e){e=this.buffer.lines.length-e;var d=0>this.buffer.ydisp-e;this.buffer.lines.trimStart(e);this.buffer.ybase=Math.max(this.buffer.ybase-e,0);this.buffer.ydisp=Math.max(this.buffer.ydisp-e,0);d&&this.refresh(0,this.rows-1)}}}this[a]=b;this.options[a]=b;switch(a){case "fontFamily":case "fontSize":this.renderer.clear();this.charMeasure.measure(this.options);break;case "enableBold":case "letterSpacing":case "lineHeight":case "fontWeight":case "fontWeightBold":a= -"fontWeight"===a||"fontWeightBold"===a||"enableBold"===a,this.renderer.clear(),this.renderer.onResize(this.cols,this.rows,a),this.refresh(0,this.rows-1);case "scrollback":this.buffers.resize(this.cols,this.rows);this.viewport.syncScrollArea();break;case "tabStopWidth":this.buffers.setupTabStops();break;case "bellSound":case "bellStyle":this.syncBellSound()}if(this.renderer)this.renderer.onOptionsChanged()};d.prototype._onTextAreaFocus=function(){this.sendFocus&&this.send(b.C0.ESC+"[I");this.element.classList.add("focus"); -this.showCursor();this.emit("focus")};d.prototype.blur=function(){return this.textarea.blur()};d.prototype._onTextAreaBlur=function(){this.refresh(this.buffer.y,this.buffer.y);this.sendFocus&&this.send(b.C0.ESC+"[O");this.element.classList.remove("focus");this.emit("blur")};d.prototype.initGlobal=function(){var a=this;this.bindKeys();w(this.element,"copy",function(b){a.hasSelection()&&g.copyHandler(b,a,a.selectionManager)});var b=function(b){return g.pasteHandler(b,a)};w(this.textarea,"paste",b); -w(this.element,"paste",b);v.isFirefox?w(this.element,"mousedown",function(b){2===b.button&&g.rightClickHandler(b,a.textarea,a.selectionManager,a.options.rightClickSelectsWord)}):w(this.element,"contextmenu",function(b){g.rightClickHandler(b,a.textarea,a.selectionManager,a.options.rightClickSelectsWord)});v.isLinux&&w(this.element,"auxclick",function(b){1===b.button&&g.moveTextAreaUnderMouseCursor(b,a.textarea)})};d.prototype.bindKeys=function(){var a=this,b=this;w(this.element,"keydown",function(a){u.activeElement=== -this&&b._keyDown(a)},!0);w(this.element,"keypress",function(a){u.activeElement===this&&b._keyPress(a)},!0);w(this.element,"keyup",function(b){16!==b.keyCode&&17!==b.keyCode&&18!==b.keyCode&&a.focus()},!0);w(this.textarea,"keydown",function(b){a._keyDown(b)},!0);w(this.textarea,"keypress",function(b){a._keyPress(b);a.textarea.value=""},!0);w(this.textarea,"compositionstart",function(){return a.compositionHelper.compositionstart()});w(this.textarea,"compositionupdate",function(b){return a.compositionHelper.compositionupdate(b)}); -w(this.textarea,"compositionend",function(){return a.compositionHelper.compositionend()});this.on("refresh",function(){return a.compositionHelper.updateCompositionElements()});this.on("refresh",function(b){return a.queueLinkification(b.start,b.end)})};d.prototype.open=function(a){var b=this;this.parent=a||this.parent;if(!this.parent)throw Error("Terminal requires a parent element.");this.context=this.parent.ownerDocument.defaultView;this.document=this.parent.ownerDocument;this.body=this.document.body; -this.element=this.document.createElement("div");this.element.classList.add("terminal");this.element.classList.add("xterm");this.element.setAttribute("tabindex","0");this.parent.appendChild(this.element);a=u.createDocumentFragment();this.viewportElement=u.createElement("div");this.viewportElement.classList.add("xterm-viewport");a.appendChild(this.viewportElement);this.viewportScrollArea=u.createElement("div");this.viewportScrollArea.classList.add("xterm-scroll-area");this.viewportElement.appendChild(this.viewportScrollArea); -this.screenElement=u.createElement("div");this.screenElement.classList.add("xterm-screen");this.helperContainer=u.createElement("div");this.helperContainer.classList.add("xterm-helpers");this.screenElement.appendChild(this.helperContainer);a.appendChild(this.screenElement);this._mouseZoneManager=new B.MouseZoneManager(this);this.on("scroll",function(){return b._mouseZoneManager.clearAll()});this.linkifier.attachToDom(this._mouseZoneManager);this.textarea=u.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"); -this.textarea.setAttribute("autocorrect","off");this.textarea.setAttribute("autocapitalize","off");this.textarea.setAttribute("spellcheck","false");this.textarea.tabIndex=0;this.textarea.addEventListener("focus",function(){return b._onTextAreaFocus()});this.textarea.addEventListener("blur",function(){return b._onTextAreaBlur()});this.helperContainer.appendChild(this.textarea);this.compositionView=u.createElement("div");this.compositionView.classList.add("composition-view");this.compositionHelper= -new k.CompositionHelper(this.textarea,this.compositionView,this);this.helperContainer.appendChild(this.compositionView);this.charSizeStyleElement=u.createElement("style");this.helperContainer.appendChild(this.charSizeStyleElement);this.charMeasure=new y.CharMeasure(u,this.helperContainer);this.syncBellSound();this.element.appendChild(a);this.renderer=new q.Renderer(this,this.options.theme);this.options.theme=null;this.viewport=new e.Viewport(this,this.viewportElement,this.viewportScrollArea,this.charMeasure); -this.viewport.onThemeChanged(this.renderer.colorManager.colors);this.on("cursormove",function(){return b.renderer.onCursorMove()});this.on("resize",function(){return b.renderer.onResize(b.cols,b.rows,!1)});this.on("blur",function(){return b.renderer.onBlur()});this.on("focus",function(){return b.renderer.onFocus()});this.charMeasure.on("charsizechanged",function(){return b.renderer.onResize(b.cols,b.rows,!0)});this.renderer.on("resize",function(a){return b.viewport.syncScrollArea()});this.selectionManager= -new t.SelectionManager(this,this.charMeasure);this.element.addEventListener("mousedown",function(a){return b.selectionManager.onMouseDown(a)});this.selectionManager.on("refresh",function(a){return b.renderer.onSelectionChanged(a.start,a.end)});this.selectionManager.on("newselection",function(a){b.textarea.value=a;b.textarea.focus();b.textarea.select()});this.on("scroll",function(){b.viewport.syncScrollArea();b.selectionManager.refresh()});this.viewportElement.addEventListener("scroll",function(){return b.selectionManager.refresh()}); -this.mouseHelper=new C.MouseHelper(this.renderer);this.charMeasure.measure(this.options);this.refresh(0,this.rows-1);this.initGlobal();this.bindMouse()};d.prototype._setTheme=function(a){a=this.renderer.setTheme(a);if(this.viewport)this.viewport.onThemeChanged(a)};d.applyAddon=function(a){a.apply(d)};d.prototype.bindMouse=function(){function a(a){switch(a.overrideType||a.type){case "mousedown":var b=null!=a.button?+a.button:null!=a.which?a.which-1:null;v.isMSIE&&(b=1===b?0:4===b?1:b);break;case "mouseup":b= -3;break;case "DOMMouseScroll":b=0>a.detail?64:65;break;case "wheel":b=0b?a.push(b):(2047>6),a.push(128|b&63)):255===b?a.push(0):(127a){if(0===this.buffer.ydisp)return; -this.userScrolling=!0}else a+this.buffer.ydisp>=this.buffer.ybase&&(this.userScrolling=!1);var e=this.buffer.ydisp;this.buffer.ydisp=Math.max(Math.min(this.buffer.ydisp+a,this.buffer.ybase),0);e!==this.buffer.ydisp&&(b||this.emit("scroll",this.buffer.ydisp),this.refresh(0,this.rows-1))};d.prototype.scrollPages=function(a){this.scrollLines(a*(this.rows-1))};d.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)};d.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase- -this.buffer.ydisp)};d.prototype.write=function(a){var e=this;this.writeBuffer.push(a);this.options.useFlowControl&&!this.xoffSentToCatchUp&&5<=this.writeBuffer.length&&(this.send(b.C0.DC3),this.xoffSentToCatchUp=!0);!this.writeInProgress&&0=a.keyCode?e.key=b.C0.ESC+String.fromCharCode(a.keyCode+32):192===a.keyCode?e.key=b.C0.ESC+"`":48<=a.keyCode&&57>=a.keyCode&&(e.key=b.C0.ESC+(a.keyCode-48)):65<=a.keyCode&&90>=a.keyCode?e.key=String.fromCharCode(a.keyCode-64):32===a.keyCode?e.key=String.fromCharCode(0):51<=a.keyCode&& -55>=a.keyCode?e.key=String.fromCharCode(a.keyCode-51+27):56===a.keyCode?e.key=String.fromCharCode(127):219===a.keyCode?e.key=String.fromCharCode(27):220===a.keyCode?e.key=String.fromCharCode(28):221===a.keyCode&&(e.key=String.fromCharCode(29))}return e};d.prototype.setgLevel=function(a){this.glevel=a;this.charset=this.charsets[a]};d.prototype.setgCharset=function(a,b){this.charsets[a]=b;this.glevel===a&&(this.charset=b)};d.prototype._keyPress=function(a){if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(a))return!1; -this.cancel(a);if(a.charCode)var b=a.charCode;else if(null==a.which)b=a.keyCode;else if(0!==a.which&&0!==a.charCode)b=a.which;else return!1;if(!b||(a.altKey||a.ctrlKey||a.metaKey)&&!this._isThirdLevelShift(this.browser,a))return!1;b=String.fromCharCode(b);this.emit("keypress",b,a);this.emit("key",b,a);this.showCursor();this.handler(b);return!0};d.prototype.send=function(a){var b=this;this.sendDataQueue||setTimeout(function(){b.handler(b.sendDataQueue);b.sendDataQueue=""},1);this.sendDataQueue+=a}; -d.prototype.bell=function(){var a=this;this.emit("bell");this.soundBell()&&this.bellAudioElement.play();this.visualBell()&&(this.element.classList.add("visual-bell-active"),clearTimeout(this.visualBellTimer),this.visualBellTimer=window.setTimeout(function(){a.element.classList.remove("visual-bell-active")},200))};d.prototype.log=function(a,b){this.options.debug&&this.context.console&&this.context.console.log&&this.context.console.log(a,b)};d.prototype.error=function(a,b){this.options.debug&&this.context.console&& -this.context.console.error&&this.context.console.error(a,b)};d.prototype.resize=function(a,b){isNaN(a)||isNaN(b)||(a===this.cols&&b===this.rows?this.charMeasure.width&&this.charMeasure.height||this.charMeasure.measure(this.options):(1>a&&(a=1),1>b&&(b=1),this.buffers.resize(a,b),this.cols=a,this.rows=b,this.buffers.setupTabStops(this.cols),this.charMeasure.measure(this.options),this.refresh(0,this.rows-1),this.emit("resize",{cols:a,rows:b})))};d.prototype.updateRange=function(a){athis.refreshEnd&&(this.refreshEnd=a)};d.prototype.maxRange=function(){this.refreshStart=0;this.refreshEnd=this.rows-1};d.prototype.eraseRight=function(a,b){var e=this.buffer.lines.get(this.buffer.ybase+b);if(e){for(var d=[this.eraseAttr()," ",1,32];athis.buffer.scrollBottom&&(this.buffer.y--,this.scroll());this.buffer.x>=this.cols&&this.buffer.x--};d.prototype.reverseIndex=function(){this.buffer.y===this.buffer.scrollTop?(this.buffer.lines.shiftElements(this.buffer.y+this.buffer.ybase,this.buffer.scrollBottom-this.buffer.scrollTop,1),this.buffer.lines.set(this.buffer.y+this.buffer.ybase,this.blankLine(!0)),this.updateRange(this.buffer.scrollTop),this.updateRange(this.buffer.scrollBottom)): -this.buffer.y--};d.prototype.reset=function(){this.options.rows=this.rows;this.options.cols=this.cols;var a=this.customKeyEventHandler,b=this.inputHandler;this.setup();this.customKeyEventHandler=a;this.inputHandler=b;this.refresh(0,this.rows-1);this.viewport.syncScrollArea()};d.prototype.tabSet=function(){this.buffer.tabs[this.buffer.x]=!0};d.prototype.cancel=function(a,b){if(this.options.cancelEvents||b)return a.preventDefault(),a.stopPropagation(),!1};d.prototype.matchColor=function(a,b,e){var d= -a<<16|b<<8|e;if(null!=E[d])a=E[d];else{for(var g=Infinity,k=-1,l=0,f,m,h;le;e++)a.push([b[e/36%6|0],b[e/6%6|0],b[e%6]]);for(e=0;24>e;e++)b=8+10*e,a.push([b,b,b]);return a}(),E={}},{"./Buffer":1,"./BufferSet":2,"./CompositionHelper":5,"./EscapeSequences":6,"./EventEmitter":7,"./InputHandler":8,"./Linkifier":9,"./Parser":10,"./SelectionManager":11,"./Viewport":15,"./handlers/Clipboard":17,"./input/MouseZoneManager":18,"./renderer/ColorManager":21, -"./renderer/Renderer":25,"./shared/utils/Browser":30,"./utils/CharMeasure":31,"./utils/MouseHelper":33,"./utils/Sounds":35}],14:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=d.LinkHoverEventTypes||(d.LinkHoverEventTypes={});a.HOVER="linkhover";a.TOOLTIP="linktooltip";a.LEAVE="linkleave"},{}],15:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=function(){function a(a,d,k,e){var g=this;this.terminal=a;this.viewportElement=d;this.scrollArea=k;this.charMeasure= -e;this.lastRecordedBufferHeight=this.lastRecordedViewportHeight=this.lastRecordedBufferLength=this.currentRowHeight=this.scrollBarWidth=0;this.scrollBarWidth=this.viewportElement.offsetWidth-this.scrollArea.offsetWidth||15;this.viewportElement.addEventListener("scroll",this.onScroll.bind(this));setTimeout(function(){return g.syncScrollArea()},0)}a.prototype.onThemeChanged=function(a){this.viewportElement.style.backgroundColor=a.background};a.prototype.refresh=function(){if(0=this._endCol&&athis._endRow?l.Up:l.Down};a.prototype._bufferLine=function(a,d,b,k,l){for(var e=a,g="";e!==b||d!==k;)e+=l?1:-1,l&&e>this._terminal.cols-1?(g+=this._terminal.buffer.translateBufferLineToString(d,!1,a,e),a=e=0,d++):!l&&0>e&&(g+=this._terminal.buffer.translateBufferLineToString(d,!1,0,a+1),a=e=this._terminal.cols-1,d--);return g+this._terminal.buffer.translateBufferLineToString(d,!1,a,e)};a.prototype._sequence=function(a){return m.C0.ESC+(this._terminal.applicationCursor? -"O":"[")+a};return a}();d.AltClickHandler=a},{"../EscapeSequences":6}],17:[function(a,h,d){function f(a,e){return e?a.replace(/\r?\n/g,"\r"):a}function m(a,e){return e?"\u001b[200~"+a+"\u001b[201~":a}function l(a,e){e.style.position="fixed";e.style.width="20px";e.style.height="20px";e.style.left=a.clientX-10+"px";e.style.top=a.clientY-10+"px";e.style.zIndex="1000";e.focus();setTimeout(function(){e.style.position=null;e.style.width=null;e.style.height=null;e.style.left=null;e.style.top=null;e.style.zIndex= -null},200)}Object.defineProperty(d,"__esModule",{value:!0});d.prepareTextForTerminal=f;d.bracketTextForPaste=m;d.copyHandler=function(a,e,d){e.browser.isMSIE?window.clipboardData.setData("Text",d.selectionText):a.clipboardData.setData("text/plain",d.selectionText);a.preventDefault()};d.pasteHandler=function(a,e){a.stopPropagation();var d=function(b){b=f(b,e.browser.isMSWindows);b=m(b,e.bracketedPasteMode);e.handler(b);e.textarea.value="";e.emit("paste",b);e.cancel(a)};if(e.browser.isMSIE){if(window.clipboardData){var b= -window.clipboardData.getData("Text");d(b)}}else a.clipboardData&&(b=a.clipboardData.getData("text/plain"),d(b))};d.moveTextAreaUnderMouseCursor=l;d.rightClickHandler=function(a,e,d,b){l(a,e);b&&!d.isClickInSelection(a)&&d.selectWordAtCursor(a);e.value=d.selectionText;e.select()}},{}],18:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=function(){function a(a){var d=this;this._terminal=a;this._zones=[];this._areZonesActive=!1;this._currentZone=this._tooltipTimeout=null;this._lastHoverCoords= -[null,null];this._terminal.element.addEventListener("mousedown",function(a){return d._onMouseDown(a)});this._mouseMoveListener=function(a){return d._onMouseMove(a)};this._clickListener=function(a){return d._onClick(a)}}a.prototype.add=function(a){this._zones.push(a);1===this._zones.length&&this._activate()};a.prototype.clearAll=function(a,d){if(0!==this._zones.length){d||(a=0,d=this._terminal.rows-1);for(var k=0;ka&&e.y<=d+1&&(this._currentZone&&this._currentZone=== -e&&(this._currentZone.leaveCallback(),this._currentZone=null),this._zones.splice(k--,1))}0===this._zones.length&&this._deactivate()}};a.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._terminal.element.addEventListener("mousemove",this._mouseMoveListener),this._terminal.element.addEventListener("click",this._clickListener))};a.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._terminal.element.removeEventListener("mousemove",this._mouseMoveListener), -this._terminal.element.removeEventListener("click",this._clickListener))};a.prototype._onMouseMove=function(a){if(this._lastHoverCoords[0]!==a.pageX||this._lastHoverCoords[1]!==a.pageY)this._onHover(a),this._lastHoverCoords=[a.pageX,a.pageY]};a.prototype._onHover=function(a){var d=this,k=this._findZoneEventAt(a);k!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=null,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),k&&(this._currentZone=k,k.hoverCallback&& -k.hoverCallback(a),this._tooltipTimeout=setTimeout(function(){return d._onTooltip(a)},500)))};a.prototype._onTooltip=function(a){this._tooltipTimeout=null;var d=this._findZoneEventAt(a);d&&d.tooltipCallback&&d.tooltipCallback(a)};a.prototype._onMouseDown=function(a){if(this._areZonesActive){var d=this._findZoneEventAt(a);d&&d.willLinkActivate(a)&&(a.preventDefault(),a.stopImmediatePropagation())}};a.prototype._onClick=function(a){var d=this._findZoneEventAt(a);d&&(d.clickCallback(a),a.preventDefault(), -a.stopImmediatePropagation())};a.prototype._findZoneEventAt=function(a){a=this._terminal.mouseHelper.getCoords(a,this._terminal.screenElement,this._terminal.charMeasure,this._terminal.options.lineHeight,this._terminal.cols,this._terminal.rows);if(!a)return null;for(var d=0;da[0])return k}return null};return a}();d.MouseZoneManager=a;a=function(){return function(a,d,l,k,e,g,b,h){this.x1=a;this.x2=d;this.y=l;this.clickCallback= -k;this.hoverCallback=e;this.tooltipCallback=g;this.leaveCallback=b;this.willLinkActivate=h}}();d.MouseZone=a},{}],19:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});var f=a("./CharAtlas"),m=a("../Buffer");d.INVERTED_DEFAULT_COLOR=-1;a=function(){function a(a,e,d,b,l){this._container=a;this._alpha=b;this._colors=l;this._scaledCharTop=this._scaledCharLeft=this._scaledCellHeight=this._scaledCellWidth=this._scaledCharHeight=this._scaledCharWidth=0;this._canvas=document.createElement("canvas"); -this._canvas.classList.add("xterm-"+e+"-layer");this._canvas.style.zIndex=d.toString();this._initCanvas();this._container.appendChild(this._canvas)}a.prototype._initCanvas=function(){this._ctx=this._canvas.getContext("2d",{alpha:this._alpha});this._alpha||this.clearAll()};a.prototype.onOptionsChanged=function(a){};a.prototype.onBlur=function(a){};a.prototype.onFocus=function(a){};a.prototype.onCursorMove=function(a){};a.prototype.onGridChanged=function(a,e,d){};a.prototype.onSelectionChanged=function(a, -e,d){};a.prototype.onThemeChanged=function(a,e){this._refreshCharAtlas(a,e)};a.prototype.setTransparency=function(a,e){if(e!==this._alpha){var d=this._canvas;this._alpha=e;this._canvas=this._canvas.cloneNode();this._initCanvas();this._container.replaceChild(this._canvas,d);this._refreshCharAtlas(a,this._colors);this.onGridChanged(a,0,a.rows-1)}};a.prototype._refreshCharAtlas=function(a,e){var d=this;0>=this._scaledCharWidth&&0>=this._scaledCharHeight||(this._charAtlas=null,a=f.acquireCharAtlas(a, -e,this._scaledCharWidth,this._scaledCharHeight),a instanceof HTMLCanvasElement?this._charAtlas=a:a.then(function(a){return d._charAtlas=a}))};a.prototype.resize=function(a,e,d){this._scaledCellWidth=e.scaledCellWidth;this._scaledCellHeight=e.scaledCellHeight;this._scaledCharWidth=e.scaledCharWidth;this._scaledCharHeight=e.scaledCharHeight;this._scaledCharLeft=e.scaledCharLeft;this._scaledCharTop=e.scaledCharTop;this._canvas.width=e.scaledCanvasWidth;this._canvas.height=e.scaledCanvasHeight;this._canvas.style.width= -e.canvasWidth+"px";this._canvas.style.height=e.canvasHeight+"px";this._alpha||this.clearAll();d&&this._refreshCharAtlas(a,this._colors)};a.prototype.fillCells=function(a,e,d,b){this._ctx.fillRect(a*this._scaledCellWidth,e*this._scaledCellHeight,d*this._scaledCellWidth,b*this._scaledCellHeight)};a.prototype.fillBottomLineAtCells=function(a,e,d){void 0===d&&(d=1);this._ctx.fillRect(a*this._scaledCellWidth,(e+1)*this._scaledCellHeight-window.devicePixelRatio-1,d*this._scaledCellWidth,window.devicePixelRatio)}; -a.prototype.fillLeftLineAtCell=function(a,e){this._ctx.fillRect(a*this._scaledCellWidth,e*this._scaledCellHeight,window.devicePixelRatio,this._scaledCellHeight)};a.prototype.strokeRectAtCell=function(a,e,d,b){this._ctx.lineWidth=window.devicePixelRatio;this._ctx.strokeRect(a*this._scaledCellWidth+window.devicePixelRatio/2,e*this._scaledCellHeight+window.devicePixelRatio/2,d*this._scaledCellWidth-window.devicePixelRatio,b*this._scaledCellHeight-window.devicePixelRatio)};a.prototype.clearAll=function(){this._alpha? -this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))};a.prototype.clearCells=function(a,e,d,b){this._alpha?this._ctx.clearRect(a*this._scaledCellWidth,e*this._scaledCellHeight,d*this._scaledCellWidth,b*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background,this._ctx.fillRect(a*this._scaledCellWidth,e*this._scaledCellHeight,d*this._scaledCellWidth,b*this._scaledCellHeight))}; -a.prototype.fillCharTrueColor=function(a,e,d,b){this._ctx.font=this._getFont(a,!1);this._ctx.textBaseline="top";this._clipRow(a,b);this._ctx.fillText(e[m.CHAR_DATA_CHAR_INDEX],d*this._scaledCellWidth+this._scaledCharLeft,b*this._scaledCellHeight+this._scaledCharTop)};a.prototype.drawChar=function(a,e,d,b,l,h,m,r,t,y){var g=0;256>m?g=m+2:t&&a.options.enableBold&&(g=1);this._charAtlas&&256>d&&(1m&&(8>m||t)||256<=m)&&256<=r?(e=this._scaledCharWidth+f.CHAR_ATLAS_CELL_SPACING,b=this._scaledCharHeight+ -f.CHAR_ATLAS_CELL_SPACING,y&&(this._ctx.globalAlpha=.5),t&&!a.options.enableBold&&1b?this._colors.ansi[b]:this._colors.foreground;this._clipRow(a,f);m&&(this._ctx.globalAlpha=.5);this._ctx.fillText(e,l*this._scaledCellWidth+this._scaledCharLeft,f*this._scaledCellHeight+this._scaledCharTop);this._ctx.restore()};a.prototype._clipRow=function(a,e){this._ctx.beginPath();this._ctx.rect(0,e*this._scaledCellHeight,a.cols*this._scaledCellWidth,this._scaledCellHeight);this._ctx.clip()};a.prototype._getFont=function(a,e){return(e?a.options.fontWeightBold: -a.options.fontWeight)+" "+a.options.fontSize*window.devicePixelRatio+"px "+a.options.fontFamily};return a}();d.BaseRenderLayer=a},{"../Buffer":1,"./CharAtlas":20}],20:[function(a,h,d){function f(a,d,b,k){k={foreground:k.foreground,background:k.background,cursor:null,cursorAccent:null,selection:null,ansi:k.ansi.slice(0,16)};return{scaledCharWidth:a,scaledCharHeight:d,fontFamily:b.options.fontFamily,fontSize:b.options.fontSize,fontWeight:b.options.fontWeight,fontWeightBold:b.options.fontWeightBold, -allowTransparency:b.options.allowTransparency,colors:k}}function m(a,d){for(var b=0;ba.length? -"0"+a:a}Object.defineProperty(d,"__esModule",{value:!0});d.DEFAULT_ANSI_COLORS="#2e3436 #cc0000 #4e9a06 #c4a000 #3465a4 #75507b #06989a #d3d7cf #555753 #ef2929 #8ae234 #fce94f #729fcf #ad7fa8 #34e2e2 #eeeeec".split(" ");a=function(){function a(){for(var a=d.DEFAULT_ANSI_COLORS.slice(),k=[0,95,135,175,215,255],e=0;216>e;e++){var g=f(k[e/36%6|0]),b=f(k[e/6%6|0]),h=f(k[e%6]);a.push("#"+g+b+h)}for(e=0;24>e;e++)k=f(8+10*e),a.push("#"+k+k+k);this.colors={foreground:"#ffffff",background:"#000000",cursor:"#ffffff", -cursorAccent:"#000000",selection:"rgba(255, 255, 255, 0.3)",ansi:a}}a.prototype.setTheme=function(a){this.colors.foreground=a.foreground||"#ffffff";this.colors.background=a.background||"#000000";this.colors.cursor=a.cursor||"#ffffff";this.colors.cursorAccent=a.cursorAccent||"#000000";this.colors.selection=a.selection||"rgba(255, 255, 255, 0.3)";this.colors.ansi[0]=a.black||d.DEFAULT_ANSI_COLORS[0];this.colors.ansi[1]=a.red||d.DEFAULT_ANSI_COLORS[1];this.colors.ansi[2]=a.green||d.DEFAULT_ANSI_COLORS[2]; -this.colors.ansi[3]=a.yellow||d.DEFAULT_ANSI_COLORS[3];this.colors.ansi[4]=a.blue||d.DEFAULT_ANSI_COLORS[4];this.colors.ansi[5]=a.magenta||d.DEFAULT_ANSI_COLORS[5];this.colors.ansi[6]=a.cyan||d.DEFAULT_ANSI_COLORS[6];this.colors.ansi[7]=a.white||d.DEFAULT_ANSI_COLORS[7];this.colors.ansi[8]=a.brightBlack||d.DEFAULT_ANSI_COLORS[8];this.colors.ansi[9]=a.brightRed||d.DEFAULT_ANSI_COLORS[9];this.colors.ansi[10]=a.brightGreen||d.DEFAULT_ANSI_COLORS[10];this.colors.ansi[11]=a.brightYellow||d.DEFAULT_ANSI_COLORS[11]; -this.colors.ansi[12]=a.brightBlue||d.DEFAULT_ANSI_COLORS[12];this.colors.ansi[13]=a.brightMagenta||d.DEFAULT_ANSI_COLORS[13];this.colors.ansi[14]=a.brightCyan||d.DEFAULT_ANSI_COLORS[14];this.colors.ansi[15]=a.brightWhite||d.DEFAULT_ANSI_COLORS[15]};return a}();d.ColorManager=a},{}],22:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var b in d)d.hasOwnProperty(b)&&(a[b]=d[b])};return function(e, -d){function b(){this.constructor=e}a(e,d);e.prototype=null===d?Object.create(d):(b.prototype=d.prototype,new b)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("../Buffer");a=function(a){function e(e,b,d){e=a.call(this,e,"cursor",b,!0,d)||this;e._state={x:null,y:null,isFocused:null,style:null,width:null};e._cursorRenderers={bar:e._renderBarCursor.bind(e),block:e._renderBlockCursor.bind(e),underline:e._renderUnderlineCursor.bind(e)};return e}f(e,a);e.prototype.resize=function(e,b,d){a.prototype.resize.call(this, -e,b,d);this._state={x:null,y:null,isFocused:null,style:null,width:null}};e.prototype.reset=function(a){this._clearCursor();this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=null,this.onOptionsChanged(a))};e.prototype.onBlur=function(a){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause();a.refresh(a.buffer.y,a.buffer.y)};e.prototype.onFocus=function(a){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume(a):a.refresh(a.buffer.y, -a.buffer.y)};e.prototype.onOptionsChanged=function(a){var b=this;a.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new l(a,function(){b._render(a,!0)})):(this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=null),a.refresh(a.buffer.y,a.buffer.y))};e.prototype.onCursorMove=function(a){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation(a)};e.prototype.onGridChanged=function(a,b,e){!this._cursorBlinkStateManager|| -this._cursorBlinkStateManager.isPaused?this._render(a,!1):this._cursorBlinkStateManager.restartBlinkAnimation(a)};e.prototype._render=function(a,b){if(!a.cursorState||a.cursorHidden)this._clearCursor();else{var e=a.buffer.ybase+a.buffer.y;b=e-a.buffer.ydisp;if(0>b||b>=a.rows)this._clearCursor();else if(e=a.buffer.lines.get(e)[a.buffer.x])if(a.isFocused)if(this._cursorBlinkStateManager&&!this._cursorBlinkStateManager.isCursorVisible)this._clearCursor();else{if(this._state){if(this._state.x===a.buffer.x&& -this._state.y===b&&this._state.isFocused===a.isFocused&&this._state.style===a.options.cursorStyle&&this._state.width===e[m.CHAR_DATA_WIDTH_INDEX])return;this._clearCursor()}this._ctx.save();this._cursorRenderers[a.options.cursorStyle||"block"](a,a.buffer.x,b,e);this._ctx.restore();this._state.x=a.buffer.x;this._state.y=b;this._state.isFocused=!1;this._state.style=a.options.cursorStyle;this._state.width=e[m.CHAR_DATA_WIDTH_INDEX]}else this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor, -this._renderBlurCursor(a,a.buffer.x,b,e),this._ctx.restore(),this._state.x=a.buffer.x,this._state.y=b,this._state.isFocused=!1,this._state.style=a.options.cursorStyle,this._state.width=e[m.CHAR_DATA_WIDTH_INDEX]}};e.prototype._clearCursor=function(){this._state&&(this.clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:null,y:null,isFocused:null,style:null,width:null})};e.prototype._renderBarCursor=function(a,b,e,d){this._ctx.save();this._ctx.fillStyle=this._colors.cursor;this.fillLeftLineAtCell(b, -e);this._ctx.restore()};e.prototype._renderBlockCursor=function(a,b,e,d){this._ctx.save();this._ctx.fillStyle=this._colors.cursor;this.fillCells(b,e,d[m.CHAR_DATA_WIDTH_INDEX],1);this._ctx.fillStyle=this._colors.cursorAccent;this.fillCharTrueColor(a,d,b,e);this._ctx.restore()};e.prototype._renderUnderlineCursor=function(a,b,e,d){this._ctx.save();this._ctx.fillStyle=this._colors.cursor;this.fillBottomLineAtCells(b,e);this._ctx.restore()};e.prototype._renderBlurCursor=function(a,b,e,d){this._ctx.save(); -this._ctx.strokeStyle=this._colors.cursor;this.strokeRectAtCell(b,e,d[m.CHAR_DATA_WIDTH_INDEX],1);this._ctx.restore()};return e}(a("./BaseRenderLayer").BaseRenderLayer);d.CursorRenderLayer=a;var l=function(){function a(a,d){this.renderCallback=d;this.isCursorVisible=!0;a.isFocused&&this._restartInterval()}Object.defineProperty(a.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!0,configurable:!0});a.prototype.dispose=function(){this._blinkInterval&& -(window.clearInterval(this._blinkInterval),this._blinkInterval=null);this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=null);this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=null)};a.prototype.restartBlinkAnimation=function(a){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){e.renderCallback(); -e._animationFrame=null})))};a.prototype._restartInterval=function(a){var e=this;void 0===a&&(a=600);this._blinkInterval&&window.clearInterval(this._blinkInterval);this._blinkStartTimeout=setTimeout(function(){if(e._animationTimeRestarted){var a=600-(Date.now()-e._animationTimeRestarted);e._animationTimeRestarted=null;if(0e&&(e=this._refreshRowsQueue[d].end)}this._refreshRowsQueue=[];this._refreshAnimationFrame=null;b=Math.max(b,0);e=Math.min(e,this._terminal.rows-1);this._renderLayers.forEach(function(d){return d.onGridChanged(a._terminal, -b,e)});this._terminal.emit("refresh",{start:b,end:e})};d.prototype._updateDimensions=function(){this._terminal.charMeasure.width&&this._terminal.charMeasure.height&&(this.dimensions.scaledCharWidth=Math.floor(this._terminal.charMeasure.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._terminal.charMeasure.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._terminal.options.lineHeight),this.dimensions.scaledCharTop= -1===this._terminal.options.lineHeight?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._terminal.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._terminal.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._terminal.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._terminal.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight= -Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._terminal.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._terminal.cols)};return d}(h.EventEmitter);d.Renderer=a},{"../EventEmitter":7,"../utils/ScreenDprMonitor":34,"./ColorManager":21,"./CursorRenderLayer":22,"./LinkRenderLayer":24,"./SelectionRenderLayer":26, -"./TextRenderLayer":27}],26:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])};return function(d,k){function e(){this.constructor=d}a(d,k);d.prototype=null===k?Object.create(k):(e.prototype=k.prototype,new e)}}();Object.defineProperty(d,"__esModule",{value:!0});a=function(a){function d(d,e,g){d=a.call(this,d,"selection",e,!0,g)||this;d._state= -{start:null,end:null};return d}f(d,a);d.prototype.resize=function(d,e,g){a.prototype.resize.call(this,d,e,g);this._state={start:null,end:null}};d.prototype.reset=function(a){this._state.start&&this._state.end&&(this._state={start:null,end:null},this.clearAll())};d.prototype.onSelectionChanged=function(a,e,d){if(this._state.start!==e&&this._state.end!==d&&(this.clearAll(),e&&d)){var b=e[1]-a.buffer.ydisp,g=d[1]-a.buffer.ydisp,f=Math.max(b,0),k=Math.min(g,a.rows-1);if(!(f>=a.rows||0>k)){b=b===f?e[0]: -0;var l=f===k?d[0]:a.cols;this._ctx.fillStyle=this._colors.selection;this.fillCells(b,f,l-b,1);this.fillCells(0,f+1,a.cols,Math.max(k-f-1,0));f!==k&&this.fillCells(0,k,g===k?d[0]:a.cols,1);this._state.start=[e[0],e[1]];this._state.end=[d[0],d[1]]}}};return d}(a("./BaseRenderLayer").BaseRenderLayer);d.SelectionRenderLayer=a},{"./BaseRenderLayer":19}],27:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,e){a.__proto__=e}|| -function(a,e){for(var b in e)e.hasOwnProperty(b)&&(a[b]=e[b])};return function(b,e){function d(){this.constructor=b}a(b,e);b.prototype=null===e?Object.create(e):(d.prototype=e.prototype,new d)}}();Object.defineProperty(d,"__esModule",{value:!0});var m=a("../Buffer"),l=a("./Types"),k=a("./GridCache"),e=a("./BaseRenderLayer");a=function(a){function b(b,e,d,g){b=a.call(this,b,"text",e,g,d)||this;b._characterOverlapCache={};b._state=new k.GridCache;return b}f(b,a);b.prototype.resize=function(b,e,d){a.prototype.resize.call(this, -b,e,d);d=this._getFont(b,!1);if(this._characterWidth!==e.scaledCharWidth||this._characterFont!==d)this._characterWidth=e.scaledCharWidth,this._characterFont=d,this._characterOverlapCache={};this._state.clear();this._state.resize(b.cols,b.rows)};b.prototype.reset=function(a){this._state.clear();this.clearAll()};b.prototype.onGridChanged=function(a,b,d){if(0!==this._state.cache.length)for(;b<=d;b++){var g=a.buffer.lines.get(b+a.buffer.ydisp);this.clearCells(0,b,a.cols,1);for(var f=0;f>18,u=p&511,A=256<=u,w=B&l.FLAGS.INVISIBLE,D=B&l.FLAGS.INVERSE;!h||32===h&&A&&!D||w||(0!==q&&this._isOverlapping(k)&&f>9&511,D&&(D=u,u=k,k=D,256===k&&(k=e.INVERTED_DEFAULT_COLOR),257===u&&(u=e.INVERTED_DEFAULT_COLOR)),256>u&&(this._ctx.save(),this._ctx.fillStyle= -u===e.INVERTED_DEFAULT_COLOR?this._colors.foreground:this._colors.ansi[u],this.fillCells(f,b,q,1),this._ctx.restore()),this._ctx.save(),B&l.FLAGS.BOLD&&(this._ctx.font=this._getFont(a,!0),8>k&&(k+=8)),B&l.FLAGS.UNDERLINE&&(this._ctx.fillStyle=k===e.INVERTED_DEFAULT_COLOR?this._colors.background:256>k?this._colors.ansi[k]:this._colors.foreground,this.fillBottomLineAtCells(f,b)),this.drawChar(a,n,h,q,f,b,k,u,!!(B&l.FLAGS.BOLD),!!(B&l.FLAGS.DIM)),this._ctx.restore())}}}};b.prototype.onOptionsChanged= -function(a){this.setTransparency(a,a.options.allowTransparency)};b.prototype._isOverlapping=function(a){if(1!==a[m.CHAR_DATA_WIDTH_INDEX]||256>a[m.CHAR_DATA_CODE_INDEX])return!1;a=a[m.CHAR_DATA_CHAR_INDEX];if(this._characterOverlapCache.hasOwnProperty(a))return this._characterOverlapCache[a];this._ctx.save();this._ctx.font=this._characterFont;var b=Math.floor(this._ctx.measureText(a).width)>this._characterWidth;this._ctx.restore();return this._characterOverlapCache[a]=b};b.prototype._clearChar=function(a, -b){var e=1,d=this._state.cache[a][b];d&&2===d[m.CHAR_DATA_WIDTH_INDEX]&&(e=2);this.clearCells(a,b,e,1)};return b}(e.BaseRenderLayer);d.TextRenderLayer=a},{"../Buffer":1,"./BaseRenderLayer":19,"./GridCache":23,"./Types":28}],28:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});a=d.FLAGS||(d.FLAGS={});a[a.BOLD=1]="BOLD";a[a.UNDERLINE=2]="UNDERLINE";a[a.BLINK=4]="BLINK";a[a.INVERSE=8]="INVERSE";a[a.INVISIBLE=16]="INVISIBLE";a[a.DIM=32]="DIM"},{}],29:[function(a,h,d){function f(a,e,d, -b){for(var g=0;gq;q++)e.save(),e.beginPath(),e.rect(q*b,0,b,k),e.clip(),e.fillText(String.fromCharCode(q),q*b,0),e.restore();e.save();e.font=m(g.fontWeightBold,g);for(q=0;256>q;q++)e.save(),e.beginPath(),e.rect(q*b,k,b,k),e.clip(),e.fillText(String.fromCharCode(q),q*b,k),e.restore();e.restore();e.font=m(g.fontWeight,g);for(var r=0;16>r;r++){8===r&&(e.font=m(g.fontWeightBold,g));var t=(r+ -2)*k;for(q=0;256>q;q++)e.save(),e.beginPath(),e.rect(q*b,t,b,k),e.clip(),e.fillStyle=g.ansiColors[r],e.fillText(String.fromCharCode(q),q*b,t),e.restore()}e.restore();if(!("createImageBitmap"in a)||l.isFirefox)return h instanceof HTMLCanvasElement?h:new Promise(function(a){return a(h.transferToImageBitmap())});b=e.getImageData(0,0,h.width,h.height);k=parseInt(g.background.substr(1,2),16);e=parseInt(g.background.substr(3,2),16);g=parseInt(g.background.substr(5,2),16);f(b,k,e,g);return a.createImageBitmap(b)}}, -{"./utils/Browser":30}],30:[function(a,h,d){Object.defineProperty(d,"__esModule",{value:!0});h=(a="undefined"===typeof navigator?!0:!1)?"node":navigator.userAgent;a=a?"node":navigator.platform;d.isFirefox=!!~h.indexOf("Firefox");d.isMSIE=!!~h.indexOf("MSIE")||!!~h.indexOf("Trident");h=0<=["Macintosh","MacIntel","MacPPC","Mac68K"].indexOf(a);d.isMac=h;d.isIpad="iPad"===a;d.isIphone="iPhone"===a;h=0<=["Windows","Win16","Win32","WinCE"].indexOf(a);d.isMSWindows=h;d.isLinux=0<=a.indexOf("Linux")},{}], -31:[function(a,h,d){var f=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])};return function(d,f){function e(){this.constructor=d}a(d,f);d.prototype=null===f?Object.create(f):(e.prototype=f.prototype,new e)}}();Object.defineProperty(d,"__esModule",{value:!0});a=function(a){function d(d,e){var g=a.call(this)||this;g._document=d;g._parentElement=e;g._measureElement= -g._document.createElement("span");g._measureElement.style.position="absolute";g._measureElement.style.top="0";g._measureElement.style.left="-9999em";g._measureElement.style.lineHeight="normal";g._measureElement.textContent="W";g._measureElement.setAttribute("aria-hidden","true");g._parentElement.appendChild(g._measureElement);return g}f(d,a);Object.defineProperty(d.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0});Object.defineProperty(d.prototype,"height",{get:function(){return this._height}, -enumerable:!0,configurable:!0});d.prototype.measure=function(a){this._measureElement.style.fontFamily=a.fontFamily;this._measureElement.style.fontSize=a.fontSize+"px";a=this._measureElement.getBoundingClientRect();0===a.width||0===a.height||this._width===a.width&&this._height===a.height||(this._width=a.width,this._height=Math.ceil(a.height),this.emit("charsizechanged"))};return d}(a("../EventEmitter").EventEmitter);d.CharMeasure=a},{"../EventEmitter":7}],32:[function(a,h,d){var f=this&&this.__extends|| -function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=d}||function(a,d){for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])};return function(d,f){function e(){this.constructor=d}a(d,f);d.prototype=null===f?Object.create(f):(e.prototype=f.prototype,new e)}}();Object.defineProperty(d,"__esModule",{value:!0});a=function(a){function d(d){var e=a.call(this)||this;e._maxLength=d;e._array=Array(e._maxLength);e._startIndex=0;e._length=0;return e}f(d,a);Object.defineProperty(d.prototype, -"maxLength",{get:function(){return this._maxLength},set:function(a){if(this._maxLength!==a){for(var e=Array(a),d=0;dthis._length)for(var e=this._length;e=a;b--)this._array[this._getCyclicIndex(b+d.length)]=this._array[this._getCyclicIndex(b)];for(b=0;bthis.maxLength?(d=this._length+d.length-this.maxLength,this._startIndex+=d,this._length=this.maxLength,this.emit("trim",d)):this._length+=d.length}};d.prototype.trimStart=function(a){a>this._length&&(a=this._length);this._startIndex+=a;this._length-=a;this.emit("trim",a)};d.prototype.shiftElements=function(a,e,d){if(!(0>=e)){if(0>a||a>=this._length)throw Error("start argument out of range");if(0>a+d)throw Error("Cannot shift elements in list beyond index 0");if(0this.maxLength;)this._length--,this._startIndex++,this.emit("trim",1)}else for(b=0;b>=1;for(;!(h=read_rng(a),h=String.fromCharCode(h[0].charCodeAt(0)&d)+h.substring(1),h=inflate_long(h,1),0c?a+Array(c-a.length+1).join("\x00"):a},get_int:function(){return struct.unpack("I",this.get_bytes(4))[0]},get_string:function(){return this.get_bytes(this.get_int())},get_mpint:function(){return inflate_long(this.get_string())},add_bytes:function(c){this.packet+=c;return this},add_boolean:function(c){this.add_bytes(!0=== -c?"\u0001":"\x00");return this},add_int:function(c){this.packet+=struct.pack("I",c);return this},add_mpint:function(c){this.add_string(deflate_long(c));return this},add_string:function(c){this.add_int(c.length);this.packet+=c;return this}};SSHyClient.parceler=function(c,a){this.socket=c;this.transport=a;this.encrypting=!1;this.hmacSHAVersion=this.inbound_iv=this.inbound_enc_key=this.inbound_mac_key=this.inbound_cipher=this.outbound_enc_iv=this.outbound_enc_key=this.outbound_mac_key=this.outbound_cipher=null;this.outbound_sequence_num=this.inbound_sequence_num=this.macSize=0;this.block_size=8;this.prevHeader=this.inbound_buffer="";this.windowSize=SSHyClient.WINDOW_SIZE;this.recieveData=this.transmitData=0}; -SSHyClient.parceler.prototype={send:function(c){packet=this.pack_message(c.toString());this.encrypting&&(packet=this.outbound_cipher.encrypt(packet)+SSHyClient.hash.HMAC(this.outbound_mac_key,struct.pack("I",this.outbound_sequence_num)+packet,this.hmacSHAVersion));this.socket.sendB64(packet);this.outbound_sequence_num++},pack_message:function(c){var a=3+this.block_size-(c.length+8)%this.block_size;c=struct.pack("I",c.length+a+1)+struct.pack("B",a)+c;return c+=this.encrypting?read_rng(a):Array(a+1).join("\x00")}, -handle:function(c){this.recieveData+=c.length;this.transport.settings.setNetTraffic(transport.parceler.recieveData,!0);if(this.encrypting)this.inbound_buffer+=c,this.decrypt();else if(this.transport.remote_version)this.inbound_buffer+=c,this.decrypt(c);else this.transport.handler_table[0](this.transport,c)},decrypt:function(){for(var c=" ",a;null!==c;){if(this.prevHeader)a=this.prevHeader,this.prevHeader="";else{a=this.read_ibuffer();if(!a)break;this.encrypting&&(a=this.inbound_cipher.decrypt(a))}var h= -struct.unpack("I",a.substring(0,4))[0],d=a.substring(4);c=this.read_ibuffer(h+this.macSize-d.length);if(!c){this.prevHeader=a;break}a=c.substring(0,h-d.length);this.encrypting&&(a=this.inbound_cipher.decrypt(a));a=d+a;if(this.macSize){d=c.substring(h-d.length);var f=struct.pack("I",this.inbound_sequence_num)+struct.pack("I",h)+a;if(SSHyClient.hash.HMAC(this.inbound_mac_key,f,this.hmacSHAVersion)!=d)throw this.transport.disconnect(),"Inbound MAC verification failed - Mismatched MAC";}this.inbound_sequence_num++; -this.windowSize-=h;0>=this.windowSize&&this.transport.winAdjust();this.transport.handle_dec(a)}},read_ibuffer:function(c){c=void 0===c?this.block_size:c;if(this.inbound_buffer.lengththis.shellString.length||(-1!==this.shellString.indexOf("]0;fish")?(this.shellString="",this.fsHintLeave=SSHyClient.fishFsHintLeave):-1!==this.shellString.indexOf("@")&&(this.shellString="",this.fsHintLeave= -SSHyClient.bashFsHintLeave)))},setLocalEcho:function(c){this.localEcho=Math.min(Math.max(this.localEcho+=c,0),2);document.getElementById("currentLEcho").innerHTML=["Force Off","Auto","Force On"][this.localEcho];c=document.getElementById("autoEchoState");1===this.localEcho?(c.style.visibility="visible",c.innerHTML="State: "+(!1===this.autoEchoState?"Disabled":"Enabled")):c.style.visibility="hidden"},parseLocalEcho:function(c){if(1===this.localEcho){var a=performance.now();if(!(100>a-this.autoEchoTimeout))if(c= -c.substring(0,64),!this.autoEchoState)-1!=c.indexOf(this.fsHintLeave)&&-1!=c.indexOf("@")&&(this.autoEchoState=!0,this.autoEchoElement.innerHTML="State: Enabled",this.autoEchoTimeout=a);else if(-1!=c.indexOf(this.fsHintEnter)||-1!=c.toLowerCase().indexOf("password"))this.autoEchoState=!1,this.autoEchoElement.innerHTML="State: Disabled",this.autoEchoTimeout=a}},parseKey:function(c){1===this.localEcho&&!1===this.autoEchoState||1i;i++)a.deleteRule(13);"Tango"=== -h?(this.colorTango=!0,document.getElementById("currentColor").innerHTML="Tango"):(a.insertRule("html, body {background-color: "+c.background+" !important;}",13),a.insertRule(".sidenav {background-color: "+modColorPercent(c.background,-.2)+" !important;}",13),a.insertRule(".brightgreen {color: "+c.brightGreen+" !important;}",13),a.insertRule(".brightyellow {color: "+c.brightYellow+" !important;}",13),this.colorTango=!1,document.getElementById("currentColor").innerHTML=void 0===h?"Custom":h)},importXresources:function(){var c= -new FileReader,a=document.getElementById("Xresources").files[0];c.readAsText(a);c.onload=function(){var h=c.result.split("\n");h=h.sort((new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})).compare);colScheme=[];for(var d=0;dthis.colorNames.length-1||0>this.colorCounter)this.colorCounter=1===c?0:this.colorNames.length-1;this.setColorScheme(this.colorCounter)},modFontSize:function(c){this.fontSize+=c;term.setOption("fontSize",this.fontSize);document.getElementById("currentFontSize").innerHTML= -transport.settings.fontSize+"px";term.fit();transport.auth.mod_pty("window-change",term.cols,term.rows)},modTerm:function(c,a){c?term.resize(term.cols,a):term.resize(a,term.rows);transport.auth.mod_pty("window-change",term.cols,term.rows)},setNetTraffic:function(c,a){if(this.sidenavElementState){switch(!0){case 1024>c:c+="Bytes";break;case 1024<=c&&1048576>c:c=(c/1024).toFixed(3)+"KB";break;case 1048576<=c&&1073741824>c:c=(c/1048576).toFixed(3)+"MB";break;default:c=(c/1073741824).toFixed(3)+"GB"}element= -!0===a?this.rxElement:this.txElement;element.innerHTML=c}}};SSHyClient.Transport=function(c,a){this.local_version="SSH-2.0-SSHyClient";this.remote_version="";this.remote_kex_message=this.local_kex_message=null;this.preferred_algorithms="diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha256,diffie-hellman-group1-sha1 ssh-rsa aes128-ctr hmac-sha2-256,hmac-sha1 none ".split(" ");this.preferred_hash=this.preferred_mac=this.preferred_kex=null;this.parceler= -new SSHyClient.parceler(c,this);this.auth=new SSHyClient.auth(this.parceler);this.settings=void 0===a?new SSHyClient.settings:a;this.lastKey="";this.closing=!1}; -SSHyClient.Transport.prototype={kex_info:{"diffie-hellman-group1-sha1":function(c){return new SSHyClient.kex.DiffieHellman(c,1,"SHA-1")},"diffie-hellman-group14-sha1":function(c){return new SSHyClient.kex.DiffieHellman(c,14,"SHA-1")},"diffie-hellman-group-exchange-sha1":function(c){return new SSHyClient.kex.DiffieHellman(c,void 0,"SHA-1")},"diffie-hellman-group1-sha256":function(c){return new SSHyClient.kex.DiffieHellman(c,1,"SHA-256")},"diffie-hellman-group14-sha256":function(c){return new SSHyClient.kex.DiffieHellman(c, -14,"SHA-256")},"diffie-hellman-group-exchange-sha256":function(c){return new SSHyClient.kex.DiffieHellman(c,void 0,"SHA-256")}},mac_info:{"hmac-sha1":function(c){c.parceler.hmacSHAVersion="SHA-1";c.preferred_hash=20},"hmac-sha2-256":function(c){c.parceler.hmacSHAVersion="SHA-256";c.preferred_hash=32}},handler_table:{0:function(c,a){c.parceler.socket.sendB64(c.local_version+"\r\n");c.remote_version=a.slice(0,a.length-2);c.send_kex_init()},1:function(c,a){c.disconnect()},2:function(c,a){},3:function(c, -a){},6:function(c,a){"ssh-userauth"==(new SSHyClient.Message(a.slice(1))).get_string()&&c.auth.ssh_connection()},20:function(c,a){c.parse_kex_reply(a);c.remote_kex_message=a;c.preferred_kex.start()},21:function(c){c.activate_encryption()},31:function(c,a){c.preferred_kex.parse_reply(31,a.slice(1))},33:function(c,a){c.preferred_kex.parse_reply(33,a.slice(1))},51:function(c,a){c.auth.awaitingAuthentication=!1;c.auth.authFailure()},52:function(c,a){c.auth.authenticated=!0;c.auth.awaitingAuthentication= -!1;c.auth.auth_success(!0)},80:function(c,a){},91:function(c,a){c.auth.channelOpened=!0;resize();c.auth.mod_pty("pty-req",term.cols,term.rows,"xterm")},93:function(c,a){},94:function(c,a){a=a.slice(9);if(c.settings.localEcho&&(c.settings.testShell(a),c.settings.parseLocalEcho(a),c.lastKey)){if(a==c.lastKey.substring(0,1)){c.lastKey=c.lastKey.slice(1);return}c.lastKey=c.lastKey.slice(1);term.write("\b")}term.write(fromUtf8(a))},96:function(c,a){},97:function(c,a){c.disconnect()},98:function(c,a){}}, -winAdjust:function(){var c=new SSHyClient.Message;c.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_WINDOW_ADJUST));c.add_int(0);c.add_int(SSHyClient.WINDOW_SIZE);this.send_packet(c.toString());this.parceler.windowSize=SSHyClient.WINDOW_SIZE},disconnect:function(c){this.closing=!0;c=void 0===c?11:c;var a=new SSHyClient.Message;a.add_bytes(String.fromCharCode(SSHyClient.MSG_DISCONNECT));a.add_int(c);this.send_packet(a.toString());ws.close();term.write("\r\nConnection to "+this.auth.hostname+" closed. Code - "+ -c)},keepAlive:function(){if(3!==ws.readyState){var c=new SSHyClient.Message;c.add_bytes(String.fromCharCode(SSHyClient.MSG_IGNORE));c.add_string("");transport.send_packet(c.toString())}},cut_padding:function(c){return c.substring(1,c.length-c[0].charCodeAt(0))},send_packet:function(c){this.parceler.send(c)},send_kex_init:function(){var c=new SSHyClient.Message;c.add_bytes(String.fromCharCode(SSHyClient.MSG_KEX_INIT));c.add_bytes(read_rng(16));c.add_string(this.preferred_algorithms[0]);c.add_string(this.preferred_algorithms[1]); -for(var a=2;6>a;a++)c.add_string(this.preferred_algorithms[a]),c.add_string(this.preferred_algorithms[a]);c.add_boolean(!1);c.add_int(0);this.local_kex_message=c=c.toString();this.send_packet(c)},parse_kex_reply:function(c){c=new SSHyClient.Message(c);c.get_bytes(17);var a=filter(this.preferred_algorithms[0],c.get_string().split(",")),h=filter(this.preferred_algorithms[1],c.get_string().split(","));c.get_string();var d=filter(this.preferred_algorithms[2],c.get_string().split(","));c.get_string(); -c=filter(this.preferred_algorithms[3],c.get_string().split(","));if(!(a&&h&&d&&c))throw"Chosen Algs = kex="+a+", keys="+h+", cipher="+d+", mac="+c;this.preferred_kex=this.kex_info[a](this);this.preferred_mac=this.mac_info[c](this)},generate_key:function(c,a){var h=new SSHyClient.Message;h.add_mpint(SSHyClient.kex.K);h.add_bytes(SSHyClient.kex.H);h.add_bytes(c);h.add_bytes(SSHyClient.kex.sessionId);return"SHA-1"==this.preferred_kex.SHAVersion?(new SSHyClient.hash.SHA1(h.toString())).digest().substring(0, -a):(new SSHyClient.hash.SHA256(h.toString())).digest().substring(0,a)},activate_encryption:function(){this.parceler.block_size=16;this.parceler.macSize=this.preferred_hash;this.parceler.outbound_enc_iv=this.generate_key("A",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.outbound_enc_key=this.generate_key("C",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.outbound_mac_key=this.generate_key("E",this.parceler.macSize,this.preferred_kex.SHAVersion);this.parceler.outbound_cipher= -new SSHyClient.crypto.AES(this.parceler.outbound_enc_key,SSHyClient.AES_CTR,this.parceler.outbound_enc_iv,new SSHyClient.crypto.counter(8*this.parceler.block_size,inflate_long(this.parceler.outbound_enc_iv)));this.parceler.inbound_enc_iv=this.generate_key("B",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.inbound_enc_key=this.generate_key("D",this.parceler.block_size,this.preferred_kex.SHAVersion);this.parceler.inbound_mac_key=this.generate_key("F",this.parceler.macSize,this.preferred_kex.SHAVersion); -this.parceler.inbound_cipher=new SSHyClient.crypto.AES(this.parceler.inbound_enc_key,SSHyClient.AES_CTR,this.parceler.inbound_enc_iv,new SSHyClient.crypto.counter(8*this.parceler.block_size,inflate_long(this.parceler.inbound_enc_iv)));this.parceler.encrypting=!0;this.auth.request_auth()},handle_dec:function(c){c=this.cut_padding(c);try{this.handler_table[c.substring(0,1).charCodeAt(0)](this,c)}catch(a){console.log(a),console.log("Error! code - "+c.substring(0,1).charCodeAt(0)+" does not exist!")}}, -str_to_bytes:function(c){return unescape(encodeURIComponent(c))},expect_key:function(c){if(c){var a=new SSHyClient.Message;a.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_DATA));a.add_int(0);a.add_string(this.str_to_bytes(c.toString()));this.parceler.send(a)}},send_new_keys:function(c){c=new SSHyClient.Message;c.add_bytes(String.fromCharCode(SSHyClient.MSG_NEW_KEYS));this.send_packet(c)}}; +SSHyClient = { + // Global Defines + MSG_DISCONNECT: 1, + MSG_IGNORE: 2, + MSG_UNIMPLEMENTED: 3, + MSG_DEBUG: 4, + MSG_SERVICE_REQUEST: 5, + MSG_SERVICE_ACCEPT: 6, + + MSG_KEX_INIT: 20, + MSG_NEW_KEYS: 21, + MSG_KEXDH_INIT: 30, + MSG_KEXDH_GEX_GROUP: 31, + MSG_KEXDH_GEX_INIT: 32, + MSG_KEXDH_GEX_REPLY: 33, + MSG_KEXDH_GEX_REQUEST: 34, + + MSG_USERAUTH_REQUEST: 50, + MSG_USERAUTH_FAILURE: 51, + MSG_USERAUTH_SUCCESS: 52, + MSG_USERAUTH_BANNER: 53, + + MSG_GLOBAL_REQUEST: 80, + MSG_REQUEST_SUCCESS: 81, + MSG_REQUEST_FAILURE: 82, + + MSG_CHANNEL_OPEN: 90, + MSG_CHANNEL_OPEN_SUCCESS: 91, + MSG_CHANNEL_OPEN_FAILURE: 92, + MSG_CHANNEL_WINDOW_ADJUST: 93, + MSG_CHANNEL_DATA: 94, + MSG_CHANNEL_EXTENDED_DATA: 95, + MSG_CHANNEL_EOF: 96, + MSG_CHANNEL_CLOSE: 97, + MSG_CHANNEL_REQUEST: 98, + MSG_CHANNEL_SUCCESS: 99, + MSG_CHANNEL_FAILURE: 100, + + WINDOW_SIZE: 40674, // Coppied from Putty + MAX_PACKET_SIZE: 16384, + + AES_CBC: 2, + AES_CTR: 6, + + /* Fish Binding */ + fishFsHintLeave: "\x1b\x5b\x33\x32", + /* Bash Binding */ + bashFsHintLeave: "\x1b\x5d\x30\x3b" +}; +var BigInteger = function() { + function e(a, b, c) { + null != a && ("number" == typeof a ? this.fromNumber(a, b, c) : null == b && "string" != typeof a ? this.fromString(a, 256) : this.fromString(a, b)) + } + + function l() { + return new e(null) + } + + function F(a, b, c, d, k, e) { + for (; 0 <= --e;) { + var f = b * this[a++] + c[d] + k; + k = Math.floor(f / 67108864); + c[d++] = f & 67108863 + } + return k + } + + function G(a, b, c, d, k, e) { + var f = b & 32767; + for (b >>= 15; 0 <= --e;) { + var g = this[a] & 32767, + l = this[a++] >> 15, + m = b * g + l * f, + g = f * g + ((m & 32767) << 15) + c[d] + (k & 1073741823); + k = (g >>> 30) + (m >>> 15) + b * l + (k >>> 30); + c[d++] = + g & 1073741823 + } + return k + } + + function H(a, b, c, d, k, e) { + var f = b & 16383; + for (b >>= 14; 0 <= --e;) { + var g = this[a] & 16383, + l = this[a++] >> 14, + m = b * g + l * f, + g = f * g + ((m & 16383) << 14) + c[d] + k; + k = (g >> 28) + (m >> 14) + b * l; + c[d++] = g & 268435455 + } + return k + } + + function B(a, b) { + var c = y[a.charCodeAt(b)]; + return null == c ? -1 : c + } + + function t(a) { + var b = l(); + b.fromInt(a); + return b + } + + function z(a) { + var b = 1, + c; + 0 != (c = a >>> 16) && (a = c, b += 16); + 0 != (c = a >> 8) && (a = c, b += 8); + 0 != (c = a >> 4) && (a = c, b += 4); + 0 != (c = a >> 2) && (a = c, b += 2); + 0 != a >> 1 && (b += 1); + return b + } + + function u(a) { + this.m = a + } + + function w(a) { + this.m = + a; + this.mp = a.invDigit(); + this.mpl = this.mp & 32767; + this.mph = this.mp >> 15; + this.um = (1 << a.DB - 15) - 1; + this.mt2 = 2 * a.t + } + + function I(a, b) { + return a & b + } + + function A(a, b) { + return a | b + } + + function C(a, b) { + return a ^ b + } + + function D(a, b) { + return a & ~b + } + + function v() {} + + function E(a) { + return a + } + + function x(a) { + this.r2 = l(); + this.q3 = l(); + e.ONE.dlShiftTo(2 * a.t, this.r2); + this.mu = this.r2.divide(a); + this.m = a + } + var m; + "Microsoft Internet Explorer" == navigator.appName ? (e.prototype.am = G, m = 30) : "Netscape" != navigator.appName ? (e.prototype.am = F, m = 26) : (e.prototype.am = + H, m = 28); + e.prototype.DB = m; + e.prototype.DM = (1 << m) - 1; + e.prototype.DV = 1 << m; + e.prototype.FV = Math.pow(2, 52); + e.prototype.F1 = 52 - m; + e.prototype.F2 = 2 * m - 52; + var y = [], + n; + m = 48; + for (n = 0; 9 >= n; ++n) y[m++] = n; + m = 97; + for (n = 10; 36 > n; ++n) y[m++] = n; + m = 65; + for (n = 10; 36 > n; ++n) y[m++] = n; + u.prototype.convert = function(a) { + return 0 > a.s || 0 <= a.compareTo(this.m) ? a.mod(this.m) : a + }; + u.prototype.revert = function(a) { + return a + }; + u.prototype.reduce = function(a) { + a.divRemTo(this.m, null, a) + }; + u.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c); + this.reduce(c) + }; + u.prototype.sqrTo = + function(a, b) { + a.squareTo(b); + this.reduce(b) + }; + w.prototype.convert = function(a) { + var b = l(); + a.abs().dlShiftTo(this.m.t, b); + b.divRemTo(this.m, null, b); + 0 > a.s && 0 < b.compareTo(e.ZERO) && this.m.subTo(b, b); + return b + }; + w.prototype.revert = function(a) { + var b = l(); + a.copyTo(b); + this.reduce(b); + return b + }; + w.prototype.reduce = function(a) { + for (; a.t <= this.mt2;) a[a.t++] = 0; + for (var b = 0; b < this.m.t; ++b) { + var c = a[b] & 32767, + d = c * this.mpl + ((c * this.mph + (a[b] >> 15) * this.mpl & this.um) << 15) & a.DM, + c = b + this.m.t; + for (a[c] += this.m.am(0, d, a, b, 0, this.m.t); a[c] >= + a.DV;) a[c] -= a.DV, a[++c]++ + } + a.clamp(); + a.drShiftTo(this.m.t, a); + 0 <= a.compareTo(this.m) && a.subTo(this.m, a) + }; + w.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c); + this.reduce(c) + }; + w.prototype.sqrTo = function(a, b) { + a.squareTo(b); + this.reduce(b) + }; + e.prototype.copyTo = function(a) { + for (var b = this.t - 1; 0 <= b; --b) a[b] = this[b]; + a.t = this.t; + a.s = this.s + }; + e.prototype.fromInt = function(a) { + this.t = 1; + this.s = 0 > a ? -1 : 0; + 0 < a ? this[0] = a : -1 > a ? this[0] = a + DV : this.t = 0 + }; + e.prototype.fromString = function(a, b) { + var c; + if (16 == b) c = 4; + else if (8 == b) c = 3; + else if (256 == + b) c = 8; + else if (2 == b) c = 1; + else if (32 == b) c = 5; + else if (4 == b) c = 2; + else { + this.fromRadix(a, b); + return + } + this.s = this.t = 0; + for (var d = a.length, k = !1, f = 0; 0 <= --d;) { + var h = 8 == c ? a[d] & 255 : B(a, d); + 0 > h ? "-" == a.charAt(d) && (k = !0) : (k = !1, 0 == f ? this[this.t++] = h : f + c > this.DB ? (this[this.t - 1] |= (h & (1 << this.DB - f) - 1) << f, this[this.t++] = h >> this.DB - f) : this[this.t - 1] |= h << f, f += c, f >= this.DB && (f -= this.DB)) + } + 8 == c && 0 != (a[0] & 128) && (this.s = -1, 0 < f && (this[this.t - 1] |= (1 << this.DB - f) - 1 << f)); + this.clamp(); + k && e.ZERO.subTo(this, this) + }; + e.prototype.clamp = function() { + for (var a = + this.s & this.DM; 0 < this.t && this[this.t - 1] == a;) --this.t + }; + e.prototype.dlShiftTo = function(a, b) { + var c; + for (c = this.t - 1; 0 <= c; --c) b[c + a] = this[c]; + for (c = a - 1; 0 <= c; --c) b[c] = 0; + b.t = this.t + a; + b.s = this.s + }; + e.prototype.drShiftTo = function(a, b) { + for (var c = a; c < this.t; ++c) b[c - a] = this[c]; + b.t = Math.max(this.t - a, 0); + b.s = this.s + }; + e.prototype.lShiftTo = function(a, b) { + var c = a % this.DB, + d = this.DB - c, + e = (1 << d) - 1, + f = Math.floor(a / this.DB), + h = this.s << c & this.DM, + g; + for (g = this.t - 1; 0 <= g; --g) b[g + f + 1] = this[g] >> d | h, h = (this[g] & e) << c; + for (g = f - 1; 0 <= g; --g) b[g] = + 0; + b[f] = h; + b.t = this.t + f + 1; + b.s = this.s; + b.clamp() + }; + e.prototype.rShiftTo = function(a, b) { + b.s = this.s; + var c = Math.floor(a / this.DB); + if (c >= this.t) b.t = 0; + else { + var d = a % this.DB, + e = this.DB - d, + f = (1 << d) - 1; + b[0] = this[c] >> d; + for (var h = c + 1; h < this.t; ++h) b[h - c - 1] |= (this[h] & f) << e, b[h - c] = this[h] >> d; + 0 < d && (b[this.t - c - 1] |= (this.s & f) << e); + b.t = this.t - c; + b.clamp() + } + }; + e.prototype.subTo = function(a, b) { + for (var c = 0, d = 0, e = Math.min(a.t, this.t); c < e;) d += this[c] - a[c], b[c++] = d & this.DM, d >>= this.DB; + if (a.t < this.t) { + for (d -= a.s; c < this.t;) d += this[c], b[c++] = + d & this.DM, d >>= this.DB; + d += this.s + } else { + for (d += this.s; c < a.t;) d -= a[c], b[c++] = d & this.DM, d >>= this.DB; + d -= a.s + } + b.s = 0 > d ? -1 : 0; - 1 > d ? b[c++] = this.DV + d : 0 < d && (b[c++] = d); + b.t = c; + b.clamp() + }; + e.prototype.multiplyTo = function(a, b) { + var c = this.abs(), + d = a.abs(), + k = c.t; + for (b.t = k + d.t; 0 <= --k;) b[k] = 0; + for (k = 0; k < d.t; ++k) b[k + c.t] = c.am(0, d[k], b, k, 0, c.t); + b.s = 0; + b.clamp(); + this.s != a.s && e.ZERO.subTo(b, b) + }; + e.prototype.squareTo = function(a) { + for (var b = this.abs(), c = a.t = 2 * b.t; 0 <= --c;) a[c] = 0; + for (c = 0; c < b.t - 1; ++c) { + var d = b.am(c, b[c], a, 2 * c, 0, 1); + (a[c + + b.t] += b.am(c + 1, 2 * b[c], a, 2 * c + 1, d, b.t - c - 1)) >= b.DV && (a[c + b.t] -= b.DV, a[c + b.t + 1] = 1) + } + 0 < a.t && (a[a.t - 1] += b.am(c, b[c], a, 2 * c, 0, 1)); + a.s = 0; + a.clamp() + }; + e.prototype.divRemTo = function(a, b, c) { + var d = a.abs(); + if (!(0 >= d.t)) { + var k = this.abs(); + if (k.t < d.t) null != b && b.fromInt(0), null != c && this.copyTo(c); + else { + null == c && (c = l()); + var f = l(), + h = this.s; + a = a.s; + var g = this.DB - z(d[d.t - 1]); + 0 < g ? (d.lShiftTo(g, f), k.lShiftTo(g, c)) : (d.copyTo(f), k.copyTo(c)); + d = f.t; + k = f[d - 1]; + if (0 != k) { + var m = k * (1 << this.F1) + (1 < d ? f[d - 2] >> this.F2 : 0), + p = this.FV / m, + m = (1 << + this.F1) / m, + n = 1 << this.F2, + r = c.t, + t = r - d, + q = null == b ? l() : b; + f.dlShiftTo(t, q); + 0 <= c.compareTo(q) && (c[c.t++] = 1, c.subTo(q, c)); + e.ONE.dlShiftTo(d, q); + for (q.subTo(f, f); f.t < d;) f[f.t++] = 0; + for (; 0 <= --t;) { + var u = c[--r] == k ? this.DM : Math.floor(c[r] * p + (c[r - 1] + n) * m); + if ((c[r] += f.am(0, u, c, t, 0, d)) < u) + for (f.dlShiftTo(t, q), c.subTo(q, c); c[r] < --u;) c.subTo(q, c) + } + null != b && (c.drShiftTo(d, b), h != a && e.ZERO.subTo(b, b)); + c.t = d; + c.clamp(); + 0 < g && c.rShiftTo(g, c); + 0 > h && e.ZERO.subTo(c, c) + } + } + } + }; + e.prototype.invDigit = function() { + if (1 > this.t) return 0; + var a = + this[0]; + if (0 == (a & 1)) return 0; + var b = a & 3, + b = b * (2 - (a & 15) * b) & 15, + b = b * (2 - (a & 255) * b) & 255, + b = b * (2 - ((a & 65535) * b & 65535)) & 65535, + b = b * (2 - a * b % this.DV) % this.DV; + return 0 < b ? this.DV - b : -b + }; + e.prototype.isEven = function() { + return 0 == (0 < this.t ? this[0] & 1 : this.s) + }; + e.prototype.exp = function(a, b) { + if (4294967295 < a || 1 > a) return e.ONE; + var c = l(), + d = l(), + k = b.convert(this), + f = z(a) - 1; + for (k.copyTo(c); 0 <= --f;) + if (b.sqrTo(c, d), 0 < (a & 1 << f)) b.mulTo(d, k, c); + else var h = c, + c = d, + d = h; + return b.revert(c) + }; + e.prototype.toString = function(a) { + if (0 > this.s) return "-" + + this.negate().toString(a); + if (16 == a) a = 4; + else if (8 == a) a = 3; + else if (2 == a) a = 1; + else if (32 == a) a = 5; + else if (4 == a) a = 2; + else return this.toRadix(a); + var b = (1 << a) - 1, + c, d = !1, + e = "", + f = this.t, + h = this.DB - f * this.DB % a; + if (0 < f--) + for (h < this.DB && 0 < (c = this[f] >> h) && (d = !0, e = "0123456789abcdefghijklmnopqrstuvwxyz".charAt(c)); 0 <= f;) h < a ? (c = (this[f] & (1 << h) - 1) << a - h, c |= this[--f] >> (h += this.DB - a)) : (c = this[f] >> (h -= a) & b, 0 >= h && (h += this.DB, --f)), 0 < c && (d = !0), d && (e += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(c)); + return d ? e : "0" + }; + e.prototype.negate = + function() { + var a = l(); + e.ZERO.subTo(this, a); + return a + }; + e.prototype.abs = function() { + return 0 > this.s ? this.negate() : this + }; + e.prototype.compareTo = function(a) { + var b = this.s - a.s; + if (0 != b) return b; + var c = this.t, + b = c - a.t; + if (0 != b) return b; + for (; 0 <= --c;) + if (0 != (b = this[c] - a[c])) return b; + return 0 + }; + e.prototype.bitLength = function() { + return 0 >= this.t ? 0 : this.DB * (this.t - 1) + z(this[this.t - 1] ^ this.s & this.DM) + }; + e.prototype.mod = function(a) { + var b = l(); + this.abs().divRemTo(a, null, b); + 0 > this.s && 0 < b.compareTo(e.ZERO) && a.subTo(b, b); + return b + }; + e.prototype.modPowInt = function(a, b) { + var c; + c = 256 > a || b.isEven() ? new u(b) : new w(b); + return this.exp(a, c) + }; + e.ZERO = t(0); + e.ONE = t(1); + v.prototype.convert = E; + v.prototype.revert = E; + v.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c) + }; + v.prototype.sqrTo = function(a, b) { + a.squareTo(b) + }; + x.prototype.convert = function(a) { + if (0 > a.s || a.t > 2 * this.m.t) return a.mod(this.m); + if (0 > a.compareTo(this.m)) return a; + var b = l(); + a.copyTo(b); + this.reduce(b); + return b + }; + x.prototype.revert = function(a) { + return a + }; + x.prototype.reduce = function(a) { + a.drShiftTo(this.m.t - + 1, this.r2); + a.t > this.m.t + 1 && (a.t = this.m.t + 1, a.clamp()); + this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); + for (this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); 0 > a.compareTo(this.r2);) a.dAddOffset(1, this.m.t + 1); + for (a.subTo(this.r2, a); 0 <= a.compareTo(this.m);) a.subTo(this.m, a) + }; + x.prototype.mulTo = function(a, b, c) { + a.multiplyTo(b, c); + this.reduce(c) + }; + x.prototype.sqrTo = function(a, b) { + a.squareTo(b); + this.reduce(b) + }; + var p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, + 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509 + ], + J = 67108864 / p[p.length - 1]; + e.prototype.chunkSize = function(a) { + return Math.floor(Math.LN2 * this.DB / Math.log(a)) + }; + e.prototype.toRadix = function(a) { + null == a && (a = 10); + if (0 == this.signum() || 2 > a || 36 < a) return "0"; + var b = this.chunkSize(a), + b = Math.pow(a, + b), + c = t(b), + d = l(), + e = l(), + f = ""; + for (this.divRemTo(c, d, e); 0 < d.signum();) f = (b + e.intValue()).toString(a).substr(1) + f, d.divRemTo(c, d, e); + return e.intValue().toString(a) + f + }; + e.prototype.fromRadix = function(a, b) { + this.fromInt(0); + null == b && (b = 10); + for (var c = this.chunkSize(b), d = Math.pow(b, c), k = !1, f = 0, h = 0, g = 0; g < a.length; ++g) { + var l = B(a, g); + 0 > l ? "-" == a.charAt(g) && 0 == this.signum() && (k = !0) : (h = b * h + l, ++f >= c && (this.dMultiply(d), this.dAddOffset(h, 0), h = f = 0)) + } + 0 < f && (this.dMultiply(Math.pow(b, f)), this.dAddOffset(h, 0)); + k && e.ZERO.subTo(this, + this) + }; + e.prototype.fromNumber = function(a, b, c) { + if ("number" == typeof b) + if (2 > a) this.fromInt(1); + else + for (this.fromNumber(a, c), this.testBit(a - 1) || this.bitwiseTo(e.ONE.shiftLeft(a - 1), A, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(b);) this.dAddOffset(2, 0), this.bitLength() > a && this.subTo(e.ONE.shiftLeft(a - 1), this); + else { + c = []; + var d = a & 7; + c.length = (a >> 3) + 1; + b.nextBytes(c); + c[0] = 0 < d ? c[0] & (1 << d) - 1 : 0; + this.fromString(c, 256) + } + }; + e.prototype.bitwiseTo = function(a, b, c) { + var d, e, f = Math.min(a.t, this.t); + for (d = + 0; d < f; ++d) c[d] = b(this[d], a[d]); + if (a.t < this.t) { + e = a.s & this.DM; + for (d = f; d < this.t; ++d) c[d] = b(this[d], e); + c.t = this.t + } else { + e = this.s & this.DM; + for (d = f; d < a.t; ++d) c[d] = b(e, a[d]); + c.t = a.t + } + c.s = b(this.s, a.s); + c.clamp() + }; + e.prototype.changeBit = function(a, b) { + var c = e.ONE.shiftLeft(a); + this.bitwiseTo(c, b, c); + return c + }; + e.prototype.addTo = function(a, b) { + for (var c = 0, d = 0, e = Math.min(a.t, this.t); c < e;) d += this[c] + a[c], b[c++] = d & this.DM, d >>= this.DB; + if (a.t < this.t) { + for (d += a.s; c < this.t;) d += this[c], b[c++] = d & this.DM, d >>= this.DB; + d += this.s + } else { + for (d += + this.s; c < a.t;) d += a[c], b[c++] = d & this.DM, d >>= this.DB; + d += a.s + } + b.s = 0 > d ? -1 : 0; + 0 < d ? b[c++] = d : -1 > d && (b[c++] = this.DV + d); + b.t = c; + b.clamp() + }; + e.prototype.dMultiply = function(a) { + this[this.t] = this.am(0, a - 1, this, 0, 0, this.t); + ++this.t; + this.clamp() + }; + e.prototype.dAddOffset = function(a, b) { + if (0 != a) { + for (; this.t <= b;) this[this.t++] = 0; + for (this[b] += a; this[b] >= this.DV;) this[b] -= this.DV, ++b >= this.t && (this[this.t++] = 0), ++this[b] + } + }; + e.prototype.multiplyLowerTo = function(a, b, c) { + var d = Math.min(this.t + a.t, b); + c.s = 0; + for (c.t = d; 0 < d;) c[--d] = + 0; + var e; + for (e = c.t - this.t; d < e; ++d) c[d + this.t] = this.am(0, a[d], c, d, 0, this.t); + for (e = Math.min(a.t, b); d < e; ++d) this.am(0, a[d], c, d, 0, b - d); + c.clamp() + }; + e.prototype.multiplyUpperTo = function(a, b, c) { + --b; + var d = c.t = this.t + a.t - b; + for (c.s = 0; 0 <= --d;) c[d] = 0; + for (d = Math.max(b - this.t, 0); d < a.t; ++d) c[this.t + d - b] = this.am(b - d, a[d], c, 0, 0, this.t + d - b); + c.clamp(); + c.drShiftTo(1, c) + }; + e.prototype.modInt = function(a) { + if (0 >= a) return 0; + var b = this.DV % a, + c = 0 > this.s ? a - 1 : 0; + if (0 < this.t) + if (0 == b) c = this[0] % a; + else + for (var d = this.t - 1; 0 <= d; --d) c = (b * + c + this[d]) % a; + return c + }; + e.prototype.millerRabin = function(a) { + var b = this.subtract(e.ONE), + c = b.getLowestSetBit(); + if (0 >= c) return !1; + var d = b.shiftRight(c); + a = a + 1 >> 1; + a > p.length && (a = p.length); + for (var k = l(), f = 0; f < a; ++f) { + k.fromInt(p[f]); + var h = k.modPow(d, this); + if (0 != h.compareTo(e.ONE) && 0 != h.compareTo(b)) { + for (var g = 1; g++ < c && 0 != h.compareTo(b);) + if (h = h.modPowInt(2, this), 0 == h.compareTo(e.ONE)) return !1; + if (0 != h.compareTo(b)) return !1 + } + } + return !0 + }; + e.prototype.clone = function() { + var a = l(); + this.copyTo(a); + return a + }; + e.prototype.intValue = + function() { + if (0 > this.s) { + if (1 == this.t) return this[0] - this.DV; + if (0 == this.t) return -1 + } else { + if (1 == this.t) return this[0]; + if (0 == this.t) return 0 + } + return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0] + }; + e.prototype.byteValue = function() { + return 0 == this.t ? this.s : this[0] << 24 >> 24 + }; + e.prototype.shortValue = function() { + return 0 == this.t ? this.s : this[0] << 16 >> 16 + }; + e.prototype.signum = function() { + return 0 > this.s ? -1 : 0 >= this.t || 1 == this.t && 0 >= this[0] ? 0 : 1 + }; + e.prototype.toByteArray = function() { + var a = this.t, + b = []; + b[0] = this.s; + var c = this.DB - + a * this.DB % 8, + d, e = 0; + if (0 < a--) + for (c < this.DB && (d = this[a] >> c) != (this.s & this.DM) >> c && (b[e++] = d | this.s << this.DB - c); 0 <= a;) + if (8 > c ? (d = (this[a] & (1 << c) - 1) << 8 - c, d |= this[--a] >> (c += this.DB - 8)) : (d = this[a] >> (c -= 8) & 255, 0 >= c && (c += this.DB, --a)), 0 != (d & 128) && (d |= -256), 0 == e && (this.s & 128) != (d & 128) && ++e, 0 < e || d != this.s) b[e++] = d; + return b + }; + e.prototype.equals = function(a) { + return 0 == this.compareTo(a) + }; + e.prototype.min = function(a) { + return 0 > this.compareTo(a) ? this : a + }; + e.prototype.max = function(a) { + return 0 < this.compareTo(a) ? this : a + }; + e.prototype.and = + function(a) { + var b = l(); + this.bitwiseTo(a, I, b); + return b + }; + e.prototype.or = function(a) { + var b = l(); + this.bitwiseTo(a, A, b); + return b + }; + e.prototype.xor = function(a) { + var b = l(); + this.bitwiseTo(a, C, b); + return b + }; + e.prototype.andNot = function(a) { + var b = l(); + this.bitwiseTo(a, D, b); + return b + }; + e.prototype.not = function() { + for (var a = l(), b = 0; b < this.t; ++b) a[b] = this.DM & ~this[b]; + a.t = this.t; + a.s = ~this.s; + return a + }; + e.prototype.shiftLeft = function(a) { + var b = l(); + 0 > a ? this.rShiftTo(-a, b) : this.lShiftTo(a, b); + return b + }; + e.prototype.shiftRight = function(a) { + var b = + l(); + 0 > a ? this.lShiftTo(-a, b) : this.rShiftTo(a, b); + return b + }; + e.prototype.getLowestSetBit = function() { + for (var a = 0; a < this.t; ++a) + if (0 != this[a]) { + var b = a * this.DB; + a = this[a]; + if (0 == a) a = -1; + else { + var c = 0; + 0 == (a & 65535) && (a >>= 16, c += 16); + 0 == (a & 255) && (a >>= 8, c += 8); + 0 == (a & 15) && (a >>= 4, c += 4); + 0 == (a & 3) && (a >>= 2, c += 2); + 0 == (a & 1) && ++c; + a = c + } + return b + a + } + return 0 > this.s ? this.t * this.DB : -1 + }; + e.prototype.bitCount = function() { + for (var a = 0, b = this.s & this.DM, c = 0; c < this.t; ++c) { + for (var d = this[c] ^ b, e = 0; 0 != d;) d &= d - 1, ++e; + a += e + } + return a + }; + e.prototype.testBit = + function(a) { + var b = Math.floor(a / this.DB); + return b >= this.t ? 0 != this.s : 0 != (this[b] & 1 << a % this.DB) + }; + e.prototype.setBit = function(a) { + return this.changeBit(a, A) + }; + e.prototype.clearBit = function(a) { + return this.changeBit(a, D) + }; + e.prototype.flipBit = function(a) { + return this.changeBit(a, C) + }; + e.prototype.add = function(a) { + var b = l(); + this.addTo(a, b); + return b + }; + e.prototype.subtract = function(a) { + var b = l(); + this.subTo(a, b); + return b + }; + e.prototype.multiply = function(a) { + var b = l(); + this.multiplyTo(a, b); + return b + }; + e.prototype.divide = function(a) { + var b = + l(); + this.divRemTo(a, b, null); + return b + }; + e.prototype.remainder = function(a) { + var b = l(); + this.divRemTo(a, null, b); + return b + }; + e.prototype.divideAndRemainder = function(a) { + var b = l(), + c = l(); + this.divRemTo(a, b, c); + return [b, c] + }; + e.prototype.modPow = function(a, b) { + var c = a.bitLength(), + d, e = t(1), + f; + if (0 >= c) return e; + d = 18 > c ? 1 : 48 > c ? 3 : 144 > c ? 4 : 768 > c ? 5 : 6; + f = 8 > c ? new u(b) : b.isEven() ? new x(b) : new w(b); + var h = [], + g = 3, + m = d - 1, + p = (1 << d) - 1; + h[1] = f.convert(this); + if (1 < d) + for (c = l(), f.sqrTo(h[1], c); g <= p;) h[g] = l(), f.mulTo(c, h[g - 2], h[g]), g += 2; + for (var n = + a.t - 1, r, v = !0, q = l(), c = z(a[n]) - 1; 0 <= n;) { + c >= m ? r = a[n] >> c - m & p : (r = (a[n] & (1 << c + 1) - 1) << m - c, 0 < n && (r |= a[n - 1] >> this.DB + c - m)); + for (g = d; 0 == (r & 1);) r >>= 1, --g; + 0 > (c -= g) && (c += this.DB, --n); + if (v) h[r].copyTo(e), v = !1; + else { + for (; 1 < g;) f.sqrTo(e, q), f.sqrTo(q, e), g -= 2; + 0 < g ? f.sqrTo(e, q) : (g = e, e = q, q = g); + f.mulTo(q, h[r], e) + } + for (; 0 <= n && 0 == (a[n] & 1 << c);) f.sqrTo(e, q), g = e, e = q, q = g, 0 > --c && (c = this.DB - 1, --n) + } + return f.revert(e) + }; + e.prototype.modInverse = function(a) { + var b = a.isEven(); + if (this.isEven() && b || 0 == a.signum()) return e.ZERO; + for (var c = a.clone(), + d = this.clone(), k = t(1), f = t(0), h = t(0), g = t(1); 0 != c.signum();) { + for (; c.isEven();) c.rShiftTo(1, c), b ? (k.isEven() && f.isEven() || (k.addTo(this, k), f.subTo(a, f)), k.rShiftTo(1, k)) : f.isEven() || f.subTo(a, f), f.rShiftTo(1, f); + for (; d.isEven();) d.rShiftTo(1, d), b ? (h.isEven() && g.isEven() || (h.addTo(this, h), g.subTo(a, g)), h.rShiftTo(1, h)) : g.isEven() || g.subTo(a, g), g.rShiftTo(1, g); + 0 <= c.compareTo(d) ? (c.subTo(d, c), b && k.subTo(h, k), f.subTo(g, f)) : (d.subTo(c, d), b && h.subTo(k, h), g.subTo(f, g)) + } + if (0 != d.compareTo(e.ONE)) return e.ZERO; + if (0 <= g.compareTo(a)) return g.subtract(a); + if (0 > g.signum()) g.addTo(a, g); + else return g; + return 0 > g.signum() ? g.add(a) : g + }; + e.prototype.pow = function(a) { + return this.exp(a, new v) + }; + e.prototype.gcd = function(a) { + var b = 0 > this.s ? this.negate() : this.clone(); + a = 0 > a.s ? a.negate() : a.clone(); + if (0 > b.compareTo(a)) { + var c = b, + b = a; + a = c + } + var c = b.getLowestSetBit(), + d = a.getLowestSetBit(); + if (0 > d) return b; + c < d && (d = c); + 0 < d && (b.rShiftTo(d, b), a.rShiftTo(d, a)); + for (; 0 < b.signum();) 0 < (c = b.getLowestSetBit()) && b.rShiftTo(c, b), 0 < (c = a.getLowestSetBit()) && + a.rShiftTo(c, a), 0 <= b.compareTo(a) ? (b.subTo(a, b), b.rShiftTo(1, b)) : (a.subTo(b, a), a.rShiftTo(1, a)); + 0 < d && a.lShiftTo(d, a); + return a + }; + e.prototype.isProbablePrime = function(a) { + var b, c = this.abs(); + if (1 == c.t && c[0] <= p[p.length - 1]) { + for (b = 0; b < p.length; ++b) + if (c[0] == p[b]) return !0; + return !1 + } + if (c.isEven()) return !1; + for (b = 1; b < p.length;) { + for (var d = p[b], e = b + 1; e < p.length && d < J;) d *= p[e++]; + for (d = c.modInt(d); b < e;) + if (0 == d % p[b++]) return !1 + } + return c.millerRabin(a) + }; + return { + BigInteger: e + } + }(), + BigInteger = BigInteger.BigInteger; +SSHyClient.hash = {}; + +SSHyClient.hash.SHA1 = function(a) { + this.data = a || ""; + this.digest_size = 20 +}; +SSHyClient.hash.SHA1.prototype = { + digest: function() { + var a = toByteArray(this.data), + h = bytesToWords(a), + f = 8 * a.length, + a = [], + g = 1732584193, + c = -271733879, + d = -1732584194, + e = 271733878, + k = -1009589776; + h[f >> 5] |= 128 << 24 - f % 32; + h[(f + 64 >>> 9 << 4) + 15] = f; + for (f = 0; f < h.length; f += 16) { + for (var m = g, n = c, p = d, q = e, r = k, b = 0; 80 > b; b++) { + if (16 > b) a[b] = h[f + b]; + else { + var l = a[b - 3] ^ a[b - 8] ^ a[b - 14] ^ a[b - 16]; + a[b] = l << 1 | l >>> 31 + } + l = (g << 5 | g >>> 27) + k + (a[b] >>> 0) + (20 > b ? (c & d | ~c & e) + 1518500249 : 40 > b ? (c ^ d ^ e) + 1859775393 : 60 > b ? (c & d | c & e | d & e) - 1894007588 : (c ^ d ^ e) - 899497514); + k = e; + e = d; + d = c << 30 | c >>> 2; + c = g; + g = l + } + g += m; + c += n; + d += p; + e += q; + k += r + } + return fromByteArray(wordsToBytes([g, c, d, e, k])) + } +}; + +SSHyClient.hash.SHA256 = function(a) { + this.data = a || "" + this.digest_size = 32 +} +SSHyClient.hash.SHA256.prototype = { + digest: function() { + var hashData = toByteArray(this.data); + + // Constants + var K = [ 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 ]; + + var m = bytesToWords(hashData), + l = hashData.length * 8, + H = [ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ], + w = [], + a, b, c, d, e, f, g, h, i, j, + t1, t2; + + // Padding + m[l >> 5] |= 0x80 << (24 - l % 32); + m[((l + 64 >> 9) << 4) + 15] = l; + + for (var i = 0; i < m.length; i += 16) { + a = H[0]; + b = H[1]; + c = H[2]; + d = H[3]; + e = H[4]; + f = H[5]; + g = H[6]; + h = H[7]; + + for (var j = 0; j < 64; j++) { + if (j < 16) { + w[j] = m[j + i]; + } else { + var gamma0x = w[j - 15], + gamma1x = w[j - 2], + gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ + ((gamma0x << 14) | (gamma0x >>> 18)) ^ + (gamma0x >>> 3), + gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ + ((gamma1x << 13) | (gamma1x >>> 19)) ^ + (gamma1x >>> 10); + + w[j] = gamma0 + (w[j - 7] >>> 0) + + gamma1 + (w[j - 16] >>> 0); + } + + var ch = e & f ^ ~e & g, + maj = a & b ^ a & c ^ b & c, + sigma0 = ((a << 30) | (a >>> 2)) ^ + ((a << 19) | (a >>> 13)) ^ + ((a << 10) | (a >>> 22)), + sigma1 = ((e << 26) | (e >>> 6)) ^ + ((e << 21) | (e >>> 11)) ^ + ((e << 7) | (e >>> 25)); + + t1 = (h >>> 0) + sigma1 + ch + (K[j]) + (w[j] >>> 0); + t2 = sigma0 + maj; + + h = g; + g = f; + f = e; + e = (d + t1) >>> 0; + d = c; + c = b; + b = a; + a = (t1 + t2) >>> 0; + } + + H[0] += a; + H[1] += b; + H[2] += c; + H[3] += d; + H[4] += e; + H[5] += f; + H[6] += g; + H[7] += h; + } + + return fromByteArray(wordsToBytes(H)); + } + } + +SSHyClient.hash.HMAC = function(a, g, SHAVersion) { + var b = digestmod = SHAVersion == 'SHA-1' ? SSHyClient.hash.SHA1 : SSHyClient.hash.SHA256, + d = new b, + e = new b; + 64 < a.length && (a = (new b(a)).digest()); + a += Array(64 - a.length + 1).join("\x00"); + for (var b = toByteArray(a).slice(0), f = toByteArray(a).slice(0), c = 0; 64 > c; ++c) b[c] ^= 92, f[c] ^= 54; + d.data += fromByteArray(b) + e.data += fromByteArray(f); + e.data += g; + d.data += e.digest(); + return d.digest() +}; + +SSHyClient.hash.MD5 = function(data){ + var hashData = toByteArray(data); + + var m = bytesToWords(hashData), + l = hashData.length * 8, + a = 1732584193, + b = -271733879, + c = -1732584194, + d = 271733878; + + // Swap endian + for (var i = 0; i < m.length; i++) { + m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | + ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; + } + + // Padding + m[l >>> 5] |= 0x80 << (l % 32); + m[(((l + 64) >>> 9) << 4) + 14] = l; + + // Method shortcuts + var FF = function (a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + var GG = function (a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + var HH = function (a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + var II = function (a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; + return ((n << s) | (n >>> (32 - s))) + b; + }; + + for (var i = 0; i < m.length; i += 16) { + var aa = a, + bb = b, + cc = c, + dd = d; + + a = FF(a, b, c, d, m[i+ 0], 7, -680876936); + d = FF(d, a, b, c, m[i+ 1], 12, -389564586); + c = FF(c, d, a, b, m[i+ 2], 17, 606105819); + b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); + a = FF(a, b, c, d, m[i+ 4], 7, -176418897); + d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); + c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); + b = FF(b, c, d, a, m[i+ 7], 22, -45705983); + a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); + d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); + c = FF(c, d, a, b, m[i+10], 17, -42063); + b = FF(b, c, d, a, m[i+11], 22, -1990404162); + a = FF(a, b, c, d, m[i+12], 7, 1804603682); + d = FF(d, a, b, c, m[i+13], 12, -40341101); + c = FF(c, d, a, b, m[i+14], 17, -1502002290); + b = FF(b, c, d, a, m[i+15], 22, 1236535329); + + a = GG(a, b, c, d, m[i+ 1], 5, -165796510); + d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); + c = GG(c, d, a, b, m[i+11], 14, 643717713); + b = GG(b, c, d, a, m[i+ 0], 20, -373897302); + a = GG(a, b, c, d, m[i+ 5], 5, -701558691); + d = GG(d, a, b, c, m[i+10], 9, 38016083); + c = GG(c, d, a, b, m[i+15], 14, -660478335); + b = GG(b, c, d, a, m[i+ 4], 20, -405537848); + a = GG(a, b, c, d, m[i+ 9], 5, 568446438); + d = GG(d, a, b, c, m[i+14], 9, -1019803690); + c = GG(c, d, a, b, m[i+ 3], 14, -187363961); + b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); + a = GG(a, b, c, d, m[i+13], 5, -1444681467); + d = GG(d, a, b, c, m[i+ 2], 9, -51403784); + c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); + b = GG(b, c, d, a, m[i+12], 20, -1926607734); + + a = HH(a, b, c, d, m[i+ 5], 4, -378558); + d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); + c = HH(c, d, a, b, m[i+11], 16, 1839030562); + b = HH(b, c, d, a, m[i+14], 23, -35309556); + a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); + d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); + c = HH(c, d, a, b, m[i+ 7], 16, -155497632); + b = HH(b, c, d, a, m[i+10], 23, -1094730640); + a = HH(a, b, c, d, m[i+13], 4, 681279174); + d = HH(d, a, b, c, m[i+ 0], 11, -358537222); + c = HH(c, d, a, b, m[i+ 3], 16, -722521979); + b = HH(b, c, d, a, m[i+ 6], 23, 76029189); + a = HH(a, b, c, d, m[i+ 9], 4, -640364487); + d = HH(d, a, b, c, m[i+12], 11, -421815835); + c = HH(c, d, a, b, m[i+15], 16, 530742520); + b = HH(b, c, d, a, m[i+ 2], 23, -995338651); + + a = II(a, b, c, d, m[i+ 0], 6, -198630844); + d = II(d, a, b, c, m[i+ 7], 10, 1126891415); + c = II(c, d, a, b, m[i+14], 15, -1416354905); + b = II(b, c, d, a, m[i+ 5], 21, -57434055); + a = II(a, b, c, d, m[i+12], 6, 1700485571); + d = II(d, a, b, c, m[i+ 3], 10, -1894986606); + c = II(c, d, a, b, m[i+10], 15, -1051523); + b = II(b, c, d, a, m[i+ 1], 21, -2054922799); + a = II(a, b, c, d, m[i+ 8], 6, 1873313359); + d = II(d, a, b, c, m[i+15], 10, -30611744); + c = II(c, d, a, b, m[i+ 6], 15, -1560198380); + b = II(b, c, d, a, m[i+13], 21, 1309151649); + a = II(a, b, c, d, m[i+ 4], 6, -145523070); + d = II(d, a, b, c, m[i+11], 10, -1120210379); + c = II(c, d, a, b, m[i+ 2], 15, 718787259); + b = II(b, c, d, a, m[i+ 9], 21, -343485551); + + a = (a + aa) >>> 0; + b = (b + bb) >>> 0; + c = (c + cc) >>> 0; + d = (d + dd) >>> 0; + } + + var rotl = function (n, b) { + return (n << b) | (n >>> (32 - b)); + }; + + var endian = function (n) { + // If number given, swap endian + if (n.constructor == Number) { + return rotl(n, 8) & 0x00FF00FF | + rotl(n, 24) & 0xFF00FF00; + } + + // Else, assume array and swap all items + for (var i = 0; i < n.length; i++) { + n[i] = endian(n[i]); + } + return n; + }; + + return fromByteArray(wordsToBytes(endian([a, b, c, d]))); +}; +sjcl = { + cipher: {} +}; +sjcl.cipher.aes = function(e, d) { + this._tables[0][0][0] || this._precompute(); + this.mode = d; + var c, b, a, f, g, h = this._tables[0][4], + n = this._tables[1]; + b = e.length; + var l = 1; + if (4 !== b && 6 !== b && 8 !== b) throw "invalid aes key size"; + this._key = [f = e.slice(0), g = []]; + for (c = b; c < 4 * b + 28; c++) { + a = f[c - 1]; + if (0 === c % b || 8 === b && 4 === c % b) a = h[a >>> 24] << 24 ^ h[a >> 16 & 255] << 16 ^ h[a >> 8 & 255] << 8 ^ h[a & 255], 0 === c % b && (a = a << 8 ^ a >>> 24 ^ l << 24, l = l << 1 ^ 283 * (l >> 7)); + f[c] = f[c - b] ^ a + } + for (b = 0; c; b++, c--) a = f[b & 3 ? c : c - 4], g[b] = 4 >= c || 4 > b ? a : n[0][h[a >>> 24]] ^ n[1][h[a >> 16 & 255]] ^ n[2][h[a >> + 8 & 255]] ^ n[3][h[a & 255]] +}; +sjcl.cipher.aes.MODE_CBC = 2; +sjcl.cipher.aes.MODE_CTR = 6; +sjcl.cipher.aes.prototype = { + encrypt: function(e, d, c) { + d = this.mode == sjcl.cipher.aes.MODE_CBC ? d : []; + for (var b = [], a = 0; a < e.length / 16; a++) { + var f = e.slice(16 * a, 16 * (a + 1)); + if (this.mode == sjcl.cipher.aes.MODE_CBC) { + for (var g = 0; 16 > g; g++) f[g] ^= d[g]; + d = sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(f), 0)) + } else + for (d = sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(toByteArray(c.increment())), 0)), g = 0; 16 > g; g++) d[g] ^= f[g]; + b = b.concat(d) + } + return b + }, + decrypt: function(e, d) { + for (var c = [], b = 0; b < e.length / + 16; b++) { + var a = e.slice(16 * b, 16 * (b + 1)); + ct = sjcl.codec.bytes.fromBits(this._crypt(sjcl.codec.bytes.toBits(a), 1)); + if (this.mode == sjcl.cipher.aes.MODE_CBC) { + for (var f = 0; 16 > f; f++) ct[f] ^= d[f]; + d = a + } + c = c.concat(ct) + } + return c + }, + _tables: [ + [ + [], + [], + [], + [], + [] + ], + [ + [], + [], + [], + [], + [] + ] + ], + _precompute: function() { + var e = this._tables[0], + d = this._tables[1], + c = e[4], + b = d[4], + a, f, g, h = [], + n = [], + l, p, k, m; + for (a = 0; 256 > a; a++) n[(h[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a; + for (f = g = 0; !c[f]; f ^= l || 1, g = n[g] || 1) + for (k = g ^ g << 1 ^ g << 2 ^ g << 3 ^ g << 4, k = k >> 8 ^ k & 255 ^ 99, c[f] = k, b[k] = f, p = h[a = + h[l = h[f]]], m = 16843009 * p ^ 65537 * a ^ 257 * l ^ 16843008 * f, p = 257 * h[k] ^ 16843008 * k, a = 0; 4 > a; a++) e[a][f] = p = p << 24 ^ p >>> 8, d[a][k] = m = m << 24 ^ m >>> 8; + for (a = 0; 5 > a; a++) e[a] = e[a].slice(0), d[a] = d[a].slice(0) + }, + _crypt: function(e, d) { + if (4 !== e.length) throw "invalid aes block size"; + var c = this._key[d], + b = e[0] ^ c[0], + a = e[d ? 3 : 1] ^ c[1], + f = e[2] ^ c[2], + g = e[d ? 1 : 3] ^ c[3], + h, n, l, p = c.length / 4 - 2, + k, m = 4, + w = [0, 0, 0, 0]; + h = this._tables[d]; + var q = h[0], + r = h[1], + t = h[2], + u = h[3], + v = h[4]; + for (k = 0; k < p; k++) h = q[b >>> 24] ^ r[a >> 16 & 255] ^ t[f >> 8 & 255] ^ u[g & 255] ^ c[m], n = q[a >>> 24] ^ r[f >> + 16 & 255] ^ t[g >> 8 & 255] ^ u[b & 255] ^ c[m + 1], l = q[f >>> 24] ^ r[g >> 16 & 255] ^ t[b >> 8 & 255] ^ u[a & 255] ^ c[m + 2], g = q[g >>> 24] ^ r[b >> 16 & 255] ^ t[a >> 8 & 255] ^ u[f & 255] ^ c[m + 3], m += 4, b = h, a = n, f = l; + for (k = 0; 4 > k; k++) w[d ? 3 & -k : k] = v[b >>> 24] << 24 ^ v[a >> 16 & 255] << 16 ^ v[f >> 8 & 255] << 8 ^ v[g & 255] ^ c[m++], h = b, b = a, a = f, f = g, g = h; + return w + } +}; +sjcl.codec = {}; +sjcl.codec.bytes = { + fromBits: function(e) { + var d = [], + c = sjcl.bitArray.bitLength(e), + b, a; + for (b = 0; b < c / 8; b++) 0 === (b & 3) && (a = e[b / 4]), d.push(a >>> 24), a <<= 8; + return d + }, + toBits: function(e) { + var d = [], + c, b = 0; + for (c = 0; c < e.length; c++) b = b << 8 | e[c], 3 === (c & 3) && (d.push(b), b = 0); + c & 3 && d.push(sjcl.bitArray.partial(8 * (c & 3), b)); + return d + } +}; +sjcl.bitArray = { + bitLength: function(e) { + var d = e.length; + return 0 === d ? 0 : 32 * (d - 1) + sjcl.bitArray.getPartial(e[d - 1]) + }, + partial: function(e, d, c) { + return 32 === e ? d : (c ? d | 0 : d << 32 - e) + 1099511627776 * e + }, + getPartial: function(e) { + return Math.round(e / 1099511627776) || 32 + } +}; +/* + Slightly modified version of [randomart](https://github.com/purpliminal/randomart) + to run in web browsers based on SSH RSA keys +*/ + +var symbols = { + "-2": "E", + "-1": "S", + "0": " ", + "1": ".", + "2": "o", + "3": "+", + "4": "=", + "5": "*", + "6": "B", + "7": "O", + "8": "X", + "9": "@", + "10": "%", + "11": "&", + "12": "#", + "13": "/", + "14": "^" +}; + +var bounds = { + width: 17, + height: 9 +}; + +function createBoard(bounds) { + var result = []; + + for (var i = 0; i < bounds.width; i++) { + result[i] = []; + for (var j = 0; j < bounds.height; j++) { + result[i][j] = 0; + } + } + return result; +} + +function generateBoard(data) { + var board = createBoard(bounds); + + var x = Math.floor(bounds.width / 2); + var y = Math.floor(bounds.height / 2); + + board[x][y] = -1; + + data.forEach( + function(b) { + for (var s = 0; s < 8; s += 2) { + var d = (b >> s) & 3; + + switch (d) { + case 0: // up + case 1: + if (y > 0) y--; + break; + case 2: // down + case 3: + if (y < (bounds.height - 1)) y++; + break; + } + switch (d) { + case 0: // left + case 2: + if (x > 0) x--; + break; + case 1: // right + case 3: + if (x < (bounds.width - 1)) x++; + break; + } + + if (board[x][y] >= 0) board[x][y]++; + } + } + ); + + board[x][y] = -2; + return board; +} + +function boardToString(board) { + result = []; + + for (var i = 0; i < bounds.height; i++) { + result[i] = []; + for (var j = 0; j < bounds.width; j++) { + result[i][j] = symbols[board[j][i]] || symbols[0]; + } + // Add | to start and end of result[i] + result[i] = '|' + result[i].join('') + '|'; + } + result.splice(0, 0, '\n+---[ RSA2048 ]---+'); + result.push('+-----------------+'); + return result.join('\n'); +} + +function randomart(data) { + var buffer = []; + for(var i = 0, length = data.length; i < length; i++){ + buffer.push('0x' + data[i]); + } + // Write the board to HTML + document.getElementById('hostKeyImg').innerHTML = boardToString(generateBoard(buffer)); + return; +} +var struct = { + pack: function(e, a) { + var b = ""; + switch (e) { + case "Q": + var d = new BigInteger("ff", 16), + b = b + String.fromCharCode(a.shiftRight(56).and(d)), + b = b + String.fromCharCode(a.shiftRight(48).and(d)), + b = b + String.fromCharCode(a.shiftRight(40).and(d)), + b = b + String.fromCharCode(a.shiftRight(32).and(d)), + b = b + String.fromCharCode(a.shiftRight(24).and(d)), + b = b + String.fromCharCode(a.shiftRight(16).and(d)), + b = b + String.fromCharCode(a.shiftRight(8).and(d)), + b = b + String.fromCharCode(a.and(d)); + break; + case "I": + b += String.fromCharCode(a >>> + 24 & 255), b += String.fromCharCode(a >>> 16 & 255), b += String.fromCharCode(a >>> 8 & 255); + case "B": + b += String.fromCharCode(a & 255) + } + return b + }, + unpack: function(e, a) { + var b = [], + d = 0, + c = 0; + switch (e) { + case "Q": + c = new BigInteger("0", 10); + c = c.add((new BigInteger(a.charCodeAt(0).toString(), 10)).shiftLeft(56)); + c = c.add((new BigInteger(a.charCodeAt(1).toString(), 10)).shiftLeft(48)); + c = c.add((new BigInteger(a.charCodeAt(2).toString(), 10)).shiftLeft(40)); + c = c.add((new BigInteger(a.charCodeAt(3).toString(), 10)).shiftLeft(32)); + c = c.add((new BigInteger(a.charCodeAt(4).toString(), + 10)).shiftLeft(24)); + c = c.add((new BigInteger(a.charCodeAt(5).toString(), 10)).shiftLeft(16)); + c = c.add((new BigInteger(a.charCodeAt(6).toString(), 10)).shiftLeft(8)); + c = c.add((new BigInteger(a.charCodeAt(7).toString(), 10)).shiftLeft(0)); + b.push(c); + break; + case "I": + c += a.charCodeAt(0) << 24 >>> 0, c += a.charCodeAt(1) << 16 >>> 0, c += a.charCodeAt(2) << 8 >>> 0, d += 3; + case "B": + c += a.charCodeAt(0 + d) << 0 >>> 0, b.push(c) + } + return b + } +}; +function inflate_long(a) { + var c = new BigInteger("0", 10); + a.length % 4 && (a = Array(4 - a.length % 4 + 1).join("\x00") + a); + for (var b = 0; b < a.length; b += 4) + c = c.shiftLeft(32), c = c.add(new BigInteger(struct.unpack("I", a.substring(b, b + 4))[0].toString(), 10)); + return c +} + +function deflate_long(a, c) { + a = "number" == typeof a ? new BigInteger(a.toString(), 10) : a.clone(); + c = void 0 == c ? !0 : c; + for (var b = "", d = new BigInteger("-1", 10), f = new BigInteger("ffffffff", 16); !a.equals(BigInteger.ZERO) && !a.equals(d);) b = struct.pack("I", a.and(f)) + b, a = a.shiftRight(32); + for (var f = !1, e = 0; e < b.length; ++e) { + if (a.equals(BigInteger.ZERO) && "\x00" != b.charAt(e)) { + f = !0; + break + } + if (a.equals(d) && "\u00ff" != b.charAt(e)) { + f = !0; + break + } + } + f || (e = 0, b = a.equals(BigInteger.ZERO) ? "\x00" : "\u00ff"); + b = b.substring(e); + c && (a.equals(BigInteger.ZERO) && + 128 <= b.charCodeAt(0) && (b = "\x00" + b), a.equals(d) && 128 > b.charCodeAt(0) && (b = "\u00ff" + b)); + return b +} +// Converts strings to byte arrays +function toByteArray(a) { + var bufView = new Uint8Array(a.length); + for (var i=0; i < a.length; i++) { + bufView[i] = a.charCodeAt(i); + } + return bufView; +} +// Converts byte arrays to strings +function fromByteArray(a) { + return String.fromCharCode.apply(null, new Uint8Array(a)); +} +// Converts bytes to words +function bytesToWords(a) { + for (var c = [], b = 0, d = 0; b < a.length; b++, d += 8) c[d >>> 5] |= (a[b] & 255) << 24 - d % 32; + return c +} +// Converts words to bytes +function wordsToBytes(a) { + for (var c = [], b = 0; b < 32 * a.length; b += 8) c.push(a[b >>> 5] >>> 24 - b % 32 & 255); + return c +} +// Used to set specific values for the AES counter +function setCharAt(a, c, b) { + return a.substring(0, c) + b + a.substring(c + 1) +}; +// Converts UTF-8 strings to raw encoding that xtemrm.js can handle +function fromUtf8(str) { + var res = ''; + var bytes = toByteArray(str); + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + if (c >= 0x00C0 && c <= 0x00DF) { + var c2 = bytes[++i]; + c = ((c & 0x1F) << 6) | (c2 & 0x3F); + } else if (c >= 0x00E0 && c <= 0x00EF) { + var c2 = bytes[++i]; + var c3 = bytes[++i]; + c = ((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F); + } else if (c >= 0x0080) { + c = '.'; // Invalid encoding, unprintable character + } + res += String.fromCharCode(c); + } + return res; + } +// returns a b byte random number +function read_rng(b) { + return String.fromCharCode.apply(null, window.crypto.getRandomValues(new Uint8Array(b))) +} +// Used for filtering algorithms and selecting the algorithms to be used during kex_init +function filter(client, server) { + client = client.split(',') + for (var x = 0; x < client.length; ++x) { + if (server.indexOf(client[x]) != -1) { + return client[x]; + } + } +} +// Used to split large chunks of text pasted into the client into managable portions +function splitSlice(str, len = 5000) { + var ret = [ ]; + for (var offset = 0, strLen = str.length; offset < strLen; offset += len) { + ret.push(str.slice(offset, len + offset)); + } + return ret; +} +// Modifies a hex color by percent (+/-) light/darkness +function modColorPercent(color, percent) { + var f=parseInt(color.slice(1),16),t=percent<0?0:255,p=percent<0?percent*-1:percent,R=f>>16,G=f>>8&0x00FF,B=f&0x0000FF; + return "#"+(0x1000000+(Math.round((t-R)*p)+R)*0x10000+(Math.round((t-G)*p)+G)*0x100+(Math.round((t-B)*p)+B)).toString(16).slice(1); +} +// Converts an ascii string to hex encoded string +function ascii2hex(a) { + for (var c = "", b = 0; b < a.length; b++) c = 1 == a.charCodeAt(b).toString(16).length ? c + ("0" + a.charCodeAt(b).toString(16)) : c + ("" + a.charCodeAt(b).toString(16)); + return c; +} + +// Moves the cursor back one and deletes a character from xtermjs term +function termBackspace(term) { + term.write('\b'); + term.eraseRight(term.buffers._terminal.buffer.x - 1, term.buffers._terminal.buffer.y); +}SSHyClient.kex = { + K: null, // Our secret key K generated by our preferred_kex algorithm + H: null, // A hash used for encryption key generation by the preferred_keys algorithm + sessionId: null // Session identifier; should be the same as H until a rekey event +}; + +function verifyKey(host_key, sig){ + var rsa = new SSHyClient.RSAKey(new SSHyClient.Message(host_key)); + if(!rsa.verify(SSHyClient.kex.H, new SSHyClient.Message(sig))){ + transport.disconnect(); + throw 'RSA signature verification failed, disconnecting.'; + } +} + +SSHyClient.kex.DiffieHellman = function(transport, group, SHAVersion){ + this.transport = transport; + this.SHAVersion = SHAVersion; + this.group = group; + + // Using group to determine what type of DH; 0= GEX; 1=g1; 14=g14 + if(this.group === undefined){ + this.p = this.q = this.g = this.x = this.e = this.f = null; + + this.minBits = 1024; + this.maxBits = 8192; + this.preferredBits = 2048; + return; + } else if(this.group === 1){ + this.p = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16); + } else if(this.group === 14){ + this.p = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16); + } + + // These only apply to DH group 1 and 14 + this.x = this.e = this.f = new BigInteger('0', 10); + this.G = new BigInteger("2", 10); +}; + +SSHyClient.kex.DiffieHellman.prototype = { + start: function() { + var m = new SSHyClient.Message(); + + if(this.group === undefined){ + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEXDH_GEX_REQUEST)); + m.add_int(this.minBits); + m.add_int(this.preferredBits); + m.add_int(this.maxBits); + } else { + // generates our 128 bit random number + this.x = inflate_long(read_rng(128)); + + // Now we calculate e = (g=2) ^ x mod p + this.e = this.G.modPow(this.x, this.p); + + // Now we create the message and send it + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEXDH_INIT)); + m.add_mpint(this.e); + } + + this.transport.send_packet(m); + }, + + parse_reply: function(ptype, r) { + if(this.group === undefined && ptype == SSHyClient.MSG_KEXDH_GEX_GROUP){ + this.parse_gex_group(r); + return; + } + this.handleDHReply(r); + }, + + handleDHReply: function(r){ + // convert r into message format for deconstruction + r = new SSHyClient.Message(r); + + // get the host key, f and signature from the message + var host_key = r.get_string(); + if(transport.settings.rsaCheckEnabled){ + // Now lets make sure that the host_key is recognised, firstly we'll pre-fetch all the data we require (ip/port/rsaKey) + var key = wsproxyURL.split('/')[3]; + // Cache the hexified host key + var hexHostKey = ascii2hex(host_key); + // Generate the short MD5'd key for randomart and confirm + var shortKey = ascii2hex(SSHyClient.hash.MD5(host_key)).match(/.{2}/g); + + // Create the randomArt image + randomart(shortKey); + + // Since we've got everthing we need lets see if the key exists already + var localObj = localStorage.getItem(key); + + if(localObj){ + // Check all the details match.. they should but Sanity + if(localObj != hexHostKey){ + if(confirm('WARNING - POTENTIAL SECURITY BREACH!\r\n\nThe server\s host key does not match the one SSHy has cached in local storage. This means that either the server administrator has changed the host key, or you have actually connected to another computer pretending to be the server.\r\nThe new rsa2 key fingerprint is:\r\nssh-rsa 2048 ' + shortKey.join(':') + '\r\nIf you were expecting this change and trust the new key, hit `Ok` to add the key to SSHy\'s cache and carry on connecting.\r\nIf you do not trust this new key, hit `Cancel` to abandon the connection')){ + // User has agree'd to the new host key so lets save it for them + localStorage.setItem(key, hexHostKey); + } else { + // Close the connection + ws.close(); + throw 'Error: Locally stored rsa key does not match remote key'; + } + } + } else { + // Prompt the user just like they are in puTTy + if(confirm('The server\'s host key is not cached in local storage. You have no guarentee that the server is the computer you think it is.\n\rThe server\'s rsa2 key finterprint is:\r\nssh-rsa 2048 ' + shortKey.join(':') + '\r\nIf you trust the host, hit `Ok` to add the key to SSHy\'s cache and carry on connecting.\r\nIf you do not trust this host, hit `Cancel` to abandon the connection')){ + // User has confirmed it is correct so save the RSA key + localStorage.setItem(key, hexHostKey); + } else { + // need to disconnect and kill the connection + ws.close(); + throw 'User has declined the rsa-key and closed the connection'; + } + } + } + + this.f = r.get_mpint(); + + var sig = r.get_string(); + // calculate our shared secret key (K) using f + var K = this.f.modPow(this.x, this.p); + + /* + Now we need to generate H = hash(V_C || V_S || I_C || I_S || K_S || e || f || K) + where V_ = identification string, K_ = public host key, I_ = SSH_MSG_KEXINIT message + */ + var m = new SSHyClient.Message(); + m.add_string(this.transport.local_version); + m.add_string(this.transport.remote_version); + m.add_string(this.transport.local_kex_message); + m.add_string(this.transport.remote_kex_message); + m.add_string(host_key); + // Only add these if we're using DH GEX + if(this.group === undefined){ + m.add_int(this.minBits); + m.add_int(this.preferredBits); + m.add_int(this.maxBits); + m.add_mpint(this.p); + m.add_mpint(this.g); + } + m.add_mpint(this.e); + m.add_mpint(this.f); + m.add_mpint(K); + + SSHyClient.kex.K = K; + SSHyClient.kex.sessionId = SSHyClient.kex.H = this.SHAVersion == 'SHA-1' ? new SSHyClient.hash.SHA1(m.toString()).digest() : new SSHyClient.hash.SHA256(m.toString()).digest(); + if(transport.settings.rsaCheckEnabled){ + verifyKey(host_key, sig); + } + this.transport.send_new_keys(); + }, + + // generates our secret x + generate_x: function() { + var q = this.p.subtract(BigInteger.ONE); + q = q.divide(new BigInteger("2", 10)); + + var qnorm = deflate_long(q, 0); + var qhbyte = qnorm[0].charCodeAt(0); + var bytes = qnorm.length; + var qmask = 0xff; + while (!(qhbyte & 0x80)) { + qhbyte <<= 1; + qmask >>= 1; + } + var x; + while (true) { + var x_bytes = read_rng(bytes); + x_bytes = String.fromCharCode(x_bytes[0].charCodeAt(0) & qmask) + x_bytes.substring(1); + x = inflate_long(x_bytes, 1); + if (x.compareTo(BigInteger.ONE) > 0 && q.compareTo(x) > 0) { + break; + } + } + this.x = x; + }, + // gets the prime and group from parse_reply and generates our secret number e + parse_gex_group: function(m) { + m = new SSHyClient.Message(m); + this.p = m.get_mpint(); + this.g = m.get_mpint(); + + this.generate_x(); + + this.e = this.g.modPow(this.x, this.p); + + m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEXDH_GEX_INIT)); + m.add_mpint(this.e); + this.transport.send_packet(m); + } +}; +SSHyClient.Transport = function(ws, settings) { + this.local_version = 'SSH-2.0-SSHyClient'; + this.remote_version = ''; + + // Kex variables + this.local_kex_message = null; // Our local kex init message containing algorithm negotiation + this.remote_kex_message = null; // The remote servers ^ + + // Our supported Algorithms + this.preferred_algorithms = ['diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha256,diffie-hellman-group1-sha1', + 'ssh-rsa', + 'aes128-ctr', + 'hmac-sha2-256,hmac-sha1', + 'none', + '' + ]; + + // Objects storing references to our different algorithm modules + this.preferred_kex = null; + this.preferred_mac = null; + this.preferred_hash = null; + + // Other SSHyClient module classes + this.parceler = new SSHyClient.parceler(ws, this); + this.auth = new SSHyClient.auth(this.parceler); + this.settings = settings === undefined ? new SSHyClient.settings() : settings; + + this.lastKey = ''; + + this.closing = false; +}; + +SSHyClient.Transport.prototype = { + /* Lookup table for all of our supported KEX algorithms + - Called by kex_info[ id] + - returns KEX algorithm */ + kex_info: { + 'diffie-hellman-group1-sha1': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 1, 'SHA-1'); + }, + 'diffie-hellman-group14-sha1': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 14, 'SHA-1'); + }, + 'diffie-hellman-group-exchange-sha1': function(self) { + return new SSHyClient.kex.DiffieHellman(self, undefined, 'SHA-1'); + }, + 'diffie-hellman-group1-sha256': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 1, 'SHA-256'); + }, + 'diffie-hellman-group14-sha256': function(self) { + return new SSHyClient.kex.DiffieHellman(self, 14, 'SHA-256'); + }, + 'diffie-hellman-group-exchange-sha256': function(self) { + return new SSHyClient.kex.DiffieHellman(self, undefined, 'SHA-256'); + } + }, + /* Lookup table for all of our supported MAC algorithms + Called by kex_info[ id] */ + mac_info: { + 'hmac-sha1': function(self) { + self.parceler.hmacSHAVersion = 'SHA-1'; + self.preferred_hash = 20; + return; + }, + 'hmac-sha2-256': function(self) { + self.parceler.hmacSHAVersion = 'SHA-256'; + self.preferred_hash = 32; + return; + } + }, + /* + A table storing various function calls corresponding to the Message ID numbers defined [https://www.ietf.org/rfc/rfc4250.txt] + called like : + `handler_table[id]( SSHyClient.transport, message)` + */ + handler_table: { + /* Sends our local SSH version to the SSH server */ + 0: function(self, m){ + // Directly interface with the websocket + self.parceler.socket.sendB64(self.local_version + '\r\n'); + // Slice off the '/r/n' from the end of our remote version + self.remote_version = m.slice(0, m.length - 2); + self.send_kex_init(); + return; + }, + /* SSH_MSG_DISCONNECT - sent by the SSH server when the connection is gracefully closed */ + 1: function(self, m) { + self.disconnect(); + return; + }, + /* SSH_MSG_IGNORE - sent by the SSH server when keys are not to be echoed */ + 2: function(self, m) { + return; + }, + /* SSH_MSG_UNIMPLEMENTED - sent by the server to indicate a function is not implemented on the remote */ + 3: function(self, m) { + return; + }, + /* SSH_MSG_SERVICE_ACCEPT: sent by the SSH server after the client request's a service (post-kex) */ + 6: function(self, m) { + var service = new SSHyClient.Message(m.slice(1)).get_string(); + // Check th type of message sent by the server and start the appropriate service + if (service == "ssh-userauth") { + self.auth.ssh_connection(); + } + return; + }, + /* SSH_MSG_KEXINIT: sent by the server after algorithm negotiation - contains server's keys and hash */ + 20: function(self, m) { + // Remote_kex_message must have no padding or length meta data so we have to strip that out + self.parse_kex_reply(m); + self.remote_kex_message = m; // we need this later for calculating H + self.preferred_kex.start(); + return; + }, + /* SSH_MSG_NEWKEYS: sent by the server to inform us that it will use encryption from now on */ + 21: function(self){ + self.activate_encryption(); + return; + }, + /* SSH_MSG_KEX_DH_GEX_GROUP: used for DH GroupEx when negotiating which group to use */ + 31: function(self, m) { + /* Since we're just extracting data from r in parse_reply, we don't need to do the processing to remove the padding + and can just remove the first 1 byte (message code) */ + self.preferred_kex.parse_reply(31, m.slice(1)); + return; + }, + /* SSH_MSG_KEX_DH_GEX_REPLY: used for DH GroupEx, sent by the server - contains server's keys and hash */ + 33: function(self, m) { + self.preferred_kex.parse_reply(33, m.slice(1)); + return; + }, + /* SSH_MSG_USERAUTH_FAILURE: sent by the server when there is a complete or partial failure with user authentication */ + 51: function(self, m) { + self.auth.awaitingAuthentication = false; + self.auth.authFailure(); + return; + }, + /* SSH_MSG_USERAUTH_SUCCESS: sent by the server when an authentication attempt succeeds */ + 52: function(self, m) { + self.auth.authenticated = true; + self.auth.awaitingAuthentication = false; + self.auth.auth_success(true); + return; + }, + /* SSH_MSG_GLOBAL_REQUEST: sent by the server to request information, server sends its hostkey after user-auth + but RSA keys (TODO) aren't implemented so for now we can ignore this message */ + 80: function(self, m) { + return; + }, + /* SSH_MSG_CHANNEL_OPEN_CONFIRMATION: sent by the server to inform the client that a new channel has been opened */ + 91: function(self, m) { + self.auth.channelOpened = true; + resize() + self.auth.mod_pty('pty-req', term.cols, term.rows, 'xterm'); + return; + }, + /* SSH_MSG_CHANNEL_WINDOW_ADJUST: sent by the server to inform the client of the maximum window size (bytes) */ + 93: function(self, m) { + return; + }, + /* SSH_MSG_CHANNEL_DATA: text sent by the server which is displayed by writing to the terminal */ + 94: function(self, m) { + // Slice the heading 9 bytes and send the remaining xterm sequence to the terminal + var str = m.slice(9); + + // Local Echo module + if(self.settings.localEcho){ + // Inspect the packet for identifying shell type + self.settings.testShell(str); + // Inspect the packet for fullscreen applications + self.settings.parseLocalEcho(str); + if (self.lastKey) { + /* If packet data == lastkey pressed do nothing, otherwise delete last key in term + and write the returned packet data */ + if (str == self.lastKey.substring(0,1)) { + self.lastKey = self.lastKey.slice(1); + return; + } + self.lastKey = self.lastKey.slice(1); + term.write('\b'); + } + } + // Convert str and write it to console + term.write(fromUtf8(str)); + return; + }, + /* SSH_MSG_CHANNEL_EOF: sent by the server indicating no more data will be sent to the channel*/ + 96: function(self, m) { + return; + }, + /* SSH_MSG_CHANNEL_CLOSE: sent by the server to indicate the channel is now closed; the SSH connection remains open*/ + 97: function(self, m) { + self.disconnect(); + return; + }, + /* SSH_MSG_CHANNEL_REQUEST: sent by the server to request a new channel, as the client we can just ignore this*/ + 98: function(self, m) { + return; + } + }, + + /* + Once the SSH server has transmitted its full window size it gets locked up and cannot send more data + until the window has been readjusted. + + Using WINDOW_SIZE from puTTy + */ + winAdjust: function() { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_WINDOW_ADJUST)); + m.add_int(0); + m.add_int(SSHyClient.WINDOW_SIZE); + + this.send_packet(m.toString()); + this.parceler.windowSize = SSHyClient.WINDOW_SIZE; + }, + // Disconnect the web client from the server with a given error code (11 - SSH_DISCONNECT_BY_APPLICATION ) + disconnect: function(reason) { + this.closing = true; + reason = reason === undefined ? 11 : reason; + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_DISCONNECT)); + m.add_int(reason); + this.send_packet(m.toString()); + ws.close(); + term.write("\r\nConnection to " + this.auth.hostname + " closed. Code - " + reason); + }, + // Sends a null packet to the SSH server to keep the connection alive + keepAlive: function(){ + // Make sure the websocket is still open + if(ws.readyState === 3){ + return; + } + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_IGNORE)); + m.add_string(''); + + transport.send_packet(m.toString()); + }, + /* Cuts the padding 00's off the end of a message by reading the padding length + - param m + returns */ + cut_padding: function(m) { + return m.substring(1, m.length - m[0].charCodeAt(0)); + }, + // Sends the raw packet to the parceler to be encapsulated and sent via websocket + send_packet: function(m) { + this.parceler.send(m); + }, + // Initiates the key exchange process by sending our supported algorithms & ciphers + send_kex_init: function() { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEX_INIT)); + // add 16 random bytes + m.add_bytes(read_rng(16)); + m.add_string(this.preferred_algorithms[0]); // Preferred Kex + m.add_string(this.preferred_algorithms[1]); // Preferred Server keys + // Adds cipher, mac, compression and languages twice + for(var i = 2; i < 6; i++){ + m.add_string(this.preferred_algorithms[i]); + m.add_string(this.preferred_algorithms[i]); + } + + m.add_boolean(false); // Kex guessing + m.add_int(0); + + m = m.toString(); + //save a copy for calculating H later + this.local_kex_message = m; + + this.send_packet(m); + }, + // Parses the server's kex init and selects best fit algorithms & ciphers + parse_kex_reply: function(m) { + m = new SSHyClient.Message(m); + // Cuts the 16 byte random cookie and message flags from the beginning + m.get_bytes(17); + + // Gets the supported algorithms, ignoring repeated keys/cipher algorithms + var kex = filter(this.preferred_algorithms[0], m.get_string().split(',')); + var keys = filter(this.preferred_algorithms[1], m.get_string().split(',')); + m.get_string(); + var cipher = filter(this.preferred_algorithms[2], m.get_string().split(',')); + m.get_string(); + var mac = filter(this.preferred_algorithms[3], m.get_string().split(',')); + + // Sanity checking to make sure nessesary algorithms have been negotiated + if (!kex || !keys || !cipher || !mac) { + var missing = ''; + if (!kex) { + missing += "KEX Algorithm,"; + } + if (!keys) { + missing += "Host Keys,"; + } + if (!cipher) { + missing += "Encryption Cipher,"; + } + if (!mac) { + missing += "MAC Algorithm"; + } + + //term.write("Incompatable SSH server (no compatable - " + missing + " )"); + throw "Chosen Algs = kex=" + kex + ", keys=" + keys + ", cipher=" + cipher + ", mac=" + mac; + } + // Set those preferred Algs + this.preferred_kex = this.kex_info[kex](this); + this.preferred_mac = this.mac_info[mac](this); + }, + + /* Takes a character and size then generates a key to be used by ssh + A = Initial IV client -> server + C = Encryption Key client -> server + E = Integrity Key client -> server + */ + generate_key: function(char, size) { + var m = new SSHyClient.Message(); + m.add_mpint(SSHyClient.kex.K); + m.add_bytes(SSHyClient.kex.H); + m.add_bytes(char); + m.add_bytes(SSHyClient.kex.sessionId); + + return this.preferred_kex.SHAVersion == 'SHA-1' ? new SSHyClient.hash.SHA1(m.toString()).digest().substring(0, size) : new SSHyClient.hash.SHA256(m.toString()).digest().substring(0, size); + }, + // Sets up the keys and ciphers that the parceler will use + activate_encryption: function() { + this.parceler.block_size = 16; + this.parceler.macSize = this.preferred_hash; + + // Generate the keys we need for encryption and HMAC + this.parceler.outbound_enc_iv = this.generate_key('A', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.outbound_enc_key = this.generate_key('C', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.outbound_mac_key = this.generate_key('E', this.parceler.macSize, this.preferred_kex.SHAVersion); + + this.parceler.outbound_cipher = new SSHyClient.crypto.AES(this.parceler.outbound_enc_key, + SSHyClient.AES_CTR, + this.parceler.outbound_enc_iv, + new SSHyClient.crypto.counter(this.parceler.block_size * 8, inflate_long(this.parceler.outbound_enc_iv))); + + this.parceler.inbound_enc_iv = this.generate_key('B', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.inbound_enc_key = this.generate_key('D', this.parceler.block_size, this.preferred_kex.SHAVersion); + this.parceler.inbound_mac_key = this.generate_key('F', this.parceler.macSize, this.preferred_kex.SHAVersion); + + this.parceler.inbound_cipher = new SSHyClient.crypto.AES(this.parceler.inbound_enc_key, + SSHyClient.AES_CTR, + this.parceler.inbound_enc_iv, + new SSHyClient.crypto.counter(this.parceler.block_size * 8, inflate_long(this.parceler.inbound_enc_iv))); + + // signal to the parceler that we want to encrypt and decypt + this.parceler.encrypting = true; + + this.auth.request_auth(); + }, + // Takes an arbitrary packet and processes it to be looked up by the handler_table + handle_dec: function(m) { + // Cut the padding off + m = this.cut_padding(m); + // Should now be in format [ptype][message] + try { + this.handler_table[m.substring(0, 1).charCodeAt(0)](this, m); + } catch (err) { + console.log(err); + console.log("Error! code - " + m.substring(0, 1).charCodeAt(0) + " does not exist!"); + } + }, + str_to_bytes: function(s) { + return unescape(encodeURIComponent(s)) + }, + // Takes a char or string and sends it to the SSH server + expect_key: function(command) { + // Make sure a non-null command is being sent + if(!command){ + return; + } + // encapsulates a character or command and sends it to the SSH server + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_DATA)); + m.add_int(0); + m.add_string(this.str_to_bytes(command.toString())); + + this.parceler.send(m); + }, + // Sends the new keys message signaling we're using the generated keys from now on + send_new_keys: function(SHAVersion) { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_NEW_KEYS)); + + this.send_packet(m); + } +}; +/** + * Copyright (c) 2017 The xterm.js authors. All rights reserved. + * @license MIT + */ + +var MINIMUM_COLS = 2; +var MINIMUM_ROWS = 1; +var FitAddon = /** @class */ (function () { + 'use strict'; + function FitAddon() { + } + FitAddon.prototype.activate = function (terminal) { + this._terminal = terminal; + }; + FitAddon.prototype.dispose = function () { }; + FitAddon.prototype.fit = function () { + var dims = this.proposeDimensions(); + if (!dims || !this._terminal) { + return; + } + // TODO: Remove reliance on private API + var core = this._terminal._core; + // Force a full render + if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) { + core._renderService.clear(); + this._terminal.resize(dims.cols, dims.rows); + } + }; + FitAddon.prototype.proposeDimensions = function () { + if (!this._terminal) { + return undefined; + } + if (!this._terminal.element || !this._terminal.element.parentElement) { + return undefined; + } + // TODO: Remove reliance on private API + var core = this._terminal._core; + if (core._renderService.dimensions.actualCellWidth === 0 || core._renderService.dimensions.actualCellHeight === 0) { + return undefined; + } + var parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement); + var parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')); + var parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'))); + var elementStyle = window.getComputedStyle(this._terminal.element); + var elementPadding = { + top: parseInt(elementStyle.getPropertyValue('padding-top')), + bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')), + right: parseInt(elementStyle.getPropertyValue('padding-right')), + left: parseInt(elementStyle.getPropertyValue('padding-left')) + }; + var elementPaddingVer = elementPadding.top + elementPadding.bottom; + var elementPaddingHor = elementPadding.right + elementPadding.left; + var availableHeight = parentElementHeight - elementPaddingVer; + var availableWidth = parentElementWidth - elementPaddingHor - core.viewport.scrollBarWidth; + var geometry = { + cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / core._renderService.dimensions.actualCellWidth)), + rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / core._renderService.dimensions.actualCellHeight)) + }; + return geometry; + }; + return FitAddon; +}()); + +SSHyClient.auth = function(parceler) { + this.parceler = parceler; // We shouldn't need anything from the transport handler + this.authenticated = null; + this.awaitingAuthentication = false; + this.hostname = wsproxyURL ? wsproxyURL.split('/')[2].split(':')[0] : ''; + this.termUsername = ''; + this.termPassword = undefined; + this.failedAttempts = 0; + this.channelOpened = false; +}; + +SSHyClient.auth.prototype = { + // Requests we want to authenticate ourselves with the SSH server + request_auth: function() { + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_SERVICE_REQUEST)); + m.add_string('ssh-userauth'); + this.parceler.send(m); + }, + // Sends the username and password provided by index.html + ssh_connection: function() { + if(!this.termUsername || !this.termPassword){ + // If no termUser or termPass has been set then we are likely using the wrapper + if(!term){ + startxtermjs(); + } + return; + } + + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_USERAUTH_REQUEST)); + m.add_string(this.termUsername); + m.add_string("ssh-connection"); + m.add_string("password"); + m.add_boolean(false); + m.add_string(this.termPassword); + + this.awaitingAuthentication = true; + + this.parceler.send(m); + }, + // Called on successful or partially successful SSH connection authentications + auth_success: function(success) { + if (success) { + // Change the window title + document.title = this.termUsername + '@' + this.hostname; + // Purge the username and password + this.termUsername = ''; + this.termPassword = undefined; + // Make sure xtermjs has been initialised + if(!term){ + startxtermjs(); + } + // Starts up the keep alive interval to 240s + transport.settings.setKeepAlive(240); + document.getElementById('keepAlive').value = 240; + // We've been authenticated, lets open a channel + this.open_channel('session'); + } + // TODO: implement follow on tries for authentication (keyboard/public key) + }, + // Opens a channel - generally called right after authenticating with the SSH server + open_channel: function(type, onsuccess) { + onsuccess = onsuccess === undefined ? null : onsuccess; + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_OPEN)); + m.add_string(type); + m.add_int(1); + m.add_int(SSHyClient.WINDOW_SIZE); + m.add_int(SSHyClient.MAX_PACKET_SIZE); + + this.parceler.send(m); + }, + // Requests a pseudo-terminal, defaulting to xterm if no other terminal emulator is provided when type == "pty-req" + // Sends the remote server our terminal rows/cols settings, called by window.resize() when type == "window-change" + mod_pty: function(type, width, height, term) { + if (!this.channelOpened) { + return; + } + + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_REQUEST)); + m.add_int(0); + m.add_string(type); + m.add_boolean(false); // we don't want any enviroment vars to be returned + if (term) { + m.add_string(term); + } + m.add_int(width); + m.add_int(height); + // pixel data, which is overwritten by the above height and width + m.add_int(0); + m.add_int(0); + + if (term) { + // Don't sent any special terminal modes + m.add_string(''); + } + + this.parceler.send(m); + + if (term) { + // invokes the shell session right after sending the packet + this.invoke_shell(); + } + }, + // Invokes the interactive terminal using the pseudo-terminal channel + invoke_shell: function() { + // Craft the shell invocation packet + var m = new SSHyClient.Message(); + m.add_bytes(String.fromCharCode(SSHyClient.MSG_CHANNEL_REQUEST)); + m.add_int(0); + m.add_string('shell'); + m.add_boolean(false); + + this.parceler.send(m); + // Start xterm.js + if (this.termPassword === undefined) { + term.write('\n\r'); + return; + } + startxtermjs(); + }, + // Called on unsuccessful SSH connection authentication + authFailure: function() { + if(term){ + term.write("Access Denied\r\n"); + // if we've failed authentication more than 5 times than disconect and warn the user + if (++this.failedAttempts >= 5) { + term.write("Too many failed authentication attempts"); + transport.disconnect(); + return; + } + term.write(this.termUsername + '@' + this.hostname + '\'s password:'); + this.termPassword = ''; + } else { + display_error('Invalid Username or Password'); + } + } +}; +SSHyClient.crypto = {}; + +// AES wrapper for Libs/aes.min.js (SJCL) +SSHyClient.crypto.AES = function(key, mode, iv, counter) { + // Setup our cipher and give it the key and mode + this.cipher = new sjcl.cipher.aes(sjcl.codec.bytes.toBits(toByteArray(key)), mode); + this.mode = mode; + // some support for CBC mode - however not fully implemented + if (this.mode == SSHyClient.AES_CBC) { + this.iv = toByteArray(iv); + } + this.counter = counter; +}; + +SSHyClient.crypto.AES.prototype = { + encrypt: function(plaintext) { + // encrypt the plaintext! + var ciphertext = this.cipher.encrypt(toByteArray(plaintext), this.iv, this.counter); + if (this.mode == SSHyClient.AES_CBC) { + // take the last 16 bytes for our IV + this.iv = ciphertext.slice(-16); + } + // convert the ciphertext from an array of bytes back into text + return fromByteArray(ciphertext); + }, + + decrypt: function(ciphertext) { + var plaintext; + ciphertext = toByteArray(ciphertext); + // do different stuff for CTR & CBC mode + if (this.mode == SSHyClient.AES_CBC) { + plaintext = this.cipher.decrypt(ciphertext, this.iv); + this.iv = ciphertext.slice(-16); + } else { + plaintext = this.cipher.encrypt(ciphertext, this.iv, this.counter); + } + return fromByteArray(plaintext); + } +}; +// Defines our custom counter +SSHyClient.crypto.counter = function(num, init) { + init = init === undefined ? 1 : init; + + this.blocksize = num / 8; + this.overflow = 0; + + // setup the initial counter value depending on if we recieved a number or not. + if (init === 0) { + this.value = new array(this.blocksize + 1).join('\xFF'); + } else { + var val = deflate_long(init.subtract(BigInteger.ONE), false); + this.value = new Array(this.blocksize - val.length + 1).join('\x00') + val; + } +}; + +SSHyClient.crypto.counter.prototype = { + // increment the current counter + increment: function() { + var i = this.blocksize; + while (i--) { + var count = String.fromCharCode((this.value.charCodeAt(i) + 1) % 256); + this.value = setCharAt(this.value, i, count); + if (count != '\x00') { + return this.value; + } + } + + // Deals with counter resetting / overflowing + var x = deflate_long(this.overflow, false); + this.value = new Array(this.blocksize - x.length + 1).join('\x00') + x; + return this.value; + + } +}; +/* + Implementation of SSHv2 Message + + Each packet is a stream of bytes that encode a combinatiuon of strings, integers, booleans + and multipoint integers. + + This class builds or breaks down a bytes stream with the implemented functions + +*/ + +SSHyClient.Message = function(content) { + this.position = 0; + + this.packet = content === undefined ? String() : String(content); +}; + +SSHyClient.Message.prototype = { + toString: function() { + return this.packet; + }, + + get_bytes: function(n) { + var b = this.packet.substring(this.position, this.position + n); + this.position += n; + if (b.length < n && n < 1048576) { // n < 1Mb + return b + new Array(n - b.length + 1).join('\x00'); + } + return b; + }, + + get_int: function() { + return struct.unpack('I', this.get_bytes(4))[0]; + }, + + get_string: function() { + return this.get_bytes(this.get_int()); + }, + + get_mpint: function() { + return inflate_long(this.get_string()); + }, + + add_bytes: function(d) { + this.packet += d; + return this; + }, + + add_boolean: function(b) { + this.add_bytes(b === true ? '\x01' : '\x00'); + return this; + }, + + add_int: function(i) { + this.packet += struct.pack('I', i); + return this; + }, + + add_mpint: function(d) { + this.add_string(deflate_long(d)); + return this; + }, + + add_string: function(d) { + this.add_int(d.length); + this.packet += d; + return this; + } +}; +SSHyClient.parceler = function(web_socket, transport) { + this.socket = web_socket; + this.transport = transport; + this.encrypting = false; + + // Encryption & Mac variables + this.outbound_enc_iv = this.outbound_enc_key = this.outbound_mac_key = this.outbound_cipher= null; + + this.inbound_iv = this.inbound_enc_key = this.inbound_mac_key = this.inbound_cipher = null; + + this.hmacSHAVersion = null; + this.macSize = 0; + + this.outbound_sequence_num = this.inbound_sequence_num = 0; + this.block_size = 8; + + this.prevHeader = this.inbound_buffer = ''; + + this.windowSize = SSHyClient.WINDOW_SIZE; + + /* Stores the recieved and transmitted data in bytes; + possible integer overflow however would need to exchange 8.1PetaBytes of data*/ + this.recieveData = this.transmitData = 0; +}; + +SSHyClient.parceler.prototype = { + // Send / Encrypt messages to the websocket proxy + send: function(data) { + // Encapsulate the data with padding and length + packet = this.pack_message(data.toString()); + + if (this.encrypting) { + // Encrypt the encapsulated packet + var encrypted_packet = this.outbound_cipher.encrypt(packet); + + // Add the mac hash & pack the sequence number + packet = encrypted_packet + SSHyClient.hash.HMAC(this.outbound_mac_key, struct.pack('I', this.outbound_sequence_num) + packet, this.hmacSHAVersion); + } + + // Now send it as a base64 string + this.socket.sendB64(packet); + + this.outbound_sequence_num++; + }, + + // Calculates and adds the packet length, padding length and padding to the message + pack_message: function(data) { + var padding = 3 + this.block_size - ((data.length + 8) % this.block_size); + + // Adds the message length, padding length and data together + var packet = struct.pack('I', data.length + padding + 1) + struct.pack('B', padding) + data; + + // RFC says we should use random bytes but we should only need if we are encrypting. Otherwise it is a waste of time + packet += this.encrypting ? read_rng(padding) : new Array(padding + 1).join('\x00'); + + return packet; + }, + // Handles inbound traffic over the socket + handle: function(r) { + // Add the packet length to the parceler's rx + this.recieveData += r.length; + this.transport.settings.setNetTraffic(transport.parceler.recieveData, true); + /* Checking for encryption first since it will be the most common check + - Parceler should send decrypted message ( -packet length -padding length -padding ) to transport.handle_dec() + from there it should be send to the relevant handler (auth/control) */ + if (this.encrypting) { + this.inbound_buffer += r; + this.decrypt(); + return; + } + + /* If we don't have a remote_version then send our version and set the remote_version */ + if (!this.transport.remote_version) { + var end = r.indexOf('\r\n'); + if (end != -1) { + var rv = r.slice(0, end+2); + this.transport.handler_table[0](this.transport, rv); + r = r.slice(end+2); + } // else that would be bad and probably we should die here + if (r.length<=0) { return; } + } + + this.inbound_buffer += r; + this.decrypt(r); + }, + // Decrypt messages from the SSH server + decrypt: function() { + // Since we cannot guarentee that we will be decyrpting zero, one or multiple packets we have to rely on this.read_ibuffer() + var buffer = ' '; + var header; + while (buffer !== null) { + // If there isn'ta previous header then we need to get one + if (!this.prevHeader) { + // Read [this.block_size] from the inbound buffer + header = this.read_ibuffer(); + if (!header) { // just for safety + return; + } + // Only need to decrypt it if we've enabled encryption + if(this.encrypting){ + header = this.inbound_cipher.decrypt(header); + } + } else { + header = this.prevHeader; + this.prevHeader = ''; + } + // Unpack the packet size from the decrypted header + var packet_size = struct.unpack('I', header.substring(0, 4))[0]; + // We can store the start of our message for later now + var leftover = header.substring(4); + + // Attempt to read [packet_size] from inbound buffer; returns null on failure + buffer = this.read_ibuffer(packet_size + this.macSize - leftover.length); + if (!buffer) { + // Couldn't read [packet_size] so store the prevHeader + this.prevHeader = header; + return; + } + // Get the packet body and mac length from the buffer + var packet = buffer.substring(0, packet_size - leftover.length); + + // Decrypt the packet + if(this.encrypting){ + packet = this.inbound_cipher.decrypt(packet); + } + + // Prepend our leftover header + packet = leftover + packet; + + /* + Now lets verify the MAC - just to make sure! + - To do this we will get the MAC from the message and generate our own MAC, then compare the two. + */ + if(this.macSize){ + var mac = buffer.substring(packet_size - leftover.length); + var mac_payload = struct.pack('I', this.inbound_sequence_num) + struct.pack('I', packet_size) + packet; + var our_mac = SSHyClient.hash.HMAC(this.inbound_mac_key, mac_payload, this.hmacSHAVersion); + if (our_mac != mac) { + // Oops something went wrong, lets close the connection + this.transport.disconnect(); + throw "Inbound MAC verification failed - Mismatched MAC"; + } + } + + // Increment the sequence number + this.inbound_sequence_num++; + + // calculate how much window size we have left + this.windowSize -= packet_size; + + // If we've run out of window size then readjust it + if (this.windowSize <= 0) { + this.transport.winAdjust(); + } + // Send the decoded packet to the transport handler + this.transport.handle_dec(packet); + } + }, + // Read [bytes] from the inbound buffer + read_ibuffer: function(bytes) { // if we don't feed it any arguments we are only wanting one block anyway + bytes = bytes === undefined ? this.block_size : bytes; + if (this.inbound_buffer.length < bytes) { + return null; + } + + var out = this.inbound_buffer.substring(0, bytes); + // Remove the bytes we're taking from the buffer + this.inbound_buffer = this.inbound_buffer.substring(bytes); + return out; + } +}; +SSHyClient.RSAKey = function(msg){ + msg.get_string(); + this.e = msg.get_mpint(); + this.n = msg.get_mpint(); +}; + +SSHyClient.RSAKey.prototype = { + /* Turn a 20-byte SHA1 hash into a blob of data as large as the key's N, + using PKCS1's \"emsa-pkcs1-v1_5\" encoding. */ + pkcs1imify : function(data) { + var SHA1_DIGESTINFO = '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14'; + var filler = new Array(deflate_long(this.n, 0).length - SHA1_DIGESTINFO.length - data.length - 3 + 1).join('\xff'); + return '\x00\x01' + filler + '\x00' + SHA1_DIGESTINFO + data; + }, + /* Compares data (hash H) with the SSH server's signature + returns true if match, false otherwise.*/ + verify : function(data, SSHsig) { + if (SSHsig.get_string() != 'ssh-rsa') { + return false; + } + var sigData = inflate_long(SSHsig.get_string(), true); + var hashObj = inflate_long(this.pkcs1imify(new SSHyClient.hash.SHA1(data).digest()), true); + + return sigData.modPow(this.e, this.n).equals(hashObj); + }, +}; + +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(self,(function(){return(()=>{"use strict";var e={4567:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;var o=r(9042),s=r(6114),a=r(6193),c=r(3656),l=r(844),h=r(5596),u=r(9631),f=function(e){function t(t,r){var i=e.call(this)||this;i._terminal=t,i._renderService=r,i._liveRegionLineCount=0,i._charsToConsume=[],i._charsToAnnounce="",i._accessibilityTreeRoot=document.createElement("div"),i._accessibilityTreeRoot.classList.add("xterm-accessibility"),i._rowContainer=document.createElement("div"),i._rowContainer.setAttribute("role","list"),i._rowContainer.classList.add("xterm-accessibility-tree"),i._rowElements=[];for(var n=0;ne;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),s.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)}),0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,s.isMac&&u.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var r=this._terminal.buffer,i=r.lines.length.toString(),n=e;n<=t;n++){var o=r.translateBufferLineToString(r.ydisp+n,!0),s=(r.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===o.length?a.innerText=" ":a.textContent=o,a.setAttribute("aria-posinset",s),a.setAttribute("aria-setsize",i))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e{function r(e){return e.replace(/\r?\n/g,"\r")}function i(e,t){return t?"[200~"+e+"[201~":e}function n(e,t,n){e=i(e=r(e),n.decPrivateModes.bracketedPasteMode),n.triggerDataEvent(e,!0),t.value=""}function o(e,t,r){var i=r.getBoundingClientRect(),n=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=n+"px",t.style.top=o+"px",t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=i,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,r){e.stopPropagation(),e.clipboardData&&n(e.clipboardData.getData("text/plain"),t,r)},t.paste=n,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,r,i,n){o(e,t,r),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}},4774:(e,t)=>{var r,i,n,o;function s(e){var t=e.toString(16);return t.length<2?"0"+t:t}function a(e,t){return e>>0}}(r=t.channels||(t.channels={})),(i=t.color||(t.color={})).blend=function(e,t){var i=(255&t.rgba)/255;if(1===i)return{css:t.css,rgba:t.rgba};var n=t.rgba>>24&255,o=t.rgba>>16&255,s=t.rgba>>8&255,a=e.rgba>>24&255,c=e.rgba>>16&255,l=e.rgba>>8&255,h=a+Math.round((n-a)*i),u=c+Math.round((o-c)*i),f=l+Math.round((s-l)*i);return{css:r.toCss(h,u,f),rgba:r.toRgba(h,u,f)}},i.isOpaque=function(e){return 255==(255&e.rgba)},i.ensureContrastRatio=function(e,t,r){var i=o.ensureContrastRatio(e.rgba,t.rgba,r);if(i)return o.toColor(i>>24&255,i>>16&255,i>>8&255)},i.opaque=function(e){var t=(255|e.rgba)>>>0,i=o.toChannels(t),n=i[0],s=i[1],a=i[2];return{css:r.toCss(n,s,a),rgba:t}},i.opacity=function(e,t){var i=Math.round(255*t),n=o.toChannels(e.rgba),s=n[0],a=n[1],c=n[2];return{css:r.toCss(s,a,c,i),rgba:r.toRgba(s,a,c,i)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,r){var i=e/255,n=t/255,o=r/255;return.2126*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(n=t.rgb||(t.rgb={})),function(e){function t(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u0||l>0||h>0);)c-=Math.max(0,Math.ceil(.1*c)),l-=Math.max(0,Math.ceil(.1*l)),h-=Math.max(0,Math.ceil(.1*h)),u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));return(c<<24|l<<16|h<<8|255)>>>0}function i(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u>>0}e.ensureContrastRatio=function(e,r,o){var s=n.relativeLuminance(e>>8),c=n.relativeLuminance(r>>8);if(a(s,c)>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i){return{css:r.toCss(e,t,i),rgba:r.toRgba(e,t,i)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=s,t.contrastRatio=a},7239:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;var r=function(){function e(){this._color={},this._rgba={}}return e.prototype.clear=function(){this._color={},this._rgba={}},e.prototype.setCss=function(e,t,r){this._rgba[e]||(this._rgba[e]={}),this._rgba[e][t]=r},e.prototype.getCss=function(e,t){return this._rgba[e]?this._rgba[e][t]:void 0},e.prototype.setColor=function(e,t,r){this._color[e]||(this._color[e]={}),this._color[e][t]=r},e.prototype.getColor=function(e,t){return this._color[e]?this._color[e][t]:void 0},e}();t.ColorContrastCache=r},5680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorManager=t.DEFAULT_ANSI_COLORS=void 0;var i=r(4774),n=r(7239),o=i.css.toColor("#ffffff"),s=i.css.toColor("#000000"),a=i.css.toColor("#ffffff"),c=i.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var e=[i.css.toColor("#2e3436"),i.css.toColor("#cc0000"),i.css.toColor("#4e9a06"),i.css.toColor("#c4a000"),i.css.toColor("#3465a4"),i.css.toColor("#75507b"),i.css.toColor("#06989a"),i.css.toColor("#d3d7cf"),i.css.toColor("#555753"),i.css.toColor("#ef2929"),i.css.toColor("#8ae234"),i.css.toColor("#fce94f"),i.css.toColor("#729fcf"),i.css.toColor("#ad7fa8"),i.css.toColor("#34e2e2"),i.css.toColor("#eeeeec")],t=[0,95,135,175,215,255],r=0;r<216;r++){var n=t[r/36%6|0],o=t[r/6%6|0],s=t[r%6];e.push({css:i.channels.toCss(n,o,s),rgba:i.channels.toRgba(n,o,s)})}for(r=0;r<24;r++){var a=8+10*r;e.push({css:i.channels.toCss(a,a,a),rgba:i.channels.toRgba(a,a,a)})}return e}());var h=function(){function e(e,r){this.allowTransparency=r;var h=e.createElement("canvas");h.width=1,h.height=1;var u=h.getContext("2d");if(!u)throw new Error("Could not get rendering context");this._ctx=u,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new n.ColorContrastCache,this.colors={foreground:o,background:s,cursor:a,cursorAccent:c,selectionTransparent:l,selectionOpaque:i.color.blend(s,l),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return e.prototype.onOptionsChange=function(e){"minimumContrastRatio"===e&&this._contrastCache.clear()},e.prototype.setTheme=function(e){void 0===e&&(e={}),this.colors.foreground=this._parseColor(e.foreground,o),this.colors.background=this._parseColor(e.background,s),this.colors.cursor=this._parseColor(e.cursor,a,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,c,!0),this.colors.selectionTransparent=this._parseColor(e.selection,l,!0),this.colors.selectionOpaque=i.color.blend(this.colors.background,this.colors.selectionTransparent),i.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=i.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(e.black,t.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,t.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,t.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,t.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,t.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,t.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,t.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,t.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},e.prototype._parseColor=function(e,t,r){if(void 0===r&&(r=this.allowTransparency),void 0===e)return t;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=e,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+e+" is invalid using fallback "+t.css),t;this._ctx.fillRect(0,0,1,1);var n=this._ctx.getImageData(0,0,1,1).data;if(255!==n[3]){if(!r)return console.warn("Color: "+e+" is using transparency, but allowTransparency is false. Using fallback "+t.css+"."),t;var o=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map((function(e){return Number(e)})),s=o[0],a=o[1],c=o[2],l=o[3],h=Math.round(255*l);return{rgba:i.channels.toRgba(s,a,c,h),css:e}}return{css:this._ctx.fillStyle,rgba:i.channels.toRgba(n[0],n[1],n[2],n[3])}},e}();t.ColorManager=h},9631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,r,i){e.addEventListener(t,r,i);var n=!1;return{dispose:function(){n||(n=!0,e.removeEventListener(t,r,i))}}}},3551:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var o=r(8460),s=r(2585),a=function(){function e(e,t,r){this._bufferService=e,this._logService=t,this._unicodeService=r,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new o.EventEmitter,this._onHideLinkUnderline=new o.EventEmitter,this._onLinkTooltip=new o.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,r){var i=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=r):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,r)),this._mouseZoneManager.clearAll(t,r),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return i._linkifyRows()}),e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var r=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,i=Math.ceil(2e3/this._bufferService.cols),n=this._bufferService.buffer.iterator(!1,t,r,i,i);n.hasNext();)for(var o=n.next(),s=0;s=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t>9&511:void 0;r.validationCallback?r.validationCallback(a,(function(e){n._rowsTimeoutId||e&&n._addLink(l[1],l[0]-n._bufferService.buffer.ydisp,a,r,f)})):c._addLink(l[1],l[0]-c._bufferService.buffer.ydisp,a,r,f)},c=this;null!==(i=o.exec(t))&&"break"!==a(););},e.prototype._addLink=function(e,t,r,i,n){var o=this;if(this._mouseZoneManager&&this._element){var s=this._unicodeService.getStringCellWidth(r),a=e%this._bufferService.cols,l=t+Math.floor(e/this._bufferService.cols),h=(a+s)%this._bufferService.cols,u=l+Math.floor((a+s)/this._bufferService.cols);0===h&&(h=this._bufferService.cols,u--),this._mouseZoneManager.add(new c(a+1,l+1,h+1,u+1,(function(e){if(i.handler)return i.handler(e,r);var t=window.open();t?(t.opener=null,t.location.href=r):console.warn("Opening link blocked as opener could not be cleared")}),(function(){o._onShowLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.add("xterm-cursor-pointer")}),(function(e){o._onLinkTooltip.fire(o._createLinkHoverEvent(a,l,h,u,n)),i.hoverTooltipCallback&&i.hoverTooltipCallback(e,r,{start:{x:a,y:l},end:{x:h,y:u}})}),(function(){o._onHideLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.remove("xterm-cursor-pointer"),i.hoverLeaveCallback&&i.hoverLeaveCallback()}),(function(e){return!i.willLinkActivate||i.willLinkActivate(e,r)})))}},e.prototype._createLinkHoverEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},e._timeBeforeLatency=200,e=i([n(0,s.IBufferService),n(1,s.ILogService),n(2,s.IUnicodeService)],e)}();t.Linkifier=a;var c=function(e,t,r,i,n,o,s,a,c){this.x1=e,this.y1=t,this.x2=r,this.y2=i,this.clickCallback=n,this.hoverCallback=o,this.tooltipCallback=s,this.leaveCallback=a,this.willLinkActivate=c};t.MouseZone=c},6465:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var a=r(2585),c=r(8460),l=r(844),h=r(3656),u=function(e){function t(t){var r=e.call(this)||this;return r._bufferService=t,r._linkProviders=[],r._linkCacheDisposables=[],r._isMouseOut=!0,r._activeLine=-1,r._onShowLinkUnderline=r.register(new c.EventEmitter),r._onHideLinkUnderline=r.register(new c.EventEmitter),r.register(l.getDisposeArrayDisposable(r._linkCacheDisposables)),r}return n(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var r=t._linkProviders.indexOf(e);-1!==r&&t._linkProviders.splice(r,1)}}},t.prototype.attachToDom=function(e,t,r){var i=this;this._element=e,this._mouseService=t,this._renderService=r,this.register(h.addDisposableDomListener(this._element,"mouseleave",(function(){i._isMouseOut=!0,i._clearCurrentLink()}))),this.register(h.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(h.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var r=e.composedPath(),i=0;ie?this._bufferService.cols:s.link.range.end.x,l=a;l<=c;l++){if(r.has(l)){n.splice(o--,1);break}r.add(l)}}},t.prototype._checkLinkProviderResult=function(e,t,r){var i,n=this;if(!this._activeProviderReplies)return r;for(var o=this._activeProviderReplies.get(e),s=!1,a=0;a=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,l.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(e.link,r)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.pointerCursor},set:function(e){var r,i;(null===(r=t._currentLink)||void 0===r?void 0:r.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(i=t._element)||void 0===i||i.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.underline},set:function(r){var i,n,o;(null===(i=t._currentLink)||void 0===i?void 0:i.state)&&(null===(o=null===(n=t._currentLink)||void 0===n?void 0:n.state)||void 0===o?void 0:o.decorations.underline)!==r&&(t._currentLink.state.decorations.underline=r,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,r))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange((function(e){var r=0===e.start?0:e.start+1+t._bufferService.buffer.ydisp;t._clearCurrentLink(r,e.end+1+t._bufferService.buffer.ydisp)}))))}},t.prototype._linkHover=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var r=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)},t.prototype._linkLeave=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)},t.prototype._linkAtPosition=function(e,t){var r=e.range.start.y===e.range.end.y,i=e.range.start.yt.y;return(r&&e.range.start.x<=t.x&&e.range.end.x>=t.x||i&&e.range.end.x>=t.x||n&&e.range.start.x<=t.x||i&&n)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,r){var i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},o([s(0,a.IBufferService)],t)}(l.Disposable);t.Linkifier2=u},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},6954:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s){var a=e.call(this)||this;return a._element=t,a._screenElement=r,a._bufferService=i,a._mouseService=n,a._selectionService=o,a._optionsService=s,a._zones=[],a._areZonesActive=!1,a._lastHoverCoords=[void 0,void 0],a._initialSelectionLength=0,a.register(c.addDisposableDomListener(a._element,"mousedown",(function(e){return a._onMouseDown(e)}))),a._mouseMoveListener=function(e){return a._onMouseMove(e)},a._mouseLeaveListener=function(e){return a._onMouseLeave(e)},a._clickListener=function(e){return a._onClick(e)},a}return n(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var r=0;re&&i.y1<=t+1||i.y2>e&&i.y2<=t+1||i.y1t+1)&&(this._currentZone&&this._currentZone===i&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(r--,1))}0===this._zones.length&&this._deactivate()}},t.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},t.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,r=this._findZoneEventAt(e);r!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),r&&(this._currentZone=r,r.hoverCallback&&r.hoverCallback(e),this._tooltipTimeout=window.setTimeout((function(){return t._onTooltip(e)}),this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),r=this._getSelectionLength();t&&r===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var r=t[0],i=t[1],n=0;n=o.x1&&r=o.x1||i===o.y2&&ro.y1&&i{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0;var r=function(){function e(e){this._renderCallback=e}return e.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.refresh=function(e,t,r){var i=this;this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){return i._innerRefresh()})))},e.prototype._innerRefresh=function(){if(void 0!==this._rowStart&&void 0!==this._rowEnd&&void 0!==this._rowCount){var e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(e,t)}},e}();t.RenderDebouncer=r},5596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._currentDevicePixelRatio=window.devicePixelRatio,t}return n(t,e),t.prototype.setListener=function(e){var t=this;this._listener&&this.clearListener(),this._listener=e,this._outerListener=function(){t._listener&&(t._listener(window.devicePixelRatio,t._currentDevicePixelRatio),t._updateDpr())},this._updateDpr()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.clearListener()},t.prototype._updateDpr=function(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},t.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},t}(r(844).Disposable);t.ScreenDprMonitor=o},3236:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var o=r(2950),s=r(1680),a=r(3614),c=r(2584),l=r(5435),h=r(3525),u=r(3551),f=r(9312),_=r(6114),d=r(3656),p=r(9042),v=r(357),g=r(6954),y=r(4567),b=r(1296),S=r(7399),m=r(8460),C=r(8437),w=r(5680),E=r(3230),L=r(4725),A=r(428),R=r(8934),k=r(6465),x=r(5114),D=r(8969),T=r(4774),O="undefined"!=typeof window?window.document:null,M=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.browser=_,r._keyDownHandled=!1,r._onCursorMove=new m.EventEmitter,r._onKey=new m.EventEmitter,r._onRender=new m.EventEmitter,r._onSelectionChange=new m.EventEmitter,r._onTitleChange=new m.EventEmitter,r._onFocus=new m.EventEmitter,r._onBlur=new m.EventEmitter,r._onA11yCharEmitter=new m.EventEmitter,r._onA11yTabEmitter=new m.EventEmitter,r._setup(),r.linkifier=r._instantiationService.createInstance(u.Linkifier),r.linkifier2=r.register(r._instantiationService.createInstance(k.Linkifier2)),r.register(r._inputHandler.onRequestBell((function(){return r.bell()}))),r.register(r._inputHandler.onRequestRefreshRows((function(e,t){return r.refresh(e,t)}))),r.register(r._inputHandler.onRequestReset((function(){return r.reset()}))),r.register(r._inputHandler.onRequestScroll((function(e,t){return r.scroll(e,t||void 0)}))),r.register(r._inputHandler.onRequestWindowsOptionsReport((function(e){return r._reportWindowsOptions(e)}))),r.register(r._inputHandler.onAnsiColorChange((function(e){return r._changeAnsiColor(e)}))),r.register(m.forwardEvent(r._inputHandler.onCursorMove,r._onCursorMove)),r.register(m.forwardEvent(r._inputHandler.onTitleChange,r._onTitleChange)),r.register(m.forwardEvent(r._inputHandler.onA11yChar,r._onA11yCharEmitter)),r.register(m.forwardEvent(r._inputHandler.onA11yTab,r._onA11yTabEmitter)),r.register(r._bufferService.onResize((function(e){return r._afterResize(e.cols,e.rows)}))),r}return n(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),t.prototype._changeAnsiColor=function(e){var t,r,i=this;this._colorManager&&(e.colors.forEach((function(e){var t=T.rgba.toColor(e.red,e.green,e.blue);i._colorManager.colors.ansi[e.colorIndex]=t})),null===(t=this._renderService)||void 0===t||t.setColors(this._colorManager.colors),null===(r=this.viewport)||void 0===r||r.onThemeChange(this._colorManager.colors))},t.prototype.dispose=function(){var t,r,i;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._renderService)||void 0===t||t.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},null===(i=null===(r=this.element)||void 0===r?void 0:r.parentNode)||void 0===i||i.removeChild(this.element))},t.prototype._setup=function(){e.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(t.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),t.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},t.prototype._updateOptions=function(t){var r,i,n,o;switch(e.prototype._updateOptions.call(this,t),t){case"fontFamily":case"fontSize":null===(r=this._renderService)||void 0===r||r.clear(),null===(i=this._charSizeService)||void 0===i||i.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":null===(n=this.viewport)||void 0===n||n.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)):(null===(o=this._accessibilityManager)||void 0===o||o.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},t.prototype._onTextAreaFocus=function(e){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},t.prototype.blur=function(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()},t.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},t.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var e=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),t=this._bufferService.buffer.y*e,r=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=r+"px",this.textarea.style.top=t+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=e+"px",this.textarea.style.lineHeight=e+"px",this.textarea.style.zIndex="-5"}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register(d.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&a.copyHandler(t,e._selectionService)})));var t=function(t){return a.handlePasteEvent(t,e.textarea,e._coreService)};this.register(d.addDisposableDomListener(this.textarea,"paste",t)),this.register(d.addDisposableDomListener(this.element,"paste",t)),_.isFirefox?this.register(d.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register(d.addDisposableDomListener(this.element,"contextmenu",(function(t){a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),_.isLinux&&this.register(d.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&a.moveTextAreaUnderMouseCursor(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register(d.addDisposableDomListener(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register(d.addDisposableDomListener(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register(d.addDisposableDomListener(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return e._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(t){return e._queueLinkification(t.start,t.end)})))},t.prototype.open=function(e){var t=this;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),this.element.setAttribute("role","document"),e.appendChild(this.element);var r=O.createDocumentFragment();this._viewportElement=O.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this._viewportScrollArea=O.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=O.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=O.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement),this.textarea=O.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),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.register(d.addDisposableDomListener(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register(d.addDisposableDomListener(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var i=this._instantiationService.createInstance(x.CoreBrowserService,this.textarea);this._instantiationService.setService(L.ICoreBrowserService,i),this._charSizeService=this._instantiationService.createInstance(A.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._compositionView=O.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(r),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(O,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme);var n=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,n,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange((function(e){return t._onRender.fire(e)}))),this.onResize((function(e){return t._renderService.resize(e.cols,e.rows)})),this._soundService=this._instantiationService.createInstance(v.SoundService),this._instantiationService.setService(L.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(s.Viewport,(function(e,r){return t.scrollLines(e,r)}),this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar((function(){return t.viewport.syncScrollArea()}))),this.register(this.viewport),this.register(this.onCursorMove((function(){t._renderService.onCursorMove(),t._syncTextArea()}))),this.register(this.onResize((function(){return t._renderService.onResize(t.cols,t.rows)}))),this.register(this.onBlur((function(){return t._renderService.onBlur()}))),this.register(this.onFocus((function(){return t._renderService.onFocus()}))),this.register(this._renderService.onDimensionsChange((function(){return t.viewport.syncScrollArea()}))),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((function(e){return t.scrollLines(e.amount,e.suppressScrollEvent)}))),this.register(this._selectionService.onSelectionChange((function(){return t._onSelectionChange.fire()}))),this.register(this._selectionService.onRequestRedraw((function(e){return t._renderService.onSelectionChanged(e.start,e.end,e.columnSelectMode)}))),this.register(this._selectionService.onLinuxMouseSelection((function(e){t.textarea.value=e,t.textarea.focus(),t.textarea.select()}))),this.register(this.onScroll((function(){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register(d.addDisposableDomListener(this._viewportElement,"scroll",(function(){return t._selectionService.refresh()}))),this._mouseZoneManager=this._instantiationService.createInstance(g.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return t._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(d.addDisposableDomListener(this.element,"mousedown",(function(e){return t._selectionService.onMouseDown(e)}))),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},t.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(h.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(b.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},t.prototype._setTheme=function(e){var t,r,i;this._theme=e,null===(t=this._colorManager)||void 0===t||t.setTheme(e),null===(r=this._renderService)||void 0===r||r.setColors(this._colorManager.colors),null===(i=this.viewport)||void 0===i||i.onThemeChange(this._colorManager.colors)},t.prototype.bindMouse=function(){var e=this,t=this,r=this.element;function i(e){var r,i,n=t._mouseService.getRawByteCoords(e,t.screenElement,t.cols,t.rows);if(!n)return!1;switch(e.overrideType||e.type){case"mousemove":i=32,void 0===e.buttons?(r=3,void 0!==e.button&&(r=e.button<3?e.button:3)):r=1&e.buttons?0:4&e.buttons?1:2&e.buttons?2:3;break;case"mouseup":i=0,r=e.button<3?e.button:3;break;case"mousedown":i=1,r=e.button<3?e.button:3;break;case"wheel":0!==e.deltaY&&(i=e.deltaY<0?0:1),r=4;break;default:return!1}return!(void 0===i||void 0===r||r>4)&&t._coreMouseService.triggerMouseEvent({col:n.x-33,row:n.y-33,button:r,action:i,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o=function(t){return i(t),t.buttons||(e._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.removeEventListener("mousemove",n.mousedrag)),e.cancel(t)},s=function(t){return i(t),t.preventDefault(),e.cancel(t)},a=function(e){e.buttons&&i(e)},l=function(e){e.buttons||i(e)};this.register(this._coreMouseService.onProtocolChange((function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?n.mousemove||(r.addEventListener("mousemove",l),n.mousemove=l):(r.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&t?n.wheel||(r.addEventListener("wheel",s,{passive:!1}),n.wheel=s):(r.removeEventListener("wheel",n.wheel),n.wheel=null),2&t?n.mouseup||(n.mouseup=o):(e._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&t?n.mousedrag||(n.mousedrag=a):(e._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)}))),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(d.addDisposableDomListener(r,"mousedown",(function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return i(t),n.mouseup&&e._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.addEventListener("mousemove",n.mousedrag),e.cancel(t)}))),this.register(d.addDisposableDomListener(r,"wheel",(function(t){if(n.wheel);else if(!e.buffer.hasScrollback){var r=e.viewport.getLinesScrolled(t);if(0===r)return;for(var i=c.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),o="",s=0;s47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,r){t!==this.cols||r!==this.rows?e.prototype.resize.call(this,t,r):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var r,i;null===(r=this._charSizeService)||void 0===r||r.measure(),null===(i=this.viewport)||void 0===i||i.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){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(var e=1;e=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s,a){var l=e.call(this)||this;return l._scrollLines=t,l._viewportElement=r,l._scrollArea=i,l._bufferService=n,l._optionsService=o,l._charSizeService=s,l._renderService=a,l.scrollBarWidth=0,l._currentRowHeight=0,l._lastRecordedBufferLength=0,l._lastRecordedViewportHeight=0,l._lastRecordedBufferHeight=0,l._lastTouchY=0,l._lastScrollTop=0,l._wheelPartialScroll=0,l._refreshAnimationFrame=null,l._ignoreNextScrollEvent=!1,l.scrollBarWidth=l._viewportElement.offsetWidth-l._scrollArea.offsetWidth||15,l.register(c.addDisposableDomListener(l._viewportElement,"scroll",l._onScroll.bind(l))),setTimeout((function(){return l.syncScrollArea()}),0),l}return n(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===t&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)}else this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){var r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&r0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var r=this._optionsService.options.fastScrollModifier;return"alt"===r&&t.altKey||"ctrl"===r&&t.ctrlKey||"shift"===r&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},o([s(3,h.IBufferService),s(4,h.IOptionsService),s(5,l.ICharSizeService),s(6,l.IRenderService)],t)}(a.Disposable);t.Viewport=u},2950:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var o=r(4725),s=r(2585),a=function(){function e(e,t,r,i,n,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._charSizeService=n,this._coreService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((function(){t._compositionPosition.end=t._textarea.value.length}),0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var r={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((function(){if(t._isSendingComposition){t._isSendingComposition=!1;var e;r.start+=t._dataAlreadySent.length,(e=t._isComposing?t._textarea.value.substring(r.start,r.end):t._textarea.value.substring(r.start)).length>0&&t._coreService.triggerDataEvent(e,!0)}}),0)}else{this._isSendingComposition=!1;var i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout((function(){if(!e._isComposing){var r=e._textarea.value.replace(t,"");r.length>0&&(e._dataAlreadySent=r,e._coreService.triggerDataEvent(r,!0))}}),0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var r=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),i=this._bufferService.buffer.y*r,n=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=o.width+"px",this._textarea.style.height=o.height+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},i([n(2,s.IBufferService),n(3,s.IOptionsService),n(4,o.ICharSizeService),n(5,s.ICoreService)],e)}();t.CompositionHelper=a},9806:(e,t)=>{function r(e,t){var r=t.getBoundingClientRect();return[e.clientX-r.left,e.clientY-r.top]}Object.defineProperty(t,"__esModule",{value:!0}),t.getRawByteCoords=t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=r,t.getCoords=function(e,t,i,n,o,s,a,c){if(o){var l=r(e,t);if(l)return l[0]=Math.ceil((l[0]+(c?s/2:0))/s),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),i+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),n),l}},t.getRawByteCoords=function(e){if(e)return{x:e[0]+32,y:e[1]+32}}},9504:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var i=r(2584);function n(e,t,r,i){var n=e-o(r,e),a=t-o(r,t);return l(Math.abs(n-a)-function(e,t,r){for(var i=0,n=e-o(r,e),a=t-o(r,t),c=0;c=0&&tt?"A":"B"}function a(e,t,r,i,n,o){for(var s=e,a=t,c="";s!==r||a!==i;)s+=n?1:-1,n&&s>o.cols-1?(c+=o.buffer.translateBufferLineToString(a,!1,e,s),s=0,e=0,a++):!n&&s<0&&(c+=o.buffer.translateBufferLineToString(a,!1,0,e+1),e=s=o.cols-1,a--);return c+o.buffer.translateBufferLineToString(a,!1,e,s)}function c(e,t){var r=t?"O":"[";return i.C0.ESC+r+e}function l(e,t){e=Math.floor(e);for(var r="",i=0;i0?i-o(s,i):t;var f=i,_=function(e,t,r,i,s,a){var c;return c=n(r,i,s,a).length>0?i-o(s,i):t,e=r&&ce?"D":"C",l(Math.abs(h-e),c(s,i));s=u>t?"D":"C";var f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:h,r)+(f-1)*r.cols+1+((u>t?h:e)-1),c(s,i))}},244:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var r=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var r=this,i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=function(){return r._wrappedAddonDispose(i)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var i=r(511),n=r(3236),o=r(9042),s=r(8460),a=r(244),c=function(){function e(e){this._core=new n.Terminal(e),this._addonManager=new a.AddonManager}return e.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(e.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new f(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unicode",{get:function(){return this._checkProposedApi(),new _(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._checkProposedApi(),this._buffer||(this._buffer=new h(this._core)),this._buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),e.prototype.blur=function(){this._core.blur()},e.prototype.focus=function(){this._core.focus()},e.prototype.resize=function(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)},e.prototype.open=function(e){this._core.open(e)},e.prototype.attachCustomKeyEventHandler=function(e){this._core.attachCustomKeyEventHandler(e)},e.prototype.registerLinkMatcher=function(e,t,r){return this._checkProposedApi(),this._core.registerLinkMatcher(e,t,r)},e.prototype.deregisterLinkMatcher=function(e){this._checkProposedApi(),this._core.deregisterLinkMatcher(e)},e.prototype.registerLinkProvider=function(e){return this._checkProposedApi(),this._core.registerLinkProvider(e)},e.prototype.registerCharacterJoiner=function(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)},e.prototype.deregisterCharacterJoiner=function(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)},e.prototype.registerMarker=function(e){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)},e.prototype.addMarker=function(e){return this.registerMarker(e)},e.prototype.hasSelection=function(){return this._core.hasSelection()},e.prototype.select=function(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)},e.prototype.getSelection=function(){return this._core.getSelection()},e.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},e.prototype.clearSelection=function(){this._core.clearSelection()},e.prototype.selectAll=function(){this._core.selectAll()},e.prototype.selectLines=function(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)},e.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},e.prototype.scrollLines=function(e){this._verifyIntegers(e),this._core.scrollLines(e)},e.prototype.scrollPages=function(e){this._verifyIntegers(e),this._core.scrollPages(e)},e.prototype.scrollToTop=function(){this._core.scrollToTop()},e.prototype.scrollToBottom=function(){this._core.scrollToBottom()},e.prototype.scrollToLine=function(e){this._verifyIntegers(e),this._core.scrollToLine(e)},e.prototype.clear=function(){this._core.clear()},e.prototype.write=function(e,t){this._core.write(e,t)},e.prototype.writeUtf8=function(e,t){this._core.write(e,t)},e.prototype.writeln=function(e,t){this._core.write(e),this._core.write("\r\n",t)},e.prototype.paste=function(e){this._core.paste(e)},e.prototype.getOption=function(e){return this._core.optionsService.getOption(e)},e.prototype.setOption=function(e,t){this._core.optionsService.setOption(e,t)},e.prototype.refresh=function(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)},e.prototype.reset=function(){this._core.reset()},e.prototype.loadAddon=function(e){return this._addonManager.loadAddon(this,e)},Object.defineProperty(e,"strings",{get:function(){return o},enumerable:!1,configurable:!0}),e.prototype._verifyIntegers=function(){for(var e=[],t=0;t=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new i.CellData)},e.prototype.translateToString=function(e,t,r){return this._line.translateToString(e,t,r)},e}(),f=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,(function(e){return t(e.toArray())}))},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,(function(e,r){return t(e,r.toArray())}))},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),_=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},1546:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var i=r(643),n=r(8803),o=r(1420),s=r(3734),a=r(1752),c=r(4774),l=r(9631),h=function(){function e(e,t,r,i,n,o,s,a){this._container=e,this._alpha=i,this._colors=n,this._rendererId=o,this._bufferService=s,this._optionsService=a,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+t+"-layer"),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;l.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=a.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,r){void 0===r&&(r=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=o.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,r,i){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,r){void 0===r&&(r=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,r*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,r){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*r,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,r,i){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,r*this._scaledCellWidth-window.devicePixelRatio,i*this._scaledCellHeight-window.devicePixelRatio)},e.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},e.prototype._clearCells=function(e,t,r,i){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,r){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(r),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,r){var o,s,a=this._getContrastColor(e);a||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,r,a):(e.isInverse()?(o=e.isBgDefault()?n.INVERTED_DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?n.INVERTED_DEFAULT_COLOR:e.getFgColor()):(s=e.isBgDefault()?i.DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?i.DEFAULT_COLOR:e.getFgColor()),o+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||i.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||i.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=s,this._currentGlyphIdentifier.fg=o,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,r))},e.prototype._drawUncachedChars=function(e,t,r,i){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(i)this._ctx.fillStyle=i.css;else if(e.isBgDefault())this._ctx.fillStyle=c.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var o=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8&&(o+=8),this._ctx.fillStyle=this._colors.ansi[o].css}else if(i)this._ctx.fillStyle=i.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var a=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}this._clipRow(r),e.isDim()&&(this._ctx.globalAlpha=n.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var r=e.getFgColor(),i=e.getFgColorMode(),n=e.getBgColor(),o=e.getBgColorMode(),s=!!e.isInverse(),a=!!e.isInverse();if(s){var l=r;r=n,n=l;var h=i;i=o,o=h}var u=this._resolveBackgroundRgba(o,n,s),f=this._resolveForegroundRgba(i,r,s,a),_=c.rgba.ensureContrastRatio(u,f,this._optionsService.options.minimumContrastRatio);if(_){var d={css:c.channels.toCss(_>>24&255,_>>16&255,_>>8&255),rgba:_};return this._colors.contrastCache.setColor(e.bg,e.fg,d),d}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,r){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,r,i){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&i&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=h},5879:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerRegistry=t.JoinedCellData=void 0;var o=r(3734),s=r(643),a=r(511),c=function(e){function t(t,r,i){var n=e.call(this)||this;return n.content=0,n.combinedData="",n.fg=t.fg,n.bg=t.bg,n.combinedData=r,n._width=i,n}return n(t,e),t.prototype.isCombined=function(){return 2097152},t.prototype.getWidth=function(){return this._width},t.prototype.getChars=function(){return this.combinedData},t.prototype.getCode=function(){return 2097151},t.prototype.setFromCharData=function(e){throw new Error("not implemented")},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(o.AttributeData);t.JoinedCellData=c;var l=function(){function e(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}return e.prototype.registerCharacterJoiner=function(e){var t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id},e.prototype.deregisterCharacterJoiner=function(e){for(var t=0;t1)for(var u=this._getJoinedRanges(i,a,o,t,n),f=0;f1)for(u=this._getJoinedRanges(i,a,o,t,n),f=0;f=this._bufferService.rows)this._clearCursor();else{var i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(i,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var n=this._optionsService.options.cursorStyle;return n&&"block"!==n?this._cursorRenderers[n](i,r,this._cell):this._renderBlurCursor(i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=n,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===i&&this._state.y===r&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},t.prototype._renderBarCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,r.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(r,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,r){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,r.getWidth(),1),this._ctx.restore()},t}(o.BaseRenderLayer);t.CursorRenderLayer=c;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=void 0}))))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=a),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0})),t._blinkInterval=window.setInterval((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0}))}),a)}),e)},e.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},3700:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var r=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var r=0;r0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===s.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&a.is256Color(e.fg)?this._ctx.fillStyle=this._colors.ansi[e.fg].css:this._ctx.fillStyle=this._colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(var t=e.y1+1;t=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var a=r(9596),c=r(4149),l=r(2512),h=r(5098),u=r(5879),f=r(844),_=r(4725),d=r(2585),p=r(1420),v=r(8460),g=1,y=function(e){function t(t,r,i,n,o,s,f,_,d){var p=e.call(this)||this;p._colors=t,p._screenElement=r,p._bufferService=o,p._charSizeService=s,p._optionsService=f,p._id=g++,p._onRequestRedraw=new v.EventEmitter;var y=p._optionsService.options.allowTransparency;return p._characterJoinerRegistry=new u.CharacterJoinerRegistry(p._bufferService),p._renderLayers=[new a.TextRenderLayer(p._screenElement,0,p._colors,p._characterJoinerRegistry,y,p._id,p._bufferService,f),new c.SelectionRenderLayer(p._screenElement,1,p._colors,p._id,p._bufferService,f),new h.LinkRenderLayer(p._screenElement,2,p._colors,p._id,i,n,p._bufferService,f),new l.CursorRenderLayer(p._screenElement,3,p._colors,p._id,p._onRequestRedraw,p._bufferService,f,_,d)],p.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},p._devicePixelRatio=window.devicePixelRatio,p._updateDimensions(),p.onOptionsChanged(),p}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,r=this._renderLayers;t{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e}},4149:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;var o=function(e){function t(t,r,i,n,o,s){var a=e.call(this,t,"selection",r,!0,i,n,o,s)||this;return a._clearState(),a}return n(t,e),t.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._clearState()},t.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},t.prototype.onSelectionChanged=function(e,t,r){if(this._didStateChange(e,t,r,this._bufferService.buffer.ydisp))if(this._clearAll(),e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(o>=this._bufferService.rows||s<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=this._colors.selectionTransparent.css,r){var a=e[0],c=t[0]-a,l=s-o+1;this._fillCells(a,o,c,l)}else{a=i===o?e[0]:0;var h=o===n?t[0]:this._bufferService.cols;this._fillCells(a,o,h-a,1);var u=Math.max(s-o-1,0);if(this._fillCells(0,o+1,this._bufferService.cols,u),o!==s){var f=n===s?t[0]:this._bufferService.cols;this._fillCells(0,s,f,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=r,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,r,i){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||r!==this._state.columnSelectMode||i!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(r(1546).BaseRenderLayer);t.SelectionRenderLayer=o},9596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.TextRenderLayer=void 0;var o=r(3700),s=r(1546),a=r(3734),c=r(643),l=r(5879),h=r(511),u=function(e){function t(t,r,i,n,s,a,c,l){var u=e.call(this,t,"text",r,s,i,a,c,l)||this;return u._characterWidth=0,u._characterFont="",u._characterOverlapCache={},u._workCell=new h.CellData,u._state=new o.GridCache,u._characterJoinerRegistry=n,u}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t);var r=this._getFont(!1,!1);this._characterWidth===t.scaledCharWidth&&this._characterFont===r||(this._characterWidth=t.scaledCharWidth,this._characterFont=r,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},t.prototype.reset=function(){this._state.clear(),this._clearAll()},t.prototype._forEachCell=function(e,t,r,i){for(var n=e;n<=t;n++)for(var o=n+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.lines.get(o),a=r?r.getJoinedCharacters(o):[],h=0;h0&&h===a[0][0]){f=!0;var d=a.shift();u=new l.JoinedCellData(this._workCell,s.translateToString(!0,d[0],d[1]),d[1]-d[0]),_=d[1]-1}!f&&this._isOverlapping(u)&&_this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=r,r},t}(s.BaseRenderLayer);t.TextRenderLayer=u},9616:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCharAtlas=void 0;var r=function(){function e(){this._didWarmUp=!1}return e.prototype.dispose=function(){},e.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},e.prototype._doWarmUp=function(){},e.prototype.beginFrame=function(){},e}();t.BaseCharAtlas=r},1420:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var i=r(2040),n=r(1906),o=[];t.acquireCharAtlas=function(e,t,r,s,a){for(var c=i.generateConfig(s,a,e,r),l=0;l=0){if(i.configEquals(u.config,c))return u.atlas;1===u.ownedBy.length?(u.atlas.dispose(),o.splice(l,1)):u.ownedBy.splice(h,1);break}}for(l=0;l{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;var i=r(643);t.generateConfig=function(e,t,r,i){var n={foreground:i.foreground,background:i.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:i.ansi};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:e,scaledCharHeight:t,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,colors:n}},t.configEquals=function(e,t){for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.CHAR_ATLAS_CELL_SPACING=1},1906:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NoneCharAtlas=t.DynamicCharAtlas=t.getGlyphCacheKey=void 0;var o=r(8803),s=r(9616),a=r(5680),c=r(7001),l=r(6114),h=r(1752),u=r(4774),f={css:"rgba(0, 0, 0, 0)",rgba:0};function _(e){return e.code<<21|e.bg<<12|e.fg<<3|(e.bold?0:4)+(e.dim?0:2)+(e.italic?0:1)}t.getGlyphCacheKey=_;var d=function(e){function t(t,r){var i=e.call(this)||this;i._config=r,i._drawToCacheCount=0,i._glyphsWaitingOnBitmap=[],i._bitmapCommitTimeout=null,i._bitmap=null,i._cacheCanvas=t.createElement("canvas"),i._cacheCanvas.width=1024,i._cacheCanvas.height=1024,i._cacheCtx=h.throwIfFalsy(i._cacheCanvas.getContext("2d",{alpha:!0}));var n=t.createElement("canvas");n.width=i._config.scaledCharWidth,n.height=i._config.scaledCharHeight,i._tmpCtx=h.throwIfFalsy(n.getContext("2d",{alpha:i._config.allowTransparency})),i._width=Math.floor(1024/i._config.scaledCharWidth),i._height=Math.floor(1024/i._config.scaledCharHeight);var o=i._width*i._height;return i._cacheMap=new c.LRUMap(o),i._cacheMap.prealloc(o),i}return n(t,e),t.prototype.dispose=function(){null!==this._bitmapCommitTimeout&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},t.prototype.beginFrame=function(){this._drawToCacheCount=0},t.prototype.draw=function(e,t,r,i){if(32===t.code)return!0;if(!this._canCache(t))return!1;var n=_(t),o=this._cacheMap.get(n);if(null!=o)return this._drawFromCache(e,o,r,i),!0;if(this._drawToCacheCount<100){var s;s=this._cacheMap.size>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,s=0;s{Object.defineProperty(t,"__esModule",{value:!0}),t.LRUMap=void 0;var r=function(){function e(e){this.capacity=e,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return e.prototype._unlinkNode=function(e){var t=e.prev,r=e.next;e===this._head&&(this._head=r),e===this._tail&&(this._tail=t),null!==t&&(t.next=r),null!==r&&(r.prev=t)},e.prototype._appendNode=function(e){var t=this._tail;null!==t&&(t.next=e),e.prev=t,e.next=null,this._tail=e,null===this._head&&(this._head=e)},e.prototype.prealloc=function(e){for(var t=this._nodePool,r=0;r=this.capacity)r=this._head,this._unlinkNode(r),delete this._map[r.key],r.key=e,r.value=t,this._map[e]=r;else{var i=this._nodePool;i.length>0?((r=i.pop()).key=e,r.value=t):r={prev:null,next:null,key:e,value:t},this._map[e]=r,this.size++}this._appendNode(r)},e}();t.LRUMap=r},1296:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var a=r(3787),c=r(8803),l=r(844),h=r(4725),u=r(2585),f=r(8460),_=r(4774),d=r(9631),p="xterm-dom-renderer-owner-",v="xterm-fg-",g="xterm-bg-",y="xterm-focus",b=1,S=function(e){function t(t,r,i,n,o,s,c,l,h){var u=e.call(this)||this;return u._colors=t,u._element=r,u._screenElement=i,u._viewportElement=n,u._linkifier=o,u._linkifier2=s,u._charSizeService=c,u._optionsService=l,u._bufferService=h,u._terminalClass=b++,u._rowElements=[],u._rowContainer=document.createElement("div"),u._rowContainer.classList.add("xterm-rows"),u._rowContainer.style.lineHeight="normal",u._rowContainer.setAttribute("aria-hidden","true"),u._refreshRowElements(u._bufferService.cols,u._bufferService.rows),u._selectionContainer=document.createElement("div"),u._selectionContainer.classList.add("xterm-selection"),u._selectionContainer.setAttribute("aria-hidden","true"),u.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},u._updateDimensions(),u._injectCss(),u._rowFactory=new a.DomRendererRowFactory(document,u._optionsService,u._colors),u._element.classList.add(p+u._terminalClass),u._screenElement.appendChild(u._rowContainer),u._screenElement.appendChild(u._selectionContainer),u._linkifier.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u._linkifier2.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier2.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new f.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove(p+this._terminalClass),d.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var e=0,t=this._rowElements;et;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove(y)},t.prototype.onFocus=function(){this._rowContainer.classList.add(y)},t.prototype.onSelectionChanged=function(e,t,r){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(!(o>=this._bufferService.rows||s<0)){var a=document.createDocumentFragment();if(r)a.appendChild(this._createSelectionElement(o,e[0],t[0],s-o+1));else{var c=i===o?e[0]:0,l=o===n?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,c,l));var h=s-o-1;if(a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,h)),o!==s){var u=n===s?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,0,u))}}this._selectionContainer.appendChild(a)}}},t.prototype._createSelectionElement=function(e,t,r,i){void 0===i&&(i=1);var n=document.createElement("div");return n.style.height=i*this.dimensions.actualCellHeight+"px",n.style.top=e*this.dimensions.actualCellHeight+"px",n.style.left=t*this.dimensions.actualCellWidth+"px",n.style.width=this.dimensions.actualCellWidth*(r-t)+"px",n},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e=n&&(e=0,r++)}},o([s(6,h.ICharSizeService),s(7,u.IOptionsService),s(8,u.IBufferService)],t)}(l.Disposable);t.DomRenderer=S},3787:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var i=r(8803),n=r(643),o=r(511),s=r(4774);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var a=function(){function e(e,t,r){this._document=e,this._optionsService=t,this._colors=r,this._workCell=new o.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,r,o,a,l,h,u){for(var f=this._document.createDocumentFragment(),_=0,d=Math.min(e.length,u)-1;d>=0;d--)if(e.loadCell(d,this._workCell).getCode()!==n.NULL_CELL_CODE||r&&d===a){_=d+1;break}for(d=0;d<_;d++){e.loadCell(d,this._workCell);var p=this._workCell.getWidth();if(0!==p){var v=this._document.createElement("span");if(p>1&&(v.style.width=h*p+"px"),r&&d===a)switch(v.classList.add(t.CURSOR_CLASS),l&&v.classList.add(t.CURSOR_BLINK_CLASS),o){case"bar":v.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":v.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:v.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&v.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&v.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&v.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&v.classList.add(t.UNDERLINE_CLASS),this._workCell.isInvisible()?v.textContent=n.WHITESPACE_CELL_CHAR:v.textContent=this._workCell.getChars()||n.WHITESPACE_CELL_CHAR;var g=this._workCell.getFgColor(),y=this._workCell.getFgColorMode(),b=this._workCell.getBgColor(),S=this._workCell.getBgColorMode(),m=!!this._workCell.isInverse();if(m){var C=g;g=b,b=C;var w=y;y=S,S=w}switch(y){case 16777216:case 33554432:this._workCell.isBold()&&g<8&&this._optionsService.options.drawBoldTextInBrightColors&&(g+=8),this._applyMinimumContrast(v,this._colors.background,this._colors.ansi[g])||v.classList.add("xterm-fg-"+g);break;case 50331648:var E=s.rgba.toColor(g>>16&255,g>>8&255,255&g);this._applyMinimumContrast(v,this._colors.background,E)||this._addStyle(v,"color:#"+c(g.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(v,this._colors.background,this._colors.foreground)||m&&v.classList.add("xterm-fg-"+i.INVERTED_DEFAULT_COLOR)}switch(S){case 16777216:case 33554432:v.classList.add("xterm-bg-"+b);break;case 50331648:this._addStyle(v,"background-color:#"+c(b.toString(16),"0",6));break;case 0:default:m&&v.classList.add("xterm-bg-"+i.INVERTED_DEFAULT_COLOR)}f.appendChild(v)}}return f},e.prototype._applyMinimumContrast=function(e,t,r){if(1===this._optionsService.options.minimumContrastRatio)return!1;var i=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===i&&(i=s.color.ensureContrastRatio(t,r,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=i?i:null)),!!i&&(this._addStyle(e,"color:"+i.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function c(e,t,r){for(;e.length{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0;var r=function(){function e(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}return e.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(e.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=r},428:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var o=r(2585),s=r(8460),a=function(){function e(e,t,r){this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=new s.EventEmitter,this._measureStrategy=new c(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},i([n(2,o.IOptionsService)],e)}();t.CharSizeService=a;var c=function(){function e(e,t,r){this._document=e,this._parentElement=t,this._optionsService=r,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},5114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var r=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return(this._textarea.getRootNode?this._textarea.getRootNode():document).activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=r},8934:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var o=r(4725),s=r(9806),a=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,r,i,n){return s.getCoords(e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,n)},e.prototype.getRawByteCoords=function(e,t,r,i){var n=this.getCoords(e,t,r,i);return s.getRawByteCoords(n)},i([n(0,o.IRenderService),n(1,o.ICharSizeService)],e)}();t.MouseService=a},3230:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var a=r(6193),c=r(8460),l=r(844),h=r(5596),u=r(3656),f=r(2585),_=r(4725),d=function(e){function t(t,r,i,n,o,s){var l=e.call(this)||this;if(l._renderer=t,l._rowCount=r,l._charSizeService=o,l._isPaused=!1,l._needsFullRefresh=!1,l._isNextRenderRedrawOnly=!0,l._needsSelectionRefresh=!1,l._canvasWidth=0,l._canvasHeight=0,l._selectionState={start:void 0,end:void 0,columnSelectMode:!1},l._onDimensionsChange=new c.EventEmitter,l._onRender=new c.EventEmitter,l._onRefreshRequest=new c.EventEmitter,l.register({dispose:function(){return l._renderer.dispose()}}),l._renderDebouncer=new a.RenderDebouncer((function(e,t){return l._renderRows(e,t)})),l.register(l._renderDebouncer),l._screenDprMonitor=new h.ScreenDprMonitor,l._screenDprMonitor.setListener((function(){return l.onDevicePixelRatioChange()})),l.register(l._screenDprMonitor),l.register(s.onResize((function(e){return l._fullRefresh()}))),l.register(n.onOptionChange((function(){return l._renderer.onOptionsChanged()}))),l.register(l._charSizeService.onCharSizeChange((function(){return l.onCharSizeChanged()}))),l._renderer.onRequestRedraw((function(e){return l.refreshRows(e.start,e.end,!0)})),l.register(u.addDisposableDomListener(window,"resize",(function(){return l.onDevicePixelRatioChange()}))),"IntersectionObserver"in window){var f=new IntersectionObserver((function(e){return l._onIntersectionChange(e[e.length-1])}),{threshold:0});f.observe(i),l.register({dispose:function(){return f.disconnect()}})}return l}return n(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,r){void 0===r&&(r=!1),this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw((function(e){return t.refreshRows(e.start,e.end,!0)})),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.onSelectionChanged(e,t,r)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},o([s(3,f.IOptionsService),s(4,_.ICharSizeService),s(5,f.IBufferService)],t)}(l.Disposable);t.RenderService=d},9312:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var a=r(6114),c=r(456),l=r(511),h=r(8460),u=r(4725),f=r(2585),_=r(9806),d=r(9504),p=r(844),v=String.fromCharCode(160),g=new RegExp(v,"g"),y=function(e){function t(t,r,i,n,o,s,a){var u=e.call(this)||this;return u._element=t,u._screenElement=r,u._bufferService=i,u._coreService=n,u._mouseService=o,u._optionsService=s,u._renderService=a,u._dragScrollAmount=0,u._enabled=!0,u._workCell=new l.CellData,u._mouseDownTimeStamp=0,u._oldHasSelection=!1,u._oldSelectionStart=void 0,u._oldSelectionEnd=void 0,u._onLinuxMouseSelection=u.register(new h.EventEmitter),u._onRedrawRequest=u.register(new h.EventEmitter),u._onSelectionChange=u.register(new h.EventEmitter),u._onRequestScrollLines=u.register(new h.EventEmitter),u._mouseMoveListener=function(e){return u._onMouseMove(e)},u._mouseUpListener=function(e){return u._onMouseUp(e)},u._coreService.onUserInput((function(){u.hasSelection&&u.clearSelection()})),u._trimListener=u._bufferService.buffer.lines.onTrim((function(e){return u._onTrim(e)})),u.register(u._bufferService.buffers.onBufferActivate((function(e){return u._onBufferActivate(e)}))),u.enable(),u._model=new c.SelectionModel(u._bufferService),u._activeSelectionMode=0,u}return n(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var r=this._bufferService.buffer,i=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var n=e[1];n<=t[1];n++){var o=r.translateBufferLineToString(n,!0,e[0],t[0]);i.push(o)}}else{var s=e[1]===t[1]?t[0]:void 0;for(i.push(r.translateBufferLineToString(e[1],!0,e[0],s)),n=e[1]+1;n<=t[1]-1;n++){var c=r.lines.get(n);o=r.translateBufferLineToString(n,!0),c&&c.isWrapped?i[i.length-1]+=o:i.push(o)}e[1]!==t[1]&&(c=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]),c&&c.isWrapped?i[i.length-1]+=o:i.push(o))}return i.map((function(e){return e.replace(g," ")})).join(a.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame((function(){return t._refresh()}))),a.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype._isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!(r&&i&&t)&&this._areCoordsInSelection(t,r,i)},t.prototype._areCoordsInSelection=function(e,t,r){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]},t.prototype._selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=_.getCoordsRelativeToElement(e,this._screenElement)[1],r=this._renderService.dimensions.canvasHeight;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return a.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval((function(){return e._dragScroll()}),50)},t.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(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){this._model.selectionEnd=void 0;var t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(a.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var r=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(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.getOption("altClickMovesCursor")){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&void 0!==r[0]&&void 0!==r[1]){var i=d.moveToCellSequence(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()},t.prototype._fireEventIfSelectionChanged=function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);r?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,r)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,r)},t.prototype._fireOnSelectionChange=function(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((function(e){return t._onTrim(e)}))},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var r=t[0],i=0;t[0]>=i;i++){var n=e.loadCell(i,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:n>1&&t[0]!==i&&(r+=n-1)}return r},t.prototype.setSelection=function(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh()},t.prototype.rightClickSelect=function(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e),this._fireEventIfSelectionChanged())},t.prototype._getWordAt=function(e,t,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),!(e[0]>=this._bufferService.cols)){var n=this._bufferService.buffer,o=n.lines.get(e[1]);if(o){var s=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e),c=a,l=e[0]-a,h=0,u=0,f=0,_=0;if(" "===s.charAt(a)){for(;a>0&&" "===s.charAt(a-1);)a--;for(;c1&&(_+=v-1,c+=v-1);d>0&&a>0&&!this._isCharWordSeparator(o.loadCell(d-1,this._workCell));){o.loadCell(d-1,this._workCell);var g=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,d--):g>1&&(f+=g-1,a-=g-1),a--,d--}for(;p1&&(_+=y-1,c+=y-1),c++,p++}}c++;var b=a+l-h+f,S=Math.min(this._bufferService.cols,c-a+h+u-f-_);if(t||""!==s.slice(a,c).trim()){if(r&&0===b&&32!==o.getCodePoint(0)){var m=n.lines.get(e[1]-1);if(m&&o.isWrapped&&32!==m.getCodePoint(this._bufferService.cols-1)){var C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){var w=this._bufferService.cols-C.start;b-=w,S+=w}}}if(i&&b+S===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){var E=n.lines.get(e[1]+1);if(E&&E.isWrapped&&32!==E.getCodePoint(0)){var L=this._getWordAt([0,e[1]+1],!1,!1,!0);L&&(S+=L.length)}}return{start:b,length:S}}}}},t.prototype._selectWordAt=function(e,t){var r=this._getWordAt(e,t);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}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var r=e[1];t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},o([s(2,f.IBufferService),s(3,f.ICoreService),s(4,u.IMouseService),s(5,f.IOptionsService),s(6,u.IRenderService)],t)}(p.Disposable);t.SelectionService=y},4725:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var i=r(8343);t.ICharSizeService=i.createDecorator("CharSizeService"),t.ICoreBrowserService=i.createDecorator("CoreBrowserService"),t.IMouseService=i.createDecorator("MouseService"),t.IRenderService=i.createDecorator("RenderService"),t.ISelectionService=i.createDecorator("SelectionService"),t.ISoundService=i.createDecorator("SoundService")},357:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var o=r(2585),s=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var r=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),(function(e){r.buffer=e,r.connect(t.destination),r.start(0)}))}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),r=t.length,i=new Uint8Array(r),n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;var i=r(8460),n=function(){function e(e){this._maxLength=e,this.onDeleteEmitter=new i.EventEmitter,this.onInsertEmitter=new i.EventEmitter,this.onTrimEmitter=new i.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(e.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(e){if(this._maxLength!==e){for(var t=new Array(e),r=0;rthis._length)for(var t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(n=0;nthis._maxLength){var o=this._length+r.length-this._maxLength;this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)}else this._length+=r.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,r){if(!(t<=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(var i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));var n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(i=0;i{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,r){if(void 0===r&&(r=5),"object"!=typeof t)return t;var i=Array.isArray(t)?[]:{};for(var n in t)i[n]=r<=1?t[n]:t[n]?e(t[n],r-1):t[n];return i}},8969:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;var o=r(844),s=r(2585),a=r(4348),c=r(7866),l=r(744),h=r(7302),u=r(6975),f=r(8460),_=r(1753),d=r(3730),p=r(1480),v=r(7994),g=r(9282),y=r(5435),b=r(5981),S=function(e){function t(t){var r=e.call(this)||this;return r._onBinary=new f.EventEmitter,r._onData=new f.EventEmitter,r._onLineFeed=new f.EventEmitter,r._onResize=new f.EventEmitter,r._onScroll=new f.EventEmitter,r._instantiationService=new a.InstantiationService,r.optionsService=new h.OptionsService(t),r._instantiationService.setService(s.IOptionsService,r.optionsService),r._bufferService=r.register(r._instantiationService.createInstance(l.BufferService)),r._instantiationService.setService(s.IBufferService,r._bufferService),r._logService=r._instantiationService.createInstance(c.LogService),r._instantiationService.setService(s.ILogService,r._logService),r._coreService=r.register(r._instantiationService.createInstance(u.CoreService,(function(){return r.scrollToBottom()}))),r._instantiationService.setService(s.ICoreService,r._coreService),r._coreMouseService=r._instantiationService.createInstance(_.CoreMouseService),r._instantiationService.setService(s.ICoreMouseService,r._coreMouseService),r._dirtyRowService=r._instantiationService.createInstance(d.DirtyRowService),r._instantiationService.setService(s.IDirtyRowService,r._dirtyRowService),r.unicodeService=r._instantiationService.createInstance(p.UnicodeService),r._instantiationService.setService(s.IUnicodeService,r.unicodeService),r._charsetService=r._instantiationService.createInstance(v.CharsetService),r._instantiationService.setService(s.ICharsetService,r._charsetService),r._inputHandler=new y.InputHandler(r._bufferService,r._charsetService,r._coreService,r._dirtyRowService,r._logService,r.optionsService,r._coreMouseService,r.unicodeService),r.register(f.forwardEvent(r._inputHandler.onLineFeed,r._onLineFeed)),r.register(r._inputHandler),r.register(f.forwardEvent(r._bufferService.onResize,r._onResize)),r.register(f.forwardEvent(r._coreService.onData,r._onData)),r.register(f.forwardEvent(r._coreService.onBinary,r._onBinary)),r.register(r.optionsService.onOptionChange((function(e){return r._updateOptions(e)}))),r._writeBuffer=new b.WriteBuffer((function(e){return r._inputHandler.parse(e)})),r}return n(t,e),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)},t.prototype.write=function(e,t){this._writeBuffer.write(e,t)},t.prototype.writeSync=function(e){this._writeBuffer.writeSync(e)},t.prototype.resize=function(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,l.MINIMUM_COLS),t=Math.max(t,l.MINIMUM_ROWS),this._bufferService.resize(e,t))},t.prototype.scroll=function(e,t){void 0===t&&(t=!1);var r,i=this._bufferService.buffer;(r=this._cachedBlankLine)&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;var n=i.ybase+i.scrollTop,o=i.ybase+i.scrollBottom;if(0===i.scrollTop){var s=i.lines.isFull;o===i.lines.length-1?s?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(o+1,0,r.clone()),s?this._bufferService.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this._bufferService.isUserScrolling||i.ydisp++)}else{var a=o-n+1;i.lines.shiftElements(n+1,a-1,-1),i.lines.set(o,r.clone())}this._bufferService.isUserScrolling||(i.ydisp=i.ybase),this._dirtyRowService.markRangeDirty(i.scrollTop,i.scrollBottom),this._onScroll.fire(i.ydisp)},t.prototype.scrollLines=function(e,t){var r=this._bufferService.buffer;if(e<0){if(0===r.ydisp)return;this._bufferService.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this._bufferService.isUserScrolling=!1);var i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},t.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},t.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},t.prototype.scrollToLine=function(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},t.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},t.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},t.prototype._updateOptions=function(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},(function(){return g.updateWindowsModeWrappedState(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,r=t;e{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0;var r=function(){function e(){this._listeners=[],this._disposed=!1}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){if(!e._disposed)for(var r=0;r24)return t.setWinLines||!1;switch(e){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}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(o=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var C=function(){function e(e,t,r,i){this._bufferService=e,this._coreService=t,this._logService=r,this._optionsService=i,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,r){this._data=h.concat(this._data,e.subarray(t,r))},e.prototype.unhook=function(e){if(!e)return this._data=new Uint32Array(0),!0;var t=u.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r0"q'+s.C0.ESC+"\\");break;case'"p':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r61;1"p'+s.C0.ESC+"\\");break;case"r":var r=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+r+s.C0.ESC+"\\");break;case"m":this._coreService.triggerDataEvent(s.C0.ESC+"P1$r0m"+s.C0.ESC+"\\");break;case" q":var i={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];i-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+i+" q"+s.C0.ESC+"\\");break;default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(s.C0.ESC+"P0$r"+s.C0.ESC+"\\")}return!0},e}(),w=function(e){function t(t,r,i,n,o,l,h,d,v){void 0===v&&(v=new c.EscapeSequenceParser);var y=e.call(this)||this;y._bufferService=t,y._charsetService=r,y._coreService=i,y._dirtyRowService=n,y._logService=o,y._optionsService=l,y._coreMouseService=h,y._unicodeService=d,y._parser=v,y._parseBuffer=new Uint32Array(4096),y._stringDecoder=new u.StringToUtf32,y._utf8Decoder=new u.Utf8ToUtf32,y._workCell=new p.CellData,y._windowTitle="",y._iconName="",y._windowTitleStack=[],y._iconNameStack=[],y._curAttrData=f.DEFAULT_ATTR_DATA.clone(),y._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),y._onRequestBell=new _.EventEmitter,y._onRequestRefreshRows=new _.EventEmitter,y._onRequestReset=new _.EventEmitter,y._onRequestScroll=new _.EventEmitter,y._onRequestSyncScrollBar=new _.EventEmitter,y._onRequestWindowsOptionsReport=new _.EventEmitter,y._onA11yChar=new _.EventEmitter,y._onA11yTab=new _.EventEmitter,y._onCursorMove=new _.EventEmitter,y._onLineFeed=new _.EventEmitter,y._onScroll=new _.EventEmitter,y._onTitleChange=new _.EventEmitter,y._onAnsiColorChange=new _.EventEmitter,y.register(y._parser),y._parser.setCsiHandlerFallback((function(e,t){y._logService.debug("Unknown CSI code: ",{identifier:y._parser.identToString(e),params:t.toArray()})})),y._parser.setEscHandlerFallback((function(e){y._logService.debug("Unknown ESC code: ",{identifier:y._parser.identToString(e)})})),y._parser.setExecuteHandlerFallback((function(e){y._logService.debug("Unknown EXECUTE code: ",{code:e})})),y._parser.setOscHandlerFallback((function(e,t,r){y._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:r})})),y._parser.setDcsHandlerFallback((function(e,t,r){"HOOK"===t&&(r=r.toArray()),y._logService.debug("Unknown DCS code: ",{identifier:y._parser.identToString(e),action:t,payload:r})})),y._parser.setPrintHandler((function(e,t,r){return y.print(e,t,r)})),y._parser.registerCsiHandler({final:"@"},(function(e){return y.insertChars(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"@"},(function(e){return y.scrollLeft(e)})),y._parser.registerCsiHandler({final:"A"},(function(e){return y.cursorUp(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"A"},(function(e){return y.scrollRight(e)})),y._parser.registerCsiHandler({final:"B"},(function(e){return y.cursorDown(e)})),y._parser.registerCsiHandler({final:"C"},(function(e){return y.cursorForward(e)})),y._parser.registerCsiHandler({final:"D"},(function(e){return y.cursorBackward(e)})),y._parser.registerCsiHandler({final:"E"},(function(e){return y.cursorNextLine(e)})),y._parser.registerCsiHandler({final:"F"},(function(e){return y.cursorPrecedingLine(e)})),y._parser.registerCsiHandler({final:"G"},(function(e){return y.cursorCharAbsolute(e)})),y._parser.registerCsiHandler({final:"H"},(function(e){return y.cursorPosition(e)})),y._parser.registerCsiHandler({final:"I"},(function(e){return y.cursorForwardTab(e)})),y._parser.registerCsiHandler({final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({prefix:"?",final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({prefix:"?",final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({final:"L"},(function(e){return y.insertLines(e)})),y._parser.registerCsiHandler({final:"M"},(function(e){return y.deleteLines(e)})),y._parser.registerCsiHandler({final:"P"},(function(e){return y.deleteChars(e)})),y._parser.registerCsiHandler({final:"S"},(function(e){return y.scrollUp(e)})),y._parser.registerCsiHandler({final:"T"},(function(e){return y.scrollDown(e)})),y._parser.registerCsiHandler({final:"X"},(function(e){return y.eraseChars(e)})),y._parser.registerCsiHandler({final:"Z"},(function(e){return y.cursorBackwardTab(e)})),y._parser.registerCsiHandler({final:"`"},(function(e){return y.charPosAbsolute(e)})),y._parser.registerCsiHandler({final:"a"},(function(e){return y.hPositionRelative(e)})),y._parser.registerCsiHandler({final:"b"},(function(e){return y.repeatPrecedingCharacter(e)})),y._parser.registerCsiHandler({final:"c"},(function(e){return y.sendDeviceAttributesPrimary(e)})),y._parser.registerCsiHandler({prefix:">",final:"c"},(function(e){return y.sendDeviceAttributesSecondary(e)})),y._parser.registerCsiHandler({final:"d"},(function(e){return y.linePosAbsolute(e)})),y._parser.registerCsiHandler({final:"e"},(function(e){return y.vPositionRelative(e)})),y._parser.registerCsiHandler({final:"f"},(function(e){return y.hVPosition(e)})),y._parser.registerCsiHandler({final:"g"},(function(e){return y.tabClear(e)})),y._parser.registerCsiHandler({final:"h"},(function(e){return y.setMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"h"},(function(e){return y.setModePrivate(e)})),y._parser.registerCsiHandler({final:"l"},(function(e){return y.resetMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"l"},(function(e){return y.resetModePrivate(e)})),y._parser.registerCsiHandler({final:"m"},(function(e){return y.charAttributes(e)})),y._parser.registerCsiHandler({final:"n"},(function(e){return y.deviceStatus(e)})),y._parser.registerCsiHandler({prefix:"?",final:"n"},(function(e){return y.deviceStatusPrivate(e)})),y._parser.registerCsiHandler({intermediates:"!",final:"p"},(function(e){return y.softReset(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"q"},(function(e){return y.setCursorStyle(e)})),y._parser.registerCsiHandler({final:"r"},(function(e){return y.setScrollRegion(e)})),y._parser.registerCsiHandler({final:"s"},(function(e){return y.saveCursor(e)})),y._parser.registerCsiHandler({final:"t"},(function(e){return y.windowOptions(e)})),y._parser.registerCsiHandler({final:"u"},(function(e){return y.restoreCursor(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"}"},(function(e){return y.insertColumns(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"~"},(function(e){return y.deleteColumns(e)})),y._parser.setExecuteHandler(s.C0.BEL,(function(){return y.bell()})),y._parser.setExecuteHandler(s.C0.LF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.VT,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.FF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.CR,(function(){return y.carriageReturn()})),y._parser.setExecuteHandler(s.C0.BS,(function(){return y.backspace()})),y._parser.setExecuteHandler(s.C0.HT,(function(){return y.tab()})),y._parser.setExecuteHandler(s.C0.SO,(function(){return y.shiftOut()})),y._parser.setExecuteHandler(s.C0.SI,(function(){return y.shiftIn()})),y._parser.setExecuteHandler(s.C1.IND,(function(){return y.index()})),y._parser.setExecuteHandler(s.C1.NEL,(function(){return y.nextLine()})),y._parser.setExecuteHandler(s.C1.HTS,(function(){return y.tabSet()})),y._parser.registerOscHandler(0,new g.OscHandler((function(e){return y.setTitle(e),y.setIconName(e),!0}))),y._parser.registerOscHandler(1,new g.OscHandler((function(e){return y.setIconName(e)}))),y._parser.registerOscHandler(2,new g.OscHandler((function(e){return y.setTitle(e)}))),y._parser.registerOscHandler(4,new g.OscHandler((function(e){return y.setAnsiColor(e)}))),y._parser.registerEscHandler({final:"7"},(function(){return y.saveCursor()})),y._parser.registerEscHandler({final:"8"},(function(){return y.restoreCursor()})),y._parser.registerEscHandler({final:"D"},(function(){return y.index()})),y._parser.registerEscHandler({final:"E"},(function(){return y.nextLine()})),y._parser.registerEscHandler({final:"H"},(function(){return y.tabSet()})),y._parser.registerEscHandler({final:"M"},(function(){return y.reverseIndex()})),y._parser.registerEscHandler({final:"="},(function(){return y.keypadApplicationMode()})),y._parser.registerEscHandler({final:">"},(function(){return y.keypadNumericMode()})),y._parser.registerEscHandler({final:"c"},(function(){return y.fullReset()})),y._parser.registerEscHandler({final:"n"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"o"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"|"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"}"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"~"},(function(){return y.setgLevel(1)})),y._parser.registerEscHandler({intermediates:"%",final:"@"},(function(){return y.selectDefaultCharset()})),y._parser.registerEscHandler({intermediates:"%",final:"G"},(function(){return y.selectDefaultCharset()}));var b=function(e){S._parser.registerEscHandler({intermediates:"(",final:e},(function(){return y.selectCharset("("+e)})),S._parser.registerEscHandler({intermediates:")",final:e},(function(){return y.selectCharset(")"+e)})),S._parser.registerEscHandler({intermediates:"*",final:e},(function(){return y.selectCharset("*"+e)})),S._parser.registerEscHandler({intermediates:"+",final:e},(function(){return y.selectCharset("+"+e)})),S._parser.registerEscHandler({intermediates:"-",final:e},(function(){return y.selectCharset("-"+e)})),S._parser.registerEscHandler({intermediates:".",final:e},(function(){return y.selectCharset("."+e)})),S._parser.registerEscHandler({intermediates:"/",final:e},(function(){return y.selectCharset("/"+e)}))},S=this;for(var m in a.CHARSETS)b(m);return y._parser.registerEscHandler({intermediates:"#",final:"8"},(function(){return y.screenAlignmentPattern()})),y._parser.setErrorHandler((function(e){return y._logService.error("Parsing error: ",e),e})),y._parser.registerDcsHandler({intermediates:"$",final:"q"},new C(y._bufferService,y._coreService,y._logService,y._optionsService)),y}return n(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onAnsiColorChange",{get:function(){return this._onAnsiColorChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,r=t.x,i=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.lengthS)for(var n=0;n0&&2===_.getWidth(o.x-1)&&_.setCellFromCodePoint(o.x-1,0,1,f.fg,f.bg,f.extended);for(var p=t;p=c)if(l){for(;o.x=this._bufferService.rows&&(o.y=this._bufferService.rows-1),o.lines.get(o.ybase+o.y).isWrapped=!0),_=o.lines.get(o.ybase+o.y)}else if(o.x=c-1,2===n)continue;if(h&&(_.insertCells(o.x,n,o.getNullCell(f),f),2===_.getWidth(c-1)&&_.setCellFromCodePoint(c-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,f.fg,f.bg,f.extended)),_.setCellFromCodePoint(o.x++,i,n,f.fg,f.bg,f.extended),n>0)for(;--n;)_.setCellFromCodePoint(o.x++,0,0,f.fg,f.bg,f.extended)}else _.getWidth(o.x-1)?_.addCodepointToCell(o.x-1,i):_.addCodepointToCell(o.x-2,i)}r-t>0&&(_.loadCell(o.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),o.x0&&0===_.getWidth(o.x)&&!_.hasContent(o.x)&&_.setCellFromCodePoint(o.x,0,1,f.fg,f.bg,f.extended),this._dirtyRowService.markDirty(o.y)},t.prototype.addCsiHandler=function(e,t){var r=this;return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(function(e){return!m(e.params[0],r._optionsService.options.windowOptions)||t(e)}))},t.prototype.addDcsHandler=function(e,t){return this._parser.registerDcsHandler(e,new y.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.registerEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.registerOscHandler(e,new g.OscHandler(t))},t.prototype.bell=function(){return this._onRequestBell.fire(),!0},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;return this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire(),!0},t.prototype.carriageReturn=function(){return this._bufferService.buffer.x=0,!0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),t.x>0&&t.x--,!0;if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var r=t.lines.get(t.ybase+t.y);r.hasWidth(t.x)&&!r.hasContent(t.x)&&t.x--}return this._restrictCursor(),!0},t.prototype.tab=function(){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;var e=this._bufferService.buffer.x;return this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e),!0},t.prototype.shiftOut=function(){return this._charsetService.setgLevel(1),!0},t.prototype.shiftIn=function(){return this._charsetService.setgLevel(0),!0},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0},t.prototype.cursorForward=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.cursorBackward=function(e){return this._moveCursor(-(e.params[0]||1),0),!0},t.prototype.cursorNextLine=function(e){return this.cursorDown(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorPrecedingLine=function(e){return this.cursorUp(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorCharAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.cursorPosition=function(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0},t.prototype.charPosAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.hPositionRelative=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.linePosAbsolute=function(e){return this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1),!0},t.prototype.vPositionRelative=function(e){return this._moveCursor(0,e.params[0]||1),!0},t.prototype.hVPosition=function(e){return this.cursorPosition(e),!0},t.prototype.tabClear=function(e){var t=e.params[0];return 0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={}),!0},t.prototype.cursorForwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop();return!0},t.prototype.cursorBackwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1,r=this._bufferService.buffer;t--;)r.x=r.prevStop();return!0},t.prototype._eraseInBufferLine=function(e,t,r,i){void 0===i&&(i=!1);var n=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);n.replaceCells(t,r,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i&&(n.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowService.markDirty(t-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var r=this._bufferService.buffer.lines.length-this._bufferService.rows;r>0&&(this._bufferService.buffer.lines.trimStart(r),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-r,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-r,0),this._onScroll.fire(0))}return!0},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}return this._dirtyRowService.markDirty(this._bufferService.buffer.y),!0},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,r=this._bufferService.buffer;if(r.y>r.scrollBottom||r.yr.scrollBottom||r.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0},t.prototype.sendDeviceAttributesSecondary=function(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t=2||2===i[1]&&o+n>=5)break;i[1]&&(n=1)}while(++o+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg,!0;for(var t,r=e.length,i=this._curAttrData,n=0;n=30&&t<=37?(i.fg&=-50331904,i.fg|=16777216|t-30):t>=40&&t<=47?(i.bg&=-50331904,i.bg|=16777216|t-40):t>=90&&t<=97?(i.fg&=-50331904,i.fg|=16777224|t-90):t>=100&&t<=107?(i.bg&=-50331904,i.bg|=16777224|t-100):0===t?(i.fg=f.DEFAULT_ATTR_DATA.fg,i.bg=f.DEFAULT_ATTR_DATA.bg):1===t?i.fg|=134217728:3===t?i.bg|=67108864:4===t?(i.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,i)):5===t?i.fg|=536870912:7===t?i.fg|=67108864:8===t?i.fg|=1073741824:2===t?i.bg|=134217728:21===t?this._processUnderline(2,i):22===t?(i.fg&=-134217729,i.bg&=-134217729):23===t?i.bg&=-67108865:24===t?i.fg&=-268435457:25===t?i.fg&=-536870913:27===t?i.fg&=-67108865:28===t?i.fg&=-1073741825:39===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):49===t?(i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?n+=this._extractColor(e,n,i):59===t?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):100===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t);return!0},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(s.C0.ESC+"[0n");break;case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"["+t+";"+r+"R")}return!0},t.prototype.deviceStatusPrivate=function(e){switch(e.params[0]){case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"[?"+t+";"+r+"R")}return!0},t.prototype.softReset=function(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){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"}var r=t%2==1;return this._optionsService.options.cursorBlink=r,!0},t.prototype.setScrollRegion=function(e){var t,r=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>r&&(this._bufferService.buffer.scrollTop=r-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0)),!0},t.prototype.windowOptions=function(e){if(!m(e.params[0],this._optionsService.options.windowOptions))return!0;var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(o.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(o.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(s.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0},t.prototype.saveCursor=function(e){return this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,!0},t.prototype.restoreCursor=function(e){return this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor(),!0},t.prototype.setTitle=function(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0},t.prototype.setIconName=function(e){return this._iconName=e,!0},t.prototype._parseAnsiColorChange=function(e){for(var t,r={colors:[]},i=/(\d+);rgb:([0-9a-f]{2})\/([0-9a-f]{2})\/([0-9a-f]{2})/gi;null!==(t=i.exec(e));)r.colors.push({colorIndex:parseInt(t[1]),red:parseInt(t[2],16),green:parseInt(t[3],16),blue:parseInt(t[4],16)});return 0===r.colors.length?null:r},t.prototype.setAnsiColor=function(e){var t=this._parseAnsiColorChange(e);return t?this._onAnsiColorChange.fire(t):this._logService.warn("Expected format ;rgb:// but got data: "+e),!0},t.prototype.nextLine=function(){return this._bufferService.buffer.x=0,this.index(),!0},t.prototype.keypadApplicationMode=function(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0},t.prototype.keypadNumericMode=function(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0},t.prototype.selectDefaultCharset=function(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),!0},t.prototype.selectCharset=function(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(b[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET),!0)},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;return this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor(),!0},t.prototype.tabSet=function(){return this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0,!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;if(e.y===e.scrollTop){var t=e.scrollBottom-e.scrollTop;e.lines.shiftElements(e.ybase+e.y,t,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)}else e.y--,this._restrictCursor();return!0},t.prototype.fullReset=function(){return this._parser.reset(),this._onRequestReset.fire(),!0},t.prototype.reset=function(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){return this._charsetService.setgLevel(e),!0},t.prototype.screenAlignmentPattern=function(){var e=new p.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.Disposable=void 0;var r=function(){function e(){this._disposables=[],this._isDisposed=!1}return e.prototype.dispose=function(){this._isDisposed=!0;for(var e=0,t=this._disposables;e{Object.defineProperty(t,"__esModule",{value:!0}),t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isFirefox=void 0;var r="undefined"==typeof navigator,i=r?"node":navigator.userAgent,n=r?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),t.isIpad="iPad"===n,t.isIphone="iPhone"===n,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),t.isLinux=n.indexOf("Linux")>=0},8273:(e,t)=>{function r(e,t,r,i){if(void 0===r&&(r=0),void 0===i&&(i=e.length),r>=e.length)return e;r=(e.length+r)%e.length,i=i>=e.length?e.length:(e.length+i)%e.length;for(var n=r;n{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;var i=r(643);t.updateWindowsModeWrappedState=function(e){var t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),r=null==t?void 0:t.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&r&&(n.isWrapped=r[i.CHAR_DATA_CODE_INDEX]!==i.NULL_CELL_CODE&&r[i.CHAR_DATA_CODE_INDEX]!==i.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;var r=function(){function e(){this.fg=0,this.bg=0,this.extended=new i}return e.toColorRGB=function(e){return[e>>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.prototype.getUnderlineColor=function(){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()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=r;var i=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=i},9092:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var i=r(6349),n=r(8437),o=r(511),s=r(643),a=r(4634),c=r(4863),l=r(7116),h=r(3734);t.MAX_BUFFER_SIZE=4294967295;var u=function(){function e(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=l.DEFAULT_CHARSET,this.markers=[],this._nullCell=o.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]),this._whitespaceCell=o.CellData.fromCharData([0,s.WHITESPACE_CELL_CHAR,s.WHITESPACE_CELL_WIDTH,s.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=n.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},e.prototype.resize=function(e,t){var r=this.getNullCell(n.DEFAULT_ATTR_DATA),i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,r)));else for(a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(o=0;othis._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var r=a.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(r.length>0){var i=a.reflowLargerCreateNewLayout(this.lines,r);a.reflowLargerApplyNewLayout(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,r){for(var i=this.getNullCell(n.DEFAULT_ATTR_DATA),o=r;o-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;s--){var c=this.lines.get(s);if(!(!c||!c.isWrapped&&c.getTrimmedLength()<=e)){for(var l=[c];c.isWrapped&&s>0;)c=this.lines.get(--s),l.unshift(c);var h=this.ybase+this.y;if(!(h>=s&&h0&&(i.push({start:s+l.length+o,newLines:p}),o+=p.length),l.push.apply(l,p);var y=_.length-1,b=_[y];0===b&&(b=_[--y]);for(var S=l.length-d-1,m=f;S>=0;){var C=Math.min(m,b);if(l[y].copyCellsFrom(l[S],m-C,b-C,C,!0),0==(b-=C)&&(b=_[--y]),0==(m-=C)){S--;var w=Math.max(S,0);m=a.getWrappedLineTrimmedLength(l,w,this._cols)}}for(v=0;v0;)0===this.ybase?this.y0){var L=[],A=[];for(v=0;v=0;v--)if(D&&D.start>k+T){for(var O=D.newLines.length-1;O>=0;O--)this.lines.set(v--,D.newLines[O]);v++,L.push({index:k+1,amount:D.newLines.length}),T+=D.newLines.length,D=i[++x]}else this.lines.set(v,A[k--]);var M=0;for(v=L.length-1;v>=0;v--)L[v].index+=M,this.lines.onInsertEmitter.fire(L[v]),M+=L[v].amount;var P=Math.max(0,R+o-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}},e.prototype.stringIndexToBufferIndex=function(e,t,r){for(void 0===r&&(r=!1);t;){var i=this.lines.get(e);if(!i)return[-1,-1];for(var n=r?i.getTrimmedLength():i.length,o=0;o0&&this.lines.get(t).isWrapped;)t--;for(;r+10;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,r=new c.Marker(e);return this.markers.push(r),r.register(this.lines.onTrim((function(e){r.line-=e,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((function(e){r.line>=e.index&&(r.line+=e.amount)}))),r.register(this.lines.onDelete((function(e){r.line>=e.index&&r.linee.index&&(r.line-=e.amount)}))),r.register(r.onDispose((function(){return t._removeMarker(r)}))),r},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,r,i,n){return new f(this,e,t,r,i,n)},e}();t.Buffer=u;var f=function(){function e(e,t,r,i,n,o){void 0===r&&(r=0),void 0===i&&(i=e.lines.length),void 0===n&&(n=0),void 0===o&&(o=0),this._buffer=e,this._trimRight=t,this._startIndex=r,this._endIndex=i,this._startOverscan=n,this._endOverscan=o,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",r=e.first;r<=e.last;++r)t+=this._buffer.translateBufferLineToString(r,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=f},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;var i=r(482),n=r(643),o=r(511),s=r(3734);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);var a=function(){function e(e,t,r){void 0===r&&(r=!1),this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);for(var i=t||o.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]),s=0;s>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]},e.prototype.set=function(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?i.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var r=3*e;return t.content=this._data[r+0],t.fg=this._data[r+1],t.bg=this._data[r+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,r,i,n,o){268435456&n&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=i,this._data[3*e+2]=n},e.prototype.addCodepointToCell=function(e,t){var r=this._data[3*e+0];2097152&r?this._combined[e]+=i.stringFromCodePoint(t):(2097151&r?(this._combined[e]=i.stringFromCodePoint(2097151&r)+i.stringFromCodePoint(t),r&=-2097152,r|=2097152):r=t|1<<22,this._data[3*e+0]=r)},e.prototype.insertCells=function(e,t,r,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new s.ExtendedAttrs),t=0;--a)this.setCell(e+t+a,this.loadCell(e+a,n));for(a=0;athis.length){var r=new Uint32Array(3*e);this.length&&(3*e=e&&delete this._combined[o]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,r,i,n){var o=e._data;if(n)for(var s=i-1;s>=0;s--)for(var a=0;a<3;a++)this._data[3*(r+s)+a]=o[3*(t+s)+a];else for(s=0;s=t&&(this._combined[l-t+r]=e._combined[l])}},e.prototype.translateToString=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===r&&(r=this.length),e&&(r=Math.min(r,this.getTrimmedLength()));for(var o="";t>22||1}return o},e}();t.BufferLine=a},4634:(e,t)=>{function r(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();var i=!e[t].hasContent(r-1)&&1===e[t].getWidth(r-1),n=2===e[t+1].getWidth(0);return i&&n?r-1:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,i,n,o){for(var s=[],a=0;a=a&&n0&&(S>u||0===h[S].getTrimmedLength());S--)b++;b>0&&(s.push(a+h.length-b),s.push(b)),a+=h.length-1}}}return s},t.reflowLargerCreateNewLayout=function(e,t){for(var r=[],i=0,n=t[i],o=0,s=0;sl&&(s-=l,a++);var h=2===e[a].getWidth(s-1);h&&s--;var u=h?i-1:i;n.push(u),c+=u}return n},t.getWrappedLineTrimmedLength=r},5295:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var o=r(9092),s=r(8460),a=function(e){function t(t,r){var i=e.call(this)||this;return i._optionsService=t,i._bufferService=r,i._onBufferActivate=i.register(new s.EventEmitter),i.reset(),i}return n(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this.setupTabStops()},Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},t.prototype.activateAltBuffer=function(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}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(r(844).Disposable);t.BufferSet=a},511:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;var o=r(482),s=r(643),a=r(3734),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.content=0,t.fg=0,t.bg=0,t.extended=new a.ExtendedAttrs,t.combinedData="",t}return n(t,e),t.fromCharData=function(e){var r=new t;return r.setFromCharData(e),r},t.prototype.isCombined=function(){return 2097152&this.content},t.prototype.getWidth=function(){return this.content>>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?o.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[s.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[s.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[s.CHAR_DATA_CHAR_INDEX].length){var r=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){var i=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(r-55296)+i-56320+65536|e[s.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[s.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[s.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[s.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(a.AttributeData);t.CellData=c},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=256,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var o=r(8460),s=function(e){function t(r){var i=e.call(this)||this;return i.line=r,i._id=t._nextId++,i.isDisposed=!1,i._onDispose=new o.EventEmitter,i}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),e.prototype.dispose.call(this))},t._nextId=1,t}(r(844).Disposable);t.Marker=s},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,(i=t.C0||(t.C0={})).NUL="\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="",i.BS="\b",i.HT="\t",i.LF="\n",i.VT="\v",i.FF="\f",i.CR="\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL="",(r=t.C1||(t.C1={})).PAD="€",r.HOP="",r.BPH="‚",r.NBH="ƒ",r.IND="„",r.NEL="…",r.SSA="†",r.ESA="‡",r.HTS="ˆ",r.HTJ="‰",r.VTS="Š",r.PLD="‹",r.PLU="Œ",r.RI="",r.SS2="Ž",r.SS3="",r.DCS="",r.PU1="‘",r.PU2="’",r.STS="“",r.CCH="”",r.MW="•",r.SPA="–",r.EPA="—",r.SOS="˜",r.SGCI="™",r.SCI="š",r.CSI="›",r.ST="œ",r.OSC="",r.PM="ž",r.APC="Ÿ"},7399:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;var i=r(2584),n={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,r,o){var s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B");break;case 8:if(e.shiftKey){s.key=i.C0.BS;break}if(e.altKey){s.key=i.C0.ESC+i.C0.DEL;break}s.key=i.C0.DEL;break;case 9:if(e.shiftKey){s.key=i.C0.ESC+"[Z";break}s.key=i.C0.HT,s.cancel=!0;break;case 13:s.key=e.altKey?i.C0.ESC+i.C0.CR:i.C0.CR,s.cancel=!0;break;case 27:s.key=i.C0.ESC,e.altKey&&(s.key=i.C0.ESC+i.C0.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"D",s.key===i.C0.ESC+"[1;3D"&&(s.key=i.C0.ESC+(r?"b":"[1;5D"))):s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"C",s.key===i.C0.ESC+"[1;3C"&&(s.key=i.C0.ESC+(r?"f":"[1;5C"))):s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"A",r||s.key!==i.C0.ESC+"[1;3A"||(s.key=i.C0.ESC+"[1;5A")):s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"B",r||s.key!==i.C0.ESC+"[1;3B"||(s.key=i.C0.ESC+"[1;5B")):s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=i.C0.ESC+"[2~");break;case 46:s.key=a?i.C0.ESC+"[3;"+(a+1)+"~":i.C0.ESC+"[3~";break;case 36:s.key=a?i.C0.ESC+"[1;"+(a+1)+"H":t?i.C0.ESC+"OH":i.C0.ESC+"[H";break;case 35:s.key=a?i.C0.ESC+"[1;"+(a+1)+"F":t?i.C0.ESC+"OF":i.C0.ESC+"[F";break;case 33:e.shiftKey?s.type=2:s.key=i.C0.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:s.key=i.C0.ESC+"[6~";break;case 112:s.key=a?i.C0.ESC+"[1;"+(a+1)+"P":i.C0.ESC+"OP";break;case 113:s.key=a?i.C0.ESC+"[1;"+(a+1)+"Q":i.C0.ESC+"OQ";break;case 114:s.key=a?i.C0.ESC+"[1;"+(a+1)+"R":i.C0.ESC+"OR";break;case 115:s.key=a?i.C0.ESC+"[1;"+(a+1)+"S":i.C0.ESC+"OS";break;case 116:s.key=a?i.C0.ESC+"[15;"+(a+1)+"~":i.C0.ESC+"[15~";break;case 117:s.key=a?i.C0.ESC+"[17;"+(a+1)+"~":i.C0.ESC+"[17~";break;case 118:s.key=a?i.C0.ESC+"[18;"+(a+1)+"~":i.C0.ESC+"[18~";break;case 119:s.key=a?i.C0.ESC+"[19;"+(a+1)+"~":i.C0.ESC+"[19~";break;case 120:s.key=a?i.C0.ESC+"[20;"+(a+1)+"~":i.C0.ESC+"[20~";break;case 121:s.key=a?i.C0.ESC+"[21;"+(a+1)+"~":i.C0.ESC+"[21~";break;case 122:s.key=a?i.C0.ESC+"[23;"+(a+1)+"~":i.C0.ESC+"[23~";break;case 123:s.key=a?i.C0.ESC+"[24;"+(a+1)+"~":i.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(r&&!o||!e.altKey||e.metaKey)!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?s.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(s.key=i.C0.US):65===e.keyCode&&(s.type=1);else{var c=n[e.keyCode],l=c&&c[e.shiftKey?1:0];if(l)s.key=i.C0.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){var h=e.ctrlKey?e.keyCode-64:e.keyCode+32;s.key=i.C0.ESC+String.fromCharCode(h)}}else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=i.C0.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=i.C0.DEL:219===e.keyCode?s.key=i.C0.ESC:220===e.keyCode?s.key=i.C0.FS:221===e.keyCode&&(s.key=i.C0.GS)}return s}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=e.length);for(var i="",n=t;n65535?(o-=65536,i+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i};var r=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i=0,n=0;this._interim&&(56320<=(a=e.charCodeAt(n++))&&a<=57343?t[i++]=1024*(this._interim-55296)+a-56320+65536:(t[i++]=this._interim,t[i++]=a),this._interim=0);for(var o=n;o=r)return this._interim=s,i;var a;56320<=(a=e.charCodeAt(o))&&a<=57343?t[i++]=1024*(s-55296)+a-56320+65536:(t[i++]=s,t[i++]=a)}else 65279!==s&&(t[i++]=s)}return i},e}();t.StringToUtf32=r;var i=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i,n,o,s,a=0,c=0,l=0;if(this.interim[0]){var h=!1,u=this.interim[0];u&=192==(224&u)?31:224==(240&u)?15:7;for(var f=0,_=void 0;(_=63&this.interim[++f])&&f<4;)u<<=6,u|=_;for(var d=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,p=d-f;l=r)return 0;if(128!=(192&(_=e[l++]))){l--,h=!0;break}this.interim[f++]=_,u<<=6,u|=63&_}h||(2===d?u<128?l--:t[a++]=u:3===d?u<2048||u>=55296&&u<=57343||65279===u||(t[a++]=u):u<65536||u>1114111||(t[a++]=u)),this.interim.fill(0)}for(var v=r-4,g=l;g=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if((c=(31&i)<<6|63&n)<128){g--;continue}t[a++]=c}else if(224==(240&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if((c=(15&i)<<12|(63&n)<<6|63&o)<2048||c>=55296&&c<=57343||65279===c)continue;t[a++]=c}else if(240==(248&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,this.interim[2]=o,a;if(128!=(192&(s=e[g++]))){g--;continue}if((c=(7&i)<<18|(63&n)<<12|(63&o)<<6|63&s)<65536||c>1114111)continue;t[a++]=c}}return a},e}();t.Utf8ToUtf32=i},225:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var i,n=r(8273),o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],a=function(){function e(){if(this.version="6",!i){i=new Uint8Array(65536),n.fill(i,1),i[0]=0,n.fill(i,0,1,32),n.fill(i,0,127,160),n.fill(i,2,4352,4448),i[9001]=2,i[9002]=2,n.fill(i,2,11904,42192),i[12351]=1,n.fill(i,2,44032,55204),n.fill(i,2,63744,64256),n.fill(i,2,65040,65050),n.fill(i,2,65072,65136),n.fill(i,2,65280,65377),n.fill(i,2,65504,65511);for(var e=0;et[n][1])return!1;for(;n>=i;)if(e>t[r=i+n>>1][1])i=r+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=a},5981:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var r=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout((function(){return r._innerWrite()}))),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var r=this._writeBuffer[this._bufferOffset],i=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(r),this._pendingData-=r.length,i&&i(),Date.now()-t>=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((function(){return e._innerWrite()}),0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=r},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var i=r(482),n=r(8742),o=r(5770),s=[],a=function(){function e(){this._handlers=Object.create(null),this._active=s,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=s},e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=s,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||s,this._active.length)for(var r=this._active.length-1;r>=0;r--)this._active[r].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,r){if(this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._ident,"PUT",i.utf32ToString(e,t,r))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=s,this._ident=0},e}();t.DcsParser=a;var c=new n.Params;c.addParam(0);var l=function(){function e(e){this._handler=e,this._data="",this._params=c,this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.length>1||e.params[0]?e.clone():c,this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=i.utf32ToString(e,t,r),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params)),this._params=c,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},2015:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var o=r(844),s=r(8273),a=r(8742),c=r(6242),l=r(6351),h=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){s.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,r,i){this.table[t<<8|e]=r<<4|i},e.prototype.addMany=function(e,t,r,i){for(var n=0;n1)throw new Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&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(var i=0;in||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");var o=e.final.charCodeAt(0);if(t[0]>o||o>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(r<<=8)|o},r.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},r.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},r.prototype.setPrintHandler=function(e){this._printHandler=e},r.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},r.prototype.registerEscHandler=function(e,t){var r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);var i=this._escHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},r.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},r.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},r.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},r.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},r.prototype.registerCsiHandler=function(e,t){var r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);var i=this._csiHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},r.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},r.prototype.registerDcsHandler=function(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)},r.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},r.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},r.prototype.registerOscHandler=function(e,t){return this._oscParser.registerHandler(e,t)},r.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},r.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},r.prototype.setErrorHandler=function(e){this._errorHandler=e},r.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},r.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},r.prototype.parse=function(e,t){for(var r=0,i=0,n=this.currentState,o=this._oscParser,s=this._dcsParser,a=this._collect,c=this._params,l=this._transitions.table,h=0;h>4){case 2:for(var f=h+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=0&&!_[d](c);d--);d<0&&this._csiHandlerFb(a<<8|r,c),this.precedingCodepoint=0;break;case 8:do{switch(r){case 59:c.addParam(0);break;case 58:c.addSubParam(-1);break;default:c.addDigit(r-48)}}while(++h47&&r<60);h--;break;case 9:a<<=8,a|=r;break;case 10:for(var p=this._escHandlers[a<<8|r],v=p?p.length-1:-1;v>=0&&!p[v]();v--);v<0&&this._escHandlerFb(a<<8|r),this.precedingCodepoint=0;break;case 11:c.reset(),c.addParam(0),a=0;break;case 12:s.hook(a<<8|r,c);break;case 13:for(var g=h+1;;++g)if(g>=t||24===(r=e[g])||26===r||27===r||r>127&&r=t||(r=e[y])<32||r>127&&r{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;var i=r(5770),n=r(482),o=[],s=function(){function e(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=o},e.prototype.reset=function(){2===this._state&&this.end(!1),this._active=o,this._id=-1,this._state=0},e.prototype._start=function(){if(this._active=this._handlers[this._id]||o,this._active.length)for(var e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,r){if(this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r);else this._handlerFb(this._id,"PUT",n.utf32ToString(e,t,r))},e.prototype._end=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].end(e);t--);for(t--;t>=0;t--)this._active[t].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._state=1},e.prototype.put=function(e,t,r){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,r)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._active=o,this._id=-1,this._state=0)},e}();t.OscParser=s;var a=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=n.utf32ToString(e,t,r),this._data.length>i.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=a},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;var r=2147483647,i=function(){function e(e,t){if(void 0===e&&(e=32),void 0===t&&(t=32),this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var r=new e;if(!t.length)return r;for(var i=t[0]instanceof Array?1:0;i>8,i=255&this._subParamsIdx[t];i-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,i))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>r?r:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>r?r:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-t>0?this._subParams.subarray(t,r):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t>8,i=255&this._subParamsIdx[t];i-r>0&&(e[t]=this._subParams.slice(r,i))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var i=this._digitIsSub?this._subParams:this.params,n=i[t-1];i[t-1]=~n?Math.min(10*n+e,r):e}},e}();t.Params=i},744:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var a=r(2585),c=r(5295),l=r(8460),h=r(844);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var u=function(e){function r(r){var i=e.call(this)||this;return i._optionsService=r,i.isUserScrolling=!1,i._onResize=new l.EventEmitter,i.cols=Math.max(r.options.cols,t.MINIMUM_COLS),i.rows=Math.max(r.options.rows,t.MINIMUM_ROWS),i.buffers=new c.BufferSet(r,i),i}return n(r,e),Object.defineProperty(r.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),r.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},r.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},r.prototype.reset=function(){this.buffers.reset(),this.isUserScrolling=!1},o([s(0,a.IOptionsService)],r)}(h.Disposable);t.BufferService=u},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var r=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=r},1753:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var o=r(2585),s=r(8460),a={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function c(e,t){var r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||t||(r|=3)),r}var l=String.fromCharCode,h={DEFAULT:function(e){var t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":""+l(t[0])+l(t[1])+l(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"[<"+c(e,!0)+";"+e.col+";"+e.row+t}},u=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new s.EventEmitter,this._lastEvent=null;for(var r=0,i=Object.keys(a);r=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},i([n(0,o.IBufferService),n(1,o.ICoreService)],e)}();t.CoreMouseService=u},6975:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var a=r(2585),c=r(8460),l=r(1439),h=r(844),u=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),_=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o._bufferService=r,o._logService=i,o._optionsService=n,o.isCursorInitialized=!1,o.isCursorHidden=!1,o._onData=o.register(new c.EventEmitter),o._onUserInput=o.register(new c.EventEmitter),o._onBinary=o.register(new c.EventEmitter),o._scrollToBottom=t,o.register({dispose:function(){return o._scrollToBottom=void 0}}),o.modes=l.clone(u),o.decPrivateModes=l.clone(f),o}return n(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=l.clone(u),this.decPrivateModes=l.clone(f)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var r=this._bufferService.buffer;r.ybase!==r.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onBinary.fire(e))},o([s(1,a.IBufferService),s(2,a.ILogService),s(3,a.IOptionsService)],t)}(h.Disposable);t.CoreService=_},3730:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var o=r(2585),s=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){ethis._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var r=e;e=t,t=r}ethis._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},i([n(0,o.IBufferService)],e)}();t.DirtyRowService=s},4348:function(e,t,r){var i=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t0?n[0].index:t.length;if(t.length!==u)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(u+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,i([void 0],i(t,s))))},e}();t.InstantiationService=a},7866:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var i=r(8460),n=r(6114),o=r(1439);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:t.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1});var s=["normal","bold","100","200","300","400","500","600","700","800","900"],a=["cols","rows"],c=function(){function e(e){this._onOptionChange=new i.EventEmitter,this.options=o.clone(t.DEFAULT_OPTIONS);for(var r=0,n=Object.keys(e);r{function r(e,t,r){t.di$target===t?t.di$dependencies.push({id:e,index:r}):(t.di$dependencies=[{id:e,index:r}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);var i=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");r(i,e,n)};return i.toString=function(){return e},t.serviceRegistry.set(e,i),i}},2585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IUnicodeService=t.IOptionsService=t.ILogService=t.IInstantiationService=t.IDirtyRowService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;var i=r(8343);t.IBufferService=i.createDecorator("BufferService"),t.ICoreMouseService=i.createDecorator("CoreMouseService"),t.ICoreService=i.createDecorator("CoreService"),t.ICharsetService=i.createDecorator("CharsetService"),t.IDirtyRowService=i.createDecorator("DirtyRowService"),t.IInstantiationService=i.createDecorator("InstantiationService"),t.ILogService=i.createDecorator("LogService"),t.IOptionsService=i.createDecorator("OptionsService"),t.IUnicodeService=i.createDecorator("UnicodeService")},1480:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;var i=r(8460),n=r(225),o=function(){function e(){this._providers=Object.create(null),this._active="",this._onChange=new i.EventEmitter;var e=new n.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}return Object.defineProperty(e.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._active},set:function(e){if(!this._providers[e])throw new Error('unknown Unicode version "'+e+'"');this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)},enumerable:!1,configurable:!0}),e.prototype.register=function(e){this._providers[e.version]=e},e.prototype.wcwidth=function(e){return this._activeProvider.wcwidth(e)},e.prototype.getStringCellWidth=function(e){for(var t=0,r=e.length,i=0;i=r)return t+this.wcwidth(n);var o=e.charCodeAt(i);56320<=o&&o<=57343?n=1024*(n-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(n)}return t},e}();t.UnicodeService=o}},t={};return function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}(4389)})()})); +//# sourceMappingURL=xterm.js.map + +SSHyClient.settings = function() { + // Local echo reduces latency on regular key presses to aruond 0.04s compared to ~0.2s without it + this.localEcho = 0; // 0 - off; 1 - auto; 2 - on + + /* Default the bindings to bash */ + this.fsHintEnter = "\x1b\x5b\x3f\x31"; // seems to be the same for all shells + this.fsHintLeave = SSHyClient.bashFsHintLeave; + + this.autoEchoState = false; // false = no echoing ; true = echoing + this.autoEchoTimeout = 0; // stores the time of last autoecho change + + this.blockedKeys = [':']; // while localecho(force-on) don't echo these keys + + this.keepAliveInterval = undefined; // stores the setInterval() reference + + this.fontSize = 16; + + this.colorTango = true + this.colorNames = Object.keys(this.colorSchemes); + this.colorCounter = 0; // Stores the current index of the theme loaded in colorSchemes + + this.shellString = ''; // Used to buffer shell identifications ie ']0;fish' or 'user@host$' + + this.sidenavElementState = 0; // Stores the state of the sidenav (0 - closed, [x] - true) + // Caches the DOM elements + this.rxElement = document.getElementById('rxTraffic'); + this.txElement = document.getElementById('txTraffic'); + this.autoEchoElement = document.getElementById('autoEchoState'); + + this.rsaCheckEnabled = true; +}; +SSHyClient.settings.prototype = { + // All our supported terminal color themes in [bg, color1, .... , color15, cursor, fg] + colorSchemes: [ + ['Solarized', {background:"#002b36", black:"#002b36", red:"#dc322f", green:"#859900", yellow:"#b58900", blue:"#268bd2", magenta:"#6c71c4", cyan:"#2aa198", white:"#93a1a1", brightBlack:"#657b83", brightRed:"#dc322f", brightGreen:"#859900", brightYellow:"#b58900", brightBlue:"#268bd2", brightMagenta:"#6c71c4", brightCyan:"#2aa198", brightWhite:"#fdf6e3", cursor:"#93a1a1", foreground:"#93a1a1"}], + ['Material', {background:"#263238", black:"#263238", red:"#ff9800", green:"#8bc34a", yellow:"#ffc107", blue:"#03a9f4", magenta:"#e91e63", cyan:"#009688", white:"#cfd8dc", brightBlack:"#37474f", brightRed:"#ffa74d", brightGreen:"#9ccc65", brightYellow:"#ffa000", brightBlue:"#81d4fa", brightMagenta:"#ad1457", brightCyan:"#26a69a", brightWhite:"#eceff1", cursor:"#eceff1", foreground:"#eceff1"}], + ['Monokai', {background:"#272822", black:"#272822", red:"#dc2566", green:"#8fc029", yellow:"#d4c96e", blue:"#55bcce", magenta:"#9358fe", cyan:"#56b7a5", white:"#acada1", brightBlack:"#76715e", brightRed:"#fa2772", brightGreen:"#a7e22e", brightYellow:"#e7db75", brightBlue:"#66d9ee", brightMagenta:"#ae82ff", brightCyan:"#66efd5", brightWhite:"#cfd0c2", cursor:"#f1ebeb", foreground:"#f1ebeb"}], + ['Ashes', {background:"#1c2023", black:"#1c2023", red:"#c7ae95", green:"#95c7ae", yellow:"#aec795", blue:"#ae95c7", magenta:"#c795ae", cyan:"#95aec7", white:"#c7ccd1", brightBlack:"#747c84", brightRed:"#c7ae95", brightGreen:"#95c7ae", brightYellow:"#aec795", brightBlue:"#ae95c7", brightMagenta:"#c795ae", brightCyan:"#95aec7", brightWhite:"#f3f4f5", cursor:"#c7ccd1", foreground:"#c7ccd1"}], + ['Google', {background:"#ffffff", black:"#ffffff", red:"#cc342b", green:"#198844", yellow:"#fba922", blue:"#3971ed", magenta:"#a36ac7", cyan:"#3971ed", white:"#c5c8c6", brightBlack:"#969896", brightRed:"#cc342b", brightGreen:"#198844", brightYellow:"#fba922", brightBlue:"#3971ed", brightMagenta:"#a36ac7", brightCyan:"#3971ed", brightWhite:"#ffffff", cursor:"#373b41", foreground:"#373b41"}], + ['Mono Light', {background:"#f7f7f7", black:"#f7f7f7", red:"#7c7c7c", green:"#8e8e8e", yellow:"#a0a0a0", blue:"#686868", magenta:"#747474", cyan:"#868686", white:"#b9b9b9", brightBlack:"#525252", brightRed:"#7c7c7c", brightGreen:"#8e8e8e", brightYellow:"#a0a0a0", brightBlue:"#686868", brightMagenta:"#747474", brightCyan:"#868686", brightWhite:"#f7f7f7", cursor:"#464646", foreground:"#464646"}], + ['Mono Dark', {background:"#000000", black:"#000000", red:"#6b6b6b", green:"#c4c4c4", yellow:"#b3b3b3", blue:"#999999", magenta:"#717171", cyan:"#8a8a8a", white:"#b5cabb", brightBlack:"#202020", brightRed:"#464646", brightGreen:"#f8f8f8", brightYellow:"#eeeeee", brightBlue:"#7c7c7c", brightMagenta:"#adadad", brightCyan:"#c0c0c0", brightWhite:"#99ac9e", cursor:"#ffffff", foreground:"#ffffff"}], + ['Tango', {}] + ], + + // Takes a single character and identifies shell type + testShell: function(r) { + // Check that we're adding the start of a string + if (r.substring(0, 2).indexOf(']') === -1 && (this.shellString.length === 0 || this.shellString.length > ']0;fish'.length)) { + this.shellString = ''; + return; + } + + this.shellString += r; + + // Don't bother checking if we don't have enough characters for a match + if (this.shellString.length < 7) { + return; + } + // Check for fish + if (this.shellString.indexOf(']0;fish') !== -1) { + this.shellString = ''; + this.fsHintLeave = SSHyClient.fishFsHintLeave; + return; + } + + // Catch all for bash + if (this.shellString.indexOf('@') !== -1) { + this.shellString = ''; + this.fsHintLeave = SSHyClient.bashFsHintLeave; + return; + } + }, + // Toggles Local Echo on and off + setLocalEcho: function(dir) { + // Clamp the setting between 0 and 2 + this.localEcho = Math.min(Math.max(this.localEcho += dir, 0), 2); + + // Change the displayed mode to the string at 'this.localEcho' of array + document.getElementById('currentLEcho').innerHTML = ["Force Off", "Auto", "Force On"][this.localEcho]; + + // If we're using auto echo mode, change the auto state tooltiptext + var element = document.getElementById('autoEchoState'); + if (this.localEcho === 1) { + element.style.visibility = 'visible'; + element.innerHTML = "State: " + (this.autoEchoState === false ? 'Disabled' : 'Enabled'); + } else { + element.style.visibility = 'hidden'; + } + }, + + // Parses a given message (r) for signs to enable or disable local echo + parseLocalEcho: function(r) { + // if we're using auto mode + if (this.localEcho === 1) { + // Caching this since it takes a long time to get at least twice + var timeout = performance.now(); + // Don't continue if we've changed state in the previous 0.1s + if (timeout - this.autoEchoTimeout < 100) { + return; + } + // We only need to examine the beginning of most messages so just take the first 64 bytes to improve performance + r = r.substring(0, 64); + if (!this.autoEchoState) { + // Search for '@' aswell so we catch on 'user@hostname' aswell + if (r.indexOf(this.fsHintLeave) != -1 && r.indexOf('@') != -1) { + this.autoEchoState = true; + // Change the Settings UI + this.autoEchoElement.innerHTML = "State: Enabled"; + this.autoEchoTimeout = timeout; + } + } else { + // check for 'password' incase we are inputting a password + if (r.indexOf(this.fsHintEnter) != -1 || r.toLowerCase().indexOf('password') != -1) { + this.autoEchoState = false; + this.autoEchoElement.innerHTML = "State: Disabled"; + this.autoEchoTimeout = timeout; + } + } + } + return; + }, + // Parses a keydown event to determine if we can safely echo the key. + parseKey: function(e) { + // Don't continue to write the key if auto echoing is disabled + if (this.localEcho === 1 && this.autoEchoState === false) { + return; + } + // Make sure the key isn't a special one eg 'ArrowUp', a blocked key or a control character + if (e.key.length > 1 || this.blockedKeys.includes(e.key) || (e.altKey || e.ctrlKey || e.metaKey)) { + return; + } + // Incase someone is typing very fast don't echo to perserve servers formatting. + if (!transport.lastKey) { + term.write(e.key); + } + transport.lastKey += e.key; + }, + // Sets the keep alive iterval or clears a current interval based on 'time' + setKeepAlive: function(time) { + // changes 'time' into seconds & floors time to stop 0.00001s ect + time = time === undefined ? 0 : Math.floor(time) * 1000; + // if there is an interval setup then clear it + if (time === 0 || this.keepAliveInterval !== undefined) { + clearInterval(this.keepAliveInterval); + this.keepAliveInterval = undefined; + if (!time) { + return; + } + } + // otherwise create a new interval + this.keepAliveInterval = setInterval(transport.keepAlive, time); + }, + // Set xtermjs's color scheme to the given color + setColorScheme: function(colIndex) { + // Gets a reference to xterm.css + var term_style = document.styleSheets[0]; + var themeName = this.colorSchemes[colIndex][0] + var themeColors = this.colorSchemes[colIndex][1] + + // Interact with xtermjs + if (term) { + term.setOption('theme',themeColors) + } + + // Remove the old CSS rules if its a custom theme + if(!this.colorTango){ + for (i = 0; i < 4; i++) { + term_style.deleteRule(13); + } + } + + if(themeName === 'Tango') { + this.colorTango = true; + document.getElementById('currentColor').innerHTML = 'Tango'; + return; + } + + // Adds html background colour + term_style.insertRule('html, body {background-color: ' + themeColors.background + ' !important;}', 13); + // Changes the sidenav color + term_style.insertRule('.sidenav {background-color: ' + modColorPercent(themeColors.background, -0.2) + ' !important;}', 13); + // Changes the rx and tx color to 10 and 11 + term_style.insertRule('.brightgreen {color: ' + themeColors.brightGreen + ' !important;}', 13); + term_style.insertRule('.brightyellow {color: ' + themeColors.brightYellow + ' !important;}', 13); + + this.colorTango = false; + + document.getElementById('currentColor').innerHTML = themeName === undefined ? 'Custom' : themeName; + }, + + importXresources: function() { + var reader = new FileReader(); + var element = document.getElementById('Xresources').files[0]; + reader.readAsText(element); + reader.onload = function() { + var file = reader.result; + var lines = file.split("\n"); + // natural sort the Xresources list to bg, 1 - 15, cur, fg colours + lines = lines.sort(new Intl.Collator(undefined, { + numeric: true, + sensitivity: 'base' + }).compare); + + colScheme = []; + + for (var i = 0; i < lines.length; i++) { + // Regex the line for a color code #xxx or #xxxxxx + var result = lines[i].match(/#([0-9a-f]{3}){1,2}/ig); + if (result) { + colScheme.push(result[0]); + // If we've added 19 colors then stop and display it? + if (colScheme.length >= 19) { + break; + } + } + } + + // Make sure the new color scheme has the required amount of colours + if (colScheme.length !== 19) { + return alert('Uploaded file could not be parsed correctly.'); + } + + // lastly we need to sort it into a dict instead of list + colScheme = {background: colScheme[0],black: colScheme[1],red: colScheme[2],green: colScheme[3],yellow: colScheme[4],blue: colScheme[5],magenta: colScheme[6],cyan: colScheme[7],white: colScheme[8],brightBlack: colScheme[9],brightRed: colScheme[10],brightGreen: colScheme[11],brightYellow: colScheme[12],brightBlue: colScheme[13],brightMagenta: colScheme[14],brightCyan: colScheme[15],brightWhite: colScheme[16],cursor: colScheme[17],foreground: colScheme[18]} + colName = element.name === '.Xresources' ? 'custom' : element.name.split('.')[0] + + // Add to the colorSchemes list + transport.settings.colorSchemes.push([colName, colScheme]) + // Get the new key + transport.settings.colorNames = Object.keys(transport.settings.colorSchemes); + transport.settings.setColorScheme(transport.settings.colorSchemes.length-1) + }; + }, + // Cycle the color counter and set the current colors to new index + cycleColorSchemes: function(dir) { + // Cycles through (0 -> colorSchemes.length - 1) where dir = 1 is incrementing and dir = false decrements + this.colorCounter = dir === 0 ? --this.colorCounter : ++this.colorCounter; + if (this.colorCounter > this.colorNames.length - 1 || this.colorCounter < 0) { + this.colorCounter = dir === 1 ? 0 : this.colorNames.length - 1; + } + // Set color scheme to (colorList [ colorNames [ counter ]]) + this.setColorScheme(this.colorCounter) + }, + // Modify the font size of the terminal + modFontSize: function(sign) { + this.fontSize += sign; + term.setOption('fontSize', this.fontSize) + + document.getElementById("currentFontSize").innerHTML = transport.settings.fontSize + 'px'; + // Recalculate rows/cols + fitAddon.fit() + transport.auth.mod_pty('window-change', term.cols, term.rows); + }, + // Sets the terminal size where id= 0-> cols ; 1-> rows + modTerm: function(id, newAmount) { + if (!id) { + term.resize(newAmount, term.rows); + } else { + term.resize(term.cols, newAmount); + } + + transport.auth.mod_pty('window-change', term.cols, term.rows); + }, + // Changes the network traffic setting to reflect transmitted or recieved data + setNetTraffic: function(value, dir) { + // No point recalculating if the sidenav is closed + if (!this.sidenavElementState) { + return; + } + // Convert the 'value' into the correct units + switch (true) { + case value < 1024: + value = value + 'Bytes'; + break; + case (value >= 1024 && value < 1048576): + value = (value / 1024).toFixed(3) + 'KB'; + break; + case (value >= 1048576 && value < 1073741824): + value = (value / 1048576).toFixed(3) + 'MB'; + break; + default: + // Just going to stop at Gb since its unlikely to go above that + value = (value / 1073741824).toFixed(3) + 'GB'; + } + // Set the target element we we're going to change. + element = dir === true ? this.rxElement : this.txElement; + element.innerHTML = value; + } +}; + diff --git a/js/dhKex.js b/js/dhKex.js index 96cddd4..f9106e0 100644 --- a/js/dhKex.js +++ b/js/dhKex.js @@ -26,9 +26,9 @@ SSHyClient.kex.DiffieHellman = function(transport, group, SHAVersion){ this.preferredBits = 2048; return; } else if(this.group === 1){ - this.P = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16); + this.p = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16); } else if(this.group === 14){ - this.P = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16); + this.p = new BigInteger("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16); } // These only apply to DH group 1 and 14 @@ -50,7 +50,7 @@ SSHyClient.kex.DiffieHellman.prototype = { this.x = inflate_long(read_rng(128)); // Now we calculate e = (g=2) ^ x mod p - this.e = this.G.modPow(this.x, this.P); + this.e = this.G.modPow(this.x, this.p); // Now we create the message and send it m.add_bytes(String.fromCharCode(SSHyClient.MSG_KEXDH_INIT)); diff --git a/js/parceler.js b/js/parceler.js index 9accdd7..3654fdf 100644 --- a/js/parceler.js +++ b/js/parceler.js @@ -71,8 +71,13 @@ SSHyClient.parceler.prototype = { /* If we don't have a remote_version then send our version and set the remote_version */ if (!this.transport.remote_version) { - this.transport.handler_table[0](this.transport, r); - return; + var end = r.indexOf('\r\n'); + if (end != -1) { + var rv = r.slice(0, end+2); + this.transport.handler_table[0](this.transport, rv); + r = r.slice(end+2); + } // else that would be bad and probably we should die here + if (r.length<=0) { return; } } this.inbound_buffer += r; diff --git a/js/settings.js b/js/settings.js index 6e90567..30e75c1 100644 --- a/js/settings.js +++ b/js/settings.js @@ -159,7 +159,7 @@ SSHyClient.settings.prototype = { // Interact with xtermjs if (term) { - term._setTheme(themeColors) + term.setOption('theme',themeColors) } // Remove the old CSS rules if its a custom theme @@ -248,7 +248,7 @@ SSHyClient.settings.prototype = { document.getElementById("currentFontSize").innerHTML = transport.settings.fontSize + 'px'; // Recalculate rows/cols - term.fit() + fitAddon.fit() transport.auth.mod_pty('window-change', term.cols, term.rows); }, // Sets the terminal size where id= 0-> cols ; 1-> rows @@ -286,4 +286,5 @@ SSHyClient.settings.prototype = { element = dir === true ? this.rxElement : this.txElement; element.innerHTML = value; } -}; \ No newline at end of file +}; + diff --git a/js/src/xterm-addon-fit.js b/js/src/xterm-addon-fit.js new file mode 100644 index 0000000..44ce88b --- /dev/null +++ b/js/src/xterm-addon-fit.js @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2017 The xterm.js authors. All rights reserved. + * @license MIT + */ + +var MINIMUM_COLS = 2; +var MINIMUM_ROWS = 1; +var FitAddon = /** @class */ (function () { + 'use strict'; + function FitAddon() { + } + FitAddon.prototype.activate = function (terminal) { + this._terminal = terminal; + }; + FitAddon.prototype.dispose = function () { }; + FitAddon.prototype.fit = function () { + var dims = this.proposeDimensions(); + if (!dims || !this._terminal) { + return; + } + // TODO: Remove reliance on private API + var core = this._terminal._core; + // Force a full render + if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) { + core._renderService.clear(); + this._terminal.resize(dims.cols, dims.rows); + } + }; + FitAddon.prototype.proposeDimensions = function () { + if (!this._terminal) { + return undefined; + } + if (!this._terminal.element || !this._terminal.element.parentElement) { + return undefined; + } + // TODO: Remove reliance on private API + var core = this._terminal._core; + if (core._renderService.dimensions.actualCellWidth === 0 || core._renderService.dimensions.actualCellHeight === 0) { + return undefined; + } + var parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement); + var parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')); + var parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'))); + var elementStyle = window.getComputedStyle(this._terminal.element); + var elementPadding = { + top: parseInt(elementStyle.getPropertyValue('padding-top')), + bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')), + right: parseInt(elementStyle.getPropertyValue('padding-right')), + left: parseInt(elementStyle.getPropertyValue('padding-left')) + }; + var elementPaddingVer = elementPadding.top + elementPadding.bottom; + var elementPaddingHor = elementPadding.right + elementPadding.left; + var availableHeight = parentElementHeight - elementPaddingVer; + var availableWidth = parentElementWidth - elementPaddingHor - core.viewport.scrollBarWidth; + var geometry = { + cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / core._renderService.dimensions.actualCellWidth)), + rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / core._renderService.dimensions.actualCellHeight)) + }; + return geometry; + }; + return FitAddon; +}()); + diff --git a/js/src/xterm.js b/js/src/xterm.js new file mode 100644 index 0000000..20e020e --- /dev/null +++ b/js/src/xterm.js @@ -0,0 +1,4 @@ + +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(self,(function(){return(()=>{"use strict";var e={4567:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;var o=r(9042),s=r(6114),a=r(6193),c=r(3656),l=r(844),h=r(5596),u=r(9631),f=function(e){function t(t,r){var i=e.call(this)||this;i._terminal=t,i._renderService=r,i._liveRegionLineCount=0,i._charsToConsume=[],i._charsToAnnounce="",i._accessibilityTreeRoot=document.createElement("div"),i._accessibilityTreeRoot.classList.add("xterm-accessibility"),i._rowContainer=document.createElement("div"),i._rowContainer.setAttribute("role","list"),i._rowContainer.classList.add("xterm-accessibility-tree"),i._rowElements=[];for(var n=0;ne;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),s.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)}),0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,s.isMac&&u.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var r=this._terminal.buffer,i=r.lines.length.toString(),n=e;n<=t;n++){var o=r.translateBufferLineToString(r.ydisp+n,!0),s=(r.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===o.length?a.innerText=" ":a.textContent=o,a.setAttribute("aria-posinset",s),a.setAttribute("aria-setsize",i))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e{function r(e){return e.replace(/\r?\n/g,"\r")}function i(e,t){return t?"[200~"+e+"[201~":e}function n(e,t,n){e=i(e=r(e),n.decPrivateModes.bracketedPasteMode),n.triggerDataEvent(e,!0),t.value=""}function o(e,t,r){var i=r.getBoundingClientRect(),n=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=n+"px",t.style.top=o+"px",t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=i,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,r){e.stopPropagation(),e.clipboardData&&n(e.clipboardData.getData("text/plain"),t,r)},t.paste=n,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,r,i,n){o(e,t,r),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}},4774:(e,t)=>{var r,i,n,o;function s(e){var t=e.toString(16);return t.length<2?"0"+t:t}function a(e,t){return e>>0}}(r=t.channels||(t.channels={})),(i=t.color||(t.color={})).blend=function(e,t){var i=(255&t.rgba)/255;if(1===i)return{css:t.css,rgba:t.rgba};var n=t.rgba>>24&255,o=t.rgba>>16&255,s=t.rgba>>8&255,a=e.rgba>>24&255,c=e.rgba>>16&255,l=e.rgba>>8&255,h=a+Math.round((n-a)*i),u=c+Math.round((o-c)*i),f=l+Math.round((s-l)*i);return{css:r.toCss(h,u,f),rgba:r.toRgba(h,u,f)}},i.isOpaque=function(e){return 255==(255&e.rgba)},i.ensureContrastRatio=function(e,t,r){var i=o.ensureContrastRatio(e.rgba,t.rgba,r);if(i)return o.toColor(i>>24&255,i>>16&255,i>>8&255)},i.opaque=function(e){var t=(255|e.rgba)>>>0,i=o.toChannels(t),n=i[0],s=i[1],a=i[2];return{css:r.toCss(n,s,a),rgba:t}},i.opacity=function(e,t){var i=Math.round(255*t),n=o.toChannels(e.rgba),s=n[0],a=n[1],c=n[2];return{css:r.toCss(s,a,c,i),rgba:r.toRgba(s,a,c,i)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,r){var i=e/255,n=t/255,o=r/255;return.2126*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(n=t.rgb||(t.rgb={})),function(e){function t(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u0||l>0||h>0);)c-=Math.max(0,Math.ceil(.1*c)),l-=Math.max(0,Math.ceil(.1*l)),h-=Math.max(0,Math.ceil(.1*h)),u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));return(c<<24|l<<16|h<<8|255)>>>0}function i(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u>>0}e.ensureContrastRatio=function(e,r,o){var s=n.relativeLuminance(e>>8),c=n.relativeLuminance(r>>8);if(a(s,c)>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i){return{css:r.toCss(e,t,i),rgba:r.toRgba(e,t,i)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=s,t.contrastRatio=a},7239:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;var r=function(){function e(){this._color={},this._rgba={}}return e.prototype.clear=function(){this._color={},this._rgba={}},e.prototype.setCss=function(e,t,r){this._rgba[e]||(this._rgba[e]={}),this._rgba[e][t]=r},e.prototype.getCss=function(e,t){return this._rgba[e]?this._rgba[e][t]:void 0},e.prototype.setColor=function(e,t,r){this._color[e]||(this._color[e]={}),this._color[e][t]=r},e.prototype.getColor=function(e,t){return this._color[e]?this._color[e][t]:void 0},e}();t.ColorContrastCache=r},5680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorManager=t.DEFAULT_ANSI_COLORS=void 0;var i=r(4774),n=r(7239),o=i.css.toColor("#ffffff"),s=i.css.toColor("#000000"),a=i.css.toColor("#ffffff"),c=i.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var e=[i.css.toColor("#2e3436"),i.css.toColor("#cc0000"),i.css.toColor("#4e9a06"),i.css.toColor("#c4a000"),i.css.toColor("#3465a4"),i.css.toColor("#75507b"),i.css.toColor("#06989a"),i.css.toColor("#d3d7cf"),i.css.toColor("#555753"),i.css.toColor("#ef2929"),i.css.toColor("#8ae234"),i.css.toColor("#fce94f"),i.css.toColor("#729fcf"),i.css.toColor("#ad7fa8"),i.css.toColor("#34e2e2"),i.css.toColor("#eeeeec")],t=[0,95,135,175,215,255],r=0;r<216;r++){var n=t[r/36%6|0],o=t[r/6%6|0],s=t[r%6];e.push({css:i.channels.toCss(n,o,s),rgba:i.channels.toRgba(n,o,s)})}for(r=0;r<24;r++){var a=8+10*r;e.push({css:i.channels.toCss(a,a,a),rgba:i.channels.toRgba(a,a,a)})}return e}());var h=function(){function e(e,r){this.allowTransparency=r;var h=e.createElement("canvas");h.width=1,h.height=1;var u=h.getContext("2d");if(!u)throw new Error("Could not get rendering context");this._ctx=u,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new n.ColorContrastCache,this.colors={foreground:o,background:s,cursor:a,cursorAccent:c,selectionTransparent:l,selectionOpaque:i.color.blend(s,l),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return e.prototype.onOptionsChange=function(e){"minimumContrastRatio"===e&&this._contrastCache.clear()},e.prototype.setTheme=function(e){void 0===e&&(e={}),this.colors.foreground=this._parseColor(e.foreground,o),this.colors.background=this._parseColor(e.background,s),this.colors.cursor=this._parseColor(e.cursor,a,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,c,!0),this.colors.selectionTransparent=this._parseColor(e.selection,l,!0),this.colors.selectionOpaque=i.color.blend(this.colors.background,this.colors.selectionTransparent),i.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=i.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(e.black,t.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,t.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,t.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,t.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,t.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,t.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,t.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,t.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},e.prototype._parseColor=function(e,t,r){if(void 0===r&&(r=this.allowTransparency),void 0===e)return t;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=e,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+e+" is invalid using fallback "+t.css),t;this._ctx.fillRect(0,0,1,1);var n=this._ctx.getImageData(0,0,1,1).data;if(255!==n[3]){if(!r)return console.warn("Color: "+e+" is using transparency, but allowTransparency is false. Using fallback "+t.css+"."),t;var o=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map((function(e){return Number(e)})),s=o[0],a=o[1],c=o[2],l=o[3],h=Math.round(255*l);return{rgba:i.channels.toRgba(s,a,c,h),css:e}}return{css:this._ctx.fillStyle,rgba:i.channels.toRgba(n[0],n[1],n[2],n[3])}},e}();t.ColorManager=h},9631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,r,i){e.addEventListener(t,r,i);var n=!1;return{dispose:function(){n||(n=!0,e.removeEventListener(t,r,i))}}}},3551:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var o=r(8460),s=r(2585),a=function(){function e(e,t,r){this._bufferService=e,this._logService=t,this._unicodeService=r,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new o.EventEmitter,this._onHideLinkUnderline=new o.EventEmitter,this._onLinkTooltip=new o.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,r){var i=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=r):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,r)),this._mouseZoneManager.clearAll(t,r),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return i._linkifyRows()}),e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var r=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,i=Math.ceil(2e3/this._bufferService.cols),n=this._bufferService.buffer.iterator(!1,t,r,i,i);n.hasNext();)for(var o=n.next(),s=0;s=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t>9&511:void 0;r.validationCallback?r.validationCallback(a,(function(e){n._rowsTimeoutId||e&&n._addLink(l[1],l[0]-n._bufferService.buffer.ydisp,a,r,f)})):c._addLink(l[1],l[0]-c._bufferService.buffer.ydisp,a,r,f)},c=this;null!==(i=o.exec(t))&&"break"!==a(););},e.prototype._addLink=function(e,t,r,i,n){var o=this;if(this._mouseZoneManager&&this._element){var s=this._unicodeService.getStringCellWidth(r),a=e%this._bufferService.cols,l=t+Math.floor(e/this._bufferService.cols),h=(a+s)%this._bufferService.cols,u=l+Math.floor((a+s)/this._bufferService.cols);0===h&&(h=this._bufferService.cols,u--),this._mouseZoneManager.add(new c(a+1,l+1,h+1,u+1,(function(e){if(i.handler)return i.handler(e,r);var t=window.open();t?(t.opener=null,t.location.href=r):console.warn("Opening link blocked as opener could not be cleared")}),(function(){o._onShowLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.add("xterm-cursor-pointer")}),(function(e){o._onLinkTooltip.fire(o._createLinkHoverEvent(a,l,h,u,n)),i.hoverTooltipCallback&&i.hoverTooltipCallback(e,r,{start:{x:a,y:l},end:{x:h,y:u}})}),(function(){o._onHideLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.remove("xterm-cursor-pointer"),i.hoverLeaveCallback&&i.hoverLeaveCallback()}),(function(e){return!i.willLinkActivate||i.willLinkActivate(e,r)})))}},e.prototype._createLinkHoverEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},e._timeBeforeLatency=200,e=i([n(0,s.IBufferService),n(1,s.ILogService),n(2,s.IUnicodeService)],e)}();t.Linkifier=a;var c=function(e,t,r,i,n,o,s,a,c){this.x1=e,this.y1=t,this.x2=r,this.y2=i,this.clickCallback=n,this.hoverCallback=o,this.tooltipCallback=s,this.leaveCallback=a,this.willLinkActivate=c};t.MouseZone=c},6465:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var a=r(2585),c=r(8460),l=r(844),h=r(3656),u=function(e){function t(t){var r=e.call(this)||this;return r._bufferService=t,r._linkProviders=[],r._linkCacheDisposables=[],r._isMouseOut=!0,r._activeLine=-1,r._onShowLinkUnderline=r.register(new c.EventEmitter),r._onHideLinkUnderline=r.register(new c.EventEmitter),r.register(l.getDisposeArrayDisposable(r._linkCacheDisposables)),r}return n(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var r=t._linkProviders.indexOf(e);-1!==r&&t._linkProviders.splice(r,1)}}},t.prototype.attachToDom=function(e,t,r){var i=this;this._element=e,this._mouseService=t,this._renderService=r,this.register(h.addDisposableDomListener(this._element,"mouseleave",(function(){i._isMouseOut=!0,i._clearCurrentLink()}))),this.register(h.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(h.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var r=e.composedPath(),i=0;ie?this._bufferService.cols:s.link.range.end.x,l=a;l<=c;l++){if(r.has(l)){n.splice(o--,1);break}r.add(l)}}},t.prototype._checkLinkProviderResult=function(e,t,r){var i,n=this;if(!this._activeProviderReplies)return r;for(var o=this._activeProviderReplies.get(e),s=!1,a=0;a=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,l.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(e.link,r)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.pointerCursor},set:function(e){var r,i;(null===(r=t._currentLink)||void 0===r?void 0:r.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(i=t._element)||void 0===i||i.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.underline},set:function(r){var i,n,o;(null===(i=t._currentLink)||void 0===i?void 0:i.state)&&(null===(o=null===(n=t._currentLink)||void 0===n?void 0:n.state)||void 0===o?void 0:o.decorations.underline)!==r&&(t._currentLink.state.decorations.underline=r,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,r))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange((function(e){var r=0===e.start?0:e.start+1+t._bufferService.buffer.ydisp;t._clearCurrentLink(r,e.end+1+t._bufferService.buffer.ydisp)}))))}},t.prototype._linkHover=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var r=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)},t.prototype._linkLeave=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)},t.prototype._linkAtPosition=function(e,t){var r=e.range.start.y===e.range.end.y,i=e.range.start.yt.y;return(r&&e.range.start.x<=t.x&&e.range.end.x>=t.x||i&&e.range.end.x>=t.x||n&&e.range.start.x<=t.x||i&&n)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,r){var i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},o([s(0,a.IBufferService)],t)}(l.Disposable);t.Linkifier2=u},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},6954:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s){var a=e.call(this)||this;return a._element=t,a._screenElement=r,a._bufferService=i,a._mouseService=n,a._selectionService=o,a._optionsService=s,a._zones=[],a._areZonesActive=!1,a._lastHoverCoords=[void 0,void 0],a._initialSelectionLength=0,a.register(c.addDisposableDomListener(a._element,"mousedown",(function(e){return a._onMouseDown(e)}))),a._mouseMoveListener=function(e){return a._onMouseMove(e)},a._mouseLeaveListener=function(e){return a._onMouseLeave(e)},a._clickListener=function(e){return a._onClick(e)},a}return n(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var r=0;re&&i.y1<=t+1||i.y2>e&&i.y2<=t+1||i.y1t+1)&&(this._currentZone&&this._currentZone===i&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(r--,1))}0===this._zones.length&&this._deactivate()}},t.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},t.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,r=this._findZoneEventAt(e);r!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),r&&(this._currentZone=r,r.hoverCallback&&r.hoverCallback(e),this._tooltipTimeout=window.setTimeout((function(){return t._onTooltip(e)}),this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),r=this._getSelectionLength();t&&r===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var r=t[0],i=t[1],n=0;n=o.x1&&r=o.x1||i===o.y2&&ro.y1&&i{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0;var r=function(){function e(e){this._renderCallback=e}return e.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.refresh=function(e,t,r){var i=this;this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){return i._innerRefresh()})))},e.prototype._innerRefresh=function(){if(void 0!==this._rowStart&&void 0!==this._rowEnd&&void 0!==this._rowCount){var e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(e,t)}},e}();t.RenderDebouncer=r},5596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._currentDevicePixelRatio=window.devicePixelRatio,t}return n(t,e),t.prototype.setListener=function(e){var t=this;this._listener&&this.clearListener(),this._listener=e,this._outerListener=function(){t._listener&&(t._listener(window.devicePixelRatio,t._currentDevicePixelRatio),t._updateDpr())},this._updateDpr()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.clearListener()},t.prototype._updateDpr=function(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},t.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},t}(r(844).Disposable);t.ScreenDprMonitor=o},3236:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var o=r(2950),s=r(1680),a=r(3614),c=r(2584),l=r(5435),h=r(3525),u=r(3551),f=r(9312),_=r(6114),d=r(3656),p=r(9042),v=r(357),g=r(6954),y=r(4567),b=r(1296),S=r(7399),m=r(8460),C=r(8437),w=r(5680),E=r(3230),L=r(4725),A=r(428),R=r(8934),k=r(6465),x=r(5114),D=r(8969),T=r(4774),O="undefined"!=typeof window?window.document:null,M=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.browser=_,r._keyDownHandled=!1,r._onCursorMove=new m.EventEmitter,r._onKey=new m.EventEmitter,r._onRender=new m.EventEmitter,r._onSelectionChange=new m.EventEmitter,r._onTitleChange=new m.EventEmitter,r._onFocus=new m.EventEmitter,r._onBlur=new m.EventEmitter,r._onA11yCharEmitter=new m.EventEmitter,r._onA11yTabEmitter=new m.EventEmitter,r._setup(),r.linkifier=r._instantiationService.createInstance(u.Linkifier),r.linkifier2=r.register(r._instantiationService.createInstance(k.Linkifier2)),r.register(r._inputHandler.onRequestBell((function(){return r.bell()}))),r.register(r._inputHandler.onRequestRefreshRows((function(e,t){return r.refresh(e,t)}))),r.register(r._inputHandler.onRequestReset((function(){return r.reset()}))),r.register(r._inputHandler.onRequestScroll((function(e,t){return r.scroll(e,t||void 0)}))),r.register(r._inputHandler.onRequestWindowsOptionsReport((function(e){return r._reportWindowsOptions(e)}))),r.register(r._inputHandler.onAnsiColorChange((function(e){return r._changeAnsiColor(e)}))),r.register(m.forwardEvent(r._inputHandler.onCursorMove,r._onCursorMove)),r.register(m.forwardEvent(r._inputHandler.onTitleChange,r._onTitleChange)),r.register(m.forwardEvent(r._inputHandler.onA11yChar,r._onA11yCharEmitter)),r.register(m.forwardEvent(r._inputHandler.onA11yTab,r._onA11yTabEmitter)),r.register(r._bufferService.onResize((function(e){return r._afterResize(e.cols,e.rows)}))),r}return n(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),t.prototype._changeAnsiColor=function(e){var t,r,i=this;this._colorManager&&(e.colors.forEach((function(e){var t=T.rgba.toColor(e.red,e.green,e.blue);i._colorManager.colors.ansi[e.colorIndex]=t})),null===(t=this._renderService)||void 0===t||t.setColors(this._colorManager.colors),null===(r=this.viewport)||void 0===r||r.onThemeChange(this._colorManager.colors))},t.prototype.dispose=function(){var t,r,i;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._renderService)||void 0===t||t.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},null===(i=null===(r=this.element)||void 0===r?void 0:r.parentNode)||void 0===i||i.removeChild(this.element))},t.prototype._setup=function(){e.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(t.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),t.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},t.prototype._updateOptions=function(t){var r,i,n,o;switch(e.prototype._updateOptions.call(this,t),t){case"fontFamily":case"fontSize":null===(r=this._renderService)||void 0===r||r.clear(),null===(i=this._charSizeService)||void 0===i||i.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":null===(n=this.viewport)||void 0===n||n.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)):(null===(o=this._accessibilityManager)||void 0===o||o.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},t.prototype._onTextAreaFocus=function(e){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},t.prototype.blur=function(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()},t.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},t.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var e=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),t=this._bufferService.buffer.y*e,r=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=r+"px",this.textarea.style.top=t+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=e+"px",this.textarea.style.lineHeight=e+"px",this.textarea.style.zIndex="-5"}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register(d.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&a.copyHandler(t,e._selectionService)})));var t=function(t){return a.handlePasteEvent(t,e.textarea,e._coreService)};this.register(d.addDisposableDomListener(this.textarea,"paste",t)),this.register(d.addDisposableDomListener(this.element,"paste",t)),_.isFirefox?this.register(d.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register(d.addDisposableDomListener(this.element,"contextmenu",(function(t){a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),_.isLinux&&this.register(d.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&a.moveTextAreaUnderMouseCursor(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register(d.addDisposableDomListener(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register(d.addDisposableDomListener(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register(d.addDisposableDomListener(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return e._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(t){return e._queueLinkification(t.start,t.end)})))},t.prototype.open=function(e){var t=this;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),this.element.setAttribute("role","document"),e.appendChild(this.element);var r=O.createDocumentFragment();this._viewportElement=O.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this._viewportScrollArea=O.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=O.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=O.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement),this.textarea=O.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),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.register(d.addDisposableDomListener(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register(d.addDisposableDomListener(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var i=this._instantiationService.createInstance(x.CoreBrowserService,this.textarea);this._instantiationService.setService(L.ICoreBrowserService,i),this._charSizeService=this._instantiationService.createInstance(A.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._compositionView=O.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(r),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(O,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme);var n=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,n,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange((function(e){return t._onRender.fire(e)}))),this.onResize((function(e){return t._renderService.resize(e.cols,e.rows)})),this._soundService=this._instantiationService.createInstance(v.SoundService),this._instantiationService.setService(L.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(s.Viewport,(function(e,r){return t.scrollLines(e,r)}),this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar((function(){return t.viewport.syncScrollArea()}))),this.register(this.viewport),this.register(this.onCursorMove((function(){t._renderService.onCursorMove(),t._syncTextArea()}))),this.register(this.onResize((function(){return t._renderService.onResize(t.cols,t.rows)}))),this.register(this.onBlur((function(){return t._renderService.onBlur()}))),this.register(this.onFocus((function(){return t._renderService.onFocus()}))),this.register(this._renderService.onDimensionsChange((function(){return t.viewport.syncScrollArea()}))),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((function(e){return t.scrollLines(e.amount,e.suppressScrollEvent)}))),this.register(this._selectionService.onSelectionChange((function(){return t._onSelectionChange.fire()}))),this.register(this._selectionService.onRequestRedraw((function(e){return t._renderService.onSelectionChanged(e.start,e.end,e.columnSelectMode)}))),this.register(this._selectionService.onLinuxMouseSelection((function(e){t.textarea.value=e,t.textarea.focus(),t.textarea.select()}))),this.register(this.onScroll((function(){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register(d.addDisposableDomListener(this._viewportElement,"scroll",(function(){return t._selectionService.refresh()}))),this._mouseZoneManager=this._instantiationService.createInstance(g.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return t._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(d.addDisposableDomListener(this.element,"mousedown",(function(e){return t._selectionService.onMouseDown(e)}))),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},t.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(h.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(b.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},t.prototype._setTheme=function(e){var t,r,i;this._theme=e,null===(t=this._colorManager)||void 0===t||t.setTheme(e),null===(r=this._renderService)||void 0===r||r.setColors(this._colorManager.colors),null===(i=this.viewport)||void 0===i||i.onThemeChange(this._colorManager.colors)},t.prototype.bindMouse=function(){var e=this,t=this,r=this.element;function i(e){var r,i,n=t._mouseService.getRawByteCoords(e,t.screenElement,t.cols,t.rows);if(!n)return!1;switch(e.overrideType||e.type){case"mousemove":i=32,void 0===e.buttons?(r=3,void 0!==e.button&&(r=e.button<3?e.button:3)):r=1&e.buttons?0:4&e.buttons?1:2&e.buttons?2:3;break;case"mouseup":i=0,r=e.button<3?e.button:3;break;case"mousedown":i=1,r=e.button<3?e.button:3;break;case"wheel":0!==e.deltaY&&(i=e.deltaY<0?0:1),r=4;break;default:return!1}return!(void 0===i||void 0===r||r>4)&&t._coreMouseService.triggerMouseEvent({col:n.x-33,row:n.y-33,button:r,action:i,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o=function(t){return i(t),t.buttons||(e._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.removeEventListener("mousemove",n.mousedrag)),e.cancel(t)},s=function(t){return i(t),t.preventDefault(),e.cancel(t)},a=function(e){e.buttons&&i(e)},l=function(e){e.buttons||i(e)};this.register(this._coreMouseService.onProtocolChange((function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?n.mousemove||(r.addEventListener("mousemove",l),n.mousemove=l):(r.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&t?n.wheel||(r.addEventListener("wheel",s,{passive:!1}),n.wheel=s):(r.removeEventListener("wheel",n.wheel),n.wheel=null),2&t?n.mouseup||(n.mouseup=o):(e._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&t?n.mousedrag||(n.mousedrag=a):(e._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)}))),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(d.addDisposableDomListener(r,"mousedown",(function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return i(t),n.mouseup&&e._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.addEventListener("mousemove",n.mousedrag),e.cancel(t)}))),this.register(d.addDisposableDomListener(r,"wheel",(function(t){if(n.wheel);else if(!e.buffer.hasScrollback){var r=e.viewport.getLinesScrolled(t);if(0===r)return;for(var i=c.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),o="",s=0;s47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,r){t!==this.cols||r!==this.rows?e.prototype.resize.call(this,t,r):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var r,i;null===(r=this._charSizeService)||void 0===r||r.measure(),null===(i=this.viewport)||void 0===i||i.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){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(var e=1;e=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s,a){var l=e.call(this)||this;return l._scrollLines=t,l._viewportElement=r,l._scrollArea=i,l._bufferService=n,l._optionsService=o,l._charSizeService=s,l._renderService=a,l.scrollBarWidth=0,l._currentRowHeight=0,l._lastRecordedBufferLength=0,l._lastRecordedViewportHeight=0,l._lastRecordedBufferHeight=0,l._lastTouchY=0,l._lastScrollTop=0,l._wheelPartialScroll=0,l._refreshAnimationFrame=null,l._ignoreNextScrollEvent=!1,l.scrollBarWidth=l._viewportElement.offsetWidth-l._scrollArea.offsetWidth||15,l.register(c.addDisposableDomListener(l._viewportElement,"scroll",l._onScroll.bind(l))),setTimeout((function(){return l.syncScrollArea()}),0),l}return n(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===t&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)}else this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){var r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&r0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var r=this._optionsService.options.fastScrollModifier;return"alt"===r&&t.altKey||"ctrl"===r&&t.ctrlKey||"shift"===r&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},o([s(3,h.IBufferService),s(4,h.IOptionsService),s(5,l.ICharSizeService),s(6,l.IRenderService)],t)}(a.Disposable);t.Viewport=u},2950:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var o=r(4725),s=r(2585),a=function(){function e(e,t,r,i,n,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._charSizeService=n,this._coreService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((function(){t._compositionPosition.end=t._textarea.value.length}),0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var r={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((function(){if(t._isSendingComposition){t._isSendingComposition=!1;var e;r.start+=t._dataAlreadySent.length,(e=t._isComposing?t._textarea.value.substring(r.start,r.end):t._textarea.value.substring(r.start)).length>0&&t._coreService.triggerDataEvent(e,!0)}}),0)}else{this._isSendingComposition=!1;var i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout((function(){if(!e._isComposing){var r=e._textarea.value.replace(t,"");r.length>0&&(e._dataAlreadySent=r,e._coreService.triggerDataEvent(r,!0))}}),0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var r=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),i=this._bufferService.buffer.y*r,n=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=o.width+"px",this._textarea.style.height=o.height+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},i([n(2,s.IBufferService),n(3,s.IOptionsService),n(4,o.ICharSizeService),n(5,s.ICoreService)],e)}();t.CompositionHelper=a},9806:(e,t)=>{function r(e,t){var r=t.getBoundingClientRect();return[e.clientX-r.left,e.clientY-r.top]}Object.defineProperty(t,"__esModule",{value:!0}),t.getRawByteCoords=t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=r,t.getCoords=function(e,t,i,n,o,s,a,c){if(o){var l=r(e,t);if(l)return l[0]=Math.ceil((l[0]+(c?s/2:0))/s),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),i+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),n),l}},t.getRawByteCoords=function(e){if(e)return{x:e[0]+32,y:e[1]+32}}},9504:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var i=r(2584);function n(e,t,r,i){var n=e-o(r,e),a=t-o(r,t);return l(Math.abs(n-a)-function(e,t,r){for(var i=0,n=e-o(r,e),a=t-o(r,t),c=0;c=0&&tt?"A":"B"}function a(e,t,r,i,n,o){for(var s=e,a=t,c="";s!==r||a!==i;)s+=n?1:-1,n&&s>o.cols-1?(c+=o.buffer.translateBufferLineToString(a,!1,e,s),s=0,e=0,a++):!n&&s<0&&(c+=o.buffer.translateBufferLineToString(a,!1,0,e+1),e=s=o.cols-1,a--);return c+o.buffer.translateBufferLineToString(a,!1,e,s)}function c(e,t){var r=t?"O":"[";return i.C0.ESC+r+e}function l(e,t){e=Math.floor(e);for(var r="",i=0;i0?i-o(s,i):t;var f=i,_=function(e,t,r,i,s,a){var c;return c=n(r,i,s,a).length>0?i-o(s,i):t,e=r&&ce?"D":"C",l(Math.abs(h-e),c(s,i));s=u>t?"D":"C";var f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:h,r)+(f-1)*r.cols+1+((u>t?h:e)-1),c(s,i))}},244:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var r=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var r=this,i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=function(){return r._wrappedAddonDispose(i)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var i=r(511),n=r(3236),o=r(9042),s=r(8460),a=r(244),c=function(){function e(e){this._core=new n.Terminal(e),this._addonManager=new a.AddonManager}return e.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(e.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new f(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unicode",{get:function(){return this._checkProposedApi(),new _(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._checkProposedApi(),this._buffer||(this._buffer=new h(this._core)),this._buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),e.prototype.blur=function(){this._core.blur()},e.prototype.focus=function(){this._core.focus()},e.prototype.resize=function(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)},e.prototype.open=function(e){this._core.open(e)},e.prototype.attachCustomKeyEventHandler=function(e){this._core.attachCustomKeyEventHandler(e)},e.prototype.registerLinkMatcher=function(e,t,r){return this._checkProposedApi(),this._core.registerLinkMatcher(e,t,r)},e.prototype.deregisterLinkMatcher=function(e){this._checkProposedApi(),this._core.deregisterLinkMatcher(e)},e.prototype.registerLinkProvider=function(e){return this._checkProposedApi(),this._core.registerLinkProvider(e)},e.prototype.registerCharacterJoiner=function(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)},e.prototype.deregisterCharacterJoiner=function(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)},e.prototype.registerMarker=function(e){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)},e.prototype.addMarker=function(e){return this.registerMarker(e)},e.prototype.hasSelection=function(){return this._core.hasSelection()},e.prototype.select=function(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)},e.prototype.getSelection=function(){return this._core.getSelection()},e.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},e.prototype.clearSelection=function(){this._core.clearSelection()},e.prototype.selectAll=function(){this._core.selectAll()},e.prototype.selectLines=function(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)},e.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},e.prototype.scrollLines=function(e){this._verifyIntegers(e),this._core.scrollLines(e)},e.prototype.scrollPages=function(e){this._verifyIntegers(e),this._core.scrollPages(e)},e.prototype.scrollToTop=function(){this._core.scrollToTop()},e.prototype.scrollToBottom=function(){this._core.scrollToBottom()},e.prototype.scrollToLine=function(e){this._verifyIntegers(e),this._core.scrollToLine(e)},e.prototype.clear=function(){this._core.clear()},e.prototype.write=function(e,t){this._core.write(e,t)},e.prototype.writeUtf8=function(e,t){this._core.write(e,t)},e.prototype.writeln=function(e,t){this._core.write(e),this._core.write("\r\n",t)},e.prototype.paste=function(e){this._core.paste(e)},e.prototype.getOption=function(e){return this._core.optionsService.getOption(e)},e.prototype.setOption=function(e,t){this._core.optionsService.setOption(e,t)},e.prototype.refresh=function(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)},e.prototype.reset=function(){this._core.reset()},e.prototype.loadAddon=function(e){return this._addonManager.loadAddon(this,e)},Object.defineProperty(e,"strings",{get:function(){return o},enumerable:!1,configurable:!0}),e.prototype._verifyIntegers=function(){for(var e=[],t=0;t=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new i.CellData)},e.prototype.translateToString=function(e,t,r){return this._line.translateToString(e,t,r)},e}(),f=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,(function(e){return t(e.toArray())}))},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,(function(e,r){return t(e,r.toArray())}))},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),_=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},1546:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var i=r(643),n=r(8803),o=r(1420),s=r(3734),a=r(1752),c=r(4774),l=r(9631),h=function(){function e(e,t,r,i,n,o,s,a){this._container=e,this._alpha=i,this._colors=n,this._rendererId=o,this._bufferService=s,this._optionsService=a,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+t+"-layer"),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;l.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=a.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,r){void 0===r&&(r=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=o.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,r,i){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,r){void 0===r&&(r=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,r*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,r){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*r,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,r,i){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,r*this._scaledCellWidth-window.devicePixelRatio,i*this._scaledCellHeight-window.devicePixelRatio)},e.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},e.prototype._clearCells=function(e,t,r,i){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,r){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(r),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,r){var o,s,a=this._getContrastColor(e);a||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,r,a):(e.isInverse()?(o=e.isBgDefault()?n.INVERTED_DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?n.INVERTED_DEFAULT_COLOR:e.getFgColor()):(s=e.isBgDefault()?i.DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?i.DEFAULT_COLOR:e.getFgColor()),o+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||i.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||i.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=s,this._currentGlyphIdentifier.fg=o,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,r))},e.prototype._drawUncachedChars=function(e,t,r,i){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(i)this._ctx.fillStyle=i.css;else if(e.isBgDefault())this._ctx.fillStyle=c.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var o=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8&&(o+=8),this._ctx.fillStyle=this._colors.ansi[o].css}else if(i)this._ctx.fillStyle=i.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var a=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}this._clipRow(r),e.isDim()&&(this._ctx.globalAlpha=n.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var r=e.getFgColor(),i=e.getFgColorMode(),n=e.getBgColor(),o=e.getBgColorMode(),s=!!e.isInverse(),a=!!e.isInverse();if(s){var l=r;r=n,n=l;var h=i;i=o,o=h}var u=this._resolveBackgroundRgba(o,n,s),f=this._resolveForegroundRgba(i,r,s,a),_=c.rgba.ensureContrastRatio(u,f,this._optionsService.options.minimumContrastRatio);if(_){var d={css:c.channels.toCss(_>>24&255,_>>16&255,_>>8&255),rgba:_};return this._colors.contrastCache.setColor(e.bg,e.fg,d),d}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,r){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,r,i){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&i&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=h},5879:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerRegistry=t.JoinedCellData=void 0;var o=r(3734),s=r(643),a=r(511),c=function(e){function t(t,r,i){var n=e.call(this)||this;return n.content=0,n.combinedData="",n.fg=t.fg,n.bg=t.bg,n.combinedData=r,n._width=i,n}return n(t,e),t.prototype.isCombined=function(){return 2097152},t.prototype.getWidth=function(){return this._width},t.prototype.getChars=function(){return this.combinedData},t.prototype.getCode=function(){return 2097151},t.prototype.setFromCharData=function(e){throw new Error("not implemented")},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(o.AttributeData);t.JoinedCellData=c;var l=function(){function e(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}return e.prototype.registerCharacterJoiner=function(e){var t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id},e.prototype.deregisterCharacterJoiner=function(e){for(var t=0;t1)for(var u=this._getJoinedRanges(i,a,o,t,n),f=0;f1)for(u=this._getJoinedRanges(i,a,o,t,n),f=0;f=this._bufferService.rows)this._clearCursor();else{var i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(i,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var n=this._optionsService.options.cursorStyle;return n&&"block"!==n?this._cursorRenderers[n](i,r,this._cell):this._renderBlurCursor(i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=n,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===i&&this._state.y===r&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},t.prototype._renderBarCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,r.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(r,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,r){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,r.getWidth(),1),this._ctx.restore()},t}(o.BaseRenderLayer);t.CursorRenderLayer=c;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=void 0}))))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=a),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0})),t._blinkInterval=window.setInterval((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0}))}),a)}),e)},e.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},3700:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var r=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var r=0;r0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===s.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&a.is256Color(e.fg)?this._ctx.fillStyle=this._colors.ansi[e.fg].css:this._ctx.fillStyle=this._colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(var t=e.y1+1;t=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var a=r(9596),c=r(4149),l=r(2512),h=r(5098),u=r(5879),f=r(844),_=r(4725),d=r(2585),p=r(1420),v=r(8460),g=1,y=function(e){function t(t,r,i,n,o,s,f,_,d){var p=e.call(this)||this;p._colors=t,p._screenElement=r,p._bufferService=o,p._charSizeService=s,p._optionsService=f,p._id=g++,p._onRequestRedraw=new v.EventEmitter;var y=p._optionsService.options.allowTransparency;return p._characterJoinerRegistry=new u.CharacterJoinerRegistry(p._bufferService),p._renderLayers=[new a.TextRenderLayer(p._screenElement,0,p._colors,p._characterJoinerRegistry,y,p._id,p._bufferService,f),new c.SelectionRenderLayer(p._screenElement,1,p._colors,p._id,p._bufferService,f),new h.LinkRenderLayer(p._screenElement,2,p._colors,p._id,i,n,p._bufferService,f),new l.CursorRenderLayer(p._screenElement,3,p._colors,p._id,p._onRequestRedraw,p._bufferService,f,_,d)],p.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},p._devicePixelRatio=window.devicePixelRatio,p._updateDimensions(),p.onOptionsChanged(),p}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,r=this._renderLayers;t{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e}},4149:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;var o=function(e){function t(t,r,i,n,o,s){var a=e.call(this,t,"selection",r,!0,i,n,o,s)||this;return a._clearState(),a}return n(t,e),t.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._clearState()},t.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},t.prototype.onSelectionChanged=function(e,t,r){if(this._didStateChange(e,t,r,this._bufferService.buffer.ydisp))if(this._clearAll(),e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(o>=this._bufferService.rows||s<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=this._colors.selectionTransparent.css,r){var a=e[0],c=t[0]-a,l=s-o+1;this._fillCells(a,o,c,l)}else{a=i===o?e[0]:0;var h=o===n?t[0]:this._bufferService.cols;this._fillCells(a,o,h-a,1);var u=Math.max(s-o-1,0);if(this._fillCells(0,o+1,this._bufferService.cols,u),o!==s){var f=n===s?t[0]:this._bufferService.cols;this._fillCells(0,s,f,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=r,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,r,i){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||r!==this._state.columnSelectMode||i!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(r(1546).BaseRenderLayer);t.SelectionRenderLayer=o},9596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.TextRenderLayer=void 0;var o=r(3700),s=r(1546),a=r(3734),c=r(643),l=r(5879),h=r(511),u=function(e){function t(t,r,i,n,s,a,c,l){var u=e.call(this,t,"text",r,s,i,a,c,l)||this;return u._characterWidth=0,u._characterFont="",u._characterOverlapCache={},u._workCell=new h.CellData,u._state=new o.GridCache,u._characterJoinerRegistry=n,u}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t);var r=this._getFont(!1,!1);this._characterWidth===t.scaledCharWidth&&this._characterFont===r||(this._characterWidth=t.scaledCharWidth,this._characterFont=r,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},t.prototype.reset=function(){this._state.clear(),this._clearAll()},t.prototype._forEachCell=function(e,t,r,i){for(var n=e;n<=t;n++)for(var o=n+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.lines.get(o),a=r?r.getJoinedCharacters(o):[],h=0;h0&&h===a[0][0]){f=!0;var d=a.shift();u=new l.JoinedCellData(this._workCell,s.translateToString(!0,d[0],d[1]),d[1]-d[0]),_=d[1]-1}!f&&this._isOverlapping(u)&&_this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=r,r},t}(s.BaseRenderLayer);t.TextRenderLayer=u},9616:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCharAtlas=void 0;var r=function(){function e(){this._didWarmUp=!1}return e.prototype.dispose=function(){},e.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},e.prototype._doWarmUp=function(){},e.prototype.beginFrame=function(){},e}();t.BaseCharAtlas=r},1420:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var i=r(2040),n=r(1906),o=[];t.acquireCharAtlas=function(e,t,r,s,a){for(var c=i.generateConfig(s,a,e,r),l=0;l=0){if(i.configEquals(u.config,c))return u.atlas;1===u.ownedBy.length?(u.atlas.dispose(),o.splice(l,1)):u.ownedBy.splice(h,1);break}}for(l=0;l{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;var i=r(643);t.generateConfig=function(e,t,r,i){var n={foreground:i.foreground,background:i.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:i.ansi};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:e,scaledCharHeight:t,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,colors:n}},t.configEquals=function(e,t){for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.CHAR_ATLAS_CELL_SPACING=1},1906:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NoneCharAtlas=t.DynamicCharAtlas=t.getGlyphCacheKey=void 0;var o=r(8803),s=r(9616),a=r(5680),c=r(7001),l=r(6114),h=r(1752),u=r(4774),f={css:"rgba(0, 0, 0, 0)",rgba:0};function _(e){return e.code<<21|e.bg<<12|e.fg<<3|(e.bold?0:4)+(e.dim?0:2)+(e.italic?0:1)}t.getGlyphCacheKey=_;var d=function(e){function t(t,r){var i=e.call(this)||this;i._config=r,i._drawToCacheCount=0,i._glyphsWaitingOnBitmap=[],i._bitmapCommitTimeout=null,i._bitmap=null,i._cacheCanvas=t.createElement("canvas"),i._cacheCanvas.width=1024,i._cacheCanvas.height=1024,i._cacheCtx=h.throwIfFalsy(i._cacheCanvas.getContext("2d",{alpha:!0}));var n=t.createElement("canvas");n.width=i._config.scaledCharWidth,n.height=i._config.scaledCharHeight,i._tmpCtx=h.throwIfFalsy(n.getContext("2d",{alpha:i._config.allowTransparency})),i._width=Math.floor(1024/i._config.scaledCharWidth),i._height=Math.floor(1024/i._config.scaledCharHeight);var o=i._width*i._height;return i._cacheMap=new c.LRUMap(o),i._cacheMap.prealloc(o),i}return n(t,e),t.prototype.dispose=function(){null!==this._bitmapCommitTimeout&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},t.prototype.beginFrame=function(){this._drawToCacheCount=0},t.prototype.draw=function(e,t,r,i){if(32===t.code)return!0;if(!this._canCache(t))return!1;var n=_(t),o=this._cacheMap.get(n);if(null!=o)return this._drawFromCache(e,o,r,i),!0;if(this._drawToCacheCount<100){var s;s=this._cacheMap.size>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,s=0;s{Object.defineProperty(t,"__esModule",{value:!0}),t.LRUMap=void 0;var r=function(){function e(e){this.capacity=e,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return e.prototype._unlinkNode=function(e){var t=e.prev,r=e.next;e===this._head&&(this._head=r),e===this._tail&&(this._tail=t),null!==t&&(t.next=r),null!==r&&(r.prev=t)},e.prototype._appendNode=function(e){var t=this._tail;null!==t&&(t.next=e),e.prev=t,e.next=null,this._tail=e,null===this._head&&(this._head=e)},e.prototype.prealloc=function(e){for(var t=this._nodePool,r=0;r=this.capacity)r=this._head,this._unlinkNode(r),delete this._map[r.key],r.key=e,r.value=t,this._map[e]=r;else{var i=this._nodePool;i.length>0?((r=i.pop()).key=e,r.value=t):r={prev:null,next:null,key:e,value:t},this._map[e]=r,this.size++}this._appendNode(r)},e}();t.LRUMap=r},1296:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var a=r(3787),c=r(8803),l=r(844),h=r(4725),u=r(2585),f=r(8460),_=r(4774),d=r(9631),p="xterm-dom-renderer-owner-",v="xterm-fg-",g="xterm-bg-",y="xterm-focus",b=1,S=function(e){function t(t,r,i,n,o,s,c,l,h){var u=e.call(this)||this;return u._colors=t,u._element=r,u._screenElement=i,u._viewportElement=n,u._linkifier=o,u._linkifier2=s,u._charSizeService=c,u._optionsService=l,u._bufferService=h,u._terminalClass=b++,u._rowElements=[],u._rowContainer=document.createElement("div"),u._rowContainer.classList.add("xterm-rows"),u._rowContainer.style.lineHeight="normal",u._rowContainer.setAttribute("aria-hidden","true"),u._refreshRowElements(u._bufferService.cols,u._bufferService.rows),u._selectionContainer=document.createElement("div"),u._selectionContainer.classList.add("xterm-selection"),u._selectionContainer.setAttribute("aria-hidden","true"),u.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},u._updateDimensions(),u._injectCss(),u._rowFactory=new a.DomRendererRowFactory(document,u._optionsService,u._colors),u._element.classList.add(p+u._terminalClass),u._screenElement.appendChild(u._rowContainer),u._screenElement.appendChild(u._selectionContainer),u._linkifier.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u._linkifier2.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier2.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new f.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove(p+this._terminalClass),d.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var e=0,t=this._rowElements;et;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove(y)},t.prototype.onFocus=function(){this._rowContainer.classList.add(y)},t.prototype.onSelectionChanged=function(e,t,r){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(!(o>=this._bufferService.rows||s<0)){var a=document.createDocumentFragment();if(r)a.appendChild(this._createSelectionElement(o,e[0],t[0],s-o+1));else{var c=i===o?e[0]:0,l=o===n?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,c,l));var h=s-o-1;if(a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,h)),o!==s){var u=n===s?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,0,u))}}this._selectionContainer.appendChild(a)}}},t.prototype._createSelectionElement=function(e,t,r,i){void 0===i&&(i=1);var n=document.createElement("div");return n.style.height=i*this.dimensions.actualCellHeight+"px",n.style.top=e*this.dimensions.actualCellHeight+"px",n.style.left=t*this.dimensions.actualCellWidth+"px",n.style.width=this.dimensions.actualCellWidth*(r-t)+"px",n},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e=n&&(e=0,r++)}},o([s(6,h.ICharSizeService),s(7,u.IOptionsService),s(8,u.IBufferService)],t)}(l.Disposable);t.DomRenderer=S},3787:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var i=r(8803),n=r(643),o=r(511),s=r(4774);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var a=function(){function e(e,t,r){this._document=e,this._optionsService=t,this._colors=r,this._workCell=new o.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,r,o,a,l,h,u){for(var f=this._document.createDocumentFragment(),_=0,d=Math.min(e.length,u)-1;d>=0;d--)if(e.loadCell(d,this._workCell).getCode()!==n.NULL_CELL_CODE||r&&d===a){_=d+1;break}for(d=0;d<_;d++){e.loadCell(d,this._workCell);var p=this._workCell.getWidth();if(0!==p){var v=this._document.createElement("span");if(p>1&&(v.style.width=h*p+"px"),r&&d===a)switch(v.classList.add(t.CURSOR_CLASS),l&&v.classList.add(t.CURSOR_BLINK_CLASS),o){case"bar":v.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":v.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:v.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&v.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&v.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&v.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&v.classList.add(t.UNDERLINE_CLASS),this._workCell.isInvisible()?v.textContent=n.WHITESPACE_CELL_CHAR:v.textContent=this._workCell.getChars()||n.WHITESPACE_CELL_CHAR;var g=this._workCell.getFgColor(),y=this._workCell.getFgColorMode(),b=this._workCell.getBgColor(),S=this._workCell.getBgColorMode(),m=!!this._workCell.isInverse();if(m){var C=g;g=b,b=C;var w=y;y=S,S=w}switch(y){case 16777216:case 33554432:this._workCell.isBold()&&g<8&&this._optionsService.options.drawBoldTextInBrightColors&&(g+=8),this._applyMinimumContrast(v,this._colors.background,this._colors.ansi[g])||v.classList.add("xterm-fg-"+g);break;case 50331648:var E=s.rgba.toColor(g>>16&255,g>>8&255,255&g);this._applyMinimumContrast(v,this._colors.background,E)||this._addStyle(v,"color:#"+c(g.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(v,this._colors.background,this._colors.foreground)||m&&v.classList.add("xterm-fg-"+i.INVERTED_DEFAULT_COLOR)}switch(S){case 16777216:case 33554432:v.classList.add("xterm-bg-"+b);break;case 50331648:this._addStyle(v,"background-color:#"+c(b.toString(16),"0",6));break;case 0:default:m&&v.classList.add("xterm-bg-"+i.INVERTED_DEFAULT_COLOR)}f.appendChild(v)}}return f},e.prototype._applyMinimumContrast=function(e,t,r){if(1===this._optionsService.options.minimumContrastRatio)return!1;var i=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===i&&(i=s.color.ensureContrastRatio(t,r,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=i?i:null)),!!i&&(this._addStyle(e,"color:"+i.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function c(e,t,r){for(;e.length{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0;var r=function(){function e(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}return e.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(e.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=r},428:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var o=r(2585),s=r(8460),a=function(){function e(e,t,r){this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=new s.EventEmitter,this._measureStrategy=new c(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},i([n(2,o.IOptionsService)],e)}();t.CharSizeService=a;var c=function(){function e(e,t,r){this._document=e,this._parentElement=t,this._optionsService=r,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},5114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var r=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return(this._textarea.getRootNode?this._textarea.getRootNode():document).activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=r},8934:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var o=r(4725),s=r(9806),a=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,r,i,n){return s.getCoords(e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,n)},e.prototype.getRawByteCoords=function(e,t,r,i){var n=this.getCoords(e,t,r,i);return s.getRawByteCoords(n)},i([n(0,o.IRenderService),n(1,o.ICharSizeService)],e)}();t.MouseService=a},3230:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var a=r(6193),c=r(8460),l=r(844),h=r(5596),u=r(3656),f=r(2585),_=r(4725),d=function(e){function t(t,r,i,n,o,s){var l=e.call(this)||this;if(l._renderer=t,l._rowCount=r,l._charSizeService=o,l._isPaused=!1,l._needsFullRefresh=!1,l._isNextRenderRedrawOnly=!0,l._needsSelectionRefresh=!1,l._canvasWidth=0,l._canvasHeight=0,l._selectionState={start:void 0,end:void 0,columnSelectMode:!1},l._onDimensionsChange=new c.EventEmitter,l._onRender=new c.EventEmitter,l._onRefreshRequest=new c.EventEmitter,l.register({dispose:function(){return l._renderer.dispose()}}),l._renderDebouncer=new a.RenderDebouncer((function(e,t){return l._renderRows(e,t)})),l.register(l._renderDebouncer),l._screenDprMonitor=new h.ScreenDprMonitor,l._screenDprMonitor.setListener((function(){return l.onDevicePixelRatioChange()})),l.register(l._screenDprMonitor),l.register(s.onResize((function(e){return l._fullRefresh()}))),l.register(n.onOptionChange((function(){return l._renderer.onOptionsChanged()}))),l.register(l._charSizeService.onCharSizeChange((function(){return l.onCharSizeChanged()}))),l._renderer.onRequestRedraw((function(e){return l.refreshRows(e.start,e.end,!0)})),l.register(u.addDisposableDomListener(window,"resize",(function(){return l.onDevicePixelRatioChange()}))),"IntersectionObserver"in window){var f=new IntersectionObserver((function(e){return l._onIntersectionChange(e[e.length-1])}),{threshold:0});f.observe(i),l.register({dispose:function(){return f.disconnect()}})}return l}return n(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,r){void 0===r&&(r=!1),this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw((function(e){return t.refreshRows(e.start,e.end,!0)})),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.onSelectionChanged(e,t,r)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},o([s(3,f.IOptionsService),s(4,_.ICharSizeService),s(5,f.IBufferService)],t)}(l.Disposable);t.RenderService=d},9312:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var a=r(6114),c=r(456),l=r(511),h=r(8460),u=r(4725),f=r(2585),_=r(9806),d=r(9504),p=r(844),v=String.fromCharCode(160),g=new RegExp(v,"g"),y=function(e){function t(t,r,i,n,o,s,a){var u=e.call(this)||this;return u._element=t,u._screenElement=r,u._bufferService=i,u._coreService=n,u._mouseService=o,u._optionsService=s,u._renderService=a,u._dragScrollAmount=0,u._enabled=!0,u._workCell=new l.CellData,u._mouseDownTimeStamp=0,u._oldHasSelection=!1,u._oldSelectionStart=void 0,u._oldSelectionEnd=void 0,u._onLinuxMouseSelection=u.register(new h.EventEmitter),u._onRedrawRequest=u.register(new h.EventEmitter),u._onSelectionChange=u.register(new h.EventEmitter),u._onRequestScrollLines=u.register(new h.EventEmitter),u._mouseMoveListener=function(e){return u._onMouseMove(e)},u._mouseUpListener=function(e){return u._onMouseUp(e)},u._coreService.onUserInput((function(){u.hasSelection&&u.clearSelection()})),u._trimListener=u._bufferService.buffer.lines.onTrim((function(e){return u._onTrim(e)})),u.register(u._bufferService.buffers.onBufferActivate((function(e){return u._onBufferActivate(e)}))),u.enable(),u._model=new c.SelectionModel(u._bufferService),u._activeSelectionMode=0,u}return n(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var r=this._bufferService.buffer,i=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var n=e[1];n<=t[1];n++){var o=r.translateBufferLineToString(n,!0,e[0],t[0]);i.push(o)}}else{var s=e[1]===t[1]?t[0]:void 0;for(i.push(r.translateBufferLineToString(e[1],!0,e[0],s)),n=e[1]+1;n<=t[1]-1;n++){var c=r.lines.get(n);o=r.translateBufferLineToString(n,!0),c&&c.isWrapped?i[i.length-1]+=o:i.push(o)}e[1]!==t[1]&&(c=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]),c&&c.isWrapped?i[i.length-1]+=o:i.push(o))}return i.map((function(e){return e.replace(g," ")})).join(a.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame((function(){return t._refresh()}))),a.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype._isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!(r&&i&&t)&&this._areCoordsInSelection(t,r,i)},t.prototype._areCoordsInSelection=function(e,t,r){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]},t.prototype._selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=_.getCoordsRelativeToElement(e,this._screenElement)[1],r=this._renderService.dimensions.canvasHeight;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return a.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval((function(){return e._dragScroll()}),50)},t.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(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){this._model.selectionEnd=void 0;var t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(a.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var r=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(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.getOption("altClickMovesCursor")){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&void 0!==r[0]&&void 0!==r[1]){var i=d.moveToCellSequence(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()},t.prototype._fireEventIfSelectionChanged=function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);r?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,r)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,r)},t.prototype._fireOnSelectionChange=function(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((function(e){return t._onTrim(e)}))},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var r=t[0],i=0;t[0]>=i;i++){var n=e.loadCell(i,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:n>1&&t[0]!==i&&(r+=n-1)}return r},t.prototype.setSelection=function(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh()},t.prototype.rightClickSelect=function(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e),this._fireEventIfSelectionChanged())},t.prototype._getWordAt=function(e,t,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),!(e[0]>=this._bufferService.cols)){var n=this._bufferService.buffer,o=n.lines.get(e[1]);if(o){var s=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e),c=a,l=e[0]-a,h=0,u=0,f=0,_=0;if(" "===s.charAt(a)){for(;a>0&&" "===s.charAt(a-1);)a--;for(;c1&&(_+=v-1,c+=v-1);d>0&&a>0&&!this._isCharWordSeparator(o.loadCell(d-1,this._workCell));){o.loadCell(d-1,this._workCell);var g=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,d--):g>1&&(f+=g-1,a-=g-1),a--,d--}for(;p1&&(_+=y-1,c+=y-1),c++,p++}}c++;var b=a+l-h+f,S=Math.min(this._bufferService.cols,c-a+h+u-f-_);if(t||""!==s.slice(a,c).trim()){if(r&&0===b&&32!==o.getCodePoint(0)){var m=n.lines.get(e[1]-1);if(m&&o.isWrapped&&32!==m.getCodePoint(this._bufferService.cols-1)){var C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){var w=this._bufferService.cols-C.start;b-=w,S+=w}}}if(i&&b+S===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){var E=n.lines.get(e[1]+1);if(E&&E.isWrapped&&32!==E.getCodePoint(0)){var L=this._getWordAt([0,e[1]+1],!1,!1,!0);L&&(S+=L.length)}}return{start:b,length:S}}}}},t.prototype._selectWordAt=function(e,t){var r=this._getWordAt(e,t);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}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var r=e[1];t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},o([s(2,f.IBufferService),s(3,f.ICoreService),s(4,u.IMouseService),s(5,f.IOptionsService),s(6,u.IRenderService)],t)}(p.Disposable);t.SelectionService=y},4725:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var i=r(8343);t.ICharSizeService=i.createDecorator("CharSizeService"),t.ICoreBrowserService=i.createDecorator("CoreBrowserService"),t.IMouseService=i.createDecorator("MouseService"),t.IRenderService=i.createDecorator("RenderService"),t.ISelectionService=i.createDecorator("SelectionService"),t.ISoundService=i.createDecorator("SoundService")},357:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var o=r(2585),s=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var r=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),(function(e){r.buffer=e,r.connect(t.destination),r.start(0)}))}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),r=t.length,i=new Uint8Array(r),n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;var i=r(8460),n=function(){function e(e){this._maxLength=e,this.onDeleteEmitter=new i.EventEmitter,this.onInsertEmitter=new i.EventEmitter,this.onTrimEmitter=new i.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(e.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(e){if(this._maxLength!==e){for(var t=new Array(e),r=0;rthis._length)for(var t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(n=0;nthis._maxLength){var o=this._length+r.length-this._maxLength;this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)}else this._length+=r.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,r){if(!(t<=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(var i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));var n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(i=0;i{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,r){if(void 0===r&&(r=5),"object"!=typeof t)return t;var i=Array.isArray(t)?[]:{};for(var n in t)i[n]=r<=1?t[n]:t[n]?e(t[n],r-1):t[n];return i}},8969:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;var o=r(844),s=r(2585),a=r(4348),c=r(7866),l=r(744),h=r(7302),u=r(6975),f=r(8460),_=r(1753),d=r(3730),p=r(1480),v=r(7994),g=r(9282),y=r(5435),b=r(5981),S=function(e){function t(t){var r=e.call(this)||this;return r._onBinary=new f.EventEmitter,r._onData=new f.EventEmitter,r._onLineFeed=new f.EventEmitter,r._onResize=new f.EventEmitter,r._onScroll=new f.EventEmitter,r._instantiationService=new a.InstantiationService,r.optionsService=new h.OptionsService(t),r._instantiationService.setService(s.IOptionsService,r.optionsService),r._bufferService=r.register(r._instantiationService.createInstance(l.BufferService)),r._instantiationService.setService(s.IBufferService,r._bufferService),r._logService=r._instantiationService.createInstance(c.LogService),r._instantiationService.setService(s.ILogService,r._logService),r._coreService=r.register(r._instantiationService.createInstance(u.CoreService,(function(){return r.scrollToBottom()}))),r._instantiationService.setService(s.ICoreService,r._coreService),r._coreMouseService=r._instantiationService.createInstance(_.CoreMouseService),r._instantiationService.setService(s.ICoreMouseService,r._coreMouseService),r._dirtyRowService=r._instantiationService.createInstance(d.DirtyRowService),r._instantiationService.setService(s.IDirtyRowService,r._dirtyRowService),r.unicodeService=r._instantiationService.createInstance(p.UnicodeService),r._instantiationService.setService(s.IUnicodeService,r.unicodeService),r._charsetService=r._instantiationService.createInstance(v.CharsetService),r._instantiationService.setService(s.ICharsetService,r._charsetService),r._inputHandler=new y.InputHandler(r._bufferService,r._charsetService,r._coreService,r._dirtyRowService,r._logService,r.optionsService,r._coreMouseService,r.unicodeService),r.register(f.forwardEvent(r._inputHandler.onLineFeed,r._onLineFeed)),r.register(r._inputHandler),r.register(f.forwardEvent(r._bufferService.onResize,r._onResize)),r.register(f.forwardEvent(r._coreService.onData,r._onData)),r.register(f.forwardEvent(r._coreService.onBinary,r._onBinary)),r.register(r.optionsService.onOptionChange((function(e){return r._updateOptions(e)}))),r._writeBuffer=new b.WriteBuffer((function(e){return r._inputHandler.parse(e)})),r}return n(t,e),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)},t.prototype.write=function(e,t){this._writeBuffer.write(e,t)},t.prototype.writeSync=function(e){this._writeBuffer.writeSync(e)},t.prototype.resize=function(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,l.MINIMUM_COLS),t=Math.max(t,l.MINIMUM_ROWS),this._bufferService.resize(e,t))},t.prototype.scroll=function(e,t){void 0===t&&(t=!1);var r,i=this._bufferService.buffer;(r=this._cachedBlankLine)&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;var n=i.ybase+i.scrollTop,o=i.ybase+i.scrollBottom;if(0===i.scrollTop){var s=i.lines.isFull;o===i.lines.length-1?s?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(o+1,0,r.clone()),s?this._bufferService.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this._bufferService.isUserScrolling||i.ydisp++)}else{var a=o-n+1;i.lines.shiftElements(n+1,a-1,-1),i.lines.set(o,r.clone())}this._bufferService.isUserScrolling||(i.ydisp=i.ybase),this._dirtyRowService.markRangeDirty(i.scrollTop,i.scrollBottom),this._onScroll.fire(i.ydisp)},t.prototype.scrollLines=function(e,t){var r=this._bufferService.buffer;if(e<0){if(0===r.ydisp)return;this._bufferService.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this._bufferService.isUserScrolling=!1);var i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},t.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},t.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},t.prototype.scrollToLine=function(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},t.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},t.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},t.prototype._updateOptions=function(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},(function(){return g.updateWindowsModeWrappedState(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,r=t;e{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0;var r=function(){function e(){this._listeners=[],this._disposed=!1}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){if(!e._disposed)for(var r=0;r24)return t.setWinLines||!1;switch(e){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}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(o=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var C=function(){function e(e,t,r,i){this._bufferService=e,this._coreService=t,this._logService=r,this._optionsService=i,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,r){this._data=h.concat(this._data,e.subarray(t,r))},e.prototype.unhook=function(e){if(!e)return this._data=new Uint32Array(0),!0;var t=u.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r0"q'+s.C0.ESC+"\\");break;case'"p':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r61;1"p'+s.C0.ESC+"\\");break;case"r":var r=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+r+s.C0.ESC+"\\");break;case"m":this._coreService.triggerDataEvent(s.C0.ESC+"P1$r0m"+s.C0.ESC+"\\");break;case" q":var i={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];i-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+i+" q"+s.C0.ESC+"\\");break;default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(s.C0.ESC+"P0$r"+s.C0.ESC+"\\")}return!0},e}(),w=function(e){function t(t,r,i,n,o,l,h,d,v){void 0===v&&(v=new c.EscapeSequenceParser);var y=e.call(this)||this;y._bufferService=t,y._charsetService=r,y._coreService=i,y._dirtyRowService=n,y._logService=o,y._optionsService=l,y._coreMouseService=h,y._unicodeService=d,y._parser=v,y._parseBuffer=new Uint32Array(4096),y._stringDecoder=new u.StringToUtf32,y._utf8Decoder=new u.Utf8ToUtf32,y._workCell=new p.CellData,y._windowTitle="",y._iconName="",y._windowTitleStack=[],y._iconNameStack=[],y._curAttrData=f.DEFAULT_ATTR_DATA.clone(),y._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),y._onRequestBell=new _.EventEmitter,y._onRequestRefreshRows=new _.EventEmitter,y._onRequestReset=new _.EventEmitter,y._onRequestScroll=new _.EventEmitter,y._onRequestSyncScrollBar=new _.EventEmitter,y._onRequestWindowsOptionsReport=new _.EventEmitter,y._onA11yChar=new _.EventEmitter,y._onA11yTab=new _.EventEmitter,y._onCursorMove=new _.EventEmitter,y._onLineFeed=new _.EventEmitter,y._onScroll=new _.EventEmitter,y._onTitleChange=new _.EventEmitter,y._onAnsiColorChange=new _.EventEmitter,y.register(y._parser),y._parser.setCsiHandlerFallback((function(e,t){y._logService.debug("Unknown CSI code: ",{identifier:y._parser.identToString(e),params:t.toArray()})})),y._parser.setEscHandlerFallback((function(e){y._logService.debug("Unknown ESC code: ",{identifier:y._parser.identToString(e)})})),y._parser.setExecuteHandlerFallback((function(e){y._logService.debug("Unknown EXECUTE code: ",{code:e})})),y._parser.setOscHandlerFallback((function(e,t,r){y._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:r})})),y._parser.setDcsHandlerFallback((function(e,t,r){"HOOK"===t&&(r=r.toArray()),y._logService.debug("Unknown DCS code: ",{identifier:y._parser.identToString(e),action:t,payload:r})})),y._parser.setPrintHandler((function(e,t,r){return y.print(e,t,r)})),y._parser.registerCsiHandler({final:"@"},(function(e){return y.insertChars(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"@"},(function(e){return y.scrollLeft(e)})),y._parser.registerCsiHandler({final:"A"},(function(e){return y.cursorUp(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"A"},(function(e){return y.scrollRight(e)})),y._parser.registerCsiHandler({final:"B"},(function(e){return y.cursorDown(e)})),y._parser.registerCsiHandler({final:"C"},(function(e){return y.cursorForward(e)})),y._parser.registerCsiHandler({final:"D"},(function(e){return y.cursorBackward(e)})),y._parser.registerCsiHandler({final:"E"},(function(e){return y.cursorNextLine(e)})),y._parser.registerCsiHandler({final:"F"},(function(e){return y.cursorPrecedingLine(e)})),y._parser.registerCsiHandler({final:"G"},(function(e){return y.cursorCharAbsolute(e)})),y._parser.registerCsiHandler({final:"H"},(function(e){return y.cursorPosition(e)})),y._parser.registerCsiHandler({final:"I"},(function(e){return y.cursorForwardTab(e)})),y._parser.registerCsiHandler({final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({prefix:"?",final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({prefix:"?",final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({final:"L"},(function(e){return y.insertLines(e)})),y._parser.registerCsiHandler({final:"M"},(function(e){return y.deleteLines(e)})),y._parser.registerCsiHandler({final:"P"},(function(e){return y.deleteChars(e)})),y._parser.registerCsiHandler({final:"S"},(function(e){return y.scrollUp(e)})),y._parser.registerCsiHandler({final:"T"},(function(e){return y.scrollDown(e)})),y._parser.registerCsiHandler({final:"X"},(function(e){return y.eraseChars(e)})),y._parser.registerCsiHandler({final:"Z"},(function(e){return y.cursorBackwardTab(e)})),y._parser.registerCsiHandler({final:"`"},(function(e){return y.charPosAbsolute(e)})),y._parser.registerCsiHandler({final:"a"},(function(e){return y.hPositionRelative(e)})),y._parser.registerCsiHandler({final:"b"},(function(e){return y.repeatPrecedingCharacter(e)})),y._parser.registerCsiHandler({final:"c"},(function(e){return y.sendDeviceAttributesPrimary(e)})),y._parser.registerCsiHandler({prefix:">",final:"c"},(function(e){return y.sendDeviceAttributesSecondary(e)})),y._parser.registerCsiHandler({final:"d"},(function(e){return y.linePosAbsolute(e)})),y._parser.registerCsiHandler({final:"e"},(function(e){return y.vPositionRelative(e)})),y._parser.registerCsiHandler({final:"f"},(function(e){return y.hVPosition(e)})),y._parser.registerCsiHandler({final:"g"},(function(e){return y.tabClear(e)})),y._parser.registerCsiHandler({final:"h"},(function(e){return y.setMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"h"},(function(e){return y.setModePrivate(e)})),y._parser.registerCsiHandler({final:"l"},(function(e){return y.resetMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"l"},(function(e){return y.resetModePrivate(e)})),y._parser.registerCsiHandler({final:"m"},(function(e){return y.charAttributes(e)})),y._parser.registerCsiHandler({final:"n"},(function(e){return y.deviceStatus(e)})),y._parser.registerCsiHandler({prefix:"?",final:"n"},(function(e){return y.deviceStatusPrivate(e)})),y._parser.registerCsiHandler({intermediates:"!",final:"p"},(function(e){return y.softReset(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"q"},(function(e){return y.setCursorStyle(e)})),y._parser.registerCsiHandler({final:"r"},(function(e){return y.setScrollRegion(e)})),y._parser.registerCsiHandler({final:"s"},(function(e){return y.saveCursor(e)})),y._parser.registerCsiHandler({final:"t"},(function(e){return y.windowOptions(e)})),y._parser.registerCsiHandler({final:"u"},(function(e){return y.restoreCursor(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"}"},(function(e){return y.insertColumns(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"~"},(function(e){return y.deleteColumns(e)})),y._parser.setExecuteHandler(s.C0.BEL,(function(){return y.bell()})),y._parser.setExecuteHandler(s.C0.LF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.VT,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.FF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.CR,(function(){return y.carriageReturn()})),y._parser.setExecuteHandler(s.C0.BS,(function(){return y.backspace()})),y._parser.setExecuteHandler(s.C0.HT,(function(){return y.tab()})),y._parser.setExecuteHandler(s.C0.SO,(function(){return y.shiftOut()})),y._parser.setExecuteHandler(s.C0.SI,(function(){return y.shiftIn()})),y._parser.setExecuteHandler(s.C1.IND,(function(){return y.index()})),y._parser.setExecuteHandler(s.C1.NEL,(function(){return y.nextLine()})),y._parser.setExecuteHandler(s.C1.HTS,(function(){return y.tabSet()})),y._parser.registerOscHandler(0,new g.OscHandler((function(e){return y.setTitle(e),y.setIconName(e),!0}))),y._parser.registerOscHandler(1,new g.OscHandler((function(e){return y.setIconName(e)}))),y._parser.registerOscHandler(2,new g.OscHandler((function(e){return y.setTitle(e)}))),y._parser.registerOscHandler(4,new g.OscHandler((function(e){return y.setAnsiColor(e)}))),y._parser.registerEscHandler({final:"7"},(function(){return y.saveCursor()})),y._parser.registerEscHandler({final:"8"},(function(){return y.restoreCursor()})),y._parser.registerEscHandler({final:"D"},(function(){return y.index()})),y._parser.registerEscHandler({final:"E"},(function(){return y.nextLine()})),y._parser.registerEscHandler({final:"H"},(function(){return y.tabSet()})),y._parser.registerEscHandler({final:"M"},(function(){return y.reverseIndex()})),y._parser.registerEscHandler({final:"="},(function(){return y.keypadApplicationMode()})),y._parser.registerEscHandler({final:">"},(function(){return y.keypadNumericMode()})),y._parser.registerEscHandler({final:"c"},(function(){return y.fullReset()})),y._parser.registerEscHandler({final:"n"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"o"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"|"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"}"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"~"},(function(){return y.setgLevel(1)})),y._parser.registerEscHandler({intermediates:"%",final:"@"},(function(){return y.selectDefaultCharset()})),y._parser.registerEscHandler({intermediates:"%",final:"G"},(function(){return y.selectDefaultCharset()}));var b=function(e){S._parser.registerEscHandler({intermediates:"(",final:e},(function(){return y.selectCharset("("+e)})),S._parser.registerEscHandler({intermediates:")",final:e},(function(){return y.selectCharset(")"+e)})),S._parser.registerEscHandler({intermediates:"*",final:e},(function(){return y.selectCharset("*"+e)})),S._parser.registerEscHandler({intermediates:"+",final:e},(function(){return y.selectCharset("+"+e)})),S._parser.registerEscHandler({intermediates:"-",final:e},(function(){return y.selectCharset("-"+e)})),S._parser.registerEscHandler({intermediates:".",final:e},(function(){return y.selectCharset("."+e)})),S._parser.registerEscHandler({intermediates:"/",final:e},(function(){return y.selectCharset("/"+e)}))},S=this;for(var m in a.CHARSETS)b(m);return y._parser.registerEscHandler({intermediates:"#",final:"8"},(function(){return y.screenAlignmentPattern()})),y._parser.setErrorHandler((function(e){return y._logService.error("Parsing error: ",e),e})),y._parser.registerDcsHandler({intermediates:"$",final:"q"},new C(y._bufferService,y._coreService,y._logService,y._optionsService)),y}return n(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onAnsiColorChange",{get:function(){return this._onAnsiColorChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,r=t.x,i=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.lengthS)for(var n=0;n0&&2===_.getWidth(o.x-1)&&_.setCellFromCodePoint(o.x-1,0,1,f.fg,f.bg,f.extended);for(var p=t;p=c)if(l){for(;o.x=this._bufferService.rows&&(o.y=this._bufferService.rows-1),o.lines.get(o.ybase+o.y).isWrapped=!0),_=o.lines.get(o.ybase+o.y)}else if(o.x=c-1,2===n)continue;if(h&&(_.insertCells(o.x,n,o.getNullCell(f),f),2===_.getWidth(c-1)&&_.setCellFromCodePoint(c-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,f.fg,f.bg,f.extended)),_.setCellFromCodePoint(o.x++,i,n,f.fg,f.bg,f.extended),n>0)for(;--n;)_.setCellFromCodePoint(o.x++,0,0,f.fg,f.bg,f.extended)}else _.getWidth(o.x-1)?_.addCodepointToCell(o.x-1,i):_.addCodepointToCell(o.x-2,i)}r-t>0&&(_.loadCell(o.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),o.x0&&0===_.getWidth(o.x)&&!_.hasContent(o.x)&&_.setCellFromCodePoint(o.x,0,1,f.fg,f.bg,f.extended),this._dirtyRowService.markDirty(o.y)},t.prototype.addCsiHandler=function(e,t){var r=this;return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(function(e){return!m(e.params[0],r._optionsService.options.windowOptions)||t(e)}))},t.prototype.addDcsHandler=function(e,t){return this._parser.registerDcsHandler(e,new y.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.registerEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.registerOscHandler(e,new g.OscHandler(t))},t.prototype.bell=function(){return this._onRequestBell.fire(),!0},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;return this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire(),!0},t.prototype.carriageReturn=function(){return this._bufferService.buffer.x=0,!0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),t.x>0&&t.x--,!0;if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var r=t.lines.get(t.ybase+t.y);r.hasWidth(t.x)&&!r.hasContent(t.x)&&t.x--}return this._restrictCursor(),!0},t.prototype.tab=function(){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;var e=this._bufferService.buffer.x;return this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e),!0},t.prototype.shiftOut=function(){return this._charsetService.setgLevel(1),!0},t.prototype.shiftIn=function(){return this._charsetService.setgLevel(0),!0},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0},t.prototype.cursorForward=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.cursorBackward=function(e){return this._moveCursor(-(e.params[0]||1),0),!0},t.prototype.cursorNextLine=function(e){return this.cursorDown(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorPrecedingLine=function(e){return this.cursorUp(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorCharAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.cursorPosition=function(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0},t.prototype.charPosAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.hPositionRelative=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.linePosAbsolute=function(e){return this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1),!0},t.prototype.vPositionRelative=function(e){return this._moveCursor(0,e.params[0]||1),!0},t.prototype.hVPosition=function(e){return this.cursorPosition(e),!0},t.prototype.tabClear=function(e){var t=e.params[0];return 0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={}),!0},t.prototype.cursorForwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop();return!0},t.prototype.cursorBackwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1,r=this._bufferService.buffer;t--;)r.x=r.prevStop();return!0},t.prototype._eraseInBufferLine=function(e,t,r,i){void 0===i&&(i=!1);var n=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);n.replaceCells(t,r,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i&&(n.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowService.markDirty(t-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var r=this._bufferService.buffer.lines.length-this._bufferService.rows;r>0&&(this._bufferService.buffer.lines.trimStart(r),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-r,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-r,0),this._onScroll.fire(0))}return!0},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}return this._dirtyRowService.markDirty(this._bufferService.buffer.y),!0},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,r=this._bufferService.buffer;if(r.y>r.scrollBottom||r.yr.scrollBottom||r.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0},t.prototype.sendDeviceAttributesSecondary=function(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t=2||2===i[1]&&o+n>=5)break;i[1]&&(n=1)}while(++o+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg,!0;for(var t,r=e.length,i=this._curAttrData,n=0;n=30&&t<=37?(i.fg&=-50331904,i.fg|=16777216|t-30):t>=40&&t<=47?(i.bg&=-50331904,i.bg|=16777216|t-40):t>=90&&t<=97?(i.fg&=-50331904,i.fg|=16777224|t-90):t>=100&&t<=107?(i.bg&=-50331904,i.bg|=16777224|t-100):0===t?(i.fg=f.DEFAULT_ATTR_DATA.fg,i.bg=f.DEFAULT_ATTR_DATA.bg):1===t?i.fg|=134217728:3===t?i.bg|=67108864:4===t?(i.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,i)):5===t?i.fg|=536870912:7===t?i.fg|=67108864:8===t?i.fg|=1073741824:2===t?i.bg|=134217728:21===t?this._processUnderline(2,i):22===t?(i.fg&=-134217729,i.bg&=-134217729):23===t?i.bg&=-67108865:24===t?i.fg&=-268435457:25===t?i.fg&=-536870913:27===t?i.fg&=-67108865:28===t?i.fg&=-1073741825:39===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):49===t?(i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?n+=this._extractColor(e,n,i):59===t?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):100===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t);return!0},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(s.C0.ESC+"[0n");break;case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"["+t+";"+r+"R")}return!0},t.prototype.deviceStatusPrivate=function(e){switch(e.params[0]){case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"[?"+t+";"+r+"R")}return!0},t.prototype.softReset=function(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){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"}var r=t%2==1;return this._optionsService.options.cursorBlink=r,!0},t.prototype.setScrollRegion=function(e){var t,r=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>r&&(this._bufferService.buffer.scrollTop=r-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0)),!0},t.prototype.windowOptions=function(e){if(!m(e.params[0],this._optionsService.options.windowOptions))return!0;var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(o.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(o.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(s.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0},t.prototype.saveCursor=function(e){return this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,!0},t.prototype.restoreCursor=function(e){return this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor(),!0},t.prototype.setTitle=function(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0},t.prototype.setIconName=function(e){return this._iconName=e,!0},t.prototype._parseAnsiColorChange=function(e){for(var t,r={colors:[]},i=/(\d+);rgb:([0-9a-f]{2})\/([0-9a-f]{2})\/([0-9a-f]{2})/gi;null!==(t=i.exec(e));)r.colors.push({colorIndex:parseInt(t[1]),red:parseInt(t[2],16),green:parseInt(t[3],16),blue:parseInt(t[4],16)});return 0===r.colors.length?null:r},t.prototype.setAnsiColor=function(e){var t=this._parseAnsiColorChange(e);return t?this._onAnsiColorChange.fire(t):this._logService.warn("Expected format ;rgb:// but got data: "+e),!0},t.prototype.nextLine=function(){return this._bufferService.buffer.x=0,this.index(),!0},t.prototype.keypadApplicationMode=function(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0},t.prototype.keypadNumericMode=function(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0},t.prototype.selectDefaultCharset=function(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),!0},t.prototype.selectCharset=function(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(b[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET),!0)},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;return this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor(),!0},t.prototype.tabSet=function(){return this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0,!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;if(e.y===e.scrollTop){var t=e.scrollBottom-e.scrollTop;e.lines.shiftElements(e.ybase+e.y,t,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)}else e.y--,this._restrictCursor();return!0},t.prototype.fullReset=function(){return this._parser.reset(),this._onRequestReset.fire(),!0},t.prototype.reset=function(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){return this._charsetService.setgLevel(e),!0},t.prototype.screenAlignmentPattern=function(){var e=new p.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.Disposable=void 0;var r=function(){function e(){this._disposables=[],this._isDisposed=!1}return e.prototype.dispose=function(){this._isDisposed=!0;for(var e=0,t=this._disposables;e{Object.defineProperty(t,"__esModule",{value:!0}),t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isFirefox=void 0;var r="undefined"==typeof navigator,i=r?"node":navigator.userAgent,n=r?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),t.isIpad="iPad"===n,t.isIphone="iPhone"===n,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),t.isLinux=n.indexOf("Linux")>=0},8273:(e,t)=>{function r(e,t,r,i){if(void 0===r&&(r=0),void 0===i&&(i=e.length),r>=e.length)return e;r=(e.length+r)%e.length,i=i>=e.length?e.length:(e.length+i)%e.length;for(var n=r;n{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;var i=r(643);t.updateWindowsModeWrappedState=function(e){var t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),r=null==t?void 0:t.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&r&&(n.isWrapped=r[i.CHAR_DATA_CODE_INDEX]!==i.NULL_CELL_CODE&&r[i.CHAR_DATA_CODE_INDEX]!==i.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;var r=function(){function e(){this.fg=0,this.bg=0,this.extended=new i}return e.toColorRGB=function(e){return[e>>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.prototype.getUnderlineColor=function(){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()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=r;var i=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=i},9092:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var i=r(6349),n=r(8437),o=r(511),s=r(643),a=r(4634),c=r(4863),l=r(7116),h=r(3734);t.MAX_BUFFER_SIZE=4294967295;var u=function(){function e(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=l.DEFAULT_CHARSET,this.markers=[],this._nullCell=o.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]),this._whitespaceCell=o.CellData.fromCharData([0,s.WHITESPACE_CELL_CHAR,s.WHITESPACE_CELL_WIDTH,s.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=n.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},e.prototype.resize=function(e,t){var r=this.getNullCell(n.DEFAULT_ATTR_DATA),i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,r)));else for(a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(o=0;othis._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var r=a.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(r.length>0){var i=a.reflowLargerCreateNewLayout(this.lines,r);a.reflowLargerApplyNewLayout(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,r){for(var i=this.getNullCell(n.DEFAULT_ATTR_DATA),o=r;o-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;s--){var c=this.lines.get(s);if(!(!c||!c.isWrapped&&c.getTrimmedLength()<=e)){for(var l=[c];c.isWrapped&&s>0;)c=this.lines.get(--s),l.unshift(c);var h=this.ybase+this.y;if(!(h>=s&&h0&&(i.push({start:s+l.length+o,newLines:p}),o+=p.length),l.push.apply(l,p);var y=_.length-1,b=_[y];0===b&&(b=_[--y]);for(var S=l.length-d-1,m=f;S>=0;){var C=Math.min(m,b);if(l[y].copyCellsFrom(l[S],m-C,b-C,C,!0),0==(b-=C)&&(b=_[--y]),0==(m-=C)){S--;var w=Math.max(S,0);m=a.getWrappedLineTrimmedLength(l,w,this._cols)}}for(v=0;v0;)0===this.ybase?this.y0){var L=[],A=[];for(v=0;v=0;v--)if(D&&D.start>k+T){for(var O=D.newLines.length-1;O>=0;O--)this.lines.set(v--,D.newLines[O]);v++,L.push({index:k+1,amount:D.newLines.length}),T+=D.newLines.length,D=i[++x]}else this.lines.set(v,A[k--]);var M=0;for(v=L.length-1;v>=0;v--)L[v].index+=M,this.lines.onInsertEmitter.fire(L[v]),M+=L[v].amount;var P=Math.max(0,R+o-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}},e.prototype.stringIndexToBufferIndex=function(e,t,r){for(void 0===r&&(r=!1);t;){var i=this.lines.get(e);if(!i)return[-1,-1];for(var n=r?i.getTrimmedLength():i.length,o=0;o0&&this.lines.get(t).isWrapped;)t--;for(;r+10;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,r=new c.Marker(e);return this.markers.push(r),r.register(this.lines.onTrim((function(e){r.line-=e,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((function(e){r.line>=e.index&&(r.line+=e.amount)}))),r.register(this.lines.onDelete((function(e){r.line>=e.index&&r.linee.index&&(r.line-=e.amount)}))),r.register(r.onDispose((function(){return t._removeMarker(r)}))),r},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,r,i,n){return new f(this,e,t,r,i,n)},e}();t.Buffer=u;var f=function(){function e(e,t,r,i,n,o){void 0===r&&(r=0),void 0===i&&(i=e.lines.length),void 0===n&&(n=0),void 0===o&&(o=0),this._buffer=e,this._trimRight=t,this._startIndex=r,this._endIndex=i,this._startOverscan=n,this._endOverscan=o,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",r=e.first;r<=e.last;++r)t+=this._buffer.translateBufferLineToString(r,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=f},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;var i=r(482),n=r(643),o=r(511),s=r(3734);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);var a=function(){function e(e,t,r){void 0===r&&(r=!1),this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);for(var i=t||o.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]),s=0;s>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]},e.prototype.set=function(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?i.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var r=3*e;return t.content=this._data[r+0],t.fg=this._data[r+1],t.bg=this._data[r+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,r,i,n,o){268435456&n&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=i,this._data[3*e+2]=n},e.prototype.addCodepointToCell=function(e,t){var r=this._data[3*e+0];2097152&r?this._combined[e]+=i.stringFromCodePoint(t):(2097151&r?(this._combined[e]=i.stringFromCodePoint(2097151&r)+i.stringFromCodePoint(t),r&=-2097152,r|=2097152):r=t|1<<22,this._data[3*e+0]=r)},e.prototype.insertCells=function(e,t,r,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new s.ExtendedAttrs),t=0;--a)this.setCell(e+t+a,this.loadCell(e+a,n));for(a=0;athis.length){var r=new Uint32Array(3*e);this.length&&(3*e=e&&delete this._combined[o]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,r,i,n){var o=e._data;if(n)for(var s=i-1;s>=0;s--)for(var a=0;a<3;a++)this._data[3*(r+s)+a]=o[3*(t+s)+a];else for(s=0;s=t&&(this._combined[l-t+r]=e._combined[l])}},e.prototype.translateToString=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===r&&(r=this.length),e&&(r=Math.min(r,this.getTrimmedLength()));for(var o="";t>22||1}return o},e}();t.BufferLine=a},4634:(e,t)=>{function r(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();var i=!e[t].hasContent(r-1)&&1===e[t].getWidth(r-1),n=2===e[t+1].getWidth(0);return i&&n?r-1:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,i,n,o){for(var s=[],a=0;a=a&&n0&&(S>u||0===h[S].getTrimmedLength());S--)b++;b>0&&(s.push(a+h.length-b),s.push(b)),a+=h.length-1}}}return s},t.reflowLargerCreateNewLayout=function(e,t){for(var r=[],i=0,n=t[i],o=0,s=0;sl&&(s-=l,a++);var h=2===e[a].getWidth(s-1);h&&s--;var u=h?i-1:i;n.push(u),c+=u}return n},t.getWrappedLineTrimmedLength=r},5295:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var o=r(9092),s=r(8460),a=function(e){function t(t,r){var i=e.call(this)||this;return i._optionsService=t,i._bufferService=r,i._onBufferActivate=i.register(new s.EventEmitter),i.reset(),i}return n(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this.setupTabStops()},Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},t.prototype.activateAltBuffer=function(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}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(r(844).Disposable);t.BufferSet=a},511:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;var o=r(482),s=r(643),a=r(3734),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.content=0,t.fg=0,t.bg=0,t.extended=new a.ExtendedAttrs,t.combinedData="",t}return n(t,e),t.fromCharData=function(e){var r=new t;return r.setFromCharData(e),r},t.prototype.isCombined=function(){return 2097152&this.content},t.prototype.getWidth=function(){return this.content>>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?o.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[s.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[s.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[s.CHAR_DATA_CHAR_INDEX].length){var r=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){var i=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(r-55296)+i-56320+65536|e[s.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[s.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[s.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[s.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(a.AttributeData);t.CellData=c},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=256,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var o=r(8460),s=function(e){function t(r){var i=e.call(this)||this;return i.line=r,i._id=t._nextId++,i.isDisposed=!1,i._onDispose=new o.EventEmitter,i}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),e.prototype.dispose.call(this))},t._nextId=1,t}(r(844).Disposable);t.Marker=s},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,(i=t.C0||(t.C0={})).NUL="\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="",i.BS="\b",i.HT="\t",i.LF="\n",i.VT="\v",i.FF="\f",i.CR="\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL="",(r=t.C1||(t.C1={})).PAD="€",r.HOP="",r.BPH="‚",r.NBH="ƒ",r.IND="„",r.NEL="…",r.SSA="†",r.ESA="‡",r.HTS="ˆ",r.HTJ="‰",r.VTS="Š",r.PLD="‹",r.PLU="Œ",r.RI="",r.SS2="Ž",r.SS3="",r.DCS="",r.PU1="‘",r.PU2="’",r.STS="“",r.CCH="”",r.MW="•",r.SPA="–",r.EPA="—",r.SOS="˜",r.SGCI="™",r.SCI="š",r.CSI="›",r.ST="œ",r.OSC="",r.PM="ž",r.APC="Ÿ"},7399:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;var i=r(2584),n={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,r,o){var s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B");break;case 8:if(e.shiftKey){s.key=i.C0.BS;break}if(e.altKey){s.key=i.C0.ESC+i.C0.DEL;break}s.key=i.C0.DEL;break;case 9:if(e.shiftKey){s.key=i.C0.ESC+"[Z";break}s.key=i.C0.HT,s.cancel=!0;break;case 13:s.key=e.altKey?i.C0.ESC+i.C0.CR:i.C0.CR,s.cancel=!0;break;case 27:s.key=i.C0.ESC,e.altKey&&(s.key=i.C0.ESC+i.C0.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"D",s.key===i.C0.ESC+"[1;3D"&&(s.key=i.C0.ESC+(r?"b":"[1;5D"))):s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"C",s.key===i.C0.ESC+"[1;3C"&&(s.key=i.C0.ESC+(r?"f":"[1;5C"))):s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"A",r||s.key!==i.C0.ESC+"[1;3A"||(s.key=i.C0.ESC+"[1;5A")):s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"B",r||s.key!==i.C0.ESC+"[1;3B"||(s.key=i.C0.ESC+"[1;5B")):s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=i.C0.ESC+"[2~");break;case 46:s.key=a?i.C0.ESC+"[3;"+(a+1)+"~":i.C0.ESC+"[3~";break;case 36:s.key=a?i.C0.ESC+"[1;"+(a+1)+"H":t?i.C0.ESC+"OH":i.C0.ESC+"[H";break;case 35:s.key=a?i.C0.ESC+"[1;"+(a+1)+"F":t?i.C0.ESC+"OF":i.C0.ESC+"[F";break;case 33:e.shiftKey?s.type=2:s.key=i.C0.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:s.key=i.C0.ESC+"[6~";break;case 112:s.key=a?i.C0.ESC+"[1;"+(a+1)+"P":i.C0.ESC+"OP";break;case 113:s.key=a?i.C0.ESC+"[1;"+(a+1)+"Q":i.C0.ESC+"OQ";break;case 114:s.key=a?i.C0.ESC+"[1;"+(a+1)+"R":i.C0.ESC+"OR";break;case 115:s.key=a?i.C0.ESC+"[1;"+(a+1)+"S":i.C0.ESC+"OS";break;case 116:s.key=a?i.C0.ESC+"[15;"+(a+1)+"~":i.C0.ESC+"[15~";break;case 117:s.key=a?i.C0.ESC+"[17;"+(a+1)+"~":i.C0.ESC+"[17~";break;case 118:s.key=a?i.C0.ESC+"[18;"+(a+1)+"~":i.C0.ESC+"[18~";break;case 119:s.key=a?i.C0.ESC+"[19;"+(a+1)+"~":i.C0.ESC+"[19~";break;case 120:s.key=a?i.C0.ESC+"[20;"+(a+1)+"~":i.C0.ESC+"[20~";break;case 121:s.key=a?i.C0.ESC+"[21;"+(a+1)+"~":i.C0.ESC+"[21~";break;case 122:s.key=a?i.C0.ESC+"[23;"+(a+1)+"~":i.C0.ESC+"[23~";break;case 123:s.key=a?i.C0.ESC+"[24;"+(a+1)+"~":i.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(r&&!o||!e.altKey||e.metaKey)!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?s.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(s.key=i.C0.US):65===e.keyCode&&(s.type=1);else{var c=n[e.keyCode],l=c&&c[e.shiftKey?1:0];if(l)s.key=i.C0.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){var h=e.ctrlKey?e.keyCode-64:e.keyCode+32;s.key=i.C0.ESC+String.fromCharCode(h)}}else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=i.C0.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=i.C0.DEL:219===e.keyCode?s.key=i.C0.ESC:220===e.keyCode?s.key=i.C0.FS:221===e.keyCode&&(s.key=i.C0.GS)}return s}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=e.length);for(var i="",n=t;n65535?(o-=65536,i+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i};var r=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i=0,n=0;this._interim&&(56320<=(a=e.charCodeAt(n++))&&a<=57343?t[i++]=1024*(this._interim-55296)+a-56320+65536:(t[i++]=this._interim,t[i++]=a),this._interim=0);for(var o=n;o=r)return this._interim=s,i;var a;56320<=(a=e.charCodeAt(o))&&a<=57343?t[i++]=1024*(s-55296)+a-56320+65536:(t[i++]=s,t[i++]=a)}else 65279!==s&&(t[i++]=s)}return i},e}();t.StringToUtf32=r;var i=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i,n,o,s,a=0,c=0,l=0;if(this.interim[0]){var h=!1,u=this.interim[0];u&=192==(224&u)?31:224==(240&u)?15:7;for(var f=0,_=void 0;(_=63&this.interim[++f])&&f<4;)u<<=6,u|=_;for(var d=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,p=d-f;l=r)return 0;if(128!=(192&(_=e[l++]))){l--,h=!0;break}this.interim[f++]=_,u<<=6,u|=63&_}h||(2===d?u<128?l--:t[a++]=u:3===d?u<2048||u>=55296&&u<=57343||65279===u||(t[a++]=u):u<65536||u>1114111||(t[a++]=u)),this.interim.fill(0)}for(var v=r-4,g=l;g=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if((c=(31&i)<<6|63&n)<128){g--;continue}t[a++]=c}else if(224==(240&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if((c=(15&i)<<12|(63&n)<<6|63&o)<2048||c>=55296&&c<=57343||65279===c)continue;t[a++]=c}else if(240==(248&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,this.interim[2]=o,a;if(128!=(192&(s=e[g++]))){g--;continue}if((c=(7&i)<<18|(63&n)<<12|(63&o)<<6|63&s)<65536||c>1114111)continue;t[a++]=c}}return a},e}();t.Utf8ToUtf32=i},225:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var i,n=r(8273),o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],a=function(){function e(){if(this.version="6",!i){i=new Uint8Array(65536),n.fill(i,1),i[0]=0,n.fill(i,0,1,32),n.fill(i,0,127,160),n.fill(i,2,4352,4448),i[9001]=2,i[9002]=2,n.fill(i,2,11904,42192),i[12351]=1,n.fill(i,2,44032,55204),n.fill(i,2,63744,64256),n.fill(i,2,65040,65050),n.fill(i,2,65072,65136),n.fill(i,2,65280,65377),n.fill(i,2,65504,65511);for(var e=0;et[n][1])return!1;for(;n>=i;)if(e>t[r=i+n>>1][1])i=r+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=a},5981:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var r=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout((function(){return r._innerWrite()}))),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var r=this._writeBuffer[this._bufferOffset],i=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(r),this._pendingData-=r.length,i&&i(),Date.now()-t>=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((function(){return e._innerWrite()}),0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=r},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var i=r(482),n=r(8742),o=r(5770),s=[],a=function(){function e(){this._handlers=Object.create(null),this._active=s,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=s},e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=s,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||s,this._active.length)for(var r=this._active.length-1;r>=0;r--)this._active[r].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,r){if(this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._ident,"PUT",i.utf32ToString(e,t,r))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=s,this._ident=0},e}();t.DcsParser=a;var c=new n.Params;c.addParam(0);var l=function(){function e(e){this._handler=e,this._data="",this._params=c,this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.length>1||e.params[0]?e.clone():c,this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=i.utf32ToString(e,t,r),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params)),this._params=c,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},2015:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var o=r(844),s=r(8273),a=r(8742),c=r(6242),l=r(6351),h=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){s.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,r,i){this.table[t<<8|e]=r<<4|i},e.prototype.addMany=function(e,t,r,i){for(var n=0;n1)throw new Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&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(var i=0;in||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");var o=e.final.charCodeAt(0);if(t[0]>o||o>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(r<<=8)|o},r.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},r.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},r.prototype.setPrintHandler=function(e){this._printHandler=e},r.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},r.prototype.registerEscHandler=function(e,t){var r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);var i=this._escHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},r.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},r.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},r.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},r.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},r.prototype.registerCsiHandler=function(e,t){var r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);var i=this._csiHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},r.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},r.prototype.registerDcsHandler=function(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)},r.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},r.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},r.prototype.registerOscHandler=function(e,t){return this._oscParser.registerHandler(e,t)},r.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},r.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},r.prototype.setErrorHandler=function(e){this._errorHandler=e},r.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},r.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},r.prototype.parse=function(e,t){for(var r=0,i=0,n=this.currentState,o=this._oscParser,s=this._dcsParser,a=this._collect,c=this._params,l=this._transitions.table,h=0;h>4){case 2:for(var f=h+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=0&&!_[d](c);d--);d<0&&this._csiHandlerFb(a<<8|r,c),this.precedingCodepoint=0;break;case 8:do{switch(r){case 59:c.addParam(0);break;case 58:c.addSubParam(-1);break;default:c.addDigit(r-48)}}while(++h47&&r<60);h--;break;case 9:a<<=8,a|=r;break;case 10:for(var p=this._escHandlers[a<<8|r],v=p?p.length-1:-1;v>=0&&!p[v]();v--);v<0&&this._escHandlerFb(a<<8|r),this.precedingCodepoint=0;break;case 11:c.reset(),c.addParam(0),a=0;break;case 12:s.hook(a<<8|r,c);break;case 13:for(var g=h+1;;++g)if(g>=t||24===(r=e[g])||26===r||27===r||r>127&&r=t||(r=e[y])<32||r>127&&r{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;var i=r(5770),n=r(482),o=[],s=function(){function e(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=o},e.prototype.reset=function(){2===this._state&&this.end(!1),this._active=o,this._id=-1,this._state=0},e.prototype._start=function(){if(this._active=this._handlers[this._id]||o,this._active.length)for(var e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,r){if(this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r);else this._handlerFb(this._id,"PUT",n.utf32ToString(e,t,r))},e.prototype._end=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].end(e);t--);for(t--;t>=0;t--)this._active[t].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._state=1},e.prototype.put=function(e,t,r){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,r)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._active=o,this._id=-1,this._state=0)},e}();t.OscParser=s;var a=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=n.utf32ToString(e,t,r),this._data.length>i.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=a},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;var r=2147483647,i=function(){function e(e,t){if(void 0===e&&(e=32),void 0===t&&(t=32),this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var r=new e;if(!t.length)return r;for(var i=t[0]instanceof Array?1:0;i>8,i=255&this._subParamsIdx[t];i-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,i))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>r?r:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>r?r:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-t>0?this._subParams.subarray(t,r):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t>8,i=255&this._subParamsIdx[t];i-r>0&&(e[t]=this._subParams.slice(r,i))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var i=this._digitIsSub?this._subParams:this.params,n=i[t-1];i[t-1]=~n?Math.min(10*n+e,r):e}},e}();t.Params=i},744:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var a=r(2585),c=r(5295),l=r(8460),h=r(844);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var u=function(e){function r(r){var i=e.call(this)||this;return i._optionsService=r,i.isUserScrolling=!1,i._onResize=new l.EventEmitter,i.cols=Math.max(r.options.cols,t.MINIMUM_COLS),i.rows=Math.max(r.options.rows,t.MINIMUM_ROWS),i.buffers=new c.BufferSet(r,i),i}return n(r,e),Object.defineProperty(r.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),r.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},r.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},r.prototype.reset=function(){this.buffers.reset(),this.isUserScrolling=!1},o([s(0,a.IOptionsService)],r)}(h.Disposable);t.BufferService=u},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var r=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=r},1753:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var o=r(2585),s=r(8460),a={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function c(e,t){var r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||t||(r|=3)),r}var l=String.fromCharCode,h={DEFAULT:function(e){var t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":""+l(t[0])+l(t[1])+l(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"[<"+c(e,!0)+";"+e.col+";"+e.row+t}},u=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new s.EventEmitter,this._lastEvent=null;for(var r=0,i=Object.keys(a);r=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},i([n(0,o.IBufferService),n(1,o.ICoreService)],e)}();t.CoreMouseService=u},6975:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var a=r(2585),c=r(8460),l=r(1439),h=r(844),u=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),_=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o._bufferService=r,o._logService=i,o._optionsService=n,o.isCursorInitialized=!1,o.isCursorHidden=!1,o._onData=o.register(new c.EventEmitter),o._onUserInput=o.register(new c.EventEmitter),o._onBinary=o.register(new c.EventEmitter),o._scrollToBottom=t,o.register({dispose:function(){return o._scrollToBottom=void 0}}),o.modes=l.clone(u),o.decPrivateModes=l.clone(f),o}return n(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=l.clone(u),this.decPrivateModes=l.clone(f)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var r=this._bufferService.buffer;r.ybase!==r.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onBinary.fire(e))},o([s(1,a.IBufferService),s(2,a.ILogService),s(3,a.IOptionsService)],t)}(h.Disposable);t.CoreService=_},3730:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var o=r(2585),s=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){ethis._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var r=e;e=t,t=r}ethis._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},i([n(0,o.IBufferService)],e)}();t.DirtyRowService=s},4348:function(e,t,r){var i=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t0?n[0].index:t.length;if(t.length!==u)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(u+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,i([void 0],i(t,s))))},e}();t.InstantiationService=a},7866:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var i=r(8460),n=r(6114),o=r(1439);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:t.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1});var s=["normal","bold","100","200","300","400","500","600","700","800","900"],a=["cols","rows"],c=function(){function e(e){this._onOptionChange=new i.EventEmitter,this.options=o.clone(t.DEFAULT_OPTIONS);for(var r=0,n=Object.keys(e);r{function r(e,t,r){t.di$target===t?t.di$dependencies.push({id:e,index:r}):(t.di$dependencies=[{id:e,index:r}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);var i=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");r(i,e,n)};return i.toString=function(){return e},t.serviceRegistry.set(e,i),i}},2585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IUnicodeService=t.IOptionsService=t.ILogService=t.IInstantiationService=t.IDirtyRowService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;var i=r(8343);t.IBufferService=i.createDecorator("BufferService"),t.ICoreMouseService=i.createDecorator("CoreMouseService"),t.ICoreService=i.createDecorator("CoreService"),t.ICharsetService=i.createDecorator("CharsetService"),t.IDirtyRowService=i.createDecorator("DirtyRowService"),t.IInstantiationService=i.createDecorator("InstantiationService"),t.ILogService=i.createDecorator("LogService"),t.IOptionsService=i.createDecorator("OptionsService"),t.IUnicodeService=i.createDecorator("UnicodeService")},1480:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;var i=r(8460),n=r(225),o=function(){function e(){this._providers=Object.create(null),this._active="",this._onChange=new i.EventEmitter;var e=new n.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}return Object.defineProperty(e.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._active},set:function(e){if(!this._providers[e])throw new Error('unknown Unicode version "'+e+'"');this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)},enumerable:!1,configurable:!0}),e.prototype.register=function(e){this._providers[e.version]=e},e.prototype.wcwidth=function(e){return this._activeProvider.wcwidth(e)},e.prototype.getStringCellWidth=function(e){for(var t=0,r=e.length,i=0;i=r)return t+this.wcwidth(n);var o=e.charCodeAt(i);56320<=o&&o<=57343?n=1024*(n-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(n)}return t},e}();t.UnicodeService=o}},t={};return function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}(4389)})()})); +//# sourceMappingURL=xterm.js.map + diff --git a/js/src/xterm.min.js b/js/src/xterm.min.js deleted file mode 100644 index 4da0be8..0000000 --- a/js/src/xterm.min.js +++ /dev/null @@ -1,6624 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Terminal = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o this._terminal.rows; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Buffer.prototype, "isCursorInViewport", { - get: function () { - var absoluteY = this.ybase + this.y; - var relativeY = absoluteY - this.ydisp; - return (relativeY >= 0 && relativeY < this._terminal.rows); - }, - enumerable: true, - configurable: true - }); - Buffer.prototype._getCorrectBufferLength = function (rows) { - if (!this._hasScrollback) { - return rows; - } - var correctBufferLength = rows + this._terminal.options.scrollback; - return correctBufferLength > exports.MAX_BUFFER_SIZE ? exports.MAX_BUFFER_SIZE : correctBufferLength; - }; - Buffer.prototype.fillViewportRows = function () { - if (this._lines.length === 0) { - var i = this._terminal.rows; - while (i--) { - this.lines.push(this._terminal.blankLine()); - } - } - }; - Buffer.prototype.clear = function () { - this.ydisp = 0; - this.ybase = 0; - this.y = 0; - this.x = 0; - this._lines = new CircularList_1.CircularList(this._getCorrectBufferLength(this._terminal.rows)); - this.scrollTop = 0; - this.scrollBottom = this._terminal.rows - 1; - this.setupTabStops(); - }; - Buffer.prototype.resize = function (newCols, newRows) { - var newMaxLength = this._getCorrectBufferLength(newRows); - if (newMaxLength > this._lines.maxLength) { - this._lines.maxLength = newMaxLength; - } - if (this._lines.length > 0) { - if (this._terminal.cols < newCols) { - var ch = [this._terminal.defAttr, ' ', 1, 32]; - for (var i = 0; i < this._lines.length; i++) { - while (this._lines.get(i).length < newCols) { - this._lines.get(i).push(ch); - } - } - } - var addToY = 0; - if (this._terminal.rows < newRows) { - for (var y = this._terminal.rows; y < newRows; y++) { - if (this._lines.length < newRows + this.ybase) { - if (this.ybase > 0 && this._lines.length <= this.ybase + this.y + addToY + 1) { - this.ybase--; - addToY++; - if (this.ydisp > 0) { - this.ydisp--; - } - } - else { - this._lines.push(this._terminal.blankLine(undefined, undefined, newCols)); - } - } - } - } - else { - for (var y = this._terminal.rows; y > newRows; y--) { - if (this._lines.length > newRows + this.ybase) { - if (this._lines.length > this.ybase + this.y + 1) { - this._lines.pop(); - } - else { - this.ybase++; - this.ydisp++; - } - } - } - } - if (newMaxLength < this._lines.maxLength) { - var amountToTrim = this._lines.length - newMaxLength; - if (amountToTrim > 0) { - this._lines.trimStart(amountToTrim); - this.ybase = Math.max(this.ybase - amountToTrim, 0); - this.ydisp = Math.max(this.ydisp - amountToTrim, 0); - } - this._lines.maxLength = newMaxLength; - } - this.x = Math.min(this.x, newCols - 1); - this.y = Math.min(this.y, newRows - 1); - if (addToY) { - this.y += addToY; - } - this.savedY = Math.min(this.savedY, newRows - 1); - this.savedX = Math.min(this.savedX, newCols - 1); - this.scrollTop = 0; - } - this.scrollBottom = newRows - 1; - }; - Buffer.prototype.translateBufferLineToString = function (lineIndex, trimRight, startCol, endCol) { - if (startCol === void 0) { startCol = 0; } - if (endCol === void 0) { endCol = null; } - var lineString = ''; - var line = this.lines.get(lineIndex); - if (!line) { - return ''; - } - var startIndex = startCol; - if (endCol === null) { - endCol = line.length; - } - var endIndex = endCol; - for (var i = 0; i < line.length; i++) { - var char = line[i]; - lineString += char[exports.CHAR_DATA_CHAR_INDEX]; - if (char[exports.CHAR_DATA_WIDTH_INDEX] === 0) { - if (startCol >= i) { - startIndex--; - } - if (endCol >= i) { - endIndex--; - } - } - else { - if (char[exports.CHAR_DATA_CHAR_INDEX].length > 1) { - if (startCol > i) { - startIndex += char[exports.CHAR_DATA_CHAR_INDEX].length - 1; - } - if (endCol > i) { - endIndex += char[exports.CHAR_DATA_CHAR_INDEX].length - 1; - } - } - } - } - if (trimRight) { - var rightWhitespaceIndex = lineString.search(/\s+$/); - if (rightWhitespaceIndex !== -1) { - endIndex = Math.min(endIndex, rightWhitespaceIndex); - } - if (endIndex <= startIndex) { - return ''; - } - } - return lineString.substring(startIndex, endIndex); - }; - Buffer.prototype.setupTabStops = function (i) { - if (i != null) { - if (!this.tabs[i]) { - i = this.prevStop(i); - } - } - else { - this.tabs = {}; - i = 0; - } - for (; i < this._terminal.cols; i += this._terminal.options.tabStopWidth) { - this.tabs[i] = true; - } - }; - Buffer.prototype.prevStop = function (x) { - if (x == null) { - x = this.x; - } - while (!this.tabs[--x] && x > 0) {} - return x >= this._terminal.cols ? this._terminal.cols - 1 : x < 0 ? 0 : x; - }; - Buffer.prototype.nextStop = function (x) { - if (x == null) { - x = this.x; - } - while (!this.tabs[++x] && x < this._terminal.cols) {} - return x >= this._terminal.cols ? this._terminal.cols - 1 : x < 0 ? 0 : x; - }; - return Buffer; -}()); -exports.Buffer = Buffer; - - - -},{"./utils/CircularList":32}],2:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Buffer_1 = require("./Buffer"); -var EventEmitter_1 = require("./EventEmitter"); -var BufferSet = (function (_super) { - __extends(BufferSet, _super); - function BufferSet(_terminal) { - var _this = _super.call(this) || this; - _this._terminal = _terminal; - _this._normal = new Buffer_1.Buffer(_this._terminal, true); - _this._normal.fillViewportRows(); - _this._alt = new Buffer_1.Buffer(_this._terminal, false); - _this._activeBuffer = _this._normal; - _this.setupTabStops(); - return _this; - } - Object.defineProperty(BufferSet.prototype, "alt", { - get: function () { - return this._alt; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BufferSet.prototype, "active", { - get: function () { - return this._activeBuffer; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(BufferSet.prototype, "normal", { - get: function () { - return this._normal; - }, - enumerable: true, - configurable: true - }); - BufferSet.prototype.activateNormalBuffer = function () { - if (this._activeBuffer === this._normal) { - return; - } - this._alt.clear(); - this._activeBuffer = this._normal; - this.emit('activate', { - activeBuffer: this._normal, - inactiveBuffer: this._alt - }); - }; - BufferSet.prototype.activateAltBuffer = function () { - if (this._activeBuffer === this._alt) { - return; - } - this._alt.fillViewportRows(); - this._activeBuffer = this._alt; - this.emit('activate', { - activeBuffer: this._alt, - inactiveBuffer: this._normal - }); - }; - BufferSet.prototype.resize = function (newCols, newRows) { - this._normal.resize(newCols, newRows); - this._alt.resize(newCols, newRows); - }; - BufferSet.prototype.setupTabStops = function (i) { - this._normal.setupTabStops(i); - this._alt.setupTabStops(i); - }; - return BufferSet; -}(EventEmitter_1.EventEmitter)); -exports.BufferSet = BufferSet; - - - -},{"./Buffer":1,"./EventEmitter":7}],3:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.wcwidth = (function (opts) { - var COMBINING_BMP = [ - [0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489], - [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2], - [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603], - [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670], - [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED], - [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A], - [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902], - [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D], - [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981], - [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD], - [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C], - [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D], - [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC], - [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD], - [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C], - [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D], - [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0], - [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48], - [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC], - [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD], - [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D], - [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6], - [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E], - [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC], - [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35], - [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E], - [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97], - [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030], - [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039], - [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F], - [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753], - [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD], - [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD], - [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922], - [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B], - [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34], - [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42], - [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF], - [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063], - [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F], - [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B], - [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F], - [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB], - ]; - var COMBINING_HIGH = [ - [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F], - [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169], - [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD], - [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F], - [0xE0100, 0xE01EF] - ]; - function bisearch(ucs, data) { - var min = 0; - var max = data.length - 1; - var mid; - if (ucs < data[0][0] || ucs > data[max][1]) { - return false; - } - while (max >= min) { - mid = (min + max) >> 1; - if (ucs > data[mid][1]) { - min = mid + 1; - } - else if (ucs < data[mid][0]) { - max = mid - 1; - } - else { - return true; - } - } - return false; - } - function wcwidthBMP(ucs) { - if (ucs === 0) { - return opts.nul; - } - if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) { - return opts.control; - } - if (bisearch(ucs, COMBINING_BMP)) { - return 0; - } - if (isWideBMP(ucs)) { - return 2; - } - return 1; - } - function isWideBMP(ucs) { - return (ucs >= 0x1100 && (ucs <= 0x115f || - ucs === 0x2329 || - ucs === 0x232a || - (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) || - (ucs >= 0xac00 && ucs <= 0xd7a3) || - (ucs >= 0xf900 && ucs <= 0xfaff) || - (ucs >= 0xfe10 && ucs <= 0xfe19) || - (ucs >= 0xfe30 && ucs <= 0xfe6f) || - (ucs >= 0xff00 && ucs <= 0xff60) || - (ucs >= 0xffe0 && ucs <= 0xffe6))); - } - function wcwidthHigh(ucs) { - if (bisearch(ucs, COMBINING_HIGH)) { - return 0; - } - if ((ucs >= 0x20000 && ucs <= 0x2fffd) || (ucs >= 0x30000 && ucs <= 0x3fffd)) { - return 2; - } - return 1; - } - var control = opts.control | 0; - var table = null; - function init_table() { - var CODEPOINTS = 65536; - var BITWIDTH = 2; - var ITEMSIZE = 32; - var CONTAINERSIZE = CODEPOINTS * BITWIDTH / ITEMSIZE; - var CODEPOINTS_PER_ITEM = ITEMSIZE / BITWIDTH; - table = (typeof Uint32Array === 'undefined') - ? new Array(CONTAINERSIZE) - : new Uint32Array(CONTAINERSIZE); - for (var i = 0; i < CONTAINERSIZE; ++i) { - var num = 0; - var pos = CODEPOINTS_PER_ITEM; - while (pos--) { - num = (num << 2) | wcwidthBMP(CODEPOINTS_PER_ITEM * i + pos); - } - table[i] = num; - } - return table; - } - return function (num) { - num = num | 0; - if (num < 32) { - return control | 0; - } - if (num < 127) { - return 1; - } - var t = table || init_table(); - if (num < 65536) { - return t[num >> 4] >> ((num & 15) << 1) & 3; - } - return wcwidthHigh(num); - }; -})({ nul: 0, control: 0 }); - - - -},{}],4:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CHARSETS = {}; -exports.DEFAULT_CHARSET = exports.CHARSETS['B']; -exports.CHARSETS['0'] = { - '`': '\u25c6', - 'a': '\u2592', - 'b': '\u0009', - 'c': '\u000c', - 'd': '\u000d', - 'e': '\u000a', - 'f': '\u00b0', - 'g': '\u00b1', - 'h': '\u2424', - 'i': '\u000b', - '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', - '}': '\u00a3', - '~': '\u00b7' -}; -exports.CHARSETS['A'] = { - '#': '£' -}; -exports.CHARSETS['B'] = null; -exports.CHARSETS['4'] = { - '#': '£', - '@': '¾', - '[': 'ij', - '\\': '½', - ']': '|', - '{': '¨', - '|': 'f', - '}': '¼', - '~': '´' -}; -exports.CHARSETS['C'] = - exports.CHARSETS['5'] = { - '[': 'Ä', - '\\': 'Ö', - ']': 'Å', - '^': 'Ü', - '`': 'é', - '{': 'ä', - '|': 'ö', - '}': 'å', - '~': 'ü' - }; -exports.CHARSETS['R'] = { - '#': '£', - '@': 'à', - '[': '°', - '\\': 'ç', - ']': '§', - '{': 'é', - '|': 'ù', - '}': 'è', - '~': '¨' -}; -exports.CHARSETS['Q'] = { - '@': 'à', - '[': 'â', - '\\': 'ç', - ']': 'ê', - '^': 'î', - '`': 'ô', - '{': 'é', - '|': 'ù', - '}': 'è', - '~': 'û' -}; -exports.CHARSETS['K'] = { - '@': '§', - '[': 'Ä', - '\\': 'Ö', - ']': 'Ü', - '{': 'ä', - '|': 'ö', - '}': 'ü', - '~': 'ß' -}; -exports.CHARSETS['Y'] = { - '#': '£', - '@': '§', - '[': '°', - '\\': 'ç', - ']': 'é', - '`': 'ù', - '{': 'à', - '|': 'ò', - '}': 'è', - '~': 'ì' -}; -exports.CHARSETS['E'] = - exports.CHARSETS['6'] = { - '@': 'Ä', - '[': 'Æ', - '\\': 'Ø', - ']': 'Å', - '^': 'Ü', - '`': 'ä', - '{': 'æ', - '|': 'ø', - '}': 'å', - '~': 'ü' - }; -exports.CHARSETS['Z'] = { - '#': '£', - '@': '§', - '[': '¡', - '\\': 'Ñ', - ']': '¿', - '{': '°', - '|': 'ñ', - '}': 'ç' -}; -exports.CHARSETS['H'] = - exports.CHARSETS['7'] = { - '@': 'É', - '[': 'Ä', - '\\': 'Ö', - ']': 'Å', - '^': 'Ü', - '`': 'é', - '{': 'ä', - '|': 'ö', - '}': 'å', - '~': 'ü' - }; -exports.CHARSETS['='] = { - '#': 'ù', - '@': 'à', - '[': 'é', - '\\': 'ç', - ']': 'ê', - '^': 'î', - '_': 'è', - '`': 'ô', - '{': 'ä', - '|': 'ö', - '}': 'ü', - '~': 'û' -}; - - - -},{}],5:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var CompositionHelper = (function () { - function CompositionHelper(textarea, compositionView, terminal) { - this.textarea = textarea; - this.compositionView = compositionView; - this.terminal = terminal; - this.isComposing = false; - this.isSendingComposition = false; - this.compositionPosition = { start: null, end: null }; - } - CompositionHelper.prototype.compositionstart = function () { - this.isComposing = true; - this.compositionPosition.start = this.textarea.value.length; - this.compositionView.textContent = ''; - this.compositionView.classList.add('active'); - }; - CompositionHelper.prototype.compositionupdate = function (ev) { - var _this = this; - this.compositionView.textContent = ev.data; - this.updateCompositionElements(); - setTimeout(function () { - _this.compositionPosition.end = _this.textarea.value.length; - }, 0); - }; - CompositionHelper.prototype.compositionend = function () { - this.finalizeComposition(true); - }; - CompositionHelper.prototype.keydown = function (ev) { - if (this.isComposing || this.isSendingComposition) { - if (ev.keyCode === 229) { - return false; - } - else if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) { - return false; - } - else { - this.finalizeComposition(false); - } - } - if (ev.keyCode === 229) { - this.handleAnyTextareaChanges(); - return false; - } - return true; - }; - CompositionHelper.prototype.finalizeComposition = function (waitForPropogation) { - var _this = this; - this.compositionView.classList.remove('active'); - this.isComposing = false; - this.clearTextareaPosition(); - if (!waitForPropogation) { - this.isSendingComposition = false; - var input = this.textarea.value.substring(this.compositionPosition.start, this.compositionPosition.end); - this.terminal.handler(input); - } - else { - var currentCompositionPosition_1 = { - start: this.compositionPosition.start, - end: this.compositionPosition.end, - }; - this.isSendingComposition = true; - setTimeout(function () { - if (_this.isSendingComposition) { - _this.isSendingComposition = false; - var input = void 0; - if (_this.isComposing) { - input = _this.textarea.value.substring(currentCompositionPosition_1.start, currentCompositionPosition_1.end); - } - else { - input = _this.textarea.value.substring(currentCompositionPosition_1.start); - } - _this.terminal.handler(input); - } - }, 0); - } - }; - CompositionHelper.prototype.handleAnyTextareaChanges = function () { - var _this = this; - var oldValue = this.textarea.value; - setTimeout(function () { - if (!_this.isComposing) { - var newValue = _this.textarea.value; - var diff = newValue.replace(oldValue, ''); - if (diff.length > 0) { - _this.terminal.handler(diff); - } - } - }, 0); - }; - CompositionHelper.prototype.updateCompositionElements = function (dontRecurse) { - var _this = this; - if (!this.isComposing) { - return; - } - if (this.terminal.buffer.isCursorInViewport) { - var cellHeight = Math.ceil(this.terminal.charMeasure.height * this.terminal.options.lineHeight); - var cursorTop = this.terminal.buffer.y * cellHeight; - var cursorLeft = this.terminal.buffer.x * this.terminal.charMeasure.width; - this.compositionView.style.left = cursorLeft + 'px'; - this.compositionView.style.top = cursorTop + 'px'; - this.compositionView.style.height = cellHeight + 'px'; - this.compositionView.style.lineHeight = cellHeight + 'px'; - var compositionViewBounds = this.compositionView.getBoundingClientRect(); - this.textarea.style.left = cursorLeft + 'px'; - this.textarea.style.top = cursorTop + 'px'; - this.textarea.style.width = compositionViewBounds.width + 'px'; - this.textarea.style.height = compositionViewBounds.height + 'px'; - this.textarea.style.lineHeight = compositionViewBounds.height + 'px'; - } - if (!dontRecurse) { - setTimeout(function () { return _this.updateCompositionElements(true); }, 0); - } - }; - CompositionHelper.prototype.clearTextareaPosition = function () { - this.textarea.style.left = ''; - this.textarea.style.top = ''; - }; - return CompositionHelper; -}()); -exports.CompositionHelper = CompositionHelper; - - - -},{}],6:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var C0; -(function (C0) { - C0.NUL = '\x00'; - C0.SOH = '\x01'; - C0.STX = '\x02'; - C0.ETX = '\x03'; - C0.EOT = '\x04'; - C0.ENQ = '\x05'; - C0.ACK = '\x06'; - C0.BEL = '\x07'; - C0.BS = '\x08'; - C0.HT = '\x09'; - C0.LF = '\x0a'; - C0.VT = '\x0b'; - C0.FF = '\x0c'; - C0.CR = '\x0d'; - C0.SO = '\x0e'; - C0.SI = '\x0f'; - C0.DLE = '\x10'; - C0.DC1 = '\x11'; - C0.DC2 = '\x12'; - C0.DC3 = '\x13'; - C0.DC4 = '\x14'; - C0.NAK = '\x15'; - C0.SYN = '\x16'; - C0.ETB = '\x17'; - C0.CAN = '\x18'; - C0.EM = '\x19'; - C0.SUB = '\x1a'; - C0.ESC = '\x1b'; - C0.FS = '\x1c'; - C0.GS = '\x1d'; - C0.RS = '\x1e'; - C0.US = '\x1f'; - C0.SP = '\x20'; - C0.DEL = '\x7f'; -})(C0 = exports.C0 || (exports.C0 = {})); - - - -},{}],7:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var EventEmitter = (function () { - function EventEmitter() { - this._events = this._events || {}; - } - EventEmitter.prototype.on = function (type, listener) { - this._events[type] = this._events[type] || []; - this._events[type].push(listener); - }; - EventEmitter.prototype.off = function (type, listener) { - if (!this._events[type]) { - return; - } - var obj = this._events[type]; - var i = obj.length; - while (i--) { - if (obj[i] === listener) { - obj.splice(i, 1); - return; - } - } - }; - EventEmitter.prototype.removeAllListeners = function (type) { - if (this._events[type]) { - delete this._events[type]; - } - }; - EventEmitter.prototype.emit = function (type) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - if (!this._events[type]) { - return; - } - var obj = this._events[type]; - for (var i = 0; i < obj.length; i++) { - obj[i].apply(this, args); - } - }; - EventEmitter.prototype.listeners = function (type) { - return this._events[type] || []; - }; - EventEmitter.prototype.destroy = function () { - this._events = {}; - }; - return EventEmitter; -}()); -exports.EventEmitter = EventEmitter; - - - -},{}],8:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var EscapeSequences_1 = require("./EscapeSequences"); -var Charsets_1 = require("./Charsets"); -var Buffer_1 = require("./Buffer"); -var Types_1 = require("./renderer/Types"); -var CharWidth_1 = require("./CharWidth"); -var InputHandler = (function () { - function InputHandler(_terminal) { - this._terminal = _terminal; - } - InputHandler.prototype.addChar = function (char, code) { - if (char >= ' ') { - var chWidth = CharWidth_1.wcwidth(code); - if (this._terminal.charset && this._terminal.charset[char]) { - char = this._terminal.charset[char]; - } - var row = this._terminal.buffer.y + this._terminal.buffer.ybase; - if (!chWidth && this._terminal.buffer.x) { - if (this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1]) { - if (!this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1][Buffer_1.CHAR_DATA_WIDTH_INDEX]) { - if (this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 2]) { - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 2][Buffer_1.CHAR_DATA_CHAR_INDEX] += char; - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 2][3] = char.charCodeAt(0); - } - } - else { - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1][Buffer_1.CHAR_DATA_CHAR_INDEX] += char; - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1][3] = char.charCodeAt(0); - } - this._terminal.updateRange(this._terminal.buffer.y); - } - return; - } - if (this._terminal.buffer.x + chWidth - 1 >= this._terminal.cols) { - if (this._terminal.wraparoundMode) { - this._terminal.buffer.x = 0; - this._terminal.buffer.y++; - if (this._terminal.buffer.y > this._terminal.buffer.scrollBottom) { - this._terminal.buffer.y--; - this._terminal.scroll(true); - } - else { - this._terminal.buffer.lines.get(this._terminal.buffer.y).isWrapped = true; - } - } - else { - if (chWidth === 2) { - return; - } - } - } - row = this._terminal.buffer.y + this._terminal.buffer.ybase; - if (this._terminal.insertMode) { - for (var moves = 0; moves < chWidth; ++moves) { - var removed = this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).pop(); - if (removed[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 0 - && this._terminal.buffer.lines.get(row)[this._terminal.cols - 2] - && this._terminal.buffer.lines.get(row)[this._terminal.cols - 2][Buffer_1.CHAR_DATA_WIDTH_INDEX] === 2) { - this._terminal.buffer.lines.get(row)[this._terminal.cols - 2] = [this._terminal.curAttr, ' ', 1, ' '.charCodeAt(0)]; - } - this._terminal.buffer.lines.get(row).splice(this._terminal.buffer.x, 0, [this._terminal.curAttr, ' ', 1, ' '.charCodeAt(0)]); - } - } - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x] = [this._terminal.curAttr, char, chWidth, char.charCodeAt(0)]; - this._terminal.buffer.x++; - this._terminal.updateRange(this._terminal.buffer.y); - if (chWidth === 2) { - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x] = [this._terminal.curAttr, '', 0, undefined]; - this._terminal.buffer.x++; - } - } - }; - InputHandler.prototype.bell = function () { - this._terminal.bell(); - }; - InputHandler.prototype.lineFeed = function () { - if (this._terminal.convertEol) { - this._terminal.buffer.x = 0; - } - this._terminal.buffer.y++; - if (this._terminal.buffer.y > this._terminal.buffer.scrollBottom) { - this._terminal.buffer.y--; - this._terminal.scroll(); - } - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x--; - } - this._terminal.emit('linefeed'); - }; - InputHandler.prototype.carriageReturn = function () { - this._terminal.buffer.x = 0; - }; - InputHandler.prototype.backspace = function () { - if (this._terminal.buffer.x > 0) { - this._terminal.buffer.x--; - } - }; - InputHandler.prototype.tab = function () { - this._terminal.buffer.x = this._terminal.buffer.nextStop(); - }; - InputHandler.prototype.shiftOut = function () { - this._terminal.setgLevel(1); - }; - InputHandler.prototype.shiftIn = function () { - this._terminal.setgLevel(0); - }; - InputHandler.prototype.insertChars = function (params) { - var param = params[0]; - if (param < 1) - param = 1; - var row = this._terminal.buffer.y + this._terminal.buffer.ybase; - var j = this._terminal.buffer.x; - var ch = [this._terminal.eraseAttr(), ' ', 1, 32]; - while (param-- && j < this._terminal.cols) { - this._terminal.buffer.lines.get(row).splice(j++, 0, ch); - this._terminal.buffer.lines.get(row).pop(); - } - }; - InputHandler.prototype.cursorUp = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.y -= param; - if (this._terminal.buffer.y < 0) { - this._terminal.buffer.y = 0; - } - }; - InputHandler.prototype.cursorDown = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.y += param; - if (this._terminal.buffer.y >= this._terminal.rows) { - this._terminal.buffer.y = this._terminal.rows - 1; - } - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x--; - } - }; - InputHandler.prototype.cursorForward = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.x += param; - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x = this._terminal.cols - 1; - } - }; - InputHandler.prototype.cursorBackward = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x--; - } - this._terminal.buffer.x -= param; - if (this._terminal.buffer.x < 0) { - this._terminal.buffer.x = 0; - } - }; - InputHandler.prototype.cursorNextLine = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.y += param; - if (this._terminal.buffer.y >= this._terminal.rows) { - this._terminal.buffer.y = this._terminal.rows - 1; - } - this._terminal.buffer.x = 0; - }; - InputHandler.prototype.cursorPrecedingLine = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.y -= param; - if (this._terminal.buffer.y < 0) { - this._terminal.buffer.y = 0; - } - this._terminal.buffer.x = 0; - }; - InputHandler.prototype.cursorCharAbsolute = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.x = param - 1; - }; - InputHandler.prototype.cursorPosition = function (params) { - var col; - var row = params[0] - 1; - if (params.length >= 2) { - col = params[1] - 1; - } - else { - col = 0; - } - if (row < 0) { - row = 0; - } - else if (row >= this._terminal.rows) { - row = this._terminal.rows - 1; - } - if (col < 0) { - col = 0; - } - else if (col >= this._terminal.cols) { - col = this._terminal.cols - 1; - } - this._terminal.buffer.x = col; - this._terminal.buffer.y = row; - }; - InputHandler.prototype.cursorForwardTab = function (params) { - var param = params[0] || 1; - while (param--) { - this._terminal.buffer.x = this._terminal.buffer.nextStop(); - } - }; - InputHandler.prototype.eraseInDisplay = function (params) { - var j; - switch (params[0]) { - case 0: - this._terminal.eraseRight(this._terminal.buffer.x, this._terminal.buffer.y); - j = this._terminal.buffer.y + 1; - for (; j < this._terminal.rows; j++) { - this._terminal.eraseLine(j); - } - break; - case 1: - this._terminal.eraseLeft(this._terminal.buffer.x, this._terminal.buffer.y); - j = this._terminal.buffer.y; - while (j--) { - this._terminal.eraseLine(j); - } - break; - case 2: - j = this._terminal.rows; - while (j--) - this._terminal.eraseLine(j); - break; - case 3: - var scrollBackSize = this._terminal.buffer.lines.length - this._terminal.rows; - if (scrollBackSize > 0) { - this._terminal.buffer.lines.trimStart(scrollBackSize); - this._terminal.buffer.ybase = Math.max(this._terminal.buffer.ybase - scrollBackSize, 0); - this._terminal.buffer.ydisp = Math.max(this._terminal.buffer.ydisp - scrollBackSize, 0); - this._terminal.emit('scroll', 0); - } - break; - } - }; - InputHandler.prototype.eraseInLine = function (params) { - switch (params[0]) { - case 0: - this._terminal.eraseRight(this._terminal.buffer.x, this._terminal.buffer.y); - break; - case 1: - this._terminal.eraseLeft(this._terminal.buffer.x, this._terminal.buffer.y); - break; - case 2: - this._terminal.eraseLine(this._terminal.buffer.y); - break; - } - }; - InputHandler.prototype.insertLines = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - var row = this._terminal.buffer.y + this._terminal.buffer.ybase; - var scrollBottomRowsOffset = this._terminal.rows - 1 - this._terminal.buffer.scrollBottom; - var scrollBottomAbsolute = this._terminal.rows - 1 + this._terminal.buffer.ybase - scrollBottomRowsOffset + 1; - while (param--) { - this._terminal.buffer.lines.splice(scrollBottomAbsolute - 1, 1); - this._terminal.buffer.lines.splice(row, 0, this._terminal.blankLine(true)); - } - this._terminal.updateRange(this._terminal.buffer.y); - this._terminal.updateRange(this._terminal.buffer.scrollBottom); - }; - InputHandler.prototype.deleteLines = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - var row = this._terminal.buffer.y + this._terminal.buffer.ybase; - var j; - j = this._terminal.rows - 1 - this._terminal.buffer.scrollBottom; - j = this._terminal.rows - 1 + this._terminal.buffer.ybase - j; - while (param--) { - this._terminal.buffer.lines.splice(row, 1); - this._terminal.buffer.lines.splice(j, 0, this._terminal.blankLine(true)); - } - this._terminal.updateRange(this._terminal.buffer.y); - this._terminal.updateRange(this._terminal.buffer.scrollBottom); - }; - InputHandler.prototype.deleteChars = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - var row = this._terminal.buffer.y + this._terminal.buffer.ybase; - var ch = [this._terminal.eraseAttr(), ' ', 1, 32]; - while (param--) { - this._terminal.buffer.lines.get(row).splice(this._terminal.buffer.x, 1); - this._terminal.buffer.lines.get(row).push(ch); - } - this._terminal.updateRange(this._terminal.buffer.y); - }; - InputHandler.prototype.scrollUp = function (params) { - var param = params[0] || 1; - while (param--) { - this._terminal.buffer.lines.splice(this._terminal.buffer.ybase + this._terminal.buffer.scrollTop, 1); - this._terminal.buffer.lines.splice(this._terminal.buffer.ybase + this._terminal.buffer.scrollBottom, 0, this._terminal.blankLine()); - } - this._terminal.updateRange(this._terminal.buffer.scrollTop); - this._terminal.updateRange(this._terminal.buffer.scrollBottom); - }; - InputHandler.prototype.scrollDown = function (params) { - var param = params[0] || 1; - while (param--) { - this._terminal.buffer.lines.splice(this._terminal.buffer.ybase + this._terminal.buffer.scrollBottom, 1); - this._terminal.buffer.lines.splice(this._terminal.buffer.ybase + this._terminal.buffer.scrollTop, 0, this._terminal.blankLine()); - } - this._terminal.updateRange(this._terminal.buffer.scrollTop); - this._terminal.updateRange(this._terminal.buffer.scrollBottom); - }; - InputHandler.prototype.eraseChars = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - var row = this._terminal.buffer.y + this._terminal.buffer.ybase; - var j = this._terminal.buffer.x; - var ch = [this._terminal.eraseAttr(), ' ', 1, 32]; - while (param-- && j < this._terminal.cols) { - this._terminal.buffer.lines.get(row)[j++] = ch; - } - }; - InputHandler.prototype.cursorBackwardTab = function (params) { - var param = params[0] || 1; - while (param--) { - this._terminal.buffer.x = this._terminal.buffer.prevStop(); - } - }; - InputHandler.prototype.charPosAbsolute = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.x = param - 1; - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x = this._terminal.cols - 1; - } - }; - InputHandler.prototype.HPositionRelative = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.x += param; - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x = this._terminal.cols - 1; - } - }; - InputHandler.prototype.repeatPrecedingCharacter = function (params) { - var param = params[0] || 1; - var line = this._terminal.buffer.lines.get(this._terminal.buffer.ybase + this._terminal.buffer.y); - var ch = line[this._terminal.buffer.x - 1] || [this._terminal.defAttr, ' ', 1, 32]; - while (param--) { - line[this._terminal.buffer.x++] = ch; - } - }; - InputHandler.prototype.sendDeviceAttributes = function (params) { - if (params[0] > 0) { - return; - } - if (!this._terminal.prefix) { - if (this._terminal.is('xterm') || this._terminal.is('rxvt-unicode') || this._terminal.is('screen')) { - this._terminal.send(EscapeSequences_1.C0.ESC + '[?1;2c'); - } - else if (this._terminal.is('linux')) { - this._terminal.send(EscapeSequences_1.C0.ESC + '[?6c'); - } - } - else if (this._terminal.prefix === '>') { - if (this._terminal.is('xterm')) { - this._terminal.send(EscapeSequences_1.C0.ESC + '[>0;276;0c'); - } - else if (this._terminal.is('rxvt-unicode')) { - this._terminal.send(EscapeSequences_1.C0.ESC + '[>85;95;0c'); - } - else if (this._terminal.is('linux')) { - this._terminal.send(params[0] + 'c'); - } - else if (this._terminal.is('screen')) { - this._terminal.send(EscapeSequences_1.C0.ESC + '[>83;40003;0c'); - } - } - }; - InputHandler.prototype.linePosAbsolute = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.y = param - 1; - if (this._terminal.buffer.y >= this._terminal.rows) { - this._terminal.buffer.y = this._terminal.rows - 1; - } - }; - InputHandler.prototype.VPositionRelative = function (params) { - var param = params[0]; - if (param < 1) { - param = 1; - } - this._terminal.buffer.y += param; - if (this._terminal.buffer.y >= this._terminal.rows) { - this._terminal.buffer.y = this._terminal.rows - 1; - } - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x--; - } - }; - InputHandler.prototype.HVPosition = function (params) { - if (params[0] < 1) - params[0] = 1; - if (params[1] < 1) - params[1] = 1; - this._terminal.buffer.y = params[0] - 1; - if (this._terminal.buffer.y >= this._terminal.rows) { - this._terminal.buffer.y = this._terminal.rows - 1; - } - this._terminal.buffer.x = params[1] - 1; - if (this._terminal.buffer.x >= this._terminal.cols) { - this._terminal.buffer.x = this._terminal.cols - 1; - } - }; - InputHandler.prototype.tabClear = function (params) { - var param = params[0]; - if (param <= 0) { - delete this._terminal.buffer.tabs[this._terminal.buffer.x]; - } - else if (param === 3) { - this._terminal.buffer.tabs = {}; - } - }; - InputHandler.prototype.setMode = function (params) { - if (params.length > 1) { - for (var i = 0; i < params.length; i++) { - this.setMode([params[i]]); - } - return; - } - if (!this._terminal.prefix) { - switch (params[0]) { - case 4: - this._terminal.insertMode = true; - break; - case 20: - break; - } - } - else if (this._terminal.prefix === '?') { - switch (params[0]) { - case 1: - this._terminal.applicationCursor = true; - break; - case 2: - this._terminal.setgCharset(0, Charsets_1.DEFAULT_CHARSET); - this._terminal.setgCharset(1, Charsets_1.DEFAULT_CHARSET); - this._terminal.setgCharset(2, Charsets_1.DEFAULT_CHARSET); - this._terminal.setgCharset(3, Charsets_1.DEFAULT_CHARSET); - break; - case 3: - this._terminal.savedCols = this._terminal.cols; - this._terminal.resize(132, this._terminal.rows); - break; - case 6: - this._terminal.originMode = true; - break; - case 7: - this._terminal.wraparoundMode = true; - break; - case 12: - break; - case 66: - this._terminal.log('Serial port requested application keypad.'); - this._terminal.applicationKeypad = true; - this._terminal.viewport.syncScrollArea(); - break; - case 9: - case 1000: - case 1002: - case 1003: - this._terminal.x10Mouse = params[0] === 9; - this._terminal.vt200Mouse = params[0] === 1000; - this._terminal.normalMouse = params[0] > 1000; - this._terminal.mouseEvents = true; - this._terminal.element.classList.add('enable-mouse-events'); - this._terminal.selectionManager.disable(); - this._terminal.log('Binding to mouse events.'); - break; - case 1004: - this._terminal.sendFocus = true; - break; - case 1005: - this._terminal.utfMouse = true; - break; - case 1006: - this._terminal.sgrMouse = true; - break; - case 1015: - this._terminal.urxvtMouse = true; - break; - case 25: - this._terminal.cursorHidden = false; - break; - case 1049: - case 47: - case 1047: - this._terminal.buffers.activateAltBuffer(); - this._terminal.viewport.syncScrollArea(); - this._terminal.showCursor(); - break; - case 2004: - this._terminal.bracketedPasteMode = true; - break; - } - } - }; - InputHandler.prototype.resetMode = function (params) { - if (params.length > 1) { - for (var i = 0; i < params.length; i++) { - this.resetMode([params[i]]); - } - return; - } - if (!this._terminal.prefix) { - switch (params[0]) { - case 4: - this._terminal.insertMode = false; - break; - case 20: - break; - } - } - else if (this._terminal.prefix === '?') { - switch (params[0]) { - case 1: - this._terminal.applicationCursor = false; - break; - case 3: - if (this._terminal.cols === 132 && this._terminal.savedCols) { - this._terminal.resize(this._terminal.savedCols, this._terminal.rows); - } - delete this._terminal.savedCols; - break; - case 6: - this._terminal.originMode = false; - break; - case 7: - this._terminal.wraparoundMode = false; - break; - case 12: - break; - case 66: - this._terminal.log('Switching back to normal keypad.'); - this._terminal.applicationKeypad = false; - this._terminal.viewport.syncScrollArea(); - break; - case 9: - case 1000: - case 1002: - case 1003: - this._terminal.x10Mouse = false; - this._terminal.vt200Mouse = false; - this._terminal.normalMouse = false; - this._terminal.mouseEvents = false; - this._terminal.element.classList.remove('enable-mouse-events'); - this._terminal.selectionManager.enable(); - break; - case 1004: - this._terminal.sendFocus = false; - break; - case 1005: - this._terminal.utfMouse = false; - break; - case 1006: - this._terminal.sgrMouse = false; - break; - case 1015: - this._terminal.urxvtMouse = false; - break; - case 25: - this._terminal.cursorHidden = true; - break; - case 1049: - case 47: - case 1047: - this._terminal.buffers.activateNormalBuffer(); - this._terminal.refresh(0, this._terminal.rows - 1); - this._terminal.viewport.syncScrollArea(); - this._terminal.showCursor(); - break; - case 2004: - this._terminal.bracketedPasteMode = false; - break; - } - } - }; - InputHandler.prototype.charAttributes = function (params) { - if (params.length === 1 && params[0] === 0) { - this._terminal.curAttr = this._terminal.defAttr; - return; - } - var l = params.length; - var flags = this._terminal.curAttr >> 18; - var fg = (this._terminal.curAttr >> 9) & 0x1ff; - var bg = this._terminal.curAttr & 0x1ff; - var p; - for (var i = 0; i < l; i++) { - p = params[i]; - if (p >= 30 && p <= 37) { - fg = p - 30; - } - else if (p >= 40 && p <= 47) { - bg = p - 40; - } - else if (p >= 90 && p <= 97) { - p += 8; - fg = p - 90; - } - else if (p >= 100 && p <= 107) { - p += 8; - bg = p - 100; - } - else if (p === 0) { - flags = this._terminal.defAttr >> 18; - fg = (this._terminal.defAttr >> 9) & 0x1ff; - bg = this._terminal.defAttr & 0x1ff; - } - else if (p === 1) { - flags |= Types_1.FLAGS.BOLD; - } - else if (p === 4) { - flags |= Types_1.FLAGS.UNDERLINE; - } - else if (p === 5) { - flags |= Types_1.FLAGS.BLINK; - } - else if (p === 7) { - flags |= Types_1.FLAGS.INVERSE; - } - else if (p === 8) { - flags |= Types_1.FLAGS.INVISIBLE; - } - else if (p === 2) { - flags |= Types_1.FLAGS.DIM; - } - else if (p === 22) { - flags &= ~Types_1.FLAGS.BOLD; - flags &= ~Types_1.FLAGS.DIM; - } - else if (p === 24) { - flags &= ~Types_1.FLAGS.UNDERLINE; - } - else if (p === 25) { - flags &= ~Types_1.FLAGS.BLINK; - } - else if (p === 27) { - flags &= ~Types_1.FLAGS.INVERSE; - } - else if (p === 28) { - flags &= ~Types_1.FLAGS.INVISIBLE; - } - else if (p === 39) { - fg = (this._terminal.defAttr >> 9) & 0x1ff; - } - else if (p === 49) { - bg = this._terminal.defAttr & 0x1ff; - } - else if (p === 38) { - if (params[i + 1] === 2) { - i += 2; - fg = this._terminal.matchColor(params[i] & 0xff, params[i + 1] & 0xff, params[i + 2] & 0xff); - if (fg === -1) - fg = 0x1ff; - i += 2; - } - else if (params[i + 1] === 5) { - i += 2; - p = params[i] & 0xff; - fg = p; - } - } - else if (p === 48) { - if (params[i + 1] === 2) { - i += 2; - bg = this._terminal.matchColor(params[i] & 0xff, params[i + 1] & 0xff, params[i + 2] & 0xff); - if (bg === -1) - bg = 0x1ff; - i += 2; - } - else if (params[i + 1] === 5) { - i += 2; - p = params[i] & 0xff; - bg = p; - } - } - else if (p === 100) { - fg = (this._terminal.defAttr >> 9) & 0x1ff; - bg = this._terminal.defAttr & 0x1ff; - } - else { - this._terminal.error('Unknown SGR attribute: %d.', p); - } - } - this._terminal.curAttr = (flags << 18) | (fg << 9) | bg; - }; - InputHandler.prototype.deviceStatus = function (params) { - if (!this._terminal.prefix) { - switch (params[0]) { - case 5: - this._terminal.send(EscapeSequences_1.C0.ESC + '[0n'); - break; - case 6: - this._terminal.send(EscapeSequences_1.C0.ESC + '[' - + (this._terminal.buffer.y + 1) - + ';' - + (this._terminal.buffer.x + 1) - + 'R'); - break; - } - } - else if (this._terminal.prefix === '?') { - switch (params[0]) { - case 6: - this._terminal.send(EscapeSequences_1.C0.ESC + '[?' - + (this._terminal.buffer.y + 1) - + ';' - + (this._terminal.buffer.x + 1) - + 'R'); - break; - case 15: - break; - case 25: - break; - case 26: - break; - case 53: - break; - } - } - }; - InputHandler.prototype.softReset = function (params) { - this._terminal.cursorHidden = false; - this._terminal.insertMode = false; - this._terminal.originMode = false; - this._terminal.wraparoundMode = true; - this._terminal.applicationKeypad = false; - this._terminal.viewport.syncScrollArea(); - this._terminal.applicationCursor = false; - this._terminal.buffer.scrollTop = 0; - this._terminal.buffer.scrollBottom = this._terminal.rows - 1; - this._terminal.curAttr = this._terminal.defAttr; - this._terminal.buffer.x = this._terminal.buffer.y = 0; - this._terminal.charset = null; - this._terminal.glevel = 0; - this._terminal.charsets = [null]; - }; - InputHandler.prototype.setCursorStyle = function (params) { - var param = params[0] < 1 ? 1 : params[0]; - switch (param) { - case 1: - case 2: - this._terminal.setOption('cursorStyle', 'block'); - break; - case 3: - case 4: - this._terminal.setOption('cursorStyle', 'underline'); - break; - case 5: - case 6: - this._terminal.setOption('cursorStyle', 'bar'); - break; - } - var isBlinking = param % 2 === 1; - this._terminal.setOption('cursorBlink', isBlinking); - }; - InputHandler.prototype.setScrollRegion = function (params) { - if (this._terminal.prefix) - return; - this._terminal.buffer.scrollTop = (params[0] || 1) - 1; - this._terminal.buffer.scrollBottom = (params[1] && params[1] <= this._terminal.rows ? params[1] : this._terminal.rows) - 1; - this._terminal.buffer.x = 0; - this._terminal.buffer.y = 0; - }; - InputHandler.prototype.saveCursor = function (params) { - this._terminal.buffer.savedX = this._terminal.buffer.x; - this._terminal.buffer.savedY = this._terminal.buffer.y; - }; - InputHandler.prototype.restoreCursor = function (params) { - this._terminal.buffer.x = this._terminal.buffer.savedX || 0; - this._terminal.buffer.y = this._terminal.buffer.savedY || 0; - }; - return InputHandler; -}()); -exports.InputHandler = InputHandler; - - - -},{"./Buffer":1,"./CharWidth":3,"./Charsets":4,"./EscapeSequences":6,"./renderer/Types":28}],9:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Types_1 = require("./Types"); -var MouseZoneManager_1 = require("./input/MouseZoneManager"); -var EventEmitter_1 = require("./EventEmitter"); -var protocolClause = '(https?:\\/\\/)'; -var domainCharacterSet = '[\\da-z\\.-]+'; -var negatedDomainCharacterSet = '[^\\da-z\\.-]+'; -var domainBodyClause = '(' + domainCharacterSet + ')'; -var tldClause = '([a-z\\.]{2,6})'; -var ipClause = '((\\d{1,3}\\.){3}\\d{1,3})'; -var localHostClause = '(localhost)'; -var portClause = '(:\\d{1,5})'; -var hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?'; -var pathClause = '(\\/[\\/\\w\\.\\-%~]*)*'; -var queryStringHashFragmentCharacterSet = '[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&\'*+,:;~\\=\\.\\-]*'; -var queryStringClause = '(\\?' + queryStringHashFragmentCharacterSet + ')?'; -var hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?'; -var negatedPathCharacterSet = '[^\\/\\w\\.\\-%]+'; -var bodyClause = hostClause + pathClause + queryStringClause + hashFragmentClause; -var start = '(?:^|' + negatedDomainCharacterSet + ')('; -var end = ')($|' + negatedPathCharacterSet + ')'; -var strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end); -var HYPERTEXT_LINK_MATCHER_ID = 0; -var Linkifier = (function (_super) { - __extends(Linkifier, _super); - function Linkifier(_terminal) { - var _this = _super.call(this) || this; - _this._terminal = _terminal; - _this._linkMatchers = []; - _this._nextLinkMatcherId = HYPERTEXT_LINK_MATCHER_ID; - _this._rowsToLinkify = { - start: null, - end: null - }; - _this.registerLinkMatcher(strictUrlRegex, null, { matchIndex: 1 }); - return _this; - } - Linkifier.prototype.attachToDom = function (mouseZoneManager) { - this._mouseZoneManager = mouseZoneManager; - }; - Linkifier.prototype.linkifyRows = function (start, end) { - var _this = this; - if (!this._mouseZoneManager) { - return; - } - if (this._rowsToLinkify.start === null) { - this._rowsToLinkify.start = start; - this._rowsToLinkify.end = end; - } - else { - this._rowsToLinkify.start = Math.min(this._rowsToLinkify.start, start); - this._rowsToLinkify.end = Math.max(this._rowsToLinkify.end, end); - } - this._mouseZoneManager.clearAll(start, end); - if (this._rowsTimeoutId) { - clearTimeout(this._rowsTimeoutId); - } - this._rowsTimeoutId = setTimeout(function () { return _this._linkifyRows(); }, Linkifier.TIME_BEFORE_LINKIFY); - }; - Linkifier.prototype._linkifyRows = function () { - this._rowsTimeoutId = null; - for (var i = this._rowsToLinkify.start; i <= this._rowsToLinkify.end; i++) { - this._linkifyRow(i); - } - this._rowsToLinkify.start = null; - this._rowsToLinkify.end = null; - }; - Linkifier.prototype.setHypertextLinkHandler = function (handler) { - this._linkMatchers[HYPERTEXT_LINK_MATCHER_ID].handler = handler; - }; - Linkifier.prototype.setHypertextValidationCallback = function (callback) { - this._linkMatchers[HYPERTEXT_LINK_MATCHER_ID].validationCallback = callback; - }; - Linkifier.prototype.registerLinkMatcher = function (regex, handler, options) { - if (options === void 0) { options = {}; } - if (this._nextLinkMatcherId !== HYPERTEXT_LINK_MATCHER_ID && !handler) { - throw new Error('handler must be defined'); - } - var matcher = { - id: this._nextLinkMatcherId++, - regex: regex, - handler: handler, - matchIndex: options.matchIndex, - validationCallback: options.validationCallback, - hoverTooltipCallback: options.tooltipCallback, - hoverLeaveCallback: options.leaveCallback, - willLinkActivate: options.willLinkActivate, - priority: options.priority || 0 - }; - this._addLinkMatcherToList(matcher); - return matcher.id; - }; - Linkifier.prototype._addLinkMatcherToList = function (matcher) { - if (this._linkMatchers.length === 0) { - this._linkMatchers.push(matcher); - return; - } - for (var i = this._linkMatchers.length - 1; i >= 0; i--) { - if (matcher.priority <= this._linkMatchers[i].priority) { - this._linkMatchers.splice(i + 1, 0, matcher); - return; - } - } - this._linkMatchers.splice(0, 0, matcher); - }; - Linkifier.prototype.deregisterLinkMatcher = function (matcherId) { - for (var i = 1; i < this._linkMatchers.length; i++) { - if (this._linkMatchers[i].id === matcherId) { - this._linkMatchers.splice(i, 1); - return true; - } - } - return false; - }; - Linkifier.prototype._linkifyRow = function (rowIndex) { - var absoluteRowIndex = this._terminal.buffer.ydisp + rowIndex; - if (absoluteRowIndex >= this._terminal.buffer.lines.length) { - return; - } - var text = this._terminal.buffer.translateBufferLineToString(absoluteRowIndex, false); - for (var i = 0; i < this._linkMatchers.length; i++) { - this._doLinkifyRow(rowIndex, text, this._linkMatchers[i]); - } - }; - Linkifier.prototype._doLinkifyRow = function (rowIndex, text, matcher, offset) { - var _this = this; - if (offset === void 0) { offset = 0; } - var result = []; - var isHttpLinkMatcher = matcher.id === HYPERTEXT_LINK_MATCHER_ID; - var match = text.match(matcher.regex); - if (!match || match.length === 0) { - return; - } - var uri = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex]; - var index = text.indexOf(uri); - if (matcher.validationCallback) { - matcher.validationCallback(uri, function (isValid) { - if (_this._rowsTimeoutId) { - return; - } - if (isValid) { - _this._addLink(offset + index, rowIndex, uri, matcher); - } - }); - } - else { - this._addLink(offset + index, rowIndex, uri, matcher); - } - var remainingStartIndex = index + uri.length; - var remainingText = text.substr(remainingStartIndex); - if (remainingText.length > 0) { - this._doLinkifyRow(rowIndex, remainingText, matcher, offset + remainingStartIndex); - } - }; - Linkifier.prototype._addLink = function (x, y, uri, matcher) { - var _this = this; - this._mouseZoneManager.add(new MouseZoneManager_1.MouseZone(x + 1, x + 1 + uri.length, y + 1, function (e) { - if (matcher.handler) { - return matcher.handler(e, uri); - } - window.open(uri, '_blank'); - }, function (e) { - _this.emit(Types_1.LinkHoverEventTypes.HOVER, { x: x, y: y, length: uri.length }); - _this._terminal.element.style.cursor = 'pointer'; - }, function (e) { - _this.emit(Types_1.LinkHoverEventTypes.TOOLTIP, { x: x, y: y, length: uri.length }); - if (matcher.hoverTooltipCallback) { - matcher.hoverTooltipCallback(e, uri); - } - }, function () { - _this.emit(Types_1.LinkHoverEventTypes.LEAVE, { x: x, y: y, length: uri.length }); - _this._terminal.element.style.cursor = ''; - if (matcher.hoverLeaveCallback) { - matcher.hoverLeaveCallback(); - } - }, function (e) { - if (matcher.willLinkActivate) { - return matcher.willLinkActivate(e, uri); - } - return true; - })); - }; - Linkifier.TIME_BEFORE_LINKIFY = 200; - return Linkifier; -}(EventEmitter_1.EventEmitter)); -exports.Linkifier = Linkifier; - - - -},{"./EventEmitter":7,"./Types":14,"./input/MouseZoneManager":18}],10:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var EscapeSequences_1 = require("./EscapeSequences"); -var Charsets_1 = require("./Charsets"); -var normalStateHandler = {}; -normalStateHandler[EscapeSequences_1.C0.BEL] = function (parser, handler) { return handler.bell(); }; -normalStateHandler[EscapeSequences_1.C0.LF] = function (parser, handler) { return handler.lineFeed(); }; -normalStateHandler[EscapeSequences_1.C0.VT] = normalStateHandler[EscapeSequences_1.C0.LF]; -normalStateHandler[EscapeSequences_1.C0.FF] = normalStateHandler[EscapeSequences_1.C0.LF]; -normalStateHandler[EscapeSequences_1.C0.CR] = function (parser, handler) { return handler.carriageReturn(); }; -normalStateHandler[EscapeSequences_1.C0.BS] = function (parser, handler) { return handler.backspace(); }; -normalStateHandler[EscapeSequences_1.C0.HT] = function (parser, handler) { return handler.tab(); }; -normalStateHandler[EscapeSequences_1.C0.SO] = function (parser, handler) { return handler.shiftOut(); }; -normalStateHandler[EscapeSequences_1.C0.SI] = function (parser, handler) { return handler.shiftIn(); }; -normalStateHandler[EscapeSequences_1.C0.ESC] = function (parser, handler) { return parser.setState(ParserState.ESCAPED); }; -var escapedStateHandler = {}; -escapedStateHandler['['] = function (parser, terminal) { - terminal.params = []; - terminal.currentParam = 0; - parser.setState(ParserState.CSI_PARAM); -}; -escapedStateHandler[']'] = function (parser, terminal) { - terminal.params = []; - terminal.currentParam = 0; - parser.setState(ParserState.OSC); -}; -escapedStateHandler['P'] = function (parser, terminal) { - terminal.params = []; - terminal.currentParam = 0; - parser.setState(ParserState.DCS); -}; -escapedStateHandler['_'] = function (parser, terminal) { - parser.setState(ParserState.IGNORE); -}; -escapedStateHandler['^'] = function (parser, terminal) { - parser.setState(ParserState.IGNORE); -}; -escapedStateHandler['c'] = function (parser, terminal) { - terminal.reset(); -}; -escapedStateHandler['E'] = function (parser, terminal) { - terminal.buffer.x = 0; - terminal.index(); - parser.setState(ParserState.NORMAL); -}; -escapedStateHandler['D'] = function (parser, terminal) { - terminal.index(); - parser.setState(ParserState.NORMAL); -}; -escapedStateHandler['M'] = function (parser, terminal) { - terminal.reverseIndex(); - parser.setState(ParserState.NORMAL); -}; -escapedStateHandler['%'] = function (parser, terminal) { - terminal.setgLevel(0); - terminal.setgCharset(0, Charsets_1.DEFAULT_CHARSET); - parser.setState(ParserState.NORMAL); - parser.skipNextChar(); -}; -escapedStateHandler[EscapeSequences_1.C0.CAN] = function (parser) { return parser.setState(ParserState.NORMAL); }; -var csiParamStateHandler = {}; -csiParamStateHandler['?'] = function (parser) { return parser.setPrefix('?'); }; -csiParamStateHandler['>'] = function (parser) { return parser.setPrefix('>'); }; -csiParamStateHandler['!'] = function (parser) { return parser.setPrefix('!'); }; -csiParamStateHandler['0'] = function (parser) { return parser.setParam(parser.getParam() * 10); }; -csiParamStateHandler['1'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 1); }; -csiParamStateHandler['2'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 2); }; -csiParamStateHandler['3'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 3); }; -csiParamStateHandler['4'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 4); }; -csiParamStateHandler['5'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 5); }; -csiParamStateHandler['6'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 6); }; -csiParamStateHandler['7'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 7); }; -csiParamStateHandler['8'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 8); }; -csiParamStateHandler['9'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 9); }; -csiParamStateHandler['$'] = function (parser) { return parser.setPostfix('$'); }; -csiParamStateHandler['"'] = function (parser) { return parser.setPostfix('"'); }; -csiParamStateHandler[' '] = function (parser) { return parser.setPostfix(' '); }; -csiParamStateHandler['\''] = function (parser) { return parser.setPostfix('\''); }; -csiParamStateHandler[';'] = function (parser) { return parser.finalizeParam(); }; -csiParamStateHandler[EscapeSequences_1.C0.CAN] = function (parser) { return parser.setState(ParserState.NORMAL); }; -var csiStateHandler = {}; -csiStateHandler['@'] = function (handler, params, prefix) { return handler.insertChars(params); }; -csiStateHandler['A'] = function (handler, params, prefix) { return handler.cursorUp(params); }; -csiStateHandler['B'] = function (handler, params, prefix) { return handler.cursorDown(params); }; -csiStateHandler['C'] = function (handler, params, prefix) { return handler.cursorForward(params); }; -csiStateHandler['D'] = function (handler, params, prefix) { return handler.cursorBackward(params); }; -csiStateHandler['E'] = function (handler, params, prefix) { return handler.cursorNextLine(params); }; -csiStateHandler['F'] = function (handler, params, prefix) { return handler.cursorPrecedingLine(params); }; -csiStateHandler['G'] = function (handler, params, prefix) { return handler.cursorCharAbsolute(params); }; -csiStateHandler['H'] = function (handler, params, prefix) { return handler.cursorPosition(params); }; -csiStateHandler['I'] = function (handler, params, prefix) { return handler.cursorForwardTab(params); }; -csiStateHandler['J'] = function (handler, params, prefix) { return handler.eraseInDisplay(params); }; -csiStateHandler['K'] = function (handler, params, prefix) { return handler.eraseInLine(params); }; -csiStateHandler['L'] = function (handler, params, prefix) { return handler.insertLines(params); }; -csiStateHandler['M'] = function (handler, params, prefix) { return handler.deleteLines(params); }; -csiStateHandler['P'] = function (handler, params, prefix) { return handler.deleteChars(params); }; -csiStateHandler['S'] = function (handler, params, prefix) { return handler.scrollUp(params); }; -csiStateHandler['T'] = function (handler, params, prefix) { - if (params.length < 2 && !prefix) { - handler.scrollDown(params); - } -}; -csiStateHandler['X'] = function (handler, params, prefix) { return handler.eraseChars(params); }; -csiStateHandler['Z'] = function (handler, params, prefix) { return handler.cursorBackwardTab(params); }; -csiStateHandler['`'] = function (handler, params, prefix) { return handler.charPosAbsolute(params); }; -csiStateHandler['a'] = function (handler, params, prefix) { return handler.HPositionRelative(params); }; -csiStateHandler['b'] = function (handler, params, prefix) { return handler.repeatPrecedingCharacter(params); }; -csiStateHandler['c'] = function (handler, params, prefix) { return handler.sendDeviceAttributes(params); }; -csiStateHandler['d'] = function (handler, params, prefix) { return handler.linePosAbsolute(params); }; -csiStateHandler['e'] = function (handler, params, prefix) { return handler.VPositionRelative(params); }; -csiStateHandler['f'] = function (handler, params, prefix) { return handler.HVPosition(params); }; -csiStateHandler['g'] = function (handler, params, prefix) { return handler.tabClear(params); }; -csiStateHandler['h'] = function (handler, params, prefix) { return handler.setMode(params); }; -csiStateHandler['l'] = function (handler, params, prefix) { return handler.resetMode(params); }; -csiStateHandler['m'] = function (handler, params, prefix) { return handler.charAttributes(params); }; -csiStateHandler['n'] = function (handler, params, prefix) { return handler.deviceStatus(params); }; -csiStateHandler['p'] = function (handler, params, prefix) { - switch (prefix) { - case '!': - handler.softReset(params); - break; - } -}; -csiStateHandler['q'] = function (handler, params, prefix, postfix) { - if (postfix === ' ') { - handler.setCursorStyle(params); - } -}; -csiStateHandler['r'] = function (handler, params) { return handler.setScrollRegion(params); }; -csiStateHandler['s'] = function (handler, params) { return handler.saveCursor(params); }; -csiStateHandler['u'] = function (handler, params) { return handler.restoreCursor(params); }; -csiStateHandler[EscapeSequences_1.C0.CAN] = function (handler, params, prefix, postfix, parser) { return parser.setState(ParserState.NORMAL); }; -var ParserState; -(function (ParserState) { - ParserState[ParserState["NORMAL"] = 0] = "NORMAL"; - ParserState[ParserState["ESCAPED"] = 1] = "ESCAPED"; - ParserState[ParserState["CSI_PARAM"] = 2] = "CSI_PARAM"; - ParserState[ParserState["CSI"] = 3] = "CSI"; - ParserState[ParserState["OSC"] = 4] = "OSC"; - ParserState[ParserState["CHARSET"] = 5] = "CHARSET"; - ParserState[ParserState["DCS"] = 6] = "DCS"; - ParserState[ParserState["IGNORE"] = 7] = "IGNORE"; -})(ParserState = exports.ParserState || (exports.ParserState = {})); -var Parser = (function () { - function Parser(_inputHandler, _terminal) { - this._inputHandler = _inputHandler; - this._terminal = _terminal; - this._state = ParserState.NORMAL; - } - Parser.prototype.parse = function (data) { - var l = data.length; - var j; - var cs; - var ch; - var code; - var low; - var cursorStartX = this._terminal.buffer.x; - var cursorStartY = this._terminal.buffer.y; - if (this._terminal.debug) { - this._terminal.log('data: ' + data); - } - this._position = 0; - if (this._terminal.surrogate_high) { - data = this._terminal.surrogate_high + data; - this._terminal.surrogate_high = ''; - } - for (; this._position < l; this._position++) { - ch = data[this._position]; - code = data.charCodeAt(this._position); - if (0xD800 <= code && code <= 0xDBFF) { - low = data.charCodeAt(this._position + 1); - if (isNaN(low)) { - this._terminal.surrogate_high = ch; - continue; - } - code = ((code - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000; - ch += data.charAt(this._position + 1); - } - if (0xDC00 <= code && code <= 0xDFFF) { - continue; - } - switch (this._state) { - case ParserState.NORMAL: - if (ch in normalStateHandler) { - normalStateHandler[ch](this, this._inputHandler); - } - else { - this._inputHandler.addChar(ch, code); - } - break; - case ParserState.ESCAPED: - if (ch in escapedStateHandler) { - escapedStateHandler[ch](this, this._terminal); - break; - } - switch (ch) { - case '(': - case ')': - case '*': - case '+': - case '-': - case '.': - switch (ch) { - case '(': - this._terminal.gcharset = 0; - break; - case ')': - this._terminal.gcharset = 1; - break; - case '*': - this._terminal.gcharset = 2; - break; - case '+': - this._terminal.gcharset = 3; - break; - case '-': - this._terminal.gcharset = 1; - break; - case '.': - this._terminal.gcharset = 2; - break; - } - this._state = ParserState.CHARSET; - break; - case '/': - this._terminal.gcharset = 3; - this._state = ParserState.CHARSET; - this._position--; - break; - case 'N': - this._state = ParserState.NORMAL; - break; - case 'O': - this._state = ParserState.NORMAL; - break; - case 'n': - this._terminal.setgLevel(2); - this._state = ParserState.NORMAL; - break; - case 'o': - this._terminal.setgLevel(3); - this._state = ParserState.NORMAL; - break; - case '|': - this._terminal.setgLevel(3); - this._state = ParserState.NORMAL; - break; - case '}': - this._terminal.setgLevel(2); - this._state = ParserState.NORMAL; - break; - case '~': - this._terminal.setgLevel(1); - this._state = ParserState.NORMAL; - break; - case '7': - this._inputHandler.saveCursor(); - this._state = ParserState.NORMAL; - break; - case '8': - this._inputHandler.restoreCursor(); - this._state = ParserState.NORMAL; - break; - case '#': - this._state = ParserState.NORMAL; - this._position++; - break; - case 'H': - this._terminal.tabSet(); - this._state = ParserState.NORMAL; - break; - case '=': - this._terminal.log('Serial port requested application keypad.'); - this._terminal.applicationKeypad = true; - if (this._terminal.viewport) { - this._terminal.viewport.syncScrollArea(); - } - this._state = ParserState.NORMAL; - break; - case '>': - this._terminal.log('Switching back to normal keypad.'); - this._terminal.applicationKeypad = false; - if (this._terminal.viewport) { - this._terminal.viewport.syncScrollArea(); - } - this._state = ParserState.NORMAL; - break; - default: - this._state = ParserState.NORMAL; - this._terminal.error('Unknown ESC control: %s.', ch); - break; - } - break; - case ParserState.CHARSET: - if (ch in Charsets_1.CHARSETS) { - cs = Charsets_1.CHARSETS[ch]; - if (ch === '/') { - this.skipNextChar(); - } - } - else { - cs = Charsets_1.DEFAULT_CHARSET; - } - this._terminal.setgCharset(this._terminal.gcharset, cs); - this._terminal.gcharset = null; - this._state = ParserState.NORMAL; - break; - case ParserState.OSC: - if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) { - if (ch === EscapeSequences_1.C0.ESC) - this._position++; - this._terminal.params.push(this._terminal.currentParam); - switch (this._terminal.params[0]) { - case 0: - case 1: - case 2: - if (this._terminal.params[1]) { - this._terminal.title = this._terminal.params[1]; - this._terminal.handleTitle(this._terminal.title); - } - break; - case 3: - break; - case 4: - case 5: - break; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - break; - case 46: - break; - case 50: - break; - case 51: - break; - case 52: - break; - case 104: - case 105: - case 110: - case 111: - case 112: - case 113: - case 114: - case 115: - case 116: - case 117: - case 118: - break; - } - this._terminal.params = []; - this._terminal.currentParam = 0; - this._state = ParserState.NORMAL; - } - else { - if (!this._terminal.params.length) { - if (ch >= '0' && ch <= '9') { - this._terminal.currentParam = - this._terminal.currentParam * 10 + ch.charCodeAt(0) - 48; - } - else if (ch === ';') { - this._terminal.params.push(this._terminal.currentParam); - this._terminal.currentParam = ''; - } - } - else { - this._terminal.currentParam += ch; - } - } - break; - case ParserState.CSI_PARAM: - if (ch in csiParamStateHandler) { - csiParamStateHandler[ch](this); - break; - } - this.finalizeParam(); - this._state = ParserState.CSI; - case ParserState.CSI: - if (ch in csiStateHandler) { - if (this._terminal.debug) { - this._terminal.log("CSI " + (this._terminal.prefix ? this._terminal.prefix : '') + " " + (this._terminal.params ? this._terminal.params.join(';') : '') + " " + (this._terminal.postfix ? this._terminal.postfix : '') + " " + ch); - } - csiStateHandler[ch](this._inputHandler, this._terminal.params, this._terminal.prefix, this._terminal.postfix, this); - } - else { - this._terminal.error('Unknown CSI code: %s.', ch); - } - this._state = ParserState.NORMAL; - this._terminal.prefix = ''; - this._terminal.postfix = ''; - break; - case ParserState.DCS: - if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) { - if (ch === EscapeSequences_1.C0.ESC) - this._position++; - var pt = void 0; - var valid = void 0; - switch (this._terminal.prefix) { - case '': - break; - case '$q': - pt = this._terminal.currentParam; - valid = false; - switch (pt) { - case '"q': - pt = '0"q'; - break; - case '"p': - pt = '61"p'; - break; - case 'r': - pt = '' - + (this._terminal.buffer.scrollTop + 1) - + ';' - + (this._terminal.buffer.scrollBottom + 1) - + 'r'; - break; - case 'm': - pt = '0m'; - break; - default: - this._terminal.error('Unknown DCS Pt: %s.', pt); - pt = ''; - break; - } - this._terminal.send(EscapeSequences_1.C0.ESC + 'P' + +valid + '$r' + pt + EscapeSequences_1.C0.ESC + '\\'); - break; - case '+p': - break; - case '+q': - pt = this._terminal.currentParam; - valid = false; - this._terminal.send(EscapeSequences_1.C0.ESC + 'P' + +valid + '+r' + pt + EscapeSequences_1.C0.ESC + '\\'); - break; - default: - this._terminal.error('Unknown DCS prefix: %s.', this._terminal.prefix); - break; - } - this._terminal.currentParam = 0; - this._terminal.prefix = ''; - this._state = ParserState.NORMAL; - } - else if (!this._terminal.currentParam) { - if (!this._terminal.prefix && ch !== '$' && ch !== '+') { - this._terminal.currentParam = ch; - } - else if (this._terminal.prefix.length === 2) { - this._terminal.currentParam = ch; - } - else { - this._terminal.prefix += ch; - } - } - else { - this._terminal.currentParam += ch; - } - break; - case ParserState.IGNORE: - if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) { - if (ch === EscapeSequences_1.C0.ESC) - this._position++; - this._state = ParserState.NORMAL; - } - break; - } - } - if (this._terminal.buffer.x !== cursorStartX || this._terminal.buffer.y !== cursorStartY) { - this._terminal.emit('cursormove'); - } - return this._state; - }; - Parser.prototype.setState = function (state) { - this._state = state; - }; - Parser.prototype.setPrefix = function (prefix) { - this._terminal.prefix = prefix; - }; - Parser.prototype.setPostfix = function (postfix) { - this._terminal.postfix = postfix; - }; - Parser.prototype.setParam = function (param) { - this._terminal.currentParam = param; - }; - Parser.prototype.getParam = function () { - return this._terminal.currentParam; - }; - Parser.prototype.finalizeParam = function () { - this._terminal.params.push(this._terminal.currentParam); - this._terminal.currentParam = 0; - }; - Parser.prototype.skipNextChar = function () { - this._position++; - }; - return Parser; -}()); -exports.Parser = Parser; - - - -},{"./Charsets":4,"./EscapeSequences":6}],11:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var MouseHelper_1 = require("./utils/MouseHelper"); -var Browser = require("./shared/utils/Browser"); -var EventEmitter_1 = require("./EventEmitter"); -var SelectionModel_1 = require("./SelectionModel"); -var Buffer_1 = require("./Buffer"); -var AltClickHandler_1 = require("./handlers/AltClickHandler"); -var DRAG_SCROLL_MAX_THRESHOLD = 50; -var DRAG_SCROLL_MAX_SPEED = 15; -var DRAG_SCROLL_INTERVAL = 50; -var ALT_CLICK_MOVE_CURSOR_TIME = 500; -var WORD_SEPARATORS = ' ()[]{}\'"'; -var NON_BREAKING_SPACE_CHAR = String.fromCharCode(160); -var ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g'); -var SelectionMode; -(function (SelectionMode) { - SelectionMode[SelectionMode["NORMAL"] = 0] = "NORMAL"; - SelectionMode[SelectionMode["WORD"] = 1] = "WORD"; - SelectionMode[SelectionMode["LINE"] = 2] = "LINE"; -})(SelectionMode || (SelectionMode = {})); -var SelectionManager = (function (_super) { - __extends(SelectionManager, _super); - function SelectionManager(_terminal, _charMeasure) { - var _this = _super.call(this) || this; - _this._terminal = _terminal; - _this._charMeasure = _charMeasure; - _this._enabled = true; - _this._initListeners(); - _this.enable(); - _this._model = new SelectionModel_1.SelectionModel(_terminal); - _this._activeSelectionMode = SelectionMode.NORMAL; - return _this; - } - Object.defineProperty(SelectionManager.prototype, "_buffer", { - get: function () { - return this._terminal.buffers.active; - }, - enumerable: true, - configurable: true - }); - SelectionManager.prototype._initListeners = function () { - var _this = this; - this._mouseMoveListener = function (event) { return _this._onMouseMove(event); }; - this._mouseUpListener = function (event) { return _this._onMouseUp(event); }; - this._trimListener = function (amount) { return _this._onTrim(amount); }; - this.initBuffersListeners(); - }; - SelectionManager.prototype.initBuffersListeners = function () { - var _this = this; - this._terminal.buffer.lines.on('trim', this._trimListener); - this._terminal.buffers.on('activate', function (e) { return _this._onBufferActivate(e); }); - }; - SelectionManager.prototype.disable = function () { - this.clearSelection(); - this._enabled = false; - }; - SelectionManager.prototype.enable = function () { - this._enabled = true; - }; - Object.defineProperty(SelectionManager.prototype, "selectionStart", { - get: function () { return this._model.finalSelectionStart; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SelectionManager.prototype, "selectionEnd", { - get: function () { return this._model.finalSelectionEnd; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SelectionManager.prototype, "hasSelection", { - get: function () { - var start = this._model.finalSelectionStart; - var end = this._model.finalSelectionEnd; - if (!start || !end) { - return false; - } - return start[0] !== end[0] || start[1] !== end[1]; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SelectionManager.prototype, "selectionText", { - get: function () { - var start = this._model.finalSelectionStart; - var end = this._model.finalSelectionEnd; - if (!start || !end) { - return ''; - } - var startRowEndCol = start[1] === end[1] ? end[0] : null; - var result = []; - result.push(this._buffer.translateBufferLineToString(start[1], true, start[0], startRowEndCol)); - for (var i = start[1] + 1; i <= end[1] - 1; i++) { - var bufferLine = this._buffer.lines.get(i); - var lineText = this._buffer.translateBufferLineToString(i, true); - if (bufferLine.isWrapped) { - result[result.length - 1] += lineText; - } - else { - result.push(lineText); - } - } - if (start[1] !== end[1]) { - var bufferLine = this._buffer.lines.get(end[1]); - var lineText = this._buffer.translateBufferLineToString(end[1], true, 0, end[0]); - if (bufferLine.isWrapped) { - result[result.length - 1] += lineText; - } - else { - result.push(lineText); - } - } - var formattedResult = result.map(function (line) { - return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' '); - }).join(Browser.isMSWindows ? '\r\n' : '\n'); - return formattedResult; - }, - enumerable: true, - configurable: true - }); - SelectionManager.prototype.clearSelection = function () { - this._model.clearSelection(); - this._removeMouseDownListeners(); - this.refresh(); - }; - SelectionManager.prototype.refresh = function (isNewSelection) { - var _this = this; - if (!this._refreshAnimationFrame) { - this._refreshAnimationFrame = window.requestAnimationFrame(function () { return _this._refresh(); }); - } - if (Browser.isLinux && isNewSelection) { - var selectionText = this.selectionText; - if (selectionText.length) { - this.emit('newselection', this.selectionText); - } - } - }; - SelectionManager.prototype._refresh = function () { - this._refreshAnimationFrame = null; - this.emit('refresh', { start: this._model.finalSelectionStart, end: this._model.finalSelectionEnd }); - }; - SelectionManager.prototype.isClickInSelection = function (event) { - var coords = this._getMouseBufferCoords(event); - var start = this._model.finalSelectionStart; - var end = this._model.finalSelectionEnd; - if (!start || !end) { - return false; - } - return (coords[1] > start[1] && coords[1] < end[1]) || - (start[1] === end[1] && coords[1] === start[1] && coords[0] > start[0] && coords[0] < end[0]) || - (start[1] < end[1] && coords[1] === end[1] && coords[0] < end[0]); - }; - SelectionManager.prototype.selectWordAtCursor = function (event) { - var coords = this._getMouseBufferCoords(event); - if (coords) { - this._selectWordAt(coords, false); - this._model.selectionEnd = null; - this.refresh(true); - } - }; - SelectionManager.prototype.selectAll = function () { - this._model.isSelectAllActive = true; - this.refresh(); - this._terminal.emit('selection'); - }; - SelectionManager.prototype._onTrim = function (amount) { - var needsRefresh = this._model.onTrim(amount); - if (needsRefresh) { - this.refresh(); - } - }; - SelectionManager.prototype._getMouseBufferCoords = function (event) { - var coords = this._terminal.mouseHelper.getCoords(event, this._terminal.screenElement, this._charMeasure, this._terminal.options.lineHeight, this._terminal.cols, this._terminal.rows, true); - if (!coords) { - return null; - } - coords[0]--; - coords[1]--; - coords[1] += this._terminal.buffer.ydisp; - return coords; - }; - SelectionManager.prototype._getMouseEventScrollAmount = function (event) { - var offset = MouseHelper_1.MouseHelper.getCoordsRelativeToElement(event, this._terminal.screenElement)[1]; - var terminalHeight = this._terminal.rows * Math.ceil(this._charMeasure.height * this._terminal.options.lineHeight); - if (offset >= 0 && offset <= terminalHeight) { - return 0; - } - if (offset > terminalHeight) { - offset -= terminalHeight; - } - offset = Math.min(Math.max(offset, -DRAG_SCROLL_MAX_THRESHOLD), DRAG_SCROLL_MAX_THRESHOLD); - offset /= DRAG_SCROLL_MAX_THRESHOLD; - return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1)); - }; - SelectionManager.prototype.shouldForceSelection = function (event) { - return Browser.isMac ? event.altKey : event.shiftKey; - }; - SelectionManager.prototype.onMouseDown = function (event) { - this._mouseDownTimeStamp = event.timeStamp; - if (event.button === 2 && this.hasSelection) { - return; - } - if (event.button !== 0) { - return; - } - if (!this._enabled) { - if (!this.shouldForceSelection(event)) { - return; - } - event.stopPropagation(); - } - event.preventDefault(); - this._dragScrollAmount = 0; - if (this._enabled && event.shiftKey) { - this._onIncrementalClick(event); - } - else { - if (event.detail === 1) { - this._onSingleClick(event); - } - else if (event.detail === 2) { - this._onDoubleClick(event); - } - else if (event.detail === 3) { - this._onTripleClick(event); - } - } - this._addMouseDownListeners(); - this.refresh(true); - }; - SelectionManager.prototype._addMouseDownListeners = function () { - var _this = this; - this._terminal.element.ownerDocument.addEventListener('mousemove', this._mouseMoveListener); - this._terminal.element.ownerDocument.addEventListener('mouseup', this._mouseUpListener); - this._dragScrollIntervalTimer = setInterval(function () { return _this._dragScroll(); }, DRAG_SCROLL_INTERVAL); - }; - SelectionManager.prototype._removeMouseDownListeners = function () { - this._terminal.element.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener); - this._terminal.element.ownerDocument.removeEventListener('mouseup', this._mouseUpListener); - clearInterval(this._dragScrollIntervalTimer); - this._dragScrollIntervalTimer = null; - }; - SelectionManager.prototype._onIncrementalClick = function (event) { - if (this._model.selectionStart) { - this._model.selectionEnd = this._getMouseBufferCoords(event); - } - }; - SelectionManager.prototype._onSingleClick = function (event) { - this._model.selectionStartLength = 0; - this._model.isSelectAllActive = false; - this._activeSelectionMode = SelectionMode.NORMAL; - this._model.selectionStart = this._getMouseBufferCoords(event); - if (!this._model.selectionStart) { - return; - } - this._model.selectionEnd = null; - var line = this._buffer.lines.get(this._model.selectionStart[1]); - if (!line) { - return; - } - if (line.length >= this._model.selectionStart[0]) { - return; - } - var char = line[this._model.selectionStart[0]]; - if (char[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 0) { - this._model.selectionStart[0]++; - } - }; - SelectionManager.prototype._onDoubleClick = function (event) { - var coords = this._getMouseBufferCoords(event); - if (coords) { - this._activeSelectionMode = SelectionMode.WORD; - this._selectWordAt(coords, true); - } - }; - SelectionManager.prototype._onTripleClick = function (event) { - var coords = this._getMouseBufferCoords(event); - if (coords) { - this._activeSelectionMode = SelectionMode.LINE; - this._selectLineAt(coords[1]); - } - }; - SelectionManager.prototype._onMouseMove = function (event) { - event.stopImmediatePropagation(); - var previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null; - this._model.selectionEnd = this._getMouseBufferCoords(event); - if (!this._model.selectionEnd) { - this.refresh(true); - return; - } - if (this._activeSelectionMode === SelectionMode.LINE) { - if (this._model.selectionEnd[1] < this._model.selectionStart[1]) { - this._model.selectionEnd[0] = 0; - } - else { - this._model.selectionEnd[0] = this._terminal.cols; - } - } - else if (this._activeSelectionMode === SelectionMode.WORD) { - this._selectToWordAt(this._model.selectionEnd); - } - this._dragScrollAmount = this._getMouseEventScrollAmount(event); - if (this._dragScrollAmount > 0) { - this._model.selectionEnd[0] = this._terminal.cols; - } - else if (this._dragScrollAmount < 0) { - this._model.selectionEnd[0] = 0; - } - if (this._model.selectionEnd[1] < this._buffer.lines.length) { - var char = this._buffer.lines.get(this._model.selectionEnd[1])[this._model.selectionEnd[0]]; - if (char && char[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 0) { - this._model.selectionEnd[0]++; - } - } - if (!previousSelectionEnd || - previousSelectionEnd[0] !== this._model.selectionEnd[0] || - previousSelectionEnd[1] !== this._model.selectionEnd[1]) { - this.refresh(true); - } - }; - SelectionManager.prototype._dragScroll = function () { - if (this._dragScrollAmount) { - this._terminal.scrollLines(this._dragScrollAmount, false); - if (this._dragScrollAmount > 0) { - this._model.selectionEnd = [this._terminal.cols - 1, Math.min(this._terminal.buffer.ydisp + this._terminal.rows, this._terminal.buffer.lines.length - 1)]; - } - else { - this._model.selectionEnd = [0, this._terminal.buffer.ydisp]; - } - this.refresh(); - } - }; - SelectionManager.prototype._onMouseUp = function (event) { - var timeElapsed = event.timeStamp - this._mouseDownTimeStamp; - this._removeMouseDownListeners(); - if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME) { - (new AltClickHandler_1.AltClickHandler(event, this._terminal)).move(); - } - else if (this.hasSelection) { - this._terminal.emit('selection'); - } - }; - SelectionManager.prototype._onBufferActivate = function (e) { - this.clearSelection(); - e.inactiveBuffer.lines.off('trim', this._trimListener); - e.activeBuffer.lines.on('trim', this._trimListener); - }; - SelectionManager.prototype._convertViewportColToCharacterIndex = function (bufferLine, coords) { - var charIndex = coords[0]; - for (var i = 0; coords[0] >= i; i++) { - var char = bufferLine[i]; - if (char[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 0) { - charIndex--; - } - else if (char[Buffer_1.CHAR_DATA_CHAR_INDEX].length > 1 && coords[0] !== i) { - charIndex += char[Buffer_1.CHAR_DATA_CHAR_INDEX].length - 1; - } - } - return charIndex; - }; - SelectionManager.prototype.setSelection = function (col, row, length) { - this._model.clearSelection(); - this._removeMouseDownListeners(); - this._model.selectionStart = [col, row]; - this._model.selectionStartLength = length; - this.refresh(); - }; - SelectionManager.prototype._getWordAt = function (coords, allowWhitespaceOnlySelection) { - var bufferLine = this._buffer.lines.get(coords[1]); - if (!bufferLine) { - return null; - } - var line = this._buffer.translateBufferLineToString(coords[1], false); - var startIndex = this._convertViewportColToCharacterIndex(bufferLine, coords); - var endIndex = startIndex; - var charOffset = coords[0] - startIndex; - var leftWideCharCount = 0; - var rightWideCharCount = 0; - var leftLongCharOffset = 0; - var rightLongCharOffset = 0; - if (line.charAt(startIndex) === ' ') { - while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') { - startIndex--; - } - while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') { - endIndex++; - } - } - else { - var startCol = coords[0]; - var endCol = coords[0]; - if (bufferLine[startCol][Buffer_1.CHAR_DATA_WIDTH_INDEX] === 0) { - leftWideCharCount++; - startCol--; - } - if (bufferLine[endCol][Buffer_1.CHAR_DATA_WIDTH_INDEX] === 2) { - rightWideCharCount++; - endCol++; - } - if (bufferLine[endCol][Buffer_1.CHAR_DATA_CHAR_INDEX].length > 1) { - rightLongCharOffset += bufferLine[endCol][Buffer_1.CHAR_DATA_CHAR_INDEX].length - 1; - endIndex += bufferLine[endCol][Buffer_1.CHAR_DATA_CHAR_INDEX].length - 1; - } - while (startCol > 0 && startIndex > 0 && !this._isCharWordSeparator(bufferLine[startCol - 1])) { - var char = bufferLine[startCol - 1]; - if (char[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 0) { - leftWideCharCount++; - startCol--; - } - else if (char[Buffer_1.CHAR_DATA_CHAR_INDEX].length > 1) { - leftLongCharOffset += char[Buffer_1.CHAR_DATA_CHAR_INDEX].length - 1; - startIndex -= char[Buffer_1.CHAR_DATA_CHAR_INDEX].length - 1; - } - startIndex--; - startCol--; - } - while (endCol < bufferLine.length && endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine[endCol + 1])) { - var char = bufferLine[endCol + 1]; - if (char[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 2) { - rightWideCharCount++; - endCol++; - } - else if (char[Buffer_1.CHAR_DATA_CHAR_INDEX].length > 1) { - rightLongCharOffset += char[Buffer_1.CHAR_DATA_CHAR_INDEX].length - 1; - endIndex += char[Buffer_1.CHAR_DATA_CHAR_INDEX].length - 1; - } - endIndex++; - endCol++; - } - } - endIndex++; - var start = startIndex - + charOffset - - leftWideCharCount - + leftLongCharOffset; - var length = Math.min(this._terminal.cols, endIndex - - startIndex - + leftWideCharCount - + rightWideCharCount - - leftLongCharOffset - - rightLongCharOffset); - if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') { - return null; - } - return { start: start, length: length }; - }; - SelectionManager.prototype._selectWordAt = function (coords, allowWhitespaceOnlySelection) { - var wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection); - if (wordPosition) { - this._model.selectionStart = [wordPosition.start, coords[1]]; - this._model.selectionStartLength = wordPosition.length; - } - }; - SelectionManager.prototype._selectToWordAt = function (coords) { - var wordPosition = this._getWordAt(coords, true); - if (wordPosition) { - this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : (wordPosition.start + wordPosition.length), coords[1]]; - } - }; - SelectionManager.prototype._isCharWordSeparator = function (charData) { - if (charData[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 0) { - return false; - } - return WORD_SEPARATORS.indexOf(charData[Buffer_1.CHAR_DATA_CHAR_INDEX]) >= 0; - }; - SelectionManager.prototype._selectLineAt = function (line) { - this._model.selectionStart = [0, line]; - this._model.selectionStartLength = this._terminal.cols; - }; - return SelectionManager; -}(EventEmitter_1.EventEmitter)); -exports.SelectionManager = SelectionManager; - - - -},{"./Buffer":1,"./EventEmitter":7,"./SelectionModel":12,"./handlers/AltClickHandler":16,"./shared/utils/Browser":30,"./utils/MouseHelper":33}],12:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var SelectionModel = (function () { - function SelectionModel(_terminal) { - this._terminal = _terminal; - this.clearSelection(); - } - SelectionModel.prototype.clearSelection = function () { - this.selectionStart = null; - this.selectionEnd = null; - this.isSelectAllActive = false; - this.selectionStartLength = 0; - }; - Object.defineProperty(SelectionModel.prototype, "finalSelectionStart", { - get: function () { - if (this.isSelectAllActive) { - return [0, 0]; - } - if (!this.selectionEnd || !this.selectionStart) { - return this.selectionStart; - } - return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SelectionModel.prototype, "finalSelectionEnd", { - get: function () { - if (this.isSelectAllActive) { - return [this._terminal.cols, this._terminal.buffer.ybase + this._terminal.rows - 1]; - } - if (!this.selectionStart) { - return null; - } - if (!this.selectionEnd || this.areSelectionValuesReversed()) { - return [this.selectionStart[0] + this.selectionStartLength, this.selectionStart[1]]; - } - if (this.selectionStartLength) { - if (this.selectionEnd[1] === this.selectionStart[1]) { - return [Math.max(this.selectionStart[0] + this.selectionStartLength, this.selectionEnd[0]), this.selectionEnd[1]]; - } - } - return this.selectionEnd; - }, - enumerable: true, - configurable: true - }); - SelectionModel.prototype.areSelectionValuesReversed = function () { - var start = this.selectionStart; - var end = this.selectionEnd; - if (!start || !end) { - return false; - } - return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]); - }; - SelectionModel.prototype.onTrim = function (amount) { - if (this.selectionStart) { - this.selectionStart[1] -= amount; - } - if (this.selectionEnd) { - this.selectionEnd[1] -= amount; - } - if (this.selectionEnd && this.selectionEnd[1] < 0) { - this.clearSelection(); - return true; - } - if (this.selectionStart && this.selectionStart[1] < 0) { - this.selectionStart[1] = 0; - } - return false; - }; - return SelectionModel; -}()); -exports.SelectionModel = SelectionModel; - - - -},{}],13:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var BufferSet_1 = require("./BufferSet"); -var Buffer_1 = require("./Buffer"); -var CompositionHelper_1 = require("./CompositionHelper"); -var EventEmitter_1 = require("./EventEmitter"); -var Viewport_1 = require("./Viewport"); -var Clipboard_1 = require("./handlers/Clipboard"); -var EscapeSequences_1 = require("./EscapeSequences"); -var InputHandler_1 = require("./InputHandler"); -var Parser_1 = require("./Parser"); -var Renderer_1 = require("./renderer/Renderer"); -var Linkifier_1 = require("./Linkifier"); -var SelectionManager_1 = require("./SelectionManager"); -var CharMeasure_1 = require("./utils/CharMeasure"); -var Browser = require("./shared/utils/Browser"); -var MouseHelper_1 = require("./utils/MouseHelper"); -var Sounds_1 = require("./utils/Sounds"); -var ColorManager_1 = require("./renderer/ColorManager"); -var MouseZoneManager_1 = require("./input/MouseZoneManager"); -var document = (typeof window !== 'undefined') ? window.document : null; -var WRITE_BUFFER_PAUSE_THRESHOLD = 5; -var WRITE_BATCH_SIZE = 300; -var DEFAULT_OPTIONS = { - cols: 80, - rows: 24, - convertEol: false, - termName: 'xterm', - cursorBlink: false, - cursorStyle: 'block', - bellSound: Sounds_1.BELL_SOUND, - bellStyle: 'none', - enableBold: true, - fontFamily: 'courier-new, courier, monospace', - fontSize: 15, - fontWeight: 'normal', - fontWeightBold: 'bold', - lineHeight: 1.0, - letterSpacing: 0, - scrollback: 1000, - screenKeys: false, - debug: false, - macOptionIsMeta: false, - cancelEvents: false, - disableStdin: false, - useFlowControl: false, - allowTransparency: false, - tabStopWidth: 8, - theme: null, - rightClickSelectsWord: Browser.isMac -}; -var Terminal = (function (_super) { - __extends(Terminal, _super); - function Terminal(options) { - if (options === void 0) { options = {}; } - var _this = _super.call(this) || this; - _this.browser = Browser; - _this.options = options; - _this.setup(); - return _this; - } - Terminal.prototype.setup = function () { - var _this = this; - Object.keys(DEFAULT_OPTIONS).forEach(function (key) { - if (_this.options[key] == null) { - _this.options[key] = DEFAULT_OPTIONS[key]; - } - _this[key] = _this.options[key]; - }); - this.parent = document ? document.body : null; - this.cols = this.options.cols; - this.rows = this.options.rows; - if (this.options.handler) { - this.on('data', this.options.handler); - } - this.cursorState = 0; - this.cursorHidden = false; - this.sendDataQueue = ''; - this.customKeyEventHandler = null; - this.applicationKeypad = false; - this.applicationCursor = false; - this.originMode = false; - this.insertMode = false; - this.wraparoundMode = true; - this.bracketedPasteMode = false; - this.charset = null; - this.gcharset = null; - this.glevel = 0; - this.charsets = [null]; - this.readable = true; - this.writable = true; - this.defAttr = (0 << 18) | (257 << 9) | (256 << 0); - this.curAttr = (0 << 18) | (257 << 9) | (256 << 0); - this.params = []; - this.currentParam = 0; - this.prefix = ''; - this.postfix = ''; - this.writeBuffer = []; - this.writeInProgress = false; - this.xoffSentToCatchUp = false; - this.writeStopped = false; - this.surrogateHigh = ''; - this.userScrolling = false; - this.inputHandler = new InputHandler_1.InputHandler(this); - this.parser = new Parser_1.Parser(this.inputHandler, this); - this.renderer = this.renderer || null; - this.selectionManager = this.selectionManager || null; - this.linkifier = this.linkifier || new Linkifier_1.Linkifier(this); - this._mouseZoneManager = this._mouseZoneManager || null; - this.buffers = new BufferSet_1.BufferSet(this); - if (this.selectionManager) { - this.selectionManager.clearSelection(); - this.selectionManager.initBuffersListeners(); - } - }; - Object.defineProperty(Terminal.prototype, "buffer", { - get: function () { - return this.buffers.active; - }, - enumerable: true, - configurable: true - }); - Terminal.prototype.eraseAttr = function () { - return (this.defAttr & ~0x1ff) | (this.curAttr & 0x1ff); - }; - Terminal.prototype.focus = function () { - if (this.textarea) { - this.textarea.focus(); - } - }; - Object.defineProperty(Terminal.prototype, "isFocused", { - get: function () { - return document.activeElement === this.textarea; - }, - enumerable: true, - configurable: true - }); - Terminal.prototype.getOption = function (key) { - if (!(key in DEFAULT_OPTIONS)) { - throw new Error('No option with key "' + key + '"'); - } - if (typeof this.options[key] !== 'undefined') { - return this.options[key]; - } - return this[key]; - }; - Terminal.prototype.setOption = function (key, value) { - if (!(key in DEFAULT_OPTIONS)) { - throw new Error('No option with key "' + key + '"'); - } - switch (key) { - case 'bellStyle': - if (!value) { - value = 'none'; - } - break; - case 'cursorStyle': - if (!value) { - value = 'block'; - } - break; - case 'fontWeight': - if (!value) { - value = 'normal'; - } - break; - case 'fontWeightBold': - if (!value) { - value = 'bold'; - } - break; - case 'lineHeight': - if (value < 1) { - console.warn(key + " cannot be less than 1, value: " + value); - return; - } - case 'tabStopWidth': - if (value < 1) { - console.warn(key + " cannot be less than 1, value: " + value); - return; - } - break; - case 'theme': - if (this.renderer) { - this._setTheme(value); - return; - } - break; - case 'scrollback': - value = Math.min(value, Buffer_1.MAX_BUFFER_SIZE); - if (value < 0) { - console.warn(key + " cannot be less than 0, value: " + value); - return; - } - if (this.options[key] !== value) { - var newBufferLength = this.rows + value; - if (this.buffer.lines.length > newBufferLength) { - var amountToTrim = this.buffer.lines.length - newBufferLength; - var needsRefresh = (this.buffer.ydisp - amountToTrim < 0); - this.buffer.lines.trimStart(amountToTrim); - this.buffer.ybase = Math.max(this.buffer.ybase - amountToTrim, 0); - this.buffer.ydisp = Math.max(this.buffer.ydisp - amountToTrim, 0); - if (needsRefresh) { - this.refresh(0, this.rows - 1); - } - } - } - break; - } - this[key] = value; - this.options[key] = value; - switch (key) { - case 'fontFamily': - case 'fontSize': - this.renderer.clear(); - this.charMeasure.measure(this.options); - break; - case 'enableBold': - case 'letterSpacing': - case 'lineHeight': - case 'fontWeight': - case 'fontWeightBold': - var didCharSizeChange = (key === 'fontWeight' || key === 'fontWeightBold' || key === 'enableBold'); - this.renderer.clear(); - this.renderer.onResize(this.cols, this.rows, didCharSizeChange); - this.refresh(0, this.rows - 1); - case 'scrollback': - this.buffers.resize(this.cols, this.rows); - this.viewport.syncScrollArea(); - break; - case 'tabStopWidth': - this.buffers.setupTabStops(); - break; - case 'bellSound': - case 'bellStyle': - this.syncBellSound(); - break; - } - if (this.renderer) { - this.renderer.onOptionsChanged(); - } - }; - Terminal.prototype._onTextAreaFocus = function () { - if (this.sendFocus) { - this.send(EscapeSequences_1.C0.ESC + '[I'); - } - this.element.classList.add('focus'); - this.showCursor(); - this.emit('focus'); - }; - Terminal.prototype.blur = function () { - return this.textarea.blur(); - }; - Terminal.prototype._onTextAreaBlur = function () { - this.refresh(this.buffer.y, this.buffer.y); - if (this.sendFocus) { - this.send(EscapeSequences_1.C0.ESC + '[O'); - } - this.element.classList.remove('focus'); - this.emit('blur'); - }; - Terminal.prototype.initGlobal = function () { - var _this = this; - this.bindKeys(); - on(this.element, 'copy', function (event) { - if (!_this.hasSelection()) { - return; - } - Clipboard_1.copyHandler(event, _this, _this.selectionManager); - }); - var pasteHandlerWrapper = function (event) { return Clipboard_1.pasteHandler(event, _this); }; - on(this.textarea, 'paste', pasteHandlerWrapper); - on(this.element, 'paste', pasteHandlerWrapper); - if (Browser.isFirefox) { - on(this.element, 'mousedown', function (event) { - if (event.button === 2) { - Clipboard_1.rightClickHandler(event, _this.textarea, _this.selectionManager, _this.options.rightClickSelectsWord); - } - }); - } - else { - on(this.element, 'contextmenu', function (event) { - Clipboard_1.rightClickHandler(event, _this.textarea, _this.selectionManager, _this.options.rightClickSelectsWord); - }); - } - if (Browser.isLinux) { - on(this.element, 'auxclick', function (event) { - if (event.button === 1) { - Clipboard_1.moveTextAreaUnderMouseCursor(event, _this.textarea); - } - }); - } - }; - Terminal.prototype.bindKeys = function () { - var _this = this; - var self = this; - on(this.element, 'keydown', function (ev) { - if (document.activeElement !== this) { - return; - } - self._keyDown(ev); - }, true); - on(this.element, 'keypress', function (ev) { - if (document.activeElement !== this) { - return; - } - self._keyPress(ev); - }, true); - on(this.element, 'keyup', function (ev) { - if (!wasMondifierKeyOnlyEvent(ev)) { - _this.focus(); - } - }, true); - on(this.textarea, 'keydown', function (ev) { - _this._keyDown(ev); - }, true); - on(this.textarea, 'keypress', function (ev) { - _this._keyPress(ev); - _this.textarea.value = ''; - }, true); - on(this.textarea, 'compositionstart', function () { return _this.compositionHelper.compositionstart(); }); - on(this.textarea, 'compositionupdate', function (e) { return _this.compositionHelper.compositionupdate(e); }); - on(this.textarea, 'compositionend', function () { return _this.compositionHelper.compositionend(); }); - this.on('refresh', function () { return _this.compositionHelper.updateCompositionElements(); }); - this.on('refresh', function (data) { return _this.queueLinkification(data.start, data.end); }); - }; - Terminal.prototype.open = function (parent) { - var _this = this; - var i = 0; - var div; - this.parent = parent || this.parent; - if (!this.parent) { - throw new Error('Terminal requires a parent element.'); - } - this.context = this.parent.ownerDocument.defaultView; - this.document = this.parent.ownerDocument; - this.body = this.document.body; - this.element = this.document.createElement('div'); - this.element.classList.add('terminal'); - this.element.classList.add('xterm'); - this.element.setAttribute('tabindex', '0'); - this.parent.appendChild(this.element); - var fragment = document.createDocumentFragment(); - this.viewportElement = document.createElement('div'); - this.viewportElement.classList.add('xterm-viewport'); - fragment.appendChild(this.viewportElement); - this.viewportScrollArea = document.createElement('div'); - this.viewportScrollArea.classList.add('xterm-scroll-area'); - this.viewportElement.appendChild(this.viewportScrollArea); - this.screenElement = document.createElement('div'); - this.screenElement.classList.add('xterm-screen'); - this.helperContainer = document.createElement('div'); - this.helperContainer.classList.add('xterm-helpers'); - this.screenElement.appendChild(this.helperContainer); - fragment.appendChild(this.screenElement); - this._mouseZoneManager = new MouseZoneManager_1.MouseZoneManager(this); - this.on('scroll', function () { return _this._mouseZoneManager.clearAll(); }); - this.linkifier.attachToDom(this._mouseZoneManager); - this.textarea = document.createElement('textarea'); - this.textarea.classList.add('xterm-helper-textarea'); - this.textarea.setAttribute('autocorrect', 'off'); - this.textarea.setAttribute('autocapitalize', 'off'); - this.textarea.setAttribute('spellcheck', 'false'); - this.textarea.tabIndex = 0; - this.textarea.addEventListener('focus', function () { return _this._onTextAreaFocus(); }); - this.textarea.addEventListener('blur', function () { return _this._onTextAreaBlur(); }); - this.helperContainer.appendChild(this.textarea); - this.compositionView = document.createElement('div'); - this.compositionView.classList.add('composition-view'); - this.compositionHelper = new CompositionHelper_1.CompositionHelper(this.textarea, this.compositionView, this); - this.helperContainer.appendChild(this.compositionView); - this.charSizeStyleElement = document.createElement('style'); - this.helperContainer.appendChild(this.charSizeStyleElement); - this.charMeasure = new CharMeasure_1.CharMeasure(document, this.helperContainer); - this.syncBellSound(); - this.element.appendChild(fragment); - this.renderer = new Renderer_1.Renderer(this, this.options.theme); - this.options.theme = null; - this.viewport = new Viewport_1.Viewport(this, this.viewportElement, this.viewportScrollArea, this.charMeasure); - this.viewport.onThemeChanged(this.renderer.colorManager.colors); - this.on('cursormove', function () { return _this.renderer.onCursorMove(); }); - this.on('resize', function () { return _this.renderer.onResize(_this.cols, _this.rows, false); }); - this.on('blur', function () { return _this.renderer.onBlur(); }); - this.on('focus', function () { return _this.renderer.onFocus(); }); - this.charMeasure.on('charsizechanged', function () { return _this.renderer.onResize(_this.cols, _this.rows, true); }); - this.renderer.on('resize', function (dimensions) { return _this.viewport.syncScrollArea(); }); - this.selectionManager = new SelectionManager_1.SelectionManager(this, this.charMeasure); - this.element.addEventListener('mousedown', function (e) { return _this.selectionManager.onMouseDown(e); }); - this.selectionManager.on('refresh', function (data) { return _this.renderer.onSelectionChanged(data.start, data.end); }); - this.selectionManager.on('newselection', function (text) { - _this.textarea.value = text; - _this.textarea.focus(); - _this.textarea.select(); - }); - this.on('scroll', function () { - _this.viewport.syncScrollArea(); - _this.selectionManager.refresh(); - }); - this.viewportElement.addEventListener('scroll', function () { return _this.selectionManager.refresh(); }); - this.mouseHelper = new MouseHelper_1.MouseHelper(this.renderer); - this.charMeasure.measure(this.options); - this.refresh(0, this.rows - 1); - this.initGlobal(); - this.bindMouse(); - }; - Terminal.prototype._setTheme = function (theme) { - var colors = this.renderer.setTheme(theme); - if (this.viewport) { - this.viewport.onThemeChanged(colors); - } - }; - Terminal.applyAddon = function (addon) { - addon.apply(Terminal); - }; - Terminal.prototype.bindMouse = function () { - var _this = this; - var el = this.element; - var self = this; - var pressed = 32; - function sendButton(ev) { - var button; - var pos; - button = getButton(ev); - pos = self.mouseHelper.getRawByteCoords(ev, self.screenElement, self.charMeasure, self.options.lineHeight, self.cols, self.rows); - if (!pos) - return; - sendEvent(button, pos); - switch (ev.overrideType || ev.type) { - case 'mousedown': - pressed = button; - break; - case 'mouseup': - pressed = 32; - break; - case 'wheel': - break; - } - } - function sendMove(ev) { - var button = pressed; - var pos = self.mouseHelper.getRawByteCoords(ev, self.screenElement, self.charMeasure, self.options.lineHeight, self.cols, self.rows); - if (!pos) - return; - button += 32; - sendEvent(button, pos); - } - function encode(data, ch) { - if (!self.utfMouse) { - if (ch === 255) { - data.push(0); - return; - } - if (ch > 127) - ch = 127; - data.push(ch); - } - else { - if (ch === 2047) { - data.push(0); - return; - } - if (ch < 127) { - data.push(ch); - } - else { - if (ch > 2047) - ch = 2047; - data.push(0xC0 | (ch >> 6)); - data.push(0x80 | (ch & 0x3F)); - } - } - } - function sendEvent(button, pos) { - if (self.vt300Mouse) { - button &= 3; - pos.x -= 32; - pos.y -= 32; - var data_1 = EscapeSequences_1.C0.ESC + '[24'; - if (button === 0) - data_1 += '1'; - else if (button === 1) - data_1 += '3'; - else if (button === 2) - data_1 += '5'; - else if (button === 3) - return; - else - data_1 += '0'; - data_1 += '~[' + pos.x + ',' + pos.y + ']\r'; - self.send(data_1); - return; - } - if (self.decLocator) { - button &= 3; - pos.x -= 32; - pos.y -= 32; - if (button === 0) - button = 2; - else if (button === 1) - button = 4; - else if (button === 2) - button = 6; - else if (button === 3) - button = 3; - self.send(EscapeSequences_1.C0.ESC + '[' - + button - + ';' - + (button === 3 ? 4 : 0) - + ';' - + pos.y - + ';' - + pos.x - + ';' - + pos.page || 0 - + '&w'); - return; - } - if (self.urxvtMouse) { - pos.x -= 32; - pos.y -= 32; - pos.x++; - pos.y++; - self.send(EscapeSequences_1.C0.ESC + '[' + button + ';' + pos.x + ';' + pos.y + 'M'); - return; - } - if (self.sgrMouse) { - pos.x -= 32; - pos.y -= 32; - self.send(EscapeSequences_1.C0.ESC + '[<' - + (((button & 3) === 3 ? button & ~3 : button) - 32) - + ';' - + pos.x - + ';' - + pos.y - + ((button & 3) === 3 ? 'm' : 'M')); - return; - } - var data = []; - encode(data, button); - encode(data, pos.x); - encode(data, pos.y); - self.send(EscapeSequences_1.C0.ESC + '[M' + String.fromCharCode.apply(String, data)); - } - function getButton(ev) { - var button; - var shift; - var meta; - var ctrl; - var mod; - switch (ev.overrideType || ev.type) { - case 'mousedown': - button = ev.button != null - ? +ev.button - : ev.which != null - ? ev.which - 1 - : null; - if (Browser.isMSIE) { - button = button === 1 ? 0 : button === 4 ? 1 : button; - } - break; - case 'mouseup': - button = 3; - break; - case 'DOMMouseScroll': - button = ev.detail < 0 - ? 64 - : 65; - break; - case 'wheel': - button = ev.wheelDeltaY > 0 - ? 64 - : 65; - break; - } - shift = ev.shiftKey ? 4 : 0; - meta = ev.metaKey ? 8 : 0; - ctrl = ev.ctrlKey ? 16 : 0; - mod = shift | meta | ctrl; - if (self.vt200Mouse) { - mod &= ctrl; - } - else if (!self.normalMouse) { - mod = 0; - } - button = (32 + (mod << 2)) + button; - return button; - } - on(el, 'mousedown', function (ev) { - ev.preventDefault(); - _this.focus(); - if (!_this.mouseEvents || _this.selectionManager.shouldForceSelection(ev)) { - return; - } - sendButton(ev); - if (_this.vt200Mouse) { - ev.overrideType = 'mouseup'; - sendButton(ev); - return _this.cancel(ev); - } - if (_this.normalMouse) - on(_this.document, 'mousemove', sendMove); - if (!_this.x10Mouse) { - var handler_1 = function (ev) { - sendButton(ev); - if (_this.normalMouse) - off(_this.document, 'mousemove', sendMove); - off(_this.document, 'mouseup', handler_1); - return _this.cancel(ev); - }; - on(_this.document, 'mouseup', handler_1); - } - return _this.cancel(ev); - }); - on(el, 'wheel', function (ev) { - if (!_this.mouseEvents) - return; - if (_this.x10Mouse || _this.vt300Mouse || _this.decLocator) - return; - sendButton(ev); - ev.preventDefault(); - }); - on(el, 'wheel', function (ev) { - if (_this.mouseEvents) - return; - _this.viewport.onWheel(ev); - return _this.cancel(ev); - }); - on(el, 'touchstart', function (ev) { - if (_this.mouseEvents) - return; - _this.viewport.onTouchStart(ev); - return _this.cancel(ev); - }); - on(el, 'touchmove', function (ev) { - if (_this.mouseEvents) - return; - _this.viewport.onTouchMove(ev); - return _this.cancel(ev); - }); - }; - Terminal.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.readable = false; - this.writable = false; - this.handler = function () { }; - this.write = function () { }; - if (this.element && this.element.parentNode) { - this.element.parentNode.removeChild(this.element); - } - }; - Terminal.prototype.refresh = function (start, end) { - if (this.renderer) { - this.renderer.queueRefresh(start, end); - } - }; - Terminal.prototype.queueLinkification = function (start, end) { - if (this.linkifier) { - this.linkifier.linkifyRows(start, end); - } - }; - Terminal.prototype.showCursor = function () { - if (!this.cursorState) { - this.cursorState = 1; - this.refresh(this.buffer.y, this.buffer.y); - } - }; - Terminal.prototype.scroll = function (isWrapped) { - var newLine = this.blankLine(undefined, isWrapped); - var topRow = this.buffer.ybase + this.buffer.scrollTop; - var bottomRow = this.buffer.ybase + this.buffer.scrollBottom; - if (this.buffer.scrollTop === 0) { - var willBufferBeTrimmed = this.buffer.lines.length === this.buffer.lines.maxLength; - if (bottomRow === this.buffer.lines.length - 1) { - this.buffer.lines.push(newLine); - } - else { - this.buffer.lines.splice(bottomRow + 1, 0, newLine); - } - if (!willBufferBeTrimmed) { - this.buffer.ybase++; - if (!this.userScrolling) { - this.buffer.ydisp++; - } - } - else { - if (this.userScrolling) { - this.buffer.ydisp = Math.max(this.buffer.ydisp - 1, 0); - } - } - } - else { - var scrollRegionHeight = bottomRow - topRow + 1; - this.buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1); - this.buffer.lines.set(bottomRow, newLine); - } - if (!this.userScrolling) { - this.buffer.ydisp = this.buffer.ybase; - } - this.updateRange(this.buffer.scrollTop); - this.updateRange(this.buffer.scrollBottom); - this.emit('scroll', this.buffer.ydisp); - }; - Terminal.prototype.scrollLines = function (disp, suppressScrollEvent) { - if (disp < 0) { - if (this.buffer.ydisp === 0) { - return; - } - this.userScrolling = true; - } - else if (disp + this.buffer.ydisp >= this.buffer.ybase) { - this.userScrolling = false; - } - var oldYdisp = this.buffer.ydisp; - this.buffer.ydisp = Math.max(Math.min(this.buffer.ydisp + disp, this.buffer.ybase), 0); - if (oldYdisp === this.buffer.ydisp) { - return; - } - if (!suppressScrollEvent) { - this.emit('scroll', this.buffer.ydisp); - } - this.refresh(0, this.rows - 1); - }; - Terminal.prototype.scrollPages = function (pageCount) { - this.scrollLines(pageCount * (this.rows - 1)); - }; - Terminal.prototype.scrollToTop = function () { - this.scrollLines(-this.buffer.ydisp); - }; - Terminal.prototype.scrollToBottom = function () { - this.scrollLines(this.buffer.ybase - this.buffer.ydisp); - }; - Terminal.prototype.write = function (data) { - var _this = this; - this.writeBuffer.push(data); - if (this.options.useFlowControl && !this.xoffSentToCatchUp && this.writeBuffer.length >= WRITE_BUFFER_PAUSE_THRESHOLD) { - this.send(EscapeSequences_1.C0.DC3); - this.xoffSentToCatchUp = true; - } - if (!this.writeInProgress && this.writeBuffer.length > 0) { - this.writeInProgress = true; - setTimeout(function () { - _this.innerWrite(); - }); - } - }; - Terminal.prototype.innerWrite = function () { - var _this = this; - var writeBatch = this.writeBuffer.splice(0, WRITE_BATCH_SIZE); - while (writeBatch.length > 0) { - var data = writeBatch.shift(); - if (this.xoffSentToCatchUp && writeBatch.length === 0 && this.writeBuffer.length === 0) { - this.send(EscapeSequences_1.C0.DC1); - this.xoffSentToCatchUp = false; - } - this.refreshStart = this.buffer.y; - this.refreshEnd = this.buffer.y; - var state = this.parser.parse(data); - this.parser.setState(state); - this.updateRange(this.buffer.y); - this.refresh(this.refreshStart, this.refreshEnd); - } - if (this.writeBuffer.length > 0) { - setTimeout(function () { return _this.innerWrite(); }, 0); - } - else { - this.writeInProgress = false; - } - }; - Terminal.prototype.writeln = function (data) { - this.write(data + '\r\n'); - }; - Terminal.prototype.attachCustomKeyEventHandler = function (customKeyEventHandler) { - this.customKeyEventHandler = customKeyEventHandler; - }; - Terminal.prototype.setHypertextLinkHandler = function (handler) { - if (!this.linkifier) { - throw new Error('Cannot attach a hypertext link handler before Terminal.open is called'); - } - this.linkifier.setHypertextLinkHandler(handler); - this.refresh(0, this.rows - 1); - }; - Terminal.prototype.setHypertextValidationCallback = function (callback) { - if (!this.linkifier) { - throw new Error('Cannot attach a hypertext validation callback before Terminal.open is called'); - } - this.linkifier.setHypertextValidationCallback(callback); - this.refresh(0, this.rows - 1); - }; - Terminal.prototype.registerLinkMatcher = function (regex, handler, options) { - if (this.linkifier) { - var matcherId = this.linkifier.registerLinkMatcher(regex, handler, options); - this.refresh(0, this.rows - 1); - return matcherId; - } - return 0; - }; - Terminal.prototype.deregisterLinkMatcher = function (matcherId) { - if (this.linkifier) { - if (this.linkifier.deregisterLinkMatcher(matcherId)) { - this.refresh(0, this.rows - 1); - } - } - }; - Terminal.prototype.hasSelection = function () { - return this.selectionManager ? this.selectionManager.hasSelection : false; - }; - Terminal.prototype.getSelection = function () { - return this.selectionManager ? this.selectionManager.selectionText : ''; - }; - Terminal.prototype.clearSelection = function () { - if (this.selectionManager) { - this.selectionManager.clearSelection(); - } - }; - Terminal.prototype.selectAll = function () { - if (this.selectionManager) { - this.selectionManager.selectAll(); - } - }; - Terminal.prototype._keyDown = function (ev) { - if (this.customKeyEventHandler && this.customKeyEventHandler(ev) === false) { - return false; - } - if (!this.compositionHelper.keydown(ev)) { - if (this.buffer.ybase !== this.buffer.ydisp) { - this.scrollToBottom(); - } - return false; - } - var result = this._evaluateKeyEscapeSequence(ev); - if (result.key === EscapeSequences_1.C0.DC3) { - this.writeStopped = true; - } - else if (result.key === EscapeSequences_1.C0.DC1) { - this.writeStopped = false; - } - if (result.scrollLines) { - this.scrollLines(result.scrollLines); - return this.cancel(ev, true); - } - if (this._isThirdLevelShift(this.browser, ev)) { - return true; - } - if (result.cancel) { - this.cancel(ev, true); - } - if (!result.key) { - return true; - } - this.emit('keydown', ev); - this.emit('key', result.key, ev); - this.showCursor(); - this.handler(result.key); - return this.cancel(ev, true); - }; - Terminal.prototype._isThirdLevelShift = function (browser, ev) { - var thirdLevelKey = (browser.isMac && !this.options.macOptionIsMeta && ev.altKey && !ev.ctrlKey && !ev.metaKey) || - (browser.isMSWindows && ev.altKey && ev.ctrlKey && !ev.metaKey); - if (ev.type === 'keypress') { - return thirdLevelKey; - } - return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47); - }; - Terminal.prototype._evaluateKeyEscapeSequence = function (ev) { - var result = { - cancel: false, - key: undefined, - scrollLines: undefined - }; - var modifiers = (ev.shiftKey ? 1 : 0) | (ev.altKey ? 2 : 0) | (ev.ctrlKey ? 4 : 0) | (ev.metaKey ? 8 : 0); - switch (ev.keyCode) { - case 0: - if (ev.key === 'UIKeyInputUpArrow') { - if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OA'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[A'; - } - } - else if (ev.key === 'UIKeyInputLeftArrow') { - if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OD'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[D'; - } - } - else if (ev.key === 'UIKeyInputRightArrow') { - if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OC'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[C'; - } - } - else if (ev.key === 'UIKeyInputDownArrow') { - if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OB'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[B'; - } - } - break; - case 8: - if (ev.shiftKey) { - result.key = EscapeSequences_1.C0.BS; - break; - } - else if (ev.altKey) { - result.key = EscapeSequences_1.C0.ESC + EscapeSequences_1.C0.DEL; - break; - } - result.key = EscapeSequences_1.C0.DEL; - break; - case 9: - if (ev.shiftKey) { - result.key = EscapeSequences_1.C0.ESC + '[Z'; - break; - } - result.key = EscapeSequences_1.C0.HT; - result.cancel = true; - break; - case 13: - result.key = EscapeSequences_1.C0.CR; - result.cancel = true; - break; - case 27: - result.key = EscapeSequences_1.C0.ESC; - result.cancel = true; - break; - case 37: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'D'; - if (result.key === EscapeSequences_1.C0.ESC + '[1;3D') { - result.key = (this.browser.isMac) ? EscapeSequences_1.C0.ESC + 'b' : EscapeSequences_1.C0.ESC + '[1;5D'; - } - } - else if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OD'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[D'; - } - break; - case 39: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'C'; - if (result.key === EscapeSequences_1.C0.ESC + '[1;3C') { - result.key = (this.browser.isMac) ? EscapeSequences_1.C0.ESC + 'f' : EscapeSequences_1.C0.ESC + '[1;5C'; - } - } - else if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OC'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[C'; - } - break; - case 38: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'A'; - if (result.key === EscapeSequences_1.C0.ESC + '[1;3A') { - result.key = EscapeSequences_1.C0.ESC + '[1;5A'; - } - } - else if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OA'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[A'; - } - break; - case 40: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'B'; - if (result.key === EscapeSequences_1.C0.ESC + '[1;3B') { - result.key = EscapeSequences_1.C0.ESC + '[1;5B'; - } - } - else if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OB'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[B'; - } - break; - case 45: - if (!ev.shiftKey && !ev.ctrlKey) { - result.key = EscapeSequences_1.C0.ESC + '[2~'; - } - break; - case 46: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[3;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[3~'; - } - break; - case 36: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'H'; - } - else if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OH'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[H'; - } - break; - case 35: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'F'; - } - else if (this.applicationCursor) { - result.key = EscapeSequences_1.C0.ESC + 'OF'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[F'; - } - break; - case 33: - if (ev.shiftKey) { - result.scrollLines = -(this.rows - 1); - } - else { - result.key = EscapeSequences_1.C0.ESC + '[5~'; - } - break; - case 34: - if (ev.shiftKey) { - result.scrollLines = this.rows - 1; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[6~'; - } - break; - case 112: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'P'; - } - else { - result.key = EscapeSequences_1.C0.ESC + 'OP'; - } - break; - case 113: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'Q'; - } - else { - result.key = EscapeSequences_1.C0.ESC + 'OQ'; - } - break; - case 114: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'R'; - } - else { - result.key = EscapeSequences_1.C0.ESC + 'OR'; - } - break; - case 115: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'S'; - } - else { - result.key = EscapeSequences_1.C0.ESC + 'OS'; - } - break; - case 116: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[15;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[15~'; - } - break; - case 117: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[17;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[17~'; - } - break; - case 118: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[18;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[18~'; - } - break; - case 119: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[19;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[19~'; - } - break; - case 120: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[20;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[20~'; - } - break; - case 121: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[21;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[21~'; - } - break; - case 122: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[23;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[23~'; - } - break; - case 123: - if (modifiers) { - result.key = EscapeSequences_1.C0.ESC + '[24;' + (modifiers + 1) + '~'; - } - else { - result.key = EscapeSequences_1.C0.ESC + '[24~'; - } - break; - default: - if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) { - if (ev.keyCode >= 65 && ev.keyCode <= 90) { - result.key = String.fromCharCode(ev.keyCode - 64); - } - else if (ev.keyCode === 32) { - result.key = String.fromCharCode(0); - } - else if (ev.keyCode >= 51 && ev.keyCode <= 55) { - result.key = String.fromCharCode(ev.keyCode - 51 + 27); - } - else if (ev.keyCode === 56) { - result.key = String.fromCharCode(127); - } - else if (ev.keyCode === 219) { - result.key = String.fromCharCode(27); - } - else if (ev.keyCode === 220) { - result.key = String.fromCharCode(28); - } - else if (ev.keyCode === 221) { - result.key = String.fromCharCode(29); - } - } - else if ((!this.browser.isMac || this.options.macOptionIsMeta) && ev.altKey && !ev.ctrlKey && !ev.metaKey) { - if (ev.keyCode >= 65 && ev.keyCode <= 90) { - result.key = EscapeSequences_1.C0.ESC + String.fromCharCode(ev.keyCode + 32); - } - else if (ev.keyCode === 192) { - result.key = EscapeSequences_1.C0.ESC + '`'; - } - else if (ev.keyCode >= 48 && ev.keyCode <= 57) { - result.key = EscapeSequences_1.C0.ESC + (ev.keyCode - 48); - } - } - else if (this.browser.isMac && !ev.altKey && !ev.ctrlKey && ev.metaKey) { - if (ev.keyCode === 65) { - this.selectAll(); - } - } - break; - } - return result; - }; - Terminal.prototype.setgLevel = function (g) { - this.glevel = g; - this.charset = this.charsets[g]; - }; - Terminal.prototype.setgCharset = function (g, charset) { - this.charsets[g] = charset; - if (this.glevel === g) { - this.charset = charset; - } - }; - Terminal.prototype._keyPress = function (ev) { - var key; - if (this.customKeyEventHandler && this.customKeyEventHandler(ev) === false) { - return false; - } - this.cancel(ev); - if (ev.charCode) { - key = ev.charCode; - } - else if (ev.which == null) { - key = ev.keyCode; - } - else if (ev.which !== 0 && ev.charCode !== 0) { - key = ev.which; - } - else { - return false; - } - if (!key || ((ev.altKey || ev.ctrlKey || ev.metaKey) && !this._isThirdLevelShift(this.browser, ev))) { - return false; - } - key = String.fromCharCode(key); - this.emit('keypress', key, ev); - this.emit('key', key, ev); - this.showCursor(); - this.handler(key); - return true; - }; - Terminal.prototype.send = function (data) { - var _this = this; - if (!this.sendDataQueue) { - setTimeout(function () { - _this.handler(_this.sendDataQueue); - _this.sendDataQueue = ''; - }, 1); - } - this.sendDataQueue += data; - }; - Terminal.prototype.bell = function () { - var _this = this; - this.emit('bell'); - if (this.soundBell()) - this.bellAudioElement.play(); - if (this.visualBell()) { - this.element.classList.add('visual-bell-active'); - clearTimeout(this.visualBellTimer); - this.visualBellTimer = window.setTimeout(function () { - _this.element.classList.remove('visual-bell-active'); - }, 200); - } - }; - Terminal.prototype.log = function (text, data) { - if (!this.options.debug) - return; - if (!this.context.console || !this.context.console.log) - return; - this.context.console.log(text, data); - }; - Terminal.prototype.error = function (text, data) { - if (!this.options.debug) - return; - if (!this.context.console || !this.context.console.error) - return; - this.context.console.error(text, data); - }; - Terminal.prototype.resize = function (x, y) { - if (isNaN(x) || isNaN(y)) { - return; - } - if (x === this.cols && y === this.rows) { - if (!this.charMeasure.width || !this.charMeasure.height) { - this.charMeasure.measure(this.options); - } - return; - } - if (x < 1) - x = 1; - if (y < 1) - y = 1; - this.buffers.resize(x, y); - this.cols = x; - this.rows = y; - this.buffers.setupTabStops(this.cols); - this.charMeasure.measure(this.options); - this.refresh(0, this.rows - 1); - this.emit('resize', { cols: x, rows: y }); - }; - Terminal.prototype.updateRange = function (y) { - if (y < this.refreshStart) - this.refreshStart = y; - if (y > this.refreshEnd) - this.refreshEnd = y; - }; - Terminal.prototype.maxRange = function () { - this.refreshStart = 0; - this.refreshEnd = this.rows - 1; - }; - Terminal.prototype.eraseRight = function (x, y) { - var line = this.buffer.lines.get(this.buffer.ybase + y); - if (!line) { - return; - } - var ch = [this.eraseAttr(), ' ', 1, 32]; - for (; x < this.cols; x++) { - line[x] = ch; - } - this.updateRange(y); - }; - Terminal.prototype.eraseLeft = function (x, y) { - var line = this.buffer.lines.get(this.buffer.ybase + y); - if (!line) { - return; - } - var ch = [this.eraseAttr(), ' ', 1, 32]; - x++; - while (x--) { - line[x] = ch; - } - this.updateRange(y); - }; - Terminal.prototype.clear = function () { - if (this.buffer.ybase === 0 && this.buffer.y === 0) { - return; - } - 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 (var i = 1; i < this.rows; i++) { - this.buffer.lines.push(this.blankLine()); - } - this.refresh(0, this.rows - 1); - this.emit('scroll', this.buffer.ydisp); - }; - Terminal.prototype.eraseLine = function (y) { - this.eraseRight(0, y); - }; - Terminal.prototype.blankLine = function (cur, isWrapped, cols) { - var attr = cur ? this.eraseAttr() : this.defAttr; - var ch = [attr, ' ', 1, 32]; - var line = []; - if (isWrapped) { - line.isWrapped = isWrapped; - } - cols = cols || this.cols; - for (var i = 0; i < cols; i++) { - line[i] = ch; - } - return line; - }; - Terminal.prototype.ch = function (cur) { - if (cur) { - return [this.eraseAttr(), ' ', 1, 32]; - } - return [this.defAttr, ' ', 1, 32]; - }; - Terminal.prototype.is = function (term) { - return (this.options.termName + '').indexOf(term) === 0; - }; - Terminal.prototype.handler = function (data) { - if (this.options.disableStdin) { - return; - } - if (this.selectionManager && this.selectionManager.hasSelection) { - this.selectionManager.clearSelection(); - } - if (this.buffer.ybase !== this.buffer.ydisp) { - this.scrollToBottom(); - } - this.emit('data', data); - }; - Terminal.prototype.handleTitle = function (title) { - this.emit('title', title); - }; - Terminal.prototype.index = function () { - this.buffer.y++; - if (this.buffer.y > this.buffer.scrollBottom) { - this.buffer.y--; - this.scroll(); - } - if (this.buffer.x >= this.cols) { - this.buffer.x--; - } - }; - Terminal.prototype.reverseIndex = function () { - if (this.buffer.y === this.buffer.scrollTop) { - var scrollRegionHeight = this.buffer.scrollBottom - this.buffer.scrollTop; - this.buffer.lines.shiftElements(this.buffer.y + this.buffer.ybase, scrollRegionHeight, 1); - this.buffer.lines.set(this.buffer.y + this.buffer.ybase, this.blankLine(true)); - this.updateRange(this.buffer.scrollTop); - this.updateRange(this.buffer.scrollBottom); - } - else { - this.buffer.y--; - } - }; - Terminal.prototype.reset = function () { - this.options.rows = this.rows; - this.options.cols = this.cols; - var customKeyEventHandler = this.customKeyEventHandler; - var inputHandler = this.inputHandler; - this.setup(); - this.customKeyEventHandler = customKeyEventHandler; - this.inputHandler = inputHandler; - this.refresh(0, this.rows - 1); - this.viewport.syncScrollArea(); - }; - Terminal.prototype.tabSet = function () { - this.buffer.tabs[this.buffer.x] = true; - }; - Terminal.prototype.cancel = function (ev, force) { - if (!this.options.cancelEvents && !force) { - return; - } - ev.preventDefault(); - ev.stopPropagation(); - return false; - }; - Terminal.prototype.matchColor = function (r1, g1, b1) { - return matchColor_(r1, g1, b1); - }; - Terminal.prototype.visualBell = function () { - return false; - }; - Terminal.prototype.soundBell = function () { - return this.options.bellStyle === 'sound'; - }; - Terminal.prototype.syncBellSound = function () { - if (!this.element) { - return; - } - if (this.soundBell() && this.bellAudioElement) { - this.bellAudioElement.setAttribute('src', this.options.bellSound); - } - else if (this.soundBell()) { - this.bellAudioElement = document.createElement('audio'); - this.bellAudioElement.setAttribute('preload', 'auto'); - this.bellAudioElement.setAttribute('src', this.options.bellSound); - this.helperContainer.appendChild(this.bellAudioElement); - } - else if (this.bellAudioElement) { - this.helperContainer.removeChild(this.bellAudioElement); - } - }; - return Terminal; -}(EventEmitter_1.EventEmitter)); -exports.Terminal = Terminal; -function globalOn(el, type, handler, capture) { - if (!Array.isArray(el)) { - el = [el]; - } - el.forEach(function (element) { - element.addEventListener(type, handler, capture || false); - }); -} -var on = globalOn; -function off(el, type, handler, capture) { - if (capture === void 0) { capture = false; } - el.removeEventListener(type, handler, capture); -} -function wasMondifierKeyOnlyEvent(ev) { - return ev.keyCode === 16 || - ev.keyCode === 17 || - ev.keyCode === 18; -} -var vcolors = (function () { - var result = ColorManager_1.DEFAULT_ANSI_COLORS.map(function (c) { - c = c.substring(1); - return [ - parseInt(c.substring(0, 2), 16), - parseInt(c.substring(2, 4), 16), - parseInt(c.substring(4, 6), 16) - ]; - }); - var r = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff]; - for (var i = 0; i < 216; i++) { - result.push([ - r[(i / 36) % 6 | 0], - r[(i / 6) % 6 | 0], - r[i % 6] - ]); - } - var c; - for (var i = 0; i < 24; i++) { - c = 8 + i * 10; - result.push([c, c, c]); - } - return result; -})(); -var matchColorCache = {}; -function matchColorDistance(r1, g1, b1, r2, g2, b2) { - return Math.pow(30 * (r1 - r2), 2) - + Math.pow(59 * (g1 - g2), 2) - + Math.pow(11 * (b1 - b2), 2); -} -function matchColor_(r1, g1, b1) { - var hash = (r1 << 16) | (g1 << 8) | b1; - if (matchColorCache[hash] != null) { - return matchColorCache[hash]; - } - var ldiff = Infinity; - var li = -1; - var i = 0; - var c; - var r2; - var g2; - var b2; - var diff; - for (; i < vcolors.length; i++) { - c = vcolors[i]; - r2 = c[0]; - g2 = c[1]; - b2 = c[2]; - diff = matchColorDistance(r1, g1, b1, r2, g2, b2); - if (diff === 0) { - li = i; - break; - } - if (diff < ldiff) { - ldiff = diff; - li = i; - } - } - return matchColorCache[hash] = li; -} - - - -},{"./Buffer":1,"./BufferSet":2,"./CompositionHelper":5,"./EscapeSequences":6,"./EventEmitter":7,"./InputHandler":8,"./Linkifier":9,"./Parser":10,"./SelectionManager":11,"./Viewport":15,"./handlers/Clipboard":17,"./input/MouseZoneManager":18,"./renderer/ColorManager":21,"./renderer/Renderer":25,"./shared/utils/Browser":30,"./utils/CharMeasure":31,"./utils/MouseHelper":33,"./utils/Sounds":35}],14:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var LinkHoverEventTypes; -(function (LinkHoverEventTypes) { - LinkHoverEventTypes["HOVER"] = "linkhover"; - LinkHoverEventTypes["TOOLTIP"] = "linktooltip"; - LinkHoverEventTypes["LEAVE"] = "linkleave"; -})(LinkHoverEventTypes = exports.LinkHoverEventTypes || (exports.LinkHoverEventTypes = {})); - - - -},{}],15:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var FALLBACK_SCROLL_BAR_WIDTH = 15; -var Viewport = (function () { - function Viewport(terminal, viewportElement, scrollArea, charMeasure) { - var _this = this; - this.terminal = terminal; - this.viewportElement = viewportElement; - this.scrollArea = scrollArea; - this.charMeasure = charMeasure; - this.scrollBarWidth = 0; - this.currentRowHeight = 0; - this.lastRecordedBufferLength = 0; - this.lastRecordedViewportHeight = 0; - this.lastRecordedBufferHeight = 0; - this.scrollBarWidth = (this.viewportElement.offsetWidth - this.scrollArea.offsetWidth) || FALLBACK_SCROLL_BAR_WIDTH; - this.viewportElement.addEventListener('scroll', this.onScroll.bind(this)); - setTimeout(function () { return _this.syncScrollArea(); }, 0); - } - Viewport.prototype.onThemeChanged = function (colors) { - this.viewportElement.style.backgroundColor = colors.background; - }; - Viewport.prototype.refresh = function () { - if (this.charMeasure.height > 0) { - this.currentRowHeight = this.terminal.renderer.dimensions.scaledCellHeight / window.devicePixelRatio; - this.lastRecordedViewportHeight = this.viewportElement.offsetHeight; - var newBufferHeight = Math.round(this.currentRowHeight * this.lastRecordedBufferLength) + (this.lastRecordedViewportHeight - this.terminal.renderer.dimensions.canvasHeight); - if (this.lastRecordedBufferHeight !== newBufferHeight) { - this.lastRecordedBufferHeight = newBufferHeight; - this.scrollArea.style.height = this.lastRecordedBufferHeight + 'px'; - } - } - }; - Viewport.prototype.syncScrollArea = function () { - if (this.lastRecordedBufferLength !== this.terminal.buffer.lines.length) { - this.lastRecordedBufferLength = this.terminal.buffer.lines.length; - this.refresh(); - } - else if (this.lastRecordedViewportHeight !== this.terminal.renderer.dimensions.canvasHeight) { - this.refresh(); - } - else { - if (this.terminal.renderer.dimensions.scaledCellHeight / window.devicePixelRatio !== this.currentRowHeight) { - this.refresh(); - } - } - var scrollTop = this.terminal.buffer.ydisp * this.currentRowHeight; - if (this.viewportElement.scrollTop !== scrollTop) { - this.viewportElement.scrollTop = scrollTop; - } - }; - Viewport.prototype.onScroll = function (ev) { - if (!this.viewportElement.offsetParent) { - return; - } - var newRow = Math.round(this.viewportElement.scrollTop / this.currentRowHeight); - var diff = newRow - this.terminal.buffer.ydisp; - this.terminal.scrollLines(diff, true); - }; - Viewport.prototype.onWheel = function (ev) { - if (ev.deltaY === 0) { - return; - } - var multiplier = 1; - if (ev.deltaMode === WheelEvent.DOM_DELTA_LINE) { - multiplier = this.currentRowHeight; - } - else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) { - multiplier = this.currentRowHeight * this.terminal.rows; - } - this.viewportElement.scrollTop += ev.deltaY * multiplier; - ev.preventDefault(); - }; - Viewport.prototype.onTouchStart = function (ev) { - this.lastTouchY = ev.touches[0].pageY; - }; - Viewport.prototype.onTouchMove = function (ev) { - var deltaY = this.lastTouchY - ev.touches[0].pageY; - this.lastTouchY = ev.touches[0].pageY; - if (deltaY === 0) { - return; - } - this.viewportElement.scrollTop += deltaY; - ev.preventDefault(); - }; - return Viewport; -}()); -exports.Viewport = Viewport; - - - -},{}],16:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var EscapeSequences_1 = require("../EscapeSequences"); -var Direction; -(function (Direction) { - Direction["Up"] = "A"; - Direction["Down"] = "B"; - Direction["Right"] = "C"; - Direction["Left"] = "D"; -})(Direction || (Direction = {})); -var AltClickHandler = (function () { - function AltClickHandler(_mouseEvent, _terminal) { - this._mouseEvent = _mouseEvent; - this._terminal = _terminal; - this._lines = this._terminal.buffer.lines; - this._startCol = this._terminal.buffer.x; - this._startRow = this._terminal.buffer.y; - _a = this._terminal.mouseHelper.getCoords(this._mouseEvent, this._terminal.element, this._terminal.charMeasure, this._terminal.options.lineHeight, this._terminal.cols, this._terminal.rows, false).map(function (coordinate) { - return coordinate - 1; - }), this._endCol = _a[0], this._endRow = _a[1]; - var _a; - } - AltClickHandler.prototype.move = function () { - if (this._mouseEvent.altKey) { - this._terminal.send(this._arrowSequences()); - } - }; - AltClickHandler.prototype._arrowSequences = function () { - return this._resetStartingRow() + - this._moveToRequestedRow() + - this._moveToRequestedCol(); - }; - AltClickHandler.prototype._resetStartingRow = function () { - var startRow = this._endRow - this._wrappedRowsForRow(this._endRow); - var endRow = this._endRow; - if (this._moveToRequestedRow().length === 0) { - return ''; - } - else { - return repeat(this._bufferLine(this._startCol, this._startRow, this._startCol, this._startRow - this._wrappedRowsForRow(this._startRow), false).length, this._sequence(Direction.Left)); - } - }; - AltClickHandler.prototype._moveToRequestedRow = function () { - var startRow = this._startRow - this._wrappedRowsForRow(this._startRow); - var endRow = this._endRow - this._wrappedRowsForRow(this._endRow); - var rowsToMove = Math.abs(startRow - endRow) - this._wrappedRowsCount(); - return repeat(rowsToMove, this._sequence(this._verticalDirection())); - }; - AltClickHandler.prototype._moveToRequestedCol = function () { - var startRow; - if (this._moveToRequestedRow().length > 0) { - startRow = this._endRow - this._wrappedRowsForRow(this._endRow); - } - else { - startRow = this._startRow; - } - var endRow = this._endRow; - var direction = this._horizontalDirection(); - return repeat(this._bufferLine(this._startCol, startRow, this._endCol, endRow, direction === Direction.Right).length, this._sequence(direction)); - }; - AltClickHandler.prototype._wrappedRowsCount = function () { - var wrappedRows = 0; - var startRow = this._startRow - this._wrappedRowsForRow(this._startRow); - var endRow = this._endRow - this._wrappedRowsForRow(this._endRow); - for (var i = 0; i < Math.abs(startRow - endRow); i++) { - var direction = this._verticalDirection() === Direction.Up ? -1 : 1; - if (this._lines.get(startRow + (direction * i)).isWrapped) { - wrappedRows++; - } - } - return wrappedRows; - }; - AltClickHandler.prototype._wrappedRowsForRow = function (currentRow) { - var rowCount = 0; - var lineWraps = this._lines.get(currentRow).isWrapped; - while (lineWraps && currentRow >= 0 && currentRow < this._terminal.rows) { - rowCount++; - currentRow--; - lineWraps = this._lines.get(currentRow).isWrapped; - } - return rowCount; - }; - AltClickHandler.prototype._horizontalDirection = function () { - var startRow; - if (this._moveToRequestedRow().length > 0) { - startRow = this._endRow - this._wrappedRowsForRow(this._endRow); - } - else { - startRow = this._startRow; - } - if ((this._startCol < this._endCol && - startRow <= this._endRow) || - (this._startCol >= this._endCol && - startRow < this._endRow)) { - return Direction.Right; - } - else { - return Direction.Left; - } - }; - AltClickHandler.prototype._verticalDirection = function () { - if (this._startRow > this._endRow) { - return Direction.Up; - } - else { - return Direction.Down; - } - }; - AltClickHandler.prototype._bufferLine = function (startCol, startRow, endCol, endRow, forward) { - var currentCol = startCol; - var currentRow = startRow; - var bufferStr = ''; - while (currentCol !== endCol || currentRow !== endRow) { - currentCol += forward ? 1 : -1; - if (forward && currentCol > this._terminal.cols - 1) { - bufferStr += this._terminal.buffer.translateBufferLineToString(currentRow, false, startCol, currentCol); - currentCol = 0; - startCol = 0; - currentRow++; - } - else if (!forward && currentCol < 0) { - bufferStr += this._terminal.buffer.translateBufferLineToString(currentRow, false, 0, startCol + 1); - currentCol = this._terminal.cols - 1; - startCol = currentCol; - currentRow--; - } - } - return bufferStr + this._terminal.buffer.translateBufferLineToString(currentRow, false, startCol, currentCol); - }; - AltClickHandler.prototype._sequence = function (direction) { - var mod = this._terminal.applicationCursor ? 'O' : '['; - return EscapeSequences_1.C0.ESC + mod + direction; - }; - return AltClickHandler; -}()); -exports.AltClickHandler = AltClickHandler; -function repeat(count, str) { - count = Math.floor(count); - var rpt = ''; - for (var i = 0; i < count; i++) { - rpt += str; - } - return rpt; -} - - - -},{"../EscapeSequences":6}],17:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function prepareTextForTerminal(text, isMSWindows) { - if (isMSWindows) { - return text.replace(/\r?\n/g, '\r'); - } - return text; -} -exports.prepareTextForTerminal = prepareTextForTerminal; -function bracketTextForPaste(text, bracketedPasteMode) { - if (bracketedPasteMode) { - return '\x1b[200~' + text + '\x1b[201~'; - } - return text; -} -exports.bracketTextForPaste = bracketTextForPaste; -function copyHandler(ev, term, selectionManager) { - if (term.browser.isMSIE) { - window.clipboardData.setData('Text', selectionManager.selectionText); - } - else { - ev.clipboardData.setData('text/plain', selectionManager.selectionText); - } - ev.preventDefault(); -} -exports.copyHandler = copyHandler; -function pasteHandler(ev, term) { - ev.stopPropagation(); - var text; - var dispatchPaste = function (text) { - text = prepareTextForTerminal(text, term.browser.isMSWindows); - text = bracketTextForPaste(text, term.bracketedPasteMode); - term.handler(text); - term.textarea.value = ''; - term.emit('paste', text); - term.cancel(ev); - }; - if (term.browser.isMSIE) { - if (window.clipboardData) { - text = window.clipboardData.getData('Text'); - dispatchPaste(text); - } - } - else { - if (ev.clipboardData) { - text = ev.clipboardData.getData('text/plain'); - dispatchPaste(text); - } - } -} -exports.pasteHandler = pasteHandler; -function moveTextAreaUnderMouseCursor(ev, textarea) { - textarea.style.position = 'fixed'; - textarea.style.width = '20px'; - textarea.style.height = '20px'; - textarea.style.left = (ev.clientX - 10) + 'px'; - textarea.style.top = (ev.clientY - 10) + 'px'; - textarea.style.zIndex = '1000'; - textarea.focus(); - setTimeout(function () { - textarea.style.position = null; - textarea.style.width = null; - textarea.style.height = null; - textarea.style.left = null; - textarea.style.top = null; - textarea.style.zIndex = null; - }, 200); -} -exports.moveTextAreaUnderMouseCursor = moveTextAreaUnderMouseCursor; -function rightClickHandler(ev, textarea, selectionManager, shouldSelectWord) { - moveTextAreaUnderMouseCursor(ev, textarea); - if (shouldSelectWord && !selectionManager.isClickInSelection(ev)) { - selectionManager.selectWordAtCursor(ev); - } - textarea.value = selectionManager.selectionText; - textarea.select(); -} -exports.rightClickHandler = rightClickHandler; - - - -},{}],18:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var HOVER_DURATION = 500; -var MouseZoneManager = (function () { - function MouseZoneManager(_terminal) { - var _this = this; - this._terminal = _terminal; - this._zones = []; - this._areZonesActive = false; - this._tooltipTimeout = null; - this._currentZone = null; - this._lastHoverCoords = [null, null]; - this._terminal.element.addEventListener('mousedown', function (e) { return _this._onMouseDown(e); }); - this._mouseMoveListener = function (e) { return _this._onMouseMove(e); }; - this._clickListener = function (e) { return _this._onClick(e); }; - } - MouseZoneManager.prototype.add = function (zone) { - this._zones.push(zone); - if (this._zones.length === 1) { - this._activate(); - } - }; - MouseZoneManager.prototype.clearAll = function (start, end) { - if (this._zones.length === 0) { - return; - } - if (!end) { - start = 0; - end = this._terminal.rows - 1; - } - for (var i = 0; i < this._zones.length; i++) { - var zone = this._zones[i]; - if (zone.y > start && zone.y <= end + 1) { - if (this._currentZone && this._currentZone === zone) { - this._currentZone.leaveCallback(); - this._currentZone = null; - } - this._zones.splice(i--, 1); - } - } - if (this._zones.length === 0) { - this._deactivate(); - } - }; - MouseZoneManager.prototype._activate = function () { - if (!this._areZonesActive) { - this._areZonesActive = true; - this._terminal.element.addEventListener('mousemove', this._mouseMoveListener); - this._terminal.element.addEventListener('click', this._clickListener); - } - }; - MouseZoneManager.prototype._deactivate = function () { - if (this._areZonesActive) { - this._areZonesActive = false; - this._terminal.element.removeEventListener('mousemove', this._mouseMoveListener); - this._terminal.element.removeEventListener('click', this._clickListener); - } - }; - MouseZoneManager.prototype._onMouseMove = function (e) { - if (this._lastHoverCoords[0] !== e.pageX || this._lastHoverCoords[1] !== e.pageY) { - this._onHover(e); - this._lastHoverCoords = [e.pageX, e.pageY]; - } - }; - MouseZoneManager.prototype._onHover = function (e) { - var _this = this; - var zone = this._findZoneEventAt(e); - if (zone === this._currentZone) { - return; - } - if (this._currentZone) { - this._currentZone.leaveCallback(); - this._currentZone = null; - if (this._tooltipTimeout) { - clearTimeout(this._tooltipTimeout); - } - } - if (!zone) { - return; - } - this._currentZone = zone; - if (zone.hoverCallback) { - zone.hoverCallback(e); - } - this._tooltipTimeout = setTimeout(function () { return _this._onTooltip(e); }, HOVER_DURATION); - }; - MouseZoneManager.prototype._onTooltip = function (e) { - this._tooltipTimeout = null; - var zone = this._findZoneEventAt(e); - if (zone && zone.tooltipCallback) { - zone.tooltipCallback(e); - } - }; - MouseZoneManager.prototype._onMouseDown = function (e) { - if (!this._areZonesActive) { - return; - } - var zone = this._findZoneEventAt(e); - if (zone) { - if (zone.willLinkActivate(e)) { - e.preventDefault(); - e.stopImmediatePropagation(); - } - } - }; - MouseZoneManager.prototype._onClick = function (e) { - var zone = this._findZoneEventAt(e); - if (zone) { - zone.clickCallback(e); - e.preventDefault(); - e.stopImmediatePropagation(); - } - }; - MouseZoneManager.prototype._findZoneEventAt = function (e) { - var coords = this._terminal.mouseHelper.getCoords(e, this._terminal.screenElement, this._terminal.charMeasure, this._terminal.options.lineHeight, this._terminal.cols, this._terminal.rows); - if (!coords) { - return null; - } - for (var i = 0; i < this._zones.length; i++) { - var zone = this._zones[i]; - if (zone.y === coords[1] && zone.x1 <= coords[0] && zone.x2 > coords[0]) { - return zone; - } - } - return null; - }; - return MouseZoneManager; -}()); -exports.MouseZoneManager = MouseZoneManager; -var MouseZone = (function () { - function MouseZone(x1, x2, y, clickCallback, hoverCallback, tooltipCallback, leaveCallback, willLinkActivate) { - this.x1 = x1; - this.x2 = x2; - this.y = y; - this.clickCallback = clickCallback; - this.hoverCallback = hoverCallback; - this.tooltipCallback = tooltipCallback; - this.leaveCallback = leaveCallback; - this.willLinkActivate = willLinkActivate; - } - return MouseZone; -}()); -exports.MouseZone = MouseZone; - - - -},{}],19:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var CharAtlas_1 = require("./CharAtlas"); -var Buffer_1 = require("../Buffer"); -exports.INVERTED_DEFAULT_COLOR = -1; -var DIM_OPACITY = 0.5; -var BaseRenderLayer = (function () { - function BaseRenderLayer(_container, id, zIndex, _alpha, _colors) { - this._container = _container; - this._alpha = _alpha; - this._colors = _colors; - this._scaledCharWidth = 0; - this._scaledCharHeight = 0; - this._scaledCellWidth = 0; - this._scaledCellHeight = 0; - this._scaledCharLeft = 0; - this._scaledCharTop = 0; - this._canvas = document.createElement('canvas'); - this._canvas.classList.add("xterm-" + id + "-layer"); - this._canvas.style.zIndex = zIndex.toString(); - this._initCanvas(); - this._container.appendChild(this._canvas); - } - BaseRenderLayer.prototype._initCanvas = function () { - this._ctx = this._canvas.getContext('2d', { alpha: this._alpha }); - if (!this._alpha) { - this.clearAll(); - } - }; - BaseRenderLayer.prototype.onOptionsChanged = function (terminal) { }; - BaseRenderLayer.prototype.onBlur = function (terminal) { }; - BaseRenderLayer.prototype.onFocus = function (terminal) { }; - BaseRenderLayer.prototype.onCursorMove = function (terminal) { }; - BaseRenderLayer.prototype.onGridChanged = function (terminal, startRow, endRow) { }; - BaseRenderLayer.prototype.onSelectionChanged = function (terminal, start, end) { }; - BaseRenderLayer.prototype.onThemeChanged = function (terminal, colorSet) { - this._refreshCharAtlas(terminal, colorSet); - }; - BaseRenderLayer.prototype.setTransparency = function (terminal, alpha) { - if (alpha === this._alpha) { - return; - } - var oldCanvas = this._canvas; - this._alpha = alpha; - this._canvas = this._canvas.cloneNode(); - this._initCanvas(); - this._container.replaceChild(this._canvas, oldCanvas); - this._refreshCharAtlas(terminal, this._colors); - this.onGridChanged(terminal, 0, terminal.rows - 1); - }; - BaseRenderLayer.prototype._refreshCharAtlas = function (terminal, colorSet) { - var _this = this; - if (this._scaledCharWidth <= 0 && this._scaledCharHeight <= 0) { - return; - } - this._charAtlas = null; - var result = CharAtlas_1.acquireCharAtlas(terminal, colorSet, this._scaledCharWidth, this._scaledCharHeight); - if (result instanceof HTMLCanvasElement) { - this._charAtlas = result; - } - else { - result.then(function (bitmap) { return _this._charAtlas = bitmap; }); - } - }; - BaseRenderLayer.prototype.resize = function (terminal, dim, charSizeChanged) { - this._scaledCellWidth = dim.scaledCellWidth; - this._scaledCellHeight = dim.scaledCellHeight; - this._scaledCharWidth = dim.scaledCharWidth; - this._scaledCharHeight = dim.scaledCharHeight; - this._scaledCharLeft = dim.scaledCharLeft; - this._scaledCharTop = dim.scaledCharTop; - this._canvas.width = dim.scaledCanvasWidth; - this._canvas.height = dim.scaledCanvasHeight; - this._canvas.style.width = dim.canvasWidth + "px"; - this._canvas.style.height = dim.canvasHeight + "px"; - if (!this._alpha) { - this.clearAll(); - } - if (charSizeChanged) { - this._refreshCharAtlas(terminal, this._colors); - } - }; - BaseRenderLayer.prototype.fillCells = function (x, y, width, height) { - this._ctx.fillRect(x * this._scaledCellWidth, y * this._scaledCellHeight, width * this._scaledCellWidth, height * this._scaledCellHeight); - }; - BaseRenderLayer.prototype.fillBottomLineAtCells = function (x, y, width) { - if (width === void 0) { width = 1; } - this._ctx.fillRect(x * this._scaledCellWidth, (y + 1) * this._scaledCellHeight - window.devicePixelRatio - 1, width * this._scaledCellWidth, window.devicePixelRatio); - }; - BaseRenderLayer.prototype.fillLeftLineAtCell = function (x, y) { - this._ctx.fillRect(x * this._scaledCellWidth, y * this._scaledCellHeight, window.devicePixelRatio, this._scaledCellHeight); - }; - BaseRenderLayer.prototype.strokeRectAtCell = function (x, y, width, height) { - this._ctx.lineWidth = window.devicePixelRatio; - this._ctx.strokeRect(x * this._scaledCellWidth + window.devicePixelRatio / 2, y * this._scaledCellHeight + (window.devicePixelRatio / 2), width * this._scaledCellWidth - window.devicePixelRatio, (height * this._scaledCellHeight) - window.devicePixelRatio); - }; - BaseRenderLayer.prototype.clearAll = function () { - if (this._alpha) { - this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height); - } - else { - this._ctx.fillStyle = this._colors.background; - this._ctx.fillRect(0, 0, this._canvas.width, this._canvas.height); - } - }; - BaseRenderLayer.prototype.clearCells = function (x, y, width, height) { - if (this._alpha) { - this._ctx.clearRect(x * this._scaledCellWidth, y * this._scaledCellHeight, width * this._scaledCellWidth, height * this._scaledCellHeight); - } - else { - this._ctx.fillStyle = this._colors.background; - this._ctx.fillRect(x * this._scaledCellWidth, y * this._scaledCellHeight, width * this._scaledCellWidth, height * this._scaledCellHeight); - } - }; - BaseRenderLayer.prototype.fillCharTrueColor = function (terminal, charData, x, y) { - this._ctx.font = this._getFont(terminal, false); - this._ctx.textBaseline = 'top'; - this._clipRow(terminal, y); - this._ctx.fillText(charData[Buffer_1.CHAR_DATA_CHAR_INDEX], x * this._scaledCellWidth + this._scaledCharLeft, y * this._scaledCellHeight + this._scaledCharTop); - }; - BaseRenderLayer.prototype.drawChar = function (terminal, char, code, width, x, y, fg, bg, bold, dim) { - var colorIndex = 0; - if (fg < 256) { - colorIndex = fg + 2; - } - else { - if (bold && terminal.options.enableBold) { - colorIndex = 1; - } - } - var isAscii = code < 256; - var isBasicColor = (colorIndex > 1 && fg < 16) && (fg < 8 || bold); - var isDefaultColor = fg >= 256; - var isDefaultBackground = bg >= 256; - if (this._charAtlas && isAscii && (isBasicColor || isDefaultColor) && isDefaultBackground) { - var charAtlasCellWidth = this._scaledCharWidth + CharAtlas_1.CHAR_ATLAS_CELL_SPACING; - var charAtlasCellHeight = this._scaledCharHeight + CharAtlas_1.CHAR_ATLAS_CELL_SPACING; - if (dim) { - this._ctx.globalAlpha = DIM_OPACITY; - } - if (bold && !terminal.options.enableBold) { - if (colorIndex > 1) { - colorIndex -= 8; - } - } - this._ctx.drawImage(this._charAtlas, code * charAtlasCellWidth, colorIndex * charAtlasCellHeight, charAtlasCellWidth, this._scaledCharHeight, x * this._scaledCellWidth + this._scaledCharLeft, y * this._scaledCellHeight + this._scaledCharTop, charAtlasCellWidth, this._scaledCharHeight); - } - else { - this._drawUncachedChar(terminal, char, width, fg, x, y, bold && terminal.options.enableBold, dim); - } - }; - BaseRenderLayer.prototype._drawUncachedChar = function (terminal, char, width, fg, x, y, bold, dim) { - this._ctx.save(); - this._ctx.font = this._getFont(terminal, bold); - this._ctx.textBaseline = 'top'; - if (fg === exports.INVERTED_DEFAULT_COLOR) { - this._ctx.fillStyle = this._colors.background; - } - else if (fg < 256) { - this._ctx.fillStyle = this._colors.ansi[fg]; - } - else { - this._ctx.fillStyle = this._colors.foreground; - } - this._clipRow(terminal, y); - if (dim) { - this._ctx.globalAlpha = DIM_OPACITY; - } - this._ctx.fillText(char, x * this._scaledCellWidth + this._scaledCharLeft, y * this._scaledCellHeight + this._scaledCharTop); - this._ctx.restore(); - }; - BaseRenderLayer.prototype._clipRow = function (terminal, y) { - this._ctx.beginPath(); - this._ctx.rect(0, y * this._scaledCellHeight, terminal.cols * this._scaledCellWidth, this._scaledCellHeight); - this._ctx.clip(); - }; - BaseRenderLayer.prototype._getFont = function (terminal, isBold) { - var fontWeight = isBold ? terminal.options.fontWeightBold : terminal.options.fontWeight; - return fontWeight + " " + terminal.options.fontSize * window.devicePixelRatio + "px " + terminal.options.fontFamily; - }; - return BaseRenderLayer; -}()); -exports.BaseRenderLayer = BaseRenderLayer; - - - -},{"../Buffer":1,"./CharAtlas":20}],20:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var CharAtlasGenerator_1 = require("../shared/CharAtlasGenerator"); -exports.CHAR_ATLAS_CELL_SPACING = 1; -var charAtlasCache = []; -function acquireCharAtlas(terminal, colors, scaledCharWidth, scaledCharHeight) { - var newConfig = generateConfig(scaledCharWidth, scaledCharHeight, terminal, colors); - for (var i = 0; i < charAtlasCache.length; i++) { - var entry = charAtlasCache[i]; - var ownedByIndex = entry.ownedBy.indexOf(terminal); - if (ownedByIndex >= 0) { - if (configEquals(entry.config, newConfig)) { - return entry.bitmap; - } - else { - if (entry.ownedBy.length === 1) { - charAtlasCache.splice(i, 1); - } - else { - entry.ownedBy.splice(ownedByIndex, 1); - } - break; - } - } - } - for (var i = 0; i < charAtlasCache.length; i++) { - var entry = charAtlasCache[i]; - if (configEquals(entry.config, newConfig)) { - entry.ownedBy.push(terminal); - return entry.bitmap; - } - } - var canvasFactory = function (width, height) { - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - return canvas; - }; - var charAtlasConfig = { - scaledCharWidth: scaledCharWidth, - scaledCharHeight: scaledCharHeight, - fontSize: terminal.options.fontSize, - fontFamily: terminal.options.fontFamily, - fontWeight: terminal.options.fontWeight, - fontWeightBold: terminal.options.fontWeightBold, - background: colors.background, - foreground: colors.foreground, - ansiColors: colors.ansi, - devicePixelRatio: window.devicePixelRatio, - allowTransparency: terminal.options.allowTransparency - }; - var newEntry = { - bitmap: CharAtlasGenerator_1.generateCharAtlas(window, canvasFactory, charAtlasConfig), - config: newConfig, - ownedBy: [terminal] - }; - charAtlasCache.push(newEntry); - return newEntry.bitmap; -} -exports.acquireCharAtlas = acquireCharAtlas; -function generateConfig(scaledCharWidth, scaledCharHeight, terminal, colors) { - var clonedColors = { - foreground: colors.foreground, - background: colors.background, - cursor: null, - cursorAccent: null, - selection: null, - ansi: colors.ansi.slice(0, 16) - }; - return { - scaledCharWidth: scaledCharWidth, - scaledCharHeight: scaledCharHeight, - fontFamily: terminal.options.fontFamily, - fontSize: terminal.options.fontSize, - fontWeight: terminal.options.fontWeight, - fontWeightBold: terminal.options.fontWeightBold, - allowTransparency: terminal.options.allowTransparency, - colors: clonedColors - }; -} -function configEquals(a, b) { - for (var i = 0; i < a.colors.ansi.length; i++) { - if (a.colors.ansi[i] !== b.colors.ansi[i]) { - return false; - } - } - return a.fontFamily === b.fontFamily && - a.fontSize === b.fontSize && - a.fontWeight === b.fontWeight && - a.fontWeightBold === b.fontWeightBold && - a.allowTransparency === b.allowTransparency && - a.scaledCharWidth === b.scaledCharWidth && - a.scaledCharHeight === b.scaledCharHeight && - a.colors.foreground === b.colors.foreground && - a.colors.background === b.colors.background; -} - - - -},{"../shared/CharAtlasGenerator":29}],21:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var DEFAULT_FOREGROUND = '#ffffff'; -var DEFAULT_BACKGROUND = '#000000'; -var DEFAULT_CURSOR = '#ffffff'; -var DEFAULT_CURSOR_ACCENT = '#000000'; -var DEFAULT_SELECTION = 'rgba(255, 255, 255, 0.3)'; -exports.DEFAULT_ANSI_COLORS = [ - '#2e3436', - '#cc0000', - '#4e9a06', - '#c4a000', - '#3465a4', - '#75507b', - '#06989a', - '#d3d7cf', - '#555753', - '#ef2929', - '#8ae234', - '#fce94f', - '#729fcf', - '#ad7fa8', - '#34e2e2', - '#eeeeec' -]; -function generate256Colors(first16Colors) { - var colors = first16Colors.slice(); - var v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff]; - for (var i = 0; i < 216; i++) { - var r = toPaddedHex(v[(i / 36) % 6 | 0]); - var g = toPaddedHex(v[(i / 6) % 6 | 0]); - var b = toPaddedHex(v[i % 6]); - colors.push("#" + r + g + b); - } - for (var i = 0; i < 24; i++) { - var c = toPaddedHex(8 + i * 10); - colors.push("#" + c + c + c); - } - return colors; -} -function toPaddedHex(c) { - var s = c.toString(16); - return s.length < 2 ? '0' + s : s; -} -var ColorManager = (function () { - function ColorManager() { - this.colors = { - foreground: DEFAULT_FOREGROUND, - background: DEFAULT_BACKGROUND, - cursor: DEFAULT_CURSOR, - cursorAccent: DEFAULT_CURSOR_ACCENT, - selection: DEFAULT_SELECTION, - ansi: generate256Colors(exports.DEFAULT_ANSI_COLORS) - }; - } - ColorManager.prototype.setTheme = function (theme) { - this.colors.foreground = theme.foreground || DEFAULT_FOREGROUND; - this.colors.background = theme.background || DEFAULT_BACKGROUND; - this.colors.cursor = theme.cursor || DEFAULT_CURSOR; - this.colors.cursorAccent = theme.cursorAccent || DEFAULT_CURSOR_ACCENT; - this.colors.selection = theme.selection || DEFAULT_SELECTION; - this.colors.ansi[0] = theme.black || exports.DEFAULT_ANSI_COLORS[0]; - this.colors.ansi[1] = theme.red || exports.DEFAULT_ANSI_COLORS[1]; - this.colors.ansi[2] = theme.green || exports.DEFAULT_ANSI_COLORS[2]; - this.colors.ansi[3] = theme.yellow || exports.DEFAULT_ANSI_COLORS[3]; - this.colors.ansi[4] = theme.blue || exports.DEFAULT_ANSI_COLORS[4]; - this.colors.ansi[5] = theme.magenta || exports.DEFAULT_ANSI_COLORS[5]; - this.colors.ansi[6] = theme.cyan || exports.DEFAULT_ANSI_COLORS[6]; - this.colors.ansi[7] = theme.white || exports.DEFAULT_ANSI_COLORS[7]; - this.colors.ansi[8] = theme.brightBlack || exports.DEFAULT_ANSI_COLORS[8]; - this.colors.ansi[9] = theme.brightRed || exports.DEFAULT_ANSI_COLORS[9]; - this.colors.ansi[10] = theme.brightGreen || exports.DEFAULT_ANSI_COLORS[10]; - this.colors.ansi[11] = theme.brightYellow || exports.DEFAULT_ANSI_COLORS[11]; - this.colors.ansi[12] = theme.brightBlue || exports.DEFAULT_ANSI_COLORS[12]; - this.colors.ansi[13] = theme.brightMagenta || exports.DEFAULT_ANSI_COLORS[13]; - this.colors.ansi[14] = theme.brightCyan || exports.DEFAULT_ANSI_COLORS[14]; - this.colors.ansi[15] = theme.brightWhite || exports.DEFAULT_ANSI_COLORS[15]; - }; - return ColorManager; -}()); -exports.ColorManager = ColorManager; - - - -},{}],22:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Buffer_1 = require("../Buffer"); -var BaseRenderLayer_1 = require("./BaseRenderLayer"); -var BLINK_INTERVAL = 600; -var CursorRenderLayer = (function (_super) { - __extends(CursorRenderLayer, _super); - function CursorRenderLayer(container, zIndex, colors) { - var _this = _super.call(this, container, 'cursor', zIndex, true, colors) || this; - _this._state = { - x: null, - y: null, - isFocused: null, - style: null, - width: null, - }; - _this._cursorRenderers = { - 'bar': _this._renderBarCursor.bind(_this), - 'block': _this._renderBlockCursor.bind(_this), - 'underline': _this._renderUnderlineCursor.bind(_this) - }; - return _this; - } - CursorRenderLayer.prototype.resize = function (terminal, dim, charSizeChanged) { - _super.prototype.resize.call(this, terminal, dim, charSizeChanged); - this._state = { - x: null, - y: null, - isFocused: null, - style: null, - width: null, - }; - }; - CursorRenderLayer.prototype.reset = function (terminal) { - this._clearCursor(); - if (this._cursorBlinkStateManager) { - this._cursorBlinkStateManager.dispose(); - this._cursorBlinkStateManager = null; - this.onOptionsChanged(terminal); - } - }; - CursorRenderLayer.prototype.onBlur = function (terminal) { - if (this._cursorBlinkStateManager) { - this._cursorBlinkStateManager.pause(); - } - terminal.refresh(terminal.buffer.y, terminal.buffer.y); - }; - CursorRenderLayer.prototype.onFocus = function (terminal) { - if (this._cursorBlinkStateManager) { - this._cursorBlinkStateManager.resume(terminal); - } - else { - terminal.refresh(terminal.buffer.y, terminal.buffer.y); - } - }; - CursorRenderLayer.prototype.onOptionsChanged = function (terminal) { - var _this = this; - if (terminal.options.cursorBlink) { - if (!this._cursorBlinkStateManager) { - this._cursorBlinkStateManager = new CursorBlinkStateManager(terminal, function () { - _this._render(terminal, true); - }); - } - } - else { - if (this._cursorBlinkStateManager) { - this._cursorBlinkStateManager.dispose(); - this._cursorBlinkStateManager = null; - } - terminal.refresh(terminal.buffer.y, terminal.buffer.y); - } - }; - CursorRenderLayer.prototype.onCursorMove = function (terminal) { - if (this._cursorBlinkStateManager) { - this._cursorBlinkStateManager.restartBlinkAnimation(terminal); - } - }; - CursorRenderLayer.prototype.onGridChanged = function (terminal, startRow, endRow) { - if (!this._cursorBlinkStateManager || this._cursorBlinkStateManager.isPaused) { - this._render(terminal, false); - } - else { - this._cursorBlinkStateManager.restartBlinkAnimation(terminal); - } - }; - CursorRenderLayer.prototype._render = function (terminal, triggeredByAnimationFrame) { - if (!terminal.cursorState || terminal.cursorHidden) { - this._clearCursor(); - return; - } - var cursorY = terminal.buffer.ybase + terminal.buffer.y; - var viewportRelativeCursorY = cursorY - terminal.buffer.ydisp; - if (viewportRelativeCursorY < 0 || viewportRelativeCursorY >= terminal.rows) { - this._clearCursor(); - return; - } - var charData = terminal.buffer.lines.get(cursorY)[terminal.buffer.x]; - if (!charData) { - return; - } - if (!terminal.isFocused) { - this._clearCursor(); - this._ctx.save(); - this._ctx.fillStyle = this._colors.cursor; - this._renderBlurCursor(terminal, terminal.buffer.x, viewportRelativeCursorY, charData); - this._ctx.restore(); - this._state.x = terminal.buffer.x; - this._state.y = viewportRelativeCursorY; - this._state.isFocused = false; - this._state.style = terminal.options.cursorStyle; - this._state.width = charData[Buffer_1.CHAR_DATA_WIDTH_INDEX]; - return; - } - if (this._cursorBlinkStateManager && !this._cursorBlinkStateManager.isCursorVisible) { - this._clearCursor(); - return; - } - if (this._state) { - if (this._state.x === terminal.buffer.x && - this._state.y === viewportRelativeCursorY && - this._state.isFocused === terminal.isFocused && - this._state.style === terminal.options.cursorStyle && - this._state.width === charData[Buffer_1.CHAR_DATA_WIDTH_INDEX]) { - return; - } - this._clearCursor(); - } - this._ctx.save(); - this._cursorRenderers[terminal.options.cursorStyle || 'block'](terminal, terminal.buffer.x, viewportRelativeCursorY, charData); - this._ctx.restore(); - this._state.x = terminal.buffer.x; - this._state.y = viewportRelativeCursorY; - this._state.isFocused = false; - this._state.style = terminal.options.cursorStyle; - this._state.width = charData[Buffer_1.CHAR_DATA_WIDTH_INDEX]; - }; - CursorRenderLayer.prototype._clearCursor = function () { - if (this._state) { - this.clearCells(this._state.x, this._state.y, this._state.width, 1); - this._state = { - x: null, - y: null, - isFocused: null, - style: null, - width: null, - }; - } - }; - CursorRenderLayer.prototype._renderBarCursor = function (terminal, x, y, charData) { - this._ctx.save(); - this._ctx.fillStyle = this._colors.cursor; - this.fillLeftLineAtCell(x, y); - this._ctx.restore(); - }; - CursorRenderLayer.prototype._renderBlockCursor = function (terminal, x, y, charData) { - this._ctx.save(); - this._ctx.fillStyle = this._colors.cursor; - this.fillCells(x, y, charData[Buffer_1.CHAR_DATA_WIDTH_INDEX], 1); - this._ctx.fillStyle = this._colors.cursorAccent; - this.fillCharTrueColor(terminal, charData, x, y); - this._ctx.restore(); - }; - CursorRenderLayer.prototype._renderUnderlineCursor = function (terminal, x, y, charData) { - this._ctx.save(); - this._ctx.fillStyle = this._colors.cursor; - this.fillBottomLineAtCells(x, y); - this._ctx.restore(); - }; - CursorRenderLayer.prototype._renderBlurCursor = function (terminal, x, y, charData) { - this._ctx.save(); - this._ctx.strokeStyle = this._colors.cursor; - this.strokeRectAtCell(x, y, charData[Buffer_1.CHAR_DATA_WIDTH_INDEX], 1); - this._ctx.restore(); - }; - return CursorRenderLayer; -}(BaseRenderLayer_1.BaseRenderLayer)); -exports.CursorRenderLayer = CursorRenderLayer; -var CursorBlinkStateManager = (function () { - function CursorBlinkStateManager(terminal, renderCallback) { - this.renderCallback = renderCallback; - this.isCursorVisible = true; - if (terminal.isFocused) { - this._restartInterval(); - } - } - Object.defineProperty(CursorBlinkStateManager.prototype, "isPaused", { - get: function () { return !(this._blinkStartTimeout || this._blinkInterval); }, - enumerable: true, - configurable: true - }); - CursorBlinkStateManager.prototype.dispose = function () { - if (this._blinkInterval) { - window.clearInterval(this._blinkInterval); - this._blinkInterval = null; - } - if (this._blinkStartTimeout) { - window.clearTimeout(this._blinkStartTimeout); - this._blinkStartTimeout = null; - } - if (this._animationFrame) { - window.cancelAnimationFrame(this._animationFrame); - this._animationFrame = null; - } - }; - CursorBlinkStateManager.prototype.restartBlinkAnimation = function (terminal) { - var _this = this; - if (this.isPaused) { - return; - } - this._animationTimeRestarted = Date.now(); - this.isCursorVisible = true; - if (!this._animationFrame) { - this._animationFrame = window.requestAnimationFrame(function () { - _this.renderCallback(); - _this._animationFrame = null; - }); - } - }; - CursorBlinkStateManager.prototype._restartInterval = function (timeToStart) { - var _this = this; - if (timeToStart === void 0) { timeToStart = BLINK_INTERVAL; } - if (this._blinkInterval) { - window.clearInterval(this._blinkInterval); - } - this._blinkStartTimeout = setTimeout(function () { - if (_this._animationTimeRestarted) { - var time = BLINK_INTERVAL - (Date.now() - _this._animationTimeRestarted); - _this._animationTimeRestarted = null; - if (time > 0) { - _this._restartInterval(time); - return; - } - } - _this.isCursorVisible = false; - _this._animationFrame = window.requestAnimationFrame(function () { - _this.renderCallback(); - _this._animationFrame = null; - }); - _this._blinkInterval = setInterval(function () { - if (_this._animationTimeRestarted) { - var time = BLINK_INTERVAL - (Date.now() - _this._animationTimeRestarted); - _this._animationTimeRestarted = null; - _this._restartInterval(time); - return; - } - _this.isCursorVisible = !_this.isCursorVisible; - _this._animationFrame = window.requestAnimationFrame(function () { - _this.renderCallback(); - _this._animationFrame = null; - }); - }, BLINK_INTERVAL); - }, timeToStart); - }; - CursorBlinkStateManager.prototype.pause = function () { - this.isCursorVisible = true; - if (this._blinkInterval) { - window.clearInterval(this._blinkInterval); - this._blinkInterval = null; - } - if (this._blinkStartTimeout) { - window.clearTimeout(this._blinkStartTimeout); - this._blinkStartTimeout = null; - } - if (this._animationFrame) { - window.cancelAnimationFrame(this._animationFrame); - this._animationFrame = null; - } - }; - CursorBlinkStateManager.prototype.resume = function (terminal) { - this._animationTimeRestarted = null; - this._restartInterval(); - this.restartBlinkAnimation(terminal); - }; - return CursorBlinkStateManager; -}()); - - - -},{"../Buffer":1,"./BaseRenderLayer":19}],23:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var GridCache = (function () { - function GridCache() { - this.cache = []; - } - GridCache.prototype.resize = function (width, height) { - for (var x = 0; x < width; x++) { - if (this.cache.length <= x) { - this.cache.push([]); - } - for (var y = this.cache[x].length; y < height; y++) { - this.cache[x].push(null); - } - this.cache[x].length = height; - } - this.cache.length = width; - }; - GridCache.prototype.clear = function () { - for (var x = 0; x < this.cache.length; x++) { - for (var y = 0; y < this.cache[x].length; y++) { - this.cache[x][y] = null; - } - } - }; - return GridCache; -}()); -exports.GridCache = GridCache; - - - -},{}],24:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Types_1 = require("../Types"); -var BaseRenderLayer_1 = require("./BaseRenderLayer"); -var LinkRenderLayer = (function (_super) { - __extends(LinkRenderLayer, _super); - function LinkRenderLayer(container, zIndex, colors, terminal) { - var _this = _super.call(this, container, 'link', zIndex, true, colors) || this; - _this._state = null; - terminal.linkifier.on(Types_1.LinkHoverEventTypes.HOVER, function (e) { return _this._onLinkHover(e); }); - terminal.linkifier.on(Types_1.LinkHoverEventTypes.LEAVE, function (e) { return _this._onLinkLeave(e); }); - return _this; - } - LinkRenderLayer.prototype.resize = function (terminal, dim, charSizeChanged) { - _super.prototype.resize.call(this, terminal, dim, charSizeChanged); - this._state = null; - }; - LinkRenderLayer.prototype.reset = function (terminal) { - this._clearCurrentLink(); - }; - LinkRenderLayer.prototype._clearCurrentLink = function () { - if (this._state) { - this.clearCells(this._state.x, this._state.y, this._state.length, 1); - this._state = null; - } - }; - LinkRenderLayer.prototype._onLinkHover = function (e) { - this._ctx.fillStyle = this._colors.foreground; - this.fillBottomLineAtCells(e.x, e.y, e.length); - this._state = e; - }; - LinkRenderLayer.prototype._onLinkLeave = function (e) { - this._clearCurrentLink(); - }; - return LinkRenderLayer; -}(BaseRenderLayer_1.BaseRenderLayer)); -exports.LinkRenderLayer = LinkRenderLayer; - - - -},{"../Types":14,"./BaseRenderLayer":19}],25:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var TextRenderLayer_1 = require("./TextRenderLayer"); -var SelectionRenderLayer_1 = require("./SelectionRenderLayer"); -var CursorRenderLayer_1 = require("./CursorRenderLayer"); -var ColorManager_1 = require("./ColorManager"); -var LinkRenderLayer_1 = require("./LinkRenderLayer"); -var EventEmitter_1 = require("../EventEmitter"); -var ScreenDprMonitor_1 = require("../utils/ScreenDprMonitor"); -var Renderer = (function (_super) { - __extends(Renderer, _super); - function Renderer(_terminal, theme) { - var _this = _super.call(this) || this; - _this._terminal = _terminal; - _this._refreshRowsQueue = []; - _this._refreshAnimationFrame = null; - _this._isPaused = false; - _this._needsFullRefresh = false; - _this.colorManager = new ColorManager_1.ColorManager(); - if (theme) { - _this.colorManager.setTheme(theme); - } - _this._renderLayers = [ - new TextRenderLayer_1.TextRenderLayer(_this._terminal.screenElement, 0, _this.colorManager.colors, _this._terminal.options.allowTransparency), - new SelectionRenderLayer_1.SelectionRenderLayer(_this._terminal.screenElement, 1, _this.colorManager.colors), - new LinkRenderLayer_1.LinkRenderLayer(_this._terminal.screenElement, 2, _this.colorManager.colors, _this._terminal), - new CursorRenderLayer_1.CursorRenderLayer(_this._terminal.screenElement, 3, _this.colorManager.colors) - ]; - _this.dimensions = { - scaledCharWidth: null, - scaledCharHeight: null, - scaledCellWidth: null, - scaledCellHeight: null, - scaledCharLeft: null, - scaledCharTop: null, - scaledCanvasWidth: null, - scaledCanvasHeight: null, - canvasWidth: null, - canvasHeight: null, - actualCellWidth: null, - actualCellHeight: null - }; - _this._devicePixelRatio = window.devicePixelRatio; - _this._updateDimensions(); - _this.onOptionsChanged(); - _this._screenDprMonitor = new ScreenDprMonitor_1.ScreenDprMonitor(); - _this._screenDprMonitor.setListener(function () { return _this.onWindowResize(window.devicePixelRatio); }); - if ('IntersectionObserver' in window) { - var observer = new IntersectionObserver(function (e) { return _this.onIntersectionChange(e[0]); }, { threshold: 0 }); - observer.observe(_this._terminal.element); - } - return _this; - } - Renderer.prototype.onIntersectionChange = function (entry) { - this._isPaused = entry.intersectionRatio === 0; - if (!this._isPaused && this._needsFullRefresh) { - this._terminal.refresh(0, this._terminal.rows - 1); - } - }; - Renderer.prototype.onWindowResize = function (devicePixelRatio) { - if (this._devicePixelRatio !== devicePixelRatio) { - this._devicePixelRatio = devicePixelRatio; - this.onResize(this._terminal.cols, this._terminal.rows, true); - } - }; - Renderer.prototype.setTheme = function (theme) { - var _this = this; - this.colorManager.setTheme(theme); - this._renderLayers.forEach(function (l) { - l.onThemeChanged(_this._terminal, _this.colorManager.colors); - l.reset(_this._terminal); - }); - if (this._isPaused) { - this._needsFullRefresh = true; - } - else { - this._terminal.refresh(0, this._terminal.rows - 1); - } - return this.colorManager.colors; - }; - Renderer.prototype.onResize = function (cols, rows, didCharSizeChange) { - var _this = this; - this._updateDimensions(); - this._renderLayers.forEach(function (l) { return l.resize(_this._terminal, _this.dimensions, didCharSizeChange); }); - if (this._isPaused) { - this._needsFullRefresh = true; - } - else { - this._terminal.refresh(0, this._terminal.rows - 1); - } - this._terminal.screenElement.style.width = this.dimensions.canvasWidth + this._terminal.viewport.scrollBarWidth + "px"; - this._terminal.screenElement.style.height = window.innerHeight + "px"; - this.emit('resize', { - width: this.dimensions.canvasWidth, - height: this.dimensions.canvasHeight - }); - }; - Renderer.prototype.onCharSizeChanged = function () { - this.onResize(this._terminal.cols, this._terminal.rows, true); - }; - Renderer.prototype.onBlur = function () { - var _this = this; - this._runOperation(function (l) { return l.onBlur(_this._terminal); }); - }; - Renderer.prototype.onFocus = function () { - var _this = this; - this._runOperation(function (l) { return l.onFocus(_this._terminal); }); - }; - Renderer.prototype.onSelectionChanged = function (start, end) { - var _this = this; - this._runOperation(function (l) { return l.onSelectionChanged(_this._terminal, start, end); }); - }; - Renderer.prototype.onCursorMove = function () { - var _this = this; - this._runOperation(function (l) { return l.onCursorMove(_this._terminal); }); - }; - Renderer.prototype.onOptionsChanged = function () { - var _this = this; - this._runOperation(function (l) { return l.onOptionsChanged(_this._terminal); }); - }; - Renderer.prototype.clear = function () { - var _this = this; - this._runOperation(function (l) { return l.reset(_this._terminal); }); - }; - Renderer.prototype._runOperation = function (operation) { - if (this._isPaused) { - this._needsFullRefresh = true; - } - else { - this._renderLayers.forEach(function (l) { return operation(l); }); - } - }; - Renderer.prototype.queueRefresh = function (start, end) { - if (this._isPaused) { - this._needsFullRefresh = true; - return; - } - this._refreshRowsQueue.push({ start: start, end: end }); - if (!this._refreshAnimationFrame) { - this._refreshAnimationFrame = window.requestAnimationFrame(this._refreshLoop.bind(this)); - } - }; - Renderer.prototype._refreshLoop = function () { - var _this = this; - var start; - var end; - if (this._refreshRowsQueue.length > 4) { - start = 0; - end = this._terminal.rows - 1; - } - else { - start = this._refreshRowsQueue[0].start; - end = this._refreshRowsQueue[0].end; - for (var i = 1; i < this._refreshRowsQueue.length; i++) { - if (this._refreshRowsQueue[i].start < start) { - start = this._refreshRowsQueue[i].start; - } - if (this._refreshRowsQueue[i].end > end) { - end = this._refreshRowsQueue[i].end; - } - } - } - this._refreshRowsQueue = []; - this._refreshAnimationFrame = null; - start = Math.max(start, 0); - end = Math.min(end, this._terminal.rows - 1); - this._renderLayers.forEach(function (l) { return l.onGridChanged(_this._terminal, start, end); }); - this._terminal.emit('refresh', { start: start, end: end }); - }; - Renderer.prototype._updateDimensions = function () { - if (!this._terminal.charMeasure.width || !this._terminal.charMeasure.height) { - return; - } - this.dimensions.scaledCharWidth = Math.floor(this._terminal.charMeasure.width * window.devicePixelRatio); - this.dimensions.scaledCharHeight = Math.ceil(this._terminal.charMeasure.height * window.devicePixelRatio); - this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._terminal.options.lineHeight); - this.dimensions.scaledCharTop = this._terminal.options.lineHeight === 1 ? 0 : Math.round((this.dimensions.scaledCellHeight - this.dimensions.scaledCharHeight) / 2); - this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._terminal.options.letterSpacing); - this.dimensions.scaledCharLeft = Math.floor(this._terminal.options.letterSpacing / 2); - this.dimensions.scaledCanvasHeight = this._terminal.rows * this.dimensions.scaledCellHeight; - this.dimensions.scaledCanvasWidth = this._terminal.cols * this.dimensions.scaledCellWidth; - this.dimensions.canvasHeight = Math.round(this.dimensions.scaledCanvasHeight / window.devicePixelRatio); - this.dimensions.canvasWidth = Math.round(this.dimensions.scaledCanvasWidth / window.devicePixelRatio); - this.dimensions.actualCellHeight = this.dimensions.canvasHeight / this._terminal.rows; - this.dimensions.actualCellWidth = this.dimensions.canvasWidth / this._terminal.cols; - }; - return Renderer; -}(EventEmitter_1.EventEmitter)); -exports.Renderer = Renderer; - - - -},{"../EventEmitter":7,"../utils/ScreenDprMonitor":34,"./ColorManager":21,"./CursorRenderLayer":22,"./LinkRenderLayer":24,"./SelectionRenderLayer":26,"./TextRenderLayer":27}],26:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var BaseRenderLayer_1 = require("./BaseRenderLayer"); -var SelectionRenderLayer = (function (_super) { - __extends(SelectionRenderLayer, _super); - function SelectionRenderLayer(container, zIndex, colors) { - var _this = _super.call(this, container, 'selection', zIndex, true, colors) || this; - _this._state = { - start: null, - end: null - }; - return _this; - } - SelectionRenderLayer.prototype.resize = function (terminal, dim, charSizeChanged) { - _super.prototype.resize.call(this, terminal, dim, charSizeChanged); - this._state = { - start: null, - end: null - }; - }; - SelectionRenderLayer.prototype.reset = function (terminal) { - if (this._state.start && this._state.end) { - this._state = { - start: null, - end: null - }; - this.clearAll(); - } - }; - SelectionRenderLayer.prototype.onSelectionChanged = function (terminal, start, end) { - if (this._state.start === start || this._state.end === end) { - return; - } - this.clearAll(); - if (!start || !end) { - return; - } - var viewportStartRow = start[1] - terminal.buffer.ydisp; - var viewportEndRow = end[1] - terminal.buffer.ydisp; - var viewportCappedStartRow = Math.max(viewportStartRow, 0); - var viewportCappedEndRow = Math.min(viewportEndRow, terminal.rows - 1); - if (viewportCappedStartRow >= terminal.rows || viewportCappedEndRow < 0) { - return; - } - var startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0; - var startRowEndCol = viewportCappedStartRow === viewportCappedEndRow ? end[0] : terminal.cols; - this._ctx.fillStyle = this._colors.selection; - this.fillCells(startCol, viewportCappedStartRow, startRowEndCol - startCol, 1); - var middleRowsCount = Math.max(viewportCappedEndRow - viewportCappedStartRow - 1, 0); - this.fillCells(0, viewportCappedStartRow + 1, terminal.cols, middleRowsCount); - if (viewportCappedStartRow !== viewportCappedEndRow) { - var endCol = viewportEndRow === viewportCappedEndRow ? end[0] : terminal.cols; - this.fillCells(0, viewportCappedEndRow, endCol, 1); - } - this._state.start = [start[0], start[1]]; - this._state.end = [end[0], end[1]]; - }; - return SelectionRenderLayer; -}(BaseRenderLayer_1.BaseRenderLayer)); -exports.SelectionRenderLayer = SelectionRenderLayer; - - - -},{"./BaseRenderLayer":19}],27:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Buffer_1 = require("../Buffer"); -var Types_1 = require("./Types"); -var GridCache_1 = require("./GridCache"); -var BaseRenderLayer_1 = require("./BaseRenderLayer"); -var OVERLAP_OWNED_CHAR_DATA = [null, '', 0, -1]; -var TextRenderLayer = (function (_super) { - __extends(TextRenderLayer, _super); - function TextRenderLayer(container, zIndex, colors, alpha) { - var _this = _super.call(this, container, 'text', zIndex, alpha, colors) || this; - _this._characterOverlapCache = {}; - _this._state = new GridCache_1.GridCache(); - return _this; - } - TextRenderLayer.prototype.resize = function (terminal, dim, charSizeChanged) { - _super.prototype.resize.call(this, terminal, dim, charSizeChanged); - var terminalFont = this._getFont(terminal, false); - if (this._characterWidth !== dim.scaledCharWidth || this._characterFont !== terminalFont) { - this._characterWidth = dim.scaledCharWidth; - this._characterFont = terminalFont; - this._characterOverlapCache = {}; - } - this._state.clear(); - this._state.resize(terminal.cols, terminal.rows); - }; - TextRenderLayer.prototype.reset = function (terminal) { - this._state.clear(); - this.clearAll(); - }; - TextRenderLayer.prototype.onGridChanged = function (terminal, startRow, endRow) { - if (this._state.cache.length === 0) { - return; - } - for (var y = startRow; y <= endRow; y++) { - var row = y + terminal.buffer.ydisp; - var line = terminal.buffer.lines.get(row); - this.clearCells(0, y, terminal.cols, 1); - for (var x = 0; x < terminal.cols; x++) { - var charData = line[x]; - var code = charData[Buffer_1.CHAR_DATA_CODE_INDEX]; - var char = charData[Buffer_1.CHAR_DATA_CHAR_INDEX]; - var attr = charData[Buffer_1.CHAR_DATA_ATTR_INDEX]; - var width = charData[Buffer_1.CHAR_DATA_WIDTH_INDEX]; - if (width === 0) { - continue; - } - if (code === 32) { - if (x > 0) { - var previousChar = line[x - 1]; - if (this._isOverlapping(previousChar)) { - continue; - } - } - } - var flags = attr >> 18; - var bg = attr & 0x1ff; - var isDefaultBackground = bg >= 256; - var isInvisible = flags & Types_1.FLAGS.INVISIBLE; - var isInverted = flags & Types_1.FLAGS.INVERSE; - if (!code || (code === 32 && isDefaultBackground && !isInverted) || isInvisible) { - continue; - } - if (width !== 0 && this._isOverlapping(charData)) { - if (x < line.length - 1 && line[x + 1][Buffer_1.CHAR_DATA_CODE_INDEX] === 32) { - width = 2; - } - } - var fg = (attr >> 9) & 0x1ff; - if (isInverted) { - var temp = bg; - bg = fg; - fg = temp; - if (fg === 256) { - fg = BaseRenderLayer_1.INVERTED_DEFAULT_COLOR; - } - if (bg === 257) { - bg = BaseRenderLayer_1.INVERTED_DEFAULT_COLOR; - } - } - if (bg < 256) { - this._ctx.save(); - this._ctx.fillStyle = (bg === BaseRenderLayer_1.INVERTED_DEFAULT_COLOR ? this._colors.foreground : this._colors.ansi[bg]); - this.fillCells(x, y, width, 1); - this._ctx.restore(); - } - this._ctx.save(); - if (flags & Types_1.FLAGS.BOLD) { - this._ctx.font = this._getFont(terminal, true); - if (fg < 8) { - fg += 8; - } - } - if (flags & Types_1.FLAGS.UNDERLINE) { - if (fg === BaseRenderLayer_1.INVERTED_DEFAULT_COLOR) { - this._ctx.fillStyle = this._colors.background; - } - else if (fg < 256) { - this._ctx.fillStyle = this._colors.ansi[fg]; - } - else { - this._ctx.fillStyle = this._colors.foreground; - } - this.fillBottomLineAtCells(x, y); - } - this.drawChar(terminal, char, code, width, x, y, fg, bg, !!(flags & Types_1.FLAGS.BOLD), !!(flags & Types_1.FLAGS.DIM)); - this._ctx.restore(); - } - } - }; - TextRenderLayer.prototype.onOptionsChanged = function (terminal) { - this.setTransparency(terminal, terminal.options.allowTransparency); - }; - TextRenderLayer.prototype._isOverlapping = function (charData) { - if (charData[Buffer_1.CHAR_DATA_WIDTH_INDEX] !== 1) { - return false; - } - var code = charData[Buffer_1.CHAR_DATA_CODE_INDEX]; - if (code < 256) { - return false; - } - var char = charData[Buffer_1.CHAR_DATA_CHAR_INDEX]; - if (this._characterOverlapCache.hasOwnProperty(char)) { - return this._characterOverlapCache[char]; - } - this._ctx.save(); - this._ctx.font = this._characterFont; - var overlaps = Math.floor(this._ctx.measureText(char).width) > this._characterWidth; - this._ctx.restore(); - this._characterOverlapCache[char] = overlaps; - return overlaps; - }; - TextRenderLayer.prototype._clearChar = function (x, y) { - var colsToClear = 1; - var state = this._state.cache[x][y]; - if (state && state[Buffer_1.CHAR_DATA_WIDTH_INDEX] === 2) { - colsToClear = 2; - } - this.clearCells(x, y, colsToClear, 1); - }; - return TextRenderLayer; -}(BaseRenderLayer_1.BaseRenderLayer)); -exports.TextRenderLayer = TextRenderLayer; - - - -},{"../Buffer":1,"./BaseRenderLayer":19,"./GridCache":23,"./Types":28}],28:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var FLAGS; -(function (FLAGS) { - FLAGS[FLAGS["BOLD"] = 1] = "BOLD"; - FLAGS[FLAGS["UNDERLINE"] = 2] = "UNDERLINE"; - FLAGS[FLAGS["BLINK"] = 4] = "BLINK"; - FLAGS[FLAGS["INVERSE"] = 8] = "INVERSE"; - FLAGS[FLAGS["INVISIBLE"] = 16] = "INVISIBLE"; - FLAGS[FLAGS["DIM"] = 32] = "DIM"; -})(FLAGS = exports.FLAGS || (exports.FLAGS = {})); - - - -},{}],29:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Browser_1 = require("./utils/Browser"); -exports.CHAR_ATLAS_CELL_SPACING = 1; -function generateCharAtlas(context, canvasFactory, request) { - var cellWidth = request.scaledCharWidth + exports.CHAR_ATLAS_CELL_SPACING; - var cellHeight = request.scaledCharHeight + exports.CHAR_ATLAS_CELL_SPACING; - var canvas = canvasFactory(255 * cellWidth, (2 + 16) * cellHeight); - var ctx = canvas.getContext('2d', { alpha: request.allowTransparency }); - ctx.fillStyle = request.background; - ctx.fillRect(0, 0, canvas.width, canvas.height); - ctx.save(); - ctx.fillStyle = request.foreground; - ctx.font = getFont(request.fontWeight, request); - ctx.textBaseline = 'top'; - for (var i = 0; i < 256; i++) { - ctx.save(); - ctx.beginPath(); - ctx.rect(i * cellWidth, 0, cellWidth, cellHeight); - ctx.clip(); - ctx.fillText(String.fromCharCode(i), i * cellWidth, 0); - ctx.restore(); - } - ctx.save(); - ctx.font = getFont(request.fontWeightBold, request); - for (var i = 0; i < 256; i++) { - ctx.save(); - ctx.beginPath(); - ctx.rect(i * cellWidth, cellHeight, cellWidth, cellHeight); - ctx.clip(); - ctx.fillText(String.fromCharCode(i), i * cellWidth, cellHeight); - ctx.restore(); - } - ctx.restore(); - ctx.font = getFont(request.fontWeight, request); - for (var colorIndex = 0; colorIndex < 16; colorIndex++) { - if (colorIndex === 8) { - ctx.font = getFont(request.fontWeightBold, request); - } - var y = (colorIndex + 2) * cellHeight; - for (var i = 0; i < 256; i++) { - ctx.save(); - ctx.beginPath(); - ctx.rect(i * cellWidth, y, cellWidth, cellHeight); - ctx.clip(); - ctx.fillStyle = request.ansiColors[colorIndex]; - ctx.fillText(String.fromCharCode(i), i * cellWidth, y); - ctx.restore(); - } - } - ctx.restore(); - if (!('createImageBitmap' in context) || Browser_1.isFirefox) { - if (canvas instanceof HTMLCanvasElement) { - return canvas; - } - else { - return new Promise(function (r) { return r(canvas.transferToImageBitmap()); }); - } - } - var charAtlasImageData = ctx.getImageData(0, 0, canvas.width, canvas.height); - var r = parseInt(request.background.substr(1, 2), 16); - var g = parseInt(request.background.substr(3, 2), 16); - var b = parseInt(request.background.substr(5, 2), 16); - clearColor(charAtlasImageData, r, g, b); - return context.createImageBitmap(charAtlasImageData); -} -exports.generateCharAtlas = generateCharAtlas; -function clearColor(imageData, r, g, b) { - for (var offset = 0; offset < imageData.data.length; offset += 4) { - if (imageData.data[offset] === r && - imageData.data[offset + 1] === g && - imageData.data[offset + 2] === b) { - imageData.data[offset + 3] = 0; - } - } -} -function getFont(fontWeight, request) { - return fontWeight + " " + request.fontSize * request.devicePixelRatio + "px " + request.fontFamily; -} - - - -},{"./utils/Browser":30}],30:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var isNode = (typeof navigator === 'undefined') ? true : false; -var userAgent = (isNode) ? 'node' : navigator.userAgent; -var platform = (isNode) ? 'node' : navigator.platform; -exports.isFirefox = !!~userAgent.indexOf('Firefox'); -exports.isMSIE = !!~userAgent.indexOf('MSIE') || !!~userAgent.indexOf('Trident'); -exports.isMac = contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform); -exports.isIpad = platform === 'iPad'; -exports.isIphone = platform === 'iPhone'; -exports.isMSWindows = contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform); -exports.isLinux = platform.indexOf('Linux') >= 0; -function contains(arr, el) { - return arr.indexOf(el) >= 0; -} - - - -},{}],31:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var EventEmitter_1 = require("../EventEmitter"); -var CharMeasure = (function (_super) { - __extends(CharMeasure, _super); - function CharMeasure(document, parentElement) { - var _this = _super.call(this) || this; - _this._document = document; - _this._parentElement = parentElement; - _this._measureElement = _this._document.createElement('span'); - _this._measureElement.style.position = 'absolute'; - _this._measureElement.style.top = '0'; - _this._measureElement.style.left = '-9999em'; - _this._measureElement.style.lineHeight = 'normal'; - _this._measureElement.textContent = 'W'; - _this._measureElement.setAttribute('aria-hidden', 'true'); - _this._parentElement.appendChild(_this._measureElement); - return _this; - } - Object.defineProperty(CharMeasure.prototype, "width", { - get: function () { - return this._width; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CharMeasure.prototype, "height", { - get: function () { - return this._height; - }, - enumerable: true, - configurable: true - }); - CharMeasure.prototype.measure = function (options) { - this._measureElement.style.fontFamily = options.fontFamily; - this._measureElement.style.fontSize = options.fontSize + "px"; - var geometry = this._measureElement.getBoundingClientRect(); - if (geometry.width === 0 || geometry.height === 0) { - return; - } - if (this._width !== geometry.width || this._height !== geometry.height) { - this._width = geometry.width; - this._height = Math.ceil(geometry.height); - this.emit('charsizechanged'); - } - }; - return CharMeasure; -}(EventEmitter_1.EventEmitter)); -exports.CharMeasure = CharMeasure; - - - -},{"../EventEmitter":7}],32:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var EventEmitter_1 = require("../EventEmitter"); -var CircularList = (function (_super) { - __extends(CircularList, _super); - function CircularList(_maxLength) { - var _this = _super.call(this) || this; - _this._maxLength = _maxLength; - _this._array = new Array(_this._maxLength); - _this._startIndex = 0; - _this._length = 0; - return _this; - } - Object.defineProperty(CircularList.prototype, "maxLength", { - get: function () { - return this._maxLength; - }, - set: function (newMaxLength) { - if (this._maxLength === newMaxLength) { - return; - } - var newArray = new Array(newMaxLength); - for (var i = 0; i < Math.min(newMaxLength, this.length); i++) { - newArray[i] = this._array[this._getCyclicIndex(i)]; - } - this._array = newArray; - this._maxLength = newMaxLength; - this._startIndex = 0; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CircularList.prototype, "length", { - get: function () { - return this._length; - }, - set: function (newLength) { - if (newLength > this._length) { - for (var i = this._length; i < newLength; i++) { - this._array[i] = undefined; - } - } - this._length = newLength; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CircularList.prototype, "forEach", { - get: function () { - var _this = this; - return function (callbackfn) { - var i = 0; - var length = _this.length; - for (var i_1 = 0; i_1 < length; i_1++) { - callbackfn(_this.get(i_1), i_1); - } - }; - }, - enumerable: true, - configurable: true - }); - CircularList.prototype.get = function (index) { - return this._array[this._getCyclicIndex(index)]; - }; - CircularList.prototype.set = function (index, value) { - this._array[this._getCyclicIndex(index)] = value; - }; - CircularList.prototype.push = function (value) { - this._array[this._getCyclicIndex(this._length)] = value; - if (this._length === this._maxLength) { - this._startIndex++; - if (this._startIndex === this._maxLength) { - this._startIndex = 0; - } - this.emit('trim', 1); - } - else { - this._length++; - } - }; - CircularList.prototype.pop = function () { - return this._array[this._getCyclicIndex(this._length-- - 1)]; - }; - CircularList.prototype.splice = function (start, deleteCount) { - var items = []; - for (var _i = 2; _i < arguments.length; _i++) { - items[_i - 2] = arguments[_i]; - } - if (deleteCount) { - for (var i = start; i < this._length - deleteCount; i++) { - this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)]; - } - this._length -= deleteCount; - } - if (items && items.length) { - for (var i = this._length - 1; i >= start; i--) { - this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)]; - } - for (var i = 0; i < items.length; i++) { - this._array[this._getCyclicIndex(start + i)] = items[i]; - } - if (this._length + items.length > this.maxLength) { - var countToTrim = (this._length + items.length) - this.maxLength; - this._startIndex += countToTrim; - this._length = this.maxLength; - this.emit('trim', countToTrim); - } - else { - this._length += items.length; - } - } - }; - CircularList.prototype.trimStart = function (count) { - if (count > this._length) { - count = this._length; - } - this._startIndex += count; - this._length -= count; - this.emit('trim', count); - }; - CircularList.prototype.shiftElements = function (start, count, offset) { - if (count <= 0) { - return; - } - if (start < 0 || start >= this._length) { - throw new Error('start argument out of range'); - } - if (start + offset < 0) { - throw new Error('Cannot shift elements in list beyond index 0'); - } - if (offset > 0) { - for (var i = count - 1; i >= 0; i--) { - this.set(start + i + offset, this.get(start + i)); - } - var expandListBy = (start + count + offset) - this._length; - if (expandListBy > 0) { - this._length += expandListBy; - while (this._length > this.maxLength) { - this._length--; - this._startIndex++; - this.emit('trim', 1); - } - } - } - else { - for (var i = 0; i < count; i++) { - this.set(start + i + offset, this.get(start + i)); - } - } - }; - CircularList.prototype._getCyclicIndex = function (index) { - return (this._startIndex + index) % this.maxLength; - }; - return CircularList; -}(EventEmitter_1.EventEmitter)); -exports.CircularList = CircularList; - - - -},{"../EventEmitter":7}],33:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var MouseHelper = (function () { - function MouseHelper(_renderer) { - this._renderer = _renderer; - } - MouseHelper.getCoordsRelativeToElement = function (event, element) { - if (event.pageX == null) { - return null; - } - var originalElement = element; - var x = event.pageX; - var y = event.pageY; - while (element) { - x -= element.offsetLeft; - y -= element.offsetTop; - element = element.offsetParent; - } - element = originalElement; - while (element && element !== element.ownerDocument.body) { - x += element.scrollLeft; - y += element.scrollTop; - element = element.parentElement; - } - return [x, y]; - }; - MouseHelper.prototype.getCoords = function (event, element, charMeasure, lineHeight, colCount, rowCount, isSelection) { - if (!charMeasure.width || !charMeasure.height) { - return null; - } - var coords = MouseHelper.getCoordsRelativeToElement(event, element); - if (!coords) { - return null; - } - coords[0] = Math.ceil((coords[0] + (isSelection ? this._renderer.dimensions.actualCellWidth / 2 : 0)) / this._renderer.dimensions.actualCellWidth); - coords[1] = Math.ceil(coords[1] / this._renderer.dimensions.actualCellHeight); - coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0)); - coords[1] = Math.min(Math.max(coords[1], 1), rowCount); - return coords; - }; - MouseHelper.prototype.getRawByteCoords = function (event, element, charMeasure, lineHeight, colCount, rowCount) { - var coords = this.getCoords(event, element, charMeasure, lineHeight, colCount, rowCount); - var x = coords[0]; - var y = coords[1]; - x += 32; - y += 32; - return { x: x, y: y }; - }; - return MouseHelper; -}()); -exports.MouseHelper = MouseHelper; - - - -},{}],34:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var ScreenDprMonitor = (function () { - function ScreenDprMonitor() { - } - ScreenDprMonitor.prototype.setListener = function (listener) { - var _this = this; - if (this._listener) { - this.clearListener(); - } - this._listener = listener; - this._outerListener = function () { - _this._listener(window.devicePixelRatio, _this._currentDevicePixelRatio); - _this._updateDpr(); - }; - this._updateDpr(); - }; - ScreenDprMonitor.prototype._updateDpr = function () { - if (this._resolutionMediaMatchList) { - this._resolutionMediaMatchList.removeListener(this._outerListener); - } - this._currentDevicePixelRatio = window.devicePixelRatio; - this._resolutionMediaMatchList = window.matchMedia("screen and (resolution: " + window.devicePixelRatio + "dppx)"); - this._resolutionMediaMatchList.addListener(this._outerListener); - }; - ScreenDprMonitor.prototype.clearListener = function () { - if (!this._listener) { - return; - } - this._resolutionMediaMatchList.removeListener(this._outerListener); - this._listener = null; - this._outerListener = null; - }; - return ScreenDprMonitor; -}()); -exports.ScreenDprMonitor = ScreenDprMonitor; - - - -},{}],35:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BELL_SOUND = 'data:audio/wav;base64,UklGRigBAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQQBAADpAFgCwAMlBZoG/wdmCcoKRAypDQ8PbRDBEQQTOxRtFYcWlBePGIUZXhoiG88bcBz7HHIdzh0WHlMeZx51HmkeUx4WHs8dah0AHXwc3hs9G4saxRnyGBIYGBcQFv8U4RPAEoYRQBACD70NWwwHC6gJOwjWBloF7gOBAhABkf8b/qv8R/ve+Xf4Ife79W/0JfPZ8Z/wde9N7ijtE+wU6xvqM+lb6H7nw+YX5mrlxuQz5Mzje+Ma49fioeKD4nXiYeJy4pHitOL04j/jn+MN5IPkFOWs5U3mDefM55/ogOl36m7rdOyE7abuyu8D8Unyj/Pg9D/2qfcb+Yn6/vuK/Qj/lAAlAg=='; - - - -},{}],36:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Terminal_1 = require("./Terminal"); -module.exports = Terminal_1.Terminal; - - - -},{"./Terminal":13}]},{},[36])(36) -}); -//# sourceMappingURL=xterm.js.map - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.fit = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o + - - + + -
+