diff --git a/.bithoundrc b/.bithoundrc deleted file mode 100644 index cc9802b..0000000 --- a/.bithoundrc +++ /dev/null @@ -1,21 +0,0 @@ -{ - "critics": { - "lint": { - "engine": "standard" - }, - "wc": { - "limit": 5000 - } - }, - "dependencies": { - "mute": [ - "read-config", - "socket.io", - "standard", - "bithound" - ] - }, - "ignore": [ - "public/webssh2.bundle.js", - ] -} diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index b9c0f53..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -engines: - csslint: - enabled: true - exclude_paths: - - "client/public/*" - duplication: - exclude_paths: - - "client/public/*" - - "workspace/*" - enabled: true - config: - languages: - - ruby - - javascript - - python - - php - eslint: - enabled: true - fixme: - enabled: true - -ratings: - paths: - - "**.css" - - "**.inc" - - "**.js" - - "**.jsx" - - "**.module" - - "**.php" - - "**.py" - - "**.rb" -exclude_paths: -- "node_modules/" -- "client/public/*" -- "workspace/*" diff --git a/.csslintrc b/.csslintrc deleted file mode 100644 index aacba95..0000000 --- a/.csslintrc +++ /dev/null @@ -1,2 +0,0 @@ ---exclude-exts=.min.css ---ignore=adjoining-classes,box-model,ids,order-alphabetical,unqualified-attributes diff --git a/.snyk b/.snyk deleted file mode 100644 index 88ba614..0000000 --- a/.snyk +++ /dev/null @@ -1,4 +0,0 @@ -# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. -version: v1.13.1 -ignore: {} -patch: {} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ec20cb0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 6 - - 10 diff --git a/Build/Release/BIG-IP-ILX-WebSSH2-0.2.8.tgz b/Build/Release/BIG-IP-ILX-WebSSH2-0.2.8.tgz deleted file mode 100644 index 15d257e..0000000 Binary files a/Build/Release/BIG-IP-ILX-WebSSH2-0.2.8.tgz and /dev/null differ diff --git a/Build/Release/BIG-IP-ILX-WebSSH2-0.2.8.tgz.sha256 b/Build/Release/BIG-IP-ILX-WebSSH2-0.2.8.tgz.sha256 deleted file mode 100644 index 2e20490..0000000 --- a/Build/Release/BIG-IP-ILX-WebSSH2-0.2.8.tgz.sha256 +++ /dev/null @@ -1 +0,0 @@ -e2e70f7d2949b6c8fe0299f888a3725763a62c01a1faea1fb729babc2ed51c92 Build/Release/BIG-IP-ILX-WebSSH2-0.2.8.tgz diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 46a51eb..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at wmchurch@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 7dbec3a..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,94 +0,0 @@ -Guidelines for contributing code: - -Make sure code passes linting from (StandardJS)[https://standardjs.com/] - - -# Contributing - -When contributing to this repository, please first discuss the change you wish to make via issue, -email, or any other method with the owners of this repository before making a change. - -Please note we have a code of conduct, please follow it in all your interactions with the project. - -## Pull Request Process - -1. Ensure any install or build dependencies are removed before the end of the layer when doing a - build. -2. Make sure code passes linting from (StandardJS)[https://standardjs.com/] -3. Explain what you're trying to accomplish in your commits -4. Update changelog and Readme if needed. - -## Code of Conduct - -### Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -### Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -### Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -### Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -### Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at [INSERT EMAIL ADDRESS]. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -### Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e7029c9..0000000 --- a/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:8.6 - -WORKDIR /usr/src -COPY app/ /usr/src/ -RUN npm install --production -EXPOSE 2222 -CMD npm run start \ No newline at end of file diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md deleted file mode 100644 index a93987c..0000000 --- a/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ -Depending on the type of issue, please include the follwing information: -- Node and NPM Version - - `node -v` - - `npm -v` -- Server OS Version / Distribution / Processor Architecture - - `uname -a` - - `cat /etc/os-release` -- WebSSH2 release version - - `grep version app/package.json` -- OS and Version of SSH server connecting to - - `uname -a` - - `sshd -v` -- Browser Version and OS - - Information from brwoser's About... or a screenshot of the about screen. -- Any log or messages from the WebSSH2 output diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 2b64768..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,15 +0,0 @@ -pipeline { - agent { - docker { - image 'node:6-alpine' - args '-p 3000:3000' - } - } - stages { - stage('Build') { - steps { - sh 'npm install' - } - } - } -} \ No newline at end of file diff --git a/app/app.js b/app/app.js new file mode 100644 index 0000000..2d4c831 --- /dev/null +++ b/app/app.js @@ -0,0 +1,90 @@ +// app/app.js +"use strict"; +/* jshint esversion: 6, asi: true, node: true */ + +const path = require("path"); +const express = require("express"); +const compression = require("compression"); +const session = require("express-session"); +const logger = require("morgan"); +const socketIo = require("socket.io"); +const myutil = require("./util"); +const config = require("./config"); +const socketHandler = require("./socket"); + +const app = express(); +const server = require("http").Server(app); + +// Session middleware +const sessionMiddleware = session({ + secret: config.session.secret, + name: config.session.name, + resave: false, + saveUninitialized: true, + cookie: { + secure: process.env.NODE_ENV === "production", + maxAge: 24 * 60 * 60 * 1000, + }, +}); + +// Express middleware +app.use(compression({ level: 9 })); +app.use(sessionMiddleware); +if (config.accesslog) app.use(logger("common")); +app.disable("x-powered-by"); + +// Socket.IO setup +const io = socketIo(server, { + path: "/ssh/socket.io", + cors: { + origin: "http://localhost:8080", + methods: ["GET", "POST"], + credentials: true, + }, +}); + +// Socket.io middleware +io.use((socket, next) => { + sessionMiddleware(socket.request, socket.request.res || {}, next); +}); + +// WebSocket handling +io.on("connection", (socket) => { + console.log( + "New connection:", + socket.id, + "Transport:", + socket.conn.transport.name + ); + + // Call the imported socket handler function only once per connection + if (!socket.handled) { + socketHandler(io, socket); + socket.handled = true; + } + + socket.on("disconnect", (reason) => { + console.log("Client disconnected:", socket.id, reason); + }); +}); + +// Error handling +app.use((req, res, next) => { + res.status(404).send("Sorry can't find that!"); +}); + +app.use((err, req, res, next) => { + console.error(err.stack); + res.status(500).send("Something broke!"); +}); + +// Graceful shutdown +process.on("SIGINT", () => { + console.log("SIGINT signal received: closing HTTP server"); + server.close(() => { + console.log("HTTP server closed"); + process.exit(0); + }); +}); + +module.exports = { server, config, io }; diff --git a/app/client/public/client.htm b/app/client/public/client.htm deleted file mode 100644 index 14799d3..0000000 --- a/app/client/public/client.htm +++ /dev/null @@ -1,32 +0,0 @@ - - - - - WebSSH2 - - - -
- -
-
- - -
-
-
- - diff --git a/app/client/public/favicon.ico b/app/client/public/favicon.ico deleted file mode 100644 index 5e4be95..0000000 Binary files a/app/client/public/favicon.ico and /dev/null differ diff --git a/app/client/public/webssh2.bundle.js b/app/client/public/webssh2.bundle.js deleted file mode 100644 index 8e56f00..0000000 --- a/app/client/public/webssh2.bundle.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! Version 0.2.12 - 2024-07-10T13:49:24.747Z - 533f719 */ -!function(t){var e={};function n(r){var i;return(e[r]||(i=e[r]={i:r,l:!1,exports:{}},t[r].call(i.exports,i,i.exports,n),i.l=!0,i)).exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/ssh/",n(n.s=53)}([function(t,e,n){var r,i=n(41),o=n(20),s=n(42),a=n(43),l=n(44),c=("undefined"!=typeof ArrayBuffer&&(r=n(45)),"undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent)),h="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),u=c||h,f=(e.protocol=3,e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6}),p=i(f),d={type:"error",data:"parser error"},m=n(46);function _(t,e,n){for(var r=new Array(t.length),i=a(t.length,n),o=0;o=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;var n=(t="string"!=typeof t?""+t:t).length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return D(t).length;default:if(r)return M(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var i,o=!1;if((e=void 0===e||e<0?0:e)>this.length)return"";if((n=void 0===n||n>this.length?this.length:n)<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t=t||"utf8";;)switch(t){case"hex":var s=e,a=n,l=this.length;(!a||a<0||l=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=l.from(e,r)),l.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var o=1,s=t.length,a=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s/=o=2,a/=2,n/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i)for(var c=-1,h=n;h>8,i.push(n%256),i.push(r);return i}(e,t.length-n),t,n,r)}function C(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i>>10&1023|55296),h=56320|1023&h),r.push(h),i+=u}var f=r,p=f.length;if(p<=w)return String.fromCharCode.apply(String,f);for(var d="",m=0;mn)&&(t+=" ... "),""},l.prototype.compare=function(t,e,n,r,i){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),(e=void 0===e?0:e)<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(i<=r&&n<=e)return 0;if(i<=r)return-1;if(n<=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(r,i),h=t.slice(e,n),u=0;uthis.length)throw new RangeError("Attempt to write outside buffer bounds");r=r||"utf8";for(var o,s,a,l=!1;;)switch(r){case"hex":var c=t,h=e,u=n,f=(h=Number(h)||0,this.length-h);if((!u||f<(u=Number(u)))&&(u=f),(f=c.length)%2!=0)throw new TypeError("Invalid hex string");f/2t.length)throw new RangeError("Index out of range")}function E(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function x(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function A(t,e,n,r){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,r,o){return o||A(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function T(t,e,n,r,o){return o||A(t,0,n,8),i.write(t,e,n,r,52,8),n+8}l.prototype.slice=function(t,e){var n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):n>>8):E(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):E(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):x(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,r){t=+t,e|=0,r||S(this,t,e,n,(r=Math.pow(2,8*n-1))-1,-r);var i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},l.prototype.writeIntBE=function(t,e,n,r){t=+t,e|=0,r||S(this,t,e,n,(r=Math.pow(2,8*n-1))-1,-r);var i=n-1,o=1,s=0;for(this[e+i]=255&t;0<=--i&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&(t=t<0?255+t+1:t),e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):E(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):E(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):x(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return T(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return T(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,r){if(n=n||0,r||0===r||(r=this.length),e>=t.length&&(e=t.length),(r=0=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length);var i,o=(r=t.length-e>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(t=t||0))for(a=e;a>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function D(t){return r.toByteArray(function(t){var e;if((t=((e=t).trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function O(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(16))},function(t,e,n){var r=n(39);t.exports=function(t){var e=t.xdomain,n=t.xscheme;t=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!n&&t)return new XDomainRequest}catch(t){}if(!e)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}},function(t,e,n){var r=n(0);function i(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.isReactNative=t.isReactNative,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}n(1)((t.exports=i).prototype),i.prototype.onError=function(t,e){return(t=new Error(t)).type="TransportError",t.description=e,this.emit("error",t),this},i.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(t){t=r.decodePacket(t,this.socket.binaryType),this.onPacket(t)},i.prototype.onPacket=function(t){this.emit("packet",t)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,n){t.exports=function t(e,n,r){function i(o,s){if(!n[o]){var a;if(!e[o])throw(a=new Error("Cannot find module '"+o+"'")).code="MODULE_NOT_FOUND",a;a=n[o]={exports:{}},e[o][0].call(a.exports,(function(t){return i(e[o][1][t]||t)}),a,a.exports,t,e,n,r)}return n[o].exports}for(var o=0;ot;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},f.prototype._createAccessibilityTreeNode=function(){var t=document.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t},f.prototype._onTab=function(t){for(var e=0;ethis._rows},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"isCursorInViewport",{get:function(){var t=this.ybase+this.y-this.ydisp;return 0<=t&&tn.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:e:t},a.prototype.fillViewportRows=function(t){if(0===this.lines.length){void 0===t&&(t=i.DEFAULT_ATTR_DATA);for(var e=this._rows;e--;)this.lines.push(this.getBlankLine(t))}},a.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},a.prototype.resize=function(t,e){var n=this.getNullCell(i.DEFAULT_ATTR_DATA),r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),0e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));rt))for(o=0;othis._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))},a.prototype._reflowLarger=function(t,e){var n=o.reflowLargerGetLinesToRemove(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(i.DEFAULT_ATTR_DATA));0x+T){for(var R=L.newLines.length-1;0<=R;R--)this.lines.set(m--,L.newLines[R]);m++,k.push({index:x+1,amount:L.newLines.length}),T+=L.newLines.length,L=r[++A]}else this.lines.set(m,S[x--]);var M=0;for(m=k.length-1;0<=m;m--)k[m].index+=M,this.lines.onInsertEmitter.fire(k[m]),M+=k[m].amount;0<(E=Math.max(0,E+s-this.lines.maxLength))&&this.lines.onTrimEmitter.fire(E)}},a.prototype.stringIndexToBufferIndex=function(t,e,n){for(void 0===n&&(n=!1);e;){var r=this.lines.get(t);if(!r)return[-1,-1];for(var o=n?r.getTrimmedLength():r.length,s=0;s=this._cols?this._cols-1:t<0?0:t},a.prototype.nextStop=function(t){for(null==t&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t},a.prototype.addMarker=function(t){var e=this,n=new s.Marker(t);return this.markers.push(n),n.register(this.lines.onTrim((function(t){n.line-=t,n.line<0&&n.dispose()}))),n.register(this.lines.onInsert((function(t){n.line>=t.index&&(n.line+=t.amount)}))),n.register(this.lines.onDelete((function(t){n.line>=t.index&&n.linet.index&&(n.line-=t.amount)}))),n.register(n.onDispose((function(){return e._removeMarker(n)}))),n},a.prototype._removeMarker=function(t){this.markers.splice(this.markers.indexOf(t),1)},a.prototype.iterator=function(t,e,n,r,i){return new l(this,t,e,n,r,i)},t=a;function a(t,e){this._terminal=t,this._hasScrollback=e,this.savedCurAttrData=i.DEFAULT_ATTR_DATA.clone(),this.markers=[],this._nullCell=i.CellData.fromCharData([0,i.NULL_CELL_CHAR,i.NULL_CELL_WIDTH,i.NULL_CELL_CODE]),this._whitespaceCell=i.CellData.fromCharData([0,i.WHITESPACE_CELL_CHAR,i.WHITESPACE_CELL_WIDTH,i.WHITESPACE_CELL_CODE]),this._cols=this._terminal.cols,this._rows=this._terminal.rows,this.clear()}n.Buffer=t,c.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(t.last=this._endIndex+this._endOverscan),t.first=Math.max(t.first,0),t.last=Math.min(t.last,this._buffer.lines.length),""),n=t.first;n<=t.last;++n)e+=this._buffer.translateBufferLineToString(n,this._trimRight);return this._current=t.last+1,{range:t,content:e}};var l=c;function c(t,e,n,r,i,o){void 0===n&&(n=0),void 0===r&&(r=t.lines.length),void 0===i&&(i=0),void 0===o&&(o=0),this._buffer=t,this._trimRight=e,this._startIndex=n,this._endIndex=r,this._startOverscan=i,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}n.BufferStringIterator=l},{"./common/CircularList":20,"./core/buffer/BufferLine":29,"./core/buffer/BufferReflow":30,"./core/buffer/Marker":31}],3:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=t("./Buffer"),i=t("./common/EventEmitter2");function o(t){this._terminal=t,this._onBufferActivate=new i.EventEmitter2,this._normal=new r.Buffer(this._terminal,!0),this._normal.fillViewportRows(),this._alt=new r.Buffer(this._terminal,!1),this._activeBuffer=this._normal,this.setupTabStops()}Object.defineProperty(o.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"alt",{get:function(){return this._alt},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"normal",{get:function(){return this._normal},enumerable:!0,configurable:!0}),o.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}))},o.prototype.activateAltBuffer=function(t){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(t),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}))},o.prototype.resize=function(t,e){this._normal.resize(t,e),this._alt.resize(t,e)},o.prototype.setupTabStops=function(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)},n.BufferSet=o},{"./Buffer":2,"./common/EventEmitter2":23}],4:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=t("./common/EventEmitter2");function i(t,e){this._onCharSizeChanged=new r.EventEmitter2,this._document=t,this._parentElement=e,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)}Object.defineProperty(i.prototype,"onCharSizeChanged",{get:function(){return this._onCharSizeChanged.event},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),i.prototype.measure=function(t){var e;this._measureElement.style.fontFamily=t.fontFamily,this._measureElement.style.fontSize=t.fontSize+"px",0!==(t=this._measureElement.getBoundingClientRect()).width&&0!==t.height&&(e=Math.ceil(t.height),this._width!==t.width||this._height!==e)&&(this._width=t.width,this._height=e,this._onCharSizeChanged.fire())},n.CharMeasure=i},{"./common/EventEmitter2":23}],5:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=t("./common/TypedArrayUtils");n.wcwidth=function(t){var e=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];var i=0|t.control,o=new Uint8Array(65536);r.fill(o,1),o[0]=t.nul,r.fill(o,t.control,1,32),r.fill(o,t.control,127,160),r.fill(o,2,4352,4448),o[9001]=2,o[9002]=2,r.fill(o,2,11904,42192),o[12351]=1,r.fill(o,2,44032,55204),r.fill(o,2,63744,64256),r.fill(o,2,65040,65050),r.fill(o,2,65072,65136),r.fill(o,2,65280,65377),r.fill(o,2,65504,65511);for(var s=0;se[i][1]))for(;r<=i;)if(t>e[n=r+i>>1][1])r=1+n;else{if(!(t=r)return e+n.wcwidth(o);var s=t.charCodeAt(i);56320<=s&&s<=57343?o=1024*(o-55296)+s-56320+65536:e+=n.wcwidth(s)}e+=n.wcwidth(o)}return e}},{"./common/TypedArrayUtils":26}],6:[function(t,e,n){function r(t){return t.replace(/\r?\n/g,"\r")}function i(t,e){return e?"[200~"+t+"[201~":t}function o(t,e){var n=e.screenElement.getBoundingClientRect(),r=t.clientX-n.left-10;t=t.clientY-n.top-10;e.textarea.style.position="absolute",e.textarea.style.width="20px",e.textarea.style.height="20px",e.textarea.style.left=r+"px",e.textarea.style.top=t+"px",e.textarea.style.zIndex="1000",e.textarea.focus(),setTimeout((function(){e.textarea.style.position=null,e.textarea.style.width=null,e.textarea.style.height=null,e.textarea.style.left=null,e.textarea.style.top=null,e.textarea.style.zIndex=null}),200)}Object.defineProperty(n,"__esModule",{value:!0}),n.prepareTextForTerminal=r,n.bracketTextForPaste=i,n.copyHandler=function(t,e,n){e.browser.isMSIE?window.clipboardData.setData("Text",n.selectionText):t.clipboardData.setData("text/plain",n.selectionText),t.preventDefault()},n.pasteHandler=function(t,e){function n(n){n=i(n=r(n),e.bracketedPasteMode),e.handler(n),e.textarea.value="",e.emit("paste",n),e.cancel(t)}t.stopPropagation(),e.browser.isMSIE?window.clipboardData&&n(window.clipboardData.getData("Text")):t.clipboardData&&n(t.clipboardData.getData("text/plain"))},n.moveTextAreaUnderMouseCursor=o,n.rightClickHandler=function(t,e,n,r){o(t,e),r&&!n.isClickInSelection(t)&&n.selectWordAtCursor(t),e.textarea.value=n.selectionText,e.textarea.select()}},{}],7:[function(t,e,n){function r(t,e,n){this._textarea=t,this._compositionView=e,this._terminal=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:null,end:null}}Object.defineProperty(n,"__esModule",{value:!0}),r.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},r.prototype.compositionupdate=function(t){var e=this;this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout((function(){e._compositionPosition.end=e._textarea.value.length}),0)},r.prototype.compositionend=function(){this._finalizeComposition(!0)},r.prototype.keydown=function(t){if(this._isComposing||this._isSendingComposition){if(229===t.keyCode)return!1;if(16===t.keyCode||17===t.keyCode||18===t.keyCode)return!1;this._finalizeComposition(!1)}return 229!==t.keyCode||(this._handleAnyTextareaChanges(),!1)},r.prototype._finalizeComposition=function(t){var e,n=this;this._compositionView.classList.remove("active"),this._isComposing=!1,this._clearTextareaPosition(),t?(e={start:this._compositionPosition.start,end:this._compositionPosition.end},this._isSendingComposition=!0,setTimeout((function(){var t;n._isSendingComposition&&(n._isSendingComposition=!1,void 0,t=n._isComposing?n._textarea.value.substring(e.start,e.end):n._textarea.value.substring(e.start),n._terminal.handler(t))}),0)):(this._isSendingComposition=!1,t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end),this._terminal.handler(t))},r.prototype._handleAnyTextareaChanges=function(){var t=this,e=this._textarea.value;setTimeout((function(){var n;t._isComposing||0<(n=t._textarea.value.replace(e,"")).length&&t._terminal.handler(n)}),0)},r.prototype.updateCompositionElements=function(t){var e,n,r,i=this;this._isComposing&&(this._terminal.buffer.isCursorInViewport&&(r=Math.ceil(this._terminal.charMeasure.height*this._terminal.options.lineHeight),e=this._terminal.buffer.y*r,n=this._terminal.buffer.x*this._terminal.charMeasure.width,this._compositionView.style.left=n+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._terminal.options.fontFamily,this._compositionView.style.fontSize=this._terminal.options.fontSize+"px",r=this._compositionView.getBoundingClientRect(),this._textarea.style.left=n+"px",this._textarea.style.top=e+"px",this._textarea.style.width=r.width+"px",this._textarea.style.height=r.height+"px",this._textarea.style.lineHeight=r.height+"px"),t||setTimeout((function(){return i.updateCompositionElements(!0)}),0))},r.prototype._clearTextareaPosition=function(){this._textarea.style.left="",this._textarea.style.top=""},n.CompositionHelper=r},{}],8:[function(t,e,n){var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=(Object.defineProperty(n,"__esModule",{value:!0}),t("./common/Lifecycle")),s=t("./core/input/TextDecoder");function a(t,e){for(var n=e-t,r=new Array(n);n--;)r[n]=--e;return r}c.prototype.add=function(t,e,n,r){this.table[e<<8|t]=(0|n)<<4|(void 0===r?e:r)},c.prototype.addMany=function(t,e,n,r){for(var i=0;i>4){case 2:a=~a?a:m;break;case 3:~a&&(this._printHandler(t,a,m),a=-1),(d=this._executeHandlers[n])?d():this._executeHandlerFb(n);break;case 0:~a?(this._printHandler(t,a,m),a=-1):~l&&(p.put(t,l,m),l=-1);break;case 1:if(159=s)if(l)r.x=0,r.y++,r.y>r.scrollBottom?(r.y--,this._terminal.scroll(!0)):r.lines.get(r.y).isWrapped=!0,p=r.lines.get(r.y+r.ybase);else if(2===g)continue;if(c&&(p.insertCells(r.x,g,r.getNullCell(h)),2===p.getWidth(s-1))&&p.setCellFromCodePoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,h.fg,h.bg),p.setCellFromCodePoint(r.x++,_,g,h.fg,h.bg),0t.scrollBottom&&(t.y--,this._terminal.scroll()),t.x>=this._terminal.cols&&t.x--,this._onLineFeed.fire()},y.prototype.carriageReturn=function(){this._terminal.buffer.x=0},y.prototype.backspace=function(){0=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1),this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--},y.prototype.cursorForward=function(t){t=t[0],this._terminal.buffer.x+=t=t<1?1:t,this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)},y.prototype.cursorBackward=function(t){(t=t[0])<1&&(t=1),this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--,this._terminal.buffer.x-=t,this._terminal.buffer.x<0&&(this._terminal.buffer.x=0)},y.prototype.cursorNextLine=function(t){t=t[0],this._terminal.buffer.y+=t=t<1?1:t,this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1),this._terminal.buffer.x=0},y.prototype.cursorPrecedingLine=function(t){t=t[0],this._terminal.buffer.y-=t=t<1?1:t,this._terminal.buffer.y<0&&(this._terminal.buffer.y=0),this._terminal.buffer.x=0},y.prototype.cursorCharAbsolute=function(t){t=t[0],this._terminal.buffer.x=(t=t<1?1:t)-1},y.prototype.cursorPosition=function(t){var e=t[0]-1;t=2<=t.length?t[1]-1:0;e<0?e=0:e>=this._terminal.rows&&(e=this._terminal.rows-1),t<0?t=0:t>=this._terminal.cols&&(t=this._terminal.cols-1),this._terminal.buffer.x=t,this._terminal.buffer.y=e},y.prototype.cursorForwardTab=function(t){for(var e=t[0]||1;e--;)this._terminal.buffer.x=this._terminal.buffer.nextStop()},y.prototype._eraseInBufferLine=function(t,e,n,r){void 0===r&&(r=!1),(t=this._terminal.buffer.lines.get(this._terminal.buffer.ybase+t)).replaceCells(e,n,this._terminal.buffer.getNullCell(this._terminal.eraseAttrData())),r&&(t.isWrapped=!1)},y.prototype._resetBufferLine=function(t){this._eraseInBufferLine(t,0,this._terminal.cols,!0)},y.prototype.eraseInDisplay=function(t){var e;switch(t[0]){case 0:for(e=this._terminal.buffer.y,this._terminal.updateRange(e),this._eraseInBufferLine(e++,this._terminal.buffer.x,this._terminal.cols,0===this._terminal.buffer.x);e=this._terminal.cols&&(this._terminal.buffer.lines.get(e+1).isWrapped=!1);e--;)this._resetBufferLine(e);this._terminal.updateRange(0);break;case 2:for(e=this._terminal.rows,this._terminal.updateRange(e-1);e--;)this._resetBufferLine(e);this._terminal.updateRange(0);break;case 3:var n=this._terminal.buffer.lines.length-this._terminal.rows;0=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)},y.prototype.hPositionRelative=function(t){t=t[0],this._terminal.buffer.x+=t=t<1?1:t,this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)},y.prototype.repeatPrecedingCharacter=function(t){var e=this._terminal.buffer,n=e.lines.get(e.ybase+e.y);n.loadCell(e.x-1,this._workCell),n.replaceCells(e.x,e.x+(t[0]||1),void 0!==this._workCell.content?this._workCell:e.getNullCell(f.DEFAULT_ATTR_DATA))},y.prototype.sendDeviceAttributes=function(t,e){0"===e&&(this._terminal.is("xterm")?this._terminal.handler(o.C0.ESC+"[>0;276;0c"):this._terminal.is("rxvt-unicode")?this._terminal.handler(o.C0.ESC+"[>85;95;0c"):this._terminal.is("linux")?this._terminal.handler(t[0]+"c"):this._terminal.is("screen")&&this._terminal.handler(o.C0.ESC+"[>83;40003;0c")):this._terminal.is("xterm")||this._terminal.is("rxvt-unicode")||this._terminal.is("screen")?this._terminal.handler(o.C0.ESC+"[?1;2c"):this._terminal.is("linux")&&this._terminal.handler(o.C0.ESC+"[?6c"))},y.prototype.linePosAbsolute=function(t){t=t[0],this._terminal.buffer.y=(t=t<1?1:t)-1,this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1)},y.prototype.vPositionRelative=function(t){t=t[0],this._terminal.buffer.y+=t=t<1?1:t,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--},y.prototype.hVPosition=function(t){t[0]<1&&(t[0]=1),t[1]<1&&(t[1]=1),this._terminal.buffer.y=t[0]-1,this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1),this._terminal.buffer.x=t[1]-1,this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)},y.prototype.tabClear=function(t){(t=t[0])<=0?delete this._terminal.buffer.tabs[this._terminal.buffer.x]:3===t&&(this._terminal.buffer.tabs={})},y.prototype.setMode=function(t,e){if(1",(function(){return r.keypadNumericMode()})),r._parser.setEscHandler("c",(function(){return r.reset()})),r._parser.setEscHandler("n",(function(){return r.setgLevel(2)})),r._parser.setEscHandler("o",(function(){return r.setgLevel(3)})),r._parser.setEscHandler("|",(function(){return r.setgLevel(3)})),r._parser.setEscHandler("}",(function(){return r.setgLevel(2)})),r._parser.setEscHandler("~",(function(){return r.setgLevel(1)})),r._parser.setEscHandler("%@",(function(){return r.selectDefaultCharset()})),r._parser.setEscHandler("%G",(function(){return r.selectDefaultCharset()})),this);for(n in s.CHARSETS)!function(t){i._parser.setEscHandler("("+t,(function(){return r.selectCharset("("+t)})),i._parser.setEscHandler(")"+t,(function(){return r.selectCharset(")"+t)})),i._parser.setEscHandler("*"+t,(function(){return r.selectCharset("*"+t)})),i._parser.setEscHandler("+"+t,(function(){return r.selectCharset("+"+t)})),i._parser.setEscHandler("-"+t,(function(){return r.selectCharset("-"+t)})),i._parser.setEscHandler("."+t,(function(){return r.selectCharset("."+t)})),i._parser.setEscHandler("/"+t,(function(){return r.selectCharset("/"+t)}))}(n);return r._parser.setErrorHandler((function(t){return r._terminal.error("Parsing error: ",t),t})),r._parser.setDcsHandler("$q",new m(r._terminal)),r}n.InputHandler=t},{"./CharWidth":5,"./EscapeSequenceParser":8,"./common/EventEmitter2":23,"./common/Lifecycle":24,"./common/TypedArrayUtils":26,"./common/data/EscapeSequences":28,"./core/buffer/BufferLine":29,"./core/data/Charsets":32,"./core/input/TextDecoder":34}],10:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=t("./MouseZoneManager"),i=t("./CharWidth"),o=t("./common/EventEmitter2");function s(t){this._terminal=t,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onLinkHover=new o.EventEmitter2,this._onLinkLeave=new o.EventEmitter2,this._onLinkTooltip=new o.EventEmitter2,this._rowsToLinkify={start:null,end:null}}Object.defineProperty(s.prototype,"onLinkHover",{get:function(){return this._onLinkHover.event},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onLinkLeave",{get:function(){return this._onLinkLeave.event},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!0,configurable:!0}),s.prototype.attachToDom=function(t){this._mouseZoneManager=t},s.prototype.linkifyRows=function(t,e){var n=this;this._mouseZoneManager&&(null===this._rowsToLinkify.start?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=e):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,e)),this._mouseZoneManager.clearAll(t,e),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return n._linkifyRows()}),s.TIME_BEFORE_LINKIFY))},s.prototype._linkifyRows=function(){this._rowsTimeoutId=null;var t=(e=this._terminal.buffer).ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var e=e.ydisp+Math.min(this._rowsToLinkify.end,this._terminal.rows)+1,n=Math.ceil(s.OVERSCAN_CHAR_LIMIT/this._terminal.cols),r=this._terminal.buffer.iterator(!1,t,e,n,n);r.hasNext();)for(var i=r.next(),o=0;o>9&511),void(n.validationCallback?n.validationCallback(u,(function(t){i._rowsTimeoutId||t&&i._addLink(l[1],l[0]-i._terminal.buffer.ydisp,u,n,h)})):a._addLink(l[1],l[0]-a._terminal.buffer.ydisp,u,n,h)));if(a._terminal.debug)throw console.log({match:r,matcher:n}),new Error("match found without corresponding matchIndex");return"break"}(););},s.prototype._addLink=function(t,e,n,o,s){var a=this,l=i.getStringCellWidth(n),c=t%this._terminal.cols,h=e+Math.floor(t/this._terminal.cols),u=(c+l)%this._terminal.cols,f=h+Math.floor((c+l)/this._terminal.cols);0===u&&(u=this._terminal.cols,f--),this._mouseZoneManager.add(new r.MouseZone(1+c,h+1,u+1,f+1,(function(t){if(o.handler)return o.handler(t,n);window.open(n,"_blank")}),(function(){a._onLinkHover.fire(a._createLinkHoverEvent(c,h,u,f,s)),a._terminal.element.classList.add("xterm-cursor-pointer")}),(function(t){a._onLinkTooltip.fire(a._createLinkHoverEvent(c,h,u,f,s)),o.hoverTooltipCallback&&o.hoverTooltipCallback(t,n)}),(function(){a._onLinkLeave.fire(a._createLinkHoverEvent(c,h,u,f,s)),a._terminal.element.classList.remove("xterm-cursor-pointer"),o.hoverLeaveCallback&&o.hoverLeaveCallback()}),(function(t){return!o.willLinkActivate||o.willLinkActivate(t,n)})))},s.prototype._createLinkHoverEvent=function(t,e,n,r,i){return{x1:t,y1:e,x2:n,y2:r,cols:this._terminal.cols,fg:i}},s.TIME_BEFORE_LINKIFY=200,s.OVERSCAN_CHAR_LIMIT=2e3,n.Linkifier=s},{"./CharWidth":5,"./MouseZoneManager":12,"./common/EventEmitter2":23}],11:[function(t,e,n){function r(t){this._renderCoordinator=t}Object.defineProperty(n,"__esModule",{value:!0}),r.getCoordsRelativeToElement=function(t,e){return e=e.getBoundingClientRect(),[t.clientX-e.left,t.clientY-e.top]},r.prototype.getCoords=function(t,e,n,i,o,s){return n.width&&n.height&&(n=r.getCoordsRelativeToElement(t,e))?(n[0]=Math.ceil((n[0]+(s?this._renderCoordinator.dimensions.actualCellWidth/2:0))/this._renderCoordinator.dimensions.actualCellWidth),n[1]=Math.ceil(n[1]/this._renderCoordinator.dimensions.actualCellHeight),n[0]=Math.min(Math.max(n[0],1),i+(s?1:0)),n[1]=Math.min(Math.max(n[1],1),o),n):null},r.prototype.getRawByteCoords=function(t,e,n,r,i){return e=(t=this.getCoords(t,e,n,r,i))[0],n=t[1],{x:e+=32,y:n+=32}},n.MouseHelper=r},{}],12:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=(Object.defineProperty(n,"__esModule",{value:!0}),t("./common/Lifecycle")),a=t("./ui/Lifecycle");o(l,i=s.Disposable),l.prototype.dispose=function(){i.prototype.dispose.call(this),this._deactivate()},l.prototype.add=function(t){this._zones.push(t),1===this._zones.length&&this._activate()},l.prototype.clearAll=function(t,e){if(0!==this._zones.length){e||(t=0,e=this._terminal.rows-1);for(var n=0;nt&&r.y1<=e+1||r.y2>t&&r.y2<=e+1||r.y1e+1)&&(this._currentZone&&this._currentZone===r&&(this._currentZone.leaveCallback(),this._currentZone=null),this._zones.splice(n--,1))}0===this._zones.length&&this._deactivate()}},l.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._terminal.element.addEventListener("mousemove",this._mouseMoveListener),this._terminal.element.addEventListener("mouseleave",this._mouseLeaveListener),this._terminal.element.addEventListener("click",this._clickListener))},l.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._terminal.element.removeEventListener("mousemove",this._mouseMoveListener),this._terminal.element.removeEventListener("mouseleave",this._mouseLeaveListener),this._terminal.element.removeEventListener("click",this._clickListener))},l.prototype._onMouseMove=function(t){this._lastHoverCoords[0]===t.pageX&&this._lastHoverCoords[1]===t.pageY||(this._onHover(t),this._lastHoverCoords=[t.pageX,t.pageY])},l.prototype._onHover=function(t){var e=this,n=this._findZoneEventAt(t);n!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=null,this._tooltipTimeout)&&clearTimeout(this._tooltipTimeout),n)&&((this._currentZone=n).hoverCallback&&n.hoverCallback(t),this._tooltipTimeout=setTimeout((function(){return e._onTooltip(t)}),500))},l.prototype._onTooltip=function(t){this._tooltipTimeout=null;var e=this._findZoneEventAt(t);e&&e.tooltipCallback&&e.tooltipCallback(t)},l.prototype._onMouseDown=function(t){var e;this._initialSelectionLength=this._terminal.getSelection().length,this._areZonesActive&&(e=this._findZoneEventAt(t))&&e.willLinkActivate(t)&&(t.preventDefault(),t.stopImmediatePropagation())},l.prototype._onMouseLeave=function(t){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=null,this._tooltipTimeout)&&clearTimeout(this._tooltipTimeout)},l.prototype._onClick=function(t){var e=this._findZoneEventAt(t),n=this._terminal.getSelection().length;e&&n===this._initialSelectionLength&&(e.clickCallback(t),t.preventDefault(),t.stopImmediatePropagation())},l.prototype._findZoneEventAt=function(t){if(t=this._terminal.mouseHelper.getCoords(t,this._terminal.screenElement,this._terminal.charMeasure,this._terminal.cols,this._terminal.rows))for(var e=t[0],n=t[1],r=0;r=i.x1&&e=i.x1||n===i.y2&&ei.y1&&ne[1]&&t[1]=e[0]&&t[0]=e[0]},h.prototype.selectWordAtCursor=function(t){(t=this._getMouseBufferCoords(t))&&(this._selectWordAt(t,!1),this._model.selectionEnd=null,this.refresh(!0))},h.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},h.prototype.selectLines=function(t,e){this._model.clearSelection(),t=Math.max(t,0),e=Math.min(e,this._terminal.buffer.lines.length-1),this._model.selectionStart=[0,t],this._model.selectionEnd=[this._terminal.cols,e],this.refresh(),this._onSelectionChange.fire()},h.prototype._onTrim=function(t){this._model.onTrim(t)&&this.refresh()},h.prototype._getMouseBufferCoords=function(t){return(t=this._terminal.mouseHelper.getCoords(t,this._terminal.screenElement,this._charMeasure,this._terminal.cols,this._terminal.rows,!0))?(t[0]--,t[1]--,t[1]+=this._terminal.buffer.ydisp,t):null},h.prototype._getMouseEventScrollAmount=function(t){t=r.MouseHelper.getCoordsRelativeToElement(t,this._terminal.screenElement)[1];var e=this._terminal.rows*Math.ceil(this._charMeasure.height*this._terminal.options.lineHeight);return 0<=t&&t<=e?0:(e=this._model.selectionStart[0]||0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++)},h.prototype._onDoubleClick=function(t){(t=this._getMouseBufferCoords(t))&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},h.prototype._onTripleClick=function(t){(t=this._getMouseBufferCoords(t))&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},h.prototype.shouldColumnSelect=function(t){return t.altKey&&!(i.isMac&&this._terminal.options.macOptionClickForcesSelection)},h.prototype._onMouseMove=function(t){t.stopImmediatePropagation();var e=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;this._model.selectionEnd=this._getMouseBufferCoords(t),this._model.selectionEnd&&(2===this._activeSelectionMode?this._model.selectionEnd[1]=r;r++){var i=t.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?n--:1=this._terminal.cols)return null;var i=this._buffer.lines.get(t[1]);if(!i)return null;var o=this._buffer.translateBufferLineToString(t[1],!1),s=this._convertViewportColToCharacterIndex(i,t),a=s,l=t[0]-s,c=0,h=0,u=0,f=0;if(" "===o.charAt(s)){for(;0this._terminal.cols;)e.length-=this._terminal.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?e.start:e.start+e.length,n]}},h.prototype._isCharWordSeparator=function(t){return 0!==t.getWidth()&&0<=" ()[]{}'\"".indexOf(t.getChars())},h.prototype._selectLineAt=function(t){t=this._buffer.getWrappedRangeForLine(t),this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._terminal.cols,t.last],this._model.selectionStartLength=0},t=h;function h(t,e){this._terminal=t,this._charMeasure=e,this._enabled=!0,this._workCell=new a.CellData,this._onLinuxMouseSelection=new l.EventEmitter2,this._onRedrawRequest=new l.EventEmitter2,this._onSelectionChange=new l.EventEmitter2,this._initListeners(),this.enable(),this._model=new o.SelectionModel(t),this._activeSelectionMode=0}n.SelectionManager=t},{"./MouseHelper":11,"./SelectionModel":14,"./common/EventEmitter2":23,"./common/Platform":25,"./core/buffer/BufferLine":29,"./handlers/AltClickHandler":35}],14:[function(t,e,n){function r(t){this._terminal=t,this.clearSelection()}Object.defineProperty(n,"__esModule",{value:!0}),r.prototype.clearSelection=function(){this.selectionStart=null,this.selectionEnd=null,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(r.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"finalSelectionEnd",{get:function(){var t;return this.isSelectAllActive?[this._terminal.cols,this._terminal.buffer.ybase+this._terminal.rows-1]:this.selectionStart?!this.selectionEnd||this.areSelectionValuesReversed()?(t=this.selectionStart[0]+this.selectionStartLength)>this._terminal.cols?[t%this._terminal.cols,this.selectionStart[1]+Math.floor(t/this._terminal.cols)]:[t,this.selectionStart[1]]:this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd:null},enumerable:!0,configurable:!0}),r.prototype.areSelectionValuesReversed=function(){var t=this.selectionStart,e=this.selectionEnd;return!(!t||!e)&&(t[1]>e[1]||t[1]===e[1]&&t[0]>e[0])},r.prototype.onTrim=function(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},n.SelectionModel=r},{}],15:[function(t,e,n){function r(t){this._terminal=t}Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_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==",Object.defineProperty(r,"audioContext",{get:function(){if(!r._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;r._audioContext=new t}return r._audioContext},enumerable:!0,configurable:!0}),r.prototype.playBellSound=function(){var t,e=r.audioContext;e&&(t=e.createBufferSource(),e.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._terminal.options.bellSound)),(function(n){t.buffer=n,t.connect(e.destination),t.start(0)})))},r.prototype._base64ToArrayBuffer=function(t){for(var e=window.atob(t),n=e.length,r=new Uint8Array(n),i=0;in)&&(n=this.buffer.lines.length-n,r=this.buffer.ydisp-n<0,this.buffer.lines.trimStart(n),this.buffer.ybase=Math.max(this.buffer.ybase-n,0),this.buffer.ydisp=Math.max(this.buffer.ydisp-n,0),r)&&this.refresh(0,this.rows-1)}switch(this.options[t]=e,t){case"fontFamily":case"fontSize":this._renderCoordinator&&(this._renderCoordinator.clear(),this.charMeasure.measure(this.options));break;case"drawBoldTextInBrightColors":case"experimentalCharAtlas":case"enableBold":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":this._renderCoordinator&&(this._renderCoordinator.clear(),this._renderCoordinator.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderCoordinator&&this._renderCoordinator.setRenderer(this._createRenderer());break;case"scrollback":this.buffers.resize(this.cols,this.rows),this.viewport&&this.viewport.syncScrollArea();break;case"screenReaderMode":e?!this._accessibilityManager&&this._renderCoordinator&&(this._accessibilityManager=new S.AccessibilityManager(this,this._renderCoordinator.dimensions)):this._accessibilityManager&&(this._accessibilityManager.dispose(),this._accessibilityManager=null);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"windowsMode":e?this._windowsMode||(this._windowsMode=M.applyWindowsMode(this)):this._windowsMode&&(this._windowsMode.dispose(),this._windowsMode=void 0)}this._renderCoordinator&&this._renderCoordinator.onOptionsChanged()}},H.prototype._onTextAreaFocus=function(t){this.sendFocus&&this.handler(f.C0.ESC+"[I"),this.updateCursorStyle(t),this.element.classList.add("focus"),this.showCursor(),this.emit("focus")},H.prototype.blur=function(){return this.textarea.blur()},H.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.sendFocus&&this.handler(f.C0.ESC+"[O"),this.element.classList.remove("focus"),this.emit("blur")},H.prototype._initGlobal=function(){function t(t){return u.pasteHandler(t,e)}var e=this;this._bindKeys(),this.register(b.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&u.copyHandler(t,e,e.selectionManager)}))),this.register(b.addDisposableDomListener(this.textarea,"paste",t)),this.register(b.addDisposableDomListener(this.element,"paste",t)),y.isFirefox?this.register(b.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&u.rightClickHandler(t,e,e.selectionManager,e.options.rightClickSelectsWord)}))):this.register(b.addDisposableDomListener(this.element,"contextmenu",(function(t){u.rightClickHandler(t,e,e.selectionManager,e.options.rightClickSelectsWord)}))),y.isLinux&&this.register(b.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&u.moveTextAreaUnderMouseCursor(t,e)})))},H.prototype._bindKeys=function(){var t=this,e=this;this.register(b.addDisposableDomListener(this.element,"keydown",(function(t){B.activeElement===this&&e._keyDown(t)}),!0)),this.register(b.addDisposableDomListener(this.element,"keypress",(function(t){B.activeElement===this&&e._keyPress(t)}),!0)),this.register(b.addDisposableDomListener(this.element,"keyup",(function(n){var r;16!==(r=n).keyCode&&17!==r.keyCode&&18!==r.keyCode&&t.focus(),e._keyUp(n)}),!0)),this.register(b.addDisposableDomListener(this.textarea,"keydown",(function(e){return t._keyDown(e)}),!0)),this.register(b.addDisposableDomListener(this.textarea,"keypress",(function(e){return t._keyPress(e)}),!0)),this.register(b.addDisposableDomListener(this.textarea,"compositionstart",(function(){return t._compositionHelper.compositionstart()}))),this.register(b.addDisposableDomListener(this.textarea,"compositionupdate",(function(e){return t._compositionHelper.compositionupdate(e)}))),this.register(b.addDisposableDomListener(this.textarea,"compositionend",(function(){return t._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return t._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(e){return t._queueLinkification(e.start,e.end)})))},H.prototype.open=function(t){var e=this;if(this._parent=t||this._parent,!this._parent)throw new Error("Terminal requires a parent element.");this._context=this._parent.ownerDocument.defaultView,this._document=this._parent.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._parent.appendChild(this.element),t=B.createDocumentFragment(),this._viewportElement=B.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this._viewportScrollArea=B.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=B.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=B.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this._mouseZoneManager=new k.MouseZoneManager(this),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return e._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this._mouseZoneManager),this.textarea=B.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.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(b.addDisposableDomListener(this.textarea,"focus",(function(t){return e._onTextAreaFocus(t)}))),this.register(b.addDisposableDomListener(this.textarea,"blur",(function(){return e._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea),this._compositionView=B.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=new l.CompositionHelper(this.textarea,this._compositionView,this),this._helperContainer.appendChild(this._compositionView),this.charMeasure=new g.CharMeasure(B,this._helperContainer),this.element.appendChild(t),this._theme=this.options.theme,this._colorManager=new D.ColorManager(B,this.options.allowTransparency),this._colorManager.setTheme(this._theme),t=this._createRenderer(),this._renderCoordinator=new O.RenderCoordinator(t,this.rows,this.screenElement),this._renderCoordinator.onRender((function(t){return e._onRender.fire(t)})),this.onResize((function(t){return e._renderCoordinator.resize(t.cols,t.rows)})),this.viewport=new h.Viewport(this,this._viewportElement,this._viewportScrollArea,this.charMeasure,this._renderCoordinator.dimensions),this.viewport.onThemeChange(this._colorManager.colors),this.register(this.viewport),this.register(this.onCursorMove((function(){return e._renderCoordinator.onCursorMove()}))),this.register(this.onResize((function(){return e._renderCoordinator.onResize(e.cols,e.rows)}))),this.register(this.addDisposableListener("blur",(function(){return e._renderCoordinator.onBlur()}))),this.register(this.addDisposableListener("focus",(function(){return e._renderCoordinator.onFocus()}))),this.register(this.charMeasure.onCharSizeChanged((function(){return e._renderCoordinator.onCharSizeChanged()}))),this.register(this._renderCoordinator.onDimensionsChange((function(){return e.viewport.syncScrollArea()}))),this.selectionManager=new _.SelectionManager(this,this.charMeasure),this.register(this.selectionManager.onSelectionChange((function(){return e._onSelectionChange.fire()}))),this.register(b.addDisposableDomListener(this.element,"mousedown",(function(t){return e.selectionManager.onMouseDown(t)}))),this.register(this.selectionManager.onRedrawRequest((function(t){return e._renderCoordinator.onSelectionChanged(t.start,t.end,t.columnSelectMode)}))),this.register(this.selectionManager.onLinuxMouseSelection((function(t){e.textarea.value=t,e.textarea.focus(),e.textarea.select()}))),this.register(this.onScroll((function(){e.viewport.syncScrollArea(),e.selectionManager.refresh()}))),this.register(b.addDisposableDomListener(this._viewportElement,"scroll",(function(){return e.selectionManager.refresh()}))),this.mouseHelper=new C.MouseHelper(this._renderCoordinator),this.element.classList.toggle("enable-mouse-events",this.mouseEvents),this.mouseEvents?this.selectionManager.disable():this.selectionManager.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new S.AccessibilityManager(this,this._renderCoordinator.dimensions),this._accessibilityManager.register(this._renderCoordinator.onDimensionsChange((function(t){return e._accessibilityManager.setDimensions(t)})))),this.charMeasure.measure(this.options),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},H.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return new d.Renderer(this,this._colorManager.colors);case"dom":return new x.DomRenderer(this,this._colorManager.colors);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},H.prototype._setTheme=function(t){this._theme=t,this._colorManager&&this._colorManager.setTheme(t),this._renderCoordinator&&this._renderCoordinator.setColors(this._colorManager.colors),this.viewport&&this.viewport.onThemeChange(this._colorManager.colors)},H.prototype.bindMouse=function(){var t=this,e=this.element,n=this,r=32;function i(t){var e=function(t){var e,r,i;switch(t.overrideType||t.type){case"mousedown":e=null!==t.button&&void 0!==t.button?+t.button:null!==t.which&&void 0!==t.which?t.which-1:null,y.isMSIE&&(e=1===e?0:4===e?1:e);break;case"mouseup":e=3;break;case"DOMMouseScroll":e=t.detail<0?64:65;break;case"wheel":e=t.deltaY<0?64:65}return i=(i=t.shiftKey?4:0)|(t.metaKey?8:0)|(r=t.ctrlKey?16:0),n.vt200Mouse?i&=r:n.normalMouse||(i=0),32+(i<<2)+e}(t),i=n.mouseHelper.getRawByteCoords(t,n.screenElement,n.charMeasure,n.cols,n.rows);if(i)switch(s(e,i),t.overrideType||t.type){case"mousedown":r=e;break;case"mouseup":r=32}}function o(t,e){n.utfMouse?2047=this.buffer.ybase&&(this._userScrolling=!1);var n=this.buffer.ydisp;this.buffer.ydisp=Math.max(Math.min(this.buffer.ydisp+t,this.buffer.ybase),0),n!==this.buffer.ydisp&&(e||this._onScroll.fire(this.buffer.ydisp),this.refresh(0,this.rows-1))},H.prototype.scrollPages=function(t){this.scrollLines(t*(this.rows-1))},H.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)},H.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)},H.prototype.scrollToLine=function(t){0!=(t-=this.buffer.ydisp)&&this.scrollLines(t)},H.prototype.writeUtf8=function(t){var e=this;this._isDisposed||t&&(this.writeBufferUtf8.push(t),this.options.useFlowControl&&!this._xoffSentToCatchUp&&5<=this.writeBufferUtf8.length&&(this.handler(f.C0.DC3),this._xoffSentToCatchUp=!0),!this._writeInProgress)&&0t;){var r=this.writeBufferUtf8[t];if(t++,this._xoffSentToCatchUp&&this.writeBufferUtf8.length===t&&(this.handler(f.C0.DC1),this._xoffSentToCatchUp=!1),this._refreshStart=this.buffer.y,this._refreshEnd=this.buffer.y,this._inputHandler.parseUtf8(r),this.updateRange(this.buffer.y),this.refresh(this._refreshStart,this._refreshEnd),12<=Date.now()-n)break}this.writeBufferUtf8.length>t?(50t;){var r=this.writeBuffer[t];if(t++,this._xoffSentToCatchUp&&this.writeBuffer.length===t&&(this.handler(f.C0.DC1),this._xoffSentToCatchUp=!1),this._refreshStart=this.buffer.y,this._refreshEnd=this.buffer.y,this._inputHandler.parse(r),this.updateRange(this.buffer.y),this.refresh(this._refreshStart,this._refreshEnd),12<=Date.now()-n)break}this.writeBuffer.length>t?(50this._refreshEnd&&(this._refreshEnd=t)},H.prototype.maxRange=function(){this._refreshStart=0,this._refreshEnd=this.rows-1},H.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 t=1;tthis.buffer.scrollBottom&&(this.buffer.y--,this.scroll()),this.buffer.x>=this.cols&&this.buffer.x--},H.prototype.reverseIndex=function(){var t;this.buffer.y===this.buffer.scrollTop?(t=this.buffer.scrollBottom-this.buffer.scrollTop,this.buffer.lines.shiftElements(this.buffer.y+this.buffer.ybase,t,1),this.buffer.lines.set(this.buffer.y+this.buffer.ybase,this.buffer.getBlankLine(this.eraseAttrData())),this.updateRange(this.buffer.scrollTop),this.updateRange(this.buffer.scrollBottom)):this.buffer.y--},H.prototype.reset=function(){this.options.rows=this.rows,this.options.cols=this.cols;var t=this._customKeyEventHandler,e=this._inputHandler,n=this.cursorState,r=this.writeBuffer,i=this.writeBufferUtf8,o=this._writeInProgress,s=this._xoffSentToCatchUp,a=this._userScrolling;this._setup(),this._customKeyEventHandler=t,this._inputHandler=e,this.cursorState=n,this.writeBuffer=r,this.writeBufferUtf8=i,this._writeInProgress=o,this._xoffSentToCatchUp=s,this._userScrolling=a,this.refresh(0,this.rows-1),this.viewport&&this.viewport.syncScrollArea()},H.prototype.tabSet=function(){this.buffer.tabs[this.buffer.x]=!0},H.prototype.cancel=function(t,e){if(this.options.cancelEvents||e)return t.preventDefault(),t.stopPropagation(),!1},H.prototype._visualBell=function(){return!1},H.prototype._soundBell=function(){return"sound"===this.options.bellStyle},t=H;function H(t){void 0===t&&(t={});var e=i.call(this)||this;return e.browser=y,e._blankLine=null,e._onCursorMove=new T.EventEmitter2,e._onData=new T.EventEmitter2,e._onKey=new T.EventEmitter2,e._onLineFeed=new T.EventEmitter2,e._onRender=new T.EventEmitter2,e._onResize=new T.EventEmitter2,e._onScroll=new T.EventEmitter2,e._onSelectionChange=new T.EventEmitter2,e._onTitleChange=new T.EventEmitter2,e.options=L.clone(t),e._setup(),e.onCursorMove((function(){return e.emit("cursormove")})),e.onData((function(t){return e.emit("data",t)})),e.onKey((function(t){return e.emit("key",t.key,t.domEvent)})),e.onLineFeed((function(){return e.emit("linefeed")})),e.onRender((function(t){return e.emit("refresh",t)})),e.onResize((function(t){return e.emit("resize",t)})),e.onSelectionChange((function(){return e.emit("selection")})),e.onScroll((function(t){return e.emit("scroll",t)})),e.onTitleChange((function(t){return e.emit("title",t)})),e}n.Terminal=t},{"./AccessibilityManager":1,"./Buffer":2,"./BufferSet":3,"./CharMeasure":4,"./Clipboard":6,"./CompositionHelper":7,"./InputHandler":9,"./Linkifier":10,"./MouseHelper":11,"./MouseZoneManager":12,"./SelectionManager":13,"./SoundManager":15,"./Strings":16,"./Viewport":18,"./WindowsMode":19,"./common/Clone":21,"./common/EventEmitter":22,"./common/EventEmitter2":23,"./common/Platform":25,"./common/data/EscapeSequences":28,"./core/buffer/BufferLine":29,"./core/input/Keyboard":33,"./renderer/RenderCoordinator":43,"./renderer/Renderer":44,"./renderer/atlas/CharAtlasCache":48,"./renderer/dom/DomRenderer":56,"./ui/ColorManager":58,"./ui/Lifecycle":59}],18:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=(Object.defineProperty(n,"__esModule",{value:!0}),t("./common/Lifecycle")),a=t("./ui/Lifecycle");o(l,i=s.Disposable),l.prototype.onDimensionsChance=function(t){this._dimensions=t},l.prototype.onThemeChange=function(t){this._viewportElement.style.backgroundColor=t.background.css},l.prototype._refresh=function(){var t=this;null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},l.prototype._innerRefresh=function(){0this._length)for(var e=this._length;ethis._maxLength?(o=this._length+n.length-this._maxLength,this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)):this._length+=n.length},i.prototype.trimStart=function(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)},i.prototype.shiftElements=function(t,e,n){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(0this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(r=0;r=t.length)){n=(t.length+n)%t.length,r=r>=t.length?t.length:(t.length+r)%t.length;for(var i=n;i>>16&255,t>>>8&255,255&t]},s.fromColorRGB=function(t){return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},s.prototype.clone=function(){var t=new s;return t.fg=this.fg,t.bg=this.bg,t},s.prototype.isInverse=function(){return 67108864&this.fg},s.prototype.isBold=function(){return 134217728&this.fg},s.prototype.isUnderline=function(){return 268435456&this.fg},s.prototype.isBlink=function(){return 536870912&this.fg},s.prototype.isInvisible=function(){return 1073741824&this.fg},s.prototype.isItalic=function(){return 67108864&this.bg},s.prototype.isDim=function(){return 134217728&this.bg},s.prototype.getFgColorMode=function(){return 50331648&this.fg},s.prototype.getBgColorMode=function(){return 50331648&this.bg},s.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},s.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},s.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},s.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},s.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},s.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},s.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},s.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},t=s;function s(){this.fg=0,this.bg=0}n.AttributeData=t,n.DEFAULT_ATTR_DATA=Object.freeze(new t),i(c,a=t),c.fromCharData=function(t){var e=new c;return e.setFromCharData(t),e},c.prototype.isCombined=function(){return 2097152&this.content},c.prototype.getWidth=function(){return this.content>>22},c.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?o.stringFromCodePoint(2097151&this.content):""},c.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},c.prototype.setFromCharData=function(t){this.fg=t[n.CHAR_DATA_ATTR_INDEX],this.bg=0;var e,r,i=!1;2>22,2097152&e?this._combined[t].charCodeAt(this._combined[t].length-1):n]},h.prototype.set=function(t,e){this._data[3*t+1]=e[n.CHAR_DATA_ATTR_INDEX],1>22},h.prototype.hasWidth=function(t){return 12582912&this._data[3*t+0]},h.prototype.getFg=function(t){return this._data[3*t+1]},h.prototype.getBg=function(t){return this._data[3*t+2]},h.prototype.hasContent=function(t){return 4194303&this._data[3*t+0]},h.prototype.getCodePoint=function(t){var e=this._data[3*t+0];return 2097152&e?this._combined[t].charCodeAt(this._combined[t].length-1):2097151&e},h.prototype.isCombined=function(t){return 2097152&this._data[3*t+0]},h.prototype.getString=function(t){var e=this._data[3*t+0];return 2097152&e?this._combined[t]:2097151&e?o.stringFromCodePoint(2097151&e):""},h.prototype.loadCell=function(t,e){var n=3*t;return e.content=this._data[0+n],e.fg=this._data[1+n],e.bg=this._data[2+n],2097152&e.content&&(e.combinedData=this._combined[t]),e},h.prototype.setCell=function(t,e){2097152&e.content&&(this._combined[t]=e.combinedData),this._data[3*t+0]=e.content,this._data[3*t+1]=e.fg,this._data[3*t+2]=e.bg},h.prototype.setCellFromCodePoint=function(t,e,n,r,i){this._data[3*t+0]=e|n<<22,this._data[3*t+1]=r,this._data[3*t+2]=i},h.prototype.addCodepointToCell=function(t,e){var n=this._data[3*t+0];2097152&n?this._combined[t]+=o.stringFromCodePoint(e):(n=2097151&n?(this._combined[t]=o.stringFromCodePoint(2097151&n)+o.stringFromCodePoint(e),-2097152&n|2097152):e|1<<22,this._data[3*t+0]=n)},h.prototype.insertCells=function(t,e,n){if(t%=this.length,ethis.length){var n=new Uint32Array(3*t);this.length&&(3*t>22);return 0},h.prototype.copyCellsFrom=function(t,e,n,r,i){var o=t._data;if(i)for(var s=r-1;0<=s;s--)for(var a=0;a<3;a++)this._data[3*(n+s)+a]=o[3*(e+s)+a];else for(s=0;s>22||1}return i},n.BufferLine=h},{"../../common/Types":27,"../input/TextDecoder":34}],30:[function(t,e,n){function r(t,e,n){var r;return e===t.length-1?t[e].getTrimmedLength():(r=!t[e].hasContent(n-1)&&1===t[e].getWidth(n-1),t=2===t[e+1].getWidth(0),r&&t?n-1:n)}Object.defineProperty(n,"__esModule",{value:!0}),n.reflowLargerGetLinesToRemove=function(t,e,n,i,o){for(var s=[],a=0;a"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};n.evaluateKeyboardEvent=function(t,e,n,o){var s,a={type:0,cancel:!1,key:void 0},l=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:"UIKeyInputUpArrow"===t.key?a.key=e?r.C0.ESC+"OA":r.C0.ESC+"[A":"UIKeyInputLeftArrow"===t.key?a.key=e?r.C0.ESC+"OD":r.C0.ESC+"[D":"UIKeyInputRightArrow"===t.key?a.key=e?r.C0.ESC+"OC":r.C0.ESC+"[C":"UIKeyInputDownArrow"===t.key&&(a.key=e?r.C0.ESC+"OB":r.C0.ESC+"[B");break;case 8:t.shiftKey?a.key=r.C0.BS:t.altKey?a.key=r.C0.ESC+r.C0.DEL:a.key=r.C0.DEL;break;case 9:t.shiftKey?a.key=r.C0.ESC+"[Z":(a.key=r.C0.HT,a.cancel=!0);break;case 13:a.key=r.C0.CR,a.cancel=!0;break;case 27:a.key=r.C0.ESC,a.cancel=!0;break;case 37:l?(a.key=r.C0.ESC+"[1;"+(1+l)+"D",a.key===r.C0.ESC+"[1;3D"&&(a.key=n?r.C0.ESC+"b":r.C0.ESC+"[1;5D")):a.key=e?r.C0.ESC+"OD":r.C0.ESC+"[D";break;case 39:l?(a.key=r.C0.ESC+"[1;"+(1+l)+"C",a.key===r.C0.ESC+"[1;3C"&&(a.key=n?r.C0.ESC+"f":r.C0.ESC+"[1;5C")):a.key=e?r.C0.ESC+"OC":r.C0.ESC+"[C";break;case 38:l?(a.key=r.C0.ESC+"[1;"+(1+l)+"A",a.key===r.C0.ESC+"[1;3A"&&(a.key=r.C0.ESC+"[1;5A")):a.key=e?r.C0.ESC+"OA":r.C0.ESC+"[A";break;case 40:l?(a.key=r.C0.ESC+"[1;"+(1+l)+"B",a.key===r.C0.ESC+"[1;3B"&&(a.key=r.C0.ESC+"[1;5B")):a.key=e?r.C0.ESC+"OB":r.C0.ESC+"[B";break;case 45:t.shiftKey||t.ctrlKey||(a.key=r.C0.ESC+"[2~");break;case 46:a.key=l?r.C0.ESC+"[3;"+(1+l)+"~":r.C0.ESC+"[3~";break;case 36:a.key=l?r.C0.ESC+"[1;"+(1+l)+"H":e?r.C0.ESC+"OH":r.C0.ESC+"[H";break;case 35:a.key=l?r.C0.ESC+"[1;"+(1+l)+"F":e?r.C0.ESC+"OF":r.C0.ESC+"[F";break;case 33:t.shiftKey?a.type=2:a.key=r.C0.ESC+"[5~";break;case 34:t.shiftKey?a.type=3:a.key=r.C0.ESC+"[6~";break;case 112:a.key=l?r.C0.ESC+"[1;"+(1+l)+"P":r.C0.ESC+"OP";break;case 113:a.key=l?r.C0.ESC+"[1;"+(1+l)+"Q":r.C0.ESC+"OQ";break;case 114:a.key=l?r.C0.ESC+"[1;"+(1+l)+"R":r.C0.ESC+"OR";break;case 115:a.key=l?r.C0.ESC+"[1;"+(1+l)+"S":r.C0.ESC+"OS";break;case 116:a.key=l?r.C0.ESC+"[15;"+(1+l)+"~":r.C0.ESC+"[15~";break;case 117:a.key=l?r.C0.ESC+"[17;"+(1+l)+"~":r.C0.ESC+"[17~";break;case 118:a.key=l?r.C0.ESC+"[18;"+(1+l)+"~":r.C0.ESC+"[18~";break;case 119:a.key=l?r.C0.ESC+"[19;"+(1+l)+"~":r.C0.ESC+"[19~";break;case 120:a.key=l?r.C0.ESC+"[20;"+(1+l)+"~":r.C0.ESC+"[20~";break;case 121:a.key=l?r.C0.ESC+"[21;"+(1+l)+"~":r.C0.ESC+"[21~";break;case 122:a.key=l?r.C0.ESC+"[23;"+(1+l)+"~":r.C0.ESC+"[23~";break;case 123:a.key=l?r.C0.ESC+"[24;"+(1+l)+"~":r.C0.ESC+"[24~";break;default:!t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?n&&!o||!t.altKey||t.metaKey?n&&!t.altKey&&!t.ctrlKey&&t.metaKey?65===t.keyCode&&(a.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&48<=t.keyCode&&1===t.key.length?a.key=t.key:t.key&&t.ctrlKey&&"_"===t.key&&(a.key=r.C0.US):(s=(s=i[t.keyCode])&&s[t.shiftKey?1:0])?a.key=r.C0.ESC+s:65<=t.keyCode&&t.keyCode<=90&&(s=t.ctrlKey?t.keyCode-64:t.keyCode+32,a.key=r.C0.ESC+String.fromCharCode(s)):65<=t.keyCode&&t.keyCode<=90?a.key=String.fromCharCode(t.keyCode-64):32===t.keyCode?a.key=String.fromCharCode(0):51<=t.keyCode&&t.keyCode<=55?a.key=String.fromCharCode(t.keyCode-51+27):56===t.keyCode?a.key=String.fromCharCode(127):219===t.keyCode?a.key=String.fromCharCode(27):220===t.keyCode?a.key=String.fromCharCode(28):221===t.keyCode&&(a.key=String.fromCharCode(29))}return a}},{"../../common/data/EscapeSequences":28}],34:[function(t,e,n){function r(){this._interim=0}function i(){this.interim=new Uint8Array(3)}Object.defineProperty(n,"__esModule",{value:!0}),n.stringFromCodePoint=function(t){return 65535>10))+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)},n.utf32ToString=function(t,e,n){void 0===n&&(n=t.length);for(var r="",i=e=void 0===e?0:e;i>10))+String.fromCharCode(o%1024+56320)):r+=String.fromCharCode(o)}return r},r.prototype.clear=function(){this._interim=0},r.prototype.decode=function(t,e){var n=t.length;if(!n)return 0;var r=0,i=0;this._interim&&(56320<=(s=t.charCodeAt(i++))&&s<=57343?e[r++]=1024*(this._interim-55296)+s-56320+65536:(e[r++]=this._interim,e[r++]=s),this._interim=0);for(var o=i;o=n)return this._interim=a,r;56320<=(s=t.charCodeAt(o))&&s<=57343?e[r++]=1024*(a-55296)+s-56320+65536:(e[r++]=a,e[r++]=s)}else e[r++]=a}return r},n.StringToUtf32=r,i.prototype.clear=function(){this.interim.fill(0)},i.prototype.decode=function(t,e){var n=t.length;if(!n)return 0;var r,i,o,s,a=0,l=0,c=0;if(this.interim[0]){for(var h=!1,u=this.interim[0],f=(u&=192==(224&u)?31:224==(240&u)?15:7,0),p=void 0;(p=63&this.interim[++f])&&f<4;)u=u<<6|p;for(var d=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,m=d-f;c=this._endCol&&tthis._endRow?"A":"B"},i.prototype._bufferLine=function(t,e,n,r,i){for(var o=t,s=e,a="";o!==n||s!==r;)o+=i?1:-1,i&&o>this._terminal.cols-1?(a+=this._terminal.buffer.translateBufferLineToString(s,!1,t,o),t=o=0,s++):!i&&o<0&&(a+=this._terminal.buffer.translateBufferLineToString(s,!1,0,t+1),t=o=this._terminal.cols-1,s--);return a+this._terminal.buffer.translateBufferLineToString(s,!1,t,o)},i.prototype._sequence=function(t){var e=this._terminal.applicationCursor?"O":"[";return r.C0.ESC+e+t},n.AltClickHandler=i},{"../common/data/EscapeSequences":28}],36:[function(t,e,n){function r(){this._addons=[]}Object.defineProperty(n,"__esModule",{value:!0}),r.prototype.dispose=function(){for(var t=this._addons.length-1;0<=t;t--)this._addons[t].instance.dispose()},r.prototype.loadAddon=function(t,e){var n=this,r={instance:e,dispose:e.dispose,isDisposed:!1};this._addons.push(r),e.dispose=function(){return n._wrappedAddonDispose(r)},e.activate(t)},r.prototype._wrappedAddonDispose=function(t){if(!t.isDisposed){for(var e=-1,n=0;n=this._line.length))return new u(this._line,t)},h.prototype.translateToString=function(t,e,n){return this._line.translateToString(t,e,n)};var c=h;function h(t){this._line=t}Object.defineProperty(f.prototype,"char",{get:function(){return this._line.getString(this._x)},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"width",{get:function(){return this._line.getWidth(this._x)},enumerable:!0,configurable:!0});var u=f;function f(t,e){this._line=t,this._x=e}},{"../Strings":16,"../Terminal":17,"./AddonManager":36}],38:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=t("../common/Types"),i=t("./atlas/Types"),o=t("./atlas/CharAtlasCache"),s=t("../core/buffer/BufferLine");function a(t,e,n,r,i){this._container=t,this._alpha=r,this._colors=i,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-"+e+"-layer"),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}a.prototype.dispose=function(){this._container.removeChild(this._canvas),this._charAtlas&&this._charAtlas.dispose()},a.prototype._initCanvas=function(){this._ctx=this._canvas.getContext("2d",{alpha:this._alpha}),this._alpha||this.clearAll()},a.prototype.onOptionsChanged=function(t){},a.prototype.onBlur=function(t){},a.prototype.onFocus=function(t){},a.prototype.onCursorMove=function(t){},a.prototype.onGridChanged=function(t,e,n){},a.prototype.onSelectionChanged=function(t,e,n,r){},a.prototype.setColors=function(t,e){this._refreshCharAtlas(t,e)},a.prototype.setTransparency=function(t,e){var n;e!==this._alpha&&(n=this._canvas,this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(t,this._colors),this.onGridChanged(t,0,t.rows-1))},a.prototype._refreshCharAtlas=function(t,e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=o.acquireCharAtlas(t,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},a.prototype.resize=function(t,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(t,this._colors)},a.prototype.fillCells=function(t,e,n,r){this._ctx.fillRect(t*this._scaledCellWidth,e*this._scaledCellHeight,n*this._scaledCellWidth,r*this._scaledCellHeight)},a.prototype.fillBottomLineAtCells=function(t,e,n){void 0===n&&(n=1),this._ctx.fillRect(t*this._scaledCellWidth,(e+1)*this._scaledCellHeight-window.devicePixelRatio-1,n*this._scaledCellWidth,window.devicePixelRatio)},a.prototype.fillLeftLineAtCell=function(t,e){this._ctx.fillRect(t*this._scaledCellWidth,e*this._scaledCellHeight,window.devicePixelRatio,this._scaledCellHeight)},a.prototype.strokeRectAtCell=function(t,e,n,r){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(t*this._scaledCellWidth+window.devicePixelRatio/2,e*this._scaledCellHeight+window.devicePixelRatio/2,n*this._scaledCellWidth-window.devicePixelRatio,r*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.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},a.prototype.clearCells=function(t,e,n,r){this._alpha?this._ctx.clearRect(t*this._scaledCellWidth,e*this._scaledCellHeight,n*this._scaledCellWidth,r*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(t*this._scaledCellWidth,e*this._scaledCellHeight,n*this._scaledCellWidth,r*this._scaledCellHeight))},a.prototype.fillCharTrueColor=function(t,e,n,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline="middle",this._clipRow(t,r),this._ctx.fillText(e.getChars(),n*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},a.prototype.drawChars=function(t,e,n,o){var a,l;!e.isFgRGB()&&!e.isBgRGB()&&(e.isInverse()?(a=e.isBgDefault()?i.INVERTED_DEFAULT_COLOR:e.getBgColor(),l=e.isFgDefault()?i.INVERTED_DEFAULT_COLOR:e.getFgColor()):(l=e.isBgDefault()?r.DEFAULT_COLOR:e.getBgColor(),a=e.isFgDefault()?r.DEFAULT_COLOR:e.getFgColor()),a+=t.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&a!==i.INVERTED_DEFAULT_COLOR?8:0,this._currentGlyphIdentifier.chars=e.getChars()||s.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||s.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=l,this._currentGlyphIdentifier.fg=a,this._currentGlyphIdentifier.bold=e.isBold()&&t.options.enableBold,this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas)&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,n*this._scaledCellWidth+this._scaledCharLeft,o*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(t,e,n,o)},a.prototype._drawUncachedChars=function(t,e,n,r){var o;this._ctx.save(),this._ctx.font=this._getFont(t,e.isBold()&&t.options.enableBold,!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse()?e.isBgDefault()?this._ctx.fillStyle=this._colors.background.css:e.isBgRGB()?this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getBgColor()).join(",")+")":this._ctx.fillStyle=this._colors.ansi[e.getBgColor()].css:e.isFgDefault()?this._ctx.fillStyle=this._colors.foreground.css:e.isFgRGB()?this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getFgColor()).join(",")+")":(o=e.getFgColor(),t.options.drawBoldTextInBrightColors&&e.isBold()&&o<8&&(o+=8),this._ctx.fillStyle=this._colors.ansi[o].css),this._clipRow(t,r),e.isDim()&&(this._ctx.globalAlpha=i.DIM_OPACITY),this._ctx.fillText(e.getChars(),n*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},a.prototype._clipRow=function(t,e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,t.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},a.prototype._getFont=function(t,e,n){return(n?"italic":"")+" "+(e?t.options.fontWeightBold:t.options.fontWeight)+" "+t.options.fontSize*window.devicePixelRatio+"px "+t.options.fontFamily},n.BaseRenderLayer=a},{"../common/Types":27,"../core/buffer/BufferLine":29,"./atlas/CharAtlasCache":48,"./atlas/Types":55}],39:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=(Object.defineProperty(n,"__esModule",{value:!0}),t("../core/buffer/BufferLine"));o(a,i=s.AttributeData),a.prototype.isCombined=function(){return 2097152},a.prototype.getWidth=function(){return this._width},a.prototype.getChars=function(){return this.combinedData},a.prototype.getCode=function(){return 2097151},a.prototype.setFromCharData=function(t){throw new Error("not implemented")},a.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t=a;function a(t,e,n){var r=i.call(this)||this;return r.content=0,r.combinedData="",r.fg=t.fg,r.bg=t.bg,r.combinedData=e,r._width=n,r}function l(t){this._terminal=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}n.JoinedCellData=t,l.prototype.registerCharacterJoiner=function(t){return t={id:this._nextCharacterJoinerId++,handler:t},this._characterJoiners.push(t),t.id},l.prototype.deregisterCharacterJoiner=function(t){for(var e=0;e=t.rows)this._clearCursor();else if(t.buffer.lines.get(n).loadCell(t.buffer.x,this._cell),void 0!==this._cell.content)if(t.isFocused)if(this._cursorBlinkStateManager&&!this._cursorBlinkStateManager.isCursorVisible)this._clearCursor();else{if(this._state){if(this._state.x===t.buffer.x&&this._state.y===r&&this._state.isFocused===t.isFocused&&this._state.style===t.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[t.options.cursorStyle||"block"](t,t.buffer.x,r,this._cell),this._ctx.restore(),this._state.x=t.buffer.x,this._state.y=r,this._state.isFocused=!1,this._state.style=t.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._renderBlurCursor(t,t.buffer.x,r,this._cell),this._ctx.restore(),this._state.x=t.buffer.x,this._state.y=r,this._state.isFocused=!1,this._state.style=t.options.cursorStyle,this._state.width=this._cell.getWidth()}},l.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})},l.prototype._renderBarCursor=function(t,e,n,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this.fillLeftLineAtCell(e,n),this._ctx.restore()},l.prototype._renderBlockCursor=function(t,e,n,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this.fillCells(e,n,r.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this.fillCharTrueColor(t,r,e,n),this._ctx.restore()},l.prototype._renderUnderlineCursor=function(t,e,n,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this.fillBottomLineAtCells(e,n),this._ctx.restore()},l.prototype._renderBlurCursor=function(t,e,n,r){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this.strokeRectAtCell(e,n,r.getWidth(),1),this._ctx.restore()},t=l;function l(t,e,n){return(t=i.call(this,t,"cursor",e,!0,n)||this)._cell=new a.CellData,t._state={x:null,y:null,isFocused:null,style:null,width:null},t._cursorRenderers={bar:t._renderBarCursor.bind(t),block:t._renderBlockCursor.bind(t),underline:t._renderUnderlineCursor.bind(t)},t}n.CursorRenderLayer=t,Object.defineProperty(h.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!0,configurable:!0}),h.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)},h.prototype.restartBlinkAnimation=function(t){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame)||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=null})))},h.prototype._restartInterval=function(t){var e=this;void 0===t&&(t=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=setTimeout((function(){if(e._animationTimeRestarted){var t=600-(Date.now()-e._animationTimeRestarted);if(e._animationTimeRestarted=null,0=t.rows||s<0||(this._ctx.fillStyle=this._colors.selection.css,r?(a=e[0],c=n[0]-a,this.fillCells(a,o,c,s-o+1)):(a=l===o?e[0]:0,c=o===s?n[0]:t.cols,this.fillCells(a,o,c-a,1),l=Math.max(s-o-1,0),this.fillCells(0,o+1,t.cols,l),o!==s&&(c=i===s?n[0]:t.cols,this.fillCells(0,s,c,1))),this._state.start=[e[0],e[1]],this._state.end=[n[0],n[1]],this._state.columnSelectMode=r,this._state.ydisp=t.buffer.ydisp)):this._clearState())},s.prototype._didStateChange=function(t,e,n,r){return!this._areCoordinatesEqual(t,this._state.start)||!this._areCoordinatesEqual(e,this._state.end)||n!==this._state.columnSelectMode||r!==this._state.ydisp},s.prototype._areCoordinatesEqual=function(t,e){return!(!t||!e)&&t[0]===e[0]&&t[1]===e[1]},t=s;function s(t,e,n){return(t=i.call(this,t,"selection",e,!0,n)||this)._clearState(),t}n.SelectionRenderLayer=t},{"./BaseRenderLayer":38}],46:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=(Object.defineProperty(n,"__esModule",{value:!0}),t("./GridCache")),a=t("./BaseRenderLayer"),l=t("../core/buffer/BufferLine"),c=t("./CharacterJoinerRegistry");o(h,i=a.BaseRenderLayer),h.prototype.resize=function(t,e){i.prototype.resize.call(this,t,e);var n=this._getFont(t,!1,!1);this._characterWidth===e.scaledCharWidth&&this._characterFont===n||(this._characterWidth=e.scaledCharWidth,this._characterFont=n,this._characterOverlapCache={}),this._state.clear(),this._state.resize(t.cols,t.rows)},h.prototype.reset=function(t){this._state.clear(),this.clearAll()},h.prototype._forEachCell=function(t,e,n,r,i){for(var o=e;o<=n;o++)for(var s=o+t.buffer.ydisp,a=t.buffer.lines.get(s),h=r?r.getJoinedCharacters(s):[],u=0;uthis._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=e},t=h;function h(t,e,n,r,o){return(t=i.call(this,t,"text",e,o,n)||this)._characterOverlapCache={},t._workCell=new l.CellData,t._state=new s.GridCache,t._characterJoinerRegistry=r,t}n.TextRenderLayer=t},{"../core/buffer/BufferLine":29,"./BaseRenderLayer":38,"./CharacterJoinerRegistry":39,"./GridCache":41}],47:[function(t,e,n){function r(){this._didWarmUp=!1}Object.defineProperty(n,"__esModule",{value:!0}),r.prototype.dispose=function(){},r.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},r.prototype._doWarmUp=function(){},r.prototype.beginFrame=function(){},n.default=r},{}],48:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=t("./CharAtlasUtils"),i=t("./DynamicCharAtlas"),o=t("./NoneCharAtlas"),s=(t=t("./StaticCharAtlas"),{none:o.default,static:t.default,dynamic:i.default}),a=[];n.acquireCharAtlas=function(t,e,n,i){for(var o=r.generateConfig(n,i,t,e),l=0;l>>24,i=e.rgba>>>16&255,o=e.rgba>>>8&255,s=0;s=this.capacity?(r=this._head,this._unlinkNode(r),delete this._map[r.key],r.key=t,r.value=e,this._map[t]=r):(0<(n=this._nodePool).length?((r=n.pop()).key=t,r.value=e):r={prev:null,next:null,key:t,value:e},this._map[t]=r,this.size++),this._appendNode(r)},n.default=r},{}],53:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),t=t("./BaseCharAtlas"),o(s,i=t.default),s.prototype.draw=function(t,e,n,r){return!1},t=s;function s(t,e){return i.call(this)||this}n.default=t},{"./BaseCharAtlas":47}],54:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=(Object.defineProperty(n,"__esModule",{value:!0}),t("./Types")),a=t("./CharAtlasGenerator"),l=t("./BaseCharAtlas"),c=t("./CharAtlasUtils"),h=t("../../common/Types");o(u,i=l.default),u.prototype._doWarmUp=function(){var t=this,e=a.generateStaticCharAtlasTexture(window,this._canvasFactory,this._config);e instanceof HTMLCanvasElement?this._texture=e:e.then((function(e){t._texture=e}))},u.prototype._isCached=function(t,e){var n=t.code<256,r=t.fg<16,i=t.fg===h.DEFAULT_COLOR,o=t.bg===h.DEFAULT_COLOR;return n&&(r||i)&&o&&!t.italic},u.prototype.draw=function(t,e,n,r){if(null===this._texture||void 0===this._texture)return!1;var i=0;if(c.is256Color(e.fg)?i=2+e.fg+(e.bold?16:0):e.fg===h.DEFAULT_COLOR&&e.bold&&(i=1),!this._isCached(e,i))return!1;t.save();var o=this._config.scaledCharWidth+s.CHAR_ATLAS_CELL_SPACING,a=this._config.scaledCharHeight+s.CHAR_ATLAS_CELL_SPACING;return e.dim&&(t.globalAlpha=s.DIM_OPACITY),t.drawImage(this._texture,e.code*o,i*a,o,this._config.scaledCharHeight,n,r,o,this._config.scaledCharHeight),t.restore(),!0},t=u;function u(t,e){var n=i.call(this)||this;return n._document=t,n._config=e,n._canvasFactory=function(t,e){var r=n._document.createElement("canvas");return r.width=t,r.height=e,r},n}n.default=t},{"../../common/Types":27,"./BaseCharAtlas":47,"./CharAtlasGenerator":49,"./CharAtlasUtils":50,"./Types":55}],55:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.INVERTED_DEFAULT_COLOR=257,n.DIM_OPACITY=.5,n.CHAR_ATLAS_CELL_SPACING=1},{}],56:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=(Object.defineProperty(n,"__esModule",{value:!0}),t("./DomRendererRowFactory")),a=t("../atlas/Types"),l=(t=t("../../common/Lifecycle"),"xterm-dom-renderer-owner-"),c="xterm-rows",h="xterm-fg-",u="xterm-bg-",f="xterm-focus",p="xterm-selection",d=1;o(m,i=t.Disposable),m.prototype.dispose=function(){this._terminal.element.classList.remove(l+this._terminalClass),this._terminal.screenElement.removeChild(this._rowContainer),this._terminal.screenElement.removeChild(this._selectionContainer),this._terminal.screenElement.removeChild(this._themeStyleElement),this._terminal.screenElement.removeChild(this._dimensionsStyleElement),i.prototype.dispose.call(this)},m.prototype._updateDimensions=function(){var t=this,e=(this.dimensions.scaledCharWidth=this._terminal.charMeasure.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._terminal.charMeasure.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._terminal.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._terminal.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._terminal.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._terminal.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._terminal.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._terminal.rows,this._rowElements.forEach((function(e){e.style.width=t.dimensions.canvasWidth+"px",e.style.height=t.dimensions.actualCellHeight+"px",e.style.lineHeight=t.dimensions.actualCellHeight+"px",e.style.overflow="hidden"})),this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._terminal.screenElement.appendChild(this._dimensionsStyleElement)),this._terminalSelector+" ."+c+" span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}");this._dimensionsStyleElement.innerHTML=e,this._selectionContainer.style.height=this._terminal._viewportElement.style.height,this._terminal.screenElement.style.width=this.dimensions.canvasWidth+"px",this._terminal.screenElement.style.height=this.dimensions.canvasHeight+"px"},m.prototype.setColors=function(t){this._colors=t,this._injectCss()},m.prototype._injectCss=function(){var t=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._terminal.screenElement.appendChild(this._themeStyleElement));var e=(e=(e=(e=this._terminalSelector+" ."+c+" { color: "+this._colors.foreground.css+"; background-color: "+this._colors.background.css+"; font-family: "+this._terminal.options.fontFamily+"; font-size: "+this._terminal.options.fontSize+"px;}")+this._terminalSelector+" span:not(."+s.BOLD_CLASS+") { font-weight: "+this._terminal.options.fontWeight+";}"+this._terminalSelector+" span."+s.BOLD_CLASS+" { font-weight: "+this._terminal.options.fontWeightBold+";}"+this._terminalSelector+" span."+s.ITALIC_CLASS+" { font-style: italic;}@keyframes blink { 0% { opacity: 1.0; } 50% { opacity: 0.0; } 100% { opacity: 1.0; }}")+this._terminalSelector+" ."+c+":not(."+f+") ."+s.CURSOR_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" ."+c+"."+f+" ."+s.CURSOR_CLASS+"."+s.CURSOR_BLINK_CLASS+" { animation: blink 1s step-end infinite;}"+this._terminalSelector+" ."+c+"."+f+" ."+s.CURSOR_CLASS+"."+s.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" ."+c+"."+f+" ."+s.CURSOR_CLASS+"."+s.CURSOR_STYLE_BAR_CLASS+" { box-shadow: 1px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" ."+c+"."+f+" ."+s.CURSOR_CLASS+"."+s.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}")+this._terminalSelector+" ."+p+" { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" ."+p+" div { position: absolute; background-color: "+this._colors.selection.css+";}";this._colors.ansi.forEach((function(n,r){e+=t._terminalSelector+" ."+h+r+" { color: "+n.css+"; }"+t._terminalSelector+" ."+u+r+" { background-color: "+n.css+"; }"})),e+=this._terminalSelector+" ."+h+a.INVERTED_DEFAULT_COLOR+" { color: "+this._colors.background.css+"; }"+this._terminalSelector+" ."+u+a.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.innerHTML=e},m.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},m.prototype._refreshRowElements=function(t,e){for(var n=this._rowElements.length;n<=e;n++){var r=document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop())},m.prototype.onResize=function(t,e){this._refreshRowElements(t,e),this._updateDimensions()},m.prototype.onCharSizeChanged=function(){this._updateDimensions()},m.prototype.onBlur=function(){this._rowContainer.classList.remove(f)},m.prototype.onFocus=function(){this._rowContainer.classList.add(f)},m.prototype.onSelectionChanged=function(t,e,n){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);var r,i,o,s,a;t&&e&&(a=t[1]-this._terminal.buffer.ydisp,r=e[1]-this._terminal.buffer.ydisp,i=Math.max(a,0),o=Math.min(r,this._terminal.rows-1),i>=this._terminal.rows||o<0||(s=document.createDocumentFragment(),n?s.appendChild(this._createSelectionElement(i,t[0],e[0],o-i+1)):(n=a===i?t[0]:0,a=i===o?e[0]:this._terminal.cols,s.appendChild(this._createSelectionElement(i,n,a)),s.appendChild(this._createSelectionElement(i+1,0,this._terminal.cols,o-i-1)),i!==o&&(t=r===o?e[0]:this._terminal.cols,s.appendChild(this._createSelectionElement(o,0,t)))),this._selectionContainer.appendChild(s)))},m.prototype._createSelectionElement=function(t,e,n,r){void 0===r&&(r=1);var i=document.createElement("div");return i.style.height=r*this.dimensions.actualCellHeight+"px",i.style.top=t*this.dimensions.actualCellHeight+"px",i.style.left=e*this.dimensions.actualCellWidth+"px",i.style.width=this.dimensions.actualCellWidth*(n-e)+"px",i},m.prototype.onCursorMove=function(){},m.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss(),this._terminal.refresh(0,this._terminal.rows-1)},m.prototype.clear=function(){this._rowElements.forEach((function(t){return t.innerHTML=""}))},m.prototype.renderRows=function(t,e){for(var n=this._terminal,r=n.buffer.ybase+n.buffer.y,i=this._terminal.buffer.x,o=this._terminal.options.cursorBlink,s=t;s<=e;s++){var a=this._rowElements[s],l=(a.innerHTML="",s+n.buffer.ydisp),c=n.buffer.lines.get(l),h=n.options.cursorStyle;a.appendChild(this._rowFactory.createRow(c,l===r,h,i,o,this.dimensions.actualCellWidth,n.cols))}},Object.defineProperty(m.prototype,"_terminalSelector",{get:function(){return"."+l+this._terminalClass},enumerable:!0,configurable:!0}),m.prototype.registerCharacterJoiner=function(t){return-1},m.prototype.deregisterCharacterJoiner=function(t){return!1},m.prototype._onLinkHover=function(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!0)},m.prototype._onLinkLeave=function(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!1)},m.prototype._setCellUnderline=function(t,e,n,r,i,o){for(;t!==e||n!==r;){var s=this._rowElements[n];if(!s)return;(s=s.children[t])&&(s.style.textDecoration=o?"underline":"none"),++t>=i&&(t=0,n++)}},t=m;function m(t,e){var n=i.call(this)||this;return n._terminal=t,n._colors=e,n._terminalClass=d++,n._rowElements=[],n._rowContainer=document.createElement("div"),n._rowContainer.classList.add(c),n._rowContainer.style.lineHeight="normal",n._rowContainer.setAttribute("aria-hidden","true"),n._refreshRowElements(n._terminal.cols,n._terminal.rows),n._selectionContainer=document.createElement("div"),n._selectionContainer.classList.add(p),n._selectionContainer.setAttribute("aria-hidden","true"),n.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},n._updateDimensions(),n._injectCss(),n._rowFactory=new s.DomRendererRowFactory(t.options,document),n._terminal.element.classList.add(l+n._terminalClass),n._terminal.screenElement.appendChild(n._rowContainer),n._terminal.screenElement.appendChild(n._selectionContainer),n._terminal.linkifier.onLinkHover((function(t){return n._onLinkHover(t)})),n._terminal.linkifier.onLinkLeave((function(t){return n._onLinkLeave(t)})),n}n.DomRenderer=t},{"../../common/Lifecycle":24,"../atlas/Types":55,"./DomRendererRowFactory":57}],57:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=t("../atlas/Types"),i=t("../../core/buffer/BufferLine");n.BOLD_CLASS="xterm-bold",n.DIM_CLASS="xterm-dim",n.ITALIC_CLASS="xterm-italic",n.UNDERLINE_CLASS="xterm-underline",n.CURSOR_CLASS="xterm-cursor",n.CURSOR_BLINK_CLASS="xterm-cursor-blink",n.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",n.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",n.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline",o.prototype.createRow=function(t,e,o,s,a,l,c){for(var h=this._document.createDocumentFragment(),u=0,f=Math.min(t.length,c)-1;0<=f;f--)if(t.loadCell(f,this._workCell).getCode()!==i.NULL_CELL_CODE||e&&f===s){u=f+1;break}for(f=0;f>>0})}for(n=0;n<24;n++){var s=8+10*n,a=c(s);t.push({css:"#"+a+a+a,rgba:(s<<24|s<<16|s<<8|255)>>>0})}return t}(),h.prototype.setTheme=function(t){this.colors.foreground=this._parseColor((t=void 0===t?{}:t).foreground,r),this.colors.background=this._parseColor(t.background,i),this.colors.cursor=this._parseColor(t.cursor,o,!0),this.colors.cursorAccent=this._parseColor(t.cursorAccent,s,!0),this.colors.selection=this._parseColor(t.selection,a,!0),this.colors.ansi[0]=this._parseColor(t.black,n.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(t.red,n.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(t.green,n.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(t.yellow,n.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(t.blue,n.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(t.magenta,n.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(t.cyan,n.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(t.white,n.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(t.brightBlack,n.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(t.brightRed,n.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(t.brightGreen,n.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(t.brightYellow,n.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(t.brightBlue,n.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(t.brightMagenta,n.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(t.brightCyan,n.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(t.brightWhite,n.DEFAULT_ANSI_COLORS[15])},h.prototype._parseColor=function(t,e,n){if(void 0===n&&(n=this.allowTransparency),void 0===t)return e;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=t,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+t+" is invalid using fallback "+e.css),e;this._ctx.fillRect(0,0,1,1);var r=this._ctx.getImageData(0,0,1,1).data;return n||255===r[3]?{css:t,rgba:(r[0]<<24|r[1]<<16|r[2]<<8|r[3])>>>0}:(console.warn("Color: "+t+" is using transparency, but allowTransparency is false. Using fallback "+e.css+"."),e)},n.ColorManager=h},{}],59:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.addDisposableDomListener=function(t,e,n,r){return t.addEventListener(e,n,r),{dispose:function(){n&&t.removeEventListener(e,n,r)}}}},{}],60:[function(t,e,n){function r(t){this._renderCallback=t}Object.defineProperty(n,"__esModule",{value:!0}),r.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},r.prototype.refresh=function(t,e,n){var r=this;this._rowCount=n,t=void 0!==t?t:0,e=void 0!==e?e:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,t):t,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,e):e,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){return r._innerRefresh()})))},r.prototype._innerRefresh=function(){void 0!==this._rowStart&&void 0!==this._rowEnd&&void 0!==this._rowCount&&(this._rowStart=Math.max(this._rowStart,0),this._rowEnd=Math.min(this._rowEnd,this._rowCount-1),this._renderCallback(this._rowStart,this._rowEnd),this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0)},n.RenderDebouncer=r},{}],61:[function(t,e,n){var r,i,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}))(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),t=t("../common/Lifecycle"),o(s,i=t.Disposable),s.prototype.setListener=function(t){var e=this;this._listener&&this.clearListener(),this._listener=t,this._outerListener=function(){e._listener&&(e._listener(window.devicePixelRatio,e._currentDevicePixelRatio),e._updateDpr())},this._updateDpr()},s.prototype.dispose=function(){i.prototype.dispose.call(this),this.clearListener()},s.prototype._updateDpr=function(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},s.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=s;function s(){var t=null!==i&&i.apply(this,arguments)||this;return t._currentDevicePixelRatio=window.devicePixelRatio,t}n.ScreenDprMonitor=t},{"../common/Lifecycle":24}],62:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n=t("./public/Terminal"),e.exports=n.Terminal},{"./public/Terminal":37}]},{},[62])(62)},function(t,e){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){for(var e=t,i=t.indexOf("["),o=t.indexOf("]"),s=(-1!=i&&-1!=o&&(t=t.substring(0,i)+t.substring(i,o).replace(/:/g,";")+t.substring(o,t.length)),n.exec(t||"")),a={},l=14;l--;)a[r[l]]=s[l]||"";return-1!=i&&-1!=o&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e,n){(function(e){t.exports=function(t){return n&&e.isBuffer(t)||r&&(t instanceof ArrayBuffer||i(t))};var n="function"==typeof e&&"function"==typeof e.isBuffer,r="function"==typeof ArrayBuffer,i=function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer}}).call(this,n(10).Buffer)},function(t,e){var n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(37),i=n(23),o=n(1),s=n(8),a=n(24),l=n(25),c=n(2)("socket.io-client:manager"),h=n(22),u=n(52),f=Object.prototype.hasOwnProperty;function p(t,e){if(!(this instanceof p))return new p(t,e);t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new u({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[],t=e.parser||s,this.encoder=new t.Encoder,this.decoder=new t.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}(t.exports=p).prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)f.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},p.prototype.updateSocketIds=function(){for(var t in this.nsps)f.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},p.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},o(p.prototype),p.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},p.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},p.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(t,e){var n,i,o,s,l,h;return c("readyState %s",this.readyState),~this.readyState.indexOf("open")||(c("opening %s",this.uri),this.engine=r(this.uri,this.opts),n=this.engine,(i=this).readyState="opening",this.skipReconnect=!1,o=a(n,"open",(function(){i.onopen(),t&&t()})),s=a(n,"error",(function(e){var n;c("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",e),t?((n=new Error("Connection error")).data=e,t(n)):i.maybeReconnectOnOpen()})),!1!==this._timeout&&(l=this._timeout,c("connect attempt will timeout after %d",l),h=setTimeout((function(){c("connect attempt timed out after %d",l),o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",l)}),l),this.subs.push({destroy:function(){clearTimeout(h)}})),this.subs.push(o),this.subs.push(s)),this},p.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(a(t,"data",l(this,"ondata"))),this.subs.push(a(t,"ping",l(this,"onping"))),this.subs.push(a(t,"pong",l(this,"onpong"))),this.subs.push(a(t,"error",l(this,"onerror"))),this.subs.push(a(t,"close",l(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",l(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(t){this.decoder.add(t)},p.prototype.ondecoded=function(t){this.emit("packet",t)},p.prototype.onerror=function(t){c("error",t),this.emitAll("error",t)},p.prototype.socket=function(t,e){var n,r=this.nsps[t];function o(){~h(n.connecting,r)||n.connecting.push(r)}return r||(r=new i(this,t,e),this.nsps[t]=r,n=this,r.on("connecting",o),r.on("connect",(function(){r.id=n.generateId(t)})),this.autoConnect&&o()),r},p.prototype.destroy=function(t){~(t=h(this.connecting,t))&&this.connecting.splice(t,1),this.connecting.length||this.close()},p.prototype.packet=function(t){c("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,(function(n){for(var r=0;r=this._reconnectionAttempts?(c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1):(t=this.backoff.duration(),c("will wait %dms before reconnect attempt",t),this.reconnecting=!0,e=setTimeout((function(){n.skipReconnect||(c("attempting reconnect"),n.emitAll("reconnect_attempt",n.backoff.attempts),n.emitAll("reconnecting",n.backoff.attempts),n.skipReconnect)||n.open((function(t){t?(c("reconnect attempt error"),n.reconnecting=!1,n.reconnect(),n.emitAll("reconnect_error",t.data)):(c("reconnect success"),n.onreconnect())}))}),t),this.subs.push({destroy:function(){clearTimeout(e)}}))},p.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){var r=n(11),i=n(40),o=n(48);n=n(49);e.polling=function(t){var e,n,s=!1,a=!1,l=!1!==t.jsonp;if("undefined"!=typeof location&&(e="https:"===location.protocol,n=(n=location.port)||(e?443:80),s=t.hostname!==location.hostname||n!==t.port,a=t.secure!==e),t.xdomain=s,t.xscheme=a,"open"in new r(t)&&!t.forceJSONP)return new i(t);if(l)return new o(t);throw new Error("JSONP disabled")},e.websocket=n},function(t,e,n){var r=n(12),i=n(3),o=n(0),s=n(4),a=n(21),l=n(5)("engine.io-client:polling"),c=(t.exports=h,null!=new(n(11))({xdomain:!1}).responseType);function h(t){var e=t&&t.forceBase64;c&&!e||(this.supportsBinary=!1),r.call(this,t)}s(h,r),h.prototype.name="polling",h.prototype.doOpen=function(){this.poll()},h.prototype.pause=function(t){var e,n=this;function r(){l("paused"),n.readyState="paused",t()}this.readyState="pausing",this.polling||!this.writable?(e=0,this.polling&&(l("we are currently polling - waiting to pause"),e++,this.once("pollComplete",(function(){l("pre-pause polling complete"),--e||r()}))),this.writable||(l("we are currently writing - waiting to pause"),e++,this.once("drain",(function(){l("pre-pause writing complete"),--e||r()})))):r()},h.prototype.poll=function(){l("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},h.prototype.onData=function(t){var e=this;l("polling got data %s",t),o.decodePayload(t,this.socket.binaryType,(function(t,n,r){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():l('ignoring poll - transport state "%s"',this.readyState))},h.prototype.doClose=function(){var t=this;function e(){l("writing close packet"),t.write([{type:"close"}])}"open"===this.readyState?(l("transport open - closing"),e()):(l("transport not open - deferring close"),this.once("open",e))},h.prototype.write=function(t){function e(){n.writable=!0,n.emit("drain")}var n=this;this.writable=!1,o.encodePayload(t,this.supportsBinary,(function(t){n.doWrite(t,e)}))},h.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=a()),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"==e&&443!==Number(this.port)||"http"==e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t}},function(t,e,n){(function(e){var r=n(9),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);t.exports=function t(n){if(!n||"object"!=typeof n)return!1;if(r(n)){for(var i=0,a=n.length;i>16&255,a[l++]=e>>8&255,a[l++]=255&e;return 2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,a[l++]=255&e),1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,a[l++]=e>>8&255,a[l++]=255&e),a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;s>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}(i));return o.join("")}(t,s,a>2]+r[e<<4&63]+"==")):2==i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a>1,h=-7,u=n?i-1:0,f=n?-1:1;i=t[e+u];for(u+=f,o=i&(1<<-h)-1,i>>=-h,h+=a;0>=-h,h+=r;0>1,u=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1;o=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(r=Math.pow(2,-s))<1&&(s--,r*=2),2<=(e+=1<=s+h?u/r:u*Math.pow(2,1-h))*r&&(s++,r/=2),c<=s+h?(a=0,s=c):1<=s+h?(a=(e*r-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));8<=i;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<>e&63|128)}function c(){if(r<=i)throw Error("Invalid byte index");var t=255&n[i];if(i++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}t.exports={version:"2.1.2",encode:function(t,e){for(var n,r,i,c=!1!==(e=e||{}).strict,h=s(t),u=h.length,f=-1,p="";++f>6&31|192):0==(4294901760&n)?(a(n,r)||(n=65533),i=o(n>>12&15|224),i+=l(n,6)):0==(4292870144&n)&&(i=o(n>>18&7|240),i=(i+=l(n,12))+l(n,6)),i+o(63&n|128)));return p},decode:function(t,e){for(var l,h=!1!==(e=e||{}).strict,u=(n=s(t),r=n.length,i=0,[]);!1!==(l=function(t){var e,o;if(r>>10&1023|55296),f=56320|1023&f),_+=o(f);return _}}},function(t,e){for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),i=0;i>2])+n[(3&e[o])<<4|e[o+1]>>4])+n[(15&e[o+1])<<2|e[o+2]>>6])+n[63&e[o+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){for(var e,n,i,o,s=.75*t.length,a=t.length,l=0,c=(s=("="===t[t.length-1]&&(s--,"="===t[t.length-2])&&s--,new ArrayBuffer(s)),new Uint8Array(s)),h=0;h>4,c[l++]=(15&n)<<4|i>>2,c[l++]=(3&i)<<6|63&o;return s}},function(t,e){var n="undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,r=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),i=r&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),o=n&&n.prototype.append&&n.prototype.getBlob;function s(t){return t.map((function(t){var e,n;return t.buffer instanceof ArrayBuffer?(e=t.buffer,t.byteLength!==e.byteLength&&((n=new Uint8Array(t.byteLength)).set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=n.buffer),e):t}))}function a(t,e){e=e||{};var r=new n;return s(t).forEach((function(t){r.append(t)})),e.type?r.getBlob(e.type):r.getBlob()}function l(t,e){return new Blob(s(t),e||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,l.prototype=Blob.prototype),t.exports=r?i?Blob:l:o?a:void 0},function(t,e,n){function r(t){var n;function r(){if(r.enabled){for(var t=r,i=+new Date,o=i-(n||i),s=(t.diff=o,t.prev=n,t.curr=i,n=i,new Array(arguments.length)),a=0;a';o=document.createElement(t)}catch(t){(o=document.createElement("iframe")).name=l.iframeId,o.src="javascript:0"}o.id=l.iframeId,l.form.appendChild(o),l.iframe=o}this.form||(n=document.createElement("form"),r=document.createElement("textarea"),i=this.iframeId="eio_iframe_"+this.index,n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=i,n.method="POST",n.setAttribute("accept-charset","utf-8"),r.name="d",n.appendChild(r),document.body.appendChild(n),this.form=n,this.area=r),this.form.action=this.uri(),h(),t=t.replace(a,"\\\n"),this.area.value=t.replace(s,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===l.iframe.readyState&&c()}:this.iframe.onload=c}}).call(this,n(16))},function(t,e,n){(function(e){var r,i,o=n(12),s=n(0),a=n(3),l=n(4),c=n(21),h=n(5)("engine.io-client:websocket");if("undefined"!=typeof WebSocket)r=WebSocket;else if("undefined"!=typeof self)r=self.WebSocket||self.MozWebSocket;else try{i=n(50)}catch(l){}var u=r||i;function f(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=r&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(u=i),o.call(this,t)}l(t.exports=f,o),f.prototype.name="websocket",f.prototype.supportsBinary=!0,f.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new u(t,e):new u(t):new u(t,e,n)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},f.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},f.prototype.write=function(t){for(var n=this,r=(this.writable=!1,t.length),i=0,o=r;it.length)&&(e=t.length);for(var n=0,r=new Array(e);n>>0;n--;)e[n]=t[n];return e}function tt(t){return t.classList?Q(t.classList):(t.getAttribute("class")||"").split(" ").filter((function(t){return t}))}function et(t){return"".concat(t).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function nt(t){return Object.keys(t||{}).reduce((function(e,n){return e+"".concat(n,": ").concat(t[n].trim(),";")}),"")}function rt(t){return t.size!==Z.size||t.x!==Z.x||t.y!==Z.y||t.rotate!==Z.rotate||t.flipX||t.flipY}function it(){var t,e,n=S,r=X.familyPrefix,i=X.replacementClass,o=':root, :host {\n --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Solid";\n --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Regular";\n --fa-font-light: normal 300 1em/1 "Font Awesome 6 Light";\n --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Thin";\n --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";\n --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-width, 1.25em);\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n -webkit-transform: scale(var(--fa-counter-scale, 0.25));\n transform: scale(var(--fa-counter-scale, 0.25));\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: bottom right;\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: bottom left;\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: top left;\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(var(--fa-li-width, 2em) * -1);\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n -webkit-animation-name: fa-beat;\n animation-name: fa-beat;\n -webkit-animation-delay: var(--fa-animation-delay, 0);\n animation-delay: var(--fa-animation-delay, 0);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n -webkit-animation-name: fa-bounce;\n animation-name: fa-bounce;\n -webkit-animation-delay: var(--fa-animation-delay, 0);\n animation-delay: var(--fa-animation-delay, 0);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n -webkit-animation-name: fa-fade;\n animation-name: fa-fade;\n -webkit-animation-delay: var(--fa-animation-delay, 0);\n animation-delay: var(--fa-animation-delay, 0);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n -webkit-animation-name: fa-beat-fade;\n animation-name: fa-beat-fade;\n -webkit-animation-delay: var(--fa-animation-delay, 0);\n animation-delay: var(--fa-animation-delay, 0);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n -webkit-animation-name: fa-flip;\n animation-name: fa-flip;\n -webkit-animation-delay: var(--fa-animation-delay, 0);\n animation-delay: var(--fa-animation-delay, 0);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n -webkit-animation-name: fa-shake;\n animation-name: fa-shake;\n -webkit-animation-delay: var(--fa-animation-delay, 0);\n animation-delay: var(--fa-animation-delay, 0);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, linear);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n -webkit-animation-name: fa-spin;\n animation-name: fa-spin;\n -webkit-animation-delay: var(--fa-animation-delay, 0);\n animation-delay: var(--fa-animation-delay, 0);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 2s);\n animation-duration: var(--fa-animation-duration, 2s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, linear);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n -webkit-animation-name: fa-spin;\n animation-name: fa-spin;\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, steps(8));\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n -webkit-animation-delay: -1ms;\n animation-delay: -1ms;\n -webkit-animation-duration: 1ms;\n animation-duration: 1ms;\n -webkit-animation-iteration-count: 1;\n animation-iteration-count: 1;\n transition-delay: 0s;\n transition-duration: 0s;\n }\n}\n@-webkit-keyframes fa-beat {\n 0%, 90% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 45% {\n -webkit-transform: scale(var(--fa-beat-scale, 1.25));\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 45% {\n -webkit-transform: scale(var(--fa-beat-scale, 1.25));\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@-webkit-keyframes fa-bounce {\n 0% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-bounce {\n 0% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n}\n@-webkit-keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@-webkit-keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@-webkit-keyframes fa-flip {\n 50% {\n -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-flip {\n 50% {\n -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@-webkit-keyframes fa-shake {\n 0% {\n -webkit-transform: rotate(-15deg);\n transform: rotate(-15deg);\n }\n 4% {\n -webkit-transform: rotate(15deg);\n transform: rotate(15deg);\n }\n 8%, 24% {\n -webkit-transform: rotate(-18deg);\n transform: rotate(-18deg);\n }\n 12%, 28% {\n -webkit-transform: rotate(18deg);\n transform: rotate(18deg);\n }\n 16% {\n -webkit-transform: rotate(-22deg);\n transform: rotate(-22deg);\n }\n 20% {\n -webkit-transform: rotate(22deg);\n transform: rotate(22deg);\n }\n 32% {\n -webkit-transform: rotate(-12deg);\n transform: rotate(-12deg);\n }\n 36% {\n -webkit-transform: rotate(12deg);\n transform: rotate(12deg);\n }\n 40%, 100% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n}\n@keyframes fa-shake {\n 0% {\n -webkit-transform: rotate(-15deg);\n transform: rotate(-15deg);\n }\n 4% {\n -webkit-transform: rotate(15deg);\n transform: rotate(15deg);\n }\n 8%, 24% {\n -webkit-transform: rotate(-18deg);\n transform: rotate(-18deg);\n }\n 12%, 28% {\n -webkit-transform: rotate(18deg);\n transform: rotate(18deg);\n }\n 16% {\n -webkit-transform: rotate(-22deg);\n transform: rotate(-22deg);\n }\n 20% {\n -webkit-transform: rotate(22deg);\n transform: rotate(22deg);\n }\n 32% {\n -webkit-transform: rotate(-12deg);\n transform: rotate(-12deg);\n }\n 36% {\n -webkit-transform: rotate(12deg);\n transform: rotate(12deg);\n }\n 40%, 100% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n}\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n -webkit-transform: scale(-1, 1);\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n -webkit-transform: scale(1, -1);\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n -webkit-transform: scale(-1, -1);\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n -webkit-transform: rotate(var(--fa-rotate-angle, none));\n transform: rotate(var(--fa-rotate-angle, none));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: var(--fa-stack-z-index, auto);\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}\n\n.fad.fa-inverse,\n.fa-duotone.fa-inverse {\n color: var(--fa-inverse, #fff);\n}';return"fa"===r&&i===n||(t=new RegExp("\\.".concat("fa","\\-"),"g"),e=new RegExp("\\--".concat("fa","\\-"),"g"),n=new RegExp("\\.".concat(n),"g"),o=o.replace(t,".".concat(r,"-")).replace(e,"--".concat(r,"-")).replace(n,".".concat(i))),o}var ot=!1;function st(){if(X.autoAddCss&&!ot){var t=it();if(t&&w){for(var e=v.createElement("style"),n=(e.setAttribute("type","text/css"),e.innerHTML=t,v.head.childNodes),r=null,i=n.length-1;-1").concat(i.map(ht).join(""),"")}function ut(t,e,n){if(t&&t[e]&&t[e][n])return{prefix:e,iconName:n,icon:t[e][n]}}function ft(t,e,n,r){for(var i,o,s=Object.keys(t),a=s.length,l=void 0!==r?pt(e,r):e,c=void 0===n?(i=1,t[s[0]]):(i=0,n);i=ke[0]&&d<=ke[1],p={value:dt((_=2===f.length&&f[0]===f[1])?f[0]:f),isSecondary:m||_},d=p.value,f=p.isSecondary,m=u[0].startsWith("FontAwesome"),_=Tt(a,d),l=_,m&&(u=St[p=d],p=Tt("fas",p),(m=u||(p?{prefix:"fas",iconName:p}:null)||{prefix:null,iconName:null}).iconName)&&m.prefix&&(_=m.iconName,a=m.prefix),!_)||f||o&&o.getAttribute(A)===a&&o.getAttribute(L)===l?r():(t.setAttribute(n,l),o&&t.removeChild(o),(h=(c={iconName:null,title:null,titleId:null,prefix:null,transform:Z,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}).extra).attributes[x]=e,Jt(_,a).then((function(i){i=qt(s(s({},c),{},{icons:{main:i,mask:{prefix:null,iconName:null,rest:[]}},prefix:a,iconName:l,extra:h,watchable:!0}));var o=v.createElement("svg");"::before"===e?t.insertBefore(o,t.firstChild):t.appendChild(o),o.outerHTML=i.map(ht).join("\n"),t.removeAttribute(n),r()})).catch(i))))}))}function Ee(t){return Promise.all([Se(t,"::before"),Se(t,"::after")])}function xe(t){return!(t.parentNode===document.head||~R.indexOf(t.tagName.toUpperCase())||t.getAttribute(x)||t.parentNode&&"svg"===t.parentNode.tagName)}function Ae(t){if(w)return new Promise((function(e,n){var r=Q(t.querySelectorAll("*")).filter(xe).map(Ee),i=ee("searchPseudoElements");he(),Promise.all(r).then((function(){i(),ue(),e()})).catch((function(){i(),ue(),n()}))}))}function Le(t){return t.toLowerCase().split(" ").reduce((function(t,e){var n=(e=e.toLowerCase().split("-"))[0],r=e.slice(1).join("-");if(n&&"h"===r)t.flipX=!0;else if(n&&"v"===r)t.flipY=!0;else if(r=parseFloat(r),!isNaN(r))switch(n){case"grow":t.size=t.size+r;break;case"shrink":t.size=t.size-r;break;case"left":t.x=t.x-r;break;case"right":t.x=t.x+r;break;case"up":t.y=t.y-r;break;case"down":t.y=t.y+r;break;case"rotate":t.rotate=t.rotate+r}return t}),{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0})}var Te=!1,Re={x:0,y:0,width:"100%",height:"100%"};function Me(t){return t.attributes&&(t.attributes.fill||!(1 Start Log',console.log("stopping log, "+Ue),Fe=new Date,Oe+"\r\n\r\nLog End for "+Be+": "+Fe.getFullYear()+"/"+(Fe.getMonth()+1)+"/"+Fe.getDate()+" @ "+Fe.getHours()+":"+Fe.getMinutes()+":"+Fe.getSeconds()+"\r\n"):(je=Ue=!0,logBtn.innerHTML=' Stop Log',downloadLogBtn.style.color="#000",downloadLogBtn.addEventListener("click",en),console.log("starting log, "+Ue),Fe=new Date,"Log Start for "+Be+": "+Fe.getFullYear()+"/"+(Fe.getMonth()+1)+"/"+Fe.getDate()+" @ "+Fe.getHours()+":"+Fe.getMinutes()+":"+Fe.getSeconds()+"\r\n\r\n"),Pe=Fe,Ye.focus(),!1}function en(){var t,e;!0===je&&(He="WebSSH2-"+Pe.getFullYear()+(Pe.getMonth()+1)+Pe.getDate()+"_"+Pe.getHours()+Pe.getMinutes()+Pe.getSeconds()+".log",t=new Blob([Oe.replace(/[\u001b\u009b][[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><;]/g,"")],{type:"text/plain"}),window.navigator.msSaveOrOpenBlob?window.navigator.msSaveBlob(t,He):((e=window.document.createElement("a")).href=window.URL.createObjectURL(t),e.download=He,document.body.appendChild(e),e.click(),document.body.removeChild(e))),Ye.focus()}Ye.open(Ge),Ye.focus(),Ye.fit(),window.addEventListener("resize",Je,!1),Ne=e.connect({path:"/ssh/socket.io"}),Ye.on("data",(function(t){Ne.emit("data",t)})),Ne.on("data",(function(t){Ye.write(t),Ue&&(Oe+=t)})),Ne.on("connect",(function(){Ne.emit("geometry",Ye.cols,Ye.rows)})),Ne.on("setTerminalOpts",(function(t){Ye.setOption("cursorBlink",t.cursorBlink),Ye.setOption("scrollback",t.scrollback),Ye.setOption("tabStopWidth",t.tabStopWidth),Ye.setOption("bellStyle",t.bellStyle)})),Ne.on("title",(function(t){document.title=t})),Ne.on("menu",(function(t){Ze(t)})),Ne.on("status",(function(t){qe.innerHTML=t})),Ne.on("ssherror",(function(t){qe.innerHTML=t,qe.style.backgroundColor="red",Ie=!0})),Ne.on("headerBackground",(function(t){Ke.style.backgroundColor=t})),Ne.on("header",(function(t){t&&(Ke.innerHTML=t,Ke.style.display="block",Ge.style.height="calc(100% - 38px)",Je())})),Ne.on("footer",(function(t){Be=t,Xe.innerHTML=t})),Ne.on("statusBackground",(function(t){qe.style.backgroundColor=t})),Ne.on("allowreplay",(function(t){!0===t?(console.log("allowreplay: "+t),We=!0,Ze(Ve.innerHTML+' Credentials')):(We=!1,console.log("allowreplay: "+t))})),Ne.on("allowreauth",(function(t){!0===t?(console.log("allowreauth: "+t),ze=!0,Ze(Ve.innerHTML+' Switch User')):(ze=!1,console.log("allowreauth: "+t))})),Ne.on("disconnect",(function(t){Ie||(qe.style.backgroundColor="red",qe.innerHTML="WEBSOCKET SERVER DISCONNECTED: "+t),Ne.io.reconnection(!1)})),Ne.on("error",(function(t){Ie||(qe.style.backgroundColor="red",qe.innerHTML="ERROR: "+t)})),Ne.on("reauth",(function(){ze&&$e()})),Ye.on("title",(function(t){document.title=t})),document.addEventListener("keydown",(function(t){t.ctrlKey&&t.shiftKey&&"Digit6"===t.code&&(t.preventDefault(),Ne.emit("data",""))}))},function(t,e){},,,,,function(t,e){}]); \ No newline at end of file diff --git a/app/client/public/webssh2.css b/app/client/public/webssh2.css deleted file mode 100644 index a8f5d32..0000000 --- a/app/client/public/webssh2.css +++ /dev/null @@ -1,295 +0,0 @@ -/*! Version 0.2.12 - 2024-07-10T13:49:24.747Z - 533f719 */ -/** - * Copyright (c) 2014 The xterm.js authors. All rights reserved. - * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) - * https://github.com/chjj/term.js - * @license MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * Originally forked from (with the author's permission): - * Fabrice Bellard's javascript vt100 for jslinux: - * http://bellard.org/jslinux/ - * Copyright (c) 2011 Fabrice Bellard - * The original design remains. The terminal itself - * has been extended to include xterm CSI codes, among - * other features. - */ - -/** - * Default styles for xterm.js - */ - -.xterm { - font-feature-settings: "liga" 0; - position: relative; - user-select: none; - -ms-user-select: none; - -webkit-user-select: none; -} - -.xterm.focus, -.xterm:focus { - outline: none; -} - -.xterm .xterm-helpers { - position: absolute; - top: 0; - /** - * The z-index of the helpers must be higher than the canvases in order for - * IMEs to appear on top. - */ - z-index: 10; -} - -.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. - */ - position: absolute; - opacity: 0; - left: -9999em; - top: 0; - width: 0; - height: 0; - z-index: -10; - /** Prevent wrapping so the IME appears against the textarea at the correct position */ - white-space: nowrap; - overflow: hidden; - resize: none; -} - -.xterm .composition-view { - /* TODO: Composition position got messed up somewhere */ - background: #000; - color: #FFF; - display: none; - position: absolute; - white-space: nowrap; - z-index: 1; -} - -.xterm .composition-view.active { - display: block; -} - -.xterm .xterm-viewport { - /* On OS X this is required in order for the scroll bar to appear fully opaque */ - background-color: #000; - overflow-y: scroll; - cursor: default; - position: absolute; - right: 0; - left: 0; - top: 0; - bottom: 0; -} - -.xterm .xterm-screen { - position: relative; -} - -.xterm .xterm-screen canvas { - position: absolute; - left: 0; - top: 0; -} - -.xterm .xterm-scroll-area { - visibility: hidden; -} - -.xterm-char-measure-element { - display: inline-block; - visibility: hidden; - position: absolute; - top: 0; - left: -9999em; - line-height: normal; -} - -.xterm { - cursor: text; -} - -.xterm.enable-mouse-events { - /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */ - cursor: default; -} - -.xterm.xterm-cursor-pointer { - cursor: pointer; -} - -.xterm.column-select.focus { - /* Column selection mode */ - cursor: crosshair; -} - -.xterm .xterm-accessibility, -.xterm .xterm-message { - position: absolute; - left: 0; - top: 0; - bottom: 0; - right: 0; - z-index: 100; - color: transparent; -} - -.xterm .live-region { - position: absolute; - left: -9999px; - width: 1px; - height: 1px; - overflow: hidden; -} - -.xterm-dim { - opacity: 0.5; -} - -.xterm-underline { - text-decoration: underline; -} -body, html { - font-family: helvetica, sans-serif, arial; - font-size: 1em; - color: #111; - background-color: rgb(0, 0, 0); - color: rgb(240, 240, 240); - height: 100%; - margin: 0; -} -#header { - color: rgb(240, 240, 240); - background-color: rgb(0, 128, 0); - width: 100%; - border-color: white; - border-style: none none solid none; - border-width: 1px; - text-align: center; - flex: 0 1 auto; - z-index: 99; - height:19px; - display: none; -} -.box { - display: block; - height: 100%; -} -#terminal-container { - display: block; - width: calc(100% - 1 px); - margin: 0 auto; - padding: 2px; - height: calc(100% - 19px); -} -#terminal-container .terminal { - background-color: #000000; - color: #fafafa; - padding: 2px; - height: calc(100% - 19px); -} -#terminal-container .terminal:focus .terminal-cursor { - background-color: #fafafa; -} -#bottomdiv { - position: fixed; - left: 0; - bottom: 0; - width: 100%; - background-color: rgb(50, 50, 50); - border-color: white; - border-style: solid none none none; - border-width: 1px; - z-index: 99; - height: 19px; -} -#footer { - display: inline-block; - color: rgb(240, 240, 240); - background-color: rgb(50, 50, 50); - padding-left: 5px; - padding-right: 5px; - border-color: white; - border-style: none none none solid; - border-width: 1px; - text-align: left; -} -#status { - display: inline-block; - color: rgb(240, 240, 240); - background-color: rgb(50, 50, 50); - padding-left: 10px; - padding-right: 10px; - border-color: white; - border-style: none solid none solid; - border-width: 1px; - text-align: left; - z-index: 100; -} -#menu { - display: inline-block; - font-size: 16px; - color: rgb(255, 255, 255); - padding-left: 10px; - z-index: 100; -} -#menu:hover .dropup-content { - display: block; -} -#logBtn, #credentialsBtn, #reauthBtn { - color: #000; -} - -.dropup { - position: relative; - display: inline-block; - cursor: pointer; -} -.dropup-content { - display: none; - position: absolute; - background-color: #f1f1f1; - font-size: 16px; - min-width: 160px; - bottom: 18px; - z-index: 101; -} -.dropup-content a { - color: #777; - padding: 12px 16px; - text-decoration: none; - display: block; -} -.dropup-content a:hover { - background-color: #ccc -} -.dropup:hover .dropup-content { - display: block; -} -.dropup:click .dropup-content { - display: block; -} -.dropup:hover .dropbtn { - background-color: #3e8e41; -} diff --git a/app/client/src/README.md b/app/client/src/README.md deleted file mode 100644 index e5728b5..0000000 --- a/app/client/src/README.md +++ /dev/null @@ -1 +0,0 @@ -Customizations and modifications to the client (browser) go here. Then run "npm run build" to integrate into ../public (where client files are served from). Note that ../public is a flat directory structure. ../public directory is deleted and refreshed eatch thime "npm run build" is run. diff --git a/app/client/src/client.htm b/app/client/src/client.htm deleted file mode 100644 index 038e107..0000000 --- a/app/client/src/client.htm +++ /dev/null @@ -1,32 +0,0 @@ - - - - - WebSSH2 - - - -
- -
-
- - -
-
-
- - diff --git a/app/client/src/css/style.css b/app/client/src/css/style.css deleted file mode 100644 index d955cc6..0000000 --- a/app/client/src/css/style.css +++ /dev/null @@ -1,123 +0,0 @@ -body, html { - font-family: helvetica, sans-serif, arial; - font-size: 1em; - color: #111; - background-color: rgb(0, 0, 0); - color: rgb(240, 240, 240); - height: 100%; - margin: 0; -} -#header { - color: rgb(240, 240, 240); - background-color: rgb(0, 128, 0); - width: 100%; - border-color: white; - border-style: none none solid none; - border-width: 1px; - text-align: center; - flex: 0 1 auto; - z-index: 99; - height:19px; - display: none; -} -.box { - display: block; - height: 100%; -} -#terminal-container { - display: block; - width: calc(100% - 1 px); - margin: 0 auto; - padding: 2px; - height: calc(100% - 19px); -} -#terminal-container .terminal { - background-color: #000000; - color: #fafafa; - padding: 2px; - height: calc(100% - 19px); -} -#terminal-container .terminal:focus .terminal-cursor { - background-color: #fafafa; -} -#bottomdiv { - position: fixed; - left: 0; - bottom: 0; - width: 100%; - background-color: rgb(50, 50, 50); - border-color: white; - border-style: solid none none none; - border-width: 1px; - z-index: 99; - height: 19px; -} -#footer { - display: inline-block; - color: rgb(240, 240, 240); - background-color: rgb(50, 50, 50); - padding-left: 5px; - padding-right: 5px; - border-color: white; - border-style: none none none solid; - border-width: 1px; - text-align: left; -} -#status { - display: inline-block; - color: rgb(240, 240, 240); - background-color: rgb(50, 50, 50); - padding-left: 10px; - padding-right: 10px; - border-color: white; - border-style: none solid none solid; - border-width: 1px; - text-align: left; - z-index: 100; -} -#menu { - display: inline-block; - font-size: 16px; - color: rgb(255, 255, 255); - padding-left: 10px; - z-index: 100; -} -#menu:hover .dropup-content { - display: block; -} -#logBtn, #credentialsBtn, #reauthBtn { - color: #000; -} - -.dropup { - position: relative; - display: inline-block; - cursor: pointer; -} -.dropup-content { - display: none; - position: absolute; - background-color: #f1f1f1; - font-size: 16px; - min-width: 160px; - bottom: 18px; - z-index: 101; -} -.dropup-content a { - color: #777; - padding: 12px 16px; - text-decoration: none; - display: block; -} -.dropup-content a:hover { - background-color: #ccc -} -.dropup:hover .dropup-content { - display: block; -} -.dropup:click .dropup-content { - display: block; -} -.dropup:hover .dropbtn { - background-color: #3e8e41; -} diff --git a/app/client/src/favicon.ico b/app/client/src/favicon.ico deleted file mode 100644 index 5e4be95..0000000 Binary files a/app/client/src/favicon.ico and /dev/null differ diff --git a/app/client/src/js/index.js b/app/client/src/js/index.js deleted file mode 100644 index e6daa70..0000000 --- a/app/client/src/js/index.js +++ /dev/null @@ -1,246 +0,0 @@ -'use strict' - -import * as io from 'socket.io-client' -import * as Terminal from 'xterm/dist/xterm' -import * as fit from 'xterm/dist/addons/fit/fit' -import { library, dom } from '@fortawesome/fontawesome-svg-core' -import { faBars, faClipboard, faDownload, faKey, faCog } from '@fortawesome/free-solid-svg-icons' -library.add(faBars, faClipboard, faDownload, faKey, faCog) -dom.watch() - -require('xterm/dist/xterm.css') -require('../css/style.css') - -Terminal.applyAddon(fit) - -/* global Blob, logBtn, credentialsBtn, reauthBtn, downloadLogBtn */ -var sessionLogEnable = false -var loggedData = false -var allowreplay = false -var allowreauth = false -var sessionLog, sessionFooter, logDate, currentDate, myFile, errorExists -var socket, termid // eslint-disable-line -var term = new Terminal() -// DOM properties -var status = document.getElementById('status') -var header = document.getElementById('header') -var dropupContent = document.getElementById('dropupContent') -var footer = document.getElementById('footer') -var terminalContainer = document.getElementById('terminal-container') -term.open(terminalContainer) -term.focus() -term.fit() - -window.addEventListener('resize', resizeScreen, false) - -function resizeScreen () { - term.fit() - socket.emit('resize', { cols: term.cols, rows: term.rows }) -} - -socket = io.connect({ - path: '/ssh/socket.io' -}) - -term.on('data', function (data) { - socket.emit('data', data) -}) - -socket.on('data', function (data) { - term.write(data) - if (sessionLogEnable) { - sessionLog = sessionLog + data - } -}) - -socket.on('connect', function () { - socket.emit('geometry', term.cols, term.rows) -}) - -socket.on('setTerminalOpts', function (data) { - term.setOption('cursorBlink', data.cursorBlink) - term.setOption('scrollback', data.scrollback) - term.setOption('tabStopWidth', data.tabStopWidth) - term.setOption('bellStyle', data.bellStyle) -}) - -socket.on('title', function (data) { - document.title = data -}) - -socket.on('menu', function (data) { - drawMenu(data) -}) - -socket.on('status', function (data) { - status.innerHTML = data -}) - -socket.on('ssherror', function (data) { - status.innerHTML = data - status.style.backgroundColor = 'red' - errorExists = true -}) - -socket.on('headerBackground', function (data) { - header.style.backgroundColor = data -}) - -socket.on('header', function (data) { - if (data) { - header.innerHTML = data - header.style.display = 'block' - // header is 19px and footer is 19px, recaculate new terminal-container and resize - terminalContainer.style.height = 'calc(100% - 38px)' - resizeScreen() - } -}) - -socket.on('footer', function (data) { - sessionFooter = data - footer.innerHTML = data -}) - -socket.on('statusBackground', function (data) { - status.style.backgroundColor = data -}) - -socket.on('allowreplay', function (data) { - if (data === true) { - console.log('allowreplay: ' + data) - allowreplay = true - drawMenu(dropupContent.innerHTML + ' Credentials') - } else { - allowreplay = false - console.log('allowreplay: ' + data) - } -}) - -socket.on('allowreauth', function (data) { - if (data === true) { - console.log('allowreauth: ' + data) - allowreauth = true - drawMenu(dropupContent.innerHTML + ' Switch User') - } else { - allowreauth = false - console.log('allowreauth: ' + data) - } -}) - -socket.on('disconnect', function (err) { - if (!errorExists) { - status.style.backgroundColor = 'red' - status.innerHTML = - 'WEBSOCKET SERVER DISCONNECTED: ' + err - } - socket.io.reconnection(false) -}) - -socket.on('error', function (err) { - if (!errorExists) { - status.style.backgroundColor = 'red' - status.innerHTML = 'ERROR: ' + err - } -}) - -socket.on('reauth', function () { - (allowreauth) && reauthSession() -}) - -term.on('title', function (title) { - document.title = title -}) - -// draw/re-draw menu and reattach listeners -// when dom is changed, listeners are abandonded -function drawMenu (data) { - dropupContent.innerHTML = data - logBtn.addEventListener('click', toggleLog) - allowreauth && reauthBtn.addEventListener('click', reauthSession) - allowreplay && credentialsBtn.addEventListener('click', replayCredentials) - loggedData && downloadLogBtn.addEventListener('click', downloadLog) -} - -// reauthenticate -function reauthSession () { // eslint-disable-line - console.log('re-authenticating') - window.location.href = '/ssh/reauth' - return false -} - -// replay password to server, requires -function replayCredentials () { // eslint-disable-line - socket.emit('control', 'replayCredentials') - console.log('replaying credentials') - term.focus() - return false -} - -// Set variable to toggle log data from client/server to a varialble -// for later download -function toggleLog () { // eslint-disable-line - if (sessionLogEnable === true) { - sessionLogEnable = false - loggedData = true - logBtn.innerHTML = ' Start Log' - console.log('stopping log, ' + sessionLogEnable) - currentDate = new Date() - sessionLog = sessionLog + '\r\n\r\nLog End for ' + sessionFooter + ': ' + - currentDate.getFullYear() + '/' + (currentDate.getMonth() + 1) + '/' + - currentDate.getDate() + ' @ ' + currentDate.getHours() + ':' + - currentDate.getMinutes() + ':' + currentDate.getSeconds() + '\r\n' - logDate = currentDate - term.focus() - return false - } else { - sessionLogEnable = true - loggedData = true - logBtn.innerHTML = ' Stop Log' - downloadLogBtn.style.color = '#000' - downloadLogBtn.addEventListener('click', downloadLog) - console.log('starting log, ' + sessionLogEnable) - currentDate = new Date() - sessionLog = 'Log Start for ' + sessionFooter + ': ' + - currentDate.getFullYear() + '/' + (currentDate.getMonth() + 1) + '/' + - currentDate.getDate() + ' @ ' + currentDate.getHours() + ':' + - currentDate.getMinutes() + ':' + currentDate.getSeconds() + '\r\n\r\n' - logDate = currentDate - term.focus() - return false - } -} - -// cross browser method to "download" an element to the local system -// used for our client-side logging feature -function downloadLog () { // eslint-disable-line - if (loggedData === true) { - myFile = 'WebSSH2-' + logDate.getFullYear() + (logDate.getMonth() + 1) + - logDate.getDate() + '_' + logDate.getHours() + logDate.getMinutes() + - logDate.getSeconds() + '.log' - // regex should eliminate escape sequences from being logged. - var blob = new Blob([sessionLog.replace(/[\u001b\u009b][[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><;]/g, '')], { // eslint-disable-line no-control-regex - type: 'text/plain' - }) - if (window.navigator.msSaveOrOpenBlob) { - window.navigator.msSaveBlob(blob, myFile) - } else { - var elem = window.document.createElement('a') - elem.href = window.URL.createObjectURL(blob) - elem.download = myFile - document.body.appendChild(elem) - elem.click() - document.body.removeChild(elem) - } - } - term.focus() -} - -// Add an event listener for capturing Ctrl + Shift + 6 -document.addEventListener('keydown', function(event) { - if (event.ctrlKey && event.shiftKey && event.code === 'Digit6') { - // Prevent the default action - event.preventDefault(); - // Emit the desired key sequence to the server - socket.emit('data', '\x1E'); // 0x1E is the RS control character - } -}); \ No newline at end of file diff --git a/app/config.js b/app/config.js new file mode 100644 index 0000000..01e1da2 --- /dev/null +++ b/app/config.js @@ -0,0 +1,95 @@ +// config.js +const path = require("path"); +const fs = require("fs"); +const nodeRoot = path.dirname(require.main.filename); +const configPath = path.join(nodeRoot, "config.json"); + +// Default configuration +let config = { + listen: { + ip: "0.0.0.0", + port: 2222, + }, + http: { + origins: ["*:*"], + }, + user: { + name: null, + password: null, + }, + ssh: { + host: null, + port: 22, + term: "xterm-color", + readyTimeout: 20000, + keepaliveInterval: 120000, + keepaliveCountMax: 10, + }, + terminal: { + cursorBlink: true, + scrollback: 10000, + tabStopWidth: 8, + bellStyle: "sound", + }, + header: { + text: null, + background: "green", + }, + session: { + name: "WebSSH2", + secret: "mysecret", + }, + options: { + challengeButton: true, + allowreauth: true, + }, + algorithms: { + kex: [ + "ecdh-sha2-nistp256", + "ecdh-sha2-nistp384", + "ecdh-sha2-nistp521", + "diffie-hellman-group-exchange-sha256", + "diffie-hellman-group14-sha1", + ], + cipher: [ + "aes128-ctr", + "aes192-ctr", + "aes256-ctr", + "aes128-gcm", + "aes128-gcm@openssh.com", + "aes256-gcm", + "aes256-gcm@openssh.com", + "aes256-cbc", + ], + hmac: ["hmac-sha2-256", "hmac-sha2-512", "hmac-sha1"], + compress: ["none", "zlib@openssh.com", "zlib"], + }, + serverlog: { + client: false, + server: false, + }, + accesslog: false, + verify: false, +}; + +try { + if (fs.existsSync(configPath)) { + console.log("WebSSH2 service reading config from: " + configPath); + config = require("read-config-ng")(configPath); + } else { + console.error( + "\n\nERROR: Missing config.json for webssh. Current config: " + + JSON.stringify(config) + ); + console.error("\n See config.json.sample for details\n\n"); + } +} catch (err) { + console.error( + "\n\nERROR: Missing config.json for webssh. Current config: " + + JSON.stringify(config) + ); + console.error("\n See config.json.sample for details\n\n"); + console.error("ERROR:\n\n " + err); +} + +module.exports = config; diff --git a/app/expressOptions.js b/app/expressOptions.js new file mode 100644 index 0000000..2361dde --- /dev/null +++ b/app/expressOptions.js @@ -0,0 +1,12 @@ +// app/expressOptions.js +module.exports = { + dotfiles: "ignore", + etag: false, + extensions: ["htm", "html"], + index: false, + maxAge: "1s", + redirect: false, + setHeaders: function (res, path, stat) { + res.set("x-timestamp", Date.now()); + }, +}; diff --git a/app/index.js b/app/index.js deleted file mode 100644 index 2173768..0000000 --- a/app/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict' -/* jshint esversion: 6, asi: true, node: true */ -/* - * index.js - * - * WebSSH2 - Web to SSH2 gateway - * Bill Church - https://github.com/billchurch/WebSSH2 - May 2017 - * - */ - -var config = require('./server/app').config -var server = require('./server/app').server - -server.listen({ host: config.listen.ip, port: config.listen.port -}) - -console.log('WebSSH2 service listening on ' + config.listen.ip + ':' + config.listen.port) - -server.on('error', function (err) { - if (err.code === 'EADDRINUSE') { - config.listen.port++ - console.warn('WebSSH2 Address in use, retrying on port ' + config.listen.port) - setTimeout(function () { - server.listen(config.listen.port) - }, 250) - } else { - console.log('WebSSH2 server.listen ERROR: ' + err.code) - } -}) diff --git a/app/scripts/webpack.common.js b/app/scripts/webpack.common.js deleted file mode 100644 index 73ef619..0000000 --- a/app/scripts/webpack.common.js +++ /dev/null @@ -1,61 +0,0 @@ -const webpack = require("webpack"); -const { BannerPlugin } = require("webpack"); -const HtmlWebpackPlugin = require("html-webpack-plugin"); -const path = require("path"); -const CopyWebpackPlugin = require("copy-webpack-plugin"); -const CleanWebpackPlugin = require("clean-webpack-plugin"); -const ExtractTextPlugin = require("extract-text-webpack-plugin"); -const packageJson = require("../package.json"); // Load package.json -const commitHash = require("child_process") - .execSync("git rev-parse --short HEAD") - .toString() - .trim(); - -module.exports = { - context: path.resolve(__dirname, "../"), - entry: { - webssh2: "./client/src/js/index.js", - }, - plugins: [ - new BannerPlugin({ - banner: `Version ${ - packageJson.version - } - ${new Date().toISOString()} - ${commitHash}`, - include: /\.(js|css|html|htm)$/, - }), - new CleanWebpackPlugin(["client/public"], { - root: path.resolve("__dirname", "../"), - verbose: true, - }), - new HtmlWebpackPlugin({ - template: "./client/src/client.htm", // Path to your source template - filename: "client.htm", // Optional: output file name, defaults to index.html - minify: false, - scriptLoading: "defer", - version: `Version ${ - packageJson.version - } - ${new Date().toISOString()} - ${commitHash}`, - publicPath: "/ssh/", // Prepend /ssh/ to the script tags - }), - new CopyWebpackPlugin([ - { from: "./client/src/favicon.ico", to: "favicon.ico" }, - ]), - new ExtractTextPlugin("[name].css"), - ], - output: { - filename: "[name].bundle.js", - path: path.resolve(__dirname, "../client/public"), - publicPath: "/ssh/", // Prepend /ssh/ to the script tags - }, - module: { - rules: [ - { - test: /\.css$/, - use: ExtractTextPlugin.extract({ - fallback: "style-loader", - use: [{ loader: "css-loader" }], - }), - }, - ], - }, -}; diff --git a/app/scripts/webpack.dev.js b/app/scripts/webpack.dev.js deleted file mode 100644 index be04c55..0000000 --- a/app/scripts/webpack.dev.js +++ /dev/null @@ -1,9 +0,0 @@ -const merge = require('webpack-merge') -const common = require('./webpack.common.js') - -module.exports = merge(common, { - devtool: 'inline-source-map', - devServer: { - contentBase: '../client/public' - } -}) diff --git a/app/scripts/webpack.prod.js b/app/scripts/webpack.prod.js deleted file mode 100644 index 42eec9b..0000000 --- a/app/scripts/webpack.prod.js +++ /dev/null @@ -1,21 +0,0 @@ -const merge = require("webpack-merge"); -const UglifyJSPlugin = require("uglifyjs-webpack-plugin"); -const common = require("./webpack.common.js"); - -module.exports = merge( - { - plugins: [ - new UglifyJSPlugin({ - uglifyOptions: { - ie8: false, - dead_code: true, - output: { - comments: false, - beautify: false, - }, - }, - }), - ], - }, - common -); diff --git a/app/server/app.js b/app/server/app.js deleted file mode 100644 index c9e1957..0000000 --- a/app/server/app.js +++ /dev/null @@ -1,202 +0,0 @@ -'use strict' -/* jshint esversion: 6, asi: true, node: true */ -// app.js - -var path = require('path') -var fs = require('fs') -var nodeRoot = path.dirname(require.main.filename) -var configPath = path.join(nodeRoot, 'config.json') -var publicPath = path.join(nodeRoot, 'client', 'public') -console.log('WebSSH2 service reading config from: ' + configPath) -var express = require('express') -var logger = require('morgan') - -// sane defaults if config.json or parts are missing -let config = { - listen: { - ip: '0.0.0.0', - port: 2222 - }, - http: { - origins: ['*:*'] - }, - user: { - name: null, - password: null - }, - ssh: { - host: null, - port: 22, - term: 'xterm-color', - readyTimeout: 20000, - keepaliveInterval: 120000, - keepaliveCountMax: 10 - }, - terminal: { - cursorBlink: true, - scrollback: 10000, - tabStopWidth: 8, - bellStyle: 'sound' - }, - header: { - text: null, - background: 'green' - }, - session: { - name: 'WebSSH2', - secret: 'mysecret' - }, - options: { - challengeButton: true, - allowreauth: true - }, - algorithms: { - kex: [ - 'ecdh-sha2-nistp256', - 'ecdh-sha2-nistp384', - 'ecdh-sha2-nistp521', - 'diffie-hellman-group-exchange-sha256', - 'diffie-hellman-group14-sha1' - ], - cipher: [ - 'aes128-ctr', - 'aes192-ctr', - 'aes256-ctr', - 'aes128-gcm', - 'aes128-gcm@openssh.com', - 'aes256-gcm', - 'aes256-gcm@openssh.com', - 'aes256-cbc' - ], - hmac: [ - 'hmac-sha2-256', - 'hmac-sha2-512', - 'hmac-sha1' - ], - compress: [ - 'none', - 'zlib@openssh.com', - 'zlib' - ] - }, - serverlog: { - client: false, - server: false - }, - accesslog: false, - verify: false -} - -// test if config.json exists, if not provide error message but try to run -// anyway -try { - if (fs.existsSync(configPath)) { - console.log('ephemeral_auth service reading config from: ' + configPath) - config = require('read-config')(configPath) - } else { - console.error('\n\nERROR: Missing config.json for webssh. Current config: ' + JSON.stringify(config)) - console.error('\n See config.json.sample for details\n\n') - } -} catch (err) { - console.error('\n\nERROR: Missing config.json for webssh. Current config: ' + JSON.stringify(config)) - console.error('\n See config.json.sample for details\n\n') - console.error('ERROR:\n\n ' + err) -} - -var session = require('express-session')({ - secret: config.session.secret, - name: config.session.name, - resave: true, - saveUninitialized: false, - unset: 'destroy' -}) -var app = express() -var compression = require('compression') -var server = require('http').Server(app) -var myutil = require('./util') -var validator = require('validator') -var io = require('socket.io')(server, { serveClient: false, path: '/ssh/socket.io', origins: config.http.origins }) -var socket = require('./socket') -var expressOptions = require('./expressOptions') -var favicon = require('serve-favicon') - -// express -app.use(compression({ level: 9 })) -app.use(session) -app.use(myutil.basicAuth) -if (config.accesslog) app.use(logger('common')) -app.disable('x-powered-by') - -// static files -app.use('/ssh', express.static(publicPath, expressOptions)) -// app.use(express.static(publicPath, expressOptions)) - -// favicon from root if being pre-fetched by browser to prevent a 404 -app.use(favicon(path.join(publicPath,'favicon.ico'))) - -app.get('/ssh/reauth', function (req, res, next) { - var r = req.headers.referer || '/' - res.status(401).send('') -}) - -// eslint-disable-next-line complexity -app.get('/ssh/host/:host?', function (req, res, next) { - res.sendFile(path.join(path.join(publicPath, 'client.htm'))) - // capture, assign, and validated variables - req.session.ssh = { - host: (validator.isIP(req.params.host + '') && req.params.host) || - (validator.isFQDN(req.params.host) && req.params.host) || - (/^(([a-z]|[A-Z]|[0-9]|[!^(){}\-_~])+)?\w$/.test(req.params.host) && - req.params.host) || config.ssh.host, - port: (validator.isInt(req.query.port + '', { min: 1, max: 65535 }) && - req.query.port) || config.ssh.port, - header: { - name: req.query.header || config.header.text, - background: req.query.headerBackground || config.header.background - }, - algorithms: config.algorithms, - keepaliveInterval: config.ssh.keepaliveInterval, - keepaliveCountMax: config.ssh.keepaliveCountMax, - term: (/^(([a-z]|[A-Z]|[0-9]|[!^(){}\-_~])+)?\w$/.test(req.query.sshterm) && - req.query.sshterm) || config.ssh.term, - terminal: { - cursorBlink: (validator.isBoolean(req.query.cursorBlink + '') ? myutil.parseBool(req.query.cursorBlink) : config.terminal.cursorBlink), - scrollback: (validator.isInt(req.query.scrollback + '', { min: 1, max: 200000 }) && req.query.scrollback) ? req.query.scrollback : config.terminal.scrollback, - tabStopWidth: (validator.isInt(req.query.tabStopWidth + '', { min: 1, max: 100 }) && req.query.tabStopWidth) ? req.query.tabStopWidth : config.terminal.tabStopWidth, - bellStyle: ((req.query.bellStyle) && (['sound', 'none'].indexOf(req.query.bellStyle) > -1)) ? req.query.bellStyle : config.terminal.bellStyle - }, - allowreplay: config.options.challengeButton || (validator.isBoolean(req.headers.allowreplay + '') ? myutil.parseBool(req.headers.allowreplay) : false), - allowreauth: config.options.allowreauth || false, - mrhsession: ((validator.isAlphanumeric(req.headers.mrhsession + '') && req.headers.mrhsession) ? req.headers.mrhsession : 'none'), - serverlog: { - client: config.serverlog.client || false, - server: config.serverlog.server || false - }, - readyTimeout: (validator.isInt(req.query.readyTimeout + '', { min: 1, max: 300000 }) && - req.query.readyTimeout) || config.ssh.readyTimeout - } - if (req.session.ssh.header.name) validator.escape(req.session.ssh.header.name) - if (req.session.ssh.header.background) validator.escape(req.session.ssh.header.background) -}) - -// express error handling -app.use(function (req, res, next) { - res.status(404).send("Sorry can't find that!") -}) - -app.use(function (err, req, res, next) { - console.error(err.stack) - res.status(500).send('Something broke!') -}) - -// socket.io -// expose express session with socket.request.session -io.use(function (socket, next) { - (socket.request.res) ? session(socket.request, socket.request.res, next) - : next(next) -}) - -// bring up socket -io.on('connection', socket) - -module.exports = { server: server, config: config } diff --git a/app/server/expressOptions.js b/app/server/expressOptions.js deleted file mode 100644 index 86d4841..0000000 --- a/app/server/expressOptions.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - dotfiles: 'ignore', - etag: false, - extensions: ['htm', 'html'], - index: false, - maxAge: '1s', - redirect: false, - setHeaders: function (res, path, stat) { - res.set('x-timestamp', Date.now()) - } -} diff --git a/app/server/socket.js b/app/server/socket.js deleted file mode 100644 index 4756b7f..0000000 --- a/app/server/socket.js +++ /dev/null @@ -1,173 +0,0 @@ -'use strict' -/* jshint esversion: 6, asi: true, node: true */ -// socket.js - -// private -var debug = require('debug') -var debugWebSSH2 = require('debug')('WebSSH2') -var SSH = require('ssh2').Client -// var fs = require('fs') -// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8')) -var termCols, termRows -var menuData = ' Start Log' + - ' Download Log' - -// public -module.exports = function socket (socket) { - // if websocket connection arrives without an express session, kill it - if (!socket.request.session) { - socket.emit('401 UNAUTHORIZED') - debugWebSSH2('SOCKET: No Express Session / REJECTED') - socket.disconnect(true) - return - } - var conn = new SSH() - socket.on('geometry', function socketOnGeometry (cols, rows) { - termCols = cols - termRows = rows - }) - conn.on('banner', function connOnBanner (data) { - // need to convert to cr/lf for proper formatting - data = data.replace(/\r?\n/g, '\r\n') - socket.emit('data', data.toString('utf-8')) - }) - - conn.on('ready', function connOnReady () { - console.log('WebSSH2 Login: user=' + socket.request.session.username + ' from=' + socket.handshake.address + ' host=' + socket.request.session.ssh.host + ' port=' + socket.request.session.ssh.port + ' sessionID=' + socket.request.sessionID + '/' + socket.id + ' mrhsession=' + socket.request.session.ssh.mrhsession + ' allowreplay=' + socket.request.session.ssh.allowreplay + ' term=' + socket.request.session.ssh.term) - socket.emit('menu', menuData) - socket.emit('allowreauth', socket.request.session.ssh.allowreauth) - socket.emit('setTerminalOpts', socket.request.session.ssh.terminal) - socket.emit('title', 'ssh://' + socket.request.session.ssh.host) - if (socket.request.session.ssh.header.background) socket.emit('headerBackground', socket.request.session.ssh.header.background) - if (socket.request.session.ssh.header.name) socket.emit('header', socket.request.session.ssh.header.name) - socket.emit('footer', 'ssh://' + socket.request.session.username + '@' + socket.request.session.ssh.host + ':' + socket.request.session.ssh.port) - socket.emit('status', 'SSH CONNECTION ESTABLISHED') - socket.emit('statusBackground', 'green') - socket.emit('allowreplay', socket.request.session.ssh.allowreplay) - conn.shell({ - term: socket.request.session.ssh.term, - cols: termCols, - rows: termRows - }, function connShell (err, stream) { - if (err) { - SSHerror('EXEC ERROR' + err) - conn.end() - return - } - // poc to log commands from client - if (socket.request.session.ssh.serverlog.client) var dataBuffer - socket.on('data', function socketOnData (data) { - stream.write(data) - // poc to log commands from client - if (socket.request.session.ssh.serverlog.client) { - if (data === '\r') { - console.log('serverlog.client: ' + socket.request.session.id + '/' + socket.id + ' host: ' + socket.request.session.ssh.host + ' command: ' + dataBuffer) - dataBuffer = undefined - } else { - dataBuffer = (dataBuffer) ? dataBuffer + data : data - } - } - }) - socket.on('control', function socketOnControl (controlData) { - switch (controlData) { - case 'replayCredentials': - if (socket.request.session.ssh.allowreplay) { - stream.write(socket.request.session.userpassword + '\n') - } - /* falls through */ - default: - console.log('controlData: ' + controlData) - } - }) - socket.on('resize', function socketOnResize (data) { - stream.setWindow(data.rows, data.cols) - }) - socket.on('disconnecting', function socketOnDisconnecting (reason) { debugWebSSH2('SOCKET DISCONNECTING: ' + reason) }) - socket.on('disconnect', function socketOnDisconnect (reason) { - debugWebSSH2('SOCKET DISCONNECT: ' + reason) - err = { message: reason } - SSHerror('CLIENT SOCKET DISCONNECT', err) - conn.end() - // socket.request.session.destroy() - }) - socket.on('error', function socketOnError (err) { - SSHerror('SOCKET ERROR', err) - conn.end() - }) - - stream.on('data', function streamOnData (data) { socket.emit('data', data.toString('utf-8')) }) - stream.on('close', function streamOnClose (code, signal) { - err = { message: ((code || signal) ? (((code) ? 'CODE: ' + code : '') + ((code && signal) ? ' ' : '') + ((signal) ? 'SIGNAL: ' + signal : '')) : undefined) } - SSHerror('STREAM CLOSE', err) - conn.end() - }) - stream.stderr.on('data', function streamStderrOnData (data) { - console.log('STDERR: ' + data) - }) - }) - }) - - conn.on('end', function connOnEnd (err) { SSHerror('CONN END BY HOST', err) }) - conn.on('close', function connOnClose (err) { SSHerror('CONN CLOSE', err) }) - conn.on('error', function connOnError (err) { SSHerror('CONN ERROR', err) }) - conn.on('keyboard-interactive', function connOnKeyboardInteractive (name, instructions, instructionsLang, prompts, finish) { - debugWebSSH2('conn.on(\'keyboard-interactive\')') - finish([socket.request.session.userpassword]) - }) - if (socket.request.session.username && socket.request.session.userpassword && socket.request.session.ssh) { - // console.log('hostkeys: ' + hostkeys[0].[0]) - conn.connect({ - host: socket.request.session.ssh.host, - port: socket.request.session.ssh.port, - username: socket.request.session.username, - password: socket.request.session.userpassword, - tryKeyboard: true, - algorithms: socket.request.session.ssh.algorithms, - readyTimeout: socket.request.session.ssh.readyTimeout, - keepaliveInterval: socket.request.session.ssh.keepaliveInterval, - keepaliveCountMax: socket.request.session.ssh.keepaliveCountMax, - debug: debug('ssh2') - }) - } else { - debugWebSSH2('Attempt to connect without session.username/password or session varialbles defined, potentially previously abandoned client session. disconnecting websocket client.\r\nHandshake information: \r\n ' + JSON.stringify(socket.handshake)) - socket.emit('ssherror', 'WEBSOCKET ERROR - Refresh the browser and try again') - socket.request.session.destroy() - socket.disconnect(true) - } - - /** - * Error handling for various events. Outputs error to client, logs to - * server, destroys session and disconnects socket. - * @param {string} myFunc Function calling this function - * @param {object} err error object or error message - */ - function SSHerror (myFunc, err) { - var theError - if (socket.request.session) { - // we just want the first error of the session to pass to the client - socket.request.session.error = (socket.request.session.error) || ((err) ? err.message : undefined) - theError = (socket.request.session.error) ? ': ' + socket.request.session.error : '' - // log unsuccessful login attempt - if (err && (err.level === 'client-authentication')) { - console.log('WebSSH2 ' + 'error: Authentication failure'.red.bold + - ' user=' + socket.request.session.username.yellow.bold.underline + - ' from=' + socket.handshake.address.yellow.bold.underline) - socket.emit('allowreauth', socket.request.session.ssh.allowreauth) - socket.emit('reauth') - } else { - console.log('WebSSH2 Logout: user=' + socket.request.session.username + ' from=' + socket.handshake.address + ' host=' + socket.request.session.ssh.host + ' port=' + socket.request.session.ssh.port + ' sessionID=' + socket.request.sessionID + '/' + socket.id + ' allowreplay=' + socket.request.session.ssh.allowreplay + ' term=' + socket.request.session.ssh.term) - if (err) { - theError = (err) ? ': ' + err.message : '' - console.log('WebSSH2 error' + theError) - } - } - socket.emit('ssherror', 'SSH ' + myFunc + theError) - socket.request.session.destroy() - socket.disconnect(true) - } else { - theError = (err) ? ': ' + err.message : '' - socket.disconnect(true) - } - debugWebSSH2('SSHerror ' + myFunc + theError) - } -} diff --git a/app/server/util.js b/app/server/util.js deleted file mode 100644 index a3ea940..0000000 --- a/app/server/util.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict' -/* jshint esversion: 6, asi: true, node: true */ -// util.js - -// private -require('colors') // allow for color property extensions in log messages -var debug = require('debug')('WebSSH2') -var Auth = require('basic-auth') - -exports.basicAuth = function basicAuth (req, res, next) { - var myAuth = Auth(req) - if (myAuth && myAuth.pass !== '') { - req.session.username = myAuth.name - req.session.userpassword = myAuth.pass - debug('myAuth.name: ' + myAuth.name.yellow.bold.underline + - ' and password ' + ((myAuth.pass) ? 'exists'.yellow.bold.underline - : 'is blank'.underline.red.bold)) - next() - } else { - res.statusCode = 401 - debug('basicAuth credential request (401)') - res.setHeader('WWW-Authenticate', 'Basic realm="WebSSH"') - res.end('Username and password required for web SSH service.') - } -} - -// takes a string, makes it boolean (true if the string is true, false otherwise) -exports.parseBool = function parseBool (str) { - return (str.toLowerCase() === 'true') -} diff --git a/app/socket.js b/app/socket.js new file mode 100644 index 0000000..84be890 --- /dev/null +++ b/app/socket.js @@ -0,0 +1,150 @@ +// app/socket.js +"use strict"; + +const debug = require("debug"); +const debugWebSSH2 = require("debug")("WebSSH2"); +const SSH = require("ssh2").Client; + +const menuData = ` + Start Log + Download Log +`; + +module.exports = function (io) { + io.on("connection", (socket) => { + let conn = null; + let stream = null; + console.log(`SOCKET CONNECT: ${socket.id}`); + + // Remove existing listeners to prevent duplicates + socket.removeAllListeners("authenticate"); + socket.removeAllListeners("data"); + socket.removeAllListeners("resize"); + socket.removeAllListeners("disconnect"); + + // Authenticate user + socket.on("authenticate", (credentials) => { + console.log(`SOCKET AUTHENTICATE: ${socket.id}`); + if (isValidCredentials(credentials)) { + console.log(`SOCKET AUTHENTICATE SUCCESS: ${socket.id}`); + initializeConnection(socket, credentials); + } else { + console.log(`SOCKET AUTHENTICATE FAILED: ${socket.id}`); + socket.emit("auth_result", { + success: false, + message: "Invalid credentials", + }); + } + }); + + socket.on("disconnect", (reason) => { + debugWebSSH2(`SOCKET DISCONNECT: ${socket.id}, Reason: ${reason}`); + if (conn) { + conn.end(); + } + // Clean up listeners + socket.removeAllListeners(); + }); + + socket.on("data", (data) => { + if (stream) { + stream.write(data); + } + }); + + socket.on("resize", (data) => { + if (stream) { + stream.setWindow(data.rows, data.cols); + } + }); + + function initializeConnection(socket, credentials) { + if (conn) { + // If there's an existing connection, end it before creating a new one + conn.end(); + } + + conn = new SSH(); + + conn.on("ready", () => { + console.log( + `WebSSH2 Login: user=${credentials.username} from=${socket.handshake.address} host=${credentials.host} port=${credentials.port} sessionID=${socket.id}` + ); + + socket.emit("auth_result", { success: true }); + socket.emit("menu", menuData); + socket.emit("title", `ssh://${credentials.host}`); + socket.emit("status", "SSH CONNECTION ESTABLISHED"); + socket.emit("statusBackground", "green"); + + conn.shell( + { + term: credentials.term, + cols: credentials.cols, + rows: credentials.rows, + }, + (err, str) => { + if (err) { + return SSHerror("EXEC ERROR", err); + } + stream = str; + + stream.on("data", (data) => { + socket.emit("data", data.toString("utf-8")); + }); + + stream.on("close", (code, signal) => { + SSHerror("STREAM CLOSE", { + message: + code || signal + ? `CODE: ${code} SIGNAL: ${signal}` + : undefined, + }); + }); + + stream.stderr.on("data", (data) => { + console.log("STDERR: " + data); + }); + } + ); + }); + + conn.on("banner", (data) => { + socket.emit("data", data.replace(/\r?\n/g, "\r\n")); + }); + + conn.on("end", () => SSHerror("CONN END BY HOST")); + conn.on("close", () => SSHerror("CONN CLOSE")); + conn.on("error", (err) => SSHerror("CONN ERROR", err)); + + conn.connect({ + host: credentials.host, + port: credentials.port, + username: credentials.username, + password: credentials.password, + tryKeyboard: true, + algorithms: credentials.algorithms, + readyTimeout: credentials.readyTimeout, + keepaliveInterval: credentials.keepaliveInterval, + keepaliveCountMax: credentials.keepaliveCountMax, + debug: debug("ssh2"), + }); + } + + function SSHerror(myFunc, err) { + const errorMessage = err ? `: ${err.message}` : ""; + console.log(`WebSSH2 error: ${myFunc}${errorMessage}`); + socket.emit("ssherror", `SSH ${myFunc}${errorMessage}`); + if (conn) { + conn.end(); + } + // Don't disconnect the socket here, let the client handle reconnection if necessary + // socket.disconnect(true); + } + + function isValidCredentials(credentials) { + // Implement your credential validation logic here + return credentials && credentials.username && credentials.password; + } + }); +}; diff --git a/app/util.js b/app/util.js new file mode 100644 index 0000000..242dca2 --- /dev/null +++ b/app/util.js @@ -0,0 +1,13 @@ +"use strict"; +// app/util.js +/* jshint esversion: 6, asi: true, node: true */ + +// private +require("colors"); // allow for color property extensions in log messages +var debug = require("debug")("WebSSH2"); +var Auth = require("basic-auth"); + +// takes a string, makes it boolean (true if the string is true, false otherwise) +exports.parseBool = function parseBool(str) { + return str.toLowerCase() === "true"; +}; diff --git a/app/config.json.sample b/config.json.sample similarity index 100% rename from app/config.json.sample rename to config.json.sample diff --git a/index.js b/index.js new file mode 100644 index 0000000..ac9d7e1 --- /dev/null +++ b/index.js @@ -0,0 +1,30 @@ +"use strict"; +/* jshint esversion: 6, asi: true, node: true */ +/* + * index.js + * + * WebSSH2 - Web to SSH2 gateway + * Bill Church - https://github.com/billchurch/WebSSH2 - May 2017 + * + */ +const { server, config } = require("./app/app"); + +server.listen(config.listen.port, config.listen.ip, () => { + console.log( + `WebSSH2 service listening on ${config.listen.ip}:${config.listen.port}` + ); +}); + +server.on("error", function (err) { + if (err.code === "EADDRINUSE") { + config.listen.port++; + console.warn( + "WebSSH2 Address in use, retrying on port " + config.listen.port + ); + setTimeout(function () { + server.listen(config.listen.port); + }, 250); + } else { + console.log("WebSSH2 server.listen ERROR: " + err.code); + } +}); diff --git a/app/package.json b/package.json similarity index 54% rename from app/package.json rename to package.json index 4f6475e..592e016 100644 --- a/app/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "webssh2", - "version": "0.2.12", + "name": "webssh2-server", + "version": "0.2.13", "ignore": [ ".gitignore" ], @@ -47,46 +47,19 @@ }, "scripts": { "start": "node index.js", - "build": "webpack --progress --colors --config scripts/webpack.prod.js", - "builddev": "webpack --progress --colors --config scripts/webpack.dev.js", - "analyze": "webpack --json --config scripts/webpack.prod.js | webpack-bundle-size-analyzer", - "test": "snyk test", "watch": "nodemon index.js", "standard": "standard --verbose --fix | snazzy", "cleanmac": "find . -name '.DS_Store' -type f -delete" }, "standard": { "ignore": [ - "client/public/webssh2.bundle.js", - "bigip/*", - "screenshots/*", "bin/*", - "build/*", - "workspace/*" + "build/*" ] }, "devDependencies": { - "@fortawesome/fontawesome-svg-core": "^1.2.12", - "@fortawesome/free-solid-svg-icons": "^5.6.3", - "clean-webpack-plugin": "^1.0.0", - "copy-webpack-plugin": "^4.6.0", - "cross-env": "^5.2.0", - "css-loader": "^2.1.0", - "extract-text-webpack-plugin": "^4.0.0-beta.0", - "file-loader": "^3.0.1", - "html-webpack-plugin": "^3.2.0", "nodaemon": "0.0.5", - "postcss-discard-comments": "^4.0.1", "snazzy": "^8.0.0", - "standard": "^12.0.1", - "style-loader": "^0.23.1", - "uglifyjs-webpack-plugin": "^2.1.1", - "url-loader": "^1.1.2", - "webpack": "^4.28.4", - "webpack-cli": "^3.2.1", - "webpack-merge": "^4.2.1", - "webpack-stream": "^5.2.1", - "xterm": "^3.10.1", - "zip-webpack-plugin": "^4.0.1" + "standard": "^12.0.1" } } diff --git a/screenshots/bigip/existing-plugin.png b/screenshots/bigip/existing-plugin.png deleted file mode 100644 index a4d1197..0000000 Binary files a/screenshots/bigip/existing-plugin.png and /dev/null differ diff --git a/screenshots/bigip/import-new-workspace.png b/screenshots/bigip/import-new-workspace.png deleted file mode 100644 index ba0b7de..0000000 Binary files a/screenshots/bigip/import-new-workspace.png and /dev/null differ diff --git a/screenshots/bigip/import-workspace-from-uri.png b/screenshots/bigip/import-workspace-from-uri.png deleted file mode 100644 index 4df0200..0000000 Binary files a/screenshots/bigip/import-workspace-from-uri.png and /dev/null differ diff --git a/screenshots/bigip/plugin-update-complete.png b/screenshots/bigip/plugin-update-complete.png deleted file mode 100644 index a000d67..0000000 Binary files a/screenshots/bigip/plugin-update-complete.png and /dev/null differ diff --git a/screenshots/bigip/workspace-new-import-complete.png b/screenshots/bigip/workspace-new-import-complete.png deleted file mode 100644 index e5790b1..0000000 Binary files a/screenshots/bigip/workspace-new-import-complete.png and /dev/null differ diff --git a/screenshots/demo-800.gif b/screenshots/demo-800.gif deleted file mode 100644 index f02bedc..0000000 Binary files a/screenshots/demo-800.gif and /dev/null differ diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 6728a8c..0000000 --- a/scripts/build.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -## Syncs from BIG-IP and builds a release based on version in extensions/ephemeral_auth/package.json -# -source ./scripts/env.sh -source ./scripts/util.sh - -./scripts/pull.sh -if [ $? -ne 0 ]; then - # failure - tput bel;tput bel;tput bel;tput bel - echo -e "\n${fgLtRed}Pull command failed. Giving up.${fgLtWhi}\n" - echo ${output} - exit 255 -fi - -# get version of package from package.json -package_version=$(jq -r ".version" workspace/extensions/webssh2/package.json) -# creates new workspace name with version -webssh_workspace_name=$webssh_workspace_name-$package_version - -echoNotice "Creating workspace package" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost /bin/tar --exclude='./extensions/webssh2/config.json' -czf - -C /var/ilx/workspaces/Common/$webssh_workspace_name . > Build/Release/$webssh_package_name-$package_version.tgz" - -echoNotice "Creating SHA256 hash" -runCommand "shasum -a 256 Build/Release/$webssh_package_name-$package_version.tgz > Build/Release/$webssh_package_name-$package_version.tgz.sha256" - -echoNotice "Copying to current" -runCommand "cp Build/Release/$webssh_package_name-$package_version.tgz $webssh_pua_location/$webssh_package_name-current.tgz && \ - cp Build/Release/$webssh_package_name-$package_version.tgz.sha256 $webssh_pua_location/$webssh_package_name-current.tgz.sha256" - -echoNotice "Deleting any '.DS_Store' files" -runCommand "find . -name '.DS_Store' -type f -delete" - -echo -e "\nWorkspace packages located at:\n" -echo " Build/Release/$webssh_package_name-$package_version.tgz" -echo " Build/Release/$webssh_package_name-$package_version.tgz.sha256" -echo " $webssh_pua_location/$webssh_package_name-current.tgz" -echo " $webssh_pua_location/$webssh_package_name-current.tgz.sha256" - -echo -e "\nšŸ‘ Build Complete šŸ‘\n" - -exit 0 diff --git a/scripts/env.sh b/scripts/env.sh deleted file mode 100755 index 1955d68..0000000 --- a/scripts/env.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -#webssh_ilxhost=root@192.168.30.209 -webssh_ilxhost=root@192.168.30.203 -webssh_workspace_name=webssh2 -webssh_package_name=BIG-IP-ILX-WebSSH2 -webssh_pua_location=./bin \ No newline at end of file diff --git a/scripts/pull.sh b/scripts/pull.sh deleted file mode 100755 index 9826955..0000000 --- a/scripts/pull.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# ./scripts/pull.sh -# -# bill@f5.com -# -# Pulls an ILX workspace from a BIG-IP and syncs to ./workspace, excludes -# ./workspace/extensions/ephemeral_auth/node_modules. -# -source ./scripts/env.sh -source ./scripts/util.sh - -# get version of package from package.json -PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1) -# creates new workspace name with version -webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION - -echo "Pull ${fgLtCya}$webssh_workspace_name${fgLtWhi} from ${fgLtCya}$webssh_ilxhost${fgLtWhi}" - -# check to see if the workspace actually exists before attempting to copy over - -echoNotice "Checking for existing workspace ${fgLtCya}$webssh_workspace_name${fgLtWhi}" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1" - -echoNotice "Pulling ${fgLtCya}$webssh_workspace_name${fgLtWhi} from ${fgLtCya}$webssh_ilxhost${fgLtWhi}" -runCommand "rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --include=\"extensions/ephemeral_auth/node_modules/f5-*\" --exclude=\".DS_Store\" --exclude=\"extensions/ephemeral_auth/node_modules/*\" $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/. workspace/. 2>&1" - -echo -e "\nšŸ‘ Pull complete šŸ‘\n" - -exit 0 diff --git a/scripts/push.sh b/scripts/push.sh deleted file mode 100755 index 02a641a..0000000 --- a/scripts/push.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# ./scripts/push.sh -# -# bill@f5.com -# -# Pushes ./workspace to a BIG-IP ILX workspace -# -source ./scripts/env.sh -source ./scripts/util.sh - -# get version of package from package.json -PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1) -# creates new workspace name with version -webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION - -echo "Push ${fgLtCya}$webssh_workspace_name${fgLtWhi} to ${fgLtCya}$webssh_ilxhost${fgLtWhi}" - -echoNotice "Checking $webssh_ilxhost for workspace $webssh_workspace_name" -output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1) -result="$?" 2>&1 -if [ $result -ne 0 ]; then - echo "āŒ" - echoNotice "Attempting to create workspace" - runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"tmsh create ilx workspace $webssh_workspace_name node-version 6.9.1\" 2>&1" -else - echo "āœ…" -fi - -echoNotice "Pushing ./workspace to $webssh_ilxhost at $webssh_workspace_name" -runCommand "rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --delete --exclude='.DS_Store' --exclude extensions/webssh2/node_modules workspace/. $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/." - -echoNotice "Installing node modules at $webssh_workspace_name on $webssh_ilxhost" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"cd /var/ilx/workspaces/Common/$webssh_workspace_name/extensions/webssh2; npm i --production\" 2>&1" - -echoNotice "Setting permissions at $webssh_workspace_name on $webssh_ilxhost" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"chown -R root.sdm /var/ilx/workspaces/Common/$webssh_workspace_name/; \ - chmod -R ug+rwX,o-w /var/ilx/workspaces/Common/$webssh_workspace_name/; \ - chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/version; \ - chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/node_version\" 2>&1" - -echoNotice "Deleting $webssh_workspace_name/node_modules/.bin on $webssh_ilxhost" -runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"cd /var/ilx/workspaces/Common/$webssh_workspace_name/extensions/webssh2; rm -rf node_modules/.bin\" 2>&1" - -# switch plugin to new workspace -echoNotice "Checking to see if plugin exists" -output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx plugin WebSSH_plugin one-line 2>&1) -result="$?" 2>&1 -if [ $result -ne 0 ]; then - echo "āŒ" - echoNotice "Attempting to create plugin" - runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh create ilx plugin WebSSH_plugin from-workspace $webssh_workspace_name extensions { webssh2 { concurrency-mode single ilx-logging enabled } } 2>&1" -else - echo "āœ…" - echoNotice "Switching plugin to $webssh_workspace_name" - runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh modify ilx plugin WebSSH_plugin from-workspace $webssh_workspace_name extensions { webssh2 { concurrency-mode single ilx-logging enabled } } 2>&1" -fi - -echo -e "\nšŸ‘ Push complete šŸ‘\n" - -exit 0 diff --git a/scripts/util.sh b/scripts/util.sh deleted file mode 100755 index 3029a27..0000000 --- a/scripts/util.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# Utility functions / scripts - -echoNotice () { echo -e -n "\n$@... "; } - -fgLtRed=$(tput bold;tput setaf 1) -fgLtGrn=$(tput bold;tput setaf 2) -fgLtYel=$(tput bold;tput setaf 3) -fgLtBlu=$(tput bold;tput setaf 4) -fgLtMag=$(tput bold;tput setaf 5) -fgLtCya=$(tput bold;tput setaf 6) -fgLtWhi=$(tput bold;tput setaf 7) -fgLtGry=$(tput bold;tput setaf 8) - -echo ${fgLtWhi} - -# check for jq and try to install... -output=$(which jq 2>&1) -if [[ $? -ne 0 ]]; then - echo -e "You need to install jq: https://stedolan.github.io/jq\n" - echo -e "If you have *brew* you can install with:\n" - echo -e " brew install jq\n" - echo -n "Do you want me to try and install that for you (Y/n)? " - read -n1 yesno - echo - if [[ ("$yesno" != "y") ]]; then - echo -e "\nUnable to continue, install jq first.\n\n" - exit 255 - else - which brew - if [[ $? -ne 0 ]]; then - echo -e "\nYou're a mess... You don't even have brew installed...\nMaybe you should check it out\n" - echo -e " https://brew.sh/\n\n" - exit 255 - fi - echo - brew install jq - if [[ $? -ne 0 ]]; then - echo -e "\nLooks like that failed, I can't do everything... Quitting, install jq...\n" - exit 255 - fi - fi -fi - -# checks the output of a command to get the status and report/handle failure -checkOutput() { - if [ $result -eq 0 ]; then - # success - #echo "${fgLtGrn}[OK]${fgLtWhi}" - echo "āœ…" - return - else - # failure - tput bel;tput bel;tput bel;tput bel - #echo "${fgLtRed}[FAILED]${fgLtWhi}" - echo "āŒ" - echo -e "\nPrevious command failed in ${script_path}/${scriptname} with error level: ${result}" - echo -e "\nCommand:\n" - echo " ${command}" - echo -e "\nSTDOUT/STDERR:\n" - echo ${output} - exit 255 - fi -} - -# run a comand and check call checkOutput -runCommand() { - # $1 command - command=$@ - output=$((eval $command) 2>&1) - result="$?" 2>&1 - prevline=$(($LINENO-2)) - checkOutput -} \ No newline at end of file diff --git a/scripts/ver.sh b/scripts/ver.sh deleted file mode 100755 index 72101c3..0000000 --- a/scripts/ver.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -## displays and optionally changes version of product - -source ./scripts/env.sh - -source ./scripts/util.sh - -echo -# get current version of workspace, ask to change or rebuild -webssh_ilx_ver=$(jq -r ".version" ./workspace/extensions/webssh2/package.json 2>&1) -if [[ $? -ne 0 ]]; then exit; echo "error reading ILX irule version";fi - -echo "Current version of $webssh_workspace_name is: $webssh_ilx_ver" - -echo -n "If you want to change this version, enter it now otherwise press enter to retain: " - -read newver - -echo - -if [[ ("$newver" != "") ]]; then - echo "Updating version of ILX to: $newver" - export newver - jq --arg newver "$newver" '.version = $newver' < ./workspace/extensions/webssh2/package.json > ./workspace/extensions/webssh2/package.json.new - if [[ $? -ne 0 ]]; then exit; echo "error changing version - ilx";fi - mv ./workspace/extensions/webssh2/package.json.new ./workspace/extensions/webssh2/package.json -else - echo "No changes made" -fi