webssh2/public/webssh2.min.js
billchurch d849f7432e adding readyTimeout option, updating packages
adding readyTimeout option, updating packages
2017-08-21 09:21:52 -04:00

4 lines
No EOL
169 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! 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='<a class="toggleLog" href="javascript:void(0);" onclick="toggleLog();">Start Log</a>',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='<a class="toggleLog" href="javascript:void(0)" onclick="toggleLog();">Logging - STOP LOG</a>',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;o<i.length;o++)n(i[o]);return n}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./utils/CircularList"),n=function(){function t(t){this._terminal=t,this.clear()}return Object.defineProperty(t.prototype,"lines",{get:function(){return this._lines},enumerable:!0,configurable:!0}),t.prototype.fillViewportRows=function(){if(0===this._lines.length)for(var t=this._terminal.rows;t--;)this.lines.push(this._terminal.blankLine())},t.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.scrollBottom=0,this.scrollTop=0,this.tabs={},this._lines=new i.CircularList(this._terminal.scrollback),this.scrollBottom=this._terminal.rows-1},t.prototype.resize=function(t,e){if(0!==this._lines.length){if(this._terminal.cols<t)for(var r=[this._terminal.defAttr," ",1],i=0;i<this._lines.length;i++)for(void 0===this._lines.get(i)&&this._lines.set(i,this._terminal.blankLine(void 0,void 0,t));this._lines.get(i).length<t;)this._lines.get(i).push(r);var n=0;if(this._terminal.rows<e)for(s=this._terminal.rows;s<e;s++)this._lines.length<e+this.ybase&&(this.ybase>0&&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<arguments.length;r++)e[r-1]=arguments[r];if(this._events[t])for(var i=this._events[t],n=0;n<i.length;n++)i[n].apply(this,e)},t.prototype.listeners=function(t){return this._events[t]||[]},t}();r.EventEmitter=i},{}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./EscapeSequences"),n=t("./Charsets"),s=function(){function t(t){this._terminal=t}return t.prototype.addChar=function(t,e){if(t>=" "){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;s<i;++s)0===this._terminal.buffer.lines.get(this._terminal.buffer.y+this._terminal.buffer.ybase).pop()[2]&&this._terminal.buffer.lines.get(n)[this._terminal.cols-2]&&2===this._terminal.buffer.lines.get(n)[this._terminal.cols-2][2]&&(this._terminal.buffer.lines.get(n)[this._terminal.cols-2]=[this._terminal.curAttr," ",1]),this._terminal.buffer.lines.get(n).splice(this._terminal.buffer.x,0,[this._terminal.curAttr," ",1]);this._terminal.buffer.lines.get(n)[this._terminal.buffer.x]=[this._terminal.curAttr,t,i],this._terminal.buffer.x++,this._terminal.updateRange(this._terminal.buffer.y),2===i&&(this._terminal.buffer.lines.get(n)[this._terminal.buffer.x]=[this._terminal.curAttr,"",0],this._terminal.buffer.x++)}},t.prototype.bell=function(){var t=this;this._terminal.visualBell&&(this._terminal.element.style.borderColor="white",setTimeout(function(){return t._terminal.element.style.borderColor=""},10),this._terminal.popOnBell&&this._terminal.focus())},t.prototype.lineFeed=function(){this._terminal.convertEol&&(this._terminal.buffer.x=0),++this._terminal.buffer.y>this._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.cols;)this._terminal.buffer.lines.get(r).splice(i++,0,n),this._terminal.buffer.lines.get(r).pop()},t.prototype.cursorUp=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)},t.prototype.cursorDown=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.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;e<this._terminal.rows;e++)this._terminal.eraseLine(e);break;case 1:for(this._terminal.eraseLeft(this._terminal.buffer.x,this._terminal.buffer.y),e=this._terminal.buffer.y;e--;)this._terminal.eraseLine(e);break;case 2:for(e=this._terminal.rows;e--;)this._terminal.eraseLine(e);break;case 3:var r=this._terminal.buffer.lines.length-this._terminal.rows;r>0&&(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.lines.get(r)[i++]=n},t.prototype.cursorBackwardTab=function(t){for(var e=t[0]||1;e--;)this._terminal.buffer.x=this._terminal.prevStop()},t.prototype.charPosAbsolute=function(t){var e=t[0];e<1&&(e=1),this._terminal.buffer.x=e-1,this._terminal.buffer.x>=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;e<t.length;e++)this.setMode([t[e]]);else if(this._terminal.prefix){if("?"===this._terminal.prefix)switch(t[0]){case 1:this._terminal.applicationCursor=!0;break;case 2:this._terminal.setgCharset(0,n.DEFAULT_CHARSET),this._terminal.setgCharset(1,n.DEFAULT_CHARSET),this._terminal.setgCharset(2,n.DEFAULT_CHARSET),this._terminal.setgCharset(3,n.DEFAULT_CHARSET);break;case 3:this._terminal.savedCols=this._terminal.cols,this._terminal.resize(132,this._terminal.rows);break;case 6:this._terminal.originMode=!0;break;case 7:this._terminal.wraparoundMode=!0;break;case 12:break;case 66:this._terminal.log("Serial port requested application keypad."),this._terminal.applicationKeypad=!0,this._terminal.viewport.syncScrollArea();break;case 9:case 1e3:case 1002:case 1003:this._terminal.x10Mouse=9===t[0],this._terminal.vt200Mouse=1e3===t[0],this._terminal.normalMouse=t[0]>1e3,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<t.length;e++)this.resetMode([t[e]]);else if(this._terminal.prefix){if("?"===this._terminal.prefix)switch(t[0]){case 1:this._terminal.applicationCursor=!1;break;case 3:132===this._terminal.cols&&this._terminal.savedCols&&this._terminal.resize(this._terminal.savedCols,this._terminal.rows),delete this._terminal.savedCols;break;case 6:this._terminal.originMode=!1;break;case 7:this._terminal.wraparoundMode=!1;break;case 12:break;case 66:this._terminal.log("Switching back to normal keypad."),this._terminal.applicationKeypad=!1,this._terminal.viewport.syncScrollArea();break;case 9:case 1e3:case 1002:case 1003:this._terminal.x10Mouse=!1,this._terminal.vt200Mouse=!1,this._terminal.normalMouse=!1,this._terminal.mouseEvents=!1,this._terminal.element.classList.remove("enable-mouse-events"),this._terminal.selectionManager.enable();break;case 1004:this._terminal.sendFocus=!1;break;case 1005:this._terminal.utfMouse=!1;break;case 1006:this._terminal.sgrMouse=!1;break;case 1015:this._terminal.urxvtMouse=!1;break;case 25:this._terminal.cursorHidden=!0;break;case 1049:case 47:case 1047:this._terminal.buffers.activateNormalBuffer(),this._terminal.selectionManager.setBuffer(this._terminal.buffer.lines),this._terminal.refresh(0,this._terminal.rows-1),this._terminal.viewport.syncScrollArea(),this._terminal.showCursor()}}else switch(t[0]){case 4:this._terminal.insertMode=!1}},t.prototype.charAttributes=function(t){if(1!==t.length||0!==t[0]){for(var e,r=t.length,i=0,n=this._terminal.curAttr>>18,s=this._terminal.curAttr>>9&511,o=511&this._terminal.curAttr;i<r;i++)(e=t[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(t<e[0][0]||t>e[n][1])return!1;for(;n>=i;)if(r=i+n>>1,t>e[r][1])i=r+1;else{if(!(t<e[r][0]))return!0;n=r-1}return!1}function r(r){return 0===r?t.nul:r<32||r>=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;e<this._linkMatchers.length;e++)if(this._linkMatchers[e].id===t)return this._linkMatchers.splice(e,1),!0;return!1},t.prototype._linkifyRow=function(t){var e=this._rows[t];if(e){e.textContent;for(var r=0;r<this._linkMatchers.length;r++){var i=this._linkMatchers[r],n=this._doLinkifyRow(e,i);if(n.length>0){if(i.validationCallback)for(var s=0;s<n.length;s++)!function(t){var e=n[t];i.validationCallback(e.textContent,e,function(t){t||e.classList.add("xterm-invalid-link")})}(s);return}}}},t.prototype._doLinkifyRow=function(t,e){var r=[],i=e.id===n,s=t.childNodes,o=t.textContent.match(e.regex);if(!o||0===o.length)return r;for(var a=o["number"!=typeof e.matchIndex?0:e.matchIndex],c=o.index+a.length,l=0;l<s.length;l++){var h=s[l],u=h.textContent.indexOf(a);if(u>=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<h.childNodes.length;d++){var m=h.childNodes[d],y=m.textContent.indexOf(a);if(-1!==y){this._replaceNodeSubstringWithNode(m,f,a,y);break}}else l+=this._replaceNodeSubstringWithNode(h,f,a,u);if(r.push(f),!(o=t.textContent.substring(c).match(e.regex))||0===o.length)return r;a=o["number"!=typeof e.matchIndex?0:e.matchIndex],c+=o.index+a.length}}return r},t.prototype._createAnchorElement=function(t,e,r){var i=this._document.createElement("a");return i.textContent=t,i.draggable=!1,r?(i.href=t,i.target="_blank",i.addEventListener("click",function(r){if(e)return e(r,t)})):i.addEventListener("click",function(r){if(!i.classList.contains("xterm-invalid-link"))return e(r,t)}),i},t.prototype._replaceNode=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var i=t.parentNode,n=0;n<e.length;n++)i.insertBefore(e[n],t);i.removeChild(t)},t.prototype._replaceNodeSubstringWithNode=function(t,e,r,i){if(1===t.childNodes.length&&(t=t.childNodes[0]),3!==t.nodeType)throw new Error("targetNode must be a text node or only contain a single text node");var n=t.textContent;if(0===i){var s=n.substring(r.length),o=this._document.createTextNode(s);return this._replaceNode(t,e,o),0}if(i===t.textContent.length-r.length){var a=n.substring(0,i),c=this._document.createTextNode(a);return this._replaceNode(t,c,e),0}var l=n.substring(0,i),h=this._document.createTextNode(l),u=n.substring(i+r.length),f=this._document.createTextNode(u);return this._replaceNode(t,h,e,f),1},t}();s.TIME_BEFORE_LINKIFY=200,r.Linkifier=s},{}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./EscapeSequences"),n=t("./Charsets"),s={};s[i.C0.BEL]=function(t,e){return e.bell()},s[i.C0.LF]=function(t,e){return e.lineFeed()},s[i.C0.VT]=s[i.C0.LF],s[i.C0.FF]=s[i.C0.LF],s[i.C0.CR]=function(t,e){return e.carriageReturn()},s[i.C0.BS]=function(t,e){return e.backspace()},s[i.C0.HT]=function(t,e){return e.tab()},s[i.C0.SO]=function(t,e){return e.shiftOut()},s[i.C0.SI]=function(t,e){return e.shiftIn()},s[i.C0.ESC]=function(t,e){return t.setState(l.ESCAPED)};var o={};o["["]=function(t,e){e.params=[],e.currentParam=0,t.setState(l.CSI_PARAM)},o["]"]=function(t,e){e.params=[],e.currentParam=0,t.setState(l.OSC)},o.P=function(t,e){e.params=[],e.currentParam=0,t.setState(l.DCS)},o._=function(t,e){t.setState(l.IGNORE)},o["^"]=function(t,e){t.setState(l.IGNORE)},o.c=function(t,e){e.reset()},o.E=function(t,e){e.buffer.x=0,e.index(),t.setState(l.NORMAL)},o.D=function(t,e){e.index(),t.setState(l.NORMAL)},o.M=function(t,e){e.reverseIndex(),t.setState(l.NORMAL)},o["%"]=function(t,e){e.setgLevel(0),e.setgCharset(0,n.DEFAULT_CHARSET),t.setState(l.NORMAL),t.skipNextChar()},o[i.C0.CAN]=function(t){return t.setState(l.NORMAL)};var a={};a["?"]=function(t){return t.setPrefix("?")},a[">"]=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<f;this._position++){if(r=t[this._position],55296<=(h=t.charCodeAt(this._position))&&h<=56319){if(u=t.charCodeAt(this._position+1),isNaN(u)){this._terminal.surrogate_high=r;continue}h=1024*(h-55296)+(u-56320)+65536,r+=t.charAt(this._position+1)}if(!(56320<=h&&h<=57343))switch(this._state){case l.NORMAL:r in s?s[r](this,this._inputHandler):this._inputHandler.addChar(r,h);break;case l.ESCAPED:if(r in o){o[r](this,this._terminal);break}switch(r){case"(":case")":case"*":case"+":case"-":case".":switch(r){case"(":this._terminal.gcharset=0;break;case")":this._terminal.gcharset=1;break;case"*":this._terminal.gcharset=2;break;case"+":this._terminal.gcharset=3;break;case"-":this._terminal.gcharset=1;break;case".":this._terminal.gcharset=2}this._state=l.CHARSET;break;case"/":this._terminal.gcharset=3,this._state=l.CHARSET,this._position--;break;case"N":case"O":break;case"n":this._terminal.setgLevel(2);break;case"o":case"|":this._terminal.setgLevel(3);break;case"}":this._terminal.setgLevel(2);break;case"~":this._terminal.setgLevel(1);break;case"7":this._inputHandler.saveCursor(),this._state=l.NORMAL;break;case"8":this._inputHandler.restoreCursor(),this._state=l.NORMAL;break;case"#":this._state=l.NORMAL,this._position++;break;case"H":this._terminal.tabSet(),this._state=l.NORMAL;break;case"=":this._terminal.log("Serial port requested application keypad."),this._terminal.applicationKeypad=!0,this._terminal.viewport.syncScrollArea(),this._state=l.NORMAL;break;case">":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;r<this._refreshRowsQueue.length;r++)this._refreshRowsQueue[r].start<t&&(t=this._refreshRowsQueue[r].start),this._refreshRowsQueue[r].end>e&&(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<i;m++){var y=c[m][0],g=c[m][1],b=c[m][2],_=m===l;if(b){if((y!==h||_)&&(h===this._terminal.defAttr||_||(f&&(p.innerHTML=f,f=""),u.appendChild(p),p=null),y!==this._terminal.defAttr||_)){f&&!p&&(p=this._spanElementObjectPool.acquire()),p&&(f&&(p.innerHTML=f,f=""),u.appendChild(p)),p=this._spanElementObjectPool.acquire();var v=511&y,C=y>>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+='<span class="xterm-wide-char">'+g+"</span>";else if(g.charCodeAt(0)>255)f+='<span class="xterm-normal-char">'+g+"</span>";else switch(g){case"&":f+="&amp;";break;case"<":f+="&lt;";break;case">":f+="&gt;";break;default:f+=g<=" "?"&nbsp;":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]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._terminal.cols:this._activeSelectionMode===n.WORD&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(t),this._dragScrollAmount>0?this._model.selectionEnd[0]=this._terminal.cols-1:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]<this._buffer.length){var r=this._buffer.get(this._model.selectionEnd[1])[this._model.selectionEnd[0]];r&&0===r[2]&&this._model.selectionEnd[0]++}e&&e[0]===this._model.selectionEnd[0]&&e[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)},e.prototype._dragScroll=function(){this._dragScrollAmount&&(this._terminal.scrollDisp(this._dragScrollAmount,!1),this._dragScrollAmount>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(;i<r.length&&" "===r.charAt(i+1);)i++}else{var c=t[0],h=t[0];for(0===e[c][2]&&(o++,c--),2===e[h][2]&&(a++,h++);n>0&&!this._isCharWordSeparator(r.charAt(n-1));)0===e[c-1][2]&&(o++,c--),n--,c--;for(;i+1<r.length&&!this._isCharWordSeparator(r.charAt(i+1));)2===e[h+1][2]&&(a++,h++),i++,h++}return{start:n+s-o,length:Math.min(i-n+o+a+1,this._terminal.cols)}},e.prototype._selectWordAt=function(t){var e=this._getWordAt(t);e&&(this._model.selectionStart=[e.start,t[1]],this._model.selectionStartLength=e.length)},e.prototype._selectToWordAt=function(t){var e=this._getWordAt(t);e&&(this._model.selectionEnd=[this._model.areSelectionValuesReversed()?e.start:e.start+e.length,t[1]])},e.prototype._isCharWordSeparator=function(t){return" ()[]{}'\"".indexOf(t)>=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<t.length;l++){var h=t[l];o+=h[n],0===h[s]&&(r>=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;r<Math.min(t,this.length);r++)e[r]=this._array[this._getCyclicIndex(r)];this._array=e,this._startIndex=0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},set:function(t){if(t>this._length)for(var e=this._length;e<t;e++)this._array[e]=void 0;this._length=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"forEach",{get:function(){var t=this;return function(e){for(var r=t.length,i=0;i<r;i++)e(t.get(i),i)}},enumerable:!0,configurable:!0}),e.prototype.get=function(t){return this._array[this._getCyclicIndex(t)]},e.prototype.set=function(t,e){this._array[this._getCyclicIndex(t)]=e},e.prototype.push=function(t){this._array[this._getCyclicIndex(this._length)]=t,this._length===this.maxLength?(++this._startIndex===this.maxLength&&(this._startIndex=0),this.emit("trim",1)):this._length++},e.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},e.prototype.splice=function(t,e){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(e){for(n=t;n<this._length-e;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+e)];this._length-=e}if(r&&r.length){for(n=this._length-1;n>=t;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(var n=0;n<r.length;n++)this._array[this._getCyclicIndex(t+n)]=r[n];if(this._length+r.length>this.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<e;n++)this.set(t+n+r,this.get(t+n))}},e.prototype._getCyclicIndex=function(t){return(this._startIndex+t)%this.maxLength},e}(t("../EventEmitter").EventEmitter);r.CircularList=n},{"../EventEmitter":6}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t){this.type=t,this._type=t,this._pool=[],this._inUse={}}return t.prototype.acquire=function(){var e;return e=0===this._pool.length?this._createNew():this._pool.pop(),this._inUse[e.getAttribute(t.OBJECT_ID_ATTRIBUTE)]=e,e},t.prototype.release=function(e){if(!this._inUse[e.getAttribute(t.OBJECT_ID_ATTRIBUTE)])throw new Error("Could not release an element not yet acquired");delete this._inUse[e.getAttribute(t.OBJECT_ID_ATTRIBUTE)],this._cleanElement(e),this._pool.push(e)},t.prototype._createNew=function(){var e=document.createElement(this._type),r=t._objectCount++;return e.setAttribute(t.OBJECT_ID_ATTRIBUTE,r.toString(10)),e},t.prototype._cleanElement=function(t){t.className="",t.innerHTML=""},t}();i.OBJECT_ID_ATTRIBUTE="data-obj-id",i._objectCount=0,r.DomElementObjectPool=i},{}],20:[function(t,e,r){"use strict";function i(t,e){return t.indexOf(e)>=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<i.vcolors.length;p++){if(s=i.vcolors[p],o=s[0],a=s[1],c=s[2],0===(h=l.distance(t,e,r,o,a,c))){f=p;break}h<u&&(u=h,f=p)}return l._cache[n]=f}function h(t){return 16===t.keyCode||17===t.keyCode||18===t.keyCode}Object.defineProperty(r,"__esModule",{value:!0});var u=t("./BufferSet"),f=t("./CompositionHelper"),p=t("./EventEmitter"),d=t("./Viewport"),m=t("./handlers/Clipboard"),y=t("./EscapeSequences"),g=t("./InputHandler"),b=t("./Parser"),_=t("./Renderer"),v=t("./Linkifier"),C=t("./SelectionManager"),w=t("./utils/CharMeasure"),k=t("./utils/Browser"),S=t("./utils/Mouse"),E=t("./utils/BufferLine"),x="undefined"!=typeof window?window.document:null;a(i,p.EventEmitter),i.prototype.eraseAttr=function(){return-512&this.defAttr|511&this.curAttr},i.tangoColors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],i.colors=function(){function t(t,r,i){n.push("#"+e(t)+e(r)+e(i))}function e(t){return t=t.toString(16),t.length<2?"0"+t:t}var r,n=i.tangoColors.slice(),s=[0,95,135,175,215,255];for(r=0;r<216;r++)t(s[r/36%6|0],s[r/6%6|0],s[r%6]);for(r=0;r<24;r++)t(s=8+10*r,s,s);return n}(),i._colors=i.colors.slice(),i.vcolors=function(){for(var t,e=[],r=i.colors,n=0;n<256;n++)t=parseInt(r[n].substring(1),16),e.push([t>>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;i<t.length;i++)e.call(r,t[i],i,t)}(function(t){if(Object.keys)return Object.keys(t);var e,r=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.push(e);return r}(i.defaults),function(t){i[t]=i.defaults[t],i.options[t]=i.defaults[t]}),i.prototype.focus=function(){return this.textarea.focus()},i.prototype.getOption=function(t){if(!(t in i.defaults))throw new Error('No option with key "'+t+'"');return void 0!==this.options[t]?this.options[t]:this[t]},i.prototype.setOption=function(t,e){if(!(t in i.defaults))throw new Error('No option with key "'+t+'"');switch(t){case"scrollback":if(e<this.rows){var r="Setting the scrollback value less than the number of rows ";return r+="("+this.rows+") is not allowed.",console.warn(r),!1}if(this.options[t]!==e){if(this.buffer.lines.length>e){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<this.rows;n++)this.insertRow();if(this.parent.appendChild(this.element),this.charMeasure=new w.CharMeasure(x,this.helperContainer),this.charMeasure.on("charsizechanged",function(){i.updateCharSizeStyles()}),this.charMeasure.measure(),this.viewport=new d.Viewport(this,this.viewportElement,this.viewportScrollArea,this.charMeasure),this.renderer=new _.Renderer(this),this.selectionManager=new C.SelectionManager(this,this.buffer.lines,this.rowContainer,this.charMeasure),this.selectionManager.on("refresh",function(t){r.renderer.refreshSelection(t.start,t.end)}),this.selectionManager.on("newselection",function(t){r.textarea.value=t,r.textarea.focus(),r.textarea.select()}),this.on("scroll",function(){return r.selectionManager.refresh()}),this.viewportElement.addEventListener("scroll",function(){return r.selectionManager.refresh()}),this.refresh(0,this.rows-1),this.initGlobal(),void 0===e){var s="You did not pass the `focus` argument in `Terminal.prototype.open()`.\n";s+="The `focus` argument now defaults to `true` but starting with xterm.js 3.0 ",s+="it will default to `false`.",console.warn(s),e=!0}e&&this.focus(),this.bindMouse(),this.emit("open")},i.loadAddon=function(i,n){return"object"==typeof r&&"object"==typeof e?t("./addons/"+i+"/"+i):(console.error("Cannot load a module without a CommonJS or RequireJS environment."),!1)},i.prototype.updateCharSizeStyles=function(){this.charSizeStyleElement.textContent=".xterm-wide-char{width:"+2*this.charMeasure.width+"px;}.xterm-normal-char{width:"+this.charMeasure.width+"px;}.xterm-rows > 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.length<e;)this.insertRow();for(;this.children.length>e;)(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){t<this.refreshStart&&(this.refreshStart=t),t>this.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);t<this.cols;t+=this.getOption("tabStopWidth"))this.buffer.tabs[t]=!0},i.prototype.prevStop=function(t){for(null==t&&(t=this.buffer.x);!this.buffer.tabs[--t]&&t>0;);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;);return 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];t<this.cols;t++)r[t]=i;this.updateRange(e)}},i.prototype.eraseLeft=function(t,e){var r=this.buffer.lines.get(this.buffer.ybase+e);if(r){var i=[this.eraseAttr()," ",1];for(t++;t--;)r[t]=i;this.updateRange(e)}},i.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var t=1;t<this.rows;t++)this.buffer.lines.push(this.blankLine());this.refresh(0,this.rows-1),this.emit("scroll",this.buffer.ydisp)}},i.prototype.eraseLine=function(t){this.eraseRight(0,t)},i.prototype.blankLine=function(t,e,r){var i=[t?this.eraseAttr():this.defAttr," ",1],n=[],s=0;for(e&&(n.isWrapped=e),r=r||this.cols;s<r;s++)n[s]=i;return n},i.prototype.ch=function(t){return t?[this.eraseAttr()," ",1]:[this.defAttr," ",1]},i.prototype.is=function(t){return 0===(this.termName+"").indexOf(t)},i.prototype.handler=function(t){this.options.disableStdin||(this.selectionManager&&this.selectionManager.hasSelection&&this.selectionManager.clearSelection(),this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),this.emit("data",t))},i.prototype.handleTitle=function(t){this.emit("title",t)},i.prototype.index=function(){++this.buffer.y>this.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=[];++y<e;)p&&p[y].run();y=-1,e=d.length}p=null,m=!1,s(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var h,u,f=t.exports={};!function(){try{h="function"==typeof setTimeout?setTimeout:r}catch(t){h=r}try{u="function"==typeof clearTimeout?clearTimeout:i}catch(t){u=i}}();var p,d=[],m=!1,y=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];d.push(new c(t,e)),1!==d.length||m||n(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=l,f.addListener=l,f.once=l,f.off=l,f.removeListener=l,f.removeAllListeners=l,f.emit=l,f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},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());for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=e.coerce(o[0]),"string"!=typeof o[0]&&(o=["%o"].concat(o));var c=0;o[0]=o[0].replace(/%([a-z%])/g,function(r,i){if("%%"===r)return r;c++;var n=e.formatters[i];if("function"==typeof n){var s=o[c];r=n.call(t,s),o.splice(c,1),c--}return r}),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;n<i;n++)r[n]&&("-"===(t=r[n].replace(/[\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function o(){e.enable("")}function a(t){var r,i;for(r=0,i=e.skips.length;r<i;r++)if(e.skips[r].test(t))return!1;for(r=0,i=e.names.length;r<i;r++)if(e.names[r].test(t))return!0;return!1}function c(t){return t instanceof Error?t.stack||t.message:t}(e=t.exports=n.debug=n).coerce=c,e.disable=o,e.enable=s,e.enabled=a,e.humanize=r(6),e.names=[],e.skips=[],e.formatters={};var l,h=0},function(t,e){function r(t){if(!((t=String(t)).length>1e4)){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(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}var o=1e3,a=60*o,c=60*a,l=24*c,h=365.25*l;t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)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;n<i;n++)r[n]&&("-"===(t=r[n].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function o(){e.enable("")}function a(t){var r,i;for(r=0,i=e.skips.length;r<i;r++)if(e.skips[r].test(t))return!1;for(r=0,i=e.names.length;r<i;r++)if(e.names[r].test(t))return!0;return!1}function c(t){return t instanceof Error?t.stack||t.message:t}(e=t.exports=n).coerce=c,e.disable=o,e.enable=s,e.enabled=a,e.humanize=r(10),e.names=[],e.skips=[],e.formatters={};var l,h=0},function(t,e){function r(t){if(!((t=""+t).length>1e4)){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(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}var o=1e3,a=60*o,c=60*a,l=24*c,h=365.25*l;t.exports=function(t,e){return e=e||{},"string"==typeof t?r(t):e.long?n(t):i(t)}},function(t,e,r){(function(t,r){(function(){function i(t,e){function r(t){if(r[t]!==y)return r[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=r("json-stringify")&&r("json-parse");else{var n,o='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var c=e.stringify,h="function"==typeof c&&_;if(h){(n=function(){return 1}).toJSON=n;try{h="0"===c(0)&&"0"===c(new s)&&'""'==c(new a)&&c(b)===y&&c(y)===y&&c()===y&&"1"===c(n)&&"[1]"==c([n])&&"[null]"==c([y])&&"null"==c(null)&&"[null,null,null]"==c([y,b,null])&&c({a:[n,!0,!1,null,"\0\b\n\f\r\t"]})==o&&"1"===c(null,n)&&"[\n 1,\n 2\n]"==c([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==c(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==c(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==c(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==c(new l(-1))}catch(t){h=!1}}i=h}if("json-parse"==t){var u=e.parse;if("function"==typeof u)try{if(0===u("0")&&!u(!1)){var f=5==(n=u(o)).a.length&&1===n.a[0];if(f){try{f=!u('"\t"')}catch(t){}if(f)try{f=1!==u("01")}catch(t){}if(f)try{f=1!==u("1.")}catch(t){}}}}catch(t){f=!1}i=f}}return r[t]=!!i}t||(t=o.Object()),e||(e=o.Object());var s=t.Number||o.Number,a=t.String||o.String,c=t.Object||o.Object,l=t.Date||o.Date,h=t.SyntaxError||o.SyntaxError,u=t.TypeError||o.TypeError,f=t.Math||o.Math,p=t.JSON||o.JSON;"object"==typeof p&&p&&(e.stringify=p.stringify,e.parse=p.parse);var d,m,y,g=c.prototype,b=g.toString,_=new l(-0xc782b5b800cec);try{_=-109252==_.getUTCFullYear()&&0===_.getUTCMonth()&&1===_.getUTCDate()&&10==_.getUTCHours()&&37==_.getUTCMinutes()&&6==_.getUTCSeconds()&&708==_.getUTCMilliseconds()}catch(t){}if(!r("json")){var v=r("bug-string-char-index");if(!_)var C=f.floor,w=[0,31,59,90,120,151,181,212,243,273,304,334],k=function(t,e){return w[e]+365*(t-1970)+C((t-1969+(e=+(e>1)))/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<i;r++){var o=t.charCodeAt(r);switch(o){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=S[o];break;default:if(o<32){e+="\\u00"+E(2,o.toString(16));break}e+=n?s[r]:t.charAt(r)}}return e+'"'},A=function(t,e,r,i,n,s,o){var a,c,l,h,f,p,g,_,v,w,S,M,L,T,B,R;try{a=e[t]}catch(t){}if("object"==typeof a&&a)if("[object Date]"!=(c=b.call(a))||d.call(a,"toJSON"))"function"==typeof a.toJSON&&("[object Number]"!=c&&"[object String]"!=c&&"[object Array]"!=c||d.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-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;L<T;L++)M=A(L,a,r,i,n,s,o),S.push(M===y?"null":M);R=S.length?n?"[\n"+s+S.join(",\n"+s)+"\n"+B+"]":"["+S.join(",")+"]":"[]"}else m(i||a,function(t){var e=A(t,a,r,i,n,s,o);e!==y&&S.push(x(t)+":"+(n?" ":"")+e)}),R=S.length?n?"{\n"+s+S.join(",\n"+s)+"\n"+B+"}":"{"+S.join(",")+"}":"{}";return o.pop(),R}};e.stringify=function(t,e,r){var i,s,o,a;if(n[typeof e]&&e)if("[object Function]"==(a=b.call(e)))s=e;else if("[object Array]"==a){o={};for(var c,l=0,h=e.length;l<h;c=e[l++],("[object String]"==(a=b.call(c))||"[object Number]"==a)&&(o[c]=1));}if(r)if("[object Number]"==(a=b.call(r))){if((r-=r%1)>0)for(i="",r>10&&(r=10);i.length<r;i+=" ");}else"[object String]"==a&&(i=r.length<=10?r:r.slice(0,10));return A("",(c={},c[""]=t,c),s,o,i,"",[])}}if(!r("json-parse")){var M,L,T=a.fromCharCode,B={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},R=function(){throw M=L=null,h()},P=function(){for(var t,e,r,i,n,s=L,o=s.length;M<o;)switch(n=s.charCodeAt(M)){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=v?s.charAt(M):s[M],M++,t;case 34:for(t="@",M++;M<o;)if((n=s.charCodeAt(M))<32)R();else if(92==n)switch(n=s.charCodeAt(++M)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=B[n],M++;break;case 117:for(e=++M,r=M+4;M<r;M++)(n=s.charCodeAt(M))>=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<o&&(n=s.charCodeAt(M))>=48&&n<=57;M++);if(46==s.charCodeAt(M)){for(r=++M;r<o&&(n=s.charCodeAt(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<o&&(n=s.charCodeAt(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;n<r.length;n++)if((i=r[n])===e||i.fn===e){r.splice(n,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks[t];if(r)for(var i=0,n=(r=r.slice(0)).length;i<n;++i)r[i].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){(function(t){var i=r(15),n=r(16);e.deconstructPacket=function(t){function e(t){if(!t)return t;if(n(t)){var s={_placeholder:!0,num:r.length};return r.push(t),s}if(i(t)){for(var o=new Array(t.length),a=0;a<t.length;a++)o[a]=e(t[a]);return o}if("object"==typeof t&&!(t instanceof Date)){o={};for(var c in t)o[c]=e(t[c]);return o}return t}var r=[],s=t.data,o=t;return o.data=e(s),o.attachments=r.length,{packet:o,buffers:r}},e.reconstructPacket=function(t,e){function r(t){if(t&&t._placeholder)return e[t.num];if(i(t)){for(var n=0;n<t.length;n++)t[n]=r(t[n]);return t}if(t&&"object"==typeof t){for(var s in t)t[s]=r(t[s]);return t}return t}return t.data=r(t.data),t.attachments=void 0,t},e.removeBlobs=function(e,r){function s(e,c,l){if(!e)return e;if(t.Blob&&e instanceof Blob||t.File&&e instanceof File){o++;var h=new FileReader;h.onload=function(){l?l[c]=this.result:a=this.result,--o||r(a)},h.readAsArrayBuffer(e)}else if(i(e))for(var u=0;u<e.length;u++)s(e[u],u,e);else if(e&&"object"==typeof e&&!n(e))for(var f in e)s(e[f],f,e)}var o=0,a=e;s(a),o||r(a)}}).call(e,function(){return this}())},function(t,e){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},function(t,e){(function(e){function r(t){return e.Buffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer}t.exports=r}).call(e,function(){return this}())},function(t,e,r){"use strict";function i(t,e){if(!(this instanceof i))return new i(t,e);t&&"object"===(void 0===t?"undefined":n(t))&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new p({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[],this.encoder=new c.Encoder,this.decoder=new c.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}var n="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},s=r(18),o=r(44),a=r(35),c=r(7),l=r(46),h=r(47),u=r(3)("socket.io-client:manager"),f=r(42),p=r(48),d=Object.prototype.hasOwnProperty;t.exports=i,i.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)d.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},i.prototype.updateSocketIds=function(){for(var t in this.nsps)d.call(this.nsps,t)&&(this.nsps[t].id=this.engine.id)},a(i.prototype),i.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},i.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},i.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},i.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},i.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},i.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},i.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},i.prototype.open=i.prototype.connect=function(t,e){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=s(this.uri,this.opts);var r=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var n=l(r,"open",function(){i.onopen(),t&&t()}),o=l(r,"error",function(e){if(u("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",e),t){var r=new Error("Connection error");r.data=e,t(r)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout;u("connect attempt will timeout after %d",a);var c=setTimeout(function(){u("connect attempt timed out after %d",a),n.destroy(),r.close(),r.emit("error","timeout"),i.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(n),this.subs.push(o),this},i.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(l(t,"data",h(this,"ondata"))),this.subs.push(l(t,"ping",h(this,"onping"))),this.subs.push(l(t,"pong",h(this,"onpong"))),this.subs.push(l(t,"error",h(this,"onerror"))),this.subs.push(l(t,"close",h(this,"onclose"))),this.subs.push(l(this.decoder,"decoded",h(this,"ondecoded")))},i.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},i.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},i.prototype.ondata=function(t){this.decoder.add(t)},i.prototype.ondecoded=function(t){this.emit("packet",t)},i.prototype.onerror=function(t){u("error",t),this.emitAll("error",t)},i.prototype.socket=function(t,e){function r(){~f(n.connecting,i)||n.connecting.push(i)}var i=this.nsps[t];if(!i){i=new o(this,t,e),this.nsps[t]=i;var n=this;i.on("connecting",r),i.on("connect",function(){i.id=n.engine.id}),this.autoConnect&&r()}return i},i.prototype.destroy=function(t){var e=f(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},i.prototype.packet=function(t){u("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var i=0;i<r.length;i++)e.engine.write(r[i],t.options);e.encoding=!1,e.processPacketQueue()}))},i.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!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<t;e++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},i.prototype.close=i.prototype.disconnect=function(){u("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},i.prototype.onclose=function(t){u("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},i.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=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;t<e;t++)this.probe(this.upgrades[t])}},i.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(a('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(u(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else a('packet received with socket readyState "%s"',this.readyState)},i.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},i.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},i.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){a("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},i.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},i.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},i.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(a("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},i.prototype.write=i.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},i.prototype.sendPacket=function(t,e,r,i){if("function"==typeof e&&(i=e,e=void 0),"function"==typeof r&&(i=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var n={type:t,data:e,options:r};this.emit("packetCreate",n),this.writeBuffer.push(n),i&&this.once("flush",i),this.flush()}},i.prototype.close=function(){function t(){i.onClose("forced close"),a("socket closing - telling transport to close"),i.transport.close()}function e(){i.removeListener("upgrade",e),i.removeListener("upgradeError",e),t()}function r(){i.once("upgrade",e),i.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var i=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():t()}):this.upgrading?r():t()}return this},i.prototype.onError=function(t){a("socket error %j",t),i.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},i.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){a('socket close with reason: "%s"',t);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),r.writeBuffer=[],r.prevBufferLen=0}},i.prototype.filterUpgrades=function(t){for(var e=[],r=0,i=t.length;r<i;r++)~c(this.transports,t[r])&&e.push(t[r]);return e}}).call(e,function(){return this}())},function(t,e,r){(function(t){function i(e){var r=!1,i=!1,a=!1!==e.jsonp;if(t.location){var c="https:"===location.protocol,l=location.port;l||(l=c?443:80),r=e.hostname!==location.hostname||l!==e.port,i=e.secure!==c}if(e.xdomain=r,e.xscheme=i,"open"in new n(e)&&!e.forceJSONP)return new s(e);if(!a)throw new Error("JSONP disabled");return new o(e)}var n=r(22),s=r(24),o=r(39),a=r(40);e.polling=i,e.websocket=a}).call(e,function(){return this}())},function(t,e,r){(function(e){var i=r(23);t.exports=function(t){var r=t.xdomain,n=t.xscheme,s=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!r||i))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!n&&s)return new XDomainRequest}catch(t){}if(!r)try{return new(e[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}}).call(e,function(){return this}())},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},function(t,e,r){(function(e){function i(){}function n(t){if(c.call(this,t),this.requestTimeout=t.requestTimeout,e.location){var r="https:"===location.protocol,i=location.port;i||(i=r?443:80),this.xd=t.hostname!==e.location.hostname||i!==t.port,this.xs=t.secure!==r}else this.extraHeaders=t.extraHeaders}function s(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function o(){for(var t in s.requests)s.requests.hasOwnProperty(t)&&s.requests[t].abort()}var a=r(22),c=r(25),l=r(35),h=r(37),u=r(3)("engine.io-client:polling-xhr");t.exports=n,t.exports.Request=s,h(n,c),n.prototype.supportsBinary=!0,n.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new s(t)},n.prototype.doWrite=function(t,e){var r="string"!=typeof t&&void 0!==t,i=this.request({method:"POST",data:t,isBinary:r}),n=this;i.on("success",e),i.on("error",function(t){n.onError("xhr post error",t)}),this.sendXhr=i},n.prototype.doPoll=function(){u("xhr poll");var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},l(s.prototype),s.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var r=this.xhr=new a(t),i=this;try{u("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.extraHeaders){r.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this.extraHeaders[n])}}catch(t){}if(this.supportsBinary&&(r.responseType="arraybuffer"),"POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=!0),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){i.onLoad()},r.onerror=function(){i.onError(r.responseText)}):r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?i.onLoad():setTimeout(function(){i.onError(r.status)},0))},u("xhr data %s",this.data),r.send(this.data)}catch(t){return void setTimeout(function(){i.onError(t)},0)}e.document&&(this.index=s.requestsCount++,s.requests[this.index]=this)},s.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},s.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},s.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},s.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=i:this.xhr.onreadystatechange=i,t)try{this.xhr.abort()}catch(t){}e.document&&delete s.requests[this.index],this.xhr=null}},s.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(t){}if("application/octet-stream"===e)t=this.xhr.response||this.xhr.responseText;else if(this.supportsBinary)try{t=String.fromCharCode.apply(null,new Uint8Array(this.xhr.response))}catch(e){for(var r=new Uint8Array(this.xhr.response),i=[],n=0,s=r.length;n<s;n++)i.push(r[n]);t=String.fromCharCode.apply(null,i)}else t=this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},s.prototype.hasXDR=function(){return void 0!==e.XDomainRequest&&!this.xs&&this.enablesXDR},s.prototype.abort=function(){this.cleanup()},s.requestsCount=0,s.requests={},e.document&&(e.attachEvent?e.attachEvent("onunload",o):e.addEventListener&&e.addEventListener("beforeunload",o,!1))}).call(e,function(){return this}())},function(t,e,r){function i(t){var e=t&&t.forceBase64;h&&!e||(this.supportsBinary=!1),n.call(this,t)}var n=r(26),s=r(36),o=r(27),a=r(37),c=r(38),l=r(3)("engine.io-client:polling");t.exports=i;var h=function(){return null!=new(r(22))({xdomain:!1}).responseType}();a(i,n),i.prototype.name="polling",i.prototype.doOpen=function(){this.poll()},i.prototype.pause=function(t){function e(){l("paused"),r.readyState="paused",t()}var r=this;if(this.readyState="pausing",this.polling||!this.writable){var i=0;this.polling&&(l("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){l("pre-pause polling complete"),--i||e()})),this.writable||(l("we are currently writing - waiting to pause"),i++,this.once("drain",function(){l("pre-pause writing complete"),--i||e()}))}else e()},i.prototype.poll=function(){l("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},i.prototype.onData=function(t){var e=this;l("polling got data %s",t);var r=function(t,r,i){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)};o.decodePayload(t,this.socket.binaryType,r),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():l('ignoring poll - transport state "%s"',this.readyState))},i.prototype.doClose=function(){function t(){l("writing close packet"),e.write([{type:"close"}])}var e=this;"open"===this.readyState?(l("transport open - closing"),t()):(l("transport not open - deferring close"),this.once("open",t))},i.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};o.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,r)})},i.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";return!1!==this.timestampRequests&&(t[this.timestampParam]=c()),this.supportsBinary||t.sid||(t.b64=1),t=s.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(r=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+t}},function(t,e,r){function i(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var n=r(27),s=r(35);t.exports=i,s(i.prototype),i.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},i.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(t){var e=n.decodePacket(t,this.socket.binaryType);this.onPacket(e)},i.prototype.onPacket=function(t){this.emit("packet",t)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,r){(function(t){function i(t,r){return r("b"+e.packets[t.type]+t.data.data)}function n(t,r,i){if(!r)return e.encodeBase64Packet(t,i);var n=t.data,s=new Uint8Array(n),o=new Uint8Array(1+n.byteLength);o[0]=b[t.type];for(var a=0;a<s.length;a++)o[a+1]=s[a];return i(o.buffer)}function s(t,r,i){if(!r)return e.encodeBase64Packet(t,i);var n=new FileReader;return n.onload=function(){t.data=n.result,e.encodePacket(t,r,!0,i)},n.readAsArrayBuffer(t.data)}function o(t,r,i){if(!r)return e.encodeBase64Packet(t,i);if(g)return s(t,r,i);var n=new Uint8Array(1);return n[0]=b[t.type],i(new C([n.buffer,t.data]))}function a(t){try{t=d.decode(t)}catch(t){return!1}return t}function c(t,e,r){for(var i=new Array(t.length),n=p(t.length,r),s=0;s<t.length;s++)!function(t,r,n){e(r,function(e,r){i[t]=r,n(e,i)})}(s,t[s],n)}var l,h=r(28),u=r(29),f=r(30),p=r(31),d=r(32);t&&t.ArrayBuffer&&(l=r(33));var m="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),y="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),g=m||y;e.protocol=3;var b=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},_=h(b),v={type:"error",data:"parser error"},C=r(34);e.encodePacket=function(e,r,s,a){"function"==typeof r&&(a=r,r=!1),"function"==typeof s&&(a=s,s=null);var c=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&c instanceof ArrayBuffer)return n(e,r,a);if(C&&c instanceof t.Blob)return o(e,r,a);if(c&&c.base64)return i(e,a);var l=b[e.type];return void 0!==e.data&&(l+=s?d.encode(String(e.data)):String(e.data)),a(""+l)},e.encodeBase64Packet=function(r,i){var n="b"+e.packets[r.type];if(C&&r.data instanceof t.Blob){var s=new FileReader;return s.onload=function(){var t=s.result.split(",")[1];i(n+t)},s.readAsDataURL(r.data)}var o;try{o=String.fromCharCode.apply(null,new Uint8Array(r.data))}catch(t){for(var a=new Uint8Array(r.data),c=new Array(a.length),l=0;l<a.length;l++)c[l]=a[l];o=String.fromCharCode.apply(null,c)}return n+=t.btoa(o),i(n)},e.decodePacket=function(t,r,i){if(void 0===t)return v;if("string"==typeof t){if("b"==t.charAt(0))return e.decodeBase64Packet(t.substr(1),r);if(i&&!1===(t=a(t)))return v;n=t.charAt(0);return Number(n)==n&&_[n]?t.length>1?{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;c<l;c++){var h=t.charAt(c);if(":"!=h)a+=h;else{if(""==a||a!=(s=Number(a)))return i(v,0,1);if(o=t.substr(c+1,s),a!=o.length)return i(v,0,1);if(o.length){if(n=e.decodePacket(o,r,!0),v.type==n.type&&v.data==n.data)return i(v,0,1);if(!1===i(n,c+s,l))return}c+=s,a=""}}return""!=a?i(v,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){function i(t,r){e.encodePacket(t,!0,!0,function(t){return r(null,t)})}if(!t.length)return r(new ArrayBuffer(0));c(t,i,function(t,e){var i=e.reduce(function(t,e){var r;return r="string"==typeof e?e.length:e.byteLength,t+r.toString().length+r+2},0),n=new Uint8Array(i),s=0;return e.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var i=new Uint8Array(t.length),o=0;o<t.length;o++)i[o]=t.charCodeAt(o);r=i.buffer}n[s++]=e?0:1;for(var a=r.byteLength.toString(),o=0;o<a.length;o++)n[s++]=parseInt(a[o]);n[s++]=255;for(var i=new Uint8Array(r),o=0;o<i.length;o++)n[s++]=i[o]}),r(n.buffer)})},e.encodePayloadAsBlob=function(t,r){function i(t,r){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);t=i.buffer,e[0]=0}for(var s=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),o=new Uint8Array(s.length+1),n=0;n<s.length;n++)o[n]=parseInt(s[n]);if(o[s.length]=255,C){var a=new C([e.buffer,o.buffer,t]);r(null,a)}})}c(t,i,function(t,e){return r(new C(e))})},e.decodePayloadAsBinary=function(t,r,i){"function"==typeof r&&(i=r,r=null);for(var n=t,s=[],o=!1;n.byteLength>0;){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;h<p.length;h++)u+=String.fromCharCode(p[h])}s.push(u),n=f(n,l)}var d=s.length;s.forEach(function(t,n){i(e.decodePacket(t,r,!0),n,d)})}}).call(e,function(){return this}())},function(t,e){t.exports=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var i in t)r.call(t,i)&&e.push(i);return e}},function(t,e,r){(function(e){function i(t){function r(t){if(!t)return!1;if(e.Buffer&&e.Buffer.isBuffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer||e.Blob&&t instanceof Blob||e.File&&t instanceof File)return!0;if(n(t)){for(var i=0;i<t.length;i++)if(r(t[i]))return!0}else if(t&&"object"==typeof t){t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON());for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&r(t[s]))return!0}return!1}return r(t)}var n=r(15);t.exports=i}).call(e,function(){return this}())},function(t,e){t.exports=function(t,e,r){var i=t.byteLength;if(e=e||0,r=r||i,t.slice)return t.slice(e,r);if(e<0&&(e+=i),r<0&&(r+=i),r>i&&(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<r;o++,a++)s[a]=n[o];return s.buffer}},function(t,e){function r(t,e,r){function n(t,i){if(n.count<=0)throw new Error("after called too many times");--n.count,t?(s=!0,e(t),e=r):0!==n.count||s||e(null,i)}var s=!1;return r=r||i,n.count=t,0===t?e():n}function i(){}t.exports=r},function(t,e,r){var i;(function(t,n){!function(s){function o(t){for(var e,r,i=[],n=0,s=t.length;n<s;)(e=t.charCodeAt(n++))>=55296&&e<=56319&&n<s?56320==(64512&(r=t.charCodeAt(n++)))?i.push(((1023&e)<<10)+(1023&r)+65536):(i.push(e),n--):i.push(e);return i}function a(t){for(var e,r=t.length,i=-1,n="";++i<r;)(e=t[i])>65535&&(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<r;)n+=l(e[i]);return n}function u(){if(b>=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<t.length;i++)r[t.charCodeAt(i)]=i;e.encode=function(e){var r,i=new Uint8Array(e),n=i.length,s="";for(r=0;r<n;r+=3)s+=t[i[r]>>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<c;e+=4)i=r[t.charCodeAt(e)],n=r[t.charCodeAt(e+1)],s=r[t.charCodeAt(e+2)],o=r[t.charCodeAt(e+3)],u[l++]=i<<2|n>>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;e<t.length;e++){var r=t[e];if(r.buffer instanceof ArrayBuffer){var i=r.buffer;if(r.byteLength!==i.byteLength){var n=new Uint8Array(r.byteLength);n.set(new Uint8Array(i,r.byteOffset,r.byteLength)),i=n.buffer}t[e]=i}}}function i(t,e){e=e||{};var i=new s;r(t);for(var n=0;n<t.length;n++)i.append(t[n]);return e.type?i.getBlob(e.type):i.getBlob()}function n(t,e){return r(t),new Blob(t,e||{})}var s=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder,o=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),a=o&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),c=s&&s.prototype.append&&s.prototype.getBlob;t.exports=function(){return o?a?e.Blob:n:c?i:void 0}()}).call(e,function(){return this}())},function(t,e,r){function i(t){if(t)return n(t)}function n(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},i.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.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;n<r.length;n++)if((i=r[n])===e||i.fn===e){r.splice(n,1);break}return this},i.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r)for(var i=0,n=(r=r.slice(0)).length;i<n;++i)r[i].apply(this,e);return this},i.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},i.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){e.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},e.decode=function(t){for(var e={},r=t.split("&"),i=0,n=r.length;i<n;i++){var s=r[i].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}},function(t,e){t.exports=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){"use strict";function r(t){var e="";do{e=o[t%a]+e,t=Math.floor(t/a)}while(t>0);return e}function i(t){var e=0;for(h=0;h<t.length;h++)e=e*a+c[t.charAt(h)];return e}function n(){var t=r(+new Date);return t!==s?(l=0,s=t):t+"."+r(l++)}for(var s,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,c={},l=0,h=0;h<a;h++)c[o[h]]=h;n.encode=r,n.decode=i,t.exports=n},function(t,e,r){(function(e){function i(){}function n(t){s.call(this,t),this.query=this.query||{},a||(e.___eio||(e.___eio=[]),a=e.___eio),this.index=a.length;var r=this;a.push(function(t){r.onData(t)}),this.query.j=this.index,e.document&&e.addEventListener&&e.addEventListener("beforeunload",function(){r.script&&(r.script.onerror=i)},!1)}var s=r(25),o=r(37);t.exports=n;var a,c=/\n/g,l=/\\n/g;o(n,s),n.prototype.supportsBinary=!1,n.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),s.prototype.doClose.call(this)},n.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},n.prototype.doWrite=function(t,e){function r(){i(),e()}function i(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(t){n.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+n.iframeId+'">';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;s<a;s++)!function(t){o.encodePacket(t,i.supportsBinary,function(s){if(!i.usingBrowserWebSocket){var o={};t.options&&(o.compress=t.options.compress),i.perMessageDeflate&&("string"==typeof s?e.Buffer.byteLength(s):s.length)<i.perMessageDeflate.threshold&&(o.compress=!1)}try{i.usingBrowserWebSocket?i.ws.send(s):i.ws.send(s,o)}catch(t){h("websocket closed before onclose event")}--n||r()})}(t[s])},i.prototype.onClose=function(){s.prototype.onClose.call(this)},i.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},i.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=l()),this.supportsBinary||(t.b64=1),(t=a.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+t},i.prototype.check=function(){return!(!f||"__initialize"in f&&this.name===i.prototype.name)}}).call(e,function(){return this}())},function(t,e){},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var i=0;i<t.length;++i)if(t[i]===e)return i;return-1}},function(t,e){(function(e){var r=/^[\],:{}\s]*$/,i=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,n=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,s=/(?:^|:|,)(?:\s*\[)+/g,o=/^\s+/,a=/\s+$/;t.exports=function(t){return"string"==typeof t&&t?(t=t.replace(o,"").replace(a,""),e.JSON&&JSON.parse?JSON.parse(t):r.test(t.replace(i,"@").replace(n,"]").replace(s,""))?new Function("return "+t)():void 0):null}}).call(e,function(){return this}())},function(t,e,r){"use strict";function i(t,e,r){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}var n=r(7),s=r(35),o=r(45),a=r(46),c=r(47),l=r(3)("socket.io-client:socket"),h=r(29);t.exports=i;var u={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},f=s.prototype.emit;s(i.prototype),i.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[a(t,"open",c(this,"onopen")),a(t,"packet",c(this,"onpacket")),a(t,"close",c(this,"onclose"))]}},i.prototype.open=i.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},i.prototype.send=function(){var t=o(arguments);return t.unshift("message"),this.emit.apply(this,t),this},i.prototype.emit=function(t){if(u.hasOwnProperty(t))return f.apply(this,arguments),this;var e=o(arguments),r=n.EVENT;h(e)&&(r=n.BINARY_EVENT);var i={type:r,data:e};return i.options={},i.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(l("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),i.id=this.ids++),this.connected?this.packet(i):this.sendBuffer.push(i),delete this.flags,this},i.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},i.prototype.onopen=function(){l("transport is open - connecting"),"/"!==this.nsp&&(this.query?this.packet({type:n.CONNECT,query:this.query}):this.packet({type:n.CONNECT}))},i.prototype.onclose=function(t){l("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},i.prototype.onpacket=function(t){if(t.nsp===this.nsp)switch(t.type){case n.CONNECT:this.onconnect();break;case n.EVENT:case n.BINARY_EVENT:this.onevent(t);break;case n.ACK:case n.BINARY_ACK:this.onack(t);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",t.data)}},i.prototype.onevent=function(t){var e=t.data||[];l("emitting event %j",e),null!=t.id&&(l("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?f.apply(this,e):this.receiveBuffer.push(e)},i.prototype.ack=function(t){var e=this,r=!1;return function(){if(!r){r=!0;var i=o(arguments);l("sending ack %j",i);var s=h(i)?n.BINARY_ACK:n.ACK;e.packet({type:s,id:t,data:i})}}},i.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(l("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):l("bad ack %s",t.id)},i.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},i.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)f.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},i.prototype.ondisconnect=function(){l("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},i.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},i.prototype.close=i.prototype.disconnect=function(){return this.connected&&(l("performing disconnect (%s)",this.nsp),this.packet({type:n.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},i.prototype.compress=function(t){return this.flags=this.flags||{},this.flags.compress=t,this}},function(t,e){function r(t,e){for(var r=[],i=(e=e||0)||0;i<t.length;i++)r[i-e]=t[i];return r}t.exports=r},function(t,e){"use strict";function r(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}t.exports=r},function(t,e){var r=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var i=r.call(arguments,2);return function(){return e.apply(t,i.concat(r.call(arguments)))}}},function(t,e){function r(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&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