/*! WebSSH2 2017-08-21 */
function replayCredentials(){return socket.emit("control","replayCredentials"),console.log("replaying credentials"),!1}function toggleLog(){return!0===sessionLogEnable?(sessionLogEnable=!1,document.getElementById("toggleLog").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,!1):(sessionLogEnable=!0,document.getElementById("toggleLog").innerHTML='Logging - STOP LOG',document.getElementById("downloadLog").style.display="inline",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,!1)}function downloadLog(){myFile="WebSSH2-"+logDate.getFullYear()+(logDate.getMonth()+1)+logDate.getDate()+"_"+logDate.getHours()+logDate.getMinutes()+logDate.getSeconds()+".log";var t=new Blob([sessionLog.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"")],{type:"text/plain"});if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveBlob(t,myFile);else{var e=window.document.createElement("a");e.href=window.URL.createObjectURL(t),e.download=myFile,document.body.appendChild(e),e.click(),document.body.removeChild(e)}}!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Terminal=t()}}(function(){return function t(e,r,i){function n(o,a){if(!r[o]){if(!e[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var h=r[o]={exports:{}};e[o][0].call(h.exports,function(t){var r=e[o][1][t];return n(r||t)},h,h.exports,t,e,r,i)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o0&&this._lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this._lines.push(this._terminal.blankLine(void 0,void 0,t)));else for(var s=this._terminal.rows;s>e;s--)this._lines.length>e+this.ybase&&(this._lines.length>this.ybase+this.y+1?this._lines.pop():(this.ybase++,this.ydisp++));this.y>=e&&(this.y=e-1),n&&(this.y+=n),this.x>=t&&(this.x=t-1),this.scrollTop=0,this.scrollBottom=e-1}},t}();r.Buffer=n},{"./utils/CircularList":18}],2:[function(t,e,r){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(r,"__esModule",{value:!0});var n=t("./Buffer"),s=function(t){function e(e){var r=t.call(this)||this;return r._terminal=e,r._normal=new n.Buffer(r._terminal),r._normal.fillViewportRows(),r._alt=new n.Buffer(r._terminal),r._activeBuffer=r._normal,r}return i(e,t),Object.defineProperty(e.prototype,"alt",{get:function(){return this._alt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"normal",{get:function(){return this._normal},enumerable:!0,configurable:!0}),e.prototype.activateNormalBuffer=function(){this._alt.clear(),this._activeBuffer=this._normal,this.emit("activate",this._normal)},e.prototype.activateAltBuffer=function(){this._alt.fillViewportRows(),this._activeBuffer=this._alt,this.emit("activate",this._alt)},e.prototype.resize=function(t,e){this._normal.resize(t,e),this._alt.resize(t,e)},e}(t("./EventEmitter").EventEmitter);r.BufferSet=s},{"./Buffer":1,"./EventEmitter":6}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"◆",a:"▒",b:"\t",c:"\f",d:"\r",e:"\n",f:"°",g:"±",h:"",i:"\v",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=null,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},{}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t,e,r){this.textarea=t,this.compositionView=e,this.terminal=r,this.isComposing=!1,this.isSendingComposition=!1,this.compositionPosition={start:null,end:null}}return t.prototype.compositionstart=function(){this.isComposing=!0,this.compositionPosition.start=this.textarea.value.length,this.compositionView.textContent="",this.compositionView.classList.add("active")},t.prototype.compositionupdate=function(t){var e=this;this.compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(function(){e.compositionPosition.end=e.textarea.value.length},0)},t.prototype.compositionend=function(){this.finalizeComposition(!0)},t.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)},t.prototype.finalizeComposition=function(t){var e=this;if(this.compositionView.classList.remove("active"),this.isComposing=!1,this.clearTextareaPosition(),t){var r={start:this.compositionPosition.start,end:this.compositionPosition.end};this.isSendingComposition=!0,setTimeout(function(){if(e.isSendingComposition){e.isSendingComposition=!1;var t=void 0;t=e.isComposing?e.textarea.value.substring(r.start,r.end):e.textarea.value.substring(r.start),e.terminal.handler(t)}},0)}else{this.isSendingComposition=!1;var i=this.textarea.value.substring(this.compositionPosition.start,this.compositionPosition.end);this.terminal.handler(i)}},t.prototype.handleAnyTextareaChanges=function(){var t=this,e=this.textarea.value;setTimeout(function(){if(!t.isComposing){var r=t.textarea.value.replace(e,"");r.length>0&&t.terminal.handler(r)}},0)},t.prototype.updateCompositionElements=function(t){var e=this;if(this.isComposing){var r=this.terminal.element.querySelector(".terminal-cursor");if(r){var i=this.terminal.element.querySelector(".xterm-rows").offsetTop+r.offsetTop;this.compositionView.style.left=r.offsetLeft+"px",this.compositionView.style.top=i+"px",this.compositionView.style.height=r.offsetHeight+"px",this.compositionView.style.lineHeight=r.offsetHeight+"px";var n=this.compositionView.getBoundingClientRect();this.textarea.style.left=r.offsetLeft+"px",this.textarea.style.top=i+"px",this.textarea.style.width=n.width+"px",this.textarea.style.height=n.height+"px",this.textarea.style.lineHeight=n.height+"px"}t||setTimeout(function(){return e.updateCompositionElements(!0)},0)}},t.prototype.clearTextareaPosition=function(){this.textarea.style.left="",this.textarea.style.top=""},t}();r.CompositionHelper=i},{}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!function(t){t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="",t.BS="\b",t.HT="\t",t.LF="\n",t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""}(r.C0||(r.C0={}))},{}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(){this._events=this._events||{}}return t.prototype.on=function(t,e){this._events[t]=this._events[t]||[],this._events[t].push(e)},t.prototype.off=function(t,e){if(this._events[t])for(var r=this._events[t],i=r.length;i--;)if(r[i]===e||r[i].listener===e)return void r.splice(i,1)},t.prototype.removeAllListeners=function(t){this._events[t]&&delete this._events[t]},t.prototype.once=function(t,e){function r(){var i=Array.prototype.slice.call(arguments);return this.off(t,r),e.apply(this,i)}return r.listener=e,this.on(t,r)},t.prototype.emit=function(t){for(var e=[],r=1;r=" "){var i=r.wcwidth(e);this._terminal.charset&&this._terminal.charset[t]&&(t=this._terminal.charset[t]);var n=this._terminal.buffer.y+this._terminal.buffer.ybase;if(!i&&this._terminal.buffer.x)return void(this._terminal.buffer.lines.get(n)[this._terminal.buffer.x-1]&&(this._terminal.buffer.lines.get(n)[this._terminal.buffer.x-1][2]?this._terminal.buffer.lines.get(n)[this._terminal.buffer.x-1][1]+=t:this._terminal.buffer.lines.get(n)[this._terminal.buffer.x-2]&&(this._terminal.buffer.lines.get(n)[this._terminal.buffer.x-2][1]+=t),this._terminal.updateRange(this._terminal.buffer.y)));if(this._terminal.buffer.x+i-1>=this._terminal.cols)if(this._terminal.wraparoundMode)this._terminal.buffer.x=0,++this._terminal.buffer.y>this._terminal.buffer.scrollBottom?(this._terminal.buffer.y--,this._terminal.scroll(!0)):this._terminal.buffer.lines.get(this._terminal.buffer.y).isWrapped=!0;else if(2===i)return;if(n=this._terminal.buffer.y+this._terminal.buffer.ybase,this._terminal.insertMode)for(var s=0;sthis._terminal.buffer.scrollBottom&&(this._terminal.buffer.y--,this._terminal.scroll()),this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--,this._terminal.emit("lineFeed")},t.prototype.carriageReturn=function(){this._terminal.buffer.x=0},t.prototype.backspace=function(){this._terminal.buffer.x>0&&this._terminal.buffer.x--},t.prototype.tab=function(){this._terminal.buffer.x=this._terminal.nextStop()},t.prototype.shiftOut=function(){this._terminal.setgLevel(1)},t.prototype.shiftIn=function(){this._terminal.setgLevel(0)},t.prototype.insertChars=function(t){var e,r,i,n;for((e=t[0])<1&&(e=1),r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=this._terminal.buffer.x,n=[this._terminal.eraseAttr()," ",1];e--&&i=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1),this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--},t.prototype.cursorForward=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.x+=e,this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)},t.prototype.cursorBackward=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.x>=this._terminal.cols&&this._terminal.buffer.x--,this._terminal.buffer.x-=e,this._terminal.buffer.x<0&&(this._terminal.buffer.x=0)},t.prototype.cursorNextLine=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.y+=e,this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1),this._terminal.buffer.x=0},t.prototype.cursorPrecedingLine=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.y-=e,this._terminal.buffer.y<0&&(this._terminal.buffer.y=0),this._terminal.buffer.x=0},t.prototype.cursorCharAbsolute=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.x=e-1},t.prototype.cursorPosition=function(t){var e,r;e=t[0]-1,r=t.length>=2?t[1]-1:0,e<0?e=0:e>=this._terminal.rows&&(e=this._terminal.rows-1),r<0?r=0:r>=this._terminal.cols&&(r=this._terminal.cols-1),this._terminal.buffer.x=r,this._terminal.buffer.y=e},t.prototype.cursorForwardTab=function(t){for(var e=t[0]||1;e--;)this._terminal.buffer.x=this._terminal.nextStop()},t.prototype.eraseInDisplay=function(t){var e;switch(t[0]){case 0:for(this._terminal.eraseRight(this._terminal.buffer.x,this._terminal.buffer.y),e=this._terminal.buffer.y+1;e0&&(this._terminal.buffer.lines.trimStart(r),this._terminal.buffer.ybase=Math.max(this._terminal.buffer.ybase-r,0),this._terminal.buffer.ydisp=Math.max(this._terminal.buffer.ydisp-r,0),this._terminal.emit("scroll",0))}},t.prototype.eraseInLine=function(t){switch(t[0]){case 0:this._terminal.eraseRight(this._terminal.buffer.x,this._terminal.buffer.y);break;case 1:this._terminal.eraseLeft(this._terminal.buffer.x,this._terminal.buffer.y);break;case 2:this._terminal.eraseLine(this._terminal.buffer.y)}},t.prototype.insertLines=function(t){var e,r,i;for((e=t[0])<1&&(e=1),r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=this._terminal.rows-1-this._terminal.buffer.scrollBottom,i=this._terminal.rows-1+this._terminal.buffer.ybase-i+1;e--;)this._terminal.buffer.lines.length===this._terminal.buffer.lines.maxLength&&(this._terminal.buffer.lines.trimStart(1),this._terminal.buffer.ybase--,this._terminal.buffer.ydisp--,r--,i--),this._terminal.buffer.lines.splice(r,0,this._terminal.blankLine(!0)),this._terminal.buffer.lines.splice(i,1);this._terminal.updateRange(this._terminal.buffer.y),this._terminal.updateRange(this._terminal.buffer.scrollBottom)},t.prototype.deleteLines=function(t){var e,r,i;for((e=t[0])<1&&(e=1),r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=this._terminal.rows-1-this._terminal.buffer.scrollBottom,i=this._terminal.rows-1+this._terminal.buffer.ybase-i;e--;)this._terminal.buffer.lines.length===this._terminal.buffer.lines.maxLength&&(this._terminal.buffer.lines.trimStart(1),this._terminal.buffer.ybase-=1,this._terminal.buffer.ydisp-=1),this._terminal.buffer.lines.splice(i+1,0,this._terminal.blankLine(!0)),this._terminal.buffer.lines.splice(r,1);this._terminal.updateRange(this._terminal.buffer.y),this._terminal.updateRange(this._terminal.buffer.scrollBottom)},t.prototype.deleteChars=function(t){var e,r,i;for((e=t[0])<1&&(e=1),r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=[this._terminal.eraseAttr()," ",1];e--;)this._terminal.buffer.lines.get(r).splice(this._terminal.buffer.x,1),this._terminal.buffer.lines.get(r).push(i)},t.prototype.scrollUp=function(t){for(var e=t[0]||1;e--;)this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollTop,1),this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollBottom,0,this._terminal.blankLine());this._terminal.updateRange(this._terminal.buffer.scrollTop),this._terminal.updateRange(this._terminal.buffer.scrollBottom)},t.prototype.scrollDown=function(t){for(var e=t[0]||1;e--;)this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollBottom,1),this._terminal.buffer.lines.splice(this._terminal.buffer.ybase+this._terminal.buffer.scrollTop,0,this._terminal.blankLine());this._terminal.updateRange(this._terminal.buffer.scrollTop),this._terminal.updateRange(this._terminal.buffer.scrollBottom)},t.prototype.eraseChars=function(t){var e,r,i,n;for((e=t[0])<1&&(e=1),r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=this._terminal.buffer.x,n=[this._terminal.eraseAttr()," ",1];e--&&i=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)},t.prototype.HPositionRelative=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.x+=e,this._terminal.buffer.x>=this._terminal.cols&&(this._terminal.buffer.x=this._terminal.cols-1)},t.prototype.repeatPrecedingCharacter=function(t){for(var e=t[0]||1,r=this._terminal.buffer.lines.get(this._terminal.buffer.ybase+this._terminal.buffer.y),i=r[this._terminal.buffer.x-1]||[this._terminal.defAttr," ",1];e--;)r[this._terminal.buffer.x++]=i},t.prototype.sendDeviceAttributes=function(t){t[0]>0||(this._terminal.prefix?">"===this._terminal.prefix&&(this._terminal.is("xterm")?this._terminal.send(i.C0.ESC+"[>0;276;0c"):this._terminal.is("rxvt-unicode")?this._terminal.send(i.C0.ESC+"[>85;95;0c"):this._terminal.is("linux")?this._terminal.send(t[0]+"c"):this._terminal.is("screen")&&this._terminal.send(i.C0.ESC+"[>83;40003;0c")):this._terminal.is("xterm")||this._terminal.is("rxvt-unicode")||this._terminal.is("screen")?this._terminal.send(i.C0.ESC+"[?1;2c"):this._terminal.is("linux")&&this._terminal.send(i.C0.ESC+"[?6c"))},t.prototype.linePosAbsolute=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.y=e-1,this._terminal.buffer.y>=this._terminal.rows&&(this._terminal.buffer.y=this._terminal.rows-1)},t.prototype.VPositionRelative=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.y+=e,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--},t.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)},t.prototype.tabClear=function(t){var e=t[0];e<=0?delete this._terminal.buffer.tabs[this._terminal.buffer.x]:3===e&&(this._terminal.buffer.tabs={})},t.prototype.setMode=function(t){if(t.length>1)for(var e=0;e1e3,this._terminal.mouseEvents=!0,this._terminal.element.classList.add("enable-mouse-events"),this._terminal.selectionManager.disable(),this._terminal.log("Binding to mouse events.");break;case 1004:this._terminal.sendFocus=!0;break;case 1005:this._terminal.utfMouse=!0;break;case 1006:this._terminal.sgrMouse=!0;break;case 1015:this._terminal.urxvtMouse=!0;break;case 25:this._terminal.cursorHidden=!1;break;case 1049:case 47:case 1047:this._terminal.buffers.activateAltBuffer(),this._terminal.viewport.syncScrollArea(),this._terminal.showCursor()}}else switch(t[0]){case 4:this._terminal.insertMode=!0}},t.prototype.resetMode=function(t){if(t.length>1)for(var e=0;e>18,s=this._terminal.curAttr>>9&511,o=511&this._terminal.curAttr;i=30&&e<=37?s=e-30:e>=40&&e<=47?o=e-40:e>=90&&e<=97?s=(e+=8)-90:e>=100&&e<=107?o=(e+=8)-100:0===e?(n=this._terminal.defAttr>>18,s=this._terminal.defAttr>>9&511,o=511&this._terminal.defAttr):1===e?n|=1:4===e?n|=2:5===e?n|=4:7===e?n|=8:8===e?n|=16:22===e?n&=-2:24===e?n&=-3:25===e?n&=-5:27===e?n&=-9:28===e?n&=-17:39===e?s=this._terminal.defAttr>>9&511:49===e?o=511&this._terminal.defAttr:38===e?2===t[i+1]?(i+=2,-1===(s=this._terminal.matchColor(255&t[i],255&t[i+1],255&t[i+2]))&&(s=511),i+=2):5===t[i+1]&&(s=e=255&t[i+=2]):48===e?2===t[i+1]?(i+=2,-1===(o=this._terminal.matchColor(255&t[i],255&t[i+1],255&t[i+2]))&&(o=511),i+=2):5===t[i+1]&&(o=e=255&t[i+=2]):100===e?(s=this._terminal.defAttr>>9&511,o=511&this._terminal.defAttr):this._terminal.error("Unknown SGR attribute: %d.",e);this._terminal.curAttr=n<<18|s<<9|o}else this._terminal.curAttr=this._terminal.defAttr},t.prototype.deviceStatus=function(t){if(this._terminal.prefix){if("?"===this._terminal.prefix)switch(t[0]){case 6:this._terminal.send(i.C0.ESC+"[?"+(this._terminal.buffer.y+1)+";"+(this._terminal.buffer.x+1)+"R")}}else switch(t[0]){case 5:this._terminal.send(i.C0.ESC+"[0n");break;case 6:this._terminal.send(i.C0.ESC+"["+(this._terminal.buffer.y+1)+";"+(this._terminal.buffer.x+1)+"R")}},t.prototype.softReset=function(t){this._terminal.cursorHidden=!1,this._terminal.insertMode=!1,this._terminal.originMode=!1,this._terminal.wraparoundMode=!0,this._terminal.applicationKeypad=!1,this._terminal.viewport.syncScrollArea(),this._terminal.applicationCursor=!1,this._terminal.buffer.scrollTop=0,this._terminal.buffer.scrollBottom=this._terminal.rows-1,this._terminal.curAttr=this._terminal.defAttr,this._terminal.buffer.x=this._terminal.buffer.y=0,this._terminal.charset=null,this._terminal.glevel=0,this._terminal.charsets=[null]},t.prototype.setCursorStyle=function(t){var e=t[0]<1?1:t[0];switch(e){case 1:case 2:this._terminal.setOption("cursorStyle","block");break;case 3:case 4:this._terminal.setOption("cursorStyle","underline");break;case 5:case 6:this._terminal.setOption("cursorStyle","bar")}var r=e%2==1;this._terminal.setOption("cursorBlink",r)},t.prototype.setScrollRegion=function(t){this._terminal.prefix||(this._terminal.buffer.scrollTop=(t[0]||1)-1,this._terminal.buffer.scrollBottom=(t[1]&&t[1]<=this._terminal.rows?t[1]:this._terminal.rows)-1,this._terminal.buffer.x=0,this._terminal.buffer.y=0)},t.prototype.saveCursor=function(t){this._terminal.buffer.savedX=this._terminal.buffer.x,this._terminal.buffer.savedY=this._terminal.buffer.y},t.prototype.restoreCursor=function(t){this._terminal.buffer.x=this._terminal.buffer.savedX||0,this._terminal.buffer.y=this._terminal.buffer.savedY||0},t}();r.InputHandler=s,r.wcwidth=function(t){function e(t,e){var r,i=0,n=e.length-1;if(te[n][1])return!1;for(;n>=i;)if(r=i+n>>1,t>e[r][1])i=r+1;else{if(!(t=127&&r<160?t.control:e(r,o)?0:i(r)?2:1}function i(t){return t>=4352&&(t<=4447||9001===t||9002===t||t>=11904&&t<=42191&&12351!==t||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510)}function n(t){return e(t,a)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}function s(){l="undefined"==typeof Uint32Array?new Array(4096):new Uint32Array(4096);for(var t=0;t<4096;++t){for(var e=0,i=16;i--;)e=e<<2|r(16*t+i);l[t]=e}return l}var o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[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]],c=0|t.control,l=null;return function(t){if((t|=0)<32)return 0|c;if(t<127)return 1;var e=l||s();return t<65536?e[t>>4]>>((15&t)<<1)&3:n(t)}}({nul:0,control:0})},{"./Charsets":3,"./EscapeSequences":5}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=new RegExp("(?:^|[^\\da-z\\.-]+)((https?:\\/\\/)((([\\da-z\\.-]+)\\.([a-z\\.]{2,6}))|((\\d{1,3}\\.){3}\\d{1,3})|(localhost))(:\\d{1,5})?(\\/[\\/\\w\\.\\-%~]*)*(\\?[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&'*+,:;~\\=\\.\\-]*)?(#[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&'*+,:;~\\=\\.\\-]*)?)($|[^\\/\\w\\.\\-%]+)"),n=0,s=function(){function t(){this._nextLinkMatcherId=n,this._rowTimeoutIds=[],this._linkMatchers=[],this.registerLinkMatcher(i,null,{matchIndex:1})}return t.prototype.attachToDom=function(t,e){this._document=t,this._rows=e},t.prototype.linkifyRow=function(e){if(this._document){var r=this._rowTimeoutIds[e];r&&clearTimeout(r),this._rowTimeoutIds[e]=setTimeout(this._linkifyRow.bind(this,e),t.TIME_BEFORE_LINKIFY)}},t.prototype.setHypertextLinkHandler=function(t){this._linkMatchers[n].handler=t},t.prototype.setHypertextValidationCallback=function(t){this._linkMatchers[n].validationCallback=t},t.prototype.registerLinkMatcher=function(t,e,r){if(void 0===r&&(r={}),this._nextLinkMatcherId!==n&&!e)throw new Error("handler must be defined");var i={id:this._nextLinkMatcherId++,regex:t,handler:e,matchIndex:r.matchIndex,validationCallback:r.validationCallback,priority:r.priority||0};return this._addLinkMatcherToList(i),i.id},t.prototype._addLinkMatcherToList=function(t){if(0!==this._linkMatchers.length){for(var e=this._linkMatchers.length-1;e>=0;e--)if(t.priority<=this._linkMatchers[e].priority)return void this._linkMatchers.splice(e+1,0,t);this._linkMatchers.splice(0,0,t)}else this._linkMatchers.push(t)},t.prototype.deregisterLinkMatcher=function(t){for(var e=1;e0){if(i.validationCallback)for(var s=0;s=0){var f=this._createAnchorElement(a,e.handler,i);if(h.textContent.length===a.length)if(3===h.nodeType)this._replaceNode(h,f);else{var p=h;if("A"===p.nodeName)return r;p.innerHTML="",p.appendChild(f)}else if(h.childNodes.length>1)for(var d=0;d"]=function(t){return t.setPrefix(">")},a["!"]=function(t){return t.setPrefix("!")},a[0]=function(t){return t.setParam(10*t.getParam())},a[1]=function(t){return t.setParam(10*t.getParam()+1)},a[2]=function(t){return t.setParam(10*t.getParam()+2)},a[3]=function(t){return t.setParam(10*t.getParam()+3)},a[4]=function(t){return t.setParam(10*t.getParam()+4)},a[5]=function(t){return t.setParam(10*t.getParam()+5)},a[6]=function(t){return t.setParam(10*t.getParam()+6)},a[7]=function(t){return t.setParam(10*t.getParam()+7)},a[8]=function(t){return t.setParam(10*t.getParam()+8)},a[9]=function(t){return t.setParam(10*t.getParam()+9)},a.$=function(t){return t.setPostfix("$")},a['"']=function(t){return t.setPostfix('"')},a[" "]=function(t){return t.setPostfix(" ")},a["'"]=function(t){return t.setPostfix("'")},a[";"]=function(t){return t.finalizeParam()},a[i.C0.CAN]=function(t){return t.setState(l.NORMAL)};var c={};c["@"]=function(t,e,r){return t.insertChars(e)},c.A=function(t,e,r){return t.cursorUp(e)},c.B=function(t,e,r){return t.cursorDown(e)},c.C=function(t,e,r){return t.cursorForward(e)},c.D=function(t,e,r){return t.cursorBackward(e)},c.E=function(t,e,r){return t.cursorNextLine(e)},c.F=function(t,e,r){return t.cursorPrecedingLine(e)},c.G=function(t,e,r){return t.cursorCharAbsolute(e)},c.H=function(t,e,r){return t.cursorPosition(e)},c.I=function(t,e,r){return t.cursorForwardTab(e)},c.J=function(t,e,r){return t.eraseInDisplay(e)},c.K=function(t,e,r){return t.eraseInLine(e)},c.L=function(t,e,r){return t.insertLines(e)},c.M=function(t,e,r){return t.deleteLines(e)},c.P=function(t,e,r){return t.deleteChars(e)},c.S=function(t,e,r){return t.scrollUp(e)},c.T=function(t,e,r){e.length<2&&!r&&t.scrollDown(e)},c.X=function(t,e,r){return t.eraseChars(e)},c.Z=function(t,e,r){return t.cursorBackwardTab(e)},c["`"]=function(t,e,r){return t.charPosAbsolute(e)},c.a=function(t,e,r){return t.HPositionRelative(e)},c.b=function(t,e,r){return t.repeatPrecedingCharacter(e)},c.c=function(t,e,r){return t.sendDeviceAttributes(e)},c.d=function(t,e,r){return t.linePosAbsolute(e)},c.e=function(t,e,r){return t.VPositionRelative(e)},c.f=function(t,e,r){return t.HVPosition(e)},c.g=function(t,e,r){return t.tabClear(e)},c.h=function(t,e,r){return t.setMode(e)},c.l=function(t,e,r){return t.resetMode(e)},c.m=function(t,e,r){return t.charAttributes(e)},c.n=function(t,e,r){return t.deviceStatus(e)},c.p=function(t,e,r){switch(r){case"!":t.softReset(e)}},c.q=function(t,e,r,i){" "===i&&t.setCursorStyle(e)},c.r=function(t,e){return t.setScrollRegion(e)},c.s=function(t,e){return t.saveCursor(e)},c.u=function(t,e){return t.restoreCursor(e)},c[i.C0.CAN]=function(t,e,r,i,n){return n.setState(l.NORMAL)};var l;!function(t){t[t.NORMAL=0]="NORMAL",t[t.ESCAPED=1]="ESCAPED",t[t.CSI_PARAM=2]="CSI_PARAM",t[t.CSI=3]="CSI",t[t.OSC=4]="OSC",t[t.CHARSET=5]="CHARSET",t[t.DCS=6]="DCS",t[t.IGNORE=7]="IGNORE"}(l||(l={}));var h=function(){function t(t,e){this._inputHandler=t,this._terminal=e,this._state=l.NORMAL}return t.prototype.parse=function(t){var e,r,h,u,f=t.length;for(this._terminal.debug&&this._terminal.log("data: "+t),this._position=0,this._terminal.surrogate_high&&(t=this._terminal.surrogate_high+t,this._terminal.surrogate_high="");this._position":this._terminal.log("Switching back to normal keypad."),this._terminal.applicationKeypad=!1,this._terminal.viewport.syncScrollArea(),this._state=l.NORMAL;break;default:this._state=l.NORMAL,this._terminal.error("Unknown ESC control: %s.",r)}break;case l.CHARSET:r in n.CHARSETS?(e=n.CHARSETS[r],"/"===r&&this.skipNextChar()):e=n.DEFAULT_CHARSET,this._terminal.setgCharset(this._terminal.gcharset,e),this._terminal.gcharset=null,this._state=l.NORMAL;break;case l.OSC:if(r===i.C0.ESC||r===i.C0.BEL){switch(r===i.C0.ESC&&this._position++,this._terminal.params.push(this._terminal.currentParam),this._terminal.params[0]){case 0:case 1:case 2:this._terminal.params[1]&&(this._terminal.title=this._terminal.params[1],this._terminal.handleTitle(this._terminal.title))}this._terminal.params=[],this._terminal.currentParam=0,this._state=l.NORMAL}else this._terminal.params.length?this._terminal.currentParam+=r:r>="0"&&r<="9"?this._terminal.currentParam=10*this._terminal.currentParam+r.charCodeAt(0)-48:";"===r&&(this._terminal.params.push(this._terminal.currentParam),this._terminal.currentParam="");break;case l.CSI_PARAM:if(r in a){a[r](this);break}this.finalizeParam(),this._state=l.CSI;case l.CSI:r in c?(this._terminal.debug&&this._terminal.log("CSI "+(this._terminal.prefix?this._terminal.prefix:"")+" "+(this._terminal.params?this._terminal.params.join(";"):"")+" "+(this._terminal.postfix?this._terminal.postfix:"")+" "+r),c[r](this._inputHandler,this._terminal.params,this._terminal.prefix,this._terminal.postfix,this)):this._terminal.error("Unknown CSI code: %s.",r),this._state=l.NORMAL,this._terminal.prefix="",this._terminal.postfix="";break;case l.DCS:if(r===i.C0.ESC||r===i.C0.BEL){r===i.C0.ESC&&this._position++;var p=void 0,d=void 0;switch(this._terminal.prefix){case"":break;case"$q":switch(p=this._terminal.currentParam,d=!1,p){case'"q':p='0"q';break;case'"p':p='61"p';break;case"r":p=this._terminal.buffer.scrollTop+1+";"+(this._terminal.buffer.scrollBottom+1)+"r";break;case"m":p="0m";break;default:this._terminal.error("Unknown DCS Pt: %s.",p),p=""}this._terminal.send(i.C0.ESC+"P"+ +d+"$r"+p+i.C0.ESC+"\\");break;case"+p":break;case"+q":p=this._terminal.currentParam,d=!1,this._terminal.send(i.C0.ESC+"P"+ +d+"+r"+p+i.C0.ESC+"\\");break;default:this._terminal.error("Unknown DCS prefix: %s.",this._terminal.prefix)}this._terminal.currentParam=0,this._terminal.prefix="",this._state=l.NORMAL}else this._terminal.currentParam?this._terminal.currentParam+=r:this._terminal.prefix||"$"===r||"+"===r?2===this._terminal.prefix.length?this._terminal.currentParam=r:this._terminal.prefix+=r:this._terminal.currentParam=r;break;case l.IGNORE:r!==i.C0.ESC&&r!==i.C0.BEL||(r===i.C0.ESC&&this._position++,this._state=l.NORMAL)}}return this._state},t.prototype.setState=function(t){this._state=t},t.prototype.setPrefix=function(t){this._terminal.prefix=t},t.prototype.setPostfix=function(t){this._terminal.postfix=t},t.prototype.setParam=function(t){this._terminal.currentParam=t},t.prototype.getParam=function(){return this._terminal.currentParam},t.prototype.finalizeParam=function(){this._terminal.params.push(this._terminal.currentParam),this._terminal.currentParam=0},t.prototype.skipNextChar=function(){this._position++},t}();r.Parser=h},{"./Charsets":3,"./EscapeSequences":5}],10:[function(t,e,r){"use strict";function i(t){var e=t.ownerDocument.createElement("span");e.innerHTML="hello world",t.appendChild(e);var r=e.offsetWidth,i=e.offsetHeight;e.style.fontWeight="bold";var n=e.offsetWidth,s=e.offsetHeight;return t.removeChild(e),r!==n||i!==s}Object.defineProperty(r,"__esModule",{value:!0});var n,s=t("./utils/DomElementObjectPool");!function(t){t[t.BOLD=1]="BOLD",t[t.UNDERLINE=2]="UNDERLINE",t[t.BLINK=4]="BLINK",t[t.INVERSE=8]="INVERSE",t[t.INVISIBLE=16]="INVISIBLE"}(n||(n={}));var o=null,a=function(){function t(t){this._terminal=t,this._refreshRowsQueue=[],this._refreshFramesSkipped=0,this._refreshAnimationFrame=null,this._spanElementObjectPool=new s.DomElementObjectPool("span"),null===o&&(o=i(this._terminal.element)),this._spanElementObjectPool=new s.DomElementObjectPool("span")}return t.prototype.queueRefresh=function(t,e){this._refreshRowsQueue.push({start:t,end:e}),this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(this._refreshLoop.bind(this)))},t.prototype._refreshLoop=function(){if(this._terminal.writeBuffer.length>0&&this._refreshFramesSkipped++<=5)this._refreshAnimationFrame=window.requestAnimationFrame(this._refreshLoop.bind(this));else{this._refreshFramesSkipped=0;var t,e;if(this._refreshRowsQueue.length>4)t=0,e=this._terminal.rows-1;else{t=this._refreshRowsQueue[0].start,e=this._refreshRowsQueue[0].end;for(var r=1;re&&(e=this._refreshRowsQueue[r].end)}this._refreshRowsQueue=[],this._refreshAnimationFrame=null,this._refresh(t,e)}},t.prototype._refresh=function(t,e){var r;e-t>=this._terminal.rows/2&&(r=this._terminal.element.parentNode)&&this._terminal.element.removeChild(this._terminal.rowContainer);var i=this._terminal.cols,s=t;for(e>=this._terminal.rows&&(this._terminal.log("`end` is too large. Most likely a bad CSR."),e=this._terminal.rows-1);s<=e;s++){var a=s+this._terminal.buffer.ydisp,c=this._terminal.buffer.lines.get(a),l=void 0;l=this._terminal.buffer.y===s-(this._terminal.buffer.ybase-this._terminal.buffer.ydisp)&&this._terminal.cursorState&&!this._terminal.cursorHidden?this._terminal.buffer.x:-1;for(var h=this._terminal.defAttr,u=document.createDocumentFragment(),f="",p=void 0;this._terminal.children[s].children.length;){var d=this._terminal.children[s].children[0];this._terminal.children[s].removeChild(d),this._spanElementObjectPool.release(d)}for(var m=0;m>9&511,w=y>>18;if(_&&(p.classList.add("reverse-video"),p.classList.add("terminal-cursor")),w&n.BOLD&&(o||p.classList.add("xterm-bold"),C<8&&(C+=8)),w&n.UNDERLINE&&p.classList.add("xterm-underline"),w&n.BLINK&&p.classList.add("xterm-blink"),w&n.INVERSE){var k=v;v=C,C=k,1&w&&C<8&&(C+=8)}w&n.INVISIBLE&&!_&&p.classList.add("xterm-hidden"),w&n.INVERSE&&(257===v&&(v=15),256===C&&(C=0)),v<256&&p.classList.add("xterm-bg-color-"+v),C<256&&p.classList.add("xterm-color-"+C)}if(2===b)f+=''+g+"";else if(g.charCodeAt(0)>255)f+=''+g+"";else switch(g){case"&":f+="&";break;case"<":f+="<";break;case">":f+=">";break;default:f+=g<=" "?" ":g}h=_?-1:y}}f&&!p&&(p=this._spanElementObjectPool.acquire()),p&&(f&&(p.innerHTML=f,f=""),u.appendChild(p),p=null),this._terminal.children[s].appendChild(u)}r&&this._terminal.element.appendChild(this._terminal.rowContainer),this._terminal.emit("refresh",{element:this._terminal.element,start:t,end:e})},t.prototype.refreshSelection=function(t,e){for(;this._terminal.selectionContainer.children.length;)this._terminal.selectionContainer.removeChild(this._terminal.selectionContainer.children[0]);if(t&&e){var r=t[1]-this._terminal.buffer.ydisp,i=e[1]-this._terminal.buffer.ydisp,n=Math.max(r,0),s=Math.min(i,this._terminal.rows-1);if(!(n>=this._terminal.rows||s<0)){var o=document.createDocumentFragment(),a=r===n?t[0]:0,c=n===s?e[0]:this._terminal.cols;o.appendChild(this._createSelectionElement(n,a,c));var l=s-n-1;if(o.appendChild(this._createSelectionElement(n+1,0,this._terminal.cols,l)),n!==s){var h=i===s?e[0]:this._terminal.cols;o.appendChild(this._createSelectionElement(s,0,h))}this._terminal.selectionContainer.appendChild(o)}}},t.prototype._createSelectionElement=function(t,e,r,i){void 0===i&&(i=1);var n=document.createElement("div");return n.style.height=i*this._terminal.charMeasure.height+"px",n.style.top=t*this._terminal.charMeasure.height+"px",n.style.left=e*this._terminal.charMeasure.width+"px",n.style.width=this._terminal.charMeasure.width*(r-e)+"px",n},t}();r.Renderer=a},{"./utils/DomElementObjectPool":19}],11:[function(t,e,r){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(r,"__esModule",{value:!0});var n,s=t("./utils/Mouse"),o=t("./utils/Browser"),a=t("./EventEmitter"),c=t("./SelectionModel"),l=t("./utils/BufferLine"),h=String.fromCharCode(160),u=new RegExp(h,"g");!function(t){t[t.NORMAL=0]="NORMAL",t[t.WORD=1]="WORD",t[t.LINE=2]="LINE"}(n||(n={}));var f=function(t){function e(e,r,i,s){var o=t.call(this)||this;return o._terminal=e,o._buffer=r,o._rowContainer=i,o._charMeasure=s,o._enabled=!0,o._initListeners(),o.enable(),o._model=new c.SelectionModel(e),o._activeSelectionMode=n.NORMAL,o}return i(e,t),e.prototype._initListeners=function(){var t=this;this._mouseMoveListener=function(e){return t._onMouseMove(e)},this._mouseUpListener=function(e){return t._onMouseUp(e)},this._rowContainer.addEventListener("mousedown",function(e){return t._onMouseDown(e)}),this._buffer.on("trim",function(e){return t._onTrim(e)})},e.prototype.disable=function(){this.clearSelection(),this._enabled=!1},e.prototype.enable=function(){this._enabled=!0},e.prototype.setBuffer=function(t){this._buffer=t,this.clearSelection()},Object.defineProperty(e.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasSelection",{get:function(){var t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;return!(!t||!e)&&(t[0]!==e[0]||t[1]!==e[1])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionText",{get:function(){var t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;if(!t||!e)return"";var r=t[1]===e[1]?e[0]:null,i=[];i.push(l.translateBufferLineToString(this._buffer.get(t[1]),!0,t[0],r));for(var n=t[1]+1;n<=e[1]-1;n++){var s=this._buffer.get(n),a=l.translateBufferLineToString(s,!0);s.isWrapped?i[i.length-1]+=a:i.push(a)}if(t[1]!==e[1]){var s=this._buffer.get(e[1]),a=l.translateBufferLineToString(s,!0,0,e[0]);s.isWrapped?i[i.length-1]+=a:i.push(a)}return i.map(function(t){return t.replace(u," ")}).join(o.isMSWindows?"\r\n":"\n")},enumerable:!0,configurable:!0}),e.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh()},e.prototype.refresh=function(t){var e=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return e._refresh()})),o.isLinux&&t&&this.selectionText.length&&this.emit("newselection",this.selectionText)},e.prototype._refresh=function(){this._refreshAnimationFrame=null,this.emit("refresh",{start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd})},e.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh()},e.prototype._onTrim=function(t){this._model.onTrim(t)&&this.refresh()},e.prototype._getMouseBufferCoords=function(t){var e=s.getCoords(t,this._rowContainer,this._charMeasure,this._terminal.cols,this._terminal.rows,!0);return e?(e[0]--,e[1]--,e[1]+=this._terminal.buffer.ydisp,e):null},e.prototype._getMouseEventScrollAmount=function(t){var e=s.getCoordsRelativeToElement(t,this._rowContainer)[1],r=this._terminal.rows*this._charMeasure.height;return e>=0&&e<=r?0:(e>r&&(e-=r),e=Math.min(Math.max(e,-50),50),(e/=50)/Math.abs(e)+Math.round(14*e))},e.prototype._onMouseDown=function(t){if(2===t.button&&this.hasSelection)t.stopPropagation();else if(0===t.button){if(!this._enabled){if(!(o.isMac&&t.altKey))return;t.stopPropagation()}t.preventDefault(),this._dragScrollAmount=0,this._enabled&&t.shiftKey?this._onIncrementalClick(t):1===t.detail?this._onSingleClick(t):2===t.detail?this._onDoubleClick(t):3===t.detail&&this._onTripleClick(t),this._addMouseDownListeners(),this.refresh(!0)}},e.prototype._addMouseDownListeners=function(){var t=this;this._rowContainer.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._rowContainer.ownerDocument.addEventListener("mouseup",this._mouseUpListener),this._dragScrollIntervalTimer=setInterval(function(){return t._dragScroll()},50)},e.prototype._removeMouseDownListeners=function(){this._rowContainer.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._rowContainer.ownerDocument.removeEventListener("mouseup",this._mouseUpListener),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=null},e.prototype._onIncrementalClick=function(t){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(t))},e.prototype._onSingleClick=function(t){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=n.NORMAL,this._model.selectionStart=this._getMouseBufferCoords(t),this._model.selectionStart){this._model.selectionEnd=null;var e=this._buffer.get(this._model.selectionStart[1]);e&&0===e[this._model.selectionStart[0]][2]&&this._model.selectionStart[0]++}},e.prototype._onDoubleClick=function(t){var e=this._getMouseBufferCoords(t);e&&(this._activeSelectionMode=n.WORD,this._selectWordAt(e))},e.prototype._onTripleClick=function(t){var e=this._getMouseBufferCoords(t);e&&(this._activeSelectionMode=n.LINE,this._selectLineAt(e[1]))},e.prototype._onMouseMove=function(t){var e=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(t),this._model.selectionEnd){if(this._activeSelectionMode===n.LINE?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._terminal.cols-1:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]0?this._model.selectionEnd=[this._terminal.cols-1,this._terminal.buffer.ydisp+this._terminal.rows]:this._model.selectionEnd=[0,this._terminal.buffer.ydisp],this.refresh())},e.prototype._onMouseUp=function(t){this._removeMouseDownListeners()},e.prototype._convertViewportColToCharacterIndex=function(t,e){for(var r=e[0],i=0;e[0]>=i;i++)0===t[i][2]&&r--;return r},e.prototype.setSelection=function(t,e,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[t,e],this._model.selectionStartLength=r,this.refresh()},e.prototype._getWordAt=function(t){var e=this._buffer.get(t[1]);if(!e)return null;var r=l.translateBufferLineToString(e,!1),i=this._convertViewportColToCharacterIndex(e,t),n=i,s=t[0]-n,o=0,a=0;if(" "===r.charAt(n)){for(;n>0&&" "===r.charAt(n-1);)n--;for(;i0&&!this._isCharWordSeparator(r.charAt(n-1));)0===e[c-1][2]&&(o++,c--),n--,c--;for(;i+1=0},e.prototype._selectLineAt=function(t){this._model.selectionStart=[0,t],this._model.selectionStartLength=this._terminal.cols},e}(a.EventEmitter);r.SelectionManager=f},{"./EventEmitter":6,"./SelectionModel":12,"./utils/Browser":15,"./utils/BufferLine":16,"./utils/Mouse":21}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t){this._terminal=t,this.clearSelection()}return t.prototype.clearSelection=function(){this.selectionStart=null,this.selectionEnd=null,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(t.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(t.prototype,"finalSelectionEnd",{get:function(){return this.isSelectAllActive?[this._terminal.cols,this._terminal.buffer.ybase+this._terminal.rows-1]:this.selectionStart?!this.selectionEnd||this.areSelectionValuesReversed()?[this.selectionStart[0]+this.selectionStartLength,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}),t.prototype.areSelectionValuesReversed=function(){var t=this.selectionStart,e=this.selectionEnd;return t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]},t.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)},t}();r.SelectionModel=i},{}],13:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t,e,r,i){var n=this;this.terminal=t,this.viewportElement=e,this.scrollArea=r,this.charMeasure=i,this.currentRowHeight=0,this.lastRecordedBufferLength=0,this.lastRecordedViewportHeight=0,this.terminal.on("scroll",this.syncScrollArea.bind(this)),this.terminal.on("resize",this.syncScrollArea.bind(this)),this.viewportElement.addEventListener("scroll",this.onScroll.bind(this)),setTimeout(function(){return n.syncScrollArea()},0)}return t.prototype.refresh=function(){if(this.charMeasure.height>0){var t=this.charMeasure.height!==this.currentRowHeight;t&&(this.currentRowHeight=this.charMeasure.height,this.viewportElement.style.lineHeight=this.charMeasure.height+"px",this.terminal.rowContainer.style.lineHeight=this.charMeasure.height+"px");var e=this.lastRecordedViewportHeight!==this.terminal.rows;(t||e)&&(this.lastRecordedViewportHeight=this.terminal.rows,this.viewportElement.style.height=this.charMeasure.height*this.terminal.rows+"px",this.terminal.selectionContainer.style.height=this.viewportElement.style.height),this.scrollArea.style.height=this.charMeasure.height*this.lastRecordedBufferLength+"px"}},t.prototype.syncScrollArea=function(){this.lastRecordedBufferLength!==this.terminal.buffer.lines.length?(this.lastRecordedBufferLength=this.terminal.buffer.lines.length,this.refresh()):this.lastRecordedViewportHeight!==this.terminal.rows?this.refresh():this.charMeasure.height!==this.currentRowHeight&&this.refresh();var t=this.terminal.buffer.ydisp*this.currentRowHeight;this.viewportElement.scrollTop!==t&&(this.viewportElement.scrollTop=t)},t.prototype.onScroll=function(t){var e=Math.round(this.viewportElement.scrollTop/this.currentRowHeight)-this.terminal.buffer.ydisp;this.terminal.scrollDisp(e,!0)},t.prototype.onWheel=function(t){if(0!==t.deltaY){var e=1;t.deltaMode===WheelEvent.DOM_DELTA_LINE?e=this.currentRowHeight:t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e=this.currentRowHeight*this.terminal.rows),this.viewportElement.scrollTop+=t.deltaY*e,t.preventDefault()}},t.prototype.onTouchStart=function(t){this.lastTouchY=t.touches[0].pageY},t.prototype.onTouchMove=function(t){var e=this.lastTouchY-t.touches[0].pageY;this.lastTouchY=t.touches[0].pageY,0!==e&&(this.viewportElement.scrollTop+=e,t.preventDefault())},t}();r.Viewport=i},{}],14:[function(t,e,r){"use strict";function i(t,e){return e?t.replace(/\r?\n/g,"\r"):t}function n(t,e,r){e.browser.isMSIE?window.clipboardData.setData("Text",r.selectionText):t.clipboardData.setData("text/plain",r.selectionText),t.preventDefault()}function s(t,e){t.stopPropagation();var r=function(r){return r=i(r,e.browser.isMSWindows),e.handler(r),e.textarea.value="",e.emit("paste",r),e.cancel(t)};e.browser.isMSIE?window.clipboardData&&r(window.clipboardData.getData("Text")):t.clipboardData&&r(t.clipboardData.getData("text/plain"))}function o(t,e){e.style.position="fixed",e.style.width="20px",e.style.height="20px",e.style.left=t.clientX-10+"px",e.style.top=t.clientY-10+"px",e.style.zIndex="1000",e.focus(),setTimeout(function(){e.style.position=null,e.style.width=null,e.style.height=null,e.style.left=null,e.style.top=null,e.style.zIndex=null},4)}function a(t,e,r){o(t,e),e.value=r.selectionText,e.select()}Object.defineProperty(r,"__esModule",{value:!0}),r.prepareTextForTerminal=i,r.copyHandler=n,r.pasteHandler=s,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=a},{}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./Generic"),n="undefined"==typeof navigator,s=n?"node":navigator.userAgent,o=n?"node":navigator.platform;r.isFirefox=!!~s.indexOf("Firefox"),r.isMSIE=!!~s.indexOf("MSIE")||!!~s.indexOf("Trident"),r.isMac=i.contains(["Macintosh","MacIntel","MacPPC","Mac68K"],o),r.isIpad="iPad"===o,r.isIphone="iPhone"===o,r.isMSWindows=i.contains(["Windows","Win16","Win32","WinCE"],o),r.isLinux=o.indexOf("Linux")>=0},{"./Generic":20}],16:[function(t,e,r){"use strict";function i(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=null);for(var o="",a=r,c=i,l=0;l=l&&a--,i>=l&&c--)}var u=c||t.length;if(e){var f=o.search(/\s+$/);if(-1!==f&&(u=Math.min(u,f)),u<=a)return""}return o.substring(a,u)}Object.defineProperty(r,"__esModule",{value:!0});var n=1,s=2;r.translateBufferLineToString=i},{}],17:[function(t,e,r){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(r,"__esModule",{value:!0});var n=function(t){function e(e,r){var i=t.call(this)||this;return i._document=e,i._parentElement=r,i}return i(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),e.prototype.measure=function(){var t=this;this._measureElement?this._doMeasure():(this._measureElement=this._document.createElement("span"),this._measureElement.style.position="absolute",this._measureElement.style.top="0",this._measureElement.style.left="-9999em",this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement),setTimeout(function(){return t._doMeasure()},0))},e.prototype._doMeasure=function(){var t=this._measureElement.getBoundingClientRect();0!==t.width&&0!==t.height&&(this._width===t.width&&this._height===t.height||(this._width=t.width,this._height=t.height,this.emit("charsizechanged")))},e}(t("../EventEmitter.js").EventEmitter);r.CharMeasure=n},{"../EventEmitter.js":6}],18:[function(t,e,r){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(r,"__esModule",{value:!0});var n=function(t){function e(e){var r=t.call(this)||this;return r._array=new Array(e),r._startIndex=0,r._length=0,r}return i(e,t),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._array.length},set:function(t){for(var e=new Array(t),r=0;rthis._length)for(var e=this._length;e=t;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(var n=0;nthis.maxLength){var s=this._length+r.length-this.maxLength;this._startIndex+=s,this._length=this.maxLength,this.emit("trim",s)}else this._length+=r.length}},e.prototype.trimStart=function(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.emit("trim",t)},e.prototype.shiftElements=function(t,e,r){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(n=e-1;n>=0;n--)this.set(t+n+r,this.get(t+n));var i=t+e+r-this._length;if(i>0)for(this._length+=i;this._length>this.maxLength;)this._length--,this._startIndex++,this.emit("trim",1)}else for(var n=0;n=0}Object.defineProperty(r,"__esModule",{value:!0}),r.contains=i},{}],21:[function(t,e,r){"use strict";function i(t,e){if(null==t.pageX)return null;for(var r=t.pageX,i=t.pageY;e&&e!==self.document.documentElement;)r-=e.offsetLeft,i-=e.offsetTop,e="offsetParent"in e?e.offsetParent:e.parentElement;return[r,i]}function n(t,e,r,n,s,o){if(!r.width||!r.height)return null;var a=i(t,e);return a?(a[0]=Math.ceil((a[0]+(o?r.width/2:0))/r.width),a[1]=Math.ceil(a[1]/r.height),a[0]=Math.min(Math.max(a[0],1),n+1),a[1]=Math.min(Math.max(a[1],1),s+1),a):null}function s(t,e,r,i,s){var o=n(t,e,r,i,s),a=o[0],c=o[1];return a+=32,c+=32,{x:a,y:c}}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoordsRelativeToElement=i,r.getCoords=n,r.getRawByteCoords=s},{}],22:[function(t,e,r){"use strict";function i(t){var e=this;if(!(this instanceof i))return new i(arguments[0],arguments[1],arguments[2]);e.browser=k,e.cancel=i.cancel,p.EventEmitter.call(this),"number"==typeof t&&(t={cols:arguments[0],rows:arguments[1],handler:arguments[2]}),t=t||{},Object.keys(i.defaults).forEach(function(r){null==t[r]&&(t[r]=i.options[r],i[r]!==i.defaults[r]&&(t[r]=i[r])),e[r]=t[r]}),8===t.colors.length?t.colors=t.colors.concat(i._colors.slice(8)):16===t.colors.length?t.colors=t.colors.concat(i._colors.slice(16)):10===t.colors.length?t.colors=t.colors.slice(0,-2).concat(i._colors.slice(8,-2),t.colors.slice(-2)):18===t.colors.length&&(t.colors=t.colors.concat(i._colors.slice(16,-2),t.colors.slice(-2))),this.colors=t.colors,this.options=t,this.parent=t.body||t.parent||(x?x.getElementsByTagName("body")[0]:null),this.cols=t.cols||t.geometry[0],this.rows=t.rows||t.geometry[1],this.geometry=[this.cols,this.rows],t.handler&&this.on("data",t.handler),this.cursorState=0,this.cursorHidden=!1,this.convertEol,this.queue="",this.customKeyEventHandler=null,this.cursorBlinkInterval=null,this.applicationKeypad=!1,this.applicationCursor=!1,this.originMode=!1,this.insertMode=!1,this.wraparoundMode=!0,this.charset=null,this.gcharset=null,this.glevel=0,this.charsets=[null],this.decLocator,this.x10Mouse,this.vt200Mouse,this.vt300Mouse,this.normalMouse,this.mouseEvents,this.sendFocus,this.utfMouse,this.sgrMouse,this.urxvtMouse,this.element,this.children,this.refreshStart,this.refreshEnd,this.savedX,this.savedY,this.savedCols,this.readable=!0,this.writable=!0,this.defAttr=131840,this.curAttr=this.defAttr,this.params=[],this.currentParam=0,this.prefix="",this.postfix="",this.inputHandler=new g.InputHandler(this),this.parser=new b.Parser(this.inputHandler,this),this.renderer=this.renderer||null,this.selectionManager=this.selectionManager||null,this.linkifier=this.linkifier||new v.Linkifier,this.writeBuffer=[],this.writeInProgress=!1,this.xoffSentToCatchUp=!1,this.writeStopped=!1,this.surrogate_high="",this.buffers=new u.BufferSet(this),this.buffer=this.buffers.active,this.buffers.on("activate",function(t){this._terminal.buffer=t}),this.selectionManager&&this.selectionManager.setBuffer(this.buffer.lines),this.setupStops(),this.userScrolling=!1}function n(t,e,r,i){Array.isArray(t)||(t=[t]),t.forEach(function(t){t.addEventListener(e,r,i||!1)})}function s(t,e,r,i){t.removeEventListener(e,r,i||!1)}function o(t,e){if(this.cancelEvents||e)return t.preventDefault(),t.stopPropagation(),!1}function a(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function c(t,e){var r=t.browser.isMac&&e.altKey&&!e.ctrlKey&&!e.metaKey||t.browser.isMSWindows&&e.altKey&&e.ctrlKey&&!e.metaKey;return"keypress"==e.type?r:r&&(!e.keyCode||e.keyCode>47)}function l(t,e,r){var n=t<<16|e<<8|r;if(null!=l._cache[n])return l._cache[n];for(var s,o,a,c,h,u=1/0,f=-1,p=0;p>16&255,t>>8&255,255&t]);return e}(),i.defaults={colors:i.colors,theme:"default",convertEol:!1,termName:"xterm",geometry:[80,24],cursorBlink:!1,cursorStyle:"block",visualBell:!1,popOnBell:!1,scrollback:1e3,screenKeys:!1,debug:!1,cancelEvents:!1,disableStdin:!1,useFlowControl:!1,tabStopWidth:8},i.options={},i.focus=null,function(t,e,r){if(t.forEach)return t.forEach(e,r);for(var i=0;ie){var n=this.buffer.lines.length-e,s=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),s&&this.refresh(0,this.rows-1)}this.buffer.lines.maxLength=e,this.viewport.syncScrollArea()}}switch(this[t]=e,this.options[t]=e,t){case"cursorBlink":this.setCursorBlinking(e);break;case"cursorStyle":this.element.classList.toggle("xterm-cursor-style-block","block"===e),this.element.classList.toggle("xterm-cursor-style-underline","underline"===e),this.element.classList.toggle("xterm-cursor-style-bar","bar"===e);break;case"tabStopWidth":this.setupStops()}},i.prototype.restartCursorBlinking=function(){this.setCursorBlinking(this.options.cursorBlink)},i.prototype.setCursorBlinking=function(t){if(this.element.classList.toggle("xterm-cursor-blink",t),this.clearCursorBlinkingInterval(),t){var e=this;this.cursorBlinkInterval=setInterval(function(){e.element.classList.toggle("xterm-cursor-blink-on")},600)}},i.prototype.clearCursorBlinkingInterval=function(){this.element.classList.remove("xterm-cursor-blink-on"),this.cursorBlinkInterval&&(clearInterval(this.cursorBlinkInterval),this.cursorBlinkInterval=null)},i.bindFocus=function(t){n(t.textarea,"focus",function(e){t.sendFocus&&t.send(y.C0.ESC+"[I"),t.element.classList.add("focus"),t.showCursor(),t.restartCursorBlinking.apply(t),i.focus=t,t.emit("focus",{terminal:t})})},i.prototype.blur=function(){return this.textarea.blur()},i.bindBlur=function(t){n(t.textarea,"blur",function(e){t.refresh(t.buffer.y,t.buffer.y),t.sendFocus&&t.send(y.C0.ESC+"[O"),t.element.classList.remove("focus"),t.clearCursorBlinkingInterval.apply(t),i.focus=null,t.emit("blur",{terminal:t})})},i.prototype.initGlobal=function(){var t=this,e=this;i.bindKeys(this),i.bindFocus(this),i.bindBlur(this),n(this.element,"copy",function(r){e.hasSelection()&&m.copyHandler(r,e,t.selectionManager)});var r=function(t){return m.pasteHandler(t,e)};n(this.textarea,"paste",r),n(this.element,"paste",r),e.browser.isFirefox?n(this.element,"mousedown",function(e){2==e.button&&m.rightClickHandler(e,t.textarea,t.selectionManager)}):n(this.element,"contextmenu",function(e){m.rightClickHandler(e,t.textarea,t.selectionManager)}),e.browser.isLinux&&n(this.element,"auxclick",function(e){1===e.button&&m.moveTextAreaUnderMouseCursor(e,t.textarea,t.selectionManager)})},i.bindKeys=function(t){n(t.element,"keydown",function(e){x.activeElement==this&&t.keyDown(e)},!0),n(t.element,"keypress",function(e){x.activeElement==this&&t.keyPress(e)},!0),n(t.element,"keyup",function(e){h(e)||t.focus(t)},!0),n(t.textarea,"keydown",function(e){t.keyDown(e)},!0),n(t.textarea,"keypress",function(e){t.keyPress(e),this.value=""},!0),n(t.textarea,"compositionstart",t.compositionHelper.compositionstart.bind(t.compositionHelper)),n(t.textarea,"compositionupdate",t.compositionHelper.compositionupdate.bind(t.compositionHelper)),n(t.textarea,"compositionend",t.compositionHelper.compositionend.bind(t.compositionHelper)),t.on("refresh",t.compositionHelper.updateCompositionElements.bind(t.compositionHelper)),t.on("refresh",function(e){t.queueLinkification(e.start,e.end)})},i.prototype.insertRow=function(t){return"object"!=typeof t&&(t=x.createElement("div")),this.rowContainer.appendChild(t),this.children.push(t),t},i.prototype.open=function(t,e){var r=this,i=this,n=0;if(this.parent=t||this.parent,!this.parent)throw new Error("Terminal requires a parent element.");for(this.context=this.parent.ownerDocument.defaultView,this.document=this.parent.ownerDocument,this.body=this.document.getElementsByTagName("body")[0],this.element=this.document.createElement("div"),this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.classList.add("xterm-theme-"+this.theme),this.element.classList.add("xterm-cursor-style-"+this.options.cursorStyle),this.setCursorBlinking(this.options.cursorBlink),this.element.setAttribute("tabindex",0),this.viewportElement=x.createElement("div"),this.viewportElement.classList.add("xterm-viewport"),this.element.appendChild(this.viewportElement),this.viewportScrollArea=x.createElement("div"),this.viewportScrollArea.classList.add("xterm-scroll-area"),this.viewportElement.appendChild(this.viewportScrollArea),this.selectionContainer=x.createElement("div"),this.selectionContainer.classList.add("xterm-selection"),this.element.appendChild(this.selectionContainer),this.rowContainer=x.createElement("div"),this.rowContainer.classList.add("xterm-rows"),this.element.appendChild(this.rowContainer),this.children=[],this.linkifier.attachToDom(x,this.children),this.helperContainer=x.createElement("div"),this.helperContainer.classList.add("xterm-helpers"),this.element.appendChild(this.helperContainer),this.textarea=x.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.textarea.addEventListener("focus",function(){i.emit("focus",{terminal:i})}),this.textarea.addEventListener("blur",function(){i.emit("blur",{terminal:i})}),this.helperContainer.appendChild(this.textarea),this.compositionView=x.createElement("div"),this.compositionView.classList.add("composition-view"),this.compositionHelper=new f.CompositionHelper(this.textarea,this.compositionView,this),this.helperContainer.appendChild(this.compositionView),this.charSizeStyleElement=x.createElement("style"),this.helperContainer.appendChild(this.charSizeStyleElement);n div{height:"+this.charMeasure.height+"px;}"},i.prototype.bindMouse=function(){function t(t){var e,r;if(e=o(t),r=S.getRawByteCoords(t,c.rowContainer,c.charMeasure,c.cols,c.rows))switch(i(e,r),t.overrideType||t.type){case"mousedown":l=e;break;case"mouseup":l=32}}function e(t){var e,r=l;(e=S.getRawByteCoords(t,c.rowContainer,c.charMeasure,c.cols,c.rows))&&i(r+=32,e)}function r(t,e){if(c.utfMouse){if(2047===e)return t.push(0);e<127?t.push(e):(e>2047&&(e=2047),t.push(192|e>>6),t.push(128|63&e))}else{if(255===e)return t.push(0);e>127&&(e=127),t.push(e)}}function i(t,e){if(c.vt300Mouse){t&=3,e.x-=32,e.y-=32;var i=y.C0.ESC+"[24";if(0===t)i+="1";else if(1===t)i+="3";else if(2===t)i+="5";else{if(3===t)return;i+="0"}return i+="~["+e.x+","+e.y+"]\r",void c.send(i)}return c.decLocator?(t&=3,e.x-=32,e.y-=32,0===t?t=2:1===t?t=4:2===t?t=6:3===t&&(t=3),void c.send(y.C0.ESC+"["+t+";"+(3===t?4:0)+";"+e.y+";"+e.x+";"+(e.page||0)+"&w")):c.urxvtMouse?(e.x-=32,e.y-=32,e.x++,e.y++,void c.send(y.C0.ESC+"["+t+";"+e.x+";"+e.y+"M")):c.sgrMouse?(e.x-=32,e.y-=32,void c.send(y.C0.ESC+"[<"+((3==(3&t)?-4&t:t)-32)+";"+e.x+";"+e.y+(3==(3&t)?"m":"M"))):(r(i=[],t),r(i,e.x),r(i,e.y),void c.send(y.C0.ESC+"[M"+String.fromCharCode.apply(String,i)))}function o(t){var e,r,i,n,s;switch(t.overrideType||t.type){case"mousedown":e=null!=t.button?+t.button:null!=t.which?t.which-1:null,c.browser.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.wheelDeltaY>0?64:65}return r=t.shiftKey?4:0,i=t.metaKey?8:0,n=t.ctrlKey?16:0,s=r|i|n,c.vt200Mouse?s&=n:c.normalMouse||(s=0),e=32+(s<<2)+e}var a=this.element,c=this,l=32;n(a,"mousedown",function(r){if(r.preventDefault(),c.focus(),c.mouseEvents)return t(r),c.vt200Mouse?(r.overrideType="mouseup",t(r),c.cancel(r)):(c.normalMouse&&n(c.document,"mousemove",e),c.x10Mouse||n(c.document,"mouseup",function r(i){return t(i),c.normalMouse&&s(c.document,"mousemove",e),s(c.document,"mouseup",r),c.cancel(i)}),c.cancel(r))}),n(a,"wheel",function(e){if(c.mouseEvents&&!(c.x10Mouse||c.vt300Mouse||c.decLocator))return t(e),c.cancel(e)}),n(a,"wheel",function(t){if(!c.mouseEvents)return c.viewport.onWheel(t),c.cancel(t)}),n(a,"touchstart",function(t){if(!c.mouseEvents)return c.viewport.onTouchStart(t),c.cancel(t)}),n(a,"touchmove",function(t){if(!c.mouseEvents)return c.viewport.onTouchMove(t),c.cancel(t)})},i.prototype.destroy=function(){this.readable=!1,this.writable=!1,this._events={},this.handler=function(){},this.write=function(){},this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},i.prototype.refresh=function(t,e){this.renderer&&this.renderer.queueRefresh(t,e)},i.prototype.queueLinkification=function(t,e){if(this.linkifier)for(var r=t;r<=e;r++)this.linkifier.linkifyRow(r)},i.prototype.showCursor=function(){this.cursorState||(this.cursorState=1,this.refresh(this.buffer.y,this.buffer.y))},i.prototype.scroll=function(t){var e;this.buffer.lines.length===this.buffer.lines.maxLength&&(this.buffer.lines.trimStart(1),this.buffer.ybase--,0!==this.buffer.ydisp&&this.buffer.ydisp--),this.buffer.ybase++,this.userScrolling||(this.buffer.ydisp=this.buffer.ybase),e=this.buffer.ybase+this.rows-1,(e-=this.rows-1-this.buffer.scrollBottom)===this.buffer.lines.length?this.buffer.lines.push(this.blankLine(void 0,t)):this.buffer.lines.splice(e,0,this.blankLine(void 0,t)),0!==this.buffer.scrollTop&&(0!==this.buffer.ybase&&(this.buffer.ybase--,this.userScrolling||(this.buffer.ydisp=this.buffer.ybase)),this.buffer.lines.splice(this.buffer.ybase+this.buffer.scrollTop,1)),this.updateRange(this.buffer.scrollTop),this.updateRange(this.buffer.scrollBottom),this.emit("scroll",this.buffer.ydisp)},i.prototype.scrollDisp=function(t,e){if(t<0){if(0===this.buffer.ydisp)return;this.userScrolling=!0}else t+this.buffer.ydisp>=this.buffer.ybase&&(this.userScrolling=!1);var r=this.buffer.ydisp;this.buffer.ydisp=Math.max(Math.min(this.buffer.ydisp+t,this.buffer.ybase),0),r!==this.buffer.ydisp&&(e||this.emit("scroll",this.buffer.ydisp),this.refresh(0,this.rows-1))},i.prototype.scrollPages=function(t){this.scrollDisp(t*(this.rows-1))},i.prototype.scrollToTop=function(){this.scrollDisp(-this.buffer.ydisp)},i.prototype.scrollToBottom=function(){this.scrollDisp(this.buffer.ybase-this.buffer.ydisp)},i.prototype.write=function(t){if(this.writeBuffer.push(t),this.options.useFlowControl&&!this.xoffSentToCatchUp&&this.writeBuffer.length>=5&&(this.send(y.C0.DC3),this.xoffSentToCatchUp=!0),!this.writeInProgress&&this.writeBuffer.length>0){this.writeInProgress=!0;var e=this;setTimeout(function(){e.innerWrite()})}},i.prototype.innerWrite=function(){for(var t=this.writeBuffer.splice(0,300);t.length>0;){var e=t.shift();e.length;this.xoffSentToCatchUp&&0===t.length&&0===this.writeBuffer.length&&(this.send(y.C0.DC1),this.xoffSentToCatchUp=!1),this.refreshStart=this.buffer.y,this.refreshEnd=this.buffer.y;var r=this.parser.parse(e);this.parser.setState(r),this.updateRange(this.buffer.y),this.refresh(this.refreshStart,this.refreshEnd)}if(this.writeBuffer.length>0){var i=this;setTimeout(function(){i.innerWrite()},0)}else this.writeInProgress=!1},i.prototype.writeln=function(t){this.write(t+"\r\n")},i.prototype.attachCustomKeydownHandler=function(t){console.warn("attachCustomKeydownHandler() is DEPRECATED and will be removed soon. Please use attachCustomKeyEventHandler() instead."),this.attachCustomKeyEventHandler(t)},i.prototype.attachCustomKeyEventHandler=function(t){this.customKeyEventHandler=t},i.prototype.setHypertextLinkHandler=function(t){if(!this.linkifier)throw new Error("Cannot attach a hypertext link handler before Terminal.open is called");this.linkifier.setHypertextLinkHandler(t),this.refresh(0,this.rows-1)},i.prototype.setHypertextValidationCallback=function(t){if(!this.linkifier)throw new Error("Cannot attach a hypertext validation callback before Terminal.open is called");this.linkifier.setHypertextValidationCallback(t),this.refresh(0,this.rows-1)},i.prototype.registerLinkMatcher=function(t,e,r){if(this.linkifier){var i=this.linkifier.registerLinkMatcher(t,e,r);return this.refresh(0,this.rows-1),i}},i.prototype.deregisterLinkMatcher=function(t){this.linkifier&&this.linkifier.deregisterLinkMatcher(t)&&this.refresh(0,this.rows-1)},i.prototype.hasSelection=function(){return!!this.selectionManager&&this.selectionManager.hasSelection},i.prototype.getSelection=function(){return this.selectionManager?this.selectionManager.selectionText:""},i.prototype.clearSelection=function(){this.selectionManager&&this.selectionManager.clearSelection()},i.prototype.selectAll=function(){this.selectionManager&&this.selectionManager.selectAll()},i.prototype.keyDown=function(t){if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(t))return!1;if(this.restartCursorBlinking(),!this.compositionHelper.keydown.bind(this.compositionHelper)(t))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var e=this.evaluateKeyEscapeSequence(t);return e.key===y.C0.DC3?this.writeStopped=!0:e.key===y.C0.DC1&&(this.writeStopped=!1),e.scrollDisp?(this.scrollDisp(e.scrollDisp),this.cancel(t,!0)):!!c(this,t)||(e.cancel&&this.cancel(t,!0),!e.key||(this.emit("keydown",t),this.emit("key",e.key,t),this.showCursor(),this.handler(e.key),this.cancel(t,!0)))},i.prototype.evaluateKeyEscapeSequence=function(t){var e={cancel:!1,key:void 0,scrollDisp:void 0},r=t.shiftKey<<0|t.altKey<<1|t.ctrlKey<<2|t.metaKey<<3;switch(t.keyCode){case 8:if(t.shiftKey){e.key=y.C0.BS;break}e.key=y.C0.DEL;break;case 9:if(t.shiftKey){e.key=y.C0.ESC+"[Z";break}e.key=y.C0.HT,e.cancel=!0;break;case 13:e.key=y.C0.CR,e.cancel=!0;break;case 27:e.key=y.C0.ESC,e.cancel=!0;break;case 37:r?(e.key=y.C0.ESC+"[1;"+(r+1)+"D",e.key==y.C0.ESC+"[1;3D"&&(e.key=this.browser.isMac?y.C0.ESC+"b":y.C0.ESC+"[1;5D")):this.applicationCursor?e.key=y.C0.ESC+"OD":e.key=y.C0.ESC+"[D";break;case 39:r?(e.key=y.C0.ESC+"[1;"+(r+1)+"C",e.key==y.C0.ESC+"[1;3C"&&(e.key=this.browser.isMac?y.C0.ESC+"f":y.C0.ESC+"[1;5C")):this.applicationCursor?e.key=y.C0.ESC+"OC":e.key=y.C0.ESC+"[C";break;case 38:r?(e.key=y.C0.ESC+"[1;"+(r+1)+"A",e.key==y.C0.ESC+"[1;3A"&&(e.key=y.C0.ESC+"[1;5A")):this.applicationCursor?e.key=y.C0.ESC+"OA":e.key=y.C0.ESC+"[A";break;case 40:r?(e.key=y.C0.ESC+"[1;"+(r+1)+"B",e.key==y.C0.ESC+"[1;3B"&&(e.key=y.C0.ESC+"[1;5B")):this.applicationCursor?e.key=y.C0.ESC+"OB":e.key=y.C0.ESC+"[B";break;case 45:t.shiftKey||t.ctrlKey||(e.key=y.C0.ESC+"[2~");break;case 46:e.key=r?y.C0.ESC+"[3;"+(r+1)+"~":y.C0.ESC+"[3~";break;case 36:r?e.key=y.C0.ESC+"[1;"+(r+1)+"H":this.applicationCursor?e.key=y.C0.ESC+"OH":e.key=y.C0.ESC+"[H";break;case 35:r?e.key=y.C0.ESC+"[1;"+(r+1)+"F":this.applicationCursor?e.key=y.C0.ESC+"OF":e.key=y.C0.ESC+"[F";break;case 33:t.shiftKey?e.scrollDisp=-(this.rows-1):e.key=y.C0.ESC+"[5~";break;case 34:t.shiftKey?e.scrollDisp=this.rows-1:e.key=y.C0.ESC+"[6~";break;case 112:e.key=r?y.C0.ESC+"[1;"+(r+1)+"P":y.C0.ESC+"OP";break;case 113:e.key=r?y.C0.ESC+"[1;"+(r+1)+"Q":y.C0.ESC+"OQ";break;case 114:e.key=r?y.C0.ESC+"[1;"+(r+1)+"R":y.C0.ESC+"OR";break;case 115:e.key=r?y.C0.ESC+"[1;"+(r+1)+"S":y.C0.ESC+"OS";break;case 116:e.key=r?y.C0.ESC+"[15;"+(r+1)+"~":y.C0.ESC+"[15~";break;case 117:e.key=r?y.C0.ESC+"[17;"+(r+1)+"~":y.C0.ESC+"[17~";break;case 118:e.key=r?y.C0.ESC+"[18;"+(r+1)+"~":y.C0.ESC+"[18~";break;case 119:e.key=r?y.C0.ESC+"[19;"+(r+1)+"~":y.C0.ESC+"[19~";break;case 120:e.key=r?y.C0.ESC+"[20;"+(r+1)+"~":y.C0.ESC+"[20~";break;case 121:e.key=r?y.C0.ESC+"[21;"+(r+1)+"~":y.C0.ESC+"[21~";break;case 122:e.key=r?y.C0.ESC+"[23;"+(r+1)+"~":y.C0.ESC+"[23~";break;case 123:e.key=r?y.C0.ESC+"[24;"+(r+1)+"~":y.C0.ESC+"[24~";break;default:!t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?this.browser.isMac||!t.altKey||t.ctrlKey||t.metaKey?this.browser.isMac&&!t.altKey&&!t.ctrlKey&&t.metaKey&&65===t.keyCode&&this.selectAll():t.keyCode>=65&&t.keyCode<=90?e.key=y.C0.ESC+String.fromCharCode(t.keyCode+32):192===t.keyCode?e.key=y.C0.ESC+"`":t.keyCode>=48&&t.keyCode<=57&&(e.key=y.C0.ESC+(t.keyCode-48)):t.keyCode>=65&&t.keyCode<=90?e.key=String.fromCharCode(t.keyCode-64):32===t.keyCode?e.key=String.fromCharCode(0):t.keyCode>=51&&t.keyCode<=55?e.key=String.fromCharCode(t.keyCode-51+27):56===t.keyCode?e.key=String.fromCharCode(127):219===t.keyCode?e.key=String.fromCharCode(27):220===t.keyCode?e.key=String.fromCharCode(28):221===t.keyCode&&(e.key=String.fromCharCode(29))}return e},i.prototype.setgLevel=function(t){this.glevel=t,this.charset=this.charsets[t]},i.prototype.setgCharset=function(t,e){this.charsets[t]=e,this.glevel===t&&(this.charset=e)},i.prototype.keyPress=function(t){var e;if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(t))return!1;if(this.cancel(t),t.charCode)e=t.charCode;else if(null==t.which)e=t.keyCode;else{if(0===t.which||0===t.charCode)return!1;e=t.which}return!(!e||(t.altKey||t.ctrlKey||t.metaKey)&&!c(this,t))&&(e=String.fromCharCode(e),this.emit("keypress",e,t),this.emit("key",e,t),this.showCursor(),this.handler(e),!0)},i.prototype.send=function(t){var e=this;this.queue||setTimeout(function(){e.handler(e.queue),e.queue=""},1),this.queue+=t},i.prototype.bell=function(){if(this.visualBell){var t=this;this.element.style.borderColor="white",setTimeout(function(){t.element.style.borderColor=""},10),this.popOnBell&&this.focus()}},i.prototype.log=function(){if(this.debug&&this.context.console&&this.context.console.log){var t=Array.prototype.slice.call(arguments);this.context.console.log.apply(this.context.console,t)}},i.prototype.error=function(){if(this.debug&&this.context.console&&this.context.console.error){var t=Array.prototype.slice.call(arguments);this.context.console.error.apply(this.context.console,t)}},i.prototype.resize=function(t,e){if(!isNaN(t)&&!isNaN(e)){e>this.getOption("scrollback")&&this.setOption("scrollback",e);var r;if(t!==this.cols||e!==this.rows){for(t<1&&(t=1),e<1&&(e=1),this.buffers.resize(t,e);this.children.lengthe;)(r=this.children.shift())&&r.parentNode.removeChild(r);this.cols=t,this.rows=e,this.setupStops(this.cols),this.charMeasure.measure(),this.refresh(0,this.rows-1),this.geometry=[this.cols,this.rows],this.emit("resize",{terminal:this,cols:t,rows:e})}else this.charMeasure.width&&this.charMeasure.height||this.charMeasure.measure()}},i.prototype.updateRange=function(t){tthis.refreshEnd&&(this.refreshEnd=t)},i.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1},i.prototype.setupStops=function(t){for(null!=t?this.buffer.tabs[t]||(t=this.prevStop(t)):(this.buffer.tabs={},t=0);t0;);return t>=this.cols?this.cols-1:t<0?0:t},i.prototype.nextStop=function(t){for(null==t&&(t=this.buffer.x);!this.buffer.tabs[++t]&&t=this.cols?this.cols-1:t<0?0:t},i.prototype.eraseRight=function(t,e){var r=this.buffer.lines.get(this.buffer.ybase+e);if(r){for(var i=[this.eraseAttr()," ",1];tthis.buffer.scrollBottom&&(this.buffer.y--,this.scroll()),this.buffer.x>=this.cols&&this.buffer.x--},i.prototype.reverseIndex=function(){this.buffer.y===this.buffer.scrollTop?(this.buffer.lines.shiftElements(this.buffer.y+this.buffer.ybase,this.rows-1,1),this.buffer.lines.set(this.buffer.y+this.buffer.ybase,this.blankLine(!0)),this.updateRange(this.buffer.scrollTop),this.updateRange(this.buffer.scrollBottom)):this.buffer.y--},i.prototype.reset=function(){this.options.rows=this.rows,this.options.cols=this.cols;var t=this.customKeyEventHandler,e=this.cursorBlinkInterval,r=this.inputHandler;i.call(this,this.options),this.customKeyEventHandler=t,this.cursorBlinkInterval=e,this.inputHandler=r,this.refresh(0,this.rows-1),this.viewport.syncScrollArea()},i.prototype.tabSet=function(){this.buffer.tabs[this.buffer.x]=!0},i.prototype.matchColor=l,l._cache={},l.distance=function(t,e,r,i,n,s){return Math.pow(30*(t-i),2)+Math.pow(59*(e-n),2)+Math.pow(11*(r-s),2)},i.translateBufferLineToString=E.translateBufferLineToString,i.EventEmitter=p.EventEmitter,i.inherits=a,i.on=n,i.off=s,i.cancel=o,e.exports=i},{"./BufferSet":2,"./CompositionHelper":4,"./EscapeSequences":5,"./EventEmitter":6,"./InputHandler":7,"./Linkifier":8,"./Parser":9,"./Renderer":10,"./SelectionManager":11,"./Viewport":13,"./handlers/Clipboard":14,"./utils/Browser":15,"./utils/BufferLine":16,"./utils/CharMeasure":17,"./utils/Mouse":21}]},{},[22])(22)}),function(t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("../../xterm")):"function"==typeof define?define(["../../xterm"],t):t(window.Terminal)}(function(t){var e={};return e.proposeGeometry=function(t){if(!t.element.parentElement)return null;var e,r,i,n,s=window.getComputedStyle(t.element.parentElement),o=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))-17),c=window.getComputedStyle(t.element),l=o-(parseInt(c.getPropertyValue("padding-top"))+parseInt(c.getPropertyValue("padding-bottom"))),h=a-(parseInt(c.getPropertyValue("padding-right"))+parseInt(c.getPropertyValue("padding-left"))),u=(t.rowContainer,t.rowContainer.firstElementChild),f=u.innerHTML;return u.style.display="inline",u.innerHTML="W",i=u.getBoundingClientRect().width,u.style.display="",e=u.getBoundingClientRect().height,u.innerHTML=f,r=parseInt(l/e),n=parseInt(h/i),{cols:n,rows:r}},e.fit=function(t){var r=e.proposeGeometry(t);r&&t.resize(r.cols,r.rows)},t.prototype.proposeGeometry=function(){return e.proposeGeometry(this)},t.prototype.fit=function(){return e.fit(this)},e}),function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function i(t,e){"object"===(void 0===t?"undefined":s(t))&&(e=t,t=void 0),e=e||{};var r,i=o(t),a=i.source,u=i.id,f=i.path,p=h[u]&&f in h[u].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||p?(l("ignoring socket cache for %s",a),r=c(a,e)):(h[u]||(l("new io instance for %s",a),h[u]=c(a,e)),r=h[u]),i.query&&!e.query?e.query=i.query:e&&"object"===s(e.query)&&(e.query=n(e.query)),r.socket(i.path,e)}function n(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(1),a=r(7),c=r(17),l=r(3)("socket.io-client");t.exports=e=i;var h=e.managers={};e.protocol=a.protocol,e.connect=i,e.Manager=r(17),e.Socket=r(44)},function(t,e,r){(function(e){"use strict";function i(t,r){var i=t;r=r||e.location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(s("protocol-less url %s",t),t=void 0!==r?r.protocol+"//"+t:"https://"+t),s("parse %s",t),i=n(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";var o=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port,i.href=i.protocol+"://"+o+(r&&r.port===i.port?"":":"+i.port),i}var n=r(2),s=r(3)("socket.io-client:url");t.exports=i}).call(e,function(){return this}())},function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,n=t.indexOf("["),s=t.indexOf("]");-1!=n&&-1!=s&&(t=t.substring(0,n)+t.substring(n,s).replace(/:/g,";")+t.substring(s,t.length));for(var o=r.exec(t||""),a={},c=14;c--;)a[i[c]]=o[c]||"";return-1!=n&&-1!=s&&(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,r){(function(i){function n(){return"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function s(){var t=arguments,r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return t;var i="color: "+this.color,n=0,s=0;return(t=[t[0],i,"color: inherit"].concat(Array.prototype.slice.call(t,1)))[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(n++,"%c"===t&&(s=n))}),t.splice(s,0,i),t}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function c(){try{return e.storage.debug}catch(t){}if(void 0!==i&&"env"in i)return i.env.DEBUG}(e=t.exports=r(5)).log=o,e.formatArgs=s,e.save=a,e.load=c,e.useColors=n,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(c())}).call(e,r(4))},function(t,e){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function n(t){if(h===setTimeout)return setTimeout(t,0);if((h===r||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function s(t){if(u===clearTimeout)return clearTimeout(t);if((u===i||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{return u(t)}catch(e){try{return u.call(null,t)}catch(e){return u.call(this,t)}}}function o(){m&&p&&(m=!1,p.length?d=p.concat(d):y=-1,d.length&&a())}function a(){if(!m){var t=n(o);m=!0;for(var e=d.length;e;){for(p=d,d=[];++y1)for(var r=1;r1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*h;case"days":case"day":case"d":return r*l;case"hours":case"hour":case"hrs":case"hr":case"h":return r*c;case"minutes":case"minute":case"mins":case"min":case"m":return r*a;case"seconds":case"second":case"secs":case"sec":case"s":return r*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function i(t){return t>=l?Math.round(t/l)+"d":t>=c?Math.round(t/c)+"h":t>=a?Math.round(t/a)+"m":t>=o?Math.round(t/o)+"s":t+"ms"}function n(t){return s(t,l,"day")||s(t,c,"hour")||s(t,a,"minute")||s(t,o,"second")||t+" ms"}function s(t,e,r){if(!(t0)return r(t);if("number"===s&&!1===isNaN(t))return e.long?n(t):i(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,r){function i(){}function n(t){var r="",i=!1;return r+=t.type,e.BINARY_EVENT!=t.type&&e.BINARY_ACK!=t.type||(r+=t.attachments,r+="-"),t.nsp&&"/"!=t.nsp&&(i=!0,r+=t.nsp),null!=t.id&&(i&&(r+=",",i=!1),r+=t.id),null!=t.data&&(i&&(r+=","),r+=f.stringify(t.data)),u("encoded %j as %s",t,r),r}function s(t,e){function r(t){var r=d.deconstructPacket(t),i=n(r.packet),s=r.buffers;s.unshift(i),e(s)}d.removeBlobs(t,r)}function o(){this.reconstructor=null}function a(t){var r={},i=0;if(r.type=Number(t.charAt(0)),null==e.types[r.type])return h();if(e.BINARY_EVENT==r.type||e.BINARY_ACK==r.type){for(var n="";"-"!=t.charAt(++i)&&(n+=t.charAt(i),i!=t.length););if(n!=Number(n)||"-"!=t.charAt(i))throw new Error("Illegal attachments");r.attachments=Number(n)}if("/"==t.charAt(i+1))for(r.nsp="";++i&&","!=(o=t.charAt(i))&&(r.nsp+=o,i!=t.length););else r.nsp="/";var s=t.charAt(i+1);if(""!==s&&Number(s)==s){for(r.id="";++i;){var o=t.charAt(i);if(null==o||Number(o)!=o){--i;break}if(r.id+=t.charAt(i),i==t.length)break}r.id=Number(r.id)}return t.charAt(++i)&&(r=c(r,t.substr(i))),u("decoded %s as %j",t,r),r}function c(t,e){try{t.data=f.parse(e)}catch(t){return h()}return t}function l(t){this.reconPack=t,this.buffers=[]}function h(t){return{type:e.ERROR,data:"parser error"}}var u=r(8)("socket.io-parser"),f=r(11),p=r(13),d=r(14),m=r(16);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=i,e.Decoder=o,i.prototype.encode=function(t,r){u("encoding packet %j",t),e.BINARY_EVENT==t.type||e.BINARY_ACK==t.type?s(t,r):r([n(t)])},p(o.prototype),o.prototype.add=function(t){var r;if("string"==typeof t)r=a(t),e.BINARY_EVENT==r.type||e.BINARY_ACK==r.type?(this.reconstructor=new l(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!m(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(r=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",r))}},o.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},l.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length==this.reconPack.attachments){var e=d.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},l.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,r){function i(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function n(){var t=arguments,r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return t;var i="color: "+this.color,n=0,s=0;return(t=[t[0],i,"color: inherit"].concat(Array.prototype.slice.call(t,1)))[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(n++,"%c"===t&&(s=n))}),t.splice(s,0,i),t}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function a(){var t;try{t=e.storage.debug}catch(t){}return t}(e=t.exports=r(9)).log=s,e.formatArgs=n,e.save=o,e.load=a,e.useColors=i,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){return JSON.stringify(t)},e.enable(a())},function(t,e,r){function i(){return e.colors[h++%e.colors.length]}function n(t){function r(){}function n(){var t=n,r=+new Date,s=r-(l||r);t.diff=s,t.prev=l,t.curr=r,l=r,null==t.useColors&&(t.useColors=e.useColors()),null==t.color&&t.useColors&&(t.color=i());var o=Array.prototype.slice.call(arguments);o[0]=e.coerce(o[0]),"string"!=typeof o[0]&&(o=["%o"].concat(o));var a=0;o[0]=o[0].replace(/%([a-z%])/g,function(r,i){if("%%"===r)return r;a++;var n=e.formatters[i];if("function"==typeof n){var s=o[a];r=n.call(t,s),o.splice(a,1),a--}return r}),"function"==typeof e.formatArgs&&(o=e.formatArgs.apply(t,o)),(n.log||e.log||console.log.bind(console)).apply(t,o)}r.enabled=!1,n.enabled=!0;var s=e.enabled(t)?n:r;return s.namespace=t,s}function s(t){e.save(t);for(var r=(t||"").split(/[\s,]+/),i=r.length,n=0;n1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*h;case"days":case"day":case"d":return r*l;case"hours":case"hour":case"hrs":case"hr":case"h":return r*c;case"minutes":case"minute":case"mins":case"min":case"m":return r*a;case"seconds":case"second":case"secs":case"sec":case"s":return r*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function i(t){return t>=l?Math.round(t/l)+"d":t>=c?Math.round(t/c)+"h":t>=a?Math.round(t/a)+"m":t>=o?Math.round(t/o)+"s":t+"ms"}function n(t){return s(t,l,"day")||s(t,c,"hour")||s(t,a,"minute")||s(t,o,"second")||t+" ms"}function s(t,e,r){if(!(t1)))/4)-C((t-1901+e)/100)+C((t-1601+e)/400)};if((d=g.hasOwnProperty)||(d=function(t){var e,r={};return(r.__proto__=null,r.__proto__={toString:1},r).toString!=b?d=function(t){var e=this.__proto__,r=t in(this.__proto__=null,this);return this.__proto__=e,r}:(e=r.constructor,d=function(t){var r=(this.constructor||e).prototype;return t in this&&!(t in r&&this[t]===r[t])}),r=null,d.call(this,t)}),m=function(t,e){var r,i,s,o=0;(r=function(){this.valueOf=0}).prototype.valueOf=0,i=new r;for(s in i)d.call(i,s)&&o++;return r=i=null,o?m=2==o?function(t,e){var r,i={},n="[object Function]"==b.call(t);for(r in t)n&&"prototype"==r||d.call(i,r)||!(i[r]=1)||!d.call(t,r)||e(r)}:function(t,e){var r,i,n="[object Function]"==b.call(t);for(r in t)n&&"prototype"==r||!d.call(t,r)||(i="constructor"===r)||e(r);(i||d.call(t,r="constructor"))&&e(r)}:(i=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],m=function(t,e){var r,s,o="[object Function]"==b.call(t),a=!o&&"function"!=typeof t.constructor&&n[typeof t.hasOwnProperty]&&t.hasOwnProperty||d;for(r in t)o&&"prototype"==r||!a.call(t,r)||e(r);for(s=i.length;r=i[--s];a.call(t,r)&&e(r));}),m(t,e)},!r("json-stringify")){var S={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},E=function(t,e){return("000000"+(e||0)).slice(-t)},x=function(t){for(var e='"',r=0,i=t.length,n=!v||i>10,s=n&&(v?t.split(""):t);r-1/0&&a<1/0){if(k){for(f=C(a/864e5),l=C(f/365.2425)+1970-1;k(l+1,0)<=f;l++);for(h=C((f-k(l,0))/30.42);k(l,h+1)<=f;h++);f=1+f-k(l,h),g=C((p=(a%864e5+864e5)%864e5)/36e5)%24,_=C(p/6e4)%60,v=C(p/1e3)%60,w=p%1e3}else l=a.getUTCFullYear(),h=a.getUTCMonth(),f=a.getUTCDate(),g=a.getUTCHours(),_=a.getUTCMinutes(),v=a.getUTCSeconds(),w=a.getUTCMilliseconds();a=(l<=0||l>=1e4?(l<0?"-":"+")+E(6,l<0?-l:l):E(4,l))+"-"+E(2,h+1)+"-"+E(2,f)+"T"+E(2,g)+":"+E(2,_)+":"+E(2,v)+"."+E(3,w)+"Z"}else a=null;if(r&&(a=r.call(e,t,a)),null===a)return"null";if("[object Boolean]"==(c=b.call(a)))return""+a;if("[object Number]"==c)return a>-1/0&&a<1/0?""+a:"null";if("[object String]"==c)return x(""+a);if("object"==typeof a){for(T=o.length;T--;)if(o[T]===a)throw u();if(o.push(a),S=[],B=s,s+=n,"[object Array]"==c){for(L=0,T=a.length;L0)for(i="",r>10&&(r=10);i.length=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70||R();t+=T("0x"+s.slice(e,M));break;default:R()}else{if(34==n)break;for(n=s.charCodeAt(M),e=M;n>=32&&92!=n&&34!=n;)n=s.charCodeAt(++M);t+=s.slice(e,M)}if(34==s.charCodeAt(M))return M++,t;R();default:if(e=M,45==n&&(i=!0,n=s.charCodeAt(++M)),n>=48&&n<=57){for(48==n&&(n=s.charCodeAt(M+1))>=48&&n<=57&&R(),i=!1;M=48&&n<=57;M++);if(46==s.charCodeAt(M)){for(r=++M;r=48&&n<=57;r++);r==M&&R(),M=r}if(101==(n=s.charCodeAt(M))||69==n){for(43!=(n=s.charCodeAt(++M))&&45!=n||M++,r=M;r=48&&n<=57;r++);r==M&&R(),M=r}return+s.slice(e,M)}if(i&&R(),"true"==s.slice(M,M+4))return M+=4,!0;if("false"==s.slice(M,M+5))return M+=5,!1;if("null"==s.slice(M,M+4))return M+=4,null;R()}return"$"},O=function(t){var e,r;if("$"==t&&R(),"string"==typeof t){if("@"==(v?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];"]"!=(t=P());r||(r=!0))r&&(","==t?"]"==(t=P())&&R():R()),","==t&&R(),e.push(O(t));return e}if("{"==t){for(e={};"}"!=(t=P());r||(r=!0))r&&(","==t?"}"==(t=P())&&R():R()),","!=t&&"string"==typeof t&&"@"==(v?t.charAt(0):t[0])&&":"==P()||R(),e[t.slice(1)]=O(P());return e}R()}return t},D=function(t,e,r){var i=N(t,e,r);i===y?delete t[e]:t[e]=i},N=function(t,e,r){var i,n=t[e];if("object"==typeof n&&n)if("[object Array]"==b.call(n))for(i=n.length;i--;)D(n,i,r);else m(n,function(t){D(n,t,r)});return r.call(t,e,n)};e.parse=function(t,e){var r,i;return M=0,L=""+t,r=O(P()),"$"!=P()&&R(),M=L=null,e&&"[object Function]"==b.call(e)?N((i={},i[""]=r,i),"",e):r}}}return e.runInContext=i,e}var n={function:!0,object:!0},s=n[typeof e]&&e&&!e.nodeType&&e,o=n[typeof window]&&window||this,a=s&&n[typeof t]&&t&&!t.nodeType&&"object"==typeof r&&r;if(!a||a.global!==a&&a.window!==a&&a.self!==a||(o=a),s)i(o,s);else{var c=o.JSON,l=o.JSON3,h=!1,u=i(o,o.JSON3={noConflict:function(){return h||(h=!0,o.JSON=c,o.JSON3=l,c=l=null),u}});o.JSON={parse:u.parse,stringify:u.stringify}}}).call(this)}).call(e,r(12)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},r.prototype.once=function(t,e){function r(){i.off(t,r),e.apply(this,arguments)}var i=this;return this._callbacks=this._callbacks||{},r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks[t];if(!r)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var i,n=0;n0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},i.prototype.cleanup=function(){u("cleanup");for(var t=this.subs.length,e=0;e=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();u("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(u("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(u("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(u("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},i.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,r){t.exports=r(19)},function(t,e,r){t.exports=r(20),t.exports.parser=r(27)},function(t,e,r){(function(e){function i(t,r){if(!(this instanceof i))return new i(t,r);r=r||{},t&&"object"==typeof t&&(r=t,t=null),t?(t=h(t),r.hostname=t.host,r.secure="https"===t.protocol||"wss"===t.protocol,r.port=t.port,t.query&&(r.query=t.query)):r.host&&(r.hostname=h(r.host).host),this.secure=null!=r.secure?r.secure:e.location&&"https:"===location.protocol,r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.agent=r.agent||!1,this.hostname=r.hostname||(e.location?location.hostname:"localhost"),this.port=r.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=r.query||{},"string"==typeof this.query&&(this.query=f.decode(this.query)),this.upgrade=!1!==r.upgrade,this.path=(r.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!r.forceJSONP,this.jsonp=!1!==r.jsonp,this.forceBase64=!!r.forceBase64,this.enablesXDR=!!r.enablesXDR,this.timestampParam=r.timestampParam||"t",this.timestampRequests=r.timestampRequests,this.transports=r.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=r.policyPort||843,this.rememberUpgrade=r.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=r.onlyBinaryUpgrades,this.perMessageDeflate=!1!==r.perMessageDeflate&&(r.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=r.pfx||null,this.key=r.key||null,this.passphrase=r.passphrase||null,this.cert=r.cert||null,this.ca=r.ca||null,this.ciphers=r.ciphers||null,this.rejectUnauthorized=void 0===r.rejectUnauthorized?null:r.rejectUnauthorized,this.forceNode=!!r.forceNode;var n="object"==typeof e&&e;n.global===n&&(r.extraHeaders&&Object.keys(r.extraHeaders).length>0&&(this.extraHeaders=r.extraHeaders),r.localAddress&&(this.localAddress=r.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function n(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var s=r(21),o=r(35),a=r(3)("engine.io-client:socket"),c=r(42),l=r(27),h=r(2),u=r(43),f=r(36);t.exports=i,i.priorWebsocketSuccess=!1,o(i.prototype),i.protocol=l.protocol,i.Socket=i,i.Transport=r(26),i.transports=r(21),i.parser=r(27),i.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=n(this.query);return e.EIO=l.protocol,e.transport=t,this.id&&(e.sid=this.id),new s[t]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:e,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized,perMessageDeflate:this.perMessageDeflate,extraHeaders:this.extraHeaders,forceNode:this.forceNode,localAddress:this.localAddress})},i.prototype.open=function(){var t;if(this.rememberUpgrade&&i.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},i.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},i.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var e=!this.supportsBinary&&f.transport.supportsBinary;u=u||e}u||(a('probe transport "%s" opened',t),h.send([{type:"ping",data:"probe"}]),h.once("packet",function(e){if(!u)if("pong"===e.type&&"probe"===e.data){if(a('probe transport "%s" pong',t),f.upgrading=!0,f.emit("upgrading",h),!h)return;i.priorWebsocketSuccess="websocket"===h.name,a('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){u||"closed"!==f.readyState&&(a("changing transport and sending upgrade packet"),l(),f.setTransport(h),h.send([{type:"upgrade"}]),f.emit("upgrade",h),h=null,f.upgrading=!1,f.flush())})}else{a('probe transport "%s" failed',t);var r=new Error("probe error");r.transport=h.name,f.emit("upgradeError",r)}}))}function r(){u||(u=!0,l(),h.close(),h=null)}function n(e){var i=new Error("probe error: "+e);i.transport=h.name,r(),a('probe transport "%s" failed because of error: %s',t,e),f.emit("upgradeError",i)}function s(){n("transport closed")}function o(){n("socket closed")}function c(t){h&&t.name!==h.name&&(a('"%s" works - aborting "%s"',t.name,h.name),r())}function l(){h.removeListener("open",e),h.removeListener("error",n),h.removeListener("close",s),f.removeListener("close",o),f.removeListener("upgrading",c)}a('probing transport "%s"',t);var h=this.createTransport(t,{probe:1}),u=!1,f=this;i.priorWebsocketSuccess=!1,h.once("open",e),h.once("error",n),h.once("close",s),this.once("close",o),this.once("upgrading",c),h.open()},i.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",i.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;t1?{type:_[n],data:t.substring(1)}:{type:_[n]}:v}var n=new Uint8Array(t)[0],s=f(t,1);return C&&"blob"===r&&(s=new C([s])),{type:_[n],data:s}},e.decodeBase64Packet=function(t,e){var r=_[t.charAt(0)];if(!l)return{type:r,data:{base64:!0,data:t.substr(1)}};var i=l.decode(t.substr(1));return"blob"===e&&C&&(i=new C([i])),{type:r,data:i}},e.encodePayload=function(t,r,i){function n(t){return t.length+":"+t}function s(t,i){e.encodePacket(t,!!o&&r,!0,function(t){i(null,n(t))})}"function"==typeof r&&(i=r,r=null);var o=u(t);return r&&o?C&&!g?e.encodePayloadAsBlob(t,i):e.encodePayloadAsArrayBuffer(t,i):t.length?void c(t,s,function(t,e){return i(e.join(""))}):i("0:")},e.decodePayload=function(t,r,i){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,i);"function"==typeof r&&(i=r,r=null);var n;if(""==t)return i(v,0,1);for(var s,o,a="",c=0,l=t.length;c0;){for(var a=new Uint8Array(n),c=0===a[0],l="",h=1;255!=a[h];h++){if(l.length>310){o=!0;break}l+=a[h]}if(o)return i(v,0,1);n=f(n,2+l.length),l=parseInt(l);var u=f(n,0,l);if(c)try{u=String.fromCharCode.apply(null,new Uint8Array(u))}catch(t){var p=new Uint8Array(u);u="";for(h=0;hi&&(r=i),e>=i||e>=r||0===i)return new ArrayBuffer(0);for(var n=new Uint8Array(t),s=new Uint8Array(r-e),o=e,a=0;o=55296&&e<=56319&&n65535&&(n+=_((e-=65536)>>>10&1023|55296),e=56320|1023&e),n+=_(e);return n}function c(t,e){return _(t>>e&63|128)}function l(t){if(0==(4294967168&t))return _(t);var e="";return 0==(4294965248&t)?e=_(t>>6&31|192):0==(4294901760&t)?(e=_(t>>12&15|224),e+=c(t,6)):0==(4292870144&t)&&(e=_(t>>18&7|240),e+=c(t,12),e+=c(t,6)),e+=_(63&t|128)}function h(t){for(var e=o(t),r=e.length,i=-1,n="";++i=g)throw Error("Invalid byte index");var t=255&y[b];if(b++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function f(){var t,e,r,i,n;if(b>g)throw Error("Invalid byte index");if(b==g)return!1;if(t=255&y[b],b++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|(e=u()))>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if(e=u(),r=u(),(n=(15&t)<<12|e<<6|r)>=2048)return n;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=u(),r=u(),i=u(),(n=(15&t)<<18|e<<12|r<<6|i)>=65536&&n<=1114111))return n;throw Error("Invalid WTF-8 detected")}function p(t){y=o(t),g=y.length,b=0;for(var e,r=[];!1!==(e=f());)r.push(e);return a(r)}var d="object"==typeof e&&e,m=("object"==typeof t&&t&&t.exports,"object"==typeof n&&n);var y,g,b,_=String.fromCharCode,v={version:"1.0.0",encode:h,decode:p};void 0!==(i=function(){return v}.call(e,r,e,t))&&(t.exports=i)}()}).call(e,r(12)(t),function(){return this}())},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),i=0;i>2],s+=t[(3&i[r])<<4|i[r+1]>>4],s+=t[(15&i[r+1])<<2|i[r+2]>>6],s+=t[63&i[r+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},e.decode=function(t){var e,i,n,s,o,a=.75*t.length,c=t.length,l=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var h=new ArrayBuffer(a),u=new Uint8Array(h);for(e=0;e>4,u[l++]=(15&n)<<4|s>>2,u[l++]=(3&s)<<6|63&o;return h}}()},function(t,e){(function(e){function r(t){for(var e=0;e0);return e}function i(t){var e=0;for(h=0;h';s=document.createElement(t)}catch(t){(s=document.createElement("iframe")).name=n.iframeId,s.src="javascript:0"}s.id=n.iframeId,n.form.appendChild(s),n.iframe=s}var n=this;if(!this.form){var s,o=document.createElement("form"),a=document.createElement("textarea"),h=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=h,o.method="POST",o.setAttribute("accept-charset","utf-8"),a.name="d",o.appendChild(a),document.body.appendChild(o),this.form=o,this.area=a}this.form.action=this.uri(),i(),t=t.replace(l,"\\\n"),this.area.value=t.replace(c,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&r()}:this.iframe.onload=r}}).call(e,function(){return this}())},function(t,e,r){(function(e){function i(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=u&&!t.forceNode,this.usingBrowserWebSocket||(f=n),s.call(this,t)}var n,s=r(26),o=r(27),a=r(36),c=r(37),l=r(38),h=r(3)("engine.io-client:websocket"),u=e.WebSocket||e.MozWebSocket;if("undefined"==typeof window)try{n=r(41)}catch(t){}var f=u;f||"undefined"!=typeof window||(f=n),t.exports=i,c(i,s),i.prototype.name="websocket",i.prototype.supportsBinary=!0,i.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e={agent:this.agent,perMessageDeflate:this.perMessageDeflate};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(e.headers=this.extraHeaders),this.localAddress&&(e.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?new f(t):new f(t,void 0,e)}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()}},i.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)}},i.prototype.write=function(t){function r(){i.emit("flush"),setTimeout(function(){i.writable=!0,i.emit("drain")},0)}var i=this;this.writable=!1;for(var n=t.length,s=0,a=n;s0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=r,r.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-r:t+r}return 0|Math.min(t,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(t){this.ms=t},r.prototype.setMax=function(t){this.max=t},r.prototype.setJitter=function(t){this.jitter=t}}])});var sessionLogEnable=!1,sessionLog,sessionFooter,logDate,currentDate,myFile,errorExists;document.getElementById("downloadLog").style.display="none",document.getElementById("credentials").style.display="none";var terminalContainer=document.getElementById("terminal-container"),term=new Terminal({cursorBlink:!0}),socket,termid;if(term.open(terminalContainer,{focus:!0}),term.fit(),document.location.pathname){var parts=document.location.pathname.split("/"),base=parts.slice(0,parts.length-1).join("/")+"/",resource=base.substring(1)+"socket.io";socket=io.connect(null,{resource:resource})}else socket=io.connect();socket.on("connect",function(){socket.emit("geometry",term.cols,term.rows),term.on("data",function(t){socket.emit("data",t)}),socket.on("title",function(t){document.title=t}).on("status",function(t){document.getElementById("status").innerHTML=t}).on("ssherror",function(t){document.getElementById("status").innerHTML=t,document.getElementById("status").style.backgroundColor="red",errorExists=!0}).on("headerBackground",function(t){document.getElementById("header").style.backgroundColor=t}).on("header",function(t){document.getElementById("header").innerHTML=t}).on("footer",function(t){sessionFooter=t,document.getElementById("footer").innerHTML=t}).on("statusBackground",function(t){document.getElementById("status").style.backgroundColor=t}).on("allowreplay",function(t){!0===t?(console.log("allowreplay: "+t),document.getElementById("credentials").style.display="inline"):document.getElementById("credentials").style.display="none"}).on("data",function(t){term.write(t),sessionLogEnable&&(sessionLog+=t)}).on("disconnect",function(t){errorExists||(document.getElementById("status").style.backgroundColor="red",document.getElementById("status").innerHTML="WEBSOCKET SERVER DISCONNECTED: "+t),socket.io.reconnection(!1)}).on("error",function(t){errorExists||(document.getElementById("status").style.backgroundColor="red",document.getElementById("status").innerHTML="ERROR: "+t)})});
//# sourceMappingURL=src/webssh2.min.map