forked from adphi/occweb
42 lines
115 KiB
JavaScript
42 lines
115 KiB
JavaScript
/**@license
|
|
* __ _____ ________ __
|
|
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
|
|
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
|
|
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
|
|
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
|
|
* \/ /____/ version 2.0.2
|
|
*
|
|
* This file is part of jQuery Terminal. http://terminal.jcubic.pl
|
|
*
|
|
* Copyright (c) 2010-2018 Jakub Jankiewicz <http://jcubic.pl/me>
|
|
* Released under the MIT license
|
|
*
|
|
* Contains:
|
|
*
|
|
* Storage plugin Distributed under the MIT License
|
|
* modified to work from Data URIs that block storage and cookies in Chrome
|
|
* Copyright (c) 2010 Dave Schindler
|
|
*
|
|
* jQuery Timers licenced with the WTFPL
|
|
* <http://jquery.offput.ca/timers/>
|
|
*
|
|
* Cross-Browser Split 1.1.1
|
|
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
|
|
* Available under the MIT License
|
|
*
|
|
* jQuery Caret
|
|
* Copyright (c) 2009, Gideon Sireling
|
|
* 3 clause BSD License
|
|
*
|
|
* sprintf.js
|
|
* Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro>
|
|
* licensed under 3 clause BSD license
|
|
*
|
|
* emoji regex v7.0.1 by Mathias Bynens
|
|
* MIT license
|
|
*
|
|
* Date: Sat, 22 Dec 2018 15:04:13 +0000
|
|
*/
|
|
(function(e){var m=function(){if(!m.cache.hasOwnProperty(arguments[0])){m.cache[arguments[0]]=m.parse(arguments[0])}return m.format.call(null,m.cache[arguments[0]],arguments)};m.format=function(e,t){var n=1,r=e.length,i="",o,a=[],u,s,l,f,c,p;for(u=0;u<r;u++){i=D(e[u]);if(i==="string"){a.push(e[u])}else if(i==="array"){l=e[u];if(l[2]){o=t[n];for(s=0;s<l[2].length;s++){if(!o.hasOwnProperty(l[2][s])){throw m('[sprintf] property "%s" does not exist',l[2][s])}o=o[l[2][s]]}}else if(l[1]){o=t[l[1]]}else{o=t[n++]}if(/[^s]/.test(l[8])&&D(o)!=="number"){throw m("[sprintf] expecting number but found %s",D(o))}switch(l[8]){case"b":o=o.toString(2);break;case"c":o=String.fromCharCode(o);break;case"d":o=parseInt(o,10);break;case"e":o=l[7]?o.toExponential(l[7]):o.toExponential();break;case"f":o=l[7]?parseFloat(o).toFixed(l[7]):parseFloat(o);break;case"o":o=o.toString(8);break;case"s":o=(o=String(o))&&l[7]?o.slice(0,l[7]):o;break;case"u":o=o>>>0;break;case"x":o=o.toString(16);break;case"X":o=o.toString(16).toUpperCase();break}o=/[def]/.test(l[8])&&l[3]&&o>=0?" +"+o:o;c=l[4]?l[4]==="0"?"0":l[4].charAt(1):" ";p=l[6]-String(o).length;f=l[6]?d(c,p):"";a.push(l[5]?o+f:f+o)}}return a.join("")};m.cache={};m.parse=function(e){var t=e,n=[],r=[],i=0;while(t){if((n=/^[^\x25]+/.exec(t))!==null){r.push(n[0])}else if((n=/^\x25{2}/.exec(t))!==null){r.push("%")}else if((n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))!==null){if(n[2]){i|=1;var o=[],a=n[2],u=[];if((u=/^([a-z_][a-z_\d]*)/i.exec(a))!==null){o.push(u[1]);while((a=a.slice(u[0].length))!==""){if((u=/^\.([a-z_][a-z_\d]*)/i.exec(a))!==null){o.push(u[1])}else if((u=/^\[(\d+)\]/.exec(a))!==null){o.push(u[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}n[2]=o}else{i|=2}if(i===3){throw"[sprintf] mixing positional and named placeholders is not (yet) supported"}r.push(n)}else{throw"[sprintf] huh?"}t=t.slice(n[0].length)}return r};var t=function(e,t,n){n=t.slice(0);n.splice(0,0,e);return m.apply(null,n)};function D(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function d(e,t){for(var n=[];t>0;n[--t]=e){}return n.join("")}e.sprintf=m;e.vsprintf=t})(typeof global!=="undefined"?global:window);(function(r,i){var e=typeof window!=="undefined"?window:global;if(typeof define==="function"&&define.amd){define(["jquery","wcwidth"],r)}else if(typeof module==="object"&&module.exports){module.exports=function(e,t,n){if(t===i){if(window!==i){t=require("jquery")}else{t=require("jquery")(e)}}if(n===i){n=require("wcwidth")}r(t,n);return t}}else{r(e.jQuery,e.wcwidth)}})(function($,wcwidth,undefined){"use strict";function debug(e){if(false){console.log(e)}}function DelayQueue(){var t=$.Callbacks();var n=false;this.resolve=function(){t.fire();n=true};this.add=function(e){if(n){e()}else{t.add(e)}}}$.omap=function(n,r){var i={};$.each(n,function(e,t){i[e]=r.call(n,e,t)});return i};$.fn.text_length=function(){return this.map(function(){return $(this).text().length}).get().reduce(function(e,t){return e+t},0)};var Clone={clone_object:function(e){var t={};if(typeof e==="object"){if($.isArray(e)){return this.clone_array(e)}else if(e===null){return e}else{for(var n in e){if($.isArray(e[n])){t[n]=this.clone_array(e[n])}else if(typeof e[n]==="object"){t[n]=this.clone_object(e[n])}else{t[n]=e[n]}}}}return t},clone_array:function(e){if(!is_function(Array.prototype.map)){throw new Error("Your browser don't support ES5 array map "+"use es5-shim")}return e.slice(0).map(function(e){if(typeof e==="object"){return this.clone_object(e)}else{return e}}.bind(this))}};var clone=function(e){return Clone.clone_object(e)};var localStorage;(function(){var e=function(){try{var e="test",t=window.localStorage;t.setItem(e,"1");t.removeItem(e);return true}catch(e){return false}};var t=function(){try{document.cookie.split(";");return true}catch(e){return false}};var n=e();function r(e,t){var n;if(typeof e==="string"&&typeof t==="string"){localStorage[e]=t;return true}else if(typeof e==="object"&&typeof t==="undefined"){for(n in e){if(e.hasOwnProperty(n)){localStorage[n]=e[n]}}return true}return false}function i(e,t){var n,r,i;n=new Date;n.setTime(n.getTime()+31536e6);r="; expires="+n.toGMTString();if(typeof e==="string"&&typeof t==="string"){document.cookie=e+"="+t+r+"; path=/";return true}else if(typeof e==="object"&&typeof t==="undefined"){for(i in e){if(e.hasOwnProperty(i)){document.cookie=i+"="+e[i]+r+"; path=/"}}return true}return false}function o(e){return localStorage[e]}function a(e){var t,n,r,i;t=e+"=";n=document.cookie.split(";");for(r=0;r<n.length;r++){i=n[r];while(i.charAt(0)===" "){i=i.slice(1,i.length)}if(i.indexOf(t)===0){return i.slice(t.length,i.length)}}return null}function u(e){return delete localStorage[e]}function s(e){return i(e,"",-1)}if(!t()&&!n){localStorage={};$.extend({Storage:{set:r,get:o,remove:u}})}else{if(n){localStorage=window.localStorage}$.extend({Storage:{set:n?r:i,get:n?o:a,remove:n?u:s}})}})();var jQuery=$;(function(e){jQuery.fn.extend({everyTime:function(e,t,n,r,i){return this.each(function(){jQuery.timer.add(this,e,t,n,r,i)})},oneTime:function(e,t,n){return this.each(function(){jQuery.timer.add(this,e,t,n,1)})},stopTime:function(e,t){return this.each(function(){jQuery.timer.remove(this,e,t)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1e3,das:1e4,hs:1e5,ks:1e6},timeParse:function(e){if(e===undefined||e===null){return null}var t=this.regex.exec(jQuery.trim(e.toString()));if(t[2]){var n=parseInt(t[1],10);var r=this.powers[t[2]]||1;return n*r}else{return e}},add:function(e,t,n,r,i,o){var a=0;if(jQuery.isFunction(n)){if(!i){i=r}r=n;n=t}t=jQuery.timer.timeParse(t);if(typeof t!=="number"||isNaN(t)||t<=0){return}if(i&&i.constructor!==Number){o=!!i;i=0}i=i||0;o=o||false;if(!e.$timers){e.$timers={}}if(!e.$timers[n]){e.$timers[n]={}}r.$timerID=r.$timerID||this.guid++;var u=function(){if(o&&u.inProgress){return}u.inProgress=true;if(++a>i&&i!==0||r.call(e,a)===false){jQuery.timer.remove(e,n,r)}u.inProgress=false};u.$timerID=r.$timerID;if(!e.$timers[n][r.$timerID]){e.$timers[n][r.$timerID]=window.setInterval(u,t)}if(!this.global[n]){this.global[n]=[]}this.global[n].push(e)},remove:function(e,t,n){var r=e.$timers,i;if(r){if(!t){for(var o in r){if(r.hasOwnProperty(o)){this.remove(e,o,n)}}}else if(r[t]){if(n){if(n.$timerID){window.clearInterval(r[t][n.$timerID]);delete r[t][n.$timerID]}}else{for(var a in r[t]){if(r[t].hasOwnProperty(a)){window.clearInterval(r[t][a]);delete r[t][a]}}}for(i in r[t]){if(r[t].hasOwnProperty(i)){break}}if(!i){i=null;delete r[t]}}for(i in r){if(r.hasOwnProperty(i)){break}}if(!i){e.$timers=null}}}}});if(/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())){e(window).one("unload",function(){var e=jQuery.timer.global;for(var t in e){if(e.hasOwnProperty(t)){var n=e[t],r=n.length;while(--r){jQuery.timer.remove(n[r],t)}}}})}})(jQuery);(function(f){if(!String.prototype.split.toString().match(/\[native/)){return}var c=String.prototype.split,p=/()??/.exec("")[1]===f,n;n=function(e,t,n){if(Object.prototype.toString.call(t)!=="[object RegExp]"){return c.call(e,t,n)}var r=[],i=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),o=0,a,u,s,l;t=new RegExp(t.source,i+"g");e+="";if(!p){a=new RegExp("^"+t.source+"$(?!\\s)",i)}n=n===f?-1>>>0:n>>>0;while(u=t.exec(e)){s=u.index+u[0].length;if(s>o){r.push(e.slice(o,u.index));if(!p&&u.length>1){u[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++){if(arguments[e]===f){u[e]=f}}})}if(u.length>1&&u.index<e.length){Array.prototype.push.apply(r,u.slice(1))}l=u[0].length;o=s;if(r.length>=n){break}}if(t.lastIndex===u.index){t.lastIndex++}}if(o===e.length){if(l||!t.test("")){r.push("")}}else{r.push(e.slice(o))}return r.length>n?r.slice(0,n):r};String.prototype.split=function(e,t){return n(this,e,t)};return n})();$.fn.caret=function(e){var t=this[0];var n=t.contentEditable==="true";if(arguments.length===0){if(window.getSelection){if(n){t.focus();var r=window.getSelection().getRangeAt(0),i=r.cloneRange();i.selectNodeContents(t);i.setEnd(r.endContainer,r.endOffset);return i.toString().length}return t.selectionStart}if(document.selection){t.focus();if(n){var r=document.selection.createRange(),i=document.body.createTextRange();i.moveToElementText(t);i.setEndPoint("EndToEnd",r);return i.text.length}var e=0,o=t.createTextRange(),i=document.selection.createRange().duplicate(),a=i.getBookmark();o.moveToBookmark(a);while(o.moveStart("character",-1)!==0)e++;return e}return 0}if(e===-1)e=this[n?"text":"val"]().length;if(window.getSelection){if(n){t.focus();window.getSelection().collapse(t.firstChild,e)}else t.setSelectionRange(e,e)}else if(document.body.createTextRange){var o=document.body.createTextRange();o.moveToElementText(t);o.moveStart("character",e);o.collapse(true);o.select()}if(!n&&!this.is(":focus")){t.focus()}return e};$.fn.resizer=function(u){var s=arguments.length===0;var l=arguments[0]==="unbind";if(!s&&!l&&!is_function(u)){throw new Error("Invalid argument, it need to a function or string "+'"unbind" or no arguments.')}if(l){u=is_function(arguments[1])?arguments[1]:null}return this.each(function(){var e=$(this);var t;var n;function r(){n.fire()}if(s||l){n=e.data("callbacks");if(s){n&&n.fire()}else{if(u&&n){n.remove(u);if(!n.has()){n=null}}else{n=null}if(!n){e.removeData("callbacks");if(window.ResizeObserver){var i=e.data("observer");if(i){i.unobserve(this);e.removeData("observer")}}else{t=e.find("> iframe");if(t.length){$(t[0].contentWindow).off("resize").remove();t.remove()}else if(e.is("body")){$(window).off("resize.resizer")}}}}}else if(e.data("callbacks")){$(this).data("callbacks").add(u)}else{n=$.Callbacks();n.add(u);e.data("callbacks",n);var o;var a=true;if(window.ResizeObserver){o=new ResizeObserver(function(){if(!a){r()}a=false});o.observe(this);e.data("observer",o)}else if(e.is("body")){$(window).on("resize.resizer",r)}else{t=$("<iframe/>").addClass("resizer").appendTo(this)[0];$(t.contentWindow).on("resize",r)}}})};$.fn.isFullyInViewport=function(e){var t=this[0].getBoundingClientRect();var n=e[0].getBoundingClientRect();var r=t.top-n.top;var i=t.bottom-n.top;var o=e.height();return i>0&&r<=o};function a11y_hide(e){e.attr({role:"presentation","aria-hidden":"true"})}var excepctions=[];function alert_exception(e,t){var n=(e?e+": ":"")+exception_message(t);if(excepctions.indexOf(n)===-1){excepctions.push(n);setTimeout(function(){throw t},0)}}function scrollbar_event(e,t){var n=t.offset().left;return t.outerWidth()<=e.clientX-n}function exception_message(e){if(typeof e==="string"){return e}else if(typeof e.fileName==="string"){return e.fileName+": "+e.message}else{return e.message}}function Cycle(){var r=[].slice.call(arguments);var i=0;$.extend(this,{get:function(){return r},index:function(){return i},rotate:function(e,t){if(t===undefined){t=i}else if(t===i){return}if(!e){var n=r.filter(function(e){return typeof e!=="undefined"});if(!n.length){return}}if(!r.length){return}if(r.length===1){return r[0]}else{if(i===r.length-1){i=0}else{++i}if(typeof r[i]!=="undefined"){return r[i]}else{return this.rotate(true,t)}}},length:function(){return r.length},remove:function(e){delete r[e]},set:function(e){for(var t=r.length;t--;){if(r[t]===e){i=t;return}}this.append(e);i=r.length-1},front:function(){if(r.length){var e=i;var t=false;while(!r[e]){e++;if(e>r.length){if(t){break}e=0;t=true}}return r[e]}},map:function(n){return r.map(function(e,t){if(typeof e!=="undefined"){return n(e,t)}return null}).filter(Boolean)},forEach:function(n){return r.forEach(function(e,t){if(typeof e!=="undefined"){n(e,t)}})},append:function(e){r.push(e)}})}function Stack(e){var t=e instanceof Array?e:e?[e]:[];$.extend(this,{data:function(){return t},map:function(e){return $.map(t,e)},size:function(){return t.length},pop:function(){if(t.length===0){return null}else{var e=t[t.length-1];t=t.slice(0,t.length-1);return e}},push:function(e){t=t.concat([e]);return e},top:function(){return t.length>0?t[t.length-1]:null},clone:function(){return new Stack(t.slice(0))}})}function History(e,t,n){var r=true;var i="";if(typeof e==="string"&&e!==""){i=e+"_"}i+="commands";var o;if(n){o=[]}else{o=$.Storage.get(i);o=o?JSON.parse(o):[]}var a=o.length-1;$.extend(this,{append:function(e){if(r){if(o[o.length-1]!==e){o.push(e);if(t&&o.length>t){o=o.slice(-t)}a=o.length-1;if(!n){$.Storage.set(i,JSON.stringify(o))}}}},set:function(e){if(e instanceof Array){o=e;if(!n){$.Storage.set(i,JSON.stringify(o))}}},data:function(){return o},reset:function(){a=o.length-1},last:function(){return o[o.length-1]},end:function(){return a===o.length-1},position:function(){return a},current:function(){return o[a]},next:function(){var e=a;if(a<o.length-1){++a}if(e!==a){return o[a]}},previous:function(){var e=a;if(a>0){--a}if(e!==a){return o[a]}},clear:function(){o=[];this.purge()},enabled:function(){return r},enable:function(){r=true},purge:function(){if(!n){$.Storage.remove(i)}},disable:function(){r=false},toggle:function(e){if(typeof e==="undefined"){r=!r}else{r=e}}})}var cmd_index=0;$.cmd={defaults:{mask:false,caseSensitiveSearch:true,historySize:60,prompt:"> ",enabled:true,history:true,onPositionChange:$.noop,onCommandChange:$.noop,clickTimeout:200,holdTimeout:400,holdRepeatTimeout:200,repeatTimeoutKeys:["HOLD+BACKSPACE"],tabindex:1,tabs:4}};$.fn.cmd=function(e){var F=$.extend({},$.cmd.defaults,e);var x=this;var t=x.data("cmd");if(t){return t}var u=cmd_index++;x.addClass("cmd");x.append('<span class="prompt"></span>');x.append('<div class="cursor-line">'+"<span></span>"+'<span class="cursor"><span><span> </span></span></span>'+"<span></span>"+"</div>");a11y_hide(x.find(".cursor-line"));var k=$("<textarea>").attr({autocapitalize:"off",spellcheck:"false",tabindex:F.tabindex}).addClass("clipboard").appendTo(x);if(!is_mobile){k.val(" ")}if(F.width){x.width(F.width)}var A;var p;var a;var T;var S;var c=x.find(".prompt");var o=false;var s="";var l=null;var n;var R="";var r;var f="";var B=0;var i;var m;var j=0;var D,d;var O=x.find(".cursor");var h;var v;var g=0;function _(e){var t=$(e.target);if(t.is("span")){t=t.closest("[data-text]");return t.index()+t.parent("span").prevAll().find("[data-text]").length+t.closest('[role="presentation"]').prevUntil(".prompt").find("[data-text]").length}else if(t.is('div[role="presentation"]')){var n=!t.nextUntil("textarea").length;return t.find("span[data-text]").length+t.prevUntil(".prompt").find("span[data-text]").length-(n?0:1)}}var y={SPACEBAR:" ",UP:"ARROWUP",DOWN:"ARROWDOWN",LEFT:"ARROWLEFT",RIGHT:"ARROWRIGHT",DEL:"DELETE",MULTIPLY:"*",DIVIDE:"/",SUBTRACT:"-",ADD:"+"};function b(e){if(e.key){var t=e.key.toUpperCase();if(y[t]){t=y[t]}if(t==="CONTROL"){return"CTRL"}else{var n=[];if(e.ctrlKey){n.push("CTRL")}if(e.metaKey&&t!=="META"){n.push("META")}if(e.shiftKey&&t!=="SHIFT"){n.push("SHIFT")}if(e.altKey&&t!=="ALT"){n.push("ALT")}if(n.length&&t===" "){t="SPACEBAR"}if(e.key){n.push(t)}return n.join("+")}}}var w;var C={"ALT+D":E(true),"HOLD+DELETE":E(false),"HOLD+SHIFT+DELETE":E(false),ENTER:function(){if(d&&R&&!F.mask&&(is_function(F.historyFilter)&&F.historyFilter(R)||F.historyFilter instanceof RegExp&&R.match(F.historyFilter)||!F.historyFilter)){d.append(R)}var e=R;d.reset();xe="";ye=true;x.set("");if(F.commands){F.commands.call(x,e)}if(is_function(i)){fe()}k.val("");return false},"SHIFT+ENTER":function(){x.insert("\n");return true},BACKSPACE:H,"SHIFT+BACKSPACE":H,TAB:function(){x.insert("\t")},"CTRL+D":function(){x["delete"](1);return false},DELETE:function(){x["delete"](1);return true},ARROWUP:I,"CTRL+P":I,ARROWDOWN:N,"CTRL+N":N,ARROWLEFT:M,"HOLD+ARROWLEFT":M,"CTRL+B":M,"CTRL+ARROWLEFT":function(){var e=B-1;var t=0;if(R[e]===" "){--e}for(var n=e;n>0;--n){if(R[n]===" "&&R[n+1]!==" "){t=n+1;break}else if(R[n]==="\n"&&R[n+1]!=="\n"){t=n;break}}x.position(t)},"CTRL+R":function(){if(o){Z(true)}else{n=i;V();r=R;x.set("");se();o=true}return false},"CTRL+G":function(){if(o){i=n;fe();x.set(r);se();o=false;s="";return false}},ARROWRIGHT:U,"HOLD+ARROWRIGHT":U,"CTRL+F":U,"CTRL+ARROWRIGHT":function(){if(R[B]===" "){++B}var e=/\S[\n\s]{2,}|[\n\s]+\S?/;var t=R.slice(B).match(e);if(!t||t[0].match(/^\s+$/)){x.position(text(R).length)}else if(t[0][0]!==" "){B+=t.index+1}else{B+=t.index+t[0].length-1;if(t[0][t[0].length-1]!==" "){--B}}se()},F12:z,END:K,"CTRL+E":K,HOME:q,"CTRL+A":q,"SHIFT+INSERT":P,"CTRL+SHIFT+T":z,"CTRL+W":L(true),"HOLD+BACKSPACE":L(false),"HOLD+SHIFT+BACKSPACE":L(false),"CTRL+H":function(){if(R!==""&&B>0){x["delete"](-1)}return false},"CTRL+X":z,"CTRL+C":z,"CTRL+T":z,"CTRL+Y":function(){if(f!==""){x.insert(f)}},"CTRL+V":P,"META+V":P,"CTRL+K":function(){var e=text(R).length;if(e>B){f=x["delete"](e-B);text_to_clipboard(x,f)}return false},"CTRL+U":function(){if(R!==""&&B!==0){f=x["delete"](-B);text_to_clipboard(x,f)}return false},"CTRL+TAB":function(){return false},"META+`":z,"META+R":z,"META+L":z};function E(i){return function e(){var t=/ *[^ ]+ *(?= )|[^ ]+$/;var n=R.slice(B);var r=n.match(t);if(r){f=r[0];if(i){text_to_clipboard(x,f)}}x.set(R.slice(0,B)+R.slice(B).replace(t,""),true);return false}}function L(n){return function e(){if(R!==""&&B!==0){var t=R.slice(0,B).match(/([^ ]+ *$)/);if(t[0].length){f=x["delete"](-t[0].length);if(n){text_to_clipboard(x,f)}}}return false}}function z(){return true}function P(){k.val("");g=0;if(x.isenabled()&&!k.is(":focus")){k.trigger("focus",[true])}k.one("input",ce);return true}function I(){if(De){r=R;x.set(d.current())}else{x.set(d.previous())}De=false;return false}function N(){x.set(d.end()?r:d.next());return false}function H(){if(o){s=s.slice(0,-1);V()}else if(R!==""&&B>0){x["delete"](-1)}x.oneTime(1,function(){ye=true})}function M(){if(B>0){x.position(-1,true);se()}}function U(){if(B<text(R).length){x.position(1,true)}return false}function q(){x.position(0)}function K(){x.position(text(R).length)}function W(){var e=k.is(":focus");if(m){if(!e){}x.oneTime(10,function(){if(!k.is(":focus")&&m){k.trigger("focus",[true])}})}else if(e&&(is_mobile||!m)){k.trigger("blur",[true])}}function J(){if(animation_supported){var e=window.getComputedStyle(O[0]);var t=e.getPropertyValue("--animation");t=t.replace(/^\s*|\s*$/g,"");var n=x.attr("class");if(n.match(/-animation/)){n=n.replace(/[a-z]+-animation/g,"")}if(t&&!t.match(/blink/)){var r=t.replace(/terminal-/,"")+"-animation";if(!n.match(r)){n+=" "+r}}if(n!==x.attr("class")){x.attr("class",n)}}}function Q(e){if(!x.isenabled()){return}x.oneTime(10,function(){if(!is_mobile&&k.val()!==R&&!e){k.val(" "+R)}if(m){x.oneTime(10,function(){try{if(!is_mobile&&k.caret()!==B+1){k.caret(B+1)}}catch(e){}})}})}if(animation_supported&&!is_android){h=function(e){if(e){O.addClass("blink")}else{O.removeClass("blink")}};v=function(){var e=O.clone();e.insertBefore(O);O.remove();O=e}}else{var Y=false;h=function(e){if(e&&!Y){Y=true;O.addClass("inverted blink");x.everyTime(500,"blink",G)}else if(Y&&!e){Y=false;x.stopTime("blink",G);O.removeClass("inverted blink")}};v=function(){h(false);h(true)}}function G(){O.toggleClass("inverted")}function V(){i="(reverse-i-search)`"+s+"': ";fe()}function X(){i=n;o=false;l=null;s=""}function Z(e){var t=d.data();var n,r;var i=t.length;if(e&&l>0){i-=l}if(s.length>0){for(var o=s.length;o>0;o--){r=$.terminal.escape_regex(s.slice(0,o));if(F.caseSensitiveSearch){n=new RegExp(r)}else{n=new RegExp(r,"i")}for(var a=i;a--;){if(n.test(t[a])){l=t.length-a;x.position(t[a].indexOf(r));x.set(t[a],true);se();if(s.length!==o){s=s.slice(0,o);V()}return}}}}s=""}function ee(){var e=x.find(".prompt");var t=e.html();e.html("<span> </span>");var n=e.find("span")[0].getBoundingClientRect().width;e.html(t);return n}function te(e){var t=x.width();return Math.floor(t/e)}function ne(e){function t(e){return $.terminal.split_equal(e,A)}function n(e){return e.filter(function(e){return!$.terminal.strip(e).match(/^ $/)})}var r=c.find(".line");var i;if(r.length){i=r.nextUntil(".line").text()}else{i=c.text()}i=$.terminal.escape_brackets(i);var o=new RegExp("^"+$.terminal.escape_regex(i));var a;if(e.match(/\n/)){var u=e.split("\n");var s=A-S-1;for(var l=0;l<u.length-1;++l){u[l]+=" "}if(strlen(u[0])>s){a=t(i+u[0]);a[0]=a[0].replace(o,"");a=n(a)}else{a=[u[0]]}for(l=1;l<u.length;++l){if(strlen(u[l])>A){var f=t(u[l]);if(l<u.length-1){f=n(f)}a=a.concat(f)}else{a.push(u[l])}}}else{a=t(i+e,A);a[0]=a[0].replace(o,"")}if(a.length>1&&a[a.length-1].length===A){a.push("")}return a}function re(t,e){try{t=$.terminal.escape_formatting(t);var n=$.extend({},F,{unixFormattingEscapeBrackets:true,position:B});var r=$.terminal.apply_formatters(t,n);var i=r[0];var o=$.terminal.length(i);if(!e){j=r[1];if(j>o){j=o}}i=$.terminal.normalize(i);return i}catch(e){alert_exception("[Formatting]",e.stack);return t}}function ie(e,t){var n=$.terminal.encode(oe(e),{tabs:F.tabs,before:t});e=$.terminal.format(n,{char_width:F.char_width});var r=/(<span[^>]+data-text[^>]+>)(.*?)(<\/span>)/g;return e.replace(r,"$1<span>$2</span>$3")}function oe(e){function t(e){if($.terminal.is_formatting(e)){if(e.match(/\\]$/)){e=e.replace(/\\]/g,"\\\\]")}}else{if(e.match(/\\$/)){e+="\\"}e="[[;;]"+e+"]"}return e}var n=ae(e);if(n===1){return t(e)}var r=[];for(var i=0;i<n;++i){var o=$.terminal.substring(e,i,i+1);r.push(t(o))}return r.join("")}function ae(e){return $.terminal.length(e)}function ue(e,t,n){return $.terminal.substring(e,t,n)}var se=function(){var g=O.prev();var _=O.next();var y=O.parent();function b(e,t){var n=$.extend({prompt:"",last:false},t);var r=n.position;var i=ae(e);var o=n.prompt;if(ch_unit_bug){O.width(p)}var a;if(r===i){g.html(ie(e));O.html("<span><span> </span></span>");_.html("")}else if(r===0){g.html("");a=ue(e,0,1);O.html(ie(a));_.html(ie(ue(e,1),o+a))}else{var u=$.terminal.substring(e,0,r);g.html(ie(u,o));a=ue(e,r,r+1);var s=(o+u).replace(/^.*\t/,"");O.html(ie(a,s));if(r===i-1){_.html("")}else{if(a.match(/\t/)){s=""}else{s+=a}_.html(ie(ue(e,r+1),s))}}var l=n.position===(n.last?i:i-1);O.toggleClass("noselect",l);J();var f=$.terminal.length(O.text());if(f>1){var c=O.find("[data-text]")[0];c.style.setProperty("--length",f)}v()}function w(e,t){return'<div role="presentation" aria-hidden="true">'+ie(e,t||"")+"</div>"}function C(e){var n=y;$.each(e,function(e,t){n=$(w(t)).insertAfter(n)})}function E(e){$.each(e,function(e,t){y.before(w(t,e===0?T:""))})}return function(){var e;switch(typeof F.mask){case"boolean":e=F.mask?R.replace(/./g,"*"):R;break;case"string":e=R.replace(/./g,F.mask);break}var t=re(e);var n;if(ae(t)===text(e).length){n=B}else{n=j}var r;x.find("div:not(.cursor-line,.clipboard-wrapper)").remove();x.css("visibility","hidden");g.html("");if(strlen(text(t))>A-S-1||t.match(/\n/)){var i=t.match(/\t/g);var o=t;if(i){t=t.replace(/\t/g,"\0\0\0\0")}var a=ne(t);if(i){a=$.map(a,function(e){return e.replace(/\x00\x00\x00\x00/g,"\t")})}var u=ae(a[0]);if(u===0&&a.length===1){}else if(n<u){b(a[0],{position:n,prompt:T});C(a.slice(1))}else if(n===u){y.before(w(a[0],T));b(a[1]||"",{position:0});if(a.length>1){C(a.slice(2))}}else{var s=a.slice(-1)[0];var l=ae(o);var f=l-n;var c=ae(s);var p=0;if(f===-1){f=0}if(f<=c){E(a.slice(0,-1));if(c===f){p=0}else{p=c-f}b(s,{position:p,last:true})}else{var m;var D;p=n;for(r=0;r<a.length;++r){var d=$.terminal.length(a[r]);if(p>d){p-=d}else{break}}D=a[r];m=r;if(p===ae(D)){p=0;D=a[++m];if(D===undefined){var h=$.terminal.defaults.strings.redrawError;throw new Error(h)}}b(D,{position:p});E(a.slice(0,m));C(a.slice(m+1))}}x.find(".cursor-line ~ div:last-of-type").append("<span></span>")}else if(t===""){g.html("");O.html("<span><span> </span></span>");_.html("")}else{b(t,{position:n})}var v=y.prevUntil(".prompt").length;if(is_css_variables_supported){x[0].style.setProperty("--cursor-line",v)}else{k.css("top",v*14+"px")}x.css("visibility","")}}();var le=function(){function u(e,t){var n=$.extend({},F,{position:t});var r=$.terminal.apply_formatters(R,n)[1];if(r===e){return 0}else if(r<e){return 1}else{return-1}}return function(e,t){if(t===0){return 0}e=text(e);var n=e.length;var r=binary_search(0,n,t,u);var i=$.terminal.split_characters(e);if(n>i.length){var o=0;for(var a=0;a<i.length;++a){o+=i[a].length;if(o>=r){return o}}}return r}}();var fe=function(){function e(e){e=$.terminal.apply_formatters(e,{});e=$.terminal.normalize(e);e=crlf(e);a=e;var t=$.terminal.split_equal(e,A);var n={char_width:F.char_width};T=t[t.length-1];var r=$.terminal.encode(t[t.length-1],{tabs:F.tabs});var i=$.terminal.format(r,n);var o=t.slice(0,-1).map(function(e){e=$.terminal.encode(e,{tabs:F.tabs});return'<span class="line">'+$.terminal.format(e,n)+"</span>"}).concat([i]).join("\n");if(c.html()!==o){c.html(o);S=strlen(text(r))}}return function(){switch(typeof i){case"string":e(i);break;case"function":i.call(x,e);break}}}();function ce(){if(g++>0){return}if(x.isenabled()){x.oneTime(100,function(){x.insert(k.val());k.val(R);Q()})}}function pe(){if(is_function(F.onCommandChange)){F.onCommandChange.call(x,R)}}function me(e){return e.replace(/((?!\\).)\\(?:]|])/g,"$1]")}$.extend(x,{option:function(e,t){if(typeof t==="undefined"){return F[e]}else{F[e]=t}return x},name:function(e){if(e!==undefined){D=e;var t=d&&d.enabled()||!d;d=new History(D,F.historySize,F.history==="memory");if(!t){d.disable()}return x}else{return D}},purge:function(){d.clear();return x},history:function(){return d},delete:function(e,t){var n,r;if(e===0){return""}else if(e<0){if(B>0){n=R.slice(0,B).slice(e);r=text(R);r=r.slice(0,B+e)+r.slice(B,r.length);if(!t){x.position(B+e)}}}else if(R!==""){r=text(R);if(B<r.length){n=r.slice(B).slice(0,e);r=r.slice(0,B)+r.slice(B+e,r.length)}}if(n){R=me(r)}se();Q();pe();return n},set:function(e,t,n){if(e!==undefined){R=me(e);if(!t){x.position(text(R).length)}se();Q();if(!n){pe()}}return x},keymap:function(e,t){function n(e,t){var n=C[e];if(is_function(n)){n=n.bind(x)}return function(e){return t.call(x,e,n)}}if(typeof e==="undefined"){return w}else if(typeof e==="string"){if(typeof t==="undefined"){if(w[e]){return w[e]}else if(C[e]){return C[e]}}else{w[e]=n(e,t)}}else{w=$.extend({},w?w:C,$.omap(e||{},n));return x}},insert:function(e,t){var n=text(R);var r=text(e).length;if(B===n.length){e=n+e}else if(B===0){e=e+n}else{e=n.slice(0,B)+e+n.slice(B)}R=me(e);if(!t){x.position(r,true,true)}else{Q()}se();Q();pe();return x},get:function(){return R},commands:function(e){if(e){F.commands=e;return x}else{return e}},destroy:function(){Re.unbind("keypress.cmd",Be);Re.unbind("keydown.cmd",Te);Re.unbind("input.cmd",Oe);x.stopTime("blink",G);x.find(".cursor").next().remove().end().prev().remove().end().remove();x.find(".prompt, .clipboard").remove();x.removeClass("cmd").removeData("cmd").off(".cmd");return x},prompt:function(e){if(e===true){return a}else if(e===undefined){return i}else{if(typeof e==="string"||typeof e==="function"){i=e}else{throw new Error("prompt must be a function or string")}fe();se();return x}},kill_text:function(){return f},position:function(e,t,n){if(typeof e==="number"){var r=B;var i=text(R).length;if(t){B+=e}else if(e<0){B=0}else if(e>i){B=i}else{B=e}if(r!==B&&!n){se();if(is_function(F.onPositionChange)){F.onPositionChange(B,j)}Q(true)}return x}else{return B}},refresh:function(){fe();se();return x},display_position:function(e,t){if(e===undefined){return j}else{var n=re(R,true);var r=ae(n);var i=text(R).length;var o;if(t){o=j+e}else if(e>r){o=r}else{o=e}if(text(n).length===ae(R)){j=o;return x.position(o)}if(r===o){j=o;return x.position(i)}var a=le(R,o);if(a!==-1){j=o;x.position(a)}return x}},visible:function(){var e=x.visible;return function(){e.apply(x,[]);se();fe();return x}}(),show:function(){var e=x.show;return function(){e.apply(x,[]);se();fe();return x}}(),resize:function(e){p=ee();if(e){A=e}else{A=te(p)}se();fe();return x},enable:function(){if(!m){m=true;x.addClass("enabled");try{if(k.is(":not(:focus)")){k.focus()}k.caret(B)}catch(e){}h(true);if(is_function(i)){fe()}J();Q()}W();return x},isenabled:function(){return m},disable:function(e){m=false;x.removeClass("enabled");h(false);if(!e){W()}return x},mask:function(e){if(typeof e==="undefined"){return F.mask}else{F.mask=e;se();return x}}});x.name(F.name||F.prompt||"");if(typeof F.prompt==="string"){i=F.prompt}else{i="> "}fe();if(F.enabled===true){x.enable()}if(!F.history){d.disable()}var De=true;var de=false;var he=false;var ve=false;var ge=false;var _e=false;var ye=true;var be=false;var we=false;var Ce=false;var Ee=false;var Fe;var xe="";function $e(e){return e.key.toUpperCase()==="BACKSPACE"||e.which===8}function ke(e){return e.key&&e.key.length===1&&!e.ctrlKey}function Ae(e){return e.which===35||e.which===36||e.which===37||e.which===38||e.which===39||e.which===40||e.which===13||e.which===27}function Te(e){debug('keydown "'+e.key+'" '+e.fake+" "+e.which);we=(e.key||"").toLowerCase()==="process"||e.which===0;var t;he=ge&&ve&&!$e(e);try{if(!e.fake){ve=ke(e);_e=String(e.key).toLowerCase()==="unidentified";be=$e(e)}}catch(e){}if(e.key==="Unidentified"){ye=true;return}if(!e.fake){ge=true;ye=false}k.off("input",ce);var n=b(e);if(is_function(F.keydown)){t=F.keydown.call(x,e);if(t!==undefined){if(!t){Fe=true}return t}}if(m){x.oneTime(F.holdTimeout,"hold",function(){Ce=true});if(Ce){n="HOLD+"+n;if(Ee){return}if(F.holdRepeatTimeout>0&&n.indexOf(F.repeatTimeoutKeys)!==-1){Ee=true;x.oneTime(F.holdRepeatTimeout,"delay",function(){Ee=false})}}v();Fe=["CTRL+V","META+V"].indexOf(n)!==-1;if(e.which!==38&&!(e.which===80&&e.ctrlKey)){De=true}if(o&&Ae(e)){X();fe();if(e.which===27){x.set("")}se();if(e.which===13){Te.call(this,e)}}else if(is_function(w[n])){t=w[n](e);if(t===true){return}if(t!==undefined){return t}}else if(e.altKey){return}else{de=false;return}}}function Se(){x.stopTime("hold");Ee=Ce=false}var Re=$(document.documentElement||window);x.keymap(F.keymap||{});function Be(e){debug('keypress "'+e.key+'" '+e.fake);Se();var t;if(!e.fake){ge=false}if((e.ctrlKey||e.metaKey)&&!e.altKey){return}if(de){return}if(is_function(F.keypress)){t=F.keypress.call(x,e);if(t!==undefined){if(!t){Fe=true}return t}}if(m){if(e.fake){return}var n;if(is_key_native||e.fake){n=e.key;var r=n.toUpperCase();if(y[r]){n=y[r]}}if(!n||_e){n=String.fromCharCode(e.which)}if($.inArray(e.which,[13,0,8])>-1){if(e.keyCode===123){return}return false}else if(n&&(!e.ctrlKey||e.ctrlKey&&e.ctrlKey)&&(!(e.altKey&&e.which===100)||e.altKey)&&!he){if(o){s+=n;Z();V()}else if(n.length===1){x.insert(n)}}}}function je(e,t,n){var r=$.Event(e);r.which=n;r.key=t;r.fake=true;Re.trigger(r)}function Oe(){debug("input "+ye+" || "+we+" (("+ge+" || "+he+") && !"+Fe+" && ("+ve+" || "+_e+") && !"+be+")");var e=k.val();if(!is_mobile){e=e.replace(/^ /,"")}if((ye||we||(ge||he)&&!Fe&&(ve||_e)&&!be)&&e!==R){var t=B;if(ye){var n=xe;be=n.slice(0,n.length-1).length===e.length}if(o){s=e;Z();V()}else{var r=e.slice(B);if(r.length===1||be){if(ye){var i;if(be){i=8}else{i=r.toUpperCase().charCodeAt(0)}je("keydown",be?"Backspace":r,i)}if(ge&&!be){je("keypress",r,r.charCodeAt(0))}}if(be){xe=R;return}if(Fe){Fe=false;return}x.set(e)}if(be){x.position(t-1)}else{x.position(t+Math.abs(e.length-xe.length))}}xe=R;Fe=false;ye=true}Re.bind("keypress.cmd",Be).bind("keydown.cmd",Te).bind("keyup.cmd",Se).bind("input.cmd",Oe);(function(){var o=false;var a=0;x.on("mousedown.cmd",function(){o=true}).on("mouseup.cmd",function(t){function e(){var e=$(t.target);if(!e.is(".prompt")&&i){if(m){if(e.is(".cmd")){x.position(text(R).length)}else{x.display_position(_(t))}}}a=0}var n;if(t.originalEvent===undefined){n=t.button}else{n=t.originalEvent.button}if(n===0&&get_selected_text()===""){var r="click_"+u;if(++a===1){var i=o;if(m){if(F.clickTimeout===0){e()}else{x.oneTime(F.clickTimeout,r,e)}}else{a=0}}else{x.stopTime(r);a=0}}o=false})})();x.data("cmd",x);if(!("KeyboardEvent"in window&&"key"in window.KeyboardEvent.prototype)){setTimeout(function(){throw new Error("key event property not supported try https://github."+"com/inexorabletash/polyfill/blob/master/keyboard.js")},0)}return x};var combine_chr_re=/^(.(?:[\u0300-\u036F]|[\u1AB0-\u1abE]|[\u1DC0-\u1DF9]|[\u1DFB-\u1DFF]|[\u20D0-\u20F0]|[\uFE20-\uFE2F])+)/;var astral_symbols_re=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;var emoji_re=/^(\uD83C\uDFF4(?:\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74)\uDB40\uDC7F|\u200D\u2620\uFE0F)|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3]))|\uD83D\uDC69\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83D\uDC69\u200D[\u2695\u2696\u2708])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC68(?:\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDD1-\uDDDD]))/;var mobile_re=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;var tablet_re=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;var format_split_re=/(\[\[[!gbiuso]*;[^;]*;[^\]]*\](?:[^\]]*[^\\](\\\\)*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?)/i;var format_parts_re=/\[\[([!gbiuso]*);([^;]*);([^;\]]*);?([^;\]]*);?([^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?/gi;var format_re=/\[\[([!gbiuso]*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?/gi;var format_exist_re=/\[\[([!gbiuso]*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]/gi;var format_full_re=/^\[\[([!gbiuso]*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]$/gi;var color_hex_re=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;var url_re=/(\bhttps?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'<>\][)])+)/gi;var url_nf_re=/\b(?![^\s[\]]*])(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'<>\][)])+)/gi;var email_re=/((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g;var command_re=/((?:"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|\/[^\/\\]*(?:\\[\S\s][^\/\\]*)*\/[gimsuy]*(?=\s|$)|(?:\\\s|\S))+)(?=\s|$)/gi;var extended_command_re=/^\s*((terminal|cmd)::([a-z_]+)\(([\s\S]*)\))\s*$/;var format_begin_re=/(\[\[[!gbiuso]*;[^;]*;[^\]]*\])/i;var format_start_re=/^(\[\[[!gbiuso]*;[^;]*;[^\]]*\])/i;var format_end_re=/\[\[[!gbiuso]*;[^;]*;[^\]]*\]?$/i;var format_exec_re=/(\[\[(?:[^\][]|\\\])+\]\])/;var float_re=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;var re_re=/^\/((?:\\\/|[^/]|\[[^\]]*\/[^\]]*\])+)\/([gimsuy]*)$/;var string_re=/("(?:[^"\\]|\\(?:\\\\)*"|\\\\)*"|'(?:[^'\\]|\\(?:\\\\)*'|\\\\)*')/;var unclosed_strings_re=/^(?=((?:[^"']+|"[^"\\]*(?:\\[^][^"\\]*)*"|'[^'\\]*(?:\\[^][^'\\]*)*')*))\1./;var animation_supported=function(){var e=false,t="Webkit Moz O ms Khtml".split(" "),n=document.createElement("div");if(n.style.animationName){e=true}if(e===false){for(var r=0;r<t.length;r++){var i=t[r]+"AnimationName";if(n.style[i]!==undefined){e=true;break}}}n=null;return e}();var is_ch_unit_supported=function(){var e=window.navigator.userAgent;if(e.match(/MSIE|Trident/)&&!e.match(/IEMobile/)){return false}var t=document.createElement("div");t.style.width="1ch";return t.style.width==="1ch"}();var is_css_variables_supported=window.CSS&&window.CSS.supports&&window.CSS.supports("--fake-var",0);var is_android=navigator.userAgent.toLowerCase().indexOf("android")!==-1;var is_key_native=function e(){if(!("KeyboardEvent"in window&&"key"in window.KeyboardEvent.prototype)){return false}var t=window.KeyboardEvent.prototype;var n=Object.getOwnPropertyDescriptor(t,"key").get;return n.toString().match(/\[native code\]/)}();var is_mobile=function(e){var t=false;if(mobile_re.test(e)||tablet_re.test(e.substr(0,4))){t=true}return t}(navigator.userAgent||navigator.vendor||window.opera);var ch_unit_bug=false;$(function(){function e(e){return e[0].getBoundingClientRect().width}var t='<span style="font-family: monospace;visibility:hidden;';var n=$(t+'width:1ch;overflow: hidden"> </span>').appendTo("body");var r=$(t+'"> </span>').appendTo("body");ch_unit_bug=e(n)!==e(r);n.remove();r.remove()});var strlen=function(){if(typeof wcwidth==="undefined"){return function(e){return $.terminal.length(e)}}else{return wcwidth}}();function bare_text(e){if(!e.match(/&/)){return e}return $("<span>"+safe(e)+"</span>").text()}function text(e){return bare_text($.terminal.strip(e))}function safe(e){if(!e.match(/[<>&]/)){return e}return e.replace(/&(?![^;]+;)/g,"&").replace(/>/g,">").replace(/</g,"<")}function crlf(e){return e.replace(/\r/g,"")}function get_next_character(e){var t=e.match(emoji_re);if(t){return t[1]}else if(e.slice(0,2).replace(astral_symbols_re,"_")===1){if(e.slice(1).match(combine_chr_re)){return e.slice(0,3)}return e.slice(0,2)}else{var n=e.match(combine_chr_re);if(n){return n[1]}return e[0]}}function normalize_position(e,r){if(r===0){return r}e=$.terminal.strip(e);var t=$.terminal.split_characters(e).reduce(function(e,t){if(typeof e==="number"){return e}var n=e.length+t.length;if(n>=r){return e.position+1}return{position:e.position+1,length:n}},{position:0,length:0});if(typeof t==="number"){return t}else{return t.position}}function char_width_prop(e,t){if(is_ch_unit_supported){return"width: "+e+"ch"}else if(!is_css_variables_supported){if(t.char_width){return"width: "+t.char_width*e+"px"}}else{return"--length: "+e}return""}function extra_css(e,t){if(typeof wcwidth!=="undefined"){var n=bare_text(e);var r=strlen(n);if(r!==$.terminal.length(n)){return char_width_prop(r,t)}}return""}function wide_characters(e,n){if(typeof wcwidth!=="undefined"){var t=bare_text(e);var r=$.terminal.split_characters(t);if(r.length===1){return e}var i=r.map(function(e){return{len:strlen(e),chr:e}}).reduce(function(e,t){var n=e[e.length-1];if(n){if(n.len!==t.len){return e.concat([{sum:t.len,len:t.len,str:t.chr}])}else{e.pop();return e.concat([{sum:n.sum+t.len,len:n.len,str:n.str+t.chr}])}}return[{sum:t.len,str:t.chr,len:t.len}]},[]);return i.map(function(e){if(e.len===1){return e.str}var t=char_width_prop(e.sum,n);if(e.sum===r.length||!t.length){return"<span>"+e.str+"</span>"}else{return'<span style="'+t+'">'+e.str+"</span>"}}).join("")}return e}function binary_search(e,t,n,r){var i=t-e;var o=e+Math.floor(i/2);var a=r(n,o);if(a===0){return o}else if(a>0&&i>1){return binary_search(o,t,n,r)}else if(a<0&&i>1){return binary_search(e,o,n,r)}else{return-1}}var get_selected_text=function(){if(window.getSelection||document.getSelection){return function(){var e=(window.getSelection||document.getSelection)();if(e.text){return e.text}else{return e.toString()}}}else if(document.selection&&document.selection.type!=="Control"){return function(){return document.selection.createRange().text}}return function(){return""}}();function text_to_clipboard(e,t){var n=$("<div>"+t.replace(/\n/,"<br/>")+"<div>");n.appendTo("body");select_all(n[0]);try{document.execCommand("copy")}catch(e){}n.remove()}var get_textarea_selection=function(){var e=document.createElement("textarea");var t="selectionStart"in e;e=null;if(t){return function(e){var t=e.selectionEnd-e.selectionStart;return e.value.substr(e.selectionStart,t)}}else if(document.selection){return function(){var e=document.selection.createRange();return e.text()}}else{return function(){return""}}}();function clear_textarea_selection(e){e.selectionStart=e.selectionEnd=0}function common_string(e,t,n){if(!t.length){return""}var r=string_case(e);var i=[];for(var o=e.length;o<t[0].length;++o){var a=false;var u=t[0].charAt(o),s=u.toLowerCase();for(var l=1;l<t.length;++l){a=true;var f=t[l].charAt(o),c=f.toLowerCase();if(u!==f){if(n||r==="mixed"){a=false;break}else if(s===c){if(r==="lower"){u=u.toLowerCase()}else if(r==="upper"){u=u.toUpperCase()}else{a=false;break}}else{a=false;break}}}if(a){i.push(u)}else{break}}return e+i.join("")}function trigger_terminal_change(t){terminals.forEach(function(e){e.settings().onTerminalChange.call(e,t)})}var select=function(){if(window.getSelection){var e=window.getSelection();if(e.setBaseAndExtent){return function(e,t){var n=window.getSelection();n.setBaseAndExtent(e,0,t,1)}}else{return function(e,t){var n=window.getSelection();var r=document.createRange();r.setStart(e,0);r.setEnd(t,t.childNodes.length);n.removeAllRanges();n.addRange(r)}}}else{return $.noop}}();function select_all(e){if(window.getSelection){var t=window.getSelection();if(t.setBaseAndExtent){t.setBaseAndExtent(e,0,e,1)}else if(document.createRange){var n=document.createRange();n.selectNodeContents(e);t.removeAllRanges();t.addRange(n)}}}function process_command(e,t){var n=e.match(command_re)||[];if(n.length){var r=n.shift();var i=$.map(n,function(e){if(e.match(/^["']/)){e=e.replace(/\n/g,"\\u0000\\u0000\\u0000\\u0000");e=t(e);return e.replace(/\x00\x00\x00\x00/g,"\n")}return t(e)});var o=$.map(n,function(e){var t=e.match(/^(['"]).*\1$/);return t&&t[1]||""});var a=e.slice(r.length).trim();return{command:e,name:r,args:i,args_quotes:o,rest:a}}else{return{command:e,name:"",args:[],args_quotes:o,rest:""}}}$.terminal={version:"2.0.2",date:"Sat, 22 Dec 2018 15:04:13 +0000",color_names:["transparent","currentcolor","black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],Cycle:Cycle,History:History,Stack:Stack,valid_color:function e(t){if(t.match(color_hex_re)){return true}else{return $.inArray(t.toLowerCase(),$.terminal.color_names)!==-1}},unclosed_strings:function e(t){return!!t.match(unclosed_strings_re)},escape_regex:function e(t){if(typeof t==="string"){var n=/([-\\^$[\]()+{}?*.|])/g;return t.replace(n,"\\$1")}},have_formatting:function e(t){return typeof t==="string"&&!!t.match(format_exist_re)},is_formatting:function e(t){return typeof t==="string"&&!!t.match(format_full_re)},format_split:function e(t){return t.split(format_split_re).filter(Boolean)},tracking_replace:function e(t,n,r,i){function o(e,t,n){return e.slice(t,n)}function a(e){return $.terminal.strip(e).length}var u="";var s;var l=0;var f;var c=i;var p;n.lastIndex=0;while(s=n.exec(t)){if(n.global){var m=a(o(t,0,n.lastIndex));p=m-a(s[0])}else{p=s.index;m=p+a(s[0])}if(l<p){u+=o(t,l,p)}l=m;if(typeof r==="function"){f=r.apply(null,s)}else{f=r.replace(/\$(\$|\d)/g,function(e,t){if(t==="$"){return"$"}return s[t]})}u+=f;if(p<i){if(m<i){c=Math.max(0,c+a(f)-a(s[0]))}else{c+=a(f)-(i-p)}}if(!n.global){break}}if(l<a(t)){u+=o(t,l)}if(t===u){return[t,i]}return[u,c]},iterate_formatting:function e(t,n){function r(e){return t.slice(e-6,e)===" "||t.slice(e-1,e).match(/\s/)}var i=/^(&(?:[a-z\d]+|#\d+|#x[a-f\d]+);)/i;function o(e){return t.slice(e).match(i)}function a(e){return t[e]==="["&&t[e+1]==="["}function u(e){return t[e]==="\\"&&t[e+1]==="]"}function s(e){return y&&(t[e]!=="]"||!l)&&!b}var l=$.terminal.have_formatting(t);var f="";var c=false;var p=0;var m;var D=-1;var d;var h=0;var v=0;for(var g=0;g<t.length;g++){var _=t.slice(g);m=_.match(format_start_re);if(m){f=m[1];c=false}else if(f){if(t[g]==="]"){if(c){f="";c=false}else{c=true}}}else{c=true}var y=f&&c||!f;var b=a(g);if(r(g)&&(y||b)){if(D===-1&&d!==g||D!==-1){D=g}}var w=t[g].match(/[[\]]/);if(y){if(t[g]==="&"){m=o(g);if(m){g+=m[1].length-2;continue}++p;++h}else if(u(g)){++p;++h;v=1;g+=1}else if(!w||!l){++p;++h}}if(s(g)){if(strlen(t[g])===2){h++}var C={count:p,index:g-v,formatting:f,length:h,text:c,size:v+1,space:D};var E=n(C);if(E===false){break}else if(E){if(E.count!==undefined){p=E.count}if(E.length!==undefined){h=E.length}if(E.space!==undefined){d=D;D=E.space}if(E.index!==undefined){g=E.index;continue}}}else if(g===t.length-1){n({count:p+1,index:g,formatting:f,length:0,text:c,space:D})}var F=get_next_character(_);if(F.length>1){g+=F.length-1}}},substring:function e(n,r,i){var t=$.terminal.split_characters(text(n));if(!t.slice(r,i).length){return""}var o=0;var a;var u="";var s="";var l;var f=/(&[^;]+);$/;var c=1;$.terminal.iterate_formatting(n,function(e){var t;if(r&&e.count===r+1){o=e.index;t=n.slice(0,o+1).match(f);if(t){o-=t[1].length}if(e.formatting){u=e.formatting}}if(i&&e.count===i){s=e.formatting;l=e.index;c=e.size}if(e.count===i+1){a=e.index;t=n.slice(0,a+1).match(f);if(t){a-=t[1].length}if(e.formatting){a=l+c}}});if(r&&!o){return""}if(a===undefined){a=n.length}n=u+n.slice(o,a);if(s){n=n.replace(/(\[\[^\]]+)?\]$/,"");n+="]"}return n},normalize:function e(t){return t.replace(format_re,function(e,t,n){if(n===""){return""}function r(e){return e.replace(/\\\]/g,"]").replace(/\n/g,"\\n").replace(/ /g," ")}t=r(t);var i=t.match(/;/g).length;if(i>=4){var o=t.split(/;/);var a=o.slice(0,4).join(";");var u=o.slice(4).join(";");return"[["+a+";"+(u||n)+"]"+n+"]"}else if(i===2){i=";;"}else if(i===3){i=";"}else{i=""}return"[["+t+i+r(n)+"]"+n+"]"})},split_equal:function e(t,p,m){var D="";var d=[];var n=$.terminal.normalize(t).split(/\n/g);for(var r=0,i=n.length;r<i;++r){if(n[r]===""){d.push("");continue}var h=n[r];var v=0;var g;var _=h.length;var o=$.terminal.split_characters(text(h));var a=o[o.length-1];var y=_-(a?a.length:1);var b=!!h.match(/\[\[[^\]]+\](?:[^\][]|\\\])+\]$/);if(b){y-=1}$.terminal.iterate_formatting(h,function(e){var t=e.index===y;var n,r;if(e.length>=p||t||e.length===p-1&&strlen(h[e.index+1])===2){var i=false;if(m&&e.space!==-1){var o=text(h.slice(e.space));var a=o.length;var u=e.index+p+1;o=o.slice(0,u);if(o.match(/\s| /)||u>a){i=true}}var s;if(m&&e.space!==-1&&e.index!==_-1&&i){g=h.slice(v,e.space);s=e.space-1}else{r=h.slice(e.index);n=get_next_character(r);g=h.slice(v,e.index)+n;if(t&&b&&n!=="]"){g+="]"}s=e.index+n.length-1}if(m){g=g.replace(/^( |\s)+|( |\s)+$/g,"")}v=(s||e.index)+1;if(D){var l=g.match(/^[^\]]*\]/);g=D+g;if(l){D=""}}var f=g.match(format_re);if(f){var c=f[f.length-1];if(c[c.length-1]!=="]"){D=c.match(format_begin_re)[1];g+="]"}else if(g.match(format_end_re)){g=g.replace(format_end_re,"");D=c.match(format_begin_re)[1]}}d.push(g);return{index:s,length:0,space:-1}}})}return d},amp:function e(t){return t.replace(/&(?!#[0-9]+;|[a-zA-Z]+;)/g,"&")},encode:function e(t,n){var s=$.extend({tabs:4,before:""},n);return $.terminal.amp(t).replace(/</g,"<").replace(/>/g,">").replace(/ /g," ").split("\n").map(function(e){var u=e.split(/((?:\[\[[^\]]+\])?\t(?:\])?)/);u=u.filter(Boolean);return u.map(function(e,a){if(e.match(/\t/)){return e.replace(/\t([^\t]*)$/,function(e,t){if(a!==0&&u[a-1].match(/\t\]?$/)){var n=new Array(s.tabs+1).join(" ");return n+t}else{var r=u.slice(a-1,a).join("");if(s.before&&a<=1){r=s.before+r}var i=$.terminal.length(r);var o=s.tabs-i%s.tabs;if(o===0){o=4}return new Array(o+1).join(" ")+t}})}return e}).join("")}).join("\n")},nested_formatting:function e(t){if(!$.terminal.have_formatting(t)){return t}var n=[];var r=/((?:\[\[(?:[^\][]|\\\])+\])?(?:[^\][]|\\\])*\]?)/;var i=/(\[\[(?:[^\][]|\\\])+\])[\s\S]*/;return t.split(r).filter(Boolean).map(function(e){if(e.match(/^\[\[/)){if(!$.terminal.is_formatting(e)){e+="]";n.push(e.replace(i,"$1"))}}else{var t=false;if(e.match(/\]/)){t=true}if(n.length){e=n[n.length-1]+e}if(t){n.pop()}else if(n.length){e+="]"}}return e}).join("")},escape_formatting:function e(t){return $.terminal.escape_brackets(t)},apply_formatters:function e(t,i){if(t===""){if(typeof i.position==="number"){return["",i.position]}else{return""}}function o(e,t,n,r){if(!e.__no_warn__&&$.terminal.length(n)!==$.terminal.length(r)){warn("Your formatter["+t+"] change length of the string, "+"you should use [regex, replacement] formatter or function "+" that return [replacement, position] instead")}}var n=$.terminal.defaults.formatters;i=i||{};var f=0;function c(e,t){var n=$.extend({},i,{position:t[1]});var r=e(t[0],n);if(typeof r==="string"){o(e,f-1,r,t[0]);if(typeof r==="string"){return[r,n.position]}return t}else if(r instanceof Array&&r.length===2){return r}else{return t}}var r;if(typeof i.position==="number"){r=[t,i.position]}else{r=[t,0]}try{var a=n.reduce(function(a,u){f++;if(typeof u==="function"&&u.__meta__){return c(u,a)}else{var s=0;var l=false;var e=$.terminal.format_split(a[0]);var t=e.map(function(e){var t;var n=text(e).length;if(a[1]<=s+n&&!l){t=a[1]-s;l=true}else{t=-1}var r=s;var i;s+=n;if($.terminal.is_formatting(e)){return[e,-1]}else{if(u instanceof Array){var o=u[2]||{};i=[e,t<0?0:t];if(i[0].match(u[0])){if(o.loop){while(i[0].match(u[0])){i=$.terminal.tracking_replace(i[0],u[0],u[1],i[1])}}else{i=$.terminal.tracking_replace(i[0],u[0],u[1],i[1])}}if(t<0){return[i[0],-1]}}else if(typeof u==="function"){i=c(u,[e,t])}if(typeof i!=="undefined"){if(i[1]!==-1){i[1]+=r}return i}return[e,-1]}});var n=t.filter(function(e){return e[1]!==-1})[0];var r=t.map(function(e){return e[0]}).join("");var i;if(typeof n==="undefined"){i=a[1]}else{i=n[1]}var o=text(r).length;if(i>o){i=o}if(r===a[0]){return a}return[r,i]}},r);if(typeof i.position==="number"){var u=$.terminal.strip(a[0]).length;if($.terminal.length(a[0])<u){var s=a[1];s=normalize_position(a[0],s);var l=$.terminal.length(a[0]);if(s>l){s=l}a[1]=s}return a}else{return a[0]}}catch(e){var p="Error in formatter ["+(f-1)+"]";n.splice(f-1);throw new $.terminal.Exception("formatting",p,e.stack)}},format:function e(t,m){function D(e){if(e.match(/\\]/)){e=e.replace(/(\\+)]/g,function(e,t){if(t.length%2===1){return"]"}else{return t.replace(/../,"\\")}})}return safe(e)}var d=$.extend({},{linksNoReferrer:false,linksNoFollow:false,anyLinks:false},m||{});if(typeof t==="string"){var n=$.terminal.format_split(t);t=$.map(n,function(e){if(e===""){return e}else if($.terminal.is_formatting(e)){e=e.replace(/\[\[[^\]]+\]/,function(e){return e.replace(/ /g," ")});return e.replace(format_parts_re,function(e,t,n,r,i,o,a){if(a===""){return""}a=D(a);var u="";if(t.indexOf("b")!==-1){u+="font-weight:bold;"}var s=[];if(t.indexOf("u")!==-1){s.push("underline")}if(t.indexOf("s")!==-1){s.push("line-through")}if(t.indexOf("o")!==-1){s.push("overline")}if(s.length){u+="text-decoration:"+s.join(" ")+";"}if(t.indexOf("i")!==-1){u+="font-style:italic;"}if($.terminal.valid_color(n)){u+="color:"+n+";"+"--color:"+n+";";if(t.indexOf("g")!==-1){u+="text-shadow:0 0 5px "+n+";"}}if($.terminal.valid_color(r)){u+="background-color:"+r+";"}var l;if(o===""){l=a}else{l=o.replace(/]/g,"]").replace(/>/g,">").replace(/</g,"<")}var f=extra_css(a,m);if(f){a=wide_characters(a,m);u+=f}var c;if(t.indexOf("!")!==-1){if(l.match(email_re)){c='<a href="mailto:'+l+'"'}else{if(!d.anyLinks&&!l.match(/^((https?|ftp):\/\/|\.{0,2}\/)/)){l=""}c='<a target="_blank"';if(l){c+=' href="'+l+'"'}var p=["noopener"];if(d.linksNoReferrer){p.unshift("noreferrer")}if(d.linksNoFollow){p.unshift("nofollow")}c+=' rel="'+p.join(" ")+'"'}c+=' tabindex="1000"'}else{c="<span"}if(u!==""){c+=' style="'+u+'"'}if(i!==""){c+=' class="'+i+'"'}if(t.indexOf("!")!==-1){c+=">"+a+"</a>"}else{c+=' data-text="'+l.replace(/"/g,""e;")+'">'+a+"</span>"}return c})}else{e=D(e);var t=extra_css(e,m);if(t.length){e=wide_characters(e,m);return'<span style="'+t+'">'+e+"</span>"}else{return"<span>"+e+"</span>"}}}).join("");return t.replace(/<span><br\s*\/?><\/span>/gi,"<br/>")}else{return""}},escape_brackets:function e(t){return t.replace(/\[/g,"[").replace(/\]/g,"]")},unescape_brackets:function e(t){return t.replace(/[/g,"[").replace(/]/g,"]")},length:function(e){return $.terminal.split_characters(text(e)).length},split_characters:function e(t){var n=[];while(t.length){var r=get_next_character(t);t=t.slice(r.length);n.push(r)}return n},columns:function(e,t,n){var r=e.map(function(e){return $.terminal.strip(e)});var i=r.map(function(e){return strlen(e)});if(typeof n==="undefined"){n=4}var o=Math.max.apply(null,i)+n;var a=Math.floor(t/o)-1;if(a<1){return e.join("\n")}var u=[];for(var s=0,l=e.length;s<l;s+=a){var f=e.slice(s,s+a);var c=f.pop();u.push(f.reduce(function(e,t){var n=$.terminal.strip(t);var r=new Array(o-n.length+1).join(" ");e.push(t+r);return e},[]).join("")+c)}return u.join("\n")},strip:function e(t){t=t.replace(format_parts_re,"$6");return t.replace(/\\([[\]])/g,function(e,t){return t})},active:function e(){return terminals.front()},last_id:function e(){var t=terminals.length();return t-1},parse_argument:function e(t,n){function r(e){return e.split(string_re).map(function(e){if(e.match(/^['"]/)){if(e==='""'||e==="''"){return""}var t=e[0];var n=new RegExp("(^|(?:\\\\(?:\\\\)*)?)"+t,"g");e=e.replace(n,"$1")}e='"'+e+'"';return JSON.parse(e)}).join("")}if(n===false){if(t[0]==="'"&&t[t.length-1]==="'"){return t.replace(/^'|'$/g,"")}else if(t[0]==='"'&&t[t.length-1]==='"'){return t.replace(/^"|"$/g,"").replace(/\\([" ])/g,"$1")}else if(t.match(/\/.*\/[gimy]*$/)){return t}else if(t.match(/['"]]/)){return r(t)}else{return t.replace(/\\ /g," ")}}var i=t.match(re_re);if(i){return new RegExp(i[1],i[2])}else if(t.match(/['"]/)){return r(t)}else if(t.match(/^-?[0-9]+$/)){return parseInt(t,10)}else if(t.match(float_re)){return parseFloat(t)}else{return t.replace(/\\(['"() ])/g,"$1")}},parse_arguments:function e(t){return $.map(t.match(command_re)||[],$.terminal.parse_argument)},split_arguments:function e(t){return $.map(t.match(command_re)||[],function(e){return $.terminal.parse_argument(e,false)})},parse_command:function e(t){return process_command(t,$.terminal.parse_argument)},split_command:function e(t){return process_command(t,function(e){return $.terminal.parse_argument(e,false)})},parse_options:function e(t,n){var o=$.extend({},{boolean:[]},n);if(typeof t==="string"){return e($.terminal.split_arguments(t),n)}var a={_:[]};function u(e){this.value=e}var r=t.reduce(function(e,t){if(typeof t!=="string"){t=String(t)}if(t.match(/^-/)&&e instanceof u){a[e.value]=true}if(t.match(/^--/)){var n=t.replace(/^--/,"");if(o.boolean.indexOf(n)===-1){return new u(n)}else{a[n]=true}}else if(t.match(/^-/)){var r=t.replace(/^-/,"").split("");if(o.boolean.indexOf(r.slice(-1)[0])===-1){var i=r.pop()}r.forEach(function(e){a[e]=true});if(i){return new u(i)}}else if(e instanceof u){a[e.value]=t}else if(t){a._.push(t)}return null},null);if(r instanceof u){a[r.value]=true}return a},extended_command:function extended_command(term,string,options){var settings=$.extend({invokeMethods:false},options);try{change_hash=false;var m=string.match(extended_command_re);if(m){if(!settings.invokeMethods){warn("To invoke terminal or cmd methods you need to enable "+"invokeMethods option");return}string=m[1];var obj=m[2]==="terminal"?term:term.cmd();var fn=m[3];try{var args=eval("["+m[4]+"]");if(!obj[fn]){term.error("Unknow function "+fn)}else{obj[fn].apply(term,args)}}catch(e){term.error("Invalid invocation in "+$.terminal.escape_brackets(string))}}else{term.exec(string,true).done(function(){change_hash=true})}}catch(e){}},iterator:function(t){function n(e){if($.terminal.is_formatting(e)){if(e.match(/\]\\\]/)){e=e.replace(/\]\\\]/g,"]\\\\]")}}return e}if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){var r=$.terminal.length(t);var i=0;var e={};e[Symbol.iterator]=function(){return{next:function(){if(i<r){var e=$.terminal.substring(t,i,i+1);i++;return{value:n(e)}}else{return{done:true}}}}};return e}},formatter:new function(){try{this[Symbol.split]=function(e){return $.terminal.format_split(e)};this[Symbol.match]=function(e){return e.match(format_re)};this[Symbol.replace]=function(e,t){return e.replace(format_parts_re,t)};this[Symbol.search]=function(e){return e.search(format_re)}}catch(e){}},new_formatter:function(e){var t=$.terminal.defaults.formatters;for(var n=0;n<t.length;++n){if(t[n]===$.terminal.nested_formatting){t.splice(n,0,e);return}}t.push(e)}};$.terminal.Exception=function e(t,n,r){if(arguments.length===1){this.message=arguments[0];this.type="TERMINAL"}else{this.type=t;this.message=n;if(r){this.stack=r}}};$.terminal.Exception.prototype=new Error;$.terminal.Exception.prototype.toString=function(){return this.message+"\n"+this.stack};$.fn.visible=function(){return this.css("visibility","visible")};$.fn.hidden=function(){return this.css("visibility","hidden")};var warnings=[];function warn(e){e="[jQuery Terminal] "+e;if(warnings.indexOf(e)===-1){warnings.push(e);if(console){if(console.warn){console.warn(e)}else if(console.log){console.log(e)}}else{setTimeout(function(){throw new Error("WARN: "+e)},0)}}}var ids={};$.jrpc=function(e,t,n,r,i){var a=new $.Deferred;var u;if($.isPlainObject(e)){u=e}else{u={url:e,method:t,params:n,success:r,error:i}}function s(e){return $.isNumeric(e.id)&&(typeof e.result!=="undefined"||typeof e.error!=="undefined")}ids[u.url]=ids[u.url]||0;var o={jsonrpc:"2.0",method:u.method,params:u.params,id:++ids[u.url]};$.ajax({url:u.url,beforeSend:function e(t,n){if(is_function(u.request)){u.request(t,o)}n.data=JSON.stringify(o)},success:function e(t,n,r){var i=r.getResponseHeader("Content-Type");if(!i.match(/(application|text)\/json/)){warn("Response Content-Type is neither application/json"+" nor text/json")}var o;try{o=JSON.parse(t)}catch(e){if(u.error){u.error(r,"Invalid JSON",e)}else{throw new $.terminal.Exception("JSON","Invalid JSON",e.stack)}a.reject({message:"Invalid JSON",response:t});return}if(is_function(u.response)){u.response(r,o)}if(s(o)||u.method==="system.describe"){if(u.success){u.success(o,n,r)}a.resolve(o)}else{if(u.error){u.error(r,"Invalid JSON-RPC")}a.reject({message:"Invalid JSON-RPC",response:t})}},error:u.error,contentType:"application/json",dataType:"text",async:true,cache:false,type:"POST"});return a.promise()};function get_char_size(e){var t=$('<div class="terminal temp"><div class="terminal-output">'+'<div><div class="line" style="float: left"><span> </span>'+"</div></div></div></div>").appendTo("body");t.addClass(e.attr("class"));if(e){var n=e.attr("style");if(n){n=n.split(/\s*;\s*/).filter(function(e){return!e.match(/display\s*:\s*none/i)}).join(";");t.attr("style",n)}}var r=t.find(".line")[0].getBoundingClientRect();var i={width:r.width,height:r.height};t.remove();return i}function get_num_chars(e,t){var n=e.find(".terminal-fill").width();var r=Math.floor(n/t.width);return r||1e3}function get_num_rows(e,t){return Math.floor(e.find(".terminal-fill").height()/t.height)}function all(e,t){var n=e.filter(function(e){return e[t]()===e});return n.length===e.length}function string_case(e){var t=e.split("");if(all(t,"toLowerCase")){return"lower"}else if(all(t,"toUpperCase")){return"upper"}else{return"mixed"}}function same_case(e){return string_case(e)!=="mixed"}function is_function(e){return get_type(e)==="function"}function get_type(e){return typeof e==="function"?"function":$.type(e)}var version_set=!$.terminal.version.match(/^\{\{/);var copyright="Copyright (c) 2011-2018 Jakub Jankiewicz <http://jcubic"+".pl/me>";var version_string=version_set?" v. "+$.terminal.version:" ";var reg=new RegExp(" {"+version_string.length+"}$");var name_ver="jQuery Terminal Emulator"+(version_set?version_string:"");var signatures=[["jQuery Terminal","(c) 2011-2018 jcubic"],[name_ver,copyright.replace(/^Copyright | *<.*>/g,"")],[name_ver,copyright.replace(/^Copyright /,"")],[" _______ ________ __"," / / _ /_ ____________ _/__ ___/______________ _____ / /"," __ / / // / // / _ / _/ // / / / _ / _/ / / \\/ / _ \\/ /","/ / / // / // / ___/ // // / / / ___/ // / / / / /\\ / // / /__","\\___/____ \\\\__/____/_/ \\__ / /_/____/_//_/_/_/_/_/ \\/\\__\\_\\___/"," \\/ /____/ ".replace(reg," ")+version_string,copyright],[" __ _____ ________ "+" __"," / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ "+" / /"," __ / // // // // // _ // _// // / / // _ // _// // // \\/ // _ "+"\\/ /","/ / // // // // // ___// / / // / / // ___// / / / / // // /\\ // // "+"/ /__","\\___//____ \\\\___//____//_/ _\\_ / /_//____//_/ /_/ /_//_//_/ /_/ \\"+"__\\_\\___/",(" \\/ /____/ "+" ").replace(reg,"")+version_string,copyright]];$.terminal.nested_formatting.__meta__=true;$.terminal.nested_formatting.__no_warn__=true;$.terminal.defaults={prompt:"> ",history:true,exit:true,clear:true,enabled:true,maskChar:"*",wrap:true,checkArity:true,raw:false,tabindex:1,invokeMethods:false,exceptionHandler:null,pauseEvents:true,softPause:false,memory:false,cancelableAjax:true,processArguments:true,linksNoReferrer:false,anyLinks:false,linksNoFollow:false,processRPCResponse:null,completionEscape:true,onCommandChange:null,onPositionChange:null,convertLinks:true,extra:{},tabs:4,historySize:60,scrollObject:null,historyState:false,importHistory:false,historyFilter:null,echoCommand:true,scrollOnEcho:true,login:null,outputLimit:-1,formatters:[$.terminal.nested_formatting],onAjaxError:null,pasteImage:true,scrollBottomOffset:20,wordAutocomplete:true,caseSensitiveAutocomplete:true,caseSensitiveSearch:true,clickTimeout:200,holdTimeout:400,holdRepeatTimeout:200,repeatTimeoutKeys:["HOLD+BACKSPACE"],request:$.noop,response:$.noop,describe:"procs",onRPCError:null,doubleTab:null,completion:false,onInit:$.noop,onClear:$.noop,onBlur:$.noop,onFocus:$.noop,onTerminalChange:$.noop,onExit:$.noop,onPush:$.noop,onPop:$.noop,keypress:$.noop,keydown:$.noop,onAfterRedraw:$.noop,onEchoCommand:$.noop,onFlush:$.noop,strings:{comletionParameters:"From version 1.0.0 completion function need to"+" have two arguments",wrongPasswordTryAgain:"Wrong password try again!",wrongPassword:"Wrong password!",ajaxAbortError:"Error while aborting ajax call!",wrongArity:"Wrong number of arguments. Function '%s' expects %s got"+" %s!",commandNotFound:"Command '%s' Not Found!",oneRPCWithIgnore:"You can use only one rpc with describe == false "+"or rpc without system.describe",oneInterpreterFunction:"You can't use more than one function (rpc "+"without system.describe or with option describe == false count"+"s as one)",loginFunctionMissing:"You didn't specify a login function",noTokenError:"Access denied (no token)",serverResponse:"Server responded",wrongGreetings:"Wrong value of greetings parameter",notWhileLogin:"You can't call `%s' function while in login",loginIsNotAFunction:"Authenticate must be a function",canExitError:"You can't exit from main interpreter",invalidCompletion:"Invalid completion",invalidSelector:"Sorry, but terminal said that you use invalid "+"selector!",invalidTerminalId:"Invalid Terminal ID",login:"login",password:"password",recursiveCall:"Recursive call detected, skip",notAString:"%s function: argument is not a string",redrawError:"Internal error, wrong position in cmd redraw",invalidStrings:"Command %s have unclosed strings",defunctTerminal:"You can't call method on terminal that was destroyed"}};var requests=[];var terminals=new Cycle;var save_state=[];var hash_commands;var change_hash=false;var fire_hash_change=true;var first_instance=true;$.fn.terminal=function(e,t){function n(n){if(n){this.storage={}}this.set=function(e,t){if(n){this.storage[e]=t}else{$.Storage.set(e,t)}};this.get=function(e){if(n){return this.storage[e]}else{return $.Storage.get(e)}};this.remove=function(e){if(n){delete this.storage[e]}else{$.Storage.remove(e)}}}function f(e){if($.terminal.unclosed_strings(e)){var t=$.terminal.escape_brackets(e);var n=sprintf(U().invalidStrings,"`"+t+"`");throw new $.terminal.Exception(n)}else if(is_function(fe.processArguments)){return process_command(e,fe.processArguments)}else if(fe.processArguments){return $.terminal.parse_command(e)}else{return $.terminal.split_command(e)}}function p(e){if(typeof e==="string"){q.echo(e)}else if(e instanceof Array){q.echo($.map(e,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof e==="object"){q.echo(JSON.stringify(e))}else{q.echo(e)}}function c(e){var t=/(.*):([0-9]+):([0-9]+)$/;var i=e.match(t);if(i){q.pause(fe.softPause);$.get(i[1],function(e){var t=i[1];q.echo("[[b;white;]"+t+"]");var n=e.split("\n");var r=+i[2]-1;q.echo(n.slice(r-2,r+3).map(function(e,t){if(t===2){e="[[;#f00;]"+$.terminal.escape_brackets(e)+"]"}return"["+(r+t-1)+"]: "+e}).join("\n")).resume()},"text")}}function a(e){if(is_function(fe.onRPCError)){fe.onRPCError.call(q,e)}else{q.error("[RPC] "+e.message);if(e.error&&e.error.message){e=e.error;var t="\t"+e.message;if(e.file){t+=' in file "'+e.file.replace(/.*\//,"")+'"'}if(e.at){t+=" at line "+e.at}q.error(t)}}}function m(n,r){var i=function(e,t){q.pause(fe.softPause);$.jrpc({url:n,method:e,params:t,request:function(e,t){try{fe.request.call(q,e,t,q)}catch(e){v(e,"USER")}},response:function(e,t){try{fe.response.call(q,e,t,q)}catch(e){v(e,"USER")}},success:function e(t){if(t.error){a(t.error)}else if(is_function(fe.processRPCResponse)){fe.processRPCResponse.call(q,t.result,q)}else{p(t.result)}q.resume()},error:d})};return function(e,t){if(e===""){return}try{e=f(e)}catch(e){v(e,"TERMINAL (get_processed_command)");return}if(!r||e.name==="help"){i(e.name,e.args)}else{var n=t.token();if(n){i(e.name,[n].concat(e.args))}else{t.error("[AUTH] "+U().noTokenError)}}}}function D(a,u,s,l){return function(e,t){if(e===""){return}var n;try{n=f(e)}catch(e){if(is_function(fe.exception)){fe.exception(e,q)}else{q.error("Error: "+(e.message||e))}return}var r=a[n.name];var i=get_type(r);if(i==="function"){if(u&&r.length!==n.args.length){q.error("[Arity] "+sprintf(U().wrongArity,n.name,r.length,n.args.length))}else{return r.apply(q,n.args)}}else if(i==="object"||i==="string"){var o=[];if(i==="object"){o=Object.keys(r);r=D(r,u,s)}t.push(r,{prompt:n.name+"> ",name:n.name,completion:i==="object"?o:undefined})}else if(is_function(l)){l(e,q)}else if(is_function(fe.onCommandNotFound)){fe.onCommandNotFound.call(q,e,q)}else{t.error(sprintf(U().commandNotFound,n.name))}}}function d(e,t,n){q.resume();if(is_function(fe.onAjaxError)){fe.onAjaxError.call(q,e,t,n)}else if(t!=="abort"){q.error("[AJAX] "+t+" - "+U().serverResponse+":\n"+$.terminal.escape_brackets(e.responseText))}}function h(o,u,i){function s(e){if(e.error){a(e.error)}else if(is_function(fe.processRPCResponse)){fe.processRPCResponse.call(q,e.result,q)}else{p(e.result)}q.resume()}function l(e,t){try{fe.request.call(q,e,t,q)}catch(e){v(e,"USER")}}function f(e,t){try{fe.response.call(q,e,t,q)}catch(e){v(e,"USER")}}function e(n){var r=n;if(fe.describe!==""){fe.describe.split(".").forEach(function(e){r=r[e]})}if(r&&r.length){var t={};$.each(r,function(e,i){if($.isPlainObject(i)&&typeof i.name==="string"){t[i.name]=function(){var e=u&&i.name!=="help";var t=Array.prototype.slice.call(arguments);var n=t.length+(e?1:0);if(fe.checkArity&&i.params&&i.params.length!==n){q.error("[Arity] "+sprintf(U().wrongArity,i.name,i.params.length,n))}else{q.pause(fe.softPause);if(e){var r=q.token(true);if(r){t=[r].concat(t)}else{q.error("[AUTH] "+U().noTokenError)}}$.jrpc({url:o,method:i.name,params:t,request:l,response:f,success:s,error:d})}}}});var a=typeof u==="string"?u:"login";t.help=t.help||function(i){if(typeof i==="undefined"){var e=n.procs.map(function(e){return e.name}).join(", ")+", help";q.echo("Available commands: "+e)}else{var o=false;$.each(r,function(e,t){if(t.name===i){o=true;var n="";n+="[[bu;;]"+t.name+"]";if(t.params){var r=t.params;if(u&&t.name!==a){r=r.slice(1)}n+=" "+r.join(" ")}if(t.help){n+="\n"+t.help}q.echo(n);return false}});if(!o){if(i==="help"){q.echo("[[bu;;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var t="Method `"+i+"' not found ";q.error(t)}}}};i(t)}else{i(null)}}return $.jrpc({url:o,method:"system.describe",params:[],success:e,request:l,response:f,error:function e(){i(null)}})}function s(t,a,n){n=n||$.noop;var e=get_type(t);var u;var r={};var s=0;var l;if(e==="array"){u={};(function t(e,n){if(e.length){var r=e[0];var i=e.slice(1);var o=get_type(r);if(o==="string"){q.pause(fe.softPause);if(fe.describe===false){if(++s===1){l=m(r,a)}else{q.error(U().oneRPCWithIgnore)}t(i,n)}else{h(r,a,function(e){if(e){$.extend(u,e)}else if(++s===1){l=m(r,a)}else{q.error(U().oneRPCWithIgnore)}q.resume();t(i,n)})}}else if(o==="function"){if(l){q.error(U().oneInterpreterFunction)}else{l=r}t(i,n)}else if(o==="object"){$.extend(u,r);t(i,n)}}else{n()}})(t,function(){n({interpreter:D(u,false,a,l.bind(q)),completion:Object.keys(u)})})}else if(e==="string"){if(fe.ignoreSystemDescribe){u={interpreter:m(t,a)};if($.isArray(fe.completion)){u.completion=fe.completion}n(u)}else{q.pause(fe.softPause);h(t,a,function(e){if(e){r.interpreter=D(e,false,a);r.completion=Object.keys(e)}else{r.interpreter=m(t,a)}n(r);q.resume()})}}else if(e==="object"){n({interpreter:D(t,fe.checkArity,a),completion:Object.keys(t)})}else{if(e==="undefined"){t=$.noop}else if(e!=="function"){var i=e+" is invalid interpreter value";throw new $.terminal.Exception(i)}n({interpreter:t,completion:fe.completion})}}function l(r,e){var i=get_type(e)==="boolean"?"login":e;return function(e,t,n){q.pause(fe.softPause);$.jrpc({url:r,method:i,params:[e,t],request:function(e,t){try{fe.request.call(q,e,t,q)}catch(e){v(e,"USER")}},response:function(e,t){try{fe.response.call(q,e,t,q)}catch(e){v(e,"USER")}},success:function e(t){if(!t.error&&t.result){n(t.result)}else{n(null)}q.resume()},error:d})}}function v(e,t,n){if(is_function(fe.exceptionHandler)){fe.exceptionHandler.call(q,e,t)}else{q.exception(e,t);if(!n){setTimeout(function(){throw e},0)}}}var g=[];var _=1;function u(e,t,n){var r,i;g.push(_);if(e===""){}else if(!n.raw){var o={linksNoReferrer:fe.linksNoReferrer,linksNoFollow:fe.linksNoFollow,anyLinks:fe.anyLinks,char_width:re.width};e=$.terminal.normalize(e);var a=q.cols();if((strlen(text(e))>a||e.match(/\n/))&&(fe.wrap===true&&n.wrap===undefined||fe.wrap===false&&n.wrap===true)){var u=n.keepWords;var s=$.terminal.split_equal(e,a,u);for(r=0,i=s.length;r<i;++r){if(s[r]===""||s[r]==="\r"){g.push("<span></span>")}else{g.push($.terminal.format(s[r],o))}}}else{e=$.terminal.format(e,o);e.split(/\n/).forEach(function(e){g.push(e)})}}else{g.push(e)}g.push({finalize:n.finalize,index:t})}function o(e){try{var n=$.extend({exec:true,raw:false,finalize:$.noop},e.options||{});var t;var r=e.string;var i=is_function(r);if(i){r=r()}if(get_type(r)!=="string"){if(is_function(fe.parseObject)){var o=fe.parseObject(r);if(get_type(o)==="string"){t=o}}else if(r instanceof Array){t=$.terminal.columns(r,q.cols(),fe.tabs)}else{t=String(r)}}else{t=r}if(t!==""){if(t!==""){if(!n.raw){if(fe.convertLinks){t=t.replace(email_re,"[[!;;]$1]").replace(url_nf_re,"[[!;;]$1]")}if(n.formatters){try{t=$.terminal.apply_formatters(t,fe)}catch(e){v(e,"FORMATTING")}}var a=t.split(format_exec_re);t=$.map(a,function(e){if(e&&e.match(format_exec_re)&&!$.terminal.is_formatting(e)){e=e.replace(/^\[\[|\]\]$/g,"");if(n.exec){var t;if(W){W=W.command.trim()}if(t===e.trim()){q.error(U().recursiveCall)}else{$.terminal.extended_command(q,e,{invokeMethods:fe.invokeMethods})}}return""}else{return e}}).join("");if(t!==""){t=crlf($.terminal.normalize(t));t=$.terminal.encode(t,{tabs:fe.tabs})}}if(t!==""){u(t,e.index,n)}}}if(t===""&&i){u(t,e.index,n)}}catch(e){g=[];if(is_function(fe.exceptionHandler)){fe.exceptionHandler.call(q,e,"TERMINAL")}else{alert_exception("[Internal Exception(process_line)]",e)}}}function r(e){e=$.extend({},{update:false,scroll:true},e||{});if(!e.update){_e.resize(G);var t=Q.empty().detach()}var i=[];if(fe.outputLimit>=0){var n;if(fe.outputLimit===0){n=q.rows()}else{n=fe.outputLimit}pe.forEach(function(e,t){var n=e[0];var r=e[1];if(get_type(n)==="function"){n=n()}if(get_type(n)!=="string"){n=String(n)}i.push({string:n,index:t,options:r})});i=i.slice(i.length-n-1)}else{i=pe.map(function(e,t){return{string:e[0],index:t,options:e[1]}})}try{g=[];$.each(i,function(e,t){o(t)});if(!e.update){_e.before(t)}q.flush(e);B("onAfterRedraw")}catch(e){if(is_function(fe.exceptionHandler)){fe.exceptionHandler.call(q,e,"TERMINAL (redraw)")}else{alert_exception("[redraw]",e)}}}function y(){if(fe.outputLimit>=0){var e;if(fe.outputLimit===0){e=q.rows()}else{e=fe.outputLimit}var t=Q.find("> div > div");if(t.length+1>e){var n=t.length-e+1;var r=t.slice(0,n);var i=r.parent();r.remove();i.each(function(){var e=$(this);if(e.is(":empty")){e.remove()}})}}}function i(){if(fe.greetings===undefined){q.echo(q.signature,{finalize:a11y_hide,formatters:false})}else if(fe.greetings){var e=typeof fe.greetings;if(e==="string"){q.echo(fe.greetings)}else if(e==="function"){try{fe.greetings.call(q,q.echo)}catch(e){fe.greetings=null;v(e,"greetings")}}else{q.error(U().wrongGreetings)}}}function b(n){if(typeof n==="undefined"){n=q.get_command()}var e=_e.prompt(true);var t=_e.mask();switch(typeof t){case"string":n=n.replace(/./g,t);break;case"boolean":if(t){n=n.replace(/./g,fe.maskChar)}else{n=$.terminal.escape_formatting(n)}break}var r={finalize:function e(t){a11y_hide(t.addClass("command"));B("onEchoCommand",[t,n])}};if(is_function(e)){var i=e(function(e){q.echo(e+n,r)});if(i&&is_function(i.then)){i.then(function(e){if(typeof e==="string"){q.echo(e+n,r)}})}}else{q.echo(e+n,r)}}function w(){if(q.is("body")){return window.innerWidth-document.documentElement.clientWidth>0}return ke.outerWidth()!==q.outerWidth()}function C(e){var t=terminals.get()[e[0]];if(!t){throw new $.terminal.Exception(U().invalidTerminalId)}var n=e[1];if(save_state[n]){t.import_view(save_state[n])}else{change_hash=false;var r=e[2];if(r){t.exec(r).done(function(){change_hash=true;save_state[n]=t.export_view()})}}}function E(){if(change_hash){fire_hash_change=false;location.hash="#"+JSON.stringify(hash_commands);setTimeout(function(){fire_hash_change=true},100)}}var F=true;var x=[];function k(t,e,n){function r(){if(fe.historyState||fe.execHash&&n){if(!save_state.length){q.save_state()}else{q.save_state(null)}}}function i(){if(!n){change_hash=true;if(fe.historyState){q.save_state(t,false)}change_hash=l}s.resolve();B("onAfterCommand",[t])}function o(e){if(typeof e!=="undefined"){p(e)}i();q.resume()}function a(){var e=u.interpreter.call(q,t,q);if(e){q.pause(fe.softPause);if(is_function(e.done||e.then)){(e.done||e.then).call(e,o)}else{return $.when(e).done(o)}}else if(he){x.push(function(){i()})}else{i()}}if(F){F=false;r()}try{if(B("onBeforeCommand",[t])===false){return}if(!n){W=$.terminal.split_command(t)}if(!z()){if(n&&(is_function(fe.historyFilter)&&fe.historyFilter(t)||t.match(fe.historyFilter))){_e.history().append(t)}}var u=ge.top();if(!e&&fe.echoCommand){b(t)}var s=new $.Deferred;var l=change_hash;if(t.match(/^\s*login\s*$/)&&q.token(true)){if(q.level()>1){q.logout(true)}else{q.logout()}i()}else if(fe.exit&&t.match(/^\s*exit\s*$/)&&!oe){var f=q.level();if(f===1&&q.get_token()||f>1){if(q.get_token(true)){q.set_token(undefined,true)}q.pop()}i()}else if(fe.clear&&t.match(/^\s*clear\s*$/)&&!oe){q.clear();i()}else{var c=a();if(c){return c}}return s.promise()}catch(e){v(e,"USER",n);q.resume();if(n){throw e}}}function A(){if(is_function(fe.onBeforeLogout)){try{if(fe.onBeforeLogout.call(q,q)===false){return}}catch(e){fe.onBeforeLogout=$.noop;v(e,"onBeforeLogout")}}T();if(is_function(fe.onAfterLogout)){try{fe.onAfterLogout.call(q,q)}catch(e){fe.onAfterLogout=$.noop;v(e,"onAfterlogout")}}q.login(Re,true,L)}function T(){var e=q.prefix_name(true)+"_";me.remove(e+"token");me.remove(e+"login")}function S(e){var t=q.prefix_name()+"_interpreters";var n=me.get(t);if(n){n=JSON.parse(n)}else{n=[]}if($.inArray(e,n)===-1){n.push(e);me.set(t,JSON.stringify(n))}}function R(e){var n=ge.top();var t=q.prefix_name(true);if(!z()){S(t)}var r=q.login_name(true);_e.name(t+(r?"_"+r:""));if(n.prompt!==_e.prompt()){if(is_function(n.prompt)){_e.prompt(function(t){var e=n.prompt.call(q,t,q);if(e&&is_function(e.then)){e.then(function(e){if(typeof e==="string"){t(e)}})}})}else{_e.prompt(n.prompt)}}if(typeof n.history!=="undefined"){q.history().toggle(n.history)}if($.isPlainObject(n.keymap)){_e.keymap($.omap(n.keymap,function(e,t){return function(){var e=[].slice.call(arguments);try{return t.apply(q,e)}catch(e){v(e,"USER KEYMAP")}}}))}_e.set("");te.resolve();if(!e&&is_function(n.onStart)){n.onStart.call(q,q)}}function B(t,e){e=(e||[]).concat([q]);var n=ge&&ge.top();if(n&&is_function(n[t])){try{return n[t].apply(q,e)}catch(e){delete n[t];v(e,t)}}else if(is_function(fe[t])){try{return fe[t].apply(q,e)}catch(e){fe[t]=null;v(e,t)}}}function j(){var e=q.find(".cursor");if(!e.isFullyInViewport(q)){q.scrollTop(e.position().top-5);return true}}function O(){if(fire_hash_change&&fe.execHash){try{if(location.hash){var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e))}else{hash_commands=[]}if(hash_commands.length){C(hash_commands[hash_commands.length-1])}else if(save_state[0]){q.import_view(save_state[0])}}catch(e){v(e,"TERMINAL")}}}function L(){R();i();if(pe.length){q.refresh()}var e=false;if(is_function(fe.onInit)){ae=function(){e=true};try{fe.onInit.call(q,q)}catch(e){v(e,"OnInit")}finally{ae=$.noop;if(!e&&q.enabled()){q.resume()}}}if(first_instance){first_instance=false;$(window).on("hashchange",O)}}function z(){return oe||_e.mask()!==false}function P(e){var t,n=ge.top();if(is_function(n.keydown)){t=n.keydown.call(q,e,q);if(t!==undefined){return t}}else if(is_function(fe.keydown)){t=fe.keydown.call(q,e,q);if(t!==undefined){return t}}}var I={"CTRL+D":function(e,t){if(!oe){if(_e.get()===""){if(ge.size()>1||is_function(Re)){q.pop("")}else{q.resume();q.echo("")}}else{t()}}return false},"CTRL+C":function(){if(get_selected_text()===""){var e=q.get_command();var t=q.get_position();e=e.slice(0,t)+"^C"+e.slice(t+2);b(e);q.set_command("")}},"CTRL+L":function(){q.clear()},TAB:function(e,t){var n=ge.top(),r,i;if(typeof n.caseSensitiveAutocomplete!=="undefined"){i=n.caseSensitiveAutocomplete}else{i=fe.caseSensitiveAutocomplete}if(fe.completion&&get_type(fe.completion)!=="boolean"&&n.completion===undefined){r=fe.completion}else{r=n.completion}if(r==="settings"){r=fe.completion}function o(e){q.complete(e,{echo:true,word:fe.wordAutocomplete,escape:fe.completionEscape,caseSensitive:i,doubleTab:fe.doubleTab})}if(r){switch(get_type(r)){case"function":var a=q.before_cursor(fe.wordAutocomplete);if(r.length===3){var u=new Error(U().comletionParameters);v(u,"USER");return false}var s=r.call(q,a,o);if(s&&is_function(s.then)){s.then(o)}break;case"array":o(r);break;default:throw new $.terminal.Exception(U().invalidCompletion)}}else{t()}return false},"CTRL+V":function(e,t){t(e);q.oneTime(200,function(){q.scroll_to_bottom()});return true},"CTRL+TAB":function(){if(terminals.length()>1){q.focus(false);return false}},PAGEDOWN:function(){q.scroll(q.height())},PAGEUP:function(){q.scroll(-q.height())}};function N(t){var e,n;if(q.enabled()){if(!q.paused()){e=P(t);if(e!==undefined){return e}if(t.which!==9){J=0}}else{if(!fe.pauseEvents){e=P(t);if(e!==undefined){return e}}if(t.which===68&&t.ctrlKey){if(fe.pauseEvents){e=P(t);if(e!==undefined){return e}}if(requests.length){for(n=requests.length;n--;){var r=requests[n];if(r.readyState!==4){try{r.abort()}catch(e){if(is_function(fe.exceptionHandler)){fe.exceptionHandler.call(q,t,"AJAX ABORT")}else{q.error(U().ajaxAbortError)}}}}requests=[]}q.resume()}return false}}}function H(e){var t=ge.top();if(De&&(!he||!fe.pauseEvents)){if(is_function(t.keypress)){return t.keypress.call(q,e,q)}else if(is_function(fe.keypress)){return fe.keypress.call(q,e,q)}}}function M(t){return function(e){t.add(e)}}function U(){return $.extend({},$.terminal.defaults.strings,fe&&fe.strings||{})}var q=this;if(q.is("body,html")){q=$("<div/>").appendTo("body");$("body").addClass("full-screen-terminal")}if(this.length>1){return this.each(function(){$.fn.terminal.call($(this),e,$.extend({name:q.selector},t))})}if(q.data("terminal")){return q.data("terminal")}if(q.length===0){var K=sprintf(U().invalidSelector);throw new $.terminal.Exception(K)}var W;var J=0;var Q;var Y=terminals.length();var G;var V;var X;var Z=new Stack;var ee=new DelayQueue;var te=new DelayQueue;var ne=M(te);var re=get_char_size(q);var ie=M(ee);var oe=false;var ae=$.noop;var ue,se;var le=[];var fe=$.extend({},$.terminal.defaults,{name:q.selector,exit:!!(t&&t.login||!t)},t||{});delete fe.formatters;var ce=false;var pe=[];var me=new n(fe.memory);var De=fe.enabled;var de=false;var he=false;var ve=true;var ge;var _e;var ye;var be;var we;$.extend(q,$.omap({id:function(){return Y},clear:function(){pe=[];Q.html("");B("onClear");q.attr({scrollTop:0});return q},export_view:function(){var e=B("onExport");e=e||{};return $.extend({},{focus:De,mask:_e.mask(),prompt:q.get_prompt(),command:q.get_command(),position:_e.position(),lines:clone(pe),interpreters:ge.clone(),history:_e.history().data},e)},import_view:function(t){if(oe){throw new Error(sprintf(U().notWhileLogin,"import_view"))}B("onImport",[t]);ne(function e(){q.set_prompt(t.prompt);q.set_command(t.command);_e.position(t.position);_e.mask(t.mask);if(t.focus){q.focus()}pe=clone(t.lines).filter(function(e){return e[0]});if(t.interpreters instanceof Stack){ge=t.interpreters}if(fe.importHistory){_e.history().set(t.history)}r()});return q},save_state:function(e,t,n){if(typeof n!=="undefined"){save_state[n]=q.export_view()}else{save_state.push(q.export_view())}if(!$.isArray(hash_commands)){hash_commands=[]}if(e!==undefined&&!t){var r=[Y,save_state.length-1,e];hash_commands.push(r);E()}return q},exec:function(n,r,e){var i=e||new $.Deferred;ie(function e(){if($.isArray(n)){(function e(){var t=n.shift();if(t){q.exec(t,r).done(e)}else{i.resolve()}})()}else if(he){le.push([n,r,i])}else{var t=k(n,r,true);if(t&&(t.done||t.then)){(t.done||t.then).call(t,function(){i.resolve(q)})}}});return i.promise()},autologin:function(e,t,n){q.trigger("terminal.autologin",[e,t,n]);return q},login:function(r,i,o,a){Z.push([].slice.call(arguments));if(oe){throw new Error(sprintf(U().notWhileLogin,"login"))}if(!is_function(r)){throw new Error(U().loginIsNotAFunction)}oe=true;if(q.token()&&q.level()===1&&!ve){oe=false;q.logout(true)}else if(q.token(true)&&q.login_name(true)){oe=false;if(is_function(o)){o()}return q}if(fe.history){_e.history().disable()}var u=q.level();function s(e,t,n){if(t){while(q.level()>u){q.pop(undefined,true)}if(fe.history){_e.history().enable()}var r=q.prefix_name(true)+"_";me.set(r+"token",t);me.set(r+"login",e);oe=false;if(is_function(o)){o()}}else{if(i){if(!n){q.error(U().wrongPasswordTryAgain)}q.pop(undefined,true).set_mask(false)}else{oe=false;if(!n){q.error(U().wrongPassword)}q.pop(undefined,true).pop(undefined,true)}if(is_function(a)){a()}}q.off("terminal.autologin")}q.on("terminal.autologin",function(e,t,n,r){s(t,n,r)});q.push(function(n){q.set_mask(fe.maskChar).push(function(e){try{var t=r.call(q,n,e,function(e,t){s(n,e,t)});if(t&&is_function(t.then)){q.pause();t.then(function(e){s(n,e);q.resume()})}}catch(e){v(e,"AUTH")}},{prompt:U().password+": ",name:"password"})},{prompt:U().login+": ",name:"login"});return q},settings:function(){return fe},before_cursor:function(e){var t=_e.position();var n=_e.get().slice(0,t);var r=n.split(" ");var i;if(e){if(r.length===1){i=r[0]}else{var o=n.match(/(\\?")/g);var a=o?o.filter(function(e){return!e.match(/^\\/)}).length:0;o=n.match(/'/g);var u=o?o.length:0;if(u%2===1){i=n.match(/('[^']*)$/)[0]}else if(a%2===1){i=n.match(/("(?:[^"]|\\")*)$/)[0]}else{i=r[r.length-1];for(Te=r.length-1;Te>0;Te--){var s=r[Te-1];if(s[s.length-1]==="\\"){i=r[Te-1]+" "+i}else{break}}}}}else{i=n}return i},complete:function(r,i){i=$.extend({word:true,echo:false,escape:true,caseSensitive:true,doubleTab:null},i||{});var o=i.caseSensitive;var a=q.before_cursor(i.word).replace(/\\"/g,'"');var s=false;if(i.word){if(a.match(/^"/)){s='"'}else if(a.match(/^'/)){s="'"}if(s){a=a.replace(/^["']/,"")}}r=r.slice();if(fe.clear&&$.inArray("clear",r)===-1){r.push("clear")}if(fe.exit&&$.inArray("exit",r)===-1){r.push("exit")}if(J%2===0){X=q.before_cursor(i.word)}else{var e=q.before_cursor(i.word);if(e!==X){return}}var t=$.terminal.escape_regex(a);if(i.escape){t=t.replace(/(\\+)(["'() ])/g,function(e,t,n){if(n.match(/[()]/)){return t+"\\?\\"+n}else{return t+"?"+n}})}function n(){var e=[];for(var t=r.length;t--;){if(l.test(r[t])){var n=r[t];if(s==='"'){n=n.replace(/"/g,'\\"')}if(!s&&i.escape){n=n.replace(/(["'() ])/g,"\\$1")}if(!o&&same_case(n)){if(a.toLowerCase()===a){n=n.toLowerCase()}else if(a.toUpperCase()===a){n=n.toUpperCase()}}e.push(n)}}return e}var u=o?"":"i";var l=new RegExp("^"+t,u);var f=n();function c(e,t){var n=q.get_command();var r=q.get_position();var i=new RegExp("^"+e,"i");var o=n.slice(0,r);var a=n.slice(r);var u=t.replace(i,"")+(s||"");q.set_command(o+u+a);q.set_position((o+u).length)}if(f.length===1){if(i.escape){c(t,f[0])}else{q.insert(f[0].replace(l,"")+(s||""))}X=q.before_cursor(i.word);return true}else if(f.length>1){if(++J>=2){J=0;if(i.echo){if(is_function(i.doubleTab)){var p=i.doubleTab.call(q,a,f,b);if(typeof p==="undefined"){return true}else{return p}}else if(i.doubleTab!==false){b();var m=f.slice().reverse().join("\t\t");q.echo($.terminal.escape_brackets(m),{keepWords:true,formatters:false})}return true}}else{var D=common_string(a,f,o);if(D){c(a,D);X=q.before_cursor(i.word);return true}}}},commands:function(){return ge.top().interpreter},set_interpreter:function(e,t){function n(){q.pause(fe.softPause);s(e,t,function(e){q.resume();var t=ge.top();$.extend(t,e);R(true)})}if(is_function(t)){q.login(t,true,n)}else if(get_type(e)==="string"&&t){q.login(l(e,t),true,n)}else{n()}return q},greetings:function(){i();return q},paused:function(){return he},pause:function(t){ie(function e(){ae();he=true;_e.disable(t||is_android);if(!t){_e.find(".prompt").hidden()}B("onPause")});return q},resume:function(){ie(function e(){he=false;if(De&&terminals.front()===q){_e.enable()}_e.find(".prompt").visible();var t=le;le=[];for(var n=0;n<t.length;++n){q.exec.apply(q,t[n])}q.trigger("resume");var r=x.shift();if(r){r()}q.scroll_to_bottom();B("onResume")});return q},cols:function(){if(fe.numChars){return fe.numChars}if(typeof G==="undefined"||G===1e3){G=get_num_chars(q,re)}return G},rows:function(){if(fe.numRows){return fe.numRows}if(typeof V==="undefined"){V=get_num_rows(q,re)}return V},history:function(){return _e.history()},history_state:function(e){function t(){fe.historyState=true;if(!save_state.length){q.save_state()}else if(terminals.length()>1){q.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(t,0)}else{setImmediate(t)}}else{fe.historyState=false}return q},clear_history_state:function(){hash_commands=[];save_state=[];return q},next:function(){if(terminals.length()===1){return q}else{terminals.front().disable();var e=terminals.rotate().enable();var t=e.offset().top-50;$("html,body").animate({scrollTop:t},500);try{trigger_terminal_change(e)}catch(e){v(e,"onTerminalChange")}return e}},focus:function(n,r){ie(function e(){if(terminals.length()===1){if(n===false){q.disable(r)}else{q.enable(r)}}else if(n===false){q.next()}else{var t=terminals.front();if(t!==q){terminals.forEach(function(e){if(e!==q&&e.enabled()){e.disable(r)}});if(!r){try{trigger_terminal_change(q)}catch(e){v(e,"onTerminalChange")}}}terminals.set(q);q.enable(r)}});return q},freeze:function(t){ne(function e(){if(t){q.disable();de=true}else{de=false;q.enable()}});return q},frozen:function(){return de},enable:function(n){if(!De&&!de){if(G===undefined){q.resize()}ie(function e(){var t;if(!n&&!De){B("onFocus")}if(!n&&t===undefined||n){De=true;if(!q.paused()){_e.enable()}}})}return q},disable:function(n){ie(function e(){var t;if(!n&&De){t=B("onBlur")}if(!n&&t===undefined||n){De=false;_e.disable()}});return q},enabled:function(){return De},signature:function(){var e=q.cols();for(var t=signatures.length;t--;){var n=signatures[t].map(function(e){return e.length});if(Math.max.apply(null,n)<=e){return signatures[t].join("\n")+"\n"}}return""},version:function(){return $.terminal.version},cmd:function(){return _e},get_command:function(){return _e.get()},set_command:function(t,n){ne(function e(){if(typeof t!=="string"){t=JSON.stringify(t)}_e.set(t,undefined,n)});return q},set_position:function(t,n){ne(function e(){_e.position(t,n)});return q},get_position:function(){return _e.position()},insert:function(n,r){if(typeof n==="string"){ne(function e(){var t=q.is_bottom();_e.insert(n,r);if(fe.scrollOnEcho||t){q.scroll_to_bottom()}});return q}else{throw new Error(sprintf(U().notAString,"insert"))}},set_prompt:function(t){ne(function e(){if(is_function(t)){_e.prompt(function(e){t.call(q,e,q)})}else{_e.prompt(t)}ge.top().prompt=t});return q},get_prompt:function(){return ge.top().prompt},set_mask:function(t){ne(function e(){_e.mask(t===true?fe.maskChar:t)});return q},get_output:function(e){if(e){return pe}else{return $.map(pe,function(e){return is_function(e[0])?e[0]():e[0]}).join("\n")}},resize:function(e,t){if(!q.is(":visible")){q.stopTime("resize");q.oneTime(500,"resize",function(){q.resize(e,t)})}else{if(e&&t){q.width(e);q.height(t)}e=q.width();t=q.height();if(typeof fe.numChars!=="undefined"||typeof fe.numRows!=="undefined"){_e.resize(fe.numChars);q.refresh();return}var n=get_num_chars(q,re);var r=get_num_rows(q,re);if(n!==G||r!==V){G=n;V=r;_e.resize(G);q.refresh();B("onResize")}}return q},refresh:function(){if(re.width!==0){q[0].style.setProperty("--char-width",re.width)}r({scroll:false,update:true});return q},flush:function(i){i=$.extend({},{update:false,scroll:true},i||{});try{var e=q.is_bottom();var o;$.each(g,function(e,t){if(t===_){o=$("<div></div>")}else if($.isPlainObject(t)&&is_function(t.finalize)){if(i.update){var n="> div[data-index="+t.index+"]";var r=Q.find(n);if(r.html()!==o.html()){r.replaceWith(o)}}else{o.appendTo(Q)}t.finalize(o.attr("data-index",t.index))}else{$("<div/>").html(t).appendTo(o).width("100%")}});y();B("onFlush");if(fe.scrollOnEcho&&i.scroll||e){q.scroll_to_bottom()}g=[]}catch(e){if(is_function(fe.exceptionHandler)){try{fe.exceptionHandler.call(q,e,"TERMINAL (Flush)")}catch(e){fe.exceptionHandler=$.noop;alert_exception("[exceptionHandler]",e)}}else{alert_exception("[Flush]",e)}}return q},update:function(t,n,r){ne(function e(){if(t<0){t=pe.length+t}if(!pe[t]){q.error("Invalid line number "+t)}else if(n===null){pe.splice(t,1);Q.find("[data-index="+t+"]").remove()}else{pe[t][0]=n;if(r){pe[t][1]=r}o({string:n,index:t,options:r});q.flush({scroll:false,update:true})}});return q},remove_line:function(e){return q.update(e,null)},last_index:function(){return pe.length-1},echo:function(e,t){function n(e){try{var n=$.extend({flush:true,raw:fe.raw,finalize:$.noop,keepWords:false,formatters:true},t||{});(function(t){n.finalize=function(e){if(n.raw){e.addClass("raw")}try{if(is_function(t)){t(e)}}catch(e){v(e,"USER:echo(finalize)");t=null}}})(n.finalize);if(n.flush){if(g.length){q.flush()}g=[]}if(typeof e==="function"){e=e.bind(q)}o({string:e,options:n,index:pe.length});pe.push([e,$.extend(n,{exec:false})]);if(n.flush){q.flush()}}catch(e){if(is_function(fe.exceptionHandler)){fe.exceptionHandler.call(q,e,"TERMINAL (echo)")}else{alert_exception("[Terminal.echo]",e)}}}if(e!==undefined&&is_function(e.then)){$.when(e).done(n)}else{n(e)}return q},error:function(e,t){t=$.extend({},t,{raw:false,formatters:false});function n(e){if(typeof e!=="string"){e=String(e)}var t=$.terminal.escape_brackets(e).replace(/\\$/,"\").replace(url_re,"]$1[[;;;error]");return"[[;;;error]"+t+"]"}if(typeof e==="function"){return q.echo(function(){return n(e.call(q))},t)}if(e&&e.then){e.then(function(e){q.echo(n(e))});return q}return q.echo(n(e),t)},exception:function(r,e){var t=exception_message(r);if(e){t="["+e+"]: "+t}if(t){q.error(t,{finalize:function(e){e.addClass("exception message")},keepWords:true})}if(typeof r.fileName==="string"){q.pause(fe.softPause);$.get(r.fileName,function(e){var t=r.lineNumber-1;var n=e.split("\n")[t];if(n){q.error("["+r.lineNumber+"]: "+n)}q.resume()},"text")}if(r.stack){var n=$.terminal.escape_brackets(r.stack);q.echo(n.split(/\n/g).map(function(e){return"[[;;;error]"+e.replace(url_re,function(e){return"]"+e+"[[;;;error]"})+"]"}).join("\n"),{finalize:function(e){e.addClass("exception stack-trace")},formatters:false})}return q},scroll:function(e){var t;e=Math.round(e);if(q.prop){if(e>q.prop("scrollTop")&&e>0){q.prop("scrollTop",0)}t=q.prop("scrollTop");q.scrollTop(t+e)}else{if(e>q.attr("scrollTop")&&e>0){q.attr("scrollTop",0)}t=q.attr("scrollTop");q.scrollTop(t+e)}return q},logout:function(n){if(oe){throw new Error(sprintf(U().notWhileLogin,"logout"))}ne(function e(){if(n){var t=Z.pop();q.set_token(undefined,true);q.login.apply(q,t)}else if(ge.size()===1&&q.token()){q.logout(true)}else{while(ge.size()>1){if(q.token()){q.logout(true).pop().pop()}else{q.pop()}}}});return q},token:function(e){return me.get(q.prefix_name(e)+"_token")},set_token:function(e,t){var n=q.prefix_name(t)+"_token";if(typeof e==="undefined"){me.remove(n)}else{me.set(n,e)}return q},get_token:function(e){return q.token(e)},login_name:function(e){return me.get(q.prefix_name(e)+"_login")},name:function(){return ge.top().name},prefix_name:function(e){var t=(fe.name?fe.name+"_":"")+Y;if(e&&ge.size()>1){var n=ge.map(function(e){return e.name||""}).slice(1).join("_");if(n){t+="_"+n}}return t},read:function(e,t,n){var r=jQuery.Deferred();var i=false;q.push(function(e){i=true;r.resolve(e);if(is_function(t)){t(e)}q.pop();if(fe.history){_e.history().enable()}},{name:"read",history:false,prompt:e||"",onExit:function(){if(!i){r.reject();if(is_function(n)){n()}}}});if(fe.history){_e.history().disable()}return r.promise()},push:function(a,u){ie(function e(){u=u||{};var t={infiniteLogin:false};var r=$.extend({},t,u);if(!r.name&&W){r.name=W.name}if(r.prompt===undefined){r.prompt=(r.name||">")+" "}var n=ge.top();if(n){n.mask=_e.mask()}var i=he;function o(){B("onPush",[n,ge.top()]);R()}s(a,u.login,function(e){ge.push($.extend({},e,r));if(r.completion===true){if($.isArray(e.completion)){ge.top().completion=e.completion}else if(!e.completion){ge.top().completion=false}}if(r.login){var t;var n=get_type(r.login);if(n==="function"){t=r.infiniteLogin?$.noop:q.pop;q.login(r.login,r.infiniteLogin,o,t)}else if(get_type(a)==="string"&&n==="string"||n==="boolean"){t=r.infiniteLogin?$.noop:q.pop;q.login(l(a,r.login),r.infiniteLogin,o,t)}}else{o()}if(!i&&q.enabled()){q.resume()}})});return q},pop:function(e,t){if(e!==undefined){b(e)}var n=q.token(true);var r;if(ge.size()===1){r=ge.top();if(fe.login){if(!t){B("onPop",[r,null])}A();B("onExit")}else{q.error(U().canExitError)}}else{if(n){T()}var i=ge.pop();r=ge.top();R();if(!t){B("onPop",[i,r])}if(oe&&q.get_prompt()!==U().login+": "){oe=false}if(is_function(i.onExit)){try{i.onExit.call(q,q)}catch(e){i.onExit=$.noop;v(e,"onExit")}}q.set_mask(r.mask)}return q},option:function(e,t){if(typeof t==="undefined"){if(typeof e==="string"){return fe[e]}else if(typeof e==="object"){$.each(e,function(e,t){fe[e]=t})}}else{fe[e]=t;if(e.match(/^num(Chars|Rows)$/)){r()}}return q},invoke_key:function(e){var t=e.toUpperCase().split("+");var n=t.pop();var r=t.indexOf("CTRL")!==-1;var i=t.indexOf("SHIFT")!==-1;var o=t.indexOf("ALT")!==-1;var a=t.indexOf("META")!==-1;var u=$.Event("keydown",{ctrlKey:r,shiftKey:i,altKey:o,metaKey:a,which:Fe[n],key:n});var s=$(document.documentElement||window);s.trigger(u);u=$.Event("keypress");u.key=n;u.which=u.keyCode=0;s.trigger(u);return q},keymap:function(e,n){if(arguments.length===0){return _e.keymap()}if(typeof n==="undefined"){if(typeof e==="string"){return _e.keymap(e)}else if($.isPlainObject(e)){e=$.omap(e||{},function(n,r){if(!Le[n]){return r.bind(q)}return function(e,t){return r.call(q,e,function(){return Le[n](e,t)})}});_e.keymap(e)}}else if(typeof n==="function"){var r=e;if(!Le[r]){_e.keymap(r,n.bind(q))}else{_e.keymap(r,function(e,t){return n.call(q,e,function(){return Le[r](e,t)})})}}},level:function(){return ge.size()},reset:function(){ne(function e(){q.clear();while(ge.size()>1){ge.pop()}L()});return q},purge:function(){ne(function e(){var t=q.prefix_name()+"_";var n=me.get(t+"interpreters");if(n){$.each(JSON.parse(n),function(e,t){me.remove(t+"_commands");me.remove(t+"_token");me.remove(t+"_login")})}_e.purge();me.remove(t+"interpreters")});return q},destroy:function(){ne(function e(){_e.destroy().remove();q.resizer("unbind");$e.resizer("unbind").remove();$(document).unbind(".terminal_"+q.id());$(window).unbind(".terminal_"+q.id());q.unbind("click wheel mousewheel mousedown mouseup");q.removeData("terminal").removeClass("terminal").unbind(".terminal");if(fe.width){q.css("width","")}if(fe.height){q.css("height","")}$(window).off("blur",je).off("focus",Be);q.find(".terminal-fill").remove();q.stopTime();terminals.remove(Y);if(be){if(be.unobserve){be.unobserve(q[0])}else{clearInterval(be)}}if(we){we.disconnect()}if(!terminals.length()){$(window).off("hashchange")}Q.remove();xe.remove();ce=true});return q},scroll_to_bottom:function(){var e;if(q.prop){e=q.prop("scrollHeight")}else{e=q.attr("scrollHeight")}q.scrollTop(e);return q},is_bottom:function(){if(fe.scrollBottomOffset===-1){return false}else{var e,t,n;e=q[0].scrollHeight;t=q.scrollTop();n=q.outerHeight();var r=e-fe.scrollBottomOffset;return t+n>r}}},function(t,e){return function(){if(ce){if(!fe.exceptionHandler){throw new $.terminal.Exception(U().defunctTerminal)}}try{return e.apply(q,[].slice.apply(arguments))}catch(e){if(t!=="exec"&&t!=="resume"){v(e,e.type||"TERMINAL",true)}if(!fe.exceptionHandler){throw e}}}}));var Ce={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",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",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"};for(Te=1;Te<25;Te++){Ce[111+Te]="F"+Te}var Ee="";for(Te=65;Te<91;Te++){Ee=String.fromCharCode(Te);Ce[Te]=[Ee.toLowerCase(),Ee.toUpperCase()]}var Fe={};Object.keys(Ce).forEach(function(t){if(Ce[t]instanceof Array){Ce[t].forEach(function(e){Fe[e.toUpperCase()]=t})}else{Fe[Ce[t].toUpperCase()]=t}});if(fe.ignoreSystemDescribe===true){fe.describe=false}if(fe.width){q.width(fe.width)}if(fe.height){q.height(fe.height)}$(document).bind("ajaxSend.terminal_"+q.id(),function(e,t){requests.push(t)});var xe=$('<div class="terminal-wrapper"/>').appendTo(q);var $e=$('<div class="font"> </div>').appendTo(q);var ke=$('<div class="terminal-fill"/>').appendTo(q);Q=$("<div>").addClass("terminal-output").attr("role","log").appendTo(xe);q.addClass("terminal");if(fe.login&&B("onBeforeLogin")===false){ve=false}var Ae;if(typeof e==="string"){Ae=e}else if(e instanceof Array){for(var Te=0,Se=e.length;Te<Se;++Te){if(typeof e[Te]==="string"){Ae=e[Te];break}}}var Re;if(is_function(fe.login)){Re=fe.login}else if(Ae&&(typeof fe.login==="string"||fe.login===true)){Re=l(Ae,fe.login)}terminals.append(q);function Be(){if(ye){q.focus()}}function je(){ye=De;q.disable().find(".cmd textarea").trigger("blur",[true])}function Oe(e){e=e.originalEvent;function t(e,t){return e.type.indexOf(t)!==-1}if(e.clipboardData){if(q.enabled()){var n=e.clipboardData.items;if(n){for(var r=0;r<n.length;r++){if(t(n[r],"image")&&fe.pasteImage){var i=n[r].getAsFile();var o=window.URL||window.webkitURL;var a=o.createObjectURL(i);q.echo('<img src="'+a+'"/>',{raw:true})}else if(t(n[r],"text/plain")){n[r].getAsString(q.insert)}}}else if(e.clipboardData.getData){var u=e.clipboardData.getData("text/plain");q.insert(u)}return false}}}$(document).on("paste.terminal_"+q.id(),Oe);var Le=$.extend({},I,$.omap(fe.keymap||{},function(n,r){if(!I[n]){return r.bind(q)}return function(e,t){return r.call(q,e,function(){return I[n](e,t)})}}));s(e,fe.login,function(e){if(fe.completion&&typeof fe.completion!=="boolean"||!fe.completion){e.completion="settings"}ge=new Stack($.extend({},fe.extra,{name:fe.name,prompt:fe.prompt,keypress:fe.keypress,keydown:fe.keydown,resize:fe.onResize,greetings:fe.greetings,mousewheel:fe.mousewheel,history:fe.history,keymap:Le},e));_e=$("<div/>").appendTo(xe).cmd({tabindex:fe.tabindex,prompt:fe.prompt,history:fe.memory?"memory":fe.history,historyFilter:fe.historyFilter,historySize:fe.historySize,caseSensitiveSearch:fe.caseSensitiveSearch,width:"100%",enabled:false,char_width:re.width,keydown:N,keymap:Le,clickTimeout:fe.clickTimeout,holdTimeout:fe.holdTimeout,holdRepeatTimeout:fe.holdRepeatTimeout,repeatTimeoutKeys:fe.repeatTimeoutKeys,keypress:H,tabs:fe.tabs,onPositionChange:function(){var e=[].slice.call(arguments);j();B("onPositionChange",e)},onCommandChange:function(e){if(ue!==ke.width()){q.resizer()}B("onCommandChange",[e]);if(!j()){q.scroll_to_bottom()}},commands:k});function t(e){e=e.originalEvent;if(e){var t=document.elementFromPoint(e.clientX,e.clientY);if(!$(t).closest(".terminal").length&&q.enabled()){q.disable()}}}q.oneTime(100,function(){$(document).bind("click.terminal_"+q.id(),t).bind("contextmenu.terminal_"+q.id(),t)});var n=$(window);document.addEventListener("resume",function(){q.disable()});if(is_mobile){q.click(function(){if(!de){if(!q.enabled()){q.focus();_e.enable()}else{q.disable()}}})}else{n.on("focus.terminal_"+q.id(),Be).on("blur.terminal_"+q.id(),je);(function(){var t=0;var n;var r="click_"+q.id();var i=q.find(".cmd textarea");function o(){if(n.is(".terminal")||n.is(".terminal-wrapper")){var e=q.get_command().length;q.set_position(e)}else if(n.closest(".prompt").length){q.set_position(0)}if(!i.is(":focus")){i.focus()}a()}function a(){t=0;n=null}var u=".terminal-output textarea,"+".terminal-output input";var e;q.find(".cmd textarea").on("focus",function(){if(typeof e!=="undefined"){q.scrollTop(e)}}).on("blur",function(){e=q.scrollTop()});q.mousedown(function(e){if(!scrollbar_event(e,ke)){n=$(e.target)}}).mouseup(function(){if(n&&n.closest(u).length){if(De){q.disable()}}else if(get_selected_text()===""&&n){if(++t===1){if(!de){if(!De){q.focus()}else{var e=fe.clickTimeout;q.oneTime(e,r,o);return}}}else{q.stopTime(r)}}a()}).dblclick(function(){a();q.stopTime(r)})})();(function(){var n=q.find(".cmd textarea");q.on("contextmenu.terminal",function(e){if(get_selected_text()===""){if(!$(e.target).is("img,value,audio,object,canvas,a")){if(!q.enabled()){q.enable()}var t=_e.offset();n.css({left:e.pageX-t.left-20,top:e.pageY-t.top-20,width:"5em",height:"4em"});if(!n.is(":focus")){n.focus()}q.stopTime("textarea");q.oneTime(100,"textarea",function(){var e={left:"",top:"",width:"",height:""};if(!is_css_variables_supported){var t=q.find(".cmd .cursor-line").prevUntil(".prompt").length;e.top=t*14+"px"}n.css(e)});q.stopTime("selection");q.everyTime(20,"selection",function(){if(n[0].selection!==n[0].value){if(get_textarea_selection(n[0])){clear_textarea_selection(n[0]);select(q.find(".terminal-output")[0],q.find(".cmd div:last-of-type")[0]);q.stopTime("selection")}}})}}})})()}q.on("click","a",function(e){var t=$(this);if(t.closest(".exception").length){var n=t.attr("href");if(n.match(/:[0-9]+$/)){e.preventDefault();c(n)}}if(De){q.find(".cmd textarea").focus()}});function r(){var e=re.width;re=get_char_size(q);if(e!==re.width){_e.option("char_width",re.width).refresh()}}i();function i(){if(q.is(":visible")){var e=ke.width();var t=ke.height();if(se!==t||ue!==e){q.resize()}se=t;ue=e}}function o(){q.resizer("unbind").resizer(i);$e.resizer("unbind").resizer(function(){r();q.resize()})}if(q.is(":visible")){o()}function a(){if(be){if(be.unobserve){be.unobserve(q[0])}else{clearInterval(be)}}var e=q.enabled();var t=q.is(":visible");if(t){o()}function n(){if(q.is(":visible")&&!t){t=true;o();r();i();if(e){q.enable()}}else if(t&&!q.is(":visible")){t=false;e=$.terminal.active()===q&&q.enabled();q.disable()}}if(window.IntersectionObserver){be=new IntersectionObserver(n,{root:document.body});be.observe(q[0])}else{be=setInterval(n,400)}}var u=!!q.closest("body").length;var s=window.MutationObserver||window.WebKitMutationObserver;if(s){we=new s(function(){if(q.closest("body").length){if(!u){q.scroll_to_bottom();if(window.IntersectionObserver){a()}i()}u=true}else if(u){u=false}});we.observe(document.body,{childList:true})}if(u){a()}ee.resolve();if(De&&q.is(":visible")&&!is_mobile){q.focus(undefined,true)}else{q.disable()}if(is_function(Re)){q.login(Re,true,L)}else{L()}function l(e){var t=terminals.get()[e[0]];if(t&&Y===t.id()){if(!e[2]){n.resolve();return n.promise()}else if(he){var n=$.Deferred();x.push(function(){return t.exec(e[2]).done(function(){t.save_state(e[2],true,e[1]);n.resolve()})});return n.promise()}else{return t.exec(e[2]).done(function(){t.save_state(e[2],true,e[1])})}}}if(fe.execHash){if(location.hash){setTimeout(function(){try{var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e));var n=0;(function e(){var t=hash_commands[n++];if(t){l(t).done(e)}else{change_hash=true}})()}catch(e){}})}else{change_hash=true}}else{change_hash=true}(function(){var i=false;$(document).bind("keydown.terminal_"+q.id(),function(e){if(e.shiftKey){i=true}}).bind("keyup.terminal_"+q.id(),function(e){if(e.shiftKey||e.which===16){i=false}});function n(e,t){if(!i){var n=ge.top();var r;if(is_function(n.mousewheel)){r=n.mousewheel(e,t,q)}else if(is_function(fe.mousewheel)){r=fe.mousewheel(e,t,q)}if(r===true){return}if(w()||r===false){e.stopPropagation();e.preventDefault()}if(r===false){return false}if(t>0){q.scroll(-40)}else{q.scroll(40)}}}if($.event.special.mousewheel){q.on("mousewheel",n)}else{var r;var e=document.createElement("div");if("onwheel"in e){r="wheel"}else if(document.onmousewheel!==undefined){r="mousewheel"}else{r="DOMMouseScroll"}e=null;q.on(r,function(e){var t;if(r==="mousewheel"){t=-1/40*e.originalEvent.wheelDelta}else{t=e.originalEvent.deltaY||e.originalEvent.detail}n(e,-t)})}})()});q.data("terminal",q);return q}});
|
|
//# sourceMappingURL=jquery.terminal.min.js.map
|