UNPKG

ttyplayer

Version:

====

2 lines 51.4 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TTYPlayer=e():t.TTYPlayer=e()}(this,function(){return function(t){function e(i){if(s[i])return s[i].exports;var r=s[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var s={};return e.m=t,e.c=s,e.p="/dist",e(0)}([function(t,e,s){"use strict";s(12);var i=s(8),r=s(1).interopRequireDefault(i),a=s(9),n=s(1).interopRequireDefault(a),o=s(4),h=s(1).interopRequireDefault(o),f=s(7),c=s(1).interopRequireDefault(f),l=s(2),u=s(5),d=s(1).interopRequireDefault(u),p=80,y=20,v=function(t){function e(t){s(1).classCallCheck(this,e);var i=s(1).possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),r=(0,l.assign)({},t);return r.rows||(r.rows=y),r.cols||(r.cols=p),i.options=r,i.mount(t.parent),i.createCorePlayer(),i.delegate(),i.createSpeedSelect(),i.bindEvent(),i.set("isPlaying",!1),i}return s(1).inherits(e,t),s(1).createClass(e,[{key:"onChange",value:function(t,e){if("isPlaying"===t)return this.refs.playButton.classList[e?"add":"remove"]("tty-hide"),void this.refs.pauseButton.classList[e?"remove":"add"]("tty-hide")}},{key:"mount",value:function(t){var e=(0,l.element)(d["default"]),s=e.element,i=e.refs;t.appendChild(s),this.element=s,this.parentNode=t,this.options.parent=i.body,this.refs=i}},{key:"unmount",value:function(){this.parentNode.removeChild(this.element)}},{key:"delegate",value:function(){var t=this,e=this.player;["play","resume","pause"].forEach(function(s){t[s]=e[s].bind(e)})}},{key:"bindEvent",value:function(){var t=this;this.refs.playButton.addEventListener("click",this.resume),this.refs.pauseButton.addEventListener("click",this.pause),this.player.on("play",function(){t.set("isPlaying",!0)}),this.player.on("pause",function(){t.set("isPlaying",!1)}),this.speedSelect.on("change",function(e){t.player.speed=e})}},{key:"unbindEvent",value:function(){this.refs.playButton.removeEventListener("click",this.resume),this.refs.pauseButton.removeEventListener("click",this.pause)}},{key:"createCorePlayer",value:function(){this.player=new r["default"](this.options)}},{key:"createSpeedSelect",value:function(){this.speedSelect=new n["default"](this.refs.speedButton,this.refs.speedSelect)}},{key:"load",value:function(t){var e=this;(0,l.fetchArrayBuffer)(t,function(t,s){if(t)return e.emit("loadError",t);var i=void 0;try{i=(0,c["default"])(s)}catch(t){return console.error(t),e.emit("loadError",t)}e.play(i)})}},{key:"destroy",value:function(){this.player.destroy(),this.speedSelect.destroy(),this.unbindEvent(),this.removeAllListeners(),this.unmount()}}]),e}(h["default"]);v.VERSION="0.2.1",t.exports=v},function(t,e){"use strict";var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};e.inherits=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":s(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},e.possibleConstructorReturn=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":s(e))&&"function"!=typeof e?t:e},e.createClass=function(){function t(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,s,i){return s&&t(e.prototype,s),i&&t(e,i),e}}(),e.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.interopRequireDefault=function(t){return t&&t.__esModule?t:{"default":t}}},function(t,e){"use strict";function s(t){return"[object Array]"===c.call(t)}function i(t){return"string"==typeof t}function r(t,e){for(var s in e)f.call(e,s)&&(t[s]=e[s]);return t}function a(t,e,s){return decodeURIComponent(escape(String.fromCharCode.apply(null,new Uint8Array(t,e,s))))}function n(t,e){var s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="arraybuffer",s.send();var i=new Error("XMLHttpRequest error.");s.onload=function(t){return/^2/.test(s.status)?void e(null,s.response):e(i)},s.onerror=function(t){return e(i)}}function o(t){l.innerHTML=t;for(var e=l.querySelectorAll("[ref]"),s={},i=0,r=e.length;i<r;i++){var a=e[i],n=a.getAttribute("ref");a.removeAttribute("ref"),s[n]=a}return{refs:s,element:l.children[0]}}function h(t,e){for(var s=t;s&&s!==document;){if(e(s))return s;s=s.parentNode}}Object.defineProperty(e,"__esModule",{value:!0}),e.isArray=s,e.isString=i,e.assign=r,e.readUtf8=a,e.fetchArrayBuffer=n,e.element=o,e.closet=h;var f=Object.prototype.hasOwnProperty,c=Object.prototype.toString,l=document.createElement("div")},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),s(6),s(11),e["default"]=function(){function t(){this._events=this._events||{}}function e(t,e,s,i){this.terminal=t,this.viewportElement=e,this.scrollArea=s,this.charMeasureElement=i,this.currentRowHeight=0,this.lastRecordedBufferLength=0,this.lastRecordedViewportHeight=0,this.terminal.on("scroll",this.syncScrollArea.bind(this)),this.terminal.on("resize",this.syncScrollArea.bind(this)),this.viewportElement.addEventListener("scroll",this.onScroll.bind(this)),this.syncScrollArea()}function i(e){var s=this;if(!(this instanceof i))return new i(arguments[0],arguments[1],arguments[2]);s.cancel=i.cancel,t.call(this),"number"==typeof e&&(e={cols:arguments[0],rows:arguments[1],handler:arguments[2]}),e=e||{},Object.keys(i.defaults).forEach(function(t){null==e[t]&&(e[t]=i.options[t],i[t]!==i.defaults[t]&&(e[t]=i[t])),s[t]=e[t]}),8===e.colors.length?e.colors=e.colors.concat(i._colors.slice(8)):16===e.colors.length?e.colors=e.colors.concat(i._colors.slice(16)):10===e.colors.length?e.colors=e.colors.slice(0,-2).concat(i._colors.slice(8,-2),e.colors.slice(-2)):18===e.colors.length&&(e.colors=e.colors.concat(i._colors.slice(16,-2),e.colors.slice(-2))),this.colors=e.colors,this.options=e,this.parent=e.body||e.parent||(d?d.getElementsByTagName("body")[0]:null),this.cols=e.cols||e.geometry[0],this.rows=e.rows||e.geometry[1],e.handler&&this.on("data",e.handler),this.ybase=0,this.ydisp=0,this.x=0,this.y=0,this.isRefreshing=!1,this.cursorState=0,this.cursorHidden=!1,this.convertEol,this.state=0,this.queue="",this.scrollTop=0,this.scrollBottom=this.rows-1,this.customKeydownHandler=null,this.applicationKeypad=!1,this.applicationCursor=!1,this.originMode=!1,this.insertMode=!1,this.wraparoundMode=!0,this.normal=null,this.charset=null,this.gcharset=null,this.glevel=0,this.charsets=[null],this.decLocator,this.x10Mouse,this.vt200Mouse,this.vt300Mouse,this.normalMouse,this.mouseEvents,this.sendFocus,this.utfMouse,this.sgrMouse,this.urxvtMouse,this.element,this.children,this.refreshStart,this.refreshEnd,this.savedX,this.savedY,this.savedCols,this.readable=!0,this.writable=!0,this.defAttr=131840,this.curAttr=this.defAttr,this.params=[],this.currentParam=0,this.prefix="",this.postfix="",this.surrogate_high="",this.lines=[];for(var r=this.rows;r--;)this.lines.push(this.blankLine());this.tabs,this.setupStops()}function r(t,e){for(var s=0;s<e.length;s+=1)if(t===e[s])return!0;return!1}function a(t,e,s,i){Array.isArray(t)||(t=[t]),t.forEach(function(t){t.addEventListener(e,s,i||!1)})}function n(t,e,s,i){t.removeEventListener(e,s,i||!1)}function o(t,e){if(this.cancelEvents||e)return t.preventDefault(),t.stopPropagation(),!1}function h(t,e){function s(){this.constructor=t}s.prototype=e.prototype,t.prototype=new s}function f(t){var e=t.getElementsByTagName("body")[0],s=t.createElement("span");s.innerHTML="hello world",e.appendChild(s);var i=s.scrollWidth;s.style.fontWeight="bold";var r=s.scrollWidth;return e.removeChild(s),i!==r}function c(t,e,s){var r=t<<16|e<<8|s;if(null!=c._cache[r])return c._cache[r];for(var a,n,o,h,f,l=1/0,u=-1,d=0;d<i.vcolors.length;d++){if(a=i.vcolors[d],n=a[0],o=a[1],h=a[2],f=c.distance(t,e,s,n,o,h),0===f){u=d;break}f<l&&(l=f,u=d)}return c._cache[r]=u}function l(t,e,s){if(t.forEach)return t.forEach(e,s);for(var i=0;i<t.length;i++)e.call(s,t[i],i,t)}function u(t){if(Object.keys)return Object.keys(t);var e,s=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&s.push(e);return s}var d=this.document;t.prototype.addListener=function(t,e){this._events[t]=this._events[t]||[],this._events[t].push(e)},t.prototype.on=t.prototype.addListener,t.prototype.removeListener=function(t,e){if(this._events[t])for(var s=this._events[t],i=s.length;i--;)if(s[i]===e||s[i].listener===e)return void s.splice(i,1)},t.prototype.off=t.prototype.removeListener,t.prototype.removeAllListeners=function(t){this._events[t]&&delete this._events[t]},t.prototype.once=function(t,e){function s(){var i=Array.prototype.slice.call(arguments);return this.removeListener(t,s),e.apply(this,i)}return s.listener=e,this.on(t,s)},t.prototype.emit=function(t){if(this._events[t])for(var e=Array.prototype.slice.call(arguments,1),s=this._events[t],i=s.length,r=0;r<i;r++)s[r].apply(this,e)},t.prototype.listeners=function(t){return this._events[t]=this._events[t]||[]},e.prototype.refresh=function(t){var e=t||this.charMeasureElement.getBoundingClientRect();e.height>0&&(e.height!==this.currentRowHeight&&(this.currentRowHeight=e.height,this.viewportElement.style.lineHeight=e.height+"px",this.terminal.rowContainer.style.lineHeight=e.height+"px"),this.lastRecordedViewportHeight!==this.terminal.rows&&(this.lastRecordedViewportHeight=this.terminal.rows,this.viewportElement.style.height=e.height*this.terminal.rows+"px"),this.scrollArea.style.height=e.height*this.lastRecordedBufferLength+"px")},e.prototype.syncScrollArea=function(){if(this.isApplicationMode)return this.lastRecordedBufferLength=this.terminal.rows,void this.refresh();if(this.lastRecordedBufferLength!==this.terminal.lines.length)this.lastRecordedBufferLength=this.terminal.lines.length,this.refresh();else if(this.lastRecordedViewportHeight!==this.terminal.rows)this.refresh();else{var t=this.charMeasureElement.getBoundingClientRect();t.height!==this.currentRowHeight&&this.refresh(t)}var e=this.terminal.ydisp*this.currentRowHeight;this.viewportElement.scrollTop!==e&&(this.viewportElement.scrollTop=e)},e.prototype.setApplicationMode=function(t){this.isApplicationMode=t,this.syncScrollArea()},e.prototype.onScroll=function(t){var e=Math.round(this.viewportElement.scrollTop/this.currentRowHeight),s=e-this.terminal.ydisp;this.terminal.scrollDisp(s,!0)},e.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()}};var p=0,y=1,v=2,m=3,b=4,g=5,k=6;h(i,t),i.prototype.eraseAttr=function(){return this.defAttr&-512|511&this.curAttr},i.tangoColors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],i.colors=function(){function t(t,s,i){r.push("#"+e(t)+e(s)+e(i))}function e(t){return t=t.toString(16),t.length<2?"0"+t:t}var s,r=i.tangoColors.slice(),a=[0,95,135,175,215,255];for(s=0;s<216;s++)t(a[s/36%6|0],a[s/6%6|0],a[s%6]);for(s=0;s<24;s++)a=8+10*s,t(a,a,a);return r}(),i._colors=i.colors.slice(),i.vcolors=function(){for(var t,e=[],s=i.colors,r=0;r<256;r++)t=parseInt(s[r].substring(1),16),e.push([t>>16&255,t>>8&255,255&t]);return e}(),i.defaults={colors:i.colors,theme:"default",convertEol:!1,termName:"xterm",geometry:[80,24],cursorBlink:!1,visualBell:!1,popOnBell:!1,scrollback:1e3,screenKeys:!1,debug:!1,cancelEvents:!1},i.options={},i.focus=null,l(u(i.defaults),function(t){i[t]=i.defaults[t],i.options[t]=i.defaults[t]}),i.prototype.focus=function(){return this.textarea.focus()},i.prototype.blur=function(){return this.textarea.blur()},i.prototype.initGlobal=function(){var t=this;w(function(){t.send(""),t.element.classList.add("focus"),t.showCursor()})},i.prepareCopiedTextForClipboard=function(t){var e=x.fromCharCode(32),s=x.fromCharCode(160),i=new RegExp(s,"g"),r=t.split("\n").map(function(t){var s=t.replace(/\s+$/g,"").replace(i,e);return s}).join("\n");return r},i.prototype.insertRow=function(t){return"object"!=("undefined"==typeof t?"undefined":s(1)["typeof"](t))&&(t=d.createElement("div")),this.rowContainer.appendChild(t),this.children.push(t),t},i.prototype.open=function(t){var s=this,n=0;if(this.parent=t||this.parent,!this.parent)throw new Error("Terminal requires a parent element.");for(this.context=this.parent.ownerDocument.defaultView,this.document=this.parent.ownerDocument,this.body=this.document.getElementsByTagName("body")[0],this.context.navigator&&this.context.navigator.userAgent&&(this.isMSIE=!!~this.context.navigator.userAgent.indexOf("MSIE")),this.context.navigator&&this.context.navigator.platform&&(this.isMac=r(this.context.navigator.platform,["Macintosh","MacIntel","MacPPC","Mac68K"]),this.isIpad="iPad"===this.context.navigator.platform,this.isIphone="iPhone"===this.context.navigator.platform,this.isMSWindows=r(this.context.navigator.platform,["Windows","Win16","Win32","WinCE"])),this.element=this.document.createElement("div"),this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.classList.add("xterm-theme-"+this.theme),this.element.style.height,this.element.setAttribute("tabindex",0),this.viewportElement=d.createElement("div"),this.viewportElement.classList.add("xterm-viewport"),this.element.appendChild(this.viewportElement),this.viewportScrollArea=d.createElement("div"),this.viewportScrollArea.classList.add("xterm-scroll-area"),this.viewportElement.appendChild(this.viewportScrollArea),this.rowContainer=d.createElement("div"),this.rowContainer.classList.add("xterm-rows"),this.element.appendChild(this.rowContainer),this.children=[],this.helperContainer=d.createElement("div"),this.helperContainer.classList.add("xterm-helpers"),this.element.appendChild(this.helperContainer),this.textarea=d.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.helperContainer.appendChild(this.textarea),this.compositionView=d.createElement("div"),this.compositionView.classList.add("composition-view"),this.helperContainer.appendChild(this.compositionView),this.charMeasureElement=d.createElement("div"),this.charMeasureElement.classList.add("xterm-char-measure-element"),this.charMeasureElement.innerHTML="W",this.helperContainer.appendChild(this.charMeasureElement);n<this.rows;n++)this.insertRow();this.parent.appendChild(this.element),this.viewport=new e(this,this.viewportElement,this.viewportScrollArea,this.charMeasureElement),this.refresh(0,this.rows-1),this.initGlobal(),this.focus(),a(this.element,"mouseup",function(){var t=d.getSelection(),e=t.isCollapsed,i="boolean"==typeof e?!e:"Range"==t.type;i||s.focus()}),null==i.brokenBold&&(i.brokenBold=f(this.document)),this.emit("open")},i.prototype.destroy=function(){this.readable=!1,this.writable=!1,this._events={},this.handler=function(){},this.write=function(){},this.element.parentNode&&this.element.parentNode.removeChild(this.element)},i.flags={BOLD:1,UNDERLINE:2,BLINK:4,INVERSE:8,INVISIBLE:16},i.prototype.refresh=function(t,e,s){var r=this;if(s="undefined"==typeof s||s)return void(this._refreshIsQueued?this._fullRefreshNext=!0:(w(function(){r.refresh(t,e,!1)},34),this._refreshIsQueued=!0));this._refreshIsQueued=!1,this._fullRefreshNext&&(t=0,e=this.rows-1,this._fullRefreshNext=!1);var a,n,o,h,f,c,l,u,p,y,v,m,b,g,k;d.activeElement;for(e-t>=this.rows/2&&(k=this.element.parentNode,k&&this.element.removeChild(this.rowContainer)),u=this.cols,n=t,e>=this.rows.length&&(this.log("`end` is too large. Most likely a bad CSR."),e=this.rows.length-1);n<=e;n++){for(g=n+this.ydisp,h=this.lines[g],f="",a=this.y===n-(this.ybase-this.ydisp)&&this.cursorState&&!this.cursorHidden?this.x:-1,y=this.defAttr,o=0;o<u;o++)if(p=h[o][0],c=h[o][1],l=h[o][2]){if(o===a&&(p=-1),p!==y&&(y!==this.defAttr&&(f+="</span>"),p!==this.defAttr))if(p===-1)f+='<span class="reverse-video terminal-cursor',this.cursorBlink&&(f+=" blinking"),f+='">';else{var x=[];v=511&p,m=p>>9&511,b=p>>18,b&i.flags.BOLD&&(i.brokenBold||x.push("xterm-bold"),m<8&&(m+=8)),b&i.flags.UNDERLINE&&x.push("xterm-underline"),b&i.flags.BLINK&&x.push("xterm-blink"),b&i.flags.INVERSE&&(v=[m,m=v][0],1&b&&m<8&&(m+=8)),b&i.flags.INVISIBLE&&x.push("xterm-hidden"),b&i.flags.INVERSE&&(257==v&&(v=15),256==m&&(m=0)),v<256&&x.push("xbg-"+v),m<256&&x.push("xc-"+m),f+="<span",x.length&&(f+=' class="'+x.join(" ")+'"'),f+=">"}switch(c){case"&":f+="&amp;";break;case"<":f+="&lt;";break;case">":f+="&gt;";break;default:f+=c<=" "?"&nbsp;":c}y=p}y!==this.defAttr&&(f+="</span>"),this.children[n].innerHTML=f}k&&this.element.appendChild(this.rowContainer),this.emit("refresh",{element:this.element,start:t,end:e})},i.prototype.showCursor=function(){this.cursorState||(this.cursorState=1,this.refresh(this.y,this.y))},i.prototype.scroll=function(){var t;++this.ybase===this.scrollback&&(this.ybase=this.ybase/2|0,this.lines=this.lines.slice(-(this.ybase+this.rows)+1)),this.ydisp=this.ybase,t=this.ybase+this.rows-1,t-=this.rows-1-this.scrollBottom,t===this.lines.length?this.lines.push(this.blankLine()):this.lines.splice(t,0,this.blankLine()),0!==this.scrollTop&&(0!==this.ybase&&(this.ybase--,this.ydisp=this.ybase),this.lines.splice(this.ybase+this.scrollTop,1)),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom),this.emit("scroll",this.ydisp)},i.prototype.scrollDisp=function(t,e){this.ydisp+=t,this.ydisp>this.ybase?this.ydisp=this.ybase:this.ydisp<0&&(this.ydisp=0),e||this.emit("scroll",this.ydisp),this.refresh(0,this.rows-1)},i.prototype.write=function(t){var e,s,r,a,n,o,h=t.length,f=0;for(this.refreshStart=this.y,this.refreshEnd=this.y,this.ybase!==this.ydisp&&(this.ydisp=this.ybase,this.emit("scroll",this.ydisp),this.maxRange()),this.surrogate_high&&(t=this.surrogate_high+t,this.surrogate_high="");f<h;f++){if(s=t[f],r=t.charCodeAt(f),55296<=r&&r<=56319){if(a=t.charCodeAt(f+1),isNaN(a)){this.surrogate_high=s;continue}r=1024*(r-55296)+(a-56320)+65536,s+=t.charAt(f+1)}if(!(56320<=r&&r<=57343))switch(this.state){case p:switch(s){case"":this.bell();break;case"\n":case"\x0B":case"\f":this.convertEol&&(this.x=0),this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll());break;case"\r":this.x=0;break;case"\b":this.x>0&&this.x--;break;case"\t":this.x=this.nextStop();break;case"":this.setgLevel(1);break;case"":this.setgLevel(0);break;case"":this.state=y;break;default:if(n=C(r),s>=" "){if(this.charset&&this.charset[s]&&(s=this.charset[s]),o=this.y+this.ybase,!n&&this.x){this.lines[o][this.x-1]&&(this.lines[o][this.x-1][2]?this.lines[o][this.x-1][1]+=s:this.lines[o][this.x-2]&&(this.lines[o][this.x-2][1]+=s),this.updateRange(this.y));break}if(this.x+n-1>=this.cols)if(this.wraparoundMode)this.x=0,this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll());else if(this.x=this.cols-1,2===n)continue;if(o=this.y+this.ybase,this.insertMode)for(var c=0;c<n;++c){var l=this.lines[this.y+this.ybase].pop();0===l[2]&&this.lines[o][this.cols-2]&&2===this.lines[o][this.cols-2][2]&&(this.lines[o][this.cols-2]=[this.curAttr," ",1]),this.lines[o].splice(this.x,0,[this.curAttr," ",1])}this.lines[o][this.x]=[this.curAttr,s,n],this.x++,this.updateRange(this.y),2===n&&(this.lines[o][this.x]=[this.curAttr,"",0],this.x++)}}break;case y:switch(s){case"[":this.params=[],this.currentParam=0,this.state=v;break;case"]":this.params=[],this.currentParam=0,this.state=m;break;case"P":this.params=[],this.currentParam=0,this.state=g;break;case"_":this.state=k;break;case"^":this.state=k;break;case"c":this.reset();break;case"E":this.x=0;case"D":this.index();break;case"M":this.reverseIndex();break;case"%":this.setgLevel(0),this.setgCharset(0,i.charsets.US),this.state=p,f++;break;case"(":case")":case"*":case"+":case"-":case".":switch(s){case"(":this.gcharset=0;break;case")":this.gcharset=1;break;case"*":this.gcharset=2;break;case"+":this.gcharset=3;break;case"-":this.gcharset=1;break;case".":this.gcharset=2}this.state=b;break;case"/":this.gcharset=3,this.state=b,f--;break;case"N":break;case"O":break;case"n":this.setgLevel(2);break;case"o":this.setgLevel(3);break;case"|":this.setgLevel(3);break;case"}":this.setgLevel(2);break;case"~":this.setgLevel(1);break;case"7":this.saveCursor(),this.state=p;break;case"8":this.restoreCursor(),this.state=p;break;case"#":this.state=p,f++;break;case"H":this.tabSet();break;case"=":this.log("Serial port requested application keypad."),this.applicationKeypad=!0,this.viewport.setApplicationMode(!0),this.state=p;break;case">":this.log("Switching back to normal keypad."),this.applicationKeypad=!1,this.viewport.setApplicationMode(!1),this.state=p;break;default:this.state=p,this.error("Unknown ESC control: %s.",s)}break;case b:switch(s){case"0":e=i.charsets.SCLD;break;case"A":e=i.charsets.UK;break;case"B":e=i.charsets.US;break;case"4":e=i.charsets.Dutch;break;case"C":case"5":e=i.charsets.Finnish;break;case"R":e=i.charsets.French;break;case"Q":e=i.charsets.FrenchCanadian;break;case"K":e=i.charsets.German;break;case"Y":e=i.charsets.Italian;break;case"E":case"6":e=i.charsets.NorwegianDanish;break;case"Z":e=i.charsets.Spanish;break;case"H":case"7":e=i.charsets.Swedish;break;case"=":e=i.charsets.Swiss;break;case"/":e=i.charsets.ISOLatin,f++;break;default:e=i.charsets.US}this.setgCharset(this.gcharset,e),this.gcharset=null,this.state=p;break;case m:if(""===s||""===s){switch(""===s&&f++,this.params.push(this.currentParam),this.params[0]){case 0:case 1:case 2:this.params[1]&&(this.title=this.params[1],this.handleTitle(this.title));break;case 3:break;case 4:case 5:break;case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:break;case 46:break;case 50:break;case 51:break;case 52:break;case 104:case 105:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:}this.params=[],this.currentParam=0,this.state=p}else this.params.length?this.currentParam+=s:s>="0"&&s<="9"?this.currentParam=10*this.currentParam+s.charCodeAt(0)-48:";"===s&&(this.params.push(this.currentParam),this.currentParam="");break;case v:if("?"===s||">"===s||"!"===s){this.prefix=s;break}if(s>="0"&&s<="9"){this.currentParam=10*this.currentParam+s.charCodeAt(0)-48;break}if("$"===s||'"'===s||" "===s||"'"===s){this.postfix=s;break}if(this.params.push(this.currentParam),this.currentParam=0,";"===s)break;switch(this.state=p,s){case"A":this.cursorUp(this.params);break;case"B":this.cursorDown(this.params);break;case"C":this.cursorForward(this.params);break;case"D":this.cursorBackward(this.params);break;case"H":this.cursorPos(this.params);break;case"J":this.eraseInDisplay(this.params);break;case"K":this.eraseInLine(this.params);break;case"m":this.prefix||this.charAttributes(this.params);break;case"n":this.prefix||this.deviceStatus(this.params);break;case"@":this.insertChars(this.params);break;case"E":this.cursorNextLine(this.params);break;case"F":this.cursorPrecedingLine(this.params);break;case"G":this.cursorCharAbsolute(this.params);break;case"L":this.insertLines(this.params);break;case"M":this.deleteLines(this.params);break;case"P":this.deleteChars(this.params);break;case"X":this.eraseChars(this.params);break;case"`":this.charPosAbsolute(this.params);break;case"a":this.HPositionRelative(this.params);break;case"c":this.sendDeviceAttributes(this.params);break;case"d":this.linePosAbsolute(this.params);break;case"e":this.VPositionRelative(this.params);break;case"f":this.HVPosition(this.params);break;case"h":break;case"l":break;case"r":this.setScrollRegion(this.params);break;case"s":this.saveCursor(this.params);break;case"u":this.restoreCursor(this.params);break;case"I":this.cursorForwardTab(this.params);break;case"S":this.scrollUp(this.params);break;case"T":this.params.length<2&&!this.prefix&&this.scrollDown(this.params);break;case"Z":this.cursorBackwardTab(this.params);break;case"b":this.repeatPrecedingCharacter(this.params);break;case"g":this.tabClear(this.params);break;case"p":switch(this.prefix){case"!":this.softReset(this.params)}break;default:this.error("Unknown CSI code: %s.",s)}this.prefix="",this.postfix="";break;case g:if(""===s||""===s){switch(""===s&&f++,this.prefix){case"":break;case"$q":var u=this.currentParam,d=!1;switch(u){case'"q':u='0"q';break;case'"p':u='61"p';break;case"r":u=""+(this.scrollTop+1)+";"+(this.scrollBottom+1)+"r";break;case"m":u="0m";break;default:this.error("Unknown DCS Pt: %s.",u),u=""}this.send("P"+ +d+"$r"+u+"\\");break;case"+p":break;case"+q":var u=this.currentParam,d=!1;this.send("P"+ +d+"+r"+u+"\\");break;default:this.error("Unknown DCS prefix: %s.",this.prefix)}this.currentParam=0,this.prefix="",this.state=p}else this.currentParam?this.currentParam+=s:this.prefix||"$"===s||"+"===s?2===this.prefix.length?this.currentParam=s:this.prefix+=s:this.currentParam=s;break;case k:""!==s&&""!==s||(""===s&&f++,this.state=p)}}this.updateRange(this.y),this.refresh(this.refreshStart,this.refreshEnd)},i.prototype.writeln=function(t){this.write(t+"\r\n")},i.prototype.attachCustomKeydownHandler=function(t){this.customKeydownHandler=t},i.prototype.setgLevel=function(t){this.glevel=t,this.charset=this.charsets[t]},i.prototype.setgCharset=function(t,e){this.charsets[t]=e,this.glevel===t&&(this.charset=e)},i.prototype.send=function(t){var e=this;this.queue||w(function(){e.handler(e.queue),e.queue=""},1),this.queue+=t},i.prototype.bell=function(){if(this.visualBell){var t=this;this.element.style.borderColor="white",w(function(){t.element.style.borderColor=""},10),this.popOnBell&&this.focus()}},i.prototype.log=function(){if(this.debug&&this.context.console&&this.context.console.log){var t=Array.prototype.slice.call(arguments);this.context.console.log.apply(this.context.console,t)}},i.prototype.error=function(){if(this.debug&&this.context.console&&this.context.console.error){var t=Array.prototype.slice.call(arguments);this.context.console.error.apply(this.context.console,t)}},i.prototype.resize=function(t,e){var s,i,r,a,n;if(t!==this.cols||e!==this.rows){if(t<1&&(t=1),e<1&&(e=1),r=this.cols,r<t)for(a=[this.defAttr," ",1],i=this.lines.length;i--;)for(;this.lines[i].length<t;)this.lines[i].push(a);else for(i=this.lines.length;i--;)for(;this.lines[i].length>t;)this.lines[i].pop();if(this.setupStops(r),this.cols=t,r=this.rows,n=0,r<e)for(s=this.element;r++<e;)this.lines.length<e+this.ybase&&(this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(this.blankLine())),this.children.length<e&&this.insertRow();else for(;r-- >e;)if(this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++)),this.children.length>e){if(s=this.children.shift(),!s)continue;s.parentNode.removeChild(s)}this.rows=e,this.y>=e&&(this.y=e-1),n&&(this.y+=n),this.x>=t&&(this.x=t-1),this.scrollTop=0,this.scrollBottom=e-1,this.refresh(0,this.rows-1),this.normal=null,this.emit("resize",{terminal:this,cols:t,rows:e})}},i.prototype.updateRange=function(t){t<this.refreshStart&&(this.refreshStart=t),t>this.refreshEnd&&(this.refreshEnd=t)},i.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1},i.prototype.setupStops=function(t){for(null!=t?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this.cols;t+=8)this.tabs[t]=!0},i.prototype.prevStop=function(t){for(null==t&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this.cols?this.cols-1:t<0?0:t},i.prototype.nextStop=function(t){for(null==t&&(t=this.x);!this.tabs[++t]&&t<this.cols;);return t>=this.cols?this.cols-1:t<0?0:t},i.prototype.eraseRight=function(t,e){for(var s=this.lines[this.ybase+e],i=[this.eraseAttr()," ",1];t<this.cols;t++)s[t]=i;this.updateRange(e)},i.prototype.eraseLeft=function(t,e){var s=this.lines[this.ybase+e],i=[this.eraseAttr()," ",1];for(t++;t--;)s[t]=i;this.updateRange(e)},i.prototype.eraseLine=function(t){this.eraseRight(0,t)},i.prototype.blankLine=function(t){for(var e=t?this.eraseAttr():this.defAttr,s=[e," ",1],i=[],r=0;r<this.cols;r++)i[r]=s;return i},i.prototype.ch=function(t){return t?[this.eraseAttr()," ",1]:[this.defAttr," ",1]},i.prototype.is=function(t){var e=this.termName;return 0===(e+"").indexOf(t)},i.prototype.handler=function(t){this.emit("data",t)},i.prototype.handleTitle=function(t){this.emit("title",t)},i.prototype.index=function(){this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll()),this.state=p},i.prototype.reverseIndex=function(){var t;this.y--,this.y<this.scrollTop&&(this.y++,this.lines.splice(this.y+this.ybase,0,this.blankLine(!0)),t=this.rows-1-this.scrollBottom,this.lines.splice(this.rows-1+this.ybase-t+1,1),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)),this.state=p},i.prototype.reset=function(){this.options.rows=this.rows,this.options.cols=this.cols,i.call(this,this.options),this.refresh(0,this.rows-1)},i.prototype.tabSet=function(){this.tabs[this.x]=!0,this.state=p},i.prototype.cursorUp=function(t){var e=t[0];e<1&&(e=1),this.y-=e,this.y<0&&(this.y=0)},i.prototype.cursorDown=function(t){var e=t[0];e<1&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1)},i.prototype.cursorForward=function(t){var e=t[0];e<1&&(e=1),this.x+=e,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.cursorBackward=function(t){var e=t[0];e<1&&(e=1),this.x-=e,this.x<0&&(this.x=0)},i.prototype.cursorPos=function(t){var e,s;e=t[0]-1,s=t.length>=2?t[1]-1:0,e<0?e=0:e>=this.rows&&(e=this.rows-1),s<0?s=0:s>=this.cols&&(s=this.cols-1),this.x=s,this.y=e},i.prototype.eraseInDisplay=function(t){var e;switch(t[0]){case 0:for(this.eraseRight(this.x,this.y),e=this.y+1;e<this.rows;e++)this.eraseLine(e);break;case 1:for(this.eraseLeft(this.x,this.y),e=this.y;e--;)this.eraseLine(e);break;case 2:for(e=this.rows;e--;)this.eraseLine(e);break;case 3:}},i.prototype.eraseInLine=function(t){switch(t[0]){case 0:this.eraseRight(this.x,this.y);break;case 1:this.eraseLeft(this.x,this.y);break;case 2:this.eraseLine(this.y)}},i.prototype.charAttributes=function(t){if(1===t.length&&0===t[0])return void(this.curAttr=this.defAttr);for(var e,s=t.length,i=0,r=this.curAttr>>18,a=this.curAttr>>9&511,n=511&this.curAttr;i<s;i++)e=t[i],e>=30&&e<=37?a=e-30:e>=40&&e<=47?n=e-40:e>=90&&e<=97?(e+=8,a=e-90):e>=100&&e<=107?(e+=8,n=e-100):0===e?(r=this.defAttr>>18,a=this.defAttr>>9&511,n=511&this.defAttr):1===e?r|=1:4===e?r|=2:5===e?r|=4:7===e?r|=8:8===e?r|=16:22===e?r&=-2:24===e?r&=-3:25===e?r&=-5:27===e?r&=-9:28===e?r&=-17:39===e?a=this.defAttr>>9&511:49===e?n=511&this.defAttr:38===e?2===t[i+1]?(i+=2,a=c(255&t[i],255&t[i+1],255&t[i+2]),a===-1&&(a=511),i+=2):5===t[i+1]&&(i+=2,e=255&t[i],a=e):48===e?2===t[i+1]?(i+=2,n=c(255&t[i],255&t[i+1],255&t[i+2]),n===-1&&(n=511),i+=2):5===t[i+1]&&(i+=2,e=255&t[i],n=e):100===e?(a=this.defAttr>>9&511,n=511&this.defAttr):this.error("Unknown SGR attribute: %d.",e);this.curAttr=r<<18|a<<9|n},i.prototype.deviceStatus=function(t){if(this.prefix){if("?"===this.prefix)switch(t[0]){case 6:this.send("[?"+(this.y+1)+";"+(this.x+1)+"R");break;case 15:break;case 25:break;case 26:break;case 53:}}else switch(t[0]){case 5:this.send("");break;case 6:this.send("["+(this.y+1)+";"+(this.x+1)+"R")}},i.prototype.insertChars=function(t){var e,s,i,r;for(e=t[0],e<1&&(e=1),s=this.y+this.ybase,i=this.x,r=[this.eraseAttr()," ",1];e--&&i<this.cols;)this.lines[s].splice(i++,0,r),this.lines[s].pop()},i.prototype.cursorNextLine=function(t){var e=t[0];e<1&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1), this.x=0},i.prototype.cursorPrecedingLine=function(t){var e=t[0];e<1&&(e=1),this.y-=e,this.y<0&&(this.y=0),this.x=0},i.prototype.cursorCharAbsolute=function(t){var e=t[0];e<1&&(e=1),this.x=e-1},i.prototype.insertLines=function(t){var e,s,i;for(e=t[0],e<1&&(e=1),s=this.y+this.ybase,i=this.rows-1-this.scrollBottom,i=this.rows-1+this.ybase-i+1;e--;)this.lines.splice(s,0,this.blankLine(!0)),this.lines.splice(i,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},i.prototype.deleteLines=function(t){var e,s,i;for(e=t[0],e<1&&(e=1),s=this.y+this.ybase,i=this.rows-1-this.scrollBottom,i=this.rows-1+this.ybase-i;e--;)this.lines.splice(i+1,0,this.blankLine(!0)),this.lines.splice(s,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},i.prototype.deleteChars=function(t){var e,s,i;for(e=t[0],e<1&&(e=1),s=this.y+this.ybase,i=[this.eraseAttr()," ",1];e--;)this.lines[s].splice(this.x,1),this.lines[s].push(i)},i.prototype.eraseChars=function(t){var e,s,i,r;for(e=t[0],e<1&&(e=1),s=this.y+this.ybase,i=this.x,r=[this.eraseAttr()," ",1];e--&&i<this.cols;)this.lines[s][i++]=r},i.prototype.charPosAbsolute=function(t){var e=t[0];e<1&&(e=1),this.x=e-1,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.HPositionRelative=function(t){var e=t[0];e<1&&(e=1),this.x+=e,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.sendDeviceAttributes=function(t){t[0]>0||(this.prefix?">"===this.prefix&&(this.is("xterm")?this.send("[>0;276;0c"):this.is("rxvt-unicode")?this.send("[>85;95;0c"):this.is("linux")?this.send(t[0]+"c"):this.is("screen")&&this.send("[>83;40003;0c")):this.is("xterm")||this.is("rxvt-unicode")||this.is("screen")?this.send("[?1;2c"):this.is("linux")&&this.send("[?6c"))},i.prototype.linePosAbsolute=function(t){var e=t[0];e<1&&(e=1),this.y=e-1,this.y>=this.rows&&(this.y=this.rows-1)},i.prototype.VPositionRelative=function(t){var e=t[0];e<1&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1)},i.prototype.HVPosition=function(t){t[0]<1&&(t[0]=1),t[1]<1&&(t[1]=1),this.y=t[0]-1,this.y>=this.rows&&(this.y=this.rows-1),this.x=t[1]-1,this.x>=this.cols&&(this.x=this.cols-1)},i.prototype.setScrollRegion=function(t){this.prefix||(this.scrollTop=(t[0]||1)-1,this.scrollBottom=(t[1]||this.rows)-1,this.x=0,this.y=0)},i.prototype.saveCursor=function(t){this.savedX=this.x,this.savedY=this.y},i.prototype.restoreCursor=function(t){this.x=this.savedX||0,this.y=this.savedY||0},i.prototype.cursorForwardTab=function(t){for(var e=t[0]||1;e--;)this.x=this.nextStop()},i.prototype.scrollUp=function(t){for(var e=t[0]||1;e--;)this.lines.splice(this.ybase+this.scrollTop,1),this.lines.splice(this.ybase+this.scrollBottom,0,this.blankLine());this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)},i.prototype.scrollDown=function(t){for(var e=t[0]||1;e--;)this.lines.splice(this.ybase+this.scrollBottom,1),this.lines.splice(this.ybase+this.scrollTop,0,this.blankLine());this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)},i.prototype.initMouseTracking=function(t){},i.prototype.resetTitleModes=function(t){},i.prototype.cursorBackwardTab=function(t){for(var e=t[0]||1;e--;)this.x=this.prevStop()},i.prototype.repeatPrecedingCharacter=function(t){for(var e=t[0]||1,s=this.lines[this.ybase+this.y],i=s[this.x-1]||[this.defAttr," ",1];e--;)s[this.x++]=i},i.prototype.tabClear=function(t){var e=t[0];e<=0?delete this.tabs[this.x]:3===e&&(this.tabs={})},i.prototype.mediaCopy=function(t){},i.prototype.setResources=function(t){},i.prototype.disableModifiers=function(t){},i.prototype.setPointerMode=function(t){},i.prototype.softReset=function(t){this.cursorHidden=!1,this.insertMode=!1,this.originMode=!1,this.wraparoundMode=!1,this.applicationKeypad=!1,this.applicationCursor=!1,this.scrollTop=0,this.scrollBottom=this.rows-1,this.curAttr=this.defAttr,this.x=this.y=0,this.charset=null,this.glevel=0,this.charsets=[null]},i.prototype.requestAnsiMode=function(t){},i.prototype.requestPrivateMode=function(t){},i.prototype.setConformanceLevel=function(t){},i.prototype.loadLEDs=function(t){},i.prototype.setCursorStyle=function(t){},i.prototype.setCharProtectionAttr=function(t){},i.prototype.restorePrivateValues=function(t){},i.prototype.setAttrInRectangle=function(t){for(var e,s,i=t[0],r=t[1],a=t[2],n=t[3],o=t[4];i<a+1;i++)for(e=this.lines[this.ybase+i],s=r;s<n;s++)e[s]=[o,e[s][1]];this.updateRange(t[0]),this.updateRange(t[2])},i.prototype.fillRectangle=function(t){for(var e,s,i=t[0],r=t[1],a=t[2],n=t[3],o=t[4];r<n+1;r++)for(e=this.lines[this.ybase+r],s=a;s<o;s++)e[s]=[e[s][0],x.fromCharCode(i)];this.updateRange(t[1]),this.updateRange(t[3])},i.prototype.enableLocatorReporting=function(t){t[0]>0},i.prototype.eraseRectangle=function(t){var e,s,i,r=t[0],a=t[1],n=t[2],o=t[3];for(i=[this.eraseAttr()," ",1];r<n+1;r++)for(e=this.lines[this.ybase+r],s=a;s<o;s++)e[s]=i;this.updateRange(t[0]),this.updateRange(t[2])},i.prototype.insertColumns=function(){for(var t,e=params[0],s=this.ybase+this.rows,i=[this.eraseAttr()," ",1];e--;)for(t=this.ybase;t<s;t++)this.lines[t].splice(this.x+1,0,i),this.lines[t].pop();this.maxRange()},i.prototype.deleteColumns=function(){for(var t,e=params[0],s=this.ybase+this.rows,i=[this.eraseAttr()," ",1];e--;)for(t=this.ybase;t<s;t++)this.lines[t].splice(this.x,1),this.lines[t].push(i);this.maxRange()},i.charsets={},i.charsets.SCLD={"`":"◆",a:"▒",b:"\t",c:"\f",d:"\r",e:"\n",f:"°",g:"±",h:"␤",i:"\x0B",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},i.charsets.UK=null,i.charsets.US=null,i.charsets.Dutch=null,i.charsets.Finnish=null,i.charsets.French=null,i.charsets.FrenchCanadian=null,i.charsets.German=null,i.charsets.Italian=null,i.charsets.NorwegianDanish=null,i.charsets.Spanish=null,i.charsets.Swedish=null,i.charsets.Swiss=null,i.charsets.ISOLatin=null;var x=this.String,w=this.setTimeout;this.setInterval;c._cache={},c.distance=function(t,e,s,i,r,a){return Math.pow(30*(t-i),2)+Math.pow(59*(e-r),2)+Math.pow(11*(s-a),2)};var C=function(t){function e(t){var e,s=0,r=i.length-1;if(t<i[0][0]||t>i[r][1])return!1;for(;r>=s;)if(e=Math.floor((s+r)/2),t>i[e][1])s=e+1;else{if(!(t<i[e][0]))return!0;r=e-1}return!1}function s(s){return 0===s?t.nul:s<32||s>=127&&s<160?t.control:e(s)?0:1+(s>=4352&&(s<=4447||9001==s||9002==s||s>=11904&&s<=42191&&12351!=s||s>=44032&&s<=55203||s>=63744&&s<=64255||s>=65040&&s<=65049||s>=65072&&s<=65135||s>=65280&&s<=65376||s>=65504&&s<=65510||s>=131072&&s<=196605||s>=196608&&s<=262141))}var i=[[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],[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]];return s}({nul:0,control:0});return i.EventEmitter=t,i.Viewport=e,i.inherits=h,i.on=a,i.off=n,i.cancel=o,i}.call(window)},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=s(3),r=s(1).interopRequireDefault(i),a=r["default"].EventEmitter,n=function(t){function e(){return s(1).classCallCheck(this,e),s(1).possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this))}return s(1).inherits(e,t),s(1).createClass(e,[{key:"set",value:function(t,e){var s=this.data||(this.data={}),i=this.get(t);s[t]=e,i!==e&&this.onChange&&this.onChange(t,e)}},{key:"get",value:function(t){return this.data&&this.data[t]}}]),e}(a);e["default"]=n},function(t,e){t.exports='<div class="ttyplayer" ref="container">\n<header class="ttyplayer-header"><a href="https://meowtec.github.io/ttyplayer.js/" target="_blank">TTYPlayer</a></header>\n<div class="ttyplayer-body" ref="body"></div>\n<footer class="ttyplayer-footer">\n<button class="tty-play tty-hide" ref="playButton">\n<i></i>\n<span>play</span>\n</button>\n<button class="tty-pause tty-hide" ref="pauseButton">\n<i></i>\n<span>pause</span>\n</button>\n<div class="tty-button-wrap">\n<div class="tty-select-wrap" ref="speedSelect">\n<div class="tty-select">\n<a href="#" data-value="8">8x</a>\n<a href="#" data-value="4">4x</a>\n<a href="#" data-value="2">2x</a>\n<a href="#" data-value="1">1x</a>\n<a href="#" data-value="0.5">0.5x</a>\n<a href="#" data-value="0.25">0.25x</a>\n</div>\n</div>\n<button class="tty-speed" ref="speedButton">\n1x\n</button>\n</div>\n</footer>\n</div>\n'},function(t,e){"use strict";var s=[["2e3436","cc0000","4e9a06","c4a000","3465a4","75507b","06989a","d3d7cf","555753","ef2929","8ae234","fce94f","729fcf","ad7fa8","34e2e2","eeeeec","000000","00005f","000087","0000af","0000d7","0000ff","005f00","005f5f","005f87","005faf","005fd7","005fff","008700","00875f","008787","0087af","0087d7","0087ff","00af00","00af5f","00af87","00afaf","00afd7","00afff","00d700","00d75f","00d787","00d7af","00d7d7","00d7ff","00ff00","00ff5f","00ff87","00ffaf","00ffd7","00ffff","5f0000","5f005f","5f0087","5f00af","5f00d7","5f00ff","5f5f00","5f5f5f","5f5f87","5f5faf","5f5fd7","5f5fff","5f8700","5f875f","5f8787","5f87af","5f87d7","5f87ff","5faf00","5faf5f","5faf87","5fafaf","5fafd7","5fafff","5fd700","5fd75f","5fd787","5fd7af","5fd7d7","5fd7ff","5fff00","5fff5f","5fff87","5fffaf","5fffd7","5fffff","870000","87005f","870087","8700af","8700d7","8700ff","875f00","875f5f","875f87","875faf","875fd7","875fff","878700","87875f","878787","8787af","8787d7","8787ff","87af00","87af5f","87af87","87afaf","87afd7","87afff","87d700","87d75f","87d787","87d7af","87d7d7","87d7ff","87ff00","87ff5f","87ff87","87ffaf","87ffd7","87ffff","af0000","af005f","af0087","af00af","af00d7","af00ff","af5f00","af5f5f","af5f87","af5faf","af5fd7","af5fff","af8700","af875f","af8787","af87af","af87d7","af87ff","afaf00","afaf5f","afaf87","afafaf","afafd7","afafff","afd700","afd75f","afd787","afd7af","afd7d7","afd7ff","afff00","afff5f","afff87","afffaf","afffd7","afffff","d70000","d7005f","d70087","d700af","d700d7","d700ff","d75f00","d75f5f","d75f87","d75faf","d75fd7","d75fff","d78700","d7875f","d78787","d787af","d787d7","d787ff","d7af00","d7af5f","d7af87","d7afaf","d7afd7","d7afff","d7d700","d7d75f","d7d787","d7d7af","d7d7d7","d7d7ff","d7ff00","d7ff5f","d7ff87","d7ffaf","d7ffd7","d7ffff","ff0000","ff005f","ff0087","ff00af","ff00d7","ff00ff","ff5f00","ff5f5f","ff5f87","ff5faf","ff5fd7","ff5fff","ff8700","ff875f","ff8787","ff87af","ff87d7","ff87ff","ffaf00","ffaf5f","ffaf87","ffafaf","ffafd7","ffafff","ffd700","ffd75f","ffd787","ffd7af","ffd7d7","ffd7ff","ffff00","ffff5f","ffff87","ffffaf","ffffd7","ffffff","080808","121212","1c1c1c","262626","303030","3a3a3a","444444","4e4e4e","585858","626262","6c6c6c","767676","808080","8a8a8a","949494","9e9e9e","a8a8a8","b2b2b2","bcbcbc","c6c6c6","d0d0d0","dadada","e4e4e4","eeeeee"],["2e3436","cc0000","4e9a06","c4a000","3465a4","75507b","06989a","d3d7cf","555753","ef2929","8ae234","fce94f","729fcf","ad7fa8","34e2e2","eeeeec","000000","00005f","000087","0000af","0000d7","0000ff","005f00","005f5f","005f87","005faf","005fd7","005fff","008700","00875f","008787","0087af","0087d7","0087ff","00af00","00af5f","00af87","00afaf","00afd7","00afff","00d700","00d75f","00d787","00d7af","00d7d7","00d7ff","00ff00","00ff5f","00ff87","00ffaf","00ffd7","00ffff","5f0000","5f005f","5f0087","5f00af","5f00d7","5f00ff","5f5f00","5f5f5f","5f5f87","5f5faf","5f5fd7","5f5fff","5f8700","5f875f","5f8787","5f87af","5f87d7","5f87ff","5faf00","5faf5f","5faf87","5fafaf","5fafd7","5fafff","5fd700","5fd75f","5fd787","5fd7af","5fd7d7","5fd7ff","5fff00","5fff5f","5fff87","5fffaf","5fffd7","5fffff","870000","87005f","870087","8700af","8700d7","8700ff","875f00","875f5f","875f87","875faf","875fd7","875fff","878700","87875f","878787","8787af","8787d7","8787ff","87af00","87af5f","87af87","87afaf","87afd7","87afff","87d700","87d75f","87d787","87d7af","87d7d7","87d7ff","87ff00","87ff5f","87ff87","87ffaf","87ffd7","87ffff","af0000","af005f","af0087","af00af","af00d7","af00ff","af5f00","af5f5f","af5f87","af5faf","af5fd7","af5fff","af8700","af875f","af8787","af87af","af87d7","af87ff","afaf00","afaf5f","afaf87","afafaf","afafd7","afafff","afd700","afd75f","afd787","afd7af","afd7d7","afd7ff","afff00","afff5f","afff87","afffaf","afffd7","afffff","d70000","d7005f","d70087","d700af","d700d7","d700ff","d75f00","d75f5f","d75f87","d75faf","d75fd7","d75fff","d78700","d7875f","d78787","d787af","d787d7","d787ff","d7af00","d7af5f","d7af87","d7afaf","d7afd7","d7afff","d7d700","d7d75f","d7d787","d7d7af","d7d7d7","d7d7ff","d7ff00","d7ff5f","d7ff87","d7ffaf","d7ffd7","d7ffff","ff0000","ff005f","ff0087","ff00af","ff00d7","ff00ff","ff5f00","ff5f5f","ff5f87","ff5faf","ff5fd7","ff5fff","ff8700","ff875f","ff8787","ff87af","ff87d7","ff87ff","ffaf00","ffaf5f","ffaf87","ffafaf","ffafd7","ffafff","ffd700","ffd75f","ffd787","ffd7af","ffd7d7","ffd7ff","ffff00","ffff5f","ffff87","ffffaf","ffffd7","ffffff","080808","121212","1c1c1c","262626","303030","3a3a3a","444444","4e4e4e","585858","626262","6c6c6c","767676","808080","8a8a8a","949494","9e9e9e","a8a8a8","b2b2b2","bcbcbc","c6c6c6","d0d0d0","dadada","e4e4e4","eeeeee"]],i=s[0].map(function(t,e){return"\n .terminal .xc-"+e+" {\n color: #"+t+";\n }\n"}).join("\n")+s[1].map(function(t,e){return"\n .terminal .xbc-"+e+" {\n background-color: #"+t+";\n }\n"}).join("\n"),r=document.createElement("style");r.setAttribute("type","text/css"),r.textContent=i,document.head.appendChild(r)},function(t,e,s){"use strict";function i(t){for(var e=[],s=0,i=t.byteLength,a=new DataView(t);s<i;){var n=a.getUint32(s,!0);s+=4;var o=a.getUint32(s,!0);s+=4;var h=a.getUint32(s,!0);s+=4,e.push({time:1e3*n+o/1e3,content:(0,r.readUtf8)(t,s,h)}),s+=h}return e}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i;var r=s(2)},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=s(10),r=s(1).interopRequireDefault(i),a=s(3),n=s(1).interopRequireDefault(a),o=s(2),h=n["default"].EventEmitter,f=function(t){function e(t){s(1).classCallCheck(this,e);var i=s(1).possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),r=new n["default"](t);return r.open(),i.term=r,i}return s(1).inherits(e,t),s(1).createClass(e,[{key:"atEnd",value:function(){return this.step===this.frames.length}},{key:"play",value:function(t){t&&(this.frames=t),this.term.reset(),this.step=0,this.renderFrame(),this.emit("play")}},{key:"pause",value:function(){this._nextTimer.pause(),this.emit("pause")}},{key:"resume",value:function(){this._nextTimer.resume(),this.emit("play")}},{key:"renderFrame",value:function(){var t=this.step,e=this.frames,s=e[t],i=e[t+1],r=s.content;"[?1h="!==r&&this.term.write(r),this.step=t+1,this.next(s,i)}},{key:"next",value:function(t,e){var s=this;e?this._nextTimer=new r["default"](function(t){return s.renderFrame()},e.time-t.time,this.speed):this.repeat?this._nextTimer=new r["default"](function(t){return s.play()},this.interval,this.speed):this.emit("end")}},{key:"destroy",value:function(){this.term.destroy(),this.removeAllListeners(),this._nextTimer&&this._nextTimer.clear()}}]),e}(h);e["default"]=f,(0,o.assign)(f.prototype,{speed:1,repeat:!0,interval:3e3})},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=s(4),r=s(1).interopRequireDefault(i),a=s(2),n=function(t){function e(t,i){s(1).classCallCheck(this,e);var r=s(1).possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.trigger=t,r.selector=i,r.bindEvents(),r.set("active",!1),r}return s(1).inherits(e,t),s(1).createClass(e,[{key:"bindEvents",value:function(){var t=this;["triggerClick","listClick","docClick"].forEach(function(e){t[e]=t[e].bind(t)}),this.trigger.addEventListener("click",this.triggerClick,!1),this.selector.addEventListener("click",this.listClick,!1),document.addEventListener("click",this.docClick,!1)}},{key:"unbindEvents",value:function(){this.trigger.removeEventListener("click",this.triggerClick,!1),this.selector.removeEventListener("click",this.listClick,!1),document.removeEventListener("click",this.docClick,!1)}},{key:"triggerClick",value:function(t){t.stopPropagation(),this.set("active",!this.get("active"))}},{key:"listClick",value:function(t){t.preventDefault();var e=(0,a.closet)(t.target,function(t){return t.dataset.value});e&&this.select(e)}},{key:"docClick",value:function(){this.set("active",!1)}},{key:"select",value:function(t){var e=void 0;if(e=t.tagName?t:this.selector.querySelector('[data-value="'+t+'"]')){var s=e.dataset.value,i=e.textContent;this.set("value",s),this.set("text",i)}}},{key:"onChange",value:function(t,e){return