UNPKG

to-where-cli

Version:

> If you want to know more about the usage, please refer to the [documentation](https://skypesky.gitbook.io/to-where-cli/).

20 lines 336 kB
#! /usr/bin/env node var HE=Object.create;var Jd=Object.defineProperty;var WE=Object.getOwnPropertyDescriptor;var BE=Object.getOwnPropertyNames;var UE=Object.getPrototypeOf,jE=Object.prototype.hasOwnProperty;var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var GE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of BE(t))!jE.call(e,o)&&o!==r&&Jd(e,o,{get:()=>t[o],enumerable:!(n=WE(t,o))||n.enumerable});return e};var Je=(e,t,r)=>(r=e!=null?HE(UE(e)):{},GE(t||!e||!e.__esModule?Jd(r,"default",{value:e,enumerable:!0}):r,e));var Xd=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Nr=(e,t,r)=>(Xd(e,t,"read from private field"),r?r.call(e):t.get(e)),Di=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)};var De=(e,t,r)=>(Xd(e,t,"access private method"),r);var In=C(Il=>{var ro=class extends Error{constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},Tl=class extends ro{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Il.CommanderError=ro;Il.InvalidArgumentError=Tl});var io=C($l=>{var{InvalidArgumentError:YE}=In(),Fl=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new YE(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function zE(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}$l.Argument=Fl;$l.humanReadableArgName=zE});var Pl=C(Zd=>{var{humanReadableArgName:VE}=io(),kl=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1}visibleCommands(t){let r=t.commands.filter(n=>!n._hidden);if(t._hasImplicitHelpCommand()){let[,n,o]=t._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),u=t.createCommand(n).helpOption(!1);u.description(t._helpCommandDescription),o&&u.arguments(o),r.push(u)}return this.sortSubcommands&&r.sort((n,o)=>n.name().localeCompare(o.name())),r}visibleOptions(t){let r=t.options.filter(u=>!u.hidden),n=t._hasHelpOption&&t._helpShortFlag&&!t._findOption(t._helpShortFlag),o=t._hasHelpOption&&!t._findOption(t._helpLongFlag);if(n||o){let u;n?o?u=t.createOption(t._helpFlags,t._helpDescription):u=t.createOption(t._helpShortFlag,t._helpDescription):u=t.createOption(t._helpLongFlag,t._helpDescription),r.push(u)}if(this.sortOptions){let u=a=>a.short?a.short.replace(/^-/,""):a.long.replace(/^--/,"");r.sort((a,h)=>u(a).localeCompare(u(h)))}return r}visibleArguments(t){return t._argsDescription&&t._args.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t._args.find(r=>r.description)?t._args:[]}subcommandTerm(t){let r=t._args.map(n=>VE(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,o)=>Math.max(n,r.subcommandTerm(o).length),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,o)=>Math.max(n,r.optionTerm(o).length),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,o)=>Math.max(n,r.argumentTerm(o).length),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let o=t.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];return t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0?`${t.description} (${r.join(", ")})`:t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,r){let n=r.padWidth(t,r),o=r.helpWidth||80,u=2,a=2;function h(E,k){if(k){let P=`${E.padEnd(n+a)}${k}`;return r.wrap(P,o-u,n+a)}return E}function f(E){return E.join(` `).replace(/^/gm," ".repeat(u))}let m=[`Usage: ${r.commandUsage(t)}`,""],y=r.commandDescription(t);y.length>0&&(m=m.concat([y,""]));let w=r.visibleArguments(t).map(E=>h(r.argumentTerm(E),r.argumentDescription(E)));w.length>0&&(m=m.concat(["Arguments:",f(w),""]));let S=r.visibleOptions(t).map(E=>h(r.optionTerm(E),r.optionDescription(E)));S.length>0&&(m=m.concat(["Options:",f(S),""]));let A=r.visibleCommands(t).map(E=>h(r.subcommandTerm(E),r.subcommandDescription(E)));return A.length>0&&(m=m.concat(["Commands:",f(A),""])),m.join(` `)}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}wrap(t,r,n,o=40){if(t.match(/[\n]\s+/))return t;let u=r-n;if(u<o)return t;let a=t.slice(0,n),h=t.slice(n),f=" ".repeat(n),m=new RegExp(".{1,"+(u-1)+"}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)","g"),y=h.match(m)||[];return a+y.map((w,S)=>(w.slice(-1)===` `&&(w=w.slice(0,w.length-1)),(S>0?f:"")+w.trimRight())).join(` `)}};Zd.Help=kl});var Ll=C(no=>{var{InvalidArgumentError:KE}=In(),Ml=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let n=Qd(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){return this.implied=Object.assign(this.implied||{},t),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new KE(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return JE(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Dl=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(t,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,u=o!==void 0?o:!1;return r.negate===(u===t)}};function JE(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function Qd(e){let t,r,n=e.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(t=n.shift()),r=n.shift(),!t&&/^-[^-]$/.test(r)&&(t=r,r=void 0),{shortFlag:t,longFlag:r}}no.Option=Ml;no.splitOptionFlags=Qd;no.DualOptions=Dl});var tp=C(ep=>{function XE(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let u=1;e[o-1]===t[n-1]?u=0:u=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+u),o>1&&n>1&&e[o-1]===t[n-2]&&e[o-2]===t[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[e.length][t.length]}function ZE(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(a=>a.slice(2)));let n=[],o=3,u=.4;return t.forEach(a=>{if(a.length<=1)return;let h=XE(e,a),f=Math.max(e.length,a.length);(f-h)/f>u&&(h<o?(o=h,n=[a]):h===o&&n.push(a))}),n.sort((a,h)=>a.localeCompare(h)),r&&(n=n.map(a=>`--${a}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` (Did you mean ${n[0]}?)`:""}ep.suggestSimilar=ZE});var up=C(op=>{var QE=require("events").EventEmitter,ql=require("child_process"),yr=require("path"),Rl=require("fs"),ve=require("process"),{Argument:eT,humanReadableArgName:tT}=io(),{CommanderError:Nl}=In(),{Help:rT}=Pl(),{Option:rp,splitOptionFlags:iT,DualOptions:nT}=Ll(),{suggestSimilar:ip}=tp(),Fn=class extends QE{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:r=>ve.stdout.write(r),writeErr:r=>ve.stderr.write(r),getOutHelpWidth:()=>ve.stdout.isTTY?ve.stdout.columns:void 0,getErrHelpWidth:()=>ve.stderr.isTTY?ve.stderr.columns:void 0,outputError:(r,n)=>n(r)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._hasHelpOption=t._hasHelpOption,this._helpFlags=t._helpFlags,this._helpDescription=t._helpDescription,this._helpShortFlag=t._helpShortFlag,this._helpLongFlag=t._helpLongFlag,this._helpCommandName=t._helpCommandName,this._helpCommandnameAndArgs=t._helpCommandnameAndArgs,this._helpCommandDescription=t._helpCommandDescription,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}command(t,r,n){let o=r,u=n;typeof o=="object"&&o!==null&&(u=o,o=null),u=u||{};let[,a,h]=t.match(/([^ ]+) *(.*)/),f=this.createCommand(a);return o&&(f.description(o),f._executableHandler=!0),u.isDefault&&(this._defaultCommandName=f._name),f._hidden=!!(u.noHelp||u.hidden),f._executableFile=u.executableFile||null,h&&f.arguments(h),this.commands.push(f),f.parent=this,f.copyInheritedSettings(this),o?this:f}createCommand(t){return new Fn(t)}createHelp(){return Object.assign(new rT,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this.commands.push(t),t.parent=this,this}createArgument(t,r){return new eT(t,r)}argument(t,r,n,o){let u=this.createArgument(t,r);return typeof n=="function"?u.default(o).argParser(n):u.default(n),this.addArgument(u),this}arguments(t){return t.split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this._args.slice(-1)[0];if(r&&r.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this._args.push(t),this}addHelpCommand(t,r){return t===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof t=="string"&&(this._helpCommandName=t.split(" ")[0],this._helpCommandnameAndArgs=t),this._helpCommandDescription=r||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(t,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'. Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,n){this._exitCallback&&this._exitCallback(new Nl(t,r,n)),ve.exit(t)}action(t){let r=n=>{let o=this._args.length,u=n.slice(0,o);return this._storeOptionsAsProperties?u[o]=this:u[o]=this.opts(),u.push(this),t.apply(this,u)};return this._actionHandler=r,this}createOption(t,r){return new rp(t,r)}addOption(t){let r=t.name(),n=t.attributeName();if(t.negate){let u=t.long.replace(/^--no-/,"--");this._findOption(u)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");this.options.push(t);let o=(u,a,h)=>{u==null&&t.presetArg!==void 0&&(u=t.presetArg);let f=this.getOptionValue(n);if(u!==null&&t.parseArg)try{u=t.parseArg(u,f)}catch(m){if(m.code==="commander.invalidArgument"){let y=`${a} ${m.message}`;this.error(y,{exitCode:m.exitCode,code:m.code})}throw m}else u!==null&&t.variadic&&(u=t._concatValue(u,f));u==null&&(t.negate?u=!1:t.isBoolean()||t.optional?u=!0:u=""),this.setOptionValueWithSource(n,u,h)};return this.on("option:"+r,u=>{let a=`error: option '${t.flags}' argument '${u}' is invalid.`;o(u,a,"cli")}),t.envVar&&this.on("optionEnv:"+r,u=>{let a=`error: option '${t.flags}' value '${u}' from env '${t.envVar}' is invalid.`;o(u,a,"env")}),this}_optionEx(t,r,n,o,u){if(typeof r=="object"&&r instanceof rp)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,n);if(a.makeOptionMandatory(!!t.mandatory),typeof o=="function")a.default(u).argParser(o);else if(o instanceof RegExp){let h=o;o=(f,m)=>{let y=h.exec(f);return y?y[0]:m},a.default(u).argParser(o)}else a.default(o);return this.addOption(a)}option(t,r,n,o){return this._optionEx({},t,r,n,o)}requiredOption(t,r,n,o){return this._optionEx({mandatory:!0},t,r,n,o)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){if(this._passThroughOptions=!!t,!!this.parent&&t&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(t=!0){if(this._storeOptionsAsProperties=!!t,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,n){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");r=r||{},t===void 0&&(t=ve.argv,ve.versions&&ve.versions.electron&&(r.from="electron")),this.rawArgs=t.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":ve.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,r){let n=this._prepareUserArgs(t,r);return this._parseCommand([],n),this}async parseAsync(t,r){let n=this._prepareUserArgs(t,r);return await this._parseCommand([],n),this}_executeSubCommand(t,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function u(y,w){let S=yr.resolve(y,w);if(Rl.existsSync(S))return S;if(o.includes(yr.extname(w)))return;let A=o.find(E=>Rl.existsSync(`${S}${E}`));if(A)return`${S}${A}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,h=this._executableDir||"";if(this._scriptPath){let y;try{y=Rl.realpathSync(this._scriptPath)}catch{y=this._scriptPath}h=yr.resolve(yr.dirname(y),h)}if(h){let y=u(h,a);if(!y&&!t._executableFile&&this._scriptPath){let w=yr.basename(this._scriptPath,yr.extname(this._scriptPath));w!==this._name&&(y=u(h,`${w}-${t._name}`))}a=y||a}n=o.includes(yr.extname(a));let f;ve.platform!=="win32"?n?(r.unshift(a),r=sp(ve.execArgv).concat(r),f=ql.spawn(ve.argv[0],r,{stdio:"inherit"})):f=ql.spawn(a,r,{stdio:"inherit"}):(r.unshift(a),r=sp(ve.execArgv).concat(r),f=ql.spawn(ve.execPath,r,{stdio:"inherit"})),f.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(w=>{ve.on(w,()=>{f.killed===!1&&f.exitCode===null&&f.kill(w)})});let m=this._exitCallback;m?f.on("close",()=>{m(new Nl(ve.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):f.on("close",ve.exit.bind(ve)),f.on("error",y=>{if(y.code==="ENOENT"){let w=h?`searched for local subcommand relative to directory '${h}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",S=`'${a}' does not exist - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${w}`;throw new Error(S)}else if(y.code==="EACCES")throw new Error(`'${a}' not executable`);if(!m)ve.exit(1);else{let w=new Nl(1,"commander.executeSubCommandAsync","(error)");w.nestedError=y,m(w)}}),this.runningCommand=f}_dispatchSubcommand(t,r,n){let o=this._findCommand(t);o||this.help({error:!0});let u;return u=this._chainOrCallSubCommandHook(u,o,"preSubcommand"),u=this._chainOrCall(u,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),u}_checkNumberOfArguments(){this._args.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let t=(n,o,u)=>{let a=o;if(o!==null&&n.parseArg)try{a=n.parseArg(o,u)}catch(h){if(h.code==="commander.invalidArgument"){let f=`error: command-argument value '${o}' is invalid for argument '${n.name()}'. ${h.message}`;this.error(f,{exitCode:h.exitCode,code:h.code})}throw h}return a};this._checkNumberOfArguments();let r=[];this._args.forEach((n,o)=>{let u=n.defaultValue;n.variadic?o<this.args.length?(u=this.args.slice(o),n.parseArg&&(u=u.reduce((a,h)=>t(n,h,a),n.defaultValue))):u===void 0&&(u=[]):o<this.args.length&&(u=this.args[o],n.parseArg&&(u=t(n,u,n.defaultValue))),r[o]=u}),this.processedArgs=r}_chainOrCall(t,r){return t&&t.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let n=t,o=[];return so(this).reverse().filter(u=>u._lifeCycleHooks[r]!==void 0).forEach(u=>{u._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:u,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(u=>{n=this._chainOrCall(n,()=>u.callback(u.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,r,n){let o=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(u=>{o=this._chainOrCall(o,()=>u(this,r))}),o}_parseCommand(t,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),r=n.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._hasImplicitHelpCommand()&&t[0]===this._helpCommandName)return t.length===1&&this.help(),this._dispatchSubcommand(t[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return np(this,r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),np(this,n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},u=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(u,t,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(u))o(),this._processArguments(),this.parent.emit(u,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(t){if(!!t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){for(let t=this;t;t=t.parent)t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=t.find(u=>n.conflictsWith.includes(u.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){for(let t=this;t;t=t.parent)t._checkForConflictingLocalOptions()}parseOptions(t){let r=[],n=[],o=r,u=t.slice();function a(f){return f.length>1&&f[0]==="-"}let h=null;for(;u.length;){let f=u.shift();if(f==="--"){o===n&&o.push(f),o.push(...u);break}if(h&&!a(f)){this.emit(`option:${h.name()}`,f);continue}if(h=null,a(f)){let m=this._findOption(f);if(m){if(m.required){let y=u.shift();y===void 0&&this.optionMissingArgument(m),this.emit(`option:${m.name()}`,y)}else if(m.optional){let y=null;u.length>0&&!a(u[0])&&(y=u.shift()),this.emit(`option:${m.name()}`,y)}else this.emit(`option:${m.name()}`);h=m.variadic?m:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let m=this._findOption(`-${f[1]}`);if(m){m.required||m.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${m.name()}`,f.slice(2)):(this.emit(`option:${m.name()}`),u.unshift(`-${f.slice(2)}`));continue}}if(/^--[^=]+=/.test(f)){let m=f.indexOf("="),y=this._findOption(f.slice(0,m));if(y&&(y.required||y.optional)){this.emit(`option:${y.name()}`,f.slice(m+1));continue}}if(a(f)&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(f)){r.push(f),u.length>0&&n.push(...u);break}else if(f===this._helpCommandName&&this._hasImplicitHelpCommand()){r.push(f),u.length>0&&r.push(...u);break}else if(this._defaultCommandName){n.push(f),u.length>0&&n.push(...u);break}}if(this._passThroughOptions){o.push(f),u.length>0&&o.push(...u);break}o.push(f)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();t[o]=o===this._versionOptionName?this._version:this[o]}return t}return this._optionValues}optsWithGlobals(){return so(this).reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,u=n.code||"commander.error";this._exit(o,u,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in ve.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,ve.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new nT(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let n=a=>{let h=a.attributeName(),f=this.getOptionValue(h),m=this.options.find(w=>w.negate&&h===w.attributeName()),y=this.options.find(w=>!w.negate&&h===w.attributeName());return m&&(m.presetArg===void 0&&f===!1||m.presetArg!==void 0&&f===m.presetArg)?m:y||a},o=a=>{let h=n(a),f=h.attributeName();return this.getOptionValueSource(f)==="env"?`environment variable '${h.envVar}'`:`option '${h.flags}'`},u=`error: ${o(t)} cannot be used with ${o(r)}`;this.error(u,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let o=[],u=this;do{let a=u.createHelp().visibleOptions(u).filter(h=>h.long).map(h=>h.long);o=o.concat(a),u=u.parent}while(u&&!u._enablePositionalOptions);r=ip(t,o)}let n=`error: unknown option '${t}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this._args.length,n=r===1?"":"s",u=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${t.length}.`;this.error(u,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(u=>{o.push(u.name()),u.alias()&&o.push(u.alias())}),r=ip(t,o)}let n=`error: unknown command '${t}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(t,r,n){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this.options.push(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${t} `),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this._args.map(n=>tT(n));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=yr.basename(t,yr.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp();return r.helpWidth===void 0&&(r.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),r.formatHelp(this,r)}_getHelpContext(t){t=t||{};let r={error:!!t.error},n;return r.error?n=o=>this._outputConfiguration.writeErr(o):n=o=>this._outputConfiguration.writeOut(o),r.write=t.write||n,r.command=this,r}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let n=this._getHelpContext(t);so(this).reverse().forEach(u=>u.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let o=this.helpInformation(n);if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this.emit(this._helpLongFlag),this.emit("afterHelp",n),so(this).forEach(u=>u.emit("afterAllHelp",n))}helpOption(t,r){if(typeof t=="boolean")return this._hasHelpOption=t,this;this._helpFlags=t||this._helpFlags,this._helpDescription=r||this._helpDescription;let n=iT(this._helpFlags);return this._helpShortFlag=n.shortFlag,this._helpLongFlag=n.longFlag,this}help(t){this.outputHelp(t);let r=ve.exitCode||0;r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let o=`${t}Help`;return this.on(o,u=>{let a;typeof r=="function"?a=r({error:u.error,command:u.command}):a=r,a&&u.write(`${a} `)}),this}};function np(e,t){e._hasHelpOption&&t.find(n=>n===e._helpLongFlag||n===e._helpShortFlag)&&(e.outputHelp(),e._exit(0,"commander.helpDisplayed","(outputHelp)"))}function sp(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",o="9229",u;return(u=t.match(/^(--inspect(-brk)?)$/))!==null?r=u[1]:(u=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=u[1],/^\d+$/.test(u[3])?o=u[3]:n=u[3]):(u=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=u[1],n=u[3],o=u[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:t})}function so(e){let t=[];for(let r=e;r;r=r.parent)t.push(r);return t}op.Command=Fn});var hp=C((Ut,cp)=>{var{Argument:sT}=io(),{Command:lp}=up(),{CommanderError:oT,InvalidArgumentError:ap}=In(),{Help:uT}=Pl(),{Option:lT}=Ll();Ut=cp.exports=new lp;Ut.program=Ut;Ut.Argument=sT;Ut.Command=lp;Ut.CommanderError=oT;Ut.Help=uT;Ut.InvalidArgumentError=ap;Ut.InvalidOptionArgumentError=ap;Ut.Option=lT});var pp=C((TL,dp)=>{var Hl=require("os");dp.exports=new function(){function t(){return Hl.type()==="Windows_NT"}function r(){return Hl.type()==="Darwin"}function n(){return Hl.type()==="Linux"}this.isWindows=t(),this.isOSX=r(),this.isLinux=n()}});var Bl=C((IL,gp)=>{"use strict";var mp=require("fs"),Wl;function aT(){try{return mp.statSync("/.dockerenv"),!0}catch{return!1}}function cT(){try{return mp.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}gp.exports=()=>(Wl===void 0&&(Wl=aT()||cT()),Wl)});var wp=C((FL,Ul)=>{"use strict";var hT=require("os"),fT=require("fs"),yp=Bl(),vp=()=>{if(process.platform!=="linux")return!1;if(hT.release().toLowerCase().includes("microsoft"))return!yp();try{return fT.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!yp():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Ul.exports=vp:Ul.exports=vp()});var xp=C(($L,_p)=>{"use strict";_p.exports=(e,t,r)=>{let n=o=>Object.defineProperty(e,t,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),e}});var Tp=C((kL,Ep)=>{var dT=require("path"),pT=require("child_process"),{promises:jl,constants:Cp}=require("fs"),oo=wp(),mT=Bl(),Gl=xp(),bp=dT.join(__dirname,"xdg-open"),{platform:Li,arch:Sp}=process,gT=(()=>{let e="/mnt/",t;return async function(){if(t)return t;let r="/etc/wsl.conf",n=!1;try{await jl.access(r,Cp.F_OK),n=!0}catch{}if(!n)return e;let o=await jl.readFile(r,{encoding:"utf8"}),u=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return u?(t=u.groups.mountPoint.trim(),t=t.endsWith("/")?t:`${t}/`,t):e}})(),Ap=async(e,t)=>{let r;for(let n of e)try{return await t(n)}catch(o){r=o}throw r},uo=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return Ap(e.app,h=>uo({...e,app:h}));let{name:t,arguments:r=[]}=e.app||{};if(r=[...r],Array.isArray(t))return Ap(t,h=>uo({...e,app:{name:h,arguments:r}}));let n,o=[],u={};if(Li==="darwin")n="open",e.wait&&o.push("--wait-apps"),e.background&&o.push("--background"),e.newInstance&&o.push("--new"),t&&o.push("-a",t);else if(Li==="win32"||oo&&!mT()){let h=await gT();n=oo?`${h}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,o.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),oo||(u.windowsVerbatimArguments=!0);let f=["Start"];e.wait&&f.push("-Wait"),t?(f.push(`"\`"${t}\`""`,"-ArgumentList"),e.target&&r.unshift(e.target)):e.target&&f.push(`"${e.target}"`),r.length>0&&(r=r.map(m=>`"\`"${m}\`""`),f.push(r.join(","))),e.target=Buffer.from(f.join(" "),"utf16le").toString("base64")}else{if(t)n=t;else{let h=!__dirname||__dirname==="/",f=!1;try{await jl.access(bp,Cp.X_OK),f=!0}catch{}n=process.versions.electron||Li==="android"||h||!f?"xdg-open":bp}r.length>0&&o.push(...r),e.wait||(u.stdio="ignore",u.detached=!0)}e.target&&o.push(e.target),Li==="darwin"&&r.length>0&&o.push("--args",...r);let a=pT.spawn(n,o,u);return e.wait?new Promise((h,f)=>{a.once("error",f),a.once("close",m=>{if(e.allowNonzeroExitCode&&m>0){f(new Error(`Exited with code ${m}`));return}h(a)})}):(a.unref(),a)},Yl=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return uo({...t,target:e})},yT=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `name`");let{arguments:r=[]}=t||{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return uo({...t,app:{name:e,arguments:r}})};function Op(e){if(typeof e=="string"||Array.isArray(e))return e;let{[Sp]:t}=e;if(!t)throw new Error(`${Sp} is not supported`);return t}function zl({[Li]:e},{wsl:t}){if(t&&oo)return Op(t);if(!e)throw new Error(`${Li} is not supported`);return Op(e)}var lo={};Gl(lo,"chrome",()=>zl({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"]}}));Gl(lo,"firefox",()=>zl({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Gl(lo,"edge",()=>zl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Yl.apps=lo;Yl.openApp=yT;Ep.exports=Yl});var Fp=C((PL,Ip)=>{"use strict";Ip.exports=Object.freeze({encoding:"utf8",silent:!1})});var kp=C((ML,$p)=>{"use strict";function vT(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function wT(e){return e==="false"&&(e=!1),!!e}function _T(e){var t=Fp();return vT(e)?typeof e.silent<"u"&&(e.silent=wT(e.silent)):e={},e=Object.assign({},t,e),e.silent&&typeof e.stdio>"u"&&(e.stdio="pipe"),e}$p.exports=_T});var Vl=C((DL,Pp)=>{"use strict";var xT=require("child_process"),bT=kp();function ST(e,t){t=bT(t);var r,n,o,u,a;try{r=null,n=xT.execSync(e,t),o="",u=0,a=!0}catch(h){r=h,n=h.stdout,o=h.stderr,u=h.status||1,a=!1}return{error:r,stdout:n,stderr:o,code:u,ok:a}}Pp.exports=ST});var pt=C(ca=>{"use strict";ca.fromCallback=function(e){return Object.defineProperty(function(...t){if(typeof t[t.length-1]=="function")e.apply(this,t);else return new Promise((r,n)=>{e.call(this,...t,(o,u)=>o!=null?n(o):r(u))})},"name",{value:e.name})};ca.fromPromise=function(e){return Object.defineProperty(function(...t){let r=t[t.length-1];if(typeof r!="function")return e.apply(this,t);e.apply(this,t.slice(0,-1)).then(n=>r(null,n),r)},"name",{value:e.name})}});var Hm=C((HL,Nm)=>{var Br=require("constants"),jF=process.cwd,go=null,GF=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return go||(go=jF.call(process)),go};try{process.cwd()}catch{}typeof process.chdir=="function"&&(ha=process.chdir,process.chdir=function(e){go=null,ha.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ha));var ha;Nm.exports=YF;function YF(e){Br.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=u(e.chown),e.fchown=u(e.fchown),e.lchown=u(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=o(e.chmodSync),e.fchmodSync=o(e.fchmodSync),e.lchmodSync=o(e.lchmodSync),e.stat=h(e.stat),e.fstat=h(e.fstat),e.lstat=h(e.lstat),e.statSync=f(e.statSync),e.fstatSync=f(e.fstatSync),e.lstatSync=f(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(y,w,S){S&&process.nextTick(S)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(y,w,S,A){A&&process.nextTick(A)},e.lchownSync=function(){}),GF==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(y){function w(S,A,E){var k=Date.now(),P=0;y(S,A,function M(L){if(L&&(L.code==="EACCES"||L.code==="EPERM")&&Date.now()-k<6e4){setTimeout(function(){e.stat(A,function(j,et){j&&j.code==="ENOENT"?y(S,A,M):E(L)})},P),P<100&&(P+=10);return}E&&E(L)})}return Object.setPrototypeOf&&Object.setPrototypeOf(w,y),w}(e.rename)),e.read=typeof e.read!="function"?e.read:function(y){function w(S,A,E,k,P,M){var L;if(M&&typeof M=="function"){var j=0;L=function(et,tt,Lt){if(et&&et.code==="EAGAIN"&&j<10)return j++,y.call(e,S,A,E,k,P,L);M.apply(this,arguments)}}return y.call(e,S,A,E,k,P,L)}return Object.setPrototypeOf&&Object.setPrototypeOf(w,y),w}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(y){return function(w,S,A,E,k){for(var P=0;;)try{return y.call(e,w,S,A,E,k)}catch(M){if(M.code==="EAGAIN"&&P<10){P++;continue}throw M}}}(e.readSync);function t(y){y.lchmod=function(w,S,A){y.open(w,Br.O_WRONLY|Br.O_SYMLINK,S,function(E,k){if(E){A&&A(E);return}y.fchmod(k,S,function(P){y.close(k,function(M){A&&A(P||M)})})})},y.lchmodSync=function(w,S){var A=y.openSync(w,Br.O_WRONLY|Br.O_SYMLINK,S),E=!0,k;try{k=y.fchmodSync(A,S),E=!1}finally{if(E)try{y.closeSync(A)}catch{}else y.closeSync(A)}return k}}function r(y){Br.hasOwnProperty("O_SYMLINK")&&y.futimes?(y.lutimes=function(w,S,A,E){y.open(w,Br.O_SYMLINK,function(k,P){if(k){E&&E(k);return}y.futimes(P,S,A,function(M){y.close(P,function(L){E&&E(M||L)})})})},y.lutimesSync=function(w,S,A){var E=y.openSync(w,Br.O_SYMLINK),k,P=!0;try{k=y.futimesSync(E,S,A),P=!1}finally{if(P)try{y.closeSync(E)}catch{}else y.closeSync(E)}return k}):y.futimes&&(y.lutimes=function(w,S,A,E){E&&process.nextTick(E)},y.lutimesSync=function(){})}function n(y){return y&&function(w,S,A){return y.call(e,w,S,function(E){m(E)&&(E=null),A&&A.apply(this,arguments)})}}function o(y){return y&&function(w,S){try{return y.call(e,w,S)}catch(A){if(!m(A))throw A}}}function u(y){return y&&function(w,S,A,E){return y.call(e,w,S,A,function(k){m(k)&&(k=null),E&&E.apply(this,arguments)})}}function a(y){return y&&function(w,S,A){try{return y.call(e,w,S,A)}catch(E){if(!m(E))throw E}}}function h(y){return y&&function(w,S,A){typeof S=="function"&&(A=S,S=null);function E(k,P){P&&(P.uid<0&&(P.uid+=4294967296),P.gid<0&&(P.gid+=4294967296)),A&&A.apply(this,arguments)}return S?y.call(e,w,S,E):y.call(e,w,E)}}function f(y){return y&&function(w,S){var A=S?y.call(e,w,S):y.call(e,w);return A&&(A.uid<0&&(A.uid+=4294967296),A.gid<0&&(A.gid+=4294967296)),A}}function m(y){if(!y||y.code==="ENOSYS")return!0;var w=!process.getuid||process.getuid()!==0;return!!(w&&(y.code==="EINVAL"||y.code==="EPERM"))}}});var Um=C((WL,Bm)=>{var Wm=require("stream").Stream;Bm.exports=zF;function zF(e){return{ReadStream:t,WriteStream:r};function t(n,o){if(!(this instanceof t))return new t(n,o);Wm.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var a=Object.keys(o),h=0,f=a.length;h<f;h++){var m=a[h];this[m]=o[m]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){u._read()});return}e.open(this.path,this.flags,this.mode,function(y,w){if(y){u.emit("error",y),u.readable=!1;return}u.fd=w,u.emit("open",w),u._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);Wm.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var u=Object.keys(o),a=0,h=u.length;a<h;a++){var f=u[a];this[f]=o[f]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Gm=C((BL,jm)=>{"use strict";jm.exports=KF;var VF=Object.getPrototypeOf||function(e){return e.__proto__};function KF(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:VF(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var ot=C((UL,pa)=>{var _e=require("fs"),JF=Hm(),XF=Um(),ZF=Gm(),yo=require("util"),Ye,wo;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ye=Symbol.for("graceful-fs.queue"),wo=Symbol.for("graceful-fs.previous")):(Ye="___graceful-fs.queue",wo="___graceful-fs.previous");function QF(){}function Vm(e,t){Object.defineProperty(e,Ye,{get:function(){return t}})}var pi=QF;yo.debuglog?pi=yo.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(pi=function(){var e=yo.format.apply(yo,arguments);e="GFS4: "+e.split(/\n/).join(` GFS4: `),console.error(e)});_e[Ye]||(Ym=global[Ye]||[],Vm(_e,Ym),_e.close=function(e){function t(r,n){return e.call(_e,r,function(o){o||zm(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,wo,{value:e}),t}(_e.close),_e.closeSync=function(e){function t(r){e.apply(_e,arguments),zm()}return Object.defineProperty(t,wo,{value:e}),t}(_e.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){pi(_e[Ye]),require("assert").equal(_e[Ye].length,0)}));var Ym;global[Ye]||Vm(global,_e[Ye]);pa.exports=fa(ZF(_e));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!_e.__patched&&(pa.exports=fa(_e),_e.__patched=!0);function fa(e){JF(e),e.gracefulify=fa,e.createReadStream=tt,e.createWriteStream=Lt;var t=e.readFile;e.readFile=r;function r(G,ne,re){return typeof ne=="function"&&(re=ne,ne=null),Te(G,ne,re);function Te(ke,Ie,se,oe){return t(ke,Ie,function(he){he&&(he.code==="EMFILE"||he.code==="ENFILE")?Wi([Te,[ke,Ie,se],he,oe||Date.now(),Date.now()]):typeof se=="function"&&se.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=o;function o(G,ne,re,Te){return typeof re=="function"&&(Te=re,re=null),ke(G,ne,re,Te);function ke(Ie,se,oe,he,Ae){return n(Ie,se,oe,function(Q){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?Wi([ke,[Ie,se,oe,he],Q,Ae||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}var u=e.appendFile;u&&(e.appendFile=a);function a(G,ne,re,Te){return typeof re=="function"&&(Te=re,re=null),ke(G,ne,re,Te);function ke(Ie,se,oe,he,Ae){return u(Ie,se,oe,function(Q){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?Wi([ke,[Ie,se,oe,he],Q,Ae||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}var h=e.copyFile;h&&(e.copyFile=f);function f(G,ne,re,Te){return typeof re=="function"&&(Te=re,re=0),ke(G,ne,re,Te);function ke(Ie,se,oe,he,Ae){return h(Ie,se,oe,function(Q){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?Wi([ke,[Ie,se,oe,he],Q,Ae||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}var m=e.readdir;e.readdir=w;var y=/^v[0-5]\./;function w(G,ne,re){typeof ne=="function"&&(re=ne,ne=null);var Te=y.test(process.version)?function(se,oe,he,Ae){return m(se,ke(se,oe,he,Ae))}:function(se,oe,he,Ae){return m(se,oe,ke(se,oe,he,Ae))};return Te(G,ne,re);function ke(Ie,se,oe,he){return function(Ae,Q){Ae&&(Ae.code==="EMFILE"||Ae.code==="ENFILE")?Wi([Te,[Ie,se,oe],Ae,he||Date.now(),Date.now()]):(Q&&Q.sort&&Q.sort(),typeof oe=="function"&&oe.call(this,Ae,Q))}}}if(process.version.substr(0,4)==="v0.8"){var S=XF(e);M=S.ReadStream,j=S.WriteStream}var A=e.ReadStream;A&&(M.prototype=Object.create(A.prototype),M.prototype.open=L);var E=e.WriteStream;E&&(j.prototype=Object.create(E.prototype),j.prototype.open=et),Object.defineProperty(e,"ReadStream",{get:function(){return M},set:function(G){M=G},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return j},set:function(G){j=G},enumerable:!0,configurable:!0});var k=M;Object.defineProperty(e,"FileReadStream",{get:function(){return k},set:function(G){k=G},enumerable:!0,configurable:!0});var P=j;Object.defineProperty(e,"FileWriteStream",{get:function(){return P},set:function(G){P=G},enumerable:!0,configurable:!0});function M(G,ne){return this instanceof M?(A.apply(this,arguments),this):M.apply(Object.create(M.prototype),arguments)}function L(){var G=this;or(G.path,G.flags,G.mode,function(ne,re){ne?(G.autoClose&&G.destroy(),G.emit("error",ne)):(G.fd=re,G.emit("open",re),G.read())})}function j(G,ne){return this instanceof j?(E.apply(this,arguments),this):j.apply(Object.create(j.prototype),arguments)}function et(){var G=this;or(G.path,G.flags,G.mode,function(ne,re){ne?(G.destroy(),G.emit("error",ne)):(G.fd=re,G.emit("open",re))})}function tt(G,ne){return new e.ReadStream(G,ne)}function Lt(G,ne){return new e.WriteStream(G,ne)}var sr=e.open;e.open=or;function or(G,ne,re,Te){return typeof re=="function"&&(Te=re,re=null),ke(G,ne,re,Te);function ke(Ie,se,oe,he,Ae){return sr(Ie,se,oe,function(Q,yh){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?Wi([ke,[Ie,se,oe,he],Q,Ae||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}return e}function Wi(e){pi("ENQUEUE",e[0].name,e[1]),_e[Ye].push(e),da()}var vo;function zm(){for(var e=Date.now(),t=0;t<_e[Ye].length;++t)_e[Ye][t].length>2&&(_e[Ye][t][3]=e,_e[Ye][t][4]=e);da()}function da(){if(clearTimeout(vo),vo=void 0,_e[Ye].length!==0){var e=_e[Ye].shift(),t=e[0],r=e[1],n=e[2],o=e[3],u=e[4];if(o===void 0)pi("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-o>=6e4){pi("TIMEOUT",t.name,r);var a=r.pop();typeof a=="function"&&a.call(null,n)}else{var h=Date.now()-u,f=Math.max(u-o,1),m=Math.min(f*1.2,100);h>=m?(pi("RETRY",t.name,r),t.apply(null,r.concat([o]))):_e[Ye].push(e)}vo===void 0&&(vo=setTimeout(da,0))}}});var mi=C(Ur=>{"use strict";var Km=pt().fromCallback,mt=ot(),e$=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(e=>typeof mt[e]=="function");Object.a