UNPKG

pnpm-cdx

Version:

Generate a CycloneDX SBOM from a PNPM Node.js project.

49 lines (48 loc) 197 kB
#! /usr/bin/env node import { createRequire as topLevelCreateRequire } from 'module' const require = topLevelCreateRequire(import.meta.url) var yl=Object.create;var Hi=Object.defineProperty;var bl=Object.getOwnPropertyDescriptor;var vl=Object.getOwnPropertyNames;var _l=Object.getPrototypeOf,wl=Object.prototype.hasOwnProperty;var et=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+n+'" is not supported')});var b=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Sl=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vl(e))!wl.call(n,i)&&i!==t&&Hi(n,i,{get:()=>e[i],enumerable:!(s=bl(e,i))||s.enumerable});return n};var Ks=(n,e,t)=>(t=n!=null?yl(_l(n)):{},Sl(e||!n||!n.__esModule?Hi(t,"default",{value:n,enumerable:!0}):t,n));var tt=b(Ws=>{var Jt=class extends Error{constructor(e,t,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Gs=class extends Jt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ws.CommanderError=Jt;Ws.InvalidArgumentError=Gs});var zt=b(zs=>{var{InvalidArgumentError:Cl}=tt(),Js=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new Cl(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function kl(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}zs.Argument=Js;zs.humanReadableArgName=kl});var Qs=b(Ki=>{var{humanReadableArgName:Al}=zt(),Zs=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1}visibleCommands(e){let t=e.commands.filter(s=>!s._hidden);if(e._hasImplicitHelpCommand()){let[,s,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),r=e.createCommand(s).helpOption(!1);r.description(e._helpCommandDescription),i&&r.arguments(i),t.push(r)}return this.sortSubcommands&&t.sort((s,i)=>s.name().localeCompare(i.name())),t}visibleOptions(e){let t=e.options.filter(r=>!r.hidden),s=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(s||i){let r;s?i?r=e.createOption(e._helpFlags,e._helpDescription):r=e.createOption(e._helpShortFlag,e._helpDescription):r=e.createOption(e._helpLongFlag,e._helpDescription),t.push(r)}if(this.sortOptions){let r=a=>a.short?a.short.replace(/^-/,""):a.long.replace(/^--/,"");t.sort((a,o)=>r(a).localeCompare(r(o)))}return t}visibleArguments(e){return e._argsDescription&&e._args.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e._args.find(t=>t.description)?e._args:[]}subcommandTerm(e){let t=e._args.map(s=>Al(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((s,i)=>Math.max(s,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((s,i)=>Math.max(s,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let s="";for(let i=e.parent;i;i=i.parent)s=i.name()+" "+s;return s+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let s=`(${t.join(", ")})`;return e.description?`${e.description} ${s}`:s}return e.description}formatHelp(e,t){let s=t.padWidth(e,t),i=t.helpWidth||80,r=2,a=2;function o(g,d){if(d){let p=`${g.padEnd(s+a)}${d}`;return t.wrap(p,i-r,s+a)}return g}function l(g){return g.join(` `).replace(/^/gm," ".repeat(r))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([u,""]));let f=t.visibleArguments(e).map(g=>o(t.argumentTerm(g),t.argumentDescription(g)));f.length>0&&(c=c.concat(["Arguments:",l(f),""]));let h=t.visibleOptions(e).map(g=>o(t.optionTerm(g),t.optionDescription(g)));h.length>0&&(c=c.concat(["Options:",l(h),""]));let m=t.visibleCommands(e).map(g=>o(t.subcommandTerm(g),t.subcommandDescription(g)));return m.length>0&&(c=c.concat(["Commands:",l(m),""])),c.join(` `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,s,i=40){if(e.match(/[\n]\s+/))return e;let r=t-s;if(r<i)return e;let a=e.slice(0,s),o=e.slice(s),l=" ".repeat(s),c=new RegExp(".{1,"+(r-1)+"}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)","g"),u=o.match(c)||[];return a+u.map((f,h)=>(f.slice(-1)===` `&&(f=f.slice(0,f.length-1)),(h>0?l:"")+f.trimRight())).join(` `)}};Ki.Help=Zs});var tn=b(Zt=>{var{InvalidArgumentError:Ol}=tt(),Xs=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=Gi(e);this.short=s.shortFlag,this.long=s.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(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){return this.implied=Object.assign(this.implied||{},e),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new Ol(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Nl(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},en=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let i=this.negativeOptions.get(s).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function Nl(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Gi(n){let e,t,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Zt.Option=Xs;Zt.splitOptionFlags=Gi;Zt.DualOptions=en});var Ji=b(Wi=>{function Ll(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let s=0;s<=n.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=n.length;i++){let r=1;n[i-1]===e[s-1]?r=0:r=1,t[i][s]=Math.min(t[i-1][s]+1,t[i][s-1]+1,t[i-1][s-1]+r),i>1&&s>1&&n[i-1]===e[s-2]&&n[i-2]===e[s-1]&&(t[i][s]=Math.min(t[i][s],t[i-2][s-2]+1))}return t[n.length][e.length]}function El(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(a=>a.slice(2)));let s=[],i=3,r=.4;return e.forEach(a=>{if(a.length<=1)return;let o=Ll(n,a),l=Math.max(n.length,a.length);(l-o)/l>r&&(o<i?(i=o,s=[a]):o===i&&s.push(a))}),s.sort((a,o)=>a.localeCompare(o)),t&&(s=s.map(a=>`--${a}`)),s.length>1?` (Did you mean one of ${s.join(", ")}?)`:s.length===1?` (Did you mean ${s[0]}?)`:""}Wi.suggestSimilar=El});var tr=b(er=>{var Tl=et("events").EventEmitter,sn=et("child_process"),ue=et("path"),nn=et("fs"),M=et("process"),{Argument:Pl,humanReadableArgName:xl}=zt(),{CommanderError:rn}=tt(),{Help:Il}=Qs(),{Option:zi,splitOptionFlags:Dl,DualOptions:ql}=tn(),{suggestSimilar:Zi}=Ji(),st=class extends Tl{constructor(e){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=e||"",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:t=>M.stdout.write(t),writeErr:t=>M.stderr.write(t),getOutHelpWidth:()=>M.stdout.isTTY?M.stdout.columns:void 0,getErrHelpWidth:()=>M.stderr.isTTY?M.stderr.columns:void 0,outputError:(t,s)=>s(t)},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(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}command(e,t,s){let i=t,r=s;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,a,o]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(a);return i&&(l.description(i),l._executableHandler=!0),r.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(r.noHelp||r.hidden),l._executableFile=r.executableFile||null,o&&l.arguments(o),this.commands.push(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(e){return new st(e)}createHelp(){return Object.assign(new Il,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new Pl(e,t)}argument(e,t,s,i){let r=this.createArgument(e,t);return typeof s=="function"?r.default(i).argParser(s):r.default(s),this.addArgument(r),this}arguments(e){return e.split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this._args.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this._args.push(e),this}addHelpCommand(e,t){return e===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof e=="string"&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new rn(e,t,s)),M.exit(e)}action(e){let t=s=>{let i=this._args.length,r=s.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new zi(e,t)}addOption(e){let t=e.name(),s=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");this.options.push(e);let i=(r,a,o)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(s);if(r!==null&&e.parseArg)try{r=e.parseArg(r,l)}catch(c){if(c.code==="commander.invalidArgument"){let u=`${a} ${c.message}`;this.error(u,{exitCode:c.exitCode,code:c.code})}throw c}else r!==null&&e.variadic&&(r=e._concatValue(r,l));r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(s,r,o)};return this.on("option:"+t,r=>{let a=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let a=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,a,"env")}),this}_optionEx(e,t,s,i,r){if(typeof t=="object"&&t instanceof zi)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(t,s);if(a.makeOptionMandatory(!!e.mandatory),typeof i=="function")a.default(r).argParser(i);else if(i instanceof RegExp){let o=i;i=(l,c)=>{let u=o.exec(l);return u?u[0]:c},a.default(r).argParser(i)}else a.default(i);return this.addOption(a)}option(e,t,s,i){return this._optionEx({},e,t,s,i)}requiredOption(e,t,s,i){return this._optionEx({mandatory:!0},e,t,s,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){if(this._passThroughOptions=!!e,!!this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");t=t||{},e===void 0&&(e=M.argv,M.versions&&M.versions.electron&&(t.from="electron")),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":M.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,f){let h=ue.resolve(u,f);if(nn.existsSync(h))return h;if(i.includes(ue.extname(f)))return;let m=i.find(g=>nn.existsSync(`${h}${g}`));if(m)return`${h}${m}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let u;try{u=nn.realpathSync(this._scriptPath)}catch{u=this._scriptPath}o=ue.resolve(ue.dirname(u),o)}if(o){let u=r(o,a);if(!u&&!e._executableFile&&this._scriptPath){let f=ue.basename(this._scriptPath,ue.extname(this._scriptPath));f!==this._name&&(u=r(o,`${f}-${e._name}`))}a=u||a}s=i.includes(ue.extname(a));let l;M.platform!=="win32"?s?(t.unshift(a),t=Xi(M.execArgv).concat(t),l=sn.spawn(M.argv[0],t,{stdio:"inherit"})):l=sn.spawn(a,t,{stdio:"inherit"}):(t.unshift(a),t=Xi(M.execArgv).concat(t),l=sn.spawn(M.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{M.on(f,()=>{l.killed===!1&&l.exitCode===null&&l.kill(f)})});let c=this._exitCallback;c?l.on("close",()=>{c(new rn(M.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):l.on("close",M.exit.bind(M)),l.on("error",u=>{if(u.code==="ENOENT"){let f=o?`searched for local subcommand relative to directory '${o}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",h=`'${a}' does not exist - if '${e._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 - ${f}`;throw new Error(h)}else if(u.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)M.exit(1);else{let f=new rn(1,"commander.executeSubCommandAsync","(error)");f.nestedError=u,c(f)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(s));else return i._parseCommand(t,s)}),r}_checkNumberOfArguments(){this._args.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let e=(s,i,r)=>{let a=i;if(i!==null&&s.parseArg)try{a=s.parseArg(i,r)}catch(o){if(o.code==="commander.invalidArgument"){let l=`error: command-argument value '${i}' is invalid for argument '${s.name()}'. ${o.message}`;this.error(l,{exitCode:o.exitCode,code:o.code})}throw o}return a};this._checkNumberOfArguments();let t=[];this._args.forEach((s,i)=>{let r=s.defaultValue;s.variadic?i<this.args.length?(r=this.args.slice(i),s.parseArg&&(r=r.reduce((a,o)=>e(s,o,a),s.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],s.parseArg&&(r=e(s,r,s.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,i=[];return Qt(this).reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(a=>{i.push({hookedCommand:r,callback:a})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{s=this._chainOrCall(s,()=>r.callback(r.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let i=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return e.length===1&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return Qi(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),Qi(this,s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),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(r,e,t)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(!!e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let i=s.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let i=e.find(r=>s.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(s,i)})}_checkForConflictingOptions(){for(let e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}parseOptions(e){let t=[],s=[],i=t,r=e.slice();function a(l){return l.length>1&&l[0]==="-"}let o=null;for(;r.length;){let l=r.shift();if(l==="--"){i===s&&i.push(l),i.push(...r);break}if(o&&!a(l)){this.emit(`option:${o.name()}`,l);continue}if(o=null,a(l)){let c=this._findOption(l);if(c){if(c.required){let u=r.shift();u===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,u)}else if(c.optional){let u=null;r.length>0&&!a(r[0])&&(u=r.shift()),this.emit(`option:${c.name()}`,u)}else this.emit(`option:${c.name()}`);o=c.variadic?c:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let c=this._findOption(`-${l[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,l.slice(2)):(this.emit(`option:${c.name()}`),r.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let c=l.indexOf("="),u=this._findOption(l.slice(0,c));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,l.slice(c+1));continue}}if(a(l)&&(i=s),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),r.length>0&&s.push(...r);break}else if(l===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(l),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){s.push(l),r.length>0&&s.push(...r);break}}if(this._passThroughOptions){i.push(l),r.length>0&&i.push(...r);break}i.push(l)}return{operands:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let i=this.options[s].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return Qt(this).reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));let s=t||{},i=s.exitCode||1,r=s.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in M.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,M.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new ql(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,s.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=a=>{let o=a.attributeName(),l=this.getOptionValue(o),c=this.options.find(f=>f.negate&&o===f.attributeName()),u=this.options.find(f=>!f.negate&&o===f.attributeName());return c&&(c.presetArg===void 0&&l===!1||c.presetArg!==void 0&&l===c.presetArg)?c:u||a},i=a=>{let o=s(a),l=o.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let a=r.createHelp().visibleOptions(r).filter(o=>o.long).map(o=>o.long);i=i.concat(a),r=r.parent}while(r&&!r._enablePositionalOptions);t=Zi(e,i)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this._args.length,s=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=Zi(e,i)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let i=this.createOption(t,s);return this._versionOptionName=i.attributeName(),this.options.push(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this._args.map(s=>xl(s));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=ue.basename(e,ue.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=i=>this._outputConfiguration.writeErr(i):s=i=>this._outputConfiguration.writeOut(i),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);Qt(this).reverse().forEach(r=>r.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let i=this.helpInformation(s);if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(i),this.emit(this._helpLongFlag),this.emit("afterHelp",s),Qt(this).forEach(r=>r.emit("afterAllHelp",s))}helpOption(e,t){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;let s=Dl(this._helpFlags);return this._helpShortFlag=s.shortFlag,this._helpLongFlag=s.longFlag,this}help(e){this.outputHelp(e);let t=M.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${s.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let a;typeof t=="function"?a=t({error:r.error,command:r.command}):a=t,a&&r.write(`${a} `)}),this}};function Qi(n,e){n._hasHelpOption&&e.find(s=>s===n._helpLongFlag||s===n._helpShortFlag)&&(n.outputHelp(),n._exit(0,"commander.helpDisplayed","(outputHelp)"))}function Xi(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:s=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],s=r[3],i=r[4]),t&&i!=="0"?`${t}=${s}:${parseInt(i)+1}`:e})}function Qt(n){let e=[];for(let t=n;t;t=t.parent)e.push(t);return e}er.Command=st});var rr=b((z,ir)=>{var{Argument:Ml}=zt(),{Command:sr}=tr(),{CommanderError:$l,InvalidArgumentError:nr}=tt(),{Help:Bl}=Qs(),{Option:jl}=tn();z=ir.exports=new sr;z.program=z;z.Argument=Ml;z.Command=sr;z.CommanderError=$l;z.Help=Bl;z.InvalidArgumentError=nr;z.InvalidOptionArgumentError=nr;z.Option=jl});var I=b(j=>{"use strict";var dn=Symbol.for("yaml.alias"),br=Symbol.for("yaml.document"),ss=Symbol.for("yaml.map"),vr=Symbol.for("yaml.pair"),pn=Symbol.for("yaml.scalar"),ns=Symbol.for("yaml.seq"),oe=Symbol.for("yaml.node.type"),Kl=n=>!!n&&typeof n=="object"&&n[oe]===dn,Gl=n=>!!n&&typeof n=="object"&&n[oe]===br,Wl=n=>!!n&&typeof n=="object"&&n[oe]===ss,Jl=n=>!!n&&typeof n=="object"&&n[oe]===vr,_r=n=>!!n&&typeof n=="object"&&n[oe]===pn,zl=n=>!!n&&typeof n=="object"&&n[oe]===ns;function wr(n){if(n&&typeof n=="object")switch(n[oe]){case ss:case ns:return!0}return!1}function Zl(n){if(n&&typeof n=="object")switch(n[oe]){case dn:case ss:case pn:case ns:return!0}return!1}var Ql=n=>(_r(n)||wr(n))&&!!n.anchor,hn=class{constructor(e){Object.defineProperty(this,oe,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}};j.ALIAS=dn;j.DOC=br;j.MAP=ss;j.NODE_TYPE=oe;j.NodeBase=hn;j.PAIR=vr;j.SCALAR=pn;j.SEQ=ns;j.hasAnchor=Ql;j.isAlias=Kl;j.isCollection=wr;j.isDocument=Gl;j.isMap=Wl;j.isNode=Zl;j.isPair=Jl;j.isScalar=_r;j.isSeq=zl});var yt=b(mn=>{"use strict";var B=I(),U=Symbol("break visit"),Sr=Symbol("skip children"),le=Symbol("remove node");function is(n,e){let t=Cr(e);B.isDocument(n)?je(null,n.contents,t,Object.freeze([n]))===le&&(n.contents=null):je(null,n,t,Object.freeze([]))}is.BREAK=U;is.SKIP=Sr;is.REMOVE=le;function je(n,e,t,s){let i=kr(n,e,t,s);if(B.isNode(i)||B.isPair(i))return Ar(n,s,i),je(n,i,t,s);if(typeof i!="symbol"){if(B.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let a=je(r,e.items[r],t,s);if(typeof a=="number")r=a-1;else{if(a===U)return U;a===le&&(e.items.splice(r,1),r-=1)}}}else if(B.isPair(e)){s=Object.freeze(s.concat(e));let r=je("key",e.key,t,s);if(r===U)return U;r===le&&(e.key=null);let a=je("value",e.value,t,s);if(a===U)return U;a===le&&(e.value=null)}}return i}async function rs(n,e){let t=Cr(e);B.isDocument(n)?await Re(null,n.contents,t,Object.freeze([n]))===le&&(n.contents=null):await Re(null,n,t,Object.freeze([]))}rs.BREAK=U;rs.SKIP=Sr;rs.REMOVE=le;async function Re(n,e,t,s){let i=await kr(n,e,t,s);if(B.isNode(i)||B.isPair(i))return Ar(n,s,i),Re(n,i,t,s);if(typeof i!="symbol"){if(B.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let a=await Re(r,e.items[r],t,s);if(typeof a=="number")r=a-1;else{if(a===U)return U;a===le&&(e.items.splice(r,1),r-=1)}}}else if(B.isPair(e)){s=Object.freeze(s.concat(e));let r=await Re("key",e.key,t,s);if(r===U)return U;r===le&&(e.key=null);let a=await Re("value",e.value,t,s);if(a===U)return U;a===le&&(e.value=null)}}return i}function Cr(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function kr(n,e,t,s){if(typeof t=="function")return t(n,e,s);if(B.isMap(e))return t.Map?.(n,e,s);if(B.isSeq(e))return t.Seq?.(n,e,s);if(B.isPair(e))return t.Pair?.(n,e,s);if(B.isScalar(e))return t.Scalar?.(n,e,s);if(B.isAlias(e))return t.Alias?.(n,e,s)}function Ar(n,e,t){let s=e[e.length-1];if(B.isCollection(s))s.items[n]=t;else if(B.isPair(s))n==="key"?s.key=t:s.value=t;else if(B.isDocument(s))s.contents=t;else{let i=B.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}mn.visit=is;mn.visitAsync=rs});var gn=b(Nr=>{"use strict";var Or=I(),Xl=yt(),ec={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},tc=n=>n.replace(/[!,[\]{}]/g,e=>ec[e]),Y=class{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Y.defaultYaml,e),this.tags=Object.assign({},Y.defaultTags,t)}clone(){let e=new Y(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Y(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Y.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Y.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:Y.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Y.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,a]=s;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let a=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,a),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let a=e.slice(2,-1);return a==="!"||a==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),a)}let[,s,i]=e.match(/^(.*!)([^!]*)$/);i||t(`The ${e} tag has no suffix`);let r=this.tags[s];return r?r+decodeURIComponent(i):s==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+tc(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(e&&s.length>0&&Or.isNode(e.contents)){let r={};Xl.visit(e.contents,(a,o)=>{Or.isNode(o)&&o.tag&&(r[o.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,a]of s)r==="!!"&&a==="tag:yaml.org,2002:"||(!e||i.some(o=>o.startsWith(a)))&&t.push(`%TAG ${r} ${a}`);return t.join(` `)}};Y.defaultYaml={explicit:!1,version:"1.2"};Y.defaultTags={"!!":"tag:yaml.org,2002:"};Nr.Directives=Y});var as=b(bt=>{"use strict";var Lr=I(),sc=yt();function nc(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Er(n){let e=new Set;return sc.visit(n,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function Tr(n,e){for(let t=1;;++t){let s=`${n}${t}`;if(!e.has(s))return s}}function ic(n,e){let t=[],s=new Map,i=null;return{onAnchor:r=>{t.push(r),i||(i=Er(n));let a=Tr(e,i);return i.add(a),a},setAnchors:()=>{for(let r of t){let a=s.get(r);if(typeof a=="object"&&a.anchor&&(Lr.isScalar(a.node)||Lr.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=r,o}}},sourceObjects:s}}bt.anchorIsValid=nc;bt.anchorNames=Er;bt.createNodeAnchors=ic;bt.findNewAnchor=Tr});var _t=b(xr=>{"use strict";var rc=as(),Pr=yt(),vt=I(),yn=class extends vt.NodeBase{constructor(e){super(vt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return Pr.visit(e,{Node:(s,i)=>{if(i===this)return Pr.visit.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:s,doc:i,maxAliasCount:r}=t,a=this.resolve(i);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=s.get(a);if(!o||o.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=os(i,a,s)),o.count*o.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(e,t,s){let i=`*${this.source}`;if(e){if(rc.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function os(n,e,t){if(vt.isAlias(e)){let s=e.resolve(n),i=t&&s&&t.get(s);return i?i.count*i.aliasCount:0}else if(vt.isCollection(e)){let s=0;for(let i of e.items){let r=os(n,i,t);r>s&&(s=r)}return s}else if(vt.isPair(e)){let s=os(n,e.key,t),i=os(n,e.value,t);return Math.max(s,i)}return 1}xr.Alias=yn});var Fe=b(Dr=>{"use strict";var ac=I();function Ir(n,e,t){if(Array.isArray(n))return n.map((s,i)=>Ir(s,String(i),t));if(n&&typeof n.toJSON=="function"){if(!t||!ac.hasAnchor(n))return n.toJSON(e,t);let s={aliasCount:0,count:1,res:void 0};t.anchors.set(n,s),t.onCreate=r=>{s.res=r,delete t.onCreate};let i=n.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof n=="bigint"&&!t?.keep?Number(n):n}Dr.toJS=Ir});var $=b(bn=>{"use strict";var qr=I(),oc=Fe(),lc=n=>!n||typeof n!="function"&&typeof n!="object",ve=class extends qr.NodeBase{constructor(e){super(qr.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:oc.toJS(this.value,e,t)}toString(){return String(this.value)}};ve.BLOCK_FOLDED="BLOCK_FOLDED";ve.BLOCK_LITERAL="BLOCK_LITERAL";ve.PLAIN="PLAIN";ve.QUOTE_DOUBLE="QUOTE_DOUBLE";ve.QUOTE_SINGLE="QUOTE_SINGLE";bn.Scalar=ve;bn.isScalarValue=lc});var wt=b($r=>{"use strict";var cc=_t(),Te=I(),Mr=$(),uc="tag:yaml.org,2002:";function fc(n,e,t){if(e){let s=t.filter(r=>r.tag===e),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(s=>s.identify?.(n)&&!s.format)}function hc(n,e,t){if(Te.isDocument(n)&&(n=n.contents),Te.isNode(n))return n;if(Te.isPair(n)){let f=t.schema[Te.MAP].createNode?.(t.schema,null,t);return f.items.push(n),f}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:a,sourceObjects:o}=t,l;if(s&&n&&typeof n=="object"){if(l=o.get(n),l)return l.anchor||(l.anchor=i(n)),new cc.Alias(l.anchor);l={anchor:null,node:null},o.set(n,l)}e?.startsWith("!!")&&(e=uc+e.slice(2));let c=fc(n,e,a.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let f=new Mr.Scalar(n);return l&&(l.node=f),f}c=n instanceof Map?a[Te.MAP]:Symbol.iterator in Object(n)?a[Te.SEQ]:a[Te.MAP]}r&&(r(c),delete t.onTagObj);let u=c?.createNode?c.createNode(t.schema,n,t):new Mr.Scalar(n);return e&&(u.tag=e),l&&(l.node=u),u}$r.createNode=hc});var St=b(cs=>{"use strict";var dc=wt(),te=I();function vn(n,e,t){let s=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let a=[];a[r]=s,s=a}else s=new Map([[r,s]])}return dc.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}var Br=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,ls=class extends te.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(s=>te.isNode(s)||te.isPair(s)?s.clone(e):s),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Br(e))this.add(t);else{let[s,...i]=e,r=this.get(s,!0);if(te.isCollection(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(s,vn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(e){let[t,...s]=e;if(s.length===0)return this.delete(t);let i=this.get(t,!0);if(te.isCollection(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){let[s,...i]=e,r=this.get(s,!0);return i.length===0?!t&&te.isScalar(r)?r.value:r:te.isCollection(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!te.isPair(t))return!1;let s=t.value;return s==null||e&&te.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[t,...s]=e;if(s.length===0)return this.has(t);let i=this.get(t,!0);return te.isCollection(i)?i.hasIn(s):!1}setIn(e,t){let[s,...i]=e;if(i.length===0)this.set(s,t);else{let r=this.get(s,!0);if(te.isCollection(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(s,vn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};ls.maxFlowStringSingleLineLength=60;cs.Collection=ls;cs.collectionFromPath=vn;cs.isEmptyPath=Br});var Ct=b(us=>{"use strict";var pc=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function _n(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var mc=(n,e,t)=>n.endsWith(` `)?_n(t,e):t.includes(` `)?` `+_n(t,e):(n.endsWith(" ")?"":" ")+t;us.indentComment=_n;us.lineComment=mc;us.stringifyComment=pc});var Rr=b(kt=>{"use strict";var gc="flow",wn="block",fs="quoted";function yc(n,e,t="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:a,onOverflow:o}={}){if(!i||i<0)return n;let l=Math.max(1+r,1+i-e.length);if(n.length<=l)return n;let c=[],u={},f=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):f=i-s);let h,m,g=!1,d=-1,p=-1,y=-1;t===wn&&(d=jr(n,d),d!==-1&&(f=d+l));for(let k;k=n[d+=1];){if(t===fs&&k==="\\"){switch(p=d,n[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}y=d}if(k===` `)t===wn&&(d=jr(n,d)),f=d+l,h=void 0;else{if(k===" "&&m&&m!==" "&&m!==` `&&m!==" "){let v=n[d+1];v&&v!==" "&&v!==` `&&v!==" "&&(h=d)}if(d>=f)if(h)c.push(h),f=h+l,h=void 0;else if(t===fs){for(;m===" "||m===" ";)m=k,k=n[d+=1],g=!0;let v=d>y+1?d-2:p-1;if(u[v])return n;c.push(v),u[v]=!0,f=v+l,h=void 0}else g=!0}m=k}if(g&&o&&o(),c.length===0)return n;a&&a();let S=n.slice(0,c[0]);for(let k=0;k<c.length;++k){let v=c[k],P=c[k+1]||n.length;v===0?S=` ${e}${n.slice(0,P)}`:(t===fs&&u[v]&&(S+=`${n[v]}\\`),S+=` ${e}${n.slice(v+1,P)}`)}return S}function jr(n,e){let t=n[e+1];for(;t===" "||t===" ";){do t=n[e+=1];while(t&&t!==` `);t=n[e+1]}return e}kt.FOLD_BLOCK=wn;kt.FOLD_FLOW=gc;kt.FOLD_QUOTED=fs;kt.foldFlowLines=yc});var Nt=b(Fr=>{"use strict";var ce=$(),_e=Rr(),ds=n=>({indentAtStart:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),ps=n=>/^(%|---|\.\.\.)/m.test(n);function bc(n,e,t){if(!e||e<0)return!1;let s=e-t,i=n.length;if(i<=s)return!1;for(let r=0,a=0;r<i;++r)if(n[r]===` `){if(r-a>s)return!0;if(a=r+1,i-a<=s)return!1}return!0}function At(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(ps(n)?" ":""),a="",o=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(a+=t.slice(o,l)+"\\ ",l+=1,o=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{a+=t.slice(o,l);let u=t.substr(l+2,4);switch(u){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:u.substr(0,2)==="00"?a+="\\x"+u.substr(2):a+=t.substr(l,6)}l+=5,o=l+1}break;case"n":if(s||t[l+2]==='"'||t.length<i)l+=1;else{for(a+=t.slice(o,l)+` `;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)a+=` `,l+=2;a+=r,t[l+2]===" "&&(a+="\\"),l+=1,o=l+1}break;default:l+=1}return a=o?a+t.slice(o):t,s?a:_e.foldFlowLines(a,r,_e.FOLD_QUOTED,ds(e))}function Sn(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(` `)||/[ \t]\n|\n[ \t]/.test(n))return At(n,e);let t=e.indent||(ps(n)?" ":""),s="'"+n.replace(/'/g,"''").replace(/\n+/g,`$& ${t}`)+"'";return e.implicitKey?s:_e.foldFlowLines(s,t,_e.FOLD_FLOW,ds(e))}function Ot(n,e){let{singleQuote:t}=e.options,s;if(t===!1)s=At;else{let i=n.includes('"'),r=n.includes("'");i&&!r?s=Sn:r&&!i?s=At:s=t?Sn:At}return s(n,e)}function hs({comment:n,type:e,value:t},s,i,r){let{blockQuote:a,commentString:o,lineWidth:l}=s.options;if(!a||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return Ot(t,s);let c=s.indent||(s.forceBlockIndent||ps(t)?" ":""),u=a==="literal"?!0:a==="folded"||e===ce.Scalar.BLOCK_FOLDED?!1:e===ce.Scalar.BLOCK_LITERAL?!0:!bc(t,l,c.length);if(!t)return u?`| `:`> `;let f,h;for(h=t.length;h>0;--h){let C=t[h-1];if(C!==` `&&C!==" "&&C!==" ")break}let m=t.substring(h),g=m.indexOf(` `);g===-1?f="-":t===m||g!==m.length-1?(f="+",r&&r()):f="",m&&(t=t.slice(0,-m.length),m[m.length-1]===` `&&(m=m.slice(0,-1)),m=m.replace(/\n+(?!\n|$)/g,`$&${c}`));let d=!1,p,y=-1;for(p=0;p<t.length;++p){let C=t[p];if(C===" ")d=!0;else if(C===` `)y=p;else break}let S=t.substring(0,y<p?y+1:p);S&&(t=t.substring(S.length),S=S.replace(/\n+/g,`$&${c}`));let v=(u?"|":">")+(d?c?"2":"1":"")+f;if(n&&(v+=" "+o(n.replace(/ ?[\r\n]+/g," ")),i&&i()),u)return t=t.replace(/\n+/g,`$&${c}`),`${v} ${c}${S}${t}${m}`;t=t.replace(/\n+/g,` $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let P=_e.foldFlowLines(`${S}${t}${m}`,c,_e.FOLD_BLOCK,ds(s));return`${v} ${c}${P}`}function vc(n,e,t,s){let{type:i,value:r}=n,{actualString:a,implicitKey:o,indent:l,inFlow:c}=e;if(o&&/[\n[\]{},]/.test(r)||c&&/[[\]{},]/.test(r))return Ot(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return o||c||!r.includes(` `)?Ot(r,e):hs(n,e,t,s);if(!o&&!c&&i!==ce.Scalar.PLAIN&&r.includes(` `))return hs(n,e,t,s);if(l===""&&ps(r))return e.forceBlockIndent=!0,hs(n,e,t,s);let u=r.replace(/\n+/g,`$& ${l}`);if(a){let f=g=>g.default&&g.t