You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
72 KiB
19 lines
72 KiB
7 years ago
|
'use strict';var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a};(function(){'use strict';function a(){var a;for(p=!0,a=0;a<n.length;a+=1)n[a]();n=[]}function b(){var b;for(q=!0,p||a(),b=0;b<o.length;b+=1)o[b]();o=[]}function c(a,b){var c;for(c=b.length-1;0<=c;c-=1)a(b[c])}function e(a){return a.replace(/-\w/g,function(a){return a.charAt(1).toUpperCase()})}function f(a,b){return a.currentStyle?a.currentStyle[e(b)]:d.getComputedStyle?d.getComputedStyle(a,null).getPropertyValue(b):null}function g(a,b){return encodeURIComponent(a).replace(/%20/g,'+')+'='+encodeURIComponent(b).replace(/%20/g,'+')}function h(a,b,c){try{a.style[e(b)]=c}catch(a){}}function i(a){a.style.display='','none'===f(a,'display')&&(a.style.display='block')}function j(a){var b,d,e,f='';if(a.constructor===Object){for(b in a)if(a.hasOwnProperty(b))if(a[b].constructor===Array)for(d=0;d<a[b].length;d+=1)f+='&'+g(b,a[b][d]);else f+='&'+g(b,a[b]);}else c(function(a){if('FORM'===a.nodeName)for(d=0;d<a.elements.length;d+=1)if(b=a.elements[d],!b.disabled)switch(b.type){case'button':case'image':case'file':case'submit':case'reset':break;case'select-one':0<b.length&&(f+='&'+g(b.name,b.value));break;case'select-multiple':for(e=0;e<b.length;e+=1)b[e].selected&&(f+='&'+g(b.name,b[e].value));break;case'checkbox':case'radio':b.checked&&(f+='&'+g(b.name,b.value));break;default:f+='&'+g(b.name,b.value);}},a);return 0<f.length?f.substring(1):''}function k(a,b,d){var e,f,g=!1;return a&&(e=a.split(/\s+/),c(function(a){for(f=0;f<e.length;f+=1){var c=e[f];if('remove'===b)a.classList.remove(c);else if('add'===b)a.classList.add(c);else if('toggle'===b)a.classList.toggle(c);else if('has'===b&&a.classList.contains(c)){g=!0;break}}},d)),g}function l(a,b,d){var e,f;a&&c(function(c){for(e=r.createElement('div'),e.innerHTML=a;null!==(f=e.lastChild);)try{'before'===b?c.parentNode.insertBefore(f,c):'after'===b?c.parentNode.insertBefore(f,c.nextSibling):'append'===b?c.appendChild(f):'prepend'===b&&c.insertBefore(f,c.firstChild)}catch(a){break}},d)}function m(a){var b,g,j,n=[],o=!1;if(a)if(a.nodeType&&1===a.nodeType)n=[a];else if('object'===('undefined'==typeof a?'undefined':_typeof(a)))o='number'!=typeof a.length,n=a;else if('string'==typeof a)for(g=r.querySelectorAll(a),j=0;j<g.length;j+=1)n[j]=g[j];return b=o?{}:n,b.each=function(a){return'function'==typeof a&&c(function(b){return a.apply(b,arguments)},n),b},b.first=function(){return m(n.shift())},b.last=function(){return m(n.pop())},b.odd=function(){var a,b=[];for(a=0;a<n.length;a+=2)b.push(n[a]);return m(b)},b.even=function(){var a,b=[];for(a=1;a<n.length;a+=2)b.push(n[a]);return m(b)},b.hide=function(){return c(function(a){a.style.display='none'},n),b},b.show=function(){return c(function(a){i(a)},n),b},b.toggle=function(a){return'undefined'==typeof a?c(function(a){'none'===f(a,'display')?i(a):a.style.display='none'},n):a?b.show():b.hide(),b},b.remove=function(){return c(function(a){try{a.parentNode.removeChild(a)}catch(a){}},n),m()},b.css=function(a,d){if(a){if(d||''===d)return c(function(b){h(b,a,d)},n),b;if(n[0]){if(n[0].style[e(a)])return n[0].style[e(a)];if(f(n[0],a))return f(n[0],a)}}},b.getClass=function(){if(n[0]&&0<n[0].className.length)return n[0].className.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,'').replace(/\s+/,' ')},b.setClass=function(a){return(a||''===a)&&c(function(b){b.className=a},n),b},b.addClass=function(a){return k(a,'add',n),b},b.removeClass=function(a){return k(a,'remove',n),b},b.toggleClass=function(a,c){var d='undefined'==typeof c?'toggle':+c?'add':'remove';return k(a,d,n),b},b.hasClass=function(a){return k(a,'has',n)},b.html=function(a){return a||''===a?(c(function(b){b.innerHTML=a},n),b):n[0]?n[0].innerHTML:void 0},b.htmlBefore=function(a){return l(a,'before',n),b},b.htmlAfter=function(a){return l(a,'after',n),b},b.htmlAppend=function(a){return l(a,'append',n),b},b.htmlPrepend=function(a){return l(a,'prepend',n),b},b.attr=function(a,d){if(a){i
|
||
|
'use strict';(function(a){function b(a,b){for(var c=a.length;c--;)if(a[c]===b)return c;return-1}function c(a,b){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}function d(a){for(j in n)n[j]=a[s[j]]}function e(a){var c,e,h,j,i,l;if(c=a.keyCode,-1==b(r,c)&&r.push(c),(93==c||224==c)&&(c=91),c in n){for(h in n[c]=!0,o)o[h]==c&&(f[h]=!0);return}if((d(a),!!f.filter.call(this,a))&&c in m)for(l=g(),j=0;j<m[c].length;j++)if(e=m[c][j],e.scope==l||'all'==e.scope){for(h in i=0<e.mods.length,n)(!n[h]&&-1<b(e.mods,+h)||n[h]&&-1==b(e.mods,+h))&&(i=!1);(0!=e.mods.length||n[16]||n[18]||n[17]||n[91])&&!i||!1!==e.method(a,e)||(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0))}}function f(a,b,c){var d,e;d=h(a),c===void 0&&(c=b,b='all');for(var f=0;f<d.length;f++)e=[],a=d[f].split('+'),1<a.length&&(e=l(a),a=[a[a.length-1]]),a=a[0],a=q(a),a in m||(m[a]=[]),m[a].push({shortcut:d[f],scope:b,method:c,key:d[f],mods:e})}function g(){return k||'all'}function h(a){var b;return a=a.replace(/\s/g,''),b=a.split(','),''==b[b.length-1]&&(b[b.length-2]+=','),b}function l(a){var b=a.slice(0,a.length-1);for(var c=0;c<b.length;c++)b[c]=o[b[c]];return b}function i(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent('on'+b,function(){c(window.event)})}var j,m={},n={16:!1,17:!1,18:!1,91:!1},k='all',o={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},p={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220,insert:45,np_0:96,np_1:97,np_2:98,np_3:99,np_4:100,np_5:101,np_6:102,np_7:103,np_8:104,np_9:105,np_mul:106,np_add:107,np_sub:109,np_point:110,np_div:111,numlock:144},q=function(a){return p[a]||a.toUpperCase().charCodeAt(0)},r=[];for(j=1;20>j;j++)p['f'+j]=111+j;var s={16:'shiftKey',17:'ctrlKey',18:'altKey',91:'metaKey'};for(j in o)f[j]=!1;i(document,'keydown',function(a){e(a)}),i(document,'keyup',function(a){var c,d=a.keyCode,e=b(r,d);if(0<=e&&r.splice(e,1),(93==d||224==d)&&(d=91),d in n)for(c in n[d]=!1,o)o[c]==d&&(f[c]=!1)}),i(window,'focus',function(){for(j in n)n[j]=!1;for(j in o)f[j]=!1});var t=a.key;a.key=f,a.key.setScope=function(a){k=a||'all'},a.key.getScope=g,a.key.deleteScope=function(a){var b,c,d;for(b in m)for(c=m[b],d=0;d<c.length;)c[d].scope===a?c.splice(d,1):d++},a.key.filter=function(a){var b=(a.target||a.srcElement).tagName;return'INPUT'!=b&&'SELECT'!=b&&'TEXTAREA'!=b},a.key.isPressed=function(a){return'string'==typeof a&&(a=q(a)),-1!=b(r,a)},a.key.isModifier=function(a){return'control'==a||'ctrl'==a?n[17]:'shift'==a?n[16]:'meta'==a?n[91]:!('alt'!=a)&&n[18]},a.key.getPressedKeyCodes=function(){return r.slice(0)},a.key.noConflict=function(){var b=a.key;return a.key=t,b},a.key.unbind=function(a,b){var d,e,f,i,j,k=[];for(d=h(a),i=0;i<d.length;i++){if(e=d[i].split('+'),1<e.length&&(k=l(e)),a=e[e.length-1],a=q(a),void 0===b&&(b=g()),!m[a])return;for(f=0;f<m[a].length;f++)j=m[a][f],j.scope===b&&c(j.mods,k)&&(m[a][f]={})}},'undefined'!=typeof module&&(module.exports=f)})(window);
|
||
|
'use strict';String.fromCodePoint||function(){var a=function(){try{var a={};var b=Object.defineProperty;var c=b(a,a,a)&&b}catch(a){}return c}();var b=String.fromCharCode;var c=Math.floor;var d=function(){var a=[];var d;var e;var f=-1;var g=arguments.length;if(!g)return'';for(var h='';++f<g;){var i=+arguments[f];if(!isFinite(i)||0>i||1114111<i||c(i)!=i)throw RangeError('Invalid code point: '+i);65535>=i?a.push(i):(i-=65536,d=(i>>10)+55296,e=i%1024+56320,a.push(d,e)),(f+1==g||a.length>16384)&&(h+=b.apply(null,a),a.length=0)}return h};a?a(String,'fromCodePoint',{value:d,configurable:!0,writable:!0}):String.fromCodePoint=d}();
|
||
|
'use strict';function mk(a){return document.createElement(a)}function qs(a){return document.querySelector(a)}function qsa(a){return document.querySelectorAll(a)}function bool(a){return 1===a||'1'===a||!0===a||'true'===a}function cr(a){return function(b){(10===b.which||13===b.which||32===b.which)&&a()}}function esc(a){return $.htmlEscape(a)}function undef(a){return'undefined'==typeof a}function jsp(a){try{return JSON.parse(a)}catch(a){return console.error(a),null}}function Chr(a){return String.fromCharCode(a)}function parse2B(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0;return a.charCodeAt(b++)-1+127*(a.charCodeAt(b)-1)}function parse3B(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0;return a.charCodeAt(b)-1+127*(a.charCodeAt(b+1)-1)+127*(127*(a.charCodeAt(b+2)-1))}function encode2B(a){var b,c;return b=a%127,a=(a-b)/127,b+=1,c=a+1,Chr(b)+Chr(c)}function encode3B(a){var b,c,d;return b=a%127,a=(a-b)/127,b+=1,c=a%127,a=(a-c)/127,c+=1,d=a+1,Chr(b)+Chr(c)+Chr(d)}
|
||
|
'use strict';(function(){var a={};var b=null;a.show=function(a,c){var d=$(a);d.removeClass('hidden visible'),setTimeout(function(){d.addClass('visible')},1),b=c},a.hide=function(a){var c=$(a);c.removeClass('visible'),setTimeout(function(){c.addClass('hidden'),b&&b()},500)},a.init=function(){$('.Modal').on('click',function(){$(this).hasClass('no-close')||a.hide(this)}),$('.Dialog').on('click',function(a){a.stopImmediatePropagation()}),$(window).on('keydown',function(b){27===b.which&&a.hide('.Modal')})},window.Modal=a})();
|
||
|
'use strict';window.Notify=function(){var a={};var b='#notif';var c;var d;var e;var f;var g=!1;var h=function(){clearTimeout(d),clearTimeout(e)};return a.show=function(b,e,i){c.toggleClass('error',!0===i),c.html(b),Modal.show(c),h(),(undef(e)||null===e||0>=e)&&(e=2500),d=setTimeout(a.hide,e),g=!1,f=setTimeout(function(){g=!0},500)},a.hide=function(){var a=$(b);a.removeClass('visible'),e=setTimeout(function(){a.addClass('hidden')},250)},a.init=function(){c=$(b),$(document).on('click',function(){g&&a.hide(this)}),c.on('click',function(a){return a.stopImmediatePropagation(),!1}),c.on('mouseenter',function(){h(),c.removeClass('hidden').addClass('visible')})},a}();
|
||
|
'use strict';$.ready(function(){$('.Row.checkbox').forEach(function(a){var b=a.querySelector('input');var c=a.querySelector('.box');$(c).toggleClass('checked',b.value);var d=function(){b.value=1-b.value,$(c).toggleClass('checked',b.value)};$(a).on('click',d).on('keypress',cr(d))}),$('.Box.mobcol,.Box.fold').forEach(function(a){var b=a.querySelector('h2');var c=function(){$(a).toggleClass('expanded')};$(b).on('click',c).on('keypress',cr(c))}),$('form').forEach(function(a){$(a).on('keypress',function(b){(10===b.keyCode||13===b.keyCode)&&b.ctrlKey&&a.submit()})}),setInterval(function(){$('.anim-dots').each(function(a){var b=$(a);var c=b.html()+'.';5===c.length&&(c='.'),b.html(c)})},1e3),$('input[type=number]').on('mousewheel',function(a){var b=$(this);var c=+b.val();isNaN(c)&&(c=1);var d=+(b.attr('step')||1);var e=+b.attr('min');var f=+b.attr('max');if(0<a.wheelDelta?c+=d:c-=d,undef(e)&&(c=Math.max(c,+e)),undef(f)&&(c=Math.min(c,+f)),b.val(c),'createEvent'in document){var g=document.createEvent('HTMLEvents');g.initEvent('change',!1,!0),b[0].dispatchEvent(g)}else b[0].fireEvent('onchange');a.preventDefault()});var a=location.search.indexOf('err=');if(-1!==a&&qs('.Box.errors')){var b=location.search.substr(a+4).split(',');var c=[];b.forEach(function(a){var b=qs('label[for="'+a+'"]');b&&(b.classList.add('error'),c.push(b.childNodes[0].textContent.trim().replace(/: ?$/,'')))}),qs('.Box.errors .list').innerHTML=c.join(', '),qs('.Box.errors').classList.remove('hidden')}if(Modal.init(),Notify.init(),550<window.innerWidth){$('.Box h2').forEach(function(a){a.removeAttribute('tabindex')});var d=qs('#brand');d&&d.addEventListener('click',function(){location.href='/'})}}),$._loader=function(a){$('#loader').toggleClass('show',a)};function showPage(){$('#content').addClass('load')}$.ready(function(){!0!==window.noAutoShow&&setTimeout(function(){showPage()},1)});
|
||
|
'use strict';var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var ANSIParser=function(){function a(b){_classCallCheck(this,a),this.reset(),this.handler=b,this.joinChunks=!0}return _createClass(a,[{key:'reset',value:function reset(){this.currentSequence=0,this.sequence=''}},{key:'parseSequence',value:function parseSequence(a){if('['===a[0]){var b=a[a.length-1];var c=a.substring(1,a.length-1);var d=c?c.split(';').map(function(a){return+a.replace(/\D/g,'')}):[];var e=d.length?d[0]:1;if('H'===b)this.handler('set-cursor',(0|d[0])-1,(0|d[1])-1);else if('A'<=b&&'D'>=b)this.handler('move-cursor-'+('B'>=b?'y':'x'),('B'===b||'C'===b?1:-1)*e);else if('E'===b||'F'===b)this.handler('move-cursor-line',('E'===b?1:-1)*e);else if('G'===b)this.handler('set-cursor-x',e-1);else if('J'===b){var f=d.length?d[0]:2;2===f&&this.handler('clear')}else if('P'===b)this.handler('delete',e);else if('@'===b)this.handler('insert-blanks',e);else if('q'===b)this.handler('set-cursor-style',e);else if('m'===b){if(!d.length||0===d[0])return void this.handler('reset-style');var g=d[0];if(1===g)this.handler('add-attrs',1);else if(2===g)this.handler('add-attrs',2);else if(3===g)this.handler('add-attrs',4);else if(4===g)this.handler('add-attrs',8);else if(5===g||6===g)this.handler('add-attrs',16);else if(7===g)this.handler('add-attrs',-1);else if(9===g)this.handler('add-attrs',64);else if(20===g)this.handler('add-attrs',32);else if(30<=g&&37>=g)this.handler('set-color-fg',g%10);else if(40<=g&&47>=g)this.handler('set-color-bg',g%10);else if(39===g)this.handler('set-color-fg',7);else if(49===g)this.handler('set-color-bg',0);else if(90<=g&&98>=g)this.handler('set-color-fg',g%10+8);else if(100<=g&&108>=g)this.handler('set-color-bg',g%10+8);else if((38===g||48===g)&&5===d[1]){var h=255&(0|d[2]);38===g&&this.handler('set-color-fg',h),48===g&&this.handler('set-color-bg',h)}}else('h'===b||'l'===b)&&'?25'===c&&('h'===b?this.handler('show-cursor'):'l'===b&&this.handler('hide-cursor'))}}},{key:'write',value:function write(a){var b=!0;var c=!1;var d=void 0;try{for(var e,f=a.toString()[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;var h=g.codePointAt(0);27===h?this.currentSequence=1:1===this.currentSequence&&'['===g?(this.currentSequence=2,this.sequence+='['):this.currentSequence&&g.match(/[\x40-\x7e]/)?(this.parseSequence(this.sequence+g),this.currentSequence=0,this.sequence=''):1<this.currentSequence?this.sequence+=g:1===this.currentSequence?(this.currentSequence=0,this.handler('write',g)):7===h?this.handler('bell'):8===h?this.handler('back'):10===h?this.handler('new-line'):13===h?this.handler('return'):21===h?this.handler('delete-line'):23===h?this.handler('delete-word'):this.handler('write',g)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}this.joinChunks||this.reset()}}]),a}();var TERM_DEFAULT_STYLE=7;var TERM_MIN_DRAW_DELAY=10;var getRainbowColor=function(a){var c=Math.PI;var d=Math.floor;var e=Math.sin;var f=d(2.5*e(a)+2.5);var h=d(2.5*e(a+2/3*c)+2.5);var g=d(2.5*e(a+4/3*c)+2.5);return 16+36*f+6*h+g};var ScrollingTerminal=function(){function a(b){var c=this;_classCallC
|
||
|
"use strict";var _tr={"wifi.connected_ip_is":"Connected, IP is ","wifi.not_conn":"Not connected.","wifi.enter_passwd":"Enter password for \":ssid:\""};function tr(a){return _tr[a]||"?"+a+"?"}
|
||
|
'use strict';(function(a){function b(a){return Math.round(100*(a.value/a.max))+'%'}function c(a,b,c){$('#sta_ssid').val(a),$('#sta_password').val(b),$('#sta-nw').toggleClass('hidden',0===a.length),$('#sta-nw-nil').toggleClass('hidden',0<a.length),$('#sta-nw .essid').html(esc(a));var d=undef(b)||0===b.length;$('#sta-nw .passwd').toggleClass('hidden',d),$('#sta-nw .nopasswd').toggleClass('hidden',!d),$('#sta-nw .ip').html(0<c.length?tr('wifi.connected_ip_is')+c:tr('wifi.not_conn'))}function d(a,b){if(200!==b)return void f(5e3);try{a=JSON.parse(a)}catch(a){return console.log(a),void f(5e3)}var d=!bool(a.result.inProgress)&&0<a.result.APs.length;if(f(d?15000:1e3),!!d){var e=$('#ap-list');$('#ap-list .AP').remove(),e.toggleClass('hidden',!d),$('#ap-loader').toggleClass('hidden',d),a.result.APs.sort(function(c,a){return a.rssi-c.rssi}).forEach(function(a){if(a.enc=parseInt(a.enc),!(4<a.enc)){var b=mk('div');var d=$(b).data('ssid',a.essid).data('pwd',a.enc).attr('tabindex',0).addClass('AP');a.essid===h&&d.addClass('selected');var f=mk('div');var i=$.htmlEscape(a.essid);$(f).addClass('inner').htmlAppend('<div class="rssi">'+a.rssi_perc+'</div>').htmlAppend('<div class="essid" title="'+i+'">'+i+'</div>').htmlAppend('<div class="auth">'+g[a.enc]+'</div>'),d.on('click',function(){var a=$(this);var b=a.data('ssid');var d='';+a.data('pwd')&&(d=prompt(tr('wifi.enter_passwd').replace(':ssid:',b)),!d)||($('#sta_password').val(d),$('#sta_ssid').val(b),c(b,d,''))}),b.appendChild(f),e[0].appendChild(b)}})}}function e(){_demo?d(_demo_aps,200):$.get('http://'+_root+'/cfg/wifi/scan',d)}function f(a){setTimeout(e,a)}var g=['Open','WEP','WPA','WPA2','WPA/WPA2'];var h;a.init=function(a){$('.Row.range').forEach(function(a){var c=a.querySelector('input');var d=a.querySelector('.x-disp1');var e=a.querySelector('.x-disp2');var f=b(c);$(d).html(f),$(e).html(f),$(c).on('input',function(){f=b(c),$(d).html(f),$(e).html(f)})}),$('#forget-sta').on('click',function(){return c('','',''),!1}),c(a.sta_ssid,a.sta_password,a.sta_active_ip),h=a.sta_active_ssid},a.startScanning=function(){$('#ap-loader').removeClass('hidden'),$('#ap-scan').addClass('hidden'),$('#ap-loader .anim-dots').html('.'),e()}})(window.WiFi={});
|
||
|
'use strict';window.Conn=function(a){function b(){console.log('CONNECTED'),g(),e('i')}function c(a){console.warn('SOCKET CLOSED, code '+a.code+'. Reconnecting...'),clearTimeout(n),n=setTimeout(function(){f()},2e3)}function d(b){try{switch(b.data.charAt(0)){case'.':break;case'-':l=!0,m=setTimeout(function(){l=!1},250);break;case'+':l=!1,clearTimeout(m);break;default:a.load(b.data),o||(showPage(),o=!0);}g()}catch(a){console.error(a)}}function e(a){return _demo?('undefined'==typeof demoInterface?console.log('TX: '+JSON.stringify(a)):demoInterface.input(a),!0):l?(console.log('Can\'t send, flood control.'),!1):!!i&&(1===i.readyState?('string'!=typeof a&&(a=JSON.stringify(a)),i.send(a),!0):(console.error('Socket not ready'),!1))}function f(){return window._demo?void('undefined'==typeof demoInterface?alert('Demoing non-demo demo!'):(demoInterface.init(a),showPage())):void(clearTimeout(n),clearTimeout(j),i=new WebSocket('ws://'+_root+'/term/update.ws'),i.onopen=b,i.onclose=c,i.onmessage=d,console.log('Opening socket.'),g())}function g(){clearTimeout(j),j=setTimeout(h,2e3)}function h(){console.error('Heartbeat lost, probing server...'),k=setInterval(function(){console.log('> ping'),$.get('http://'+_root+'/system/ping',function(a,b){200===b&&(clearInterval(k),console.info('Server ready, reloading page...'),location.reload())},{timeout:100})},1e3)}var i;var j;var k;var l=!1;var m;var n;var o=!1;return{ws:null,init:f,send:e,canSend:function(){return!l}}};
|
||
|
'use strict';window.Input=function(a){function b(b){return a.send('s'+b)}function c(b){a.send('b'+Chr(b))}function d(a,b){return l.fn_alt?a:b}function e(a,b){return l.cu_alt?a:b}function f(a,b){return l.np_alt?a:b}function g(a){var b={tab:'\t',backspace:'\b',enter:l.crlf_mode?'\r\n':'\r',"ctrl+enter":'\n',esc:'\x1B',up:e('\x1BOA','\x1B[A'),down:e('\x1BOB','\x1B[B'),right:e('\x1BOC','\x1B[C'),left:e('\x1BOD','\x1B[D'),home:e('\x1BOH',d('\x1B[H','\x1B[1~')),insert:'\x1B[2~',delete:'\x1B[3~',end:e('\x1BOF',d('\x1B[F','\x1B[4~')),pageup:'\x1B[5~',pagedown:'\x1B[6~',f1:d('\x1BOP','\x1B[11~'),f2:d('\x1BOQ','\x1B[12~'),f3:d('\x1BOR','\x1B[13~'),f4:d('\x1BOS','\x1B[14~'),f5:'\x1B[15~',f6:'\x1B[17~',f7:'\x1B[18~',f8:'\x1B[19~',f9:'\x1B[20~',f10:'\x1B[21~',f11:'\x1B[23~',f12:'\x1B[24~',"shift+f1":d('\x1BO1;2P','\x1B[25~'),"shift+f2":d('\x1BO1;2Q','\x1B[26~'),"shift+f3":d('\x1BO1;2R','\x1B[28~'),"shift+f4":d('\x1BO1;2S','\x1B[29~'),"shift+f5":d('\x1B[15;2~','\x1B[31~'),"shift+f6":d('\x1B[17;2~','\x1B[32~'),"shift+f7":d('\x1B[18;2~','\x1B[33~'),"shift+f8":d('\x1B[19;2~','\x1B[34~'),"shift+f9":d('\x1B[20;2~','\x1B[35~'),"shift+f10":d('\x1B[21;2~','\x1B[36~'),"shift+f11":d('\x1B[22;2~','\x1B[37~'),"shift+f12":d('\x1B[23;2~','\x1B[38~'),np_0:f('\x1BOp','0'),np_1:f('\x1BOq','1'),np_2:f('\x1BOr','2'),np_3:f('\x1BOs','3'),np_4:f('\x1BOt','4'),np_5:f('\x1BOu','5'),np_6:f('\x1BOv','6'),np_7:f('\x1BOw','7'),np_8:f('\x1BOx','8'),np_9:f('\x1BOy','9'),np_mul:f('\x1BOR','*'),np_add:f('\x1BOl','+'),np_sub:f('\x1BOS','-'),np_point:f('\x1BOn','.'),np_div:f('\x1BOQ','/')};var c=['f5','f11','f12','shift+f5'];for(var g in b)(a||!c.includes(g))&&b.hasOwnProperty(g)&&h(g,b[g])}function h(a,c){-1!==a.indexOf('ctrl+')&&(a+=','+a.replace('ctrl','command')),key.unbind(a),key(a,function(a){l.no_keys||(a.preventDefault(),b(c))})}function i(a){var c=String.fromCharCode;var d=a.allFn;window.addEventListener('keypress',function(a){if(!l.no_keys){var c='';a.key?c=a.key:a.which&&(c=String.fromCodePoint(a.which)),0<c.length&&32<=c.charCodeAt(0)&&(32===a.which&&a.preventDefault(),b(c))}});for(var e=1;26>=e;e++)h('ctrl+'+c(96+e),c(e));h('ctrl+]','\x1B'),h('ctrl+\\','\x1C'),h('ctrl+[','\x1D'),h('ctrl+^','\x1E'),h('ctrl+_','\x1F'),h('ctrl+left','\x1F[1;5D'),h('ctrl+right','\x1F[1;5C'),h('ctrl+up','\x1F[1;5A'),h('ctrl+down','\x1F[1;5B'),h('ctrl+home','\x1F[1;5H'),h('ctrl+end','\x1F[1;5F'),h('shift+left','\x1F[1;2D'),h('shift+right','\x1F[1;2C'),h('shift+up','\x1F[1;2A'),h('shift+down','\x1F[1;2B'),h('shift+home','\x1F[1;2H'),h('shift+end','\x1F[1;2F'),h('\u2325+left','\x1Bb'),h('\u2325+right','\x1Bf'),h('\u2318+left','\x01'),h('\u2318+right','\x05'),h('\u2325+backspace','\x17'),h('\u2318+backspace','\x15'),g(d)}function j(){return(key.isModifier('ctrl')?1:0)|(key.isModifier('shift')?2:0)|(key.isModifier('alt')?4:0)|(key.isModifier('meta')?8:0)}var l={np_alt:!1,cu_alt:!1,fn_alt:!1,mt_click:!1,mt_move:!1,no_keys:!1,crlf_mode:!1};var k=0;var n=0;var o=0;return{init:function(a){i(a),$('#action-buttons button').forEach(function(a){a.addEventListener('click',function(){c(+this.dataset.n)})}),window.addEventListener('mousedown',function(a){0===a.button&&(k=1),1===a.button&&(n=1),2===a.button&&(o=1)}),window.addEventListener('mouseup',function(a){0===a.button&&(k=0),1===a.button&&(n=0),2===a.button&&(o=0)})},sendString:b,setAlts:function setAlts(a,b,c,d){(l.cu_alt!==a||l.np_alt!==b||l.fn_alt!==c||l.crlf_mode!==d)&&(l.cu_alt=a,l.np_alt=b,l.fn_alt=c,l.crlf_mode=d,g())},setMouseMode:function setMouseMode(a,b){l.mt_click=a,l.mt_move=b},onMouseMove:function onMouseMove(c,d){if(l.mt_move){var e=k?1:n?2:o?3:0;var b=j();a.send('m'+encode2B(d)+encode2B(c)+encode2B(e)+encode2B(b))}},onMouseDown:function onMouseDown(c,d,e){if(l.mt_click&&!(3<e||1>e)){var b=j();a.send('p'+encode2B(d)+encode2B(c)+encode2B(e)+encode2B(b))}},onMouseUp:function onMouseUp(c,d,e){if(l.mt_click&&!(3<e||1>e)){var b=j();a.send('r'+encode2B(d)+encode2B(c)+encode2B(e)+encode2B(b))}},onMouseWheel:function onMouseWheel(c,d,e){if(l.mt_click){var f=j();var g=0>e?4:5;a.send('p'+encode2B(d)+encode2B(c)+encode2B(g)+encode2
|
||
|
'use strict';var _slicedToArray=function(){function a(a,b){var c=[];var d=!0;var e=!1;var f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h['return']&&h['return']()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError('Invalid attempt to destructure non-iterable instance')}}();var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,'value'in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}var frakturExceptions={C:'\u212D',H:'\u210C',I:'\u2111',R:'\u211C',Z:'\u2128'};var SEQ_REPEAT=2;var SEQ_SET_COLORS=3;var SEQ_SET_ATTRS=4;var SEQ_SET_FG=5;var SEQ_SET_BG=6;var SELECTION_BG='#b2d7fe';var SELECTION_FG='#333';var 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']];var colorTable256=Array(16).fill('rgba(0, 0, 0, 0)');for(var red=0;6>red;red++)for(var green=0;6>green;green++)for(var blue=0;6>blue;blue++){var redValue=40*red+(red?55:0);var greenValue=40*green+(green?55:0);var blueValue=40*blue+(blue?55:0);colorTable256.push('rgb('+redValue+', '+greenValue+', '+blueValue+')')}for(var gray=0;24>gray;gray++){var value=10*gray+8;colorTable256.push('rgb('+value+', '+value+', '+value+')')}window.TermScreen=function(){function a(){var b=this;_classCallCheck(this,a),this.canvas=mk('canvas'),this.ctx=this.canvas.getContext('2d'),'AudioContext'in window||'webkitAudioContext'in window?this.audioCtx=new(window.AudioContext||window.webkitAudioContext):console.warn('No AudioContext!'),this.input=new Proxy({},{get:function get(){return function(){return console.warn('TermScreen#input not set!')}}}),this.cursor={x:0,y:0,blinkOn:!1,blinking:!0,visible:!0,hanging:!1,style:'block',blinkInterval:null},this._palette=null,this._window={width:0,height:0,devicePixelRatio:1,fontFamily:'"DejaVu Sans Mono", "Liberation Mono", "Inconsolata", "Menlo", monospace',fontSize:20,gridScaleX:1,gridScaleY:1.2,blinkStyleOn:!0,blinkInterval:null,fitIntoWidth:0,fitIntoHeight:0,debug:!1,graphics:0},this._windowScale=1,this.windowState={width:0,height:0,devicePixelRatio:0,gridScaleX:0,gridScaleY:0,fontFamily:'',fontSize:0,fitIntoWidth:0,fitIntoHeight:0},this.selection={selectable:!0,start:[0,0],end:[0,0]},this.mouseMode={clicks:!1,movement:!1},this._listeners={};var c=this;this.window=new Proxy(this._window,{set:function set(a,b,d){return a[b]=d,c.scheduleSizeUpdate(),c.scheduleDraw('window:'+b+'='+d),!0}}),this.bracketedPaste=!1,this.blinkingCellCount=0,this.screen=[],this.screenFG=[],this.screenBG=[],this.screenAttrs=[],this.drawnScreen=[],this.drawnScreenFG=[],this.drawnScreenBG=[],this.drawnScreenAttrs=[],this.drawnCursor=[-1,-1,''],this.resetBlink(),this.resetCursorBlink();var
|
||
|
'use strict';window.TermUpl=function(a,b,c){function d(){f('Ready...'),Modal.show('#fu_modal',e),$('#fu_form').toggleClass('busy',!1),b.blockKeys(!0)}function e(){console.log('Upload modal closed.'),clearTimeout(m),l=0,b.blockKeys(!1)}function f(a){qs('#fu_prog').textContent=a}function g(){var a=qs('#fu_text').value;return a.length?void(k=a.split('\n'),l=0,q=0,n=qs('#fu_delay').value,0>n&&(n=0,qs('#fu_delay').value=n),o={CR:'\r',LF:'\n',CRLF:'\r\n'}[qs('#fu_crlf').value],$('#fu_form').toggleClass('busy',!0),f('Starting...'),h()):void j()}function h(){if($('#fu_modal').hasClass('visible')){if(!a.canSend())return void(m=setTimeout(h,1));0===q&&(p='',0===l&&c.bracketedPaste&&(p='\x1B[200~'),p+=k[l++]+o,l===k.length&&c.bracketedPaste&&(p+='\x1B[201~'));var d;if(p.length-q<=r?(d=p.substr(q,r),q=0):(d=p.substr(q,r),q+=r),console.log(d),!b.sendString(d))return void f('FAILED!');var e=Math.round(1e3*(l/k.length))/10;f(l+' / '+k.length+' ('+e+'%)'),k.length>l||0<q?m=setTimeout(h,n):i()}}function i(){a.canSend()?(f('Done.'),j()):(f('Waiting for Tx buffer...'),setTimeout(i,100))}function j(){Modal.hide('#fu_modal')}var k,l,m,n,o,p,q;var r=128;return{init:function init(){qs('#fu_file').addEventListener('change',function(a){var b=new FileReader;var c=a.target.files[0];return console.log('Selected file type: '+c.type),c.type.match(/text\/.*|application\/(json|csv|.*xml.*|.*script.*)/)||confirm('This does not look like a text file: '+c.type+'\nReally load?')?void(b.onload=function(a){var b=a.target.result.replace(/[\r\n]+/,'\n');qs('#fu_text').value=b},console.log('Loading file...'),b.readAsText(c)):void(qs('#fu_file').value='')},!1),qs('#term-fu-open').addEventListener('click',function(){return d(),!1}),qs('#term-fu-start').addEventListener('click',function(){return g(),!1}),qs('#term-fu-close').addEventListener('click',function(){return j(),!1})}}};
|
||
|
'use strict';var _slicedToArray=function(){function a(a,b){var c=[];var d=!0;var e=!1;var f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h['return']&&h['return']()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError('Invalid attempt to destructure non-iterable instance')}}();window.attachDebugScreen=function(a){var b=mk('canvas');var c=b.getContext('2d');b.style.position='absolute',b.style.top='6px',b.style.left='6px',b.style.pointerEvents='none';var d=function(){b.parentNode||a.canvas.parentNode.appendChild(b)};var e=function(){b.parentNode&&b.parentNode.removeChild(b)};var f=function(){var c=a.window,d=c.width,e=c.height,f=c.devicePixelRatio;var g=a.getCellSize();b.width=d*g.width*f,b.height=e*g.height*f,b.style.width=d*g.width+'px',b.style.height=e*g.height+'px'};var g,h,i;var j=new Map;var k;a._debug={drawStart:function drawStart(a){i=a,g=Date.now()},drawEnd:function drawEnd(){h=Date.now(),console.log('Draw: '+i+' ('+(h-g)+' ms) with fancy graphics: '+a.window.graphics),k()},setCell:function setCell(a,b){j.set(a,[b,Date.now()])}};var l=!1;var m=function(){l&&requestAnimationFrame(m);var b=a.window,d=b.devicePixelRatio,f=b.width,g=b.height;var h=a.getCellSize(),i=h.width,k=h.height;var n=Date.now();c.setTransform(d,0,0,d,0,0),c.clearRect(0,0,f*i,g*k);var o=0;for(var w=0;w<f*g;w++)if(j.has(w)&&0!==j.get(w)[0]){var p=j.get(w),q=_slicedToArray(p,2),r=q[0],s=q[1];var t=(n-s)/1e3;if(!(1<t)){o++,c.globalAlpha=0.5*Math.max(0,1-t);var u=w%f;var v=Math.floor(w/f);1&r&&(c.fillStyle='#f0f'),2&r&&(c.fillStyle='#0f0'),c.fillRect(u*i,v*k,i,k),4&r&&(c.lineWidth=2,c.strokeStyle='#f00',c.strokeRect(u*i,v*k,i,k))}}0==o&&(l=!1,e())};k=function(){l||(d(),f(),l=!0,m())}};
|
||
|
'use strict';var _slicedToArray=function(){function a(a,b){var c=[];var d=!0;var e=!1;var f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h['return']&&h['return']()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError('Invalid attempt to destructure non-iterable instance')}}();window.initSoftKeyboard=function(a,b){var c=qs('#softkb-input');if(c){var d=!1;var e=function(){if(d){var b=a.gridToScreen(a.cursor.x,a.cursor.y,!0),e=_slicedToArray(b,2),f=e[0],g=e[1];c.style.transform='translate('+f+'px, '+g+'px)'}};c.addEventListener('focus',function(){d=!0,e()}),c.addEventListener('blur',function(){return d=!1}),a.on('cursor-moved',e);var f=function(a){d=a,e(),a?c.focus():c.blur()};qs('#term-kb-open').addEventListener('click',function(){return f(!0),!1});var g='';var h=!1;var i=function(a){var c=!1;a.length>g.length?a.startsWith(g)?b.sendString(a.substr(g.length)):c=!0:a.length<g.length?g.startsWith(a)?b.sendString('\b'.repeat(g.length-a.length)):c=!0:a!==g&&(c=!0),c&&b.sendString('\b'.repeat(g.length)+a),g=a};c.addEventListener('keydown',function(a){'Unidentified'===a.key||(c.value='','Backspace'===a.key?(a.preventDefault(),b.sendString('\b')):'Enter'===a.key&&(a.preventDefault(),b.sendString('\r')))}),c.addEventListener('keypress',function(a){a.stopPropagation()}),c.addEventListener('input',function(a){a.stopPropagation(),a.isComposing?i(a.data):'insertCompositionText'===a.inputType?b.sendString(a.data):'deleteContentBackward'===a.inputType?(g='',i('')):'insertText'===a.inputType&&b.sendString(a.data)}),c.addEventListener('compositionstart',function(){g='',h=!0}),c.addEventListener('compositionend',function(){g='',h=!1,c.value=''}),a.on('open-soft-keyboard',function(){return c.focus()})}};
|
||
|
'use strict';window.termInit=function(a){var b=a.labels,c=a.theme,d=a.allFn;var f=new TermScreen;var e=Conn(f);var g=Input(e);var h=TermUpl(e,g,f);f.input=g,e.init(),g.init({allFn:d}),h.init(),Notify.init(),window.onerror=function(a,b,c,d){return Notify.show('<b>JS ERROR!</b><br>'+a+'<br>at '+b+':'+c+':'+d,1e4,!0),!1},qs('#screen').appendChild(f.canvas),f.load(b,c),window.initSoftKeyboard(f,g),window.attachDebugScreen&&window.attachDebugScreen(f);var i=!1;var j=!1;var k=function(){i?(f.window.fitIntoWidth=window.screen.width,f.window.fitIntoHeight=window.screen.height):(f.window.fitIntoWidth=j?window.innerWidth-20:0,f.window.fitIntoHeight=j?window.innerHeight:0)};k(),window.addEventListener('resize',k);var l=function(){j=!j;var a=qs('#resize-button-icon');j?(a.classList.remove('icn-resize-small'),a.classList.add('icn-resize-full')):(a.classList.remove('icn-resize-full'),a.classList.add('icn-resize-small')),k()};if(qs('#term-fit-screen').addEventListener('click',function(){return l(),!1}),Element.prototype.requestFullscreen||Element.prototype.webkitRequestFullscreen){setInterval(function checkForFullscreen(){i&&(innerWidth!==window.screen.width||innerHeight!==window.screen.height)&&(i=!1,k())},500);var m=mk('a');m.href='#',m.addEventListener('click',function(a){a.preventDefault(),i=!0,k(),f.updateSize(),f.canvas.requestFullscreen?f.canvas.requestFullscreen():f.canvas.webkitRequestFullscreen()});var n=mk('i');n.classList.add('icn-resize-full'),m.appendChild(n);var o=mk('span');o.textContent='Fullscreen',m.appendChild(o),qs('#term-nav').insertBefore(m,qs('#term-nav').firstChild)}window.termScreen=f,window.conn=e,window.input=g,window.termUpl=h};
|
||
|
|
||
|
//# sourceMappingURL=app.d7551c3.js.map
|