
fixes #40 fixes #41 moved /js/client.js to /js/index.js todo: rework build scripts to utilize webpack vs gulp
4 lines
No EOL
197 KiB
JavaScript
4 lines
No EOL
197 KiB
JavaScript
/*! webssh2 2018-02-01 */
|
||
|
||
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 l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}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");r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.MAX_BUFFER_SIZE=4294967295;var n=function(){function t(t,e){this._terminal=t,this._hasScrollback=e,this.clear()}return Object.defineProperty(t.prototype,"lines",{get:function(){return this._lines},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._terminal.rows},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isCursorInViewport",{get:function(){var t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._terminal.rows},enumerable:!0,configurable:!0}),t.prototype._getCorrectBufferLength=function(t){if(!this._hasScrollback)return t;var e=t+this._terminal.options.scrollback;return e>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:e},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._lines=new i.CircularList(this._getCorrectBufferLength(this._terminal.rows)),this.scrollTop=0,this.scrollBottom=this._terminal.rows-1,this.setupTabStops()},t.prototype.resize=function(t,e){var r=this._getCorrectBufferLength(e);if(r>this._lines.maxLength&&(this._lines.maxLength=r),this._lines.length>0){if(this._terminal.cols<t)for(var i=[this._terminal.defAttr," ",1,32],n=0;n<this._lines.length;n++)for(void 0===this._lines.get(n)&&this._lines.set(n,this._terminal.blankLine(void 0,void 0,t));this._lines.get(n).length<t;)this._lines.get(n).push(i);var s=0;if(this._terminal.rows<e)for(o=this._terminal.rows;o<e;o++)this._lines.length<e+this.ybase&&(this.ybase>0&&this._lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this._lines.push(this._terminal.blankLine(void 0,void 0,t)));else for(var o=this._terminal.rows;o>e;o--)this._lines.length>e+this.ybase&&(this._lines.length>this.ybase+this.y+1?this._lines.pop():(this.ybase++,this.ydisp++));if(r<this._lines.maxLength){var a=this._lines.length-r;a>0&&(this._lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0)),this._lines.maxLength=r}this.y>=e&&(this.y=e-1),s&&(this.y+=s),this.x>=t&&(this.x=t-1),this.scrollTop=0}this.scrollBottom=e-1},t.prototype.translateBufferLineToString=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=null);var s="",o=this.lines.get(t);if(!o)return"";for(var a=i,l=n=n||o.length,c=0;c<o.length;c++){var h=o[c];s+=h[r.CHAR_DATA_CHAR_INDEX],0===h[r.CHAR_DATA_WIDTH_INDEX]?(i>=c&&a--,n>=c&&l--):h[r.CHAR_DATA_CHAR_INDEX].length>1&&(i>c&&(a+=h[r.CHAR_DATA_CHAR_INDEX].length-1),n>c&&(l+=h[r.CHAR_DATA_CHAR_INDEX].length-1))}if(e){var u=s.search(/\s+$/);if(-1!==u&&(l=Math.min(l,u)),l<=a)return""}return s.substring(a,l)},t.prototype.setupTabStops=function(t){for(null!=t?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._terminal.cols;t+=this._terminal.options.tabStopWidth)this.tabs[t]=!0},t.prototype.prevStop=function(t){for(null==t&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._terminal.cols?this._terminal.cols-1:t<0?0:t},t.prototype.nextStop=function(t){for(null==t&&(t=this.x);!this.tabs[++t]&&t<this._terminal.cols;);return t>=this._terminal.cols?this._terminal.cols-1:t<0?0:t},t}();r.Buffer=n},{"./utils/CircularList":30}],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,!0),r._normal.fillViewportRows(),r._alt=new n.Buffer(r._terminal,!1),r._activeBuffer=r._normal,r.setupTabStops(),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.prototype.setupTabStops=function(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)},e}(t("./EventEmitter").EventEmitter);r.BufferSet=s},{"./Buffer":1,"./EventEmitter":7}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),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(){c="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);c[t]=e}return c}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]],l=0|t.control,c=null;return function(t){if((t|=0)<32)return 0|l;if(t<127)return 1;var e=c||s();return t<65536?e[t>>4]>>((15&t)<<1)&3:n(t)}}({nul:0,control:0})},{}],4:[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["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},{}],5:[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){if(this.terminal.buffer.isCursorInViewport){var r=Math.ceil(this.terminal.charMeasure.height*this.terminal.options.lineHeight),i=this.terminal.buffer.y*r,n=this.terminal.buffer.x*this.terminal.charMeasure.width;this.compositionView.style.left=n+"px",this.compositionView.style.top=i+"px",this.compositionView.style.height=r+"px",this.compositionView.style.lineHeight=r+"px";var s=this.compositionView.getBoundingClientRect();this.textarea.style.left=n+"px",this.textarea.style.top=i+"px",this.textarea.style.width=s.width+"px",this.textarea.style.height=s.height+"px",this.textarea.style.lineHeight=s.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},{}],6:[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={}))},{}],7:[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);this.off(t,r),e.apply(this,i)}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.prototype.destroy=function(){this._events={}},t}();r.EventEmitter=i},{}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./EscapeSequences"),n=t("./Charsets"),s=t("./Buffer"),o=t("./renderer/Types"),a=t("./CharWidth"),l=function(){function t(t){this._terminal=t}return t.prototype.addChar=function(t,e){if(t>=" "){var r=a.wcwidth(e);this._terminal.charset&&this._terminal.charset[t]&&(t=this._terminal.charset[t]);var i=this._terminal.buffer.y+this._terminal.buffer.ybase;if(!r&&this._terminal.buffer.x)return void(this._terminal.buffer.lines.get(i)[this._terminal.buffer.x-1]&&(this._terminal.buffer.lines.get(i)[this._terminal.buffer.x-1][s.CHAR_DATA_WIDTH_INDEX]?(this._terminal.buffer.lines.get(i)[this._terminal.buffer.x-1][s.CHAR_DATA_CHAR_INDEX]+=t,this._terminal.buffer.lines.get(i)[this._terminal.buffer.x-1][3]=t.charCodeAt(0)):this._terminal.buffer.lines.get(i)[this._terminal.buffer.x-2]&&(this._terminal.buffer.lines.get(i)[this._terminal.buffer.x-2][s.CHAR_DATA_CHAR_INDEX]+=t,this._terminal.buffer.lines.get(i)[this._terminal.buffer.x-2][3]=t.charCodeAt(0)),this._terminal.updateRange(this._terminal.buffer.y)));if(this._terminal.buffer.x+r-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===r)return;if(i=this._terminal.buffer.y+this._terminal.buffer.ybase,this._terminal.insertMode)for(var n=0;n<r;++n)0===this._terminal.buffer.lines.get(this._terminal.buffer.y+this._terminal.buffer.ybase).pop()[s.CHAR_DATA_WIDTH_INDEX]&&this._terminal.buffer.lines.get(i)[this._terminal.cols-2]&&2===this._terminal.buffer.lines.get(i)[this._terminal.cols-2][s.CHAR_DATA_WIDTH_INDEX]&&(this._terminal.buffer.lines.get(i)[this._terminal.cols-2]=[this._terminal.curAttr," ",1," ".charCodeAt(0)]),this._terminal.buffer.lines.get(i).splice(this._terminal.buffer.x,0,[this._terminal.curAttr," ",1," ".charCodeAt(0)]);this._terminal.buffer.lines.get(i)[this._terminal.buffer.x]=[this._terminal.curAttr,t,r,t.charCodeAt(0)],this._terminal.buffer.x++,this._terminal.updateRange(this._terminal.buffer.y),2===r&&(this._terminal.buffer.lines.get(i)[this._terminal.buffer.x]=[this._terminal.curAttr,"",0,void 0],this._terminal.buffer.x++)}},t.prototype.bell=function(){this._terminal.bell()},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.buffer.nextStop()},t.prototype.shiftOut=function(){this._terminal.setgLevel(1)},t.prototype.shiftIn=function(){this._terminal.setgLevel(0)},t.prototype.insertChars=function(t){var e=t[0];e<1&&(e=1);for(var r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=this._terminal.buffer.x,n=[this._terminal.eraseAttr()," ",1,32];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=t[0]-1;e=t.length>=2?t[1]-1:0,r<0?r=0:r>=this._terminal.rows&&(r=this._terminal.rows-1),e<0?e=0:e>=this._terminal.cols&&(e=this._terminal.cols-1),this._terminal.buffer.x=e,this._terminal.buffer.y=r},t.prototype.cursorForwardTab=function(t){for(var e=t[0]||1;e--;)this._terminal.buffer.x=this._terminal.buffer.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=t[0];e<1&&(e=1);for(var r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=this._terminal.rows-1-this._terminal.buffer.scrollBottom,n=this._terminal.rows-1+this._terminal.buffer.ybase-i+1;e--;)this._terminal.buffer.lines.splice(n-1,1),this._terminal.buffer.lines.splice(r,0,this._terminal.blankLine(!0));this._terminal.updateRange(this._terminal.buffer.y),this._terminal.updateRange(this._terminal.buffer.scrollBottom)},t.prototype.deleteLines=function(t){var e=t[0];e<1&&(e=1);var r,i=this._terminal.buffer.y+this._terminal.buffer.ybase;for(r=this._terminal.rows-1-this._terminal.buffer.scrollBottom,r=this._terminal.rows-1+this._terminal.buffer.ybase-r;e--;)this._terminal.buffer.lines.splice(i,1),this._terminal.buffer.lines.splice(r,0,this._terminal.blankLine(!0));this._terminal.updateRange(this._terminal.buffer.y),this._terminal.updateRange(this._terminal.buffer.scrollBottom)},t.prototype.deleteChars=function(t){var e=t[0];e<1&&(e=1);for(var r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=[this._terminal.eraseAttr()," ",1,32];e--;)this._terminal.buffer.lines.get(r).splice(this._terminal.buffer.x,1),this._terminal.buffer.lines.get(r).push(i);this._terminal.updateRange(this._terminal.buffer.y)},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=t[0];e<1&&(e=1);for(var r=this._terminal.buffer.y+this._terminal.buffer.ybase,i=this._terminal.buffer.x,n=[this._terminal.eraseAttr()," ",1,32];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.buffer.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,32];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.selectionManager.setBuffer(this._terminal.buffer),this._terminal.viewport.syncScrollArea(),this._terminal.showCursor();break;case 2004:this._terminal.bracketedPasteMode=!0}}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),this._terminal.refresh(0,this._terminal.rows-1),this._terminal.viewport.syncScrollArea(),this._terminal.showCursor();break;case 2004:this._terminal.bracketedPasteMode=!1}}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=this._terminal.curAttr>>18,n=this._terminal.curAttr>>9&511,s=511&this._terminal.curAttr,a=0;a<r;a++)(e=t[a])>=30&&e<=37?n=e-30:e>=40&&e<=47?s=e-40:e>=90&&e<=97?n=(e+=8)-90:e>=100&&e<=107?s=(e+=8)-100:0===e?(i=this._terminal.defAttr>>18,n=this._terminal.defAttr>>9&511,s=511&this._terminal.defAttr):1===e?i|=o.FLAGS.BOLD:4===e?i|=o.FLAGS.UNDERLINE:5===e?i|=o.FLAGS.BLINK:7===e?i|=o.FLAGS.INVERSE:8===e?i|=o.FLAGS.INVISIBLE:2===e?i|=o.FLAGS.DIM:22===e?(i&=~o.FLAGS.BOLD,i&=~o.FLAGS.DIM):24===e?i&=~o.FLAGS.UNDERLINE:25===e?i&=~o.FLAGS.BLINK:27===e?i&=~o.FLAGS.INVERSE:28===e?i&=~o.FLAGS.INVISIBLE:39===e?n=this._terminal.defAttr>>9&511:49===e?s=511&this._terminal.defAttr:38===e?2===t[a+1]?(a+=2,-1===(n=this._terminal.matchColor(255&t[a],255&t[a+1],255&t[a+2]))&&(n=511),a+=2):5===t[a+1]&&(n=e=255&t[a+=2]):48===e?2===t[a+1]?(a+=2,-1===(s=this._terminal.matchColor(255&t[a],255&t[a+1],255&t[a+2]))&&(s=511),a+=2):5===t[a+1]&&(s=e=255&t[a+=2]):100===e?(n=this._terminal.defAttr>>9&511,s=511&this._terminal.defAttr):this._terminal.error("Unknown SGR attribute: %d.",e);this._terminal.curAttr=i<<18|n<<9|s}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=l},{"./Buffer":1,"./CharWidth":3,"./Charsets":4,"./EscapeSequences":6,"./renderer/Types":27}],9:[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("./Types"),s=t("./input/MouseZoneManager"),o=t("./EventEmitter"),a=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\\.\\-%]+)"),l=0,c=function(t){function e(e){var r=t.call(this)||this;return r._terminal=e,r._linkMatchers=[],r._nextLinkMatcherId=l,r._rowsToLinkify={start:null,end:null},r.registerLinkMatcher(a,null,{matchIndex:1}),r}return i(e,t),e.prototype.attachToDom=function(t){this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,r){var i=this;this._mouseZoneManager&&(this._rowsToLinkify.start?(this._rowsToLinkify.start=this._rowsToLinkify.start<t?this._rowsToLinkify.start:t,this._rowsToLinkify.end=this._rowsToLinkify.end>r?this._rowsToLinkify.end:r):(this._rowsToLinkify.start=t,this._rowsToLinkify.end=r),this._mouseZoneManager.clearAll(t,r),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return i._linkifyRows()},e.TIME_BEFORE_LINKIFY))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=null;for(var t=this._rowsToLinkify.start;t<=this._rowsToLinkify.end;t++)this._linkifyRow(t);this._rowsToLinkify.start=null,this._rowsToLinkify.end=null},e.prototype.setHypertextLinkHandler=function(t){this._linkMatchers[l].handler=t},e.prototype.setHypertextValidationCallback=function(t){this._linkMatchers[l].validationCallback=t},e.prototype.registerLinkMatcher=function(t,e,r){if(void 0===r&&(r={}),this._nextLinkMatcherId!==l&&!e)throw new Error("handler must be defined");var i={id:this._nextLinkMatcherId++,regex:t,handler:e,matchIndex:r.matchIndex,validationCallback:r.validationCallback,hoverTooltipCallback:r.tooltipCallback,hoverLeaveCallback:r.leaveCallback,priority:r.priority||0};return this._addLinkMatcherToList(i),i.id},e.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)},e.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},e.prototype._linkifyRow=function(t){var e=this._terminal.buffer.ydisp+t;if(!(e>=this._terminal.buffer.lines.length))for(var r=this._terminal.buffer.translateBufferLineToString(e,!1),i=0;i<this._linkMatchers.length;i++)this._doLinkifyRow(t,r,this._linkMatchers[i])},e.prototype._doLinkifyRow=function(t,e,r,i){var n=this;void 0===i&&(i=0);r.id;var s=e.match(r.regex);if(s&&0!==s.length){var o=s["number"!=typeof r.matchIndex?0:r.matchIndex],a=e.indexOf(o);r.validationCallback?r.validationCallback(o,function(e){n._rowsTimeoutId||e&&n._addLink(i+a,t,o,r)}):this._addLink(i+a,t,o,r);var l=a+o.length,c=e.substr(l);c.length>0&&this._doLinkifyRow(t,c,r,i+l)}},e.prototype._addLink=function(t,e,r,i){var o=this;this._mouseZoneManager.add(new s.MouseZone(t+1,t+1+r.length,e+1,function(t){if(i.handler)return i.handler(t,r);window.open(r,"_blank")},function(i){o.emit(n.LinkHoverEventTypes.HOVER,{x:t,y:e,length:r.length}),o._terminal.element.style.cursor="pointer"},function(s){o.emit(n.LinkHoverEventTypes.TOOLTIP,{x:t,y:e,length:r.length}),i.hoverTooltipCallback&&i.hoverTooltipCallback(s,r)},function(){o.emit(n.LinkHoverEventTypes.LEAVE,{x:t,y:e,length:r.length}),o._terminal.element.style.cursor="",i.hoverLeaveCallback&&i.hoverLeaveCallback()}))},e.TIME_BEFORE_LINKIFY=200,e}(o.EventEmitter);r.Linkifier=c},{"./EventEmitter":7,"./Types":14,"./input/MouseZoneManager":17}],10:[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(c.ESCAPED)};var o={};o["["]=function(t,e){e.params=[],e.currentParam=0,t.setState(c.CSI_PARAM)},o["]"]=function(t,e){e.params=[],e.currentParam=0,t.setState(c.OSC)},o.P=function(t,e){e.params=[],e.currentParam=0,t.setState(c.DCS)},o._=function(t,e){t.setState(c.IGNORE)},o["^"]=function(t,e){t.setState(c.IGNORE)},o.c=function(t,e){e.reset()},o.E=function(t,e){e.buffer.x=0,e.index(),t.setState(c.NORMAL)},o.D=function(t,e){e.index(),t.setState(c.NORMAL)},o.M=function(t,e){e.reverseIndex(),t.setState(c.NORMAL)},o["%"]=function(t,e){e.setgLevel(0),e.setgCharset(0,n.DEFAULT_CHARSET),t.setState(c.NORMAL),t.skipNextChar()},o[i.C0.CAN]=function(t){return t.setState(c.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(c.NORMAL)};var l={};l["@"]=function(t,e,r){return t.insertChars(e)},l.A=function(t,e,r){return t.cursorUp(e)},l.B=function(t,e,r){return t.cursorDown(e)},l.C=function(t,e,r){return t.cursorForward(e)},l.D=function(t,e,r){return t.cursorBackward(e)},l.E=function(t,e,r){return t.cursorNextLine(e)},l.F=function(t,e,r){return t.cursorPrecedingLine(e)},l.G=function(t,e,r){return t.cursorCharAbsolute(e)},l.H=function(t,e,r){return t.cursorPosition(e)},l.I=function(t,e,r){return t.cursorForwardTab(e)},l.J=function(t,e,r){return t.eraseInDisplay(e)},l.K=function(t,e,r){return t.eraseInLine(e)},l.L=function(t,e,r){return t.insertLines(e)},l.M=function(t,e,r){return t.deleteLines(e)},l.P=function(t,e,r){return t.deleteChars(e)},l.S=function(t,e,r){return t.scrollUp(e)},l.T=function(t,e,r){e.length<2&&!r&&t.scrollDown(e)},l.X=function(t,e,r){return t.eraseChars(e)},l.Z=function(t,e,r){return t.cursorBackwardTab(e)},l["`"]=function(t,e,r){return t.charPosAbsolute(e)},l.a=function(t,e,r){return t.HPositionRelative(e)},l.b=function(t,e,r){return t.repeatPrecedingCharacter(e)},l.c=function(t,e,r){return t.sendDeviceAttributes(e)},l.d=function(t,e,r){return t.linePosAbsolute(e)},l.e=function(t,e,r){return t.VPositionRelative(e)},l.f=function(t,e,r){return t.HVPosition(e)},l.g=function(t,e,r){return t.tabClear(e)},l.h=function(t,e,r){return t.setMode(e)},l.l=function(t,e,r){return t.resetMode(e)},l.m=function(t,e,r){return t.charAttributes(e)},l.n=function(t,e,r){return t.deviceStatus(e)},l.p=function(t,e,r){switch(r){case"!":t.softReset(e)}},l.q=function(t,e,r,i){" "===i&&t.setCursorStyle(e)},l.r=function(t,e){return t.setScrollRegion(e)},l.s=function(t,e){return t.saveCursor(e)},l.u=function(t,e){return t.restoreCursor(e)},l[i.C0.CAN]=function(t,e,r,i,n){return n.setState(c.NORMAL)};var c;!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"}(c=r.ParserState||(r.ParserState={}));var h=function(){function t(t,e){this._inputHandler=t,this._terminal=e,this._state=c.NORMAL}return t.prototype.parse=function(t){var e,r,h,u,f=t.length,p=this._terminal.buffer.x,d=this._terminal.buffer.y;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 c.NORMAL:r in s?s[r](this,this._inputHandler):this._inputHandler.addChar(r,h);break;case c.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=c.CHARSET;break;case"/":this._terminal.gcharset=3,this._state=c.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=c.NORMAL;break;case"8":this._inputHandler.restoreCursor(),this._state=c.NORMAL;break;case"#":this._state=c.NORMAL,this._position++;break;case"H":this._terminal.tabSet(),this._state=c.NORMAL;break;case"=":this._terminal.log("Serial port requested application keypad."),this._terminal.applicationKeypad=!0,this._terminal.viewport&&this._terminal.viewport.syncScrollArea(),this._state=c.NORMAL;break;case">":this._terminal.log("Switching back to normal keypad."),this._terminal.applicationKeypad=!1,this._terminal.viewport&&this._terminal.viewport.syncScrollArea(),this._state=c.NORMAL;break;default:this._state=c.NORMAL,this._terminal.error("Unknown ESC control: %s.",r)}break;case c.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=c.NORMAL;break;case c.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=c.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 c.CSI_PARAM:if(r in a){a[r](this);break}this.finalizeParam(),this._state=c.CSI;case c.CSI:r in l?(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),l[r](this._inputHandler,this._terminal.params,this._terminal.prefix,this._terminal.postfix,this)):this._terminal.error("Unknown CSI code: %s.",r),this._state=c.NORMAL,this._terminal.prefix="",this._terminal.postfix="";break;case c.DCS:if(r===i.C0.ESC||r===i.C0.BEL){r===i.C0.ESC&&this._position++;var m=void 0,_=void 0;switch(this._terminal.prefix){case"":break;case"$q":switch(m=this._terminal.currentParam,_=!1,m){case'"q':m='0"q';break;case'"p':m='61"p';break;case"r":m=this._terminal.buffer.scrollTop+1+";"+(this._terminal.buffer.scrollBottom+1)+"r";break;case"m":m="0m";break;default:this._terminal.error("Unknown DCS Pt: %s.",m),m=""}this._terminal.send(i.C0.ESC+"P"+ +_+"$r"+m+i.C0.ESC+"\\");break;case"+p":break;case"+q":m=this._terminal.currentParam,_=!1,this._terminal.send(i.C0.ESC+"P"+ +_+"+r"+m+i.C0.ESC+"\\");break;default:this._terminal.error("Unknown DCS prefix: %s.",this._terminal.prefix)}this._terminal.currentParam=0,this._terminal.prefix="",this._state=c.NORMAL}else this._terminal.currentParam?this._terminal.currentParam+=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 c.IGNORE:r!==i.C0.ESC&&r!==i.C0.BEL||(r===i.C0.ESC&&this._position++,this._state=c.NORMAL)}}return this._terminal.buffer.x===p&&this._terminal.buffer.y===d||this._terminal.emit("cursormove"),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":4,"./EscapeSequences":6}],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/MouseHelper"),o=t("./utils/Browser"),a=t("./EventEmitter"),l=t("./SelectionModel"),c=t("./Buffer"),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){var s=t.call(this)||this;return s._terminal=e,s._buffer=r,s._charMeasure=i,s._enabled=!0,s._initListeners(),s.enable(),s._model=new l.SelectionModel(e),s._activeSelectionMode=n.NORMAL,s}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._buffer.lines.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(this._buffer.translateBufferLineToString(t[1],!0,t[0],r));for(var n=t[1]+1;n<=e[1]-1;n++){var s=this._buffer.lines.get(n),a=this._buffer.translateBufferLineToString(n,!0);s.isWrapped?i[i.length-1]+=a:i.push(a)}if(t[1]!==e[1]){var s=this._buffer.lines.get(e[1]),a=this._buffer.translateBufferLineToString(e[1],!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(),this._terminal.emit("selection")},e.prototype._onTrim=function(t){this._model.onTrim(t)&&this.refresh()},e.prototype._getMouseBufferCoords=function(t){var e=this._terminal.mouseHelper.getCoords(t,this._terminal.element,this._charMeasure,this._terminal.options.lineHeight,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.MouseHelper.getCoordsRelativeToElement(t,this._terminal.element)[1],r=this._terminal.rows*Math.ceil(this._charMeasure.height*this._terminal.options.lineHeight);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.shouldForceSelection=function(t){return o.isMac?t.altKey:t.shiftKey},e.prototype.onMouseDown=function(t){if((2!==t.button||!this.hasSelection)&&0===t.button){if(!this._enabled){if(!this.shouldForceSelection(t))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._terminal.element.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._terminal.element.ownerDocument.addEventListener("mouseup",this._mouseUpListener),this._dragScrollIntervalTimer=setInterval(function(){return t._dragScroll()},50)},e.prototype._removeMouseDownListeners=function(){this._terminal.element.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._terminal.element.ownerDocument.removeEventListener("mouseup",this._mouseUpListener),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=null},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.lines.get(this._model.selectionStart[1]);e&&(e.length>=this._model.selectionStart[0]||0===e[this._model.selectionStart[0]][c.CHAR_DATA_WIDTH_INDEX]&&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){t.stopImmediatePropagation();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:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]<this._buffer.lines.length){var r=this._buffer.lines.get(this._model.selectionEnd[1])[this._model.selectionEnd[0]];r&&0===r[c.CHAR_DATA_WIDTH_INDEX]&&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.scrollLines(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(),this.hasSelection&&this._terminal.emit("selection")},e.prototype._convertViewportColToCharacterIndex=function(t,e){for(var r=e[0],i=0;e[0]>=i;i++){var n=t[i];0===n[c.CHAR_DATA_WIDTH_INDEX]?r--:n[c.CHAR_DATA_CHAR_INDEX].length>1&&e[0]!==i&&(r+=n[c.CHAR_DATA_CHAR_INDEX].length-1)}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.lines.get(t[1]);if(!e)return null;var r=this._buffer.translateBufferLineToString(t[1],!1),i=this._convertViewportColToCharacterIndex(e,t),n=i,s=t[0]-i,o=0,a=0,l=0,h=0;if(" "===r.charAt(i)){for(;i>0&&" "===r.charAt(i-1);)i--;for(;n<r.length&&" "===r.charAt(n+1);)n++}else{var u=t[0],f=t[0];for(0===e[u][c.CHAR_DATA_WIDTH_INDEX]&&(o++,u--),2===e[f][c.CHAR_DATA_WIDTH_INDEX]&&(a++,f++),e[f][c.CHAR_DATA_CHAR_INDEX].length>1&&(h+=e[f][c.CHAR_DATA_CHAR_INDEX].length-1,n+=e[f][c.CHAR_DATA_CHAR_INDEX].length-1);u>0&&i>0&&!this._isCharWordSeparator(e[u-1]);)0===(p=e[u-1])[c.CHAR_DATA_WIDTH_INDEX]?(o++,u--):p[c.CHAR_DATA_CHAR_INDEX].length>1&&(l+=p[c.CHAR_DATA_CHAR_INDEX].length-1,i-=p[c.CHAR_DATA_CHAR_INDEX].length-1),i--,u--;for(;f<e.length&&n+1<r.length&&!this._isCharWordSeparator(e[f+1]);){var p=e[f+1];2===p[c.CHAR_DATA_WIDTH_INDEX]?(a++,f++):p[c.CHAR_DATA_CHAR_INDEX].length>1&&(h+=p[c.CHAR_DATA_CHAR_INDEX].length-1,n+=p[c.CHAR_DATA_CHAR_INDEX].length-1),n++,f++}}return n++,{start:i+s-o+l,length:Math.min(this._terminal.cols,n-i+o+a-l-h)}},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 0!==t[c.CHAR_DATA_WIDTH_INDEX]&&" ()[]{}'\"".indexOf(t[c.CHAR_DATA_CHAR_INDEX])>=0},e.prototype._selectLineAt=function(t){this._model.selectionStart=[0,t],this._model.selectionStartLength=this._terminal.cols},e}(a.EventEmitter);r.SelectionManager=f},{"./Buffer":1,"./EventEmitter":7,"./SelectionModel":12,"./utils/Browser":28,"./utils/MouseHelper":32}],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||!e)&&(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";function i(t,e,r,i){void 0===i&&(i=!1),t.removeEventListener(e,r,i)}function n(t,e){var r=t.isMac&&e.altKey&&!e.ctrlKey&&!e.metaKey||t.isMSWindows&&e.altKey&&e.ctrlKey&&!e.metaKey;return"keypress"===e.type?r:r&&(!e.keyCode||e.keyCode>47)}function s(t){return 16===t.keyCode||17===t.keyCode||18===t.keyCode}function o(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)}function a(t,e,r){var i=t<<16|e<<8|r;if(null!=D[i])return D[i];for(var n,s,a,l,c,h=1/0,u=-1,f=0;f<B.length;f++){if(n=B[f],s=n[0],a=n[1],l=n[2],0===(c=o(t,e,r,s,a,l))){u=f;break}c<h&&(h=c,u=f)}return D[i]=u}var l=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 c=t("./BufferSet"),h=t("./Buffer"),u=t("./CompositionHelper"),f=t("./EventEmitter"),p=t("./Viewport"),d=t("./handlers/Clipboard"),m=t("./EscapeSequences"),_=t("./InputHandler"),y=t("./Parser"),g=t("./renderer/Renderer"),b=t("./Linkifier"),v=t("./SelectionManager"),C=t("./utils/CharMeasure"),w=t("./utils/Browser"),A=t("./utils/MouseHelper"),S=t("./utils/Sounds"),k=t("./renderer/ColorManager"),x=t("./input/MouseZoneManager"),E=t("./renderer/CharAtlas"),L="undefined"!=typeof window?window.document:null,T={cols:80,rows:24,convertEol:!1,termName:"xterm",cursorBlink:!1,cursorStyle:"block",bellSound:S.BellSound,bellStyle:"none",enableBold:!0,fontFamily:"courier-new, courier, monospace",fontSize:15,lineHeight:1,letterSpacing:0,scrollback:1e3,screenKeys:!1,debug:!1,cancelEvents:!1,disableStdin:!1,useFlowControl:!1,tabStopWidth:8,theme:null},R=function(t){function e(e){void 0===e&&(e={});var r=t.call(this)||this;return r.browser=w,r.options=e,r.setup(),r}return l(e,t),e.prototype.setup=function(){var t=this;Object.keys(T).forEach(function(e){null==t.options[e]&&(t.options[e]=T[e]),t[e]=t.options[e]}),this.parent=L?L.body:null,this.cols=this.options.cols,this.rows=this.options.rows,this.options.handler&&this.on("data",this.options.handler),this.cursorState=0,this.cursorHidden=!1,this.sendDataQueue="",this.customKeyEventHandler=null,this.applicationKeypad=!1,this.applicationCursor=!1,this.originMode=!1,this.insertMode=!1,this.wraparoundMode=!0,this.bracketedPasteMode=!1,this.charset=null,this.gcharset=null,this.glevel=0,this.charsets=[null],this.readable=!0,this.writable=!0,this.defAttr=131840,this.curAttr=131840,this.params=[],this.currentParam=0,this.prefix="",this.postfix="",this.writeBuffer=[],this.writeInProgress=!1,this.xoffSentToCatchUp=!1,this.writeStopped=!1,this.surrogate_high="",this.userScrolling=!1,this.inputHandler=new _.InputHandler(this),this.parser=new y.Parser(this.inputHandler,this),this.renderer=this.renderer||null,this.selectionManager=this.selectionManager||null,this.linkifier=this.linkifier||new b.Linkifier(this),this._mouseZoneManager=this._mouseZoneManager||null,this.buffers=new c.BufferSet(this),this.buffer=this.buffers.active,this.buffers.on("activate",function(e){t.buffer=e}),this.selectionManager&&this.selectionManager.setBuffer(this.buffer)},e.prototype.eraseAttr=function(){return-512&this.defAttr|511&this.curAttr},e.prototype.focus=function(){this.textarea&&this.textarea.focus()},Object.defineProperty(e.prototype,"isFocused",{get:function(){return L.activeElement===this.textarea},enumerable:!0,configurable:!0}),e.prototype.getOption=function(t){if(!(t in T))throw new Error('No option with key "'+t+'"');return void 0!==this.options[t]?this.options[t]:this[t]},e.prototype.setOption=function(t,e){if(!(t in T))throw new Error('No option with key "'+t+'"');switch(t){case"bellStyle":e||(e="none");break;case"cursorStyle":e||(e="block");break;case"lineHeight":if(e<1)return void console.warn(t+" cannot be less than 1, value: "+e);case"tabStopWidth":if(e<1)return void console.warn(t+" cannot be less than 1, value: "+e);break;case"theme":if(this.renderer)return void this._setTheme(e);break;case"scrollback":if((e=Math.min(e,h.MAX_BUFFER_SIZE))<0)return void console.warn(t+" cannot be less than 0, value: "+e);if(this.options[t]!==e){var r=this.rows+e;if(this.buffer.lines.length>r){var i=this.buffer.lines.length-r,n=this.buffer.ydisp-i<0;this.buffer.lines.trimStart(i),this.buffer.ybase=Math.max(this.buffer.ybase-i,0),this.buffer.ydisp=Math.max(this.buffer.ydisp-i,0),n&&this.refresh(0,this.rows-1)}}}switch(this[t]=e,this.options[t]=e,t){case"fontFamily":case"fontSize":this.renderer.clear(),this.charMeasure.measure(this.options);break;case"enableBold":case"letterSpacing":case"lineHeight":this.renderer.clear(),this.renderer.onResize(this.cols,this.rows,!1),this.refresh(0,this.rows-1);case"scrollback":this.buffers.resize(this.cols,this.rows),this.viewport.syncScrollArea();break;case"tabStopWidth":this.buffers.setupTabStops();break;case"bellSound":case"bellStyle":this.syncBellSound()}this.renderer&&this.renderer.onOptionsChanged()},e.prototype._onTextAreaFocus=function(){this.sendFocus&&this.send(m.C0.ESC+"[I"),this.element.classList.add("focus"),this.showCursor(),this.emit("focus")},e.prototype.blur=function(){return this.textarea.blur()},e.prototype._onTextAreaBlur=function(){this.refresh(this.buffer.y,this.buffer.y),this.sendFocus&&this.send(m.C0.ESC+"[O"),this.element.classList.remove("focus"),this.emit("blur")},e.prototype.initGlobal=function(){var t=this;this.bindKeys(),M(this.element,"copy",function(e){t.hasSelection()&&d.copyHandler(e,t,t.selectionManager)});var e=function(e){return d.pasteHandler(e,t)};M(this.textarea,"paste",e),M(this.element,"paste",e),w.isFirefox?M(this.element,"mousedown",function(e){2===e.button&&d.rightClickHandler(e,t.textarea,t.selectionManager)}):M(this.element,"contextmenu",function(e){d.rightClickHandler(e,t.textarea,t.selectionManager)}),w.isLinux&&M(this.element,"auxclick",function(e){1===e.button&&d.moveTextAreaUnderMouseCursor(e,t.textarea)})},e.prototype.bindKeys=function(){var t=this,e=this;M(this.element,"keydown",function(t){L.activeElement===this&&e._keyDown(t)},!0),M(this.element,"keypress",function(t){L.activeElement===this&&e._keyPress(t)},!0),M(this.element,"keyup",function(e){s(e)||t.focus()},!0),M(this.textarea,"keydown",function(e){t._keyDown(e)},!0),M(this.textarea,"keypress",function(e){t._keyPress(e),t.textarea.value=""},!0),M(this.textarea,"compositionstart",function(){return t.compositionHelper.compositionstart()}),M(this.textarea,"compositionupdate",function(e){return t.compositionHelper.compositionupdate(e)}),M(this.textarea,"compositionend",function(){return t.compositionHelper.compositionend()}),this.on("refresh",function(){return t.compositionHelper.updateCompositionElements()}),this.on("refresh",function(e){return t.queueLinkification(e.start,e.end)})},e.prototype.open=function(t){var e=this;if(this.parent=t||this.parent,!this.parent)throw new Error("Terminal requires a parent element.");this.context=this.parent.ownerDocument.defaultView,this.document=this.parent.ownerDocument,this.body=this.document.body,E.initialize(this.document),this.element=this.document.createElement("div"),this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),this.parent.appendChild(this.element);var r=L.createDocumentFragment();this.viewportElement=L.createElement("div"),this.viewportElement.classList.add("xterm-viewport"),r.appendChild(this.viewportElement),this.viewportScrollArea=L.createElement("div"),this.viewportScrollArea.classList.add("xterm-scroll-area"),this.viewportElement.appendChild(this.viewportScrollArea),this._mouseZoneManager=new x.MouseZoneManager(this),this.on("scroll",function(){return e._mouseZoneManager.clearAll()}),this.linkifier.attachToDom(this._mouseZoneManager),this.helperContainer=L.createElement("div"),this.helperContainer.classList.add("xterm-helpers"),r.appendChild(this.helperContainer),this.textarea=L.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.textarea.addEventListener("focus",function(){return e._onTextAreaFocus()}),this.textarea.addEventListener("blur",function(){return e._onTextAreaBlur()}),this.helperContainer.appendChild(this.textarea),this.compositionView=L.createElement("div"),this.compositionView.classList.add("composition-view"),this.compositionHelper=new u.CompositionHelper(this.textarea,this.compositionView,this),this.helperContainer.appendChild(this.compositionView),this.charSizeStyleElement=L.createElement("style"),this.helperContainer.appendChild(this.charSizeStyleElement),this.charMeasure=new C.CharMeasure(L,this.helperContainer),this.syncBellSound(),this.element.appendChild(r),this.renderer=new g.Renderer(this,this.options.theme),this.options.theme=null,this.viewport=new p.Viewport(this,this.viewportElement,this.viewportScrollArea,this.charMeasure),this.viewport.onThemeChanged(this.renderer.colorManager.colors),this.on("cursormove",function(){return e.renderer.onCursorMove()}),this.on("resize",function(){return e.renderer.onResize(e.cols,e.rows,!1)}),this.on("blur",function(){return e.renderer.onBlur()}),this.on("focus",function(){return e.renderer.onFocus()}),window.addEventListener("resize",function(){return e.renderer.onWindowResize(window.devicePixelRatio)}),this.charMeasure.on("charsizechanged",function(){return e.renderer.onResize(e.cols,e.rows,!0)}),this.renderer.on("resize",function(t){return e.viewport.syncScrollArea()}),this.selectionManager=new v.SelectionManager(this,this.buffer,this.charMeasure),this.element.addEventListener("mousedown",function(t){return e.selectionManager.onMouseDown(t)}),this.selectionManager.on("refresh",function(t){return e.renderer.onSelectionChanged(t.start,t.end)}),this.selectionManager.on("newselection",function(t){e.textarea.value=t,e.textarea.focus(),e.textarea.select()}),this.on("scroll",function(){e.viewport.syncScrollArea(),e.selectionManager.refresh()}),this.viewportElement.addEventListener("scroll",function(){return e.selectionManager.refresh()}),this.mouseHelper=new A.MouseHelper(this.renderer),this.charMeasure.measure(this.options),this.refresh(0,this.rows-1),this.initGlobal(),this.bindMouse()},e.prototype._setTheme=function(t){var e=this.renderer.setTheme(t);this.viewport&&this.viewport.onThemeChanged(e)},e.applyAddon=function(t){t.apply(e)},e.prototype.bindMouse=function(){function t(t){var e,r;if(e=s(t),r=l.mouseHelper.getRawByteCoords(t,l.element,l.charMeasure,l.options.lineHeight,l.cols,l.rows))switch(n(e,r),t.overrideType||t.type){case"mousedown":c=e;break;case"mouseup":c=32}}function e(t){var e=c,r=l.mouseHelper.getRawByteCoords(t,l.element,l.charMeasure,l.options.lineHeight,l.cols,l.rows);r&&n(e+=32,r)}function r(t,e){if(l.utfMouse){if(2047===e)return void 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 void t.push(0);e>127&&(e=127),t.push(e)}}function n(t,e){if(l.vt300Mouse){t&=3,e.x-=32,e.y-=32;var i=m.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 l.send(i)}if(l.decLocator)return 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 l.send(m.C0.ESC+"["+t+";"+(3===t?4:0)+";"+e.y+";"+e.x+";"+e.page||"0&w");if(l.urxvtMouse)return e.x-=32,e.y-=32,e.x++,e.y++,void l.send(m.C0.ESC+"["+t+";"+e.x+";"+e.y+"M");if(l.sgrMouse)return e.x-=32,e.y-=32,void l.send(m.C0.ESC+"[<"+((3==(3&t)?-4&t:t)-32)+";"+e.x+";"+e.y+(3==(3&t)?"m":"M"));var n=[];r(n,t),r(n,e.x),r(n,e.y),l.send(m.C0.ESC+"[M"+String.fromCharCode.apply(String,n))}function s(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,w.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,l.vt200Mouse?s&=n:l.normalMouse||(s=0),e=32+(s<<2)+e}var o=this,a=this.element,l=this,c=32;M(a,"mousedown",function(r){if(r.preventDefault(),o.focus(),o.mouseEvents&&!o.selectionManager.shouldForceSelection(r)){if(t(r),o.vt200Mouse)return r.overrideType="mouseup",t(r),o.cancel(r);if(o.normalMouse&&M(o.document,"mousemove",e),!o.x10Mouse){var n=function(r){return t(r),o.normalMouse&&i(o.document,"mousemove",e),i(o.document,"mouseup",n),o.cancel(r)};M(o.document,"mouseup",n)}return o.cancel(r)}}),M(a,"wheel",function(e){o.mouseEvents&&(o.x10Mouse||o.vt300Mouse||o.decLocator||(t(e),e.preventDefault()))}),M(a,"wheel",function(t){if(!o.mouseEvents)return o.viewport.onWheel(t),o.cancel(t)}),M(a,"touchstart",function(t){if(!o.mouseEvents)return o.viewport.onTouchStart(t),o.cancel(t)}),M(a,"touchmove",function(t){if(!o.mouseEvents)return o.viewport.onTouchMove(t),o.cancel(t)})},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.readable=!1,this.writable=!1,this.handler=function(){},this.write=function(){},this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},e.prototype.refresh=function(t,e){this.renderer&&this.renderer.queueRefresh(t,e)},e.prototype.queueLinkification=function(t,e){this.linkifier&&this.linkifier.linkifyRows(t,e)},e.prototype.showCursor=function(){this.cursorState||(this.cursorState=1,this.refresh(this.buffer.y,this.buffer.y))},e.prototype.scroll=function(t){var e=this.blankLine(void 0,t),r=this.buffer.ybase+this.buffer.scrollTop,i=this.buffer.ybase+this.buffer.scrollBottom;if(0===this.buffer.scrollTop){var n=this.buffer.lines.length===this.buffer.lines.maxLength;i===this.buffer.lines.length-1?this.buffer.lines.push(e):this.buffer.lines.splice(i+1,0,e),n?this.userScrolling&&(this.buffer.ydisp=Math.max(this.buffer.ydisp-1,0)):(this.buffer.ybase++,this.userScrolling||this.buffer.ydisp++)}else{var s=i-r+1;this.buffer.lines.shiftElements(r+1,s-1,-1),this.buffer.lines.set(i,e)}this.userScrolling||(this.buffer.ydisp=this.buffer.ybase),this.updateRange(this.buffer.scrollTop),this.updateRange(this.buffer.scrollBottom),this.emit("scroll",this.buffer.ydisp)},e.prototype.scrollLines=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))},e.prototype.scrollPages=function(t){this.scrollLines(t*(this.rows-1))},e.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)},e.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)},e.prototype.write=function(t){var e=this;this.writeBuffer.push(t),this.options.useFlowControl&&!this.xoffSentToCatchUp&&this.writeBuffer.length>=5&&(this.send(m.C0.DC3),this.xoffSentToCatchUp=!0),!this.writeInProgress&&this.writeBuffer.length>0&&(this.writeInProgress=!0,setTimeout(function(){e.innerWrite()}))},e.prototype.innerWrite=function(){for(var t=this,e=this.writeBuffer.splice(0,300);e.length>0;){var r=e.shift();this.xoffSentToCatchUp&&0===e.length&&0===this.writeBuffer.length&&(this.send(m.C0.DC1),this.xoffSentToCatchUp=!1),this.refreshStart=this.buffer.y,this.refreshEnd=this.buffer.y;var i=this.parser.parse(r);this.parser.setState(i),this.updateRange(this.buffer.y),this.refresh(this.refreshStart,this.refreshEnd)}this.writeBuffer.length>0?setTimeout(function(){return t.innerWrite()},0):this.writeInProgress=!1},e.prototype.writeln=function(t){this.write(t+"\r\n")},e.prototype.attachCustomKeyEventHandler=function(t){this.customKeyEventHandler=t},e.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)},e.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)},e.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}return 0},e.prototype.deregisterLinkMatcher=function(t){this.linkifier&&this.linkifier.deregisterLinkMatcher(t)&&this.refresh(0,this.rows-1)},e.prototype.hasSelection=function(){return!!this.selectionManager&&this.selectionManager.hasSelection},e.prototype.getSelection=function(){return this.selectionManager?this.selectionManager.selectionText:""},e.prototype.clearSelection=function(){this.selectionManager&&this.selectionManager.clearSelection()},e.prototype.selectAll=function(){this.selectionManager&&this.selectionManager.selectAll()},e.prototype._keyDown=function(t){if(this.customKeyEventHandler&&!1===this.customKeyEventHandler(t))return!1;if(!this.compositionHelper.keydown(t))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var e=this._evaluateKeyEscapeSequence(t);return e.key===m.C0.DC3?this.writeStopped=!0:e.key===m.C0.DC1&&(this.writeStopped=!1),e.scrollLines?(this.scrollLines(e.scrollLines),this.cancel(t,!0)):!!n(this.browser,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)))},e.prototype._evaluateKeyEscapeSequence=function(t){var e={cancel:!1,key:void 0,scrollLines:void 0},r=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:"UIKeyInputUpArrow"===t.key?this.applicationCursor?e.key=m.C0.ESC+"OA":e.key=m.C0.ESC+"[A":"UIKeyInputLeftArrow"===t.key?this.applicationCursor?e.key=m.C0.ESC+"OD":e.key=m.C0.ESC+"[D":"UIKeyInputRightArrow"===t.key?this.applicationCursor?e.key=m.C0.ESC+"OC":e.key=m.C0.ESC+"[C":"UIKeyInputDownArrow"===t.key&&(this.applicationCursor?e.key=m.C0.ESC+"OB":e.key=m.C0.ESC+"[B");break;case 8:if(t.shiftKey){e.key=m.C0.BS;break}e.key=m.C0.DEL;break;case 9:if(t.shiftKey){e.key=m.C0.ESC+"[Z";break}e.key=m.C0.HT,e.cancel=!0;break;case 13:e.key=m.C0.CR,e.cancel=!0;break;case 27:e.key=m.C0.ESC,e.cancel=!0;break;case 37:r?(e.key=m.C0.ESC+"[1;"+(r+1)+"D",e.key===m.C0.ESC+"[1;3D"&&(e.key=this.browser.isMac?m.C0.ESC+"b":m.C0.ESC+"[1;5D")):this.applicationCursor?e.key=m.C0.ESC+"OD":e.key=m.C0.ESC+"[D";break;case 39:r?(e.key=m.C0.ESC+"[1;"+(r+1)+"C",e.key===m.C0.ESC+"[1;3C"&&(e.key=this.browser.isMac?m.C0.ESC+"f":m.C0.ESC+"[1;5C")):this.applicationCursor?e.key=m.C0.ESC+"OC":e.key=m.C0.ESC+"[C";break;case 38:r?(e.key=m.C0.ESC+"[1;"+(r+1)+"A",e.key===m.C0.ESC+"[1;3A"&&(e.key=m.C0.ESC+"[1;5A")):this.applicationCursor?e.key=m.C0.ESC+"OA":e.key=m.C0.ESC+"[A";break;case 40:r?(e.key=m.C0.ESC+"[1;"+(r+1)+"B",e.key===m.C0.ESC+"[1;3B"&&(e.key=m.C0.ESC+"[1;5B")):this.applicationCursor?e.key=m.C0.ESC+"OB":e.key=m.C0.ESC+"[B";break;case 45:t.shiftKey||t.ctrlKey||(e.key=m.C0.ESC+"[2~");break;case 46:e.key=r?m.C0.ESC+"[3;"+(r+1)+"~":m.C0.ESC+"[3~";break;case 36:r?e.key=m.C0.ESC+"[1;"+(r+1)+"H":this.applicationCursor?e.key=m.C0.ESC+"OH":e.key=m.C0.ESC+"[H";break;case 35:r?e.key=m.C0.ESC+"[1;"+(r+1)+"F":this.applicationCursor?e.key=m.C0.ESC+"OF":e.key=m.C0.ESC+"[F";break;case 33:t.shiftKey?e.scrollLines=-(this.rows-1):e.key=m.C0.ESC+"[5~";break;case 34:t.shiftKey?e.scrollLines=this.rows-1:e.key=m.C0.ESC+"[6~";break;case 112:e.key=r?m.C0.ESC+"[1;"+(r+1)+"P":m.C0.ESC+"OP";break;case 113:e.key=r?m.C0.ESC+"[1;"+(r+1)+"Q":m.C0.ESC+"OQ";break;case 114:e.key=r?m.C0.ESC+"[1;"+(r+1)+"R":m.C0.ESC+"OR";break;case 115:e.key=r?m.C0.ESC+"[1;"+(r+1)+"S":m.C0.ESC+"OS";break;case 116:e.key=r?m.C0.ESC+"[15;"+(r+1)+"~":m.C0.ESC+"[15~";break;case 117:e.key=r?m.C0.ESC+"[17;"+(r+1)+"~":m.C0.ESC+"[17~";break;case 118:e.key=r?m.C0.ESC+"[18;"+(r+1)+"~":m.C0.ESC+"[18~";break;case 119:e.key=r?m.C0.ESC+"[19;"+(r+1)+"~":m.C0.ESC+"[19~";break;case 120:e.key=r?m.C0.ESC+"[20;"+(r+1)+"~":m.C0.ESC+"[20~";break;case 121:e.key=r?m.C0.ESC+"[21;"+(r+1)+"~":m.C0.ESC+"[21~";break;case 122:e.key=r?m.C0.ESC+"[23;"+(r+1)+"~":m.C0.ESC+"[23~";break;case 123:e.key=r?m.C0.ESC+"[24;"+(r+1)+"~":m.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=m.C0.ESC+String.fromCharCode(t.keyCode+32):192===t.keyCode?e.key=m.C0.ESC+"`":t.keyCode>=48&&t.keyCode<=57&&(e.key=m.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},e.prototype.setgLevel=function(t){this.glevel=t,this.charset=this.charsets[t]},e.prototype.setgCharset=function(t,e){this.charsets[t]=e,this.glevel===t&&(this.charset=e)},e.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)&&!n(this.browser,t))&&(e=String.fromCharCode(e),this.emit("keypress",e,t),this.emit("key",e,t),this.showCursor(),this.handler(e),!0)},e.prototype.send=function(t){var e=this;this.sendDataQueue||setTimeout(function(){e.handler(e.sendDataQueue),e.sendDataQueue=""},1),this.sendDataQueue+=t},e.prototype.bell=function(){var t=this;this.emit("bell"),this.soundBell()&&this.bellAudioElement.play(),this.visualBell()&&(this.element.classList.add("visual-bell-active"),clearTimeout(this.visualBellTimer),this.visualBellTimer=window.setTimeout(function(){t.element.classList.remove("visual-bell-active")},200))},e.prototype.log=function(t,e){this.options.debug&&this.context.console&&this.context.console.log&&this.context.console.log(t,e)},e.prototype.error=function(t,e){this.options.debug&&this.context.console&&this.context.console.error&&this.context.console.error(t,e)},e.prototype.resize=function(t,e){isNaN(t)||isNaN(e)||(t!==this.cols||e!==this.rows?(t<1&&(t=1),e<1&&(e=1),this.buffers.resize(t,e),this.cols=t,this.rows=e,this.buffers.setupTabStops(this.cols),this.charMeasure.measure(this.options),this.refresh(0,this.rows-1),this.emit("resize",{cols:t,rows:e})):this.charMeasure.width&&this.charMeasure.height||this.charMeasure.measure(this.options))},e.prototype.updateRange=function(t){t<this.refreshStart&&(this.refreshStart=t),t>this.refreshEnd&&(this.refreshEnd=t)},e.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1},e.prototype.eraseRight=function(t,e){var r=this.buffer.lines.get(this.buffer.ybase+e);if(r){for(var i=[this.eraseAttr()," ",1,32];t<this.cols;t++)r[t]=i;this.updateRange(e)}},e.prototype.eraseLeft=function(t,e){var r=this.buffer.lines.get(this.buffer.ybase+e);if(r){var i=[this.eraseAttr()," ",1,32];for(t++;t--;)r[t]=i;this.updateRange(e)}},e.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)}},e.prototype.eraseLine=function(t){this.eraseRight(0,t)},e.prototype.blankLine=function(t,e,r){var i=[t?this.eraseAttr():this.defAttr," ",1,32],n=[];e&&(n.isWrapped=e),r=r||this.cols;for(var s=0;s<r;s++)n[s]=i;return n},e.prototype.ch=function(t){return t?[this.eraseAttr()," ",1,32]:[this.defAttr," ",1,32]},e.prototype.is=function(t){return 0===(this.options.termName+"").indexOf(t)},e.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))},e.prototype.handleTitle=function(t){this.emit("title",t)},e.prototype.index=function(){++this.buffer.y>this.buffer.scrollBottom&&(this.buffer.y--,this.scroll()),this.buffer.x>=this.cols&&this.buffer.x--},e.prototype.reverseIndex=function(){if(this.buffer.y===this.buffer.scrollTop){var t=this.buffer.scrollBottom-this.buffer.scrollTop;this.buffer.lines.shiftElements(this.buffer.y+this.buffer.ybase,t,1),this.buffer.lines.set(this.buffer.y+this.buffer.ybase,this.blankLine(!0)),this.updateRange(this.buffer.scrollTop),this.updateRange(this.buffer.scrollBottom)}else this.buffer.y--},e.prototype.reset=function(){this.options.rows=this.rows,this.options.cols=this.cols;var t=this.customKeyEventHandler,e=this.inputHandler,r=this.buffers;this.setup(),this.customKeyEventHandler=t,this.inputHandler=e,this.buffers=r,this.refresh(0,this.rows-1),this.viewport.syncScrollArea()},e.prototype.tabSet=function(){this.buffer.tabs[this.buffer.x]=!0},e.prototype.cancel=function(t,e){if(this.options.cancelEvents||e)return t.preventDefault(),t.stopPropagation(),!1},e.prototype.matchColor=function(t,e,r){return a(t,e,r)},e.prototype.visualBell=function(){return"visual"===this.options.bellStyle||"both"===this.options.bellStyle},e.prototype.soundBell=function(){return"sound"===this.options.bellStyle||"both"===this.options.bellStyle},e.prototype.syncBellSound=function(){this.element&&(this.soundBell()&&this.bellAudioElement?this.bellAudioElement.setAttribute("src",this.options.bellSound):this.soundBell()?(this.bellAudioElement=L.createElement("audio"),this.bellAudioElement.setAttribute("preload","auto"),this.bellAudioElement.setAttribute("src",this.options.bellSound),this.helperContainer.appendChild(this.bellAudioElement)):this.bellAudioElement&&this.helperContainer.removeChild(this.bellAudioElement))},e}(f.EventEmitter);r.Terminal=R;var M=function(t,e,r,i){Array.isArray(t)||(t=[t]),t.forEach(function(t){t.addEventListener(e,r,i||!1)})},B=function(){for(var t=k.DEFAULT_ANSI_COLORS.map(function(t){return t=t.substring(1),[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}),e=[0,95,135,175,215,255],r=0;r<216;r++)t.push([e[r/36%6|0],e[r/6%6|0],e[r%6]]);for(var i,r=0;r<24;r++)i=8+10*r,t.push([i,i,i]);return t}(),D={}},{"./Buffer":1,"./BufferSet":2,"./CompositionHelper":5,"./EscapeSequences":6,"./EventEmitter":7,"./InputHandler":8,"./Linkifier":9,"./Parser":10,"./SelectionManager":11,"./Viewport":15,"./handlers/Clipboard":16,"./input/MouseZoneManager":17,"./renderer/CharAtlas":19,"./renderer/ColorManager":20,"./renderer/Renderer":24,"./utils/Browser":28,"./utils/CharMeasure":29,"./utils/MouseHelper":32,"./utils/Sounds":33}],14:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!function(t){t.HOVER="linkhover",t.TOOLTIP="linktooltip",t.LEAVE="linkleave"}(r.LinkHoverEventTypes||(r.LinkHoverEventTypes={}))},{}],15:[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.lastRecordedBufferHeight=0,this.viewportElement.addEventListener("scroll",this.onScroll.bind(this)),setTimeout(function(){return n.syncScrollArea()},0)}return t.prototype.onThemeChanged=function(t){this.viewportElement.style.backgroundColor=t.background},t.prototype.refresh=function(){if(this.charMeasure.height>0){this.currentRowHeight=this.terminal.renderer.dimensions.scaledCellHeight/window.devicePixelRatio,this.lastRecordedViewportHeight!==this.terminal.renderer.dimensions.canvasHeight&&(this.lastRecordedViewportHeight=this.terminal.renderer.dimensions.canvasHeight,this.viewportElement.style.height=this.lastRecordedViewportHeight+"px");var t=Math.round(this.currentRowHeight*this.lastRecordedBufferLength);this.lastRecordedBufferHeight!==t&&(this.lastRecordedBufferHeight=t,this.scrollArea.style.height=this.lastRecordedBufferHeight+"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.renderer.dimensions.canvasHeight?this.refresh():this.terminal.renderer.dimensions.scaledCellHeight/window.devicePixelRatio!==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.scrollLines(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},{}],16:[function(t,e,r){"use strict";function i(t,e){return e?t.replace(/\r?\n/g,"\r"):t}function n(t,e){return e?"[200~"+t+"[201~":t}function s(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)}Object.defineProperty(r,"__esModule",{value:!0}),r.prepareTextForTerminal=i,r.bracketTextForPaste=n,r.copyHandler=function(t,e,r){e.browser.isMSIE?window.clipboardData.setData("Text",r.selectionText):t.clipboardData.setData("text/plain",r.selectionText),t.preventDefault()},r.pasteHandler=function(t,e){t.stopPropagation();var r=function(r){r=n(r=i(r,e.browser.isMSWindows),e.bracketedPasteMode),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"))},r.moveTextAreaUnderMouseCursor=s,r.rightClickHandler=function(t,e,r){s(t,e),e.value=r.selectionText,e.select()}},{}],17:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t){var e=this;this._terminal=t,this._zones=[],this._areZonesActive=!1,this._tooltipTimeout=null,this._currentZone=null,this._lastHoverCoords=[null,null],this._terminal.element.addEventListener("mousedown",function(t){return e._onMouseDown(t)}),this._mouseMoveListener=function(t){return e._onMouseMove(t)},this._clickListener=function(t){return e._onClick(t)}}return t.prototype.add=function(t){this._zones.push(t),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(t,e){if(0!==this._zones.length){e||(t=0,e=this._terminal.rows-1);for(var r=0;r<this._zones.length;r++){var i=this._zones[r];i.y>t&&i.y<=e+1&&(this._currentZone&&this._currentZone===i&&(this._currentZone.leaveCallback(),this._currentZone=null),this._zones.splice(r--,1))}0===this._zones.length&&this._deactivate()}},t.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._terminal.element.addEventListener("mousemove",this._mouseMoveListener),this._terminal.element.addEventListener("click",this._clickListener))},t.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._terminal.element.removeEventListener("mousemove",this._mouseMoveListener),this._terminal.element.removeEventListener("click",this._clickListener))},t.prototype._onMouseMove=function(t){this._lastHoverCoords[0]===t.pageX&&this._lastHoverCoords[1]===t.pageY||(this._onHover(t),this._lastHoverCoords=[t.pageX,t.pageY])},t.prototype._onHover=function(t){var e=this,r=this._findZoneEventAt(t);r!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=null,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),r&&(this._currentZone=r,r.hoverCallback&&r.hoverCallback(t),this._tooltipTimeout=setTimeout(function(){return e._onTooltip(t)},500)))},t.prototype._onTooltip=function(t){this._tooltipTimeout=null;var e=this._findZoneEventAt(t);e&&e.tooltipCallback&&e.tooltipCallback(t)},t.prototype._onMouseDown=function(t){this._areZonesActive&&this._findZoneEventAt(t)&&(t.preventDefault(),t.stopImmediatePropagation())},t.prototype._onClick=function(t){var e=this._findZoneEventAt(t);e&&(e.clickCallback(t),t.preventDefault(),t.stopImmediatePropagation())},t.prototype._findZoneEventAt=function(t){var e=this._terminal.mouseHelper.getCoords(t,this._terminal.element,this._terminal.charMeasure,this._terminal.options.lineHeight,this._terminal.cols,this._terminal.rows);if(!e)return null;for(var r=0;r<this._zones.length;r++){var i=this._zones[r];if(i.y===e[1]&&i.x1<=e[0]&&i.x2>e[0])return i}return null},t}();r.MouseZoneManager=i;var n=function(){return function(t,e,r,i,n,s,o){this.x1=t,this.x2=e,this.y=r,this.clickCallback=i,this.hoverCallback=n,this.tooltipCallback=s,this.leaveCallback=o}}();r.MouseZone=n},{}],18:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./CharAtlas"),n=t("../Buffer");r.INVERTED_DEFAULT_COLOR=-1;var s=function(){function t(t,e,r,i,n){this._alpha=i,this._colors=n,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._canvas=document.createElement("canvas"),this._canvas.id="xterm-"+e+"-layer",this._canvas.style.zIndex=r.toString(),this._ctx=this._canvas.getContext("2d",{alpha:i}),this._ctx.scale(window.devicePixelRatio,window.devicePixelRatio),i||this.clearAll(),t.appendChild(this._canvas)}return t.prototype.onOptionsChanged=function(t){},t.prototype.onBlur=function(t){},t.prototype.onFocus=function(t){},t.prototype.onCursorMove=function(t){},t.prototype.onGridChanged=function(t,e,r){},t.prototype.onSelectionChanged=function(t,e,r){},t.prototype.onThemeChanged=function(t,e){this._refreshCharAtlas(t,e)},t.prototype._refreshCharAtlas=function(t,e){var r=this;if(!(this._scaledCharWidth<=0&&this._scaledCharHeight<=0)){this._charAtlas=null;var n=i.acquireCharAtlas(t,this._colors,this._scaledCharWidth,this._scaledCharHeight);n instanceof HTMLCanvasElement?this._charAtlas=n:n.then(function(t){return r._charAtlas=t})}},t.prototype.resize=function(t,e,r){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this.clearAll(),r&&this._refreshCharAtlas(t,this._colors)},t.prototype.fillCells=function(t,e,r,i){this._ctx.fillRect(t*this._scaledCellWidth,e*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight)},t.prototype.fillBottomLineAtCells=function(t,e,r){void 0===r&&(r=1),this._ctx.fillRect(t*this._scaledCellWidth,(e+1)*this._scaledCellHeight-window.devicePixelRatio-1,r*this._scaledCellWidth,window.devicePixelRatio)},t.prototype.fillLeftLineAtCell=function(t,e){this._ctx.fillRect(t*this._scaledCellWidth,e*this._scaledCellHeight,window.devicePixelRatio,this._scaledCellHeight)},t.prototype.strokeRectAtCell=function(t,e,r,i){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(t*this._scaledCellWidth+window.devicePixelRatio/2,e*this._scaledCellHeight+window.devicePixelRatio/2,r*this._scaledCellWidth-window.devicePixelRatio,i*this._scaledCellHeight-window.devicePixelRatio)},t.prototype.clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},t.prototype.clearCells=function(t,e,r,i){this._alpha?this._ctx.clearRect(t*this._scaledCellWidth,e*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background,this._ctx.fillRect(t*this._scaledCellWidth,e*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight))},t.prototype.fillCharTrueColor=function(t,e,r,i){this._ctx.font=t.options.fontSize*window.devicePixelRatio+"px "+t.options.fontFamily,this._ctx.textBaseline="top",this._clipRow(t,i),this._ctx.fillText(e[n.CHAR_DATA_CHAR_INDEX],r*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop)},t.prototype.drawChar=function(t,e,r,n,s,o,a,l,c,h){var u=0;a<256?u=a+2:c&&t.options.enableBold&&(u=1);var f=r<256,p=u>1&&a<16&&(a<8||c),d=a>=256,m=l>=256;if(this._charAtlas&&f&&(p||d)&&m){var _=this._scaledCharWidth+i.CHAR_ATLAS_CELL_SPACING,y=this._scaledCharHeight+i.CHAR_ATLAS_CELL_SPACING;h&&(this._ctx.globalAlpha=.5),c&&!t.options.enableBold&&u>1&&(u-=8),this._ctx.drawImage(this._charAtlas,r*_,u*y,_,this._scaledCharHeight,s*this._scaledCellWidth+this._scaledCharLeft,o*this._scaledCellHeight+this._scaledCharTop,_,this._scaledCharHeight)}else this._drawUncachedChar(t,e,n,a,s,o,c,h)},t.prototype._drawUncachedChar=function(t,e,i,n,s,o,a,l){this._ctx.save(),this._ctx.font=t.options.fontSize*window.devicePixelRatio+"px "+t.options.fontFamily,a&&t.options.enableBold&&(this._ctx.font="bold "+this._ctx.font),this._ctx.textBaseline="top",n===r.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background:this._ctx.fillStyle=n<256?this._colors.ansi[n]:this._colors.foreground,this._clipRow(t,o),l&&(this._ctx.globalAlpha=.5),this._ctx.fillText(e,s*this._scaledCellWidth+this._scaledCharLeft,o*this._scaledCellHeight+this._scaledCharTop),this._ctx.restore()},t.prototype._clipRow=function(t,e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,t.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},t}();r.BaseRenderLayer=s},{"../Buffer":1,"./CharAtlas":19}],19:[function(t,e,r){"use strict";function i(t,e,r,i){var n={foreground:i.foreground,background:i.background,cursor:null,cursorAccent:null,selection:null,ansi:i.ansi.slice(0,16)};return{scaledCharWidth:t,scaledCharHeight:e,fontFamily:r.options.fontFamily,fontSize:r.options.fontSize,colors:n}}function n(t,e){for(var r=0;r<t.colors.ansi.length;r++)if(t.colors.ansi[r]!==e.colors.ansi[r])return!1;return t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize&&t.scaledCharWidth===e.scaledCharWidth&&t.scaledCharHeight===e.scaledCharHeight&&t.colors.foreground===e.colors.foreground&&t.colors.background===e.colors.background}Object.defineProperty(r,"__esModule",{value:!0});var s=t("../utils/Browser");r.CHAR_ATLAS_CELL_SPACING=1;var o=[];r.acquireCharAtlas=function(t,e,r,s){for(var l=i(r,s,t,e),c=0;c<o.length;c++){var h=(u=o[c]).ownedBy.indexOf(t);if(h>=0){if(n(u.config,l))return u.bitmap;1===u.ownedBy.length?o.splice(c,1):u.ownedBy.splice(h,1);break}}for(c=0;c<o.length;c++){var u=o[c];if(n(u.config,l))return u.ownedBy.push(t),u.bitmap}var f={bitmap:a.generate(r,s,t.options.fontSize,t.options.fontFamily,e.background,e.foreground,e.ansi),config:l,ownedBy:[t]};return o.push(f),f.bitmap};var a;r.initialize=function(t){a||(a=new l(t))};var l=function(){function t(t){this._document=t,this._canvas=this._document.createElement("canvas"),this._ctx=this._canvas.getContext("2d",{alpha:!1}),this._ctx.scale(window.devicePixelRatio,window.devicePixelRatio)}return t.prototype.generate=function(t,e,i,n,o,a,l){var c=t+r.CHAR_ATLAS_CELL_SPACING,h=e+r.CHAR_ATLAS_CELL_SPACING;this._canvas.width=255*c,this._canvas.height=18*h,this._ctx.fillStyle=o,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height),this._ctx.save(),this._ctx.fillStyle=a,this._ctx.font=i*window.devicePixelRatio+"px "+n,this._ctx.textBaseline="top";for(p=0;p<256;p++)this._ctx.save(),this._ctx.beginPath(),this._ctx.rect(p*c,0,c,h),this._ctx.clip(),this._ctx.fillText(String.fromCharCode(p),p*c,0),this._ctx.restore();this._ctx.save(),this._ctx.font="bold "+this._ctx.font;for(p=0;p<256;p++)this._ctx.save(),this._ctx.beginPath(),this._ctx.rect(p*c,h,c,h),this._ctx.clip(),this._ctx.fillText(String.fromCharCode(p),p*c,h),this._ctx.restore();this._ctx.restore(),this._ctx.font=i*window.devicePixelRatio+"px "+n;for(var u=0;u<16;u++){8===u&&(this._ctx.font="bold "+this._ctx.font);for(var f=(u+2)*h,p=0;p<256;p++)this._ctx.save(),this._ctx.beginPath(),this._ctx.rect(p*c,f,c,h),this._ctx.clip(),this._ctx.fillStyle=l[u],this._ctx.fillText(String.fromCharCode(p),p*c,f),this._ctx.restore()}if(this._ctx.restore(),!("createImageBitmap"in window)||s.isFirefox){var d=this._canvas;return this._canvas=this._document.createElement("canvas"),this._ctx=this._canvas.getContext("2d"),this._ctx.scale(window.devicePixelRatio,window.devicePixelRatio),d}var m=this._ctx.getImageData(0,0,this._canvas.width,this._canvas.height),_=parseInt(o.substr(1,2),16),y=parseInt(o.substr(3,2),16),g=parseInt(o.substr(5,2),16);this._clearColor(m,_,y,g);var b=window.createImageBitmap(m);return this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),b},t.prototype._clearColor=function(t,e,r,i){for(var n=0;n<t.data.length;n+=4)t.data[n]===e&&t.data[n+1]===r&&t.data[n+2]===i&&(t.data[n+3]=0)},t}()},{"../utils/Browser":28}],20:[function(t,e,r){"use strict";function i(t){for(var e=t.slice(),r=[0,95,135,175,215,255],i=0;i<216;i++){var s=n(r[i/36%6|0]),o=n(r[i/6%6|0]),a=n(r[i%6]);e.push("#"+s+o+a)}for(i=0;i<24;i++){var l=n(8+10*i);e.push("#"+l+l+l)}return e}function n(t){var e=t.toString(16);return e.length<2?"0"+e:e}Object.defineProperty(r,"__esModule",{value:!0});var s="#ffffff",o="#000000",a="#ffffff",l="#000000",c="rgba(255, 255, 255, 0.3)";r.DEFAULT_ANSI_COLORS=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"];var h=function(){function t(){this.colors={foreground:s,background:o,cursor:a,cursorAccent:l,selection:c,ansi:i(r.DEFAULT_ANSI_COLORS)}}return t.prototype.setTheme=function(t){this.colors.foreground=t.foreground||s,this.colors.background=this._validateColor(t.background,o),this.colors.cursor=t.cursor||a,this.colors.cursorAccent=t.cursorAccent||l,this.colors.selection=t.selection||c,this.colors.ansi[0]=t.black||r.DEFAULT_ANSI_COLORS[0],this.colors.ansi[1]=t.red||r.DEFAULT_ANSI_COLORS[1],this.colors.ansi[2]=t.green||r.DEFAULT_ANSI_COLORS[2],this.colors.ansi[3]=t.yellow||r.DEFAULT_ANSI_COLORS[3],this.colors.ansi[4]=t.blue||r.DEFAULT_ANSI_COLORS[4],this.colors.ansi[5]=t.magenta||r.DEFAULT_ANSI_COLORS[5],this.colors.ansi[6]=t.cyan||r.DEFAULT_ANSI_COLORS[6],this.colors.ansi[7]=t.white||r.DEFAULT_ANSI_COLORS[7],this.colors.ansi[8]=t.brightBlack||r.DEFAULT_ANSI_COLORS[8],this.colors.ansi[9]=t.brightRed||r.DEFAULT_ANSI_COLORS[9],this.colors.ansi[10]=t.brightGreen||r.DEFAULT_ANSI_COLORS[10],this.colors.ansi[11]=t.brightYellow||r.DEFAULT_ANSI_COLORS[11],this.colors.ansi[12]=t.brightBlue||r.DEFAULT_ANSI_COLORS[12],this.colors.ansi[13]=t.brightMagenta||r.DEFAULT_ANSI_COLORS[13],this.colors.ansi[14]=t.brightCyan||r.DEFAULT_ANSI_COLORS[14],this.colors.ansi[15]=t.brightWhite||r.DEFAULT_ANSI_COLORS[15]},t.prototype._validateColor=function(t,e){if(!t)return e;if(7===t.length&&"#"===t.charAt(0))return t;if(4===t.length&&"#"===t.charAt(0)){var r=t.charAt(1),i=t.charAt(2),n=t.charAt(3);return"#"+r+r+i+i+n+n}return e},t}();r.ColorManager=h},{}],21:[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,r,i){var n=t.call(this,e,"cursor",r,!0,i)||this;return n._state={x:null,y:null,isFocused:null,style:null,width:null},n._cursorRenderers={bar:n._renderBarCursor.bind(n),block:n._renderBlockCursor.bind(n),underline:n._renderUnderlineCursor.bind(n)},n}return i(e,t),e.prototype.resize=function(e,r,i){t.prototype.resize.call(this,e,r,i),this._state={x:null,y:null,isFocused:null,style:null,width:null}},e.prototype.reset=function(t){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=null,this.onOptionsChanged(t))},e.prototype.onBlur=function(t){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),t.refresh(t.buffer.y,t.buffer.y)},e.prototype.onFocus=function(t){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume(t):t.refresh(t.buffer.y,t.buffer.y)},e.prototype.onOptionsChanged=function(t){var e=this;t.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new o(t,function(){e._render(t,!0)})):(this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=null),t.refresh(t.buffer.y,t.buffer.y))},e.prototype.onCursorMove=function(t){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation(t)},e.prototype.onGridChanged=function(t,e,r){this._cursorBlinkStateManager&&!this._cursorBlinkStateManager.isPaused||this._render(t,!1)},e.prototype._render=function(t,e){if(t.cursorState&&!t.cursorHidden){var r=t.buffer.ybase+t.buffer.y,i=r-t.buffer.ydisp;if(i<0||i>=t.rows)this._clearCursor();else{var s=t.buffer.lines.get(r)[t.buffer.x];if(s){if(!t.isFocused)return this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor,this._renderBlurCursor(t,t.buffer.x,i,s),this._ctx.restore(),this._state.x=t.buffer.x,this._state.y=i,this._state.isFocused=!1,this._state.style=t.options.cursorStyle,void(this._state.width=s[n.CHAR_DATA_WIDTH_INDEX]);if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===t.buffer.x&&this._state.y===i&&this._state.isFocused===t.isFocused&&this._state.style===t.options.cursorStyle&&this._state.width===s[n.CHAR_DATA_WIDTH_INDEX])return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[t.options.cursorStyle||"block"](t,t.buffer.x,i,s),this._ctx.restore(),this._state.x=t.buffer.x,this._state.y=i,this._state.isFocused=!1,this._state.style=t.options.cursorStyle,this._state.width=s[n.CHAR_DATA_WIDTH_INDEX]}else this._clearCursor()}}}else this._clearCursor()},e.prototype._clearCursor=function(){this._state&&(this.clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:null,y:null,isFocused:null,style:null,width:null})},e.prototype._renderBarCursor=function(t,e,r,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor,this.fillLeftLineAtCell(e,r),this._ctx.restore()},e.prototype._renderBlockCursor=function(t,e,r,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor,this.fillCells(e,r,i[n.CHAR_DATA_WIDTH_INDEX],1),this._ctx.fillStyle=this._colors.cursorAccent,this.fillCharTrueColor(t,i,e,r),this._ctx.restore()},e.prototype._renderUnderlineCursor=function(t,e,r,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor,this.fillBottomLineAtCells(e,r),this._ctx.restore()},e.prototype._renderBlurCursor=function(t,e,r,i){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor,this.strokeRectAtCell(e,r,i[n.CHAR_DATA_WIDTH_INDEX],1),this._ctx.restore()},e}(t("./BaseRenderLayer").BaseRenderLayer);r.CursorRenderLayer=s;var o=function(){function t(t,e){this.renderCallback=e,this.isCursorVisible=!0,t.isFocused&&this._restartInterval()}return Object.defineProperty(t.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=null),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=null),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=null)},t.prototype.restartBlinkAnimation=function(t){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){e.renderCallback(),e._animationFrame=null})))},t.prototype._restartInterval=function(t){var e=this;void 0===t&&(t=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=setTimeout(function(){if(e._animationTimeRestarted){var t=600-(Date.now()-e._animationTimeRestarted);if(e._animationTimeRestarted=null,t>0)return void e._restartInterval(t)}e.isCursorVisible=!1,e._animationFrame=window.requestAnimationFrame(function(){e.renderCallback(),e._animationFrame=null}),e._blinkInterval=setInterval(function(){if(e._animationTimeRestarted){var t=600-(Date.now()-e._animationTimeRestarted);return e._animationTimeRestarted=null,void e._restartInterval(t)}e.isCursorVisible=!e.isCursorVisible,e._animationFrame=window.requestAnimationFrame(function(){e.renderCallback(),e._animationFrame=null})},600)},t)},t.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=null),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=null),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=null)},t.prototype.resume=function(t){this._animationTimeRestarted=null,this._restartInterval(),this.restartBlinkAnimation(t)},t}()},{"../Buffer":1,"./BaseRenderLayer":18}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(){this.cache=[]}return t.prototype.resize=function(t,e){for(var r=0;r<t;r++){this.cache.length<=r&&this.cache.push([]);for(var i=this.cache[r].length;i<e;i++)this.cache[r].push(null);this.cache[r].length=e}this.cache.length=t},t.prototype.clear=function(){for(var t=0;t<this.cache.length;t++)for(var e=0;e<this.cache[t].length;e++)this.cache[t][e]=null},t}();r.GridCache=i},{}],23:[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("./BaseRenderLayer"),s=t("../Types"),o=function(t){function e(e,r,i,n){var o=t.call(this,e,"link",r,!0,i)||this;return o._state=null,n.linkifier.on(s.LinkHoverEventTypes.HOVER,function(t){return o._onLinkHover(t)}),n.linkifier.on(s.LinkHoverEventTypes.LEAVE,function(t){return o._onLinkLeave(t)}),o}return i(e,t),e.prototype.resize=function(e,r,i){t.prototype.resize.call(this,e,r,i),this._state=null},e.prototype.reset=function(t){this._clearCurrentLink()},e.prototype._clearCurrentLink=function(){this._state&&(this.clearCells(this._state.x,this._state.y,this._state.length,1),this._state=null)},e.prototype._onLinkHover=function(t){this._ctx.fillStyle=this._colors.foreground,this.fillBottomLineAtCells(t.x,t.y,t.length),this._state=t},e.prototype._onLinkLeave=function(t){this._clearCurrentLink()},e}(n.BaseRenderLayer);r.LinkRenderLayer=o},{"../Types":14,"./BaseRenderLayer":18}],24:[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("./TextRenderLayer"),s=t("./SelectionRenderLayer"),o=t("./CursorRenderLayer"),a=t("./ColorManager"),l=t("./LinkRenderLayer"),c=function(t){function e(e,r){var i=t.call(this)||this;return i._terminal=e,i._refreshRowsQueue=[],i._refreshAnimationFrame=null,i.colorManager=new a.ColorManager,r&&i.colorManager.setTheme(r),i._renderLayers=[new n.TextRenderLayer(i._terminal.element,0,i.colorManager.colors),new s.SelectionRenderLayer(i._terminal.element,1,i.colorManager.colors),new l.LinkRenderLayer(i._terminal.element,2,i.colorManager.colors,i._terminal),new o.CursorRenderLayer(i._terminal.element,3,i.colorManager.colors)],i.dimensions={scaledCharWidth:null,scaledCharHeight:null,scaledCellWidth:null,scaledCellHeight:null,scaledCharLeft:null,scaledCharTop:null,scaledCanvasWidth:null,scaledCanvasHeight:null,canvasWidth:null,canvasHeight:null,actualCellWidth:null,actualCellHeight:null},i._devicePixelRatio=window.devicePixelRatio,i._updateDimensions(),i.onOptionsChanged(),i}return i(e,t),e.prototype.onWindowResize=function(t){this._devicePixelRatio!==t&&(this._devicePixelRatio=t,this.onResize(this._terminal.cols,this._terminal.rows,!0))},e.prototype.setTheme=function(t){var e=this;return this.colorManager.setTheme(t),this._renderLayers.forEach(function(t){t.onThemeChanged(e._terminal,e.colorManager.colors),t.reset(e._terminal)}),this._terminal.refresh(0,this._terminal.rows-1),this.colorManager.colors},e.prototype.onResize=function(t,e,r){var i=this;this._updateDimensions(),this._renderLayers.forEach(function(t){return t.resize(i._terminal,i.dimensions,r)}),this._terminal.refresh(0,this._terminal.rows-1),this.emit("resize",{width:this.dimensions.canvasWidth,height:this.dimensions.canvasHeight})},e.prototype.onCharSizeChanged=function(){this.onResize(this._terminal.cols,this._terminal.rows,!0)},e.prototype.onBlur=function(){var t=this;this._renderLayers.forEach(function(e){return e.onBlur(t._terminal)})},e.prototype.onFocus=function(){var t=this;this._renderLayers.forEach(function(e){return e.onFocus(t._terminal)})},e.prototype.onSelectionChanged=function(t,e){var r=this;this._renderLayers.forEach(function(i){return i.onSelectionChanged(r._terminal,t,e)})},e.prototype.onCursorMove=function(){var t=this;this._renderLayers.forEach(function(e){return e.onCursorMove(t._terminal)})},e.prototype.onOptionsChanged=function(){var t=this;this._renderLayers.forEach(function(e){return e.onOptionsChanged(t._terminal)})},e.prototype.clear=function(){var t=this;this._renderLayers.forEach(function(e){return e.reset(t._terminal)})},e.prototype.queueRefresh=function(t,e){this._refreshRowsQueue.push({start:t,end:e}),this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(this._refreshLoop.bind(this)))},e.prototype._refreshLoop=function(){var t,e,r=this;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 i=1;i<this._refreshRowsQueue.length;i++)this._refreshRowsQueue[i].start<t&&(t=this._refreshRowsQueue[i].start),this._refreshRowsQueue[i].end>e&&(e=this._refreshRowsQueue[i].end)}this._refreshRowsQueue=[],this._refreshAnimationFrame=null,t=Math.max(t,0),e=Math.min(e,this._terminal.rows-1),this._renderLayers.forEach(function(i){return i.onGridChanged(r._terminal,t,e)}),this._terminal.emit("refresh",{start:t,end:e})},e.prototype._updateDimensions=function(){this._terminal.charMeasure.width&&this._terminal.charMeasure.height&&(this.dimensions.scaledCharWidth=Math.floor(this._terminal.charMeasure.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._terminal.charMeasure.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._terminal.options.lineHeight),this.dimensions.scaledCharTop=1===this._terminal.options.lineHeight?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._terminal.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._terminal.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._terminal.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._terminal.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._terminal.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._terminal.cols)},e}(t("../EventEmitter").EventEmitter);r.Renderer=c},{"../EventEmitter":7,"./ColorManager":20,"./CursorRenderLayer":21,"./LinkRenderLayer":23,"./SelectionRenderLayer":25,"./TextRenderLayer":26}],25:[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,i){var n=t.call(this,e,"selection",r,!0,i)||this;return n._state={start:null,end:null},n}return i(e,t),e.prototype.resize=function(e,r,i){t.prototype.resize.call(this,e,r,i),this._state={start:null,end:null}},e.prototype.reset=function(t){this._state.start&&this._state.end&&(this._state={start:null,end:null},this.clearAll())},e.prototype.onSelectionChanged=function(t,e,r){if(this._state.start!==e&&this._state.end!==r&&(this.clearAll(),e&&r)){var i=e[1]-t.buffer.ydisp,n=r[1]-t.buffer.ydisp,s=Math.max(i,0),o=Math.min(n,t.rows-1);if(!(s>=t.rows||o<0)){var a=i===s?e[0]:0,l=s===o?r[0]:t.cols;this._ctx.fillStyle=this._colors.selection,this.fillCells(a,s,l-a,1);var c=Math.max(o-s-1,0);if(this.fillCells(0,s+1,t.cols,c),s!==o){var h=n===o?r[0]:t.cols;this.fillCells(0,o,h,1)}this._state.start=[e[0],e[1]],this._state.end=[r[0],r[1]]}}},e}(t("./BaseRenderLayer").BaseRenderLayer);r.SelectionRenderLayer=n},{"./BaseRenderLayer":18}],26:[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=t("./Types"),o=t("./GridCache"),a=t("./BaseRenderLayer"),l=function(t){function e(e,r,i){var n=t.call(this,e,"text",r,!1,i)||this;return n._characterOverlapCache={},n._state=new o.GridCache,n}return i(e,t),e.prototype.resize=function(e,r,i){t.prototype.resize.call(this,e,r,i);var n=e.options.fontSize*window.devicePixelRatio+"px "+e.options.fontFamily;this._characterWidth===r.scaledCharWidth&&this._characterFont===n||(this._characterWidth=r.scaledCharWidth,this._characterFont=n,this._characterOverlapCache={}),this._state.clear(),this._state.resize(e.cols,e.rows)},e.prototype.reset=function(t){this._state.clear(),this.clearAll()},e.prototype.onGridChanged=function(t,e,r){if(0!==this._state.cache.length)for(var i=e;i<=r;i++){var o=i+t.buffer.ydisp,l=t.buffer.lines.get(o);this.clearCells(0,i,t.cols,1);for(var c=0;c<t.cols;c++){var h=l[c],u=h[n.CHAR_DATA_CODE_INDEX],f=h[n.CHAR_DATA_CHAR_INDEX],p=h[n.CHAR_DATA_ATTR_INDEX],d=h[n.CHAR_DATA_WIDTH_INDEX];if(0!==d){if(32===u&&c>0){var m=l[c-1];if(this._isOverlapping(m))continue}var _=p>>18,y=511&p,g=y>=256,b=_&s.FLAGS.INVISIBLE,v=_&s.FLAGS.INVERSE;if(u&&(32!==u||!g||v)&&!b){0!==d&&this._isOverlapping(h)&&c<l.length-1&&32===l[c+1][n.CHAR_DATA_CODE_INDEX]&&(d=2);var C=p>>9&511;if(v){var w=y;y=C,256===(C=w)&&(C=a.INVERTED_DEFAULT_COLOR),257===y&&(y=a.INVERTED_DEFAULT_COLOR)}y<256&&(this._ctx.save(),this._ctx.fillStyle=y===a.INVERTED_DEFAULT_COLOR?this._colors.foreground:this._colors.ansi[y],this.fillCells(c,i,d,1),this._ctx.restore()),this._ctx.save(),_&s.FLAGS.BOLD&&(this._ctx.font="bold "+this._ctx.font,C<8&&(C+=8)),_&s.FLAGS.UNDERLINE&&(C===a.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background:this._ctx.fillStyle=C<256?this._colors.ansi[C]:this._colors.foreground,this.fillBottomLineAtCells(c,i)),this.drawChar(t,f,u,d,c,i,C,y,!!(_&s.FLAGS.BOLD),!!(_&s.FLAGS.DIM)),this._ctx.restore()}}}}},e.prototype._isOverlapping=function(t){if(1!==t[n.CHAR_DATA_WIDTH_INDEX])return!1;if(t[n.CHAR_DATA_CODE_INDEX]<256)return!1;var e=t[n.CHAR_DATA_CHAR_INDEX];if(this._characterOverlapCache.hasOwnProperty(e))return this._characterOverlapCache[e];this._ctx.save(),this._ctx.font=this._characterFont;var r=Math.floor(this._ctx.measureText(e).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[e]=r,r},e.prototype._clearChar=function(t,e){var r=1,i=this._state.cache[t][e];i&&2===i[n.CHAR_DATA_WIDTH_INDEX]&&(r=2),this.clearCells(t,e,r,1)},e}(a.BaseRenderLayer);r.TextRenderLayer=l},{"../Buffer":1,"./BaseRenderLayer":18,"./GridCache":22,"./Types":27}],27:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});!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",t[t.DIM=32]="DIM"}(r.FLAGS||(r.FLAGS={}))},{}],28:[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":31}],29:[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._measureElement=i._document.createElement("span"),i._measureElement.style.position="absolute",i._measureElement.style.top="0",i._measureElement.style.left="-9999em",i._measureElement.style.lineHeight="normal",i._measureElement.textContent="W",i._measureElement.setAttribute("aria-hidden","true"),i._parentElement.appendChild(i._measureElement),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(t){this._measureElement.style.fontFamily=t.fontFamily,this._measureElement.style.fontSize=t.fontSize+"px";var e=this._measureElement.getBoundingClientRect();0!==e.width&&0!==e.height&&(this._width===e.width&&this._height===e.height||(this._width=e.width,this._height=Math.ceil(e.height),this.emit("charsizechanged")))},e}(t("../EventEmitter").EventEmitter);r.CharMeasure=n},{"../EventEmitter":7}],30:[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._maxLength=e,r._array=new Array(r._maxLength),r._startIndex=0,r._length=0,r}return i(e,t),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(t){if(this._maxLength!==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._maxLength=t,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":7}],31:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.contains=function(t,e){return t.indexOf(e)>=0}},{}],32:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function t(t){this._renderer=t}return t.getCoordsRelativeToElement=function(t,e){if(null==t.pageX)return null;for(var r=e,i=t.pageX,n=t.pageY;e;)i-=e.offsetLeft,n-=e.offsetTop,e="offsetParent"in e?e.offsetParent:e.parentElement;for(e=r;e&&e!==e.ownerDocument.body;)i+=e.scrollLeft,n+=e.scrollTop,e=e.parentElement;return[i,n]},t.prototype.getCoords=function(e,r,i,n,s,o,a){if(!i.width||!i.height)return null;var l=t.getCoordsRelativeToElement(e,r);return l?(l[0]=Math.ceil((l[0]+(a?this._renderer.dimensions.actualCellWidth/2:0))/this._renderer.dimensions.actualCellWidth),l[1]=Math.ceil(l[1]/this._renderer.dimensions.actualCellHeight),l[0]=Math.min(Math.max(l[0],1),s+(a?1:0)),l[1]=Math.min(Math.max(l[1],1),o),l):null},t.prototype.getRawByteCoords=function(t,e,r,i,n,s){var o=this.getCoords(t,e,r,i,n,s),a=o[0],l=o[1];return a+=32,l+=32,{x:a,y:l}},t}();r.MouseHelper=i},{}],33:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.BellSound="data:audio/wav;base64,UklGRigBAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQQBAADpAFgCwAMlBZoG/wdmCcoKRAypDQ8PbRDBEQQTOxRtFYcWlBePGIUZXhoiG88bcBz7HHIdzh0WHlMeZx51HmkeUx4WHs8dah0AHXwc3hs9G4saxRnyGBIYGBcQFv8U4RPAEoYRQBACD70NWwwHC6gJOwjWBloF7gOBAhABkf8b/qv8R/ve+Xf4Ife79W/0JfPZ8Z/wde9N7ijtE+wU6xvqM+lb6H7nw+YX5mrlxuQz5Mzje+Ma49fioeKD4nXiYeJy4pHitOL04j/jn+MN5IPkFOWs5U3mDefM55/ogOl36m7rdOyE7abuyu8D8Unyj/Pg9D/2qfcb+Yn6/vuK/Qj/lAAlAg=="},{}],34:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./Terminal");e.exports=i.Terminal},{"./Terminal":13}]},{},[34])(34)}),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).fit=t()}}(function(){return function t(e,r,i){function n(o,a){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}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";function i(t){if(!t.element.parentElement)return null;var e=window.getComputedStyle(t.element.parentElement),r=parseInt(e.getPropertyValue("height")),i=Math.max(0,parseInt(e.getPropertyValue("width"))-17),n=window.getComputedStyle(t.element),s=r-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),o=i-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")));return{cols:Math.floor(o/t.renderer.dimensions.actualCellWidth),rows:Math.floor(s/t.renderer.dimensions.actualCellHeight)}}function n(t){var e=i(t);e&&(t.rows===e.rows&&t.cols===e.cols||(t.renderer.clear(),t.resize(e.cols,e.rows)))}Object.defineProperty(r,"__esModule",{value:!0}),r.proposeGeometry=i,r.fit=n,r.apply=function(t){t.prototype.proposeGeometry=function(){return i(this)},t.prototype.fit=function(){return n(this)}}},{}]},{},[1])(1)}),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?(c("ignoring socket cache for %s",a),r=l(a,e)):(h[u]||(c("new io instance for %s",a),h[u]=l(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),l=r(17),c=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";var i=r(2),n=r(3)("socket.io-client:url");t.exports=function(t,r){var s=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)||(n("protocol-less url %s",t),t=void 0!==r?r.protocol+"//"+t:"https://"+t),n("parse %s",t),s=i(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";var o=-1!==s.host.indexOf(":")?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+o+":"+s.port,s.href=s.protocol+"://"+o+(r&&r.port===s.port?"":":"+s.port),s}}).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={},l=14;l--;)a[i[l]]=o[l]||"";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(){try{return e.storage.debug}catch(t){}if(void 0!==i&&"env"in i)return i.env.DEBUG}(e=t.exports=r(5)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(){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},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=n,e.useColors=function(){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},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(n())}).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):_=-1,d.length&&a())}function a(){if(!m){var t=n(o);m=!0;for(var e=d.length;e;){for(p=d,d=[];++_<e;)p&&p[_].run();_=-1,e=d.length}p=null,m=!1,s(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}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,_=-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 l(t,e)),1!==d.length||m||n(a)},l.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=c,f.addListener=c,f.once=c,f.off=c,f.removeListener=c,f.removeAllListeners=c,f.emit=c,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[o++%e.colors.length]}function n(t){function r(){}function n(){var t=n,r=+new Date,o=r-(s||r);t.diff=o,t.prev=s,t.curr=r,s=r,null==t.useColors&&(t.useColors=e.useColors()),null==t.color&&t.useColors&&(t.color=i());for(var a=new Array(arguments.length),l=0;l<a.length;l++)a[l]=arguments[l];a[0]=e.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var c=0;a[0]=a[0].replace(/%([a-z%])/g,function(r,i){if("%%"===r)return r;c++;var n=e.formatters[i];if("function"==typeof n){var s=a[c];r=n.call(t,s),a.splice(c,1),c--}return r}),a=e.formatArgs.apply(t,a),(n.log||e.log||console.log.bind(console)).apply(t,a)}r.enabled=!1,n.enabled=!0;var o=e.enabled(t)?n:r;return o.namespace=t,o}(e=t.exports=n.debug=n).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(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+"$")))},e.enabled=function(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},e.humanize=r(6),e.names=[],e.skips=[],e.formatters={};var s,o=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*c;case"hours":case"hour":case"hrs":case"hr":case"h":return r*l;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>=c?Math.round(t/c)+"d":t>=l?Math.round(t/l)+"h":t>=a?Math.round(t/a)+"m":t>=o?Math.round(t/o)+"s":t+"ms"}function n(t){return s(t,c,"day")||s(t,l,"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,l=60*a,c=24*l,h=365.25*c;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){d.removeBlobs(t,function(t){var r=d.deconstructPacket(t),i=n(r.packet),s=r.buffers;s.unshift(i),e(s)})}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=l(r,t.substr(i))),u("decoded %s as %j",t,r),r}function l(t,e){try{t.data=f.parse(e)}catch(t){return h()}return t}function c(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 c(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()},c.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},c.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,r){function i(){var t;try{t=e.storage.debug}catch(t){}return t}(e=t.exports=r(9)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(){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},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=i,e.useColors=function(){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},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(i())},function(t,e,r){function i(){return e.colors[s++%e.colors.length]}(e=t.exports=function(t){function r(){}function s(){var t=s,r=+new Date,o=r-(n||r);t.diff=o,t.prev=n,t.curr=r,n=r,null==t.useColors&&(t.useColors=e.useColors()),null==t.color&&t.useColors&&(t.color=i());var a=Array.prototype.slice.call(arguments);a[0]=e.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var l=0;a[0]=a[0].replace(/%([a-z%])/g,function(r,i){if("%%"===r)return r;l++;var n=e.formatters[i];if("function"==typeof n){var s=a[l];r=n.call(t,s),a.splice(l,1),l--}return r}),"function"==typeof e.formatArgs&&(a=e.formatArgs.apply(t,a)),(s.log||e.log||console.log.bind(console)).apply(t,a)}r.enabled=!1,s.enabled=!0;var o=e.enabled(t)?s:r;return o.namespace=t,o}).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(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+"$")))},e.enabled=function(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},e.humanize=r(10),e.names=[],e.skips=[],e.formatters={};var n,s=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*c;case"hours":case"hour":case"hrs":case"hr":case"h":return r*l;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>=c?Math.round(t/c)+"d":t>=l?Math.round(t/l)+"h":t>=a?Math.round(t/a)+"m":t>=o?Math.round(t/o)+"s":t+"ms"}function n(t){return s(t,c,"day")||s(t,l,"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,l=60*a,c=24*l,h=365.25*c;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]!==_)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 l=e.stringify,h="function"==typeof l&&b;if(h){(n=function(){return 1}).toJSON=n;try{h="0"===l(0)&&"0"===l(new s)&&'""'==l(new a)&&l(g)===_&&l(_)===_&&l()===_&&"1"===l(n)&&"[1]"==l([n])&&"[null]"==l([_])&&"null"==l(null)&&"[null,null,null]"==l([_,g,null])&&l({a:[n,!0,!1,null,"\0\b\n\f\r\t"]})==o&&"1"===l(null,n)&&"[\n 1,\n 2\n]"==l([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==l(new c(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==l(new c(864e13))&&'"-000001-01-01T00:00:00.000Z"'==l(new c(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==l(new c(-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,l=t.Object||o.Object,c=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=l.prototype,g=y.toString,b=new c(-0xc782b5b800cec);try{b=-109252==b.getUTCFullYear()&&0===b.getUTCMonth()&&1===b.getUTCDate()&&10==b.getUTCHours()&&37==b.getUTCMinutes()&&6==b.getUTCSeconds()&&708==b.getUTCMilliseconds()}catch(t){}if(!r("json")){var v=r("bug-string-char-index");if(!b)var C=f.floor,w=[0,31,59,90,120,151,181,212,243,273,304,334],A=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=y.hasOwnProperty)||(d=function(t){var e,r={};return(r.__proto__=null,r.__proto__={toString:1},r).toString!=g?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]"==g.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]"==g.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]"==g.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"},k=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"+k(2,o.toString(16));break}e+=n?s[r]:t.charAt(r)}}return e+'"'},E=function(t,e,r,i,n,s,o){var a,l,c,h,f,p,y,b,v,w,S,L,T,R,M,B;try{a=e[t]}catch(t){}if("object"==typeof a&&a)if("[object Date]"!=(l=g.call(a))||d.call(a,"toJSON"))"function"==typeof a.toJSON&&("[object Number]"!=l&&"[object String]"!=l&&"[object Array]"!=l||d.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&a<1/0){if(A){for(f=C(a/864e5),c=C(f/365.2425)+1970-1;A(c+1,0)<=f;c++);for(h=C((f-A(c,0))/30.42);A(c,h+1)<=f;h++);f=1+f-A(c,h),y=C((p=(a%864e5+864e5)%864e5)/36e5)%24,b=C(p/6e4)%60,v=C(p/1e3)%60,w=p%1e3}else c=a.getUTCFullYear(),h=a.getUTCMonth(),f=a.getUTCDate(),y=a.getUTCHours(),b=a.getUTCMinutes(),v=a.getUTCSeconds(),w=a.getUTCMilliseconds();a=(c<=0||c>=1e4?(c<0?"-":"+")+k(6,c<0?-c:c):k(4,c))+"-"+k(2,h+1)+"-"+k(2,f)+"T"+k(2,y)+":"+k(2,b)+":"+k(2,v)+"."+k(3,w)+"Z"}else a=null;if(r&&(a=r.call(e,t,a)),null===a)return"null";if("[object Boolean]"==(l=g.call(a)))return""+a;if("[object Number]"==l)return a>-1/0&&a<1/0?""+a:"null";if("[object String]"==l)return x(""+a);if("object"==typeof a){for(R=o.length;R--;)if(o[R]===a)throw u();if(o.push(a),S=[],M=s,s+=n,"[object Array]"==l){for(T=0,R=a.length;T<R;T++)L=E(T,a,r,i,n,s,o),S.push(L===_?"null":L);B=S.length?n?"[\n"+s+S.join(",\n"+s)+"\n"+M+"]":"["+S.join(",")+"]":"[]"}else m(i||a,function(t){var e=E(t,a,r,i,n,s,o);e!==_&&S.push(x(t)+":"+(n?" ":"")+e)}),B=S.length?n?"{\n"+s+S.join(",\n"+s)+"\n"+M+"}":"{"+S.join(",")+"}":"{}";return o.pop(),B}};e.stringify=function(t,e,r){var i,s,o,a;if(n[typeof e]&&e)if("[object Function]"==(a=g.call(e)))s=e;else if("[object Array]"==a){o={};for(var l,c=0,h=e.length;c<h;l=e[c++],("[object String]"==(a=g.call(l))||"[object Number]"==a)&&(o[l]=1));}if(r)if("[object Number]"==(a=g.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 E("",(l={},l[""]=t,l),s,o,i,"",[])}}if(!r("json-parse")){var L,T,R=a.fromCharCode,M={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},B=function(){throw L=T=null,h()},D=function(){for(var t,e,r,i,n,s=T,o=s.length;L<o;)switch(n=s.charCodeAt(L)){case 9:case 10:case 13:case 32:L++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=v?s.charAt(L):s[L],L++,t;case 34:for(t="@",L++;L<o;)if((n=s.charCodeAt(L))<32)B();else if(92==n)switch(n=s.charCodeAt(++L)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=M[n],L++;break;case 117:for(e=++L,r=L+4;L<r;L++)(n=s.charCodeAt(L))>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70||B();t+=R("0x"+s.slice(e,L));break;default:B()}else{if(34==n)break;for(n=s.charCodeAt(L),e=L;n>=32&&92!=n&&34!=n;)n=s.charCodeAt(++L);t+=s.slice(e,L)}if(34==s.charCodeAt(L))return L++,t;B();default:if(e=L,45==n&&(i=!0,n=s.charCodeAt(++L)),n>=48&&n<=57){for(48==n&&(n=s.charCodeAt(L+1))>=48&&n<=57&&B(),i=!1;L<o&&(n=s.charCodeAt(L))>=48&&n<=57;L++);if(46==s.charCodeAt(L)){for(r=++L;r<o&&(n=s.charCodeAt(r))>=48&&n<=57;r++);r==L&&B(),L=r}if(101==(n=s.charCodeAt(L))||69==n){for(43!=(n=s.charCodeAt(++L))&&45!=n||L++,r=L;r<o&&(n=s.charCodeAt(r))>=48&&n<=57;r++);r==L&&B(),L=r}return+s.slice(e,L)}if(i&&B(),"true"==s.slice(L,L+4))return L+=4,!0;if("false"==s.slice(L,L+5))return L+=5,!1;if("null"==s.slice(L,L+4))return L+=4,null;B()}return"$"},O=function(t){var e,r;if("$"==t&&B(),"string"==typeof t){if("@"==(v?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];"]"!=(t=D());r||(r=!0))r&&(","==t?"]"==(t=D())&&B():B()),","==t&&B(),e.push(O(t));return e}if("{"==t){for(e={};"}"!=(t=D());r||(r=!0))r&&(","==t?"}"==(t=D())&&B():B()),","!=t&&"string"==typeof t&&"@"==(v?t.charAt(0):t[0])&&":"==D()||B(),e[t.slice(1)]=O(D());return e}B()}return t},H=function(t,e,r){var i=I(t,e,r);i===_?delete t[e]:t[e]=i},I=function(t,e,r){var i,n=t[e];if("object"==typeof n&&n)if("[object Array]"==g.call(n))for(i=n.length;i--;)H(n,i,r);else m(n,function(t){H(n,t,r)});return r.call(t,e,n)};e.parse=function(t,e){var r,i;return L=0,T=""+t,r=O(D()),"$"!=D()&&B(),L=T=null,e&&"[object Function]"==g.call(e)?I((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 l=o.JSON,c=o.JSON3,h=!1,u=i(o,o.JSON3={noConflict:function(){return h||(h=!0,o.JSON=l,o.JSON3=c,l=c=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 l in t)o[l]=e(t[l]);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,l,c){if(!e)return e;if(t.Blob&&e instanceof Blob||t.File&&e instanceof File){o++;var h=new FileReader;h.onload=function(){c?c[l]=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){t.exports=function(t){return e.Buffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer}}).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 l.Encoder,this.decoder=new l.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),l=r(7),c=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=c(r,"open",function(){i.onopen(),t&&t()}),o=c(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 l=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(l)}})}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(c(t,"data",h(this,"ondata"))),this.subs.push(c(t,"ping",h(this,"onping"))),this.subs.push(c(t,"pong",h(this,"onpong"))),this.subs.push(c(t,"error",h(this,"onerror"))),this.subs.push(c(t,"close",h(this,"onclose"))),this.subs.push(c(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"),l=r(42),c=r(27),h=r(2),u=r(43),f=r(36);t.exports=i,i.priorWebsocketSuccess=!1,o(i.prototype),i.protocol=c.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=c.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"),c(),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,c(),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 l(t){h&&t.name!==h.name&&(a('"%s" works - aborting "%s"',t.name,h.name),r())}function c(){h.removeListener("open",e),h.removeListener("error",n),h.removeListener("close",s),f.removeListener("close",o),f.removeListener("upgrading",l)}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",l),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++)~l(this.transports,t[r])&&e.push(t[r]);return e}}).call(e,function(){return this}())},function(t,e,r){(function(t){var i=r(22),n=r(24),s=r(39),o=r(40);e.polling=function(e){var r=!1,o=!1,a=!1!==e.jsonp;if(t.location){var l="https:"===location.protocol,c=location.port;c||(c=l?443:80),r=e.hostname!==location.hostname||c!==e.port,o=e.secure!==l}if(e.xdomain=r,e.xscheme=o,"open"in new i(e)&&!e.forceJSONP)return new n(e);if(!a)throw new Error("JSONP disabled");return new s(e)},e.websocket=o}).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(l.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),l=r(25),c=r(35),h=r(37),u=r(3)("engine.io-client:polling-xhr");t.exports=n,t.exports.Request=s,h(n,l),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},c(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),l=r(38),c=r(3)("engine.io-client:polling");t.exports=i;var h=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(){c("paused"),r.readyState="paused",t()}var r=this;if(this.readyState="pausing",this.polling||!this.writable){var i=0;this.polling&&(c("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){c("pre-pause polling complete"),--i||e()})),this.writable||(c("we are currently writing - waiting to pause"),i++,this.once("drain",function(){c("pre-pause writing complete"),--i||e()}))}else e()},i.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},i.prototype.onData=function(t){var e=this;c("polling got data %s",t);o.decodePayload(t,this.socket.binaryType,function(t,r,i){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},i.prototype.doClose=function(){function t(){c("writing close packet"),e.write([{type:"close"}])}var e=this;"open"===this.readyState?(c("transport open - closing"),t()):(c("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]=l()),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]=g[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(y)return s(t,r,i);var n=new Uint8Array(1);return n[0]=g[t.type],i(new C([n.buffer,t.data]))}function a(t){try{t=d.decode(t)}catch(t){return!1}return t}function l(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 c,h=r(28),u=r(29),f=r(30),p=r(31),d=r(32);t&&t.ArrayBuffer&&(c=r(33));var m="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),_="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),y=m||_;e.protocol=3;var g=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},b=h(g),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 l=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&l instanceof ArrayBuffer)return n(e,r,a);if(C&&l instanceof t.Blob)return o(e,r,a);if(l&&l.base64)return i(e,a);var c=g[e.type];return void 0!==e.data&&(c+=s?d.encode(String(e.data)):String(e.data)),a(""+c)},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),l=new Array(a.length),c=0;c<a.length;c++)l[c]=a[c];o=String.fromCharCode.apply(null,l)}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&&b[n]?t.length>1?{type:b[n],data:t.substring(1)}:{type:b[n]}:v}var n=new Uint8Array(t)[0],s=f(t,1);return C&&"blob"===r&&(s=new C([s])),{type:b[n],data:s}},e.decodeBase64Packet=function(t,e){var r=b[t.charAt(0)];if(!c)return{type:r,data:{base64:!0,data:t.substr(1)}};var i=c.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"==typeof r&&(i=r,r=null);var s=u(t);return r&&s?C&&!y?e.encodePayloadAsBlob(t,i):e.encodePayloadAsArrayBuffer(t,i):t.length?void l(t,function(t,i){e.encodePacket(t,!!s&&r,!0,function(t){i(null,n(t))})},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="",l=0,c=t.length;l<c;l++){var h=t.charAt(l);if(":"!=h)a+=h;else{if(""==a||a!=(s=Number(a)))return i(v,0,1);if(o=t.substr(l+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,l+s,c))return}l+=s,a=""}}return""!=a?i(v,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){if(!t.length)return r(new ArrayBuffer(0));l(t,function(t,r){e.encodePacket(t,!0,!0,function(t){return r(null,t)})},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){l(t,function(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)}})},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),l=0===a[0],c="",h=1;255!=a[h];h++){if(c.length>310){o=!0;break}c+=a[h]}if(o)return i(v,0,1);n=f(n,2+c.length),c=parseInt(c);var u=f(n,0,c);if(l)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,c)}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){var i=r(15);t.exports=function(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(i(t)){for(var n=0;n<t.length;n++)if(r(t[n]))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)}}).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.exports=function(t,e,i){function n(t,r){if(n.count<=0)throw new Error("after called too many times");--n.count,t?(s=!0,e(t),e=i):0!==n.count||s||e(null,r)}var s=!1;return i=i||r,n.count=t,0===t?e():n}},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+=y((e-=65536)>>>10&1023|55296),e=56320|1023&e),n+=y(e);return n}function l(t,e){return y(t>>e&63|128)}function c(t){if(0==(4294967168&t))return y(t);var e="";return 0==(4294965248&t)?e=y(t>>6&31|192):0==(4294901760&t)?(e=y(t>>12&15|224),e+=l(t,6)):0==(4292870144&t)&&(e=y(t>>18&7|240),e+=l(t,12),e+=l(t,6)),e+=y(63&t|128)}function h(){if(_>=m)throw Error("Invalid byte index");var t=255&d[_];if(_++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function u(){var t,e,r,i,n;if(_>m)throw Error("Invalid byte index");if(_==m)return!1;if(t=255&d[_],_++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|(e=h()))>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if(e=h(),r=h(),(n=(15&t)<<12|e<<6|r)>=2048)return n;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=h(),r=h(),i=h(),(n=(15&t)<<18|e<<12|r<<6|i)>=65536&&n<=1114111))return n;throw Error("Invalid WTF-8 detected")}var f="object"==typeof e&&e,p=("object"==typeof t&&t&&t.exports,"object"==typeof n&&n);var d,m,_,y=String.fromCharCode,g={version:"1.0.0",encode:function(t){for(var e=o(t),r=e.length,i=-1,n="";++i<r;)n+=c(e[i]);return n},decode:function(t){d=o(t),m=d.length,_=0;for(var e,r=[];!1!==(e=u());)r.push(e);return a(r)}};void 0!==(i=function(){return g}.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,l=t.length,c=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var h=new ArrayBuffer(a),u=new Uint8Array(h);for(e=0;e<l;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[c++]=i<<2|n>>4,u[c++]=(15&n)<<4|s>>2,u[c++]=(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}}(),l=s&&s.prototype.append&&s.prototype.getBlob;t.exports=o?a?e.Blob:n:l?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=s[t%o]+e,t=Math.floor(t/o)}while(t>0);return e}function i(){var t=r(+new Date);return t!==n?(l=0,n=t):t+"."+r(l++)}for(var n,s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),o=64,a={},l=0,c=0;c<o;c++)a[s[c]]=c;i.encode=r,i.decode=function(t){var e=0;for(c=0;c<t.length;c++)e=e*o+a[t.charAt(c)];return e},t.exports=i},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,l=/\n/g,c=/\\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(c,"\\\n"),this.area.value=t.replace(l,"\\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),l=r(37),c=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,l(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]=c()),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),l=r(47),c=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",l(this,"onopen")),a(t,"packet",l(this,"onpacket")),a(t,"close",l(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]&&(c("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(){c("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){c("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||[];c("emitting event %j",e),null!=t.id&&(c("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);c("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?(c("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):c("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(){c("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&&(c("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){t.exports=function(t,e){for(var r=[],i=(e=e||0)||0;i<t.length;i++)r[i-e]=t[i];return r}},function(t,e){"use strict";t.exports=function(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,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),term.focus(),term.applyAddon(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
|