!function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(e,t,n){"use strict";t.mk=function(e){return document.createElement(e)},t.qs=function(e){return document.querySelector(e)},t.qsa=function(e){return document.querySelectorAll(e)},t.cr=function(e){return function(t){10!==t.which&&13!==t.which&&32!==t.which||e()}},t.parse2B=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.charCodeAt(t++)-1+127*(e.charCodeAt(t)-1)},t.parse3B=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.charCodeAt(t)-1+127*(e.charCodeAt(t+1)-1)+127*(e.charCodeAt(t+2)-1)*127},t.encode2B=function(e){var t=void 0,n=void 0;return t=e%127,e=(e-t)/127,t+=1,n=e+1,String.fromCharCode(t)+String.fromCharCode(n)},t.encode3B=function(e){var t=void 0,n=void 0,i=void 0;return t=e%127,e=(e-t)/127,t+=1,n=e%127,e=(e-n)/127,n+=1,i=e+1,String.fromCharCode(t)+String.fromCharCode(n)+String.fromCharCode(i)}},function(e,t,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};/*!chibi 3.0.7, Copyright 2012-2016 Kyle Barrow, released under MIT license */ !function(){function t(){var e;for(m=!0,e=0;e=0;n-=1)e(t[n])}function o(e){return e.replace(/-\w/g,function(e){return e.charAt(1).toUpperCase()})}function s(e,t){return e.currentStyle?e.currentStyle[o(t)]:w.getComputedStyle?w.getComputedStyle(e,null).getPropertyValue(t):null}function a(e,t){return encodeURIComponent(e).replace(/%20/g,"+")+"="+encodeURIComponent(t).replace(/%20/g,"+")}function l(e,t,n){try{e.style[o(t)]=n}catch(e){}}function u(e){e.style.display="","none"===s(e,"display")&&(e.style.display="block")}function c(e){var t,n,i,o="";if(e.constructor===Object){for(t in e)if(e.hasOwnProperty(t))if(e[t].constructor===Array)for(n=0;n0&&(o+="&"+a(t.name,t.value));break;case"select-multiple":for(i=0;i0?o.substring(1):""}function h(e,t,n){var i,o,s=!1;return e&&(i=e.split(/\s+/),r(function(e){for(o=0;o0)return c[0].className.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"").replace(/\s+/," ")},t.setClass=function(e){return(e||""===e)&&r(function(t){t.className=e},c),t},t.addClass=function(e){return h(e,"add",c),t},t.removeClass=function(e){return h(e,"remove",c),t},t.toggleClass=function(e,n){return h(e,void 0===n?"toggle":+n?"add":"remove",c),t},t.hasClass=function(e){return h(e,"has",c)},t.html=function(e){return e||""===e?(r(function(t){t.innerHTML=e},c),t):c[0]?c[0].innerHTML:void 0},t.htmlBefore=function(e){return d(e,"before",c),t},t.htmlAfter=function(e){return d(e,"after",c),t},t.htmlAppend=function(e){return d(e,"append",c),t},t.htmlPrepend=function(e){return d(e,"prepend",c),t},t.attr=function(e,n){if(e){if(e=e.toLowerCase(),void 0!==n)return r(function(t){"style"===e?t.style.cssText=n:"class"===e?t.className=n:t.setAttribute(e,n)},c),t;if(c[0])if("style"===e){if(c[0].style.cssText)return c[0].style.cssText}else if("class"===e){if(c[0].className)return c[0].className}else if(c[0].getAttribute(e))return c[0].getAttribute(e)}},t.data=function(e,n){if(e)return t.attr("data-"+e,n)},t.val=function(e){var n,i,o;if(void 0!==e)return r(function(t){switch(t.nodeName){case"SELECT":for("string"!=typeof e&&"number"!=typeof e||(e=[e]),i=0;i1?n:n[0];case"INPUT":case"TEXTAREA":case"BUTTON":return c[0].value}},t.checked=function(e){return"boolean"==typeof e?(r(function(t){"INPUT"!==t.nodeName||"checkbox"!==t.type&&"radio"!==t.type||(t.checked=e)},c),t):!c[0]||"INPUT"!==c[0].nodeName||"checkbox"!==c[0].type&&"radio"!==c[0].type?void 0:!!c[0].checked},t.on=function(n,i){return e!==w&&e!==y||(c=[e]),r(function(e){y.addEventListener?e.addEventListener(n,i,!1):y.attachEvent&&(e[n+i]=function(){return i.apply(e,arguments)},e.attachEvent("on"+n,e[n+i]))},c),t},t.off=function(n,i){return e!==w&&e!==y||(c=[e]),r(function(e){y.addEventListener?e.removeEventListener(n,i,!1):y.attachEvent&&(e.detachEvent("on"+n,e[n+i]),e[n+i]=null)},c),t},t}var v=[],p=[],m=!1,g=!1,y=document,w=window;y.addEventListener?(y.addEventListener("DOMContentLoaded",t,!1),w.addEventListener("load",n,!1)):y.attachEvent?(y.attachEvent("onreadystatechange",t),w.attachEvent("onload",n)):w.onload=n,f.ajax=function(e){var t=Object.assign({method:"GET",nocache:!0,timeout:5e3,loader:!0,callback:null},e);t.method=t.method.toUpperCase();var n=t.loader?f._loader:function(){},i=t.url,r=t.method,o=null;t.data&&(o=c(t.data)),o&&"GET"===r&&(i+=-1===i.indexOf("?")?"?"+o:"&"+o,o=null);var s=new XMLHttpRequest;if(t.nocache){var a=(+new Date).toString(36);i+=(-1===i.indexOf("?")?"?":"&")+"_="+a}n(!0),s.open(r,i,!0),s.timeout=t.timeout;var l=setTimeout(function(){console.error("XHR timed out."),s.abort(),n(!1)},t.timeout+10);return s.onreadystatechange=function(){4===s.readyState&&(n(!1),t.callback&&t.callback(s.responseText,s.status),clearTimeout(l))},s.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"===r&&s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send(o),s},f._loader=function(){},f.get=function(e,t,n){return n=n||{},n.url=e,n.callback=t,n.method="GET",f.ajax(n)},f.post=function(e,t,n){return n=n||{},n.url=e,n.callback=t,n.method="POST",f.ajax(n)},f.ready=function(e){if(e){if(m)return e(),f;v.push(e)}},f.loaded=function(e){if(e){if(g)return e(),f;p.push(e)}};var b={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};f.htmlEscape=function(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return b[e]})},e.exports=f}()},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function r(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!r(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,r,a,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),u=n.slice(),r=u.length,l=0;l0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,r,s,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){r=a;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var i=n(1),r=n(7),o=r.rgb255ToHex,s=t.themes=[["#111213","#CC0000","#4E9A06","#C4A000","#3465A4","#75507B","#06989A","#D3D7CF","#555753","#EF2929","#8AE234","#FCE94F","#729FCF","#AD7FA8","#34E2E2","#EEEEEC"],["#000000","#aa0000","#00aa00","#aa5500","#0000aa","#aa00aa","#00aaaa","#aaaaaa","#555555","#ff5555","#55ff55","#ffff55","#5555ff","#ff55ff","#55ffff","#ffffff"],["#000000","#cd0000","#00cd00","#cdcd00","#0000ee","#cd00cd","#00cdcd","#e5e5e5","#7f7f7f","#ff0000","#00ff00","#ffff00","#5c5cff","#ff00ff","#00ffff","#ffffff"],["#000000","#cd0000","#00cd00","#cdcd00","#0000cd","#cd00cd","#00cdcd","#faebd7","#404040","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"],["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],["#073642","#dc322f","#859900","#b58900","#268bd2","#d33682","#2aa198","#eee8d5","#002b36","#cb4b16","#586e75","#657b83","#839496","#6c71c4","#93a1a1","#fdf6e3"],["#000000","#69001A","#117800","#769100","#1A00A6","#8019AB","#289E76","#A4A4A4","#484848","#C54E76","#6DD441","#D2ED46","#765BFF","#DC75FF","#84FAD2","#FFFFFF"],["#000000","#aa0000","#00aa00","#aaaa00","#0000aa","#aa00aa","#00aaaa","#aaaaaa","#000000","#ff0000","#00FF00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"],["#000000","#722640","#0E5940","#808080","#40337F","#E434FE","#1B9AFE","#BFB3FF","#404C00","#E46501","#1BCB01","#BFCC80","#808080","#F1A6BF","#8DD9BF","#ffffff"],["#000000","#8D3E37","#55A049","#AAB95D","#40318D","#80348B","#72C1C8","#D59F74","#8B5429","#B86962","#94E089","#FFFFB2","#8071CC","#AA5FB6","#87D6DD","#ffffff"],["#eee8d5","#dc322f","#859900","#b58900","#268bd2","#d33682","#2aa198","#073642","#fdf6e3","#cb4b16","#93a1a1","#839496","#657b83","#6c71c4","#586e75","#002b36"],["#073642","#dc322f","#859900","#b58900","#268bd2","#d33682","#2aa198","#fdf6e3","#002b36","#cb4b16","#657b83","#839496","#93a1a1","#6c71c4","#eee8d5","#fdf6e3"]];t.fgbgThemes=[["#AAAAAA","#000000","Lnx","Linux"],["#FFFFFF","#000000","W+K","White on Black"],["#00FF00","#000000","Lim","Lime"],["#E53C00","#000000","Nix","Nixie"],["#EFF0F1","#31363B","Brz","Breeze"],["#FFFFFF","#300A24","Amb","Ambiance"],["#839496","#002B36","SoD","Solarized Dark"],["#93a1a1","#002b36","SoH","Solarized Dark (High Contrast)"],["#657B83","#FDF6E3","SoL","Solarized Light"],["#000000","#FFD75F","Wsp","Wasp"],["#000000","#FFFFDD","K+Y","Black on Yellow"],["#000000","#FFFFFF","K+W","Black on White"]];var a=null;t.buildColorTable=function(){if(null!==a)return a;a=new Array(16).fill("#000000");for(var e=0;e<6;e++)for(var t=0;t<6;t++)for(var n=0;n<6;n++){var i=40*e+(e?55:0),r=40*t+(t?55:0),s=40*n+(n?55:0);a.push(o(i,r,s))}for(var l=0;l<24;l++){var u=10*l+8;a.push(o(u,u,u))}return a},t.SELECTION_FG="#333",t.SELECTION_BG="#b2d7fe",t.themePreview=function(e){i("[data-fg]").forEach(function(n){var i=n.dataset.fg;/^\d+$/.test(i)&&(i=t.toHex(i,e)),n.style.color=i}),i("[data-bg]").forEach(function(n){var i=n.dataset.bg;/^\d+$/.test(i)&&(i=t.toHex(i,e)),n.style.backgroundColor=i})},t.colorTable256=null,t.ensureColorTable256=function(){t.colorTable256||(t.colorTable256=t.buildColorTable())},t.getColor=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e<16&&e in n?n[e]:-1===e?t.SELECTION_FG:-2===e?t.SELECTION_BG:e>15&&e<256?(t.ensureColorTable256(),t.colorTable256[e]):e>255?(e-=256,"#"+("000000"+e.toString(16)).substr(-6)):Math.floor(Date.now()/1e3)%2==0?"#ff0ff":"#00ff00"},t.toHex=function(e,n){return/^\d+$/.test(e)?(e=+e,t.getColor(e,s[n])):e}},function(e,t,n){"use strict";var i=n(1),r={},o=null;r.show=function(e,t){var n=i(e);n.removeClass("hidden visible"),setTimeout(function(){n.addClass("visible")},1),o=t},r.hide=function(e){var t=i(e);t.removeClass("visible"),setTimeout(function(){t.addClass("hidden"),o&&o()},500)},r.init=function(){i(".Modal").on("click",function(){i(this).hasClass("no-close")||r.hide(this)}),i(".Dialog").on("click",function(e){e.stopImmediatePropagation()}),i(window).on("keydown",function(e){27===e.which&&r.hide(".Modal")})},e.exports=r},function(e,t,n){"use strict";var i=n(1),r=n(4),o={},s=void 0,a=void 0,l=void 0,u=!1,c=function(){clearTimeout(a),clearTimeout(l)};o.show=function(e,t,n){s.toggleClass("error",!0===n),s.html(e),r.show(s),c(),(!t||t<=0)&&(t=2500),a=setTimeout(o.hide,t),u=!1,setTimeout(function(){u=!0},500)},o.hide=function(){var e=i("#notif");e.removeClass("visible"),l=setTimeout(function(){e.addClass("hidden")},250)},o.init=function(){s=i("#notif"),i(document).on("click",function(){u&&o.hide(this)}),s.on("click",function(e){return e.stopImmediatePropagation(),!1}),s.on("mouseenter",function(){c(),s.removeClass("hidden").addClass("visible")})},e.exports=o},function(e,t,n){"use strict";t.ATTR_FG=1,t.ATTR_BG=2,t.ATTR_BOLD=4,t.ATTR_UNDERLINE=8,t.ATTR_INVERSE=16,t.ATTR_BLINK=32,t.ATTR_ITALIC=64,t.ATTR_STRIKE=128,t.ATTR_OVERLINE=256,t.ATTR_FAINT=512,t.ATTR_FRAKTUR=1024},function(e,t,n){"use strict";function i(e){return("00"+e).substr(-2)}var r=Math,o=2*r.PI;t.hue2rgb=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),6*n<1?e+6*(t-e)*n:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e},t.hsl2rgb=function(e,n,i){e/=o;var r=void 0,s=void 0,a=void 0;if(0===n)r=s=a=i;else{var l=void 0,u=void 0;u=i<.5?i*(1+n):i+n-n*i,l=2*i-u,r=t.hue2rgb(l,u,e+1/3),s=t.hue2rgb(l,u,e),a=t.hue2rgb(l,u,e-1/3)}return[r,s,a]},t.rgb2hsl=function(e,t,n){var i=r.min(e,t,n),s=r.max(e,t,n),a=s-i,l=void 0,u=void 0,c=void 0;if(c=(s+i)/2,0===a)l=u=0;else{u=c<.5?a/(s+i):a/(2-s-i);var h=((s-e)/6+a/2)/a,d=((s-t)/6+a/2)/a,f=((s-n)/6+a/2)/a;e===s?l=f-d:t===s?l=1/3+h-f:n===s&&(l=2/3+d-h),l<0?l+=1:l>1&&(l-=1)}return l*=o,[l,u,c]},t.hex2rgb=function(e){var t=e.match(/^#([\da-f]{3,6})$/i);if(t){e=t[1];var n=e.length/3,i=Math.pow(16,n)-1;return[0,1,2].map(function(t){return parseInt(e.slice(t*n,(t+1)*n),16)/i})}return[0,0,0]},t.rgb255ToHex=function(e,t,n){return"#"+[e,t,n].map(function(e){return i(e.toString(16))}).join("")},t.rgb2hex=function(e,t,n){return"#"+[e,t,n].map(function(e){return i(Math.round(255*e).toString(16))}).join("")}},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=55296?2049:1))},p=function(){function e(t){s(this,e),this.reset(),this.handler=t,this.joinChunks=!0}return l(e,[{key:"reset",value:function(){this.currentSequence=0,this.sequence=""}},{key:"parseSequence",value:function(e){if("["===e[0]){var t=e[e.length-1],n=e.substring(1,e.length-1),i=n?n.split(";").map(function(e){return+e.replace(/\D/g,"")}):[],r=i.length?i[0]:1;if("H"===t)this.handler("set-cursor",(0|i[0])-1,(0|i[1])-1);else if(t>="A"&&t<="D")this.handler("move-cursor-"+(t<="B"?"y":"x"),("B"===t||"C"===t?1:-1)*r);else if("E"===t||"F"===t)this.handler("move-cursor-line",("E"===t?1:-1)*r);else if("G"===t)this.handler("set-cursor-x",r-1);else if("J"===t){var o=i.length?i[0]:2;2===o&&this.handler("clear")}else if("P"===t)this.handler("delete",r);else if("@"===t)this.handler("insert-blanks",r);else if("q"===t)this.handler("set-cursor-style",r);else if("m"===t){if(!i.length)return void this.handler("reset-style");for(var s=void 0;s=i.shift();)if(0===s)this.handler("reset-style");else if(1===s)this.handler("add-attrs",4);else if(2===s)this.handler("add-attrs",512);else if(3===s)this.handler("add-attrs",64);else if(4===s)this.handler("add-attrs",8);else if(5===s||6===s)this.handler("add-attrs",32);else if(7===s)this.handler("add-attrs",16);else if(9===s)this.handler("add-attrs",128);else if(20===s)this.handler("add-attrs",1024);else if(s>=30&&s<=37)this.handler("set-color-fg",s%10);else if(s>=40&&s<=47)this.handler("set-color-bg",s%10);else if(39===s)this.handler("reset-color-fg");else if(49===s)this.handler("reset-color-bg");else if(s>=90&&s<=98)this.handler("set-color-fg",s%10+8);else if(s>=100&&s<=108)this.handler("set-color-bg",s%10+8);else if(38===s||48===s){var a=i.shift();if(2===a){var l=i.shift(),u=i.shift(),c=i.shift(),h=256+(l<<16|u<<8|c);38===s&&this.handler("set-color-fg",h),48===s&&this.handler("set-color-bg",h)}else if(5===a){var d=255&(0|i.shift());38===s&&this.handler("set-color-fg",d),48===s&&this.handler("set-color-bg",d)}}}else"h"!==t&&"l"!==t||"?25"===n&&("h"===t?this.handler("show-cursor"):"l"===t&&this.handler("hide-cursor"))}}},{key:"write",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,o=e.toString()[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var s=r.value,a=s.codePointAt(0);27===a?this.currentSequence=1:1===this.currentSequence&&"["===s?(this.currentSequence=2,this.sequence+="["):this.currentSequence&&s.match(/[\x40-\x7e]/)?(this.parseSequence(this.sequence+s),this.currentSequence=0,this.sequence=""):this.currentSequence>1?this.sequence+=s:1===this.currentSequence?(this.currentSequence=0,this.handler("write",s)):a<3?this.handler("_null"):3===a?this.handler("sigint"):a<=6?this.handler("_null"):7===a?this.handler("bell"):8===a?this.handler("back"):9===a?this.handler("tab"):10===a?this.handler("new-line"):13===a?this.handler("return"):21===a?this.handler("delete-line"):23===a?this.handler("delete-word"):this.handler("write",s)}}catch(e){n=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw i}}this.joinChunks||this.reset()}}]),e}(),m=[0,0,0],g=function(e){return 16+36*Math.floor(2.5*Math.sin(e)+2.5)+6*Math.floor(2.5*Math.sin(e+2/3*Math.PI)+2.5)+Math.floor(2.5*Math.sin(e+4/3*Math.PI)+2.5)},y=function(){function e(t){var n=this;s(this,e),this.width=80,this.height=25,this.termScreen=t,this.parser=new p(function(){return n.handleParsed.apply(n,arguments)}),this.buttonLabels=[],this.reset(),this._lastLoad=Date.now(),this.loadTimer(),window.showPage()}return l(e,[{key:"reset",value:function(){this.style=m.slice(),this.cursor={x:0,y:0,style:1,visible:!0},this.trackMouse=!1,this.theme=0,this.defaultFG=7,this.defaultBG=0,this.rainbow=this.superRainbow=!1,this.parser.reset(),this.clear()}},{key:"clear",value:function(){this.screen=[];for(var e=0;e=this.height&&this.scroll()}},{key:"writeChar",value:function(e){this.screen[this.cursor.y*this.width+this.cursor.x]=[e,this.style.slice()],++this.cursor.x>=this.width&&(this.cursor.x=0,this.newLine())}},{key:"moveBack",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=0;t0?this.cursor.x=this.width-1:this.cursor.x=0,this.cursor.y=Math.max(0,this.cursor.y-1))}},{key:"moveForward",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=0;t=this.width&&(this.cursor.x=0,++this.cursor.y>=this.height&&this.scroll())}},{key:"deleteChar",value:function(){this.moveBack(),this.screen.splice((this.cursor.y+1)*this.width,0,[" ",m.slice()]),this.screen.splice(this.cursor.y*this.width+this.cursor.x,1)}},{key:"deleteForward",value:function(e){e=Math.min(this.width,e);for(var t=0;tthis.width-1&&(this.cursor.x=this.width-1),this.cursor.y>this.height-1&&(this.cursor.y=this.height-1)}},{key:"handleParsed",value:function(e){"write"===e?this.writeChar(arguments.length<=1?void 0:arguments[1]):"delete"===e?this.deleteForward(arguments.length<=1?void 0:arguments[1]):"insert-blanks"===e?this.insertBlanks(arguments.length<=1?void 0:arguments[1]):"clear"===e?this.clear():"bell"===e?this.termScreen.load("UB"):"back"===e?this.moveBack():"new-line"===e?(this.newLine(),this.cursor.x=0):"return"===e?this.cursor.x=0:"set-cursor"===e?(this.cursor.x=arguments.length<=2?void 0:arguments[2],this.cursor.y=arguments.length<=1?void 0:arguments[1],this.clampCursor()):"move-cursor-y"===e?(this.cursor.y+=arguments.length<=1?void 0:arguments[1],this.clampCursor()):"move-cursor-x"===e?(this.cursor.x+=arguments.length<=1?void 0:arguments[1],this.clampCursor()):"move-cursor-line"===e?(this.cursor.x=0,this.cursor.y+=arguments.length<=1?void 0:arguments[1],this.clampCursor()):"set-cursor-x"===e?this.cursor.x=arguments.length<=1?void 0:arguments[1]:"set-cursor-style"===e?this.cursor.style=Math.max(0,Math.min(6,arguments.length<=1?void 0:arguments[1])):"reset-style"===e?this.style=m.slice():"add-attrs"===e?this.style[2]|=arguments.length<=1?void 0:arguments[1]:"set-color-fg"===e?(this.style[0]=arguments.length<=1?void 0:arguments[1],this.style[2]|=1):"set-color-bg"===e?(this.style[1]=arguments.length<=1?void 0:arguments[1],this.style[2]|=2):"reset-color-fg"===e?(this.style[0]=0,1&this.style[2]&&(this.style[2]^=1)):"reset-color-bg"===e?(this.style[1]=0,2&this.style[2]&&(this.style[2]^=2)):"hide-cursor"===e?this.cursor.visible=!1:"show-cursor"===e&&(this.cursor.visible=!0)}},{key:"write",value:function(e){this.parser.write(e)}},{key:"getScreenOpts",value:function(){var e="O";e+=v(25),e+=v(80),e+=v(this.theme),e+=this.encodeColor(this.defaultFG),e+=this.encodeColor(this.defaultBG);var t=+this.cursor.visible;return t|=96*+this.trackMouse,t|=384,t|=this.cursor.style<<9,e+=v(t)}},{key:"getButtons",value:function(){var e="B";return e+=v(this.buttonLabels.length),e+=this.buttonLabels.map(function(e){return""+e+""}).join("")}},{key:"getTitle",value:function(){return"TESPTerm Web UI Demo"}},{key:"getCursor",value:function(){var e="C";return e+=v(this.cursor.y),e+=v(this.cursor.x),e+=v(0)}},{key:"encodeColor",value:function(e){return e<256?v(e):(e-=256,v(4095&e|65536)+v(e>>12))}},{key:"serializeScreen",value:function(){var e="S";e+=v(0)+v(0),e+=v(this.height)+v(this.width);var t=[null,null,null],n=0,i=!0,r=!1,o=void 0;try{for(var s,a=this.screen[Symbol.iterator]();!(i=(s=a.next()).done);i=!0){var l=s.value,u=l[1].slice();if(this.rainbow){var c=n%this.width,h=Math.floor(n/this.width),d=(c+h)/10+Date.now()/1e3;this.superRainbow&&(d=(c*h+Date.now())/100+Date.now()/1e3),u[0]=g(d),u[1]=0,this.superRainbow&&(u[1]=g(d/10)),u[2]=1|u[2],!this.superRainbow&&2&u[2]&&(u[2]^=2),n++}var f=u[0],p=u[1],m=u[2],y=f!==t[0],w=p!==t[1],b=m!==t[2];y&&w?f<256&&p<256?e+=""+v(p<<8|f):(e+=""+this.encodeColor(f),e+=""+this.encodeColor(p)):y?e+=""+this.encodeColor(f):w&&(e+=""+this.encodeColor(p)),b&&(e+=""+v(m)),t=u,e+=l[0]}}catch(e){r=!0,o=e}finally{try{!i&&a.return&&a.return()}finally{if(r)throw o}}return e}},{key:"getUpdate",value:function(){var e=[],t=this.getScreenOpts(),n=this.getTitle(),i=this.getButtons(),r=this.getCursor(),o=this.serializeScreen();return this._screenOpts!==t&&(this._screenOpts=t,e.push(t)),this._title!==n&&(this._title=n,e.push(n)),this._buttons!==i&&(this._buttons=i,e.push(i)),this._cursor!==r&&(this._cursor=r,e.push(r)),this._screen!==o&&(this._screen=o,e.push(o)),e.length?"U"+v(0)+e.join(""):""}},{key:"loadTimer",value:function(){var e=this;clearInterval(this._loadTimer),this._loadTimer=setInterval(function(){var t=e.getUpdate();t&&e.termScreen.load(t)},30)}}]),e}(),w=function(e){function t(){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),l(t,[{key:"write",value:function(e){this.emit("in",e)}},{key:"destroy",value:function(){this.emit("exit",0)}},{key:"run",value:function(){}}]),t}(u),b={buttons:[],mouseReceiver:null},k={clear:function(e){function t(){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),l(t,[{key:"run",value:function(){this.emit("write",""),this.destroy()}}]),t}(w),screenfetch:function(e){function t(){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),l(t,[{key:"run",value:function(){for(var e=this,t=("\n ###. ESPTerm Demo\n '###. Hostname: "+window.location.hostname+"\n '###. Shell: ESPTerm Demo Shell\n '###. Resolution: 80x25@"+window.devicePixelRatio+"x\n :###-\n .###'\n .###'\n .###' ###############\n ###' ###############\n ").split("\n").filter(function(e){return e.trim()}),n="",i=0;i0?"C":"D")),e.emit("write","["+Math.abs(r)+(r>0?"B":"A")),o=t,s=n},l=function(r,o){if(a(r,o),"@"===t[o][r])e.emit("write","▄\b");else{var s=231+n[t[o][r]],l=i[t[o][r]];e.emit("write","[48;5;"+s+"m[38;5;"+s+"m"+l+"\b")}};return new Promise(function(n,i){var r=e,o=13,s=0;!function e(){for(var i=0;i0&&l(u,i)}++o<70?++s>=3?(setTimeout(e,50),s=0):e():(a(0,t.length),r.emit("write","[?25h"),n())}()})}},{key:"printText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=[""," ESPTerm is a VT100-like terminal emulator running on the ESP8266 WiFi chip.",""," This is an online demo of the web user interface, simulating a simple "," terminal in your browser.",""," Type ls to list available commands."," Use the links below this screen for a demo of the options and more info.",""];if(e)this.emit("write",t.join("\r\n")+"\r\n"),this.destroy();else{var n=this;!function e(){n.emit("write",t.shift()+"\r\n"),t.length?setTimeout(e,17):n.destroy()}()}}}]),t}(w),colors:function(e){function t(){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),l(t,[{key:"run",value:function(){this.emit("write","\r\n");this.emit("write"," ");for(var e=0;e<16;e++)this.emit("write","["+(e<8?"3"+e:"9"+(e-8))+"m"),this.emit("write","foreground-color"[e]+" ");this.emit("write","\r\n ");for(var t=0;t<16;t++)this.emit("write","["+(t<8?"4"+t:"10"+(t-8))+"m ");this.emit("write","\r\n");for(var n=0;n<6;n++){this.emit("write"," ");for(var i=0;i<6;i++){for(var r=0;r<6;r++)this.emit("write","[48;5;"+(16+36*n+6*i+r)+"m ");this.emit("write","")}this.emit("write","\r\n")}this.emit("write"," ");for(var o=0;o<24;o++)this.emit("write","[48;5;"+(232+o)+"m ");this.emit("write","\r\n\n"),this.destroy()}}]),t}(w),ls:function(e){function t(){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),l(t,[{key:"run",value:function(){this.emit("write","List of demo commands\r\n");for(var e in k)"string"!=typeof k[e]&&this.emit("write",e+"\r\n");this.destroy()}}]),t}(w),theme:function(e){function t(e){s(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.shell=e,n}return o(t,e),l(t,[{key:"run",value:function(){var e=0|+(arguments.length<=0?void 0:arguments[0]),t=f.length;if(!arguments.length||!Number.isFinite(e)||e<0||e>=t)return this.emit("write","Usage: theme [0–"+(t-1)+"]\n"),void this.destroy();this.shell.terminal.theme=e,this.shell.terminal.termScreen.drawnScreenFG=[],this.emit("write",""),this.destroy()}}]),t}(w),themes:function(e){function t(e){s(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.shell=e,n.parser=new p(function(){return n.handler.apply(n,arguments)}),n}return o(t,e),l(t,[{key:"destroy",value:function(){this.shell.terminal.cursor.style=this.savedCursorStyle,this.emit("write","\n\n"),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"run",value:function(){var e=this;this.savedCursorStyle=this.shell.terminal.cursor.style,this.shell.terminal.cursor.style=3,this.fgType=0,this.bgType=0;var t=function(){return e.shell.terminal.defaultFG-256},n=function(t){e.shell.terminal.defaultFG=t+256},i=function(){return e.shell.terminal.defaultBG-256},r=function(t){e.shell.terminal.defaultBG=t+256},o=function(t,n,i,r,o){return n*=4,{label:t,length:1,getValue:function(){return i()>>n&15},getDisplay:function(){return(i()>>n&15).toString(16)},setValue:function(e){r(i()&(16777215^15<1?n-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{};s(this,t);var i=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.shell=e,i.su=n.su,i.abort=!1,i}return o(t,e),l(t,[{key:"write",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"y"===e?(this.shell.terminal.rainbow=!this.shell.terminal.rainbow,this.shell.terminal.superRainbow=!0,b._didWarnRainbow=!0):this.emit("write",e),t&&this.emit("write","Rainbow!\n"),this.destroy()}},{key:"run",value:function(){this.su&&!this.shell.terminal.rainbow?b._didWarnRainbow?this.write("y",!1):this.emit("write","Warning: flashy colors. Continue? [y/N] "):(this.shell.terminal.rainbow=!this.shell.terminal.rainbow,this.shell.terminal.superRainbow=!1,this.destroy())}},{key:"destroy",value:function(){this.abort=!0,a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(w),mouse:function(e){function t(e){s(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.shell=e,n}return o(t,e),l(t,[{key:"run",value:function(){var e=this,t=this;this.emit("buttons",[{label:"Exit",action:function(e){e.write("")}},{label:"Add Box",action:function(){t.boxes.push(t.generateRandomBox()),t.render()}}]),this.shell.terminal.trackMouse=!0,b.mouseReceiver=this,this.boxes=Array(3).fill(0).map(function(t){return e.generateRandomBox()}),this.grabbedBox=null,this.grabOffset=[0,0],this.render()}},{key:"render",value:function(){this.emit("write",""),this.emit("write","Mouse Demo\r\nMove boxes around or scroll their contents!");var e=!0,t=!1,n=void 0;try{for(var i,r=this.boxes[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var o=i.value;this.emit("write","["+(o.y+1)+";"+(o.x+1)+"H"),this.emit("write","[48;2;"+o.color.join(";")+"m");for(var s=o.y;s=this.shell.terminal.width-1||s<0||s>=this.shell.terminal.height||(a++,this.emit("write",o.content[s-o.y][l-o.x]));this.emit("write","".repeat(a)+"")}}}catch(e){t=!0,n=e}finally{try{!e&&r.return&&r.return()}finally{if(t)throw n}}this.mouse&&this.emit("write","["+(this.mouse.y+1)+";"+(this.mouse.x+1)+"H")}},{key:"generateRandomBox",value:function(){for(var e="abcdefghijklmnopqrstuvwxyz-*()!@#$%",t=[],n=[5,10,15][Math.floor(3*Math.random())],i=[4,5,6][Math.floor(3*Math.random())],r=0;r.6?t[r]+=e[Math.floor(Math.random()*e.length)]:t[r]+=" "}return{x:Math.floor(Math.random()*(this.shell.terminal.width-1))+1,y:Math.floor(Math.random()*(this.shell.terminal.height-1))+1,width:n,height:i,color:[Math.random(),Math.random(),Math.random()].map(function(e){return Math.floor(255*e)}),content:t}}},{key:"getBoxAt",value:function(e,t){var n=this.boxes.slice().reverse(),i=!0,r=!1,o=void 0;try{for(var s,a=n[Symbol.iterator]();!(i=(s=a.next()).done);i=!0){var l=s.value;if(l.x<=e&&l.x+l.width>e&&l.y<=t&&l.y+l.height>t)return l}}catch(e){r=!0,o=e}finally{try{!i&&a.return&&a.return()}finally{if(r)throw o}}}},{key:"mouseMove",value:function(e,t){this.mouse={x:e,y:t},this.grabbedBox&&(this.grabbedBox.x=e+this.grabOffset[0],this.grabbedBox.y=t+this.grabOffset[1]),this.render()}},{key:"mouseDown",value:function(e,t,n){if(4===n)this.scrollInsideBox(this.getBoxAt(e,t),-1);else if(5===n)this.scrollInsideBox(this.getBoxAt(e,t),1);else{var r=this.getBoxAt(e,t);if(r){var o;this.grabbedBox=r,this.grabOffset=[r.x-e,r.y-t],(o=this.boxes).push.apply(o,i(this.boxes.splice(this.boxes.indexOf(r),1)))}}this.render()}},{key:"mouseUp",value:function(e,t,n){this.grabbedBox=null}},{key:"scrollInsideBox",value:function(e,t){if(e){var n=e.content.slice();e.content=[];for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};s(this,t);var i=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.su=n.su,i}return o(t,e),l(t,[{key:"run",value:function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0])||arguments[0];0!==this.terminal.cursor.x&&this.terminal.write("⏎\r\n"),this.terminal.write("demosh "),e||this.terminal.write(""),this.terminal.write("$ "),this.history.unshift(""),this.cursorPos=0,this.setButtons()}},{key:"copyFromHistoryIndex",value:function(){if(this.historyIndex){var e=this.history[this.historyIndex];this.history[0]=e,this.historyIndex=0}}},{key:"getCompleted",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.history[0]){var t=this.history[0],n="";if(t.startsWith("sudo ")){var i=t.replace(/^(sudo\s+)+/,"");n=t.substr(0,t.length-i.length),t=i}if(!t)return null;for(var r in this.index)if(r.startsWith(t)&&r!==t)return e&&r in _?n+_[r]:n+r;return null}return null}},{key:"handleParsed",value:function(e){if(this.terminal.write("["+(this.lastInputLength-this.cursorPos)+"P"),this.terminal.write("\b".repeat(this.cursorPos)),"write"===e)this.copyFromHistoryIndex(),this.history[0]=this.history[0].substr(0,this.cursorPos)+(arguments.length<=1?void 0:arguments[1])+this.history[0].substr(this.cursorPos),this.cursorPos++;else if("back"===e)this.copyFromHistoryIndex(),this.history[0]=this.history[0].substr(0,this.cursorPos-1)+this.history[0].substr(this.cursorPos),--this.cursorPos<0&&(this.cursorPos=0);else if("tab"===e){var t=this.getCompleted();t&&(this.history[0]=t,this.cursorPos=this.history[0].length)}else if("move-cursor-x"===e)this.cursorPos=Math.max(0,Math.min(this.history[this.historyIndex].length,this.cursorPos+(arguments.length<=1?void 0:arguments[1])));else if("delete-line"===e)this.copyFromHistoryIndex(),this.history[0]="",this.cursorPos=0;else if("delete-word"===e){this.copyFromHistoryIndex();var n=this.history[0].substr(0,this.cursorPos).split(" ");n.pop(),this.history[0]=n.join(" ")+this.history[0].substr(this.cursorPos),this.cursorPos=n.join(" ").length}else"move-cursor-y"===e&&(this.historyIndex-=arguments.length<=1?void 0:arguments[1],this.historyIndex<0&&(this.historyIndex=0),this.historyIndex>=this.history.length&&(this.historyIndex=this.history.length-1),this.cursorPos=this.history[this.historyIndex].length);this.terminal.write(this.history[this.historyIndex]),this.terminal.write("\b".repeat(this.history[this.historyIndex].length)),this.terminal.moveForward(this.cursorPos),this.lastInputLength=this.cursorPos;var i=this.getCompleted(!0);if(0===this.historyIndex&&i&&"return"!==e){var r=i.substr(this.history[0].length);this.terminal.write(""+r+""+"\b".repeat(r.length)),this.lastInputLength+=r.length}"return"===e&&(this.terminal.write("\n"),this.parse(this.history[this.historyIndex]))}},{key:"parse",value:function(e){"help"===e&&(e="info"),e?this.run(e):this.prompt()}},{key:"run",value:function(e){var t=[""],n=!1,i=!0,r=!1,o=void 0;try{for(var s,a=e.trim()[Symbol.iterator]();!(i=(s=a.next()).done);i=!0){var l=s.value;n&&l!==n?t[t.length-1]+=l:n?n=!1:'"'===l||"'"===l?n=l:l.match(/\s/)?t[t.length-1]&&t.push(""):t[t.length-1]+=l}}catch(e){r=!0,o=e}finally{try{!i&&a.return&&a.return()}finally{if(r)throw o}}var u=t.shift();u in this.index?this.spawn(u,t):(this.terminal.write("demosh: Unknown command: "+u+"\r\n"),this.prompt(!1))}},{key:"spawn",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this.index[e];if(r instanceof Function){var o;this.setButtons([]),this.child=new r(this);var s=function(e){return t.terminal.write(e)},a=function(e){return t.setButtons(e)};this.child.on("write",s),this.child.on("buttons",a),this.child.on("exit",function(e){t.child&&(t.child.removeListener("write",s),t.child.removeListener("buttons",a)),t.child=null,t.prompt(!e)}),(o=this.child).run.apply(o,i(n))}else this.terminal.write(r),this.prompt()}},{key:"setButtons",value:function(e){if(!e){var t=this,n=function(e){var n=function n(){t.write(e[0]),(e=e.substr(1))&&setTimeout(n,100)};setTimeout(n,200)};e=[{label:"Open GitHub",action:function(e){e.child&&e.child.destroy(),n("github\r")}},{label:"Help",action:function(e){e.child&&e.child.destroy(),n("info\r")}}]}e.length||e.push({label:"",action:function(){}}),this.buttons=e,this.terminal.buttonLabels=e.map(function(e){return e.label})}},{key:"onButtonPress",value:function(e){var t=this.buttons[e];t&&t.action(this,this.terminal)}}]),e}();window.demoInterface=e.exports={input:function(e){var t=e[0],n=e.substr(1);if("s"===t)this.shell.write(n);else if("b"===t){var i=n.charCodeAt(0);this.shell.onButtonPress(i-1)}else if("m"===t||"p"===t||"r"===t){var r=h(n,0),o=h(n,2),s=h(n,4),a=h(n,6);b.mouseReceiver&&("m"===t?b.mouseReceiver.mouseMove(o,r,s,a):"p"===t?b.mouseReceiver.mouseDown(o,r,s,a):"r"===t&&b.mouseReceiver.mouseUp(o,r,s,a))}},didInit:!1,init:function(e){this.didInit||(this.didInit=!0,this.terminal=new y(e),this.shell=new S(this.terminal,!0))}}},function(e,t,n){"use strict";var i=n(14);e.exports=function(e){return i[e]||"?"+e+"?"}},function(e,t,n){"use strict";n(11),n(4),n(5),n(12);try{n(8)}catch(e){}n(13);var i=n(1),r=n(0),o=r.qs;window.termInit=n(15),window.$=i,window.qs=o,window.themes=n(3),window.TermConf=n(26)},function(e,t,n){"use strict";/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */ String.fromCodePoint||function(){var e=function(){try{var e={},t=Object.defineProperty,n=t(e,e,e)&&t}catch(e){}return n}(),t=String.fromCharCode,n=Math.floor,i=function(){var e,i,r=[],o=-1,s=arguments.length;if(!s)return"";for(var a="";++o1114111||n(l)!=l)throw RangeError("Invalid code point: "+l);l<=65535?r.push(l):(l-=65536,e=55296+(l>>10),i=l%1024+56320,r.push(e,i)),(o+1==s||r.length>16384)&&(a+=t.apply(null,r),r.length=0)}return a};e?e(String,"fromCodePoint",{value:i,configurable:!0,writable:!0}):String.fromCodePoint=i}()},function(e,t,n){"use strict";function i(){d=!0,r("#content").addClass("load")}var r=n(1),o=n(0),s=o.mk,a=o.qs,l=o.qsa,u=o.cr,c=n(4),h=n(5);r.ready(function(){function e(){r("#menu").toggleClass("expanded")}r("#brand").on("click",e).on("keypress",u(e)),r(".Row.checkbox").forEach(function(e){var t=e.querySelector("input"),n=e.querySelector(".box");r(n).toggleClass("checked",t.value);var i=function(){t.value=1-t.value,r(n).toggleClass("checked",t.value)};r(e).on("click",i).on("keypress",u(i))}),r(".Box.mobcol,.Box.fold").forEach(function(e){var t=e.querySelector("h2"),n=function(){r(e).hasClass("d-expanded")?r(e).removeClass("d-expanded"):r(e).toggleClass("expanded")};r(t).on("click",n).on("keypress",u(n))}),r("form").forEach(function(e){r(e).on("keypress",function(t){10!==t.keyCode&&13!==t.keyCode||!t.ctrlKey||e.submit()})}),setInterval(function(){r(".anim-dots").each(function(e){var t=r(e),n=t.html()+".";5===n.length&&(n="."),t.html(n)})},1e3),r("input[type=number]").on("wheel",function(e){var t=r(this),n=+t.val();isNaN(n)&&(n=1);var i=+(t.attr("step")||1),o=+t.attr("min"),s=+t.attr("max");if(e.deltaY>0?n+=i:n-=i,Number.isFinite(o)&&(n=Math.max(n,+o)),Number.isFinite(s)&&(n=Math.min(n,+s)),t.val(n),"createEvent"in document){var a=document.createEvent("HTMLEvents");a.initEvent("change",!1,!0),t[0].dispatchEvent(a)}else t[0].fireEvent("onchange");e.preventDefault()});try{do{var t=void 0,n=void 0;if(-1!==(t=window.location.search.indexOf("err="))&&a(".Box.errors")){if("break"===function(){var e=decodeURIComponent(window.location.search.substr(t+4)).split(","),n=[];return e.forEach(function(e){if(0!==e.length){var t=l('label[for="'+e+'"]');if(t&&t.length>0)for(var i=0;i550){r(".Box h2").forEach(function(e){e.removeAttribute("tabindex")});var d=a("#brand");d&&d.addEventListener("click",function(){window.location.href="/"})}}),r._loader=function(e){r("#loader").toggleClass("show",e)};var d=!1;window.showPage=i,r.ready(function(){!0===window.noAutoShow?setTimeout(function(){if(!d){var e=s("P");e.id="load-failed",e.innerHTML='Server connection failed! Trying again.',a("#screen").appendChild(e),a("#screen").classList.add("failed"),i()}},2e3):setTimeout(function(){i()},1)})},function(e,t,n){"use strict";var i=n(1),r=n(0),o=r.mk,s=n(9),a=window.location.protocol.match(/s:/),l=function(e){return"+"+(.25*e.value).toFixed(2)+" dBm"},u=function(e,t,n){i("#sta_ssid").val(e),i("#sta_password").val(t),i("#sta-nw").toggleClass("hidden",0===e.length),i("#sta-nw-nil").toggleClass("hidden",e.length>0),i("#sta-nw .essid").html(i.htmlEscape(e));var r=!!t;i("#sta-nw .passwd").toggleClass("hidden",!r),i("#sta-nw .nopasswd").toggleClass("hidden",r),i("#sta-nw .ip").html(n.length>0?s("wifi.connected_ip_is")+n:s("wifi.not_conn"))},c=function(e,t){if(200!==t)return void f(5e3);try{e=JSON.parse(e)}catch(e){return console.log(e),void f(5e3)}var n=!e.result.inProgress&&e.result.APs.length>0;if(f(n?15e3:1e3),n){var r=i("#ap-list");i("#ap-list .AP").remove(),r.toggleClass("hidden",!n),i("#ap-loader").toggleClass("hidden",n),e.result.APs.sort(function(e,t){return t.rssi-e.rssi}).forEach(function(e){if(e.enc=parseInt(e.enc),!(e.enc>4)){var t=o("div"),n=i(t).data("ssid",e.essid).data("pwd",e.enc).attr("tabindex",0).addClass("AP");e.essid===g&&n.addClass("selected");var a=o("div"),l=i.htmlEscape(e.essid);i(a).addClass("inner").htmlAppend('
'+e.rssi_perc+"
").htmlAppend('
'+l+"
").htmlAppend('
'+m[e.enc]+"
"),n.on("click",function(){var e=i(this),t=e.data("ssid"),n="";+e.data("pwd")&&!(n=window.prompt(s("wifi.enter_passwd").replace(":ssid:",t)))||(i("#sta_password").val(n),i("#sta_ssid").val(t),u(t,n,""))}),t.appendChild(a),r[0].appendChild(t)}})}},h=function(){i("#ap-loader").removeClass("hidden"),i("#ap-scan").addClass("hidden"),i("#ap-loader .anim-dots").html("."),d()},d=function(){window._demo?c(window._demo_aps,200):i.get((a?"https":"http")+"://"+window._root+"/cfg/wifi/scan",c)},f=function(e){setTimeout(d,e)},v=function(e){i(".Row.range").forEach(function(e){var t=e.querySelector("input"),n=e.querySelector(".x-disp1"),r=e.querySelector(".x-disp2"),o=l(t);i(n).html(o),i(r).html(o),i(t).on("input",function(){o=l(t),i(n).html(o),i(r).html(o)})}),i("#forget-sta").on("click",function(){return u("","",""),!1}),u(e.sta_ssid,e.sta_password,e.sta_active_ip),g=e.sta_active_ssid},p=window.WiFi={},m=["Open","WEP","WPA","WPA2","WPA/WPA2"],g=void 0;p.init=v,p.startScanning=h},function(e,t){e.exports={"wifi.connected_ip_is":"Connected, IP is ","wifi.not_conn":"Not connected.","wifi.enter_passwd":'Enter password for ":ssid:"',"term_nav.fullscreen":"Fullscreen","term_conn.connecting":"Connecting","term_conn.waiting_content":"Waiting for content","term_conn.disconnected":"Disconnected","term_conn.waiting_server":"Waiting for server","term_conn.reconnecting":"Reconnecting"}},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:250;clearTimeout(k),k=setTimeout(function(){t.window.statusScreen=e},n)};n.on("open",function(){_({title:l("term_conn.connecting"),loading:!0})}),n.on("connect",function(){_({title:l("term_conn.waiting_content"),loading:!0})}),t.on("load",function(){clearTimeout(k),t.window.statusScreen&&(t.window.statusScreen=null)}),n.on("disconnect",function(){_({title:l("term_conn.disconnected")},500),t.screen=[],t.screenFG=[],t.screenBG=[],t.screenAttrs=[]}),n.on("silence",function(){_({title:l("term_conn.waiting_server"),loading:!0},0)}),n.on("ping-success",function(){_({title:l("term_conn.reconnecting"),loading:!0},0)}),n.init(),o.init(e),g.init(),u.init(),window.onerror=function(e,t,n,i){return u.show("JS ERROR!
"+e+"
at "+t+":"+n+":"+i,1e4,!0),!1},s("#screen").appendChild(t.layout.canvas),v(t,o),p&&p(t,n);var S={},C=!1,x=!1,T=!1,L=t.layout.window.padding,A=function(){C?(S.className="icn-resize-small",x?(t.layout.window.fitIntoWidth=window.screen.width,t.layout.window.fitIntoHeight=window.screen.height,t.layout.window.padding=0):(t.layout.window.fitIntoWidth=window.innerWidth,s("#term-nav").classList.contains("hidden")?t.layout.window.fitIntoHeight=window.innerHeight:t.layout.window.fitIntoHeight=window.innerHeight-24,t.layout.window.padding=0)):(S.className="icn-resize-full",t.layout.window.fitIntoWidth=T?window.innerWidth-4:0,t.layout.window.fitIntoHeight=T?window.innerHeight:0,t.layout.window.padding=L)};A(),window.addEventListener("resize",A);var E=function(){T=!T;var e=s("#resize-button-icon");T?(e.classList.remove("icn-resize-small"),e.classList.add("icn-resize-full")):(e.classList.remove("icn-resize-full"),e.classList.add("icn-resize-small")),A()};if(s("#term-fit-screen").addEventListener("click",function(){return E(),!1}),window.Element.prototype.requestFullscreen||window.Element.prototype.webkitRequestFullscreen){x=!0;var P=function(){!C||window.innerWidth===window.screen.width&&window.innerHeight===window.screen.height||(C=!1,A())};setInterval(P,500)}var R=a("a");R.id="fullscreen-button",R.href="#",R.addEventListener("click",function(e){if(e.preventDefault(),document.body.classList.contains("pseudo-fullscreen"))return document.body.classList.remove("pseudo-fullscreen"),C=!1,void A();C=!0,A(),t.layout.updateSize(),x?t.layout.canvas.requestFullscreen?t.layout.canvas.requestFullscreen():t.layout.canvas.webkitRequestFullscreen():document.body.classList.add("pseudo-fullscreen")}),S=a("i"),S.className="icn-resize-full",R.appendChild(S);var F=a("span");F.textContent=l("term_nav.fullscreen"),R.appendChild(F),s("#term-nav").insertBefore(R,s("#term-nav").firstChild),window.termScreen=t,window.buttons=y,window.conn=n,window.input=o,window.termUpl=g}},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0?1:-1])):(m-=t.wheelDeltaY,Math.abs(m)>=40&&(e.emit.apply(e,["mousewheel"].concat(i(e.layout.screenToGrid(t.offsetX,t.offsetY)),[m>0?1:-1])),m=0)),t.preventDefault())}),e.layout.on("contextmenu",function(t){e.mouseMode.clicks&&t.preventDefault(),u(t.offsetX,t.offsetY)}),e}return s(t,e),a(t,[{key:"resetScreen",value:function(){var e=this.window,t=e.width,n=e.height;this.blinkingCellCount=0,this.screen.screen=new Array(t*n).fill(" "),this.screen.screenFG=new Array(t*n).fill(0),this.screen.screenBG=new Array(t*n).fill(0),this.screen.screenAttrs=new Array(t*n).fill(0),this.screen.screenLines=new Array(n).fill(0)}},{key:"updateLayout",value:function(){this.layout.window.width=this.window.width,this.layout.window.height=this.window.height}},{key:"renderScreen",value:function(e){for(var t=[],n=0;nn[1]||t[1]===n[1]&&t[0]>n[0]){var i=[n,t];t=i[0],n=i[1]}return{start:t,end:n}}},{key:"isInSelection",value:function(e,t){var n=this.getNormalizedSelection(),i=n.start,r=n.end,o=i[0]<=e,s=eDate.now()-50)){if(this._lastBeep=Date.now(),!this._convolver){this._convolver=e.createConvolver();for(var t=.8*e.sampleRate,n=e.createBuffer(2,t,e.sampleRate),i=0;i57343&&(t-=2048),t-1}var s=function(){function e(e,t){for(var n=0;n>9&7;A>0&&A--;var E=A>>1,P=!(1&A);E=0===E?"block":1===E?"line":"bar";var R=!!(128&S),F=!!(256&S),O=!!(8192&S),B=!!(16384&S),M=!!(2&S);m.push({topic:"screen-opts",width:w,height:y,theme:b,defFG:k,defBG:_,cursorVisible:C,cursorBlinking:P,cursorStyle:E,inputAlts:x,trackMouseClicks:T,trackMouseMovement:L,showButtons:R,showConfigLinks:F,bracketedPaste:O,reverseVideo:B,debugEnabled:M})}else if("C"===g){var D=o(n[t++]),I=o(n[t++]),N=!!o(n[t++]);m.push({topic:"cursor",x:I,y:D,hanging:N})}else if("P"===g){var j=s(),G=o(n[t++]);m.push({topic:"static-opts",fontStack:j,fontSize:G})}else if("H"===g){for(var z=[],H=o(n[t++]),W=0;W>3]=7&q}m.push({topic:"double-lines",lines:z})}else if("T"===g)m.push({topic:"title",title:s()});else if("B"===g){for(var U=o(n[t++]),V=[],K=[],X=0;Xk));P++);break;case 1:w+=o(n[t++]);break;case 3:A=o(n[t++]),a=255&A,g=A>>8&255;break;case 4:A=o(n[t++]),y=65535&A;break;case 7:y=0;break;case 5:A=o(n[t++]),65536&A&&(A&=4095,A|=(4095&o(n[t++]))<<12,A+=256),a=A;break;case 6:A=o(n[t++]),65536&A&&(A&=4095,A|=(4095&o(n[t++]))<<12,A+=256),g=A;break;default:L<32&&(T="�"),b=T,x(),w++}}m.push({topic:"content",frameX:i,frameY:e,frameWidth:s,frameHeight:r,cells:C})}();59&r&&!this.contentLoaded&&(m.push({topic:"full-load-complete"}),this.contentLoaded=!0)}return m}},{key:"parse",value:function(e){var t=e.substr(1),n=[];switch(e[0]){case"U":n.push.apply(n,i(this.parseUpdate(t)));break;case"G":return[{topic:"notification",content:t}];default:console.warn("Bad data message type; ignoring.\n"+JSON.stringify(e))}return n}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.style||"normal",n=e.weight||"normal",i=this.window.fontFamily||"";return i.length>0&&(i+=","),i+=u,t+" normal "+n+" "+this.window.fontSize+"px "+i}},{key:"screenToGrid",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.getCellSize();return e=e/this._windowScale-this._padding,t=t/this._windowScale-this._padding,t=Math.floor(t/i.height),this.renderer.drawnScreenLines[t]&&(e/=2),e=Math.floor((e+(n?i.width/2:0))/i.width),e=Math.max(0,Math.min(this.window.width-1,e)),t=Math.max(0,Math.min(this.window.height-1,t)),[e,t]}},{key:"gridToScreen",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.getCellSize();return this.renderer.drawnScreenLines[t]&&(e*=2),[e*r.width,t*r.height].map(function(e){return n._padding+(i?e*n._windowScale:e)})}},{key:"updateCharSize",value:function(){return this.charSize={width:this.renderer.getCharWidthFor(this.getFont()),height:this.window.fontSize},this.charSize}},{key:"getCellSize",value:function(){return!this.charSize.height&&this.window.fontSize&&this.updateCharSize(),{width:Math.ceil(this.charSize.width*this.window.gridScaleX),height:Math.ceil(this.charSize.height*this.window.gridScaleY)}}},{key:"updateSize",value:function(){this._window.devicePixelRatio=Math.ceil(this._windowScale*(window.devicePixelRatio||1));var e=!1;for(var t in this.windowState)this.windowState.hasOwnProperty(t)&&this.windowState[t]!==this.window[t]&&(e=!0,this.windowState[t]=this.window[t]);if(e){var n=this.window,i=n.width,r=n.height,o=n.fitIntoWidth,s=n.fitIntoHeight,a=n.padding;this.updateCharSize();var l=this.getCellSize(),u=i*l.width,c=r*l.height,h=u;if(o&&s){var d=u/c;d1&&void 0!==arguments[1]?arguments[1]:1;clearTimeout(this._scheduledDraw),this._scheduledDraw=setTimeout(function(){return t.draw(e)},n)}},{key:"getColor",value:function(e){return h(e,this.palette)}},{key:"resetCursorBlink",value:function(){var e=this;this.cursorBlinkOn=!0,clearInterval(this.cursorBlinkInterval),this.cursorBlinkInterval=setInterval(function(){e.cursorBlinkOn=!e.cursor.blinking||!e.cursorBlinkOn,e.cursor.blinking&&e.scheduleDraw("cursor-blink")},500)}},{key:"resetBlink",value:function(){var e=this;this.blinkStyleOn=!0,clearInterval(this.blinkInterval);var t=0;this.blinkInterval=setInterval(function(){e.blinkingCellCount<=0||(t++,t>=4&&e.blinkStyleOn?(e.blinkStyleOn=!1,t=0,e.scheduleDraw("blink-style")):t>=1&&!e.blinkStyleOn&&(e.blinkStyleOn=!0,t=0,e.scheduleDraw("blink-style")))},200)}},{key:"drawBackground",value:function(e){var t=e.x,n=e.y,i=e.cellWidth,r=e.cellHeight,o=e.bg,s=e.isDefaultBG,a=this.ctx,l=this.width,u=this.height,c=this.padding;1&this.screenLines[n]&&(i*=2),a.fillStyle=this.getColor(o);var h=t*i+c,d=n*r+c,f=0===t||0===n||t===l-1||n===u-1,v=void 0,p=void 0,m=void 0,g=void 0;if(f){var y=h,w=d,b=h+i,k=d+r;0===t?y-=c:t===l-1&&(b+=c),0===n?w-=c:n===u-1&&(k+=c),v=y,p=w,m=b-y,g=k-w}else v=h,p=d,m=i,g=r;a.clearRect(v,p,m,g),(!s||o<0||!this.backgroundImage)&&a.fillRect(v,p,m,g)}},{key:"drawCharacter",value:function(e){var n=e.x,i=e.y,r=e.charSize,o=e.cellWidth,s=e.cellHeight,a=e.text,l=e.fg,u=e.attrs;if(a){var c=this.ctx,h=this.padding,d=!1,f=!1,v=!1;u&_&&(c.globalAlpha=.5),u&m&&(d=!0),u&S&&(a=t.alphaToFraktur(a)),u&b&&(f=!0),u&k&&(v=!0),c.fillStyle=this.getColor(l);var p=n*o+h,g=i*s+h,y=1&this.screenLines[i],w=2&this.screenLines[i],C=4&this.screenLines[i];this.screenLines[i]&&(y&&(o*=2),c.save(),c.translate(h,g+.5*s),y&&c.scale(2,1),w?(c.scale(1,2),c.translate(0,s/4)):C&&(c.scale(1,2),c.translate(0,-s/4)),c.translate(-h,-g-.5*s),y&&c.translate(-o/4,0),(C||w)&&(c.beginPath(),w?c.rect(p,g,o,s/2):c.rect(p,g+s/2,o,s/2),c.clip()));var x=a.codePointAt(0);if(x>=9600&&x<=9631){c.beginPath();var T=p,L=g,A=o,E=s,P=o/2,R=s/2;if(9600===x)c.rect(T,L,A,R);else if(x<=9608){var F=(1-(x-9600)/8)*E;c.rect(T,L+F,A,E-F)}else if(x<=9615){var O=(x-9608)/8*A;c.rect(T,L,A-O,E)}else if(9616===x)c.rect(T+P,L,P,E);else if(x<=9619){var B=void 0,M=void 0,D=void 0;9617===x?(B=A/4,M=E/10,D=1):9618===x?(B=A/6,M=A/10,D=1):9619===x&&(B=A/4,M=A/7,D=2);for(var I=!1,N=0;N=57520&&x<=57523?(c.beginPath(),57520===x||57521===x?(c.moveTo(p,g),c.lineTo(p+o,g+s/2),c.lineTo(p,g+s)):57522!==x&&57523!==x||(c.moveTo(p+o,g),c.lineTo(p,g+s/2),c.lineTo(p+o,g+s)),x%2==0?c.fill():(c.strokeStyle=c.fillStyle,c.stroke())):c.fillText(a,p+.5*o,g+.5*s);if(d||f||v){if(c.strokeStyle=this.getColor(l),c.lineWidth=1,c.lineCap="round",c.beginPath(),d){var z=Math.round(g+r.height)+.5;c.moveTo(p,z),c.lineTo(p+o,z)}if(f){var H=Math.round(g+.5*s)+.5;c.moveTo(p,H),c.lineTo(p+o,H)}if(v){var W=Math.round(g)+.5;c.moveTo(p,W),c.lineTo(p+o,W)}c.stroke()}this.screenLines[i]&&c.restore(),c.globalAlpha=1}}},{key:"getAdjacentCells",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.width,i=this.height,r=n*i,o=[],s=-t;s<=t;s++)for(var a=-t;a<=t;a++)0===s&&0===a||o.push(e+s+a*n);return o.filter(function(e){return e>=0&&e=1){var I=!0,N=!1,j=void 0;try{for(var G,z=b.keys()[Symbol.iterator]();!(I=(G=z.next()).done);I=!0){var H=G.value;if(!b.get(H)){var W=b.get(H-1)||!1,q=b.get(H+1)||!1;W&&q&&(b.set(H,!0),this.debug&&this._debug&&D.push(H))}}}catch(e){N=!0,j=e}finally{try{!I&&z.return&&z.return()}finally{if(N)throw j}}}var U=new Map,V=new Map,K=function(e){return" "!==e&&t.measureText(e).width>=u+.05},X=!0,Y=!1,$=void 0;try{for(var J,Q=b.keys()[Symbol.iterator]();!(X=(J=Q.next()).done);X=!0){var Z=J.value,ee=b.get(Z)||U.get(Z)||!1,te=this.screen[Z],ne=K(te),ie=ne?2:1;if(!ee){var re=!1,oe=!0,se=!1,ae=void 0;try{for(var le,ue=this.getAdjacentCells(Z,ie)[Symbol.iterator]();!(oe=(le=ue.next()).done);oe=!0){var ce=le.value;if(b.get(ce)&&(this.graphics<2||ne||K(this.screen[ce]))&&!this.screenLines[Math.floor(Z/this.width)]&&!this.screenLines[Math.floor(ce/this.width)]){re=!0,this.getAdjacentCells(Z,1).includes(ce)&&V.set(Z,!0);break}}}catch(e){se=!0,ae=e}finally{try{!oe&&ue.return&&ue.return()}finally{if(se)throw ae}}re&&(ee=!0)}b.get(Z)&&V.set(Z,!0),U.set(Z,ee)}}catch(e){Y=!0,$=e}finally{try{!X&&Q.return&&Q.return()}finally{if(Y)throw $}}if(this.graphics>=1){for(var he=this.padding,de=[],fe=0;febe&&ye--,be--),be++):be++}ye++}t.save(),t.beginPath();var _e=!0,Se=!1,Ce=void 0;try{for(var xe,Te=de[Symbol.iterator]();!(_e=(xe=Te.next()).done);_e=!0){var Le=xe.value,Ae=s(Le,4),Ee=Ae[0],Pe=Ae[1],Re=Ae[2],Fe=Ae[3],Oe=he+Ee*u,Be=he+Pe*c,Me=(Re-Ee)*u,De=(Fe-Pe)*c;0===Ee&&(Oe-=he,Me+=he),0===Pe&&(Be-=he,De+=he),Re===n-1&&(Me+=he),Pe===i-1&&(De+=he),t.rect(Oe,Be,Me,De)}}catch(e){Se=!0,Ce=e}finally{try{!_e&&Te.return&&Te.return()}finally{if(Se)throw Ce}}t.clip()}var Ie=!0,Ne=!1,je=void 0;try{for(var Ge,ze=m.keys()[Symbol.iterator]();!(Ie=(Ge=ze.next()).done);Ie=!0){var He=Ge.value,We=!0,qe=!1,Ue=void 0;try{for(var Ve,Ke=m.get(He)[Symbol.iterator]();!(We=(Ve=Ke.next()).done);We=!0){var Xe=Ve.value,Ye=Xe.cell,$e=Xe.x,Je=Xe.y,Qe=Xe.text,Ze=Xe.bg,et=Xe.isDefaultBG;if(U.get(Ye)&&(this.drawBackground({x:$e,y:Je,cellWidth:u,cellHeight:c,bg:Ze,isDefaultBG:et}),this.debug)){var tt=+U.get(Ye);tt|=+b.get(Ye)<<1,tt|=+V.get(Ye)<<2,tt|=+K(Qe)<<3,tt|=+D.includes(Ye)<<4,this._debug.setCell(Ye,tt)}}}catch(e){qe=!0,Ue=e}finally{try{!We&&Ke.return&&Ke.return()}finally{if(qe)throw Ue}}}}catch(e){Ne=!0,je=e}finally{try{!Ie&&ze.return&&ze.return()}finally{if(Ne)throw je}}this.drawnCursor=[-1,-1,"",!1];var nt=!0,it=!1,rt=void 0;try{for(var ot,st=m.keys()[Symbol.iterator]();!(nt=(ot=st.next()).done);nt=!0){var at=ot.value,lt=0;at&p&&(lt|=1),at&w&&(lt|=2),t.font=this.fonts[lt];var ut=!0,ct=!1,ht=void 0;try{for(var dt,ft=m.get(at)[Symbol.iterator]();!(ut=(dt=ft.next()).done);ut=!0){var vt=dt.value,pt=vt.cell,mt=vt.x,gt=vt.y,yt=vt.text,wt=vt.fg,bt=vt.bg,kt=vt.attrs,_t=vt.isCursor,St=vt.inSelection;if(U.get(pt)&&(this.drawCharacter({x:mt,y:gt,charSize:a,cellWidth:u,cellHeight:c,text:yt,fg:wt,attrs:kt}),this.drawnScreen[pt]=yt,this.drawnScreenFG[pt]=wt,this.drawnScreenBG[pt]=bt,this.drawnScreenAttrs[pt]=kt,_t&&(this.drawnCursor=[mt,gt,this.cursor.style,this.cursor.hanging]),_t&&!St)){t.save(),t.beginPath();var Ct=mt,xt=gt,Tt=u;this.cursor.hanging&&(Ct+=1),1&this.screenLines[xt]&&(Tt*=2);var Lt=Ct*Tt+this.padding,At=xt*c+this.padding;if("block"===this.cursor.style)t.rect(Lt,At,Tt,c);else if("bar"===this.cursor.style){t.rect(Lt,At,2,c)}else if("line"===this.cursor.style){t.rect(Lt,At+a.height,Tt,2)}t.clip();var Et=[bt,wt];wt=Et[0],bt=Et[1],wt===bt&&(bt=0===wt?7:0),this.drawBackground({x:Ct,y:xt,cellWidth:u,cellHeight:c,bg:bt}),this.drawCharacter({x:Ct,y:xt,charSize:a,cellWidth:u,cellHeight:c,text:yt,fg:wt,attrs:kt}),t.restore()}}}catch(e){ct=!0,ht=e}finally{try{!ut&&ft.return&&ft.return()}finally{if(ct)throw ht}}}}catch(e){it=!0,rt=e}finally{try{!nt&&st.return&&st.return()}finally{if(it)throw rt}}this.graphics>=1&&t.restore(),this.debug&&this._debug&&this._debug.drawEnd(),this.emit("draw",e)}},{key:"drawStatus",value:function(e){var t=this.ctx,n=this.width,i=this.height,r=this.devicePixelRatio;this.drawnScreen=[];var o=this.cellSize,s=n*o.width+2*this.padding,a=i*o.height+2*this.padding;if(t.setTransform(r,0,0,r,0,0),t.fillStyle=this.getColor(this.defaultBG),t.fillRect(0,0,s,a),t.font="24px "+this.statusFont,t.fillStyle=this.getColor(this.defaultFG),t.textAlign="center",t.textBaseline="middle",t.fillText(e.title||"",s/2,a/2-50),e.loading){t.save(),t.translate(s/2,a/2+20),t.strokeStyle=this.getColor(this.defaultFG),t.lineWidth=5,t.lineCap="round";for(var l=Date.now()/1e3,u=0;u<12;u++){t.rotate(Math.PI/6);var c=(12*l-u)%12;t.globalAlpha=Math.max(.2,1-c/3),t.beginPath(),t.moveTo(0,15),t.lineTo(0,30),t.stroke()}t.restore()}}},{key:"startDrawLoop",value:function(){if(!this._drawTimerThread){var e=Math.random().toString(36);this._drawTimerThread=e,this.drawTimerLoop(e)}}},{key:"stopDrawLoop",value:function(){this._drawTimerThread=null}},{key:"drawTimerLoop",value:function(e){var t=this;e&&e===this._drawTimerThread&&(window.requestAnimationFrame(function(){return t.drawTimerLoop(e)}),this.draw("draw-loop"))}},{key:"palette",get:function(){return this._palette||c[0]},set:function(e){this._palette!==e&&(this._palette=e,this.resetDrawn(),this.emit("palette-update",e),this.scheduleDraw("palette"))}}],[{key:"alphaToFraktur",value:function(e){return e>="a"&&e<="z"?e=String.fromCodePoint(119997+e.charCodeAt(0)):e>="A"&&e<="Z"&&(e=C[e]||String.fromCodePoint(120003+e.charCodeAt(0))),e}}]),t}(l)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n ping"),this.emit("ping"),l.get((c?"https":"http")+"://"+window._root+"/api/v1/ping",function(t,n){200===n?(clearInterval(e.pingInterval),console.info("Server ready, opening socket…"),e.emit("ping-success"),e.init()):e.emit("ping-fail",n)},{timeout:100,loader:!1})}},{key:"onHeartbeatFail",value:function(){var e=this;this.closeSocket(),this.emit("silence"),console.error("Heartbeat lost, probing server..."),clearInterval(this.pingInterval),this.pingInterval=setInterval(function(){e.sendPing()},1e3),setTimeout(function(){e.sendPing()},200)}}]),t}(a)},function(e,t,n){"use strict";var i=n(0),r=i.encode2B;e.exports=function(e,t){function n(t){return e.send("s"+t)}function i(t){e.send("b"+String.fromCharCode(t+1))}function o(e){var i=e.allFn;window.addEventListener("keypress",function(e){if(b()&&!e.ctrlKey&&!e.metaKey){var t="";e.key&&1===e.key.length?t=e.key:e.which&&229!==e.which&&(t=String.fromCodePoint(e.which)),t.length>0&&t.charCodeAt(0)>=32&&(32===e.which&&e.preventDefault(),n(t))}}),window.addEventListener("keydown",S),window.addEventListener("copy",function(e){if(b()){var n=t.getSelectedText();n&&(e.preventDefault(),e.clipboardData.setData("text/plain",n))}}),window.addEventListener("paste",function(e){if(b()){e.preventDefault();var i=e.clipboardData.getData("text/plain");i.includes("\n")||i.length>90?(l.termUpload||console.error("input.termUpload is undefined"),l.termUpload.setContent(i),l.termUpload.open()):(t.bracketedPaste&&(i="[200~"+i+"[201~"),n(i))}}),v.all_fn=i}function s(e){o(e),window.addEventListener("mousedown",function(e){0===e.button&&(C=1),1===e.button&&(x=1),2===e.button&&(T=1)}),window.addEventListener("mouseup",function(e){0===e.button&&(C=0),1===e.button&&(x=0),2===e.button&&(T=0)})}function a(){return L}for(var l=void 0,u={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",58:":",59:";",60:"<",61:"=",62:">",63:"?",64:"@",91:"Meta",92:"Meta",93:"ContextMenu",106:"Numpad*",107:"Numpad+",109:"Numpad-",110:"Numpad.",111:"Numpad/",144:"NumLock",145:"ScrollLock",160:"^",161:"!",162:'"',163:"#",164:"$",165:"%",166:"&",167:"_",168:"(",169:")",170:"*",171:"+",172:"|",173:"-",174:"{",175:"}",176:"~",186:";",187:"=",188:"Numpad,",189:"-",190:"Numpad,",192:"`",194:"Numpad,",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},c=48;c<=57;c++)u[c]=String.fromCharCode(c);for(var h=65;h<=90;h++)u[h]=String.fromCharCode(h);for(var d=112;d<=131;d++)u[d]="F"+(d-112+1);for(var f=96;f<=105;f++)u[f]="Numpad"+(f-96);for(var v={np_alt:!1,cu_alt:!1,fn_alt:!1,mt_click:!1,mt_move:!1,no_keys:!1,crlf_mode:!1,all_fn:!1},p=function(e,t){return v.fn_alt?e:t},m=function(e,t){return v.cu_alt?e:t},g=function(e,t){return v.np_alt?e:t},y={Backspace:"\b",Tab:"\t",Enter:function(){return v.crlf_mode?"\r\n":"\r"},"Control+Enter":"\n",Escape:"",ArrowUp:function(){return m("OA","")},ArrowDown:function(){return m("OB","")},ArrowRight:function(){return m("OC","")},ArrowLeft:function(){return m("OD","")},Home:function(){return m("OH",p("","[1~"))},Insert:"[2~",Delete:"[3~",End:function(){return m("OF",p("","[4~"))},PageUp:"[5~",PageDown:"[6~",F1:function(){return p("OP","[11~")},F2:function(){return p("OQ","[12~")},F3:function(){return p("OR","[13~")},F4:function(){return p("OS","[14~")},F5:"[15~",F6:"[17~",F7:"[18~",F8:"[19~",F9:"[20~",F10:"[21~",F11:"[23~",F12:"[24~","Shift+F1":function(){return p("O1;2P","[25~")},"Shift+F2":function(){return p("O1;2Q","[26~")},"Shift+F3":function(){return p("O1;2R","[28~")},"Shift+F4":function(){return p("O1;2S","[29~")},"Shift+F5":function(){return p("[15;2~","[31~")},"Shift+F6":function(){return p("[17;2~","[32~")},"Shift+F7":function(){return p("[18;2~","[33~")},"Shift+F8":function(){return p("[19;2~","[34~")},"Shift+F9":function(){return p("[20;2~","[35~")},"Shift+F10":function(){return p("[21;2~","[36~")},"Shift+F11":function(){return p("[22;2~","[37~")},"Shift+F12":function(){return p("[23;2~","[38~")},Numpad0:function(){return g("Op","0")},Numpad1:function(){return g("Oq","1")},Numpad2:function(){return g("Or","2")},Numpad3:function(){return g("Os","3")},Numpad4:function(){return g("Ot","4")},Numpad5:function(){return g("Ou","5")},Numpad6:function(){return g("Ov","6")},Numpad7:function(){return g("Ow","7")},Numpad8:function(){return g("Ox","8")},Numpad9:function(){return g("Oy","9")},"Numpad*":function(){return g("OR","*")},"Numpad+":function(){return g("Ol","+")},"Numpad-":function(){return g("OS","-")},"Numpad.":function(){return g("On",".")},"Numpad/":function(){return g("OQ","/")},"Control+]":"","Control+\\":"","Control+[":"","Control+^":"","Control+_":"","Control+ArrowLeft":"[1;5D","Control+ArrowRight":"[1;5C","Control+ArrowUp":"[1;5A","Control+ArrowDown":"[1;5B","Control+Home":"[1;5H","Control+End":"[1;5F","Shift+ArrowLeft":"[1;2D","Shift+ArrowRight":"[1;2C","Shift+ArrowUp":"[1;2A","Shift+ArrowDown":"[1;2B","Shift+Home":"[1;2H","Shift+End":"[1;2F","Alt+ArrowLeft":"b","Alt+ArrowRight":"f","Meta+ArrowLeft":"","Meta+ArrowRight":"","Alt+Backspace":"","Meta+Backspace":"","Control+Shift+C":function(){t.copySelectionToClipboard()},"Control+Insert":function(){t.copySelectionToClipboard()},"Control+F12":function(){t.window.debug^=1}},w=1;w<=26;w++)y["Control+"+String.fromCharCode(64+w)]=String.fromCharCode(w);var b=function(){return!v.no_keys&&!(document.activeElement instanceof window.HTMLTextAreaElement)},k=["F5","F11","F12","Shift+F5"],_={alt:!1,ctrl:!1,meta:!1,shift:!1},S=function(e){if(b()){var t=[];(e.altKey||_.alt)&&t.push("Alt"),(e.ctrlKey||_.ctrl)&&t.push("Control"),(e.metaKey||_.meta)&&t.push("Meta"),(e.shiftKey||_.shift)&&t.push("Shift");var i=u[e.which]||e.key;if(!e.ctrlKey&&!e.metaKey||"V"!==i){var r=null;for(var o in y){var s=o.split("+");if(s.pop()===i&&s.sort().join()===t.join()){if(k.includes(o)&&!v.all_fn)continue;r=y[o];break}}r&&(r instanceof Function&&(r=r()),e.preventDefault(),"string"==typeof r&&n(r))}}},C=0,x=0,T=0,L=0;return window.addEventListener("keydown",function(e){e.ctrlKey&&(L|=1),e.shiftKey&&(L|=2),e.altKey&&(L|=4),e.metaKey&&(L|=8)}),window.addEventListener("keyup",function(e){L=0,e.ctrlKey&&(L|=1),e.shiftKey&&(L|=2),e.altKey&&(L|=4),e.metaKey&&(L|=8)}),l={init:s,sendString:n,sendButton:i,setAlts:function(e,t,n,i){v.cu_alt===e&&v.np_alt===t&&v.fn_alt===n&&v.crlf_mode===i||(v.cu_alt=e,v.np_alt=t,v.fn_alt=n,v.crlf_mode=i)},setMouseMode:function(e,t){v.mt_click=e,v.mt_move=t},onMouseMove:function(t,n){if(v.mt_move){var i=C?1:x?2:T?3:0,o=a();e.send("m"+r(n)+r(t)+r(i)+r(o))}},onMouseDown:function(t,n,i){if(v.mt_click&&!(i>3||i<1)){var o=a();e.send("p"+r(n)+r(t)+r(i)+r(o))}},onMouseUp:function(t,n,i){if(v.mt_click&&!(i>3||i<1)){var o=a();e.send("r"+r(n)+r(t)+r(i)+r(o))}},onMouseWheel:function(t,n,i){if(v.mt_click){var o=a(),s=i<0?4:5;e.send("p"+r(n)+r(t)+r(s)+r(o))}},blockKeys:function(e){v.no_keys=e},handleKeyDown:S,softModifiers:_}}},function(e,t,n){"use strict";var i=n(1),r=n(0),o=r.qs,s=n(4);e.exports=function(e,t,n){function r(){l("Ready..."),s.show("#fu_modal",a),i("#fu_form").toggleClass("busy",!1),t.blockKeys(!0)}function a(){console.log("Upload modal closed."),clearTimeout(p),v=0,t.blockKeys(!1)}function l(e){o("#fu_prog").textContent=e}function u(){var e=o("#fu_text").value;if(!e.length)return void d();f=e.split("\n"),v=0,w=0,m=+o("#fu_delay").value,m<0&&(m=0,o("#fu_delay").value=m),g={CR:"\r",LF:"\n",CRLF:"\r\n"}[o("#fu_crlf").value],i("#fu_form").toggleClass("busy",!0),l("Starting..."),c()}function c(){if(i("#fu_modal").hasClass("visible")){if(!e.canSend())return void(p=setTimeout(c,1));0===w&&(y="",0===v&&n.bracketedPaste&&(y="[200~"),y+=f[v++]+g,v===f.length&&n.bracketedPaste&&(y+="[201~"));var r=+o("#fu_chunk").value;(0===r||r>b)&&(r=b);var s=void 0;if(y.length-w<=r?(s=y.substr(w,r),w=0):(s=y.substr(w,r),w+=r),!t.sendString(s))return void l("FAILED!");var a=Math.round(v/f.length*1e3)/10;l(v+" / "+f.length+" ("+a+"%)"),f.length>v||w>0?p=setTimeout(c,m):h()}}function h(){e.canSend()?(l("Done."),d()):(l("Waiting for Tx buffer..."),setTimeout(h,100))}function d(){s.hide("#fu_modal")}var f=void 0,v=void 0,p=void 0,m=void 0,g=void 0,y=void 0,w=void 0,b=128;return{init:function(){o("#fu_file").addEventListener("change",function(e){var t=new window.FileReader,n=e.target.files[0],i=n.type||"application/octet-stream";if(console.log("Selected file type: "+i),!i.match(/text\/.*|application\/(json|csv|.*xml.*|.*script.*|x-php)/)&&!window.confirm("This does not look like a text file: "+i+"\nReally load?"))return void(o("#fu_file").value="");t.onload=function(e){var t=e.target.result.replace(/[\r\n]+/,"\n");o("#fu_text").value=t},console.log("Loading file..."),t.readAsText(n)},!1),o("#term-fu-open").addEventListener("click",function(e){e.preventDefault(),r()}),o("#term-fu-start").addEventListener("click",function(e){e.preventDefault(),u()}),o("#term-fu-close").addEventListener("click",function(e){e.preventDefault(),d()})},open:r,setContent:function(e){o("#fu_text").value=e}}}},function(e,t,n){"use strict";var i=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&a.return&&a.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(0),o=r.qs;e.exports=function(e,t){var n=o("#softkb-input");if(n){var r=document.createElement("div");r.id="keyboard-shortcut-bar",navigator.userAgent.match(/iPad|iPhone|iPod/)&&o("#screen").appendChild(r);var s=!1,a=function(){if(s){var t=e.layout.gridToScreen(e.cursor.x,e.cursor.y,!0),r=i(t,2),o=r[0],a=r[1];n.style.transform="translate("+o+"px, "+a+"px)"}};n.addEventListener("focus",function(){s=!0,a(),r.classList.add("open")}),n.addEventListener("blur",function(){s=!1,r.classList.remove("open")}),e.on("cursor-moved",a),o("#term-kb-open").addEventListener("click",function(e){e.preventDefault(),n.focus()});var l="",u=function(e){null===e&&(e="");var n=!1;e.length>l.length?e.startsWith(l)?t.sendString(e.substr(l.length)):n=!0:e.length1)h.delete(d);else{o.globalAlpha=.5*Math.max(0,1-g);var y=d%s,w=Math.floor(d/s);2&p?o.fillStyle="#0f0":1&p&&(o.fillStyle="#f0f"),4&p||(o.fillStyle="#0ff"),16&p&&(o.globalAlpha/=2),o.fillRect(y*c.width,w*c.height,c.width,c.height),8&p&&(o.strokeStyle="#f00",o.beginPath(),o.moveTo(y*c.width,(w+1)*c.height),o.lineTo((y+1)*c.width,(w+1)*c.height),o.stroke())}}var b=[],_=!0,S=!1,C=void 0;try{for(var x,L=P.frames[Symbol.iterator]();!(_=(x=L.next()).done);_=!0){var A=x.value,E=A[4],F=(n-E)/1e3;F>1?b.push(A):(o.globalAlpha=1-F,o.strokeStyle="#ff0",o.strokeRect(A[0]*c.width,A[1]*c.height,A[2]*c.width,A[3]*c.height))}}catch(e){S=!0,C=e}finally{try{!_&&L.return&&L.return()}finally{if(S)throw C}}var O=!0,B=!1,M=void 0;try{for(var D,I=b[Symbol.iterator]();!(O=(D=I.next()).done);O=!0){var N=D.value;P.frames.splice(P.frames.indexOf(N),1)}}catch(e){B=!0,M=e}finally{try{!O&&I.return&&I.return()}finally{if(B)throw M}}}if(null!==k){var j=k,G=r(j,2),z=G[0],H=G[1];o.save(),o.globalAlpha=.5,o.lineWidth=1,o.beginPath(),o.moveTo(0,H*c.height),o.lineTo(z*c.width,H*c.height),o.strokeStyle="#f00",o.setLineDash([c.width]),o.stroke(),o.beginPath(),o.moveTo(z*c.width,0),o.lineTo(z*c.width,H*c.height),o.strokeStyle="#0f0",o.setLineDash([c.height]),o.stroke(),o.globalAlpha=1,o.lineWidth=1+.5*Math.sin(n/1e3*10),o.strokeStyle="#fff",o.lineJoin="round",o.setLineDash([2,2]),o.lineDashOffset=n/1e3*10,o.strokeRect(z*c.width,H*c.height,c.width,c.height),o.lineDashOffset+=2,o.strokeStyle="#000",o.strokeRect(z*c.width,H*c.height,c.width,c.height),o.restore()}if(null!==P.scrollRegion){var W=r(P.scrollRegion,2),q=W[0],U=W[1];o.save(),o.globalAlpha=1,o.strokeStyle="#00f",o.lineWidth=2,o.setLineDash([2,2]),o.beginPath(),o.moveTo(0,q*c.height),o.lineTo(s*c.width,q*c.height),o.stroke(),o.beginPath(),o.moveTo(0,(U+1)*c.height),o.lineTo(s*c.width,(U+1)*c.height),o.stroke(),o.restore()}};x=function(){R||(R=!0,F())};var O=function(e){return("00"+e.toString()).substr(-2)},B=function(e){return e<256?e.toString():"#"+O(e>>16)+O(e>>8&255)+O(255&e)},M=function(e,t){var n=document.createElement("span");return n.textContent=e,Object.assign(n.style,t||{}),n},D=function(e,t){t&l&&e.appendChild(M("HasFG")),t&u&&e.appendChild(M("HasBG")),t&c&&e.appendChild(M("Bold",{fontWeight:"bold"})),t&h&&e.appendChild(M("Uline",{textDecoration:"underline"})),t&d&&e.appendChild(M("Blink")),t&f&&e.appendChild(M("Italic",{fontStyle:"italic"})),t&v&&e.appendChild(M("Strike",{textDecoration:"line-through"})),t&p&&e.appendChild(M("Oline",{textDecoration:"overline"})),t&m&&e.appendChild(M("Faint",{opacity:.5})),t&g&&e.appendChild(M("Fraktur"))};w=function(){y.classList.remove("hidden"),y.innerHTML="";var t=k[1]*e.window.width+k[0];if(e.screen[t]){var n=document.createElement("span");n.textContent=B(e.screenFG[t]);var i=document.createElement("span");i.textContent=" ●",i.style.color=s(e.screenFG[t],e.layout.renderer.palette),n.appendChild(i);var r=document.createElement("span");r.textContent=B(e.screenBG[t]);var o=document.createElement("span");o.textContent=" ●",o.style.color=s(e.screenBG[t],e.layout.renderer.palette),r.appendChild(o);var a=e.screen[t],l=a.codePointAt(0),u=l.toString(16).length<=4?("0000"+l.toString(16)).substr(-4):l.toString(16),c=document.createElement("span");c.classList.add("attributes"),D(c,e.screenAttrs[t]);var h={Cell:"col "+(k[0]+1)+", ln "+(k[1]+1)+" ("+t+")",Foreground:n,Background:r,Character:"U+"+u,Attributes:c},d=document.createElement("table");for(var f in h){var v=document.createElement("tr"),p=document.createElement("td");p.appendChild(new window.Text(f)),p.classList.add("label");var m=document.createElement("td");m.appendChild("string"==typeof h[f]?new window.Text(h[f]):h[f]),m.classList.add("value"),v.appendChild(p),v.appendChild(m),d.appendChild(v)}y.appendChild(d);var g=e.layout.getCellSize(),w=(k[0]+1)*g.width+3,b=(k[1]+1)*g.height+3;y.style.transform="translate("+w+"px, "+b+"px)"}};var I=null,N={},j=function(){if(!I){var t=document.createElement("input");t.type="checkbox",t.addEventListener("change",function(e){P.showUpdates=t.checked});var n=document.createElement("input");n.type="checkbox",n.value=!!e.layout.renderer.graphics,n.addEventListener("change",function(t){e.layout.renderer.graphics=+n.checked}),I={cursor:{title:"Cursor",Position:"",Style:"",Visible:!0,Hanging:!1},internal:{Flags:"","Cursor Attributes":"","Code Page":"",Heap:0,Clients:0},drawing:{title:"Drawing","Last Update":"","Show Updates":t,"Fancy Graphics":n,"Redraw Screen":function(){e.layout.renderer.resetDrawn(),e.layout.renderer.draw("debug-redraw")}}};for(var i in I)!function(e){var t=I[e],n=document.createElement("table");n.classList.add("toolbar-group"),N[e]={};for(var i in t)!function(i){var r=document.createElement("tr"),o=document.createElement("td");o.classList.add("name");var s=document.createElement("td");if(s.classList.add("value"),N[e][i]={name:o,value:s},"title"===i)o.textContent=t[i],o.classList.add("title");else if(o.textContent=i,t[i]instanceof Function){o.textContent="";var a=document.createElement("button");o.classList.add("has-button"),o.appendChild(a),a.textContent=i,a.addEventListener("click",function(e){return t[i](e)})}else t[i]instanceof window.Node?s.appendChild(t[i]):s.textContent=t[i];r.appendChild(o),r.appendChild(s),n.appendChild(r)}(i);a.appendChild(n)}(i);var r=N.heartbeat=document.createElement("div");r.classList.add("heartbeat"),r.textContent="❤",a.appendChild(r)}};t.on("heartbeat",function(){T&&N.heartbeat&&(N.heartbeat.classList.remove("beat"),window.requestAnimationFrame(function(){N.heartbeat.classList.add("beat")}))}),b=function(){j(),Object.assign(I.cursor,{Position:"col "+(e.cursor.x+1)+", ln "+(e.cursor.y+1),Style:e.cursor.style+(e.cursor.blinking?", blink":""),Visible:e.cursor.visible,Hanging:e.cursor.hanging});var t=Math.round(100*(P.endTime-P.startTime))/100;I.drawing["Last Update"]=P.reason+" ("+t+"ms)",I.drawing["Fancy Graphics"].checked=!!e.layout.renderer.graphics;for(var n in I){var i=I[n],r=N[n];for(var o in i)if("title"!==o){var s=r[o].value;i[o]instanceof window.Node||i[o]instanceof Function||(s.textContent=i[o])}}},e.on("update",b),e.on("internal",function(e){T&&I&&(Object.assign(I.internal,{Flags:e.flags.toString(2),"Cursor Attributes":e.cursorAttrs.toString(2),"Code Page":e.charsetGx+" ("+e.charsetG0+", "+e.charsetG1+")",Heap:e.freeHeap,Clients:e.clientCount}),P.scrollRegion=[e.regionStart,e.regionEnd],b())})}},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);tl.length)for(var e=l.length;er.length)for(var t=l.length;t>r.length;t--)v();for(var a=0;a '+f+" "),(l+1)%5==0&&n.htmlAppend("
")}s(".preset").on("click",function(){s("#default_fg").val(this.dataset.xfg),s("#default_bg").val(this.dataset.xbg),r()}),r()},t.nextTheme=function(){var e=u("#theme"),t=e.selectedIndex;e.options[++t%e.options.length].selected=!0,r()},t.prevTheme=function(){var e=u("#theme"),t=e.selectedIndex;e.options[(e.options.length+--t)%e.options.length].selected=!0,r()}},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);tthis.triangleRadius&&rl){var u=y.tan(r)*a,c=y.atan(u/l);c>w/6?c=w/6:c<-w/6&&(c=-w/6),n+=c-r,i=(n+w-this.hue)%w,r=i%(w/3)-w/6,s=y.tan(r)*o,a=l=y.sqrt(o*o+s*s)}e=y.round(y.cos(n)*a),t=y.round(-y.sin(n)*a);var h=this.lightness=y.sin(i)*a/this.triangleSideLength+.5,d=1-2*y.abs(h-.5),f=this.saturation=(y.cos(i)*a+this.triangleRadius/2)/(1.5*this.triangleRadius)/d;f=y.max(0,f),f=y.min(1,f),this.lightness=h,this.saturation=f,this.x=e,this.y=t,this.moveTrianglePointer(),this.emit("drag")}}}},{key:"setOptions",value:function(e){e=e||{};var t=this.options,n=this.options={};l(t,function(t,i){n[i]=e.hasOwnProperty(i)?e[i]:t})}}],[{key:"initInput",value:function(e,n){n=n||{};var i=void 0,r=function(){var r=e.value;n.parseColor&&(r=n.parseColor(r)),i?i.setHEX(r):(n.size=n.size||e.offsetWidth,n.background=m.getComputedStyle(e,null).backgroundColor,n.margin=n.margin||10,n.event=n.event||"dragend",i=new t(r,n),i.on(n.event,function(){var t=i.getHEX();e.value=n.uppercase?t.toUpperCase():t,s()}));var o=e.offsetTop;m.innerHeight-e.getBoundingClientRect().top>e.offsetHeight+n.margin+n.size?o+=e.offsetHeight+n.margin:o-=n.margin+n.size;var a=i.getElement();a.style.position="absolute",a.style.left=e.offsetLeft+"px",a.style.top=o+"px",a.style.zIndex="1338",i.inject(e.parentNode)},o=function(){i&&i.dispose()},s=function(){var t=g.createEvent("HTMLEvents");t.initEvent("input",!0,!1),e.dispatchEvent(t)};e.addEventListener("focus",r,!1),e.addEventListener("blur",o,!1),e.addEventListener("keyup",function(){e.value.match(/^#((?:[0-9A-Fa-f]{3})|(?:[0-9A-Fa-f]{6}))$/)?(r(),s()):o()},!1)}}]),t}(c)}]); //# sourceMappingURL=app.8b43b1d-en.js.map