/**@license
 *       __ _____                     ________                              __
 *      / // _  /__ __ _____ ___ __ _/__  ___/__ ___ ______ __ __  __ ___  / /
 *  __ / // // // // // _  // _// // / / // _  // _//     // //  \/ // _ \/ /
 * /  / // // // // // ___// / / // / / // ___// / / / / // // /\  // // / /__
 * \___//____ \\___//____//_/ _\_  / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
 *           \/              /____/                              version 2.18.2
 *
 * This file is part of jQuery Terminal. https://terminal.jcubic.pl
 *
 * Copyright (c) 2010-2020 Jakub T. Jankiewicz <https://jcubic.pl/m>e
 * 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
 *
 * debounce function from Lodash
 * Copyright JS Foundation and other contributors <https://js.foundation/>
 * The MIT License
 *
 * emoji regex v7.0.1 by Mathias Bynens
 * MIT license
 *
 * broken image by Sophia Bai from the Noun Project (CC-BY)
 *
 * Date: Mon, 24 Aug 2020 17:56:04 +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="",a,o=[],u,s,l,f,c,p;for(u=0;u<r;u++){i=d(e[u]);if(i==="string"){o.push(e[u])}else if(i==="array"){l=e[u];if(l[2]){a=t[n];for(s=0;s<l[2].length;s++){if(!a.hasOwnProperty(l[2][s])){throw m('[sprintf] property "%s" does not exist',l[2][s])}a=a[l[2][s]]}}else if(l[1]){a=t[l[1]]}else{a=t[n++]}if(/[^s]/.test(l[8])&&d(a)!=="number"){throw m("[sprintf] expecting number but found %s",d(a))}switch(l[8]){case"b":a=a.toString(2);break;case"c":a=String.fromCharCode(a);break;case"d":a=parseInt(a,10);break;case"e":a=l[7]?a.toExponential(l[7]):a.toExponential();break;case"f":a=l[7]?parseFloat(a).toFixed(l[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=String(a))&&l[7]?a.slice(0,l[7]):a;break;case"u":a=a>>>0;break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase();break}a=/[def]/.test(l[8])&&l[3]&&a>=0?" +"+a:a;c=l[4]?l[4]==="0"?"0":l[4].charAt(1):" ";p=l[6]-String(a).length;f=l[6]?h(c,p):"";o.push(l[5]?a+f:f+a)}}return o.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 a=[],o=n[2],u=[];if((u=/^([a-z_][a-z_\d]*)/i.exec(o))!==null){a.push(u[1]);while((o=o.slice(u[0].length))!==""){if((u=/^\.([a-z_][a-z_\d]*)/i.exec(o))!==null){a.push(u[1])}else if((u=/^\[(\d+)\]/.exec(o))!==null){a.push(u[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}n[2]=a}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 h(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 n=typeof window!=="undefined"?window:global;if(typeof define==="function"&&define.amd){define(["jquery","wcwidth"],function(e,t){r(e,t,n);return e})}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,e);return t}}else{r(n.jQuery,n.wcwidth,n)}})(function($,wcwidth,root,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)};if(!("clear"in Map.prototype)){Map.prototype.clear=function(){this.forEach(function(e,t,n){n.delete(t)})}}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 a(e){return localStorage[e]}function o(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:a,remove:u}})}else{if(n){localStorage=window.localStorage}$.extend({Storage:{set:n?r:i,get:n?a:o,remove:n?u:s}})}})();var debounce=function(){var E="Expected a function";function $(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function F(){return Date.now()}return function e(r,i,t){var n=Math.max,a=Math.min;var o,u,s,l,f,c,p=0,m=false,d=false,h=true;if(typeof r!="function"){throw new TypeError(E)}i=i||0;if($(t)){m=!!t.leading;d="maxWait"in t;s=d?n(t.maxWait||0,i):s;h="trailing"in t?!!t.trailing:h}function v(e){var t=o,n=u;o=u=undefined;p=e;l=r.apply(n,t);return l}function D(e){p=e;f=setTimeout(y,i);return m?v(e):l}function g(e){var t=e-c,n=e-p,r=i-t;return d?a(r,s-n):r}function _(e){var t=e-c,n=e-p;return c===undefined||t>=i||t<0||d&&n>=s}function y(){var e=F();if(_(e)){return b(e)}f=setTimeout(y,g(e))}function b(e){f=undefined;if(h&&o){return v(e)}o=u=undefined;return l}function w(){if(f!==undefined){clearTimeout(f)}p=0;o=c=u=f=undefined}function C(){return f===undefined?l:b(F())}function x(){var e=F(),t=_(e);o=arguments;u=this;c=e;if(t){if(f===undefined){return D(c)}if(d){f=setTimeout(y,i);return v(c)}}if(f===undefined){f=setTimeout(y,i)}return l}x.cancel=w;x.flush=C;return x}}();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,a){var o=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){a=!!i;i=0}i=i||0;a=a||false;if(!e.$timers){e.$timers={}}if(!e.$timers[n]){e.$timers[n]={}}r.$timerID=r.$timerID||this.guid++;var u=function(){if(a&&u.inProgress){return}u.inProgress=true;if(++o>i&&i!==0||r.call(e,o)===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 a in r){if(r.hasOwnProperty(a)){this.remove(e,a,n)}}}else if(r[t]){if(n){if(n.$timerID){window.clearInterval(r[t][n.$timerID]);delete r[t][n.$timerID]}}else{for(var o in r[t]){if(r[t].hasOwnProperty(o)){window.clearInterval(r[t][o]);delete r[t][o]}}}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":""),a=0,o,u,s,l;t=new RegExp(t.source,i+"g");e+="";if(!p){o=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>a){r.push(e.slice(a,u.index));if(!p&&u.length>1){u[0].replace(o,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;a=s;if(r.length>=n){break}}if(t.lastIndex===u.index){t.lastIndex++}}if(a===e.length){if(l||!t.test("")){r.push("")}}else{r.push(e.slice(a))}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){if(!this.is(":focus")){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,a=t.createTextRange(),i=document.selection.createRange().duplicate(),o=i.getBookmark();a.moveToBookmark(o);while(a.moveStart("character",-1)!==0)e++;return e}return 0}if(e===-1)e=this[n?"text":"val"]().length;if(window.getSelection){if(n){if(!this.is(":focus")){t.focus()}var u=window.getSelection();u.collapse(u.focusNode,e)}else t.setSelectionRange(e,e)}else if(document.body.createTextRange){var a=document.body.createTextRange();a.moveToElementText(t);a.moveStart("character",e);a.collapse(true);a.select()}if(!n&&!this.is(":focus")){t.focus()}return e};function make_callback_plugin(e){var s=$.extend({init:$.noop,destroy:$.noop,name:"event"},e);return function(r,i){var a=arguments.length===0;var o=arguments[0]==="unbind";if(!a&&!o&&!is_function(r)){throw new Error("Invalid argument, it need to a function or string "+'"unbind" or no arguments.')}if(o){r=is_function(arguments[1])?arguments[1]:null}var u="callbacks_"+s.name;return this.each(function(){var t=$(this);var n;function e(e){n.fireWith(t,[e])}if(a||o){n=t.data(u);if(a){n&&n.fire()}else{if(r&&n){n.remove(r);if(!n.has()){n=null}}else{n=null}if(!n){t.removeData(u);s.destroy.call(this,e,i)}}}else if(t.data(u)){$(this).data(u).add(r)}else{n=$.Callbacks();n.add(r);t.data(u,n);s.init.call(this,e,i)}})}}$.fn.resizer=make_callback_plugin({name:"resize",init:function(e,t){var n=$.extend({prefix:""},t);var r=$(this);var i;var a=true;if(r.is("body")){$(window).on("resize.resizer",e)}else if(window.ResizeObserver){i=new ResizeObserver(function(){if(!a){e()}a=false});i.observe(this);r.data("observer",i)}else{var o=$("<iframe/>").addClass(n.prefix+"resizer").appendTo(this)[0];$(o.contentWindow).on("resize",e)}},destroy:function(){var e=$(this);if(window.ResizeObserver){var t=e.data("observer");if(t){t.unobserve(this);e.removeData("observer")}}else{var n=e.find('> iframe[class$="resizer"]');if(n.length){$(n[0].contentWindow).off("resize").remove();n.remove()}else if(e.is("body")){$(window).off("resize.resizer")}}}});$.fn.touch_scroll=make_callback_plugin({name:"touch",init:function(r){var i;var a;$(this).on("touchstart.scroll",function(e){e=e.originalEvent;if(e.target.tagName.toLowerCase()!=="a"&&e.touches.length===1){a=i=e.touches[0]}}).on("touchmove.scroll",function(e){e=e.originalEvent;if(i&&e.touches.length===1){var t=e.touches[0];var n=r({origin:i,previous:a,current:t});if(n===false){e.preventDefault()}a=t}}).on("touchend.scroll",function(){if(i||a){i=a=null}})},destroy:function(){$(this).off("touchstart.scroll touchmove.scroll touchend.scroll")}});function jquery_resolve(e){var t=jQuery.Deferred();t.resolve(e);return t.promise()}function unpromise(e,t,n){if(e!==undefined){if(is_function(e.catch)){e.catch(n)}if(is_function(e.done)){return e.done(t)}else if(is_function(e.then)){return e.then(t)}else{return t(e)}}}$.fn.is_fully_in_viewport=function(){function t(e,t){var n=e.getBoundingClientRect();var r=t[0].getBoundingClientRect();var i=n.top-r.top;var a=n.bottom-r.top;var o=t.height();return a>0&&i<=o}if(window.IntersectionObserver){return function(e){var t=this[0];var n=jQuery.Deferred();var r=new window.IntersectionObserver(function(e){n.resolve(e[0].isIntersecting&&e[0].ratio===1);r.unobserve(t)},{root:e[0]});r.observe(t);return n.promise()}}else{return function(e){return jquery_resolve(t(this[0],e))}}}();var entity_re=/(&(?:[a-z\d]+|#\d+|#x[a-f\d]+);)/i;var combine_chr_re=/(.(?:[\u0300-\u036F]|[\u1AB0-\u1abE]|[\u1DC0-\u1DF9]|[\u1DFB-\u1DFF]|[\u20D0-\u20F0]|[\uFE20-\uFE2F])+)/;var astral_symbols_re=/([\uD800-\uDBFF][\uDC00-\uDFFF])/;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])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\])([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)(\])$/i;var format_begin_re=/(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\])/i;var format_start_re=/^(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\])/i;var format_end_re=/\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\]?$/i;var self_closing_re=/^(?:\[\[)?[^;]*@[^;]*;/;var color_re=/^(?:#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i;var url_re=/(\bhttps?:\/\/(?:(?:(?!&[^;]+;)|(?=&amp;))[^\s"'<>\][)])+)/gi;var url_nf_re=/\b(?![^"\s[\]]*])(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&amp;))[^\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 url_full_re=/^(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&amp;))[^\s"'<>\][)])+)$/gi;var email_full_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_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 broken_image='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14"><title id="title2">rounded</title><path id="terminal-broken-image" d="m 14,10 h 2 v 1 a 3,3 0 0 1 -3,3 H 3 A 3,3 0 0 1 0,11 H 4.5 A 1.00012,1.00012 0 0 0 5.207,10.707 L 6.5,9.414 7.793,10.707 a 0.99963,0.99963 0 0 0 1.41406,0 l 2.36719,-2.36719 1.80127,1.44092 A 0.99807,0.99807 0 0 0 14,10 Z M 16,3 V 8 H 14.35059 L 12.12451,6.21924 A 0.99846,0.99846 0 0 0 10.793,6.293 L 8.5,8.586 7.207,7.293 a 0.99962,0.99962 0 0 0 -1.41406,0 L 4.08594,9 H 0 V 3 A 3,3 0 0 1 3,0 h 10 a 3,3 0 0 1 3,3 z M 6,4.5 A 1.5,1.5 0 1 0 4.5,6 1.5,1.5 0 0 0 6,4.5 Z" /></svg>';var use_broken_image='<svg class="terminal-broken-image" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14" xmlns:xlink="http://www.w3.org/1999/xlink"><use xlink:href="#terminal-broken-image"/></svg>';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 agent=window.navigator.userAgent;var is_IE=/MSIE|Trident/.test(agent)||/rv:11.0/i.test(agent);var is_IEMobile=/IEMobile/.test(agent);var is_ch_unit_supported=function(){if(is_IE&&!is_IEMobile){return false}var e=document.createElement("div");e.style.width="1ch";return e.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}if(navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1){return 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">&nbsp;</span>').appendTo("body");var r=$(t+'">&nbsp;</span>').appendTo("body");ch_unit_bug=Math.abs(e(n)-e(r))>1e-4;n.remove();r.remove()});function css(t,n,e){if(t instanceof $.fn.init){t.each(function(){css(this,n,e)})}else if($.isPlainObject(n)){Object.keys(n).forEach(function(e){t.style.setProperty(e,n[e])})}else if(typeof e==="undefined"){return t.style.getPropertyValue(n)}else{t.style.setProperty(n,e)}}function a11y_hide(e){e.attr({role:"presentation","aria-hidden":"true"})}var excepctions=[];function alert_exception(e,t){if(arguments[0]instanceof $.terminal.Exception){e=arguments[0].type;t=arguments[0]}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=is_array(e)?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 WorkerCache(e){var t=$.extend({validation:$.noop,action:$.noop,onCache:$.noop},e);this._onCache=t.onCache.bind(this);this._action=t.action.bind(this);this._validation=t.validation.bind(this);this._cache=new Map}WorkerCache.prototype.validate=function(e){var t=this._validation(e);var n=t===undefined||t===true;if(!n){this._cache.clear()}return n};WorkerCache.prototype.get=function(e){var t;if(this.validate(e)&&this._cache.has(e)){t=this._cache.get(e);this._onCache({cache:t});return t}t=this._action(e);this._cache.set(e,t);return t};function History(e,t,n){var r=true;var i="";if(typeof e==="string"&&e!==""){i=e+"_"}i+="commands";var a;if(n){a=[]}else{a=$.Storage.get(i);a=a?JSON.parse(a):[]}var o=a.length-1;$.extend(this,{append:function(e){if(r){if(a[a.length-1]!==e){a.push(e);if(t&&a.length>t){a=a.slice(-t)}o=a.length-1;if(!n){$.Storage.set(i,JSON.stringify(a))}}}},set:function(e){if(is_array(e)){a=e;if(!n){$.Storage.set(i,JSON.stringify(a))}}},data:function(){return a},reset:function(){o=a.length-1},last:function(){return a[a.length-1]},end:function(){return o===a.length-1},position:function(){return o},current:function(){return a[o]},next:function(){var e=o;if(o<a.length-1){++o}if(e!==o){return a[o]}},previous:function(){var e=o;if(o>0){--o}if(e!==o){return a[o]}},clear:function(){a=[];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,inputStyle:"textarea",mobileDelete:is_mobile,onPaste:$.noop,clickTimeout:200,holdTimeout:400,holdRepeatTimeout:200,mobileIngoreAutoSpace:[],repeatTimeoutKeys:[],tabindex:1,tabs:4}};$.fn.cmd=function(e){var F=$.extend({},$.cmd.defaults,e);function o(e){return F.mobileIngoreAutoSpace.length&&F.mobileIngoreAutoSpace.indexOf(e)!==-1&&is_android}var k=this;var t=k.data("cmd");if(t){return t}var u=cmd_index++;k.addClass("cmd");var A=$('<div class="cmd-wrapper"/>').appendTo(k);A.append('<span class="cmd-prompt"></span>');A.append('<div class="cmd-cursor-line">'+"<span></span>"+'<span class="cmd-cursor">'+'<span data-text class="end"><span>&nbsp;</span></span>'+"</span>"+"<span></span>"+"</div>");var n=A.find(".cmd-cursor-line");a11y_hide(n);var T;if(is_mobile){T=function(){var t=$('<div class="cmd-editable" contenteditable/>').attr({autocapitalize:"off",autocorrect:"off",spellcheck:"false",tabindex:F.tabindex}).insertAfter(k);t.on("focus",function(){k.enable()}).on("blur",function(){k.disable()});var e;var n={$node:t,val:function(e){if(typeof e==="undefined"){return t.text()}else{t.html(e)}},reset:function(){clearTimeout(e);e=setTimeout(function(){t.css({top:"",bottom:""})},400)},focus:function(){css(t[0],{top:"calc(var(--terminal-scroll, 0) * 1px)"});n.reset()},blur:function(){t.css({top:"100%",bottom:0}).blur();window.getSelection().removeAllRanges();n.reset()}};return n}();k.addClass("cmd-mobile")}else{T=function(){var t=$("<textarea>").attr({autocapitalize:"off",spellcheck:"false",tabindex:F.tabindex}).addClass("cmd-clipboard").appendTo(k);return{$node:t,val:function(e){if(typeof e==="undefined"){return t.val()}else{return t.val(e)}}}}();T.val(" ")}if(F.width){k.width(F.width)}var p;var d;var s;var S;var m;var h=k.find(".cmd-prompt");var l=false;var f="";var c=null;var r;var R="";var i;var a="";var B=0;var v;var D;var j=0;var g,_;var L=k.find(".cmd-cursor");var y;var O;var b=0;var w="";var P=/\uFFFF$/;var C=/^\uFFFF$/;function x(e){var t=$(e.target);if(t.is("span,img,a")){t=t.closest("[data-text]");return t.index()+t.parent("span").prevAll().find("[data-text]").length+t.closest('[role="presentation"]').prevUntil(".cmd-prompt").find("[data-text]").length}else if(t.is('div[role="presentation"]')){var n=!t.next().length;return t.find("[data-text]").length+t.prevUntil(".cmd-prompt").find("[data-text]").length-(n?0:1)}}var E={SPACEBAR:" ",UP:"ArrowUP",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight",DEL:"Delete",MULTIPLY:"*",DIVIDE:"/",SUBTRACT:"-",ADD:"+"};function z(e){var t=e.key.toUpperCase();if(E[t]){return E[t]}return t}function I(e){if(e.key){var t=z(e).toUpperCase();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 N={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"};var M;for(M=1;M<25;M++){N[111+M]="F"+M}var H="";for(M=65;M<91;M++){H=String.fromCharCode(M);N[M]=[H.toLowerCase(),H.toUpperCase()]}var U={};Object.keys(N).forEach(function(t){if(is_array(N[t])){N[t].forEach(function(e){U[e.toUpperCase()]=t})}else{U[N[t].toUpperCase()]=t}});var W;var q={"ALT+D":K({clipboard:true}),"HOLD+ALT+D":K({clipboard:true,hold:true}),"HOLD+DELETE":K({clipboard:false,hold:true}),"HOLD+SHIFT+DELETE":K({clipboard:false,hold:true}),ENTER:function(){if(_&&R&&!F.mask&&(is_function(F.historyFilter)&&F.historyFilter(R)||F.historyFilter instanceof RegExp&&R.match(F.historyFilter)||!F.historyFilter)){_.append(R)}var e=R;_.reset();Ke="";Ne=true;k.set("");var t;if(F.commands){t=F.commands.call(k,e)}if(is_function(v)){if(t&&is_function(t.then)){t.then(Re)}else{Re()}}T.val("");return false},"SHIFT+ENTER":function(){k.insert("\n");return true},BACKSPACE:ie,"SHIFT+BACKSPACE":ie,TAB:function(){k.insert("\t")},"CTRL+D":function(){k["delete"](1);return false},DELETE:function(){k["delete"](1);return true},"HOLD+ARROWUP":ne,ARROWUP:ne,"CTRL+ARROWUP":V,"CTRL+P":V,ARROWDOWN:re,"HOLD+ARROWDOWN":re,"CTRL+N":X,"CTRL+ARROWDOWN":X,ARROWLEFT:ae,"HOLD+ARROWLEFT":debounce(ae,10),"CTRL+B":ae,"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}}k.position(t)},"CTRL+R":function(){if(l){ve(true)}else{r=v;de();i=R;k.set("");Ae();l=true}return false},"CTRL+G":function(){if(l){v=r;Re();k.set(i);Ae();l=false;f="";return false}},ARROWRIGHT:oe,"HOLD+ARROWRIGHT":debounce(oe,10),"CTRL+F":oe,"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+$/)){k.position(bare_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}}Ae()},F12:Q,END:se(true),"CTRL+END":se(),"CTRL+E":se(),HOME:ue(true),"CTRL+HOME":ue(),"CTRL+A":ue(),"SHIFT+INSERT":Y,"CTRL+SHIFT+T":Q,"CTRL+W":J({clipboard:true,hold:false}),"HOLD+BACKSPACE":J({clipboard:false,hold:true}),"HOLD+SHIFT+BACKSPACE":J({clipboard:false,hold:true}),"CTRL+H":function(){if(R!==""&&B>0){k["delete"](-1)}return false},"CTRL+X":Q,"CTRL+C":function(){return get_selected_html()===""},"CTRL+T":Q,"CTRL+Y":function(){if(a!==""){k.insert(a)}},"CTRL+V":Y,"META+V":Y,"CTRL+K":function(){var e=text(R).length;if(e>B){a=k["delete"](e-B);text_to_clipboard(T.$node,a)}return false},"CTRL+U":function(){if(R!==""&&B!==0){a=k["delete"](-B);text_to_clipboard(T.$node,a)}return false},"CTRL+TAB":function(){return false},"META+`":Q,"META+R":Q,"META+L":Q};function K(i){i=i||{};if(i.hold&&!F.mobileDelete){return function e(){k["delete"](1);return false}}return function e(){var t=/ *[^ ]+ *(?= )|[^ ]+$/;var n=R.slice(B);var r=n.match(t);if(r){a=r[0];if(i.clipboard){text_to_clipboard(T,a)}}k.set(R.slice(0,B)+R.slice(B).replace(t,""),true);return false}}function J(n){n=n||{};if(n.hold&&!F.mobileDelete){return function e(){k["delete"](-1)}}return function e(){if(R!==""&&B!==0){var t=R.slice(0,B).match(/([^ ]* *$)/);if(t[0].length){a=k["delete"](-t[0].length);if(n.clipboard){text_to_clipboard(T,a)}}}return false}}function Q(){return true}function Y(){T.val("");b=0;if(k.isenabled()&&!T.$node.is(":focus")){T.$node.trigger("focus",[true])}T.$node.one("input",G);return true}function G(){if(b++>0){return}function n(){T.val(R);ce()}function r(e){k.insert(e);n()}if(k.isenabled()){k.oneTime(100,function(){var e=T.val();if(is_function(F.onPaste)){var t=F.onPaste.call(k,{target:k,text:e});if(t!==undefined){if(t&&is_function(t.then||t.done)){(t.then||t.done).call(t,r)}else if(typeof t==="string"){r(t)}else if(t===false){n()}return}}r(e)})}}function V(){if(je){i=R;k.set(_.current())}else{k.set(_.previous())}je=false;return false}function X(){if(_.end()){je=true;k.set(i)}else{k.set(_.next())}return false}function Z(e){return e.match(/\n/)}function ee(e,t){var n=e.split("\n").map(function(e){return $.terminal.length(e)});if(t){n[0]+=t}var r=n.filter(function(e){return e>=p});return!!r.length}function te(e){var t=s;var n=$.terminal.split_equal(t+e,p);var r=new RegExp("^"+$.terminal.escape_regex(t));n=n.map($.terminal.unescape_brackets);n[0]=n[0].replace(r,"");return n}function ne(){var e=we(R);e=$.terminal.strip(e);var t=$.terminal.substring(e,0,B);var n=k.column();var r=k.find(".cmd-cursor-line");var i=r.prevUntil("span").length;if(i===1&&n<=m){k.position(0);return false}if(i===0){return V()}if(Z(t)||ee(t,m)){var a=r.prev();var o=a.is(".cmd-end-line");var u=te(e);a=u[i-1];var s=u[i].substring(n).length;var l;if(s>0){l=n;if(i-1===0){l-=m}l=n+a.substring(l).length;if(o){++l}}else{l=n+1}k.position(-l,true);return false}else{return V()}}function re(){var e=we(R);e=$.terminal.strip(e);var t=$.terminal.substring(e,B);if(Z(t)||ee(t)){var n=te(e);var r=k.column();var i=k.find(".cmd-cursor-line");var a=i.prevUntil("span");var o=a.length;var u=i.is(".cmd-end-line");var s=i.next().is(".cmd-end-line");var l=n[o+1];if(!l){return X()}var f=n[o].substring(r).length;var c;if(f===0){c=l.length;if(s){c++}}else{c=Math.min(r,l.length)+f;if(o===0){c+=m}if(u){c+=1}}k.position(c,true);return false}else{return X()}}function ie(){if(l){f=f.slice(0,-1);de()}else if(R!==""&&B>0){k["delete"](-1)}k.oneTime(1,function(){Ne=true})}function ae(){if(B>0){k.position(-1,true)}}function oe(){if(B<bare_text(R).length){k.position(1,true)}return false}function ue(e){function t(){k.position(0)}if(e){return function(){if(R.match(/\n/)){var e=R.substring(0,k.position());k.position(e.lastIndexOf("\n")+1)}else{t()}}}else{return t}}function se(e){function i(){k.position(text(R).length)}if(e){return function(){if(R.match(/\n/)){var e=R.split("\n");var t=k.position();var n=0;for(var r=0;r<e.length;++r){n+=e[r].length;if(n>t){k.position(n+r);return}}}i()}}else{return i}}function le(){var e=T.$node;var t=e.is(":focus");if(D){if(!t){}k.oneTime(10,function(){if(!e.is(":focus")&&D){e.trigger("focus",[true])}})}else if(t&&!D){e.trigger("blur",[true])}}function fe(){if(animation_supported){var e=window.getComputedStyle(L[0]);var t=e.getPropertyValue("--animation");t=t.replace(/^\s*|\s*$/g,"");var n=k.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}}n=n.replace(/\s+/g," ");if(n!==k.attr("class").replace(/\s+/g," ")){k.attr("class",n)}}}function ce(e){if(!k.isenabled()){return}k.oneTime(10,function(){if(!is_mobile&&T.val()!==R&&!e){T.val(" "+R)}if(D){k.oneTime(10,function(){try{if(T.$node.caret()!==B+1){T.$node.caret(B+1)}}catch(e){}})}})}if(animation_supported&&!is_android){y=function(e){if(e){L.addClass("cmd-blink")}else{L.removeClass("cmd-blink")}};O=function(){var e=L.clone();e.insertBefore(L);L.remove();L=e}}else{var pe=false;y=function(e){if(e&&!pe){pe=true;L.addClass("cmd-inverted cmd-blink");k.everyTime(500,"blink",me)}else if(pe&&!e){pe=false;k.stopTime("blink",me);L.removeClass("cmd-inverted cmd-blink")}};O=function(){y(false);y(true)}}function me(){L.toggleClass("cmd-inverted")}function de(){v="(reverse-i-search)`"+f+"': ";Re()}function he(){v=r;l=false;c=null;f=""}function ve(e){var t=_.data();var n,r;var i=t.length;if(e&&c>0){i-=c}if(f.length>0){for(var a=f.length;a>0;a--){r=$.terminal.escape_regex(f.slice(0,a));if(F.caseSensitiveSearch){n=new RegExp(r)}else{n=new RegExp(r,"i")}for(var o=i;o--;){if(n.test(t[o])){c=t.length-o;k.position(t[o].indexOf(r));k.set(t[o],true);Ae();if(f.length!==a){f=f.slice(0,a);de()}return}}}}f=""}function De(){var e=k.find(".cmd-prompt");var t=e.html();e.html("<span>&nbsp;</span>");var n=e.find("span")[0].getBoundingClientRect().width;e.html(t);return n}function ge(e){var t=k.width();return Math.floor(t/e)}function _e(e){function t(e){return $.terminal.split_equal(e,p)}function n(n){var r=[];n.forEach(function(e,t){if($.terminal.strip(e).match(C)){r[t]=false;if(t>0){r[t-1]+=w}}else{r[t]=n[t]}});return r.filter(function(e){return e!==false})}var r=h.find(".cmd-line");var i;if(r.length){i=r.nextUntil(".cmd-line").text()}else{i=h.text()}i=$.terminal.escape_brackets(i);var a=new RegExp("^"+$.terminal.escape_regex(i));var o;if(e.match(/\n/)){var u=e.split("\n");var s=p-m-1;for(var l=0;l<u.length-1;++l){u[l]+=w}if(strlen(u[0])>s){o=t(i+u[0]);o[0]=o[0].replace(a,"");o=n(o)}else{o=[u[0]]}for(l=1;l<u.length;++l){if(strlen(u[l])>p){var f=t(u[l]);if(l<u.length-1){f=n(f)}o=o.concat(f)}else{o.push(u[l])}}}else{o=t(i+e,p);o[0]=o[0].replace(a,"")}if(o.length>1){var c=$.terminal.length(o[o.length-1]);if(c===p){o.push("")}}return o}var ye=new WorkerCache({validation:function(e){var t=false;if((!this._previous_value||this._previous_value===e)&&(!this._cols||this._cols===p)){t=true}this._previous_value=e;this._cols=p;return t},action:_e});function be(e){return ye.get(e)}function we(t,e){try{t=$.terminal.escape_formatting(t);var n=$.extend({},F,{unixFormattingEscapeBrackets:true,position:B,command:true});var r=$.terminal.apply_formatters(t,n);var i=$.terminal.normalize(r[0]);var a=$.terminal.length(i);if(!e){j=r[1];if(j>a){j=a}}i=$.terminal.normalize(i);return i}catch(e){alert_exception("[Formatting]",e.stack);return t}}function Ce(e,t){var n=$.terminal.encode(xe(e),{tabs:F.tabs,before:t});return $.terminal.format(n,{char_width:F.char_width,allowedAttributes:F.allowedAttributes||[]})}function xe(e){return $.terminal.partition(e).join("")}function Ee(e,t){return $.terminal.length(e,t)}function $e(e){return strlen(text(e))>p-m-1||e.match(/\n/)}function Fe(e,t,n){return $.terminal.substring(e,t,n)}function ke(e){if($.terminal.is_formatting(e)){return e.replace(format_parts_re,"$4").match(/^emoji /)}return false}var Ae=function(){var g=L.prev();var _=L.next();var y=L.parent();function b(e,t){var n=e.match(P);if(n){e=e.replace(P," ")}y.toggleClass("cmd-end-line",!!n);var r=false;var i=$.extend({prompt:"",last:false},t);var a=i.position;var o=Ee(e);var u=i.prompt;var s;if(a===o){g.html(Ce(e));s="&nbsp;";C();_.html("")}else if(a===0){g.html("");s=Fe(e,0,1);L.html(Ce(s));_.html(Ce(Fe(e,1),u+s))}else{var l=$.terminal.substring(e,0,a);g.html(Ce(l,u));s=Fe(e,a,a+1);var f=(u+l).replace(/^.*\t/,"");L.html(Ce(s,f));if(a===o-1){r=true;_.html("")}else{if(s.match(/\t/)){f=""}else{f+=s}_.html(Ce(Fe(e,a+1),f))}}if(ch_unit_bug){if(typeof wcwidth!=="undefined"){var c=strlen(text(s));if(c===1&&ke(s)){c=2}L.width(d*c)}else{L.width(d)}}L.toggleClass("cmd-end-line",r);fe();var p=$.terminal.length(L.text());if(p>1){var m=L.find("[data-text]")[0];m.style.setProperty("--length",p)}O()}function w(e,t){var n=e.match(P);var r='<div role="presentation" aria-hidden="true"';if(n){e=e.replace(P," ");r+=' class="cmd-end-line"'}r+=">"+Ce(e,t||"")+"</div>";return r}function C(){L.html('<span data-text class="end"><span>&nbsp;<span></span>')}function x(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?S:""))})}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=we(e);var n;if(Ee(t)===text(e).length){n=B}else{n=j}var r;A.css({display:"none"});A.find("div:not(.cmd-cursor-line)").remove();g.html("");if($e(t)){var i=t.match(/\t/g);var a=t;if(i){t=t.replace(/\t/g,"\0\0\0\0")}var o=be(t);if(i){o=$.map(o,function(e){return e.replace(/\x00\x00\x00\x00/g,"\t")})}var u=Ee(o[0]);if(u===0&&o.length===1){}else if(n<u){b(o[0],{length:o.length,position:n,prompt:S});x(o.slice(1))}else if(n===u){y.before(w(o[0],S));b(o[1]||"",{length:o.length,position:0,last:o.length<=2});if(o.length>2){x(o.slice(2))}}else{var s=o.slice(-1)[0];var l=Ee(a);var f=l-n;var c=Ee(s);var p=0;if(f===-1){f=0}if(f<=c){E(o.slice(0,-1));if(c===f){p=0}else{p=c-f}b(s,{length:o.length,position:p,last:true})}else{var m;var d;p=n;for(r=0;r<o.length;++r){var h=$.terminal.length(o[r]);if(p>h){p-=h}else{break}}d=o[r];m=r;if(p===Ee(d)){p=0;d=o[++m];if(d===undefined){var v=$.terminal.defaults.strings.redrawError;throw new Error(v)}}b(d,{length:o.length,position:p});E(o.slice(0,m));x(o.slice(m+1))}}k.find(".cmd-cursor-line ~ div:last-of-type").append("<span></span>")}else if(t===""){g.html("");C();_.html("")}else{b(t,{length:1,position:n})}var D=y.prevUntil(".cmd-prompt").length;if(is_css_variables_supported){k[0].style.setProperty("--cursor-line",D)}else{T.$node.css("top",D*14+"px")}A.css({display:""})}}();var Te=function(){function a(e,t){var n=$.extend({},F,{position:t,command:true});return $.terminal.apply_formatters(e,n)[1]}function s(e,t,n){var r=a(n,t);if(r===e){var i=a(n,t+1);if(i>e){return 0}return 1}else if(r<e){return 1}else{return-1}}return function(e,t){if(t===0){return 0}e=bare_text(e);var n=e.length;var r=$.terminal.escape_brackets(R);var i=binary_search(0,n,t,s,[r]);var a=$.terminal.split_characters(e);if(n>a.length){var o=0;for(var u=0;u<a.length;++u){o+=a[u].length;if(o>=i){return o}}}return i}}();var Se;var Re=function(){function t(e){e=$.terminal.apply_formatters(e,{prompt:true});e=$.terminal.normalize(e);e=crlf(e);s=e;var t=$.terminal.split_equal(e,p).map(function(e){if(!$.terminal.have_formatting(e)){return"[[;;]"+e+"]"}return $.terminal.format_split(e).map(function(e){if($.terminal.is_formatting(e)){return e}return"[[;;]"+e+"]"}).join("")});var n={char_width:F.char_width};S=t[t.length-1];var r=$.terminal.encode(t[t.length-1],{tabs:F.tabs});var i=$.terminal.format(r,n);var a=t.slice(0,-1).map(function(e){e=$.terminal.encode(e,{tabs:F.tabs});return'<span class="cmd-line">'+$.terminal.format(e,n)+"</span>"}).concat([i]).join("\n");if(h.html()!==a){h.html(a);var o=h.find("> span span");T.$node.attr("data-cmd-prompt",h.text());if(is_ch_unit_supported){h.hide();o.each(function(){var e=$(this);var t=strlen(e.text());e.css("width",t+"ch")});h.show()}m=strlen(text(r))}}return function(){if(Se&&Se.set){Se.set=$.noop;Se=null}switch(typeof v){case"string":t(v);break;case"function":var n=Se={set:t};var e=v.call(k,function(e){n.set(e)});if(typeof e==="string"){n.set(e)}if(e&&e.then){e.then(n.set).catch(function(e){var t=$.terminal.escape_brackets("[ERR]> ");n.set("[[;red;]"+t+"]");alert_exception("Prompt",e)})}break}}}();function Be(){if(is_function(F.onCommandChange)){F.onCommandChange.call(k,R)}}$.extend(k,{option:function(e,t){if(typeof t==="undefined"){return F[e]}else{F[e]=t}return k},name:function(e){if(e!==undefined){g=e;var t=_&&_.enabled()||!_;_=new History(g,F.historySize,F.history==="memory");if(!t){_.disable()}return k}else{return g}},purge:function(){_.clear();return k},history:function(){return _},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=bare_text(R);r=r.slice(0,B+e)+r.slice(B,r.length);if(!t){k.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=r}Ae();ce();Be();return n},set:function(e,t,n){if(e!==undefined){R=e;if(!t){k.position(bare_text(R).length)}Ae();ce();if(!n){Be()}}return k},keymap:function(e,t){function n(e,t){var n=q[e];if(is_function(n)){n=n.bind(k)}return function(e){return t.call(k,e,n)}}if(e===null){W=q;return k}else if(typeof e==="undefined"){return W}else if(typeof e==="string"){if(typeof t==="undefined"){if(W[e]){return W[e]}else if(q[e]){return q[e]}}else{W[e]=n(e,t)}}else{W=$.extend({},W?W:q,$.omap(e||{},n));return k}},insert:function(e,t){var n=bare_text(R);var r=bare_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=e;if(!t){k.position(r,true,true)}ce();Ae();Be();return k},get:function(){return R},commands:function(e){if(e){F.commands=e;return k}else{return e}},destroy:function(){tt.unbind("keypress.cmd",nt);tt.unbind("keydown.cmd",Ze);tt.unbind("input.cmd",at);k.stopTime("blink",me);k.find(".cmd-wrapper").remove();k.find(".cmd-prompt, .cmd-clipboard, .cmd-editable").remove();k.removeClass("cmd").removeData("cmd").off(".cmd");return k},column:function(e){var t=R.substring(0,B);if(B===0||!R.length){return 0}var n=/\n?([^\n]*)$/;var r=t.match(n);var i=r[1].length;if(!Z(t)&&(e||ee(t,m))){i+=m}if(i===0){return i}i%=p;if(i===0){return p}return i},line:function(){var e=R.substring(0,B);if(B===0||!R.length){return 0}return e.split(/\n/).length-1},prompt:function(e){if(e===true){return s}else if(e===undefined){return v}else{var t=e!==v;if(typeof e==="string"||typeof e==="function"){v=e}else{throw new Error("prompt must be a function or string")}if(t){Re();Ae()}return k}},kill_text:function(){return a},position:function(e,t,n){if(typeof e==="number"){var r=B;var i=bare_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){Ae();if(is_function(F.onPositionChange)){F.onPositionChange(B,j)}ce(true)}return k}else{return B}},refresh:function(){Re();Ae();ce(true);return k},display_position:function(e,t){if(e===undefined){return j}else{var n=we($.terminal.escape_formatting(R),true);var r=Ee(n);var i=bare_text(R).length;var a;if(t){a=j+e}else if(e>r){a=r}else{a=e}if(r===i){j=a;return k.position(a)}if(r===a){j=a;return k.position(i)}var o=Te(R,a);if(o!==-1){j=a;k.position(o)}return k}},visible:function(){var e=k.visible;return function(){e.apply(k,[]);Ae();Re();return k}}(),show:function(){var e=k.show;return function(){e.apply(k,[]);Ae();Re();return k}}(),resize:function(e){d=De();var t;if(typeof e==="number"){t=e}else{t=ge(d)}if(p!==t||arguments[0]===true){p=t;Ae();Re()}return k},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 a=t.indexOf("ALT")!==-1;var o=t.indexOf("META")!==-1;var u=$.Event("keydown",{ctrlKey:r,shiftKey:i,altKey:a,metaKey:o,which:U[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 k},clip:function(){return T},enable:function(e){if(!D){D=true;k.addClass("enabled");try{if(!T.$node.is(":focus")){T.$node.focus()}T.$node.caret(B)}catch(e){}y(true);if(!e&&is_function(v)){Re()}fe();ce()}le();return k},isenabled:function(){return D},disable:function(e){D=false;k.removeClass("enabled");y(false);if(!e){le()}return k},mask:function(e){if(typeof e==="undefined"){return F.mask}else{F.mask=e;Ae();return k}}});k.name(F.name||F.prompt||"");if(F.prompt!==false){v=F.prompt;Re()}if(F.enabled===true){k.enable()}d=De();p=ge(d);if(!F.history){_.disable()}var je=true;var Le=false;var Oe=false;var Pe=false;var ze=false;var Ie=false;var Ne=true;var Me=false;var He=false;var Ue=false;var We=false;var qe;var Ke="";var Je;function Qe(e){return e.key.toUpperCase()==="BACKSPACE"||e.which===8}function Ye(e){return e.key&&e.key.length===1&&!e.ctrlKey}function Ge(e){var t=["HOLD+SHIFT+BACKSPACE","HOLD+BACKSPACE"];return t.indexOf(e)!==-1&&F.mobileDelete||F.repeatTimeoutKeys.indexOf(e)!==-1}function Ve(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}var Xe=false;function Ze(e){debug('keydown "'+e.key+'" '+e.fake+" "+e.which);var t;He=(e.key||"").toLowerCase()==="process"||e.which===0;Oe=ze&&Pe&&!Qe(e);try{if(!e.fake){Pe=Ye(e);Ie=String(e.key).toLowerCase()==="unidentified";Me=Qe(e)}}catch(e){}if(e.key==="Unidentified"){Ne=true;return}if(!e.fake&&["meta","os"].indexOf(e.key.toLowerCase())===-1){Ne=false}ze=true;T.$node.off("input",G);var n=I(e);if(is_function(F.keydown)){e.key=z(e);t=F.keydown.call(k,e);if(t!==undefined){if(!t){qe=true}return t}}if(n!==Je){et()}if(D||n==="CTRL+C"&&is_terminal_selected(k)){if(Ue){Je=n;n="HOLD+"+n;if(We){return}if(F.holdRepeatTimeout>0&&Ge(n)){We=true;k.oneTime(F.holdRepeatTimeout,"delay",function(){We=false})}}else{k.oneTime(F.holdTimeout,"hold",function(){Ue=true});Je=n}if(!e.fake&&is_android){if(Xe){et();Xe=false;return false}if(o(n)){Xe=true}else if(o(Je)){Xe=false}}O();qe=["CTRL+V","META+V"].indexOf(n)!==-1;if(n.toLowerCase()==="enter"){je=true}if(l&&Ve(e)){he();Re();if(e.which===27){k.set("")}Ae();if(e.which===13){Ze.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{Le=false;return}}}function et(){k.stopTime("hold");k.stopTime("delay");We=Ue=false}var tt=$(document.documentElement||window);k.keymap(F.keymap||{});function nt(e){debug('keypress "'+e.key+'" '+e.fake);et();var t;if(!e.fake){ze=false}if((e.ctrlKey||e.metaKey)&&!e.altKey){return}if(Le){return}if(is_function(F.keypress)){t=F.keypress.call(k,e);if(t!==undefined){if(!t){qe=true}return t}}if(D){if(e.fake){return}var n;if(is_key_native){n=e.key;var r=n.toUpperCase();if(E[r]){n=E[r]}}if(!n||Ie){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)&&!Oe){if(l){f+=n;ve();de()}else if(n.length===1){k.insert(n)}}}}function rt(e,t,n){var r=$.Event(e);r.which=n;r.key=t;r.fake=true;tt.trigger(r)}var it=false;function at(){debug("input "+Ne+" || "+He+" (("+ze+" || "+Oe+") && !"+qe+" && ("+Pe+" || "+Ie+") && !"+Me+")");var e=T.val();if(!is_mobile){e=e.replace(/^ /,"")}if((Ne||He||(ze||Oe)&&!qe&&(Pe||Ie)&&!Me)&&e!==R){var t=B;if(Ne){var n=Ke;Me=n.slice(0,n.length-1).length===e.length}if(it){it=false;T.val(R);return}if(l){f=e;ve();de()}else{var r=e.slice(B);if(r.length===1||Me){var i=get_next_character(r);if(o(i)){it=true}if(Ne){var a;if(Me){a=8}else{a=r.toUpperCase().charCodeAt(0)}rt("keydown",Me?"Backspace":r,a)}if(ze&&!Me){rt("keypress",i,r.charCodeAt(0))}}if(Me){Ke=R;return}if(qe){qe=false;return}k.set(e)}if(Me){k.position(t-1)}else{k.position(t+Math.abs(e.length-Ke.length))}}Ke=R;qe=false;Ne=true}tt.bind("keypress.cmd",nt);tt.bind("keydown.cmd",Ze);tt.bind("keyup.cmd",et);tt.bind("input.cmd",at);(function(){if(is_mobile){$(k[0]).add(T.$node).on("touchstart.cmd",function(){if(!k.isenabled()){T.focus()}else{T.blur()}});k.disable();return}var a=false;var o=0;k.on("mousedown.cmd",function(){a=true}).on("mouseup.cmd",function(n){function e(){var e=$(n.target);var t=e.is(".cmd-prompt");if(!t&&i&&get_selected_html()===""){if(D){if(e.is(".cmd")){k.position(text(R).length)}else{k.display_position(x(n))}}}o=0}var t;if(n.originalEvent===undefined){t=n.button}else{t=n.originalEvent.button}if(t===0&&get_selected_html()===""){var r="click_"+u;if(++o===1){var i=a;if(D){if(F.clickTimeout===0){e()}else{k.oneTime(F.clickTimeout,r,e)}}else{o=0}}else{k.stopTime(r);o=0}}a=false})})();k.data("cmd",k);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 k};var strlen=function(){if(typeof wcwidth==="undefined"){return function(e){return $.terminal.length(e)}}else{return wcwidth}}();function count_selfclosing_formatting(e){var n=0;if($.terminal.have_formatting(e)){var r=new RegExp(format_parts_re,"i");$.terminal.format_split(e).forEach(function(e){if($.terminal.is_formatting(e)){var t=e.match(r);if(t&&t[1].match(/@/)&&t[6]===""){n++}}})}return n}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,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;")}function crlf(e){return e.replace(/\r/g,"")}function char_len(e){return entity_re.test(e)?1:e.length}function make_re_fn(n){return function(e){var t=e.match(n);if(starts_with(t)){return t[1]}}}function starts_with(e){return e&&e.index===0}function make_next_char_fun(t){var i=[];[entity_re,emoji_re,combine_chr_re].forEach(function(e){if(t.match(e)){i.push(make_re_fn(e))}});if(t.match(astral_symbols_re)){i.push(function(e){var t=e.match(astral_symbols_re);if(starts_with(t)){var n=e.match(combine_chr_re);if(n&&n.index===1){return e.slice(0,3)}return t[1]}})}return function(e){for(var t=0;t<i.length;++t){var n=i[t];var r=n(e);if(r){return r}}return e[0]}}function get_next_character(e){var t=e.match(entity_re);if(starts_with(t)){return t[1]}var n=e.match(combine_chr_re);if(starts_with(n)){return n[1]}var r=e.match(emoji_re);if(starts_with(r)){return r[1]}else if(e.charCodeAt(0)<255){return e[0]}else{var i=e.match(astral_symbols_re);if(starts_with(i)){n=e.match(combine_chr_re);if(n&&n.index===1){return e.slice(0,3)}return e.slice(0,2)}else{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+char_len(t);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>1&&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,specs:[t]}])}else{e.pop();return e.concat([{sum:n.sum+t.len,len:n.len,specs:n.specs.concat(t)}])}}return[{sum:t.len,specs:[t],len:t.len}]},[]);return i.map(function(e){if(e.len===1){return a(e)}var t=char_width_prop(e.sum,n);if(e.sum===r.length||!t.length){return"<span>"+a(e)+"</span>"}else if(e.specs.length>1){return o(t,e.specs.map(function(e){return o(char_width_prop(e.len),e.chr)}).join(""))}else{return o(t,a(e))}}).join("")}function a(e){return e.specs.map(function(e){return e.chr}).join("")}function o(e,t){return'<span style="'+e+'">'+t+"</span>"}return e}function binary_search(e,t,n,r,i){var a=t-e;var o=e+Math.floor(a/2);var u=[n,o].concat(i);var s=r.apply(null,u);if(s===0){return o}else if(s>0&&a>1){return binary_search(o,t,n,r,i)}else if(s<0&&a>1){return binary_search(e,o,n,r,i)}else{return-1}}function is_terminal_selected(e){if(is_function(window.getSelection)){var t=window.getSelection();if(t.toString()){var n=t.getRangeAt(0).startContainer.parentNode;var r=$(n).closest(".terminal");return r.length&&(e&&r.find(".cmd").is(e)||!e)}}}function get_selected_html(){var e="";if(is_function(window.getSelection)){var t=window.getSelection();if(t.rangeCount){var n=document.createElement("div");for(var r=0,i=t.rangeCount;r<i;++r){n.appendChild(t.getRangeAt(r).cloneContents())}e=n.innerHTML}}return e}function with_selection(e){var t="";var n=[];if(is_function(window.getSelection)){var r=window.getSelection();if(r.rangeCount){var i=document.createElement("div");for(var a=0,o=r.rangeCount;a<o;++a){var u=r.getRangeAt(a).cloneRange();n.push(u);i.appendChild(u.cloneContents())}t=i.innerHTML}}e(t);if(n.length){r.removeAllRanges();n.forEach(function(e){r.addRange(e)})}return t!==""}function process_selected_line(){var e=$(this);var t=e.text();if(e.hasClass("cmd-end-line")){t+="\n"}return t}function process_div(e){return $(e).find("> div, > span").map(process_selected_line).get().join("\n").replace(/\n$/,"")}function process_selected_html(e){var t;var n="";var r=$("<div>"+e+"</div>");if(e.match(/<\/div>/)){t=r.find("div[data-index]").map(function(){return process_div(this)}).get().join("\n");if(!t&&e.match(/style="width: 100%;?"/)){t=process_div(r)}n=t}var i=r.find(".cmd-prompt");if(i.length){if(n.length){n+="\n"}n+=i.text()}var a=r.find('[role="presentation"]');if(a.length){n+=a.map(process_selected_line).get().join("")}if(!n.length&&e){n=r.text()}return n.replace(/\xA0/g," ")}var text_to_clipboard;if(is_function(document.queryCommandSupported)&&document.queryCommandSupported("copy")){text_to_clipboard=function e(t,n){var r=t.val();var i=t.is(":focus");var a=t.caret();if(window.navigator&&window.navigator.clipboard){navigator.clipboard.writeText(n)}else if(i){t.val(n).focus();t[0].select();document.execCommand("copy");t.val(r);t.caret(a)}else{var o=$("<textarea/>").css({position:"fixed",top:0,left:0}).appendTo("body");o.val(n).focus();o[0].select();document.execCommand("copy");o.blur();o.remove()}return true}}else{text_to_clipboard=$.noop}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 a=e.length;a<t[0].length;++a){var o=false;var u=t[0].charAt(a),s=u.toLowerCase();for(var l=1;l<t.length;++l){o=true;var f=t[l].charAt(a),c=f.toLowerCase();if(u!==f){if(n||r==="mixed"){o=false;break}else if(s===c){if(r==="lower"){u=u.toLowerCase()}else if(r==="upper"){u=u.toUpperCase()}else{o=false;break}}else{o=false;break}}}if(o){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 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 a=$.map(n,function(e){var t=e.match(/^(['"]).*\1$/);return t&&t[1]||""});var o=e.slice(r.length).trim();return{command:e,name:r,args:i,args_quotes:a,rest:o}}else{return{command:e,name:"",args:[],args_quotes:a,rest:""}}}$.terminal={version:"2.18.2",date:"Mon, 24 Aug 2020 17:56:04 +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","rebeccapurple"],Cycle:Cycle,History:History,Stack:Stack,valid_color:function e(t){if(t.match(color_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){if(!(n instanceof RegExp)){throw new Error("tracking_replace: Second argument need to be RegExp")}function a(e,t,n){return e.slice(t,n)}function o(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=o(a(t,0,n.lastIndex));p=m-o(s[0])}else{p=s.index;m=p+o(s[0])}if(l<p){u+=a(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){var d=o(f);d+=count_selfclosing_formatting(f);if(m<i){c=Math.max(0,c+d-o(s[0]))}else{c+=d-(i-p)}}if(!n.global){break}}if(l<o(t)){u+=a(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)==="&nbsp;"||t.slice(e-1,e).match(/\s/)}function i(e){return t.slice(e).match(entity_re)}function a(e){return t[e]==="["&&t[e+1]==="["}function o(e){return t[e-1]!=="\\"&&t[e]==="\\"&&t[e+1]==="]"}function u(e){return F&&(t[e]!=="]"||!m)&&!k}var s=make_next_char_fun(t);function l(){var e=s(E);if(e.length>1&&$.terminal.length(E)>1){return e.length-1}return 0}function f(){return r(x)&&(F||k)&&(g===-1&&y!==x||g!==-1)}var c=false;function p(){if(x===t.length-1&&!c){c=true}else{c=d&&!!E.match(/^.]$/)}return c}var m=$.terminal.have_formatting(t);var d="";var h=false;var v=0;var D;var g=-1;var _=-1;var y;var b=0;var w=0;var C=/(&[^;]+);$/;for(var x=0;x<t.length;x++){var E=t.slice(x);D=E.match(format_start_re);if(D){d=D[1];h=false}else if(d){if(t[x]==="]"){if(h){d="";h=false}else{h=true}}}else{h=true}var F=d&&h||!d;var k=a(x);if(f()){g=x;_=v}var A=t[x].match(/[[\]]/);w=0;if(F){if(t[x]==="&"){D=i(x);if(D){x+=D[1].length-2;continue}++v;++b}else if(o(x)){++v;++b;w=1;x+=1}else if(!A||!m){++v;++b}}if(u(x)){if(strlen(t[x])===2){b++}var T=s(E);var S=T.length;if(T===";"){D=t.slice(0,x+1).match(C);if(D){w=D[1].length;S=w+1}}var R={last:p(),count:v,index:x-w,formatting:d,length:b,text:h,size:S,space:g,space_count:_};var B=n(R);if(B===false){break}else if(B){if(B.count!==undefined){v=B.count}if(B.length!==undefined){b=B.length}if(B.space!==undefined){y=g;g=B.space}if(B.index!==undefined){x=B.index;continue}}}else if(x===t.length-1&&!c){n({last:true,count:v+1,index:x,formatting:d,length:0,text:h,space:g})}if(h){x+=l()}}},partition:function e(n){if(!$.terminal.have_formatting(n)){var t=$.terminal.split_characters(n);return t.map(i)}var r=[];function i(e){if(e.match(/\\$/)){e+="\\"}return"[[;;]"+e+"]"}function a(e){if($.terminal.is_formatting(e)){if(e.match(/\\]$/)){e=e.replace(/\\]/g,"\\\\]")}}else{e=i(e)}return e}$.terminal.iterate_formatting(n,function(e){if(e.text){var t=[];if(e.formatting){t.push(e.formatting)}t.push(n.substring(e.index,e.index+e.size));if(e.formatting){t.push("]")}r.push(a(t.join("")))}});return r},substring:function e(t,n,r){var i=$.terminal.split_characters(t);if(!i.slice(n,r).length){return""}if(!$.terminal.have_formatting(t)){return i.slice(n,r).join("")}var a=0;var o;var u="";var s="";var l;var f=1;$.terminal.iterate_formatting(t,function(e){if(n&&e.count===n+1){a=e.index;if(e.formatting){u=e.formatting}}if(r&&e.count===r){s=e.formatting;l=e.index;f=e.size}if(e.count===r+1){o=e.index;if(e.formatting){o=l+f}}});if(n&&!a){return""}if(o===undefined){o=t.length}t=u+t.slice(a,o);if(s){t=t.replace(/(\[\[^\]]+)?\]$/,"");t+="]"}return t},normalize:function e(t){t=t.replace(format_re,function(e,t,n){if(t.match(self_closing_re)&&n===""){return"[["+t+"] ]"}if(n===""){return""}function r(e){return e.replace(/\\\]/g,"&#93;").replace(/\n/g,"\\n").replace(/&nbsp;/g," ")}t=r(t);var i=t.match(/;/g).length;if(i>=4){var a=t.split(/;/);var o=a.slice(0,4).join(";");var u=a.slice(4).join(";");return"[["+o+";"+(u||n)+"]"+n+"]"}else if(i===2){i=";;"}else if(i===3){i=";"}t+=i+r(n);return"[["+t+"]"+n+"]"});return $.terminal.amp(t)},split_equal:function e(t,c,p){var m="";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=make_next_char_fun(h);var D=0;var g;var _=h.length;var y=!!h.match(/\[\[[^\]]+\](?:[^\][]|\\\])+\]$/);$.terminal.iterate_formatting(h,function(e){var t,n;if(e.length>=c||e.last||e.length===c-1&&strlen(h[e.index+1])===2){var r=false;if(p&&e.space!==-1){var i=text(h).substring(e.space_count);i=i.slice(0,c).trim();var a=strlen(i);if(i.match(/\s/)||a<c){r=true}}var o=e.index+e.size;if(y){o+=1}var u;if(p&&e.space!==-1&&o!==_&&r){g=h.slice(D,e.space);u=e.space-1}else{n=h.slice(e.index);t=v(n);g=h.slice(D,e.index)+t;if(e.last&&y&&t!=="]"){g+="]"}u=e.index+t.length-1}if(p){g=g.replace(/^(&nbsp;|\s)+|(&nbsp;|\s)+$/g,"")}D=(u||e.index)+1;if(m){var s=g.match(/^[^\]]*\]/);g=m+g;if(s){m=""}}var l=g.match(format_re);if(l){var f=l[l.length-1];if(f[f.length-1]!=="]"){m=f.match(format_begin_re)[1];g+="]"}else if(g.match(format_end_re)){g=g.replace(format_end_re,"");m=f.match(format_begin_re)[1]}}d.push(g);return{index:u,length:0,space:-1}}})}return d},amp:function e(t){return t.replace(/&(?!#[0-9]+;|#x[0-9a-f]+;|[a-z]+;)/gi,"&amp;")},encode:function e(t,n){var s=$.extend({tabs:4,before:""},n);return $.terminal.amp(t).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ /g,"&nbsp;").split("\n").map(function(e){var u=e.split(/((?:\[\[[^\]]+\])?\t(?:\])?)/);u=u.filter(Boolean);return u.map(function(e,o){if(e.match(/\t/)){return e.replace(/\t([^\t]*)$/,function(e,t){if(o!==0&&u[o-1].match(/\t\]?$/)){var n=new Array(s.tabs+1).join("&nbsp;");return n+t}else{var r=u.slice(o-1,o).join("");if(s.before&&o<=1){r=s.before+r}var i=$.terminal.length(r);var a=s.tabs-i%s.tabs;if(a===0){a=4}return new Array(a+1).join("&nbsp;")+t}})}return e}).join("")}).join("\n")},nested_formatting:function e(t){if(!$.terminal.have_formatting(t)){return t}var a=[];var n=/((?:\[\[(?:[^\][]|\\\])+\])?(?:[^\][]|\\\])*\]?)/;var o=/\[\[([^\][]+)\][\s\S]*/;var u=/^\[\[([^;]*);([^;]*);([^\]]*)\]/;function s(e){var t=[[],"",""];if(!e.length){return t}for(var n=e.length;n--;){var r=e[n].split(";");var i=r[0].split(/(-?[@!gbiuso])/g).filter(Boolean);i.forEach(function(e){if(t[0].indexOf(e)===-1){t[0].push(e)}});for(var a=1;a<t.length;++a){var o=r[a].trim();if(o&&!t[a]){t[a]=o}}}var u=t[0].filter(function(e){return e[0]==="-"}).map(function(e){return e[1]});t[0]=t[0].filter(function(e){return u.indexOf(e)===-1&&u.indexOf(e[1])===-1}).join("");return t.join(";")}return t.split(n).filter(Boolean).map(function(e){var t;if(e.match(/^\[\[/)){var n=e.replace(o,"$1");var r=$.terminal.is_formatting(e);e=e.replace(u,"");a.push(n);if($.terminal.nested_formatting.__inherit__){t=s(a)}else{t=n}if(!r){e+="]"}else{a.pop()}e="[["+t+"]"+e}else{var i=false;if(e.match(/\]/)){i=true}if(a.length){if($.terminal.nested_formatting.__inherit__){t=s(a)}else{t=a[a.length-1]}e="[["+t+"]"+e}if(i){a.pop()}else if(a.length){e+="]"}}return e}).join("")},escape_formatting:function e(t){return $.terminal.escape_brackets(t)},apply_formatters:function e(t,a){if(t===""){if(a&&typeof a.position==="number"){return["",a.position]}else{return""}}function i(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")}}function p(t){if(!a||!t){return true}var e=["echo","command","prompt"];var n=e.some(function(e){return t[e]===true});if(!n){return true}for(var r=e.length;r--;){var i=e[r];if(t[i]===true&&a[i]===true){return true}}return false}a=a||{};var n=a.formatters||$.terminal.defaults.formatters;var m=0;function d(e,t){var n=$.extend({},a,{position:t[1]});var r=e(t[0],n);if(typeof r==="string"){i(e,m-1,r,t[0]);if(typeof r==="string"){return[r,n.position]}return t}else if(is_array(r)&&r.length===2){return r}else{return t}}var r;if(typeof a.position==="number"){r=[t,a.position]}else{r=[t,0]}try{var o=n.reduce(function(u,s){m++;if(typeof s==="function"&&s.__meta__){return d(s,u)}else{var l=0;var f=false;var e=$.terminal.format_split(u[0]);var t=e.map(function(e){var t;var n=text(e).length;if(u[1]<l+n&&!f){t=u[1]-l;f=true}else if(f){t=-1}else{t=u[1]}var r=l;var i;l+=n;if($.terminal.is_formatting(e)){if(f){return[e,t]}return[e,-1]}else{if(is_array(s)){var a=s[2]||{};i=[e,t<0?0:t];if(i[0].match(s[0])&&p(s[2])){if(a.loop){while(i[0].match(s[0])){i=$.terminal.tracking_replace(i[0],s[0],s[1],i[1])}}else{i=$.terminal.tracking_replace(i[0],s[0],s[1],i[1])}}if(t<0){return[i[0],-1]}}else if(typeof s==="function"){i=d(s,[e,t])}if(typeof i!=="undefined"){if(i[1]!==-1){i[1]+=r}var o=text(i[0]).length;if(o!==n){}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=u[1]}else{i=n[1]}var a=text(r).length;a+=count_selfclosing_formatting(r);if(i>a){i=a}if(r===u[0]){return u}var o=$.terminal.strip(u[0]);var c=$.terminal.strip(r);if(o===c){return[r,u[1]]}return[r,i]}},r);if(typeof a.position==="number"){var u=$.terminal.strip(o[0]).length;if($.terminal.length(o[0])<u){var s=o[1];s=normalize_position(o[0],s);var l=$.terminal.length(o[0]);if(s>l){s=l}o[1]=s}return o}else{return o[0]}}catch(e){var f="Error in formatter ["+(m-1)+"]";n.splice(m-1);throw new $.terminal.Exception("formatting",f,e.stack)}},format:function i(e,t){var h=$.extend({},{linksNoReferrer:false,linksNoFollow:false,allowedAttributes:[],char_width:undefined,escape:true,anyLinks:false},t||{});function r(e){if(e.length&&h.allowedAttributes.length){return e.filter(function(e){if(e==="data-text"){return false}var t=false;var n=h.allowedAttributes;for(var r=0;r<n.length;++r){if(n[r]instanceof RegExp){if(n[r].test(e)){t=true;break}}else if(n[r]===e){t=true;break}}return t})}return[]}function v(e,t){if(e===""){return t}else{return e.replace(/&#93;/g,"]").replace(/>/g,"&gt;").replace(/</g,"&lt;")}}function D(n){if(n){var e=r(Object.keys(n));if(e.length){return" "+e.map(function(e){var t=n[e].replace(/"/g,"&quot;");return e+'="'+t+'"'}).join(" ")}}return""}function g(){var e=["noopener"];if(h.linksNoReferrer){e.unshift("noreferrer")}if(h.linksNoFollow){e.unshift("nofollow")}return e}function n(e){return e.match(/^\.{1,2}\//)||e.match(/^\//)||!(e.match(/\//)||e.match(/^[^:]+:/))}function a(n){return function(e){if(h.anyLinks){return true}var t=n(e);if(!t){warn("Invalid URL "+e+" only http(s) ftp and Path "+"are allowed")}return t}}var _=a(function(e){return e.match(/^((https?|ftp):\/\/|\.{0,2}\/)/)||n(e)});var y=a(function(e){return e.match(/^(https?:|blob:|data:)/)||n(e)});function i(e,t,n,r,i,a,o){var u;if(a.match(/;/)){try{var s=a.split(";");var l=s.slice(1).join(";").replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">");if(l.match(/^\s*\{[^}]*\}\s*$/)){u=JSON.parse(l);a=s[0]}}catch(e){}}if(o===""&&!t.match(/@/)){return""}o=safe(o);o=o.replace(/\\\]/g,"&#93;");if(h.escape){o=o.replace(/\\\\/g,"\\")}var f="";if(t.indexOf("b")!==-1){f+="font-weight:bold;"}var c=[];if(t.indexOf("u")!==-1){c.push("underline")}if(t.indexOf("s")!==-1){c.push("line-through")}if(t.indexOf("o")!==-1){c.push("overline")}if(c.length){f+="text-decoration:"+c.join(" ")+";"}if(t.indexOf("i")!==-1){f+="font-style:italic;"}if($.terminal.valid_color(n)){f+=["color:"+n,"--color:"+n,"--original-color:"+n].join(";")+";";if(t.indexOf("!")!==-1){f+="--link-color:"+n+";"}if(t.indexOf("g")!==-1){f+="text-shadow:0 0 5px "+n+";"}}if($.terminal.valid_color(r)){f+="background-color:"+r+";"}var p=v(a,o);var m=extra_css(o,h);if(m){o=wide_characters(o,h);f+=m}var d;if(t.indexOf("!")!==-1){if(p.match(email_re)){d='<a href="mailto:'+p+'"'}else{if(!_(p)){p=""}d='<a target="_blank"';if(p){d+=' href="'+p+'"'}d+=' rel="'+g().join(" ")+'"'}d+=' tabindex="1000"'}else if(t.indexOf("@")!==-1){d="<img";if(y(p)){d+=' src="'+p+'"'}}else{d="<span"}if(u&&u.style){u.style=f+u.style;f=""}d+=D(u);if(f!==""){d+=' style="'+f+'"'}if(i!==""){d+=' class="'+i+'"'}if(t.indexOf("!")!==-1){d+=" data-text>"+o+"</a>"}else if(t.indexOf("@")!==-1){d+=" data-text/>"}else{d+=' data-text="'+p.replace(/"/g,"&quot;")+'">'+"<span>"+o+"</span></span>"}return d}if(typeof e==="string"){var o=$.terminal.format_split(e);e=$.map(o,function(e){if(e===""){return e}else if($.terminal.is_formatting(e)){e=e.replace(/\[\[[^\]]+\]/,function(e){return e.replace(/&nbsp;/g," ")});return e.replace(format_parts_re,i)}else{e=safe(e);e=e.replace(/\\\]/,"&#93;");var t=e;var n=extra_css(e,h);var r;if(n.length){e=wide_characters(e,h);r='<span style="'+n+'"'}else{r="<span"}return r+' data-text="'+t+'">'+e+"</span>"}}).join("");return e.replace(/<span><br\s*\/?><\/span>/gi,"<br/>")}else{return""}},escape_brackets:function e(t){return t.replace(/\[/g,"&#91;").replace(/\]/g,"&#93;").replace(/\\/g,"&#92;")},unescape_brackets:function e(t){return t.replace(/&#91;/g,"[").replace(/&#93;/g,"]").replace(/&#92;/g,"\\")},length:function(e,t){return $.terminal.split_characters(t?e:text(e)).length},split_characters:function e(t){var n=[];var r=make_next_char_fun(t);while(t.length){var i=r(t);t=t.slice(i.length);n.push(i)}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 a=Math.max.apply(null,i)+n;var o=Math.floor(t/a)-1;if(o<1){return e.join("\n")}var u=[];for(var s=0,l=e.length;s<l;s+=o){var f=e.slice(s,s+o);var c=f.pop();u.push(f.reduce(function(e,t){var n=$.terminal.strip(t);var r=new Array(a-n.length+1).join(" ");e.push(t+r);return e},[]).join("")+c)}return u.join("\n")},strip:function e(t){if(!$.terminal.have_formatting(t)){return t}return $.terminal.format_split(t).map(function(e){if($.terminal.is_formatting(e)){e=e.replace(format_parts_re,"$6");return e.replace(/\\([[\]])/g,function(e,t){return t})}return e}).join("")},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 u={_:[]};function s(e){this.value=e}var r=t.reduce(function(e,t){var n=typeof t==="string"?t:"";if(n.match(/^--?[^-]/)&&e instanceof s){u[e.value]=true}if(n.match(/^--[^-]/)){var r=n.replace(/^--/,"");if(o.boolean.indexOf(r)===-1){return new s(r)}else{u[r]=true}}else if(n.match(/^-[^-]/)){var i=n.replace(/^-/,"").split("");if(o.boolean.indexOf(i.slice(-1)[0])===-1){var a=i.pop()}i.forEach(function(e){u[e]=true});if(a){return new s(a)}}else if(e instanceof s){u[e.value]=t}else if(t){u._.push(t)}return null},null);if(r instanceof s){u[r.value]=true}return u},extended_command:function extended_command(term,string,options){var settings=$.extend({invokeMethods:false},options);var deferred=new $.Deferred;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");deferred.reject()}else{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{var ret=obj[fn].apply(term,args);if(ret&&ret.then){return ret}}deferred.resolve()}catch(e){term.error("Invalid invocation in "+$.terminal.escape_brackets(string));deferred.reject()}}}else{return term.exec(string,true).done(function(){change_hash=true})}}catch(e){deferred.reject()}return deferred.promise()},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 o=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 a={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,a)}n.data=JSON.stringify(a)},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 a;try{a=JSON.parse(t)}catch(e){if(u.error){u.error(r,"Invalid JSON",e)}else{throw new $.terminal.Exception("JSON","Invalid JSON",e.stack)}o.reject({message:"Invalid JSON",response:t});return}if(is_function(u.response)){u.response(r,a)}if(s(a)||u.method==="system.describe"){if(u.success){u.success(a,n,r)}o.resolve(a)}else{if(u.error){u.error(r,"Invalid JSON-RPC")}o.reject({message:"Invalid JSON-RPC",response:t})}},error:u.error,contentType:"application/json",dataType:"text",async:true,cache:false,type:"POST"});return o.promise()};function terminal_ready(e){return!!(e.closest("body").length&&e.is(":visible")&&e.find(".cmd-prompt").length)}function get_char_size(e){var t;if(terminal_ready(e)){var n=e.find(".cmd-prompt").clone().css({visiblity:"hidden",position:"absolute"});n.appendTo(e.find(".cmd")).html("&nbsp;");t=n[0].getBoundingClientRect();n.remove()}else{var r=$('<div class="terminal terminal-temp"><div class="terminal-'+'wrapper"><div class="terminal-output"><div><div class="te'+'rminal-line" style="float: left"><span>&nbsp;</span></div'+"></div></div></div>").appendTo("body");r.addClass(e.attr("class")).attr("id",e.attr("id"));if(e){var i=e.attr("style");if(i){i=i.split(/\s*;\s*/).filter(function(e){return!e.match(/display\s*:\s*none/i)}).join(";");r.attr("style",i)}}t=r.find(".terminal-line")[0].getBoundingClientRect()}var a={width:t.width,height:t.height};if(r){r.remove()}return a}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){var n=e.find(".terminal-fill").height();return Math.floor(n/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 is_promise(e){return is_function(e&&(e.then||e.done))}function is_array(e){return get_type(e)==="array"}function get_type(e){return typeof e==="function"?"function":$.type(e)}var version_set=!$.terminal.version.match(/^\{\{/);var copyright="Copyright (c) 2011-2020 Jakub T. Jankiewicz "+"<https://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-2020 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.__inherit__=false;$.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,mousewheel:null,touchscroll:null,memory:false,cancelableAjax:true,processArguments:true,linksNoReferrer:false,anyLinks:false,linksNoFollow:false,processRPCResponse:null,completionEscape:true,onCommandChange:null,mobileDelete:is_mobile,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:[],mobileIngoreAutoSpace:[],request:$.noop,response:$.noop,describe:"procs",onRPCError:null,keymap:null,doubleTab:null,doubleTabEchoCommand:false,ansiParser:{},completion:false,onInit:$.noop,onClear:$.noop,onBlur:$.noop,onFocus:$.noop,onTerminalChange:$.noop,onExit:$.noop,onPush:$.noop,onPop:$.noop,keypress:$.noop,keydown:$.noop,renderHandler:null,onAfterRedraw:$.noop,onEchoCommand:$.noop,onPaste:$.noop,onFlush:$.noop,onBeforeCommand:null,onAfterCommand:null,onBeforeEcho:null,onAfterEcho:null,onBeforeLogin:null,onAfterLogout:null,onBeforeLogout:null,allowedAttributes:["title",/^aria-/,"id",/^data-/],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",recursiveLoop:"Recursive loop in echo 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(te().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 o(e,t){if(is_function(Fe.renderHandler)){var n=Fe.renderHandler.call(ne,e,t,ne);if(n===false){return false}if(typeof n==="string"||s(n)||is_promise(n)){return n}else{return e}}return e}function a(e){var t=e.data("index");var n=Se[t];var r=n[1];if(is_function(r.unmount)){r.unmount.call(ne,e)}}function i(n,r){if(s(n)){var e=$.extend({},r,{raw:true,finalize:function(e){var t;if(n instanceof $.fn.init){t=n.clone(true,true)}else{t=n}e.find(".terminal-render-item").replaceWith(t);if(r&&is_function(r.finalize)){r.finalize(e,ne)}}});return['<div class="terminal-render-item"/>',e]}}function u(e,t){var n=i(e,t);if(n){ne.echo.apply(ne,n);return true}}function r(e){return le.find("[data-index="+e+"]")}function s(e){return e instanceof $.fn.init||e instanceof Element}function p(e){e=o(e);if(e===false){return}if(u(e)){return}if(typeof e==="string"){ne.echo(e)}else if(is_array(e)){ne.echo($.map(e,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof e==="object"){ne.echo(JSON.stringify(e))}else{ne.echo(e)}}function m(e,o){var t=/(.*):([0-9]+):([0-9]+)$/;var u=e.match(t);if(u){ne.pause(Fe.softPause);$.get(u[1],function(e){var t=u[1];var n=e.split("\n");var i=+u[2]-1;var r=i>2?i-2:0;var a=n.slice(r,i+3).map(function(e,t){var n="["+(i+t-1)+"]: ";var r=o-n.length-4;if(e.length>r){e=e.substring(0,r)+"..."}if(i>2?t===2:t===i){e="[[;#f00;]"+$.terminal.escape_brackets(e)+"]"}return n+e}).filter(Boolean).join("\n");if(a.length){ne.echo("[[b;white;]"+t+"]");ne.echo(a).resume()}},"text")}}function c(e){if(is_function(Fe.onRPCError)){Fe.onRPCError.call(ne,e)}else{ne.error("&#91;RPC&#93; "+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}ne.error(t)}}}function d(n,r){var i=function(e,t){ne.pause(Fe.softPause);$.jrpc({url:n,method:e,params:t,request:function(e,t){try{Fe.request.call(ne,e,t,ne)}catch(e){_(e,"USER")}},response:function(e,t){try{Fe.response.call(ne,e,t,ne)}catch(e){_(e,"USER")}},success:function e(t){if(t.error){c(t.error)}else if(is_function(Fe.processRPCResponse)){Fe.processRPCResponse.call(ne,t.result,ne)}else{p(t.result)}ne.resume()},error:v})};return function(e,t){if(e===""){return}try{e=f(e)}catch(e){_(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("&#91;AUTH&#93; "+te().noTokenError)}}}}function h(o,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,ne)}else{ne.error("Error: "+(e.message||e))}return}var r=o[n.name];var i=get_type(r);if(i==="function"){if(u&&r.length!==n.args.length){ne.error("&#91;Arity&#93; "+sprintf(te().wrongArity,n.name,r.length,n.args.length))}else{return r.apply(ne,n.args)}}else if(i==="object"||i==="string"){var a=[];if(i==="object"){a=Object.keys(r);r=h(r,u,s)}t.push(r,{prompt:n.name+"> ",name:n.name,completion:i==="object"?a:undefined})}else if(is_function(l)){l(e,ne)}else if(is_function(Fe.onCommandNotFound)){Fe.onCommandNotFound.call(ne,e,ne)}else{t.error(sprintf(te().commandNotFound,n.name))}}}function v(e,t,n){ne.resume();if(is_function(Fe.onAjaxError)){Fe.onAjaxError.call(ne,e,t,n)}else if(t!=="abort"){ne.error("&#91;AJAX&#93; "+t+" - "+te().serverResponse+":\n"+$.terminal.escape_brackets(e.responseText))}}function D(a,u,r){function s(e){if(e.error){c(e.error)}else if(is_function(Fe.processRPCResponse)){Fe.processRPCResponse.call(ne,e.result,ne)}else{p(e.result)}ne.resume()}function l(e,t){try{Fe.request.call(ne,e,t,ne)}catch(e){_(e,"USER")}}function f(e,t){try{Fe.response.call(ne,e,t,ne)}catch(e){_(e,"USER")}}function e(e){var n=e;if(Fe.describe!==false&&Fe.describe!==""){Fe.describe.split(".").forEach(function(e){n=n[e]})}if(n&&n.length){var t={};$.each(n,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){ne.error("&#91;Arity&#93; "+sprintf(te().wrongArity,i.name,i.params.length,n))}else{ne.pause(Fe.softPause);if(e){var r=ne.token(true);if(r){t=[r].concat(t)}else{ne.error("&#91;AUTH&#93; "+te().noTokenError)}}$.jrpc({url:a,method:i.name,params:t,request:l,response:f,success:s,error:v})}}}});var o=typeof u==="string"?u:"login";t.help=t.help||function(i){if(typeof i==="undefined"){var e=n.map(function(e){return e.name}).join(", ")+", help";ne.echo("Available commands: "+e)}else{var a=false;$.each(n,function(e,t){if(t.name===i){a=true;var n="";n+="[[bu;;]"+t.name+"]";if(t.params){var r=t.params;if(u&&t.name!==o){r=r.slice(1)}n+=" "+r.join(" ")}if(t.help){n+="\n"+t.help}ne.echo(n);return false}});if(!a){if(i==="help"){ne.echo("[[bu;;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var t="Method `"+i+"' not found ";ne.error(t)}}}};r(t)}else{r(null)}}return $.jrpc({url:a,method:"system.describe",params:[],success:e,request:l,response:f,error:function e(){r(null)}})}function l(t,o,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 a=get_type(r);if(a==="string"){ne.pause(Fe.softPause);if(Fe.describe===false){if(++s===1){l=d(r,o)}else{ne.error(te().oneRPCWithIgnore)}t(i,n)}else{D(r,o,function(e){if(e){$.extend(u,e)}else if(++s===1){l=d(r,o)}else{ne.error(te().oneRPCWithIgnore)}ne.resume();t(i,n)})}}else if(a==="function"){if(l){ne.error(te().oneInterpreterFunction)}else{l=r}t(i,n)}else if(a==="object"){$.extend(u,r);t(i,n)}}else{n()}})(t,function(){n({interpreter:h(u,false,o,l&&l.bind(ne)),completion:Object.keys(u)})})}else if(e==="string"){if(Fe.describe===false){u={interpreter:d(t,o)};if($.isArray(Fe.completion)){u.completion=Fe.completion}n(u)}else{ne.pause(Fe.softPause);D(t,o,function(e){if(e){r.interpreter=h(e,false,o);r.completion=Object.keys(e)}else{r.interpreter=d(t,o)}n(r);ne.resume()})}}else if(e==="object"){n({interpreter:h(t,Fe.checkArity,o),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 g(r,e){var i=get_type(e)==="boolean"?"login":e;return function(e,t,n){ne.pause(Fe.softPause);$.jrpc({url:r,method:i,params:[e,t],request:function(e,t){try{Fe.request.call(ne,e,t,ne)}catch(e){_(e,"USER")}},response:function(e,t){try{Fe.response.call(ne,e,t,ne)}catch(e){_(e,"USER")}},success:function e(t){if(!t.error&&t.result){n(t.result)}else{n(null)}ne.resume()},error:v})}}function _(e,t,n){if(is_function(Fe.exceptionHandler)){Fe.exceptionHandler.call(ne,e,t)}else{ne.exception(e,t);if(!n){setTimeout(function(){throw e},0)}}}var y=[];var b=1;var w;if("Map"in root){w=new Map}function C(e,t,n){var r,i;y.push(b);var a={linksNoReferrer:Fe.linksNoReferrer,linksNoFollow:Fe.linksNoFollow,anyLinks:Fe.anyLinks,char_width:ke.width,escape:false,allowedAttributes:n.allowedAttributes||[]};var o=Fe.useCache&&w;function u(e,t){var n=JSON.stringify([e,a]);if(o){if(w.has(n)){return w.get(n)}}var r={line:$.terminal.format(e,a),newline:t};if(o){w.set(n,r)}return r}if(e instanceof Array){for(r=0,i=e.length;r<i;++r){if(e[r]===""||e[r]==="\r"){y.push({line:"<span></span>"})}else{y.push(u(e[r],r===i-1))}}}else if(!n.raw){y.push(u(e))}else{y.push({line:e})}y.push({finalize:n.finalize,index:t})}function x(e){function t(e,n,r,i,a,o,t){function u(e,t){return"[["+[n+(e||""),r,i,a,t||o].join(";")+"]"}function s(e){return"]"+u("!",e)+e+"]"+u()}if(!n.match(/!/)){var l=t.match(email_full_re)||t.match(url_full_re);if(l){return u("!",l[1])+t+"]"}else if(t.match(email_re)||t.match(url_nf_re)){var f=t.replace(email_re,s).replace(url_nf_re,s);return u("",o)+f+"]"}}return e}if(!$.terminal.have_formatting(e)){return e.replace(email_re,"[[!;;]$1]").replace(url_nf_re,"[[!;;]$1]")}return $.terminal.format_split(e).map(function(e){if($.terminal.is_formatting(e)){return e.replace(format_parts_re,t)}else{return e.replace(email_re,"[[!;;]$1]").replace(url_nf_re,"[[!;;]$1]")}}).join("")}function E(e,t){return(strlen(text(e))>t.cols||e.match(/\n/))&&(Fe.wrap===true&&t.wrap===undefined||Fe.wrap===false&&t.wrap===true)}var F;if("Map"in root){F=new Map}function k(e){try{var n=$.extend({exec:true,raw:false,finalize:$.noop,invokeMethods:false,formatters:true,convertLinks:Fe.convertLinks},e.options||{});var t;t=Ve(e.value);if(t!==""){if(!n.raw){if(n.formatters){try{t=$.terminal.apply_formatters(t,$.extend(Fe,{echo:true}))}catch(e){_(e,"FORMATTING")}}if(Fe.useCache){var r=t;if(F&&F.has(r)){t=F.get(r);C(t,e.index,n);return}}if(n.exec){var i=t.split(format_exec_re);t=$.map(i,function(e){if(e&&e.match(format_exec_re)&&!$.terminal.is_formatting(e)){e=e.replace(/^\[\[|\]\]$/g,"");if(n.exec){var t=e.trim();if(ue&&ue===t){ue="";ne.error(te().recursiveLoop)}else{ue=t;$.terminal.extended_command(ne,e,{invokeMethods:n.invokeMethods}).then(function(){ue=""})}}return""}else{return e}}).join("")}if(t===""){return}if(n.convertLinks){t=x(t)}t=crlf($.terminal.normalize(t));t=$.terminal.encode(t,{tabs:Fe.tabs});var a;var o=n.cols=ne.cols();if(E(t,n)){var u=n.keepWords;a=$.terminal.split_equal(t,o,u)}else if(t.match(/\n/)){a=t.split(/\n/)}}}var s=a||t;if(F&&r){F.set(r,s)}C(s,e.index,n)}catch(e){y=[];if(is_function(Fe.exceptionHandler)){Fe.exceptionHandler.call(ne,e,"TERMINAL")}else{alert_exception("[Internal Exception(process_line)]",e)}}}function A(e){e=$.extend({},{update:false,scroll:true},e||{});if(!e.update){ze.resize(pe);var t=le.empty().detach()}var i=[];if(Fe.outputLimit>=0){var n;if(Fe.outputLimit===0){n=ne.rows()}else{n=Fe.outputLimit}Se.forEach(function(e,t){var n=e[0];var r=e[1];i.push({value:n,index:t,options:r})});var r=i.length-n-1;i=i.slice(r)}else{i=Se.map(function(e,t){return{value:e[0],index:t,options:e[1]}})}try{y=[];$.each(i,function(e,t){k(t)});if(!e.update){ze.before(t)}ne.flush(e);W("onAfterRedraw")}catch(e){if(is_function(Fe.exceptionHandler)){Fe.exceptionHandler.call(ne,e,"TERMINAL (redraw)")}else{alert_exception("[redraw]",e)}}}function T(){if(Fe.outputLimit>=0){var e;if(Fe.outputLimit===0){e=ne.rows()}else{e=Fe.outputLimit}var t=le.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")){a(e);e.remove()}})}}}function S(){if(Fe.greetings===undefined){ne.echo(ne.signature,{finalize:a11y_hide,formatters:false})}else if(Fe.greetings){var e=typeof Fe.greetings;if(e==="string"){ne.echo(Fe.greetings)}else if(e==="function"){try{var t=Fe.greetings.call(ne,ne.echo);var n=L("Greetings");unpromise(t,ne.echo,function(e){n(e);Fe.greetings=null})}catch(e){Fe.greetings=null;_(e,"greetings")}}else{ne.error(te().wrongGreetings)}}}function R(n){if(typeof n==="undefined"){n=ne.get_command()}var e=ze.prompt(true);var t=ze.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={convertLinks:false,exec:false,formatters:false,finalize:function e(t){a11y_hide(t.addClass("terminal-command"));W("onEchoCommand",[t,n])}};n=$.terminal.apply_formatters(n,{command:true});ne.echo(e+n,r)}function B(){return We.outerWidth()!==ne.outerWidth()}function j(e){var t=terminals.get()[e[0]];if(!t){throw new $.terminal.Exception(te().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 L(t){return function(e){ne.error("["+t+"] "+(e.message||e)).resume()}}function O(){if(change_hash){fire_hash_change=false;location.hash="#"+JSON.stringify(hash_commands);setTimeout(function(){fire_hash_change=true},100)}}var P=true;var z=[];function I(n,e,t){function r(){if(Fe.historyState||Fe.execHash&&t){if(!save_state.length){ne.save_state()}else{ne.save_state(null)}}}function i(){if(!t){change_hash=true;if(Fe.historyState){ne.save_state(n,false)}change_hash=l}s.resolve();W("onAfterCommand",[n])}function a(e){if(typeof e!=="undefined"){p(e)}i();ne.resume()}function o(){var e=u.interpreter.call(ne,n,ne);if(e){if(!ce){ne.pause(Fe.softPause)}ce=false;var t=L("Command");if(is_function(e.done||e.then)){return unpromise(e,a,t)}else{return $.when(e).done(a).catch(t)}}else if(Le){z.push(function(){i()})}else{i()}}if(P){P=false;r()}try{if(W("onBeforeCommand",[n])===false){return}if(t){ue=n.trim()}else{oe=$.terminal.split_command(n)}if(!Y()){if(t&&(is_function(Fe.historyFilter)&&Fe.historyFilter(n)||n.match(Fe.historyFilter))){ze.history().append(n)}}var u=Pe.top();if(!e&&Fe.echoCommand){R(n)}var s=new $.Deferred;var l=change_hash;if(n.match(/^\s*login\s*$/)&&ne.token(true)){if(ne.level()>1){ne.logout(true)}else{ne.logout()}i()}else if(Fe.exit&&n.match(/^\s*exit\s*$/)&&!we){var f=ne.level();if(f===1&&ne.get_token()||f>1){if(ne.get_token(true)){ne.set_token(undefined,true)}ne.pop()}i()}else if(Fe.clear&&n.match(/^\s*clear\s*$/)&&!we){ne.clear();i()}else{var c=o();if(c){return c}}return s.promise()}catch(e){_(e,"USER",t);ne.resume();if(t){throw e}}}function N(){if(W("onBeforeLogout",[],true)===false){return}M();W("onAfterlogout",[],true);ne.login(Qe,true,Q)}function M(){var e=ne.prefix_name(true)+"_";Re.remove(e+"token");Re.remove(e+"login")}function H(e){var t=ne.prefix_name()+"_interpreters";var n=Re.get(t);if(n){n=JSON.parse(n)}else{n=[]}if($.inArray(e,n)===-1){n.push(e);Re.set(t,JSON.stringify(n))}}function U(e){var t=Pe.top();var n=ne.prefix_name(true);if(!Y()){H(n)}var r=ne.login_name(true);ze.name(n+(r?"_"+r:""));var i=t.prompt;if(is_function(i)){i=Xe(i)}if(i!==ze.prompt()){if(is_function(t.prompt)){ze.prompt("")}ze.prompt(t.prompt)}if(typeof t.history!=="undefined"){ne.history().toggle(t.history)}if($.isPlainObject(t.keymap)){ze.keymap(null).keymap($.extend({},et,$.omap(t.keymap,function(e,t){return function(){var e=[].slice.call(arguments);try{return t.apply(ne,e)}catch(e){_(e,"USER KEYMAP")}}})))}ze.set("");De.resolve();if(!e&&is_function(t.onStart)){t.onStart.call(ne,ne)}}function W(t,e,n){e=(e||[]).concat([ne]);var r=Pe&&Pe.top();if(r&&is_function(r[t])&&!n){try{return r[t].apply(ne,e)}catch(e){delete r[t];_(e,t)}}else if(is_function(Fe[t])){try{return Fe[t].apply(ne,e)}catch(e){Fe[t]=null;_(e,t)}}}var q=function(){function e(e){if(!e){try{ne.scroll_to(ne.find(".cmd-cursor"));return true}catch(e){return true}}}if(typeof global!=="undefined"&&typeof global.it==="function"){return e}return debounce(e,100,{leading:true,trailing:false})}();function K(){var e=ne.find(".cmd-cursor-line");return e.is_fully_in_viewport(ne).then(q)}function J(){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){j(hash_commands[hash_commands.length-1])}else if(save_state[0]){ne.import_view(save_state[0])}}catch(e){_(e,"TERMINAL")}}}function Q(){U();S();if(Se.length){ne.refresh()}var e=false;if(is_function(Fe.onInit)){Ce=function(){e=true};try{Fe.onInit.call(ne,ne)}catch(e){_(e,"OnInit")}finally{Ce=$.noop;if(!e&&ne.enabled()){ne.resume(true)}}}if(first_instance){first_instance=false;$(window).on("hashchange",J)}}function Y(){return we||ze.mask()!==false}function G(e){var t,n=Pe.top();if(is_function(n.keydown)){t=n.keydown.call(ne,e,ne);if(t!==undefined){return t}}else if(is_function(Fe.keydown)){t=Fe.keydown.call(ne,e,ne);if(t!==undefined){return t}}}var V={"CTRL+D":function(e,t){if(!we){if(ze.get()===""){if(Pe.size()>1||is_function(Qe)){ne.pop("")}else{ne.resume();ne.echo("")}}else{t()}}return false},"CTRL+C":function(){with_selection(function(e){if(e===""){var t=ne.get_command();var n=ne.get_position();t=t.slice(0,n)+"^C"+t.slice(n+2);R(t);ne.set_command("")}else{var r=ne.find("textarea");text_to_clipboard(r,process_selected_html(e))}});return false},"CTRL+L":function(){ne.clear();return false},TAB:function(e,t){var n=Pe.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 a(e){e=e.slice();if(!ne.before_cursor(false).match(/\s/)){if(Fe.clear&&$.inArray("clear",e)===-1){e.push("clear")}if(Fe.exit&&$.inArray("exit",e)===-1){e.push("exit")}}ne.complete(e,{echo:true,word:Fe.wordAutocomplete,escape:Fe.completionEscape,caseSensitive:i,echoCommand:Fe.doubleTabEchoCommand,doubleTab:Fe.doubleTab})}if(r){switch(get_type(r)){case"function":var o=ne.before_cursor(Fe.wordAutocomplete);if(r.length===3){var u=new Error(te().comletionParameters);_(u,"USER");return false}var s=r.call(ne,o,a);unpromise(s,a,L("Completion"));break;case"array":a(r);break;default:throw new $.terminal.Exception(te().invalidCompletion)}}else{t()}return false},"CTRL+V":function(e,t){t(e);ne.oneTime(200,function(){ne.scroll_to_bottom()});return true},"CTRL+TAB":function(){if(terminals.length()>1){ne.focus(false);return false}},PAGEDOWN:function(){ne.scroll(ne.height())},PAGEUP:function(){ne.scroll(-ne.height())}};function X(t){var e,n;if(ne.enabled()){if(!ne.paused()){e=G(t);if(e!==undefined){return e}if(t.which!==9){se=0}}else{if(!Fe.pauseEvents){e=G(t);if(e!==undefined){return e}}if(t.which===68&&t.ctrlKey){if(Fe.pauseEvents){e=G(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(ne,t,"AJAX ABORT")}else{ne.error(te().ajaxAbortError)}}}}requests=[]}ne.resume()}return false}}}function Z(e){var t=Pe.top();if(Be&&(!Le||!Fe.pauseEvents)){if(is_function(t.keypress)){return t.keypress.call(ne,e,ne)}else if(is_function(Fe.keypress)){return Fe.keypress.call(ne,e,ne)}}}function ee(t){return function(e){t.add(e)}}function te(){return $.extend({},$.terminal.defaults.strings,Fe&&Fe.strings||{})}var ne=this;if(this.length>1){return this.each(function(){$.fn.terminal.call($(this),e,$.extend({name:ne.selector},t))})}var re;if(ne.is("body,html")){if(ne.hasClass("full-screen-terminal")){var ie=ne.find("> .terminal").data("terminal");if(ie){return ie}}re=ne;ne=$("<div/>").appendTo("body");$("body").addClass("full-screen-terminal")}else if(ne.data("terminal")){return ne.data("terminal")}$.extend(ne,$.omap({id:function(){return fe},clear:function(){if(W("onClear")!==false){Se.forEach(function(e,t){var n=e[1];if(is_function(n.onClear)){n.onClear.call(ne,r(t))}});Se=[];le[0].innerHTML="";ne.prop({scrollTop:0})}return ne},export_view:function(){var e=W("onExport");e=e||{};return $.extend({},{focus:Be,mask:ze.mask(),prompt:ne.get_prompt(),command:ne.get_command(),position:ze.position(),lines:clone(Se),interpreters:Pe.clone(),history:ze.history().data},e)},import_view:function(t){if(we){throw new Error(sprintf(te().notWhileLogin,"import_view"))}W("onImport",[t]);ge(function e(){ne.set_prompt(t.prompt);ne.set_command(t.command);ze.position(t.position);ze.mask(t.mask);if(t.focus){ne.focus()}Se=clone(t.lines).filter(function(e){return e[0]});if(t.interpreters instanceof Stack){Pe=t.interpreters}if(Fe.importHistory){ze.history().set(t.history)}A()});return ne},save_state:function(e,t,n){if(typeof n!=="undefined"){save_state[n]=ne.export_view()}else{save_state.push(ne.export_view())}if(!$.isArray(hash_commands)){hash_commands=[]}if(e!==undefined&&!t){var r=[fe,save_state.length-1,e];hash_commands.push(r);O()}return ne},exec:function(n,r,e){var i=e||new $.Deferred;_e(function e(){if($.isArray(n)){(function e(){var t=n.shift();if(t){ne.exec(t,r).done(e)}else{i.resolve()}})()}else if(Le){$e.push([n,r,i])}else{var t=I(n,r,true);unpromise(t,function(){i.resolve()},function(){i.reject()})}});return i.promise()},autologin:function(e,t,n){ne.trigger("terminal.autologin",[e,t,n]);return ne},login:function(r,i,a,o){he.push([].slice.call(arguments));if(we){throw new Error(sprintf(te().notWhileLogin,"login"))}if(!is_function(r)){throw new Error(te().loginIsNotAFunction)}we=true;if(ne.token()&&ne.level()===1&&!Oe){we=false;ne.logout(true)}else if(ne.token(true)&&ne.login_name(true)){we=false;if(is_function(a)){a()}return ne}if(Fe.history){ze.history().disable()}function u(){while(ne.level()>e){ne.pop(undefined,true)}if(Fe.history){ze.history().enable()}}var e=ne.level();function s(e,t,n){if(ne.paused()){ne.resume()}if(t){u();var r=ne.prefix_name(true)+"_";Re.set(r+"token",t);Re.set(r+"login",e);we=false;W("onAfterLogin",[e,t]);if(is_function(a)){a()}}else{if(i){if(!n){ne.error(te().wrongPasswordTryAgain)}ne.pop(undefined,true).set_mask(false)}else{we=false;if(!n){ne.error(te().wrongPassword)}ne.pop(undefined,true).pop(undefined,true)}if(is_function(o)){o()}}ne.off("terminal.autologin")}ne.on("terminal.autologin",function(e,t,n,r){if(W("onBeforeLogin",[t,n])===false){return}s(t,n,r)});ne.push(function(n){ne.set_mask(Fe.maskChar).push(function(e){try{if(W("onBeforeLogin",[n,e])===false){u();return}ne.pause();var t=r.call(ne,n,e,function(e,t){s(n,e,t)});if(t&&is_function(t.then||t.done)){(t.then||t.done).call(t,function(e){s(n,e)})}}catch(e){_(e,"AUTH")}},{prompt:te().password+": ",name:"password"})},{prompt:te().login+": ",name:"login"});return ne},settings:function(){return Fe},before_cursor:function(e){var t=ze.position();var n=ze.get().slice(0,t);var r=n.split(" ");var i;if(e){if(r.length===1){i=r[0]}else{var a=n.match(/(\\?")/g);var o=a?a.filter(function(e){return!e.match(/^\\/)}).length:0;a=n.match(/'/g);var u=a?a.length:0;if(u%2===1){i=n.match(/('[^']*)$/)[0]}else if(o%2===1){i=n.match(/("(?:[^"]|\\")*)$/)[0]}else{i=r[r.length-1];for(Ke=r.length-1;Ke>0;Ke--){var s=r[Ke-1];if(s[s.length-1]==="\\"){i=r[Ke-1]+" "+i}else{break}}}}}else{i=n}return i},complete:function(r,i){i=$.extend({word:true,echo:false,escape:true,echoCommand:false,caseSensitive:true,doubleTab:null},i||{});var a=i.caseSensitive;var o=ne.before_cursor(i.word).replace(/\\"/g,'"');var s=false;if(i.word){if(o.match(/^"/)){s='"'}else if(o.match(/^'/)){s="'"}if(s){o=o.replace(/^["']/,"")}}if(se%2===0){de=ne.before_cursor(i.word)}else{var e=ne.before_cursor(i.word);if(e!==de){return}}var t=$.terminal.escape_regex(o);if(i.escape){t=t.replace(/(\\+)(["'() ])/g,function(e,t,n){if(n.match(/[()]/)){return t+"\\?\\"+n}else{return t+"?"+n}})}function u(e){if(s==='"'){e=e.replace(/"/g,'\\"')}if(!s&&i.escape){e=e.replace(/(["'() ])/g,"\\$1")}return e}function n(){var e=[];for(var t=r.length;t--;){if(r[t].match(/\n/)&&i.word){warn("If you use commands with newlines you "+"should use word option for complete or"+" wordAutocomplete terminal option")}if(f.test(r[t])){var n=u(r[t]);if(!a&&same_case(n)){if(o.toLowerCase()===o){n=n.toLowerCase()}else if(o.toUpperCase()===o){n=n.toUpperCase()}}e.push(n)}}return e}var l=a?"":"i";var f=new RegExp("^"+t,l);var c=n();function p(e,t){var n=ne.get_command();var r=ne.get_position();var i=new RegExp("^"+e,"i");var a=n.slice(0,r);var o=n.slice(r);var u=t.replace(i,"")+(s||"");ne.set_command(a+u+o);ne.set_position((a+u).length)}if(c.length===1){if(i.escape){p(t,c[0])}else{ne.insert(c[0].replace(f,"")+(s||""))}de=ne.before_cursor(i.word);return true}else if(c.length>1){if(++se>=2){se=0;if(i.echo){if(is_function(i.doubleTab)){if(i.echoCommand){R()}var m=i.doubleTab.call(ne,o,c,R);if(typeof m==="undefined"){return true}else{return m}}else if(i.doubleTab!==false){R();var d=c.slice().reverse().join("\t\t");ne.echo($.terminal.escape_brackets(d),{keepWords:true,formatters:false})}return true}}else{var h=common_string(u(o),c,a);if(h){p(t,h);de=ne.before_cursor(i.word);return true}}}},commands:function(){return Pe.top().interpreter},set_interpreter:function(e,t){function n(){ne.pause(Fe.softPause);l(e,t,function(e){ne.resume();var t=Pe.top();$.extend(t,e);U(true)})}if(is_function(t)){ne.login(t,true,n)}else if(get_type(e)==="string"&&t){ne.login(g(e,t),true,n)}else{n()}return ne},greetings:function(){S();return ne},paused:function(){return Le},pause:function(t){_e(function e(){Ce();Le=true;ze.disable(t||is_android);if(!t){ze.find(".cmd-prompt").hidden()}W("onPause")});return ne},resume:function(i){_e(function e(){Le=false;if(Be&&terminals.front()===ne){ze.enable(i)}ze.find(".cmd-prompt").visible();var t=$e;$e=[];for(var n=0;n<t.length;++n){ne.exec.apply(ne,t[n])}ne.trigger("resume");var r=z.shift();if(r){r()}ne.scroll_to_bottom();W("onResume")});return ne},cols:function(){if(Fe.numChars){return Fe.numChars}if(typeof pe==="undefined"||pe===1e3){pe=get_num_chars(ne,ke)}return pe},rows:function(){if(Fe.numRows){return Fe.numRows}if(typeof me==="undefined"){me=get_num_rows(ne,ke)}return me},history:function(){return ze.history()},history_state:function(e){function t(){Fe.historyState=true;if(!save_state.length){ne.save_state()}else if(terminals.length()>1){ne.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(t,0)}else{setImmediate(t)}}else{Fe.historyState=false}return ne},clear_history_state:function(){hash_commands=[];save_state=[];return ne},next:function(){if(terminals.length()===1){return ne}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){_(e,"onTerminalChange")}return e}},focus:function(n,r){_e(function e(){if(terminals.length()===1){if(n===false){ne.disable(r)}else{ne.enable(r)}}else if(n===false){ne.next()}else{var t=terminals.front();if(t!==ne){terminals.forEach(function(e){if(e!==ne&&e.enabled()){e.disable(r)}});if(!r){try{trigger_terminal_change(ne)}catch(e){_(e,"onTerminalChange")}}}terminals.set(ne);ne.enable(r)}});return ne},freeze:function(t){ge(function e(){if(t){ne.disable();je=true}else{je=false;ne.enable()}});return ne},frozen:function(){return je},enable:function(n){if(!Be&&!je){if(pe===undefined){ne.resize()}_e(function e(){var t;if(!n&&!Be){W("onFocus")}if(!n&&t===undefined||n){Be=true;if(!ne.paused()){ze.enable(true)}}})}return ne},clear_cache:"Map"in root?function(){w.clear();F.clear();return ne}:function(){return ne},disable:function(n){_e(function e(){var t;if(!n&&Be){t=W("onBlur")}if(!n&&t===undefined||n){Be=false;ze.disable()}});return ne},enabled:function(){return Be},signature:function(){var e=ne.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 ze},get_command:function(){return ze.get()},echo_command:function(e){return R(e)},set_command:function(t,n){ge(function e(){if(typeof t!=="string"){t=JSON.stringify(t)}ze.set(t,undefined,n)});return ne},set_position:function(t,n){ge(function e(){ze.position(t,n)});return ne},get_position:function(){return ze.position()},insert:function(n,r){if(typeof n==="string"){ge(function e(){var t=ne.is_bottom();ze.insert(n,r);if(Fe.scrollOnEcho||t){ne.scroll_to_bottom()}});return ne}else{throw new Error(sprintf(te().notAString,"insert"))}},set_prompt:function(t){ge(function e(){if(is_function(t)){ze.prompt(function(e){t.call(ne,e,ne)})}else{ze.prompt(t)}Pe.top().prompt=t});return ne},get_prompt:function(){return Pe.top().prompt},set_mask:function(t){ge(function e(){ze.mask(t===true?Fe.maskChar:t)});return ne},get_output:function(e){if(e){return Se}else{return $.map(Se,function(e){return is_function(e[0])?e[0]():e[0]}).join("\n")}},resize:function(e,t){if(!ne.is(":visible")){ne.stopTime("resize");ne.oneTime(500,"resize",function(){ne.resize(e,t)})}else{if(e&&t){ne.width(e);ne.height(t)}e=ne.width();t=ne.height();if(typeof Fe.numChars!=="undefined"||typeof Fe.numRows!=="undefined"){ze.resize(Fe.numChars);ne.refresh();W("onResize");return}var n=get_num_chars(ne,ke);var r=get_num_rows(ne,ke);if(n!==pe||r!==me){pe=n;me=r;ze.resize(pe);ne.refresh();W("onResize")}}return ne},refresh:function(){if(ke.width!==0){ne[0].style.setProperty("--char-width",ke.width)}A({scroll:false,update:true});return ne},flush:function(e){e=$.extend({},{update:false,scroll:true},e||{});try{var t=ne.is_bottom();le.css("visibilty","hidden");var n;while(y.length){var r=y.shift();if(r===b){n=$(document.createElement("div"))}else if($.isPlainObject(r)&&is_function(r.finalize)){if(e.update){var i="> div[data-index="+r.index+"]";var a=le.find(i);if(a.html()!==n.html()){a.replaceWith(n)}}else{n.appendTo(le)}n.attr("data-index",r.index);r.finalize(n)}else{var o=r.line;var u=document.createElement("div");u.style.width="100%";u.innerHTML=o;if(r.newline){u.className="cmd-end-line"}n[0].appendChild(u)}}T();le.css("visibilty","");W("onFlush");var s=ne.find(".cmd").offset();var l=ne.offset();setTimeout(function(){css(ne[0],{"--terminal-height":ne.height(),"--terminal-x":s.left-l.left,"--terminal-y":s.top-l.top,"--terminal-scroll":ne.prop("scrollTop")})},0);if(Fe.scrollOnEcho&&e.scroll||t){ne.scroll_to_bottom()}}catch(e){if(is_function(Fe.exceptionHandler)){try{Fe.exceptionHandler.call(ne,e,"TERMINAL (Flush)")}catch(e){Fe.exceptionHandler=$.noop;alert_exception("[exceptionHandler]",e)}}else{alert_exception("[Flush]",e)}}finally{y=[]}return ne},update:function(n,t,r){ge(function e(){if(n<0){n=Se.length+n}if(!Se[n]){ne.error("Invalid line number "+n)}else if(t===null){Se.splice(n,1);le.find("[data-index="+n+"]").remove()}else{t=o(t,{update:true,line:n});if(t===false){return ne}unpromise(t,function(e){var t=i(e,r);if(t){e=t[0];r=t[1]}Se[n][0]=e;if(r){Se[n][1]=$.extend(Se[n][1],r)}k({value:e,index:n,options:Se[n][1]});ne.flush({scroll:false,update:true})})}});return ne},remove_line:function(e){return ne.update(e,null)},last_index:function(){return Se.length-1},echo:function(e,i){var a=arguments.length>0;function t(t){try{var n=$.extend({flush:true,exec:true,raw:Fe.raw,finalize:$.noop,unmount:$.noop,keepWords:false,invokeMethods:Fe.invokeMethods,onClear:null,formatters:true,allowedAttributes:Fe.allowedAttributes},i||{});(function(t){n.finalize=function(e){if(n.raw){e.addClass("raw")}try{if(is_function(t)){t.call(ne,e)}e.find("img").each(function(){var e=$(this);var t=new Image;t.onerror=function(){e.replaceWith(use_broken_image)};t.src=this.src})}catch(e){_(e,"USER:echo(finalize)");t=null}}})(n.finalize);if(n.flush){if(y.length){ne.flush()}}if(W("onBeforeEcho",[t])===false){return}var e;if(typeof t==="function"){e=t.bind(ne)}else if(typeof t==="undefined"){if(a){e=String(t)}else{e=""}}else{var r=o(t,{});if(r===false){return ne}e=r}unpromise(e,function(e){if(u(e,n)){return ne}k({value:e,options:n,index:Se.length});n.exec=false;Se.push([e,n]);if(n.flush){ne.flush();W("onAfterEcho",[t])}})}catch(e){if(is_function(Fe.exceptionHandler)){Fe.exceptionHandler.call(ne,e,"TERMINAL (echo)")}else{alert_exception("[Terminal.echo]",e)}}}if(e!==undefined&&is_function(e.then)){$.when(e).done(t).catch(L("Echo"))}else{t(e)}return ne},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(/\\$/,"&#92;").replace(url_re,"]$1[[;;;terminal-error]");return"[[;;;terminal-error]"+t+"]"}if(typeof e==="function"){return ne.echo(function(){return n(e.call(ne))},t)}if(e&&e.then){e.then(function(e){ne.echo(n(e))}).catch(L("Echo Error"));return ne}return ne.echo(n(e),t)},exception:function(r,e){var t=exception_message(r);if(e){t="&#91;"+e+"&#93;: "+t}if(t){ne.error(t,{finalize:function(e){e.addClass("terminal-exception terminal-message")},keepWords:true})}if(typeof r.fileName==="string"){ne.pause(Fe.softPause);$.get(r.fileName,function(e){var t=r.lineNumber-1;var n=e.split("\n")[t];if(n){ne.error("["+r.lineNumber+"]: "+n)}ne.resume()},"text")}if(r.stack){var n=$.terminal.escape_brackets(r.stack);ne.echo(n.split(/\n/g).map(function(e){return"[[;;;terminal-error]"+e.replace(url_re,function(e){return"]"+e+"[[;;;terminal-error]"})+"]"}).join("\n"),{finalize:function(e){e.addClass("terminal-exception terminal-stack-trace")},formatters:false})}return ne},scroll:function(e){var t;e=Math.round(e);if(ne.prop){if(e>ne.prop("scrollTop")&&e>0){ne.prop("scrollTop",0)}t=ne.prop("scrollTop");ne.scrollTop(t+e)}else{if(e>ne.prop("scrollTop")&&e>0){ne.prop("scrollTop",0)}t=ne.prop("scrollTop");ne.scrollTop(t+e)}return ne},logout:function(n){if(we){throw new Error(sprintf(te().notWhileLogin,"logout"))}ge(function e(){if(n){var t=he.pop();ne.set_token(undefined,true);ne.login.apply(ne,t)}else if(Pe.size()===1&&ne.token()){ne.logout(true)}else{while(Pe.size()>1){if(ne.token()){ne.logout(true).pop().pop()}else{ne.pop()}}}});return ne},token:function(e){return Re.get(ne.prefix_name(e)+"_token")},set_token:function(e,t){var n=ne.prefix_name(t)+"_token";if(typeof e==="undefined"){Re.remove(n)}else{Re.set(n,e)}return ne},get_token:function(e){return ne.token(e)},login_name:function(e){return Re.get(ne.prefix_name(e)+"_login")},name:function(){return Pe.top().name},prefix_name:function(e){var t=(Fe.name?Fe.name+"_":"")+fe;if(e&&Pe.size()>1){var n=Pe.map(function(e){return e.name||""}).slice(1).join("_");if(n){t+="_"+n}}return t},read:function(e,t,n){ce=true;var r=jQuery.Deferred();var i=false;ne.push(function(e){i=true;r.resolve(e);if(is_function(t)){t(e)}ne.pop();if(Fe.history){ze.history().enable()}},{name:"read",history:false,prompt:e||"",onExit:function(){if(!i){r.reject();if(is_function(n)){n()}}}});if(Fe.history){ze.history().disable()}return r.promise()},push:function(o,u){_e(function e(){u=u||{};var t={infiniteLogin:false};var r=$.extend({},t,u);if(!r.name&&oe){r.name=oe.name}if(r.prompt===undefined){r.prompt=(r.name||">")+" "}var n=Pe.top();if(n){n.mask=ze.mask()}var i=Le;function a(){W("onPush",[n,Pe.top()]);U()}l(o,u.login,function(e){Pe.push($.extend({},e,r));if(r.completion===true){if($.isArray(e.completion)){Pe.top().completion=e.completion}else if(!e.completion){Pe.top().completion=false}}if(r.login){var t;var n=get_type(r.login);if(n==="function"){t=r.infiniteLogin?$.noop:ne.pop;ne.login(r.login,r.infiniteLogin,a,t)}else if(get_type(o)==="string"&&n==="string"||n==="boolean"){t=r.infiniteLogin?$.noop:ne.pop;ne.login(g(o,r.login),r.infiniteLogin,a,t)}}else{a()}if(!i&&ne.enabled()){ne.resume()}})});return ne},pop:function(e,t){if(e!==undefined){R(e)}var n=ne.token(true);var r;if(Pe.size()===1){r=Pe.top();if(Fe.login){if(!t){W("onPop",[r,null])}N();W("onExit")}else{ne.error(te().canExitError)}}else{if(n){M()}var i=Pe.pop();r=Pe.top();U();ne.set_mask(r.mask);if(!t){W("onPop",[i,r])}if(we&&ne.get_prompt()!==te().login+": "){we=false}if(is_function(i.onExit)){try{i.onExit.call(ne,ne)}catch(e){i.onExit=$.noop;_(e,"onExit")}}}return ne},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)$/)){A()}}return ne},invoke_key:function(e){ze.invoke_key(e);return ne},keymap:function(e,n){if(arguments.length===0){return ze.keymap()}if(typeof n==="undefined"){if(typeof e==="string"){return ze.keymap(e)}else if($.isPlainObject(e)){e=$.extend({},et,$.omap(e||{},function(n,r){if(!et[n]){return r.bind(ne)}return function(e,t){return r.call(ne,e,function(){return et[n](e,t)})}}));ze.keymap(null).keymap(e)}}else if(typeof n==="function"){var r=e;if(!et[r]){ze.keymap(r,n.bind(ne))}else{ze.keymap(r,function(e,t){return n.call(ne,e,function(){return et[r](e,t)})})}}},level:function(){return Pe.size()},reset:function(){ge(function e(){ne.clear();while(Pe.size()>1){Pe.pop()}Q()});return ne},purge:function(){ge(function e(){var t=ne.prefix_name()+"_";var n=Re.get(t+"interpreters");if(n){$.each(JSON.parse(n),function(e,t){Re.remove(t+"_commands");Re.remove(t+"_token");Re.remove(t+"_login")})}ze.purge();Re.remove(t+"interpreters")});return ne},destroy:function(){ge(function e(){ze.destroy().remove();ne.resizer("unbind");ne.touch_scroll("unbind");Ue.resizer("unbind").remove();$(document).unbind(".terminal_"+ne.id());$(window).unbind(".terminal_"+ne.id());ne.unbind("click wheel mousewheel mousedown mouseup");ne.removeData("terminal").removeClass("terminal").unbind(".terminal");if(Fe.width){ne.css("width","")}if(Fe.height){ne.css("height","")}$(window).off("blur",Ge).off("focus",Ye);ne.find(".terminal-fill, .terminal-font").remove();ne.stopTime();terminals.remove(fe);if(Ne){if(Ne.unobserve){Ne.unobserve(ne[0])}else{clearInterval(Ne)}}var t=ne.find(".terminal-scroll-marker");if(be){Ne.unobserve(t[0])}t.remove();if(Me){Me.disconnect()}if(!terminals.length()){$(window).off("hashchange")}if(is_mobile){ne.off(["touchstart.terminal","touchmove.terminal","touchend.terminal"].join(" "))}le.remove();He.remove();if(re){var n=$(re);if(n.attr("class")==="full-screen-terminal"){n.removeAttr("class")}else{n.removeClass("full-screen-terminal")}ne.remove()}Te=true});return ne},scroll_to:function(e){var t=ne.scrollTop()-ne.offset().top+$(e).offset().top;ne.scrollTop(t);return ne},scroll_to_bottom:function(){var e;if(ne.prop){e=ne.prop("scrollHeight")}else{e=ne.attr("scrollHeight")}ne.scrollTop(e);return ne},is_bottom:function(){if(Fe.scrollBottomOffset===-1){return false}else if(typeof ye==="boolean"){return ye}else{var e,t,n;e=ne[0].scrollHeight;t=ne[0].scrollTop;n=ne[0].offsetHeight;var r=e-Fe.scrollBottomOffset;return t+n>r}}},function(t,e){return function(){if(Te){if(!Fe.exceptionHandler){throw new $.terminal.Exception(te().defunctTerminal)}}try{return e.apply(ne,[].slice.apply(arguments))}catch(e){if(t!=="exec"&&t!=="resume"){_(e,e.type||"TERMINAL",true)}if(!Fe.exceptionHandler){throw e}}}}));if(ne.length===0){var ae=sprintf(te().invalidSelector);throw new $.terminal.Exception(ae)}ne.data("terminal",ne);var oe;var ue;var se=0;var le;var fe=terminals.length();var ce=false;var pe;var me;var de;var he=new Stack;var ve=new DelayQueue;var De=new DelayQueue;var ge=ee(De);var _e=ee(ve);var ye;var be;var we=false;var Ce=$.noop;var xe,Ee;var $e=[];var Fe=$.extend({},$.terminal.defaults,{name:ne.selector,exit:!!(t&&t.login||!t)},t||{});if(typeof Fe.width==="number"){ne.width(Fe.width)}if(typeof Fe.height==="number"){ne.height(Fe.height)}var ke=get_char_size(ne);var Ae=!terminal_ready(ne);delete Fe.formatters;var Te=false;var Se=[];var Re=new n(Fe.memory);var Be=Fe.enabled;var je=false;var Le=false;var Oe=true;var Pe;var ze;var Ie;var Ne;var Me;if(Fe.ignoreSystemDescribe===true){Fe.describe=false}$(document).bind("ajaxSend.terminal_"+ne.id(),function(e,t){requests.push(t)});var He=$('<div class="terminal-wrapper"/>').appendTo(ne);$(broken_image).hide().appendTo(He);var Ue=$('<div class="terminal-font">&nbsp;</div>').appendTo(ne);var We=$('<div class="terminal-fill"/>').appendTo(ne);le=$("<div>").addClass("terminal-output").attr("role","log").appendTo(He);ne.addClass("terminal");if(Fe.login&&W("onBeforeLogin")===false){Oe=false}var qe;if(typeof e==="string"){qe=e}else if(is_array(e)){for(var Ke=0,Je=e.length;Ke<Je;++Ke){if(typeof e[Ke]==="string"){qe=e[Ke];break}}}var Qe;if(is_function(Fe.login)){Qe=Fe.login}else if(qe&&(typeof Fe.login==="string"||Fe.login===true)){Qe=g(qe,Fe.login)}terminals.append(ne);function Ye(){if(Ie){ne.focus();ne.scroll_to_bottom()}}function Ge(){Ie=Be;ne.disable().find(".cmd textarea").trigger("blur",[true])}function Ve(e){if(is_function(e)){e=e()}if(get_type(e)!=="string"){if(is_function(Fe.parseObject)){var t=Fe.parseObject(e);if(get_type(t)==="string"){e=t}}else if(is_array(e)){e=$.terminal.columns(e,ne.cols(),Fe.tabs)}else{e=String(e)}}return e}function Xe(t){if(t.proxy){return t}var e=function(e){return t.call(ne,e,ne)};e.proxy=true;return e}function Ze(e){e=e.originalEvent;function t(e,t){return e.type.indexOf(t)!==-1}function i(e){ne.echo('<img src="'+e+'"/>',{raw:true})}function a(e){var t=window.URL||window.webkitURL;return t.createObjectURL(e)}function o(e,t){if(!t){var n={target:ne};if(typeof e==="string"){n["text"]=e}else if(e instanceof Blob){n["image"]=a(e)}var r=W("onPaste",[n]);if(r){if(is_function(r.then||r.done)){return(r.then||r.done).call(r,function(e){o(e,true)})}else{o(r,true)}}else if(r!==false){o(n.image||n.text,true)}}else if(e instanceof Blob){i(a(e))}else if(typeof e==="string"){if(e.match(/^(data:|blob:)/)){i(e)}else{ne.insert(e)}}}if(e.clipboardData){if(ne.enabled()){var n=e.clipboardData.items;if(n){for(var r=0;r<n.length;r++){if(t(n[r],"image")&&Fe.pasteImage){var u=n[r].getAsFile();o(u)}else if(t(n[r],"text/plain")){n[r].getAsString(o)}}}else if(e.clipboardData.getData){var s=e.clipboardData.getData("text/plain");o(s)}return false}}}$(document).on("paste.terminal_"+ne.id(),Ze);var et=$.extend({},V,$.omap(Fe.keymap||{},function(n,r){if(!V[n]){return r.bind(ne)}return function(e,t){return r.call(ne,e,function(){return V[n](e,t)})}}));l(e,Fe.login,function(e){if(Fe.completion&&typeof Fe.completion!=="boolean"||!Fe.completion){e.completion="settings"}var t=Fe.prompt;if(is_function(t)){t=Xe(t)}Pe=new Stack($.extend({},Fe.extra,{name:Fe.name,prompt:t,keypress:Fe.keypress,keydown:Fe.keydown,resize:Fe.onResize,greetings:Fe.greetings,mousewheel:Fe.mousewheel,history:Fe.history,keymap:et},e));ze=$("<div/>").appendTo(He).cmd({tabindex:Fe.tabindex,mobileDelete:Fe.mobileDelete,mobileIngoreAutoSpace:Fe.mobileIngoreAutoSpace,prompt:Qe?false:t,history:Fe.memory?"memory":Fe.history,historyFilter:Fe.historyFilter,historySize:Fe.historySize,caseSensitiveSearch:Fe.caseSensitiveSearch,onPaste:Fe.onPaste,width:"100%",enabled:false,char_width:ke.width,keydown:X,keymap:et,clickTimeout:Fe.clickTimeout,holdTimeout:Fe.holdTimeout,holdRepeatTimeout:Fe.holdRepeatTimeout,repeatTimeoutKeys:Fe.repeatTimeoutKeys,allowedAttributes:Fe.allowedAttributes,keypress:Z,tabs:Fe.tabs,onPositionChange:function(){var e=[].slice.call(arguments);K();W("onPositionChange",e)},onCommandChange:function(e){if(xe!==We.width()){ne.resizer()}W("onCommandChange",[e]);K()},commands:I});function n(e){if(is_mobile){return}e=e.originalEvent;if(e){var t=document.elementFromPoint(e.clientX,e.clientY);if(!$(t).closest(".terminal").length&&ne.enabled()){ne.disable()}}}ne.oneTime(100,function(){$(document).bind("click.terminal_"+ne.id(),n).bind("contextmenu.terminal_"+ne.id(),n)});var r=$(window);document.addEventListener("resume",function(){ne.disable()});if(is_mobile){(function(){ne.addClass("terminal-mobile");var i;var a;var n;var o=3;var e=ze.clip();var r=200;var u;e.$node.off("touchstart.cmd");ne.on("touchstart.terminal",function(e){e=e.originalEvent;window.touch_event=e;if(e.target.tagName.toLowerCase()==="a"){return}if(!je&&e.touches.length===1){n=ne.enabled();var t=e.touches[0];i={x:t.clientX,y:t.clientY};u=setTimeout(function(){i=null},r)}}).on("touchmove.terminal",function(e){if(e.touches.length===1&&i){var t=e.touches[0];var n=Math.abs(t.clientX-i.x);var r=Math.abs(t.clientY-i.y);if(n>o||r>o){a=true}}}).on("touchend.terminal",function(){if(i){clearTimeout(u);if(!a){if(!n){e.focus();ne.focus()}else{e.blur();ne.disable()}}}a=false;i=null})})()}else{r.on("focus.terminal_"+ne.id(),Ye).on("blur.terminal_"+ne.id(),Ge);(function(){var t=0;var n;var r="click_"+ne.id();var i=ne.find(".cmd textarea");function a(){if(n.is(".terminal")||n.is(".terminal-wrapper")){var e=ne.get_command().length;ne.set_position(e)}else if(n.closest(".cmd-prompt").length){ne.set_position(0)}if(!i.is(":focus")){i.focus()}o()}function o(){t=0;n=null}var u=".terminal-output textarea,"+".terminal-output input";ne.mousedown(function(e){if(!scrollbar_event(e,We)){n=$(e.target)}}).mouseup(function(){if(n&&n.closest(u).length){if(Be){ne.disable()}}else if(get_selected_html()===""&&n){if(++t===1){if(!je){if(!Be){ne.focus();ne.scroll_to_bottom()}else{var e=Fe.clickTimeout;ne.oneTime(e,r,a);return}}}else{ne.stopTime(r)}}o()}).dblclick(function(){o();ne.stopTime(r)})})();(function(){var d=ze.clip().$node;function h(e){return e.type==="mousedown"&&e.buttons===2||e.type==="contextmenu"}var e;if("oncontextmenu"in window){e="contextmenu.terminal"}else{e="mousedown.terminal"}ne.on(e,function(e){if(get_selected_html()===""&&h(e)){var t=$(e.target);if(t.is("img,value,audio,object,canvas,a")){return}if(!ne.enabled()){ne.enable()}var n=ze.offset();var r=ze[0].getBoundingClientRect();var i=ne.offset();var a=i.top-n.top;var o=Math.max(e.pageY-n.top-20,a);var u=e.pageX-n.left-20;var s=4*14;var l=5*14;var f=ne[0].getBoundingClientRect();var c=We.outerWidth();var p=o+r.top+s;p=p-f.height-f.top;var m=u+r.left+l;m=m-c-f.left;if(p>0){s-=Math.ceil(p)}if(m>0){l-=Math.ceil(m)}d.css({left:u,top:o,width:l,height:s});if(!d.is(":focus")){d.focus()}ne.stopTime("textarea");ne.oneTime(100,"textarea",function(){var e={left:"",top:"",width:"",height:""};if(!is_css_variables_supported){var t=ne.find(".cmd .cmd-cursor-line").prevUntil(".cmd-prompt").length;e.top=t*14+"px"}d.css(e)});ne.stopTime("selection");ne.everyTime(20,"selection",function(){if(d[0].selection!==d[0].value){if(get_textarea_selection(d[0])){clear_textarea_selection(d[0]);select(ne.find(".terminal-output")[0],ne.find(".cmd div:last-of-type")[0]);ne.stopTime("selection")}}})}})})();ne.on("scroll",function(){var e=ne.find("textarea");var t=ne[0].getBoundingClientRect();var n=ne[0].scrollHeight;var r=ne.scrollTop();var i=n-(r+t.height);if(i===0){e.css("top","")}else{e.css("top",-i)}})}ne.on("click","a",function(e){var t=$(this);if(t.closest(".terminal-exception").length){var n=t.attr("href");if(n.match(/:[0-9]+$/)){e.preventDefault();m(n,ne.cols())}}if(Be){ne.find(".cmd textarea").focus()}});function i(){var e=ke.width;ke=get_char_size(ne);if(e!==ke.width){ze.option("char_width",ke.width).refresh()}}a();function a(){if(ne.is(":visible")){var e=We.width();var t=We.height();if(Ae){Ae=!terminal_ready(ne);i()}if(Ee!==t||xe!==e){ne.resize()}Ee=t;xe=e}}function o(){var e={prefix:"terminal-"};ne.resizer("unbind").resizer(a,e);Ue.resizer("unbind").resizer(function(){i();ne.resize()},e)}function u(e){ye=e[0].intersectionRatio===1}function s(){if(window.IntersectionObserver){var e=$('<div class="terminal-scroll-marker"/>').appendTo(ne);var t=e;if(Fe.scrollBottomOffset!==-1){t=$("<div/>").css({height:Fe.scrollBottomOffset}).appendTo(e)}be=new IntersectionObserver(u,{root:ne[0]});be.observe(t[0])}}s();if(ne.is(":visible")){o()}function l(){if(Ne){if(Ne.unobserve){Ne.unobserve(ne[0])}else{clearInterval(Ne)}}var e=ne.enabled();var t=ne.is(":visible");if(e&&!t){ne.disable()}if(t){o()}else{He.css("visibility","hidden")}function n(){if(ne.is(":visible")&&!t){t=true;o();i();a();if(e){ne.enable()}He.css("visibility","")}else if(t&&!ne.is(":visible")){t=false;e=$.terminal.active()===ne&&ne.enabled();ne.disable();He.css("visibility","hidden")}}if(window.IntersectionObserver&&ne.css("position")!=="fixed"){Ne=new IntersectionObserver(n,{root:null});Ne.observe(ne[0])}else{Ne=setInterval(n,100)}}var f=!!ne.closest("body").length;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){Me=new c(function(){if(ne.closest("body").length){if(!f){ne.scroll_to_bottom();l();a()}f=true}else if(f){f=false}});Me.observe(document.body,{childList:true})}if(f){l()}ve.resolve();if(Be&&ne.is(":visible")&&!is_mobile){ne.focus(undefined,true)}else{ne.disable()}if(is_function(Qe)){ne.login(Qe,true,Q)}else{Q()}function p(e){var t=terminals.get()[e[0]];if(t&&fe===t.id()){if(!e[2]){n.resolve();return n.promise()}else if(Le){var n=$.Deferred();z.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){p(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_"+ne.id(),function(e){if(e.shiftKey){i=true}}).bind("keyup.terminal_"+ne.id(),function(e){if(e.shiftKey||e.which===16){i=false}});function n(e,t){if(!i){var n=Pe.top();var r;if(is_function(n.mousewheel)){r=n.mousewheel(e,t,ne)}else if(is_function(Fe.mousewheel)){r=Fe.mousewheel(e,t,ne)}if(r===true){return}if((B()||r===false)&&!e.ctrlKey){e.stopPropagation();e.preventDefault()}if(r===false){return false}if(t>0){ne.scroll(-40)}else{ne.scroll(40)}}}if($.event.special.mousewheel){ne.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;ne.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)})}ne.touch_scroll(function(e){var t=e.current.clientY-e.previous.clientY;var n;var r=Pe.top();if(is_function(r.touchscroll)){n=r.touchscroll(e,t,ne)}else if(is_function(Fe.touchscroll)){n=Fe.touchscroll(e,t,ne)}css(ne[0],{"--terminal-scroll":ne.prop("scrollTop")});if(n===true){return}return false})})()});return ne}});
