/
jquery.terminal-2.40.5.min.js
47 lines (47 loc) · 169 KB
/
jquery.terminal-2.40.5.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**@license
* __ _____ ________ __
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.40.5
*
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
*
* Copyright (c) 2010-2023 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: Sat, 27 Apr 2024 14:23:24 +0000
*/
(function(e){var m=function(){if(!m.cache.hasOwnProperty(arguments[0])){m.cache[arguments[0]]=m.parse(arguments[0])}return m.format.call(null,m.cache[arguments[0]],arguments)};m.format=function(e,t){var n=1,r=e.length,i="",u,a=[],o,s,l,f,c,p;for(o=0;o<r;o++){i=D(e[o]);if(i==="string"){a.push(e[o])}else if(i==="array"){l=e[o];if(l[2]){u=t[n];for(s=0;s<l[2].length;s++){if(!u.hasOwnProperty(l[2][s])){throw m('[sprintf] property "%s" does not exist',l[2][s])}u=u[l[2][s]]}}else if(l[1]){u=t[l[1]]}else{u=t[n++]}if(/[^s]/.test(l[8])&&D(u)!=="number"){throw m("[sprintf] expecting number but found %s",D(u))}switch(l[8]){case"b":u=u.toString(2);break;case"c":u=String.fromCharCode(u);break;case"d":u=parseInt(u,10);break;case"e":u=l[7]?u.toExponential(l[7]):u.toExponential();break;case"f":u=l[7]?parseFloat(u).toFixed(l[7]):parseFloat(u);break;case"o":u=u.toString(8);break;case"s":u=(u=String(u))&&l[7]?u.slice(0,l[7]):u;break;case"u":u=u>>>0;break;case"x":u=u.toString(16);break;case"X":u=u.toString(16).toUpperCase();break}u=/[def]/.test(l[8])&&l[3]&&u>=0?" +"+u:u;c=l[4]?l[4]==="0"?"0":l[4].charAt(1):" ";p=l[6]-String(u).length;f=l[6]?d(c,p):"";a.push(l[5]?u+f:f+u)}}return a.join("")};m.cache={};m.parse=function(e){var t=e,n=[],r=[],i=0;while(t){if((n=/^[^\x25]+/.exec(t))!==null){r.push(n[0])}else if((n=/^\x25{2}/.exec(t))!==null){r.push("%")}else if((n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))!==null){if(n[2]){i|=1;var u=[],a=n[2],o=[];if((o=/^([a-z_][a-z_\d]*)/i.exec(a))!==null){u.push(o[1]);while((a=a.slice(o[0].length))!==""){if((o=/^\.([a-z_][a-z_\d]*)/i.exec(a))!==null){u.push(o[1])}else if((o=/^\[(\d+)\]/.exec(a))!==null){u.push(o[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}n[2]=u}else{i|=2}if(i===3){throw"[sprintf] mixing positional and named placeholders is not (yet) supported"}r.push(n)}else{throw"[sprintf] huh?"}t=t.slice(n[0].length)}return r};var t=function(e,t,n){n=t.slice(0);n.splice(0,0,e);return m.apply(null,n)};function D(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function d(e,t){for(var n=[];t>0;n[--t]=e){}return n.join("")}e.sprintf=m;e.vsprintf=t})(typeof global!=="undefined"?global:self||window);(function(r,i){var n;if(typeof window!=="undefined"){n=window}else if(typeof self!=="undefined"){n=self}else if(typeof global!=="undefined"){n=global}else{throw new Error("Unknow context")}if(typeof define==="function"&&define.amd){define(["jquery","wcwidth"],function(e,t){r(e,t,n);return e})}else if(typeof module==="object"&&module.exports){module.exports=function(e,t,n){if(t===i){if(typeof window!=="undefined"){t=require("jquery")}else{t=require("jquery")(e)}}if(n===i){n=require("wcwidth")}r(t,n,e);return t}}else{if(!n.jQuery){n.$=n.cash}r(n.jQuery||n.cash,n.wcwidth,n)}})(function($,wcwidth,root,undefined){"use strict";function debug(e){if(false){console.log(e)}}function DelayQueue(){var t=$.Callbacks();var n=false;var e=this;this.resolve=function(){t.fire();e.resolved=n=true};this.add=function(e){if(n){e()}else{t.add(e)}}}$.omap=function(n,r){var i={};$.each(n,function(e,t){i[e]=r.call(n,e,t)});return i};$.fn.text_length=function(){return this.map(function(){return $(this).text().length}).get().reduce(function(e,t){return e+t},0)};var Clone={clone_object:function(e){var t={};if(typeof e==="object"){if(Array.isArray(e)){return this.clone_array(e)}else if(e===null){return e}else{for(var n in e){if(Array.isArray(e[n])){t[n]=this.clone_array(e[n])}else if(typeof e[n]==="object"){t[n]=this.clone_object(e[n])}else{t[n]=e[n]}}}}return t},clone_array:function(e){if(!is_function(Array.prototype.map)){throw new Error("Your browser don't support ES5 array map "+"use es5-shim")}return e.slice(0).map(function(e){if(typeof e==="object"){return this.clone_object(e)}else{return e}}.bind(this))}};var clone=function(e){return Clone.clone_object(e)};if("Map"in root&&!("clear"in Map.prototype)){Map.prototype.clear=function(){this.forEach(function(e,t,n){n.delete(t)})}}var localStorage;(function(){var e=function(){try{var e="test",t=window.localStorage;t.setItem(e,"1");t.removeItem(e);return true}catch(e){return false}};var t=function(){try{document.cookie.split(";");return true}catch(e){return false}};var n=e();function r(e,t){var n;if(typeof e==="string"&&typeof t==="string"){localStorage[e]=t;return true}else if(typeof e==="object"&&typeof t==="undefined"){for(n in e){if(e.hasOwnProperty(n)){localStorage[n]=e[n]}}return true}return false}function i(e,t){var n,r,i;n=new Date;n.setTime(n.getTime()+31536e6);r="; expires="+n.toGMTString();if(typeof e==="string"&&typeof t==="string"){document.cookie=e+"="+t+r+"; path=/";return true}else if(typeof e==="object"&&typeof t==="undefined"){for(i in e){if(e.hasOwnProperty(i)){document.cookie=i+"="+e[i]+r+"; path=/"}}return true}return false}function u(e){return localStorage[e]}function a(e){var t,n,r,i;t=e+"=";n=document.cookie.split(";");for(r=0;r<n.length;r++){i=n[r];while(i.charAt(0)===" "){i=i.slice(1,i.length)}if(i.indexOf(t)===0){return i.slice(t.length,i.length)}}return null}function o(e){return delete localStorage[e]}function s(e){return i(e,"",-1)}if(!t()&&!n){localStorage={};$.extend({Storage:{set:r,get:u,remove:o}})}else{if(n){localStorage=window.localStorage}$.extend({Storage:{set:n?r:i,get:n?u:a,remove:n?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(r,i,t){var n=Math.max,u=Math.min;var a,o,s,l,f,c,p=0,m=false,D=false,d=true;if(typeof r!="function"){throw new TypeError(E)}i=i||0;if(x(t)){m=!!t.leading;D="maxWait"in t;s=D?n(t.maxWait||0,i):s;d="trailing"in t?!!t.trailing:d}function h(e){var t=a,n=o;a=o=undefined;p=e;l=r.apply(n,t);return l}function v(e){p=e;f=setTimeout(y,i);return m?h(e):l}function g(e){var t=e-c,n=e-p,r=i-t;return D?u(r,s-n):r}function _(e){var t=e-c,n=e-p;return c===undefined||t>=i||t<0||D&&n>=s}function y(){var e=$();if(_(e)){return b(e)}f=setTimeout(y,g(e))}function b(e){f=undefined;if(d&&a){return h(e)}a=o=undefined;return l}function C(){if(f!==undefined){clearTimeout(f)}p=0;a=c=o=f=undefined}function F(){return f===undefined?l:b($())}function w(){var e=$(),t=_(e);a=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,n,r,i){return this.each(function(){jQuery.timer.add(this,e,t,n,r,i)})},oneTime:function(e,t,n){return this.each(function(){jQuery.timer.add(this,e,t,n,1)})},stopTime:function(e,t){return this.each(function(){jQuery.timer.remove(this,e,t)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1e3,das:1e4,hs:1e5,ks:1e6},timeParse:function(e){if(e===undefined||e===null){return null}var t=this.regex.exec(e.toString().trim());if(t[2]){var n=parseInt(t[1],10);var r=this.powers[t[2]]||1;return n*r}else{return e}},add:function(e,t,n,r,i,u){var a=0;if(typeof n==="function"){if(!i){i=r}r=n;n=t}t=jQuery.timer.timeParse(t);if(typeof t!=="number"||isNaN(t)||t<=0){return}if(i&&i.constructor!==Number){u=!!i;i=0}i=i||0;u=u||false;if(!e.$timers){e.$timers={}}if(!e.$timers[n]){e.$timers[n]={}}r.$timerID=r.$timerID||this.guid++;var o=function(){if(u&&o.inProgress){return}o.inProgress=true;if(++a>i&&i!==0||r.call(e,a)===false){jQuery.timer.remove(e,n,r)}o.inProgress=false};o.$timerID=r.$timerID;if(!e.$timers[n][r.$timerID]){e.$timers[n][r.$timerID]=setInterval(o,t)}if(!this.global[n]){this.global[n]=[]}this.global[n].push(e)},remove:function(e,t,n){var r=e.$timers,i;if(r){if(!t){for(var u in r){if(r.hasOwnProperty(u)){this.remove(e,u,n)}}}else if(r[t]){if(n){if(n.$timerID){clearInterval(r[t][n.$timerID]);delete r[t][n.$timerID]}}else{for(var a in r[t]){if(r[t].hasOwnProperty(a)){clearInterval(r[t][a]);delete r[t][a]}}}for(i in r[t]){if(r[t].hasOwnProperty(i)){break}}if(!i){i=null;delete r[t]}}for(i in r){if(r.hasOwnProperty(i)){break}}if(!i){e.$timers=null}}}}});if(/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())){e(window).one("unload",function(){var e=jQuery.timer.global;for(var t in e){if(e.hasOwnProperty(t)){var n=e[t],r=n.length;while(--r){jQuery.timer.remove(n[r],t)}}}})}})(jQuery);(function(f){if(!String.prototype.split.toString().match(/\[native/)){return}var c=String.prototype.split,p=/()??/.exec("")[1]===f,n;n=function(e,t,n){if(Object.prototype.toString.call(t)!=="[object RegExp]"){return c.call(e,t,n)}var r=[],i=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),u=0,a,o,s,l;t=new RegExp(t.source,i+"g");e+="";if(!p){a=new RegExp("^"+t.source+"$(?!\\s)",i)}n=n===f?-1>>>0:n>>>0;while(o=t.exec(e)){s=o.index+o[0].length;if(s>u){r.push(e.slice(u,o.index));if(!p&&o.length>1){o[0].replace(a,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(r,o.slice(1))}l=o[0].length;u=s;if(r.length>=n){break}}if(t.lastIndex===o.index){t.lastIndex++}}if(u===e.length){if(l||!t.test("")){r.push("")}}else{r.push(e.slice(u))}return r.length>n?r.slice(0,n):r};String.prototype.split=function(e,t){return n(this,e,t)};return n})();$.fn.caret=function(e){var t=this[0];var n=t.contentEditable==="true";if(arguments.length===0){if(window.getSelection){if(n){if(!this.is(":focus")){t.focus()}var r=window.getSelection().getRangeAt(0),i=r.cloneRange();i.selectNodeContents(t);i.setEnd(r.endContainer,r.endOffset);return i.toString().length}return t.selectionStart}if(document.selection){t.focus();if(n){var r=document.selection.createRange(),i=document.body.createTextRange();i.moveToElementText(t);i.setEndPoint("EndToEnd",r);return i.text.length}var e=0,u=t.createTextRange(),i=document.selection.createRange().duplicate(),a=i.getBookmark();u.moveToBookmark(a);while(u.moveStart("character",-1)!==0)e++;return e}return 0}if(e===-1)e=this[n?"text":"val"]().length;if(window.getSelection){if(n){if(!this.is(":focus")){t.focus()}var o=window.getSelection();o.collapse(o.focusNode,e)}else t.setSelectionRange(e,e)}else if(document.body.createTextRange){var u=document.body.createTextRange();u.moveToElementText(t);u.moveStart("character",e);u.collapse(true);u.select()}if(!n&&!this.is(":focus")){t.focus()}return e};function make_callback_plugin(e){var s=$.extend({init:$.noop,destroy:$.noop,name:"event"},e);return function(r,i){var u=arguments.length===0;var a=arguments[0]==="unbind";if(!u&&!a&&!is_function(r)){throw new Error("Invalid argument, it need to a function or string "+'"unbind" or no arguments.')}if(a){r=is_function(arguments[1])?arguments[1]:null}var o="callbacks_"+s.name;return this.each(function(){var t=$(this);var n;function e(e){n.fireWith(t,[e])}if(u||a){n=t.data(o);if(u){n&&n.fire()}else{if(r&&n){n.remove(r);if(!n.has()){n=null}}else{n=null}if(!n){t.removeData(o);s.destroy.call(this,e,i)}}}else if(t.data(o)){$(this).data(o).add(r)}else{n=$.Callbacks();n.add(r);t.data(o,n);s.init.call(this,e,i)}})}}$.fn.resizer=make_callback_plugin({name:"resize",init:function(e,t){var n=$.extend({prefix:""},t);var r=$(this);var i;var u=true;if(r.is("body")){$(window).on("resize.resizer",e)}else if(window.ResizeObserver){i=new ResizeObserver(function(){if(!u){setTimeout(e,0)}u=false});i.observe(this);r.data("observer",i)}else{var a=$("<iframe/>").addClass(n.prefix+"resizer").appendTo(this)[0];$(a.contentWindow).on("resize",e)}},destroy:function(){var e=$(this);if(window.ResizeObserver){var t=e.data("observer");if(t){t.unobserve(this);e.removeData("observer")}}else{var n=e.find('> iframe[class$="resizer"]');if(n.length){$(n[0].contentWindow).off("resize").remove();n.remove()}else if(e.is("body")){$(window).off("resize.resizer")}}}});$.fn.touch_scroll=make_callback_plugin({name:"touch",init:function(r){var i;var u;$(this).on("touchstart.scroll",function(e){e=e.originalEvent;if(e.target.tagName.toLowerCase()!=="a"&&e.touches.length===1){u=i=e.touches[0]}}).on("touchmove.scroll",function(e){e=e.originalEvent;if(i&&e.touches.length===1){var t=e.touches[0];var n=r({origin:i,previous:u,current:t});if(n===false){e.preventDefault()}u=t}}).on("touchend.scroll",function(){if(i||u){i=u=null}})},destroy:function(){$(this).off("touchstart.scroll touchmove.scroll touchend.scroll")}});$.fn.on_load=function(e){var n=$.extend({error:$.noop,load:$.noop,done:$.noop},e);var r=[];this.find("img,iframe").each(function(){var e=$(this);var t=new $.Deferred;e.on("load",t.resolve).on("error",function(){n.error(e);t.reject()});r.push(t)});n.load(!!r.length);if(r.length){$.when.apply($,r).then(function(){n.done(true)})}else{n.done(false)}return this};function jquery_resolve(e){var t=jQuery.Deferred();t.resolve(e);return t.promise()}function unpromise(e,t,n){if(e!==undefined){if(is_promise(e)){if(is_function(e.catch)&&is_function(n)){e.catch(n)}if(is_function(e.done)){return e.done(t)}else if(is_function(e.then)){return e.then(t)}}else if(e instanceof Array){var r=e.filter(function(e){return e&&(is_function(e.done)||is_function(e.then))});if(r.length){var i=$.when.apply($,e).then(function(){return t([].slice.call(arguments))});if(is_function(i.catch)){i=i.catch(n)}return i}}return t(e)}}function always(e){return e===undefined?true:e}$.fn.is_fully_in_viewport=function(){function t(e,t){var n=e.getBoundingClientRect();var r=t[0].getBoundingClientRect();var i=n.top-r.top;var u=n.bottom-r.top;var a=t.height();return u>0&&i<=a}if(root.IntersectionObserver){return function(e){var t=this[0];var n=jQuery.Deferred();var r=new root.IntersectionObserver(function(e){n.resolve(e[0].isIntersecting&&e[0].ratio===1);r.unobserve(t)},{root:e[0]});r.observe(t);return n.promise()}}else{return function(e){return jquery_resolve(t(this[0],e))}}}();var entity_re=/(&(?:[a-z\d]+|#\d+|#x[a-f\d]+);)/i;var 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=/(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\](?:[^\]\\]*(?:\\\\)*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?)/i;var format_parts_re=/\[\[((?:-?[@!gbiuso])*);([^;]*);([^;\]]*);?([^;\]]*);?([^\]]*)\]([^\]\\]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]+)\]?/gi;var format_re=/\[\[((?:-?[@!gbiuso])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?/gi;var format_exist_re=/\[\[((?:-?[@!gbiuso])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]/gi;var format_full_re=/^(\[\[(?:(?:-?[@!gbiuso])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\])([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)(\])$/i;var format_begin_re=/(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\])/i;var format_start_re=/^(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\])/i;var format_end_re=/\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\]?$/i;var self_closing_re=/^(?:\[\[)?[^;]*@[^;]*;/;var color_re=/^(?:#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i;var url_re=/(\b(?:file|ftp|https?):\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'\\<>\][)])+)/gi;var url_nf_re=/\b(?![^"\s[\]]*])(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'\\<>\][)])+)/gi;var email_re=/((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g;var url_full_re=/^(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\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=/(\[\[(?:-?[@!gbiuso])*;[^\]]+\](?:\\[[\]]|[^\]])*\]|\[\[[\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(" "),n=document.createElement("div");if(n.style.animationName){e=true}if(e===false){for(var r=0;r<t.length;r++){var i=t[r]+"AnimationName";if(n.style[i]!==undefined){e=true;break}}}n=null;return e}();var agent=(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 n=Object.getOwnPropertyDescriptor(t,"key").get;return!!n.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 n=$(t+'width:1ch;overflow: hidden"> </span>');n.appendTo("body");var r=$(t+'"> </span>').appendTo("body");ch_unit_bug=Math.abs(e(n)-e(r))>1e-4;n.remove();r.remove()})}function css(t,n,e){if(t instanceof $.fn.init){t.each(function(){css(this,n,e)})}else if($.isPlainObject(n)){Object.keys(n).forEach(function(e){t.style.setProperty(e,n[e])})}else if(typeof e==="undefined"){return t.style.getPropertyValue(n)}else{t.style.setProperty(n,e)}}function style_prop(e,t,n){var r=[e+":"+t+"px",e+":"+"calc("+t+"px / var(--pixel-density, 1))"];if(n){r=r.map(function(e){return e+" !important"})}return r.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 n=(e?e+": ":"")+exception_message(t);if(excepctions.indexOf(n)===-1){excepctions.push(n);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 scrollbar_event(e,t,n){n=n||1;var r=t.offset().left;var i=t.outerWidth()*n;return i<=e.clientX-r}function exception_message(e){if(typeof e==="string"){return e}else if(typeof e.fileName==="string"){return e.fileName+": "+e.message}else{return e.message}}function Cycle(){var r=[].slice.call(arguments);var i=0;$.extend(this,{get:function(){return r},index:function(){return i},rotate:function(e,t){if(t===undefined){t=i}else if(t===i){return}if(!e){var n=r.filter(function(e){return typeof e!=="undefined"});if(!n.length){return}}if(!r.length){return}if(r.length===1){return r[0]}else{if(i===r.length-1){i=0}else{++i}if(typeof r[i]!=="undefined"){return r[i]}else{return this.rotate(true,t)}}},length:function(){return r.length},remove:function(e){delete r[e]},set:function(e){for(var t=r.length;t--;){if(r[t]===e){i=t;return}}this.append(e);i=r.length-1},front:function(){if(r.length){var e=i;var t=false;while(!r[e]){e++;if(e>r.length){if(t){break}e=0;t=true}}return r[e]}},map:function(n){return r.map(function(e,t){if(typeof e!=="undefined"){return n(e,t)}return null}).filter(Boolean)},forEach:function(n){return r.forEach(function(e,t){if(typeof e!=="undefined"){n(e,t)}})},append:function(e){r.push(e)}})}function Stack(e){var t=is_array(e)?e:e?[e]:[];$.extend(this,{data:function(){return t},map:function(e){return $.map(t,e)},size:function(){return t.length},pop:function(){if(t.length===0){return null}else{var e=t[t.length-1];t=t.slice(0,t.length-1);return e}},push:function(e){t=t.concat([e]);return e},top:function(){return t.length>0?t[t.length-1]:null},clone:function(){return new Stack(t.slice(0))}})}function WorkerCache(e){var t=$.extend({validation:$.noop,action:$.noop,onCache:$.noop},e);this._onCache=t.onCache.bind(this);this._action=t.action.bind(this);this._validation=t.validation.bind(this);if("Map"in root){this._cache=new Map}}WorkerCache.prototype.validate=function(e){var t=this._validation(e);var n=t===undefined||t===true;if(!n){this._cache.clear()}return n};WorkerCache.prototype.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,n){var r=true;var i="";if(typeof e==="string"&&e!==""){i=e+"_"}i+="commands";var u;if(n){u=[]}else{u=$.Storage.get(i);u=u?JSON.parse(u):[]}var a=u.length-1;$.extend(this,{append:function(e){if(r){if(u[u.length-1]!==e){u.push(e);if(t&&u.length>t){u=u.slice(-t)}a=u.length-1;if(!n){$.Storage.set(i,JSON.stringify(u))}}}},set:function(e){if(is_array(e)){u=e;if(!n){$.Storage.set(i,JSON.stringify(u))}}},data:function(){return u},reset:function(){a=u.length-1},last:function(){return u[u.length-1]},end:function(){return a===u.length-1},position:function(){return a},current:function(){return u[a]},next:function(){var e=a;if(a<u.length-1){++a}if(e!==a){return u[a]}},previous:function(){var e=a;if(a>0){--a}if(e!==a){return u[a]}},clear:function(){u=[];this.purge()},enabled:function(){return r},enable:function(){r=true},purge:function(){if(!n){$.Storage.remove(i)}},disable:function(){r=false},toggle:function(e){if(typeof e==="undefined"){r=!r}else{r=e}}})}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 n=e[1];if(this.has_newline()){this._lines.push(e)}else{var r=this.last_line();r[0]=this.join(r[0],t);r[1].newline=n.newline}};OutputLines.prototype.clear=function(r){this._lines.forEach(function(e,t){var n=e[1];if(is_function(n.onClear)){n.onClear.call(self,r(t))}});this._lines=[];this._snapshot=[]};OutputLines.prototype.data=function(){return this._lines.filter(Boolean)};OutputLines.prototype.has_newline=function(){if(this._lines.length===0){return true}return this.last_line()[1].newline};OutputLines.prototype.unmount=function(e){var t=e.data("index");var n=this._lines[t];if(n){var r=n[1];if(is_function(r.unmount)){r.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,n){if(t===null){delete this._lines[e];delete this._snapshot[e]}else{this._lines[e][0]=t;if(n){this._lines[e][1]=$.extend(this._lines[e][1],n)}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 n=this._settings();var i=[];this._snapshot=[];if(n.outputLimit>=0){var r;if(n.outputLimit===0){r=e}else{r=n.outputLimit}this._lines.forEach(function(e,t){var n=e[0];var r=e[1];i.push({value:n,index:t,options:r})});var u=i.length-r-1;i=i.slice(u)}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,n,r){var i=this._format_cache&&this._settings.useCache;if(i){var u=JSON.stringify([t,this._settings]);if(this._format_cache.has(u)){return this._format_cache.get(u)}}var a={line:$.terminal.format(t,this._settings),raw:r,newline:n};if(i){this._format_cache.set(u,a)}return a};FormatBuffer.prototype.empty=function(){return!this._output_buffer.length};FormatBuffer.prototype.append=function(e,t,n,r){this._settings=$.extend({useCache:true},this._options(n));this._output_buffer.push(FormatBuffer.NEW_LINE);if(e instanceof Array){var i=r.split("\n");for(var u=0,a=e.length;u<a;++u){if(e[u]===""||e[u]==="\r"){this._output_buffer.push({line:"",raw:""})}else{var o=this.format(e[u],u===a-1,i[u]);this._output_buffer.push(o)}}}else if(n.raw){this._output_buffer.push({line:e,raw:r})}else{this._output_buffer.push(this.format(e,false,r))}this._output_buffer.push({finalize:n.finalize,index:t,raw:n.raw,newline:n.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 n=this._output_buffer[t++];if(n===FormatBuffer.NEW_LINE){e()}else{e(n)}}};FormatBuffer.prototype.flush=function(e){this.forEach(e);this.clear()};function with_prompt(e,n,t){function r(e){var t=$.terminal.escape_brackets("[ERR]> ");n("[[;red;]"+t+"]");alert_exception("Prompt",e)}function i(e){n(e);u.resolve()}var u=new $.Deferred;switch(typeof e){case"string":i(e);break;case"function":try{var a=e.call(t,function(e){i(e)});if(typeof a==="string"){i(a)}if(a&&a.then){a.then(i).catch(r)}}catch(e){r(e)}break}return u.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> </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 n={$node:t,val:function(e){if(typeof e==="undefined"){return t.text()}else{t.html(e)}},reset:function(){clearTimeout(e);e=setTimeout(function(){t.css({top:"",bottom:""})},100)},focus:function(){css(t[0],{top:"calc(var(--terminal-scroll, 0) * 1px)"});n.reset()},blur:function(){t.css({top:"100%",bottom:0}).blur();window.getSelection().removeAllRanges();n.reset()}};return n}();k.addClass("cmd-mobile")}else{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 a=false;var s="";var U=null;var K;var T="";var J;var u="";var S=0;var r;var l;var R=0;var Q,f;var v=k.find(".cmd-cursor");var t;var Y;var V=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 n=!t.next().length;return t.find("[data-text]").length+t.prevUntil(".cmd-prompt").find("[data-text]").length-(n?0:1)}}var te={SPACEBAR:" ",UP:"ArrowUP",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight",DEL:"Delete",MULTIPLY:"*",DIVIDE:"/",SUBTRACT:"-",ADD:"+"};function ne(e){var t=e.key.toUpperCase();if(te[t]){return te[t]}return t}function re(e){if(e.key){var t=ne(e).toUpperCase();if(t==="CONTROL"){return"CTRL"}else{var n=[];if(e.ctrlKey){n.push("CTRL")}if(e.metaKey&&t!=="META"){n.push("META")}if(e.shiftKey&&t!=="SHIFT"){n.push("SHIFT")}if(e.altKey&&t!=="ALT"){n.push("ALT")}if(n.length&&t===" "){t="SPACEBAR"}if(e.key){n.push(t)}return n.join("+")}}}var 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 n;for(n=1;n<25;n++){e[111+n]="F"+n}var ie="";for(n=65;n<91;n++){ie=String.fromCharCode(n);e[n]=[ie.toLowerCase(),ie.toUpperCase()]}var ue={};Object.keys(e).forEach(function(t){if(is_array(e[t])){e[t].forEach(function(e){ue[e.toUpperCase()]=t})}else{ue[e[t].toUpperCase()]=t}});var i;var c={"ALT+D":ae({clipboard:true}),"HOLD+ALT+D":ae({clipboard:true,hold:true}),"HOLD+DELETE":ae({clipboard:false,hold:true}),"HOLD+SHIFT+DELETE":ae({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();Ge="";F=true;var t;if(x.commands){t=x.commands.call(k,e)}if(is_function(r)){if(t&&is_function(t.then)){t.then(function(){b()})}else{b()}}k.set("");B.val("");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 n=e;n>0;--n){if(T[n]===" "&&T[n+1]!==" "){t=n+1;break}else if(T[n]==="\n"&&T[n+1]!=="\n"){t=n;break}}k.position(t)},"CTRL+R":function(){if(a){$e(true)}else{K=r;_();J=T;k.set("");y();a=true}return false},"CTRL+G":function(){if(a){r=K;b();k.set(J);y();a=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(u!==""){k.insert(u)}},"CTRL+V":se,"META+V":se,"CTRL+K":function(){var e=text(T).length;if(e>S){u=k["delete"](e-S);text_to_clipboard(B.$node,u)}return false},"CTRL+U":function(){if(T!==""&&S!==0){u=k["delete"](-S);text_to_clipboard(B.$node,u)}return false},"CTRL+TAB":function(){return false},"META+`":p,"META+R":p,"META+L":p};function ae(i){i=i||{};if(i.hold&&!x.mobileDelete){return function e(){k["delete"](1);return false}}return function e(){var t=/ *[^ ]+ *(?= )|[^ ]+$/;var n=T.slice(S);var r=n.match(t);if(r){u=r[0];if(i.clipboard){text_to_clipboard(B.$node,u)}}k.set(T.slice(0,S)+T.slice(S).replace(t,""),true);return false}}function oe(n){n=n||{};if(n.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){u=k["delete"](-t[0].length);if(n.clipboard){text_to_clipboard(B.$node,u)}}}return false}}function p(){return true}function se(){B.val("");V=0;if(k.isenabled()&&!B.$node.is(":focus")){B.$node.trigger("focus",[true])}B.$node.one("input",le);return true}function le(){if(V++>0){return}function n(){B.val(T);g()}function r(e){k.insert(e);n()}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,r)}else if(typeof t==="string"){r(t)}else if(t===false){n()}return}}r(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 n=e.split("\n").map(function(e){return $.terminal.length(e)});if(t){n[0]+=t}var r=n.filter(function(e){return e>=m});return!!r.length}function De(e){var t=H;var n=$.terminal.split_equal(t+e,m);var r=new RegExp("^"+$.terminal.escape_regex(t));n=n.map($.terminal.unescape_brackets);n[0]=n[0].replace(r,"");return n}function de(){var e=$.terminal.substring(T,0,S);var t=k.column();var n=k.find(".cmd-cursor-line");var r=n.prevUntil("span").length;if(r===1&&t<=d){k.position(0);return false}if(r===0){return fe()}if(pe(e)||me(e,d)){var i=n.prev();var u=i.is(".cmd-end-line");var a=De(T);i=a[r-1];var o=a[r].substring(t).length;var s;if(o>0){s=t;if(r-1===0){s-=d}s=t+i.substring(s).length;if(u){++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 n=k.column();var r=k.find(".cmd-cursor-line");var i=r.prevUntil("span");var u=i.length;var a=r.is(".cmd-end-line");var o=r.next().is(".cmd-end-line");var s=t[u+1];if(!s){return ce()}var l=t[u].substring(n).length;var f;if(l===0){f=s.length;if(o){f++}}else{f=Math.min(n,s.length)+l;if(u===0){f+=d}if(a){f+=1}}k.position(f,true);return false}else{return ce()}}function ve(){if(a){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 n=0;for(var r=0;r<e.length;++r){n+=e[r].length;if(n>t){k.position(n+r);return}}}i()}}else{return i}}function 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 n=k.attr("class");if(n.match(/-animation/)){n=n.replace(/[a-z]+-animation/g,"")}if(t&&!t.match(/blink/)){var r=t.replace(/terminal-/,"")+"-animation";if(!n.match(r)){n+=" "+r}}n=n.replace(/\s+/g," ");if(n!==k.attr("class").replace(/\s+/g," ")){k.attr("class",n)}}}function 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")}};Y=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")}};Y=function(){t(false);t(true)}}function Ee(){v.toggleClass("cmd-inverted")}function _(){r="(reverse-i-search)`"+s+"': ";b()}function xe(){r=K;a=false;U=null;s=""}function $e(e){var t=f.data();var n,r;var i=t.length;if(e&&U>0){i-=U}if(s.length>0){for(var u=s.length;u>0;u--){r=$.terminal.escape_regex(s.slice(0,u));if(x.caseSensitiveSearch){n=new RegExp(r)}else{n=new RegExp(r,"i")}for(var a=i;a--;){if(n.test(t[a])){U=t.length-a;k.position(t[a].indexOf(r));k.set(t[a],true);y();if(s.length!==u){s=s.slice(0,u);_()}return}}}}s=""}function ke(){var e=k.find(".cmd-prompt");var t=e.html();e.html("<span> </span>");var n=e.find("span").get(0).getBoundingClientRect().width;e.html(t);return n}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 n(n){var r=[];n.forEach(function(e,t){if($.terminal.strip(e).match(Z)){r[t]=false;if(t>0){r[t-1]+=G}}else{r[t]=n[t]}});return r.filter(function(e){return e!==false})}var r=h.find(".cmd-line");var i;if(r.length){i=r.nextUntil(".cmd-line").text()}else{i=h.text()}i=i.replace("","");i=$.terminal.escape_brackets(i);var u=Pe();var a=new RegExp("^"+u+$.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(a,"");o=n(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=n(c)}o=o.concat(c)}else{o.push(s[f])}}}else{o=t(u+i+e,m);o[0]=o[0].replace(a,"")}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 n=$.extend({},x,{unixFormattingEscapeBrackets:true,position:S,command:true});var r=$.terminal.apply_formatters(t,n);var i=$.terminal.normalize(r[0]);var u=$.terminal.length(i);if(!e){R=r[1];if(R>u){R=u}}return i}catch(e){alert_exception("[Formatting]",e.stack);return t}}function j(e,t){var n=$.terminal.encode(je(e),{tabs:x.tabs,before:t});return $.terminal.format(n,{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,n){return $.terminal.substring(e,t,n)}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 n=e.match(X);if(n){e=e.replace(X," ")}y.toggleClass("cmd-end-line",!!n);var r=false;var i=$.extend({prompt:"",last:false},t);var u=i.position;var a=O(e);var o=i.prompt;var s;if(u===a){g.html(j(e));s=" ";F();_.html("")}else if(u===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,u);g.html(j(l,o));s=Le(e,u,u+1);var f=(o+l).replace(/^.*\t/,"");v.html(j(s,f));if(u===a-1){r=true;_.html("")}else{if(s.match(/\t/)){f=""}else{f+=s}_.html(j(Le(e,u+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",r);Fe();var p=$.terminal.length(v.text());if(p>1){var m=v.find("[data-text]")[0];m.style.setProperty("--length",p)}Y()}function C(e,t){var n=e.match(X);var r='<div role="presentation" aria-hidden="true"';if(n){e=e.replace(X," ");r+=' class="cmd-end-line"'}r+=">"+j(e,t||"")+"</div>";return r}function F(){v.html('<span data-text class="end"><span> <span></span>')}function w(e){var n=y;$.each(e,function(e,t){n=$(C(t)).insertAfter(n)})}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 n;if(O(t)===text(e).length){n=S}else{n=R}var r;A.css({display:"none"});A.find("div:not(.cmd-cursor-line)").remove();g.html("");if(Oe(t)){var i=t.match(/\t/g);var u=t;if(i){t=t.replace(/\t/g,"\0\0\0\0")}var a=Se(t);if(i){a=$.map(a,function(e){return e.replace(/\x00\x00\x00\x00/g,"\t")})}var o=O(a[0]);if(o===0&&a.length===1){}else if(n<o){b(a[0],{length:a.length,position:n,prompt:W});w(a.slice(1))}else if(n===o){y.before(C(a[0],W));b(a[1]||"",{length:a.length,position:0,last:a.length<=2});if(a.length>2){w(a.slice(2))}}else{var s=a.slice(-1)[0];var l=O(u);var f=l-n;var c=O(s);var p=0;if(f===-1){f=0}if(f<=c){E(a.slice(0,-1));if(c===f){p=0}else{p=c-f}b(s,{length:a.length,position:p,last:true})}else{var m;var D;p=n;for(r=0;r<a.length;++r){var d=$.terminal.length(a[r]);if(p>d){p-=d}else{break}}D=a[r];m=r;if(p===O(D)){p=0;D=a[++m];if(D===undefined){var h=$.terminal.defaults.strings.redrawError;throw new Error(h)}}b(D,{length:a.length,position:p});E(a.slice(0,m));w(a.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:n})}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 u(e,t){var n=$.extend({},x,{position:t,command:true});return $.terminal.apply_formatters(e,n)[1]}function s(e,t,n){var r=u(n,t);if(r===e){var i=u(n,t+1);if(i>e){return 0}return 1}else if(r<e){return 1}else{return-1}}return function(e,t){if(t===0){return 0}e=bare_text(e);var n=e.length;var r=$.terminal.escape_brackets(T);var i=binary_search(0,n,t,s,[r]);var u=$.terminal.split_characters(e);if(n>u.length){var a=0;for(var o=0;o<u.length;++o){a+=u[o].length;if(a>=i){return a}}}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 n=t+e;var r=$.terminal.split_equal(n,m);r=r.map(function(e){return e.replace(/^\uFFFF+/,"")});r=r.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=r[r.length-1];var u=$.terminal.encode(r[r.length-1],{tabs:x.tabs});var a=$.terminal.format(u,i);q=strlen(text(u));d=q+o;return r.slice(0,-1).map(function(e){e=$.terminal.encode(e,{tabs:x.tabs});return'<span class="cmd-line">'+$.terminal.format(e,i)+"</span>"}).concat([a]).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 n=i(e);H=e;n=n||$.terminal.format("[[;;]]");if(h.html()!==n){h.html(n);var r=h.find("> span span");B.$node.attr("data-cmd-prompt",h.text());if(is_ch_unit_supported){h.hide();r.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 n=Ne={set:e};with_prompt(r,function(e){n.set(e,t)},k)}}();function Me(){if(is_function(x.onCommandChange)){x.onCommandChange.call(k,T)}}function He(e,t,n){var r=e.substring(0,t);if(t===0||!e.length){return 0}var i=/\n?([^\n]*)$/;var u=r.match(i);var a=u[1].length;if(!pe(r)&&(n||me(r,d))){a+=d}if(a===0){return a}a%=m;if(a===0){return m}return a}$.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 n,r;if(e===0){return""}else if(e<0){if(S>0){n=T.slice(0,S).slice(e);r=bare_text(T);r=r.slice(0,S+e)+r.slice(S,r.length);if(!t){k.position(S+e)}}}else if(T!==""){r=text(T);if(S<r.length){n=r.slice(S).slice(0,e);r=r.slice(0,S)+r.slice(S+e,r.length)}}if(n){T=r}y();g();Me();return n},set:function(e,t,n){if(e!==undefined){var r=e!==T;T=e;if(!t){k.position(bare_text(T).length)}y();g();if(!n&&r){Me()}}return k},keymap:function(e,t){function n(e,t){var n=c[e];if(is_function(n)){n=n.bind(k)}return function(e){return t.call(k,e,n)}}if(e===null){i=c;return k}else if(typeof e==="undefined"){return i}else if(typeof e==="string"){if(typeof t==="undefined"){if(i[e]){return i[e]}else if(c[e]){return c[e]}}else{i[e]=n(e,t)}}else{i=$.extend({},i?i:c,$.omap(e||{},n));return k}},insert:function(e,t){var n=bare_text(T);var r=bare_text(e).length;if(S===n.length){e=n+e}else if(S===0){e=e+n}else{e=n.slice(0,S)+e+n.slice(S)}T=e;if(!t){k.position(r,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",at);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 r}else{var n=e!==r;if(typeof e==="string"||typeof e==="function"){r=e}else{throw new Error("prompt must be a function or string")}if(n){b(t);y()}return k}},kill_text:function(){return u},position:function(e,t,n){if(typeof e==="number"){var r=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(r!==S){y();if(!n&&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 n=Re($.terminal.escape_formatting(T),true);var r=O(n);var i=bare_text(T).length;var u;if(t){u=R+e}else if(e>r){u=r}else{u=e}if(r===i){R=u;return k.position(u)}if(r===u){R=u;return k.position(i)}var a=Ie(T,u);if(a!==-1){R=u;k.position(a)}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 n=t.pop();var r=t.indexOf("CTRL")!==-1;var i=t.indexOf("SHIFT")!==-1;var u=t.indexOf("ALT")!==-1;var a=t.indexOf("META")!==-1;var o=$.Event("keydown",{ctrlKey:r,shiftKey:i,altKey:u,metaKey:a,which:ue[n],key:n});var s=$(document.documentElement||window);s.trigger(o);o=$.Event("keypress");o.key=n;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(r)){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){r=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 Ye=false;var Ve=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 nt(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 rt=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);try{if(!e.fake){Ke=et(e);Je=String(e.key).toLowerCase()==="unidentified";w=Ze(e)}}catch(e){}if(e.key==="Unidentified"){F=true;return}if(!e.fake&&["meta","os"].indexOf(e.key.toLowerCase())===-1){F=false}C=true;B.$node.off("input",le);var n=re(e);if(is_function(x.keydown)){e.key=ne(e);t=x.keydown.call(k,e);if(t!==undefined){if(!t){E=true}return t}}if(n!==Xe){ut()}if(l||n==="CTRL+C"&&is_terminal_selected(k)){if(Ye){Xe=n;n="HOLD+"+n;if(Ve){return}if(x.holdRepeatTimeout>0&&tt(n)){Ve=true;k.oneTime(x.holdRepeatTimeout,"delay",function(){Ve=false})}}else{k.oneTime(x.holdTimeout,"hold",function(){Ye=true});Xe=n}if(!e.fake&&is_android){if(rt){ut();rt=false;return false}if(I(n)){rt=true}else if(I(Xe)){rt=false}}Y();E=["CTRL+V","META+V"].indexOf(n)!==-1;if(n.toLowerCase()==="enter"){We=true}if(a&&nt(e)){xe();b();if(e.which===27){k.set("")}y();if(e.which===13){it.call(this,e)}}else if(is_function(i[n])){t=i[n](e);if(t===true){return}if(t!==undefined){return t}}else if(e.altKey){return}else{qe=false;return}}}function ut(){k.stopTime("hold");k.stopTime("delay");Ve=Ye=false}var L=$(document.documentElement||window);k.keymap(x.keymap||{});function at(e){debug('keypress "'+e.key+'" '+e.fake);ut();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 n;if(is_key_native){n=e.key;var r=n.toUpperCase();if(te[r]){n=te[r]}}if(!n||Je){n=String.fromCharCode(e.which)}if($.inArray(e.which,[13,0,8])>-1){if(e.keyCode===123){return}return false}else if(n&&(!e.ctrlKey||e.ctrlKey&&e.ctrlKey)&&(!(e.altKey&&e.which===100)||e.altKey)&&!Ue){if(a){s+=n;$e();_()}else if(n.length===1){k.insert(n)}}}}function ot(e,t,n){var r=$.Event(e);r.which=n;r.key=t;r.fake=true;L.trigger(r)}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 n=Ge;w=n.slice(0,n.length-1).length===e.length}if(st){st=false;B.val(T);return}if(a){s=e;$e();_()}else{var r=e.slice(S);if(r.length===1||w){var i=get_next_character(r);if(I(i)){st=true}if(F){var u;if(w){u=8}else{u=r.toUpperCase().charCodeAt(0)}ot("keydown",w?"Backspace":r,u)}if(C&&!w){ot("keypress",i,r.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",at);L.bind("keydown.cmd",it);L.bind("keyup.cmd",ut);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 u=false;var a=0;k.on("mousedown.cmd",function(){u=true}).on("mouseup.cmd",function(n){function e(){var e=$(n.target);var t=e.is(".cmd-prompt");if(!t&&i&&get_selected_html()===""){if(l){if(e.is(".cmd")){k.position(text(T).length)}else{k.display_position(ee(n))}}}a=0}var t;if(n.originalEvent===undefined){t=n.button}else{t=n.originalEvent.button}if(t===0&&get_selected_html()===""){var r="click_"+N;if(++a===1){var i=u;if(l){if(x.clickTimeout===0){e()}else{k.oneTime(x.clickTimeout,r,e)}}else{a=0}}else{k.stopTime(r);a=0}}u=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 n=0;if($.terminal.have_formatting(e)){var r=new RegExp(format_parts_re.source,"i");$.terminal.format_split(e).forEach(function(e){if($.terminal.is_formatting(e)){var t=e.match(r);if(t&&t[1].match(/@/)&&t[6]===""){n++}}})}return n}var entities={"&":"&","<":"<",">":">","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ"," ":" ","¡":"¡","¢":"¢","£":"£","¤":"¤","¥":"¥","¦":"¦","§":"§","¨":"¨","©":"©","ª":"ª","«":"«","¬":"¬","­":"","®":"®","¯":"¯","°":"°","±":"±","²":"²","³":"³","´":"´","µ":"µ","¶":"¶","¸":"¸","¹":"¹","º":"º","»":"»","¼":"¼","½":"½","¾":"¾","¿":"¿","×":"×","÷":"÷","∀":"∀","∂":"∂","∃":"∃","∅":"∅","∇":"∇","∈":"∈","∉":"∉","∋":"∋","∏":"∏","∑":"∑","−":"−","∗":"∗","√":"√","∝":"∝","∞":"∞","∠":"∠","∧":"∧","∨":"∨","∩":"∩","∪":"∪","∫":"∫","∴":"∴","∼":"∼","≅":"≅","≈":"≈","≠":"≠","≡":"≡","≤":"≤","≥":"≥","⊂":"⊂","⊃":"⊃","⊄":"⊄","⊆":"⊆","⊇":"⊇","⊕":"⊕","⊗":"⊗","⊥":"⊥","⋅":"⋅","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","ς":"ς","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","ϑ":"ϑ","ϒ":"ϒ","ϖ":"ϖ","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ƒ":"ƒ","ˆ":"ˆ","˜":"˜"," ":" "," ":" "," ":" ","‌":"","‍":"","‎":"","‏":"","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","•":"•","…":"…","‰":"‰","′":"′","″":"″","‹":"‹","›":"›","‾":"‾","€":"€","™":"™","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⌈":"⌈","⌉":"⌉","⌊":"⌊","⌋":"⌋","◊":"◊","♠":"♠","♣":"♣","♥":"♥","♦":"♦"};function render_entities(e){return e.replace(/&#(x?)([0-9]+);/g,function(e,t,n){n=parseInt(n,t?16:10);return String.fromCharCode(n)}).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 safe(e){if(!e.match(/[<>&]/)){return e}return e.replace(/&(?![^;]+;)/g,"&").replace(/>/g,">").replace(/</g,"<")}function crlf(e){return e.replace(/\r/g,"")}function char_len(e){return entity_re.test(e)?1:e.length}function make_re_fn(r){return function e(t){var n=t.match(r);if(starts_with(n)){return n[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 n=0;n<t.length;++n){if(t[n].test(e)){return false}}return true}function make_next_char_fun(t){var u=[];[entity_re,emoji_re,combine_chr_re].forEach(function(e){if(e.test(t)){u.push(make_re_fn(e))}});if(astral_symbols_re.test(t)){u.push(function e(t){var n=t.match(astral_symbols_re);if(starts_with(n)){var r=t.match(combine_chr_re);if(r&&r.index===1){return t.slice(0,3)}return n[1]}})}return function e(t){for(var n=0;n<u.length;++n){var r=u[n];var i=r(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 n=e.match(combine_chr_re);if(starts_with(n)){return n[1]}var r=e.match(emoji_re);if(starts_with(r)){return r[1]}else if(e.charCodeAt(0)<255){return e[0]}else{var i=e.match(astral_symbols_re);if(starts_with(i)){n=e.match(combine_chr_re);if(n&&n.index===1){return e.slice(0,3)}return e.slice(0,2)}else{return e[0]}}}function normalize_position(e,r){if(r===0){return r}e=$.terminal.strip(e);var t=$.terminal.split_characters(e).reduce(function(e,t){if(typeof e==="number"){return e}var n=e.length+char_len(t);if(n>=r){return e.position+1}return{position:e.position+1,length:n}},{position:0,length:0});if(typeof t==="number"){return t}else{return t.position}}function 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,""")}function char_width_object(e,t){var n={};if(e===0){n["width"]="1px"}else if(is_ch_unit_supported){n["width"]=e+"ch"}else if(!is_css_variables_supported){if(t.charWidth){n["width"]=t.charWidth*e+"px"}}else{n["--length"]=e}return n}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 n=bare_text(e);var r=strlen(n);if(r>1&&r!==$.terminal.length(n)){return char_width_object(r,t)}}}function wide_characters(e,n){if(typeof wcwidth!=="undefined"){var t=bare_text(e);var r=$.terminal.split_characters(t);if(r.length===1){return e}var i=r.map(function(e){return{len:strlen(e),chr:e}}).reduce(function(e,t){var n=e[e.length-1];if(n){if(n.len!==t.len){return e.concat([{sum:t.len,len:t.len,specs:[t]}])}else{e.pop();return e.concat([{sum:n.sum+t.len,len:n.len,specs:n.specs.concat(t)}])}}return[{sum:t.len,specs:[t],len:t.len}]},[]);return i.map(function(e){if(e.len===1){return u(e)}var t=char_width_prop(e.sum,n);if(e.sum===r.length||!t.length){return"<span>"+u(e)+"</span>"}else if(e.specs.length>1){return a(t,e.specs.map(function(e){return a(char_width_prop(e.len),e.chr)}).join(""))}else{return a(t,u(e))}}).join("")}function u(e){return e.specs.map(function(e){return e.chr}).join("")}function a(e,t){return'<span style="'+e+'">'+t+"</span>"}return e}function binary_search(e,t,n,r,i){var u=t-e;var a=e+Math.floor(u/2);var o=[n,a].concat(i);var s=r.apply(null,o);if(s===0){return a}else if(s>0&&u>1){return binary_search(a,t,n,r,i)}else if(s<0&&u>1){return binary_search(e,a,n,r,i)}else{return-1}}function is_terminal_selected(e){if(is_function(window.getSelection)){var t=window.getSelection();if(t.toString()){var n=t.getRangeAt(0).startContainer.parentNode;var r=$(n).closest(".terminal");return r.length&&(e&&r.find(".cmd").is(e)||!e)}}}function get_selected_html(){var e="";if(is_function(window.getSelection)){var t=window.getSelection();if(t.rangeCount){var n=document.createElement("div");for(var r=0,i=t.rangeCount;r<i;++r){n.appendChild(t.getRangeAt(r).cloneContents())}e=n.innerHTML}}return e}function with_selection(e){var t="";var n=[];if(is_function(window.getSelection)){var r=window.getSelection();if(r.rangeCount){var i=document.createElement("div");for(var u=0,a=r.rangeCount;u<a;++u){var o=r.getRangeAt(u).cloneRange();n.push(o);i.appendChild(o.cloneContents())}t=i.innerHTML}}e(t);if(n.length){r.removeAllRanges();n.forEach(function(e){r.addRange(e)})}return t!==""}function process_selected_line(){var e=$(this);var t=e.text();if(e.hasClass("cmd-end-line")){t+="\n"}return t}function process_div(e){return $(e).find("> div, > span").map(process_selected_line).get().join("\n").replace(/\n$/,"")}function process_selected_html(e){var t;var n="";var r=$("<div>"+e+"</div>");if(e.match(/<\/div>/)){t=r.find("div[data-index]").map(function(){return process_div(this)}).get().join("\n");if(!t&&e.match(/style="width: 100%;?"/)){t=process_div(r)}n=t}var i=r.find(".cmd-prompt");if(i.length){if(n.length){n+="\n"}n+=i.text()}var u=r.find('[role="presentation"]');if(u.length){n+=u.map(process_selected_line).get().join("")}if(!n.length&&e){n=r.text()}return n.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,n){var r=t.val();var i=t.is(":focus");var u=t.caret();if(window.navigator&&window.navigator.clipboard){navigator.clipboard.writeText(n)}else if(i){t.val(n).focus();t[0].select();document.execCommand("copy");t.val(r);t.caret(u)}else{var a=$("<textarea/>").css({position:"fixed",top:0,left:0}).appendTo("body");a.val(n).focus();a[0].select();document.execCommand("copy");a.blur();a.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 n="selectionStart"in t;t=null;if(n){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,n){if(!t.length){return""}var r=string_case(e);var i=[];for(var u=e.length;u<t[0].length;++u){var a=false;var o=t[0].charAt(u),s=o.toLowerCase();for(var l=1;l<t.length;++l){a=true;var f=t[l].charAt(u),c=f.toLowerCase();if(o!==f){if(n||r==="mixed"){a=false;break}else if(s===c){if(r==="lower"){o=o.toLowerCase()}else if(r==="upper"){o=o.toUpperCase()}else{a=false;break}}else{a=false;break}}}if(a){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 n=root.getSelection();n.setBaseAndExtent(e,0,t,1)}}else{return function(e,t){var n=root.getSelection();var r=document.createRange();r.setStart(e,0);r.setEnd(t,t.childNodes.length);n.removeAllRanges();n.addRange(r)}}}else{return $.noop}}();function process_command(e,t){var n=e.trim();var r=n.match(command_re)||[];if(r.length){var i=r.shift();var u=$.map(r,function(e){if(e.match(/^["']/)){e=e.replace(/\n/g,"\\u0000\\u0000\\u0000\\u0000");e=t(e);return e.replace(/\x00\x00\x00\x00/g,"\n")}return t(e)});var a=$.map(r,function(e){var t=e.match(/^(['"`]).*\1$/);return t&&t[1]||""});var o=n.slice(i.length).trim();return{command:e,name:i,args:u,args_quotes:a,rest:o}}else{return{command:e,name:"",args:[],args_quotes:[],rest:""}}}function on_height_change(t){var n=window.visualViewport.height;t(n);window.visualViewport.addEventListener("resize",function(){var e=window.visualViewport.height;if(n!==e){n=e;t(n)}})}$.terminal={version:"2.40.5",date:"Sat, 27 Apr 2024 14:23:24 +0000",color_names:["transparent","currentcolor","black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","rebeccapurple"],Cycle:Cycle,History:History,Stack:Stack,valid_color:function e(t){if(t.match(color_re)){return true}else{return $.inArray(t.toLowerCase(),$.terminal.color_names)!==-1}},unclosed_strings:function e(t){return!!t.match(unclosed_strings_re)},escape_regex:function e(t){if(typeof t==="string"){var n=/([-\\^$[\]()+{}?*.|])/g;return t.replace(n,"\\$1")}},have_formatting:function e(t){return typeof t==="string"&&!!t.match(format_exist_re)},is_formatting:function e(t){return typeof t==="string"&&!!t.match(format_full_re)},is_extended_command:function e(t){return typeof t==="string"&&t.match(format_exec_re)&&!$.terminal.is_formatting(t)},each_extended_command:function(e,n){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 n(t)||""}return e}).join("")},format_split:function e(t){return t.split(format_split_re).filter(Boolean)},tracking_replace:function e(t,n,r,i){if(!(n instanceof RegExp)){throw new Error("tracking_replace: Second argument need to be RegExp")}function u(e,t,n){return e.slice(t,n)}function a(e){return $.terminal.strip(e).length}var o="";var s;var l=0;var f;var c=i;var p;n.lastIndex=0;while(s=n.exec(t)){if(n.global){var m=a(u(t,0,n.lastIndex));p=m-a(s[0])}else{p=s.index;m=p+a(s[0])}if(l<p){o+=u(t,l,p)}l=m;if(typeof r==="function"){f=r.apply(null,s)}else{f=r.replace(/\$(\$|\d)/g,function(e,t){if(t==="$"){return"$"}return s[t]})}o+=f;if(p<i){var D=a(f);D+=count_selfclosing_formatting(f);if(m<i){c=Math.max(0,c+D-a(s[0]))}else{c+=D-(i-p)}}if(!n.global){break}}if(l<a(t)){o+=u(t,l)}if(t===o){return[t,i]}return[o,c]},iterate_formatting:function z(t,e){function n(e){return e===" "||e==="\t"||e==="\n"}function r(e){if(!d){return n(t[e-1])}return t.slice(e-6,e)===" "||n(t[e-1])}function i(e){if(!d){return null}return t.slice(e).match(entity_re)}function u(e){return t[e]==="["&&t[e+1]==="["}function a(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 r(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=u(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(a(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(r,t){var n=$.extend({wrap:true},t);if(!$.terminal.have_formatting(r)){var i=$.terminal.split_characters(r);return i.map(a)}var u=[];function a(e){if(e.match(/\\$/)){e+="\\"}return"[[;;]"+e+"]"}function o(e){if($.terminal.is_formatting(e)){if(e.match(/\\]$/)){e=e.replace(/\\]/g,"\\\\]")}}else if(n.wrap){e=a(e)}return e}$.terminal.iterate_formatting(r,function e(t){if(t.text){var n=[];if(t.formatting){n.push(t.formatting)}n.push(r.substring(t.index,t.index+t.size));if(t.formatting){n.push("]")}u.push(o(n.join("")))}});return u},substring:function e(t,n,r){var i=$.terminal.split_characters(t);if(!i.slice(n,r).length){return""}if(!$.terminal.have_formatting(t)){return i.slice(n,r).join("")}var u=0;var a;var o="";var s="";var l;var f=1;$.terminal.iterate_formatting(t,function e(t){if(n&&t.count===n+1){u=t.index;if(t.formatting){o=t.formatting}}if(r&&t.count===r){s=t.formatting;l=t.index;f=t.size}if(t.count===r+1){a=t.index;if(t.formatting){a=l+f}}});if(n&&!u){return""}if(a===undefined){a=t.length}t=o+t.slice(u,a);if(s){t=t.replace(/(\[\[^\]]+)?\]$/,"");t+="]"}return t},normalize:function e(t){t=t.replace(format_re,function e(t,n,r){if(n.match(self_closing_re)&&r===""){return"[["+n+"] ]"}if(r===""){return""}function i(e){return e.replace(/\\\]/g,"]").replace(/\n/g,"\\n").replace(/ /g," ")}n=i(n);var u=n.match(/;/g).length;if(u>=4){var a=n.split(/;/);var o=a.slice(0,4).join(";");var s=a.slice(4).join(";");return"[["+o+";"+(s||r)+"]"+r+"]"}else if(u===2){u=";;"}else if(u===3){u=";"}n+=u+i(r);return"[["+n+"]"+r+"]"});return $.terminal.amp(t)},split_equal:function e(t,p,n){if(typeof n==="boolean"){n={keepWords:n}}var m=$.extend({trim:false,keepWords:false},n);var D="";var d=[];var r=$.terminal.normalize(t).split(/\n/g);var i=$.terminal.have_formatting(t);for(var u=0,a=r.length;u<a;++u){if(r[u]===""){d.push("");continue}var h=r[u];var v=make_next_char_fun(h);var g=0;var _;var y=h.length;var b=/\[\[[^\]]+\](?:[^\][]|\\\])+\]$/.test(h);var C=/^( |\s)/.test(h);if(!i&&y<p){d.push(h);continue}$.terminal.iterate_formatting(h,function e(t){var n,r;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 u=text(h).substring(t.space_count);u=u.slice(0,p).replace(/\s+$/,"");var a=strlen(u);if(space_re.test(u)||a<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{r=h.slice(t.index);n=v(r);_=h.slice(g,t.index)+n;if(t.last&&b&&n!=="]"){_+="]"}s=t.index+n.length-1}if(m.trim||m.keepWords){_=_.replace(/( |\s)+$/g,"")}if(!C&&!D){_=_.replace(/^( |\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:function e(t){return t.replace(/&(?!#[0-9]+;|#x[0-9a-f]+;|[a-z]+;)/gi,"&")},encode:function e(t,n){var s=$.extend({tabs:4,before:""},n);return $.terminal.amp(t).replace(/</g,"<").replace(/>/g,">").replace(/ /g," ").split("\n").map(function(e){var o=e.split(/((?:\[\[[^\]]+\])?\t(?:\])?)/);o=o.filter(Boolean);return o.map(function(e,a){if(e.match(/\t/)){return e.replace(/\t([^\t]*)$/,function(e,t){if(a!==0&&o[a-1].match(/\t\]?$/)){var n=new Array(s.tabs+1).join(" ");return n+t}else{var r=o.slice(a-1,a).join("");if(s.before&&a<=1){r=s.before+r}var i=$.terminal.length(r);var u=s.tabs-i%s.tabs;if(u===0){u=4}return new Array(u+1).join(" ")+t}})}return e}).join("")}).join("\n")},nested_formatting:function e(t){if(!$.terminal.have_formatting(t)){return t}var u=[];var n=/((?:\[\[(?:[^\][]|\\\])+\])?(?:[^\][]|\\\])*\]?)/;var a=/\[\[([^\][]+)\][\s\S]*/;var o=/^\[\[([^;]*);([^;]*);([^\]]*)\]/;var f=3;var c=5;function r(e,t,n){return n.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 n=t[0];var r=t[1];i[n]=r});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(r).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 n=e.style;var r=i[c].style;e.style=p(n,r);i[c]=$.extend(e,i[c],{style:p(n,r)})}else{i[c]=$.extend(e,i[c])}}catch(e){warn("Invalid JSON "+t)}}var i=[[],"",""];if(!e.length){return i}for(var n=e.length;n--;){var r=$.terminal.parse_formatting(e[n]);if(r.length>5){var u=r.slice(5).join(";");r=r.slice(0,5).concat(u)}var a=r[0].split(/(-?[@!gbiuso])/g).filter(Boolean);a.forEach(function(e){if(i[0].indexOf(e)===-1){i[0].push(e)}});for(var o=1;o<r.length;++o){var s=r[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(n).filter(Boolean).map(function(e){var t;if(e.match(/^\[\[/)&&!$.terminal.is_extended_command(e)){var n=e.replace(a,"$1");var r=$.terminal.is_formatting(e);e=e.replace(o,"");u.push(n);if($.terminal.nested_formatting.__inherit__){t=h(u)}else{t=n}if(!r){e+="]"}else{u.pop()}e="[["+t+"]"+e}else{var i=false;if(e.match(/\]/)){i=true}if(u.length){if($.terminal.nested_formatting.__inherit__){t=h(u)}else{t=u[u.length-1]}e="[["+t+"]"+e}if(i){u.pop()}else if(u.length){e+="]"}}return e}).join("")},escape_formatting:function e(t){return $.terminal.escape_brackets(t)},apply_formatters:function e(t,u){if(t===""){if(u&&typeof u.position==="number"){return["",u.position]}else{return""}}function i(e,t,n,r){if(!e.__no_warn__&&$.terminal.length(n)!==$.terminal.length(r)){warn("Your formatter["+t+"] change length of the string, "+"you should use [regex, replacement] formatter or function "+" that return [replacement, position] instead")}}function p(t){if(!u||!t){return true}var e=["echo","command","prompt"];var n=e.some(function(e){return t[e]===true});if(!n){return true}for(var r=e.length;r--;){var i=e[r];if(t[i]===true&&u[i]===true){return true}}return false}u=u||{};var n=u.formatters||$.terminal.defaults.formatters;var m=0;function D(e,t){var n=$.extend({},u,{position:t[1]});var r=e(t[0],n);if(typeof r==="string"){i(e,m-1,r,t[0]);if(typeof r==="string"){return[r,n.position]}return t}else if(is_array(r)&&r.length===2){return r}else{return t}}var r;if(typeof u.position==="number"){r=[t,u.position]}else{r=[t,0]}try{var a=n.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 n=text(e).length;if(o[1]<l+n&&!f){t=o[1]-l;f=true}else if(f){t=-1}else{t=o[1]}var r=l;var i;l+=n;if($.terminal.is_formatting(e)){if(f){return[e,t]}return[e,-1]}else{if(is_array(s)){var u=s[2]||{};i=[e,t<0?0:t];if(i[0].match(s[0])&&p(s[2])){if(u.loop){while(i[0].match(s[0])){i=$.terminal.tracking_replace(i[0],s[0],s[1],i[1])}}else{i=$.terminal.tracking_replace(i[0],s[0],s[1],i[1])}}if(t<0){return[i[0],-1]}}else if(typeof s==="function"){i=D(s,[e,t])}if(typeof i!=="undefined"){if(i[1]!==-1){i[1]+=r}var a=text(i[0]).length;if(a!==n){}return i}return[e,-1]}});var n=t.filter(function(e){return e[1]!==-1})[0];var r=t.map(function(e){return e[0]}).join("");var i;if(typeof n==="undefined"){i=o[1]}else{i=n[1]}var u=text(r).length;u+=count_selfclosing_formatting(r);if(i>u){i=u}if(r===o[0]){return o}var a=$.terminal.strip(o[0]);var c=$.terminal.strip(r);if(a===c){return[r,o[1]]}return[r,i]}},r);if(typeof u.position==="number"){var o=$.terminal.strip(a[0]).length;if($.terminal.length(a[0])<o){var s=a[1];s=normalize_position(a[0],s);var l=$.terminal.length(a[0]);if(s>l){s=l}a[1]=s}return a}else{return a[0]}}catch(e){var f="Error in formatter ["+(m-1)+"]";n.splice(m-1);throw new $.terminal.Exception("formatting",f,e.stack)}},escape_brackets:function e(t){return t.replace(/\[/g,"[").replace(/\]/g,"]").replace(/\\/g,"\")},unescape_brackets:function e(t){return t.replace(/[/g,"[").replace(/]/g,"]").replace(/\/g,"\\")},length:function e(t,n){if(!t){return 0}return $.terminal.split_characters(n?t:text(t)).length},split_characters:function e(t){if(is_simple_text(t)){return t.split("")}var n=[];var r=make_next_char_fun(t);while(t.length){var i=r(t);t=t.slice(i.length);n.push(i)}return n},columns:function e(t,n,r){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 u=i.map(function(e){return strlen(e)});if(typeof r==="undefined"){r=4}var a=Math.max.apply(null,u)+r;var o=Math.floor(n/a)-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 n=$.terminal.strip(t);var r=new Array(a-n.length+1).join(" ");e.push(t+r);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,n){function r(e){return e.split(string_re).map(function(e){if(e.match(/^['"`]/)){if(e==='""'||e==="''"||e==="``"){return""}var t=e[0];var n=new RegExp("(\\\\\\\\(?:\\\\\\\\)*)"+t,"g");e=e.replace(n,"$1").replace(/^[`'"]|[`'"]$/g,"");if(t==="'"){e=e.replace(/"/g,'\\"')}}e='"'+e+'"';return JSON.parse(e)}).join("")}if(n===false){if(t[0]==="'"&&t[t.length-1]==="'"){return t.replace(/^'|'$/g,"")}else if(t[0]==="`"&&t[t.length-1]==="`"){return t.replace(/^`|`$/g,"")}else if(t[0]==='"'&&t[t.length-1]==='"'){return t.replace(/^"|"$/g,"").replace(/\\([" ])/g,"$1")}else if(t.match(/\/.*\/[gimy]*$/)){return t}else if(t.match(/['"`]]/)){return r(t)}else{return t.replace(/\\ /g," ")}}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 r(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,n){var a=$.extend({},{boolean:[]},n);if(typeof t==="string"){return e($.terminal.split_arguments(t),n)}var o={_:[]};function s(e){this.value=e}var r=t.reduce(function(e,t){var n=typeof t==="string"?t:"";if(n.match(/^--?[^-]/)&&e instanceof s){o[e.value]=true}if(n.match(/^--[^-]/)){var r=n.replace(/^--/,"");if(a.boolean.indexOf(r)===-1){return new s(r)}else{o[r]=true}}else if(n.match(/^-[^-]/)){var i=n.replace(/^-/,"").split("");if(a.boolean.indexOf(i.slice(-1)[0])===-1){var u=i.pop()}i.forEach(function(e){o[e]=true});if(u){return new s(u)}}else if(e instanceof s){o[e.value]=t}else if(t){o._.push(t)}return null},null);if(r instanceof s){o[r.value]=true}return o},parse_formatting:function(e){var t=$.terminal.unescape_brackets(e).split(";");var n=4;if(t.length>=5){var r=$.terminal.escape_brackets(t[n]);t[n]=r}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 n(e){if($.terminal.is_formatting(e)){if(e.match(/\]\\\]/)){e=e.replace(/\]\\\]/g,"]\\\\]")}}return e}if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){var r=$.terminal.length(t);var i=0;var e={};e[Symbol.iterator]=function(){return{next:function(){if(i<r){var e=$.terminal.substring(t,i,i+1);i++;return{value:n(e)}}else{return{done:true}}}}};return e}},formatter:new function(){try{this[Symbol.split]=function(e){return $.terminal.format_split(e)};this[Symbol.match]=function(e){return e.match(format_re)};this[Symbol.replace]=function(e,t){return e.replace(format_parts_re,t)};this[Symbol.search]=function(e){return e.search(format_re)}}catch(e){}},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 n=t.pop();for(var r=1;r<=2;++r){if(!$.terminal.valid_color(t[r])){t[r]=""}}return t.slice(1,4).concat(n)}else{return["","","",e]}})},new_formatter:function(e){$.terminal.defaults.formatters.unshift(e)}};(function(){function F(e,t){if(e===""){return t}else{return e.replace(/]/g,"]").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""")}}function s(e){return e.match(/^\.{1,2}\//)||e.match(/^\//)||!(e.match(/\//)||e.match(/^[^:]+:/))}function l(n,r){return function(e){if(r.anyLinks){return true}var t=n(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 u=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 n=g.allowedAttributes;for(var r=0;r<n.length;++r){if(n[r]instanceof RegExp){if(n[r].test(e)){t=true;break}}else if(n[r]===e){t=true;break}}return t})}return[]}function y(n,r,e){if(r){if(e.length){var i;var t=e.map(function(e){if(r[e]===null){return""}if(r[e]===true){return e}var t=escape_html_attr(r[e]);if(e==="style"){t=t?n+";"+t:n;i=true}return e+'="'+t+'"'}).filter(Boolean);if(!t.length){return""}if(!i&&n){t.push('style="'+n+'"')}return t.join(" ")}}if(!n){return""}return'style="'+n+'"'}function r(){var e=["noopener"];if(g.linksNoReferrer){e.unshift("noreferrer")}if(g.linksNoFollow){e.unshift("nofollow")}return e}var a=r().join(" ");function b(e,t,n){if(e.match(email_re)){return'<a href="mailto:'+e+'"'}else{var r=["<a"];if(e&&u(e)){r.push('href="'+e+'"')}if(t){if(n.includes("target")&&t.target===undefined){t.target="_blank"}if(n.includes("rel")&&t.rel===undefined){t.rel=a}}else{r.push('rel="'+a+'"');r.push('target="_blank"')}return r.join(" ")}}function C(e){var t="<img";if(n(e)){t+=' src="'+e+'"';if(text){t+=' alt="'+text+'"'}}return t}function i(e,t,n,r,i,u,a){var o;var s=[];if(u.match(/;/)){try{var l=u.split(";");var f=l.slice(1).join(";").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">");if(f.match(/^\s*\{[^}]*\}\s*$/)){o=JSON.parse(f);s=_(Object.keys(o));u=l[0]}}catch(e){}}if(a===""&&!t.match(/@/)){return""}a=safe(a);a=a.replace(/\\\]/g,"]");if(g.escape){a=a.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($.terminal.valid_color(n)){$.extend(c,{color:n,"--color":n,"--original-color":n});if(t.indexOf("!")!==-1){c["--link-color"]=n}if(t.indexOf("g")!==-1){c["text-shadow"]="0 0 5px "+n}}if($.terminal.valid_color(r)){$.extend(c,{"background-color":r,"--background":r})}var m=F(u,a);var D=extra_css(a,g);if(D){a=wide_characters(a,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)}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>"+a+"</a>"}else if(t.indexOf("@")!==-1){d+=" data-text/>"}else{d+=' data-text="'+m+'">'+"<span>"+a+"</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(/ /g," ")});return e.replace(format_parts_re,i)}else{e=safe(e);e=e.replace(/\\\]/,"]");var t=F(e);var n=extra_css(e,g);var r;if(n){e=wide_characters(e,g);r='<span style="'+style_to_string(n)+'"'}else{r="<span"}return r+' data-text="'+t+'">'+e+"</span>"}}).join("");return e.replace(/<span><br\s*\/?><\/span>/gi,"<br/>")}else{return""}}})();$.terminal.Exception=function e(t,n,r){if(arguments.length===1){this.message=arguments[0];this.type="TERMINAL"}else{this.type=t;this.message=n;if(r){this.stack=r}}};$.terminal.Exception.prototype=new Error;$.terminal.Exception.prototype.toString=function(){return this.message+"\n"+this.stack};$.fn.visible=function(){return this.css("visibility","visible")};$.fn.hidden=function(){return this.css("visibility","hidden")};var warnings=[];function warn(e){e="[jQuery Terminal] "+e;if(warnings.indexOf(e)===-1){warnings.push(e);if(console){if(console.warn){console.warn(e)}else if(console.log){console.log(e)}}else{setTimeout(function(){throw new Error("WARN: "+e)},0)}}}var ids={};$.jrpc=function(e,t,n,r,i){var o=new $.Deferred;var s;if($.isPlainObject(e)){s=e}else{s={url:e,method:t,params:n,success:r,error:i}}function u(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,n,r){if(u(e)||s.method==="system.describe"){if(s.success){s.success(e,n,r)}o.resolve(e)}else{if(s.error){s.error(r,"Invalid JSON-RPC")}o.reject({message:"Invalid JSON-RPC",response:t})}}$.ajax({url:s.url,beforeSend:function e(t,n){if(is_function(s.request)){s.request(t,l)}n.data=JSON.stringify(l)},success:function e(t,n,r){var i=r.getResponseHeader("Content-Type");if(!i.match(/(application|text)\/json/)){warn("Response Content-Type is neither application/json"+" nor text/json")}var u;try{u=JSON.parse(t)}catch(e){if(s.error){s.error(r,"Invalid JSON",e)}else{throw new $.terminal.Exception("JSON","Invalid JSON",e.stack)}o.reject({message:"Invalid JSON",response:t});return}if(is_function(s.response)){s.response(r,u)}if(is_function(s.intercept)){var a=s.intercept(l,u);if(a){return unpromise(a,function(e){var t=JSON.stringify(e);f(e,t,n,r)})}}f(u,t,n,r)},error:s.error,contentType:"application/json",dataType:"text",async:true,cache:false,type:"POST"});return o.promise()};$.rpc=function(e,t,n){var r=new $.Deferred;function i(e){if(e.error){r.reject(e.error)}else{r.resolve(e.result)}}function u(e,t,n){r.reject({message:n})}$.jrpc(e,t,n,i,u);return r.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 n=e.find(".cmd-prompt").clone().css({visiblity:"hidden",position:"absolute"});n.appendTo(e.find(".cmd")).html(" ").wrap('<div class="cmd-wrapper"/>');t={width:n.width(),height:n.height()};n.parent().remove()}else{var r=$('<div class="terminal terminal-temp"><div class="terminal-'+'wrapper"><div class="terminal-output"><div><div class="te'+'rminal-line" style="float: left"><span> </span></div'+'></div></div><div class="terminal-pixel"></div></div>').appendTo("body");r.addClass(e.attr("class")).attr("id",e.attr("id"));if(e){var i=e.attr("style");if(i){i=i.split(/\s*;\s*/).filter(function(e){return!e.match(/display\s*:\s*none/i)}).join(";");r.attr("style",i)}}var u=r.find(".terminal-line");t={width:u.width(),height:u.height()};r.remove()}return t}function get_num_chars(e,t){var n=e.find(".terminal-fill").width();var r=Math.floor(n/t.width);return r||1e3}function get_num_rows(e,t){var n=e.find(".terminal-fill");var r=n.height();return Math.floor(r/t.height)}function all(e,t){var n=e.filter(function(e){return e[t]()===e});return n.length===e.length}function string_case(e){var t=e.split("");if(all(t,"toLowerCase")){return"lower"}else if(all(t,"toUpperCase")){return"upper"}else{return"mixed"}}function same_case(e){return string_case(e)!=="mixed"}function is_function(e){return get_type(e)==="function"}function is_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 n=Array.from(document.fonts.keys());var r=n.find(function(e){return e.family===t});return!!r}function get_type(e){if(typeof e==="function"){return"function"}if(e===null){return e+""}if(Array.isArray(e)){return"array"}if(typeof e==="object"){return"object"}return typeof e}var version_set=!$.terminal.version.match(/^\{\{/);var copyright="Copyright (c) 2011-2023 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-2023 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,linksNoReferrer:false,externalPause:true,useCache:true,anyLinks:false,linksNoFollow:false,processRPCResponse:null,completionEscape:true,mobileDelete:is_mobile,convertLinks:true,extra:{},tabs:4,historySize:60,scrollObject:null,historyState:false,importHistory:false,historyFilter:null,echoCommand:true,scrollOnEcho:true,login:null,outputLimit:-1,formatters:[$.terminal.nested_formatting],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"}};var requests=[];var terminals=new Cycle;var save_state=[];var hash_commands;var change_hash=false;var fire_hash_change=true;var first_instance=true;$.fn.terminal=function(e,t){function n(n){if(n){this.storage={}}this.set=function(e,t){if(n){this.storage[e]=t}else{$.Storage.set(e,t)}};this.get=function(e){if(n){return this.storage[e]}else{return $.Storage.get(e)}};this.remove=function(e){if(n){delete this.storage[e]}else{$.Storage.remove(e)}}}function N(e){if($.terminal.unclosed_strings(e)){var t=$.terminal.escape_brackets(e);var n=sprintf(c().invalidStrings,"`"+t+"`");throw new $.terminal.Exception(n)}else if(is_function(E.processArguments)){return process_command(e,E.processArguments)}else if(E.processArguments){return $.terminal.parse_command(e)}else{return $.terminal.split_command(e)}}function M(e,n){n=n||{};if($.terminal.Animation&&e instanceof $.terminal.Animation){e.start(F);return false}if(is_function(E.renderHandler)){return unpromise(e,function(e){try{var t=E.renderHandler.call(F,e,n,F);if(t===false){return false}if(typeof t==="string"||q(t)||is_promise(t)){return t}else{return e}}catch(e){return["[[;red;]"+e.message+"]",format_stack_trace(e.stack)].join("\n")}})}return e}function o(t,n){if(q(t)){var e=$.extend({},n,{raw:true,finalize:function(e){e.find(".terminal-render-item").replaceWith(t);if(n&&is_function(n.finalize)){n.finalize(e,F)}}});return['<div class="terminal-render-item"/>',e]}}function H(e,t){var n=o(e,t);if(n){F.echo.apply(F,n);return true}}function W(e){return w.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(typeof e==="string"){F.echo(e)}else if(is_array(e)){F.echo($.map(e,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof e==="object"){F.echo(JSON.stringify(e))}else{F.echo(e)}}function K(e,a){var t=/(.*):([0-9]+):([0-9]+)$/;var o=e.match(t);if(o){F.pause(E.softPause);$.get(o[1],function(e){var t=o[1];var n=e.split("\n");var i=+o[2]-1;var r=i>2?i-2:0;var u=n.slice(r,i+3).map(function(e,t){var n="["+(i+t-1)+"]: ";var r=a-n.length-4;if(e.length>r){e=e.substring(0,r)+"..."}if(i>2?t===2:t===i){e="[[;#f00;]"+$.terminal.escape_brackets(e)+"]"}return n+e}).filter(Boolean).join("\n");if(u.length){F.echo("[[b;white;]"+t+"]");F.echo(u).resume()}},"text")}}function J(e){if(is_function(E.onRPCError)){E.onRPCError.call(F,e)}else{F.error("[RPC] "+e.message);if(e.error&&e.error.message){e=e.error;var t="\t"+e.message;if(e.file){t+=' in file "'+e.file.replace(/.*\//,"")+'"'}if(e.at){t+=" at line "+e.at}F.error(t)}}}function Q(n,r){var i;if(E.rpc){i=function(){return E.rpc.apply(F,arguments)}}var u=function(e,t){F.pause(E.softPause);$.jrpc({url:n,method:e,params:t,request:function(e,t){try{E.request.call(F,e,t,F)}catch(e){m(e,"USER")}},intercept:i,response:function(e,t){try{E.response.call(F,e,t,F)}catch(e){m(e,"USER")}},success:function e(t){if(t.error){J(t.error)}else if(is_function(E.processRPCResponse)){E.processRPCResponse.call(F,t.result,F)}else if(t.result!==null){U(t.result)}F.resume()},error:V})};return function(e,t){if(e===""){return}try{e=N(e)}catch(e){m(e,"TERMINAL (get_processed_command)");return}if(!r||e.name==="help"){u(e.name,e.args)}else{var n=t.token(true);if(n){u(e.name,[n].concat(e.args))}else{t.error("[AUTH] "+c().noTokenError)}}}}function Y(a,o,s,l){return function(e,t){if(e===""){return}var n;try{n=N(e)}catch(e){if(is_function(E.exception)){E.exception(e,F)}else{F.error("Error: "+(e.message||e))}return}var r=a[n.name];var i=get_type(r);if(i==="function"){if(o&&r.length!==n.args.length){F.error("[Arity] "+sprintf(c().wrongArity,n.name,r.length,n.args.length))}else{return r.apply(F,n.args)}}else if(i==="object"||i==="string"){var u=[];if(i==="object"){u=Object.keys(r);r=Y(r,o,s)}t.push(r,{prompt:n.name+"> ",name:n.name,completion:i==="object"?u:undefined})}else if(is_function(l)){l(e,F)}else if(is_function(E.onCommandNotFound)){E.onCommandNotFound.call(F,e,F)}else{t.error(sprintf(c().commandNotFound,n.name))}}}function V(e,t,n){F.resume();if(is_function(E.onAjaxError)){E.onAjaxError.call(F,e,t,n)}else if(t!=="abort"){F.error("[AJAX] "+t+" - "+c().serverResponse+":\n"+$.terminal.escape_brackets(e.responseText))}}function G(u,o,r){function s(e){if(e.error){J(e.error)}else if(is_function(E.processRPCResponse)){E.processRPCResponse.call(F,e.result,F)}else{U(e.result)}F.resume()}function l(e,t){try{E.request.call(F,e,t,F)}catch(e){m(e,"USER")}}function f(e,t){try{E.response.call(F,e,t,F)}catch(e){m(e,"USER")}}function e(e){var n=e;if(E.describe!==false&&E.describe!==""){E.describe.split(".").forEach(function(e){n=n[e]})}if(n&&n.length){var t={};$.each(n,function(e,i){if($.isPlainObject(i)&&typeof i.name==="string"){t[i.name]=function(){var e=o&&i.name!=="help";var t=Array.prototype.slice.call(arguments);var n=t.length+(e?1:0);if(E.checkArity&&i.params&&i.params.length!==n){F.error("[Arity] "+sprintf(c().wrongArity,i.name,i.params.length,n))}else{F.pause(E.softPause);if(e){var r=F.token(true);if(r){t=[r].concat(t)}else{F.error("[AUTH] "+c().noTokenError)}}$.jrpc({url:u,method:i.name,params:t,request:l,response:f,success:s,error:V})}}}});var a=typeof o==="string"?o:"login";t.help=t.help||function(i){if(typeof i==="undefined"){var e=n.map(function(e){return e.name}).join(", ")+", help";F.echo("Available commands: "+e)}else{var u=false;$.each(n,function(e,t){if(t.name===i){u=true;var n="";n+="[[bu;;]"+t.name+"]";if(t.params){var r=t.params;if(o&&t.name!==a){r=r.slice(1)}n+=" "+r.join(" ")}if(t.help){n+="\n"+t.help}F.echo(n);return false}});if(!u){if(i==="help"){F.echo("[[bu;;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var t="Method `"+i+"' not found ";F.error(t)}}}};r(t)}else{r(null)}}return $.jrpc({url:u,method:"system.describe",params:[],success:e,request:l,response:f,error:function e(){r(null)}})}function X(t,a,n){n=n||$.noop;var e=get_type(t);var o;var r={};var s=0;var l;if(e==="array"){o={};(function t(e,n){if(e.length){var r=e[0];var i=e.slice(1);var u=get_type(r);if(u==="string"){if(E.describe===false){if(++s===1){l=Q(r,a)}else{F.error(c().oneRPCWithIgnore)}t(i,n)}else{F.pause(E.softPause);G(r,a,function(e){if(e){$.extend(o,e)}else if(++s===1){l=Q(r,a)}else{F.error(c().oneRPCWithIgnore)}F.resume();t(i,n)})}}else if(u==="function"){if(l){F.error(c().oneInterpreterFunction)}else{l=r}t(i,n)}else if(u==="object"){$.extend(o,r);t(i,n)}}else{n()}})(t,function(){n({interpreter:Y(o,false,a,l&&l.bind(F)),completion:Object.keys(o)})})}else if(e==="string"){if(E.describe===false){o={interpreter:Q(t,a)};if(Array.isArray(E.completion)){o.completion=E.completion}n(o)}else{F.pause(E.softPause);G(t,a,function(e){if(e){r.interpreter=Y(e,false,a);r.completion=Object.keys(e)}else{r.interpreter=Q(t,a)}n(r);F.resume()})}}else if(e==="object"){n({interpreter:Y(t,E.checkArity,a),completion:Object.keys(t)})}else{if(e==="undefined"){t=$.noop}else if(e!=="function"){var i=e+" is invalid interpreter value";throw new $.terminal.Exception(i)}n({interpreter:t,completion:E.completion})}}function Z(r,e){var i=get_type(e)==="boolean"?"login":e;return function(e,t,n){F.pause(E.softPause);$.jrpc({url:r,method:i,params:[e,t],request:function(e,t){try{E.request.call(F,e,t,F)}catch(e){m(e,"USER")}},response:function(e,t){try{E.response.call(F,e,t,F)}catch(e){m(e,"USER")}},success:function e(t){if(!t.error&&t.result){n(t.result)}else{n(null)}F.resume()},error:V})}}function m(e,t,n){if(is_function(E.exceptionHandler)){E.exceptionHandler.call(F,e,t)}else{F.exception(e,t);if(!n){setTimeout(function(){throw e},0)}}}function ee(e){function t(e,n,r,i,u,a,t){function o(e,t){return"[["+[n+(e||""),r,i,u,t||a].join(";")+"]"}function s(e){return"]"+o("!",e)+e+"]"+o()}if(!n.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("",a)+f+"]"}}return e}function n(e){return e.replace(email_re,"[[!;;]$1]").replace(url_nf_re,"[[!;;]$1]")}if(!$.terminal.have_formatting(e)){return n(e)}return $.terminal.format_split(e).map(function(e){if($.terminal.is_formatting(e)){return e.replace(format_parts_re,t)}else{return n(e)}}).join("")}function te(e,t){return(strlen(text(e))>t.cols||e.match(/\n/))&&(E.wrap===true&&t.wrap===undefined||E.wrap===false&&t.wrap===true)}var f;if("Map"in root){f=new Map}function ne(e,n,r){if(r.exec||n.options.clear_exec){return $.terminal.each_extended_command(e,function(e){if(r.exec){n.options.exec=false;n.options.clear_exec=true;var t=e.trim();if(d&&d===t){d="";F.error(c().recursiveLoop)}else{d=t;$.terminal.extended_command(F,e,{invokeMethods:r.invokeMethods}).then(function(){d=""})}}})}return e}function re(t){try{var e=!is_function(t.value);var n=$.extend({exec:true,raw:false,finalize:$.noop,useCache:e,invokeMethods:false,formatters:true,convertLinks:E.convertLinks},t.options||{});var r=gt(t.value);if(r&&is_function(r.then)){return r.then(function(e){re($.extend(t,{value:e,options:n}))})}if(r!==""){if(!n.raw){if(E.useCache&&n.useCache){var i=r;if(f&&f.has(i)){var u=f.get(i);y.append(u.input,t.index,n,u.raw);return true}}if(n.formatters){try{r=$.terminal.apply_formatters(r,$.extend(E,{echo:true}))}catch(e){m(e,"FORMATTING")}}r=ne(r,t,n);if(r===""){return}if(n.convertLinks){r=ee(r)}var a=r;r=crlf($.terminal.normalize(r));r=$.terminal.encode(r,{tabs:E.tabs});var o;var s=n.cols=F.cols();if(te(r,n)){o=$.terminal.split_equal(r,s,{keepWords:n.keepWords,trim:true})}else if(r.match(/\n/)){o=r.split(/\n/)}}}else{a=""}var l=o||r;if(f&&i&&e){f.set(i,{input:l,raw:a})}y.append(l,t.index,n,a)}catch(e){y.clear();if(is_function(E.exceptionHandler)){E.exceptionHandler.call(F,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){B.resize(u);var t=w.empty().detach()}try{y.clear();unpromise(x.render(F.rows(),function(e){return e.map(re)}),function(){F.flush(e);if(!e.update){B.before(t)}v("onAfterRedraw")})}catch(e){if(is_function(E.exceptionHandler)){E.exceptionHandler.call(F,e,"TERMINAL (redraw)")}else{alert_exception("[redraw]",e)}}}function ie(){if(E.outputLimit>=0){var e;if(E.outputLimit===0){e=F.rows()}else{e=E.outputLimit}var t=w.find("> div > div");if(t.length+1>e){var n=t.length-e+1;var r=t.slice(0,n);var i=r.parent();r.remove();i.each(function(){var e=$(this);if(e.is(":empty")){x.unmount(e);e.remove()}});x.limit_snapshot(n)}}}function ue(){if(E.greetings===undefined){F.echo(F.signature,{finalize:a11y_hide,formatters:false})}else if(E.greetings){var e=typeof E.greetings;if(e==="string"){F.echo(E.greetings)}else if(e==="function"){F.echo(function(){try{var e=new $.Deferred;var t=E.greetings.call(F,e.resolve);if(t){e.resolve(t)}return e.promise()}catch(e){E.greetings=null;m(e,"greetings")}})}else{F.error(c().wrongGreetings)}}}function ae(e){var t=B.mask();switch(typeof t){case"string":return e.replace(/./g,t);case"boolean":if(t){return e.replace(/./g,E.maskChar)}else{return $.terminal.escape_formatting(e)}}throw new $.terminal.Exception(c().invalidMask)}function h(n){if(typeof n==="undefined"){n=F.get_command()}var e=B.prompt(true);n=ae(n);var t={exec:false,formatters:false,convertLinks:false,finalize:function e(t){a11y_hide(t.addClass("terminal-command"));v("onEchoCommand",[t,n])}};n=$.terminal.apply_formatters(n,{command:true});F.echo(e+n,t)}function oe(){return j.outerWidth()!==F.outerWidth()}function se(e){var t=terminals.get()[e[0]];if(!t){throw new $.terminal.Exception(c().invalidTerminalId)}var n=e[1];if(save_state[n]){t.import_view(save_state[n])}else{change_hash=false;var r=e[2];if(r){t.exec(r).done(function(){change_hash=true;save_state[n]=t.export_view()})}}}function le(t){return function(e){F.error("["+t+"] "+(e.message||e)).resume()}}function fe(){if(change_hash){fire_hash_change=false;location.hash="#"+JSON.stringify(hash_commands);setTimeout(function(){fire_hash_change=true},100)}}var ce=true;var pe=[];function me(n,e,r){function t(){if(E.historyState||E.execHash&&r){if(!save_state.length){F.save_state()}else{F.save_state(null)}}}function i(){if(!r){change_hash=true;if(E.historyState){F.save_state(n,false)}change_hash=c}}function u(){f.resolve();v("onAfterCommand",[n])}function a(e,t){if(typeof e!=="undefined"){U(e)}u();if(t){F.resume()}}function o(e){return is_function(e.done||e.then)&&Ve}function s(){var e=l.interpreter.call(F,n,F);i();if(e){if(!Ue){if(o(e)){k=true}else if(is_promise(e)){F.pause(E.softPause)}}Ue=false;var t=le("Command");if(is_function(e.done||e.then)){return unpromise(e,function(e){a(e,true)},t)}else{return $.when(e).done(a).catch(t)}}else{if(r){B.refresh()}if(k){pe.push(function(){u()})}else{u()}if(r){return f.promise()}}}if(ce){ce=false;t()}try{if(v("onBeforeCommand",[n])===false){return}if(r){d=n.trim();D=$.terminal.split_command(d)}else{D=$.terminal.split_command(n)}if(!Fe()){if(r&&(is_function(E.historyFilter)&&E.historyFilter(n)||n.match(E.historyFilter))){B.history().append(n)}}var l=A.top();if(!e&&E.echoCommand){h(n)}var f=new $.Deferred;var c=change_hash;if(n.match(/^\s*login\s*$/)&&F.token(true)){i();if(F.level()>1){F.logout(true)}else{F.logout()}u()}else if(E.exit&&n.match(/^\s*exit\s*$/)&&!_){i();var p=F.level();if(p===1&&F.get_token()||p>1){if(F.get_token(true)){F.set_token(undefined,true)}F.pop()}u()}else if(E.clear&&n.match(/^\s*clear\s*$/)&&!_){i();F.clear();u()}else{return s()}return f.promise()}catch(e){m(e,"USER",r);F.resume();if(r){throw e}}}function De(){if(v("onBeforeLogout",[],true)===false){return}de();v("onAfterlogout",[],true);F.login(I,true,be)}function de(){var e=F.prefix_name(true)+"_";r.remove(e+"token");r.remove(e+"login")}function he(e){var t=F.prefix_name()+"_interpreters";var n=r.get(t);if(n){n=JSON.parse(n)}else{n=[]}if($.inArray(e,n)===-1){n.push(e);r.set(t,JSON.stringify(n))}}function s(e){var t=A.top();var n=F.prefix_name(true);if(!Fe()){he(n)}var r=F.login_name(true);B.name(n+(r?"_"+r:""));var i=t.prompt;if(is_function(i)){i=_t(i)}var u=is_function(t.prompt);if(u||i!==B.prompt()){if(u){B.prompt("")}B.prompt(t.prompt)}if(typeof t.history!=="undefined"){F.history().toggle(t.history)}if($.isPlainObject(t.keymap)){B.keymap(null).keymap($.extend({},P,$.omap(t.keymap,function(e,t){return function(){var e=[].slice.call(arguments);try{return t.apply(F,e)}catch(e){m(e,"USER KEYMAP")}}})))}B.set("");if(!e&&is_function(t.onStart)){t.onStart.call(F,F)}}function v(t,e,n){e=(e||[]).concat([F]);var r=A&&A.top();if(r&&is_function(r[t])&&!n){try{return r[t].apply(F,e)}catch(e){delete r[t];m(e,t)}}else if(is_function(E[t])){try{return E[t].apply(F,e)}catch(e){E[t]=null;m(e,t)}}}var ve=function(){function e(e){if(!e){try{F.scroll_to(F.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 ge(){var e=F.find(".cmd-cursor-line");return e.is_fully_in_viewport(F).then(ve)}function _e(e){if(typeof history!=="undefined"&&history.replaceState){var t="#"+JSON.stringify(e);var n=location.href.replace(/#.*$/,t);history.replaceState(null,"",n)}}function ye(){if(fire_hash_change&&E.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]){F.import_view(save_state[0])}}catch(e){m(e,"TERMINAL")}}}function be(){s();Xe.resolve();ue()}function Ce(){if(x.length){if(a.length){$.when.apply($,a)}}function t(){tt=$.noop;if(!e&&F.enabled()){F.resume(true)}}var e=false;if(is_function(E.onInit)){tt=function(){e=true};var n;try{n=E.onInit.call(F,F)}catch(e){m(e,"OnInit")}finally{if(!is_promise(n)){t()}else{n.then(t).catch(function(e){m(e,"OnInit");t()})}}}if(first_instance){first_instance=false;$(window).on("hashchange",ye)}}function Fe(){return _||B.mask()!==false}function we(e){var t,n=A.top();if(is_function(n.keydown)){t=n.keydown.call(F,e,F);if(t!==undefined){return t}}else if(is_function(E.keydown)){t=E.keydown.call(F,e,F);if(t!==undefined){return t}}}var Ee={"CTRL+D":function(e,t){if(!_){if(B.get()===""){if(A.size()>1||is_function(I)){F.pop("")}else{F.resume()}}else{t()}}return false},"CTRL+C":function(){with_selection(function(e){if(e===""){var t=F.get_command();var n=F.get_position();t=t.slice(0,n)+"^C"+t.slice(n+2);h(t);F.set_command("")}else{var r=F.find("textarea");text_to_clipboard(r,process_selected_html(e))}});return false},"CTRL+L":function(){F.clear();return false},TAB:function(e,t){var n=A.top(),r,i;if(typeof n.caseSensitiveAutocomplete!=="undefined"){i=n.caseSensitiveAutocomplete}else{i=E.caseSensitiveAutocomplete}if(E.completion&&get_type(E.completion)!=="boolean"&&n.completion===undefined){r=E.completion}else{r=n.completion}if(r==="settings"){r=E.completion}function u(e){e=e.slice();if(!F.before_cursor(false).match(/\s/)){if(E.clear&&$.inArray("clear",e)===-1){e.push("clear")}if(E.exit&&$.inArray("exit",e)===-1){e.push("exit")}}F.complete(e,{echo:true,word:E.wordAutocomplete,escape:E.completionEscape,caseSensitive:i,echoCommand:E.doubleTabEchoCommand,doubleTab:E.doubleTab})}if(r){switch(get_type(r)){case"function":var a=F.before_cursor(E.wordAutocomplete);if(r.length===3){var o=new Error(c().comletionParameters);m(o,"USER");return false}var s=r.call(F,a,u);unpromise(s,u,le("Completion"));break;case"array":u(r);break;default:throw new $.terminal.Exception(c().invalidCompletion)}}else{t()}return false},"CTRL+V":function(e,t){t(e);F.oneTime(200,function(){F.scroll_to_bottom()});return true},"CTRL+TAB":function(){if(terminals.length()>1){F.focus(false);return false}},PAGEDOWN:function(){F.scroll(F.height())},PAGEUP:function(){F.scroll(-F.height())}};function xe(t){var e,n;if(Ve){return false}if(F.enabled()){if(!F.paused()){e=we(t);if(e!==undefined){return e}if(t.which!==9){qe=0}}else{if(!E.pauseEvents){e=we(t);if(e!==undefined){return e}}if(t.which===68&&t.ctrlKey){if(E.pauseEvents){e=we(t);if(e!==undefined){return e}}if(requests.length){for(n=requests.length;n--;){var r=requests[n];if(r.readyState!==4){try{r.abort()}catch(e){if(is_function(E.exceptionHandler)){E.exceptionHandler.call(F,t,"AJAX ABORT")}else{F.error(c().ajaxAbortError)}}}}requests=[]}F.resume()}return false}}}function $e(e){var t=A.top();if(b&&(!k||!E.pauseEvents)){if(is_function(t.keypress)){return t.keypress.call(F,e,F)}else if(is_function(E.keypress)){return E.keypress.call(F,e,F)}}}function ke(b,C){return function e(s,l){var f=$.terminal.apply_formatters(s,{animation:true});f=$.terminal.normalize(f);var t=false;if(l&&typeof l.keepWords!=="undefined"){t=l.keepWords}if(C){var n=$.terminal.split_equal(f,F.cols(),{keepWords:t})}Ve=true;var c=F.get_prompt();var p=0;var m=$.terminal.length(f);if(m>0){var D="";if(l.prompt){D=l.prompt}else{F.set_prompt("")}var d=F.is_bottom();var h=0;if(C){var v=n.map(function(e){return{formatted:e,chars:$.terminal.partition(e,{wrap:false}),len:$.terminal.length(e)}})}else{var g=$.terminal.partition(f,{wrap:false})}var _;var y=setInterval(function(){var e,t,n;if(!Ge){if(C){e=v[h].formatted;t=v[h].chars;n=v[h].len}else{e=f;t=g;n=m}var r=t[p];if(l.mask){var i=B.mask();if(typeof i==="string"){r=i}else if(i){r=E.maskChar}}D+=r;B.prompt(D,{formatters:false});if(d&&(r==="\n"||!F.is_bottom())){F.scroll_to_bottom()}p++;if(p===n&&C){var u=F.last_index();if(h===v.length-1){F.set_prompt(c)}else{F.set_prompt("")}var a=!!x.get_partial().length;F.echo(e,$.extend({},l,{formatters:false,finalize:null,typing:false}));v[h].index=u+1;D="";++h;p=0}}else{F.skip_stop();var o=$.terminal.substring(f,p,m);D+=o;B.prompt(D,{formatters:false});_=true}if(C){_=h===v.length}else{_=p===m}if(_){clearInterval(y);setTimeout(function(){if(a||l.newline===false){var e=F.last_index();var t=w.find('[data-index="'+e+'"]');l.finalize(t)}else{if(C){v.forEach(function(e){F.remove_line(e.index)})}b(s,c,l)}Ve=false},l.delay)}},l.delay)}}}var Ae=ke(function(e,t,n){F.set_prompt(e);n.finalize()},true);var Be=function(){var r=ke(function(e,t,n){F.set_prompt(t);F.insert(e);n.finalize()});return function(e,t,n){return r(t,$.extend({},n,{prompt:e+F.get_command()}))}}();var Te=ke(function(e,t,n){F.set_prompt(t);F.echo(e,$.extend({},n,{typing:false}))},true);var Se=function(){var r=ke(function(r,e,i){F.set_prompt(e);with_prompt(e,function(e){var t=ae(r);t=$.terminal.apply_formatters(t,{command:true});var n=e+t;i=$.extend({},i,{typing:false,formatters:false,convertLinks:false});F.echo(n,i)},F)});return function(e,t,n){return r(t,$.extend({},n,{prompt:e,mask:true}))}}();function Re(a,o,s){return function e(r,i){var u=new $.Deferred;p(function e(){var t=$.extend({typing:false,delay:E.execAnimationDelay},i);if(t.typing){if(typeof r!=="string"){return u.reject(a+": Typing animation require string")}if(typeof t.delay!=="number"||isNaN(t.delay)){return u.reject(a+": Invalid argument, delay need to"+" be a number")}var n=F.typing(a,t.delay,r,t);n.then(function(){u.resolve()})}else{o(r,t)}if(is_function(s)){s(r,t)}});if(i&&i.typing){return u.promise()}return F}}function je(e,t,n){var r=v("onBeforeLogin",[e,t]);return unpromise(always(r),n,"validate_login")}function Oe(u,i,a,o){if(E.history){B.history().disable()}var e=F.level();t();function s(){while(F.level()>e){F.pop(undefined,true)}if(E.history){B.history().enable()}}function l(e,t){var n=F.prefix_name(true)+"_";r.set(n+"token",t);r.set(n+"login",e)}function t(){var e=F.prefix_name(true)+"_";r.remove(e+"token");r.remove(e+"login")}function f(e,t,n){var r;if(t){s();l(e,t);_=false;v("onAfterLogin",[e,t]);r=a}else{if(i){if(!n){F.error(c().wrongPasswordTryAgain)}F.pop(undefined,true).set_mask(false)}else{_=false;if(!n){F.error(c().wrongPassword)}F.pop(undefined,true).pop(undefined,true)}r=o}if(F.paused()){F.resume()}if(is_function(r)){r()}F.off("terminal.autologin")}F.on("terminal.autologin",function(e,t,n,r){je(t,n,function(e){if(e!==false){f(t,n,r)}})});F.push(function(i){F.set_mask(E.maskChar).push(function(r){try{je(i,r,function(e){if(e===false){s();return}F.pause();try{var t=[i,r,function(e,t){f(i,e,t)}];var n=u.apply(F,t);unpromise(n,function(e){f(i,e)},function(e){F.pop(undefined,true).pop(undefined,true);F.error(e.message);if(is_function(o)){o()}if(F.paused()){F.resume()}F.off("terminal.autologin")})}catch(e){m(e,"AUTH")}})}catch(e){m(e,"AUTH")}},{prompt:c().password+": ",name:"password"})},{prompt:c().login+": ",name:"login"})}function Le(t){return function(e){t.add(e)}}function c(){return $.extend({},$.terminal.defaults.strings,E&&E.strings||{})}function ze(e,t){return parseInt(e.getPropertyValue(t),10)||0}function Ie(){var t=window.getComputedStyle(j[0]);function e(e){return ze(t,"padding-"+e)}var n=e("left");var r=e("right");var i=e("top");var u=e("bottom");return{top:i,left:n,right:r,bottom:u}}var F=this;if(this.length>1){return this.each(function(){$.fn.terminal.call($(this),e,$.extend({name:F.selector},t))})}var Pe;if(F.is("body,html")){if(F.hasClass("full-screen-terminal")){var Ne=F.find("> .terminal").data("terminal");if(Ne){return Ne}}Pe=F;F=$("<div/>").appendTo("body");$("body").addClass("full-screen-terminal")}else if(F.data("terminal")){return F.data("terminal")}var Me=$.omap({id:function(){return g},clear:function(){if(v("onClear")!==false){y.clear();x.clear(function(e){return W(e)});w[0].innerHTML="";F.prop({scrollTop:0})}return F},export_view:function(){var e=v("onExport");e=e||{};return $.extend({},{focus:b,mask:B.mask(),prompt:F.get_prompt(),command:F.get_command(),position:B.position(),lines:clone(x.data()),interpreters:A.clone(),history:B.history().data},e)},import_view:function(t){if(_){throw new Error(sprintf(c().notWhileLogin,"import_view"))}v("onImport",[t]);p(function e(){F.set_prompt(t.prompt);F.set_command(t.command);B.position(t.position);B.mask(t.mask);if(t.focus){F.focus()}x.import(clone(t.lines).filter(function(e){return e[0]}));if(t.interpreters instanceof Stack){A=t.interpreters}if(E.importHistory){B.history().set(t.history)}i()});return F},save_state:function(e,t,n){if(typeof n!=="undefined"){save_state[n]=F.export_view()}else{save_state.push(F.export_view())}if(!Array.isArray(hash_commands)){hash_commands=[]}if(e!==undefined&&!t){var r=[g,save_state.length-1,e];hash_commands.push(r);fe()}return F},exec:function(r,i,u){function a(e){var t=me(r,e,true);unpromise(t,function(){D=null;s.resolve()},function(){D=null;s.reject()})}if(i&&typeof i==="object"){u=i;i=null}var o=$.extend({deferred:null,silent:false,typing:false,delay:E.execAnimationDelay},u);if(i===null){i=o.silent}if(!is_deferred(o.deferred)){o.deferred=new $.Deferred}var s=o.deferred;l(function e(){if(Array.isArray(r)){(function e(){var t=r.shift();if(t){F.exec(t,i,u).done(e)}else{s.resolve()}})()}else if(k){ut.push([r,i,o])}else if(o.typing&&!i){var t=o.delay;k=true;var n=F.typing("enter",t,r,{delay:t});n.then(function(){k=false;a(true)});s.then(function(){k=false})}else{a(i)}});return s.promise()},autologin:function(e,t,n){F.trigger("terminal.autologin",[e,t,n]);return F},login:function(t,n,r,i){Qe.push([].slice.call(arguments));if(_){throw new Error(sprintf(c().notWhileLogin,"login"))}if(!is_function(t)){throw new Error(c().loginIsNotAFunction)}_=true;if(F.token()&&F.level()===1&&!ot){_=false;F.logout(true)}else{var e=F.token(true);var u=F.login_name(true);if(e&&u){_=false;F.pause();je(u,e,function(e){if(e!==false){if(is_function(r)){r()}}else{F.resume();Oe(t,n,r,i)}})}else{Oe(t,n,r,i)}}return F},settings:function(){return E},before_cursor:function(e){var t=B.position();var n=B.get().slice(0,t);var r=n.split(/\s/);var i;if(e){if(r.length===1){i=r[0]}else{var u=n.match(/(\\?")/g);var a=u?u.filter(function(e){return!e.match(/^\\/)}).length:0;u=n.match(/'/g);var o=u?u.length:0;if(o%2===1){i=n.match(/('[^']*)$/)[0]}else if(a%2===1){i=n.match(/("(?:[^"]|\\")*)$/)[0]}else{i=r[r.length-1];for(z=r.length-1;z>0;z--){var s=r[z-1];if(s[s.length-1]==="\\"){i=r[z-1]+" "+i}else{break}}}}}else{i=n}return i},complete:function(r,i){i=$.extend({word:true,echo:false,escape:true,echoCommand:false,caseSensitive:true,doubleTab:null},i||{});var u=i.caseSensitive;var a=F.before_cursor(i.word).replace(/\\"/g,'"');var s=false;if(i.word){if(a.match(/^"/)){s='"'}else if(a.match(/^'/)){s="'"}if(s){a=a.replace(/^["']/,"")}}if(qe%2===0){Je=F.before_cursor(i.word)}else{var e=F.before_cursor(i.word);if(e!==Je){return}}var t=$.terminal.escape_regex(a);if(i.escape){t=t.replace(/(\\+)(["'() ])/g,function(e,t,n){if(n.match(/[()]/)){return t+"\\?\\"+n}else{return t+"?"+n}})}function o(e){if(s==='"'){e=e.replace(/"/g,'\\"')}if(!s&&i.escape){e=e.replace(/(["'() ])/g,"\\$1")}return e}function n(){var e=[];for(var t=r.length;t--;){if(r[t].match(/\n/)&&i.word){warn("If you use commands with newlines you "+"should use word option for complete or"+" wordAutocomplete terminal option")}if(f.test(r[t])){var n=o(r[t]);if(!u&&same_case(n)){if(a.toLowerCase()===a){n=n.toLowerCase()}else if(a.toUpperCase()===a){n=n.toUpperCase()}}e.push(n)}}return e}var l=u?"":"i";var f=new RegExp("^"+t,l);var c=n();function p(e,t){var n=F.get_command();var r=F.get_position();var i=new RegExp("^"+e,"i");var u=n.slice(0,r);var a=n.slice(r);var o=t.replace(i,"")+(s||"");F.set_command(u+o+a);F.set_position((u+o).length)}if(c.length===1){if(i.escape){p(t,c[0])}else{F.insert(c[0].replace(f,"")+(s||""))}Je=F.before_cursor(i.word);return true}else if(c.length>1){if(++qe>=2){qe=0;if(i.echo){if(is_function(i.doubleTab)){if(i.echoCommand){h()}var m=i.doubleTab.call(F,a,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");F.echo($.terminal.escape_brackets(D),{keepWords:true,formatters:false})}return true}}else{var d=common_string(o(a),c,u);if(d){p(t,d);Je=F.before_cursor(i.word);return true}}}},commands:function(){return A.top().interpreter},set_interpreter:function(e,t){var n=$.Deferred();function r(){F.pause(E.softPause);X(e,t,function(e){F.resume();var t=A.top();$.extend(t,e);s(true);n.resolve()})}if(is_function(t)){F.login(t,true,r)}else if(get_type(e)==="string"&&t){F.login(Z(e,t),true,r)}else{r()}return n.promise()},greetings:function(){ue();return F},paused:function(){return k},pause:function(t){l(function e(){tt();k=true;B.disable(t||is_android);if(!t){B.find(".cmd-prompt").hidden()}v("onPause")});return F},resume:function(i){l(function e(){k=false;if(b&&terminals.front()===F){B.enable(i)}B.find(".cmd-prompt").visible();var t=ut;ut=[];for(var n=0;n<t.length;++n){F.exec.apply(F,t[n])}F.trigger("resume");var r=pe.shift();if(r){r()}if(v("onResume")!==false){F.scroll_to_bottom()}});return F},skip:function(){Ge=true},skip_stop:function(){Ge=false},animating:function(){return Ve},cols:function(){if(E.numChars){return E.numChars}if(!u||u===1e3){u=get_num_chars(F,L)}return u},rows:function(){if(E.numRows){return E.numRows}if(!Ke){Ke=get_num_rows(F,L)}return Ke},history:function(){return B.history()},geometry:function(){var e=Ie();return{terminal:{padding:{left:e.left,right:e.right,top:e.top,bottom:e.bottom},width:nt+e.left+e.right,height:rt+e.top+e.bottom},density:O,char:L,cols:this.cols(),rows:this.rows()}},history_state:function(e){function t(){E.historyState=true;if(!save_state.length){F.save_state()}else if(terminals.length()>1){F.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(t,0)}else{setImmediate(t)}}else{E.historyState=false}return F},clear_history_state:function(){hash_commands=[];save_state=[];return F},next:function(){if(terminals.length()===1){return F}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){m(e,"onTerminalChange")}return e}},focus:function(n,r){l(function e(){if(terminals.length()===1){if(n===false){F.disable(r)}else{F.enable(r)}}else if(n===false){F.next()}else{var t=terminals.front();if(t!==F){terminals.forEach(function(e){if(e!==F&&e.enabled()){e.disable(r)}});if(!r){try{trigger_terminal_change(F)}catch(e){m(e,"onTerminalChange")}}}terminals.set(F);F.enable(r)}});return F},blur:function(e){return this.focus(false,e)},freeze:function(t){p(function e(){if(t){F.disable();C=true}else{C=false;F.enable()}});return F},frozen:function(){return C},enable:function(n){if(!b&&!C){if(u===undefined){F.resize()}l(function e(){var t;if(!n&&!b){v("onFocus")}if(!n&&t===undefined||n){b=true;if(!F.paused()){B.enable(true)}}})}return F},clear_cache:"Map"in root?function(){y.clear_cache();f.clear();B.clear_cache();return F}:function(){return F},disable:function(n){l(function e(){var t;if(!n&&b){t=v("onBlur")}if(!n&&t===undefined||n){b=false;B.disable()}});return F},enabled:function(){return b},signature:function(){var e=F.cols();for(var t=signatures.length;t--;){var n=signatures[t].map(function(e){return e.length});if(Math.max.apply(null,n)<=e){return signatures[t].join("\n").replace(/\s+$/m,"")+"\n"}}return""},version:function(){return $.terminal.version},cmd:function(){return B},get_command:function(){return B.get()},enter:Re("enter",h),set_command:function(t,n){p(function e(){if(typeof t!=="string"){t=JSON.stringify(t)}B.set(t,undefined,n)});return F},set_position:function(t,n){p(function e(){B.position(t,n)});return F},get_position:function(){return B.position()},insert:function(u,e){if(typeof u==="string"){var a;var t={stay:false,typing:false,delay:100};if(!is_object(e)){e={stay:e}}a=$.extend(t,e);var o=new $.Deferred;p(function e(){function t(){if(E.scrollOnEcho||n){F.scroll_to_bottom()}}var n=F.is_bottom();if(a.typing){var r=a.delay;var i=F.typing("insert",r,u,E);i.then(function(){t();o.resolve()})}else{B.insert(u,E.stay);t()}});if(a.typing){return o.promise()}return F}else{throw new Error(sprintf(c().notAString,"insert"))}},set_prompt:Re("prompt",function(t){if(is_function(t)){B.prompt(function(e){return t.call(F,e,F)})}else{B.prompt(t)}},function(e){A.top().prompt=e}),get_prompt:function(){return A.top().prompt},set_mask:function(t){p(function e(){B.mask(t===true?E.maskChar:t)});return F},get_mask:function(){return B.mask()},get_output:function(e){if(e){return x.data()}else{return x.get_snapshot()}},resize:function(e,t){if(!F.is(":visible")){F.stopTime("resize");F.oneTime(500,"resize",function(){F.resize(e,t)})}else{if(e&&t){F.width(e);F.height(t)}e=F.width();t=F.height();if(typeof E.numChars!=="undefined"||typeof E.numRows!=="undefined"){if(typeof E.numChars!=="undefined"){B.resize(E.numChars);F.refresh()}v("onResize");return}var n=get_num_chars(F,L);var r=get_num_rows(F,L);if(n!==u||r!==Ke){F.clear_cache();var i=n!==u;u=n;Ke=r;if(i){B.resize(u);F.refresh()}v("onResize")}}return F},refresh:function(){if(L.width!==0){css(F[0],{"--char-width":L.width,"--pixel-density":O})}F.clear_cache();if(Je){B.resize()}i({scroll:false,update:true});return F},flush:function(h){h=$.extend({},{update:false,scroll:true},h||{});p(function e(){try{if(y.is_empty()){return F}var t=F.is_bottom();var i=E.scrollOnEcho&&h.scroll||t;var u;var a=true;var o=false;var s=$();var l;var f=[];if(!h.update){s=F.find(".partial");l=x.get_partial()}y.flush(function(e){if(!e){if(!s.length){u=$("<div/>");l=[]}else if(a){a=false;o=true;u=s}}else if(is_function(e.finalize)){if(h.update&&e.raw===true&&e.newline){return}if(i){u.find("img").on("load",function(){F.scroll_to_bottom()})}if(h.update){x.update_snapshot(e.index,l);var t=W(e.index);if(t.html()!==u.html()){t.replaceWith(u)}}else{u.appendTo(w);if(!s.length){x.make_snapshot(l)}}u.attr("data-index",e.index);o=!e.newline;u.toggleClass("partial",o);f.push({node:u,finalize:e.finalize});if(o){s=u}else if(e.newline&&s.length){u=$("<div/>");s=$()}}else{var n=e.line;var r;if(typeof e.raw==="string"){if(o){l[l.length-1]+=e.raw}else{l.push(e.raw)}}if(o){r=u.children().last().append(n);o=false}else{r=$("<div/>").html(n);if(e.newline){r.addClass("cmd-end-line")}u.append(r)}r.css("width","100%")}});s=F.find(".partial");f.forEach(function(e){e.finalize(e.node)});var n;if(s.length===0){css(B[0],{"--prompt-offset":"",top:""});B.__set_prompt_margin(0);n=F.find(".terminal-output div:last-child"+" div:last-child");if(n.css("display")==="inline-block"){n.css({width:"100%",display:""})}}else if(l.length&&l[l.length-1]){var r=$.terminal.length(l[l.length-1]);r%=F.cols();n=s.children().last();var c=n[0].getBoundingClientRect();var p=is_ch_unit_supported?r+"ch":r+"px";css(B[0],{top:-c.height/O+"px","--prompt-offset":p});B.__set_prompt_margin(r)}ie();v("onFlush");var m=F.find(".cmd-cursor");var D=F.find(".cmd").offset();var d=F.offset();F.stopTime("flush").oneTime(10,"flush",function(){var e=w.height();var t=B.height();css(F[0],{"--terminal-height":F.height(),"--terminal-x":D.left-d.left,"--terminal-y":D.top-d.top,"--terminal-scroll":S.prop("scrollTop"),"--cmd-top":e,"--cmd-height":t});if(b&&!is_mobile){m.hide();F.oneTime(1,"flush",function(){m.show()})}});u.on_load({done:function(){if(i){F.scroll_to_bottom()}}})}catch(e){if(is_function(E.exceptionHandler)){try{E.exceptionHandler.call(F,e,"TERMINAL (Flush)")}catch(e){E.exceptionHandler=$.noop;alert_exception("[exceptionHandler]",e)}}else{alert_exception("[Flush]",e)}}finally{y.clear()}});return F},update:function(r,t,i){p(function e(){if(r<0){r=x.length()+r}if(!x.valid_index(r)){F.error("Invalid line number "+r)}else if(t===null){x.update(r,null);W(r).remove()}else{t=M(t,{update:true,line:r});if(t===false){return F}unpromise(t,function(e){var t=o(e,i);if(t){e=t[0];i=t[1]}i=x.update(r,e,i);var n=re({value:e,index:r,options:i});unpromise(n,function(){F.flush({scroll:false,update:true})})})}});return F},remove_line:function(e){return F.update(e,null)},last_index:function(){return x.length()-1},echo:function(e,r,t){var o=arguments.length>0;var s=t||new $.Deferred;function l(){We=false;var e=a;a=[];for(var t=0;t<e.length;++t){F.echo.apply(F,e[t])}}function f(e){l();m(e,"ECHO",true)}function n(i){try{var u=$.extend({flush:true,exec:true,raw:E.raw,finalize:$.noop,unmount:$.noop,delay:E.execAnimationDelay,ansi:false,typing:false,externalPause:true,keepWords:false,invokeMethods:E.invokeMethods,onClear:null,formatters:true,allowedAttributes:E.allowedAttributes,newline:true},r||{});var n=E.externalPause&&u.externalPause;(function(t){if(q(i)){return}u.finalize=function(e){if(u.raw){e.addClass("raw")}if(u.ansi){e.addClass("ansi")}try{if(is_function(t)){t.call(F,e)}e.on_load({error:function(e){e.replaceWith(use_broken_image)},done:function(e){if(e&&n){F.resume()}},load:function(e){if(e&&n){F.pause()}}})}catch(e){m(e,"USER:echo(finalize)");t=null}}})(u.finalize);if(u.flush){if(!y.empty()){F.flush()}}if(v("onBeforeEcho",[i])===false){return}if(u.typing){if(typeof i!=="string"){return s.reject("echo: Typing animation require string"+" or promise that resolve to string")}if(typeof u.delay!=="number"||isNaN(u.delay)){return s.reject("echo: Invalid argument, delay need to"+" be a number")}var e=F.typing("echo",u.delay,i,u);e.then(function(){s.resolve()});return}var t;if(typeof i==="function"){t=i.bind(F)}else if(typeof i==="undefined"){if(o){t=String(i)}else{t=""}}else{var a=M(i);if(a===false){return F}t=a}if(is_promise(t)){We=true}unpromise(t,function(e){if(is_promise(a)&&e===false){return}if(H(e,u)){return F}var t=x.length();var n=x.has_newline();if(!n){t--}if(!u.newline&&e[e.length-1]==="\n"){e=e.slice(0,-1);u.newline=true}var r=re({value:e,options:u,index:t});if(is_promise(r)){We=true}x.push([e,u]);unpromise(r,function(){if(u.flush){F.flush();v("onAfterEcho",[i])}l()},f)},f)}catch(e){if(is_function(E.exceptionHandler)){E.exceptionHandler.call(F,e,"TERMINAL (echo)")}else{alert_exception("[Terminal.echo]",e)}}}var i=r&&r.typing;if(We){var u=[e,r];if(i){u.push(s)}a.push(u)}else{n(e)}if(i){return s.promise()}return F},typing:function(t,e,n,r){var i=new $.Deferred;var u;var a;if(typeof r==="object"){a=r.finalize||$.noop;u=$.extend({},r,{delay:e,finalize:o})}else{a=r||$.noop;u={delay:e,finalize:o}}function o(){i.resolve();if(is_function(a)){a.apply(F,arguments)}}var s=["prompt","echo","enter","insert"];function l(){return s.indexOf(t)>=0}p(function e(){if(l()){if(t==="prompt"){Ae(n,u)}else if(t==="echo"){Te(n,u)}else if(t==="enter"){with_prompt(F.get_prompt(),function(e){Se(e,n,u)},F)}else if(t==="insert"){with_prompt(F.get_prompt(),function(e){Be(e,n,u)},F)}}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 n(e){if(typeof e!=="string"){e=String(e)}var t=$.terminal.escape_brackets(e).replace(/\\$/,"\").replace(url_re,"]$1[[;;;terminal-error]");return"[[;;;terminal-error]"+t+"]"}if(typeof e==="function"){return F.echo(function(){return n(e.call(F))},t)}if(e&&e.then){e.then(function(e){F.echo(n(e))}).catch(le("Echo Error"));return F}return F.echo(n(e),t)},exception:function(r,e){var t=exception_message(r);if(e){t="["+e+"]: "+t}if(t){F.error(t,{finalize:function(e){e.addClass("terminal-exception terminal-message")},keepWords:true})}if(typeof r.fileName==="string"){var i=F.paused();if(!i){F.pause(E.softPause)}$.get(r.fileName,function(e){var t=r.lineNumber-1;var n=e.split("\n")[t];if(n){F.error("["+r.lineNumber+"]: "+n)}if(!i){F.resume()}},"text")}if(r.stack){F.echo(format_stack_trace(r.stack),{finalize:function(e){e.addClass("terminal-exception terminal-stack-trace")},formatters:false})}return F},scroll:function(e){var t;e=Math.round(e);if(F.prop){if(e>S.prop("scrollTop")&&e>0){S.prop("scrollTop",0)}t=S.prop("scrollTop");S.scrollTop(t+e)}else{if(e>S.prop("scrollTop")&&e>0){S.prop("scrollTop",0)}t=S.prop("scrollTop");S.scrollTop(t+e)}return F},logout:function(n){if(_){throw new Error(sprintf(c().notWhileLogin,"logout"))}p(function e(){if(n){var t=Qe.pop();F.set_token(undefined,true);F.login.apply(F,t)}else if(A.size()===1&&F.token()){F.logout(true)}else{while(A.size()>1){if(F.token()){F.logout(true).pop().pop()}else{F.pop()}}}});return F},token:function(e){return r.get(F.prefix_name(e)+"_token")},set_token:function(e,t){var n=F.prefix_name(t)+"_token";if(typeof e==="undefined"){r.remove(n)}else{r.set(n,e)}return F},get_token:function(e){return F.token(e)},login_name:function(e){return r.get(F.prefix_name(e)+"_login")},name:function(){return A.top().name},prefix_name:function(e,t){var n=(E.name?E.name+"_":"")+g;if(e&&A.size()>1){var r=A.map(function(e){return e.name||""}).slice(1,t).join("_");if(r){n+="_"+r}}return n},read:function(e,t,n){var r;if(typeof arguments[1]==="object"){r=$.extend({typing:false,delay:E.execAnimationDelay,success:$.noop,cancel:$.noop},arguments[1])}else{r={typing:false,success:t||$.noop,cancel:n||$.noop}}if(r.typing){var i=F.get_prompt();r.typing=false;return F.typing("prompt",r.delay,e).then(function(){return F.set_prompt(i).read(e,r)})}Ue=true;var u=jQuery.Deferred();var a=false;F.push(function(e){a=true;u.resolve(e);if(is_function(r.success)){r.success(e)}F.pop();if(E.history){B.history().enable()}},{name:"read",history:false,prompt:e||"",onExit:function(){if(!a){u.reject();if(is_function(r.cancel)){r.cancel()}}}});if(E.history){B.history().disable()}if(is_function(r.onReady)){r.onReady.call(F)}return u.promise()},push:function(a,o){l(function e(){o=o||{};var t={infiniteLogin:false};var r=$.extend({},t,o);if(!r.name&&D){r.name=D.name}if(r.prompt===undefined){r.prompt=(r.name||">")+" "}var n=A.top();if(n){n.mask=B.mask()}var i=k;function u(){v("onPush",[n,A.top()]);s()}X(a,o.login,function(e){A.push($.extend({},e,r));if(r.completion===true){if(Array.isArray(e.completion)){A.top().completion=e.completion}else if(!e.completion){A.top().completion=false}}if(r.login){var t;var n=get_type(r.login);if(n==="function"){t=r.infiniteLogin?$.noop:F.pop;F.login(r.login,r.infiniteLogin,u,t)}else if(get_type(a)==="string"&&n==="string"||n==="boolean"){t=r.infiniteLogin?$.noop:F.pop;F.login(Z(a,r.login),r.infiniteLogin,u,t)}}else{u()}if(!i&&F.enabled()){F.resume()}})});return F},pop:function(e,t){if(e!==undefined){h(e)}var n=F.token(true);var r;if(A.size()===1){r=A.top();if(E.login){if(!t){v("onPop",[r,null])}De();v("onExit")}else{F.error(c().canExitError)}}else{if(n){de()}var i=A.pop();r=A.top();s();F.set_mask(r.mask);if(!t){v("onPop",[i,r])}if(_&&F.get_prompt()!==c().login+": "){_=false}if(is_function(i.onExit)){try{i.onExit.call(F,F)}catch(e){i.onExit=$.noop;m(e,"onExit")}}}return F},option:function(e,t){if(typeof t==="undefined"){if(typeof e==="string"){return E[e]}else if(typeof e==="object"){$.each(e,function(e,t){E[e]=t})}}else{E[e]=t;if(e.match(/^num(Chars|Rows)$/)){i()}}return F},invoke_key:function(e){B.invoke_key(e);return F},keymap:function(e,n){if(arguments.length===0){return B.keymap()}if(typeof n==="undefined"){if(typeof e==="string"){return B.keymap(e)}else if($.isPlainObject(e)){e=$.extend({},P,$.omap(e||{},function(n,r){if(!P[n]){return r.bind(F)}return function(e,t){return r.call(F,e,function(){return P[n](e,t)})}}));B.keymap(null).keymap(e)}}else if(typeof n==="function"){var r=e;if(!P[r]){B.keymap(r,n.bind(F))}else{B.keymap(r,function(e,t){return n.call(F,e,function(){return P[r](e,t)})})}}},level:function(){return A.size()},reset:function(){p(function e(){F.clear();while(A.size()>1){A.pop()}s();ue();Ce()});return F},purge:function(){p(function e(){var t=F.prefix_name()+"_";var n=r.get(t+"interpreters");if(n){$.each(JSON.parse(n),function(e,t){r.remove(t+"_commands");r.remove(t+"_token");r.remove(t+"_login")})}B.purge();r.remove(t+"interpreters")});return F},destroy:function(){p(function e(){B.destroy().remove();F.resizer("unbind");F.touch_scroll("unbind");ft.resizer("unbind").remove();ct.resizer("unbind").remove();$(document).unbind(".terminal_"+F.id());$(window).unbind(".terminal_"+F.id());F.unbind("click mousedown mouseup");F.removeData("terminal").removeClass("terminal").unbind(".terminal");if(E.width){F.css("width","")}if(E.height){F.css("height","")}$(window).off("blur",vt).off("focus",dt);F.find(".terminal-fill, .terminal-font, .terminal-font-forcer").remove();F.stopTime();terminals.remove(g);if(T){if(T.unobserve){T.unobserve(F[0])}else{clearInterval(T)}}var t=F.find(".terminal-scroll-marker");if(et){et.unobserve(t[0])}t.remove();if(lt){lt.disconnect()}if(!terminals.length()){$(window).off("hashchange")}if(is_mobile){F.off(["touchstart.terminal","touchmove.terminal","touchend.terminal"].join(" "))}w.remove();S.remove();if(Pe){var n=$(Pe);if(n.attr("class")==="full-screen-terminal"){n.removeAttr("class")}else{n.removeClass("full-screen-terminal")}F.remove()}at=true});return F},scroll_to:function(e){var t=S.scrollTop()-F.offset().top+$(e).offset().top;S.scrollTop(t);return F},scroll_to_bottom:function(){var e;if(F.prop){e=S.prop("scrollHeight")}else{e=S.attr("scrollHeight")}S.scrollTop(e);return F},is_bottom:function(){if(E.scrollBottomOffset===-1){return false}else if(typeof Ze==="boolean"){return Ze}else{var e,t,n;e=S[0].scrollHeight;t=S[0].scrollTop;n=S[0].offsetHeight;var r=e-E.scrollBottomOffset;return t+n>r}},duplicate:function(){var e=$(F);return $.extend(e,Me)},get_output_buffer:function(e){var r=$.extend({html:false},e);var i=[];var u=false;y.forEach(function(e){if(e){if(is_function(e.finalize)){u=!e.newline}else{var t;if(r.html){t=e.line}else{t=e.raw}if(u){var n=i.length-1;i[n]+=t}else{i.push(t)}}}});if(r.html){return i.map(function(e){return"<div>"+e+"</div>"}).join("\n")}return i.join("\n")},clear_buffer:function(){y.clear();return F}},function(t,e){return function(){if(at){if(!E.exceptionHandler){throw new $.terminal.Exception(c().defunctTerminal)}}try{return e.apply(F,[].slice.apply(arguments))}catch(e){if(t!=="exec"&&t!=="resume"){m(e,e.type||"TERMINAL",true)}if(!E.exceptionHandler){throw e}}}});$.extend(F,Me);if(F.length===0){var He=sprintf(c().invalidSelector);throw new $.terminal.Exception(He)}F.data("terminal",F);var a=[];var We=false;var D;var d;var qe=0;var w;var g=terminals.length();var Ue=false;var u;var Ke;var Je;var Qe=new Stack;var Ye=new DelayQueue;var Ve=false;var Ge=false;var Xe=new DelayQueue;var p=Le(Xe);var l=Le(Ye);var Ze;var et;var _=false;var tt=$.noop;var nt,rt,it;var ut=[];var E=$.extend({},$.terminal.defaults,{name:F.selector,exit:!!(t&&t.login||!t)},t||{});if(typeof E.width==="number"){F.width(E.width)}if(typeof E.height==="number"){F.height(E.height)}delete E.formatters;var at=false;var y=new FormatBuffer(function(e){return{linksNoReferrer:E.linksNoReferrer,linksNoFollow:E.linksNoFollow,anyLinks:E.anyLinks,charWidth:L.width,useCache:E.useCache,escape:false,allowedAttributes:e.allowedAttributes||[]}});var x=new OutputLines(function(){return E});var r=new n(E.memory);var b=E.enabled;var C=false;var k=false;var ot=true;var A;var B;var st;var T;var lt;if(E.ignoreSystemDescribe===true){E.describe=false}$(document).bind("ajaxSend.terminal_"+F.id(),function(e,t){requests.push(t)});var S=$('<div class="terminal-scroller"/>').appendTo(F);var R=$('<div class="terminal-wrapper"/>').appendTo(S);$(broken_image).hide().appendTo(R);var ft=$('<div class="terminal-font"> </div>').appendTo(F);var ct=$('<div class="terminal-pixel"/>').appendTo(F);var j=$('<div class="terminal-fill"/>').appendTo(S);w=$("<div>").addClass("terminal-output").attr("role","log").appendTo(R);F.addClass("terminal");var O=ht();var L=get_char_size(F);var pt=!terminal_ready(F);if(E.login&&v("onBeforeLogin")===false){ot=false}var mt;if(typeof e==="string"){mt=e}else if(is_array(e)){for(var z=0,Dt=e.length;z<Dt;++z){if(typeof e[z]==="string"){mt=e[z];break}}}var I;if(is_function(E.login)){I=E.login}else if(mt&&(typeof E.login==="string"||E.login===true)){I=Z(mt,E.login)}terminals.append(F);function dt(){if(st){F.focus();F.scroll_to_bottom()}}function ht(){var e=ct[0].getBoundingClientRect();return e.width||1}function vt(){st=b;F.disable().find(".cmd textarea").trigger("blur",[true])}function gt(e){if(is_function(e)){e=e()}if(e&&is_function(e.then)){return e.then(gt)}if(get_type(e)!=="string"){if(is_function(E.parseObject)){var t=E.parseObject(e);if(get_type(t)==="string"){e=t}}else if(is_array(e)){e=$.terminal.columns(e,F.cols(),E.tabs)}else{var n=is_big_int(e);e=String(e);if(n){e+="n"}}}return e}function _t(t){if(t.proxy){return t}var e=function(e){return t.call(F,e,F)};e.proxy=true;return e}function yt(e){e=e.originalEvent;function t(e,t){return e.type.indexOf(t)!==-1}function i(e){F.echo('<img src="'+e+'"/>',{raw:true})}function u(e){var t=window.URL||window.webkitURL;return t.createObjectURL(e)}function a(e,t){if(!t){var n={target:F};if(typeof e==="string"){n.text=e}else if(e instanceof Blob){n.image=u(e)}var r=v("onPaste",[n]);if(r){if(is_function(r.then||r.done)){return(r.then||r.done).call(r,function(e){a(e,true)})}else{a(r,true)}}else if(r!==false){a(n.image||n.text,true)}}else if(e instanceof Blob){i(u(e))}else if(typeof e==="string"){if(e.match(/^(data:|blob:)/)){i(e)}else{F.insert(e)}}}if(e.clipboardData){if(F.enabled()){var n=e.clipboardData.items;if(n){for(var r=0;r<n.length;r++){if(t(n[r],"image")&&E.pasteImage){var o=n[r].getAsFile();a(o)}else if(t(n[r],"text/plain")){n[r].getAsString(function(e){a(e.replace(/\r/g,""))})}}}else if(e.clipboardData.getData){var s=e.clipboardData.getData("text/plain");a(s.replace(/\r/g,""))}return false}}}$(document).on("paste.terminal_"+F.id(),yt);var P=$.extend({},Ee,$.omap(E.keymap||{},function(n,r){if(!Ee[n]){return r.bind(F)}return function(e,t){return r.call(F,e,function(){return Ee[n](e,t)})}}));X(e,E.login,function(e){if(E.completion&&typeof E.completion!=="boolean"||!E.completion){e.completion="settings"}var t=E.prompt;if(is_function(t)){t=_t(t)}A=new Stack($.extend({},E.extra,{name:E.name,prompt:t,keypress:E.keypress,keydown:E.keydown,resize:E.onResize,greetings:E.greetings,mousewheel:E.mousewheel,history:E.history,keymap:P},e));B=$("<div/>").appendTo(R).cmd({tabindex:E.tabindex,mobileDelete:E.mobileDelete,mobileIngoreAutoSpace:E.mobileIngoreAutoSpace,prompt:I?false:t,history:E.memory?"memory":E.history,historyFilter:E.historyFilter,historySize:E.historySize,caseSensitiveSearch:E.caseSensitiveSearch,onPaste:E.onPaste,width:"100%",enabled:false,charWidth:L.width,keydown:xe,keymap:P,clickTimeout:E.clickTimeout,holdTimeout:E.holdTimeout,holdRepeatTimeout:E.holdRepeatTimeout,repeatTimeoutKeys:E.repeatTimeoutKeys,allowedAttributes:E.allowedAttributes,keypress:$e,tabs:E.tabs,onPositionChange:function(){var e=[].slice.call(arguments);ge();v("onPositionChange",e)},onCommandChange:function(e){if(nt!==j.width()){F.resizer()}v("onCommandChange",[e]);ge()},commands:me});function n(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&&F.enabled()){F.disable()}}}F.oneTime(100,function(){$(document).bind("click.terminal_"+F.id(),n).bind("contextmenu.terminal_"+F.id(),n)});var r=$(window);document.addEventListener("resume",function(){F.disable()});if(is_mobile){(function(){F.addClass("terminal-mobile");var i;var u;var n;var a=3;var e=B.clip();var r=200;var o;e.$node.off("touchstart.cmd");F.on("touchstart.terminal",function(e){e=e.originalEvent;window.touch_event=e;if(e.target.tagName.toLowerCase()==="a"){return}if(!C&&e.touches.length===1){n=F.enabled();var t=e.touches[0];i={x:t.clientX,y:t.clientY};o=setTimeout(function(){i=null},r)}}).on("touchmove.terminal",function(e){if(e.touches.length===1&&i){var t=e.touches[0];var n=Math.abs(t.clientX-i.x);var r=Math.abs(t.clientY-i.y);if(n>a||r>a){u=true}}}).on("touchend.terminal",function(){if(i){clearTimeout(o);if(!u){if(!n){e.focus();F.focus();setTimeout(function(){F.scroll_to_bottom()},100)}else{e.blur();F.disable()}}}u=false;i=null})})();if("visualViewport"in window){on_height_change(function(e){css(document.documentElement,{"--terminal-force-height":e+"px"})})}}else{r.on("focus.terminal_"+F.id(),dt).on("blur.terminal_"+F.id(),vt);var h;(function(){var t=0;var n;var r="click_"+F.id();var i=F.find(".cmd textarea");function u(){if(n.is(".terminal")||n.is(".terminal-scroller")||n.is(".terminal-wrapper")){var e=F.get_command().length;F.set_position(e)}else if(n.closest(".cmd-prompt").length){F.set_position(0)}if(!i.is(":focus")){i.focus()}a()}function a(){t=0;n=null}var o=".terminal-output textarea,"+".terminal-output input";F.mousedown(function(e){if(!scrollbar_event(e,j,O)){n=$(e.target)}}).mouseup(function(){if(h){h=false;return}if(n&&n.closest(o).length){if(b){F.disable()}}else if(get_selected_html()===""&&n){if(++t===1){if(!C){if(!b){F.focus();F.scroll_to_bottom()}else{var e=E.clickTimeout;F.oneTime(e,r,u);return}}}else{F.stopTime(r)}}a()}).dblclick(function(){a();F.stopTime(r)})})();(function(){var D=B.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"}F.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(!F.enabled()){F.enable()}var n=B.offset();var r=B[0].getBoundingClientRect();var i=F.offset();var u=i.top-n.top;var a=Math.max(e.pageY-n.top-20,u);var o=e.pageX-n.left-20;var s=4*14;var l=5*14;var f=F[0].getBoundingClientRect();var c=j.outerWidth()*O;var p=a+r.top+s;p=p-f.height-f.top;var m=o+r.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",a,true),style_prop("width",l,true),style_prop("height",s,true)].join(";"));if(!D.is(":focus")){D.focus()}F.stopTime("textarea");F.oneTime(100,"textarea",function(){var e={left:"",top:"",width:"",height:""};if(!is_css_variables_supported){var t=F.find(".cmd .cmd-cursor-line").prevUntil(".cmd-prompt").length;e.top=t*14+"px"}D.css(e)});F.stopTime("selection");F.everyTime(20,"selection",function(){if(D[0].selection!==D[0].value){if(get_textarea_selection(D[0])){clear_textarea_selection(D[0]);select(F.find(".terminal-output")[0],F.find(".cmd div:last-of-type")[0]);F.stopTime("selection")}}})}})})();F.on("scroll",function(){var e=F.find("textarea");var t=F[0].getBoundingClientRect();var n=F[0].scrollHeight;var r=S.scrollTop();var i=n-(r+t.height);if(i===0){e.css("top","")}else{e.css("top",-i)}})}F.on("click","a",function(e){var t=$(this);if(t.closest(".terminal-exception").length){var n=t.attr("href");if(n.match(/:[0-9]+$/)){e.preventDefault();K(n,F.cols())}}if(b){F.find(".cmd textarea").focus()}});function i(){var e=L.width;L=get_char_size(F);if(e!==L.width){B.option("charWidth",L.width).refresh()}}u();function u(){if(F.is(":visible")){var e=S.width();var t=j.height();O=ht();css(F[0],{"--pixel-density":O});if(pt){pt=!terminal_ready(F);if(!pt){L=get_char_size(F);i()}}if(rt!==t||nt!==e||O!==it){F.resize()}rt=t;nt=e;it=O}}function a(){var e={prefix:"terminal-"};F.resizer("unbind").resizer(u,e);ft.resizer("unbind").resizer(function(){i();F.resize()},e);ct.resizer("unbind").resizer(function(){O=ht();F.refresh()},e);$('<div class="terminal-font-forcer terminal-hidden">x<div>').appendTo(F)}function o(e){Ze=e[0].intersectionRatio>=.9}function s(){if(window.IntersectionObserver){var e=$('<div class="terminal-scroll-marker"/>').appendTo(S);var t=e;if(E.scrollBottomOffset!==-1){var n=style_prop("height",E.scrollBottomOffset);t=$('<div style="'+n+'"/>').appendTo(e)}et=new IntersectionObserver(o,{root:S[0],rootMargin:"0px",threshold:1});et.observe(t[0])}}s();if(F.is(":visible")){a()}function l(){if(T){if(T.unobserve){T.unobserve(F[0])}else{clearInterval(T)}}var e=F.enabled();var t=F.is(":visible");if(e&&!t){F.disable()}if(t){a()}else{R.css("visibility","hidden")}function n(){if(F.is(":visible")&&!t){t=true;a();i();u();if(e){F.enable()}R.css("visibility","")}else if(t&&!F.is(":visible")){t=false;e=$.terminal.active()===F&&F.enabled();F.disable();R.css("visibility","hidden")}}if(window.IntersectionObserver&&F.css("position")!=="fixed"){T=new IntersectionObserver(n,{root:null});T.observe(F[0])}else{T=setInterval(n,100)}}var f=!!F.closest("body").length;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){lt=new c(function(){if(F.closest("body").length){if(!f){F.scroll_to_bottom();l();u()}f=true}else if(f){f=false}});lt.observe(document.body,{childList:true})}if(f){l()}if(document.fonts&&document.fonts.ready){document.fonts.ready.then(function(){if(have_custom_font(F)){i();F.resize()}Ye.resolve()})}else{Ye.resolve()}if(b&&F.is(":visible")&&!is_mobile){F.focus(undefined,true)}else{F.disable()}if(is_function(I)){F.login(I,true,be);Xe.resolve();Ce()}else{be();Ce()}function p(e,t){var n=terminals.get()[e[0]];var r=$.Deferred();if(n&&g===n.id()){if(!e[2]){r.resolve();return r.promise()}else if(k){pe.push(function(){return n.exec(e[2],t).done(function(){n.save_state(e[2],true,e[1]);r.resolve()})});return r.promise()}else{return n.exec(e[2],t).done(function(){n.save_state(e[2],true,e[1])})}}}if(E.execHash){if(location.hash){setTimeout(function(){try{var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e));if(!e.match(/\[/)){_e(hash_commands)}var n=0;var r={typing:E.execAnimation,delay:E.execAnimationDelay};(function e(){var t=hash_commands[n++];if(t){p(t,r).done(e)}else{change_hash=true}})()}catch(e){}})}else{change_hash=true}}else{change_hash=true}(function(){var i=false;$(document).bind("keydown.terminal_"+F.id(),function(e){if(e.shiftKey){i=true}}).bind("keyup.terminal_"+F.id(),function(e){if(e.shiftKey||e.which===16){i=false}});function n(e,t){if(!i){var n=A.top();var r;if(is_function(n.mousewheel)){r=n.mousewheel(e,t,F)}else if(is_function(E.mousewheel)){r=E.mousewheel(e,t,F)}if(r===true){return}if((oe()||r===false)&&!e.ctrlKey){e.stopPropagation();e.preventDefault()}if(r===false){return false}if(t>0){F.scroll(-40)}else{F.scroll(40)}}}if($.event.special.mousewheel){S.on("mousewheel",n)}else{var r;var e=document.createElement("div");if("onwheel"in e){r="wheel"}else if(document.onmousewheel!==undefined){r="mousewheel"}else{r="DOMMouseScroll"}e=null;F.on(r,function(e){var t;if(r==="mousewheel"){t=-1/40*e.originalEvent.wheelDelta}else{t=e.originalEvent.deltaY||e.originalEvent.detail}n(e,-t)})}S.touch_scroll(function(e){var t=e.current.clientY-e.previous.clientY;var n;var r=A.top();if(is_function(r.touchscroll)){n=r.touchscroll(e,t,F)}else if(is_function(E.touchscroll)){n=E.touchscroll(e,t,F)}css(F[0],{"--terminal-scroll":S.prop("scrollTop")});if(n===true){return}return false})})()});return F}});
//# sourceMappingURL=jquery.terminal.min.js.map