\][)])+\b)/gi;var A=/\b(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'<>\][)])+)\b(?![^[\]]*])/gi;var F=/((([^<>('")[\]\\.,;:\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 L=/('(?:[^']|\\')*'|"(\\"|[^"])*"|(?:\/(\\\/|[^\/])+\/[gimy]*)(?=:? |$)|(\\\s|\S)+|[\w-]+)/gi;var O=/(\[\[[!gbiuso]*;[^;]*;[^\]]*\])/i;var P=/^(\[\[[!gbiuso]*;[^;]*;[^\]]*\])/i;var j=/\[\[[!gbiuso]*;[^;]*;[^\]]*\]?$/i;var I=/(\[\[(?:[^\]]|\\\])*\]\])/;var N=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;var $=/^\/((?:\\\/|[^\/]|\[[^\]]*\/[^\]]*\])+)\/([gimy]*)$/;e.terminal={version:"1.1.2",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"],valid_color:function(n){if(n.match(E)){return true}else{return e.inArray(n.toLowerCase(),e.terminal.color_names)!==-1}},escape_regex:function(e){if(typeof e==="string"){var n=/([-\\^$[\]()+{}?*.|])/g;return e.replace(n,"\\$1")}},have_formatting:function(e){return typeof e==="string"&&!!e.match(R)},is_formatting:function(e){return typeof e==="string"&&!!e.match(C)},format_split:function(e){return e.split(k)},split_equal:function(n,r,t){var i=false;var o=false;var a="";var s=[];var l=n.replace(T,function(e,n,r){var t=n.match(/;/g).length;if(t>=4){return e}else if(t===2){t=";;"}else if(t===3){t=";"}else{t=""}var i=r.replace(/\\\]/g,"]").replace(/\n/g,"\\n").replace(/ /g," ");return"[["+n+t+i+"]"+r+"]"}).split(/\n/g);function f(){return m.substring(y-6,y)===" "||m.substring(y-1,y)===" "}function c(){var e=g.match(T);if(e){var n=e[e.length-1];if(n[n.length-1]!=="]"){a=n.match(O)[1];g+="]"}else if(g.match(j)){g=g.replace(j,"");a=n.match(O)[1]}}}for(var u=0,p=l.length;u"+b+"").text();var k=b.length;b=b.substring(0,y+r+1);var x=!!b.match(/\s/)||y+r+1>k;if(t&&v!==-1&&y!==_-1&&x){g=m.substring(h,v);y=v-1}else{g=m.substring(h,y+1)}if(t){g=g.replace(/( |\s)+$/g,"")}v=-1;h=y+1;d=0;if(a){g=a+g;if(g.match("]")){a=""}}c();s.push(g)}}}return s},encode:function(e){e=e.replace(/&(?!#[0-9]+;|[a-zA-Z]+;)/g,"&");return e.replace(//g,">").replace(/ /g," ").replace(/\t/g," ")},escape_formatting:function(n){return e.terminal.escape_brackets(e.terminal.encode(n))},format:function(n,r){var t=e.extend({},{linksNoReferrer:false},r||{});if(typeof n==="string"){var i=e.terminal.format_split(n);n=e.map(i,function(n){if(n===""){return n}else if(e.terminal.is_formatting(n)){n=n.replace(/\[\[[^\]]+\]/,function(e){return e.replace(/ /g," ")});return n.replace(x,function(n,r,i,o,a,s,l){if(l===""){return""}l=l.replace(/\\]/g,"]");var f="";if(r.indexOf("b")!==-1){f+="font-weight:bold;"}var c=[];if(r.indexOf("u")!==-1){c.push("underline")}if(r.indexOf("s")!==-1){c.push("line-through")}if(r.indexOf("o")!==-1){c.push("overline")}if(c.length){f+="text-decoration:"+c.join(" ")+";"}if(r.indexOf("i")!==-1){f+="font-style:italic;"}if(e.terminal.valid_color(i)){f+="color:"+i+";";if(r.indexOf("g")!==-1){f+="text-shadow:0 0 5px "+i+";"}}if(e.terminal.valid_color(o)){f+="background-color:"+o}var u;if(s===""){u=l}else{u=s.replace(/]/g,"]")}var p;if(r.indexOf("!")!==-1){if(u.match(F)){p='"+l+""}else{p+=' data-text="'+u.replace('"',""e;")+'">'+l+""}return p})}else{return""+n.replace(/\\\]/g,"]")+""}}).join("");return n.replace(/
<\/span>/gi,"
")}else{return""}},escape_brackets:function(e){return e.replace(/\[/g,"[").replace(/\]/g,"]")},strip:function(e){return e.replace(x,"$6")},active:function(){return Z.front()},last_id:function(){var e=Z.length();if(e){return e-1}},parse_arguments:function(n){return e.map(n.match(L)||[],function(n){var r=n.match($);if(r){return new RegExp(r[1],r[2])}else if(n[0]==="'"&&n[n.length-1]==="'"&&n.length>1){return n.replace(/^'|'$/g,"")}else if(n[0]==='"'&&n[n.length-1]==='"'&&n.length>1){return e.parseJSON(n)}else if(n.match(/^-?[0-9]+$/)){return parseInt(n,10)}else if(n.match(N)){return parseFloat(n)}else if(n.match(/^['"]$/)){return""}else{return n.replace(/\\(['"() ])/g,"$1")}})},split_arguments:function(n){return e.map(n.match(L)||[],function(e){if(e[0]==="'"&&e[e.length-1]==="'"){return e.replace(/^'|'$/g,"")}else if(e[0]==='"'&&e[e.length-1]==='"'){return e.replace(/^"|"$/g,"").replace(/\\([" ])/g,"$1")}else if(e.match(/\/.*\/[gimy]*$/)){return e}else{return e.replace(/\\ /g," ")}})},parse_command:function(n){return b(n,e.terminal.parse_arguments)},split_command:function(n){return b(n,e.terminal.split_arguments)},extended_command:function(e,n){try{re=false;e.exec(n,true).then(function(){re=true})}catch(r){}}};e.fn.visible=function(){return this.css("visibility","visible")};e.fn.hidden=function(){return this.css("visibility","hidden")};e.fn.scroll_element=function(){var n=e.fn.scroll_element.defaults;return this.map(function(){var r=e(this);if(r.is("body")){var t=e("html");var i=e("body");var o=i.scrollTop()||t.scrollTop();var a=e("").css(n.pre).appendTo("body");a.html(new Array(n.lines).join("\n"));e("body,html").scrollTop(10);var s;if(i.scrollTop()===10){i.scrollTop(o);s=i[0]}else if(t.scrollTop()===10){t.scrollTop(o);s=t[0]}a.remove();return s}else{return this}})};e.fn.scroll_element.defaults={lines:2e3,pre:{"font-size":"14px","white-space":"pre"}};function z(){if(!("KeyboardEvent"in window&&"key"in window.KeyboardEvent.prototype)){return false}var e=window.KeyboardEvent.prototype;var n=Object.getOwnPropertyDescriptor(e,"key").get;return n.toString().match(/\[native code\]/)}function H(e){if(console&&console.warn){console.warn(e)}else{throw new Error("WARN: "+e)}}var D={};e.jrpc=function(n,r,t,i,o){var a;if(e.isPlainObject(n)){a=n}else{a={url:n,method:r,params:t,success:i,error:o}}function s(e){return typeof e.id==="number"&&typeof e.result!=="undefined"||a.method==="system.describe"&&e.name==="DemoService"&&typeof e.id!=="undefined"&&e.procs instanceof Array;
-
-}D[a.url]=D[a.url]||0;var l={jsonrpc:"2.0",method:a.method,params:a.params,id:++D[a.url]};return e.ajax({url:a.url,beforeSend:function(n,r){if(e.isFunction(a.request)){a.request(n,l)}r.data=JSON.stringify(l)},success:function(n,r,t){var i=t.getResponseHeader("Content-Type");if(!i.match(/(application|text)\/json/)){H("Response Content-Type is neither application/json"+" nor text/json")}var o;try{o=e.parseJSON(n)}catch(l){if(a.error){a.error(t,"Invalid JSON",l)}else{throw new Error("Invalid JSON")}return}if(e.isFunction(a.response)){a.response(t,o)}if(s(o)){a.success(o,r,t)}else if(a.error){a.error(t,"Invalid JSON-RPC")}else{throw new Error("Invalid JSON-RPC")}},error:a.error,contentType:"application/json",dataType:"text",async:true,cache:false,type:"POST"})};function B(){var n=e('').appendTo("body");var r=n.find("span");var t={width:r.width(),height:r.outerHeight()};n.remove();return t}function M(n){var r=e(''+"
").appendTo("body").css("padding",0);var t=r.find("span");var i=t[0].getBoundingClientRect().width;var o=Math.floor(n.find("iframe").width()/i);r.remove();return o}function W(e){return Math.floor(e.height()/B().height)}function U(){if(window.getSelection||document.getSelection){var e=(window.getSelection||document.getSelection)();if(e.text){return e.text}else{return e.toString()}}else if(document.selection){return document.selection.createRange().text}}function K(n,r){var t=e(""+r.replace(/\n/,"
")+"
");var i;n.append(t);if(document.body.createTextRange){i=document.body.createTextRange();i.moveToElementText(t[0]);i.select()}else if(window.getSelection){var o=window.getSelection();if(o.setBaseAndExtent){o.setBaseAndExtent(t[0],0,t[0],1)}else if(document.createRange){i=document.createRange();i.selectNodeContents(t[0]);o.removeAllRanges();o.addRange(i)}}try{document.execCommand("copy")}catch(a){}t.remove()}var q=!e.terminal.version.match(/^\{\{/);var J="Copyright (c) 2011-2017 Jakub Jankiewicz
";var G=q?" v. "+e.terminal.version:" ";var Y=new RegExp(" {"+G.length+"}$");var X="jQuery Terminal Emulator"+(q?G:"");var V=[["jQuery Terminal","(c) 2011-2017 jcubic"],[X,J.replace(/^Copyright | *<.*>/g,"")],[X,J.replace(/^Copyright /,"")],[" _______ ________ __"," / / _ /_ ____________ _/__ ___/______________ _____ / /"," __ / / // / // / _ / _/ // / / / _ / _/ / / \\/ / _ \\/ /","/ / / // / // / ___/ // // / / / ___/ // / / / / /\\ / // / /__","\\___/____ \\\\__/____/_/ \\__ / /_/____/_//_/_/_/ /_/ \\/\\__\\_\\___/"," \\/ /____/ ".replace(Y," ")+G,J],[" __ _____ ________ "+" __"," / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ "+" / /"," __ / // // // // // _ // _// // / / // _ // _// // // \\/ // _ "+"\\/ /","/ / // // // // // ___// / / // / / // ___// / / / / // // /\\ // // "+"/ /__","\\___//____ \\\\___//____//_/ _\\_ / /_//____//_/ /_/ /_//_//_/ /_/ \\"+"__\\_\\___/",(" \\/ /____/ "+" ").replace(Y,"")+G,J]];e.terminal.defaults={prompt:"> ",history:true,exit:true,clear:true,enabled:true,historySize:60,maskChar:"*",wrap:true,checkArity:true,raw:false,exceptionHandler:null,pauseEvents:true,memory:false,cancelableAjax:true,processArguments:true,linksNoReferrer:false,processRPCResponse:null,Token:true,convertLinks:true,extra:{},historyState:false,importHistory:false,echoCommand:true,scrollOnEcho:true,login:null,outputLimit:-1,formatters:[],onAjaxError:null,scrollBottomOffset:20,wordAutocomplete:true,clickTimeout:200,request:e.noop,response:e.noop,onRPCError:null,completion:false,historyFilter:null,softPause:false,onInit:e.noop,onClear:e.noop,onBlur:e.noop,onFocus:e.noop,onTerminalChange:e.noop,onExit:e.noop,onPush:e.noop,onPop:e.noop,keypress:e.noop,keydown:e.noop,strings:{comletionParameters:"From version 1.0.0 completion function need to"+" have two arguments",wrongPasswordTryAgain:"Wrong password try again!",wrongPassword:"Wrong password!",ajaxAbortError:"Error while aborting ajax call!",wrongArity:"Wrong number of arguments. Function '%s' expects %s got"+" %s!",commandNotFound:"Command '%s' Not Found!",oneRPCWithIgnore:"You can use only one rpc with ignoreSystemDescr"+"ibe or rpc without system.describe",oneInterpreterFunction:"You can't use more than one function (rpc "+"without system.describe or with option ignoreSystemDescribe cou"+"nts 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 "%s" is not valid '+"selector!",invalidTerminalId:"Invalid Terminal ID",login:"login",password:"password",recursiveCall:"Recursive call detected, skip",notAString:"%s function: argument is not a string",redrawError:"Internal error, wrong position in cmd redraw"}};var Q=[];var Z=new h;var ee=[];var ne;var re=false;var te=true;var ie=true;e.fn.terminal=function(r,i){function o(n){if(n){this.storage={}}this.set=function(r,t){if(n){this.storage[r]=t}else{e.Storage.set(r,t)}};this.get=function(r){if(n){return this.storage[r]}else{return e.Storage.get(r)}};this.remove=function(r){if(n){delete this.storage[r]}else{e.Storage.remove(r)}}}function a(n){if(e.isFunction(Ee.processArguments)){return b(n,Ee.processArguments)}else if(Ee.processArguments){return e.terminal.parse_command(n)}else{return e.terminal.split_command(n)}}function s(n){if(typeof n==="string"){se.echo(n)}else if(n instanceof Array){se.echo(e.map(n,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof n==="object"){se.echo(JSON.stringify(n))}else{se.echo(n)}}function l(n){var r=/(.*):([0-9]+):([0-9]+)$/;var t=n.match(r);if(t){se.pause(Ee.softPause);e.get(t[1],function(n){var r=location.href.replace(/[^\/]+$/,"");var i=t[1].replace(r,"");se.echo("[[b;white;]"+i+"]");var o=n.split("\n");var a=+t[2]-1;se.echo(o.slice(a-2,a+3).map(function(n,r){if(r===2){n="[[;#f00;]"+e.terminal.escape_brackets(n)+"]"}return"["+(a+r)+"]: "+n}).join("\n")).resume()},"text")}}function f(n){if(e.isFunction(Ee.onRPCError)){Ee.onRPCError.call(se,n)}else{se.error("[RPC] "+n.message);if(n.error&&n.error.message){n=n.error;var r=" "+n.message;if(n.file){r+=' in file "'+n.file.replace(/.*\//,"")+'"'}if(n.at){r+=" at line "+n.at}se.error(r)}}}function c(n,r){var t=function(r,t){se.pause(Ee.softPause);e.jrpc({url:n,method:r,params:t,request:function(e,n){try{Ee.request.apply(se,e,n,se)}catch(r){y(r,"USER")}},response:function(e,n){try{Ee.response.apply(se,e,n,se)}catch(r){y(r,"USER")}},success:function(n){if(n.error){f(n.error)}else if(e.isFunction(Ee.processRPCResponse)){Ee.processRPCResponse.call(se,n.result,se)}else{s(n.result)}se.resume()},error:p})};return function(e,n){if(e===""){return}try{e=a(e)}catch(i){y(i,"TERMINAL (get_processed_command)");return}if(!r||e.name==="help"){t(e.name,e.args)}else{var o=n.token();if(o){t(e.name,[o].concat(e.args))}else{n.error("[AUTH] "+Ae.noTokenError)}}}}function u(r,t,i,o){return function(s,l){if(s===""){return}var f;try{f=a(s)}catch(c){if(e.isFunction(Ee.exception)){Ee.exception(c,se)}else{se.error(c.toString())}return}var p=r[f.name];var m=e.type(p);if(m==="function"){if(t&&p.length!==f.args.length){se.error("[Arity] "+sprintf(Ae.wrongArity,f.name,p.length,f.args.length))}else{return p.apply(se,f.args)}}else if(m==="object"||m==="string"){var h=[];if(m==="object"){h=Object.keys(p);p=u(p,t,i)}l.push(p,{prompt:f.name+"> ",name:f.name,completion:m==="object"?h:n})}else if(e.isFunction(o)){o(s,se)}else if(e.isFunction(Ee.onCommandNotFound)){Ee.onCommandNotFound.call(se,s,se)}else{l.error(sprintf(Ae.commandNotFound,f.name))}}}function p(n,r,t){se.resume();if(e.isFunction(Ee.onAjaxError)){Ee.onAjaxError.call(se,n,r,t)}else if(r!=="abort"){se.error("[AJAX] "+r+" - "+Ae.serverResponse+":\n"+e.terminal.escape_brackets(n.responseText))}}function m(n,r,t){function i(n){if(n.error){f(n.error)}else if(e.isFunction(Ee.processRPCResponse)){Ee.processRPCResponse.call(se,n.result,se)}else{s(n.result)}se.resume()}function o(e,n){try{Ee.request.call(se,e,n,se)}catch(r){y(r,"USER")}}function a(e,n){try{Ee.response.call(se,e,n,se)}catch(r){y(r,"USER")}}function l(s){if(s.procs){var l={};e.each(s.procs,function(t,s){l[s.name]=function(){var t=r&&s.name!=="help";var l=Array.prototype.slice.call(arguments);var f=l.length+(t?1:0);if(Ee.checkArity&&s.params&&s.params.length!==f){se.error("[Arity] "+sprintf(Ae.wrongArity,s.name,s.params.length,f))}else{se.pause(Ee.softPause);if(t){var c=se.token(true);if(c){l=[c].concat(l)}else{se.error("[AUTH] "+Ae.noTokenError)}}e.jrpc({url:n,method:s.name,params:l,request:o,response:a,success:i,error:p})}}});l.help=l.help||function(n){if(typeof n==="undefined"){var r=s.procs.map(function(e){return e.name}).join(", ")+", help";se.echo("Available commands: "+r)}else{var t=false;e.each(s.procs,function(e,r){if(r.name===n){t=true;var i="";i+="[[bu;#fff;]"+r.name+"]";if(r.params){i+=" "+r.params.join(" ")}if(r.help){i+="\n"+r.help}se.echo(i);return false}});if(!t){if(n==="help"){se.echo("[[bu;#fff;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var i="Method `"+n+"' not found ";se.error(i)}}}};t(l)}else{t(null)}}return e.jrpc({url:n,method:"system.describe",params:[],success:l,request:function(e,n){try{Ee.request.call(se,e,n,se)}catch(r){y(r,"USER")}},response:function(e,n){try{Ee.response.call(se,e,n,se)}catch(r){y(r,"USER")}},error:function(){t(null)}})}function h(n,r,t){t=t||e.noop;var i=e.type(n);var o;var a={};var s=0;var l;if(i==="array"){o={};(function f(n,t){if(n.length){var i=n[0];var a=n.slice(1);var u=e.type(i);if(u==="string"){se.pause(Ee.softPause);if(Ee.ignoreSystemDescribe){if(++s===1){l=c(i,r)}else{se.error(Ae.oneRPCWithIgnore)}f(a,t)}else{m(i,r,function(n){if(n){e.extend(o,n)}else if(++s===1){l=c(i,r)}else{se.error(Ae.oneRPCWithIgnore)}se.resume();f(a,t)})}}else if(u==="function"){if(l){se.error(Ae.oneInterpreterFunction)}else{l=i}f(a,t)}else if(u==="object"){e.extend(o,i);f(a,t)}}else{t()}})(n,function(){t({interpreter:u(o,false,r,l.bind(se)),completion:Object.keys(o)})})}else if(i==="string"){if(Ee.ignoreSystemDescribe){o={interpreter:c(n,r)};if(e.isArray(Ee.completion)){o.completion=Ee.completion}t(o)}else{se.pause(Ee.softPause);m(n,r,function(e){if(e){a.interpreter=u(e,false,r);a.completion=Object.keys(e)}else{a.interpreter=c(n,r)}t(a);se.resume()})}}else if(i==="object"){t({interpreter:u(n,Ee.checkArity),completion:Object.keys(n)})}else{if(i==="undefined"){n=e.noop}else if(i!=="function"){throw new Error(i+" is invalid interpreter value")}t({interpreter:n,completion:Ee.completion})}}function g(n,r){var t=e.type(r)==="boolean"?"login":r;return function(r,i,o){se.pause(Ee.softPause);e.jrpc({url:n,method:t,params:[r,i],request:function(e,n){try{Ee.request.call(se,e,n,se)}catch(r){y(r,"USER")}},response:function(e,n){try{Ee.response.call(se,e,n,se)}catch(r){y(r,"USER")}},success:function(e){if(!e.error&&e.result){o(e.result)}else{o(null)}se.resume()},error:p})}}function v(e){if(typeof e==="string"){return e}else if(typeof e.fileName==="string"){return e.fileName+": "+e.message}else{return e.message}}function y(n,r){if(e.isFunction(Ee.exceptionHandler)){Ee.exceptionHandler.call(se,n,r)}else{se.exception(n,r)}}function _(){var e;if(le.prop){e=le.prop("scrollHeight")}else{e=le.attr("scrollHeight")}le.scrollTop(e)}function k(n,r){try{if(e.isFunction(r)){r(function(){})}else if(typeof r!=="string"){var t=n+" must be string or function";throw t}}catch(i){y(i,n.toUpperCase());return false}return true}var x=[];var T=1;function R(r,t){if(Ee.convertLinks&&!t.raw){r=r.replace(F,"[[!;;]$1]").replace(A,"[[!;;]$1]")}var i=e.terminal.defaults.formatters;var o,a;if(!t.raw){if(t.formatters){for(o=0;ohe||r.match(/\n/))&&(Ee.wrap===true&&t.wrap===n||Ee.wrap===false&&t.wrap===true)){var f=t.keepWords;var c=e.terminal.split_equal(r,he,f);for(o=0,a=c.length;o")}else if(t.raw){x.push(c[o])}else{x.push(e.terminal.format(c[o],{linksNoReferrer:Ee.linksNoReferrer}))}}}else if(!t.raw){r=e.terminal.format(r,{linksNoReferrer:Ee.linksNoReferrer});r.split(/\n/).forEach(function(e){x.push(e)})}else{x.push(r)}x.push(t.finalize)}function C(n,r){try{var t=e.extend({exec:true,raw:false,finalize:e.noop},r||{});var i=e.type(n)==="function"?n():n;i=e.type(i)==="string"?i:String(i);if(i!==""){i=e.map(i.split(I),function(n){if(n.match(I)&&!e.terminal.is_formatting(n)){n=n.replace(/^\[\[|\]\]$/g,"");if(t.exec){if(fe&&fe.command===n){se.error(Ae.recursiveCall)}else{e.terminal.extended_command(se,n)}}return""}else{return n}}).join("");if(i!==""){R(i,t)}}}catch(o){x=[];if(e.isFunction(Ee.exceptionHandler)){Ee.exceptionHandler.call(se,o,"TERMINAL")}else{alert("[Internal Exception(process_line)]:"+v(o)+"\n"+o.stack)}}}function E(){Be.resize(he);var n=pe.empty().detach();var r;if(Ee.outputLimit>=0){var t;if(Ee.outputLimit===0){t=se.rows()}else{t=Ee.outputLimit}r=ue.slice(ue.length-t-1)}else{r=ue}try{x=[];e.each(r,function(e,n){C.apply(null,n)});Be.before(n);se.flush()}catch(i){if(e.isFunction(Ee.exceptionHandler)){Ee.exceptionHandler.call(se,i,"TERMINAL (redraw)")}else{alert("Exception in redraw\n"+i.stack)}}}function L(){if(Ee.greetings===n){se.echo(se.signature)}else if(Ee.greetings){var e=typeof Ee.greetings;if(e==="string"){se.echo(Ee.greetings)}else if(e==="function"){Ee.greetings.call(se,se.echo)}else{se.error(Ae.wrongGreetings)}}}function O(n){if(typeof n==="undefined"){n=se.get_command()}var r=Be.prompt();var t=Be.mask();switch(typeof t){case"string":n=n.replace(/./g,t);break;case"boolean":if(t){n=n.replace(/./g,Ee.maskChar)}else{n=e.terminal.escape_formatting(n)}break}var i={finalize:function(e){e.addClass("command")}};if(e.isFunction(r)){r(function(e){se.echo(e+n,i)})}else{se.echo(r+n,i)}}function P(e){var n=Z.get()[e[0]];if(!n){throw new Error(Ae.invalidTerminalId)}var r=e[1];if(ee[r]){n.import_view(ee[r])}else{re=false;var t=e[2];if(t){n.exec(t).then(function(){re=true;ee[r]=n.export_view()})}}}function j(){if(re){te=false;location.hash="#"+JSON.stringify(ne);setTimeout(function(){te=true},100)}}var N=true;var $=[];function z(r,t,i){if(N){N=false;if(Ee.historyState||Ee.execHash&&i){if(!ee.length){se.save_state()}else{se.save_state(null)}}}function o(){if(!i){re=true;if(Ee.historyState){se.save_state(r,false)}re=f}l.resolve();if(e.isFunction(Ee.onAfterCommand)){Ee.onAfterCommand.call(se,se,r)}}try{if(e.isFunction(Ee.onBeforeCommand)){if(Ee.onBeforeCommand.call(se,se,r)===false){return}}if(!i){fe=e.terminal.split_command(r)}if(!G()){if(i&&(e.isFunction(Ee.historyFilter)&&Ee.historyFilter(r)||r.match(Ee.historyFilter))){Be.history().append(r)}}var a=De.top();if(!t&&Ee.echoCommand){O(r)}var l=new e.Deferred;var f=re;if(r.match(/^\s*login\s*$/)&&se.token(true)){if(se.level()>1){se.logout(true)}else{se.logout()}o()}else if(Ee.exit&&r.match(/^\s*exit\s*$/)&&!ke){var c=se.level();if(c===1&&se.get_token()||c>1){if(se.get_token(true)){se.set_token(n,true)}se.pop()}o()}else if(Ee.clear&&r.match(/^\s*clear\s*$/)&&!ke){se.clear();o()}else{var u=ue.length-1;var p=a.interpreter.call(se,r,se);if(p!==n){se.pause(Ee.softPause);return e.when(p).then(function(e){if(e&&u===ue.length-1){s(e)}o();se.resume()})}else if(Oe){$.push(function(){o()})}else{o()}}return l.promise()}catch(m){y(m,"USER");se.resume();throw m}}function H(){if(e.isFunction(Ee.onBeforeLogout)){try{if(Ee.onBeforeLogout.call(se,se)===false){return}}catch(n){y(n,"onBeforeLogout")}}D();if(e.isFunction(Ee.onAfterLogout)){try{Ee.onAfterLogout.call(se,se)}catch(n){y(n,"onAfterlogout")}}se.login(Ee.login,true,J)}function D(){var e=se.prefix_name(true)+"_";Se.remove(e+"token");Se.remove(e+"login")}function B(n){var r=se.prefix_name()+"_interpreters";var t=Se.get(r);if(t){t=e.parseJSON(t)}else{t=[]}if(e.inArray(n,t)===-1){t.push(n);Se.set(r,JSON.stringify(t))}}function K(n){var r=De.top();var t=se.prefix_name(true);if(!G()){B(t)}Be.name(t);if(e.isFunction(r.prompt)){Be.prompt(function(e){r.prompt.call(se,e,se)})}else{Be.prompt(r.prompt)}if(e.isPlainObject(r.keymap)){Be.keymap(e.omap(r.keymap,function(e,n){return function(){var e=[].slice.call(arguments);try{return n.apply(se,e)}catch(r){y(r,"USER KEYMAP");throw r}}}))}Be.set("");_e.resolve();if(!n&&e.isFunction(r.onStart)){r.onStart.call(se,se)}}function q(){if(te&&Ee.execHash){try{if(location.hash){var n=location.hash.replace(/^#/,"");ne=e.parseJSON(decodeURIComponent(n))}else{ne=[]}if(ne.length){P(ne[ne.length-1])}else if(ee[0]){se.import_view(ee[0])}}catch(r){y(r,"TERMINAL")}}}function J(){K();L();if(ue.length){E()}var n=false;if(e.isFunction(Ee.onInit)){xe=function(){n=true};try{Ee.onInit.call(se,se)}catch(r){y(r,"OnInit")}finally{xe=e.noop;if(!n&&se.enabled()){se.resume()}}}if(ie){ie=false;e(window).on("hashchange",q)}}function G(){return ke||Be.mask()!==false}function Y(r){var t,i=De.top();if(e.isFunction(i.keydown)){t=i.keydown.call(se,r,se);if(t!==n){return t}}else if(e.isFunction(Ee.keydown)){t=Ee.keydown.call(se,r,se);if(t!==n){return t}}}var X={"CTRL+D":function(e,r){if(!ke){if(Be.get()===""){if(De.size()>1||Ee.login!==n){se.pop("")}else{se.resume();se.echo("")}}else{r()}}return false},"CTRL+L":function(){se.clear()},TAB:function(r,t){var i=De.top(),o;if(Ee.completion&&e.type(Ee.completion)!=="boolean"&&i.completion===n){o=Ee.completion}else{o=i.completion}if(o==="settings"){o=Ee.completion}if(o){switch(e.type(o)){case"function":var a=se.before_cursor(Ee.wordAutocomplete);if(o.length===3){var s=new Error(Ae.comletionParameters);y(s,"USER");return false}o.call(se,a,function(e){se.complete(e,{echo:true})});break;case"array":se.complete(o,{echo:true});break;default:throw new Error(Ae.invalidCompletion)}}else{t()}return false},"CTRL+V":function(e,n){n(e);se.oneTime(200,function(){_()});return true},"CTRL+TAB":function(){if(Z.length()>1){se.focus(false);return false}},PAGEDOWN:function(){se.scroll(se.height())},PAGEUP:function(){se.scroll(-se.height())}};function oe(r){var t,i;if(se.enabled()){if(!se.paused()){t=Y(r);if(t!==n){return t}if(r.which!==9){ce=0}se.attr({scrollTop:se.attr("scrollHeight")})}else{if(!Ee.pauseEvents){t=Y(r);if(t!==n){return t}}if(r.which===68&&r.ctrlKey){if(Ee.pauseEvents){t=Y(r);if(t!==n){return t}}if(Q.length){for(i=Q.length;i--;){var o=Q[i];if(o.readyState!==4){try{o.abort()}catch(a){if(e.isFunction(Ee.exceptionHandler)){Ee.exceptionHandler.call(se,r,"AJAX ABORT")}else{se.error(Ae.ajaxAbortError)}}}}Q=[]}se.resume()}return false}}}function ae(e){return function(n){if(e.state()!=="resolved"){e.then(n.bind(se))}else{n.call(se)}}}var se=this;if(this.length>1){return this.each(function(){e.fn.terminal.call(e(this),r,e.extend({name:se.selector},i))})}if(se.data("terminal")){return se.data("terminal")}if(se.length===0){throw sprintf(e.terminal.defaults.strings.invalidSelector,se.selector)}var le;var fe;var ce=0;var ue=[];var pe;var me=Z.length();var he;var de;var ge;var ve=new d;var ye=e.Deferred();var _e=e.Deferred();var we=ae(_e);var be=ae(ye);var ke=false;var xe=e.noop;var Te,Re;var Ce=[];var Ee=e.extend({},e.terminal.defaults,{name:se.selector},i||{});var Se=new o(Ee.memory);var Ae=e.extend({},e.terminal.defaults.strings,Ee.strings);var Fe=Ee.enabled,Le=false;var Oe=false;var Pe=true;e.extend(se,e.omap({id:function(){return me},clear:function(){pe.html("");ue=[];try{Ee.onClear.call(se,se)}catch(e){y(e,"onClear")}se.attr({scrollTop:0});return se},export_view:function(){var n={};if(e.isFunction(Ee.onExport)){try{n=Ee.onExport.call(se)}catch(r){y(r,"onExport")}}return e.extend({},{focus:Fe,mask:Be.mask(),prompt:se.get_prompt(),command:se.get_command(),position:Be.position(),lines:t(ue),interpreters:De.clone(),history:Be.history().data},n)},import_view:function(n){if(ke){throw new Error(sprintf(Ae.notWhileLogin,"import_view"))}if(e.isFunction(Ee.onImport)){try{Ee.onImport.call(se,n)}catch(r){y(r,"onImport")}}we(function i(){se.set_prompt(n.prompt);se.set_command(n.command);Be.position(n.position);Be.mask(n.mask);if(n.focus){se.focus()}ue=t(n.lines);De=n.interpreters;if(Ee.importHistory){Be.history().set(n.history)}E()});return se},save_state:function(r,t,i){if(typeof i!=="undefined"){ee[i]=se.export_view()}else{ee.push(se.export_view())}if(!e.isArray(ne)){ne=[]}if(r!==n&&!t){var o=[me,ee.length-1,r];ne.push(o);j()}},exec:function(n,r,t){var i=t||new e.Deferred;be(function o(){if(e.isArray(n)){(function t(){var e=n.shift();if(e){se.exec(e,r).then(t)}else{i.resolve()}})()}else if(Oe){Ce.push([n,r,i])}else{z(n,r,true).then(function(){i.resolve(se)})}});return i.promise()},autologin:function(e,n,r){se.trigger("terminal.autologin",[e,n,r]);return se},login:function(r,t,i,o){ve.push([].slice.call(arguments));if(ke){throw new Error(sprintf(Ae.notWhileLogin,"login"))}if(!e.isFunction(r)){throw new Error(Ae.loginIsNotAFunction)}ke=true;if(se.token()&&se.level()===1&&!Pe){ke=false;se.logout(true)}else if(se.token(true)&&se.login_name(true)){ke=false;if(e.isFunction(i)){i()}return se}if(Ee.history){Be.history().disable()}var a=se.level();function s(r,s,l){if(s){while(se.level()>a){se.pop(n,true)}if(Ee.history){Be.history().enable()}var f=se.prefix_name(true)+"_";Se.set(f+"token",s);Se.set(f+"login",r);ke=false;if(e.isFunction(i)){i()}}else{if(t){if(!l){se.error(Ae.wrongPasswordTryAgain)}se.pop(n,true).set_mask(false)}else{ke=false;if(!l){se.error(Ae.wrongPassword)}se.pop(n,true).pop(n,true)}if(e.isFunction(o)){o()}}se.off("terminal.autologin")}se.on("terminal.autologin",function(e,n,r,t){s(n,r,t)});se.push(function(e){se.set_mask(Ee.maskChar).push(function(n){try{r.call(se,e,n,function(n,r){s(e,n,r)})}catch(t){y(t,"AUTH")}},{prompt:Ae.password+": ",name:"password"})},{prompt:Ae.login+": ",name:"login"});return se},settings:function(){return Ee},before_cursor:function(e){var n=Be.position();var r=Be.get().substring(0,n);var t=r.split(" ");var i;if(e){if(t.length===1){i=t[0]}else{var o=r.match(/(\\?")/g);var a=o?o.filter(function(e){return!e.match(/^\\/)}).length:0;o=r.match(/'/g);var s=o?o.length:0;if(s%2===1){i=r.match(/('[^']*)$/)[0]}else if(a%2===1){i=r.match(/("(?:[^"]|\\")*)$/)[0]}else{i=t[t.length-1];for(ze=t.length-1;ze>0;ze--){var l=t[ze-1];if(l[l.length-1]==="\\"){i=t[ze-1]+" "+i}else{break}}}}}else{i=r}return i},complete:function(n,r){r=e.extend({word:true,echo:false},r||{});var t=se.before_cursor(r.word).replace(/\\"/g,'"');var i=false;if(t.match(/^"/)){i='"'}else if(t.match(/^'/)){i="'"}if(i){t=t.replace(/^["']/,"")}n=n.slice();if(Ee.clear&&e.inArray("clear",n)===-1){n.push("clear")}if(Ee.exit&&e.inArray("exit",n)===-1){n.push("exit")}if(ce%2===0){ge=se.before_cursor(r.word)}else{var o=se.before_cursor(r.word);if(o!==ge){return}}var a=e.terminal.escape_regex(t).replace(/\\(["'() ])/g,"\\?$1");var s=new RegExp("^"+a);var l=[];for(var f=n.length;f--;){if(s.test(n[f])){var c=n[f];if(i==='"'){c=c.replace(/"/g,'\\"')}if(!i){c=c.replace(/(["'() ])/g,"\\$1")}l.push(c)}}if(l.length===1){se.insert(l[0].replace(s,"")+(i||""));ge=se.before_cursor(r.word);return true}else if(l.length>1){if(++ce>=2){ce=0;if(r.echo){O();var u=l.reverse().join(" ");se.echo(e.terminal.escape_brackets(u),{keepWords:true});return true}}else{var p=false;var m;e:for(m=t.length;m1){se.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(n,0)}else{setImmediate(n)}}else{Ee.historyState=false}return se},clear_history_state:function(){ne=[];ee=[];return se},next:function(){if(Z.length()===1){return se}else{Z.front().disable();var n=Z.rotate().enable();var r=n.offset().top-50;e("html,body").animate({scrollTop:r},500);try{Ee.onTerminalChange.call(n,n)}catch(t){y(t,"onTerminalChange")}return n}},focus:function(e,n){be(function r(){var r;if(Z.length()===1){if(e===false){try{r=Ee.onBlur.call(se,se);if(!n&&r!==false||n){se.disable()}}catch(t){y(t,"onBlur")}}else{try{r=Ee.onFocus.call(se,se);if(!n&&r!==false||n){se.enable()}}catch(t){y(t,"onFocus")}}}else if(e===false){se.next()}else{var i=Z.front();if(i!==se){i.disable();if(!n){try{Ee.onTerminalChange.call(se,se)}catch(t){y(t,"onTerminalChange")}}}Z.set(se);se.enable()}});return se},freeze:function(e){we(function n(){if(e){se.disable();Le=true}else{Le=false;se.enable()}})},frozen:function(){return Le},enable:function(){if(!Fe&&!Le){if(he===n){se.resize()}be(function e(){if(!se.paused()){Be.enable()}Fe=true})}return se},disable:function(){be(function e(){Fe=false;Be.disable()});return se},enabled:function(){return Fe},signature:function(){var e=se.cols();var n;if(e<15){n=null}else if(e<35){n=0}else if(e<55){n=1}else if(e<64){n=2}else if(e<75){n=3}else{n=4}if(n!==null){return V[n].join("\n")+"\n"}else{return""}},version:function(){return e.terminal.version},cmd:function(){return Be},get_command:function(){return Be.get()},set_command:function(e){we(function n(){Be.set(e)});return se},insert:function(e,n){if(typeof e==="string"){we(function r(){var r=se.is_bottom();Be.insert(e,n);if(Ee.scrollOnEcho||r){_()}});return se}else{throw new Error(sprintf(Ae.notAString,"insert"))}},set_prompt:function(n){we(function r(){if(k("prompt",n)){if(e.isFunction(n)){Be.prompt(function(e){n(e,se)})}else{Be.prompt(n)}De.top().prompt=n}});return se},get_prompt:function(){return De.top().prompt},set_mask:function(e){we(function n(){Be.mask(e===true?Ee.maskChar:e)});return se},get_output:function(n){if(n){return ue}else{return e.map(ue,function(n){return e.isFunction(n[0])?n[0]():n[0]}).join("\n")}},resize:function(n,r){if(!se.is(":visible")){se.stopTime("resize");se.oneTime(500,"resize",function(){se.resize(n,r)})}else{if(n&&r){se.width(n);se.height(r)}n=se.width();r=se.height();var t=se.cols();var i=se.rows();if(t!==he||i!==de){he=t;de=i;E();var o=De.top();if(e.isFunction(o.resize)){o.resize(se)}else if(e.isFunction(Ee.onResize)){Ee.onResize.call(se,se)}_()}}return se},flush:function(){try{var n=se.is_bottom();var r;e.each(x,function(n,t){if(t===T){r=e("")}else if(e.isFunction(t)){r.appendTo(pe);try{t(r)}catch(i){y(i,"USER:echo(finalize)")}}else{e("").html(t).appendTo(r).width("100%")}});if(Ee.outputLimit>=0){var t;if(Ee.outputLimit===0){t=se.rows()}else{t=Ee.outputLimit}var i=pe.find("div div");if(i.length>t){var o=i.length-t+1;var a=i.slice(0,o);var s=a.parent();a.remove();s.each(function(){var n=e(this);if(n.is(":empty")){n.remove()}})}}de=W(se);if(Ee.scrollOnEcho||n){_()}x=[]}catch(l){if(e.isFunction(Ee.exceptionHandler)){Ee.exceptionHandler.call(se,l,"TERMINAL (Flush)")}else{alert("[Flush] "+v(l)+"\n"+l.stack)}}return se},update:function(e,n){we(function r(){if(e<0){e=ue.length+e}if(!ue[e]){se.error("Invalid line number "+e)}else{if(n===null){ue.splice(e,1)}else{ue[e][0]=n}E()}});return se},last_index:function(){return ue.length-1},echo:function(n,r){function t(n){try{var t=e.extend({flush:true,raw:Ee.raw,finalize:e.noop,keepWords:false,formatters:true},r||{});if(t.flush){if(x.length){se.flush()}x=[]}C(n,t);ue.push([n,e.extend(t,{exec:false})]);if(t.flush){se.flush()}}catch(i){if(e.isFunction(Ee.exceptionHandler)){Ee.exceptionHandler.call(se,i,"TERMINAL (echo)")}else{alert("[Terminal.echo] "+v(i)+"\n"+i.stack)}}}n=n||"";var i=e.type(n);if(i==="function"||i==="string"){t(n)}else{e.when(n).then(t)}return se},error:function(n,r){r=e.extend({},r,{raw:false,formatters:false});var t=e.terminal.escape_brackets(n).replace(/\\$/,"\").replace(S,"]$1[[;;;error]");return se.echo("[[;;;error]"+t+"]",r)},exception:function(n,r){var t=v(n);if(r){t="["+r+"]: "+t}if(t){se.error(t,{finalize:function(e){e.addClass("exception message")},keepWords:true})}if(typeof n.fileName==="string"){se.pause(Ee.softPause);e.get(n.fileName,function(e){var r=n.lineNumber-1;var t=e.split("\n")[r];if(t){se.error("["+n.lineNumber+"]: "+t)}se.resume()},"text")}if(n.stack){var i=e.terminal.escape_brackets(n.stack);se.echo(i.split(/\n/g).map(function(e){return"[[;;;error]"+e.replace(S,function(e){return"]"+e+"[[;;;error]"})+"]"}).join("\n"),{finalize:function(e){e.addClass("exception stack-trace")},formatters:false})}},scroll:function(e){var n;e=Math.round(e);if(le.prop){if(e>le.prop("scrollTop")&&e>0){le.prop("scrollTop",0)}n=le.prop("scrollTop");le.scrollTop(n+e)}else{if(e>le.attr("scrollTop")&&e>0){le.attr("scrollTop",0)}n=le.attr("scrollTop");le.scrollTop(n+e)}return se},logout:function(e){if(ke){throw new Error(sprintf(Ae.notWhileLogin,"logout"))}we(function r(){if(e){var r=ve.pop();se.set_token(n,true);se.login.apply(se,r)}else if(De.size()===1&&se.token()){se.logout(true)}else{while(De.size()>1){if(se.token()){se.logout(true).pop().pop()}else{se.pop()}}}});return se},token:function(e){return Se.get(se.prefix_name(e)+"_token")},set_token:function(e,n){var r=se.prefix_name(n)+"_token";if(typeof e==="undefined"){Se.remove(r,e)}else{Se.set(r,e)}return se},get_token:function(e){return se.token(e)},login_name:function(e){return Se.get(se.prefix_name(e)+"_login")},name:function(){return De.top().name},prefix_name:function(e){var n=(Ee.name?Ee.name+"_":"")+me;if(e&&De.size()>1){var r=De.map(function(e){return e.name||""}).slice(1).join("_");if(r){n+="_"+r}}return n},read:function(n,r){var t=new e.Deferred;se.push(function(n){se.pop();if(e.isFunction(r)){r(n)}t.resolve(n)},{prompt:n});return t.promise()},push:function(r,t){be(function i(){t=t||{};var i={infiniteLogin:false};var o=e.extend({},i,t);if(!o.name&&fe){o.name=fe.name}if(o.prompt===n){o.prompt=(o.name||">")+" "}var a=De.top();if(a){a.mask=Be.mask()}var s=Oe;function l(){Ee.onPush.call(se,a,De.top(),se);K()}h(r,!!t.login,function(n){De.push(e.extend({},n,o));if(o.completion===true){if(e.isArray(n.completion)){De.top().completion=n.completion}else if(!n.completion){De.top().completion=false}}if(o.login){var t;var i=e.type(o.login);if(i==="function"){t=o.infiniteLogin?e.noop:se.pop;se.login(o.login,o.infiniteLogin,l,t)}else if(e.type(r)==="string"&&i==="string"||i==="boolean"){t=o.infiniteLogin?e.noop:se.pop;se.login(g(r,o.login),o.infiniteLogin,l,t)}}else{l()}if(!s&&se.enabled()){se.resume()}})});return se},pop:function(r,t){
-if(r!==n){O(r)}var i=se.token(true);var o;if(De.size()===1){o=De.top();if(Ee.login){H();if(e.isFunction(Ee.onExit)){try{Ee.onExit.call(se,se)}catch(a){y(a,"onExit")}}}else{se.error(Ae.canExitError)}if(!t){Ee.onPop.call(se,o,null,se)}}else{if(i){D()}var s=De.pop();o=De.top();K();if(!t){Ee.onPop.call(se,s,o)}if(ke&&se.get_prompt()!==Ae.login+": "){ke=false}if(e.isFunction(s.onExit)){try{s.onExit.call(se,se)}catch(a){y(a,"onExit")}}se.set_mask(o.mask)}return se},option:function(n,r){if(typeof r==="undefined"){if(typeof n==="string"){return Ee[n]}else if(typeof n==="object"){e.each(n,function(e,n){Ee[e]=n})}}else{Ee[n]=r}return se},level:function(){return De.size()},reset:function(){we(function e(){se.clear();while(De.size()>1){De.pop()}J()});return se},purge:function(){we(function n(){var n=se.prefix_name()+"_";var r=Se.get(n+"interpreters");if(r){e.each(e.parseJSON(r),function(e,n){Se.remove(n+"_commands");Se.remove(n+"_token");Se.remove(n+"_login")})}Be.purge();Se.remove(n+"interpreters")});return se},destroy:function(){we(function n(){Be.destroy().remove();pe.remove();je.remove();e(document).unbind(".terminal_"+se.id());e(window).unbind(".terminal_"+se.id());se.unbind("click mousewheel mousedown mouseup");se.removeData("terminal").removeClass("terminal");if(Ee.width){se.css("width","")}if(Ee.height){se.css("height","")}e(window).off("blur",Ue).off("focus",We);Ie.remove();Z.remove(me);if(!Z.length()){e(window).off("hashchange")}});return se},scroll_to_bottom:_,is_bottom:function(){if(Ee.scrollBottomOffset===-1){return false}else{var n,r,t;if(se.is("body")){n=e(document).height();r=e(window).scrollTop();t=window.innerHeight}else{n=le[0].scrollHeight;r=le.scrollTop();t=le.outerHeight()}var i=n-Ee.scrollBottomOffset;return r+t>i}}},function(e,n){return function(){try{return n.apply(se,[].slice.apply(arguments))}catch(r){if(e!=="exec"&&e!=="resume"){y(r,"TERMINAL")}throw r}}}));if(Ee.width){se.width(Ee.width)}if(Ee.height){se.height(Ee.height)}le=se.scroll_element();e(document).bind("ajaxSend.terminal_"+se.id(),function(e,n){Q.push(n)});var je=e('').appendTo(se);var Ie=e("").appendTo(je);pe=e("").addClass("terminal-output").appendTo(je);se.addClass("terminal");if(Ee.login&&e.isFunction(Ee.onBeforeLogin)){try{if(Ee.onBeforeLogin.call(se,se)===false){Pe=false}}catch(Ne){y(Ne,"onBeforeLogin");throw Ne}}var $e;if(typeof r==="string"){$e=r}else if(r instanceof Array){for(var ze=0,He=r.length;ze").appendTo(je).cmd({prompt:Ee.prompt,history:Ee.memory?"memory":Ee.history,historyFilter:Ee.historyFilter,historySize:Ee.historySize,width:"100%",enabled:Fe&&!w,keydown:oe,keymap:t,clickTimeout:Ee.clickTimeout,keypress:function(n){var r=De.top();if(e.isFunction(r.keypress)){return r.keypress.call(se,n,se)}else if(e.isFunction(Ee.keypress)){return Ee.keypress.call(se,n,se)}},onCommandChange:function(n){if(e.isFunction(Ee.onCommandChange)){try{Ee.onCommandChange.call(se,n,se)}catch(r){y(r,"onCommandChange");throw r}}_()},commands:z});if(Fe&&se.is(":visible")&&!w){se.focus(n,true)}else{se.disable()}se.oneTime(100,function(){function n(n){var r=e(n.target);if(!r.closest(".terminal").length&&se.enabled()&&Ee.onBlur.call(se,se)!==false){se.disable()}}e(document).bind("click.terminal_"+se.id(),n).bind("contextmenu.terminal_"+se.id(),n)});var i=e(window);if(!w){i.on("focus.terminal_"+se.id(),We).on("blur.terminal_"+se.id(),Ue)}else{}if(w){se.click(function(){if(!se.enabled()&&!Le){se.focus();Be.enable()}else{se.focus(false)}})}else{(function(){var n=0;var r=false;var t;se.mousedown(function(i){var o=e(i.target).parents();if(o.addBack){t=o.addBack()}else{t=o.andSelf()}se.oneTime(1,function(){e(window).on("mousemove.terminal_"+se.id(),function(){r=true;n=0;e(window).off("mousemove.terminal_"+se.id())})})}).mouseup(function(){var i=r;r=false;e(window).off("mousemove.terminal_"+se.id());if(!i){if(++n===1){if(!se.enabled()&&!Le){se.focus();Be.enable();n=0}else{var o="click_"+se.id();se.oneTime(Ee.clickTimeout,o,function(){if(!t.is(".terminal-output")&&!t.is(".cmd")&&t.is(".terminal > div")){var e=Be.get().length;Be.position(e)}n=0})}}else{se.stopTime("click_"+se.id());n=0}}}).dblclick(function(){n=0;se.stopTime("click_"+se.id())})})()}se.delegate(".exception a","click",function(n){var r=e(this).attr("href");if(r.match(/:[0-9]+$/)){n.preventDefault();l(r)}});se.mousedown(function(e){if(e.which===2){var n=U();se.insert(n)}});if(se.is(":visible")){he=se.cols();Be.resize(he);de=W(se)}ye.resolve();if(Ee.login){se.login(Ee.login,true,J)}else{J()}function o(){if(se.is(":visible")){var e=se.width();var n=se.height();if(Re!==n||Te!==e){se.resize()}Re=n;Te=e}}se.oneTime(100,function(){function e(){Ie[0].contentWindow.onresize=o}if(Ie.is(":visible")){e()}else{Ie.on("load",e)}});function a(n){var r=Z.get()[n[0]];if(r&&me===r.id()){if(n[2]){try{if(Oe){var t=e.Deferred();$.push(function(){return r.exec(n[2]).then(function(){r.save_state(n[2],true,n[1]);t.resolve()})});return t.promise()}else{return r.exec(n[2]).then(function(){r.save_state(n[2],true,n[1])})}}catch(i){var o=r.settings();if(e.isFunction(o.exceptionHandler)){o.exceptionHandler.call(se,i,"EXEC HASH")}else{var a=e.terminal.escape_brackets(ge);var s="Error while exec with command "+a;r.error(s).exception(i)}}}}}if(Ee.execHash){if(location.hash){setTimeout(function(){try{var n=location.hash.replace(/^#/,"");ne=e.parseJSON(decodeURIComponent(n));var r=0;(function i(){var e=ne[r++];if(e){a(e).then(i)}else{re=true}})()}catch(t){}})}else{re=true}}else{re=true}if(e.event.special.mousewheel){var s=false;e(document).bind("keydown.terminal_"+se.id(),function(e){if(e.shiftKey){s=true}}).bind("keyup.terminal_"+se.id(),function(e){if(e.shiftKey||e.which===16){s=false}});se.mousewheel(function(n,r){if(!s){var t=De.top();var i;if(e.isFunction(t.mousewheel)){i=t.mousewheel(n,r,se);if(i===false){return}}else if(e.isFunction(Ee.mousewheel)){i=Ee.mousewheel(n,r,se);if(i===false){return}}if(r>0){se.scroll(-40)}else{se.scroll(40)}}})}});se.data("terminal",se);return se}})(jQuery);
diff --git a/public/themes/pterodactyl/vendor/terminal/unix_formatting.js b/public/themes/pterodactyl/vendor/terminal/unix_formatting.js
deleted file mode 100755
index 5a6929204..000000000
--- a/public/themes/pterodactyl/vendor/terminal/unix_formatting.js
+++ /dev/null
@@ -1,318 +0,0 @@
-/**@license
- * __ _____ ________ __
- * / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
- * __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
- * / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
- * \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
- * \/ /____/
- * http://terminal.jcubic.pl
- *
- * This is example of how to create custom formatter for jQuery Terminal
- *
- * Copyright (c) 2014-2016 Jakub Jankiewicz
- * Released under the MIT license
- *
- */
-(function($) {
- if (!$.terminal) {
- throw new Error('$.terminal is not defined');
- }
- // ---------------------------------------------------------------------
- // :: Replace overtyping (from man) formatting with terminal formatting
- // ---------------------------------------------------------------------
- $.terminal.overtyping = function(string) {
- return string.replace(/((?:_\x08.|.\x08_)+)/g, function(full) {
- var striped = full.replace(/_x08|\x08_|_\u0008|\u0008_/g, '');
- return '[[u;;]' + striped + ']';
- }).replace(/((?:.\x08.)+)/g, function(full) {
- return '[[b;#fff;]' + full.replace(/(.)(?:\x08|\u0008)\1/g,
- function(full, g) {
- return g;
- }) + ']';
- });
- };
- // ---------------------------------------------------------------------
- // :: Html colors taken from ANSI formatting in Linux Terminal
- // ---------------------------------------------------------------------
- $.terminal.ansi_colors = {
- normal: {
- black: '#000',
- red: '#A00',
- green: '#008400',
- yellow: '#A50',
- blue: '#00A',
- magenta: '#A0A',
- cyan: '#0AA',
- white: '#AAA'
- },
- faited: {
- black: '#000',
- red: '#640000',
- green: '#006100',
- yellow: '#737300',
- blue: '#000087',
- magenta: '#650065',
- cyan: '#008787',
- white: '#818181'
- },
- bold: {
- black: '#000',
- red: '#F55',
- green: '#44D544',
- yellow: '#FF5',
- blue: '#55F',
- magenta: '#F5F',
- cyan: '#5FF',
- white: '#FFF'
- },
- // XTerm 8-bit pallete
- palette: [
- '#000000', '#AA0000', '#00AA00', '#AA5500', '#0000AA', '#AA00AA',
- '#00AAAA', '#AAAAAA', '#555555', '#FF5555', '#55FF55', '#FFFF55',
- '#5555FF', '#FF55FF', '#55FFFF', '#FFFFFF', '#000000', '#00005F',
- '#000087', '#0000AF', '#0000D7', '#0000FF', '#005F00', '#005F5F',
- '#005F87', '#005FAF', '#005FD7', '#005FFF', '#008700', '#00875F',
- '#008787', '#0087AF', '#0087D7', '#0087FF', '#00AF00', '#00AF5F',
- '#00AF87', '#00AFAF', '#00AFD7', '#00AFFF', '#00D700', '#00D75F',
- '#00D787', '#00D7AF', '#00D7D7', '#00D7FF', '#00FF00', '#00FF5F',
- '#00FF87', '#00FFAF', '#00FFD7', '#00FFFF', '#5F0000', '#5F005F',
- '#5F0087', '#5F00AF', '#5F00D7', '#5F00FF', '#5F5F00', '#5F5F5F',
- '#5F5F87', '#5F5FAF', '#5F5FD7', '#5F5FFF', '#5F8700', '#5F875F',
- '#5F8787', '#5F87AF', '#5F87D7', '#5F87FF', '#5FAF00', '#5FAF5F',
- '#5FAF87', '#5FAFAF', '#5FAFD7', '#5FAFFF', '#5FD700', '#5FD75F',
- '#5FD787', '#5FD7AF', '#5FD7D7', '#5FD7FF', '#5FFF00', '#5FFF5F',
- '#5FFF87', '#5FFFAF', '#5FFFD7', '#5FFFFF', '#870000', '#87005F',
- '#870087', '#8700AF', '#8700D7', '#8700FF', '#875F00', '#875F5F',
- '#875F87', '#875FAF', '#875FD7', '#875FFF', '#878700', '#87875F',
- '#878787', '#8787AF', '#8787D7', '#8787FF', '#87AF00', '#87AF5F',
- '#87AF87', '#87AFAF', '#87AFD7', '#87AFFF', '#87D700', '#87D75F',
- '#87D787', '#87D7AF', '#87D7D7', '#87D7FF', '#87FF00', '#87FF5F',
- '#87FF87', '#87FFAF', '#87FFD7', '#87FFFF', '#AF0000', '#AF005F',
- '#AF0087', '#AF00AF', '#AF00D7', '#AF00FF', '#AF5F00', '#AF5F5F',
- '#AF5F87', '#AF5FAF', '#AF5FD7', '#AF5FFF', '#AF8700', '#AF875F',
- '#AF8787', '#AF87AF', '#AF87D7', '#AF87FF', '#AFAF00', '#AFAF5F',
- '#AFAF87', '#AFAFAF', '#AFAFD7', '#AFAFFF', '#AFD700', '#AFD75F',
- '#AFD787', '#AFD7AF', '#AFD7D7', '#AFD7FF', '#AFFF00', '#AFFF5F',
- '#AFFF87', '#AFFFAF', '#AFFFD7', '#AFFFFF', '#D70000', '#D7005F',
- '#D70087', '#D700AF', '#D700D7', '#D700FF', '#D75F00', '#D75F5F',
- '#D75F87', '#D75FAF', '#D75FD7', '#D75FFF', '#D78700', '#D7875F',
- '#D78787', '#D787AF', '#D787D7', '#D787FF', '#D7AF00', '#D7AF5F',
- '#D7AF87', '#D7AFAF', '#D7AFD7', '#D7AFFF', '#D7D700', '#D7D75F',
- '#D7D787', '#D7D7AF', '#D7D7D7', '#D7D7FF', '#D7FF00', '#D7FF5F',
- '#D7FF87', '#D7FFAF', '#D7FFD7', '#D7FFFF', '#FF0000', '#FF005F',
- '#FF0087', '#FF00AF', '#FF00D7', '#FF00FF', '#FF5F00', '#FF5F5F',
- '#FF5F87', '#FF5FAF', '#FF5FD7', '#FF5FFF', '#FF8700', '#FF875F',
- '#FF8787', '#FF87AF', '#FF87D7', '#FF87FF', '#FFAF00', '#FFAF5F',
- '#FFAF87', '#FFAFAF', '#FFAFD7', '#FFAFFF', '#FFD700', '#FFD75F',
- '#FFD787', '#FFD7AF', '#FFD7D7', '#FFD7FF', '#FFFF00', '#FFFF5F',
- '#FFFF87', '#FFFFAF', '#FFFFD7', '#FFFFFF', '#080808', '#121212',
- '#1C1C1C', '#262626', '#303030', '#3A3A3A', '#444444', '#4E4E4E',
- '#585858', '#626262', '#6C6C6C', '#767676', '#808080', '#8A8A8A',
- '#949494', '#9E9E9E', '#A8A8A8', '#B2B2B2', '#BCBCBC', '#C6C6C6',
- '#D0D0D0', '#DADADA', '#E4E4E4', '#EEEEEE'
- ]
- };
- // ---------------------------------------------------------------------
- // :: Replace ANSI formatting with terminal formatting
- // ---------------------------------------------------------------------
- $.terminal.from_ansi = (function() {
- var color_list = {
- 30: 'black',
- 31: 'red',
- 32: 'green',
- 33: 'yellow',
- 34: 'blue',
- 35: 'magenta',
- 36: 'cyan',
- 37: 'white',
-
- 39: 'inherit' // default color
- };
- var background_list = {
- 40: 'black',
- 41: 'red',
- 42: 'green',
- 43: 'yellow',
- 44: 'blue',
- 45: 'magenta',
- 46: 'cyan',
- 47: 'white',
-
- 49: 'transparent' // default background
- };
- function format_ansi(code) {
- var controls = code.split(';');
- var num;
- var faited = false;
- var reverse = false;
- var bold = false;
- var styles = [];
- var output_color = '';
- var output_background = '';
- var _8bit_color = false;
- var _8bit_background = false;
- var process_8bit = false;
- var palette = $.terminal.ansi_colors.palette;
- function set_styles(num) {
- switch (num) {
- case 1:
- styles.push('b');
- bold = true;
- faited = false;
- break;
- case 4:
- styles.push('u');
- break;
- case 3:
- styles.push('i');
- break;
- case 5:
- process_8bit = true;
- break;
- case 38:
- _8bit_color = true;
- break;
- case 48:
- _8bit_background = true;
- break;
- case 2:
- faited = true;
- bold = false;
- break;
- case 7:
- reverse = true;
- break;
- default:
- if (controls.indexOf('5') === -1) {
- if (color_list[num]) {
- output_color = color_list[num];
- }
- if (background_list[num]) {
- output_background = background_list[num];
- }
- }
- }
- }
- for (var i in controls) {
- if (controls.hasOwnProperty(i)) {
- num = parseInt(controls[i], 10);
- if (process_8bit && (_8bit_background || _8bit_color)) {
- if (_8bit_color && palette[num]) {
- output_color = palette[num];
- }
- if (_8bit_background && palette[num]) {
- output_background = palette[num];
- }
- } else {
- set_styles(num);
- }
- }
- }
- if (reverse) {
- if (output_color || output_background) {
- var tmp = output_background;
- output_background = output_color;
- output_color = tmp;
- } else {
- output_color = 'black';
- output_background = 'white';
- }
- }
- var colors, color, background, backgrounds;
- if (bold) {
- colors = backgrounds = $.terminal.ansi_colors.bold;
- } else if (faited) {
- colors = backgrounds = $.terminal.ansi_colors.faited;
- } else {
- colors = backgrounds = $.terminal.ansi_colors.normal;
- }
- if (_8bit_color) {
- color = output_color;
- } else if (output_color === 'inherit') {
- color = output_color;
- } else {
- color = colors[output_color];
- }
- if (_8bit_background) {
- background = output_background;
- } else if (output_background === 'transparent') {
- background = output_background;
- } else {
- background = backgrounds[output_background];
- }
- return [styles.join(''), color, background];
- }
- return function(input) {
- //merge multiple codes
- /*input = input.replace(/((?:\x1B\[[0-9;]*[A-Za-z])*)/g, function(group) {
- return group.replace(/m\x1B\[/g, ';');
- });*/
- var splitted = input.split(/(\x1B\[[0-9;]*[A-Za-z])/g);
- if (splitted.length === 1) {
- return input;
- }
- var output = [];
- //skip closing at the begining
- if (splitted.length > 3) {
- var str = splitted.slice(0, 3).join('');
- if (str.match(/^\[0*m$/)) {
- splitted = splitted.slice(3);
- }
- }
- var prev_color, prev_background, code, match;
- var inside = false;
- for (var i = 0; i < splitted.length; ++i) {
- match = splitted[i].match(/^\x1B\[([0-9;]*)([A-Za-z])$/);
- if (match) {
- switch (match[2]) {
- case 'm':
- if (+match[1] !== 0) {
- code = format_ansi(match[1]);
- }
- if (inside) {
- output.push(']');
- if (+match[1] === 0) {
- //just closing
- inside = false;
- prev_color = prev_background = '';
- } else {
- // someone forget to close - move to next
- code[1] = code[1] || prev_color;
- code[2] = code[2] || prev_background;
- output.push('[[' + code.join(';') + ']');
- // store colors to next use
- if (code[1]) {
- prev_color = code[1];
- }
- if (code[2]) {
- prev_background = code[2];
- }
- }
- } else if (+match[1] !== 0) {
- inside = true;
- code[1] = code[1] || prev_color;
- code[2] = code[2] || prev_background;
- output.push('[[' + code.join(';') + ']');
- // store colors to next use
- if (code[1]) {
- prev_color = code[1];
- }
- if (code[2]) {
- prev_background = code[2];
- }
- }
- break;
- }
- } else {
- output.push(splitted[i]);
- }
- }
- if (inside) {
- output.push(']');
- }
- return output.join(''); //.replace(/\[\[[^\]]+\]\]/g, '');
- };
- })();
- $.terminal.defaults.formatters.push($.terminal.overtyping);
- $.terminal.defaults.formatters.push($.terminal.from_ansi);
-})(jQuery);
diff --git a/resources/themes/pterodactyl/layouts/admin.blade.php b/resources/themes/pterodactyl/layouts/admin.blade.php
index 6309f4dc9..e568ef0a4 100644
--- a/resources/themes/pterodactyl/layouts/admin.blade.php
+++ b/resources/themes/pterodactyl/layouts/admin.blade.php
@@ -177,7 +177,7 @@
@section('footer-scripts')
- {!! Theme::js('vendor/terminal/keyboard.polyfill.js') !!}
+ {!! Theme::js('js/keyboard.polyfill.js') !!}
{!! Theme::js('js/laroute.js') !!}
@@ -186,7 +186,7 @@
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
{!! Theme::js('vendor/slimscroll/jquery.slimscroll.min.js') !!}
{!! Theme::js('vendor/adminlte/app.min.js') !!}
- {!! Theme::js('vendor/socketio/socket.io.min.js') !!}
+ {!! Theme::js('vendor/socketio/socket.io.v203.min.js') !!}
{!! Theme::js('vendor/bootstrap-notify/bootstrap-notify.min.js') !!}
{!! Theme::js('vendor/select2/select2.full.min.js') !!}
{!! Theme::js('js/admin/functions.js') !!}
diff --git a/resources/themes/pterodactyl/layouts/master.blade.php b/resources/themes/pterodactyl/layouts/master.blade.php
index b57299607..7a137d100 100644
--- a/resources/themes/pterodactyl/layouts/master.blade.php
+++ b/resources/themes/pterodactyl/layouts/master.blade.php
@@ -268,7 +268,7 @@
@section('footer-scripts')
- {!! Theme::js('vendor/terminal/keyboard.polyfill.js') !!}
+ {!! Theme::js('js/keyboard.polyfill.js') !!}
{!! Theme::js('js/laroute.js') !!}
@@ -277,7 +277,7 @@
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
{!! Theme::js('vendor/slimscroll/jquery.slimscroll.min.js') !!}
{!! Theme::js('vendor/adminlte/app.min.js') !!}
- {!! Theme::js('vendor/socketio/socket.io.min.js') !!}
+ {!! Theme::js('vendor/socketio/socket.io.v203.min.js') !!}
{!! Theme::js('vendor/bootstrap-notify/bootstrap-notify.min.js') !!}
{!! Theme::js('js/autocomplete.js') !!}
@if(config('pterodactyl.lang.in_context'))
diff --git a/resources/themes/pterodactyl/server/console.blade.php b/resources/themes/pterodactyl/server/console.blade.php
index 0a98369e1..babb44a66 100644
--- a/resources/themes/pterodactyl/server/console.blade.php
+++ b/resources/themes/pterodactyl/server/console.blade.php
@@ -22,28 +22,38 @@
{{ Settings::get('company', 'Pterodactyl') }} - Console → {{ $server->name }}
@include('layouts.scripts')
- {!! Theme::css('vendor/terminal/jquery.terminal.css') !!}
+ {!! Theme::css('vendor/bootstrap/bootstrap.min.css') !!}
+ {!! Theme::css('css/terminal.css') !!}
+
-
-
+
+
+
{!! Theme::js('js/laroute.js') !!}
+ {!! Theme::js('vendor/ansi/ansi_up.js') !!}
{!! Theme::js('vendor/jquery/jquery.min.js') !!}
- {!! Theme::js('vendor/socketio/socket.io.min.js') !!}
+ {!! Theme::js('vendor/socketio/socket.io.v203.min.js') !!}
{!! Theme::js('vendor/bootstrap-notify/bootstrap-notify.min.js') !!}
{!! Theme::js('js/frontend/server.socket.js') !!}
{!! Theme::js('vendor/mousewheel/jquery.mousewheel-min.js') !!}
- {!! Theme::js('vendor/terminal/jquery.terminal.min.js') !!}
- {!! Theme::js('vendor/terminal/unix_formatting.js') !!}
{!! Theme::js('js/frontend/console.js') !!}
diff --git a/resources/themes/pterodactyl/server/index.blade.php b/resources/themes/pterodactyl/server/index.blade.php
index 49161b541..0a38e4ce3 100644
--- a/resources/themes/pterodactyl/server/index.blade.php
+++ b/resources/themes/pterodactyl/server/index.blade.php
@@ -25,7 +25,7 @@
@section('scripts')
@parent
- {!! Theme::css('vendor/terminal/jquery.terminal.css') !!}
+ {!! Theme::css('css/terminal.css') !!}
@endsection
@section('content-header')
@@ -42,6 +42,12 @@
+
@@ -81,10 +87,9 @@
@section('footer-scripts')
@parent
+ {!! Theme::js('vendor/ansi/ansi_up.js') !!}
{!! Theme::js('js/frontend/server.socket.js') !!}
{!! Theme::js('vendor/mousewheel/jquery.mousewheel-min.js') !!}
- {!! Theme::js('vendor/terminal/jquery.terminal.min.js') !!}
- {!! Theme::js('vendor/terminal/unix_formatting.js') !!}
{!! Theme::js('js/frontend/console.js') !!}
{!! Theme::js('vendor/chartjs/chart.min.js') !!}
{!! Theme::js('vendor/jquery/date-format.min.js') !!}