-
Notifications
You must be signed in to change notification settings - Fork 1
/
console.min.js
2 lines (2 loc) · 48.3 KB
/
console.min.js
1
2
function merge(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function clone(t){var e=t instanceof Array?[]:{};for(var n in t)e[n]=t[n]&&"object"==typeof t[n]?clone(t[n]):t[n];return e}function strip_tags(t,e){e=(((e||"")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join("");var n=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,i=/<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;return t.replace(i,"").replace(n,function(t,n){return e.indexOf("<"+n.toLowerCase()+">")>-1?t:""})}function str_split(t,e){if(null===e&&(e=1),null===t||1>e)return!1;t+="";for(var n=[],i=0,r=t.length;r>i;)n.push(t.slice(i,i+=e));return n}function str_repeat(t,e){for(var n="";;){if(1&e&&(n+=t),e>>=1,!e)break;t+=t}return n}function ksort(t,e){var n,i,r,o={},s=[],a=this,p=!1,u={};switch(e){case"SORT_STRING":n=function(t,e){return a.strnatcmp(t,e)};break;case"SORT_LOCALE_STRING":var l=this.i18n_loc_get_default();n=this.php_js.i18nLocales[l].sorting;break;case"SORT_NUMERIC":n=function(t,e){return t+0-(e+0)};break;default:n=function(t,e){var n=parseFloat(t),i=parseFloat(e),r=n+""===t,o=i+""===e;return r&&o?n>i?1:i>n?-1:0:r&&!o?1:!r&&o?-1:t>e?1:e>t?-1:0}}for(r in t)t.hasOwnProperty(r)&&s.push(r);for(s.sort(n),this.php_js=this.php_js||{},this.php_js.ini=this.php_js.ini||{},p=this.php_js.ini["phpjs.strictForIn"]&&this.php_js.ini["phpjs.strictForIn"].local_value&&"off"!==this.php_js.ini["phpjs.strictForIn"].local_value,u=p?t:u,i=0;i<s.length;i++)r=s[i],o[r]=t[r],p&&delete t[r];for(i in o)o.hasOwnProperty(i)&&(u[i]=o[i]);return p||u}function levenshtein(t,e){if(t==e)return 0;var n=t.length,i=e.length;if(0===n)return i;if(0===i)return n;var r=!1;try{r=!"0"[0]}catch(o){r=!0}r&&(t=t.split(""),e=e.split(""));var s=new Array(n+1),a=new Array(n+1),p=0,u=0,l=0;for(p=0;n+1>p;p++)s[p]=p;var h="",c="";for(u=1;i>=u;u++){for(a[0]=u,c=e[u-1],p=0;n>p;p++){h=t[p],l=h==c?0:1;var f=s[p+1]+1,g=a[p]+1,m=s[p]+l;f>g&&(f=g),f>m&&(f=m),a[p+1]=f}var d=s;s=a,a=d}return s[n]}function asort(t,e){var n,i,r,o=[],s=0,a=this,p=!1,u={};switch(e){case"SORT_STRING":r=function(t,e){return a.strnatcmp(t,e)};break;case"SORT_LOCALE_STRING":var l=this.i18n_loc_get_default();r=this.php_js.i18nLocales[l].sorting;break;case"SORT_NUMERIC":r=function(t,e){return t-e};break;case"SORT_REGULAR":default:r=function(t,e){var n=parseFloat(t),i=parseFloat(e),r=n+""===t,o=i+""===e;return r&&o?n>i?1:i>n?-1:0:r&&!o?1:!r&&o?-1:t>e?1:e>t?-1:0}}this.php_js=this.php_js||{},this.php_js.ini=this.php_js.ini||{},p=this.php_js.ini["phpjs.strictForIn"]&&this.php_js.ini["phpjs.strictForIn"].local_value&&"off"!==this.php_js.ini["phpjs.strictForIn"].local_value,u=p?t:u;for(n in t)t.hasOwnProperty(n)&&(o.push([n,t[n]]),p&&delete t[n]);for(o.sort(function(t,e){return r(t[1],e[1])}),i=0,s=o.length;s>i;i++)u[o[i][0]]=o[i][1];return p||u}function Command(t){if(this._application=null,this._name=null,this._aliases=[],this._definition=new InputDefinition,this._help=null,this._description=null,this._ignoreValidationErrors=!1,this._applicationDefinitionMerged=!1,this._applicationDefinitionMergedWithArgs=!1,this._code=null,this._synopsis=null,this._helperSet=null,t&&this.setName(t),this.configure(),!this._name)throw new Error("The command name cannot be empty.")}function InputDefinition(t){this._arguments={},this._requiredCount=null,this._hasAnArrayArgument=!1,this._hasOptional=null,this._options={},this._shortcuts={},this.setDefinition(t)}function InputArgument(t,e,n,i){if(e="undefined"==typeof e?ARGUMENT_OPTIONAL:parseInt(e),isNaN(e)||e>7||1>e)throw new Error('Argument mode "'+e+'" is not valid.');this._name=t,this._mode=e,this._description=void 0===n||null===n?"":n,this.setDefault(i)}function InputOption(t,e,n,i,r){if(this._shortcut=null,this._mode=null,this._default=null,0===t.indexOf("--")&&(t=t.slice(2)),0===t.length)throw new Error("An option name cannot be empty.");if(("undefined"==typeof e||"String"==typeof e&&0===e.length)&&(e=null),null!==e&&("-"===e.slice(0,1)&&(e=e.slice(1)),0===e.length))throw new Error("An option shortcut cannot be empty.");if(n="undefined"==typeof n?null:parseInt(n),null===n)n=OPTION_VALUE_NONE;else if(isNaN(n)||n>15||1>n)throw new Error('Option mode "'+n+'" is not valid.');if(this._name=t,this._shortcut=e,this._mode=n,this._description=void 0===i||null===i?"":i,this.isArray()&&!this.acceptValue())throw new Error("Impossible to have an option mode OPTION_VALUE_IS_ARRAY if the option does not accept a value.");this.setDefault(r)}function Input(t){t="undefined"==typeof t?null:t,this._interactive=!0,null===t?(this._arguments={},this._options={},this._definition=new InputDefinition):(this.bind(t),this.validate())}function ArgvInput(t,e){if(t="undefined"==typeof t?null:t,e="undefined"==typeof e?null:e,null===t)throw new Error("argv parameter must an array.");Input.call(this,e),this._parsed=null,this._tokens=t}function StringInput(t,e){e="undefined"==typeof e?null:e,ArgvInput.call(this,[],null),this.REGEX_STRING="([^ ]+?)(?: |(?=\")\\\\|(?=')\\\\|$)",this.REGEX_QUOTED_STRING="(?:\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"|'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)')",this.setTokens(this.tokenize(t)),null!==e&&this.bind(e)}function OutputFormatter(t,e){this.FORMAT_PATTERN=new XRegExp("(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?: [^<\\\\]+ | (?!<(?:/?[a-z]|/>)). | \\\\<. )*)","gisx"),e="undefined"==typeof e?[]:e,this._decorated="undefined"==typeof t?!1:t,this._styles={},this._styleStack=null,this.setStyle("error",new OutputFormatterStyle("white","red")),this.setStyle("info",new OutputFormatterStyle("green")),this.setStyle("comment",new OutputFormatterStyle("yellow")),this.setStyle("question",new OutputFormatterStyle("black","cyan"));for(var n=e.length-1;n>=0;n--)this.setStyle(e[n]);this._styleStack=new OutputFormatterStyleStack}function OutputFormatterStyle(t,e,n){this._availableForegroundColors={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37},this._availableBackgroundColors={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47},this._availableOptions={bold:1,underscore:4,blink:5,reverse:7,conceal:8},t="undefined"==typeof t?null:t,e="undefined"==typeof e?null:e,n="undefined"==typeof n?[]:n,this._options=[],null!==t&&this.setForeground(t),null!==e&&this.setBackground(e),n.length&&this.setOptions(n)}function OutputFormatterStyleStack(t){this._emptyStyle="undefined"==typeof t?new OutputFormatterStyle:t,this.reset()}function Output(t,e,n){this.VERBOSITY_QUIET=0,this.VERBOSITY_NORMAL=1,this.VERBOSITY_VERBOSE=2,this.OUTPUT_NORMAL=0,this.OUTPUT_RAW=1,this.OUTPUT_PLAIN=2,this._verbosity="undefined"==typeof t?this.VERBOSITY_NORMAL:t,this._formatter="undefined"==typeof n?new OutputFormatter:n,this._formatter.setDecorated(e)}function NullOutput(){}function JqueryTerminalOutput(t,e,n,i){if(t="undefined"==typeof t?null:t,n="undefined"==typeof n?null:n,null===t)throw new Error("The JqueryTerminalOutput class needs a Terminal object as its first argument.");null===n&&(n=!0),Output.call(this,e,n,i),this._terminal=t}function HelpCommand(){Command.call(this,"help"),this._command=null}function ListCommand(){Command.call(this,"list")}function Application(t,e){this._name="undefined"==typeof t?"UNKNOWN":t,this._version="undefined"==typeof e?"UNKNOWN":e,this._commands={},this._helperSet=this.getDefaultHelperSet(),this._definition=this.getDefaultInputDefinition(),this._runningCommand=null;for(var n=this.getDefaultCommands(),i=n.length-1;i>=0;i--)this.addCommand(n[i])}var XRegExp;XRegExp=XRegExp||function(t){"use strict";function e(t,e,n){var i;for(i in l.prototype)l.prototype.hasOwnProperty(i)&&(t[i]=l.prototype[i]);return t.xregexp={captureNames:e,isNative:!!n},t}function n(t){return(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":"")}function i(t,i,r){if(!l.isRegExp(t))throw new TypeError("type RegExp expected");var o=g.replace.call(n(t)+(i||""),w,"");return r&&(o=g.replace.call(o,new RegExp("["+r+"]+","g"),"")),t=t.xregexp&&!t.xregexp.isNative?e(l(t.source,o),t.xregexp.captureNames?t.xregexp.captureNames.slice(0):null):e(new RegExp(t.source,o),null,!0)}function r(t,e){var n=t.length;if(Array.prototype.lastIndexOf)return t.lastIndexOf(e);for(;n--;)if(t[n]===e)return n;return-1}function o(t,e){return Object.prototype.toString.call(t).toLowerCase()==="[object "+e+"]"}function s(t){return t=t||{},"all"===t||t.all?t={natives:!0,extensibility:!0}:o(t,"string")&&(t=l.forEach(t,/[^\s,]+/,function(t){this[t]=!0},{})),t}function a(t,e,n,i){var r,o,s=y.length,a=null;S=!0;try{for(;s--;)if(o=y[s],("all"===o.scope||o.scope===n)&&(!o.trigger||o.trigger.call(i))&&(o.pattern.lastIndex=e,r=m.exec.call(o.pattern,t),r&&r.index===e)){a={output:o.handler.call(i,r,n),match:r};break}}catch(p){throw p}finally{S=!1}return a}function p(t){l.addToken=h[t?"on":"off"],f.extensibility=t}function u(t){RegExp.prototype.exec=(t?m:g).exec,RegExp.prototype.test=(t?m:g).test,String.prototype.match=(t?m:g).match,String.prototype.replace=(t?m:g).replace,String.prototype.split=(t?m:g).split,f.natives=t}var l,h,c,f={natives:!1,extensibility:!1},g={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},m={},d={},y=[],_="default",v="class",O={"default":/^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/,"class":/^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/},A=/\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g,w=/([\s\S])(?=[\s\S]*\1)/g,N=/^(?:[?*+]|{\d+(?:,\d*)?})\??/,E=g.exec.call(/()??/,"")[1]===t,I=RegExp.prototype.sticky!==t,S=!1,x="gim"+(I?"y":"");return l=function(n,r){if(l.isRegExp(n)){if(r!==t)throw new TypeError("can't supply flags when constructing one RegExp from another");return i(n)}if(S)throw new Error("can't call the XRegExp constructor within token definition functions");var o,s,p,u=[],h=_,c={hasNamedCapture:!1,captureNames:[],hasFlag:function(t){return r.indexOf(t)>-1}},f=0;if(n=n===t?"":String(n),r=r===t?"":String(r),g.match.call(r,w))throw new SyntaxError("invalid duplicate regular expression flag");for(n=g.replace.call(n,/^\(\?([\w$]+)\)/,function(t,e){if(g.test.call(/[gy]/,e))throw new SyntaxError("can't use flag g or y in mode modifier");return r=g.replace.call(r+e,w,""),""}),l.forEach(r,/[\s\S]/,function(t){if(x.indexOf(t[0])<0)throw new SyntaxError("invalid regular expression flag "+t[0])});f<n.length;)o=a(n,f,h,c),o?(u.push(o.output),f+=o.match[0].length||1):(s=g.exec.call(O[h],n.slice(f)),s?(u.push(s[0]),f+=s[0].length):(p=n.charAt(f),"["===p?h=v:"]"===p&&(h=_),u.push(p),++f));return e(new RegExp(u.join(""),g.replace.call(r,/[^gimy]+/g,"")),c.hasNamedCapture?c.captureNames:null)},h={on:function(t,e,n){n=n||{},t&&y.push({pattern:i(t,"g"+(I?"y":"")),handler:e,scope:n.scope||_,trigger:n.trigger||null}),n.customFlags&&(x=g.replace.call(x+n.customFlags,w,""))},off:function(){throw new Error("extensibility must be installed before using addToken")}},l.addToken=h.off,l.cache=function(t,e){var n=t+"/"+(e||"");return d[n]||(d[n]=l(t,e))},l.escape=function(t){return g.replace.call(t,/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},l.exec=function(t,e,n,r){var o,s=i(e,"g"+(r&&I?"y":""),r===!1?"y":"");return s.lastIndex=n=n||0,o=m.exec.call(s,t),r&&o&&o.index!==n&&(o=null),e.global&&(e.lastIndex=o?s.lastIndex:0),o},l.forEach=function(t,e,n,i){for(var r,o=0,s=-1;r=l.exec(t,e,o);)n.call(i,r,++s,t,e),o=r.index+(r[0].length||1);return i},l.globalize=function(t){return i(t,"g")},l.install=function(t){t=s(t),!f.natives&&t.natives&&u(!0),!f.extensibility&&t.extensibility&&p(!0)},l.isInstalled=function(t){return!!f[t]},l.isRegExp=function(t){return o(t,"regexp")},l.matchChain=function(t,e){return function n(t,i){for(var r=e[i].regex?e[i]:{regex:e[i]},o=[],s=function(t){o.push(r.backref?t[r.backref]||"":t[0])},a=0;a<t.length;++a)l.forEach(t[a],r.regex,s);return i!==e.length-1&&o.length?n(o,i+1):o}([t],0)},l.replace=function(e,n,r,o){var s,a=l.isRegExp(n),p=n;return a?(o===t&&n.global&&(o="all"),p=i(n,"all"===o?"g":"","all"===o?"":"g")):"all"===o&&(p=new RegExp(l.escape(String(n)),"g")),s=m.replace.call(String(e),p,r),a&&n.global&&(n.lastIndex=0),s},l.split=function(t,e,n){return m.split.call(t,e,n)},l.test=function(t,e,n,i){return!!l.exec(t,e,n,i)},l.uninstall=function(t){t=s(t),f.natives&&t.natives&&u(!1),f.extensibility&&t.extensibility&&p(!1)},l.union=function(t,e){var n,i,r,s,a=/(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g,p=0,u=function(t,e,r){var o=i[p-n];if(e){if(++p,o)return"(?<"+o+">"}else if(r)return"\\"+(+r+n);return t},h=[];if(!o(t,"array")||!t.length)throw new TypeError("patterns must be a nonempty array");for(s=0;s<t.length;++s)r=t[s],l.isRegExp(r)?(n=p,i=r.xregexp&&r.xregexp.captureNames||[],h.push(l(r.source).source.replace(a,u))):h.push(l.escape(r));return l(h.join("|"),e)},l.version="2.0.0",m.exec=function(e){var i,o,s,a,p;if(this.global||(a=this.lastIndex),i=g.exec.apply(this,arguments)){if(!E&&i.length>1&&r(i,"")>-1&&(s=new RegExp(this.source,g.replace.call(n(this),"g","")),g.replace.call(String(e).slice(i.index),s,function(){for(var e=1;e<arguments.length-2;++e)arguments[e]===t&&(i[e]=t)})),this.xregexp&&this.xregexp.captureNames)for(p=1;p<i.length;++p)o=this.xregexp.captureNames[p-1],o&&(i[o]=i[p]);this.global&&!i[0].length&&this.lastIndex>i.index&&(this.lastIndex=i.index)}return this.global||(this.lastIndex=a),i},m.test=function(t){return!!m.exec.call(this,t)},m.match=function(t){if(l.isRegExp(t)){if(t.global){var e=g.match.apply(this,arguments);return t.lastIndex=0,e}}else t=new RegExp(t);return m.exec.call(t,this)},m.replace=function(t,e){var n,i,s,a,p=l.isRegExp(t);return p?(t.xregexp&&(n=t.xregexp.captureNames),t.global||(a=t.lastIndex)):t+="",o(e,"function")?i=g.replace.call(String(this),t,function(){var i,r=arguments;if(n)for(r[0]=new String(r[0]),i=0;i<n.length;++i)n[i]&&(r[0][n[i]]=r[i+1]);return p&&t.global&&(t.lastIndex=r[r.length-2]+r[0].length),e.apply(null,r)}):(s=String(this),i=g.replace.call(s,t,function(){var t=arguments;return g.replace.call(String(e),A,function(e,i,o){var s;if(i){if(s=+i,s<=t.length-3)return t[s]||"";if(s=n?r(n,i):-1,0>s)throw new SyntaxError("backreference to undefined group "+e);return t[s+1]||""}if("$"===o)return"$";if("&"===o||0==+o)return t[0];if("`"===o)return t[t.length-1].slice(0,t[t.length-2]);if("'"===o)return t[t.length-1].slice(t[t.length-2]+t[0].length);if(o=+o,!isNaN(o)){if(o>t.length-3)throw new SyntaxError("backreference to undefined group "+e);return t[o]||""}throw new SyntaxError("invalid token "+e)})})),p&&(t.lastIndex=t.global?0:a),i},m.split=function(e,n){if(!l.isRegExp(e))return g.split.apply(this,arguments);var i,r=String(this),o=e.lastIndex,s=[],a=0;return n=(n===t?-1:n)>>>0,l.forEach(r,e,function(t){t.index+t[0].length>a&&(s.push(r.slice(a,t.index)),t.length>1&&t.index<r.length&&Array.prototype.push.apply(s,t.slice(1)),i=t[0].length,a=t.index+i)}),a===r.length?(!g.test.call(e,"")||i)&&s.push(""):s.push(r.slice(a)),e.lastIndex=o,s.length>n?s.slice(0,n):s},c=h.on,c(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4})|x(?![\dA-Fa-f]{2}))/,function(t,e){if("B"===t[1]&&e===_)return t[0];throw new SyntaxError("invalid escape "+t[0])},{scope:"all"}),c(/\[(\^?)]/,function(t){return t[1]?"[\\s\\S]":"\\b\\B"}),c(/(?:\(\?#[^)]*\))+/,function(t){return g.test.call(N,t.input.slice(t.index+t[0].length))?"":"(?:)"}),c(/\\k<([\w$]+)>/,function(t){var e=isNaN(t[1])?r(this.captureNames,t[1])+1:+t[1],n=t.index+t[0].length;if(!e||e>this.captureNames.length)throw new SyntaxError("backreference to undefined group "+t[0]);return"\\"+e+(n===t.input.length||isNaN(t.input.charAt(n))?"":"(?:)")}),c(/(?:\s+|#.*)+/,function(t){return g.test.call(N,t.input.slice(t.index+t[0].length))?"":"(?:)"},{trigger:function(){return this.hasFlag("x")},customFlags:"x"}),c(/\./,function(){return"[\\s\\S]"},{trigger:function(){return this.hasFlag("s")},customFlags:"s"}),c(/\(\?P?<([\w$]+)>/,function(t){if(!isNaN(t[1]))throw new SyntaxError("can't use integer as capture name "+t[0]);return this.captureNames.push(t[1]),this.hasNamedCapture=!0,"("}),c(/\\(\d+)/,function(t,e){if(!(e===_&&/^[1-9]/.test(t[1])&&+t[1]<=this.captureNames.length)&&"0"!==t[1])throw new SyntaxError("can't use octal escape or backreference to undefined group "+t[0]);return t[0]},{scope:"all"}),c(/\((?!\?)/,function(){return this.hasFlag("n")?"(?:":(this.captureNames.push(null),"(")},{customFlags:"n"}),"undefined"!=typeof exports&&(exports.XRegExp=l),l}(),Command.prototype.execute=function(){throw new Error("You must override the execute() method in the concrete command class.")},Command.prototype.interact=function(){},Command.prototype.initialize=function(){},Command.prototype.run=function(t,e){this.getSynopsis(),this.mergeApplicationDefinition();try{t.bind(this._definition)}catch(n){if(!this._ignoreValidationErrors)throw n}if(this.initialize(t,e),t.isInteractive()&&this.interact(t,e),t.validate(),this._code)var i=this._code.call(void 0,t,e);else var i=this.execute(t,e);return isNaN(parseInt(i,10))?0:parsetInt(i,10)},Command.prototype.setCode=function(t){if("function"!=typeof t)throw new Error("Invalid callable provided to Command::setCode.");return this._code=t,this},Command.prototype.mergeApplicationDefinition=function(t){if(t="undefined"!=typeof t?t:!0,null!==this._application&&(!0!==this._applicationDefinitionMerged||!this._applicationDefinitionMergedWithArgs&&t)){if(t){var e=this._definition.getArguments();this._definition.setArguments(clone(this._application.getDefinition().getArguments())),this._definition.addArguments(e)}this._definition.addOptions(this._application.getDefinition().getOptions()),this._applicationDefinitionMerged=!0,t&&(this._applicationDefinitionMergedWithArgs=!0)}},Command.prototype.setDefinition=function(t){return t instanceof InputDefinition?this._definition=t:this._definition.setDefinition(t),this._applicationDefinitionMerged=!1,this},Command.prototype.addArgument=function(t,e,n,i){return this._definition.addArgument(new InputArgument(t,e,n,i)),this},Command.prototype.addOption=function(t,e,n,i,r){return this._definition.addOption(new InputOption(t,e,n,i,r)),this},Command.prototype.getProcessedHelp=function(){return null!==this._help?this._help.replace("%command.name%",this._name):null},Command.prototype.setAliases=function(t){for(var e=t.length-1;e>=0;e--)this.validateName(t[e]);return this._aliases=t,this},Command.prototype.getAliases=function(){return this._aliases},Command.prototype.getHelper=function(t){return this._helperSet[t]},Command.prototype.asText=function(){this._application&&!this._applicationDefinitionMerged&&(this.getSynopsis(),this.mergeApplicationDefinition(!1));var t=["<comment>Usage:</comment>"," "+this.getSynopsis(),""];this._aliases.length&&t.push("<comment>Aliases:</comment> <info>"+this._aliases.join(", ")+"</info>"),t=t.concat(this._definition.asText());var e=this.getProcessedHelp();return e&&(console.log(e),t.push("<comment>Help:</comment>"),t.push(" "+e.replace("\n","\n ")+"\n")),t.join("\n")},Command.prototype.getSynopsis=function(){return null===this._synopsis&&(this._synopsis=this._name+" "+this._definition.getSynopsis()),this._synopsis},Command.prototype.configure=function(){},Command.prototype.isSecret=function(){return!1},Command.prototype.isEnabled=function(){return!0},Command.prototype.setApplication=function(t){this._application=t,this._helperSet=t?t.helperSet:null},Command.prototype.setName=function(t){return this.validateName(t),this._name=t,this},Command.prototype.getName=function(){return this._name},Command.prototype.validateName=function(t){if(!t.match(/^[^\:]+(\:[^\:]+)*$/))throw new Error('Command name "'+t+'" is invalid.')},Command.prototype.setDescription=function(t){return this._description=t,this},Command.prototype.getDescription=function(){return this._description},Command.prototype.setHelp=function(t){return this._help=t,this},Command.prototype.getHelp=function(){return this._help},Command.prototype.ignoreValidationErrors=function(){this._ignoreValidationErrors=!0},Command.prototype.getApplication=function(){return this._application},InputDefinition.prototype.setDefinition=function(t){t="undefined"==typeof t?[]:t;for(var e=[],n=[],i=t.length-1;i>=0;i--){var r=t[i];r instanceof InputOption?n.push(r):e.push(r)}this.setArguments(e),this.setOptions(n)},InputDefinition.prototype.setArguments=function(t){this._arguments={},this._requiredCount=0,this._hasOptional=!1,this._hasAnArrayArgument=!1,this.addArguments(t)},InputDefinition.prototype.addArguments=function(t){if(void 0!==t&&null!==t)for(var e in t)this.addArgument(t[e])},InputDefinition.prototype.addArgument=function(t){if(void 0!==this._arguments[t.getName()])throw new Error('An argument with name "'+t.getName()+'" already exists.');if(this._hasAnArrayArgument)throw new Error("Cannot add an argument after an array argument.");if(t.isRequired()&&this._hasOptional)throw new Error("Cannot add a required argument after an optional one.");t.isArray()&&(this._hasAnArrayArgument=!0),t.isRequired()?++this._requiredCount:this._hasOptional=!0,this._arguments[t.getName()]=t},InputDefinition.prototype.getArgument=function(t){if(isNaN(parseInt(t))||(t=Object.getOwnPropertyNames(this._arguments)[parseInt(t)]),!this.hasArgument(t))throw new Error('The "'+t+'" argument does not exist.');return this._arguments[t]},InputDefinition.prototype.hasArgument=function(t){return isNaN(parseInt(t))||(t=Object.getOwnPropertyNames(this._arguments)[parseInt(t)]),void 0!==this._arguments[t]},InputDefinition.prototype.getArguments=function(){return this._arguments},InputDefinition.prototype.getArgumentCount=function(){return this._hasAnArrayArgument?Number.MAX_VALUE:this._arguments.length},InputDefinition.prototype.getArgumentRequiredCount=function(){return this._requiredCount},InputDefinition.prototype.getArgumentDefaults=function(){var t={};for(var e in this.getArguments())e=this.getArgument(e),t[e.getName()]=e.getDefault();return t},InputDefinition.prototype.setOptions=function(t){this._options={},this._shortcuts={},this.addOptions(t)},InputDefinition.prototype.addOptions=function(t){for(var e in t)this.addOption(t[e])},InputDefinition.prototype.addOption=function(t){if(void 0!==this._options[t.getName()]&&!t.equals(this._options[t.getName()]))throw new Error('An option named "'+t.getName()+'" already exists.');if(void 0!==this._shortcuts[t.getShortcut()]&&!t.equals(this._options[this._shortcuts[t.getShortcut()]]))throw new Error('An option with shortcut "'+t.getShortcut()+'" already exists.');this._options[t.getName()]=t,t.getShortcut()&&(this._shortcuts[t.getShortcut()]=t.getName())},InputDefinition.prototype.getOption=function(t){if(!this.hasOption(t))throw new Error('The "--'+t+'" option does not exist.');return this._options[t]},InputDefinition.prototype.hasOption=function(t){return void 0!==this._options[t]},InputDefinition.prototype.getOptions=function(){return this._options},InputDefinition.prototype.hasShortcut=function(t){return void 0!==this._shortcuts[t]},InputDefinition.prototype.getOptionForShortcut=function(t){return this.getOption(this.shortcutToName(t))},InputDefinition.prototype.getOptionDefaults=function(){var t={};for(var e in this.getOptions())e=this.getOption(e),t[e.getName()]=e.getDefault();return t},InputDefinition.prototype.shortcutToName=function(t){if(void 0===this._shortcuts[t])throw new Error('The "-'+t+'" option does not exist.');return this._shortcuts[t]},InputDefinition.prototype.getSynopsis=function(){var t=[];for(var e in this.getOptions()){e=this.getOption(e);var n=e.getShortcut()?"-"+e.getShortcut()+"|":"";e.isValueRequired()?t.push("["+n+"--"+e.getName()+'="..."]'):e.isValueOptional()?t.push("["+n+"--"+e.getName()+'[="..."]]'):t.push("["+n+"--"+e.getName()+"]")}for(var i in this.getArguments())i=this.getArgument(i),i.isRequired()?t.push(i.getName()+(i.isArray()?"1":"")):t.push("["+i.getName()+(i.isArray()?"1":"")+"]"),i.isArray()&&t.push("... ["+i.getName()+"N]");return t.join(" ")},InputDefinition.prototype.asText=function(){var t=0;for(var e in this.getOptions()){e=this.getOption(e);var n=e.getName().length+2;e.getShortcut()&&(n+=e.getShortcut().length+3),t=Math.max(t,n)}for(var i in this.getArguments())i=this.getArgument(i),t=Math.max(t,i.getName().length);++t;var r=[];if(Object.getOwnPropertyNames(this._arguments).length){r.push("<comment>Arguments:</comment>");for(var i in this.getArguments()){if(i=this.getArgument(i),null===i.getDefault()||"Array"==typeof i.getDefault()&&!i.getDefault().length)var o="";else var o="<comment> (default: "+this.formatDefaultValue(i.getDefault())+")</comment>";var s=i.getDescription().replace("\n","\n"+str_repeat(" ",t+2));r.push(" <info>"+i.getName()+str_repeat(" ",t-i.getName().length)+"</info> "+s+o)}r.push("")}if(Object.getOwnPropertyNames(this._options).length){r.push("<comment>Options:</comment>");for(var e in this.getOptions()){if(e=this.getOption(e),e.acceptValue()&&null!==e.getDefault()&&("Array"!=typeof e.getDefault()||e.getDefault().length))var o="<comment> (default: "+this.formatDefaultValue(e.getDefault())+")</comment>";else var o="";var a=e.isArray()?"<comment> (multiple values allowed)</comment>":"",s=e.getDescription().replace("\n","\n"+str_repeat(" ",t+2)),p=t-e.getName().length-2,u=e.getShortcut()?"(-"+e.getShortcut()+")":"";r.push(" <info>--"+e.getName()+"</info> "+u+str_repeat(" ",p-u.length)+s+o+a)}r.push("")}return r.join("\n")},InputDefinition.prototype.formatDefaultValue=function(t){return JSON.stringify(t)};var ARGUMENT_REQUIRED=1,ARGUMENT_OPTIONAL=2,ARGUMENT_IS_ARRAY=4;InputArgument.prototype.getName=function(){return this._name},InputArgument.prototype.isRequired=function(){return ARGUMENT_REQUIRED===(ARGUMENT_REQUIRED&this._mode)},InputArgument.prototype.isArray=function(){return ARGUMENT_IS_ARRAY===(ARGUMENT_IS_ARRAY&this._mode)},InputArgument.prototype.setDefault=function(t){if(t="undefined"==typeof t?null:t,self.REQUIRED===this._mode&&null!==t)throw new Error("Cannot set a default value except for ARGUMENT_OPTIONAL mode.");if(this.isArray())if(null===t)t=[];else if("Array"!=typeof t)throw new Error("A default value for an array argument must be an array.");this._default=t},InputArgument.prototype.getDefault=function(){return this._default},InputArgument.prototype.getDescription=function(){return this._description};var OPTION_VALUE_NONE=1,OPTION_VALUE_REQUIRED=2,OPTION_VALUE_OPTIONAL=4,OPTION_VALUE_IS_ARRAY=8;InputOption.prototype.getShortcut=function(){return this._shortcut},InputOption.prototype.getName=function(){return this._name},InputOption.prototype.acceptValue=function(){return this.isValueRequired()||this.isValueOptional()},InputOption.prototype.isValueRequired=function(){return OPTION_VALUE_REQUIRED===(OPTION_VALUE_REQUIRED&this._mode)},InputOption.prototype.isValueOptional=function(){return OPTION_VALUE_OPTIONAL===(OPTION_VALUE_OPTIONAL&this._mode)},InputOption.prototype.isArray=function(){return OPTION_VALUE_IS_ARRAY===(OPTION_VALUE_IS_ARRAY&this._mode)},InputOption.prototype.setDefault=function(t){if(t="undefined"==typeof t?null:t,OPTION_VALUE_NONE===(OPTION_VALUE_NONE&this._mode)&&null!==t)throw new Error("Cannot set a default value when using OPTION_VALUE_NONE mode.");if(this.isArray())if(null===t)t=[];else if("Array"!=typeof t)throw new Error("A default value for an array option must be an array.");this._default=this.acceptValue()?t:!1},InputOption.prototype.getDefault=function(){return this._default},InputOption.prototype.getDescription=function(){return this._description},InputOption.prototype.equals=function(t){return this.getName()===t.getName()&&this.getShortcut()===t.getShortcut()&&this.getDefault()===t.getDefault()&&this.isArray()===t.isArray()&&this.isValueRequired()===t.isValueRequired()&&this.isValueOptional()===t.isValueOptional()},Input.prototype.bind=function(t){this._arguments={},this._options={},this._definition=t,this.parse()},Input.prototype.parse=function(){throw new Error("You must override this method.")},Input.prototype.validate=function(){if(Object.getOwnPropertyNames(this._arguments).length<this._definition.getArgumentRequiredCount())throw new Error("Not enough arguments.")},Input.prototype.isInteractive=function(){return this._interactive},Input.prototype.setInteractive=function(t){this._interactive=t},Input.prototype.getArguments=function(){return merge(this._definition.getArgumentDefaults(),this._arguments)},Input.prototype.getArgument=function(t){if(!this._definition.hasArgument(t))throw new Error('The "'+t+'" argument does not exist.');return this._arguments.hasOwnProperty(t)&&null!==this._arguments[t]?this._arguments[t]:this._definition.getArgument(t).getDefault()},Input.prototype.setArgument=function(t,e){if(!this._definition.hasArgument(t))throw new Error('The "'+t+'" argument does not exist.');this._arguments[t]=e},Input.prototype.hasArgument=function(t){return this._definition.hasArgument(t)},Input.prototype.getOptions=function(){return merge(this._options.getOptionDefaults(),this._options)},Input.prototype.getOption=function(t){if(!this._definition.hasOption(t))throw new Error('The "'+t+'" option does not exist.');return this._options.hasOwnProperty(t)&&null!==this._options[t]?this._options[t]:this._definition.getOption(t).getDefault()},Input.prototype.setOption=function(t,e){if(!this._definition.hasOption(t))throw new Error('The "'+t+'" option does not exist.');this._options[t]=e},Input.prototype.hasOption=function(t){return this._definition.hasOption(t)},ArgvInput.prototype=Object.create(Input.prototype),ArgvInput.prototype.setTokens=function(t){this._tokens=t},ArgvInput.prototype.parse=function(){var t=!0;this._parsed=clone(this._tokens);for(var e=0;e<this._parsed.length;e++){var n=this._parsed[e];t&&""==n?this.parseArgument(n):t&&"--"==n?t=!1:t&&0===n.indexOf("--")?this.parseLongOption(n):t&&"-"===n.slice(0,1)?this.parseShortOption(n):this.parseArgument(n)}},ArgvInput.prototype.parseShortOption=function(t){var e=t.slice(1);if(e.length>1){var n=e.slice(0,1);this._definition.hasShortcut(n)&&this._definition.getOptionForShortcut(n).acceptValue()?this.addShortOption(n,e.slice(1)):this.parseShortOptionSet(e)}else this.addShortOption(e,null)},ArgvInput.prototype.parseShortOptionSet=function(t){for(var e=t.length,n=e-1;n>=0;n--){var i=t.slice(n,1);if(!this._definition.hasShortcut(i))throw new Error('The "-'+i+'" option does not exist.');var r=this._definition.getOptionForShortcut(i);if(r.acceptValue()){this.addLongOption(r.getName(),n===e-1?null:t.slice(n+1));break}this.addLongOption(r.getName(),!0)}},ArgvInput.prototype.parseLongOption=function(t){var e=t.slice(2),n=e.indexOf("=");n>=0?this.addLongOption(e.slice(0,n),e.slice(n+1)):this.addLongOption(e,null)},ArgvInput.prototype.parseArgument=function(t){var e=Object.getOwnPropertyNames(this._arguments).length;if(this._definition.hasArgument(e)){var n=this._definition.getArgument(e);this._arguments[n.getName()]=n.isArray()?[t]:t}else{if(!this._definition.hasArgument(e-1)||!this._definition.getArgument(e-1).isArray())throw new Error("Too many arguments.");var n=this._definition.getArgument(e-1);this._arguments[n.getName()].push(t)}},ArgvInput.prototype.addShortOption=function(t,e){if(!this._definition.hasShortcut(t))throw new Error('The "-'+t+'" option does not exist.');this.addLongOption(this._definition.getOptionForShortcut(t).getName(),e)},ArgvInput.prototype.addLongOption=function(t,e){if(!this._definition.hasOption(t))throw new Error('The "--'+t+'" option does not exist.');var n=this._definition.getOption(t);if(-1===e&&(e=null),null===e&&n.acceptValue()&&this._parsed.length){var i=this._parsed.shift();i.length&&"-"!==i.slice(0,1)?e=i:0===i.length?e="":this._parsed.unshift(i)}if(null===e){if(n.isValueRequired())throw new Error('The "--'+t+'" option requires a value.');n.isArray()||(e=n.isValueOptional()?n.getDefault():!0)}n.isArray()?this._options[t].push(e):this._options[t]=e},ArgvInput.prototype.getFirstArgument=function(){for(var t in this._tokens){var e=this._tokens[t];
if(!e||"-"!==e.slice(0,1))return e}},ArgvInput.prototype.hasParameterOption=function(t){t=t instanceof Array?t:[t];for(var e=this._tokens.length-1;e>=0;e--){var n=this._tokens[e];if(t.indexOf(n)>=0)return!0}return!1},ArgvInput.prototype.getParameterOption=function(t,e){e="undefined"==typeof e?!1:e,t=t instanceof Array?t:[t];for(var n=clone(this._tokens),i=null;i=n.shift();)for(var r=t.length-1;r>=0;r--){var o=t[r];if(0===i.indexOf(o)){var s=i.indexOf("=");return s>-1?i.slice(s+1):n.shift()}}},StringInput.prototype=Object.create(ArgvInput.prototype),StringInput.prototype.tokenize=function(t){t=t.replace(/(\r\n|\r|\n|\t)/g," ");for(var e=[],n=t.length,i=0;n>i;){var r=t.slice(i),o=null;if(o=r.match(/^\s+/));else if(o=r.match(new RegExp("^([^=\"' ]+?)(=?)("+this.REGEX_QUOTED_STRING+"+)"))){var s=o[1]+o[2]+o[3].slice(1,o[3].length-1).replace(/("'|'"|''|"")/g,"").replace(/(\\(?![rnt]))/g,"");e.push(s)}else if(o=r.match(new RegExp("^"+this.REGEX_QUOTED_STRING))){var s=o[0].slice(1,o[0].length-1).replace(/\\(?![rnt])/g,"");e.push(s)}else{if(!(o=r.match(new RegExp("^"+this.REGEX_STRING))))throw new Error('Unable to parse input near "... '+r.slice(0,10)+' ..."');var s=o[1].replace(/\\(?![rnt])/g,"");e.push(s)}i+=o[0].length}return e},OutputFormatter.prototype.escape=function(t){return t.replace(/([^\\\\]?)</i,"$1\\<")},OutputFormatter.prototype.setDecorated=function(t){this._decorated=t},OutputFormatter.prototype.isDecorated=function(){return this._decorated},OutputFormatter.prototype.setStyle=function(t,e){this._styles[t.toLowerCase()]=e},OutputFormatter.prototype.hasStyle=function(t){return void 0!==this._styles[t.toLowerCase()]},OutputFormatter.prototype.getStyle=function(t){if(!this.hasStyle(t))throw new Error("Undefined style: "+t);return this._styles[t.toLowerCase()]},OutputFormatter.prototype.format=function(t){var e=this;return t=t.replace(this.FORMAT_PATTERN,function(t,n,i,r,o){if("\\"===n)return e.applyCurrentStyle(t);if(""===r)return"/"===i?(e._styleStack.pop(),e.applyCurrentStyle(o)):"<>"+e.applyCurrentStyle(o);if(void 0!==r&&void 0!==e._styles[r.toLowerCase()])var s=e._styles[r.toLowerCase()];else{var s=e.createStyleFromString(r);if(!1===s)return e.applyCurrentStyle(t)}return"/"===i?e._styleStack.pop(s):e._styleStack.push(s),e.applyCurrentStyle(o)}),t.replace("\\<","<")},OutputFormatter.prototype.createStyleFromString=function(t){if(void 0===t)return!1;var e=t.toLowerCase().match(/([^=]+)=([^;]+)(;|$)/g);return e?!1:!1},OutputFormatter.prototype.applyCurrentStyle=function(t){return this.isDecorated()&&t.length>0?this._styleStack.getCurrent().apply(t):t},OutputFormatterStyle.prototype.setForeground=function(t){if(t="undefined"==typeof t?null:t,null===t)return this._foreground=null,void 0;if(void 0===this._availableForegroundColors[t])throw new Error('Invalid foreground color specified: "'+t+'". Expected one of ('+this._availableForegroundColors.join(", ")+")");this._foreground=this._availableForegroundColors[t]},OutputFormatterStyle.prototype.setBackground=function(t){if(t="undefined"==typeof t?null:t,null===t)return this._background=null,void 0;if(void 0===this._availableBackgroundColors[t])throw new Error('Invalid background color specified: "'+t+'". Expected one of ('+this._availableBackgroundColors.join(", ")+")");this._foreground=this._availableBackgroundColors[t]},OutputFormatterStyle.prototype.setOption=function(t){if(void 0===this._availableOptions[t])throw new Error('Invalid option specified: "'+t+'". Expected one of ('+this._availableOptions.join(", ")+")");-1===this._options.indexOf(this._availableOptions[t])&&this._options.push(this._availableOptions[t])},OutputFormatterStyle.prototype.unsetOption=function(t){if(void 0===this._availableOptions[t])throw new Error('Invalid option specified: "'+t+'". Expected one of ('+this._availableOptions.join(", ")+")");this._options.indexOf(this._availableOptions[t])>-1&&this._options.slice(this._options.indexOf(this._availableOptions[t]),1)},OutputFormatterStyle.prototype.setOptions=function(t){this._options=[];for(var e=t.length-1;e>=0;e--)this.setOption(t[e])},OutputFormatterStyle.prototype.apply=function(t){var e=[];return null!==this._foreground&&e.push(this._foreground),null!==this._background&&e.push(this._background),this._options.length&&(e=e.concat(this._options)),0===e.length?t:"["+e.join(";")+"m"+t+"[0m"},OutputFormatterStyleStack.prototype.reset=function(){this._styles=[]},OutputFormatterStyleStack.prototype.push=function(t){this._styles.push(t)},OutputFormatterStyleStack.prototype.pop=function(t){if(0===this._styles.length)return this._emptyStyle;if(null===t)return this._styles.pop();for(var e=this._styles.length-1;e>=0;e--){var n=this._styles[e];if(t.apply("")===n.apply(""))return this._styles=this._styles.slice(0,e),n}throw new Error("Incorrectly nested style tag found.")},OutputFormatterStyleStack.prototype.getCurrent=function(){return 0===this._styles.length?this._emptyStyle:this._styles[this._styles.length-1]},OutputFormatterStyleStack.prototype.setEmptyStyle=function(t){return this._emptyStyle=t,this},OutputFormatterStyleStack.prototype.getEmptyStyle=function(){return this._emptyStyle};var OUTPUT_VERBOSITY_QUIET=0,OUTPUT_VERBOSITY_NORMAL=1,OUTPUT_VERBOSITY_VERBOSE=2;Output.prototype.setFormatter=function(t){this._formatter=t},Output.prototype.getFormatter=function(){return this._formatter},Output.prototype.setDecorated=function(t){this._formatter.setDecorated(t)},Output.prototype.isDecorated=function(){return this._formatter.isDecorated()},Output.prototype.setVerbosity=function(t){this._verbosity=t},Output.prototype.getVerbosity=function(){return this._verbosity},Output.prototype.writeln=function(t,e){e="undefined"==typeof e?0:e,this.write(t,!0,e)},Output.prototype.write=function(t,e,n){if(this.VERBOSITY_QUIET!==this._verbosity){t=t instanceof Array?t:[t];for(var i=t.length-1;i>=0;i--){var r=t[i];switch(n){case this.OUTPUT_NORMAL:r=this._formatter.format(r);break;case this.OUTPUT_RAW:break;case this.OUTPUT_PLAIN:r=strip_tags(this._formatter.format(r));break;default:throw new Error("Unknown output type given ("+n+")")}this.doWrite(r,e)}}},Output.prototype.doWrite=function(){throw new Error("You must override this method.")},NullOutput.prototype=Object.create(Output.prototype),NullOutput.prototype.doWrite=function(){},JqueryTerminalOutput.prototype=Object.create(Output.prototype),JqueryTerminalOutput.prototype.getTerminal=function(){return this._terminal},JqueryTerminalOutput.prototype.doWrite=function(t){this._terminal.echo(t)},HelpCommand.prototype=Object.create(Command.prototype),HelpCommand.prototype.configure=function(){this.ignoreValidationErrors(),this.setName("help").setDefinition([new InputArgument("command_name",ARGUMENT_OPTIONAL,"The command name.","help")]).setDescription("Display help for a command.").setHelp("The <info>%command.name%</info> command displays help for a given command:\n\n <info>help list</info>\n\n To display the list of available commands, please use the <info>list</info> command.")},HelpCommand.prototype.setCommand=function(t){return this._command=t,this},HelpCommand.prototype.execute=function(t,e){null===this._command&&(this._command=this.getApplication().find(t.getArgument("command_name"))),e.writeln(this._command.asText()),this._command=null},ListCommand.prototype=Object.create(Command.prototype),ListCommand.prototype.configure=function(){this.setName("list").setDefinition([new InputArgument("namespace",ARGUMENT_OPTIONAL,"The namespace name.")]).setDescription("List commands.").setHelp("The <info>%command.name%</info> command list all commands.\n\n <info>list</info>\n\n You can also display the commands for a specific namespace:\n\n <info>list contact</info>")},ListCommand.prototype.execute=function(t,e){e.writeln(this.getApplication().asText(t.getArgument("namespace"),!1))},Application.prototype.run=function(t,e){if("undefined"==typeof t||"undefined"==typeof e)throw new Error("input and output must be defined.");try{var n=this.doRun(t,e)}catch(i){this.renderException(i,e),this._runningCommand=null}return n},Application.prototype.doRun=function(t,e){var n=this.getCommandName(t);!0===t.hasParameterOption("--ansi")?e.setDecorated(!0):!0===t.hasParameterOption("--no-ansi")&&e.setDecorated(!1),!0===t.hasParameterOption(["--help","-h"])&&(n?this._wantsHelp=!0:(n="help",t=new StringInput(n))),!0===t.hasParameterOption(["--quiet","-q"])?e.setVerbosity(e.VERBOSITY_QUIET):!0===t.hasParameterOption(["--verbose","-v"])&&e.setVerbosity(e.VERBOSITY_VERBOSE),!0===t.hasParameterOption(["--version","-V"])&&e.writeln(this.getLongVersion()),n||(n="list",t=new StringInput(n));var i=this.find(n);this._runningCommand=i;var r=i.run(t,e);return this._runningCommand=null,r},Application.prototype.setHelperSet=function(t){this._helperSet=t},Application.prototype.getHelperSet=function(){return this._helperSet},Application.prototype.setDefinition=function(t){this._definition=t},Application.prototype.getDefinition=function(){return this._definition},Application.prototype.getHelp=function(){var t=[this.getLongVersion(),"","<comment>Usage:</comment>"," [options] command [arguments]","","<comment>Options:</comment>"];for(var e in this._definition.getOptions()){e=this._definition.getOption(e);for(var n="<info>--"+e.getName()+"</info>",i=29-n.length,r="",o=i-1;o>=0;o--)r+=" ";t.push(" "+n+r+" "+(e.getShortcut()?"<info>-"+e.getShortcut()+"</info>":" ")+" "+e.getDescription())}return t.join("\n")},Application.prototype.getName=function(){return this._name},Application.prototype.getVersion=function(){return this._version},Application.prototype.setVersion=function(t){this._version=t},Application.prototype.getLongVersion=function(){return"UNKNOWN"!==this.getName()&&"UNKNOWN"!==this.getVersion()?"<info>"+this.getName()+"</info> version <comment>"+this.getVersion()+"</comment>":void 0},Application.prototype.register=function(t){return this.addCommand(new Command(t))},Application.prototype.addCommands=function(t){for(var e=t.length-1;e>=0;e--)this.addCommand(t[e])},Application.prototype.addCommand=function(t){if(t.setApplication(this),!t.isEnabled())return t.setApplication(null),void 0;this._commands[t.getName()]=t;for(var e=t.getAliases().length-1;e>=0;e--)this._commands[t.getAliases()[e]]=t;return t},Application.prototype.get=function(t){if(void 0===this._commands[t])throw new Error('The command "'+t+'" does not exist.');var e=this._commands[t];if(this._wantsHelp){this._wantsHelp=!1;var n=this.get("help");return n.setCommand(e),n}return e},Application.prototype.has=function(t){return void 0!==this._commands[t]},Application.prototype.getNamespaces=function(){var t=[];for(var e in this._commands){e=this._commands[e];var n=this.extractNamespace(e.getName());n.length&&t.push(n);for(var i=e.getAliases().length-1;i>=0;i--){var n=this.extractNamespace(e.getAliases()[i]);n.length&&t.push(n)}}return t.reverse().filter(function(t,e,n){return!1!==t&&-1===n.indexOf(t,e+1)}).reverse()},Application.prototype.findNamespace=function(t){for(var e=this.getNamespaces(),n={},i=e.length-1;i>=0;i--){var r=e[i];n[r]=r.split(":")}for(var o=[],s=t.split(":"),i=0;i<=s.length-1;i++){var a=s[i],p={};for(var u in n){var l=n[u];p[u]=void 0!=l[i]?l[i]:""}for(var u in p){var l=p[u];l||p.splice(u,1)}var h=[];for(var u in p)h.push(p[u]);p=h;var h=[];for(var u in p)-1==h.indexOf(p[u])&&h.push(p[u]);if(p=h,p=this.getAbbreviations(p),void 0===p[a]){var c="There are no commands defined in the "+t+" namespace.";i>=1&&(a=o+":"+a);var f=this.findAlternativeNamespace(a,p);throw f&&Object.getOwnPropertyNames(f).length>0&&(c+=1===Object.getOwnPropertyNames(f).length?"\n\nDid you mean this?\n ":"\n\nDid you mean one of these?\n ",c+=Object.getOwnPropertyNames(f).join("\n ")),new Error(c)}if(p[a].indexOf(a)>=0&&(p[a]=[a]),p[a].length>1)throw new Error('The namespace "'+t+'" is ambiguous ('+this.getAbbreviationSuggestions(p[a])+").");o.push(p[a][0])}return o.join(":")},Application.prototype.find=function(t){var e="",n=t,i=t.lastIndexOf(":");i>=0&&(e=this.findNamespace(t.slice(0,i)),n=e+t.slice(i));var r=[];for(var o in this._commands){o=this._commands[o];var s=this.extractNamespace(o.getName());(s===e||!e.length&&0===e.indexOf(s))&&r.push(o.getName())}var a=this.getAbbreviations(r.reverse().filter(function(t,e,n){return-1===n.indexOf(t,e+1)}).reverse());if(void 0!==a[n]&&1==a[n].length)return this.get(a[n][0]);if(void 0!==a[n]&&a[n].indexOf(n)>=0)return this.get(n);if(void 0!==a[n]&&a[n].length>1){var p=this.getAbbreviationSuggestions(a[n]);throw new Error('Command "'+t+'" is ambiguous ('+p+").")}var u=[];for(var o in this._commands){o=this._commands[o];for(var l=o.getAliases().length-1;l>=0;l--){var h=o.getAliases()[l],s=this.extractNamespace(h);(s===e||!e.length&&0===e.indexOf(s))&&u.push(h)}}var u=this.getAbbreviations(u.reverse().filter(function(t,e,n){return-1===n.indexOf(t,e+1)}).reverse());if(void 0===u[n]){var c='Command "'+t+'" is not defined.',f=this.findAlternativeCommands(n,a);throw Object.getOwnPropertyNames(f).length&&(c+=1==Object.getOwnPropertyNames(f).length?"\n\nDid you mean this?\n ":"\n\nDid you mean one of these?\n ",c+=Object.getOwnPropertyNames(f).join("\n ")),new Error(c)}if(u[n].length>1)throw new Error('Command "'+t+'" is ambiguous ('+this.getAbbreviationSuggestions(u[n])+").");return this.get(u[n][0])},Application.prototype.all=function(t){if(t="undefined"==typeof t?null:t,null===t)return this._commands;var e={};for(var n in this._commands){var i=this._commands[n];t===this.extractNamespace(n,t.split(":").length+1)&&(e[n]=i)}return e},Application.prototype.getAbbreviations=function(t){for(var e={},n=0;n<t.length;n++)for(var i=t[n],r=i.length;r>0;r--){var o=i.slice(0,r);void 0===e[o]&&(e[o]=[]),e[o].push(i)}return e},Application.prototype.asText=function(t,e){t="undefined"==typeof t?null:t,e="undefined"==typeof e?!1:e;var n=t?this.all(this.findNamespace(t)):this._commands,i=0;for(var r in n){var o=n[r];i=o.getName().length>i?o.getName().length:i}if(i+=2,e){var s=[],a=this.sortCommands(n);for(var p in a){var n=a[p];for(var r in n){for(var o=n[r],u="",l=0;l<i-r.length;l++)u+=" ";s.push(u+o.getName()+" "+o.getDescription())}}return s.join("\n")}var s=[this.getHelp(),""];t?s.push('<comment>Available commands for the "'+t+'" namespace:</comment>'):s.push("<comment>Available commands:</comment>");var a=this.sortCommands(n);for(var p in a){var n=a[p];t||"_global"===p||s.push("<comment>"+p+"</comment>");for(var r in n){for(var o=n[r],u="",l=0;l<i-r.length;l++)u+=" ";s.push(" <info>"+r+"</info>"+u+" "+o.getDescription())}}return s.join("\n")},Application.prototype.renderException=function(t,e){for(var n=" "+t.name+" ",i=n.length,r=80,o=[],s=t.message.split("\n"),a=0;a<s.length;a++)for(var p=s[a],u=str_split(p,r-4),l=0;l<u.length;l++){var h=u[l];o.push(" "+h+" "),i=Math.max(h.length+4,i)}for(var c=[str_repeat(" ",i),n+str_repeat(" ",Math.max(0,i-n.length))],a=0;a<o.length;a++){var p=o[a];c.push(p+str_repeat(" ",i-p.length))}c.push(str_repeat(" ",i)),e.writeln(""),e.writeln("");for(var a=0;a<c.length;a++){var f=c[a];e.writeln("<error>"+f+"</error>")}e.writeln(""),e.writeln(""),e.getVerbosity()===e.VERBOSITY_VERBOSE&&(e.writeln(" at <info>"+t.fileName+":"+t.lineNumber+"</info>"),e.writeln(""),e.writeln("")),null!==this._runningCommand&&(e.writeln("<info>"+this._runningCommand.getSynopsis()+"</info>"),e.writeln(""),e.writeln(""))},Application.prototype.getCommandName=function(t){return t.getFirstArgument()},Application.prototype.getDefaultInputDefinition=function(){return new InputDefinition([new InputArgument("command",ARGUMENT_REQUIRED,"The command to execute"),new InputOption("--help","-h",OPTION_VALUE_NONE,"Display this help message."),new InputOption("--quiet","-q",OPTION_VALUE_NONE,"Do not output any message."),new InputOption("--verbose","-v",OPTION_VALUE_NONE,"Increase verbosity of messages."),new InputOption("--version","-V",OPTION_VALUE_NONE,"Display this application version."),new InputOption("--ansi",null,OPTION_VALUE_NONE,"Force ANSI output."),new InputOption("--no-ansi",null,OPTION_VALUE_NONE,"Disable ANSI output.")])},Application.prototype.getDefaultCommands=function(){return[new HelpCommand,new ListCommand]},Application.prototype.getDefaultHelperSet=function(){return null},Application.prototype.sortCommands=function(t){var e={};for(var n in t){var i=t[n],r=this.extractNamespace(n,1);r||(r="_global"),void 0===e[r]&&(e[r]={}),e[r][n]=i}ksort(e);for(var o in e){var t=e[o];ksort(t)}return e},Application.prototype.getAbbreviationSuggestions=function(t){return t[0]+", "+t[1]+(t.length>2?" and "+t.length+" more":"")},Application.prototype.extractNamespace=function(t,e){var n=t.split(":");return n.pop(),void 0===e?n.join(":"):n.slice(0,e).join(":")},Application.prototype.findAlternativeCommands=function(t,e){var n=function(t){return t.getName()};return this.findAlternatives(t,this._commands,e,n)},Application.prototype.findAlternativeNamespace=function(t,e){return this.findAlternatives(t,this.getNamespaces(),e)},Application.prototype.findAlternatives=function(t,e,n,i){i="undefined"==typeof i?null:i;var r={};for(var o in e){var s=e[o];null!==i&&(s=i.call(this,s));var a=levenshtein(t,s);(a<=t.length/3||s.indexOf(t)>=0)&&(r[s]=a)}if(!Object.getOwnPropertyNames(r).length)for(var p in n){var u=n[p],a=levenshtein(t,p);if(a<=t.length/3||p.indexOf(t)>=0)for(var l=0;l<u.length;l++){var h=u[l];r[h]=a}}return asort(r,"SORT_NUMERIC"),r};