forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
1 lines (1 loc) · 32.9 KB
/
index.js
1
module.exports=function(t,e){"use strict";var n={};function __webpack_require__(e){if(n[e]){return n[e].exports}var r=n[e]={i:e,l:false,exports:{}};t[e].call(r.exports,r,r.exports,__webpack_require__);r.l=true;return r.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(236)}return startup()}({2:function(t,e,n){"use strict";var r=n(324);t.exports=r;r.prototype.done=function(t,e){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(t){setTimeout(function(){throw t},0)})}},60:function(t,e,n){"use strict";var r=n(928);var o=[];t.exports=asap;function asap(t){var e;if(o.length){e=o.pop()}else{e=new RawTask}e.task=t;e.domain=process.domain;r(e)}function RawTask(){this.task=null;this.domain=null}RawTask.prototype.call=function(){if(this.domain){this.domain.enter()}var t=true;try{this.task.call();t=false;if(this.domain){this.domain.exit()}}finally{if(t){r.requestFlush()}this.task=null;this.domain=null;o.push(this)}}},87:function(t){t.exports=require("os")},129:function(t){t.exports=require("child_process")},184:function(t){t.exports=require("vm")},191:function(t){t.exports=require("querystring")},211:function(t){t.exports=require("https")},229:function(t){t.exports=require("domain")},234:function(t,e,n){var r=n(697);t.exports=function(){return function(t,e,n){if(t===" ")return t;switch(e%3){case 0:return r.red(t);case 1:return r.white(t);case 2:return r.blue(t)}}}()},236:function(t,e,n){"use strict";const r=n(493);const o=n(747);const i=n(605);const s=n(211);const u=n(622);const a=n(721);const c=n(700);const f=n(191);const l=n(835);const p=n(669);const h=n(184);const m="amphtml-validator";function hasPrefix(t,e){return t.indexOf(e)==0}function isHttpOrHttpsUrl(t){return hasPrefix(t,"http://")||hasPrefix(t,"https://")}function readFromFile(t){return new c(function(e,n){o.readFile(t,"utf8",function(t,r){if(t){n(t)}else{e(r.trim())}})})}function readFromReadable(t,e){return new c(function(n,r){const o=[];e.setEncoding("utf8");e.on("data",function(t){o.push(t)});e.on("end",function(){n(o.join(""))});e.on("error",function(e){r(new Error("Could not read from "+t+" - "+e.message))})})}function readFromStdin(){return readFromReadable("stdin",process.stdin).then(function(t){process.stdin.resume();return t})}function readFromUrl(t,e){return new c(function(n,r){const o=hasPrefix(t,"http://")?i:s;const u=o.request(t,function(e){if(e.statusCode!==200){e.resume();r(new Error("Unable to fetch "+t+" - HTTP Status "+e.statusCode))}else{n(e)}});u.setHeader("User-Agent",e);u.on("error",function(e){r(new Error("Unable to fetch "+t+" - "+e.message))});u.end()}).then(readFromReadable.bind(null,t))}function ValidationResult(){this.status="UNKNOWN";this.errors=[]}function ValidationError(){this.severity="UNKNOWN_SEVERITY";this.line=1;this.col=0;this.message="";this.specUrl=null;this.code="UNKNOWN_CODE";this.params=[]}function Validator(t){this.sandbox=h.createContext();try{new h.Script(t).runInContext(this.sandbox)}catch(t){throw new Error("Could not instantiate validator.js - "+t.message)}}Validator.prototype.validateString=function(t,e){const n=this.sandbox.amp.validator.validateString(t,e);const r=new ValidationResult;r.status=n.status;for(let t=0;t<n.errors.length;t++){const e=n.errors[t];const o=new ValidationError;o.severity=e.severity;o.line=e.line;o.col=e.col;o.message=this.sandbox.amp.validator.renderErrorMessage(e);o.specUrl=e.specUrl;o.code=e.code;o.params=e.params;r.errors.push(o)}return r};const d={};function getInstance(t,e){const n=t||"https://cdn.ampproject.org/v0/validator.js";const r=e||m;if(d.hasOwnProperty(n)){return c.resolve(d[n])}const o=isHttpOrHttpsUrl(n)?readFromUrl(n,r):readFromFile(n);return o.then(function(t){let e;try{e=new Validator(t)}catch(t){throw t}d[n]=e;return e})}e.getInstance=getInstance;function newInstance(t){return new Validator(t)}e.newInstance=newInstance;function logValidationResult(t,e,n){if(e.status==="PASS"){process.stdout.write(t+": "+(n?r.green("PASS"):"PASS")+"\n")}for(let o=0;o<e.errors.length;o++){const i=e.errors[o];let s=t+":"+i.line+":"+i.col+" ";if(n){s+=(i.severity==="ERROR"?r.red:r.magenta)(i.message)}else{s+=i.message}if(i.specUrl){s+=" (see "+i.specUrl+")"}process.stderr.write(s+"\n")}}function main(){a.usage("[options] <fileOrUrlOrMinus...>\n\n"+' Validates the files or urls provided as arguments. If "-" is\n'+" specified, reads from stdin instead.").option("--validator_js <fileOrUrl>","The Validator Javascript.\n"+" Latest published version by default, or\n"+" dist/validator_minified.js (built with build.py)\n"+" for development.","https://cdn.ampproject.org/v0/validator.js").option("--user-agent <userAgent>","User agent string to use in requests.",m).option("--html_format <AMP|AMP4ADS|AMP4EMAIL>","The input format to be validated.\n"+" AMP by default.","AMP").option("--format <color|text|json>","How to format the output.\n"+' "color" displays errors/warnings/success in\n'+" red/orange/green.\n"+' "text" avoids color (e.g., useful in terminals not\n'+" supporting color).\n"+' "json" emits json corresponding to the ValidationResult\n'+" message in validator.proto.","color").parse(process.argv);if(a.args.length===0){a.outputHelp();process.exit(1)}if(a.html_format!=="AMP"&&a.html_format!=="AMP4ADS"&&a.html_format!=="AMP4EMAIL"){process.stderr.write('--html_format must be set to "AMP", "AMP4ADS", or "AMP4EMAIL".\n',function(){process.exit(1)})}if(a.format!=="color"&&a.format!=="text"&&a.format!=="json"){process.stderr.write('--format must be set to "color", "text", or "json".\n',function(){process.exit(1)})}const t=[];for(let e=0;e<a.args.length;e++){const n=a.args[e];if(n==="-"){t.push(readFromStdin())}else if(isHttpOrHttpsUrl(n)){t.push(readFromUrl(n,a.userAgent))}else{t.push(readFromFile(n))}}getInstance(a.validator_js,a.userAgent).then(function(e){c.all(t).then(function(t){const n={};let r=false;for(let o=0;o<t.length;o++){const i=e.validateString(t[o],a.html_format);if(a.format==="json"){n[a.args[o]]=i}else{logValidationResult(a.args[o],i,a.format==="color"?true:false)}if(i.status!=="PASS"){r=true}}if(a.format==="json"){process.stdout.write(JSON.stringify(n)+"\n",function(){process.exit(r?1:0)})}else if(r){process.stderr.write("",function(){process.exit(1)})}else{process.stdout.write("",function(){process.exit(0)})}}).catch(function(t){process.stderr.write((a.format=="color"?r.red(t.message):t.message)+"\n",function(){process.exit(1)})})}).catch(function(t){process.stderr.write((a.format=="color"?r.red(t.message):t.message)+"\n",function(){process.exit(1)})})}e.main=main},324:function(t,e,n){"use strict";var r=n(928);function noop(){}var o=null;var i={};function getThen(t){try{return t.then}catch(t){o=t;return i}}function tryCallOne(t,e){try{return t(e)}catch(t){o=t;return i}}function tryCallTwo(t,e,n){try{t(e,n)}catch(t){o=t;return i}}t.exports=Promise;function Promise(t){if(typeof this!=="object"){throw new TypeError("Promises must be constructed via new")}if(typeof t!=="function"){throw new TypeError("Promise constructor's argument is not a function")}this._75=0;this._83=0;this._18=null;this._38=null;if(t===noop)return;doResolve(t,this)}Promise._47=null;Promise._71=null;Promise._44=noop;Promise.prototype.then=function(t,e){if(this.constructor!==Promise){return safeThen(this,t,e)}var n=new Promise(noop);handle(this,new Handler(t,e,n));return n};function safeThen(t,e,n){return new t.constructor(function(r,o){var i=new Promise(noop);i.then(r,o);handle(t,new Handler(e,n,i))})}function handle(t,e){while(t._83===3){t=t._18}if(Promise._47){Promise._47(t)}if(t._83===0){if(t._75===0){t._75=1;t._38=e;return}if(t._75===1){t._75=2;t._38=[t._38,e];return}t._38.push(e);return}handleResolved(t,e)}function handleResolved(t,e){r(function(){var n=t._83===1?e.onFulfilled:e.onRejected;if(n===null){if(t._83===1){resolve(e.promise,t._18)}else{reject(e.promise,t._18)}return}var r=tryCallOne(n,t._18);if(r===i){reject(e.promise,o)}else{resolve(e.promise,r)}})}function resolve(t,e){if(e===t){return reject(t,new TypeError("A promise cannot be resolved with itself."))}if(e&&(typeof e==="object"||typeof e==="function")){var n=getThen(e);if(n===i){return reject(t,o)}if(n===t.then&&e instanceof Promise){t._83=3;t._18=e;finale(t);return}else if(typeof n==="function"){doResolve(n.bind(e),t);return}}t._83=1;t._18=e;finale(t)}function reject(t,e){t._83=2;t._18=e;if(Promise._71){Promise._71(t,e)}finale(t)}function finale(t){if(t._75===1){handle(t,t._38);t._38=null}if(t._75===2){for(var e=0;e<t._38.length;e++){handle(t,t._38[e])}t._38=null}}function Handler(t,e,n){this.onFulfilled=typeof t==="function"?t:null;this.onRejected=typeof e==="function"?e:null;this.promise=n}function doResolve(t,e){var n=false;var r=tryCallTwo(t,function(t){if(n)return;n=true;resolve(e,t)},function(t){if(n)return;n=true;reject(e,t)});if(!n&&r===i){n=true;reject(e,o)}}},326:function(t,e,n){"use strict";var r=n(324);var o=n(60);t.exports=r;r.denodeify=function(t,e){if(typeof e==="number"&&e!==Infinity){return denodeifyWithCount(t,e)}else{return denodeifyWithoutCount(t)}};var i="function (err, res) {"+"if (err) { rj(err); } else { rs(res); }"+"}";function denodeifyWithCount(t,e){var n=[];for(var o=0;o<e;o++){n.push("a"+o)}var s=["return function ("+n.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(n).concat([i]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],s)(r,t)}function denodeifyWithoutCount(t){var e=Math.max(t.length-1,3);var n=[];for(var o=0;o<e;o++){n.push("a"+o)}var s=["return function ("+n.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+e+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+i+";","var res;","switch (argLength) {",n.concat(["extra"]).map(function(t,e){return"case "+e+":"+"res = fn.call("+["self"].concat(n.slice(0,e)).concat("cb").join(",")+");"+"break;"}).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],s)(r,t)}r.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments);var n=typeof e[e.length-1]==="function"?e.pop():null;var i=this;try{return t.apply(this,arguments).nodeify(n,i)}catch(t){if(n===null||typeof n=="undefined"){return new r(function(e,n){n(t)})}else{o(function(){n.call(i,t)})}}}};r.prototype.nodeify=function(t,e){if(typeof t!="function")return this;this.then(function(n){o(function(){t.call(e,null,n)})},function(n){o(function(){t.call(e,n)})})}},396:function(t){"use strict";t.exports=function(t,e){e=e||process.argv;var n=e.indexOf("--");var r=/^-{1,2}/.test(t)?"":"--";var o=e.indexOf(r+t);return o!==-1&&(n===-1?true:o<n)}},428:function(t,e,n){"use strict";var r=n(324);t.exports=r;var o=valuePromise(true);var i=valuePromise(false);var s=valuePromise(null);var u=valuePromise(undefined);var a=valuePromise(0);var c=valuePromise("");function valuePromise(t){var e=new r(r._44);e._83=1;e._18=t;return e}r.resolve=function(t){if(t instanceof r)return t;if(t===null)return s;if(t===undefined)return u;if(t===true)return o;if(t===false)return i;if(t===0)return a;if(t==="")return c;if(typeof t==="object"||typeof t==="function"){try{var e=t.then;if(typeof e==="function"){return new r(e.bind(t))}}catch(t){return new r(function(e,n){n(t)})}}return valuePromise(t)};r.all=function(t){var e=Array.prototype.slice.call(t);return new r(function(t,n){if(e.length===0)return t([]);var o=e.length;function res(i,s){if(s&&(typeof s==="object"||typeof s==="function")){if(s instanceof r&&s.then===r.prototype.then){while(s._83===3){s=s._18}if(s._83===1)return res(i,s._18);if(s._83===2)n(s._18);s.then(function(t){res(i,t)},n);return}else{var u=s.then;if(typeof u==="function"){var a=new r(u.bind(s));a.then(function(t){res(i,t)},n);return}}}e[i]=s;if(--o===0){t(e)}}for(var i=0;i<e.length;i++){res(i,e[i])}})};r.reject=function(t){return new r(function(e,n){n(t)})};r.race=function(t){return new r(function(e,n){t.forEach(function(t){r.resolve(t).then(e,n)})})};r.prototype["catch"]=function(t){return this.then(null,t)}},431:function(t){var e={};t.exports=e;var n={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(n).forEach(function(t){var r=n[t];var o=e[t]=[];o.open="["+r[0]+"m";o.close="["+r[1]+"m"})},493:function(t,e,n){var r=n(697);t.exports=r},605:function(t){t.exports=require("http")},614:function(t){t.exports=require("events")},622:function(t){t.exports=require("path")},626:function(t,e,n){"use strict";t.exports=n(324);n(2);n(658);n(428);n(326);n(837)},656:function(t,e,n){var r=n(697);t.exports=function(){var t=["red","yellow","green","blue","magenta"];return function(e,n,o){if(e===" "){return e}else{return r[t[n++%t.length]](e)}}}()},658:function(t,e,n){"use strict";var r=n(324);t.exports=r;r.prototype["finally"]=function(t){return this.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})})}},669:function(t){t.exports=require("util")},697:function(t,e,n){var r={};t.exports=r;r.themes={};var o=n(669);var i=r.styles=n(431);var s=Object.defineProperties;var u=new RegExp(/[\r\n]+/g);r.supportsColor=n(775).supportsColor;if(typeof r.enabled==="undefined"){r.enabled=r.supportsColor()!==false}r.enable=function(){r.enabled=true};r.disable=function(){r.enabled=false};r.stripColors=r.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var a=r.stylize=function stylize(t,e){if(!r.enabled){return t+""}return i[e].open+t+i[e].close};var c=/[|\\{}()[\]^$+*?.]/g;var f=function(t){if(typeof t!=="string"){throw new TypeError("Expected a string")}return t.replace(c,"\\$&")};function build(t){var e=function builder(){return applyStyle.apply(builder,arguments)};e._styles=t;e.__proto__=p;return e}var l=function(){var t={};i.grey=i.gray;Object.keys(i).forEach(function(e){i[e].closeRe=new RegExp(f(i[e].close),"g");t[e]={get:function(){return build(this._styles.concat(e))}}});return t}();var p=s(function colors(){},l);function applyStyle(){var t=Array.prototype.slice.call(arguments);var e=t.map(function(t){if(t!==undefined&&t.constructor===String){return t}else{return o.inspect(t)}}).join(" ");if(!r.enabled||!e){return e}var n=e.indexOf("\n")!=-1;var s=this._styles;var a=s.length;while(a--){var c=i[s[a]];e=c.open+e.replace(c.closeRe,c.open)+c.close;if(n){e=e.replace(u,c.close+"\n"+c.open)}}return e}r.setTheme=function(t){if(typeof t==="string"){console.log("colors.setTheme now only accepts an object, not a string. "+"If you are trying to set a theme from a file, it is now your (the "+"caller's) responsibility to require the file. The old syntax "+"looked like colors.setTheme(__dirname + "+"'/../themes/generic-logging.js'); The new syntax looks like "+"colors.setTheme(require(__dirname + "+"'/../themes/generic-logging.js'));");return}for(var e in t){(function(e){r[e]=function(n){if(typeof t[e]==="object"){var o=n;for(var i in t[e]){o=r[t[e][i]](o)}return o}return r[t[e]](n)}})(e)}};function init(){var t={};Object.keys(l).forEach(function(e){t[e]={get:function(){return build([e])}}});return t}var h=function sequencer(t,e){var n=e.split("");n=n.map(t);return n.join("")};r.trap=n(994);r.zalgo=n(713);r.maps={};r.maps.america=n(234);r.maps.zebra=n(899);r.maps.rainbow=n(656);r.maps.random=n(853);for(var m in r.maps){(function(t){r[t]=function(e){return h(r.maps[t],e)}})(m)}s(r,init())},700:function(t,e,n){"use strict";t.exports=n(626)},713:function(t){t.exports=function zalgo(t,e){t=t||" he is here ";var n={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]};var r=[].concat(n.up,n.down,n.mid);function randomNumber(t){var e=Math.floor(Math.random()*t);return e}function isChar(t){var e=false;r.filter(function(n){e=n===t});return e}function heComes(t,e){var r="";var o;var i;e=e||{};e["up"]=typeof e["up"]!=="undefined"?e["up"]:true;e["mid"]=typeof e["mid"]!=="undefined"?e["mid"]:true;e["down"]=typeof e["down"]!=="undefined"?e["down"]:true;e["size"]=typeof e["size"]!=="undefined"?e["size"]:"maxi";t=t.split("");for(i in t){if(isChar(i)){continue}r=r+t[i];o={up:0,down:0,mid:0};switch(e.size){case"mini":o.up=randomNumber(8);o.mid=randomNumber(2);o.down=randomNumber(8);break;case"maxi":o.up=randomNumber(16)+3;o.mid=randomNumber(4)+1;o.down=randomNumber(64)+3;break;default:o.up=randomNumber(8)+1;o.mid=randomNumber(6)/2;o.down=randomNumber(8)+1;break}var s=["up","mid","down"];for(var u in s){var a=s[u];for(var c=0;c<=o[a];c++){if(e[a]){r=r+n[a][randomNumber(n[a].length)]}}}}return r}return heComes(t,e)}},721:function(t,e,n){var r=n(614).EventEmitter;var o=n(129).spawn;var i=n(622);var s=i.dirname;var u=i.basename;var a=n(747);n(669).inherits(Command,r);e=t.exports=new Command;e.Command=Command;e.Option=Option;function Option(t,e){this.flags=t;this.required=~t.indexOf("<");this.optional=~t.indexOf("[");this.bool=!~t.indexOf("-no-");t=t.split(/[ ,|]+/);if(t.length>1&&!/^[[<]/.test(t[1]))this.short=t.shift();this.long=t.shift();this.description=e||""}Option.prototype.name=function(){return this.long.replace("--","").replace("no-","")};Option.prototype.attributeName=function(){return camelcase(this.name())};Option.prototype.is=function(t){return this.short===t||this.long===t};function Command(t){this.commands=[];this.options=[];this._execs={};this._allowUnknownOption=false;this._args=[];this._name=t||""}Command.prototype.command=function(t,e,n){if(typeof e==="object"&&e!==null){n=e;e=null}n=n||{};var r=t.split(/ +/);var o=new Command(r.shift());if(e){o.description(e);this.executables=true;this._execs[o._name]=true;if(n.isDefault)this.defaultExecutable=o._name}o._noHelp=!!n.noHelp;this.commands.push(o);o.parseExpectedArgs(r);o.parent=this;if(e)return this;return o};Command.prototype.arguments=function(t){return this.parseExpectedArgs(t.split(/ +/))};Command.prototype.addImplicitHelpCommand=function(){this.command("help [cmd]","display help for [cmd]")};Command.prototype.parseExpectedArgs=function(t){if(!t.length)return;var e=this;t.forEach(function(t){var n={required:false,name:"",variadic:false};switch(t[0]){case"<":n.required=true;n.name=t.slice(1,-1);break;case"[":n.name=t.slice(1,-1);break}if(n.name.length>3&&n.name.slice(-3)==="..."){n.variadic=true;n.name=n.name.slice(0,-3)}if(n.name){e._args.push(n)}});return this};Command.prototype.action=function(t){var e=this;var n=function(n,r){n=n||[];r=r||[];var o=e.parseOptions(r);outputHelpIfNecessary(e,o.unknown);if(o.unknown.length>0){e.unknownOption(o.unknown[0])}if(o.args.length)n=o.args.concat(n);e._args.forEach(function(t,r){if(t.required&&n[r]==null){e.missingArgument(t.name)}else if(t.variadic){if(r!==e._args.length-1){e.variadicArgNotLast(t.name)}n[r]=n.splice(r)}});if(e._args.length){n[e._args.length]=e}else{n.push(e)}t.apply(e,n)};var r=this.parent||this;var o=r===this?"*":this._name;r.on("command:"+o,n);if(this._alias)r.on("command:"+this._alias,n);return this};Command.prototype.option=function(t,e,n,r){var o=this,i=new Option(t,e),s=i.name(),u=i.attributeName();if(typeof n!=="function"){if(n instanceof RegExp){var a=n;n=function(t,e){var n=a.exec(t);return n?n[0]:e}}else{r=n;n=null}}if(!i.bool||i.optional||i.required){if(!i.bool)r=true;if(r!==undefined){o[u]=r;i.defaultValue=r}}this.options.push(i);this.on("option:"+s,function(t){if(t!==null&&n){t=n(t,o[u]===undefined?r:o[u])}if(typeof o[u]==="boolean"||typeof o[u]==="undefined"){if(t==null){o[u]=i.bool?r||true:false}else{o[u]=t}}else if(t!==null){o[u]=t}});return this};Command.prototype.allowUnknownOption=function(t){this._allowUnknownOption=arguments.length===0||t;return this};Command.prototype.parse=function(t){if(this.executables)this.addImplicitHelpCommand();this.rawArgs=t;this._name=this._name||u(t[1],".js");if(this.executables&&t.length<3&&!this.defaultExecutable){t.push("--help")}var e=this.parseOptions(this.normalize(t.slice(2)));var n=this.args=e.args;var r=this.parseArgs(this.args,e.unknown);var o=r.args[0];var i=null;if(o){i=this.commands.filter(function(t){return t.alias()===o})[0]}if(this._execs[o]&&typeof this._execs[o]!=="function"){return this.executeSubCommand(t,n,e.unknown)}else if(i){n[0]=i._name;return this.executeSubCommand(t,n,e.unknown)}else if(this.defaultExecutable){n.unshift(this.defaultExecutable);return this.executeSubCommand(t,n,e.unknown)}return r};Command.prototype.executeSubCommand=function(t,e,n){e=e.concat(n);if(!e.length)this.help();if(e[0]==="help"&&e.length===1)this.help();if(e[0]==="help"){e[0]=e[1];e[1]="--help"}var r=t[1];var c=u(r,".js")+"-"+e[0];var f,l=a.lstatSync(r).isSymbolicLink()?a.readlinkSync(r):r;if(l!==r&&l.charAt(0)!=="/"){l=i.join(s(r),l)}f=s(l);var p=i.join(f,c);var h=false;if(exists(p+".js")){c=p+".js";h=true}else if(exists(p)){c=p}e=e.slice(1);var m;if(process.platform!=="win32"){if(h){e.unshift(c);e=(process.execArgv||[]).concat(e);m=o(process.argv[0],e,{stdio:"inherit",customFds:[0,1,2]})}else{m=o(c,e,{stdio:"inherit",customFds:[0,1,2]})}}else{e.unshift(c);m=o(process.execPath,e,{stdio:"inherit"})}var d=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];d.forEach(function(t){process.on(t,function(){if(m.killed===false&&m.exitCode===null){m.kill(t)}})});m.on("close",process.exit.bind(process));m.on("error",function(t){if(t.code==="ENOENT"){console.error("\n %s(1) does not exist, try --help\n",c)}else if(t.code==="EACCES"){console.error("\n %s(1) not executable. try chmod or run with root\n",c)}process.exit(1)});this.runningCommand=m};Command.prototype.normalize=function(t){var e=[],n,r,o;for(var i=0,s=t.length;i<s;++i){n=t[i];if(i>0){r=this.optionFor(t[i-1])}if(n==="--"){e=e.concat(t.slice(i));break}else if(r&&r.required){e.push(n)}else if(n.length>1&&n[0]==="-"&&n[1]!=="-"){n.slice(1).split("").forEach(function(t){e.push("-"+t)})}else if(/^--/.test(n)&&~(o=n.indexOf("="))){e.push(n.slice(0,o),n.slice(o+1))}else{e.push(n)}}return e};Command.prototype.parseArgs=function(t,e){var n;if(t.length){n=t[0];if(this.listeners("command:"+n).length){this.emit("command:"+t.shift(),t,e)}else{this.emit("command:*",t)}}else{outputHelpIfNecessary(this,e);if(e.length>0){this.unknownOption(e[0])}}return this};Command.prototype.optionFor=function(t){for(var e=0,n=this.options.length;e<n;++e){if(this.options[e].is(t)){return this.options[e]}}};Command.prototype.parseOptions=function(t){var e=[],n=t.length,r,o,i;var s=[];for(var u=0;u<n;++u){i=t[u];if(r){e.push(i);continue}if(i==="--"){r=true;continue}o=this.optionFor(i);if(o){if(o.required){i=t[++u];if(i==null)return this.optionMissingArgument(o);this.emit("option:"+o.name(),i)}else if(o.optional){i=t[u+1];if(i==null||i[0]==="-"&&i!=="-"){i=null}else{++u}this.emit("option:"+o.name(),i)}else{this.emit("option:"+o.name())}continue}if(i.length>1&&i[0]==="-"){s.push(i);if(u+1<t.length&&t[u+1][0]!=="-"){s.push(t[++u])}continue}e.push(i)}return{args:e,unknown:s}};Command.prototype.opts=function(){var t={},e=this.options.length;for(var n=0;n<e;n++){var r=this.options[n].attributeName();t[r]=r===this._versionOptionName?this._version:this[r]}return t};Command.prototype.missingArgument=function(t){console.error();console.error(" error: missing required argument `%s'",t);console.error();process.exit(1)};Command.prototype.optionMissingArgument=function(t,e){console.error();if(e){console.error(" error: option `%s' argument missing, got `%s'",t.flags,e)}else{console.error(" error: option `%s' argument missing",t.flags)}console.error();process.exit(1)};Command.prototype.unknownOption=function(t){if(this._allowUnknownOption)return;console.error();console.error(" error: unknown option `%s'",t);console.error();process.exit(1)};Command.prototype.variadicArgNotLast=function(t){console.error();console.error(" error: variadic arguments must be last `%s'",t);console.error();process.exit(1)};Command.prototype.version=function(t,e){if(arguments.length===0)return this._version;this._version=t;e=e||"-V, --version";var n=new Option(e,"output the version number");this._versionOptionName=n.long.substr(2)||"version";this.options.push(n);this.on("option:"+this._versionOptionName,function(){process.stdout.write(t+"\n");process.exit(0)});return this};Command.prototype.description=function(t,e){if(arguments.length===0)return this._description;this._description=t;this._argsDescription=e;return this};Command.prototype.alias=function(t){var e=this;if(this.commands.length!==0){e=this.commands[this.commands.length-1]}if(arguments.length===0)return e._alias;if(t===e._name)throw new Error("Command alias can't be the same as its name");e._alias=t;return this};Command.prototype.usage=function(t){var e=this._args.map(function(t){return humanReadableArgName(t)});var n="[options]"+(this.commands.length?" [command]":"")+(this._args.length?" "+e.join(" "):"");if(arguments.length===0)return this._usage||n;this._usage=t;return this};Command.prototype.name=function(t){if(arguments.length===0)return this._name;this._name=t;return this};Command.prototype.prepareCommands=function(){return this.commands.filter(function(t){return!t._noHelp}).map(function(t){var e=t._args.map(function(t){return humanReadableArgName(t)}).join(" ");return[t._name+(t._alias?"|"+t._alias:"")+(t.options.length?" [options]":"")+(e?" "+e:""),t._description]})};Command.prototype.largestCommandLength=function(){var t=this.prepareCommands();return t.reduce(function(t,e){return Math.max(t,e[0].length)},0)};Command.prototype.largestOptionLength=function(){var t=[].slice.call(this.options);t.push({flags:"-h, --help"});return t.reduce(function(t,e){return Math.max(t,e.flags.length)},0)};Command.prototype.largestArgLength=function(){return this._args.reduce(function(t,e){return Math.max(t,e.name.length)},0)};Command.prototype.padWidth=function(){var t=this.largestOptionLength();if(this._argsDescription&&this._args.length){if(this.largestArgLength()>t){t=this.largestArgLength()}}if(this.commands&&this.commands.length){if(this.largestCommandLength()>t){t=this.largestCommandLength()}}return t};Command.prototype.optionHelp=function(){var t=this.padWidth();return this.options.map(function(e){return pad(e.flags,t)+" "+e.description+(e.bool&&e.defaultValue!==undefined?" (default: "+e.defaultValue+")":"")}).concat([pad("-h, --help",t)+" "+"output usage information"]).join("\n")};Command.prototype.commandHelp=function(){if(!this.commands.length)return"";var t=this.prepareCommands();var e=this.padWidth();return[" Commands:","",t.map(function(t){var n=t[1]?" "+t[1]:"";return(n?pad(t[0],e):t[0])+n}).join("\n").replace(/^/gm," "),""].join("\n")};Command.prototype.helpInformation=function(){var t=[];if(this._description){t=[" "+this._description,""];var e=this._argsDescription;if(e&&this._args.length){var n=this.padWidth();t.push(" Arguments:");t.push("");this._args.forEach(function(r){t.push(" "+pad(r.name,n)+" "+e[r.name])});t.push("")}}var r=this._name;if(this._alias){r=r+"|"+this._alias}var o=[""," Usage: "+r+" "+this.usage(),""];var i=[];var s=this.commandHelp();if(s)i=[s];var u=[" Options:","",""+this.optionHelp().replace(/^/gm," "),""];return o.concat(t).concat(u).concat(i).join("\n")};Command.prototype.outputHelp=function(t){if(!t){t=function(t){return t}}process.stdout.write(t(this.helpInformation()));this.emit("--help")};Command.prototype.help=function(t){this.outputHelp(t);process.exit()};function camelcase(t){return t.split("-").reduce(function(t,e){return t+e[0].toUpperCase()+e.slice(1)})}function pad(t,e){var n=Math.max(0,e-t.length);return t+Array(n+1).join(" ")}function outputHelpIfNecessary(t,e){e=e||[];for(var n=0;n<e.length;n++){if(e[n]==="--help"||e[n]==="-h"){t.outputHelp();process.exit(0)}}}function humanReadableArgName(t){var e=t.name+(t.variadic===true?"...":"");return t.required?"<"+e+">":"["+e+"]"}function exists(t){try{if(a.statSync(t).isFile()){return true}}catch(t){return false}}},747:function(t){t.exports=require("fs")},775:function(t,e,n){"use strict";var r=n(87);var o=n(396);var i=process.env;var s=void 0;if(o("no-color")||o("no-colors")||o("color=false")){s=false}else if(o("color")||o("colors")||o("color=true")||o("color=always")){s=true}if("FORCE_COLOR"in i){s=i.FORCE_COLOR.length===0||parseInt(i.FORCE_COLOR,10)!==0}function translateLevel(t){if(t===0){return false}return{level:t,hasBasic:true,has256:t>=2,has16m:t>=3}}function supportsColor(t){if(s===false){return 0}if(o("color=16m")||o("color=full")||o("color=truecolor")){return 3}if(o("color=256")){return 2}if(t&&!t.isTTY&&s!==true){return 0}var e=s?1:0;if(process.platform==="win32"){var n=r.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(n[0])>=10&&Number(n[2])>=10586){return Number(n[2])>=14931?3:2}return 1}if("CI"in i){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(t){return t in i})||i.CI_NAME==="codeship"){return 1}return e}if("TEAMCITY_VERSION"in i){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0}if("TERM_PROGRAM"in i){var u=parseInt((i.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(i.TERM_PROGRAM){case"iTerm.app":return u>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(i.TERM)){return 2}if(/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM)){return 1}if("COLORTERM"in i){return 1}if(i.TERM==="dumb"){return e}return e}function getSupportLevel(t){var e=supportsColor(t);return translateLevel(e)}t.exports={supportsColor:getSupportLevel,stdout:getSupportLevel(process.stdout),stderr:getSupportLevel(process.stderr)}},835:function(t){t.exports=require("url")},837:function(t,e,n){"use strict";var r=n(324);t.exports=r;r.enableSynchronous=function(){r.prototype.isPending=function(){return this.getState()==0};r.prototype.isFulfilled=function(){return this.getState()==1};r.prototype.isRejected=function(){return this.getState()==2};r.prototype.getValue=function(){if(this._83===3){return this._18.getValue()}if(!this.isFulfilled()){throw new Error("Cannot get a value of an unfulfilled promise.")}return this._18};r.prototype.getReason=function(){if(this._83===3){return this._18.getReason()}if(!this.isRejected()){throw new Error("Cannot get a rejection reason of a non-rejected promise.")}return this._18};r.prototype.getState=function(){if(this._83===3){return this._18.getState()}if(this._83===-1||this._83===-2){return 0}return this._83}};r.disableSynchronous=function(){r.prototype.isPending=undefined;r.prototype.isFulfilled=undefined;r.prototype.isRejected=undefined;r.prototype.getValue=undefined;r.prototype.getReason=undefined;r.prototype.getState=undefined}},853:function(t,e,n){var r=n(697);t.exports=function(){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta"];return function(e,n,o){return e===" "?e:r[t[Math.round(Math.random()*(t.length-2))]](e)}}()},899:function(t,e,n){var r=n(697);t.exports=function(t,e,n){return e%2===0?t:r.inverse(t)}},928:function(t,e,n){"use strict";var r;var o=typeof setImmediate==="function";t.exports=rawAsap;function rawAsap(t){if(!i.length){requestFlush();s=true}i[i.length]=t}var i=[];var s=false;var u=0;var a=1024;function flush(){while(u<i.length){var t=u;u=u+1;i[t].call();if(u>a){for(var e=0,n=i.length-u;e<n;e++){i[e]=i[e+u]}i.length-=u;u=0}}i.length=0;u=0;s=false}rawAsap.requestFlush=requestFlush;function requestFlush(){var t=process.domain;if(t){if(!r){r=n(229)}r.active=process.domain=null}if(s&&o){setImmediate(flush)}else{process.nextTick(flush)}if(t){r.active=process.domain=t}}},994:function(t){t.exports=function runTheTrap(t,e){var n="";t=t||"Run the trap, drop the bass";t=t.split("");var r={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};t.forEach(function(t){t=t.toLowerCase();var e=r[t]||[" "];var o=Math.floor(Math.random()*e.length);if(typeof r[t]!=="undefined"){n+=r[t][o]}else{n+=t}});return n}}});