@joker.front/cli
Version:
The Next-Generation Front-End Toolchain: Swift, Efficient, and Adaptive.
34 lines • 783 kB
JavaScript
"use strict";var e=require("events"),t=require("tty"),r=require("util"),n=require("fs"),i=require("net"),s=require("url"),o=require("http"),a=require("node:https"),c=require("node:http"),l=require("node:http2"),u=require("node:path"),p=require("node:os"),h=require("crypto"),d=require("node:fs"),f=require("node:dns"),m=require("node:crypto"),g=require("node:child_process"),A=require("child_process"),v=require("path"),y=require("node:process"),w=require("node:buffer"),x=require("node:url"),b=require("node:fs/promises"),_=require("node:util"),E=require("os"),S=require("rollup"),C=require("html-minifier"),k=require("node:module"),I=require("node:assert"),B=require("node:v8"),N=require("module"),R=require("esbuild"),O=require("postcss"),T=require("stream"),P=require("node:zlib"),L=require("worker_threads"),D=require("node:perf_hooks"),M=require("chokidar"),$=require("https"),Q=require("assert"),j=require("zlib"),F=require("buffer"),U=require("tls"),q=require("querystring"),H="undefined"!=typeof document?document.currentScript:null;function V(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var W=V(n),G=V(q);function J(e){return null==e?[]:Array.isArray(e)?e:[e]}function K(e,t,r,n){var i,s=e[t],o=~n.string.indexOf(t)?null==r||!0===r?"":String(r):"boolean"==typeof r?r:~n.boolean.indexOf(t)?"false"!==r&&("true"===r||(e._.push(0*(i=+r)==0?i:r),!!r)):0*(i=+r)==0?i:r;e[t]=null==s?o:Array.isArray(s)?s.concat(o):[s,o]}const z=e=>e.replace(/[<[].+/,"").trim(),Y=e=>e.sort(((e,t)=>e.length>t.length?-1:1))[0],X=(e,t)=>e.length>=t?e:`${e}${" ".repeat(t-e.length)}`,Z=(e,t,r)=>{let n,i=0,s=t.length,o=e;for(;i<s;++i)n=o[t[i]],o=o[t[i]]=i===s-1?r:null!=n?n:!~t[i+1].indexOf(".")&&+t[i+1]>-1?[]:{}},ee=(e,t)=>{for(const r of Object.keys(t)){const n=t[r];n.shouldTransform&&(e[r]=Array.prototype.concat.call([],e[r]),"function"==typeof n.transformFunction&&(e[r]=e[r].map(n.transformFunction)))}},te=e=>e.split(".").map(((e,t)=>0===t?e.replace(/([a-z])-([a-z])/g,((e,t,r)=>t+r.toUpperCase())):e)).join(".");class re extends Error{constructor(e){super(e),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}}class ne{constructor(e,t,r){this.rawName=e,this.description=t,this.config=Object.assign({},r),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=z(e).split(",").map((e=>{let t=e.trim().replace(/^-{1,2}/,"");return t.startsWith("no-")&&(this.negated=!0,t=t.replace(/^no-/,"")),te(t)})).sort(((e,t)=>e.length>t.length?1:-1)),this.name=this.names[this.names.length-1],this.negated&&null==this.config.default&&(this.config.default=!0),e.includes("<")?this.required=!0:e.includes("[")?this.required=!1:this.isBoolean=!0}}const ie=process.argv,se=`${process.platform}-${process.arch} node-${process.version}`;class oe{constructor(e,t,r={},n){this.rawName=e,this.description=t,this.config=r,this.cli=n,this.options=[],this.aliasNames=[],this.name=z(e),this.args=(e=>{const t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=e=>{let t=!1,r=e[1];return r.startsWith("...")&&(r=r.slice(3),t=!0),{required:e[0].startsWith("<"),value:r,variadic:t}};let s,o;for(;s=t.exec(e);)n.push(i(s));for(;o=r.exec(e);)n.push(i(o));return n})(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t="-v, --version"){return this.versionNumber=e,this.option(t,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,t,r){const n=new ne(e,t,r);return this.options.push(n),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return""===this.name||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof ae}hasOption(e){return e=e.split(".")[0],this.options.find((t=>t.names.includes(e)))}outputHelp(){const{name:e,commands:t}=this.cli,{versionNumber:r,options:n,helpCallback:i}=this.cli.globalCommand;let s=[{body:`${e}${r?`/${r}`:""}`}];s.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`});if((this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){const r=Y(t.map((e=>e.rawName)));s.push({title:"Commands",body:t.map((e=>` ${X(e.rawName,r.length)} ${e.description}`)).join("\n")}),s.push({title:"For more info, run any command with the `--help` flag",body:t.map((t=>` $ ${e}${""===t.name?"":` ${t.name}`} --help`)).join("\n")})}let o=this.isGlobalCommand?n:[...this.options,...n||[]];if(this.isGlobalCommand||this.isDefaultCommand||(o=o.filter((e=>"version"!==e.name))),o.length>0){const e=Y(o.map((e=>e.rawName)));s.push({title:"Options",body:o.map((t=>` ${X(t.rawName,e.length)} ${t.description} ${void 0===t.config.default?"":`(default: ${t.config.default})`}`)).join("\n")})}this.examples.length>0&&s.push({title:"Examples",body:this.examples.map((t=>"function"==typeof t?t(e):t)).join("\n")}),i&&(s=i(s)||s),console.log(s.map((e=>e.title?`${e.title}:\n${e.body}`:e.body)).join("\n\n"))}outputVersion(){const{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.log(`${e}/${t} ${se}`)}checkRequiredArgs(){const e=this.args.filter((e=>e.required)).length;if(this.cli.args.length<e)throw new re(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){const{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions)for(const r of Object.keys(e))if("--"!==r&&!this.hasOption(r)&&!t.hasOption(r))throw new re(`Unknown option \`${r.length>1?`--${r}`:`-${r}`}\``)}checkOptionValue(){const{options:e,globalCommand:t}=this.cli,r=[...t.options,...this.options];for(const t of r){const n=e[t.name.split(".")[0]];if(t.required){const e=r.some((e=>e.negated&&e.names.includes(t.name)));if(!0===n||!1===n&&!e)throw new re(`option \`${t.rawName}\` value is missing`)}}}}class ae extends oe{constructor(e){super("@@global@@","",{},e)}}var ce=Object.assign;class le extends e.EventEmitter{constructor(e=""){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new ae(this),this.globalCommand.usage("<command> [options]")}usage(e){return this.globalCommand.usage(e),this}command(e,t,r){const n=new oe(e,t||"",r,this);return n.globalCommand=this.globalCommand,this.commands.push(n),n}option(e,t,r){return this.globalCommand.option(e,t,r),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t="-v, --version"){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},r,n){return this.args=e,this.options=t,r&&(this.matchedCommand=r),n&&(this.matchedCommandName=n),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=ie,{run:t=!0}={}){this.rawArgs=e,this.name||(this.name=e[1]?(e=>{const t=/([^\\\/]+)$/.exec(e);return t?t[1]:""})(e[1]):"cli");let r=!0;for(const t of this.commands){const n=this.mri(e.slice(2),t),i=n.args[0];if(t.isMatched(i)){r=!1;const e=ce(ce({},n),{args:n.args.slice(1)});this.setParsedInfo(e,t,i),this.emit(`command:${i}`,t)}}if(r)for(const t of this.commands)if(""===t.name){r=!1;const n=this.mri(e.slice(2),t);this.setParsedInfo(n,t),this.emit("command:!",t)}if(r){const t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&null==this.matchedCommandName&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());const n={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit("command:*"),n}mri(e,t){const r=[...this.globalCommand.options,...t?t.options:[]],n=(e=>{const t={alias:{},boolean:[]};for(const[r,n]of e.entries())if(n.names.length>1&&(t.alias[n.names[0]]=n.names.slice(1)),n.isBoolean)if(n.negated){const i=e.some(((e,t)=>t!==r&&e.names.some((e=>n.names.includes(e)))&&"boolean"==typeof e.required));i||t.boolean.push(n.names[0])}else t.boolean.push(n.names[0]);return t})(r);let i=[];const s=e.indexOf("--");s>-1&&(i=e.slice(s+1),e=e.slice(0,s));let o=function(e,t){t=t||{};var r,n,i,s,o,a={_:[]},c=0,l=0,u=0,p=(e=e||[]).length;const h=void 0!==t.alias,d=void 0!==t.unknown,f=void 0!==t.default;if(t.alias=t.alias||{},t.string=J(t.string),t.boolean=J(t.boolean),h)for(r in t.alias)for(n=t.alias[r]=J(t.alias[r]),c=0;c<n.length;c++)(t.alias[n[c]]=n.concat(r)).splice(c,1);for(c=t.boolean.length;c-- >0;)for(l=(n=t.alias[t.boolean[c]]||[]).length;l-- >0;)t.boolean.push(n[l]);for(c=t.string.length;c-- >0;)for(l=(n=t.alias[t.string[c]]||[]).length;l-- >0;)t.string.push(n[l]);if(f)for(r in t.default)if(s=typeof t.default[r],n=t.alias[r]=t.alias[r]||[],void 0!==t[s])for(t[s].push(r),c=0;c<n.length;c++)t[s].push(n[c]);const m=d?Object.keys(t.alias):[];for(c=0;c<p;c++){if("--"===(i=e[c])){a._=a._.concat(e.slice(++c));break}for(l=0;l<i.length&&45===i.charCodeAt(l);l++);if(0===l)a._.push(i);else if("no-"===i.substring(l,l+3)){if(s=i.substring(l+3),d&&!~m.indexOf(s))return t.unknown(i);a[s]=!1}else{for(u=l+1;u<i.length&&61!==i.charCodeAt(u);u++);for(s=i.substring(l,u),o=i.substring(++u)||c+1===p||45===(""+e[c+1]).charCodeAt(0)||e[++c],n=2===l?[s]:s,u=0;u<n.length;u++){if(s=n[u],d&&!~m.indexOf(s))return t.unknown("-".repeat(l)+s);K(a,s,u+1<n.length||o,t)}}}if(f)for(r in t.default)void 0===a[r]&&(a[r]=t.default[r]);if(h)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a}(e,n);o=Object.keys(o).reduce(((e,t)=>ce(ce({},e),{[te(t)]:o[t]})),{_:[]});const a=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue;let u=Object.create(null);for(const e of r){if(!l&&void 0!==e.config.default)for(const t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&void 0===u[e.name]&&(u[e.name]=Object.create(null),u[e.name].shouldTransform=!0,u[e.name].transformFunction=e.config.type[0])}for(const e of Object.keys(o))if("_"!==e){const t=e.split(".");Z(c,t,o[e]),ee(c,u)}return{args:a,options:c}}runMatchedCommand(){const{args:e,options:t,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();const n=[];return r.args.forEach(((t,r)=>{t.variadic?n.push(e.slice(r)):n.push(e[r])})),n.push(t),r.commandAction.apply(this,n)}}var ue="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var he,de,fe,me,ge={exports:{}},Ae={exports:{}},ve={exports:{}};function ye(){if(de)return he;de=1;var e=1e3,t=60*e,r=60*t,n=24*r,i=365.25*n;function s(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}return he=function(o,a){a=a||{};var c=typeof o;if("string"===c&&o.length>0)return function(s){if(s=String(s),s.length>100)return;var o=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(s);if(!o)return;var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*i;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(o);if("number"===c&&!1===isNaN(o))return a.long?function(i){return s(i,n,"day")||s(i,r,"hour")||s(i,t,"minute")||s(i,e,"second")||i+" ms"}(o):function(i){if(i>=n)return Math.round(i/n)+"d";if(i>=r)return Math.round(i/r)+"h";if(i>=t)return Math.round(i/t)+"m";if(i>=e)return Math.round(i/e)+"s";return i+"ms"}(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))},he}function we(){return fe||(fe=1,function(e,t){var r;function n(e){function n(){if(n.enabled){var e=n,i=+new Date,s=i-(r||i);e.diff=s,e.prev=r,e.curr=i,r=i;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=t.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var c=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;c++;var i=t.formatters[n];if("function"==typeof i){var s=o[c];r=i.call(e,s),o.splice(c,1),c--}return r})),t.formatArgs.call(e,o),(n.log||t.log||console.log.bind(console)).apply(e,o)}}return n.namespace=e,n.enabled=t.enabled(e),n.useColors=t.useColors(),n.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),"function"==typeof t.init&&t.init(n),n}(t=ve.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e),t.names=[],t.skips=[];for(var r=("string"==typeof e?e:"").split(/[\s,]+/),n=r.length,i=0;i<n;i++)r[i]&&("-"===(e=r[i].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=ye(),t.names=[],t.skips=[],t.formatters={}}(0,ve.exports)),ve.exports}var xe,be={exports:{}};"undefined"!=typeof process&&"renderer"===process.type?ge.exports=(me||(me=1,function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=Ae.exports=we()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(s=i))})),e.splice(s,0,n)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}(0,Ae.exports)),Ae.exports):ge.exports=(xe||(xe=1,function(e,s){var o=t,a=r;(s=be.exports=we()).init=function(e){e.inspectOpts={};for(var t=Object.keys(s.inspectOpts),r=0;r<t.length;r++)e.inspectOpts[t[r]]=s.inspectOpts[t[r]]},s.log=function(){return l.write(a.format.apply(a,arguments)+"\n")},s.formatArgs=function(e){var t=this.namespace;if(this.useColors){var r=this.color,n=" [3"+r+";1m"+t+" [0m";e[0]=n+e[0].split("\n").join("\n"+n),e.push("[3"+r+"m+"+s.humanize(this.diff)+"[0m")}else e[0]=(new Date).toUTCString()+" "+t+" "+e[0]},s.save=function(e){null==e?delete process.env.DEBUG:process.env.DEBUG=e},s.load=u,s.useColors=function(){return"colors"in s.inspectOpts?Boolean(s.inspectOpts.colors):o.isatty(c)},s.colors=[6,2,3,4,5,1],s.inspectOpts=Object.keys(process.env).filter((function(e){return/^debug_/i.test(e)})).reduce((function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()})),n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{});var c=parseInt(process.env.DEBUG_FD,10)||2;1!==c&&2!==c&&a.deprecate((function(){}),"except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();var l=1===c?process.stdout:2===c?process.stderr:function(e){var t;switch(process.binding("tty_wrap").guessHandleType(e)){case"TTY":(t=new o.WriteStream(e))._type="tty",t._handle&&t._handle.unref&&t._handle.unref();break;case"FILE":(t=new n.SyncWriteStream(e,{autoClose:!1}))._type="fs";break;case"PIPE":case"TCP":(t=new i.Socket({fd:e,readable:!1,writable:!0})).readable=!1,t.read=null,t._type="pipe",t._handle&&t._handle.unref&&t._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return t.fd=e,t._isStdio=!0,t}(c);function u(){return process.env.DEBUG}s.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((function(e){return e.trim()})).join(" ")},s.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)},s.enable(u())}(0,be.exports)),be.exports);var _e=ge.exports,Ee=function(e){return String(e).replace(Ce,ke).replace(Se,encodeURI)}
/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* Copyright(c) 2015 Andreas Lubbe
* Copyright(c) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
*/,Se=/(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g,Ce=/(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g,ke="$1�$2";
/*!
* encodeurl
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/var Ie=/["'&<>]/,Be=function(e){var t,r=""+e,n=Ie.exec(r);if(!n)return r;var i="",s=0,o=0;for(s=n.index;s<r.length;s++){switch(r.charCodeAt(s)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}o!==s&&(i+=r.substring(o,s)),o=s+1,i+=t}return o!==s?i+r.substring(o,s):i};var Ne={exports:{}},Re=function(e,t){if(!Array.isArray(e))throw new TypeError("arg must be an array of [ee, events...] arrays");for(var r=[],n=0;n<e.length;n++){var i=e[n];if(!Array.isArray(i)||i.length<2)throw new TypeError("each array member must be [ee, events...]");for(var s=i[0],o=1;o<i.length;o++){var a=i[o],c=Oe(a,l);s.on(a,c),r.push({ee:s,event:a,fn:c})}}function l(){u(),t.apply(null,arguments)}function u(){for(var e,t=0;t<r.length;t++)(e=r[t]).ee.removeListener(e.event,e.fn)}function p(e){t=e}return p.cancel=u,p};
/*!
* ee-first
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*/function Oe(e,t){return function(r){for(var n=new Array(arguments.length),i="error"===e?r:null,s=0;s<n.length;s++)n[s]=arguments[s];t(i,this,e,n)}}
/*!
* on-finished
* Copyright(c) 2013 Jonathan Ong
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/Ne.exports=function(e,t){if(!1!==Le(e))return Pe(t,null,e),e;return function(e,t){var r=e.__onFinished;r&&r.queue||(r=e.__onFinished=function(e){function t(r){if(e.__onFinished===t&&(e.__onFinished=null),t.queue){var n=t.queue;t.queue=null;for(var i=0;i<n.length;i++)n[i](r,e)}}return t.queue=[],t}(e),function(e,t){var r,n,i=!1;function s(e){r.cancel(),n.cancel(),i=!0,t(e)}function o(t){e.removeListener("socket",o),i||r===n&&(n=Te([[t,"error","close"]],s))}if(r=n=Te([[e,"end","finish"]],s),e.socket)return void o(e.socket);e.on("socket",o),void 0===e.socket&&function(e,t){var r=e.assignSocket;if("function"!=typeof r)return;e.assignSocket=function(e){r.call(this,e),t(e)}}(e,o)}(e,r));r.queue.push(t)}(e,t),e},Ne.exports.isFinished=Le;var Te=Re,Pe="function"==typeof setImmediate?setImmediate:function(e){process.nextTick(e.bind.apply(e,arguments))};function Le(e){var t=e.socket;return"boolean"==typeof e.finished?Boolean(e.finished||t&&!t.writable):"boolean"==typeof e.complete?Boolean(e.upgrade||!t||!t.readable||e.complete&&!e.readable):void 0}var De=Ne.exports,Me={exports:{}},$e=s,Qe=$e.parse,je=$e.Url;function Fe(e){var t=e.url;if(void 0!==t){var r=e._parsedUrl;return qe(t,r)?r:((r=Ue(t))._raw=t,e._parsedUrl=r)}}function Ue(e){if("string"!=typeof e||47!==e.charCodeAt(0))return Qe(e);for(var t=e,r=null,n=null,i=1;i<e.length;i++)switch(e.charCodeAt(i)){case 63:null===n&&(t=e.substring(0,i),r=e.substring(i+1),n=e.substring(i));break;case 9:case 10:case 12:case 13:case 32:case 35:case 160:case 65279:return Qe(e)}var s=void 0!==je?new je:{};return s.path=e,s.href=e,s.pathname=t,null!==n&&(s.query=r,s.search=n),s}function qe(e,t){return"object"==typeof t&&null!==t&&(void 0===je||t instanceof je)&&t._raw===e}Me.exports=Fe,Me.exports.original=function(e){var t=e.originalUrl;if("string"!=typeof t)return Fe(e);var r=e._parsedOriginalUrl;if(qe(t,r))return r;return r=Ue(t),r._raw=t,e._parsedOriginalUrl=r};var He=Me.exports,Ve={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"(Unused)",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},We=Ge;function Ge(e){if("number"==typeof e){if(!Ge[e])throw new Error("invalid status code: "+e);return e}if("string"!=typeof e)throw new TypeError("code must be a number or string");var t=parseInt(e,10);if(!isNaN(t)){if(!Ge[t])throw new Error("invalid status code: "+t);return t}if(!(t=Ge[e.toLowerCase()]))throw new Error('invalid status message: "'+e+'"');return t}
/*!
* unpipe
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/Ge.STATUS_CODES=Ve,Ge.codes=function(e,t){var r=[];return Object.keys(t).forEach((function(n){var i=t[n],s=Number(n);e[s]=i,e[i]=s,e[i.toLowerCase()]=s,r.push(s)})),r}(Ge,Ve),Ge.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},Ge.empty={204:!0,205:!0,304:!0},Ge.retry={502:!0,503:!0,504:!0};var Je=function(e){if(!e)throw new TypeError("argument stream is required");if("function"==typeof e.unpipe)return void e.unpipe();if(!function(e){for(var t=e.listeners("data"),r=0;r<t.length;r++)if("ondata"===t[r].name)return!0;return!1}(e))return;for(var t,r=e.listeners("close"),n=0;n<r.length;n++)"cleanup"!==(t=r[n]).name&&"onclose"!==t.name||t.call(e)}
/*!
* finalhandler
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/;var Ke=_e("finalhandler"),ze=Ee,Ye=Be,Xe=De,Ze=He,et=We,tt=Je,rt=/\x20{2}/g,nt=/\n/g,it="function"==typeof setImmediate?setImmediate:function(e){process.nextTick(e.bind.apply(e,arguments))},st=Xe.isFinished;var ot=function(e,t,r){var n=r||{},i=n.env||process.env.NODE_ENV||"development",s=n.onerror;return function(r){var n,o,a;if(r||!at(t)){if(r?(a=function(e){if("number"==typeof e.status&&e.status>=400&&e.status<600)return e.status;if("number"==typeof e.statusCode&&e.statusCode>=400&&e.statusCode<600)return e.statusCode;return}(r),void 0===a?a=function(e){var t=e.statusCode;("number"!=typeof t||t<400||t>599)&&(t=500);return t}(t):n=function(e){if(!e.headers||"object"!=typeof e.headers)return;for(var t=Object.create(null),r=Object.keys(e.headers),n=0;n<r.length;n++){var i=r[n];t[i]=e.headers[i]}return t}(r),o=function(e,t,r){var n;"production"!==r&&((n=e.stack)||"function"!=typeof e.toString||(n=e.toString()));return n||et[t]}(r,a,i)):(a=404,o="Cannot "+e.method+" "+ze(function(e){try{return Ze.original(e).pathname}catch(e){return"resource"}}(e))),Ke("default %s",a),r&&s&&it(s,r,e,t),at(t))return Ke("cannot %d after headers sent",a),void e.socket.destroy();!function(e,t,r,n,i){function s(){var s=function(e){return'<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>'+Ye(e).replace(nt,"<br>").replace(rt," ")+"</pre>\n</body>\n</html>\n"}(i);t.statusCode=r,t.statusMessage=et[r],function(e,t){if(!t)return;for(var r=Object.keys(t),n=0;n<r.length;n++){var i=r[n];e.setHeader(i,t[i])}}(t,n),t.setHeader("Content-Security-Policy","default-src 'none'"),t.setHeader("X-Content-Type-Options","nosniff"),t.setHeader("Content-Type","text/html; charset=utf-8"),t.setHeader("Content-Length",Buffer.byteLength(s,"utf8")),"HEAD"!==e.method?t.end(s,"utf8"):t.end()}if(st(e))return void s();tt(e),Xe(e,s),e.resume()}(e,t,a,n,o)}else Ke("cannot 404 after headers sent")}};function at(e){return"boolean"!=typeof e.headersSent?Boolean(e._header):e.headersSent}var ct={exports:{}},lt=ct.exports=function(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e},ut=_e("connect:dispatcher"),pt=e.EventEmitter,ht=ot,dt=o,ft=lt,mt=He,gt=function(){function e(t,r,n){e.handle(t,r,n)}return ft(e,vt),ft(e,pt.prototype),e.route="/",e.stack=[],e},At=process.env.NODE_ENV||"development",vt={},yt="function"==typeof setImmediate?setImmediate:function(e){process.nextTick(e.bind.apply(e,arguments))};function wt(e){"test"!==At&&console.error(e.stack||e.toString())}vt.use=function(e,t){var r=t,n=e;if("string"!=typeof e&&(r=e,n="/"),"function"==typeof r.handle){var i=r;i.route=n,r=function(e,t,r){i.handle(e,t,r)}}return r instanceof dt.Server&&(r=r.listeners("request")[0]),"/"===n[n.length-1]&&(n=n.slice(0,-1)),ut("use %s %s",n||"/",r.name||"anonymous"),this.stack.push({route:n,handle:r}),this},vt.handle=function(e,t,r){var n=0,i=function(e){if(0===e.length||"/"===e[0])return;var t=e.indexOf("://");return-1!==t&&-1===e.lastIndexOf("?",t)?e.substr(0,e.indexOf("/",3+t)):void 0}(e.url)||"",s="",o=!1,a=this.stack,c=r||ht(e,t,{env:At,onerror:wt});e.originalUrl=e.originalUrl||e.url,function r(l){o&&(e.url=e.url.substr(1),o=!1),0!==s.length&&(e.url=i+s+e.url.substr(i.length),s="");var u=a[n++];if(u){var p=mt(e).pathname||"/",h=u.route;if(p.toLowerCase().substr(0,h.length)!==h.toLowerCase())return r(l);var d=p.length>h.length&&p[h.length];if(d&&"/"!==d&&"."!==d)return r(l);0!==h.length&&"/"!==h&&(s=h,e.url=i+e.url.substr(i.length+s.length),i||"/"===e.url[0]||(e.url="/"+e.url,o=!0)),function(e,t,r,n,i,s){var o=e.length,a=r,c=Boolean(r);ut("%s %s : %s",e.name||"<anonymous>",t,n.originalUrl);try{if(c&&4===o)return void e(r,n,i,s);if(!c&&o<4)return void e(n,i,s)}catch(e){a=e}s(a)}(u.handle,h,l,e,t,r)}else yt(c,l)}()},vt.listen=function(){var e=dt.createServer(this);return e.listen.apply(e,arguments)};var xt=pe(gt),bt={exports:{}};let _t=process.argv||[],Et=process.env,St=!("NO_COLOR"in Et||_t.includes("--no-color"))&&("FORCE_COLOR"in Et||_t.includes("--color")||"win32"===process.platform||null!=require&&t.isatty(1)&&"dumb"!==Et.TERM||"CI"in Et),Ct=(e,t,r=e)=>n=>{let i=""+n,s=i.indexOf(t,e.length);return~s?e+kt(i,t,r,s)+t:e+i+t},kt=(e,t,r,n)=>{let i="",s=0;do{i+=e.substring(s,n)+r,s=n+t.length,n=e.indexOf(t,s)}while(~n);return i+e.substring(s)},It=(e=St)=>{let t=e?Ct:()=>String;return{isColorSupported:e,reset:t("[0m","[0m"),bold:t("[1m","[22m","[22m[1m"),dim:t("[2m","[22m","[22m[2m"),italic:t("[3m","[23m"),underline:t("[4m","[24m"),inverse:t("[7m","[27m"),hidden:t("[8m","[28m"),strikethrough:t("[9m","[29m"),black:t("[30m","[39m"),red:t("[31m","[39m"),green:t("[32m","[39m"),yellow:t("[33m","[39m"),blue:t("[34m","[39m"),magenta:t("[35m","[39m"),cyan:t("[36m","[39m"),white:t("[37m","[39m"),gray:t("[90m","[39m"),bgBlack:t("[40m","[49m"),bgRed:t("[41m","[49m"),bgGreen:t("[42m","[49m"),bgYellow:t("[43m","[49m"),bgBlue:t("[44m","[49m"),bgMagenta:t("[45m","[49m"),bgCyan:t("[46m","[49m"),bgWhite:t("[47m","[49m"),blackBright:t("[90m","[39m"),redBright:t("[91m","[39m"),greenBright:t("[92m","[39m"),yellowBright:t("[93m","[39m"),blueBright:t("[94m","[39m"),magentaBright:t("[95m","[39m"),cyanBright:t("[96m","[39m"),whiteBright:t("[97m","[39m"),bgBlackBright:t("[100m","[49m"),bgRedBright:t("[101m","[49m"),bgGreenBright:t("[102m","[49m"),bgYellowBright:t("[103m","[49m"),bgBlueBright:t("[104m","[49m"),bgMagentaBright:t("[105m","[49m"),bgCyanBright:t("[106m","[49m"),bgWhiteBright:t("[107m","[49m")}};bt.exports=It(),bt.exports.createColors=It;var Bt=bt.exports,Nt=pe(Bt),Rt=function(e,t){if(null==e)throw new TypeError("argument entity is required");var r=function(e){if("function"==typeof Tt&&e instanceof Tt)return!0;return e&&"object"==typeof e&&"ctime"in e&&"[object Date]"===Pt.call(e.ctime)&&"mtime"in e&&"[object Date]"===Pt.call(e.mtime)&&"ino"in e&&"number"==typeof e.ino&&"size"in e&&"number"==typeof e.size}(e),n=t&&"boolean"==typeof t.weak?t.weak:r;if(!r&&"string"!=typeof e&&!Buffer.isBuffer(e))throw new TypeError("argument entity must be string, Buffer, or fs.Stats");var i=r?function(e){var t=e.mtime.getTime().toString(16),r=e.size.toString(16);return'"'+r+"-"+t+'"'}(e):function(e){if(0===e.length)return'"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';var t=Ot.createHash("sha1").update(e,"utf8").digest("base64").substring(0,27),r="string"==typeof e?Buffer.byteLength(e,"utf8"):e.length;return'"'+r.toString(16)+"-"+t+'"'}(e);return n?"W/"+i:i},Ot=h,Tt=n.Stats,Pt=Object.prototype.toString;var Lt,Dt=pe(Rt);!function(e){const t=["silent","error","warn","info","debug"];function r(r,n,i){if(t.indexOf(r)<=t.indexOf(e.logLevel)){let e=`${Nt.dim(function(){let e=new Date;function t(e,t=2){return e.toString().padStart(t,"0")}return t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+":"+t(e.getMilliseconds(),3)}())} `;switch(r){case"info":e+=`[${Nt.cyan(Nt.bold(n))}] `;break;case"warn":e+=`[${Nt.yellow(Nt.bold(n))}] `;break;case"error":e+=`[${Nt.red(Nt.bold(n))}] `;break;case"debug":e+=`[${Nt.cyan(Nt.bold(n))}] `,r="info"}e+=`: ${i}`,console[r](e)}}e.logLevel="info",e.debug=function(e,t){r("debug",e,t)},e.info=function(e,t){r("info",e,t)},e.warn=function(e,t){return r("warn",e,t),t},e.error=function(e,t,n){return r("error",e,t),n&&console.error(n),t+(n?.message?`\n${n?.message}`:"")}}(Lt||(Lt={}));var Mt,$t,Qt,jt,Ft,Ut={exports:{}};Ft="win32"===process.platform||ue.TESTING_WINDOWS?function(){if($t)return Mt;$t=1,Mt=r,r.sync=function(r,n){return t(e.statSync(r),r,n)};var e=n;function t(e,t,r){return!(!e.isSymbolicLink()&&!e.isFile())&&function(e,t){var r=void 0!==t.pathExt?t.pathExt:process.env.PATHEXT;if(!r)return!0;if(-1!==(r=r.split(";")).indexOf(""))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}(t,r)}function r(r,n,i){e.stat(r,(function(e,s){i(e,!e&&t(s,r,n))}))}return Mt}():function(){if(jt)return Qt;jt=1,Qt=t,t.sync=function(t,n){return r(e.statSync(t),n)};var e=n;function t(t,n,i){e.stat(t,(function(e,t){i(e,!e&&r(t,n))}))}function r(e,t){return e.isFile()&&function(e,t){var r=e.mode,n=e.uid,i=e.gid,s=void 0!==t.uid?t.uid:process.getuid&&process.getuid(),o=void 0!==t.gid?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8);return r&parseInt("001",8)||r&c&&i===o||r&a&&n===s||r&(a|c)&&0===s}(e,t)}return Qt}();var qt=Ht;function Ht(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise((function(r,n){Ht(e,t||{},(function(e,t){e?n(e):r(t)}))}))}Ft(e,t||{},(function(e,n){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,n=!1),r(e,n)}))}Ht.sync=function(e,t){try{return Ft.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}};const Vt="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,Wt=v,Gt=Vt?";":":",Jt=qt,Kt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),zt=(e,t)=>{const r=t.colon||Gt,n=e.match(/\//)||Vt&&e.match(/\\/)?[""]:[...Vt?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],i=Vt?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Vt?i.split(r):[""];return Vt&&-1!==e.indexOf(".")&&""!==s[0]&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},Yt=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});const{pathEnv:n,pathExt:i,pathExtExe:s}=zt(e,t),o=[],a=r=>new Promise(((i,s)=>{if(r===n.length)return t.all&&o.length?i(o):s(Kt(e));const a=n[r],l=/^".*"$/.test(a)?a.slice(1,-1):a,u=Wt.join(l,e),p=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;i(c(p,r,0))})),c=(e,r,n)=>new Promise(((l,u)=>{if(n===i.length)return l(a(r+1));const p=i[n];Jt(e+p,{pathExt:s},((i,s)=>{if(!i&&s){if(!t.all)return l(e+p);o.push(e+p)}return l(c(e,r,n+1))}))}));return r?a(0).then((e=>r(null,e)),r):a(0)};var Xt=Yt;Yt.sync=(e,t)=>{t=t||{};const{pathEnv:r,pathExt:n,pathExtExe:i}=zt(e,t),s=[];for(let o=0;o<r.length;o++){const a=r[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=Wt.join(c,e),u=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let e=0;e<n.length;e++){const r=u+n[e];try{if(Jt.sync(r,{pathExt:i})){if(!t.all)return r;s.push(r)}}catch(e){}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw Kt(e)};var Zt={exports:{}};const er=(e={})=>{const t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find((e=>"PATH"===e.toUpperCase()))||"Path"};Zt.exports=er,Zt.exports.default=er;var tr=Zt.exports;const rr=v,nr=Xt,ir=tr;function sr(e,t){const r=e.options.env||process.env,n=process.cwd(),i=null!=e.options.cwd,s=i&&void 0!==process.chdir&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch(e){}let o;try{o=nr.sync(e.command,{path:r[ir({env:r})],pathExt:t?rr.delimiter:void 0})}catch(e){}finally{s&&process.chdir(n)}return o&&(o=rr.resolve(i?e.options.cwd:"",o)),o}var or=function(e){return sr(e)||sr(e,!0)},ar={};const cr=/([()\][%!^"`<>&|;, *?])/g;ar.command=function(e){return e=e.replace(cr,"^$1")},ar.argument=function(e,t){return e=(e=`"${e=(e=(e=`${e}`).replace(/(\\*)"/g,'$1$1\\"')).replace(/(\\*)$/,"$1$1")}"`).replace(cr,"^$1"),t&&(e=e.replace(cr,"^$1")),e};const lr=/^#!(.*)/;const ur=n,pr=(e="")=>{const t=e.match(lr);if(!t)return null;const[r,n]=t[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return"env"===i?n:n?`${i} ${n}`:i};var hr=function(e){const t=Buffer.alloc(150);let r;try{r=ur.openSync(e,"r"),ur.readSync(r,t,0,150,0),ur.closeSync(r)}catch(e){}return pr(t.toString())};const dr=v,fr=or,mr=ar,gr=hr,Ar="win32"===process.platform,vr=/\.(?:com|exe)$/i,yr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function wr(e){if(!Ar)return e;const t=function(e){e.file=fr(e);const t=e.file&&gr(e.file);return t?(e.args.unshift(e.file),e.command=t,fr(e)):e.file}(e),r=!vr.test(t);if(e.options.forceShell||r){const r=yr.test(t);e.command=dr.normalize(e.command),e.command=mr.command(e.command),e.args=e.args.map((e=>mr.argument(e,r)));const n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}var xr=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);const n={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?n:wr(n)};const br="win32"===process.platform;function _r(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Er(e,t){return br&&1===e&&!t.file?_r(t.original,"spawn"):null}var Sr={hookChildProcess:function(e,t){if(!br)return;const r=e.emit;e.emit=function(n,i){if("exit"===n){const n=Er(i,t);if(n)return r.call(e,"error",n)}return r.apply(e,arguments)}},verifyENOENT:Er,verifyENOENTSync:function(e,t){return br&&1===e&&!t.file?_r(t.original,"spawnSync"):null},notFoundError:_r};const Cr=A,kr=xr,Ir=Sr;function Br(e,t,r){const n=kr(e,t,r),i=Cr.spawn(n.command,n.args,n.options);return Ir.hookChildProcess(i,n),i}Ut.exports=Br,Ut.exports.spawn=Br,Ut.exports.sync=function(e,t,r){const n=kr(e,t,r),i=Cr.spawnSync(n.command,n.args,n.options);return i.error=i.error||Ir.verifyENOENTSync(i.status,n),i},Ut.exports._parse=kr,Ut.exports._enoent=Ir;var Nr=pe(Ut.exports);let Rr,Or;function Tr(){return void 0===Rr&&(Rr=function(){try{return d.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return d.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),Rr}function Pr(){return void 0===Or&&(Or=(()=>{try{return d.statSync("/run/.containerenv"),!0}catch{return!1}})()||Tr()),Or}const Lr=()=>{if("linux"!==y.platform)return!1;if(p.release().toLowerCase().includes("microsoft"))return!Pr();try{return!!d.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")&&!Pr()}catch{return!1}};var Dr=y.env.__IS_WSL_TEST__?Lr:Lr();function Mr(e,t,r){const n=r=>Object.defineProperty(e,t,{value:r,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=r();return n(e),e},set(e){n(e)}}),e}const $r=_.promisify(g.execFile);const Qr=_.promisify(g.execFile);async function jr(e){return async function(e,{humanReadableOutput:t=!0}={}){if("darwin"!==y.platform)throw new Error("macOS only");const r=t?[]:["-ss"],{stdout:n}=await Qr("osascript",["-e",e,r]);return n.trim()}(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const Fr=_.promisify(g.execFile),Ur={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}};class qr extends Error{}const Hr=_.promisify(g.execFile);async function Vr(){if("darwin"===y.platform){const e=await async function(){if("darwin"!==y.platform)throw new Error("macOS only");const{stdout:e}=await $r("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e);return t?.groups.id??"com.apple.Safari"}();return{name:await jr(e),id:e}}if("linux"===y.platform){const{stdout:e}=await Hr("xdg-mime",["query","default","x-scheme-handler/http"]),t=e.trim(),r=(e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(e=>e.toUpperCase())))(t.replace(/.desktop$/,"").replace("-"," "));return{name:r,id:t}}if("win32"===y.platform)return async function(e=Fr){const{stdout:t}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!r)throw new qr(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);const{id:n}=r.groups,i=Ur[n];if(!i)throw new qr(`Unknown browser ID: ${n}`);return i}();throw new Error("Only macOS, Linux, and Windows are supported")}const Wr=u.dirname(x.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:H&&H.src||new URL("bundle.js",document.baseURI).href)),Gr=u.join(Wr,"xdg-open"),{platform:Jr,arch:Kr}=y,zr=(()=>{const e="/mnt/";let t;return async function(){if(t)return t;const r="/etc/wsl.conf";let n=!1;try{await b.access(r,b.constants.F_OK),n=!0}catch{}if(!n)return e;const i=await b.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(t=s.groups.mountPoint.trim(),t=t.endsWith("/")?t:`${t}/`,t):e}})(),Yr=async(e,t)=>{let r;for(const n of e)try{return await t(n)}catch(e){r=e}throw r},Xr=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return Yr(e.app,(t=>Xr({...e,app:t})));let t,{name:r,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(r))return Yr(r,(t=>Xr({...e,app:{name:t,arguments:n}})));if("browser"===r||"browserPrivate"===r){const t={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},i={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},s=await Vr();if(s.id in t){const o=t[s.id];return"browserPrivate"===r&&n.push(i[o]),Xr({...e,app:{name:tn[o],arguments:n}})}throw new Error(`${s.name} is not supported as a default browser`)}const i=[],s={};if("darwin"===Jr)t="open",e.wait&&i.push("--wait-apps"),e.background&&i.push("--background"),e.newInstance&&i.push("--new"),r&&i.push("-a",r);else if("win32"===Jr||Dr&&!Pr()&&!r){const o=await zr();t=Dr?`${o}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${y.env.SYSTEMROOT||y.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Dr||(s.windowsVerbatimArguments=!0);const a=["Start"];e.wait&&a.push("-Wait"),r?(a.push(`"\`"${r}\`""`),e.target&&n.push(e.target)):e.target&&a.push(`"${e.target}"`),n.length>0&&(n=n.map((e=>`"\`"${e}\`""`)),a.push("-ArgumentList",n.join(","))),e.target=w.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(r)t=r;else{const e=!Wr||"/"===Wr;let r=!1;try{await b.access(Gr,b.constants.X_OK),r=!0}catch{}t=y.versions.electron??("android"===Jr||e||!r)?"xdg-open":Gr}n.length>0&&i.push(...n),e.wait||(s.stdio="ignore",s.detached=!0)}"darwin"===Jr&&n.length>0&&i.push("--args",...n),e.target&&i.push(e.target);const o=g.spawn(t,i,s);return e.wait?new Promise(((t,r)=>{o.once("error",r),o.once("close",(n=>{!e.allowNonzeroExitCode&&n>0?r(new Error(`Exited with code ${n}`)):t(o)}))})):(o.unref(),o)};function Zr(e){if("string"==typeof e||Array.isArray(e))return e;const{[Kr]:t}=e;if(!t)throw new Error(`${Kr} is not supported`);return t}function en({[Jr]:e},{wsl:t}){if(t&&Dr)return Zr(t);if(!e)throw new Error(`${Jr} is not supported`);return Zr(e)}const tn={};Mr(tn,"chrome",(()=>en({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}))),Mr(tn,"firefox",(()=>en({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}))),Mr(tn,"edge",(()=>en({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}))),Mr(tn,"browser",(()=>"browser")),Mr(tn,"browserPrivate",(()=>"browserPrivate"));var rn=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a `target`");return Xr({...t,target:e})},nn={};const sn=v,on="\\\\/",an=`[^${on}]`,cn="\\.",ln="\\/",un="[^/]",pn=`(?:${ln}|$)`,hn=`(?:^|${ln})`,dn=`${cn}{1,2}${pn}`,fn={DOT_LITERAL:cn,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:ln,ONE_CHAR:"(?=.)",QMARK:un,END_ANCHOR:pn,DOTS_SLASH:dn,NO_DOT:`(?!${cn})`,NO_DOTS:`(?!${hn}${dn})`,NO_DOT_SLASH:`(?!${cn}{0,1}${pn})`,NO_DOTS_SLASH:`(?!${dn})`,QMARK_NO_DOT:`[^.${ln}]`,STAR:`${un}*?`,START_ANCHOR:hn},mn={...fn,SLASH_LITERAL:`[${on}]`,QMARK:an,STAR:`${an}*?`,DOTS_SLASH:`${cn}{1,2}(?:[${on}]|$)`,NO_DOT:`(?!${cn})`,NO_DOTS:`(?!(?:^|[${on}])${cn}{1,2}(?:[${on}]|$))`,NO_DOT_SLASH:`(?!${cn}{0,1}(?:[${on}]|$))`,NO_DOTS_SLASH:`(?!${cn}{1,2}(?:[${on}]|$))`,QMARK_NO_DOT:`[^.${on}]`,START_ANCHOR:`(?:^|[${on}])`,END_ANCHOR:`(?:[${on}]|$)`};var gn={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:sn.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?mn:fn};!function(e){const t=v,r="win32"===process.platform,{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:i,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:o}=gn;e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(o,"\\$1"),e.toPosixSlashes=e=>e.replace(n,"/"),e.removeBackslashes=e=>e.replace(i,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===r||"\\"===t.sep,e.escapeLast=(t,r,n)=>{const i=t.lastIndexOf(r,n);return-1===i?t:"\\"===t[i-1]?e.escapeLast(t,r,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r},e.wrapOutput=(e,t={},r={})=>{let n=`${r.contains?"":"^"}(?:${e})${r.contains?"":"$"}`;return!0===t.negated&&(n=`(?:^(?!${n}).*$)`),n}}(nn);const An=nn,{CHAR_ASTERISK:vn,CHAR_AT:yn,CHAR_BACKWARD_SLASH:wn,CHAR_COMMA:xn,CHAR_DOT:bn,CHAR_EXCLAMATION_MARK:_n,CHAR_FORWARD_SLASH:En,CHAR_LEFT_CURLY_BRACE:Sn,CHAR_LEFT_PARENTHESES:Cn,CHAR_LEFT_SQUARE_BRACKET:kn,CHAR_PLUS:In,CHAR_QUESTION_MARK:Bn,CHAR_RIGHT_CURLY_BRACE:Nn,CHAR_RIGHT_PARENTHESES:Rn,CHAR_RIGHT_SQUARE_BRACKET:On}=gn,Tn=e=>e===En||e===wn,Pn=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};var Ln=(e,t)=>{const r=t||{},n=e.length-1,i=!0===r.parts||!0===r.scanToEnd,s=[],o=[],a=[];let c,l,u=e,p=-1,h=0,d=0,f=!1,m=!1,g=!1,A=!1,v=!1,y=!1,w=!1,x=!1,b=!1,_=!1,E=0,S={value:"",depth:0,isGlob:!1};const C=()=>p>=n,k=()=>(c=l,u.charCodeAt(++p));for(;p<n;){let e;if(l=k(),l!==wn){if(!0===y||l===Sn){for(E++;!0!==C()&&(l=k());)if(l!==wn)if(l!==Sn){if(!0!==y&&l===bn&&(l=k())===bn){if(f=S.isBrace=!0,g=S.isGlob=!0,_=!0,!0===i)continue;break}if(!0!==y&&l===xn){if(f=S.isBrace=!0,g=S.isGlob=!0,_=!0,!0===i)continue;break}if(l===Nn&&(E--,0===E)){y=!1,f=S.isBrace=!0,_=!0;break}}else E++;else w=S.backslashes=!0,k();if(!0===i)continue;break}if(l!==En){if(!0!==r.noext){if(!0===(l===In||l===yn||l===vn||l===Bn||l===_n)&&u.charCodeAt(p+1)===Cn){if(g=S.isGlob=!0,A=S.isExtglob=!0,_=!0,l===_n&&p===h&&(b=!0),!0===i){for(;!0!==C()&&(l=k());)if(l!==wn){if(l===Rn){g=S.isGlob=!0,_=!0;break}}else w=S.backslashes=!0,l=k();continue}break}}if(l===vn){if(c===vn&&(v=S.isGlobstar=!0),g=S.isGlob=!0,_=!0,!0===i)continue;break}if(l===Bn){if(g=S.isGlob=!0,_=!0,!0===i)continue;break}if(l===kn){for(;!0!==C()&&(e=k());)if(e!==wn){if(e===On){m=S.isBracket=!0,g=S.isGlob=!0,_=!0;break}}else w=S.backslashes=!0,k();if(!0===i)continue;break}if(!0===r.nonegate||l!==_n||p!==h){if(!0!==r.noparen&&l===Cn){if(g=S.isGlob=!0,!0===i){for(;!0!==C()&&(l=k());)if(l!==Cn){if(l===Rn){_=!0;break}}else w=S.backslashes=!0,l=k();continue}break}if(!0===g){if(_=!0,!0===i)continue;break}}else x=S.ne