basekernel/webv86/web/jquery.terminal.min.js

48 lines
171 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**@license
* __ _____ ________ __
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.44.1
*
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
*
* Copyright (c) 2010-2024 Jakub T. Jankiewicz <https://jcubic.pl/me>
* Released under the MIT license
*
* Contains:
*
* Storage plugin Distributed under the MIT License
* modified to work from Data URIs that block storage and cookies in Chrome
* Copyright (c) 2010 Dave Schindler
*
* jQuery Timers licenced with the WTFPL
* <http://jquery.offput.ca/timers/>
*
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* Available under the MIT License
*
* jQuery Caret
* Copyright (c) 2009, Gideon Sireling
* 3 clause BSD License
*
* sprintf.js
* Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro>
* licensed under 3 clause BSD license
*
* debounce function from Lodash
* Copyright JS Foundation and other contributors <https://js.foundation/>
* The MIT License
*
* emoji regex v9.0.0 by Mathias Bynens
* MIT license
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Tue, 08 Oct 2024 20:29:53 +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 r=1,n=e.length,i="",a,u=[],o,s,l,f,c,p;for(o=0;o<n;o++){i=D(e[o]);if(i==="string"){u.push(e[o])}else if(i==="array"){l=e[o];if(l[2]){a=t[r];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[r++]}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]?d(c,p):"";u.push(l[5]?a+f:f+a)}}return u.join("")};m.cache={};m.parse=function(e){var t=e,r=[],n=[],i=0;while(t){if((r=/^[^\x25]+/.exec(t))!==null){n.push(r[0])}else if((r=/^\x25{2}/.exec(t))!==null){n.push("%")}else if((r=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))!==null){if(r[2]){i|=1;var a=[],u=r[2],o=[];if((o=/^([a-z_][a-z_\d]*)/i.exec(u))!==null){a.push(o[1]);while((u=u.slice(o[0].length))!==""){if((o=/^\.([a-z_][a-z_\d]*)/i.exec(u))!==null){a.push(o[1])}else if((o=/^\[(\d+)\]/.exec(u))!==null){a.push(o[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}r[2]=a}else{i|=2}if(i===3){throw"[sprintf] mixing positional and named placeholders is not (yet) supported"}n.push(r)}else{throw"[sprintf] huh?"}t=t.slice(r[0].length)}return n};var t=function(e,t,r){r=t.slice(0);r.splice(0,0,e);return m.apply(null,r)};function D(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function d(e,t){for(var r=[];t>0;r[--t]=e){}return r.join("")}e.sprintf=m;e.vsprintf=t})(typeof global!=="undefined"?global:self||window);(function(n,i){var r;if(typeof window!=="undefined"){r=window}else if(typeof self!=="undefined"){r=self}else if(typeof global!=="undefined"){r=global}else{throw new Error("Unknow context")}if(typeof define==="function"&&define.amd){define(["jquery","wcwidth"],function(e,t){n(e,t,r);return e})}else if(typeof module==="object"&&module.exports){module.exports=function(e,t,r){if(t===i){if(typeof window!=="undefined"){t=require("jquery")}else{t=require("jquery")(e)}}if(r===i){r=require("wcwidth")}n(t,r,e);return t}}else{if(!r.jQuery){r.$=r.cash}n(r.jQuery||r.cash,r.wcwidth,r)}})(function($,wcwidth,root,undefined){"use strict";function debug(e){if(false){console.log(e)}}function DelayQueue(){var t=$.Callbacks();var r=false;var e=this;this.resolve=function(){t.fire();e.resolved=r=true};this.add=function(e){if(r){e()}else{t.add(e)}}}$.omap=function(r,n){var i={};$.each(r,function(e,t){i[e]=n.call(r,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(Array.isArray(e)){return this.clone_array(e)}else if(e===null){return e}else{for(var r in e){if(Array.isArray(e[r])){t[r]=this.clone_array(e[r])}else if(typeof e[r]==="object"){t[r]=this.clone_object(e[r])}else{t[r]=e[r]}}}}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("Map"in root&&!("clear"in Map.prototype)){Map.prototype.clear=function(){this.forEach(function(e,t,r){r.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 r=e();function n(e,t){var r;if(typeof e==="string"&&typeof t==="string"){localStorage[e]=t;return true}else if(typeof e==="object"&&typeof t==="undefined"){for(r in e){if(e.hasOwnProperty(r)){localStorage[r]=e[r]}}return true}return false}function i(e,t){var r,n,i;r=new Date;r.setTime(r.getTime()+31536e6);n="; expires="+r.toGMTString();if(typeof e==="string"&&typeof t==="string"){document.cookie=e+"="+t+n+"; path=/";return true}else if(typeof e==="object"&&typeof t==="undefined"){for(i in e){if(e.hasOwnProperty(i)){document.cookie=i+"="+e[i]+n+"; path=/"}}return true}return false}function a(e){return localStorage[e]}function u(e){var t,r,n,i;t=e+"=";r=document.cookie.split(";");for(n=0;n<r.length;n++){i=r[n];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 o(e){return delete localStorage[e]}function s(e){return i(e,"",-1)}if(!t()&&!r){localStorage={};$.extend({Storage:{set:n,get:a,remove:o}})}else{if(r){localStorage=window.localStorage}$.extend({Storage:{set:r?n:i,get:r?a:u,remove:r?o:s}})}})();var debounce=function(){var E="Expected a function";function x(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function $(){return Date.now()}return function e(n,i,t){var r=Math.max,a=Math.min;var u,o,s,l,f,c,p=0,m=false,D=false,d=true;if(typeof n!="function"){throw new TypeError(E)}i=i||0;if(x(t)){m=!!t.leading;D="maxWait"in t;s=D?r(t.maxWait||0,i):s;d="trailing"in t?!!t.trailing:d}function h(e){var t=u,r=o;u=o=undefined;p=e;l=n.apply(r,t);return l}function v(e){p=e;f=setTimeout(y,i);return m?h(e):l}function g(e){var t=e-c,r=e-p,n=i-t;return D?a(n,s-r):n}function _(e){var t=e-c,r=e-p;return c===undefined||t>=i||t<0||D&&r>=s}function y(){var e=$();if(_(e)){return b(e)}f=setTimeout(y,g(e))}function b(e){f=undefined;if(d&&u){return h(e)}u=o=undefined;return l}function C(){if(f!==undefined){clearTimeout(f)}p=0;u=c=o=f=undefined}function F(){return f===undefined?l:b($())}function w(){var e=$(),t=_(e);u=arguments;o=this;c=e;if(t){if(f===undefined){return v(c)}if(D){f=setTimeout(y,i);return h(c)}}if(f===undefined){f=setTimeout(y,i)}return l}w.cancel=C;w.flush=F;return w}}();var jQuery=$;(function(e){jQuery.fn.extend({everyTime:function(e,t,r,n,i){return this.each(function(){jQuery.timer.add(this,e,t,r,n,i)})},oneTime:function(e,t,r){return this.each(function(){jQuery.timer.add(this,e,t,r,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(e.toString().trim());if(t[2]){var r=parseInt(t[1],10);var n=this.powers[t[2]]||1;return r*n}else{return e}},add:function(e,t,r,n,i,a){var u=0;if(typeof r==="function"){if(!i){i=n}n=r;r=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[r]){e.$timers[r]={}}n.$timerID=n.$timerID||this.guid++;var o=function(){if(a&&o.inProgress){return}o.inProgress=true;if(++u>i&&i!==0||n.call(e,u)===false){jQuery.timer.remove(e,r,n)}o.inProgress=false};o.$timerID=n.$timerID;if(!e.$timers[r][n.$timerID]){e.$timers[r][n.$timerID]=setInterval(o,t)}if(!this.global[r]){this.global[r]=[]}this.global[r].push(e)},remove:function(e,t,r){var n=e.$timers,i;if(n){if(!t){for(var a in n){if(n.hasOwnProperty(a)){this.remove(e,a,r)}}}else if(n[t]){if(r){if(r.$timerID){clearInterval(n[t][r.$timerID]);delete n[t][r.$timerID]}}else{for(var u in n[t]){if(n[t].hasOwnProperty(u)){clearInterval(n[t][u]);delete n[t][u]}}}for(i in n[t]){if(n[t].hasOwnProperty(i)){break}}if(!i){i=null;delete n[t]}}for(i in n){if(n.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 r=e[t],n=r.length;while(--n){jQuery.timer.remove(r[n],t)}}}})}})(jQuery);(function(f){if(!String.prototype.split.toString().match(/\[native/)){return}var c=String.prototype.split,p=/()??/.exec("")[1]===f,r;r=function(e,t,r){if(Object.prototype.toString.call(t)!=="[object RegExp]"){return c.call(e,t,r)}var n=[],i=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),a=0,u,o,s,l;t=new RegExp(t.source,i+"g");e+="";if(!p){u=new RegExp("^"+t.source+"$(?!\\s)",i)}r=r===f?-1>>>0:r>>>0;while(o=t.exec(e)){s=o.index+o[0].length;if(s>a){n.push(e.slice(a,o.index));if(!p&&o.length>1){o[0].replace(u,function(){for(var e=1;e<arguments.length-2;e++){if(arguments[e]===f){o[e]=f}}})}if(o.length>1&&o.index<e.length){Array.prototype.push.apply(n,o.slice(1))}l=o[0].length;a=s;if(n.length>=r){break}}if(t.lastIndex===o.index){t.lastIndex++}}if(a===e.length){if(l||!t.test("")){n.push("")}}else{n.push(e.slice(a))}return n.length>r?n.slice(0,r):n};String.prototype.split=function(e,t){return r(this,e,t)};return r})();$.fn.caret=function(e){var t=this[0];var r=t.contentEditable==="true";if(arguments.length===0){if(window.getSelection){if(r){if(!this.is(":focus")){t.focus()}var n=window.getSelection().getRangeAt(0),i=n.cloneRange();i.selectNodeContents(t);i.setEnd(n.endContainer,n.endOffset);return i.toString().length}return t.selectionStart}if(document.selection){t.focus();if(r){var n=document.selection.createRange(),i=document.body.createTextRange();i.moveToElementText(t);i.setEndPoint("EndToEnd",n);return i.text.length}var e=0,a=t.createTextRange(),i=document.selection.createRange().duplicate(),u=i.getBookmark();a.moveToBookmark(u);while(a.moveStart("character",-1)!==0)e++;return e}return 0}if(e===-1)e=this[r?"text":"val"]().length;if(window.getSelection){if(r){if(!this.is(":focus")){t.focus()}var o=window.getSelection();o.collapse(o.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(!r&&!this.is(":focus")){t.focus()}return e};function make_callback_plugin(e){var s=$.extend({init:$.noop,destroy:$.noop,name:"event"},e);return function(n,i){var a=arguments.length===0;var u=arguments[0]==="unbind";if(!a&&!u&&!is_function(n)){throw new Error("Invalid argument, it need to a function or string "+'"unbind" or no arguments.')}if(u){n=is_function(arguments[1])?arguments[1]:null}var o="callbacks_"+s.name;return this.each(function(){var t=$(this);var r;function e(e){r.fireWith(t,[e])}if(a||u){r=t.data(o);if(a){r&&r.fire()}else{if(n&&r){r.remove(n);if(!r.has()){r=null}}else{r=null}if(!r){t.removeData(o);s.destroy.call(this,e,i)}}}else if(t.data(o)){$(this).data(o).add(n)}else{r=$.Callbacks();r.add(n);t.data(o,r);s.init.call(this,e,i)}})}}$.fn.resizer=make_callback_plugin({name:"resize",init:function(e,t){var r=$.extend({prefix:""},t);var n=$(this);var i;var a=true;if(n.is("body")){$(window).on("resize.resizer",e)}else if(window.ResizeObserver){i=new ResizeObserver(function(){if(!a){setTimeout(e,0)}a=false});i.observe(this);n.data("observer",i)}else{var u=$("<iframe/>").addClass(r.prefix+"resizer").appendTo(this)[0];$(u.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 r=e.find('> iframe[class$="resizer"]');if(r.length){$(r[0].contentWindow).off("resize").remove();r.remove()}else if(e.is("body")){$(window).off("resize.resizer")}}}});$.fn.touch_scroll=make_callback_plugin({name:"touch",init:function(n){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 r=n({origin:i,previous:a,current:t});if(r===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")}});$.fn.on_load=function(e){var r=$.extend({error:$.noop,load:$.noop,done:$.noop},e);var n=[];this.find("img,iframe").each(function(){var e=$(this);var t=new $.Deferred;e.on("load",t.resolve).on("error",function(){r.error(e);t.reject()});n.push(t)});r.load(!!n.length);if(n.length){$.when.apply($,n).then(function(){r.done(true)})}else{r.done(false)}return this};function jquery_resolve(e){var t=jQuery.Deferred();t.resolve(e);return t.promise()}function always(e,t){if(is_function(e.finally)){return e.finally(t)}if(is_function(e.always)){return e.always(t)}return e}function unpromise(e,t,r){if(e!==undefined){if(is_promise(e)){if(is_function(e.done)){e=e.done(t)}else if(is_function(e.then)){e=e.then(t)}if(is_function(e.catch)&&is_function(r)){e.catch(r)}return e}else if(e instanceof Array){var n=e.filter(function(e){return e&&(is_function(e.done)||is_function(e.then))});if(n.length){var i=$.when.apply($,e).then(function(){return t([].slice.call(arguments))});if(is_function(i.catch)){i=i.catch(r)}return i}}return t(e)}}function defined(e){return e===undefined?true:e}$.fn.is_fully_in_viewport=function(){function t(e,t){var r=e.getBoundingClientRect();var n=t[0].getBoundingClientRect();var i=r.top-n.top;var a=r.bottom-n.top;var u=t.height();return a>0&&i<=u}if(root.IntersectionObserver){return function(e){var t=this[0];var r=jQuery.Deferred();var n=new root.IntersectionObserver(function(e){r.resolve(e[0].isIntersecting&&e[0].ratio===1);n.unobserve(t)},{root:e[0]});n.observe(t);return r.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 space_re=/\s/;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\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83E\uDDD1(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFE])|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83E\uDDD1(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC3B\u200D\u2744|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDF])\u200D[\u2640\u2642])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\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\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2-\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\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*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\u26A7\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\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\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=/(\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\](?:[^\]\\]*(?:\\\\)*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?)/i;var format_parts_re=/\[\[((?:-?[@!gbiusor])*);([^;]*);([^;\]]*);?([^;\]]*);?([^\]]*)\]([^\]\\]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]+)\]?/gi;var format_re=/\[\[((?:-?[@!gbiusor])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?/gi;var format_exist_re=/\[\[((?:-?[@!gbiusor])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]/gi;var format_full_re=/^(\[\[(?:(?:-?[@!gbiusor])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\])([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)(\])$/i;var format_begin_re=/(\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\])/i;var format_start_re=/^(\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\])/i;var format_end_re=/\[\[(?:-?[@!gbiusor])*;[^;]*;[^\]]*\]?$/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=/(\b(?:file|ftp|https?):\/\/(?:(?:(?!&[^;]+;)|(?=&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][^`\\]*)*`|\/[^\/\\]*(?:\\[\S\s][^\/\\]*)*\/[gimsuy]*(?=\s|$)|(?:\\\s|\S))+)(?=\s|$)/gi;var extended_command_re=/^\s*((terminal|cmd)::([a-z_]+)\(([\s\S]*)\))\s*$/;var format_exec_split_re=/(\[\[(?:-?[@!gbiusor])*;[^\]]+\](?:\\[[\]]|[^\]])*\]|\[\[[\s\S]+?\]\])/;var format_exec_re=/(\[\[[\s\S]+?\]\])/;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(){if(typeof document==="undefined"){return false}var e=false,t="Webkit Moz O ms Khtml".split(" "),r=document.createElement("div");if(r.style.animationName){e=true}if(e===false){for(var n=0;n<t.length;n++){var i=t[n]+"AnimationName";if(r.style[i]!==undefined){e=true;break}}}r=null;return e}();var agent=(root.navigator||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}if(typeof document==="undefined"){return true}var e=document.createElement("div");e.style.width="1ch";return e.style.width==="1ch"}();var is_css_variables_supported=root.CSS&&root.CSS.supports&&root.CSS.supports("(--fake-var: 0)");var is_android=navigator.userAgent.toLowerCase().indexOf("android")!==-1;var is_key_native=function e(){if(!("KeyboardEvent"in root&&"key"in root.KeyboardEvent.prototype)){return false}var t=root.KeyboardEvent.prototype;var r=Object.getOwnPropertyDescriptor(t,"key").get;return!!r.toString().match(/\[native code\]/)}();var is_browser=function(){try{return this===window}catch(e){return false}}();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||root.opera);var ch_unit_bug=false;if(is_browser){$(function(){function e(e){return e[0].getBoundingClientRect().width}var t='<span style="font-family: monospace;visibility:hidden;';var r=$(t+'width:1ch;overflow: hidden">&nbsp;</span>');r.appendTo("body");var n=$(t+'">&nbsp;</span>').appendTo("body");ch_unit_bug=Math.abs(e(r)-e(n))>1e-4;r.remove();n.remove()})}function css(t,r,e){if(t instanceof $.fn.init){t.each(function(){css(this,r,e)})}else if($.isPlainObject(r)){Object.keys(r).forEach(function(e){t.style.setProperty(e,r[e])})}else if(typeof e==="undefined"){return t.style.getPropertyValue(r)}else{t.style.setProperty(r,e)}}function style_prop(e,t,r){var n=[e+":"+t+"px",e+":"+"calc("+t+"px / var(--pixel-density, 1))"];if(r){n=n.map(function(e){return e+" !important"})}return n.join(";")}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 r=(e?e+": ":"")+exception_message(t);if(excepctions.indexOf(r)===-1){excepctions.push(r);setTimeout(function(){throw t},0)}}function generate_id(){var e=Math.random()*46656|0;var t=Math.random()*46656|0;e=("000"+e.toString(36)).slice(-3);t=("000"+t.toString(36)).slice(-3);return e+t}function remove(e,t){for(var r in e){if(t(e[r],r)){e.splice(r,1)}}}function scrollbar_event(e,t,r){r=r||1;var n=t.offset().left;var i=t.outerWidth()*r;return i<=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 n=[].slice.call(arguments);var i=0;$.extend(this,{get:function(){return n},index:function(){return i},rotate:function(e,t){if(t===undefined){t=i}else if(t===i){return}if(!e){var r=n.filter(function(e){return typeof e!=="undefined"});if(!r.length){return}}if(!n.length){return}if(n.length===1){return n[0]}else{if(i===n.length-1){i=0}else{++i}if(typeof n[i]!=="undefined"){return n[i]}else{return this.rotate(true,t)}}},length:function(){return n.length},remove:function(e){delete n[e]},set:function(e){for(var t=n.length;t--;){if(n[t]===e){i=t;return}}this.append(e);i=n.length-1},front:function(){if(n.length){var e=i;var t=false;while(!n[e]){e++;if(e>n.length){if(t){break}e=0;t=true}}return n[e]}},map:function(r){return n.map(function(e,t){if(typeof e!=="undefined"){return r(e,t)}return null}).filter(Boolean)},forEach:function(r){return n.forEach(function(e,t){if(typeof e!=="undefined"){r(e,t)}})},append:function(e){n.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);if("Map"in root){this._cache=new Map}}WorkerCache.prototype.validate=function(e){var t=this._validation(e);var r=t===undefined||t===true;if(!r){this._cache.clear()}return r};WorkerCache.prototype.clear=function(){this._cache.clear()};WorkerCache.prototype.get=function(e){if(!this._cache){return this._action(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,r){var n=true;var i="";if(typeof e==="string"&&e!==""){i=e+"_"}i+="commands";var a;if(r){a=[]}else{a=$.Storage.get(i);a=a?JSON.parse(a):[]}var u=a.length-1;$.extend(this,{append:function(e){if(n){if(a[a.length-1]!==e){a.push(e);if(t&&a.length>t){a=a.slice(-t)}u=a.length-1;if(!r){$.Storage.set(i,JSON.stringify(a))}}}},set:function(e){if(is_array(e)){a=e;if(!r){$.Storage.set(i,JSON.stringify(a))}}},data:function(){return a},reset:function(){u=a.length-1},last:function(){return a[a.length-1]},end:function(){return u===a.length-1},position:function(){return u},current:function(){return a[u]},next:function(){var e=u;if(u<a.length-1){++u}if(e!==u){return a[u]}},previous:function(){var e=u;if(u>0){--u}if(e!==u){return a[u]}},clear:function(){a=[];this.purge()},enabled:function(){return n},enable:function(){n=true},purge:function(){if(!r){$.Storage.remove(i)}},disable:function(){n=false},toggle:function(e){if(typeof e==="undefined"){n=!n}else{n=e}}})}function OutputLines(e){this._settings=e;this._lines=[];this._snapshot=[]}OutputLines.prototype.make_snapshot=function(e){this._snapshot.push(e)};OutputLines.prototype.get_partial=function(){if(!this._snapshot.length){return[]}var e=this._snapshot[this._snapshot.length-1];return e};OutputLines.prototype.update_snapshot=function(e,t){this._snapshot[e]=t};OutputLines.prototype.limit_snapshot=function(e){this._snapshot=this._snapshot.slice(e)};OutputLines.prototype.clear_snapshot=function(){this._snapshot=[]};OutputLines.prototype.get_snapshot=function(){return this._snapshot.reduce(function(e,t){if(!t){return e}return e.concat(t)},[]).join("\n")};OutputLines.prototype.join=function(){var e=[].slice.call(arguments);if(e.some(is_function)){return function(){return e.reduce(function(e,t){if(is_function(e)){e=e()}if(is_function(t)){t=t()}if(is_promise(e)||is_promise(t)){return $.when(e,t).then(function(e,t){return e+t})}return t})}}else if(e.some(is_promise)){return e.reduce(function(e,t){return $.when(e,t).then(function(e,t){return e+t})})}return e.join("")};OutputLines.prototype.import=function(e){this._lines=e};OutputLines.prototype.push=function(e){var t=e[0];var r=e[1];if(this.has_newline()){this._lines.push(e)}else{var n=this.last_line();n[0]=this.join(n[0],t);n[1].newline=r.newline}};OutputLines.prototype.clear=function(n){this._lines.forEach(function(e,t){var r=e[1];if(is_function(r.onClear)){r.onClear.call(self,n(t))}});this._lines=[];this._snapshot=[]};OutputLines.prototype.data=function(){return this._lines.filter(Boolean)};OutputLines.prototype.has_newline=function(){var e=this.last_line();if(!e){return true}return e[1].newline};OutputLines.prototype.unmount=function(e){var t=e.data("index");var r=this._lines[t];if(r){var n=r[1];if(is_function(n.unmount)){n.unmount.call(self,e)}}};OutputLines.prototype.last_line=function(){var e=this.data();var t=e.length;return e[t-1]};OutputLines.prototype.update=function(e,t,r){if(t===null){delete this._lines[e];delete this._snapshot[e]}else{this._lines[e][0]=t;if(r){this._lines[e][1]=$.extend(this._lines[e][1],r)}return this._lines[e][1]}};OutputLines.prototype.length=function(){return this._lines.length};OutputLines.prototype.valid_index=function(e){return!!this._lines[e]};OutputLines.prototype.render=function(e,t){var r=this._settings();var i=[];this._snapshot=[];if(r.outputLimit>=0){var n;if(r.outputLimit===0){n=e}else{n=r.outputLimit}this._lines.forEach(function(e,t){var r=e[0];var n=e[1];i.push({value:r,index:t,options:n})});var a=i.length-n-1;i=i.slice(a)}else{i=this._lines.map(function(e,t){return{value:e[0],index:t,options:e[1]}})}return t(i)};function FormatBuffer(e){this._options=e;if("Map"in root){this._format_cache=new Map}this._output_buffer=[]}FormatBuffer.NEW_LINE=1;FormatBuffer.prototype.format=function e(t,r,n){var i=this._format_cache&&this._settings.useCache;if(i){var a=JSON.stringify([t,this._settings]);if(this._format_cache.has(a)){return this._format_cache.get(a)}}var u={line:$.terminal.format(t,this._settings),raw:n,newline:r};if(i){this._format_cache.set(a,u)}return u};FormatBuffer.prototype.empty=function(){return!this._output_buffer.length};FormatBuffer.prototype.append=function(e,t,r,n){this._settings=$.extend({useCache:true},this._options(r));this._output_buffer.push(FormatBuffer.NEW_LINE);if(e instanceof Array){for(var i=0,a=e.length;i<a;++i){if(e[i]===""||e[i]==="\r"){this._output_buffer.push({line:"",raw:""})}else{var u=this.format(e[i],i===a-1,n[i]);this._output_buffer.push(u)}}}else if(r.raw){this._output_buffer.push({line:e,raw:n})}else{this._output_buffer.push(this.format(e,false,n))}this._output_buffer.push({finalize:r.finalize,index:t,raw:r.raw,newline:r.newline})};FormatBuffer.prototype.clear_cache=function(){if(this._format_cache){this._format_cache.clear()}};FormatBuffer.prototype.output=function(){return this._output_buffer.slice()};FormatBuffer.prototype.is_empty=function(){return!this._output_buffer.length};FormatBuffer.prototype.clear=function(){this._output_buffer=[]};FormatBuffer.prototype.forEach=function(e){var t=0;while(t<this._output_buffer.length){var r=this._output_buffer[t++];if(r===FormatBuffer.NEW_LINE){e()}else{e(r)}}};FormatBuffer.prototype.flush=function(e){this.forEach(e);this.clear()};function with_prompt(e,r,t){function n(e){var t=$.terminal.escape_brackets("[ERR]> ");r("[[;red;]"+t+"]");alert_exception("Prompt",e)}function i(e){r(e);a.resolve()}var a=new $.Deferred;switch(typeof e){case"string":i(e);break;case"function":try{var u=e.call(t,function(e){i(e)});if(typeof u==="string"){i(u)}if(u&&u.then){u.then(i).catch(n)}}catch(e){n(e)}break}return a.promise()}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(z){var x=$.extend({},$.cmd.defaults,z);function I(e){return x.mobileIngoreAutoSpace.length&&x.mobileIngoreAutoSpace.indexOf(e)!==-1&&is_android}var k=this;var P=k.data("cmd");if(P){return P}var N=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 M=A.find(".cmd-cursor-line");a11y_hide(M);var B;if(is_mobile){B=function(){var t=$('<div class="cmd-editable" contenteditable/>').attr({autocapitalize:"off",autocorrect:"off",spellcheck:"false",tabindex:x.tabindex}).insertAfter(k);t.on("focus",function(){k.enable()}).on("blur",function(){k.disable()});var e;var r={$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:""})},100)},focus:function(){css(t[0],{top:"calc(var(--terminal-scroll, 0) * 1px)"});r.reset()},blur:function(){t.css({top:"100%",bottom:0}).blur();window.getSelection().removeAllRanges();r.reset()}};return r}();k.addClass("cmd-mobile")}else{B=function(){var e=generate_id();var t=$("<textarea>").attr({autocapitalize:"off",spellcheck:"false",id:e,tabindex:x.tabindex}).addClass("cmd-clipboard").appendTo(k);t.before('<label class="visually-hidden" for="'+e+'">'+"Clipboard textarea for jQuery Terminal</label>");return{$node:t,val:function(e){if(typeof e==="undefined"){return t.val()}else{return t.val(e)}}}}();B.val(" ")}if(x.width){k.width(x.width)}var m;var D;var H;var W;var q;var o=0;var d;var h=k.find(".cmd-prompt");var u=false;var s="";var U=null;var K;var T="";var J;var a="";var S=0;var n;var l;var R=0;var Q,f;var v=k.find(".cmd-cursor");var t;var V;var Y=0;var G="￿";var X=/\uFFFF$/;var Z=/^\uFFFF$/;function ee(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 r=!t.next().length;return t.find("[data-text]").length+t.prevUntil(".cmd-prompt").find("[data-text]").length-(r?0:1)}}var te={SPACEBAR:" ",UP:"ArrowUP",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight",DEL:"Delete",MULTIPLY:"*",DIVIDE:"/",SUBTRACT:"-",ADD:"+"};function re(e){var t=e.key.toUpperCase();if(te[t]){return te[t]}return t}function ne(e){if(e.key){var t=re(e).toUpperCase();if(t==="CONTROL"){return"CTRL"}else{var r=[];if(e.ctrlKey){r.push("CTRL")}if(e.metaKey&&t!=="META"){r.push("META")}if(e.shiftKey&&t!=="SHIFT"){r.push("SHIFT")}if(e.altKey&&t!=="ALT"){r.push("ALT")}if(r.length&&t===" "){t="SPACEBAR"}if(e.key){r.push(t)}return r.join("+")}}}var e={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 r;for(r=1;r<25;r++){e[111+r]="F"+r}var ie="";for(r=65;r<91;r++){ie=String.fromCharCode(r);e[r]=[ie.toLowerCase(),ie.toUpperCase()]}var ae={};Object.keys(e).forEach(function(t){if(is_array(e[t])){e[t].forEach(function(e){ae[e.toUpperCase()]=t})}else{ae[e[t].toUpperCase()]=t}});var c;var i={"ALT+D":ue({clipboard:true}),"HOLD+ALT+D":ue({clipboard:true,hold:true}),"HOLD+DELETE":ue({clipboard:false,hold:true}),"HOLD+SHIFT+DELETE":ue({clipboard:false,hold:true}),ENTER:function(){if(f&&T&&!x.mask&&(is_function(x.historyFilter)&&x.historyFilter(T)||x.historyFilter instanceof RegExp&&T.match(x.historyFilter)||!x.historyFilter)){f.append(T)}var e=T;if(!is_mobile){B.$node.blur()}f.reset();k.set("");B.val("");Ge="";F=true;var t;if(x.commands){t=x.commands.call(k,e)}if(is_function(n)){if(t&&is_function(t.then)){t.then(function(){b()})}else{b()}}if(!is_mobile){B.$node.focus()}return false},"SHIFT+ENTER":function(){k.insert("\n");return true},BACKSPACE:ve,"SHIFT+BACKSPACE":ve,TAB:function(){k.insert("\t")},"CTRL+D":function(){k["delete"](1);return false},DELETE:function(){k["delete"](1);return true},"HOLD+ARROWUP":de,ARROWUP:de,"CTRL+ARROWUP":fe,"CTRL+P":fe,ARROWDOWN:he,"HOLD+ARROWDOWN":he,"CTRL+N":ce,"CTRL+ARROWDOWN":ce,ARROWLEFT:ge,"HOLD+ARROWLEFT":debounce(ge,10),"CTRL+B":ge,"CTRL+ARROWLEFT":function(){var e=S-1;var t=0;if(T[e]===" "){--e}for(var r=e;r>0;--r){if(T[r]===" "&&T[r+1]!==" "){t=r+1;break}else if(T[r]==="\n"&&T[r+1]!=="\n"){t=r;break}}k.position(t)},"CTRL+R":function(){if(u){$e(true)}else{K=n;_();J=T;k.set("");y();u=true}return false},"CTRL+G":function(){if(u){n=K;b();k.set(J);y();u=false;s="";return false}},ARROWRIGHT:_e,"HOLD+ARROWRIGHT":debounce(_e,10),"CTRL+F":_e,"CTRL+ARROWRIGHT":function(){if(T[S]===" "){++S}var e=/\S[\n\s]{2,}|[\n\s]+\S?/;var t=T.slice(S).match(e);if(!t||t[0].match(/^\s+$/)){k.position(bare_text(T).length)}else if(t[0][0]!==" "){S+=t.index+1}else{S+=t.index+t[0].length-1;if(t[0][t[0].length-1]!==" "){--S}}y()},F12:p,END:be(true),"CTRL+END":be(),"CTRL+E":be(),HOME:ye(true),"CTRL+HOME":ye(),"CTRL+A":ye(),"SHIFT+INSERT":se,"CTRL+SHIFT+T":p,"CTRL+W":oe({clipboard:true,hold:false}),"CTRL+BACKSPACE":oe({clipboard:true,hold:false}),"HOLD+BACKSPACE":oe({clipboard:false,hold:true}),"HOLD+SHIFT+BACKSPACE":oe({clipboard:false,hold:true}),"CTRL+H":function(){if(T!==""&&S>0){k["delete"](-1)}return false},"CTRL+X":p,"CTRL+C":function(){return get_selected_html()===""},"CTRL+T":p,"CTRL+Y":function(){if(a!==""){k.insert(a)}},"CTRL+V":se,"META+V":se,"CTRL+K":function(){var e=text(T).length;if(e>S){a=k["delete"](e-S);text_to_clipboard(B.$node,a)}return false},"CTRL+U":function(){if(T!==""&&S!==0){a=k["delete"](-S);text_to_clipboard(B.$node,a)}return false},"CTRL+TAB":function(){return false},"META+`":p,"META+R":p,"META+L":p};function ue(i){i=i||{};if(i.hold&&!x.mobileDelete){return function e(){k["delete"](1);return false}}return function e(){var t=/ *[^ ]+ *(?= )|[^ ]+$/;var r=T.slice(S);var n=r.match(t);if(n){a=n[0];if(i.clipboard){text_to_clipboard(B.$node,a)}}k.set(T.slice(0,S)+T.slice(S).replace(t,""),true);return false}}function oe(r){r=r||{};if(r.hold&&!x.mobileDelete){return function e(){k["delete"](-1)}}return function e(){if(T!==""&&S!==0){var t=T.slice(0,S).match(/([^ ]* *$)/);if(t[0].length){a=k["delete"](-t[0].length);if(r.clipboard){text_to_clipboard(B.$node,a)}}}return false}}function p(){return true}function se(){B.val("");Y=0;if(k.isenabled()&&!B.$node.is(":focus")){B.$node.trigger("focus",[true])}B.$node.one("input",le);return true}function le(){if(Y++>0){return}function r(){B.val(T);g()}function n(e){k.insert(e);r()}if(k.isenabled()){k.oneTime(100,function(){var e=B.val().replace(/\r/g,"");if(is_function(x.onPaste)){var t=x.onPaste.call(k,{target:k,text:e});if(t!==undefined){if(t&&is_function(t.then||t.done)){(t.then||t.done).call(t,n)}else if(typeof t==="string"){n(t)}else if(t===false){r()}return}}n(e)})}}function fe(){if(We){J=T;k.set(f.current())}else{k.set(f.previous())}We=false;return false}function ce(){if(f.end()){We=true;k.set(J)}else{k.set(f.next())}return false}function pe(e){return e.match(/\n/)}function me(e,t){var r=e.split("\n").map(function(e){return $.terminal.length(e)});if(t){r[0]+=t}var n=r.filter(function(e){return e>=m});return!!n.length}function De(e){var t=H;var r=$.terminal.split_equal(t+e,m);var n=new RegExp("^"+$.terminal.escape_regex(t));r=r.map($.terminal.unescape_brackets);r[0]=r[0].replace(n,"");return r}function de(){var e=$.terminal.substring(T,0,S);var t=k.column();var r=k.find(".cmd-cursor-line");var n=r.prevUntil("span").length;if(n===1&&t<=d){k.position(0);return false}if(n===0){return fe()}if(pe(e)||me(e,d)){var i=r.prev();var a=i.is(".cmd-end-line");var u=De(T);i=u[n-1];var o=u[n].substring(t).length;var s;if(o>0){s=t;if(n-1===0){s-=d}s=t+i.substring(s).length;if(a){++s}}else{s=t+1}k.position(-s,true);return false}else{return fe()}}function he(){var e=$.terminal.substring(T,S);if(pe(e)||me(e)){var t=De(T);var r=k.column();var n=k.find(".cmd-cursor-line");var i=n.prevUntil("span");var a=i.length;var u=n.is(".cmd-end-line");var o=n.next().is(".cmd-end-line");var s=t[a+1];if(!s){return ce()}var l=t[a].substring(r).length;var f;if(l===0){f=s.length;if(o){f++}}else{f=Math.min(r,s.length)+l;if(a===0){f+=d}if(u){f+=1}}k.position(f,true);return false}else{return ce()}}function ve(){if(u){s=s.slice(0,-1);_()}else if(T!==""&&S>0){k["delete"](-1)}k.oneTime(1,function(){F=true})}function ge(){if(S>0){k.position(-1,true)}}function _e(){if(S<bare_text(T).length){k.position(1,true)}return false}function ye(e){function t(){k.position(0)}if(e){return function(){if(T.match(/\n/)){var e=T.substring(0,k.position());k.position(e.lastIndexOf("\n")+1)}else{t()}}}else{return t}}function be(e){function i(){k.position(text(T).length)}if(e){return function(){if(T.match(/\n/)){var e=T.split("\n");var t=k.position();var r=0;for(var n=0;n<e.length;++n){r+=e[n].length;if(r>t){k.position(r+n);return}}}i()}}else{return i}}function Ce(){var e=B.$node;var t=e.is(":focus");if(l){if(!t){}k.oneTime(10,function(){if(!e.is(":focus")&&l){e.trigger("focus",[true])}})}else if(t&&!l){e.trigger("blur",[true])}}function Fe(){if(animation_supported){var e=window.getComputedStyle(v[0]);var t=e.getPropertyValue("--animation");t=t.replace(/^\s*|\s*$/g,"");var r=k.attr("class");if(r.match(/-animation/)){r=r.replace(/[a-z]+-animation/g,"")}if(t&&!t.match(/blink/)){var n=t.replace(/terminal-/,"")+"-animation";if(!r.match(n)){r+=" "+n}}r=r.replace(/\s+/g," ");if(r!==k.attr("class").replace(/\s+/g," ")){k.attr("class",r)}}}function g(e){if(!k.isenabled()){return}k.oneTime(10,function(){if(!is_mobile&&B.val()!==T&&!e){B.val(" "+T)}if(l){k.oneTime(10,function(){try{var e=!is_mobile?S+1:S;if(B.$node.caret()!==e){B.$node.caret(e)}}catch(e){}})}})}if(animation_supported&&!is_android){t=function(e){if(e){v.addClass("cmd-blink")}else{v.removeClass("cmd-blink")}};V=function(){var e=v.clone();e.insertBefore(v);v.remove();v=e}}else{var we=false;t=function(e){if(e&&!we){we=true;v.addClass("cmd-inverted cmd-blink");k.everyTime(500,"blink",Ee)}else if(we&&!e){we=false;k.stopTime("blink",Ee);v.removeClass("cmd-inverted cmd-blink")}};V=function(){t(false);t(true)}}function Ee(){v.toggleClass("cmd-inverted")}function _(){n="(reverse-i-search)`"+s+"': ";b()}function xe(){n=K;u=false;U=null;s=""}function $e(e){var t=f.data();var r,n;var i=t.length;if(e&&U>0){i-=U}if(s.length>0){for(var a=s.length;a>0;a--){n=$.terminal.escape_regex(s.slice(0,a));if(x.caseSensitiveSearch){r=new RegExp(n)}else{r=new RegExp(n,"i")}for(var u=i;u--;){if(r.test(t[u])){U=t.length-u;k.position(t[u].indexOf(n));k.set(t[u],true);y();if(s.length!==a){s=s.slice(0,a);_()}return}}}}s=""}function ke(){var e=k.find(".cmd-prompt");var t=e.html();e.html("<span>&nbsp;</span>");var r=e.find("span").get(0).getBoundingClientRect().width;e.html(t);return r}function Ae(e){var t=k.width();return Math.floor(t/e)}function Be(e){function t(e){return $.terminal.split_equal(e,m)}function r(r){var n=[];r.forEach(function(e,t){if($.terminal.strip(e).match(Z)){n[t]=false;if(t>0){n[t-1]+=G}}else{n[t]=r[t]}});return n.filter(function(e){return e!==false})}var n=h.find(".cmd-line");var i;if(n.length){i=n.nextUntil(".cmd-line").text()}else{i=h.text()}i=i.replace("","");i=$.terminal.escape_brackets(i);var a=Pe();var u=new RegExp("^"+a+$.terminal.escape_regex(i));var o;if(e.match(/\n/)){var s=e.split("\n");var l=m-d-1;for(var f=0;f<s.length-1;++f){s[f]+=G}if(strlen(s[0])>l){o=t(i+s[0]);o[0]=o[0].replace(u,"");o=r(o)}else{o=[s[0]]}for(f=1;f<s.length;++f){if(strlen(s[f])>m){var c=t(s[f]);if(f<s.length-1){c=r(c)}o=o.concat(c)}else{o.push(s[f])}}}else{o=t(a+i+e,m);o[0]=o[0].replace(u,"")}if(o.length>1){var p=$.terminal.length(o[o.length-1]);if(p===m){o.push("")}}return o}var Te=new WorkerCache({validation:function(e){var t=false;if((!this._previous_value||this._previous_value===e)&&(!this._cols||this._cols===m)){t=true}this._previous_value=e;this._cols=m;return t},action:Be});function Se(e){return Te.get(e)}function Re(t,e){try{t=$.terminal.escape_formatting(t);var r=$.extend({},x,{unixFormattingEscapeBrackets:true,position:S,command:true});var n=$.terminal.apply_formatters(t,r);var i=$.terminal.normalize(n[0]);var a=$.terminal.length(i);if(!e){R=n[1];if(R>a){R=a}}return i}catch(e){alert_exception("[Formatting]",e.stack);return t}}function j(e,t){var r=$.terminal.encode(je(e),{tabs:x.tabs,before:t});return $.terminal.format(r,{charWidth:x.charWidth,allowedAttributes:x.allowedAttributes||[]})}function je(e){return $.terminal.partition(e).join("")}function O(e,t){return $.terminal.length(e,t)}function Oe(e){var t=strlen(text(e));return t>0&&t>m-d-1||e.match(/\n/)}function Le(e,t,r){return $.terminal.substring(e,t,r)}function ze(e){if($.terminal.is_formatting(e)){return e.replace(format_parts_re,"$4").match(/^emoji /)}return false}var y=function(){var g=v.prev();var _=v.next();var y=v.parent();function b(e,t){var r=e.match(X);if(r){e=e.replace(X," ")}y.toggleClass("cmd-end-line",!!r);var n=false;var i=$.extend({prompt:"",last:false},t);var a=i.position;var u=O(e);var o=i.prompt;var s;if(a===u){g.html(j(e));s="&nbsp;";F();_.html("")}else if(a===0){g.html("");s=Le(e,0,1);v.html(j(s));_.html(j(Le(e,1),o+s))}else{var l=$.terminal.substring(e,0,a);g.html(j(l,o));s=Le(e,a,a+1);var f=(o+l).replace(/^.*\t/,"");v.html(j(s,f));if(a===u-1){n=true;_.html("")}else{if(s.match(/\t/)){f=""}else{f+=s}_.html(j(Le(e,a+1),f))}}if(ch_unit_bug){if(typeof wcwidth!=="undefined"){var c=strlen(text(s));if(c===1&&ze(s)){c=2}v.width(D*c)}else{v.width(D)}}v.toggleClass("cmd-end-line",n);Fe();var p=$.terminal.length(v.text());if(p>1){var m=v.find("[data-text]")[0];m.style.setProperty("--length",p)}V()}function C(e,t){var r=e.match(X);var n='<div role="presentation" aria-hidden="true"';if(r){e=e.replace(X," ");n+=' class="cmd-end-line"'}n+=">"+j(e,t||"")+"</div>";return n}function F(){v.html('<span data-text class="end"><span>&nbsp;<span></span>')}function w(e){var r=y;$.each(e,function(e,t){r=$(C(t)).insertAfter(r)})}function E(e){$.each(e,function(e,t){y.before(C(t,e===0?W:""))})}return function(){var e;switch(typeof x.mask){case"boolean":e=x.mask?T.replace(/./g,"*"):T;break;case"string":e=T.replace(/./g,x.mask);break}var t=Re(e);var r;if(O(t)===text(e).length){r=S}else{r=R}var n;A.css({display:"none"});A.find("div:not(.cmd-cursor-line)").remove();g.html("");if(Oe(t)){var i=t.match(/\t/g);var a=t;if(i){t=t.replace(/\t/g,"\0\0\0\0")}var u=Se(t);if(i){u=$.map(u,function(e){return e.replace(/\x00\x00\x00\x00/g,"\t")})}var o=O(u[0]);if(o===0&&u.length===1){}else if(r<o){b(u[0],{length:u.length,position:r,prompt:W});w(u.slice(1))}else if(r===o){y.before(C(u[0],W));b(u[1]||"",{length:u.length,position:0,last:u.length<=2});if(u.length>2){w(u.slice(2))}}else{var s=u.slice(-1)[0];var l=O(a);var f=l-r;var c=O(s);var p=0;if(f===-1){f=0}if(f<=c){E(u.slice(0,-1));if(c===f){p=0}else{p=c-f}b(s,{length:u.length,position:p,last:true})}else{var m;var D;p=r;for(n=0;n<u.length;++n){var d=$.terminal.length(u[n]);if(p>d){p-=d}else{break}}D=u[n];m=n;if(p===O(D)){p=0;D=u[++m];if(D===undefined){var h=$.terminal.defaults.strings.redrawError;throw new Error(h)}}b(D,{length:u.length,position:p});E(u.slice(0,m));w(u.slice(m+1))}}k.find(".cmd-cursor-line ~ div:last-of-type").append("<span></span>")}else if(t===""){g.html("");F();_.html("")}else{b(t,{length:1,position:r})}var v=y.prevUntil(".cmd-prompt").length;if(is_css_variables_supported){k[0].style.setProperty("--cursor-line",v)}else{B.$node.css("top",v*14+"px")}A.css({display:""})}}();var Ie=function(){function a(e,t){var r=$.extend({},x,{position:t,command:true});return $.terminal.apply_formatters(e,r)[1]}function s(e,t,r){var n=a(r,t);if(n===e){var i=a(r,t+1);if(i>e){return 0}return 1}else if(n<e){return 1}else{return-1}}return function(e,t){if(t===0){return 0}e=bare_text(e);var r=e.length;var n=$.terminal.escape_brackets(T);var i=binary_search(0,r,t,s,[n]);var a=$.terminal.split_characters(e);if(r>a.length){var u=0;for(var o=0;o<a.length;++o){u+=a[o].length;if(u>=i){return u}}}return i}}();function Pe(){if(o){return new Array(o+1).join("￿")}return""}var Ne;var b=function(){function i(e){if(!e){q=0;d=o;return e}var t=Pe();var r=t+e;var n=$.terminal.split_equal(r,m);n=n.map(function(e){return e.replace(/^\uFFFF+/,"")});n=n.map(function(e){if(!$.terminal.have_formatting(e)){return"[[;;]"+$.terminal.escape_brackets(e)+"]"}return $.terminal.format_split(e).map(function(e){if($.terminal.is_formatting(e)){return e}return"[[;;]"+$.terminal.escape_brackets(e)+"]"}).join("")});var i={charWidth:x.charWidth};W=n[n.length-1];var a=$.terminal.encode(n[n.length-1],{tabs:x.tabs});var u=$.terminal.format(a,i);q=strlen(text(a));d=q+o;return n.slice(0,-1).map(function(e){e=$.terminal.encode(e,{tabs:x.tabs});return'<span class="cmd-line">'+$.terminal.format(e,i)+"</span>"}).concat([u]).join("\n")}function e(e,t){if(e){if(t&&t.formatters||!t){e=$.terminal.apply_formatters(e,{prompt:true});e=$.terminal.normalize(e)}e=crlf(e)}var r=i(e);H=e;r=r||$.terminal.format("[[;;]]");if(h.html()!==r){h.html(r);var n=h.find("> span span");B.$node.attr("data-cmd-prompt",h.text());if(is_ch_unit_supported){h.hide();n.each(function(){var e=$(this);var t=strlen(e.text());if(t===0){e.css("width",1)}else{e.css("width",t+"ch")}});h.show()}}}return function(t){if(Ne&&Ne.set){Ne.set=$.noop;Ne=null}var r=Ne={set:e};with_prompt(n,function(e){r.set(e,t)},k)}}();function Me(){if(is_function(x.onCommandChange)){x.onCommandChange.call(k,T)}}function He(e,t,r){var n=e.substring(0,t);if(t===0||!e.length){return 0}var i=/\n?([^\n]*)$/;var a=n.match(i);var u=a[1].length;if(!pe(n)&&(r||me(n,d))){u+=d}if(u===0){return u}u%=m;if(u===0){return m}return u}$.extend(k,{option:function(e,t){if(typeof t==="undefined"){return x[e]}else{x[e]=t}return k},name:function(e){if(e!==undefined){Q=e;var t=f&&f.enabled()||!f;f=new History(Q,x.historySize,x.history==="memory");if(!t){f.disable()}return k}else{return Q}},purge:function(){f.clear();return k},history:function(){return f},delete:function(e,t){var r,n;if(e===0){return""}else if(e<0){if(S>0){r=T.slice(0,S).slice(e);n=bare_text(T);n=n.slice(0,S+e)+n.slice(S,n.length);if(!t){k.position(S+e)}}}else if(T!==""){n=text(T);if(S<n.length){r=n.slice(S).slice(0,e);n=n.slice(0,S)+n.slice(S+e,n.length)}}if(r){T=n}y();g();Me();return r},set:function(e,t,r){if(e!==undefined){var n=e!==T;T=e;if(!t){k.position(bare_text(T).length)}y();g();if(!r&&n){Me()}}return k},keymap:function(e,t){function r(e,t){var r=i[e];if(is_function(r)){r=r.bind(k)}return function(e){return t.call(k,e,r)}}if(e===null){c=i;return k}else if(typeof e==="undefined"){return c}else if(typeof e==="string"){if(typeof t==="undefined"){if(c[e]){return c[e]}else if(i[e]){return i[e]}}else{c[e]=r(e,t)}}else{c=$.extend({},c?c:i,$.omap(e||{},r));return k}},insert:function(e,t){var r=bare_text(T);var n=bare_text(e).length;if(S===r.length){e=r+e}else if(S===0){e=e+r}else{e=r.slice(0,S)+e+r.slice(S)}T=e;if(!t){k.position(n,true,true)}g();y();Me();return k},get:function(){return T},commands:function(e){if(e){x.commands=e;return k}else{return e}},destroy:function(){L.unbind("keypress.cmd",ut);L.unbind("keydown.cmd",it);L.unbind("input.cmd",ft);k.stopTime("blink",Ee);k.find(".cmd-wrapper").remove();k.find(".cmd-prompt, .cmd-clipboard, .cmd-editable").remove();k.removeClass("cmd").removeData("cmd").off(".cmd");return k},display_column:function(e){var t=Re(T);t=$.terminal.strip(t);return He(t,R,e)},column:function(e){return He(T,S,e)},line:function(){var e=T.substring(0,S);if(S===0||!T.length){return 0}return e.split(/\n/).length-1},__set_prompt_margin:function(e){o=e;d=q+o},prompt:function(e,t){if(e===true){return H}else if(e===undefined){return n}else{var r=e!==n;if(typeof e==="string"||typeof e==="function"){n=e}else{throw new Error("prompt must be a function or string")}if(r){b(t);y()}return k}},kill_text:function(){return a},position:function(e,t,r){if(typeof e==="number"){var n=S;var i=bare_text(T).length;if(t){S+=e}else if(e<0){S=0}else if(e>i){S=i}else{S=e}if(n!==S){y();if(!r&&is_function(x.onPositionChange)){x.onPositionChange(S,R)}g(true)}return k}else{return S}},refresh:function(){b();y();g(true);return k},display_position:function(e,t){if(e===undefined){return R}else{var r=Re($.terminal.escape_formatting(T),true);var n=O(r);var i=bare_text(T).length;var a;if(t){a=R+e}else if(e>n){a=n}else{a=e}if(n===i){R=a;return k.position(a)}if(n===a){R=a;return k.position(i)}var u=Ie(T,a);if(u!==-1){R=a;k.position(u)}return k}},visible:function(){var e=k.visible;return function(){e.apply(k,[]);y();b();return k}}(),show:function(){var e=k.show;return function(){e.apply(k,[]);y();b();return k}}(),resize:function(e){D=ke();var t;if(typeof e==="number"){t=e}else{t=Ae(D)}if(m!==t||arguments[0]===true){m=t;b();y()}return k},clear_cache:"Map"in root?function(){Te.clear()}:function(){return k},invoke_key:function(e){if(!l){warn('invoke_key("'+e+'") called on disabled terminal')}var t=e.toUpperCase().split("+");var r=t.pop();var n=t.indexOf("CTRL")!==-1;var i=t.indexOf("SHIFT")!==-1;var a=t.indexOf("ALT")!==-1;var u=t.indexOf("META")!==-1;var o=$.Event("keydown",{ctrlKey:n,shiftKey:i,altKey:a,metaKey:u,which:ae[r],key:r});var s=$(document.documentElement||window);s.trigger(o);o=$.Event("keypress");o.key=r;o.which=o.keyCode=0;s.trigger(o);return k},clip:function(){return B},enable:function(e){if(!l){l=true;k.addClass("enabled");try{if(!B.$node.is(":focus")){B.$node.focus()}B.$node.caret(S)}catch(e){}t(true);if(!e&&is_function(n)){b()}Fe();g()}Ce();return k},isenabled:function(){return l},disable:function(e){l=false;k.removeClass("enabled");t(false);if(!e){Ce()}return k},mask:function(e){if(typeof e==="undefined"){return x.mask}else{x.mask=e;y();return k}}});k.name(x.name||x.prompt||"");D=ke();m=Ae(D);if(x.prompt!==false){n=x.prompt;b()}if(x.enabled===true){k.enable()}if(!x.history){f.disable()}var We=true;var qe=false;var Ue=false;var Ke=false;var C=false;var Je=false;var F=true;var w=false;var Qe=false;var Ve=false;var Ye=false;var E;var Ge="";var Xe;function Ze(e){return e.key.toUpperCase()==="BACKSPACE"||e.which===8}function et(e){return e.key&&e.key.length===1&&!e.ctrlKey}function tt(e){var t=["HOLD+SHIFT+BACKSPACE","HOLD+BACKSPACE"];return t.indexOf(e)!==-1&&x.mobileDelete||x.repeatTimeoutKeys.indexOf(e)!==-1}function rt(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 nt=false;function it(e){debug('keydown "'+e.key+'" '+e.fake+" "+e.which);var t;Qe=(e.key||"").toLowerCase()==="process"||e.which===0;Ue=C&&Ke&&!Ze(e);var r=typeof e.key!=="undefined";var n=String(e.key).toLowerCase();var i=n==="unidentified";try{if(!e.fake){Ke=et(e);Je=!i;w=r&&Ze(e)}}catch(e){}if(i){F=true;return}if(!e.fake&&r&&["meta","os"].indexOf(n)===-1){F=false}C=true;B.$node.off("input",le);var a=ne(e);if(is_function(x.keydown)){if(r){e.key=re(e)}t=x.keydown.call(k,e);if(t!==undefined){if(!t){E=true}return t}}if(a!==Xe){at()}if(l||a==="CTRL+C"&&is_terminal_selected(k)){if(Ve){Xe=a;a="HOLD+"+a;if(Ye){return}if(x.holdRepeatTimeout>0&&tt(a)){Ye=true;k.oneTime(x.holdRepeatTimeout,"delay",function(){Ye=false})}}else{k.oneTime(x.holdTimeout,"hold",function(){Ve=true});Xe=a}if(!e.fake&&is_android){if(nt){at();nt=false;return false}if(I(a)){nt=true}else if(I(Xe)){nt=false}}V();E=["CTRL+V","META+V"].indexOf(a)!==-1;if(a==="ENTER"){We=true}if(u&&rt(e)){xe();b();if(e.which===27){k.set("")}y();if(e.which===13){it.call(this,e)}}else if(is_function(c[a])){t=c[a](e);if(t===true){return}if(t!==undefined){return t}}else if(e.altKey){return}else{qe=false;return}}}function at(){k.stopTime("hold");k.stopTime("delay");Ye=Ve=false}var L=$(document.documentElement||window);k.keymap(x.keymap||{});function ut(e){debug('keypress "'+e.key+'" '+e.fake);at();var t;if(!e.fake){C=false}if((e.ctrlKey||e.metaKey)&&!e.altKey){return}if(qe){return}if(is_function(x.keypress)){t=x.keypress.call(k,e);if(t!==undefined){if(!t){E=true}return t}}if(l){if(e.fake){return}var r;if(is_key_native){r=e.key;var n=r.toUpperCase();if(te[n]){r=te[n]}}if(!r||Je){r=String.fromCharCode(e.which)}if($.inArray(e.which,[13,0,8])>-1){if(e.keyCode===123){return}return false}else if(r&&(!e.ctrlKey||e.ctrlKey&&e.ctrlKey)&&(!(e.altKey&&e.which===100)||e.altKey)&&!Ue){if(u){s+=r;$e();_()}else if(r.length===1){k.insert(r)}}}}function ot(e,t,r){var n=$.Event(e);n.which=r;n.key=t;n.fake=true;L.trigger(n)}var st=false;function lt(){Ge=T;E=false;F=true}function ft(){debug("input "+F+" || "+Qe+" (("+C+" || "+Ue+") && !"+E+" && ("+Ke+" || "+Je+") && !"+w+")");var e=B.val();if(!is_mobile){e=e.replace(/^ /,"")}if(F||Qe||(C||Ue)&&!E&&(Ke||Je)&&!w){if(e&&e===T){if(is_android){if(F){ot("keydown","Enter",13)}}lt();return}var t=S;if(F){var r=Ge;w=r.slice(0,r.length-1).length===e.length}if(st){st=false;B.val(T);return}if(u){s=e;$e();_()}else{var n=e.slice(S);if(n.length===1||w){var i=get_next_character(n);if(I(i)){st=true}if(F){var a;if(w){a=8}else{a=n.toUpperCase().charCodeAt(0)}ot("keydown",w?"Backspace":n,a)}if(C&&!w){ot("keypress",i,n.charCodeAt(0))}}if(w){Ge=T;return}if(E){E=false;return}k.set(e)}if(w){k.position(t-1)}else{k.position(t+Math.abs(e.length-Ge.length))}}lt()}L.bind("keypress.cmd",ut);L.bind("keydown.cmd",it);L.bind("keyup.cmd",at);L.bind("input.cmd",ft);(function(){if(is_mobile){$(k[0]).add(B.$node).on("touchstart.cmd",function(){if(!k.isenabled()){B.focus()}else{B.blur()}});k.disable();return}var a=false;var u=0;k.on("mousedown.cmd",function(){a=true}).on("mouseup.cmd",function(r){function e(){var e=$(r.target);var t=e.is(".cmd-prompt");if(!t&&i&&get_selected_html()===""){if(l){if(e.is(".cmd")){k.position(text(T).length)}else{k.display_position(ee(r))}}}u=0}var t;if(r.originalEvent===undefined){t=r.button}else{t=r.originalEvent.button}if(t===0&&get_selected_html()===""){var n="click_"+N;if(++u===1){var i=a;if(l){if(x.clickTimeout===0){e()}else{k.oneTime(x.clickTimeout,n,e)}}else{u=0}}else{k.stopTime(n);u=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){e=e.replace(/\u200B/g,"");return $.terminal.length(e)}}else{return wcwidth}}();function count_selfclosing_formatting(e){var r=0;if($.terminal.have_formatting(e)){var n=new RegExp(format_parts_re.source,"i");$.terminal.format_split(e).forEach(function(e){if($.terminal.is_formatting(e)){var t=e.match(n);if(t&&t[1].match(/@/)&&t[6]===""){r++}}})}return r}var entities={"&amp;":"&","&lt;":"<","&gt;":">","&Agrave;":"À","&Aacute;":"Á","&Acirc;":"Â","&Atilde;":"Ã","&Auml;":"Ä","&Aring;":"Å","&AElig;":"Æ","&Ccedil;":"Ç","&Egrave;":"È","&Eacute;":"É","&Ecirc;":"Ê","&Euml;":"Ë","&Igrave;":"Ì","&Iacute;":"Í","&Icirc;":"Î","&Iuml;":"Ï","&ETH;":"Ð","&Ntilde;":"Ñ","&Ograve;":"Ò","&Oacute;":"Ó","&Ocirc;":"Ô","&Otilde;":"Õ","&Ouml;":"Ö","&Oslash;":"Ø","&Ugrave;":"Ù","&Uacute;":"Ú","&Ucirc;":"Û","&Uuml;":"Ü","&Yacute;":"Ý","&THORN;":"Þ","&szlig;":"ß","&agrave;":"à","&aacute;":"á","&acirc;":"â","&atilde;":"ã","&auml;":"ä","&aring;":"å","&aelig;":"æ","&ccedil;":"ç","&egrave;":"è","&eacute;":"é","&ecirc;":"ê","&euml;":"ë","&igrave;":"ì","&iacute;":"í","&icirc;":"î","&iuml;":"ï","&eth;":"ð","&ntilde;":"ñ","&ograve;":"ò","&oacute;":"ó","&ocirc;":"ô","&otilde;":"õ","&ouml;":"ö","&oslash;":"ø","&ugrave;":"ù","&uacute;":"ú","&ucirc;":"û","&uuml;":"ü","&yacute;":"ý","&thorn;":"þ","&yuml;":"ÿ","&nbsp;":" ","&iexcl;":"¡","&cent;":"¢","&pound;":"£","&curren;":"¤","&yen;":"¥","&brvbar;":"¦","&sect;":"§","&uml;":"¨","&copy;":"©","&ordf;":"ª","&laquo;":"«","&not;":"¬","&shy;":"­","&reg;":"®","&macr;":"¯","&deg;":"°","&plusmn;":"±","&sup2;":"²","&sup3;":"³","&acute;":"´","&micro;":"µ","&para;":"¶","&cedil;":"¸","&sup1;":"¹","&ordm;":"º","&raquo;":"»","&frac14;":"¼","&frac12;":"½","&frac34;":"¾","&iquest;":"¿","&times;":"×","&divide;":"÷","&forall;":"∀","&part;":"∂","&exist;":"∃","&empty;":"∅","&nabla;":"∇","&isin;":"∈","&notin;":"∉","&ni;":"∋","&prod;":"∏","&sum;":"∑","&minus;":"","&lowast;":"","&radic;":"√","&prop;":"∝","&infin;":"∞","&ang;":"∠","&and;":"∧","&or;":"","&cap;":"∩","&cup;":"","&int;":"∫","&there4;":"∴","&sim;":"","&cong;":"≅","&asymp;":"≈","&ne;":"≠","&equiv;":"≡","&le;":"≤","&ge;":"≥","&sub;":"⊂","&sup;":"⊃","&nsub;":"⊄","&sube;":"⊆","&supe;":"⊇","&oplus;":"⊕","&otimes;":"⊗","&perp;":"⊥","&sdot;":"⋅","&Alpha;":"Α","&Beta;":"Β","&Gamma;":"Γ","&Delta;":"Δ","&Epsilon;":"Ε","&Zeta;":"Ζ","&Eta;":"Η","&Theta;":"Θ","&Iota;":"Ι","&Kappa;":"Κ","&Lambda;":"Λ","&Mu;":"Μ","&Nu;":"Ν","&Xi;":"Ξ","&Omicron;":"Ο","&Pi;":"Π","&Rho;":"Ρ","&Sigma;":"Σ","&Tau;":"Τ","&Upsilon;":"Υ","&Phi;":"Φ","&Chi;":"Χ","&Psi;":"Ψ","&Omega;":"Ω","&alpha;":"α","&beta;":"β","&gamma;":"γ","&delta;":"δ","&epsilon;":"ε","&zeta;":"ζ","&eta;":"η","&theta;":"θ","&iota;":"ι","&kappa;":"κ","&lambda;":"λ","&mu;":"μ","&nu;":"ν","&xi;":"ξ","&omicron;":"ο","&pi;":"π","&rho;":"ρ","&sigmaf;":"ς","&sigma;":"σ","&tau;":"τ","&upsilon;":"υ","&phi;":"φ","&chi;":"χ","&psi;":"ψ","&omega;":"ω","&thetasym;":"ϑ","&upsih;":"ϒ","&piv;":"ϖ","&OElig;":"Œ","&oelig;":"œ","&Scaron;":"Š","&scaron;":"š","&Yuml;":"Ÿ","&fnof;":"ƒ","&circ;":"ˆ","&tilde;":"˜","&ensp;":"","&emsp;":"","&thinsp;":"","&zwnj;":"","&zwj;":"","&lrm;":"","&rlm;":"","&ndash;":"","&mdash;":"—","&lsquo;":"","&rsquo;":"","&sbquo;":"","&ldquo;":"“","&rdquo;":"”","&bdquo;":"„","&dagger;":"†","&Dagger;":"‡","&bull;":"•","&hellip;":"…","&permil;":"‰","&prime;":"","&Prime;":"″","&lsaquo;":"","&rsaquo;":"","&oline;":"‾","&euro;":"€","&trade;":"™","&larr;":"←","&uarr;":"↑","&rarr;":"→","&darr;":"↓","&harr;":"↔","&crarr;":"↵","&lceil;":"⌈","&rceil;":"⌉","&lfloor;":"⌊","&rfloor;":"⌋","&loz;":"◊","&spades;":"♠","&clubs;":"♣","&hearts;":"♥","&diams;":"♦"};function render_entities(e){return e.replace(/&#(x?)([0-9]+);/g,function(e,t,r){r=parseInt(r,t?16:10);return String.fromCharCode(r)}).replace(/(&[^;]+;)/g,function(e,t){return entities[t]||t})}function bare_text(e){if(!e.match(/&/)){return e}return render_entities(safe(e))}function text(e){return bare_text($.terminal.strip(e))}function amp(e){return e.replace(/&(?!#[0-9]+;|#x[0-9a-f]+;|[a-z]+;)/gi,"&amp;")}function safe(e){if(!e.match(/[<>&]/)){return e}return amp(e).replace(/</g,"&lt;").replace(/>/g,"&gt;")}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(t){var r=t.match(n);if(starts_with(r)){return r[1]}}}function starts_with(e){return e&&e.index===0}function is_simple_text(e){var t=[entity_re,emoji_re,combine_chr_re,astral_symbols_re];for(var r=0;r<t.length;++r){if(t[r].test(e)){return false}}return true}function make_next_char_fun(t){var a=[];[entity_re,emoji_re,combine_chr_re].forEach(function(e){if(e.test(t)){a.push(make_re_fn(e))}});if(astral_symbols_re.test(t)){a.push(function e(t){var r=t.match(astral_symbols_re);if(starts_with(r)){var n=t.match(combine_chr_re);if(n&&n.index===1){return t.slice(0,3)}return r[1]}})}return function e(t){for(var r=0;r<a.length;++r){var n=a[r];var i=n(t);if(i){return i}}return t[0]}}function get_next_character(e){var t=e.match(entity_re);if(starts_with(t)){return t[1]}var r=e.match(combine_chr_re);if(starts_with(r)){return r[1]}var n=e.match(emoji_re);if(starts_with(n)){return n[1]}else if(e.charCodeAt(0)<255){return e[0]}else{var i=e.match(astral_symbols_re);if(starts_with(i)){r=e.match(combine_chr_re);if(r&&r.index===1){return e.slice(0,3)}return e.slice(0,2)}else{return e[0]}}}function normalize_position(e,n){if(n===0){return n}e=$.terminal.strip(e);var t=$.terminal.split_characters(e).reduce(function(e,t){if(typeof e==="number"){return e}var r=e.length+char_len(t);if(r>=n){return e.position+1}return{position:e.position+1,length:r}},{position:0,length:0});if(typeof t==="number"){return t}else{return t.position}}function style_to_string(t){return Object.keys(t).map(function(e){return e+":"+t[e]}).join(";")}function escape_html_attr(e){return e.replace(/"/g,"&quot;")}function char_width_object(e,t){var r={};if(e===0){r["width"]="1px"}else if(is_ch_unit_supported){r["width"]=e+"ch"}else if(!is_css_variables_supported){if(t.charWidth){r["width"]=t.charWidth*e+"px"}}else{r["--length"]=e}return r}function char_width_prop(e,t){return style_to_string(char_width_object(e,t))}function extra_css(e,t){if(typeof wcwidth!=="undefined"){var r=bare_text(e);var n=strlen(r);if(n>1&&n!==$.terminal.length(r)){return char_width_object(n,t)}}}function wide_characters(e,r){if(typeof wcwidth!=="undefined"){var t=bare_text(e);var n=$.terminal.split_characters(t);if(n.length===1){return e}var i=n.map(function(e){return{len:strlen(e),chr:e}}).reduce(function(e,t){var r=e[e.length-1];if(r){if(r.len!==t.len){return e.concat([{sum:t.len,len:t.len,specs:[t]}])}else{e.pop();return e.concat([{sum:r.sum+t.len,len:r.len,specs:r.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,r);if(e.sum===n.length||!t.length){return"<span>"+a(e)+"</span>"}else if(e.specs.length>1){return u(t,e.specs.map(function(e){return u(char_width_prop(e.len),e.chr)}).join(""))}else{return u(t,a(e))}}).join("")}function a(e){return e.specs.map(function(e){return e.chr}).join("")}function u(e,t){return'<span style="'+e+'">'+t+"</span>"}return e}function binary_search(e,t,r,n,i){var a=t-e;var u=e+Math.floor(a/2);var o=[r,u].concat(i);var s=n.apply(null,o);if(s===0){return u}else if(s>0&&a>1){return binary_search(u,t,r,n,i)}else if(s<0&&a>1){return binary_search(e,u,r,n,i)}else{return-1}}function is_terminal_selected(e){if(is_function(window.getSelection)){var t=window.getSelection();if(t.toString()){var r=t.getRangeAt(0).startContainer.parentNode;var n=$(r).closest(".terminal");return n.length&&(e&&n.find(".cmd").is(e)||!e)}}}function get_selected_html(){var e="";if(is_function(window.getSelection)){var t=window.getSelection();if(t.rangeCount){var r=document.createElement("div");for(var n=0,i=t.rangeCount;n<i;++n){r.appendChild(t.getRangeAt(n).cloneContents())}e=r.innerHTML}}return e}function with_selection(e){var t="";var r=[];if(is_function(window.getSelection)){var n=window.getSelection();if(n.rangeCount){var i=document.createElement("div");for(var a=0,u=n.rangeCount;a<u;++a){var o=n.getRangeAt(a).cloneRange();r.push(o);i.appendChild(o.cloneContents())}t=i.innerHTML}}e(t);if(r.length){n.removeAllRanges();r.forEach(function(e){n.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 r="";var n=$("<div>"+e+"</div>");if(e.match(/<\/div>/)){t=n.find("div[data-index]").map(function(){return process_div(this)}).get().join("\n");if(!t&&e.match(/style="width: 100%;?"/)){t=process_div(n)}r=t}var i=n.find(".cmd-prompt");if(i.length){if(r.length){r+="\n"}r+=i.text()}var a=n.find('[role="presentation"]');if(a.length){r+=a.map(process_selected_line).get().join("")}if(!r.length&&e){r=n.text()}return r.replace(/\xA0/g," ")}var support_copy=function(){if(typeof document==="undefined"){return false}if(!is_function(document.queryCommandSupported)){return false}return document.queryCommandSupported("copy")}();var text_to_clipboard;if(support_copy){text_to_clipboard=function e(t,r){var n=t.val();var i=t.is(":focus");var a=t.caret();if(window.navigator&&window.navigator.clipboard){navigator.clipboard.writeText(r)}else if(i){t.val(r).focus();t[0].select();document.execCommand("copy");t.val(n);t.caret(a)}else{var u=$("<textarea/>").css({position:"fixed",top:0,left:0}).appendTo("body");u.val(r).focus();u[0].select();document.execCommand("copy");u.blur();u.remove()}return true}}else{text_to_clipboard=$.noop}var get_textarea_selection=function(){function e(){return""}if(typeof document==="undefined"){return e}var t=document.createElement("textarea");var r="selectionStart"in t;t=null;if(r){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 e}}();function clear_textarea_selection(e){e.selectionStart=e.selectionEnd=0}function common_string(e,t,r){if(!t.length){return""}var n=string_case(e);var i=[];for(var a=e.length;a<t[0].length;++a){var u=false;var o=t[0].charAt(a),s=o.toLowerCase();for(var l=1;l<t.length;++l){u=true;var f=t[l].charAt(a),c=f.toLowerCase();if(o!==f){if(r||n==="mixed"){u=false;break}else if(s===c){if(n==="lower"){o=o.toLowerCase()}else if(n==="upper"){o=o.toUpperCase()}else{u=false;break}}else{u=false;break}}}if(u){i.push(o)}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(root.getSelection){var e=root.getSelection();if(e.setBaseAndExtent){return function(e,t){var r=root.getSelection();r.setBaseAndExtent(e,0,t,1)}}else{return function(e,t){var r=root.getSelection();var n=document.createRange();n.setStart(e,0);n.setEnd(t,t.childNodes.length);r.removeAllRanges();r.addRange(n)}}}else{return $.noop}}();function process_command(e,t){var r=e.trim();var n=r.match(command_re)||[];if(n.length){var i=n.shift();var a=$.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 u=$.map(n,function(e){var t=e.match(/^(['"`]).*\1$/);return t&&t[1]||""});var o=r.slice(i.length).trim();return{command:e,name:i,args:a,args_quotes:u,rest:o}}else{return{command:e,name:"",args:[],args_quotes:[],rest:""}}}function on_height_change(r){var e=window.visualViewport.scale;var n=Math.round(window.visualViewport.height*e);r(n);window.visualViewport.addEventListener("resize",function(){var e=window.visualViewport.scale;var t=Math.round(window.visualViewport.height*e);if(n!==t){n=t;r(n)}})}$.terminal={version:"2.44.1",date:"Tue, 08 Oct 2024 20:29:53 +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 r=/([-\\^$[\]()+{}?*.|])/g;return t.replace(r,"\\$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)},is_extended_command:function e(t){return typeof t==="string"&&t.match(format_exec_re)&&!$.terminal.is_formatting(t)},each_extended_command:function(e,r){var t=e.split(format_exec_split_re);return $.map(t,function(e){if($.terminal.is_extended_command(e)){var t=e.replace(/^\[\[|\]\]$/g,"");return r(t)||""}return e}).join("")},format_split:function e(t){return t.split(format_split_re).filter(Boolean)},tracking_replace:function e(t,r,n,i){if(!(r instanceof RegExp)){throw new Error("tracking_replace: Second argument need to be RegExp")}function a(e,t,r){return e.slice(t,r)}function u(e){return $.terminal.strip(e).length}var o="";var s;var l=0;var f;var c=i;var p;r.lastIndex=0;while(s=r.exec(t)){if(r.global){var m=u(a(t,0,r.lastIndex));p=m-u(s[0])}else{p=s.index;m=p+u(s[0])}if(l<p){o+=a(t,l,p)}l=m;if(typeof n==="function"){f=n.apply(null,s)}else{f=n.replace(/\$(\$|\d)/g,function(e,t){if(t==="$"){return"$"}return s[t]})}o+=f;if(p<i){var D=u(f);D+=count_selfclosing_formatting(f);if(m<i){c=Math.max(0,c+D-u(s[0]))}else{c+=D-(i-p)}}if(!r.global){break}}if(l<u(t)){o+=a(t,l)}if(t===o){return[t,i]}return[o,c]},iterate_formatting:function z(t,e){function r(e){return e===" "||e==="\t"||e==="\n"}function n(e){if(!d){return r(t[e-1])}return t.slice(e-6,e)==="&nbsp;"||r(t[e-1])}function i(e){if(!d){return null}return t.slice(e).match(entity_re)}function a(e){return t[e]==="["&&t[e+1]==="["}function u(e){return t[e-1]!=="\\"&&t[e]==="\\"&&t[e+1]==="]"}function o(e){return t[e]==="]"||t[e]==="["}function s(e){return B&&!T&&(t[e]!=="]"&&!A||!D)||v&&!h}var l=make_next_char_fun(t);function f(){var e=l(k);if(e.length>1&&$.terminal.length(k)>1){return e.length-1}return 0}function c(){return n(x)&&(B||T)&&(y===-1&&C!==x||y!==-1)}var p=false;function m(){if(x===t.length-1&&!p){p=true}else{p=h&&!!k.match(/^.]$/)}return p}var D=$.terminal.have_formatting(t);var d=entity_re.test(t);var h="";var v=false;var g=0;var _;var y=-1;var b=-1;var C;var F=0;var w=0;var E=/(&[^;]+);$/;for(var x=0;x<t.length;x++){var k=t.slice(x);var A=false;_=k.match(format_start_re);if(_){h=_[1];v=false}else if(h){if(t[x]==="]"){A=v;if(v){h="";v=false}else{v=true}}}else{v=true}var B=h&&v||!h;var T=a(x);if(c()){y=x;b=g}var S=o(x);w=0;if(B){if(t[x]==="&"){_=i(x);if(_){x+=_[1].length-2;continue}++g;++F}else if(u(x)){++g;++F;w=1;x+=1}else if(!S||!D||v&&!h){++g;++F}}if(s(x)){if(strlen(t[x])===2){F++}var R=l(k);var j=R.length;if(R===";"){_=t.slice(0,x+1).match(E);if(_){w=_[1].length;j=w+1}}var O={last:m(),count:g,index:x-w,formatting:h,length:F,text:v,size:j,space:y,space_count:b};var L=e(O);if(L===false){break}else if(L){if(L.count!==undefined){g=L.count}if(L.length!==undefined){F=L.length}if(L.space!==undefined){C=y;y=L.space}if(L.index!==undefined){x=L.index;continue}}}else if(x===t.length-1&&!p){e({last:true,count:g+1,index:x,formatting:h,length:0,text:v,space:y})}if(v){x+=f()}}},partition:function e(n,t){var r=$.extend({wrap:true},t);if(!$.terminal.have_formatting(n)){var i=$.terminal.split_characters(n);return i.map(u)}var a=[];function u(e){if(e.match(/\\$/)){e+="\\"}return"[[;;]"+e+"]"}function o(e){if($.terminal.is_formatting(e)){if(e.match(/\\]$/)){e=e.replace(/\\]/g,"\\\\]")}}else if(r.wrap){e=u(e)}return e}$.terminal.iterate_formatting(n,function e(t){if(t.text){var r=[];if(t.formatting){r.push(t.formatting)}r.push(n.substring(t.index,t.index+t.size));if(t.formatting){r.push("]")}a.push(o(r.join("")))}});return a},substring:function e(t,r,n){var i=$.terminal.split_characters(t);if(!i.slice(r,n).length){return""}if(!$.terminal.have_formatting(t)){return i.slice(r,n).join("")}var a=0;var u;var o="";var s="";var l;var f=1;$.terminal.iterate_formatting(t,function e(t){if(r&&t.count===r+1){a=t.index;if(t.formatting){o=t.formatting}}if(n&&t.count===n){s=t.formatting;l=t.index;f=t.size}if(t.count===n+1){u=t.index;if(t.formatting){u=l+f}}});if(r&&!a){return""}if(u===undefined){u=t.length}t=o+t.slice(a,u);if(s){t=t.replace(/(\[\[^\]]+)?\]$/,"");t+="]"}return t},normalize:function e(t){t=t.replace(format_re,function e(t,r,n){if(r.match(self_closing_re)&&n===""){return"[["+r+"] ]"}if(n===""){return""}function i(e){return e.replace(/\\\]/g,"&#93;").replace(/\n/g,"\\n").replace(/&nbsp;/g," ")}r=i(r);var a=r.match(/;/g).length;if(a>=4){var u=r.split(/;/);var o=u.slice(0,4).join(";");var s=u.slice(4).join(";");return"[["+o+";"+(s||n)+"]"+n+"]"}else if(a===2){a=";;"}else if(a===3){a=";"}r+=a+i(n);return"[["+r+"]"+n+"]"});return $.terminal.amp(t)},split_equal:function e(t,p,r){if(typeof r==="boolean"){r={keepWords:r}}var m=$.extend({trim:false,keepWords:false},r);var D="";var d=[];var n=$.terminal.normalize(t).split(/\n/g);var i=$.terminal.have_formatting(t);for(var a=0,u=n.length;a<u;++a){if(n[a]===""){d.push("");continue}var h=n[a];var v=make_next_char_fun(h);var g=0;var _;var y=h.length;var b=/\[\[[^\]]+\](?:[^\][]|\\\])+\]$/.test(h);var C=/^(&nbsp;|\s)/.test(h);if(!i&&y<p){d.push(h);continue}$.terminal.iterate_formatting(h,function e(t){var r,n;if(t.length>=p||t.last||t.length===p-1&&strlen(h[t.index+1])===2){var i=false;if(m.keepWords&&t.space!==-1){var a=text(h).substring(t.space_count);a=a.slice(0,p).replace(/\s+$/,"");var u=strlen(a);if(space_re.test(a)||u<p){i=true}}var o=t.index+t.size;if(b){o+=1}var s;if(m.keepWords&&t.space!==-1&&o!==y&&i){_=h.slice(g,t.space);s=t.space-1}else{n=h.slice(t.index);r=v(n);_=h.slice(g,t.index)+r;if(t.last&&b&&r!=="]"){_+="]"}s=t.index+r.length-1}if(m.trim||m.keepWords){_=_.replace(/(&nbsp;|\s)+$/g,"")}if(!C&&!D){_=_.replace(/^(&nbsp;|\s)+/g,"")}g=(s||t.index)+1;if(D){var l=/^[^\]]*\]/.test(_);_=D+_;if(l){D=""}}var f=_.match(format_re);if(f){var c=f[f.length-1];if(c[c.length-1]!=="]"){D=c.match(format_begin_re)[1];_+="]"}else if(format_end_re.test(_)){_=_.replace(format_end_re,"");D=c.match(format_begin_re)[1]}}d.push(_);return{index:s,length:0,space:-1}}})}return d},amp:amp,encode:function e(t,r){var s=$.extend({tabs:4,before:""},r);return safe(t).replace(/ /g,"&nbsp;").split("\n").map(function(e){var o=e.split(/((?:\[\[[^\]]+\])?\t(?:\])?)/);o=o.filter(Boolean);return o.map(function(e,u){if(e.match(/\t/)){return e.replace(/\t([^\t]*)$/,function(e,t){if(u!==0&&o[u-1].match(/\t\]?$/)){var r=new Array(s.tabs+1).join("&nbsp;");return r+t}else{var n=o.slice(u-1,u).join("");if(s.before&&u<=1){n=s.before+n}var i=$.terminal.length(n);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 r=/((?:\[\[(?:[^\][]|\\\])+\])?(?:[^\][]|\\\])*\]?)/;var u=/\[\[([^\][]+)\][\s\S]*/;var o=/^\[\[([^;]*);([^;]*);([^\]]*)\]/;var f=3;var c=5;function n(e,t,r){return r.indexOf(e)===t}function p(e,t){e=i(e);if(!t){return e}return $.extend(t,e)}function i(e){var i={};e.split(/\s*;\s*/).forEach(function(e){var t=e.split(":").map(function(e){return e.trim()});var r=t[0];var n=t[1];i[r]=n});return i}function m(e){var t=e.slice();if(e[c]){t[c]=l(e[c])}if(e[f]){t[f]=D(e[f])}t[0]=s(e[0]);return t.join(";")}function s(e){var t=e.filter(function(e){return e[0]==="-"}).map(function(e){return e[1]});return e.filter(function(e){return t.indexOf(e)===-1&&t.indexOf(e[1])===-1}).join("")}function l(e){return JSON.stringify(e,function(e,t){if(e==="style"){return d(t)}return t})}function D(e){return e.filter(n).join(" ")}function d(t){return Object.keys(t).map(function(e){return e+":"+t[e]}).join(";")}function h(e){function t(t){if(!i[c]){i[c]={}}try{var e=JSON.parse(t);if(e.style){var r=e.style;var n=i[c].style;e.style=p(r,n);i[c]=$.extend(e,i[c],{style:p(r,n)})}else{i[c]=$.extend(e,i[c])}}catch(e){warn("Invalid JSON "+t)}}var i=[[],"",""];if(!e.length){return i}for(var r=e.length;r--;){var n=$.terminal.parse_formatting(e[r]);if(n.length>5){var a=n.slice(5).join(";");n=n.slice(0,5).concat(a)}var u=n[0].split(/(-?[@!gbiusor])/g).filter(Boolean);u.forEach(function(e){if(i[0].indexOf(e)===-1){i[0].push(e)}});for(var o=1;o<n.length;++o){var s=n[o].trim();if(s){if(o===f){if(!i[f]){i[f]=[]}var l=s.split(/\s+/);i[f]=i[f].concat(l)}else if(o===c){t(s)}else if(!i[o]){i[o]=s}}}}return m(i)}return t.split(r).filter(Boolean).map(function(e){var t;if(e.match(/^\[\[/)&&!$.terminal.is_extended_command(e)){var r=e.replace(u,"$1");var n=$.terminal.is_formatting(e);e=e.replace(o,"");a.push(r);if($.terminal.nested_formatting.__inherit__){t=h(a)}else{t=r}if(!n){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=h(a)}else{t=a[a.length-1]}e="[["+t+"]"+e}if(i){a.pop()}else if(a.length){e+="]"}}return e}).join("")},using_xml_formatter:function e(){if(!("xml_formatter"in $.terminal)){return false}var t=$.terminal.defaults.formatters;return t.includes($.terminal.xml_formatter)},escape_formatting:function e(t){var r=$.terminal.escape_brackets(t);if($.terminal.using_xml_formatter()){r=safe(r)}return r},apply_formatters:function e(t,a){if(t===""){if(a&&typeof a.position==="number"){return["",a.position]}else{return""}}function i(e,t,r,n){if(!e.__no_warn__&&$.terminal.length(r)!==$.terminal.length(n)){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 r=e.some(function(e){return t[e]===true});if(!r){return true}for(var n=e.length;n--;){var i=e[n];if(t[i]===true&&a[i]===true){return true}}return false}a=a||{};var r=a.formatters||$.terminal.defaults.formatters;var m=0;function D(e,t){var r=$.extend({},a,{position:t[1]});var n=e(t[0],r);if(typeof n==="string"){i(e,m-1,n,t[0]);if(typeof n==="string"){return[n,r.position]}return t}else if(is_array(n)&&n.length===2){return n}else{return t}}var n;if(typeof a.position==="number"){n=[t,a.position]}else{n=[t,0]}try{var u=r.reduce(function(o,s){m++;if(typeof s==="function"&&s.__meta__){return D(s,o)}else{var l=0;var f=false;var e=$.terminal.format_split(o[0]);var t=e.map(function(e){var t;var r=text(e).length;if(o[1]<l+r&&!f){t=o[1]-l;f=true}else if(f){t=-1}else{t=o[1]}var n=l;var i;l+=r;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]+=n}var u=text(i[0]).length;if(u!==r){}return i}return[e,-1]}});var r=t.filter(function(e){return e[1]!==-1})[0];var n=t.map(function(e){return e[0]}).join("");var i;if(typeof r==="undefined"){i=o[1]}else{i=r[1]}var a=text(n).length;a+=count_selfclosing_formatting(n);if(i>a){i=a}if(n===o[0]){return o}var u=$.terminal.strip(o[0]);var c=$.terminal.strip(n);if(u===c){return[n,o[1]]}return[n,i]}},n);if(typeof a.position==="number"){var o=$.terminal.strip(u[0]).length;if($.terminal.length(u[0])<o){var s=u[1];s=normalize_position(u[0],s);var l=$.terminal.length(u[0]);if(s>l){s=l}u[1]=s}return u}else{return u[0]}}catch(e){var f="Error in formatter ["+(m-1)+"]";r.splice(m-1);throw new $.terminal.Exception("formatting",f,e.stack)}},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,r){if(!t){return 0}return $.terminal.split_characters(r?t:text(t)).length},split_characters:function e(t){if(is_simple_text(t)){return t.split("")}var r=[];var n=make_next_char_fun(t);while(t.length){var i=n(t);t=t.slice(i.length);r.push(i)}return r},columns:function e(t,r,n){t=t.map(function(e){if(typeof e!=="string"){return String(e)}return e});var i=t.map(function(e){return $.terminal.strip(e)});var a=i.map(function(e){return strlen(e)});if(typeof n==="undefined"){n=4}var u=Math.max.apply(null,a)+n;var o=Math.floor(r/u)-1;if(o<1){return t.join("\n")}var s=[];for(var l=0,f=t.length;l<f;l+=o){var c=t.slice(l,l+o);var p=c.pop();s.push(c.reduce(function(e,t){var r=$.terminal.strip(t);var n=new Array(u-r.length+1).join(" ");e.push(t+n);return e},[]).join("")+p)}return s.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,r){function n(e){return e.split(string_re).map(function(e){if(e.match(/^['"`]/)){if(e==='""'||e==="''"||e==="``"){return""}var t=e[0];var r=new RegExp("(\\\\\\\\(?:\\\\\\\\)*)"+t,"g");e=e.replace(r,"$1").replace(/^[`'"]|[`'"]$/g,"");if(t==="'"){e=e.replace(/"/g,'\\"')}}e='"'+e+'"';return JSON.parse(e)}).join("")}if(r===false){if(t[0]==="'"&&t[t.length-1]==="'"){return t.replace(/^'|'$/g,"")}else 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 n(t)}else{return t.replace(/\\ /g," ")}}if(t==="true"){return true}else if(t==="false"){return false}var i=t.match(re_re);if(i){return new RegExp(i[1],i[2])}else if(t.match(/['"`]/)){return n(t)}else if(t.match(/^-?[0-9]+n?$/)){if(t.match(/n$/)){return BigInt(t.replace(/n$/,""))}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,r){var u=$.extend({},{boolean:[]},r);if(typeof t==="string"){return e($.terminal.split_arguments(t),r)}var o={_:[]};function s(e){this.value=e}var n=t.reduce(function(e,t){var r=typeof t==="string"?t:"";if(r.match(/^--?[^-]/)&&e instanceof s){o[e.value]=true}if(r.match(/^--[^-]/)){var n=r.replace(/^--/,"");if(u.boolean.indexOf(n)===-1){return new s(n)}else{o[n]=true}}else if(r.match(/^-[^-]/)){var i=r.replace(/^-/,"").split("");if(u.boolean.indexOf(i.slice(-1)[0])===-1){var a=i.pop()}i.forEach(function(e){o[e]=true});if(a){return new s(a)}}else if(e instanceof s){o[e.value]=t}else if(t){o._.push(t)}return null},null);if(n instanceof s){o[n.value]=true}return o},parse_formatting:function(e){var t=$.terminal.unescape_brackets(e).split(";");var r=4;if(t.length>=5){var n=$.terminal.escape_brackets(t[r]);t[r]=n}return t},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 r(e){if($.terminal.is_formatting(e)){if(e.match(/\]\\\]/)){e=e.replace(/\]\\\]/g,"]\\\\]")}}return e}if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){var n=$.terminal.length(t);var i=0;var e={};e[Symbol.iterator]=function(){return{next:function(){if(i<n){var e=$.terminal.substring(t,i,i+1);i++;return{value:r(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){}},process_formatting:function(e){return $.terminal.format_split(e).map(function(e){if($.terminal.is_formatting(e)){var t=e.match(new RegExp(format_parts_re,"i"));var r=t.pop();for(var n=1;n<=2;++n){if(!$.terminal.valid_color(t[n])){t[n]=""}}return t.slice(1,4).concat(r)}else{return["","","",e]}})},new_formatter:function(e){$.terminal.defaults.formatters.unshift(e)},remove_formatter:function(t){remove($.terminal.defaults.formatters,function(e){return e===t})}};(function(){function w(e,t){if(e===""){return t}else{return e.replace(/&#93;/g,"]").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}}function s(e){return e.match(/^\.{1,2}\//)||e.match(/^\//)||!(e.match(/\//)||e.match(/^[^:]+:/))}function l(r,n){return function(e){if(n.anyLinks){return true}var t=r(e);if(!t){warn("Invalid URL "+e+" only http(s) ftp and path "+"are allowed")}return t}}$.terminal.format=function i(e,t){var g=$.extend({},{linksNoReferrer:false,linksNoFollow:false,allowedAttributes:[],charWidth:undefined,escape:true,anyLinks:false},t||{});var a=l(function(e){return e.match(/^((https?|file|ftp):\/\/|\.{0,2}\/)/)||s(e)},g);var n=l(function(e){return e.match(/^(https?:|file:|blob:|data:)/)||s(e)},g);function _(e){if(e.length&&g.allowedAttributes.length){return e.filter(function(e){if(e==="data-text"){return false}var t=false;var r=g.allowedAttributes;for(var n=0;n<r.length;++n){if(r[n]instanceof RegExp){if(r[n].test(e)){t=true;break}}else if(r[n]===e){t=true;break}}return t})}return[]}function y(r,n,e){if(n){if(e.length){var i;var t=e.map(function(e){if(n[e]===null){return""}if(n[e]===true){return e}var t=escape_html_attr(n[e]);if(e==="style"){if(r){t=t?r+";"+t:r}i=true}return e+'="'+t+'"'}).filter(Boolean);if(!t.length){return""}if(!i&&r){t.push('style="'+r+'"')}return t.join(" ")}}if(!r){return""}return'style="'+r+'"'}function r(){var e=["noopener"];if(g.linksNoReferrer){e.unshift("noreferrer")}if(g.linksNoFollow){e.unshift("nofollow")}return e}var u=r().join(" ");function b(e,t,r){if(e.match(email_re)){return'<a href="mailto:'+e+'"'}else{var n=["<a"];if(e&&a(e)){n.push('href="'+e+'"')}if(t){if(r.includes("target")&&t.target===undefined){t.target="_blank"}if(r.includes("rel")&&t.rel===undefined){t.rel=u}}else{n.push('rel="'+u+'"');n.push('target="_blank"')}return n.join(" ")}}function C(e,t){var r="<img";if(n(e)){r+=' src="'+e+'"';if(t){r+=' alt="'+t+'"'}}return r}function F(e){var t=0;var r=false;while(t<e.length){if(e[t]==="&"){r=true}else if(e[t]===";"&&!r){return t}else if(e[t]===";"){r=false}t++}return-1}function i(e,t,r,n,i,a,u){var o;var s=[];if(a.match(/;/)){try{var l=F(a);if(l!==-1){var f=a.substring(l+1);f=f.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">");if(f.match(/^\s*\{[^}]*\}\s*$/)){o=JSON.parse(f);s=_(Object.keys(o));a=a.substring(0,l)}}}catch(e){}}if(u===""&&!t.match(/@/)){return""}u=safe(u);u=u.replace(/\\\]/g,"&#93;");if(g.escape){u=u.replace(/\\\\/g,"\\")}var c={};if(t.indexOf("b")!==-1){c["font-weight"]="bold"}var p=[];if(t.indexOf("u")!==-1){p.push("underline")}if(t.indexOf("s")!==-1){p.push("line-through")}if(t.indexOf("o")!==-1){p.push("overline")}if(p.length){c["text-decoration"]=p.join(" ")}if(t.indexOf("i")!==-1){c["font-style"]="italic"}if(t.indexOf("r")!==-1){if(i.trim()){i+=" "+"terminal-inverted"}else{i="terminal-inverted"}}if($.terminal.valid_color(r)){$.extend(c,{color:r,"--color":r,"--original-color":r});if(t.indexOf("!")!==-1){c["--link-color"]=r}if(t.indexOf("g")!==-1){c["text-shadow"]="0 0 5px "+r}}if($.terminal.valid_color(n)){$.extend(c,{"background-color":n,"--background":n})}var m=w(a,u);var D=extra_css(u,g);if(D){u=wide_characters(u,g);$.extend(c,D)}var d;var h=style_to_string(c);if(t.indexOf("!")!==-1){d=b(m,o,s)}else if(t.indexOf("@")!==-1){d=C(m,u)}else{d="<span"}var v=y(h,o,s);if(v){d+=" "+v}if(i!==""){d+=' class="'+i+'"'}if(t.indexOf("!")!==-1){d+=" data-text>"+u+"</a>"}else if(t.indexOf("@")!==-1){d+=" data-text/>"}else{d+=' data-text="'+m+'">'+"<span>"+u+"</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=w(e);var r=extra_css(e,g);var n;if(r){e=wide_characters(e,g);n='<span style="'+style_to_string(r)+'"'}else{n="<span"}return n+' data-text="'+t+'">'+e+"</span>"}}).join("");return e.replace(/<span><br\s*\/?><\/span>/gi,"<br/>")}else{return""}}})();$.terminal.Exception=function e(t,r,n){if(arguments.length===1){this.message=arguments[0];this.type="TERMINAL"}else{this.type=t;this.message=r;if(n){this.stack=n}}};$.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,r,n,i){var o=new $.Deferred;var s;if($.isPlainObject(e)){s=e}else{s={url:e,method:t,params:r,success:n,error:i}}function a(e){return typeof e.id==="number"&&(typeof e.result!=="undefined"||typeof e.error!=="undefined")}ids[s.url]=ids[s.url]||0;var l={jsonrpc:"2.0",method:s.method,params:s.params,id:++ids[s.url]};function f(e,t,r,n){if(a(e)||s.method==="system.describe"){if(s.success){s.success(e,r,n)}o.resolve(e)}else{if(s.error){s.error(n,"Invalid JSON-RPC")}o.reject({message:"Invalid JSON-RPC",response:t})}}$.ajax({url:s.url,beforeSend:function e(t,r){if(is_function(s.request)){s.request(t,l)}r.data=JSON.stringify(l)},success:function e(t,r,n){var i=n.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(s.error){s.error(n,"Invalid JSON",e)}else{throw new $.terminal.Exception("JSON","Invalid JSON",e.stack)}o.reject({message:"Invalid JSON",response:t});return}if(is_function(s.response)){s.response(n,a)}if(is_function(s.intercept)){var u=s.intercept(l,a);if(u){return unpromise(u,function(e){var t=JSON.stringify(e);f(e,t,r,n)})}}f(a,t,r,n)},error:s.error,contentType:"application/json",dataType:"text",async:true,cache:false,type:"POST"});return o.promise()};$.rpc=function(e,t,r){var n=new $.Deferred;function i(e){if(e.error){n.reject(e.error)}else{n.resolve(e.result)}}function a(e,t,r){n.reject({message:r})}$.jrpc(e,t,r,i,a);return n.promise()};function terminal_ready(e){return!!(e.closest("body").length&&e.is(":visible")&&e.find(".cmd-prompt").length)}function format_stack_trace(e){e=$.terminal.escape_brackets(e);return e.split(/\n/g).map(function(e){return"[[;;;terminal-error]"+e.replace(url_re,function(e){return"]"+e+"[[;;;terminal-error]"})+"]"}).join("\n")}function get_char_size(e){var t;if(terminal_ready(e)){var r=e.find(".cmd-prompt").clone().css({visiblity:"hidden",position:"absolute"});r.appendTo(e.find(".cmd")).html("&nbsp;").wrap('<div class="cmd-wrapper"/>');t={width:r.width(),height:r.height()};r.parent().remove()}else{var n=$('<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 class="terminal-pixel"></div></div>').appendTo("body");n.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(";");n.attr("style",i)}}var a=n.find(".terminal-line");t={width:a.width(),height:a.height()};n.remove()}return t}function aproximation(e){if(e-Math.floor(e)>.9){return Math.ceil(e)}return Math.floor(e)}function get_num_chars(e,t){var r=e.find(".terminal-fill").width();var n=Math.floor(r/t.width);return n||1e3}function get_num_rows(e,t){var r=e.find(".terminal-fill");var n=r.height();return aproximation(n/t.height)}function all(e,t){var r=e.filter(function(e){return e[t]()===e});return r.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_string(e){return get_type(e)==="string"}function is_object(e){return e&&typeof e==="object"}function is_promise(e){return is_object(e)&&is_function(e.then||e.done)}function is_big_int(e){return typeof e==="bigint"}function is_deferred(e){return is_promise(e)&&is_function(e.promise)}if(!Array.isArray){Array.isArray=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}function is_array(e){return Array.isArray(e)}function have_custom_font(e){var t=$(e).css("--font");if(!t){return false}var r=Array.from(document.fonts.keys());var n=r.find(function(e){return e.family===t});return!!n}function get_type(e){if(typeof e==="function"){return"function"}if(e===null){return e+""}if(Array.isArray(e)){return"array"}if(e instanceof String){return"string"}if(typeof e==="object"){return"object"}return typeof e}var version_set=!$.terminal.version.match(/^\{\{/);var copyright="Copyright (c) 2011-2024 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-2024 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__=true;$.terminal.nested_formatting.__no_warn__=true;$.terminal.defaults={prompt:"> ",history:true,exit:true,clear:true,enabled:true,maskChar:"*",wrap:true,checkArity:true,raw:false,tabindex:1,invokeMethods:false,exceptionHandler:null,pauseEvents:true,softPause:false,mousewheel:null,touchscroll:null,memory:false,cancelableAjax:true,processArguments:true,execAnimation:false,execAnimationDelay:100,execHistory:false,linksNoReferrer:false,externalPause:true,useCache:true,anyLinks:false,linksNoFollow:false,processRPCResponse:null,completionEscape:true,mobileDelete:is_mobile,convertLinks:true,errorOnAbort: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],unixFormatting:{escapeBrackets:false,ansiParser:{},ansiArt:false},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,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,onCommandChange:null,onPositionChange:null,allowedAttributes:["title","target","rel",/^aria-/,"id",/^data-/],strings:{comletionParameters:"From version 1.0.0 completion function need to"+" have two arguments",wrongPasswordTryAgain:"Wrong username or password try again!",wrongPassword:"Wrong username or 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",invalidMask:"Invalid mask used only string or boolean allowed",defunctTerminal:"You can't call method on terminal that was destroyed",abortError:"Abort with CTRL+D",timeoutError:"Signal timed out"}};var requests=[];var abort_controllers=[];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 r(r){if(r){this.storage={}}this.set=function(e,t){if(r){this.storage[e]=t}else{$.Storage.set(e,t)}};this.get=function(e){if(r){return this.storage[e]}else{return $.Storage.get(e)}};this.remove=function(e){if(r){delete this.storage[e]}else{$.Storage.remove(e)}}}function c(e){if($.terminal.unclosed_strings(e)){var t=$.terminal.escape_brackets(e);var r=sprintf(m().invalidStrings,"`"+t+"`");throw new $.terminal.Exception(r)}else if(is_function(B.processArguments)){return process_command(e,B.processArguments)}else if(B.processArguments){return $.terminal.parse_command(e)}else{return $.terminal.split_command(e)}}var u=false;function M(e,n){n=n||{};if($.terminal.Animation&&e instanceof $.terminal.Animation){e.start(x);return false}if(is_function(B.renderHandler)){if(u){return e}return unpromise(e,function(e){try{u=true;var t=B.renderHandler.call(x,e,n,x);if(t===false){return false}var r=is_promise(t);if(r){return always(t,function(){u=false})}if(typeof t==="string"||q(t)){return t}else{return e}}catch(e){return["[[;red;]"+e.message+"]",format_stack_trace(e.stack)].join("\n")}finally{if(!r){u=false}}})}return e}function o(t,r){if(q(t)){var e=$.extend({},r,{raw:true,finalize:function(e){e.find(".terminal-render-item").replaceWith(t);if(r&&is_function(r.finalize)){r.finalize(e,x)}}});return['<div class="terminal-render-item"/>',e]}}function H(e,t){var r=o(e,t);if(r){x.echo.apply(x,r);return true}}function W(e){return k.find("[data-index="+e+"]")}function q(e){return e instanceof $.fn.init||e instanceof Element}function U(e){e=M(e);if(e===false){return}if(H(e)){return}if(is_string(e)){x.echo(e)}else if(is_array(e)){x.echo($.map(e,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof e==="object"){x.echo(JSON.stringify(e))}else{x.echo(e)}}function K(e,u){var t=/(.*):([0-9]+):([0-9]+)$/;var o=e.match(t);if(o){x.pause(B.softPause);$.get(o[1],function(e){var t=o[1];var r=e.split("\n");var i=+o[2]-1;var n=i>2?i-2:0;var a=r.slice(n,i+3).map(function(e,t){var r="["+(i+t-1)+"]: ";var n=u-r.length-4;if(e.length>n){e=e.substring(0,n)+"..."}if(i>2?t===2:t===i){e="[[;#f00;]"+$.terminal.escape_brackets(e)+"]"}return r+e}).filter(Boolean).join("\n");if(a.length){x.echo("[[b;white;]"+t+"]");x.echo(a).resume()}},"text")}}function J(e){if(is_function(B.onRPCError)){B.onRPCError.call(x,e)}else{x.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}x.error(t)}}}function Q(r,n){var i;if(B.rpc){i=function(){return B.rpc.apply(x,arguments)}}var a=function(e,t){x.pause(B.softPause);$.jrpc({url:r,method:e,params:t,request:function(e,t){try{B.request.call(x,e,t,x)}catch(e){d(e,"USER")}},intercept:i,response:function(e,t){try{B.response.call(x,e,t,x)}catch(e){d(e,"USER")}},success:function e(t){if(t.error){J(t.error)}else if(is_function(B.processRPCResponse)){B.processRPCResponse.call(x,t.result,x)}else if(t.result!==null){U(t.result)}x.resume()},error:Y})};return function(e,t){if(e===""){return}try{e=c(e)}catch(e){d(e,"TERMINAL (get_processed_command)");return}if(!n||e.name==="help"){a(e.name,e.args)}else{var r=t.token(true);if(r){a(e.name,[r].concat(e.args))}else{t.error("&#91;AUTH&#93; "+m().noTokenError)}}}}function V(u,o,s,l){return function(e,t){if(e===""){return}var r;try{r=c(e)}catch(e){if(is_function(B.exception)){B.exception(e,x)}else{x.error("Error: "+(e.message||e))}return}var n=u[r.name];var i=get_type(n);if(i==="function"){if(o&&n.length!==r.args.length){x.error("&#91;Arity&#93; "+sprintf(m().wrongArity,r.name,n.length,r.args.length))}else{return n.apply(x,r.args)}}else if(i==="object"||i==="string"){var a=[];if(i==="object"){a=Object.keys(n);n=V(n,o,s)}t.push(n,{prompt:r.name+"> ",name:r.name,completion:i==="object"?a:undefined})}else if(is_function(l)){l(e,x)}else if(is_function(B.onCommandNotFound)){B.onCommandNotFound.call(x,e,x)}else{t.error(sprintf(m().commandNotFound,r.name))}}}function Y(e,t,r){x.resume();if(is_function(B.onAjaxError)){B.onAjaxError.call(x,e,t,r)}else if(t!=="abort"){x.error("&#91;AJAX&#93; "+t+" - "+m().serverResponse+":\n"+$.terminal.escape_brackets(e.responseText))}}function G(a,o,n){function s(e){if(e.error){J(e.error)}else if(is_function(B.processRPCResponse)){B.processRPCResponse.call(x,e.result,x)}else{U(e.result)}x.resume()}function l(e,t){try{B.request.call(x,e,t,x)}catch(e){d(e,"USER")}}function f(e,t){try{B.response.call(x,e,t,x)}catch(e){d(e,"USER")}}function e(e){var r=e;if(B.describe!==false&&B.describe!==""){B.describe.split(".").forEach(function(e){r=r[e]})}if(r&&r.length){var t={};$.each(r,function(e,i){if($.isPlainObject(i)&&typeof i.name==="string"){t[i.name]=function(){var e=o&&i.name!=="help";var t=Array.prototype.slice.call(arguments);var r=t.length+(e?1:0);if(B.checkArity&&i.params&&i.params.length!==r){x.error("&#91;Arity&#93; "+sprintf(m().wrongArity,i.name,i.params.length,r))}else{x.pause(B.softPause);if(e){var n=x.token(true);if(n){t=[n].concat(t)}else{x.error("&#91;AUTH&#93; "+m().noTokenError)}}$.jrpc({url:a,method:i.name,params:t,request:l,response:f,success:s,error:Y})}}}});var u=typeof o==="string"?o:"login";t.help=t.help||function(i){if(typeof i==="undefined"){var e=r.map(function(e){return e.name}).join(", ")+", help";x.echo("Available commands: "+e)}else{var a=false;$.each(r,function(e,t){if(t.name===i){a=true;var r="";r+="[[bu;;]"+t.name+"]";if(t.params){var n=t.params;if(o&&t.name!==u){n=n.slice(1)}r+=" "+n.join(" ")}if(t.help){r+="\n"+t.help}x.echo(r);return false}});if(!a){if(i==="help"){x.echo("[[bu;;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var t="Method `"+i+"' not found ";x.error(t)}}}};n(t)}else{n(null)}}return $.jrpc({url:a,method:"system.describe",params:[],success:e,request:l,response:f,error:function e(){n(null)}})}function X(t,u,r){r=r||$.noop;var e=get_type(t);var o;var n={};var s=0;var l;if(e==="array"){o={};(function t(e,r){if(e.length){var n=e[0];var i=e.slice(1);var a=get_type(n);if(a==="string"){if(B.describe===false){if(++s===1){l=Q(n,u)}else{x.error(m().oneRPCWithIgnore)}t(i,r)}else{x.pause(B.softPause);G(n,u,function(e){if(e){$.extend(o,e)}else if(++s===1){l=Q(n,u)}else{x.error(m().oneRPCWithIgnore)}x.resume();t(i,r)})}}else if(a==="function"){if(l){x.error(m().oneInterpreterFunction)}else{l=n}t(i,r)}else if(a==="object"){$.extend(o,n);t(i,r)}}else{r()}})(t,function(){r({interpreter:V(o,false,u,l&&l.bind(x)),completion:Object.keys(o)})})}else if(e==="string"){if(B.describe===false){o={interpreter:Q(t,u)};if(Array.isArray(B.completion)){o.completion=B.completion}r(o)}else{x.pause(B.softPause);G(t,u,function(e){if(e){n.interpreter=V(e,false,u);n.completion=Object.keys(e)}else{n.interpreter=Q(t,u)}r(n);x.resume()})}}else if(e==="object"){r({interpreter:V(t,B.checkArity,u),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)}r({interpreter:t,completion:B.completion})}}function Z(n,e){var i=get_type(e)==="boolean"?"login":e;return function(e,t,r){x.pause(B.softPause);$.jrpc({url:n,method:i,params:[e,t],request:function(e,t){try{B.request.call(x,e,t,x)}catch(e){d(e,"USER")}},response:function(e,t){try{B.response.call(x,e,t,x)}catch(e){d(e,"USER")}},success:function e(t){if(!t.error&&t.result){r(t.result)}else{r(null)}x.resume()},error:Y})}}function d(e,t,r){if(is_function(B.exceptionHandler)){B.exceptionHandler.call(x,e,t)}else{x.exception(e,t);if(!r){setTimeout(function(){throw e},0)}}}function ee(e){function t(e,r,n,i,a,u,t){function o(e,t){return"[["+[r+(e||""),n,i,a,t||u].join(";")+"]"}function s(e){return"]"+o("!",e)+e+"]"+o()}if(!r.match(/!/)){var l=t.match(email_full_re)||t.match(url_full_re);if(l){return o("!",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 o("",u)+f+"]"}}return e}function r(e){return e.replace(email_re,"[[!;;]$1]").replace(url_nf_re,"[[!;;]$1]")}if(!$.terminal.have_formatting(e)){return r(e)}return $.terminal.format_split(e).map(function(e){if($.terminal.is_formatting(e)){return e.replace(format_parts_re,t)}else{return r(e)}}).join("")}function te(e,t){return(strlen(text(e))>t.cols||e.match(/\n/))&&(B.wrap===true&&t.wrap===undefined||B.wrap===false&&t.wrap===true)}var p;if("Map"in root){p=new Map}function re(e,r,n){if(n.exec||r.options.clear_exec){return $.terminal.each_extended_command(e,function(e){if(n.exec){r.options.exec=false;r.options.clear_exec=true;var t=e.trim();if(_&&_===t){_="";x.error(m().recursiveLoop)}else{_=t;$.terminal.extended_command(x,e,{invokeMethods:n.invokeMethods}).then(function(){_=""})}}})}return e}function ne(t){try{var e=!is_function(t.value);var r=$.extend({exec:true,raw:false,finalize:$.noop,useCache:e,invokeMethods:false,formatters:true,convertLinks:B.convertLinks},t.options||{});var n=yt(t.value);if(n&&is_function(n.then)){return n.then(function(e){ne($.extend(t,{value:e,options:r}))})}if(n!==""){if(!r.raw){if(B.useCache&&r.useCache){var i=n;if(p&&p.has(i)){var a=p.get(i);b.append(a.input,t.index,r,a.raw);return true}}if(r.formatters){try{n=$.terminal.apply_formatters(n,$.extend(B,{echo:true}))}catch(e){d(e,"FORMATTING")}}n=re(n,t,r);if(n===""){return}if(r.convertLinks){n=ee(n)}var u=n;n=crlf($.terminal.normalize(n));n=$.terminal.encode(n,{tabs:B.tabs});var o;var s;var l=r.cols=x.cols();if(te(n,r)){o=$.terminal.split_equal(n,l,{keepWords:r.keepWords,trim:true});s=$.terminal.split_equal(u,l,{keepWords:r.keepWords,trim:true})}else if(n.match(/\n/)){o=n.split(/\n/);s=n.split(/\n/)}}}else{u=""}var f=o||n;var c=s||u;if(p&&i&&e){p.set(i,{input:f,raw:c})}b.append(f,t.index,r,c)}catch(e){b.clear();if(is_function(B.exceptionHandler)){B.exceptionHandler.call(x,e,"TERMINAL")}else{alert_exception("[Internal Exception(process_line)]",e)}}return true}function i(e){e=$.extend({},{update:false,scroll:true},e||{});if(!e.update){S.resize(a);var t=k.empty().detach()}try{b.clear();unpromise(C.render(x.rows(),function(e){return e.map(ne)}),function(){x.flush(e);if(!e.update){S.before(t)}v("onAfterRedraw")})}catch(e){if(is_function(B.exceptionHandler)){B.exceptionHandler.call(x,e,"TERMINAL (redraw)")}else{alert_exception("[redraw]",e)}}}function ie(){if(B.outputLimit>=0){var e;if(B.outputLimit===0){e=x.rows()}else{e=B.outputLimit}var t=k.find("> div > div");if(t.length+1>e){var r=t.length-e+1;var n=t.slice(0,r);var i=n.parent();n.remove();i.each(function(){var e=$(this);if(e.is(":empty")){C.unmount(e);e.remove()}});C.limit_snapshot(r)}}}function ae(){if(B.greetings===undefined){x.echo(x.signature,{finalize:a11y_hide,formatters:false})}else if(B.greetings){if(is_string(B.greetings)){x.echo(B.greetings)}else if(is_function(B.greetings)){x.echo(function(){try{var e=new $.Deferred;var t=B.greetings.call(x,e.resolve);if(t){e.resolve(t)}return e.promise()}catch(e){B.greetings=null;d(e,"greetings")}})}else{x.error(m().wrongGreetings)}}}function ue(e){var t=S.mask();switch(typeof t){case"string":return e.replace(/./g,t);case"boolean":if(t){return e.replace(/./g,B.maskChar)}else{return $.terminal.escape_formatting(e)}}throw new $.terminal.Exception(m().invalidMask)}function h(r){if(typeof r==="undefined"){r=x.get_command()}var e=S.prompt(true);r=ue(r);var t={exec:false,formatters:false,convertLinks:false,finalize:function e(t){a11y_hide(t.addClass("terminal-command"));v("onEchoCommand",[t,r])}};r=$.terminal.apply_formatters(r,{command:true});x.echo(e+r,t)}function oe(){return L.outerWidth()!==x.outerWidth()}function se(e){var t=terminals.get()[e[0]];if(!t){throw new $.terminal.Exception(m().invalidTerminalId)}var r=e[1];if(save_state[r]){t.import_view(save_state[r])}else{change_hash=false;var n=e[2];if(n){t.exec(n).done(function(){change_hash=true;save_state[r]=t.export_view()})}}}var le=["AbortError","TimeoutError"];function fe(t){return function(e){if(le.includes(e.name)&&!B.errorOnAbort){return}x.error("["+t+"] "+(e.message||e)).resume()}}function ce(){if(change_hash){fire_hash_change=false;location.hash="#"+JSON.stringify(hash_commands);setTimeout(function(){fire_hash_change=true},100)}}var pe=true;var me=[];function De(t,e,r){function n(){if(B.historyState||B.execHash&&r){if(!save_state.length){x.save_state()}else{x.save_state(null)}}}function i(){if(!r){change_hash=true;if(B.historyState){x.save_state(t,false)}change_hash=m}}function a(){p.resolve();v("onAfterCommand",[t])}function u(e,t){if(typeof e!=="undefined"){U(e)}a();if(t){x.resume()}}function o(e){return is_function(e.done||e.then)&&A}var s=fe("Command");function l(e){s(e);abort_controllers=[]}function f(){var e=c.interpreter.call(x,t,x);i();if(e){if(!Qe){if(o(e)){E=true}else if(is_promise(e)){x.pause(B.softPause)}}Qe=false;if(is_function(e.done||e.then)){return unpromise(e,function(e){u(e,true);abort_controllers=[]},l)}else{return $.when(e).done(u).catch(l)}}else{if(r){S.refresh()}if(E){me.push(function(){a()})}else{a()}if(r){return p.promise()}}}if(pe){pe=false;n()}try{if(v("onBeforeCommand",[t])===false){return}if(r){_=t.trim();g=$.terminal.split_command(_)}else{g=$.terminal.split_command(t)}if(!we()){if(r&&(is_function(B.historyFilter)&&B.historyFilter(t)||t.match(B.historyFilter))){S.history().append(t)}}var c=T.top();if(!e&&B.echoCommand){h(t)}var p=new $.Deferred;var m=change_hash;if(t.match(/^\s*login\s*$/)&&x.token(true)){i();if(x.level()>1){x.logout(true)}else{x.logout()}a()}else if(B.exit&&t.match(/^\s*exit\s*$/)&&!y){i();var D=x.level();if(D===1&&x.get_token()||D>1){if(x.get_token(true)){x.set_token(undefined,true)}x.pop()}a()}else if(B.clear&&t.match(/^\s*clear\s*$/)&&!y){i();x.clear();a()}else{return f()}return p.promise()}catch(e){d(e,"USER",r);x.resume();if(r){throw e}}}function de(){if(v("onBeforeLogout",[],true)===false){return}he();v("onAfterlogout",[],true);x.login(P,true,Ce)}function he(){var e=x.prefix_name(true)+"_";n.remove(e+"token");n.remove(e+"login")}function ve(e){var t=x.prefix_name()+"_interpreters";var r=n.get(t);if(r){r=JSON.parse(r)}else{r=[]}if($.inArray(e,r)===-1){r.push(e);n.set(t,JSON.stringify(r))}}function s(e){var t=T.top();var r=x.prefix_name(true);if(!we()){ve(r)}var n=x.login_name(true);S.name(r+(n?"_"+n:""));var i=t.prompt;if(is_function(i)){i=bt(i)}var a=is_function(t.prompt);if(a||i!==S.prompt()){if(a){S.prompt("")}S.prompt(t.prompt)}if(typeof t.history!=="undefined"){x.history().toggle(t.history)}if($.isPlainObject(t.keymap)){S.keymap(null).keymap($.extend({},N,$.omap(t.keymap,function(e,t){return function(){var e=[].slice.call(arguments);try{return t.apply(x,e)}catch(e){d(e,"USER KEYMAP")}}})))}S.set("");if(!e&&is_function(t.onStart)){t.onStart.call(x,x)}}function v(t,e,r){e=(e||[]).concat([x]);var n=T&&T.top();if(n&&is_function(n[t])&&!r){try{return n[t].apply(x,e)}catch(e){delete n[t];d(e,t)}}else if(is_function(B[t])){try{return B[t].apply(x,e)}catch(e){B[t]=null;d(e,t)}}}var ge=function(){function e(e){if(!e){try{x.scroll_to(x.find(".cmd-cursor-line"));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 _e(){var e=x.find(".cmd-cursor-line");return e.is_fully_in_viewport(x).then(ge)}function ye(e){if(typeof history!=="undefined"&&history.replaceState){var t="#"+JSON.stringify(e);var r=location.href.replace(/#.*$/,t);history.replaceState(null,"",r)}}function be(){if(fire_hash_change&&B.execHash){try{if(location.hash){var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e))}else{hash_commands=[]}if(hash_commands.length){se(hash_commands[hash_commands.length-1])}else if(save_state[0]){x.import_view(save_state[0])}}catch(e){d(e,"TERMINAL")}}}function Ce(){s();et.resolve();ae()}function Fe(){if(C.length){if(qe.length){$.when.apply($,qe)}}function t(){nt=$.noop;if(!e&&x.enabled()){x.resume(true)}}var e=false;if(is_function(B.onInit)){nt=function(){e=true};var r;try{r=B.onInit.call(x,x)}catch(e){d(e,"OnInit")}finally{if(!is_promise(r)){t()}else{r.then(t).catch(function(e){d(e,"OnInit");t()})}}}if(first_instance){first_instance=false;$(window).on("hashchange",be)}}function we(){return y||S.mask()!==false}function Ee(e){var t,r=T.top();if(is_function(r.keydown)){t=r.keydown.call(x,e,x);if(t!==undefined){return t}}else if(is_function(B.keydown)){t=B.keydown.call(x,e,x);if(t!==undefined){return t}}}var xe={"CTRL+D":function(e,t){if(!y){if(S.get()===""){if(T.size()>1||is_function(P)){x.pop("")}else{x.resume()}}else{t()}}return false},"CTRL+C":function(){with_selection(function(e){if(e===""){var t=x.get_command();var r=x.get_position();t=t.slice(0,r)+"^C"+t.slice(r+2);h(t);x.set_command("")}else{var n=x.find("textarea");text_to_clipboard(n,process_selected_html(e))}});return false},"CTRL+L":function(){x.clear();return false},TAB:function(e,t){var r=T.top(),n,i;if(typeof r.caseSensitiveAutocomplete!=="undefined"){i=r.caseSensitiveAutocomplete}else{i=B.caseSensitiveAutocomplete}if(B.completion&&get_type(B.completion)!=="boolean"&&r.completion===undefined){n=B.completion}else{n=r.completion}if(n==="settings"){n=B.completion}function a(e){e=e.slice();if(!x.before_cursor(false).match(/\s/)){if(B.clear&&$.inArray("clear",e)===-1){e.push("clear")}if(B.exit&&$.inArray("exit",e)===-1){e.push("exit")}}x.complete(e,{echo:true,word:B.wordAutocomplete,escape:B.completionEscape,caseSensitive:i,echoCommand:B.doubleTabEchoCommand,doubleTab:B.doubleTab})}if(n){switch(get_type(n)){case"function":var u=x.before_cursor(B.wordAutocomplete);if(n.length===3){var o=new Error(m().comletionParameters);d(o,"USER");return false}var s=n.call(x,u,a);unpromise(s,a,fe("Completion"));break;case"array":a(n);break;default:throw new $.terminal.Exception(m().invalidCompletion)}}else{t()}return false},"CTRL+V":function(e,t){t(e);x.oneTime(200,function(){x.scroll_to_bottom()});return true},"CTRL+TAB":function(){if(terminals.length()>1){x.focus(false);return false}},PAGEDOWN:function(){x.scroll(x.height())},PAGEUP:function(){x.scroll(-x.height())}};function $e(t){var e,r;if(A){return false}if(x.enabled()){if(!x.paused()){e=Ee(t);if(e!==undefined){return e}if(t.which!==9){Ke=0}}else{if(!B.pauseEvents){e=Ee(t);if(e!==undefined){return e}}if(t.which===68&&t.ctrlKey){if(B.pauseEvents){e=Ee(t);if(e!==undefined){return e}}x.abort();if(requests.length){for(r=requests.length;r--;){var n=requests[r];if(n.readyState!==4){try{n.abort()}catch(e){if(is_function(B.exceptionHandler)){B.exceptionHandler.call(x,t,"AJAX ABORT")}else{x.error(m().ajaxAbortError)}}}}requests=[]}x.resume()}return false}}}function ke(e){var t=T.top();if(F&&(!E||!B.pauseEvents)){if(is_function(t.keypress)){return t.keypress.call(x,e,x)}else if(is_function(B.keypress)){return B.keypress.call(x,e,x)}}}function Ae(w,E){return function e(f,c){var p=$.terminal.apply_formatters(f,{animation:true});p=$.terminal.normalize(p);var t=false;if(c&&typeof c.keepWords!=="undefined"){t=c.keepWords}if(E){var r=$.terminal.split_equal(p,x.cols(),{keepWords:t})}var m=A;A=true;var D=x.get_prompt();var d=0;var h=$.terminal.length(p);if(h>0){var v="";if(c.prompt){v=$.terminal.apply_formatters(c.prompt,{prompt:true})}else{x.set_prompt("")}var g=x.is_bottom();var _=0;if(E){var y=r.map(function(e){return{formatted:e,chars:$.terminal.partition(e,{wrap:false}),len:$.terminal.length(e)}})}else{var b=$.terminal.partition(p,{wrap:false})}var C;var F=setInterval(function(){var e,t,r;if(!Ze){if(E){e=y[_].formatted;t=y[_].chars;r=y[_].len}else{e=p;t=b;r=h}if(r===0){S.prompt("")}else{var n=t[d];if(c.mask){var i=S.mask();if(typeof i==="string"){n=i}else if(i){n=B.maskChar}}v+=n;S.prompt(v,{formatters:false});if(g&&(n==="\n"||!x.is_bottom())){x.scroll_to_bottom()}d++}if(d===r&&E){var a=x.last_index();if(_===y.length-1){x.set_prompt(D)}else{x.set_prompt("")}var u=!!k.find(".partial").length;x.echo(e,$.extend({},c,{formatters:false,finalize:null,typing:false}));y[_].index=a+1;v="";++_;d=0}}else{x.skip_stop();var o=$.terminal.substring(p,d,h);v+=o;S.prompt(v,{formatters:false});C=true}if(!C){if(E){C=_===y.length}else{C=d===h}}if(C){clearInterval(F);if(u||c.newline===false){var s=x.last_index();var l=k.find('[data-index="'+s+'"]');c.finalize(l)}else{if(E){y.forEach(function(e){if(typeof e.index!=="undefined"){x.remove_line(e.index)}})}w(f,D,c)}if(!m){A=false}}},c.delay)}}}var Be=Ae(function(e,t,r){x.set_prompt(e);r.finalize()},true);var Te=function(){var n=Ae(function(e,t,r){x.set_prompt(t);x.insert(e);r.finalize()});return function(e,t,r){return n(t,$.extend({},r,{prompt:e+x.get_command()}))}}();var Se=Ae(function(e,t,r){x.set_prompt(t);x.echo(e,$.extend({},r,{typing:false}))},true);var Re=function(){var n=Ae(function(n,e,i){x.set_prompt(e);with_prompt(e,function(e){var t=ue(n);e=$.terminal.apply_formatters(e,{prompt:true});t=$.terminal.apply_formatters(t,{command:true});var r=e+t;i=$.extend({},i,{typing:false,formatters:false,convertLinks:false});x.echo(r,i)},x)});return function(e,t,r){return n(t,$.extend({},r,{prompt:e,mask:true}))}}();function je(u,o,s){return function e(n,i){var a=new $.Deferred;f(function e(){var t=$.extend({typing:false,delay:B.execAnimationDelay},i);if(t.typing){if(typeof n!=="string"){return a.reject(u+": Typing animation require string")}if(typeof t.delay!=="number"||isNaN(t.delay)){return a.reject(u+": Invalid argument, delay need to"+" be a number")}var r=x.typing(u,t.delay,n,t);r.then(function(){a.resolve()})}else{o(n,t)}if(is_function(s)){s(n,t)}});if(i&&i.typing){return a.promise()}return x}}function Oe(e,t,r){var n=v("onBeforeLogin",[e,t]);return unpromise(defined(n),r,"validate_login")}function Le(a,u,o,s){if(B.history){S.history().disable()}var e=x.level();t();function l(){while(x.level()>e){x.pop(undefined,true)}if(B.history){S.history().enable()}}function f(e,t){var r=x.prefix_name(true)+"_";n.set(r+"token",t);n.set(r+"login",e)}function t(){var e=x.prefix_name(true)+"_";n.remove(e+"token");n.remove(e+"login")}function c(r,n,i){D(function e(){var t;if(n){l();f(r,n);y=false;v("onAfterLogin",[r,n]);t=o}else{if(u){if(!i){x.error(m().wrongPasswordTryAgain)}x.pop(undefined,true).set_mask(false)}else{y=false;if(!i){x.error(m().wrongPassword)}x.pop(undefined,true).pop(undefined,true)}t=s}if(x.paused()){x.resume()}if(is_function(t)){t()}x.off("terminal.autologin")})}x.on("terminal.autologin",function(e,t,r,n){Oe(t,r,function(e){if(e!==false){c(t,r,n)}})});x.push(function(i){x.set_mask(B.maskChar).push(function(n){try{Oe(i,n,function(e){if(e===false){l();return}x.pause();try{var t=[i,n,function(e,t){c(i,e,t)}];var r=a.apply(x,t);unpromise(r,function(e){c(i,e)},function(e){x.pop(undefined,true).pop(undefined,true);x.error(e.message);if(is_function(s)){s()}if(x.paused()){x.resume()}x.off("terminal.autologin")})}catch(e){d(e,"AUTH")}})}catch(e){d(e,"AUTH")}},{prompt:m().password+": ",name:"password"})},{prompt:m().login+": ",name:"login"})}function ze(t){return function(e){t.add(e)}}function m(){return $.extend({},$.terminal.defaults.strings,B&&B.strings||{})}function Ie(e,t){return parseInt(e.getPropertyValue(t),10)||0}function Pe(){var t=window.getComputedStyle(L[0]);function e(e){return Ie(t,"padding-"+e)}var r=e("left");var n=e("right");var i=e("top");var a=e("bottom");return{top:i,left:r,right:n,bottom:a}}var x=this;if(this.length>1){return this.each(function(){$.fn.terminal.call($(this),e,$.extend({name:x.selector},t))})}var Ne;if(x.is("body,html")){if(x.hasClass("full-screen-terminal")){var Me=x.find("> .terminal").data("terminal");if(Me){return Me}}Ne=x;x=$("<div/>").appendTo("body");$("body").addClass("full-screen-terminal")}else if(x.data("terminal")){return x.data("terminal")}var He=$.omap({id:function(){return Je},clear:function(){if(v("onClear")!==false){b.clear();C.clear(function(e){return W(e)});k[0].innerHTML="";x.prop({scrollTop:0})}return x},export_view:function(){var e=v("onExport");e=e||{};return $.extend({},{focus:F,mask:S.mask(),prompt:x.get_prompt(),command:x.get_command(),position:S.position(),lines:clone(C.data()),interpreters:T.clone(),history:S.history().data},e)},import_view:function(r){if(y){throw new Error(sprintf(m().notWhileLogin,"import_view"))}v("onImport",[r]);f(function e(){var t=x.is_bottom();x.set_prompt(r.prompt);x.set_command(r.command);S.position(r.position);S.mask(r.mask);if(r.focus){x.focus()}C.import(clone(r.lines).filter(function(e){return e[0]}));if(r.interpreters instanceof Stack){T=r.interpreters}if(B.importHistory){S.history().set(r.history)}i();if(t){x.scroll_to_bottom()}});return x},save_state:function(e,t,r){if(typeof r!=="undefined"){save_state[r]=x.export_view()}else{save_state.push(x.export_view())}if(!Array.isArray(hash_commands)){hash_commands=[]}if(e!==undefined&&!t){var n=[Je,save_state.length-1,e];hash_commands.push(n);ce()}return x},exec:function(n,i,a){function u(e){if(o.history){S.history().append(n)}var t=De(n,e,true);unpromise(t,function(){g=null;s.resolve()},function(){g=null;s.reject()})}if(i&&typeof i==="object"){a=i;i=null}var o=$.extend({deferred:null,silent:false,history:false,typing:false,delay:B.execAnimationDelay},a);if(i===null){i=o.silent}if(!is_deferred(o.deferred)){o.deferred=new $.Deferred}var s=o.deferred;D(function e(){if(Array.isArray(n)){(function e(){var t=n.shift();if(t){x.exec(t,i,a).done(e)}else{s.resolve()}})()}else if(E){ot.push([n,i,o])}else if(o.typing&&!i){var t=o.delay;E=true;var r=x.typing("enter",t,n,{delay:t});r.then(function(){E=false;u(true)});s.then(function(){E=false})}else{u(i)}});return s.promise()},autologin:function(e,t,r){x.trigger("terminal.autologin",[e,t,r]);return x},login:function(t,r,n,i){Ge.push([].slice.call(arguments));if(y){throw new Error(sprintf(m().notWhileLogin,"login"))}if(!is_function(t)){throw new Error(m().loginIsNotAFunction)}y=true;if(x.token()&&x.level()===1&&!lt){y=false;x.logout(true)}else{var e=x.token(true);var a=x.login_name(true);if(e&&a){y=false;x.pause();Oe(a,e,function(e){if(e!==false){if(is_function(n)){n()}}else{x.resume();Le(t,r,n,i)}})}else{Le(t,r,n,i)}}return x},settings:function(){return B},before_cursor:function(e){var t=S.position();var r=S.get().slice(0,t);var n=r.split(/\s/);var i;if(e){if(n.length===1){i=n[0]}else{var a=r.match(/(\\?")/g);var u=a?a.filter(function(e){return!e.match(/^\\/)}).length:0;a=r.match(/'/g);var o=a?a.length:0;if(o%2===1){i=r.match(/('[^']*)$/)[0]}else if(u%2===1){i=r.match(/("(?:[^"]|\\")*)$/)[0]}else{i=n[n.length-1];for(l=n.length-1;l>0;l--){var s=n[l-1];if(s[s.length-1]==="\\"){i=n[l-1]+" "+i}else{break}}}}}else{i=r}return i},complete:function(n,i){i=$.extend({word:true,echo:false,escape:true,echoCommand:false,caseSensitive:true,doubleTab:null},i||{});var a=i.caseSensitive;var u=x.before_cursor(i.word).replace(/\\"/g,'"');var s=false;if(i.word){if(u.match(/^"/)){s='"'}else if(u.match(/^'/)){s="'"}if(s){u=u.replace(/^["']/,"")}}if(Ke%2===0){Ye=x.before_cursor(i.word)}else{var e=x.before_cursor(i.word);if(e!==Ye){return}}var t=$.terminal.escape_regex(u);if(i.escape){t=t.replace(/(\\+)(["'() ])/g,function(e,t,r){if(r.match(/[()]/)){return t+"\\?\\"+r}else{return t+"?"+r}})}function o(e){if(s==='"'){e=e.replace(/"/g,'\\"')}if(!s&&i.escape){e=e.replace(/(["'() ])/g,"\\$1")}return e}function r(){var e=[];for(var t=n.length;t--;){if(n[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(n[t])){var r=o(n[t]);if(!a&&same_case(r)){if(u.toLowerCase()===u){r=r.toLowerCase()}else if(u.toUpperCase()===u){r=r.toUpperCase()}}e.push(r)}}return e}var l=a?"":"i";var f=new RegExp("^"+t,l);var c=r();function p(e,t){var r=x.get_command();var n=x.get_position();var i=new RegExp("^"+e,"i");var a=r.slice(0,n);var u=r.slice(n);var o=t.replace(i,"")+(s||"");x.set_command(a+o+u);x.set_position((a+o).length)}if(c.length===1){if(i.escape){p(t,c[0])}else{x.insert(c[0].replace(f,"")+(s||""))}Ye=x.before_cursor(i.word);return true}else if(c.length>1){if(++Ke>=2){Ke=0;if(i.echo){if(is_function(i.doubleTab)){if(i.echoCommand){h()}var m=i.doubleTab.call(x,u,c,h);if(typeof m==="undefined"){return true}else{return m}}else if(i.doubleTab!==false){h();var D=c.slice().reverse().join("\t\t");x.echo($.terminal.escape_brackets(D),{keepWords:true,formatters:false})}return true}}else{var d=common_string(o(u),c,a);if(d){p(t,d);Ye=x.before_cursor(i.word);return true}}}},commands:function(){return T.top().interpreter},set_interpreter:function(e,t){var r=$.Deferred();function n(){x.pause(B.softPause);X(e,t,function(e){x.resume();var t=T.top();$.extend(t,e);s(true);r.resolve()})}if(is_function(t)){x.login(t,true,n)}else if(get_type(e)==="string"&&t){x.login(Z(e,t),true,n)}else{n()}return r.promise()},greetings:function(){ae();return x},paused:function(){return E},pause:function(t){D(function e(){nt();E=true;S.disable(t||is_android);if(!t){S.find(".cmd-prompt").hidden()}v("onPause")});return x},resume:function(i){D(function e(){E=false;if(F&&terminals.front()===x){S.enable(i)}S.find(".cmd-prompt").visible();var t=ot;ot=[];for(var r=0;r<t.length;++r){x.exec.apply(x,t[r])}x.trigger("resume");var n=me.shift();if(n){n()}if(v("onResume")!==false){x.scroll_to_bottom()}});return x},signal:function(){var e=new AbortController;abort_controllers.push(e);return e.signal},timeout:function(e){var t=new AbortController;var r=new Error(m().timeoutError);r.name="TimeoutError";abort_controllers.push(t);var n=t.signal;setTimeout(function(){if(!n.aborted){t.abort(r)}},e);return n},abort:function(e){if(abort_controllers.length){var t=new Error(e||m().abortError);t.name="AbortError";for(var r=abort_controllers.length;r--;){var n=abort_controllers[r];if(!n.signal.aborted){n.abort(t)}}abort_controllers=[]}return x},skip:function(){Ze=true;return x},skip_stop:function(){Ze=false;return x},animating:function(){return A},cols:function(){if(B.numChars){return B.numChars}if(!a||a===1e3){a=get_num_chars(x,I)}return a},rows:function(){if(B.numRows){return B.numRows}if(!Ve){Ve=get_num_rows(x,I)}return Ve},history:function(){return S.history()},geometry:function(){var e=Pe();return{terminal:{padding:{left:e.left,right:e.right,top:e.top,bottom:e.bottom},width:it+e.left+e.right,height:at+e.top+e.bottom},density:z,char:I,cols:this.cols(),rows:this.rows()}},history_state:function(e){function t(){B.historyState=true;if(!save_state.length){x.save_state()}else if(terminals.length()>1){x.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(t,0)}else{setImmediate(t)}}else{B.historyState=false}return x},clear_history_state:function(){hash_commands=[];save_state=[];return x},next:function(){if(terminals.length()===1){return x}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){d(e,"onTerminalChange")}return e}},focus:function(r,n){D(function e(){if(terminals.length()===1){if(r===false){x.disable(n)}else{x.enable(n)}}else if(r===false){x.next()}else{var t=terminals.front();if(t!==x){terminals.forEach(function(e){if(e!==x&&e.enabled()){e.disable(n)}});if(!n){try{trigger_terminal_change(x)}catch(e){d(e,"onTerminalChange")}}}terminals.set(x);x.enable(n)}});return x},blur:function(e){return this.focus(false,e)},freeze:function(t){f(function e(){if(t){x.disable();w=true}else{w=false;x.enable()}});return x},frozen:function(){return w},enable:function(r){if(!F&&!w){if(a===undefined){x.resize()}D(function e(){var t;if(!r&&!F){v("onFocus")}if(!r&&t===undefined||r){F=true;if(!x.paused()){S.enable(true)}}})}return x},clear_cache:"Map"in root?function(){b.clear_cache();p.clear();S.clear_cache();return x}:function(){return x},disable:function(r){D(function e(){var t;if(!r&&F){t=v("onBlur")}if(!r&&t===undefined||r){F=false;S.disable()}});return x},enabled:function(){return F},signature:function(){var e=x.cols();for(var t=signatures.length;t--;){var r=signatures[t].map(function(e){return e.length});if(Math.max.apply(null,r)<=e){return signatures[t].join("\n").replace(/\s+$/m,"")+"\n"}}return""},version:function(){return $.terminal.version},cmd:function(){return S},get_command:function(){return S.get()},enter:je("enter",h),set_command:function(t,r){f(function e(){if(typeof t!=="string"){t=JSON.stringify(t)}S.set(t,undefined,r)});return x},set_position:function(t,r){f(function e(){S.position(t,r)});return x},get_position:function(){return S.position()},insert:function(a,e){if(typeof a==="string"){var u;var t={stay:false,typing:false,delay:100};if(!is_object(e)){e={stay:e}}u=$.extend(t,e);var o=new $.Deferred;f(function e(){function t(){if(B.scrollOnEcho||r){x.scroll_to_bottom()}}var r=x.is_bottom();if(u.typing){var n=u.delay;var i=x.typing("insert",n,a,B);i.then(function(){t();o.resolve()})}else{S.insert(a,B.stay);t()}});if(u.typing){return o.promise()}return x}else{throw new Error(sprintf(m().notAString,"insert"))}},set_prompt:je("prompt",function(t){if(is_function(t)){S.prompt(function(e){return t.call(x,e,x)})}else{S.prompt(t)}},function(e){T.top().prompt=e}),get_prompt:function(){return T.top().prompt},set_mask:function(t){f(function e(){S.mask(t===true?B.maskChar:t)});return x},get_mask:function(){return S.mask()},get_output:function(e){if(e){return C.data()}else{return C.get_snapshot()}},resize:function(e,t){if(!x.is(":visible")){x.stopTime("resize");x.oneTime(500,"resize",function(){x.resize(e,t)})}else{if(e&&t){x.width(e);x.height(t)}e=x.width();t=x.height();if(typeof B.numChars!=="undefined"||typeof B.numRows!=="undefined"){if(typeof B.numChars!=="undefined"){S.resize(B.numChars);x.refresh()}v("onResize");return}var r=get_num_chars(x,I);var n=get_num_rows(x,I);if(r!==a||n!==Ve){x.clear_cache();var i=r!==a;a=r;Ve=n;if(i){S.resize(a);x.refresh()}v("onResize")}}return x},refresh:function(){if(I.width!==0){css(x[0],{"--char-width":I.width,"--pixel-density":z})}x.clear_cache();if(Ye){S.resize()}i({scroll:false,update:true});return x},flush:function(m){m=$.extend({},{update:false,scroll:true},m||{});f(function e(){try{if(b.is_empty()){return x}var t=x.is_bottom();var i=B.scrollOnEcho&&m.scroll||t;var a;var u=true;var o=false;var s=$();var l;var f=[];if(!m.update){s=x.find(".partial");l=C.get_partial()}b.flush(function(e){if(!e){if(!s.length){a=$("<div/>");l=[]}else if(u){u=false;o=true;a=s}}else if(is_function(e.finalize)){if(m.update&&e.raw===true&&e.newline){return}if(i){a.find("img").on("load",function(){x.scroll_to_bottom()})}if(m.update){C.update_snapshot(e.index,l);var t=W(e.index);if(t.html()!==a.html()){t.replaceWith(a)}}else{a.appendTo(k);if(!s.length){C.make_snapshot(l)}}a.attr("data-index",e.index);o=!e.newline;a.toggleClass("partial",o);f.push({node:a,finalize:e.finalize});if(o){s=a}else if(e.newline&&s.length){a=$("<div/>");s=$()}}else{var r=e.line;var n;if(typeof e.raw==="string"){if(o){l[l.length-1]+=e.raw}else{l.push(e.raw)}}if(o){n=a.children().last().append(r);o=false}else{n=$("<div/>").html(r);if(e.newline){n.addClass("cmd-end-line")}a.append(n)}n.css("width","100%")}});s=x.find(".partial");var r=$.terminal.length(l[l.length-1]);r%=x.cols();f.forEach(function(e){e.finalize(e.node)});var n;if(s.length===0){css(S[0],{"--prompt-offset":"",top:""});S.__set_prompt_margin(0);n=x.find(".terminal-output div:last-child"+" div:last-child");if(n.css("display")==="inline-block"){n.css({width:"100%",display:""})}}else if(l.length){n=s.children().last();var c=n[0].getBoundingClientRect();var p=is_ch_unit_supported?r+"ch":r+"px";css(S[0],{top:-c.height/z+"px","--prompt-offset":p});S.__set_prompt_margin(r)}ie();v("onFlush");x.stopTime("flush").oneTime(10,"flush",function(){var e=x.find(".cmd-cursor");var t=x.find(".cmd").offset();var r=x.offset();var n=k.height();var i=S.height();css(x[0],{"--terminal-height":x.height(),"--terminal-x":t.left-r.left,"--terminal-y":t.top-r.top,"--terminal-scroll":j.prop("scrollTop"),"--cmd-top":n,"--cmd-height":i});if(F&&!is_mobile&&!m.update){e.hide();setTimeout(function(){e.show()})}});a.on_load({done:function(){if(i){x.scroll_to_bottom()}}})}catch(e){if(is_function(B.exceptionHandler)){try{B.exceptionHandler.call(x,e,"TERMINAL (Flush)")}catch(e){B.exceptionHandler=$.noop;alert_exception("[exceptionHandler]",e)}}else{alert_exception("[Flush]",e)}}finally{b.clear()}});return x},update:function(n,t,i){f(function e(){if(n<0){n=C.length()+n}if(!C.valid_index(n)){x.error("Invalid line number "+n)}else if(t===null){C.update(n,null);W(n).remove()}else{t=M(t,{update:true,line:n});if(t===false){return x}unpromise(t,function(e){var t=o(e,i);if(t){e=t[0];i=t[1]}i=C.update(n,e,i);var r=ne({value:e,index:n,options:i});unpromise(r,function(){x.flush({scroll:false,update:true})})})}});return x},remove_line:function(e){return x.update(e,null)},last_index:function(){return C.length()-1},echo:function(e,n,t){var o=arguments.length>0;var s=t||new $.Deferred;function l(){Ue=false;var e=qe;qe=[];for(var t=0;t<e.length;++t){x.echo.apply(x,e[t])}}function f(e){l();d(e,"ECHO",true)}function r(i){try{var a=$.extend({flush:true,exec:true,raw:B.raw,finalize:$.noop,unmount:$.noop,delay:B.execAnimationDelay,ansi:false,typing:false,externalPause:true,keepWords:false,invokeMethods:B.invokeMethods,onClear:null,formatters:true,allowedAttributes:B.allowedAttributes,newline:true},n||{});var r=B.externalPause&&a.externalPause;(function(t){if(q(i)){return}a.finalize=function(e){if(a.raw){e.addClass("raw")}if(a.ansi){e.addClass("ansi")}try{if(is_function(t)){t.call(x,e)}e.on_load({error:function(e){e.replaceWith(use_broken_image);if(r){x.resume()}},done:function(e){if(e&&r){x.resume()}},load:function(e){if(e&&r){x.pause()}}})}catch(e){d(e,"USER:echo(finalize)");t=null}}})(a.finalize);if(a.flush){if(!b.empty()){x.flush()}}if(v("onBeforeEcho",[i])===false){return}if(a.typing){if(typeof i!=="string"){return s.reject("echo: Typing animation require string"+" or promise that resolve to string")}if(typeof a.delay!=="number"||isNaN(a.delay)){return s.reject("echo: Invalid argument, delay need to"+" be a number")}var e=x.typing("echo",a.delay,i,a);e.then(function(){s.resolve()});return}var t;if(typeof i==="function"){t=i.bind(x)}else if(typeof i==="undefined"){if(o){return x}else{t=""}}else{var u=M(i);if(u===false){return x}t=u}if(is_promise(t)){Ue=true}unpromise(t,function(e){if(typeof e==="undefined"||is_promise(u)&&e===false){return}if(H(e,a)){return}var t=C.length();var r=C.has_newline();if(!r){t--}if(!a.newline&&e[e.length-1]==="\n"){e=e.slice(0,-1);a.newline=true}var n=ne({value:e,options:a,index:t});if(is_promise(n)){Ue=true}C.push([e,a]);unpromise(n,function(){var e=x.find(".partial").length;var t=a.flush&&e;if(a.flush){x.flush();if(e){x.oneTime(1,"echo",function(){var e=C.last_line();if(e){x.update(-1,e[0],e[1])}l()})}v("onAfterEcho",[i])}if(!t){l()}},f)},f)}catch(e){if(is_function(B.exceptionHandler)){B.exceptionHandler.call(x,e,"TERMINAL (echo)")}else{alert_exception("[Terminal.echo]",e)}}}var i=n&&n.typing;if(Ue&&!u){var a=[e,n];if(i){a.push(s)}qe.push(a)}else{r(e)}if(i){return s.promise()}return x},animation:function(e){if(is_function(e)){A=true;var t=x.get_prompt();x.set_prompt("");return unpromise(e(),function(){x.set_prompt(t);A=false})}return $.when()},delay:function(e){var t=new $.Deferred;setTimeout(function(){t.resolve()},e);return t.promise()},typing:function(t,e,r,n){var i=new $.Deferred;var a;var u;if(typeof n==="object"){u=n.finalize||$.noop;a=$.extend({},n,{delay:e,finalize:o})}else{u=n||$.noop;a={delay:e,finalize:o}}function o(){i.resolve();if(is_function(u)){u.apply(x,arguments)}}var s=["prompt","echo","enter","insert"];function l(){return s.indexOf(t)>=0}f(function e(){if(l()){if(t==="prompt"){Be(r,a)}else if(t==="echo"){Se(r,a)}else if(t==="enter"){with_prompt(x.get_prompt(),function(e){Re(e,r,a)},x)}else if(t==="insert"){with_prompt(x.get_prompt(),function(e){Te(e,r,a)},x)}}else{i.reject("Invalid type only `echo` and `prompt` are supported")}});return i.promise()},error:function(e,t){t=$.extend({},t,{raw:false,formatters:false});function r(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 x.echo(function(){return r(e.call(x))},t)}if(e&&e.then){e.then(function(e){x.echo(r(e))}).catch(fe("Echo Error"));return x}return x.echo(r(e),t)},exception:function(n,e){var t=exception_message(n);if(e){t="&#91;"+e+"&#93;: "+t}if(t){x.error(t,{finalize:function(e){e.addClass("terminal-exception terminal-message")},keepWords:true})}if(typeof n.fileName==="string"){var i=x.paused();if(!i){x.pause(B.softPause)}$.get(n.fileName,function(e){var t=n.lineNumber-1;var r=e.split("\n")[t];if(r){x.error("["+n.lineNumber+"]: "+r)}if(!i){x.resume()}},"text")}if(n.stack){x.echo(format_stack_trace(n.stack),{finalize:function(e){e.addClass("terminal-exception terminal-stack-trace")},formatters:false})}return x},scroll:function(e){var t;e=Math.round(e);if(x.prop){if(e>j.prop("scrollTop")&&e>0){j.prop("scrollTop",0)}t=j.prop("scrollTop");j.scrollTop(t+e)}else{if(e>j.prop("scrollTop")&&e>0){j.prop("scrollTop",0)}t=j.prop("scrollTop");j.scrollTop(t+e)}return x},logout:function(r){if(y){throw new Error(sprintf(m().notWhileLogin,"logout"))}f(function e(){if(r){var t=Ge.pop();x.set_token(undefined,true);x.login.apply(x,t)}else if(T.size()===1&&x.token()){x.logout(true)}else{while(T.size()>1){if(x.token()){x.logout(true).pop().pop()}else{x.pop()}}}});return x},token:function(e){return n.get(x.prefix_name(e)+"_token")},set_token:function(e,t){var r=x.prefix_name(t)+"_token";if(typeof e==="undefined"){n.remove(r)}else{n.set(r,e)}return x},get_token:function(e){return x.token(e)},login_name:function(e){return n.get(x.prefix_name(e)+"_login")},name:function(){return T.top().name},prefix_name:function(e,t){var r=(B.name?B.name+"_":"")+Je;if(e&&T.size()>1){var n=T.map(function(e){return e.name||""}).slice(1,t).join("_");if(n){r+="_"+n}}return r},read:function(e,t,r){var n;if(typeof arguments[1]==="object"){n=$.extend({typing:false,delay:B.execAnimationDelay,success:$.noop,cancel:$.noop},arguments[1])}else{n={typing:false,success:t||$.noop,cancel:r||$.noop}}if(!n.signal){n.signal=x.signal()}if(n.typing){var i=x.get_prompt();n.typing=false;return x.typing("prompt",n.delay,e).then(function(){return x.set_prompt(i).read(e,n)})}Qe=true;var a=jQuery.Deferred();if(n.signal.aborted){a.reject();return a.promise()}x.push(function(e){a.resolve(e);if(is_function(n.success)){n.success(e)}o()},{name:"read",history:false,prompt:e||"",onStart:function(){n.signal.addEventListener("abort",s)},keymap:{"CTRL+D":function(){x.abort();return false}}});function u(e){a.reject(e);if(is_function(n.cancel)){n.cancel()}}function o(){x.pop();if(B.history){S.history().enable()}}function s(){o();u(n.signal.reason)}if(B.history){S.history().disable()}if(is_function(n.onReady)){n.onReady.call(x)}return a.promise()},push:function(u,o){D(function e(){o=o||{};var t={infiniteLogin:false};var n=$.extend({},t,o);if(!n.name&&g){n.name=g.name}if(n.prompt===undefined){n.prompt=(n.name||">")+" "}var r=T.top();if(r){r.mask=S.mask()}var i=E;function a(){v("onPush",[r,T.top()]);s()}X(u,o.login,function(e){T.push($.extend({},e,n));if(n.completion===true){if(Array.isArray(e.completion)){T.top().completion=e.completion}else if(!e.completion){T.top().completion=false}}if(n.login){var t;var r=get_type(n.login);if(r==="function"){t=n.infiniteLogin?$.noop:x.pop;x.login(n.login,n.infiniteLogin,a,t)}else if(get_type(u)==="string"&&r==="string"||r==="boolean"){t=n.infiniteLogin?$.noop:x.pop;x.login(Z(u,n.login),n.infiniteLogin,a,t)}}else{a()}if(!i&&x.enabled()){x.resume()}})});return x},pop:function(e,t){if(e!==undefined){h(e)}var r=x.token(true);var n;if(T.size()===1){n=T.top();if(B.login){if(!t){v("onPop",[n,null])}de();v("onExit")}else{x.error(m().canExitError)}}else{if(r){he()}var i=T.pop();n=T.top();s();x.set_mask(n.mask);if(!t){v("onPop",[i,n])}if(y&&x.get_prompt()!==m().login+": "){y=false}if(is_function(i.onExit)){try{i.onExit.call(x,x)}catch(e){i.onExit=$.noop;d(e,"onExit")}}}return x},option:function(e,t){if(typeof t==="undefined"){if(typeof e==="string"){return B[e]}else if(typeof e==="object"){$.each(e,function(e,t){B[e]=t})}}else{B[e]=t;if(e.match(/^num(Chars|Rows)$/)){i()}}return x},invoke_key:function(e){S.invoke_key(e);return x},keymap:function(e,r){if(arguments.length===0){return S.keymap()}if(typeof r==="undefined"){if(typeof e==="string"){return S.keymap(e)}else if($.isPlainObject(e)){e=$.extend({},N,$.omap(e||{},function(r,n){if(!N[r]){return n.bind(x)}return function(e,t){return n.call(x,e,function(){return N[r](e,t)})}}));S.keymap(null).keymap(e)}}else if(typeof r==="function"){var n=e;if(!N[n]){S.keymap(n,r.bind(x))}else{S.keymap(n,function(e,t){return r.call(x,e,function(){return N[n](e,t)})})}}},level:function(){return T.size()},reset:function(){f(function e(){x.clear();while(T.size()>1){T.pop()}s();ae();Fe()});return x},purge:function(){f(function e(){var t=x.prefix_name()+"_";var r=n.get(t+"interpreters");if(r){$.each(JSON.parse(r),function(e,t){n.remove(t+"_commands");n.remove(t+"_token");n.remove(t+"_login")})}S.purge();n.remove(t+"interpreters")});return x},destroy:function(){f(function e(){S.destroy().remove();x.resizer("unbind");x.touch_scroll("unbind");pt.resizer("unbind").remove();mt.resizer("unbind").remove();$(document).unbind(".terminal_"+x.id());$(window).unbind(".terminal_"+x.id());x.unbind("click mousedown mouseup");x.removeData("terminal").removeClass("terminal").unbind(".terminal");if(B.width){x.css("width","")}if(B.height){x.css("height","")}$(window).off("blur",_t).off("focus",vt);x.find(".terminal-fill, .terminal-font, .terminal-font-forcer").remove();x.stopTime();terminals.remove(Je);if(R){if(R.unobserve){R.unobserve(x[0])}else{clearInterval(R)}}var t=x.find(".terminal-scroll-marker");if(rt){rt.unobserve(t[0])}t.remove();if(ct){ct.disconnect()}if(!terminals.length()){$(window).off("hashchange")}if(is_mobile){x.off(["touchstart.terminal","touchmove.terminal","touchend.terminal"].join(" "))}k.remove();j.remove();if(Ne){var r=$(Ne);if(r.attr("class")==="full-screen-terminal"){r.removeAttr("class")}else{r.removeClass("full-screen-terminal")}x.remove()}st=true});return x},scroll_to:function(e){var t=j.scrollTop()-x.offset().top+$(e).offset().top;j.scrollTop(t);return x},scroll_to_bottom:function(){var e;if(x.prop){e=j.prop("scrollHeight")}else{e=j.attr("scrollHeight")}j.scrollTop(e);return x},is_bottom:function(){if(B.scrollBottomOffset===-1){return false}else if(typeof tt==="boolean"){return tt}else{var e,t,r;e=j[0].scrollHeight;t=j[0].scrollTop;r=j[0].offsetHeight;var n=e-B.scrollBottomOffset;return t+r>n}},duplicate:function(){var e=$(x);return $.extend(e,He)},get_output_buffer:function(e){var n=$.extend({html:false},e);var i=[];var a=false;b.forEach(function(e){if(e){if(is_function(e.finalize)){a=!e.newline}else{var t;if(n.html){t=e.line}else{t=e.raw}if(a){var r=i.length-1;i[r]+=t}else{i.push(t)}}}});if(n.html){return i.map(function(e){return"<div>"+e+"</div>"}).join("\n")}return i.join("\n")},clear_buffer:function(){b.clear();return x}},function(t,e){return function(){if(st){if(!B.exceptionHandler){throw new $.terminal.Exception(m().defunctTerminal)}}try{return e.apply(x,[].slice.apply(arguments))}catch(e){if(t!=="exec"&&t!=="resume"){d(e,e.type||"TERMINAL",true)}if(!B.exceptionHandler){throw e}}}});$.extend(x,He);if(x.length===0){var We=sprintf(m().invalidSelector);throw new $.terminal.Exception(We)}x.data("terminal",x);var qe=[];var Ue=false;var g;var _;var Ke=0;var k;var Je=terminals.length();var Qe=false;var a;var Ve;var Ye;var Ge=new Stack;var Xe=new DelayQueue;var A=false;var Ze=false;var et=new DelayQueue;var f=ze(et);var D=ze(Xe);var tt;var rt;var y=false;var nt=$.noop;var it,at,ut;var ot=[];var B=$.extend({},$.terminal.defaults,{name:x.selector,exit:!!(t&&t.login||!t)},t||{});if(typeof B.width==="number"){x.width(B.width)}if(typeof B.height==="number"){x.height(B.height)}delete B.formatters;var st=false;var b=new FormatBuffer(function(e){return{linksNoReferrer:B.linksNoReferrer,linksNoFollow:B.linksNoFollow,anyLinks:B.anyLinks,charWidth:I.width,useCache:B.useCache,escape:false,allowedAttributes:e.allowedAttributes||[]}});var C=new OutputLines(function(){return B});var n=new r(B.memory);var F=B.enabled;var w=false;var E=false;var lt=true;var T;var S;var ft;var R;var ct;if(B.ignoreSystemDescribe===true){B.describe=false}$(document).bind("ajaxSend.terminal_"+x.id(),function(e,t){requests.push(t)});var j=$('<div class="terminal-scroller"/>').appendTo(x);var O=$('<div class="terminal-wrapper"/>').appendTo(j);$(broken_image).hide().appendTo(O);var pt=$('<div class="terminal-font">&nbsp;</div>').appendTo(x);var mt=$('<div class="terminal-pixel"/>').appendTo(x);var L=$('<div class="terminal-fill"/>').appendTo(j);k=$("<div>").addClass("terminal-output").attr("role","log").appendTo(O);x.addClass("terminal");var z=gt();var I=get_char_size(x);var Dt=!terminal_ready(x);if(B.login&&v("onBeforeLogin")===false){lt=false}var dt;if(typeof e==="string"){dt=e}else if(is_array(e)){for(var l=0,ht=e.length;l<ht;++l){if(typeof e[l]==="string"){dt=e[l];break}}}var P;if(is_function(B.login)){P=B.login}else if(dt&&(typeof B.login==="string"||B.login===true)){P=Z(dt,B.login)}terminals.append(x);function vt(){if(ft){x.focus();x.scroll_to_bottom()}}function gt(){var e=mt[0].getBoundingClientRect();return e.width||1}function _t(){ft=F;x.disable().find(".cmd textarea").trigger("blur",[true])}function yt(e){if(is_function(e)){e=e()}if(e&&is_function(e.then)){return e.then(yt)}if(get_type(e)!=="string"){if(is_function(B.parseObject)){var t=B.parseObject(e);if(get_type(t)==="string"){e=t}}else if(is_array(e)){e=$.terminal.columns(e,x.cols(),B.tabs)}else{var r=is_big_int(e);e=String(e);if(r){e+="n"}}}return e}function bt(t){if(t.proxy){return t}var e=function(e){return t.call(x,e,x)};e.proxy=true;return e}function Ct(e){e=e.originalEvent;function t(e,t){return e.type.indexOf(t)!==-1}function i(e){x.echo('<img src="'+e+'"/>',{raw:true})}function a(e){var t=window.URL||window.webkitURL;return t.createObjectURL(e)}function u(e,t){if(!t){var r={target:x};if(typeof e==="string"){r.text=e}else if(e instanceof Blob){r.image=a(e)}var n=v("onPaste",[r]);if(n){if(is_function(n.then||n.done)){return(n.then||n.done).call(n,function(e){u(e,true)})}else{u(n,true)}}else if(n!==false){u(r.image||r.text,true)}}else if(e instanceof Blob){i(a(e))}else if(typeof e==="string"){if(e.match(/^(data:|blob:)/)){i(e)}else{x.insert(e)}}}if(e.clipboardData){if(x.enabled()){var r=e.clipboardData.items;if(r){for(var n=0;n<r.length;n++){if(t(r[n],"image")&&B.pasteImage){var o=r[n].getAsFile();u(o)}else if(t(r[n],"text/plain")){r[n].getAsString(function(e){u(e.replace(/\r/g,""))})}}}else if(e.clipboardData.getData){var s=e.clipboardData.getData("text/plain");u(s.replace(/\r/g,""))}return false}}}$(document).on("paste.terminal_"+x.id(),Ct);var N=$.extend({},xe,$.omap(B.keymap||{},function(r,n){if(!xe[r]){return n.bind(x)}return function(e,t){return n.call(x,e,function(){return xe[r](e,t)})}}));X(e,B.login,function(e){if(B.completion&&typeof B.completion!=="boolean"||!B.completion){e.completion="settings"}var t=B.prompt;if(is_function(t)){t=bt(t)}T=new Stack($.extend({},B.extra,{name:B.name,prompt:t,keypress:B.keypress,keydown:B.keydown,resize:B.onResize,greetings:B.greetings,mousewheel:B.mousewheel,history:B.history,keymap:N},e));S=$("<div/>").appendTo(O).cmd({tabindex:B.tabindex,mobileDelete:B.mobileDelete,mobileIngoreAutoSpace:B.mobileIngoreAutoSpace,prompt:P?false:t,history:B.memory?"memory":B.history,historyFilter:B.historyFilter,historySize:B.historySize,caseSensitiveSearch:B.caseSensitiveSearch,onPaste:B.onPaste,width:"100%",enabled:false,charWidth:I.width,keydown:$e,keymap:N,clickTimeout:B.clickTimeout,holdTimeout:B.holdTimeout,holdRepeatTimeout:B.holdRepeatTimeout,repeatTimeoutKeys:B.repeatTimeoutKeys,allowedAttributes:B.allowedAttributes,keypress:ke,tabs:B.tabs,onPositionChange:function(){var e=[].slice.call(arguments);_e();v("onPositionChange",e)},onCommandChange:function(e){if(it!==L.width()){x.resizer()}v("onCommandChange",[e]);_e()},commands:De});function r(e){if(is_mobile){return}e=e.originalEvent;if(e&&e.isTrusted){var t=document.elementFromPoint(e.clientX,e.clientY);if(!$(t).closest(".terminal").length&&x.enabled()){x.disable()}}}x.oneTime(100,function(){$(document).bind("click.terminal_"+x.id(),r).bind("contextmenu.terminal_"+x.id(),r)});var n=$(window);document.addEventListener("resume",function(){x.disable()});if(is_mobile){(function(){x.addClass("terminal-mobile");var i;var a;var r;var u=3;var e=S.clip();var n=200;var o;e.$node.off("touchstart.cmd");x.on("touchstart.terminal",function(e){e=e.originalEvent;window.touch_event=e;if(e.target.tagName.toLowerCase()==="a"){return}if(!w&&e.touches.length===1){r=x.enabled();var t=e.touches[0];i={x:t.clientX,y:t.clientY};o=setTimeout(function(){i=null},n)}}).on("touchmove.terminal",function(e){if(e.touches.length===1&&i){var t=e.touches[0];var r=Math.abs(t.clientX-i.x);var n=Math.abs(t.clientY-i.y);if(r>u||n>u){a=true}}}).on("touchend.terminal",function(){if(i){clearTimeout(o);if(!a){if(!r){e.focus();x.focus();setTimeout(function(){x.scroll_to_bottom()},100)}else{e.blur();x.disable()}}}a=false;i=null})})();if("visualViewport"in window){on_height_change(function(e){css(document.documentElement,{"--terminal-force-height":e+"px"})})}}else{n.on("focus.terminal_"+x.id(),vt).on("blur.terminal_"+x.id(),_t);var h;(function(){var t=0;var r;var n="click_"+x.id();var i=x.find(".cmd textarea");function a(){if(r.is(".terminal")||r.is(".terminal-scroller")||r.is(".terminal-wrapper")){var e=x.get_command().length;x.set_position(e)}else if(r.closest(".cmd-prompt").length){x.set_position(0)}if(!i.is(":focus")){i.focus()}u()}function u(){t=0;r=null}var o=".terminal-output textarea,"+".terminal-output input";x.mousedown(function(e){if(!scrollbar_event(e,L,z)){r=$(e.target)}}).mouseup(function(){if(h){h=false;return}if(r&&r.closest(o).length){if(F){x.disable()}}else if(get_selected_html()===""&&r){if(++t===1){if(!w){if(!F){x.focus();x.scroll_to_bottom()}else{var e=B.clickTimeout;x.oneTime(e,n,a);return}}}else{x.stopTime(n)}}u()}).dblclick(function(){u();x.stopTime(n)})})();(function(){var D=S.clip().$node;function d(e){return e.type==="mousedown"&&e.buttons===2||e.type==="contextmenu"}var e;if("oncontextmenu"in window){e="contextmenu.terminal"}else{e="mousedown.terminal"}x.on(e,function(e){h=get_selected_html()===""&&d(e)&&!e.ctrlKey;if(h){var t=$(e.target);if(t.is("img,value,audio,object,canvas,a")){return}if(!x.enabled()){x.enable()}var r=S.offset();var n=S[0].getBoundingClientRect();var i=x.offset();var a=i.top-r.top;var u=Math.max(e.pageY-r.top-20,a);var o=e.pageX-r.left-20;var s=4*14;var l=5*14;var f=x[0].getBoundingClientRect();var c=L.outerWidth()*z;var p=u+n.top+s;p=p-f.height-f.top;var m=o+n.left+l;m=m-c-f.left;if(p>0){s-=Math.ceil(p)}if(m>0){l-=Math.ceil(m)}D.attr("style",[style_prop("left",o,true),style_prop("top",u,true),style_prop("width",l,true),style_prop("height",s,true)].join(";"));if(!D.is(":focus")){D.focus()}x.stopTime("textarea");x.oneTime(100,"textarea",function(){var e={left:"",top:"",width:"",height:""};if(!is_css_variables_supported){var t=x.find(".cmd .cmd-cursor-line").prevUntil(".cmd-prompt").length;e.top=t*14+"px"}D.css(e)});x.stopTime("selection");x.everyTime(20,"selection",function(){if(D[0].selection!==D[0].value){if(get_textarea_selection(D[0])){clear_textarea_selection(D[0]);select(x.find(".terminal-output")[0],x.find(".cmd div:last-of-type")[0]);x.stopTime("selection")}}})}})})();x.on("scroll",function(){var e=x.find("textarea");var t=x[0].getBoundingClientRect();var r=x[0].scrollHeight;var n=j.scrollTop();var i=r-(n+t.height);if(i===0){e.css("top","")}else{e.css("top",-i)}})}x.on("click","a",function(e){var t=$(this);if(t.closest(".terminal-exception").length){var r=t.attr("href");if(r.match(/:[0-9]+$/)){e.preventDefault();K(r,x.cols())}}if(F){x.find(".cmd textarea").focus()}});function i(){var e=I.width;I=get_char_size(x);if(e!==I.width){S.option("charWidth",I.width).refresh()}}a();function a(){if(x.is(":visible")){var e=L.width();var t=L.height();z=gt();if(ut!==z){css(x[0],{"--pixel-density":z})}if(Dt){Dt=!terminal_ready(x);if(!Dt){I=get_char_size(x);i()}}if(at!==t||it!==e||z!==ut){x.resize()}at=t;it=e;ut=z}}function u(){var e={prefix:"terminal-"};x.resizer("unbind").resizer(a,e);pt.resizer("unbind").resizer(function(){i();x.resize()},e);mt.resizer("unbind").resizer(function(){z=gt();x.refresh()},e);$('<div class="terminal-font-forcer terminal-hidden">x<div>').appendTo(x)}function o(e){tt=e[0].intersectionRatio>=.9}function s(){if(window.IntersectionObserver){var e=$('<div class="terminal-scroll-marker"/>').appendTo(j);var t=e;if(B.scrollBottomOffset!==-1){var r=style_prop("height",B.scrollBottomOffset);t=$('<div style="'+r+'"/>').appendTo(e)}rt=new IntersectionObserver(o,{root:j[0],rootMargin:"0px",threshold:1});rt.observe(t[0])}}s();if(x.is(":visible")){u()}function l(){if(R){if(R.unobserve){R.unobserve(x[0])}else{clearInterval(R)}}var e=x.enabled();var t=x.is(":visible");if(e&&!t){x.disable()}if(t){u()}else{O.css("visibility","hidden")}function r(){if(x.is(":visible")&&!t){t=true;u();i();a();if(e){x.enable()}O.css("visibility","")}else if(t&&!x.is(":visible")){t=false;e=$.terminal.active()===x&&x.enabled();x.disable();O.css("visibility","hidden")}}if(window.IntersectionObserver&&x.css("position")!=="fixed"){R=new IntersectionObserver(r,{root:null});R.observe(x[0])}else{R=setInterval(r,100)}}var f=!!x.closest("body").length;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){ct=new c(function(){if(x.closest("body").length){if(!f){x.scroll_to_bottom();l();a()}f=true}else if(f){f=false}});ct.observe(document.body,{childList:true})}if(f){l()}if(document.fonts&&document.fonts.ready){document.fonts.ready.then(function(){if(have_custom_font(x)){i();x.resize()}Xe.resolve()})}else{Xe.resolve()}if(F&&x.is(":visible")&&!is_mobile){x.focus(undefined,true)}else{x.disable()}if(is_function(P)){x.login(P,true,Ce);et.resolve();Fe()}else{Ce();Fe()}function p(e,t){var r=terminals.get()[e[0]];var n=$.Deferred();if(r&&Je===r.id()){if(!e[2]){n.resolve();return n.promise()}else if(E){me.push(function(){return r.exec(e[2],t).done(function(){r.save_state(e[2],true,e[1]);n.resolve()})});return n.promise()}else{return r.exec(e[2],t).done(function(){r.save_state(e[2],true,e[1])})}}}if(B.execHash){if(location.hash){setTimeout(function(){try{var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e));if(!e.match(/\[/)){ye(hash_commands)}var r=0;var n={typing:B.execAnimation,history:B.execHistory,delay:B.execAnimationDelay};(function e(){var t=hash_commands[r++];if(t){p(t,n).done(e)}else{change_hash=true}})()}catch(e){}})}else{change_hash=true}}else{change_hash=true}(function(){var i=false;$(document).bind("keydown.terminal_"+x.id(),function(e){if(e.shiftKey){i=true}}).bind("keyup.terminal_"+x.id(),function(e){if(e.shiftKey||e.which===16){i=false}});function r(e,t){if(!i){var r=T.top();var n;if(is_function(r.mousewheel)){n=r.mousewheel(e,t,x)}else if(is_function(B.mousewheel)){n=B.mousewheel(e,t,x)}if(n===true){return}if((oe()||n===false)&&!e.ctrlKey){e.stopPropagation();e.preventDefault()}if(n===false){return false}if(t>0){x.scroll(-40)}else{x.scroll(40)}}}if($.event.special.mousewheel){j.on("mousewheel",r)}else{var n;var e=document.createElement("div");if("onwheel"in e){n="wheel"}else if(document.onmousewheel!==undefined){n="mousewheel"}else{n="DOMMouseScroll"}e=null;x.on(n,function(e){var t;if(n==="mousewheel"){t=-1/40*e.originalEvent.wheelDelta}else{t=e.originalEvent.deltaY||e.originalEvent.detail}r(e,-t)})}j.touch_scroll(function(e){var t=e.current.clientY-e.previous.clientY;var r;var n=T.top();if(is_function(n.touchscroll)){r=n.touchscroll(e,t,x)}else if(is_function(B.touchscroll)){r=B.touchscroll(e,t,x)}css(x[0],{"--terminal-scroll":j.prop("scrollTop")});if(r===true){return}return false})})()});return x}});
//# sourceMappingURL=jquery.terminal.min.js.map