metascope 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/cli.js CHANGED
@@ -103,7 +103,7 @@ fi
103
103
  `)}`:``;d.fail(te(`Missing required argument: %s`,`Missing required arguments: %s`,Object.keys(m).length,Object.keys(m).join(`, `)+f))}},re.unknownArguments=function(f,m,ie,ae,oe=!0){var se;let ce=l.getInternalMethods().getCommandInstance().getCommands(),le=[],ue=l.getInternalMethods().getContext();if(Object.keys(f).forEach(d=>{!specialKeys.includes(d)&&!Object.prototype.hasOwnProperty.call(ie,d)&&!Object.prototype.hasOwnProperty.call(l.getInternalMethods().getParseContext(),d)&&!re.isValidAndSomeAliasIsNotNew(d,m)&&le.push(d)}),oe&&(ue.commands.length>0||ce.length>0||ae)&&f._.slice(ue.commands.length).forEach(l=>{ce.includes(``+l)||le.push(``+l)}),oe){let d=l.getDemandedCommands()._?.max||0,m=ue.commands.length+d;m<f._.length&&f._.slice(m).forEach(l=>{l=String(l),!ue.commands.includes(l)&&!le.includes(l)&&le.push(l)})}le.length&&d.fail(te(`Unknown argument: %s`,`Unknown arguments: %s`,le.length,le.map(l=>l.trim()?l:`"${l}"`).join(`, `)))},re.unknownCommands=function(f){let m=l.getInternalMethods().getCommandInstance().getCommands(),re=[],ie=l.getInternalMethods().getContext();return(ie.commands.length>0||m.length>0)&&f._.slice(ie.commands.length).forEach(l=>{m.includes(``+l)||re.push(``+l)}),re.length>0?(d.fail(te(`Unknown command: %s`,`Unknown commands: %s`,re.length,re.join(`, `))),!0):!1},re.isValidAndSomeAliasIsNotNew=function(d,f){if(!Object.prototype.hasOwnProperty.call(f,d))return!1;let m=l.parsed.newAliases;return[d,...f[d]].some(l=>!Object.prototype.hasOwnProperty.call(m,l)||!m[d])},re.limitedChoices=function(f){let te=l.getOptions(),re={};if(!Object.keys(te.choices).length)return;Object.keys(f).forEach(l=>{specialKeys.indexOf(l)===-1&&Object.prototype.hasOwnProperty.call(te.choices,l)&&[].concat(f[l]).forEach(d=>{te.choices[l].indexOf(d)===-1&&d!==void 0&&(re[l]=(re[l]||[]).concat(d))})});let ie=Object.keys(re);if(!ie.length)return;let ae=m(`Invalid values:`);ie.forEach(l=>{ae+=`\n ${m(`Argument: %s, Given: %s, Choices: %s`,l,d.stringifiedValues(re[l]),d.stringifiedValues(te.choices[l]))}`}),d.fail(ae)};let ie={};re.implies=function(d,m){argsert(`<string|object> [array|number|string]`,[d,m],arguments.length),typeof d==`object`?Object.keys(d).forEach(l=>{re.implies(l,d[l])}):(l.global(d),ie[d]||(ie[d]=[]),Array.isArray(m)?m.forEach(l=>re.implies(d,l)):(assertNotStrictEqual(m,void 0,f),ie[d].push(m)))},re.getImplied=function(){return ie};function ae(l,d){let f=Number(d);return d=isNaN(f)?d:f,typeof d==`number`?d=l._.length>=d:d.match(/^--no-.+/)?(d=d.match(/^--no-(.+)/)[1],d=!Object.prototype.hasOwnProperty.call(l,d)):d=Object.prototype.hasOwnProperty.call(l,d),d}re.implications=function(l){let f=[];if(Object.keys(ie).forEach(d=>{let m=d;(ie[d]||[]).forEach(d=>{let te=m,re=d;te=ae(l,te),d=ae(l,d),te&&!d&&f.push(` ${m} -> ${re}`)})}),f.length){let l=`${m(`Implications failed:`)}\n`;f.forEach(d=>{l+=d}),d.fail(l)}};let oe={};re.conflicts=function(d,f){argsert(`<string|object> [array|string]`,[d,f],arguments.length),typeof d==`object`?Object.keys(d).forEach(l=>{re.conflicts(l,d[l])}):(l.global(d),oe[d]||(oe[d]=[]),Array.isArray(f)?f.forEach(l=>re.conflicts(d,l)):oe[d].push(f))},re.getConflicting=()=>oe,re.conflicting=function(te){Object.keys(te).forEach(l=>{oe[l]&&oe[l].forEach(f=>{f&&te[l]!==void 0&&te[f]!==void 0&&d.fail(m(`Arguments %s and %s are mutually exclusive`,l,f))})}),l.getInternalMethods().getParserConfiguration()[`strip-dashed`]&&Object.keys(oe).forEach(l=>{oe[l].forEach(re=>{re&&te[f.Parser.camelCase(l)]!==void 0&&te[f.Parser.camelCase(re)]!==void 0&&d.fail(m(`Arguments %s and %s are mutually exclusive`,l,re))})})},re.recommendCommands=function(l,f){let te=3;f=f.sort((l,d)=>d.length-l.length);let re=null,ie=1/0;for(let d=0,m;(m=f[d])!==void 0;d++){let d=levenshtein(l,m);d<=3&&d<ie&&(ie=d,re=m)}re&&d.fail(m(`Did you mean %s?`,re))},re.reset=function(l){return ie=objFilter(ie,d=>!l[d]),oe=objFilter(oe,d=>!l[d]),re};let se=[];return re.freeze=function(){se.push({implied:ie,conflicting:oe})},re.unfreeze=function(){let l=se.pop();assertNotStrictEqual(l,void 0,f),{implied:ie,conflicting:oe}=l},re}let previouslyVisitedConfigs=[],shim;function applyExtends(l,d,f,m){shim=m;let te={};if(Object.prototype.hasOwnProperty.call(l,`extends`)){if(typeof l.extends!=`string`)return te;let re=/\.json|\..*rc$/.test(l.extends),ie=null;if(re)ie=getPathToDefaultConfig(d,l.extends);else try{ie=import.meta.resolve(l.extends)}catch{return l}checkForCircularExtends(ie),previouslyVisitedConfigs.push(ie),te=re?JSON.parse(shim.readFileSync(ie,`utf8`)):m.require(l.extends),delete l.extends,te=applyExtends(te,shim.path.dirname(ie),f,shim)}return previouslyVisitedConfigs=[],f?mergeDeep$1(te,l):Object.assign({},te,l)}function checkForCircularExtends(l){if(previouslyVisitedConfigs.indexOf(l)>-1)throw new YError(`Circular extended configurations: '${l}'.`)}function getPathToDefaultConfig(l,d){return shim.path.resolve(l,d)}function mergeDeep$1(l,d){let f={};function m(l){return l&&typeof l==`object`&&!Array.isArray(l)}Object.assign(f,l);for(let te of Object.keys(d))m(d[te])&&m(f[te])?f[te]=mergeDeep$1(l[te],d[te]):f[te]=d[te];return f}var __classPrivateFieldSet=function(l,d,f,m,te){if(m===`m`)throw TypeError(`Private method is not writable`);if(m===`a`&&!te)throw TypeError(`Private accessor was defined without a setter`);if(typeof d==`function`?l!==d||!te:!d.has(l))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return m===`a`?te.call(l,f):te?te.value=f:d.set(l,f),f},__classPrivateFieldGet=function(l,d,f,m){if(f===`a`&&!m)throw TypeError(`Private accessor was defined without a getter`);if(typeof d==`function`?l!==d||!m:!d.has(l))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return f===`m`?m:f===`a`?m.call(l):m?m.value:d.get(l)},_YargsInstance_command,_YargsInstance_cwd,_YargsInstance_context,_YargsInstance_completion,_YargsInstance_completionCommand,_YargsInstance_defaultShowHiddenOpt,_YargsInstance_exitError,_YargsInstance_detectLocale,_YargsInstance_emittedWarnings,_YargsInstance_exitProcess,_YargsInstance_frozens,_YargsInstance_globalMiddleware,_YargsInstance_groups,_YargsInstance_hasOutput,_YargsInstance_helpOpt,_YargsInstance_isGlobalContext,_YargsInstance_logger,_YargsInstance_output,_YargsInstance_options,_YargsInstance_parentRequire,_YargsInstance_parserConfig,_YargsInstance_parseFn,_YargsInstance_parseContext,_YargsInstance_pkgs,_YargsInstance_preservedGroups,_YargsInstance_processArgs,_YargsInstance_recommendCommands,_YargsInstance_shim,_YargsInstance_strict,_YargsInstance_strictCommands,_YargsInstance_strictOptions,_YargsInstance_usage,_YargsInstance_usageConfig,_YargsInstance_versionOpt,_YargsInstance_validation;function YargsFactory(l){return(d=[],f=l.process.cwd(),m)=>{let te=new YargsInstance(d,f,m,l);return Object.defineProperty(te,"argv",{get:()=>te.parse(),enumerable:!0}),te.help(),te.version(),te}}const kCopyDoubleDash=Symbol(`copyDoubleDash`),kCreateLogger=Symbol(`copyDoubleDash`),kDeleteFromParserHintObject=Symbol(`deleteFromParserHintObject`),kEmitWarning=Symbol(`emitWarning`),kFreeze=Symbol(`freeze`),kGetDollarZero=Symbol(`getDollarZero`),kGetParserConfiguration=Symbol(`getParserConfiguration`),kGetUsageConfiguration=Symbol(`getUsageConfiguration`),kGuessLocale=Symbol(`guessLocale`),kGuessVersion=Symbol(`guessVersion`),kParsePositionalNumbers=Symbol(`parsePositionalNumbers`),kPkgUp=Symbol(`pkgUp`),kPopulateParserHintArray=Symbol(`populateParserHintArray`),kPopulateParserHintSingleValueDictionary=Symbol(`populateParserHintSingleValueDictionary`),kPopulateParserHintArrayDictionary=Symbol(`populateParserHintArrayDictionary`),kPopulateParserHintDictionary=Symbol(`populateParserHintDictionary`),kSanitizeKey=Symbol(`sanitizeKey`),kSetKey=Symbol(`setKey`),kUnfreeze=Symbol(`unfreeze`),kValidateAsync=Symbol(`validateAsync`),kGetCommandInstance=Symbol(`getCommandInstance`),kGetContext=Symbol(`getContext`),kGetHasOutput=Symbol(`getHasOutput`),kGetLoggerInstance=Symbol(`getLoggerInstance`),kGetParseContext=Symbol(`getParseContext`),kGetUsageInstance=Symbol(`getUsageInstance`),kGetValidationInstance=Symbol(`getValidationInstance`),kHasParseCallback=Symbol(`hasParseCallback`),kIsGlobalContext=Symbol(`isGlobalContext`),kPostProcess=Symbol(`postProcess`),kRebase=Symbol(`rebase`),kReset=Symbol(`reset`),kRunYargsParserAndExecuteCommands=Symbol(`runYargsParserAndExecuteCommands`),kRunValidation=Symbol(`runValidation`),kSetHasOutput=Symbol(`setHasOutput`),kTrackManuallySetKeys=Symbol(`kTrackManuallySetKeys`),DEFAULT_LOCALE=`en_US`;var YargsInstance=class{constructor(l=[],d,f,m){this.customScriptName=!1,this.parsed=!1,_YargsInstance_command.set(this,void 0),_YargsInstance_cwd.set(this,void 0),_YargsInstance_context.set(this,{commands:[],fullCommands:[]}),_YargsInstance_completion.set(this,null),_YargsInstance_completionCommand.set(this,null),_YargsInstance_defaultShowHiddenOpt.set(this,`show-hidden`),_YargsInstance_exitError.set(this,null),_YargsInstance_detectLocale.set(this,!0),_YargsInstance_emittedWarnings.set(this,{}),_YargsInstance_exitProcess.set(this,!0),_YargsInstance_frozens.set(this,[]),_YargsInstance_globalMiddleware.set(this,void 0),_YargsInstance_groups.set(this,{}),_YargsInstance_hasOutput.set(this,!1),_YargsInstance_helpOpt.set(this,null),_YargsInstance_isGlobalContext.set(this,!0),_YargsInstance_logger.set(this,void 0),_YargsInstance_output.set(this,``),_YargsInstance_options.set(this,void 0),_YargsInstance_parentRequire.set(this,void 0),_YargsInstance_parserConfig.set(this,{}),_YargsInstance_parseFn.set(this,null),_YargsInstance_parseContext.set(this,null),_YargsInstance_pkgs.set(this,{}),_YargsInstance_preservedGroups.set(this,{}),_YargsInstance_processArgs.set(this,void 0),_YargsInstance_recommendCommands.set(this,!1),_YargsInstance_shim.set(this,void 0),_YargsInstance_strict.set(this,!1),_YargsInstance_strictCommands.set(this,!1),_YargsInstance_strictOptions.set(this,!1),_YargsInstance_usage.set(this,void 0),_YargsInstance_usageConfig.set(this,{}),_YargsInstance_versionOpt.set(this,null),_YargsInstance_validation.set(this,void 0),__classPrivateFieldSet(this,_YargsInstance_shim,m,`f`),__classPrivateFieldSet(this,_YargsInstance_processArgs,l,`f`),__classPrivateFieldSet(this,_YargsInstance_cwd,d,`f`),__classPrivateFieldSet(this,_YargsInstance_parentRequire,f,`f`),__classPrivateFieldSet(this,_YargsInstance_globalMiddleware,new GlobalMiddleware(this),`f`),this.$0=this[kGetDollarZero](),this[kReset](),__classPrivateFieldSet(this,_YargsInstance_command,__classPrivateFieldGet(this,_YargsInstance_command,`f`),`f`),__classPrivateFieldSet(this,_YargsInstance_usage,__classPrivateFieldGet(this,_YargsInstance_usage,`f`),`f`),__classPrivateFieldSet(this,_YargsInstance_validation,__classPrivateFieldGet(this,_YargsInstance_validation,`f`),`f`),__classPrivateFieldSet(this,_YargsInstance_options,__classPrivateFieldGet(this,_YargsInstance_options,`f`),`f`),__classPrivateFieldGet(this,_YargsInstance_options,`f`).showHiddenOpt=__classPrivateFieldGet(this,_YargsInstance_defaultShowHiddenOpt,`f`),__classPrivateFieldSet(this,_YargsInstance_logger,this[kCreateLogger](),`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`).y18n.setLocale(DEFAULT_LOCALE)}addHelpOpt(l,d){let f=`help`;return argsert(`[string|boolean] [string]`,[l,d],arguments.length),__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)&&(this[kDeleteFromParserHintObject](__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)),__classPrivateFieldSet(this,_YargsInstance_helpOpt,null,`f`)),l===!1&&d===void 0?this:(__classPrivateFieldSet(this,_YargsInstance_helpOpt,typeof l==`string`?l:`help`,`f`),this.boolean(__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)),this.describe(__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`),d||__classPrivateFieldGet(this,_YargsInstance_usage,`f`).deferY18nLookup(`Show help`)),this)}help(l,d){return this.addHelpOpt(l,d)}addShowHiddenOpt(l,d){if(argsert(`[string|boolean] [string]`,[l,d],arguments.length),l===!1&&d===void 0)return this;let f=typeof l==`string`?l:__classPrivateFieldGet(this,_YargsInstance_defaultShowHiddenOpt,`f`);return this.boolean(f),this.describe(f,d||__classPrivateFieldGet(this,_YargsInstance_usage,`f`).deferY18nLookup(`Show hidden options`)),__classPrivateFieldGet(this,_YargsInstance_options,`f`).showHiddenOpt=f,this}showHidden(l,d){return this.addShowHiddenOpt(l,d)}alias(l,d){return argsert(`<object|string|array> [string|array]`,[l,d],arguments.length),this[kPopulateParserHintArrayDictionary](this.alias.bind(this),`alias`,l,d),this}array(l){return argsert(`<array|string>`,[l],arguments.length),this[kPopulateParserHintArray](`array`,l),this[kTrackManuallySetKeys](l),this}boolean(l){return argsert(`<array|string>`,[l],arguments.length),this[kPopulateParserHintArray](`boolean`,l),this[kTrackManuallySetKeys](l),this}check(l,d){return argsert(`<function> [boolean]`,[l,d],arguments.length),this.middleware((d,f)=>maybeAsyncResult(()=>l(d,f.getOptions()),f=>(f?(typeof f==`string`||f instanceof Error)&&__classPrivateFieldGet(this,_YargsInstance_usage,`f`).fail(f.toString(),f):__classPrivateFieldGet(this,_YargsInstance_usage,`f`).fail(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).y18n.__(`Argument check failed: %s`,l.toString())),d),l=>(__classPrivateFieldGet(this,_YargsInstance_usage,`f`).fail(l.message?l.message:l.toString(),l),d)),!1,d),this}choices(l,d){return argsert(`<object|string|array> [string|array]`,[l,d],arguments.length),this[kPopulateParserHintArrayDictionary](this.choices.bind(this),`choices`,l,d),this}coerce(l,d){if(argsert(`<object|string|array> [function]`,[l,d],arguments.length),Array.isArray(l)){if(!d)throw new YError(`coerce callback must be provided`);for(let f of l)this.coerce(f,d);return this}else if(typeof l==`object`){for(let d of Object.keys(l))this.coerce(d,l[d]);return this}if(!d)throw new YError(`coerce callback must be provided`);let f=l;return __classPrivateFieldGet(this,_YargsInstance_options,`f`).key[f]=!0,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).addCoerceMiddleware((l,m)=>{var te;let re=m.getAliases()[f]??[],ie=[f,...re].filter(d=>Object.prototype.hasOwnProperty.call(l,d));return ie.length===0?l:maybeAsyncResult(()=>d(l[ie[0]]),d=>(ie.forEach(f=>{l[f]=d}),l),l=>{throw new YError(l.message)})},f),this}conflicts(l,d){return argsert(`<string|object> [string|array]`,[l,d],arguments.length),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).conflicts(l,d),this}config(l=`config`,d,f){return argsert(`[object|string] [string|function] [function]`,[l,d,f],arguments.length),typeof l==`object`&&!Array.isArray(l)?(l=applyExtends(l,__classPrivateFieldGet(this,_YargsInstance_cwd,`f`),this[kGetParserConfiguration]()[`deep-merge-config`]||!1,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects=(__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects||[]).concat(l),this):(typeof d==`function`&&(f=d,d=void 0),this.describe(l,d||__classPrivateFieldGet(this,_YargsInstance_usage,`f`).deferY18nLookup(`Path to JSON config file`)),(Array.isArray(l)?l:[l]).forEach(l=>{__classPrivateFieldGet(this,_YargsInstance_options,`f`).config[l]=f||!0}),this)}completion(l,d,f){return argsert(`[string] [string|boolean|function] [function]`,[l,d,f],arguments.length),typeof d==`function`&&(f=d,d=void 0),__classPrivateFieldSet(this,_YargsInstance_completionCommand,l||__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)||`completion`,`f`),!d&&d!==!1&&(d=`generate completion script`),this.command(__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`),d),f&&__classPrivateFieldGet(this,_YargsInstance_completion,`f`).registerFunction(f),this}command(l,d,f,m,te,re){return argsert(`<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]`,[l,d,f,m,te,re],arguments.length),__classPrivateFieldGet(this,_YargsInstance_command,`f`).addHandler(l,d,f,m,te,re),this}commands(l,d,f,m,te,re){return this.command(l,d,f,m,te,re)}commandDir(l,d){argsert(`<string> [object]`,[l,d],arguments.length);let f=__classPrivateFieldGet(this,_YargsInstance_parentRequire,`f`)||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).require;return __classPrivateFieldGet(this,_YargsInstance_command,`f`).addDirectory(l,f,__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getCallerFile(),d),this}count(l){return argsert(`<array|string>`,[l],arguments.length),this[kPopulateParserHintArray](`count`,l),this[kTrackManuallySetKeys](l),this}default(l,d,f){return argsert(`<object|string|array> [*] [string]`,[l,d,f],arguments.length),f&&(assertSingleKey(l,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),__classPrivateFieldGet(this,_YargsInstance_options,`f`).defaultDescription[l]=f),typeof d==`function`&&(assertSingleKey(l,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),__classPrivateFieldGet(this,_YargsInstance_options,`f`).defaultDescription[l]||(__classPrivateFieldGet(this,_YargsInstance_options,`f`).defaultDescription[l]=__classPrivateFieldGet(this,_YargsInstance_usage,`f`).functionDescription(d)),d=d.call()),this[kPopulateParserHintSingleValueDictionary](this.default.bind(this),`default`,l,d),this}defaults(l,d,f){return this.default(l,d,f)}demandCommand(l=1,d,f,m){return argsert(`[number] [number|string] [string|null|undefined] [string|null|undefined]`,[l,d,f,m],arguments.length),typeof d!=`number`&&(f=d,d=1/0),this.global(`_`,!1),__classPrivateFieldGet(this,_YargsInstance_options,`f`).demandedCommands._={min:l,max:d,minMsg:f,maxMsg:m},this}demand(l,d,f){return Array.isArray(d)?(d.forEach(l=>{assertNotStrictEqual(f,!0,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),this.demandOption(l,f)}),d=1/0):typeof d!=`number`&&(f=d,d=1/0),typeof l==`number`?(assertNotStrictEqual(f,!0,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),this.demandCommand(l,d,f,f)):Array.isArray(l)?l.forEach(l=>{assertNotStrictEqual(f,!0,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),this.demandOption(l,f)}):typeof f==`string`?this.demandOption(l,f):(f===!0||f===void 0)&&this.demandOption(l),this}demandOption(l,d){return argsert(`<object|string|array> [string]`,[l,d],arguments.length),this[kPopulateParserHintSingleValueDictionary](this.demandOption.bind(this),`demandedOptions`,l,d),this}deprecateOption(l,d){return argsert(`<string> [string|boolean]`,[l,d],arguments.length),__classPrivateFieldGet(this,_YargsInstance_options,`f`).deprecatedOptions[l]=d,this}describe(l,d){return argsert(`<object|string|array> [string]`,[l,d],arguments.length),this[kSetKey](l,!0),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).describe(l,d),this}detectLocale(l){return argsert(`<boolean>`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_detectLocale,l,`f`),this}env(l){return argsert(`[string|boolean]`,[l],arguments.length),l===!1?delete __classPrivateFieldGet(this,_YargsInstance_options,`f`).envPrefix:__classPrivateFieldGet(this,_YargsInstance_options,`f`).envPrefix=l||``,this}epilogue(l){return argsert(`<string>`,[l],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).epilog(l),this}epilog(l){return this.epilogue(l)}example(l,d){return argsert(`<string|array> [string]`,[l,d],arguments.length),Array.isArray(l)?l.forEach(l=>this.example(...l)):__classPrivateFieldGet(this,_YargsInstance_usage,`f`).example(l,d),this}exit(l,d){__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,`f`),__classPrivateFieldSet(this,_YargsInstance_exitError,d,`f`),__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.exit(l)}exitProcess(l=!0){return argsert(`[boolean]`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_exitProcess,l,`f`),this}fail(l){if(argsert(`<function|boolean>`,[l],arguments.length),typeof l==`boolean`&&l!==!1)throw new YError(`Invalid first argument. Expected function or boolean 'false'`);return __classPrivateFieldGet(this,_YargsInstance_usage,`f`).failFn(l),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(l,d){return argsert(`<array> [function]`,[l,d],arguments.length),d?__classPrivateFieldGet(this,_YargsInstance_completion,`f`).getCompletion(l,d):new Promise((d,f)=>{__classPrivateFieldGet(this,_YargsInstance_completion,`f`).getCompletion(l,(l,m)=>{l?f(l):d(m)})})}getDemandedOptions(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_options,`f`).demandedOptions}getDemandedCommands(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_options,`f`).demandedCommands}getDeprecatedOptions(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_options,`f`).deprecatedOptions}getDetectLocale(){return __classPrivateFieldGet(this,_YargsInstance_detectLocale,`f`)}getExitProcess(){return __classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)}getGroups(){return Object.assign({},__classPrivateFieldGet(this,_YargsInstance_groups,`f`),__classPrivateFieldGet(this,_YargsInstance_preservedGroups,`f`))}getHelp(){if(__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,`f`),!__classPrivateFieldGet(this,_YargsInstance_usage,`f`).hasCachedHelpMessage()){if(!this.parsed){let l=this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this,_YargsInstance_processArgs,`f`),void 0,void 0,0,!0);if(isPromise$1(l))return l.then(()=>__classPrivateFieldGet(this,_YargsInstance_usage,`f`).help())}let l=__classPrivateFieldGet(this,_YargsInstance_command,`f`).runDefaultBuilderOn(this);if(isPromise$1(l))return l.then(()=>__classPrivateFieldGet(this,_YargsInstance_usage,`f`).help())}return Promise.resolve(__classPrivateFieldGet(this,_YargsInstance_usage,`f`).help())}getOptions(){return __classPrivateFieldGet(this,_YargsInstance_options,`f`)}getStrict(){return __classPrivateFieldGet(this,_YargsInstance_strict,`f`)}getStrictCommands(){return __classPrivateFieldGet(this,_YargsInstance_strictCommands,`f`)}getStrictOptions(){return __classPrivateFieldGet(this,_YargsInstance_strictOptions,`f`)}global(l,d){return argsert(`<string|array> [boolean]`,[l,d],arguments.length),l=[].concat(l),d===!1?l.forEach(l=>{__classPrivateFieldGet(this,_YargsInstance_options,`f`).local.includes(l)||__classPrivateFieldGet(this,_YargsInstance_options,`f`).local.push(l)}):__classPrivateFieldGet(this,_YargsInstance_options,`f`).local=__classPrivateFieldGet(this,_YargsInstance_options,`f`).local.filter(d=>l.indexOf(d)===-1),this}group(l,d){argsert(`<string|array> <string>`,[l,d],arguments.length);let f=__classPrivateFieldGet(this,_YargsInstance_preservedGroups,`f`)[d]||__classPrivateFieldGet(this,_YargsInstance_groups,`f`)[d];__classPrivateFieldGet(this,_YargsInstance_preservedGroups,`f`)[d]&&delete __classPrivateFieldGet(this,_YargsInstance_preservedGroups,`f`)[d];let m={};return __classPrivateFieldGet(this,_YargsInstance_groups,`f`)[d]=(f||[]).concat(l).filter(l=>m[l]?!1:m[l]=!0),this}hide(l){return argsert(`<string>`,[l],arguments.length),__classPrivateFieldGet(this,_YargsInstance_options,`f`).hiddenOptions.push(l),this}implies(l,d){return argsert(`<string|object> [number|string|array]`,[l,d],arguments.length),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).implies(l,d),this}locale(l){return argsert(`[string]`,[l],arguments.length),l===void 0?(this[kGuessLocale](),__classPrivateFieldGet(this,_YargsInstance_shim,`f`).y18n.getLocale()):(__classPrivateFieldSet(this,_YargsInstance_detectLocale,!1,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`).y18n.setLocale(l),this)}middleware(l,d,f){return __classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).addMiddleware(l,!!d,f)}nargs(l,d){return argsert(`<string|object|array> [number]`,[l,d],arguments.length),this[kPopulateParserHintSingleValueDictionary](this.nargs.bind(this),`narg`,l,d),this}normalize(l){return argsert(`<array|string>`,[l],arguments.length),this[kPopulateParserHintArray](`normalize`,l),this}number(l){return argsert(`<array|string>`,[l],arguments.length),this[kPopulateParserHintArray](`number`,l),this[kTrackManuallySetKeys](l),this}option(l,d){if(argsert(`<string|object> [object]`,[l,d],arguments.length),typeof l==`object`)Object.keys(l).forEach(d=>{this.options(d,l[d])});else{typeof d!=`object`&&(d={}),this[kTrackManuallySetKeys](l),__classPrivateFieldGet(this,_YargsInstance_versionOpt,`f`)&&(l===`version`||d?.alias===`version`)&&this[kEmitWarning]([`"version" is a reserved word.`,`Please do one of the following:`,'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)",`- Use a different option key`,`https://yargs.js.org/docs/#api-reference-version`].join(`
104
104
  `),void 0,`versionWarning`),__classPrivateFieldGet(this,_YargsInstance_options,`f`).key[l]=!0,d.alias&&this.alias(l,d.alias);let f=d.deprecate||d.deprecated;f&&this.deprecateOption(l,f);let m=d.demand||d.required||d.require;m&&this.demand(l,m),d.demandOption&&this.demandOption(l,typeof d.demandOption==`string`?d.demandOption:void 0),d.conflicts&&this.conflicts(l,d.conflicts),`default`in d&&this.default(l,d.default),d.implies!==void 0&&this.implies(l,d.implies),d.nargs!==void 0&&this.nargs(l,d.nargs),d.config&&this.config(l,d.configParser),d.normalize&&this.normalize(l),d.choices&&this.choices(l,d.choices),d.coerce&&this.coerce(l,d.coerce),d.group&&this.group(l,d.group),(d.boolean||d.type===`boolean`)&&(this.boolean(l),d.alias&&this.boolean(d.alias)),(d.array||d.type===`array`)&&(this.array(l),d.alias&&this.array(d.alias)),(d.number||d.type===`number`)&&(this.number(l),d.alias&&this.number(d.alias)),(d.string||d.type===`string`)&&(this.string(l),d.alias&&this.string(d.alias)),(d.count||d.type===`count`)&&this.count(l),typeof d.global==`boolean`&&this.global(l,d.global),d.defaultDescription&&(__classPrivateFieldGet(this,_YargsInstance_options,`f`).defaultDescription[l]=d.defaultDescription),d.skipValidation&&this.skipValidation(l);let te=d.describe||d.description||d.desc,re=__classPrivateFieldGet(this,_YargsInstance_usage,`f`).getDescriptions();(!Object.prototype.hasOwnProperty.call(re,l)||typeof te==`string`)&&this.describe(l,te),d.hidden&&this.hide(l),d.requiresArg&&this.requiresArg(l)}return this}options(l,d){return this.option(l,d)}parse(l,d,f){argsert(`[string|array] [function|boolean|object] [function]`,[l,d,f],arguments.length),this[kFreeze](),l===void 0&&(l=__classPrivateFieldGet(this,_YargsInstance_processArgs,`f`)),typeof d==`object`&&(__classPrivateFieldSet(this,_YargsInstance_parseContext,d,`f`),d=f),typeof d==`function`&&(__classPrivateFieldSet(this,_YargsInstance_parseFn,d,`f`),d=!1),d||__classPrivateFieldSet(this,_YargsInstance_processArgs,l,`f`),__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`)&&__classPrivateFieldSet(this,_YargsInstance_exitProcess,!1,`f`);let m=this[kRunYargsParserAndExecuteCommands](l,!!d),te=this.parsed;return __classPrivateFieldGet(this,_YargsInstance_completion,`f`).setParsed(this.parsed),isPromise$1(m)?m.then(l=>(__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`)&&__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`).call(this,__classPrivateFieldGet(this,_YargsInstance_exitError,`f`),l,__classPrivateFieldGet(this,_YargsInstance_output,`f`)),l)).catch(l=>{throw __classPrivateFieldGet(this,_YargsInstance_parseFn,`f`)&&__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`)(l,this.parsed.argv,__classPrivateFieldGet(this,_YargsInstance_output,`f`)),l}).finally(()=>{this[kUnfreeze](),this.parsed=te}):(__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`)&&__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`).call(this,__classPrivateFieldGet(this,_YargsInstance_exitError,`f`),m,__classPrivateFieldGet(this,_YargsInstance_output,`f`)),this[kUnfreeze](),this.parsed=te,m)}parseAsync(l,d,f){let m=this.parse(l,d,f);return isPromise$1(m)?m:Promise.resolve(m)}parseSync(l,d,f){let m=this.parse(l,d,f);if(isPromise$1(m))throw new YError(`.parseSync() must not be used with asynchronous builders, handlers, or middleware`);return m}parserConfiguration(l){return argsert(`<object>`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_parserConfig,l,`f`),this}pkgConf(l,d){argsert(`<string> [string]`,[l,d],arguments.length);let f=null,m=this[kPkgUp](d||__classPrivateFieldGet(this,_YargsInstance_cwd,`f`));return m[l]&&typeof m[l]==`object`&&(f=applyExtends(m[l],d||__classPrivateFieldGet(this,_YargsInstance_cwd,`f`),this[kGetParserConfiguration]()[`deep-merge-config`]||!1,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects=(__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects||[]).concat(f)),this}positional(l,d){argsert(`<string> <object>`,[l,d],arguments.length);let f=[`default`,`defaultDescription`,`implies`,`normalize`,`choices`,`conflicts`,`coerce`,`type`,`describe`,`desc`,`description`,`alias`];d=objFilter(d,(l,d)=>l===`type`&&![`string`,`number`,`boolean`].includes(d)?!1:f.includes(l));let m=__classPrivateFieldGet(this,_YargsInstance_context,`f`).fullCommands[__classPrivateFieldGet(this,_YargsInstance_context,`f`).fullCommands.length-1],te=m?__classPrivateFieldGet(this,_YargsInstance_command,`f`).cmdToParseOptions(m):{array:[],alias:{},default:{},demand:{}};return objectKeys(te).forEach(f=>{let m=te[f];Array.isArray(m)?m.indexOf(l)!==-1&&(d[f]=!0):m[l]&&!(f in d)&&(d[f]=m[l])}),this.group(l,__classPrivateFieldGet(this,_YargsInstance_usage,`f`).getPositionalGroupName()),this.option(l,d)}recommendCommands(l=!0){return argsert(`[boolean]`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_recommendCommands,l,`f`),this}required(l,d,f){return this.demand(l,d,f)}require(l,d,f){return this.demand(l,d,f)}requiresArg(l){return argsert(`<array|string|object> [number]`,[l],arguments.length),typeof l==`string`&&__classPrivateFieldGet(this,_YargsInstance_options,`f`).narg[l]||this[kPopulateParserHintSingleValueDictionary](this.requiresArg.bind(this),`narg`,l,NaN),this}showCompletionScript(l,d){return argsert(`[string] [string]`,[l,d],arguments.length),l||=this.$0,__classPrivateFieldGet(this,_YargsInstance_logger,`f`).log(__classPrivateFieldGet(this,_YargsInstance_completion,`f`).generateCompletionScript(l,d||__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)||`completion`)),this}showHelp(l){if(argsert(`[string|function]`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,`f`),!__classPrivateFieldGet(this,_YargsInstance_usage,`f`).hasCachedHelpMessage()){if(!this.parsed){let d=this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this,_YargsInstance_processArgs,`f`),void 0,void 0,0,!0);if(isPromise$1(d))return d.then(()=>{__classPrivateFieldGet(this,_YargsInstance_usage,`f`).showHelp(l)}),this}let d=__classPrivateFieldGet(this,_YargsInstance_command,`f`).runDefaultBuilderOn(this);if(isPromise$1(d))return d.then(()=>{__classPrivateFieldGet(this,_YargsInstance_usage,`f`).showHelp(l)}),this}return __classPrivateFieldGet(this,_YargsInstance_usage,`f`).showHelp(l),this}scriptName(l){return this.customScriptName=!0,this.$0=l,this}showHelpOnFail(l,d){return argsert(`[boolean|string] [string]`,[l,d],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).showHelpOnFail(l,d),this}showVersion(l){return argsert(`[string|function]`,[l],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).showVersion(l),this}skipValidation(l){return argsert(`<array|string>`,[l],arguments.length),this[kPopulateParserHintArray](`skipValidation`,l),this}strict(l){return argsert(`[boolean]`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_strict,l!==!1,`f`),this}strictCommands(l){return argsert(`[boolean]`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_strictCommands,l!==!1,`f`),this}strictOptions(l){return argsert(`[boolean]`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_strictOptions,l!==!1,`f`),this}string(l){return argsert(`<array|string>`,[l],arguments.length),this[kPopulateParserHintArray](`string`,l),this[kTrackManuallySetKeys](l),this}terminalWidth(){return argsert([],0),__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.stdColumns}updateLocale(l){return this.updateStrings(l)}updateStrings(l){return argsert(`<object>`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_detectLocale,!1,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`).y18n.updateLocale(l),this}usage(l,d,f,m){if(argsert(`<string|null|undefined> [string|boolean] [function|object] [function]`,[l,d,f,m],arguments.length),d!==void 0){if(assertNotStrictEqual(l,null,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),(l||``).match(/^\$0( |$)/))return this.command(l,d,f,m);throw new YError(`.usage() description must start with $0 if being used as alias for .command()`)}else return __classPrivateFieldGet(this,_YargsInstance_usage,`f`).usage(l),this}usageConfiguration(l){return argsert(`<object>`,[l],arguments.length),__classPrivateFieldSet(this,_YargsInstance_usageConfig,l,`f`),this}version(l,d,f){let m=`version`;if(argsert(`[boolean|string] [string] [string]`,[l,d,f],arguments.length),__classPrivateFieldGet(this,_YargsInstance_versionOpt,`f`)&&(this[kDeleteFromParserHintObject](__classPrivateFieldGet(this,_YargsInstance_versionOpt,`f`)),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).version(void 0),__classPrivateFieldSet(this,_YargsInstance_versionOpt,null,`f`)),arguments.length===0)f=this[kGuessVersion](),l=m;else if(arguments.length===1){if(l===!1)return this;f=l,l=m}else arguments.length===2&&(f=d,d=void 0);return __classPrivateFieldSet(this,_YargsInstance_versionOpt,typeof l==`string`?l:m,`f`),d||=__classPrivateFieldGet(this,_YargsInstance_usage,`f`).deferY18nLookup(`Show version number`),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).version(f||void 0),this.boolean(__classPrivateFieldGet(this,_YargsInstance_versionOpt,`f`)),this.describe(__classPrivateFieldGet(this,_YargsInstance_versionOpt,`f`),d),this}wrap(l){return argsert(`<number|null|undefined>`,[l],arguments.length),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).wrap(l),this}[(_YargsInstance_command=new WeakMap,_YargsInstance_cwd=new WeakMap,_YargsInstance_context=new WeakMap,_YargsInstance_completion=new WeakMap,_YargsInstance_completionCommand=new WeakMap,_YargsInstance_defaultShowHiddenOpt=new WeakMap,_YargsInstance_exitError=new WeakMap,_YargsInstance_detectLocale=new WeakMap,_YargsInstance_emittedWarnings=new WeakMap,_YargsInstance_exitProcess=new WeakMap,_YargsInstance_frozens=new WeakMap,_YargsInstance_globalMiddleware=new WeakMap,_YargsInstance_groups=new WeakMap,_YargsInstance_hasOutput=new WeakMap,_YargsInstance_helpOpt=new WeakMap,_YargsInstance_isGlobalContext=new WeakMap,_YargsInstance_logger=new WeakMap,_YargsInstance_output=new WeakMap,_YargsInstance_options=new WeakMap,_YargsInstance_parentRequire=new WeakMap,_YargsInstance_parserConfig=new WeakMap,_YargsInstance_parseFn=new WeakMap,_YargsInstance_parseContext=new WeakMap,_YargsInstance_pkgs=new WeakMap,_YargsInstance_preservedGroups=new WeakMap,_YargsInstance_processArgs=new WeakMap,_YargsInstance_recommendCommands=new WeakMap,_YargsInstance_shim=new WeakMap,_YargsInstance_strict=new WeakMap,_YargsInstance_strictCommands=new WeakMap,_YargsInstance_strictOptions=new WeakMap,_YargsInstance_usage=new WeakMap,_YargsInstance_usageConfig=new WeakMap,_YargsInstance_versionOpt=new WeakMap,_YargsInstance_validation=new WeakMap,kCopyDoubleDash)](l){if(!l._||!l[`--`])return l;l._.push.apply(l._,l[`--`]);try{delete l[`--`]}catch{}return l}[kCreateLogger](){return{log:(...l)=>{this[kHasParseCallback]()||console.log(...l),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,`f`),__classPrivateFieldGet(this,_YargsInstance_output,`f`).length&&__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,`f`)+`
105
105
  `,`f`),__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,`f`)+l.join(` `),`f`)},error:(...l)=>{this[kHasParseCallback]()||console.error(...l),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,`f`),__classPrivateFieldGet(this,_YargsInstance_output,`f`).length&&__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,`f`)+`
106
- `,`f`),__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,`f`)+l.join(` `),`f`)}}}[kDeleteFromParserHintObject](l){objectKeys(__classPrivateFieldGet(this,_YargsInstance_options,`f`)).forEach(d=>{if((l=>l===`configObjects`)(d))return;let f=__classPrivateFieldGet(this,_YargsInstance_options,`f`)[d];Array.isArray(f)?f.includes(l)&&f.splice(f.indexOf(l),1):typeof f==`object`&&delete f[l]}),delete __classPrivateFieldGet(this,_YargsInstance_usage,`f`).getDescriptions()[l]}[kEmitWarning](l,d,f){__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,`f`)[f]||(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.emitWarning(l,d),__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,`f`)[f]=!0)}[kFreeze](){__classPrivateFieldGet(this,_YargsInstance_frozens,`f`).push({options:__classPrivateFieldGet(this,_YargsInstance_options,`f`),configObjects:__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`),groups:__classPrivateFieldGet(this,_YargsInstance_groups,`f`),strict:__classPrivateFieldGet(this,_YargsInstance_strict,`f`),strictCommands:__classPrivateFieldGet(this,_YargsInstance_strictCommands,`f`),strictOptions:__classPrivateFieldGet(this,_YargsInstance_strictOptions,`f`),completionCommand:__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`),output:__classPrivateFieldGet(this,_YargsInstance_output,`f`),exitError:__classPrivateFieldGet(this,_YargsInstance_exitError,`f`),hasOutput:__classPrivateFieldGet(this,_YargsInstance_hasOutput,`f`),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`),parseContext:__classPrivateFieldGet(this,_YargsInstance_parseContext,`f`)}),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).freeze(),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).freeze(),__classPrivateFieldGet(this,_YargsInstance_command,`f`).freeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).freeze()}[kGetDollarZero](){let l=``,d;return d=/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.argv()[0])?__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.argv().slice(1,2):__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.argv().slice(0,1),l=d.map(l=>{let d=this[kRebase](__classPrivateFieldGet(this,_YargsInstance_cwd,`f`),l);return l.match(/^(\/|([a-zA-Z]:)?\\)/)&&d.length<l.length?d:l}).join(` `).trim(),__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`_`)&&__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getProcessArgvBin()===__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`_`)&&(l=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`_`).replace(`${__classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.dirname(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.execPath())}/`,``)),l}[kGetParserConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_parserConfig,`f`)}[kGetUsageConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_usageConfig,`f`)}[kGuessLocale](){if(!__classPrivateFieldGet(this,_YargsInstance_detectLocale,`f`))return;let l=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LC_ALL`)||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LC_MESSAGES`)||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LANG`)||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LANGUAGE`)||`en_US`;this.locale(l.replace(/[.:].*/,``))}[kGuessVersion](){return this[kPkgUp]().version||`unknown`}[kParsePositionalNumbers](l){let d=l[`--`]?l[`--`]:l._;for(let l=0,f;(f=d[l])!==void 0;l++)__classPrivateFieldGet(this,_YargsInstance_shim,`f`).Parser.looksLikeNumber(f)&&Number.isSafeInteger(Math.floor(parseFloat(`${f}`)))&&(d[l]=Number(f));return l}[kPkgUp](l){let d=l||`*`;if(__classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d])return __classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d];let f={};try{let d=l||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).mainFilename;__classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.extname(d)&&(d=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.dirname(d));let m=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).findUp(d,(l,d)=>{if(d.includes(`package.json`))return`package.json`});assertNotStrictEqual(m,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),f=JSON.parse(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).readFileSync(m,`utf8`))}catch{}return __classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d]=f||{},__classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d]}[kPopulateParserHintArray](l,d){d=[].concat(d),d.forEach(d=>{d=this[kSanitizeKey](d),__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l].push(d)})}[kPopulateParserHintSingleValueDictionary](l,d,f,m){this[kPopulateParserHintDictionary](l,d,f,m,(l,d,f)=>{__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l][d]=f})}[kPopulateParserHintArrayDictionary](l,d,f,m){this[kPopulateParserHintDictionary](l,d,f,m,(l,d,f)=>{__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l][d]=(__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l][d]||[]).concat(f)})}[kPopulateParserHintDictionary](l,d,f,m,te){if(Array.isArray(f))f.forEach(d=>{l(d,m)});else if((l=>typeof l==`object`)(f))for(let d of objectKeys(f))l(d,f[d]);else te(d,this[kSanitizeKey](f),m)}[kSanitizeKey](l){return l===`__proto__`?`___proto___`:l}[kSetKey](l,d){return this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this),`key`,l,d),this}[kUnfreeze](){var l,d,f,m,te,re,ie,ae,oe,se,ce,le;let ue=__classPrivateFieldGet(this,_YargsInstance_frozens,`f`).pop();assertNotStrictEqual(ue,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,`f`));let de;l=this,d=this,f=this,m=this,te=this,re=this,ie=this,ae=this,oe=this,se=this,ce=this,le=this,{options:{set value(d){__classPrivateFieldSet(l,_YargsInstance_options,d,`f`)}}.value,configObjects:de,exitProcess:{set value(l){__classPrivateFieldSet(d,_YargsInstance_exitProcess,l,`f`)}}.value,groups:{set value(l){__classPrivateFieldSet(f,_YargsInstance_groups,l,`f`)}}.value,output:{set value(l){__classPrivateFieldSet(m,_YargsInstance_output,l,`f`)}}.value,exitError:{set value(l){__classPrivateFieldSet(te,_YargsInstance_exitError,l,`f`)}}.value,hasOutput:{set value(l){__classPrivateFieldSet(re,_YargsInstance_hasOutput,l,`f`)}}.value,parsed:this.parsed,strict:{set value(l){__classPrivateFieldSet(ie,_YargsInstance_strict,l,`f`)}}.value,strictCommands:{set value(l){__classPrivateFieldSet(ae,_YargsInstance_strictCommands,l,`f`)}}.value,strictOptions:{set value(l){__classPrivateFieldSet(oe,_YargsInstance_strictOptions,l,`f`)}}.value,completionCommand:{set value(l){__classPrivateFieldSet(se,_YargsInstance_completionCommand,l,`f`)}}.value,parseFn:{set value(l){__classPrivateFieldSet(ce,_YargsInstance_parseFn,l,`f`)}}.value,parseContext:{set value(l){__classPrivateFieldSet(le,_YargsInstance_parseContext,l,`f`)}}.value}=ue,__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects=de,__classPrivateFieldGet(this,_YargsInstance_usage,`f`).unfreeze(),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unfreeze(),__classPrivateFieldGet(this,_YargsInstance_command,`f`).unfreeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).unfreeze()}[kValidateAsync](l,d){return maybeAsyncResult(d,d=>(l(d),d))}getInternalMethods(){return{getCommandInstance:this[kGetCommandInstance].bind(this),getContext:this[kGetContext].bind(this),getHasOutput:this[kGetHasOutput].bind(this),getLoggerInstance:this[kGetLoggerInstance].bind(this),getParseContext:this[kGetParseContext].bind(this),getParserConfiguration:this[kGetParserConfiguration].bind(this),getUsageConfiguration:this[kGetUsageConfiguration].bind(this),getUsageInstance:this[kGetUsageInstance].bind(this),getValidationInstance:this[kGetValidationInstance].bind(this),hasParseCallback:this[kHasParseCallback].bind(this),isGlobalContext:this[kIsGlobalContext].bind(this),postProcess:this[kPostProcess].bind(this),reset:this[kReset].bind(this),runValidation:this[kRunValidation].bind(this),runYargsParserAndExecuteCommands:this[kRunYargsParserAndExecuteCommands].bind(this),setHasOutput:this[kSetHasOutput].bind(this)}}[kGetCommandInstance](){return __classPrivateFieldGet(this,_YargsInstance_command,`f`)}[kGetContext](){return __classPrivateFieldGet(this,_YargsInstance_context,`f`)}[kGetHasOutput](){return __classPrivateFieldGet(this,_YargsInstance_hasOutput,`f`)}[kGetLoggerInstance](){return __classPrivateFieldGet(this,_YargsInstance_logger,`f`)}[kGetParseContext](){return __classPrivateFieldGet(this,_YargsInstance_parseContext,`f`)||{}}[kGetUsageInstance](){return __classPrivateFieldGet(this,_YargsInstance_usage,`f`)}[kGetValidationInstance](){return __classPrivateFieldGet(this,_YargsInstance_validation,`f`)}[kHasParseCallback](){return!!__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`)}[kIsGlobalContext](){return __classPrivateFieldGet(this,_YargsInstance_isGlobalContext,`f`)}[kPostProcess](l,d,f,m){return f||isPromise$1(l)?l:(d||(l=this[kCopyDoubleDash](l)),(this[kGetParserConfiguration]()[`parse-positional-numbers`]||this[kGetParserConfiguration]()[`parse-positional-numbers`]===void 0)&&(l=this[kParsePositionalNumbers](l)),m&&(l=applyMiddleware(l,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).getMiddleware(),!1)),l)}[kReset](l={}){__classPrivateFieldSet(this,_YargsInstance_options,__classPrivateFieldGet(this,_YargsInstance_options,`f`)||{},`f`);let d={};d.local=__classPrivateFieldGet(this,_YargsInstance_options,`f`).local||[],d.configObjects=__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects||[];let f={};return d.local.forEach(d=>{f[d]=!0,(l[d]||[]).forEach(l=>{f[l]=!0})}),Object.assign(__classPrivateFieldGet(this,_YargsInstance_preservedGroups,`f`),Object.keys(__classPrivateFieldGet(this,_YargsInstance_groups,`f`)).reduce((l,d)=>{let m=__classPrivateFieldGet(this,_YargsInstance_groups,`f`)[d].filter(l=>!(l in f));return m.length>0&&(l[d]=m),l},{})),__classPrivateFieldSet(this,_YargsInstance_groups,{},`f`),[`array`,`boolean`,`string`,`skipValidation`,`count`,`normalize`,`number`,`hiddenOptions`].forEach(l=>{d[l]=(__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l]||[]).filter(l=>!f[l])}),[`narg`,`key`,`alias`,`default`,`defaultDescription`,`config`,`choices`,`demandedOptions`,`demandedCommands`,`deprecatedOptions`].forEach(l=>{d[l]=objFilter(__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l],l=>!f[l])}),d.envPrefix=__classPrivateFieldGet(this,_YargsInstance_options,`f`).envPrefix,__classPrivateFieldSet(this,_YargsInstance_options,d,`f`),__classPrivateFieldSet(this,_YargsInstance_usage,__classPrivateFieldGet(this,_YargsInstance_usage,`f`)?__classPrivateFieldGet(this,_YargsInstance_usage,`f`).reset(f):usage(this,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldSet(this,_YargsInstance_validation,__classPrivateFieldGet(this,_YargsInstance_validation,`f`)?__classPrivateFieldGet(this,_YargsInstance_validation,`f`).reset(f):validation(this,__classPrivateFieldGet(this,_YargsInstance_usage,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldSet(this,_YargsInstance_command,__classPrivateFieldGet(this,_YargsInstance_command,`f`)?__classPrivateFieldGet(this,_YargsInstance_command,`f`).reset():command(__classPrivateFieldGet(this,_YargsInstance_usage,`f`),__classPrivateFieldGet(this,_YargsInstance_validation,`f`),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldGet(this,_YargsInstance_completion,`f`)||__classPrivateFieldSet(this,_YargsInstance_completion,completion(this,__classPrivateFieldGet(this,_YargsInstance_usage,`f`),__classPrivateFieldGet(this,_YargsInstance_command,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).reset(),__classPrivateFieldSet(this,_YargsInstance_completionCommand,null,`f`),__classPrivateFieldSet(this,_YargsInstance_output,``,`f`),__classPrivateFieldSet(this,_YargsInstance_exitError,null,`f`),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!1,`f`),this.parsed=!1,this}[kRebase](l,d){return __classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.relative(l,d)}[kRunYargsParserAndExecuteCommands](l,d,f,m=0,te=!1){var re,ie,ae,oe;let se=!!f||te;l||=__classPrivateFieldGet(this,_YargsInstance_processArgs,`f`),__classPrivateFieldGet(this,_YargsInstance_options,`f`).__=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).y18n.__,__classPrivateFieldGet(this,_YargsInstance_options,`f`).configuration=this[kGetParserConfiguration]();let ce=!!__classPrivateFieldGet(this,_YargsInstance_options,`f`).configuration[`populate--`],le=Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,`f`).configuration,{"populate--":!0}),ue=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).Parser.detailed(l,Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,`f`),{configuration:{"parse-positional-numbers":!1,...le}})),de=Object.assign(ue.argv,__classPrivateFieldGet(this,_YargsInstance_parseContext,`f`)),fe,pe=ue.aliases,me=!1,he=!1;Object.keys(de).forEach(l=>{l===__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)&&de[l]?me=!0:l===__classPrivateFieldGet(this,_YargsInstance_versionOpt,`f`)&&de[l]&&(he=!0)}),de.$0=this.$0,this.parsed=ue,m===0&&__classPrivateFieldGet(this,_YargsInstance_usage,`f`).clearCachedHelpMessage();try{if(this[kGuessLocale](),d)return this[kPostProcess](de,ce,!!f,!1);__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)&&[__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)].concat(pe[__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)]||[]).filter(l=>l.length>1).includes(``+de._[de._.length-1])&&(de._.pop(),me=!0),__classPrivateFieldSet(this,_YargsInstance_isGlobalContext,!1,`f`);let re=__classPrivateFieldGet(this,_YargsInstance_command,`f`).getCommands(),ie=__classPrivateFieldGet(this,_YargsInstance_completion,`f`)?.completionKey?[__classPrivateFieldGet(this,_YargsInstance_completion,`f`)?.completionKey,...this.getAliases()[__classPrivateFieldGet(this,_YargsInstance_completion,`f`)?.completionKey]??[]].some(l=>Object.prototype.hasOwnProperty.call(de,l)):!1,ae=me||ie||te;if(de._.length){if(re.length){let l;for(let d=m||0,ie;de._[d]!==void 0;d++)if(ie=String(de._[d]),re.includes(ie)&&ie!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)){let l=__classPrivateFieldGet(this,_YargsInstance_command,`f`).runCommand(ie,this,ue,d+1,te,me||he||te);return this[kPostProcess](l,ce,!!f,!1)}else if(!l&&ie!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)){l=ie;break}!__classPrivateFieldGet(this,_YargsInstance_command,`f`).hasDefaultCommand()&&__classPrivateFieldGet(this,_YargsInstance_recommendCommands,`f`)&&l&&!ae&&__classPrivateFieldGet(this,_YargsInstance_validation,`f`).recommendCommands(l,re)}__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)&&de._.includes(__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`))&&!ie&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,_YargsInstance_command,`f`).hasDefaultCommand()&&!ae){let l=__classPrivateFieldGet(this,_YargsInstance_command,`f`).runCommand(null,this,ue,0,te,me||he||te);return this[kPostProcess](l,ce,!!f,!1)}if(ie){__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),l=[].concat(l);let d=l.slice(l.indexOf(`--${__classPrivateFieldGet(this,_YargsInstance_completion,`f`).completionKey}`)+1);return __classPrivateFieldGet(this,_YargsInstance_completion,`f`).getCompletion(d,(l,d)=>{if(l)throw new YError(l.message);(d||[]).forEach(l=>{__classPrivateFieldGet(this,_YargsInstance_logger,`f`).log(l)}),this.exit(0)}),this[kPostProcess](de,!ce,!!f,!1)}if(__classPrivateFieldGet(this,_YargsInstance_hasOutput,`f`)||(me?(__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),se=!0,this.showHelp(l=>{__classPrivateFieldGet(this,_YargsInstance_logger,`f`).log(l),this.exit(0)})):he&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),se=!0,__classPrivateFieldGet(this,_YargsInstance_usage,`f`).showVersion(`log`),this.exit(0))),!se&&__classPrivateFieldGet(this,_YargsInstance_options,`f`).skipValidation.length>0&&(se=Object.keys(de).some(l=>__classPrivateFieldGet(this,_YargsInstance_options,`f`).skipValidation.indexOf(l)>=0&&de[l]===!0)),!se){if(ue.error)throw new YError(ue.error.message);if(!ie){let l=this[kRunValidation](pe,{},ue.error);f||(fe=applyMiddleware(de,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).getMiddleware(),!0)),fe=this[kValidateAsync](l,fe??de),isPromise$1(fe)&&!f&&(fe=fe.then(()=>applyMiddleware(de,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).getMiddleware(),!1)))}}}catch(l){if(l instanceof YError)__classPrivateFieldGet(this,_YargsInstance_usage,`f`).fail(l.message,l);else throw l}return this[kPostProcess](fe??de,ce,!!f,!0)}[kRunValidation](l,d,f,m){let te={...this.getDemandedOptions()};return re=>{if(f)throw new YError(f.message);__classPrivateFieldGet(this,_YargsInstance_validation,`f`).nonOptionCount(re),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).requiredArguments(re,te);let ie=!1;__classPrivateFieldGet(this,_YargsInstance_strictCommands,`f`)&&(ie=__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unknownCommands(re)),__classPrivateFieldGet(this,_YargsInstance_strict,`f`)&&!ie?__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unknownArguments(re,l,d,!!m):__classPrivateFieldGet(this,_YargsInstance_strictOptions,`f`)&&__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unknownArguments(re,l,{},!1,!1),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).limitedChoices(re),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).implications(re),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).conflicting(re)}}[kSetHasOutput](){__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,`f`)}[kTrackManuallySetKeys](l){if(typeof l==`string`)__classPrivateFieldGet(this,_YargsInstance_options,`f`).key[l]=!0;else for(let d of l)__classPrivateFieldGet(this,_YargsInstance_options,`f`).key[d]=!0}};function isYargsInstance(l){return!!l&&typeof l.getInternalMethods==`function`}const Yargs=YargsFactory(esm_default);function charAt(l,d){return l.charAt(d)}function join$4(l,d=``){return l.join(d)}function replaceAll(l,d,f=``){if(typeof l.replaceAll==`function`)return l.replaceAll(d,f);let m=new RegExp(d,`g`);return l.replace(m,f)}function slice(l,d=0,f=void 0){return l.slice(d,f)}function toLowerCase(l){return l.toLowerCase()}function toUpperCase(l){return l.toUpperCase()}function removeApostrophe(l){return replaceAll(l,`'`,``)}function capitalize(l){return join$4([toUpperCase(charAt(l,0)??``),slice(l,1)])}function pascalCaseAll(l){return l.map(l=>capitalize(toLowerCase(l)))}var UNESCAPED_SEPARATORS=[`[`,`]`,`{`,`}`,`(`,`)`,`|`,`/`,`-`,`\\`],SEPARATORS=[...UNESCAPED_SEPARATORS,` `,`_`,`.`];function escapeChar(l){return UNESCAPED_SEPARATORS.includes(l)?`\\${l}`:l}var SEPARATOR_REGEX=RegExp(`[${SEPARATORS.map(escapeChar).join(``)}]`,`g`);function words(l){return l.replace(SEPARATOR_REGEX,` `).replace(/([a-zA-Z])([0-9])/g,`$1 $2`).replace(/([0-9])([a-zA-Z])/g,`$1 $2`).replace(/([a-zA-Z0-9_\-./])([^a-zA-Z0-9_\-./'])/g,`$1 $2`).replace(/([^a-zA-Z0-9_\-./'])([a-zA-Z0-9_\-./])/g,`$1 $2`).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).trim().split(/\s+/g)}function pascalCase(l){return join$4(pascalCaseAll(words(removeApostrophe(l))))}function delimiterCase(l,d){return join$4(words(removeApostrophe(l)),d)}function kebabCase(l){return toLowerCase(delimiterCase(removeApostrophe(l),`-`))}function titleCase(l){return delimiterCase(pascalCase(l),` `)}var name=`metascope`,version$1=`0.8.4`,bin={metascope:`dist/bin/cli.js`};function isPlainObject$8(l){if(typeof l!=`object`||!l)return!1;let d=Object.getPrototypeOf(l);return d!==null&&d!==Object.prototype&&Object.getPrototypeOf(d)!==null||Symbol.iterator in l?!1:Symbol.toStringTag in l?Object.prototype.toString.call(l)===`[object Module]`:!0}function _defu(l,d,f=`.`,m){if(!isPlainObject$8(d))return _defu(l,{},f,m);let te={...d};for(let d of Object.keys(l)){if(d===`__proto__`||d===`constructor`)continue;let re=l[d];re!=null&&(m&&m(te,d,re,f)||(Array.isArray(re)&&Array.isArray(te[d])?te[d]=[...re,...te[d]]:isPlainObject$8(re)&&isPlainObject$8(te[d])?te[d]=_defu(re,te[d],(f?`${f}.`:``)+d.toString(),m):te[d]=re))}return te}function createDefu(l){return(...d)=>d.reduce((d,f)=>_defu(d,f,``,l),{})}const defu=createDefu(),defuFn=createDefu((l,d,f)=>{if(l[d]!==void 0&&typeof f==`function`)return l[d]=f(l[d]),!0}),defuArrayFn=createDefu((l,d,f)=>{if(Array.isArray(l[d])&&typeof f==`function`)return l[d]=f(l[d]),!0});let LogLevel=function(l){return l.info=`info`,l.warn=`warn`,l.error=`error`,l.debug=`debug`,l.trace=`trace`,l.fatal=`fatal`,l}({});const LogLevelPriority={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},LAZY_SYMBOL=Symbol.for(`loglayer.lazy`),LAZY_EVAL_ERROR=`[LazyEvalError]`;function isLazy(l){return typeof l==`object`&&!!l&&LAZY_SYMBOL in l}function countLazyValues(l){let d=0;for(let f of Object.keys(l))isLazy(l[f])&&d++;return d}function resolveLazyValues(l){let d=!1;for(let f of Object.keys(l))if(isLazy(l[f])){d=!0;break}if(!d)return{resolved:l,errors:null};let f={},m=null;for(let d of Object.keys(l)){let te=l[d];if(isLazy(te))try{f[d]=te[LAZY_SYMBOL]()}catch(l){f[d]=LAZY_EVAL_ERROR,m||=[],m.push({key:d,error:l})}else f[d]=te}return{resolved:f,errors:m}}function hasPromiseValues(l){for(let d of Object.keys(l))if(l[d]instanceof Promise)return!0;return!1}function replacePromiseValues(l){let d=null,f={};for(let m of Object.keys(l))l[m]instanceof Promise?(f[m]=LAZY_EVAL_ERROR,d||=[],d.push(m)):f[m]=l[m];return d?{resolved:f,asyncKeys:d}:{resolved:l,asyncKeys:null}}async function resolvePromiseValues(l){let d=Object.keys(l),f=await Promise.allSettled(d.map(d=>Promise.resolve(l[d]))),m={},te=null;for(let l=0;l<d.length;l++){let re=f[l];re.status===`fulfilled`?m[d[l]]=re.value:(m[d[l]]=LAZY_EVAL_ERROR,te||=[],te.push({key:d[l],error:re.reason}))}return{resolved:m,errors:te}}function resolveMessages(l){let d=l[0];if(Array.isArray(d)&&d.raw!==void 0){let f=d,m=l.slice(1),te=``;for(let l=0;l<f.length;l++)te+=f[l],l<m.length&&(te+=String(m[l]));return[te]}return l}let PluginCallbackType=function(l){return l.transformLogLevel=`transformLogLevel`,l.onBeforeDataOut=`onBeforeDataOut`,l.shouldSendToLogger=`shouldSendToLogger`,l.onMetadataCalled=`onMetadataCalled`,l.onBeforeMessageOut=`onBeforeMessageOut`,l.onContextCalled=`onContextCalled`,l}({});var DefaultContextManager=class l{context={};hasContext=!1;setContext(l){if(!l){this.context={},this.hasContext=!1;return}this.context=l,this.hasContext=!0}appendContext(l){this.context={...this.context,...l},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(l){if(l===void 0){this.context={},this.hasContext=!1;return}let d=Array.isArray(l)?l:[l];for(let l of d)delete this.context[l];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:l,childContextManager:d}){if(l.hasContextData()){let f=l.getContext();d.setContext({...f})}}clone(){let d=new l;return d.setContext({...this.context}),d.hasContext=this.hasContext,d}},MockContextManager=class l{setContext(l){}appendContext(l){}getContext(){return{}}hasContextData(){return!1}clearContext(l){}onChildLoggerCreated(l){}clone(){return new l}},DefaultLogLevelManager=class l{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(l){let d=LogLevelPriority[l];for(let l of Object.values(LogLevel)){let f=l,m=LogLevelPriority[l];this.logLevelEnabledStatus[f]=m>=d}}enableIndividualLevel(l){let d=l;d in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[d]=!0)}disableIndividualLevel(l){let d=l;d in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[d]=!1)}isLevelEnabled(l){let d=l;return this.logLevelEnabledStatus[d]}enableLogging(){for(let l of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[l]=!0}disableLogging(){for(let l of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[l]=!1}onChildLoggerCreated({parentLogLevelManager:d,childLogLevelManager:f}){let m=d.logLevelEnabledStatus;f instanceof l&&(f.logLevelEnabledStatus={...m})}clone(){let d=new l;return d.logLevelEnabledStatus={...this.logLevelEnabledStatus},d}},MockLogLevelManager=class l{setLevel(l){}enableIndividualLevel(l){}disableIndividualLevel(l){}isLevelEnabled(l){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(l){}clone(){return new l}},BaseTransport=class{id;logger;enabled;consoleDebug;level;constructor(l){this.id=l.id??Date.now().toString()+Math.random().toString(),this.logger=l.logger,this.enabled=l.enabled??!0,this.consoleDebug=l.consoleDebug??!1,this.level=l.level??`trace`}_sendToLogger(l){if(!this.enabled||LogLevelPriority[l.logLevel]<LogLevelPriority[this.level])return;let d=this.shipToLogger(l);if(this.consoleDebug)switch(l.logLevel){case LogLevel.info:console.info(...d);break;case LogLevel.warn:console.warn(...d);break;case LogLevel.error:console.error(...d);break;case LogLevel.trace:console.debug(...d);break;case LogLevel.debug:console.debug(...d);break;case LogLevel.fatal:console.debug(...d);break;default:console.log(...d)}}getLoggerInstance(){return this.logger}},LoggerlessTransport=class{id;enabled;level;consoleDebug;constructor(l){this.id=l.id??Date.now().toString()+Math.random().toString(),this.enabled=l.enabled??!0,this.consoleDebug=l.consoleDebug??!1,this.level=l.level??`trace`}_sendToLogger(l){if(!this.enabled||LogLevelPriority[l.logLevel]<LogLevelPriority[this.level])return;let d=this.shipToLogger(l);if(this.consoleDebug)switch(l.logLevel){case LogLevel.info:console.info(...d);break;case LogLevel.warn:console.warn(...d);break;case LogLevel.error:console.error(...d);break;case LogLevel.trace:console.debug(...d);break;case LogLevel.debug:console.debug(...d);break;case LogLevel.fatal:console.debug(...d);break;default:console.log(...d)}}getLoggerInstance(){throw Error(`This transport does not have a logger instance`)}};const CALLBACK_LIST=[PluginCallbackType.onBeforeDataOut,PluginCallbackType.onMetadataCalled,PluginCallbackType.onBeforeMessageOut,PluginCallbackType.transformLogLevel,PluginCallbackType.shouldSendToLogger,PluginCallbackType.onContextCalled];var PluginManager=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(l){this.idToPlugin={},this.mapPlugins(l),this.indexPlugins()}mapPlugins(l){for(let d of l){if(d.id||=Date.now().toString()+Math.random().toString(),this.idToPlugin[d.id])throw Error(`[LogLayer] Plugin with id ${d.id} already exists.`);d.registeredAt=Date.now(),this.idToPlugin[d.id]=d}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let l=Object.values(this.idToPlugin).sort((l,d)=>l.registeredAt-d.registeredAt);for(let d of l){if(d.disabled)return;for(let l of CALLBACK_LIST)d[l]&&d.id&&this[l].push(d.id)}}hasPlugins(l){return this[l].length>0}countPlugins(l){return l?this[l].length:Object.keys(this.idToPlugin).length}addPlugins(l){this.mapPlugins(l),this.indexPlugins()}enablePlugin(l){let d=this.idToPlugin[l];d&&(d.disabled=!1),this.indexPlugins()}disablePlugin(l){let d=this.idToPlugin[l];d&&(d.disabled=!0),this.indexPlugins()}removePlugin(l){delete this.idToPlugin[l],this.indexPlugins()}runTransformLogLevel(l,d){let f=null;for(let m of this.transformLogLevel){let te=this.idToPlugin[m];if(te.transformLogLevel){let m=te.transformLogLevel({data:l.data,logLevel:l.logLevel,messages:l.messages,error:l.error,metadata:l.metadata,context:l.context,groups:l.groups,schema:l.schema,prefix:l.prefix},d);m!=null&&m!==!1&&(f=m)}}return f!=null&&f!==!1?f:l.logLevel}runOnBeforeDataOut(l,d){let f={...l},m=f.data;for(let l of this.onBeforeDataOut){let te=this.idToPlugin[l];if(te.onBeforeDataOut){let l=te.onBeforeDataOut({data:f.data,logLevel:f.logLevel,error:f.error,metadata:f.metadata,context:f.context,groups:f.groups,schema:f.schema,prefix:f.prefix},d);l&&(f.data||={},l!==m&&Object.assign(f.data,l))}}return f.data}runShouldSendToLogger(l,d){return!this.shouldSendToLogger.some(f=>!this.idToPlugin[f].shouldSendToLogger?.(l,d))}runOnMetadataCalled(l,d){let f={...l};for(let l of this.onMetadataCalled){let m=this.idToPlugin[l].onMetadataCalled?.(f,d);if(m)f=m;else return null}return f}runOnBeforeMessageOut(l,d){let f=[...l.messages];for(let m of this.onBeforeMessageOut){let te=this.idToPlugin[m].onBeforeMessageOut?.({messages:f,logLevel:l.logLevel,groups:l.groups,schema:l.schema,prefix:l.prefix},d);te&&(f=te)}return f}runOnContextCalled(l,d){let f={...l};for(let l of this.onContextCalled){let m=this.idToPlugin[l].onContextCalled?.(f,d);if(m)f=m;else return null}return f}},LogLayer=class l{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_isLoggingLazyError=!1;_lazyContextCount=0;_assignedGroups=null;_groupsConfig=null;_activeGroups=null;_ungroupedBehavior=`all`;_config;constructor(l){this._config={...l,enabled:l.enabled??!0},this.contextManager=new DefaultContextManager,this.logLevelManager=new DefaultLogLevelManager,this._config.enabled||this.disableLogging();let d=[...l.plugins||[],...mixinRegistry.pluginsToInit];this.pluginManager=new PluginManager(d),this._config.errorFieldName||(this._config.errorFieldName=`err`),this._config.copyMsgOnOnlyError||(this._config.copyMsgOnOnlyError=!1),this._initializeTransports(this._config.transport),this._groupsConfig=l.groups?{...l.groups}:null,this._ungroupedBehavior=l.ungroupedBehavior??`all`,this._activeGroups=l.activeGroups?new Set(l.activeGroups):null,this._parseEnvGroups(),mixinRegistry.logLayerHandlers.length>0&&mixinRegistry.logLayerHandlers.forEach(d=>{d.onConstruct&&d.onConstruct(this,l)})}withContextManager(l){return this.contextManager&&typeof this.contextManager[Symbol.dispose]==`function`&&this.contextManager[Symbol.dispose](),this.contextManager=l,this._lazyContextCount=l.hasContextData()?countLazyValues(l.getContext()):0,this}getContextManager(){return this.contextManager}withLogLevelManager(l){return this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]==`function`&&this.logLevelManager[Symbol.dispose](),this.logLevelManager=l,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(l){if(this.idToTransport)for(let l in this.idToTransport)this.idToTransport[l]&&typeof this.idToTransport[l][Symbol.dispose]==`function`&&this.idToTransport[l][Symbol.dispose]();this.hasMultipleTransports=Array.isArray(l)&&l.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(l)?l[0]:l,Array.isArray(l)?this.idToTransport=l.reduce((l,d)=>(l[d.id]=d,l),{}):this.idToTransport={[l.id]:l}}withPrefix(l){let d=this.child();return d._config.prefix=l,d}withGroup(l){let d=this.child(),f=Array.isArray(l)?l:[l];if(d._assignedGroups){let l=new Set([...d._assignedGroups,...f]);d._assignedGroups=Array.from(l)}else d._assignedGroups=[...f];return d}addGroup(l,d){return this._groupsConfig||={},this._groupsConfig[l]={...d},this}removeGroup(l){return this._groupsConfig&&(delete this._groupsConfig[l],Object.keys(this._groupsConfig).length===0&&(this._groupsConfig=null)),this}enableGroup(l){return this._groupsConfig?.[l]&&(this._groupsConfig[l]={...this._groupsConfig[l],enabled:!0}),this}disableGroup(l){return this._groupsConfig?.[l]&&(this._groupsConfig[l]={...this._groupsConfig[l],enabled:!1}),this}setGroupLevel(l,d){return this._groupsConfig?.[l]&&(this._groupsConfig[l]={...this._groupsConfig[l],level:d}),this}setActiveGroups(l){return this._activeGroups=l?new Set(l):null,this}getGroups(){return this._groupsConfig?{...this._groupsConfig}:{}}withContext(l){let d=l;if(!l)return this._config.consoleDebug&&console.debug(`[LogLayer] withContext was called with no context; dropping.`),this;if(this.pluginManager.hasPlugins(PluginCallbackType.onContextCalled)&&(d=this.pluginManager.runOnContextCalled(l,this),!d))return this._config.consoleDebug&&console.debug(`[LogLayer] Context was dropped due to plugin returning falsy value.`),this;let f=this.contextManager.getContext();for(let l of Object.keys(d)){let m=l in f&&isLazy(f[l]),te=isLazy(d[l]);!m&&te?this._lazyContextCount++:m&&!te&&this._lazyContextCount--}return this.contextManager.appendContext(d),this}clearContext(l){if(l!==void 0&&this._lazyContextCount>0){let d=this.contextManager.getContext(),f=Array.isArray(l)?l:[l];for(let l of f)l in d&&isLazy(d[l])&&this._lazyContextCount--}else l===void 0&&(this._lazyContextCount=0);return this.contextManager.clearContext(l),this}getContext(l){let d=this.contextManager.getContext();if(l?.raw||this._lazyContextCount===0)return d;let{resolved:f,errors:m}=resolveLazyValues(d);m&&this._logLazyEvalErrors(m,`context`);let{resolved:te,asyncKeys:re}=replacePromiseValues(f);return re&&this._logAsyncLazyContextErrors(re),te}addPlugins(l){this.pluginManager.addPlugins(l)}enablePlugin(l){this.pluginManager.enablePlugin(l)}disablePlugin(l){this.pluginManager.disablePlugin(l)}removePlugin(l){this.pluginManager.removePlugin(l)}withMetadata(l){return new LogBuilder(this).withMetadata(l)}withError(l){return new LogBuilder(this).withError(l)}child(){let d=new l({...this._config,transport:Array.isArray(this._config.transport)?[...this._config.transport]:this._config.transport}).withPluginManager(this.pluginManager).withContextManager(this.contextManager.clone()).withLogLevelManager(this.logLevelManager.clone());return this.contextManager.onChildLoggerCreated({parentContextManager:this.contextManager,childContextManager:d.contextManager,parentLogger:this,childLogger:d}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:d.logLevelManager,parentLogger:this,childLogger:d}),d._lazyContextCount=d.contextManager.hasContextData()?countLazyValues(d.contextManager.getContext()):0,d._groupsConfig=this._groupsConfig,d._activeGroups=this._activeGroups,d._ungroupedBehavior=this._ungroupedBehavior,d._assignedGroups=this._assignedGroups?[...this._assignedGroups]:null,d}withFreshTransports(l){return this._config.transport=l,this._initializeTransports(l),this}addTransport(l){let d=Array.isArray(l)?l:[l],f=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],m=new Set(d.map(l=>l.id));for(let l of d){let d=this.idToTransport[l.id];d&&typeof d[Symbol.dispose]==`function`&&d[Symbol.dispose]()}let te=[...f.filter(l=>!m.has(l.id)),...d];this._config.transport=te;for(let l of d)this.idToTransport[l.id]=l;return this.hasMultipleTransports=te.length>1,this.singleTransport=this.hasMultipleTransports?null:te[0],this}removeTransport(l){let d=this.idToTransport[l];if(!d)return!1;typeof d[Symbol.dispose]==`function`&&d[Symbol.dispose](),delete this.idToTransport[l];let f=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter(d=>d.id!==l);return this._config.transport=f.length===1?f[0]:f,this.hasMultipleTransports=f.length>1,this.singleTransport=this.hasMultipleTransports?null:f[0]||null,!0}withFreshPlugins(l){return this._config.plugins=l,this.pluginManager=new PluginManager(l),this}withPluginManager(l){return this.pluginManager=l,this}errorOnly(l,d){let f=d?.logLevel||LogLevel.error;if(!this.isLevelEnabled(f))return;let{copyMsgOnOnlyError:m}=this._config,te={logLevel:f,err:l};(m&&d?.copyMsg!==!1||d?.copyMsg===!0)&&l?.message&&(te.params=[l.message]),this._formatLog(te)}metadataOnly(l,d=LogLevel.info){if(!this.isLevelEnabled(d))return;let{muteMetadata:f,consoleDebug:m}=this._config;if(f)return;if(!l){m&&console.debug(`[LogLayer] metadataOnly was called with no metadata; dropping.`);return}let te=l;if(this.pluginManager.hasPlugins(PluginCallbackType.onMetadataCalled)&&(te=this.pluginManager.runOnMetadataCalled(l,this),!te)){m&&console.debug(`[LogLayer] Metadata was dropped due to plugin returning falsy value.`);return}let re={logLevel:d,metadata:te};return this._formatLog(re)}info(...l){if(!this.isLevelEnabled(LogLevel.info))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.info,params:d})}warn(...l){if(!this.isLevelEnabled(LogLevel.warn))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.warn,params:d})}error(...l){if(!this.isLevelEnabled(LogLevel.error))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.error,params:d})}debug(...l){if(!this.isLevelEnabled(LogLevel.debug))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.debug,params:d})}trace(...l){if(!this.isLevelEnabled(LogLevel.trace))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.trace,params:d})}fatal(...l){if(!this.isLevelEnabled(LogLevel.fatal))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.fatal,params:d})}raw(l){if(!this.isLevelEnabled(l.logLevel))return;let d={logLevel:l.logLevel,params:l.messages,metadata:l.metadata,rootData:l.rootData,err:l.error,context:l.context};return this._formatMessage(l.messages),this._formatLog(d)}disableLogging(){return this.logLevelManager.disableLogging(),this}enableLogging(){return this.logLevelManager.enableLogging(),this}muteContext(){return this._config.muteContext=!0,this}unMuteContext(){return this._config.muteContext=!1,this}muteMetadata(){return this._config.muteMetadata=!0,this}unMuteMetadata(){return this._config.muteMetadata=!1,this}enableIndividualLevel(l){return this.logLevelManager.enableIndividualLevel(l),this}disableIndividualLevel(l){return this.logLevelManager.disableIndividualLevel(l),this}setLevel(l){return this.logLevelManager.setLevel(l),this}isLevelEnabled(l){return this.logLevelManager.isLevelEnabled(l)}formatContext(l){let{contextFieldName:d,muteContext:f}=this._config;return l&&Object.keys(l).length>0&&!f?d?{[d]:{...l}}:{...l}:{}}formatMetadata(l=null){let{metadataFieldName:d,muteMetadata:f}=this._config;return l&&!f?d?{[d]:{...l}}:{...l}:{}}getLoggerInstance(l){let d=this.idToTransport[l];if(d)return d.getLoggerInstance()}_parseEnvGroups(){let l=typeof process<`u`?process.env?.LOGLAYER_GROUPS:void 0;if(!l)return;let d=l.split(`,`).map(l=>l.trim()).filter(Boolean),f=[];for(let l of d){let d=l.indexOf(`:`);if(d>0){let m=l.slice(0,d),te=l.slice(d+1);f.push(m),this._groupsConfig?.[m]&&(this._groupsConfig[m]={...this._groupsConfig[m],level:te})}else f.push(l)}this._activeGroups=new Set(f)}_mergeGroups(l){if(this._assignedGroups&&l){let d=new Set([...this._assignedGroups,...l]);return Array.from(d)}return l||this._assignedGroups}_applyUngroupedRules(l){return this._ungroupedBehavior===`all`?!0:this._ungroupedBehavior===`none`?!1:this._ungroupedBehavior.includes(l)}_shouldTransportReceiveLog(l,d,f){if(!this._groupsConfig)return!0;let m=this._mergeGroups(f);if(!m||m.length===0)return this._applyUngroupedRules(l);let te=!1;for(let f of m){let m=this._groupsConfig[f];if(m&&(te=!0,m.enabled!==!1&&!(this._activeGroups&&!this._activeGroups.has(f)))){if(m.level){let l=LogLevelPriority[m.level];if(LogLevelPriority[d]<l)continue}if(m.transports.includes(l))return!0}}return te?!1:this._applyUngroupedRules(l)}_formatMessage(l=[]){let{prefix:d}=this._config;d&&typeof l[0]==`string`&&(l[0]=`${d} ${l[0]}`)}_formatLog({logLevel:l,params:d=[],metadata:f=null,rootData:m=null,err:te,context:re=null,groups:ie=null}){let ae=re===null?this.contextManager.getContext():re,oe;if(this._lazyContextCount>0||re!==null){let l=resolveLazyValues(ae);l.errors&&this._logLazyEvalErrors(l.errors,`context`);let{resolved:d,asyncKeys:f}=replacePromiseValues(l.resolved);f&&this._logAsyncLazyContextErrors(f),oe=d}else oe=ae;let se=null;if(f){let l=resolveLazyValues(f);f=l.resolved,se=l.errors}if(se&&this._logLazyEvalErrors(se,`metadata`),f&&hasPromiseValues(f))return this._resolveAsyncAndProcess(l,d,oe,f,m,te,re,ie);this._processLog(l,d,oe,f,m,te,re,ie)}async _resolveAsyncAndProcess(l,d,f,m,te,re,ie,ae){let oe=null;if(m){let l=await resolvePromiseValues(m);oe=l.resolved,l.errors&&this._logLazyEvalErrors(l.errors,`metadata`)}this._processLog(l,d,f,oe,te,re,ie,ae)}_logLazyEvalErrors(l,d){if(this._isLoggingLazyError){for(let f of l)console.error(`[LogLayer] Lazy evaluation error in ${d} key "${f.key}":`,f.error);return}this._isLoggingLazyError=!0;try{for(let f of l){let l=f.error instanceof Error?f.error.message:String(f.error);this._processLog(LogLevel.error,[`[LogLayer] Lazy evaluation failed for ${d} key "${f.key}": ${l}`],{},null,null,f.error instanceof Error?f.error:void 0,{})}}finally{this._isLoggingLazyError=!1}}_logAsyncLazyContextErrors(l){if(this._isLoggingLazyError){for(let d of l)console.error(`[LogLayer] Async lazy values are not supported in context (key "${d}"). Use async lazy only in metadata.`);return}this._isLoggingLazyError=!0;try{for(let d of l)this._processLog(LogLevel.error,[`[LogLayer] Async lazy values are not supported in context (key "${d}"). Use async lazy only in metadata.`],{},null,null,void 0,{})}finally{this._isLoggingLazyError=!1}}_processLog(l,d,f,m,te,re,ie,ae=null){let{errorSerializer:oe,errorFieldInMetadata:se,muteContext:ce,contextFieldName:le,metadataFieldName:ue,errorFieldName:de,prefix:fe}=this._config,pe={contextFieldName:le??void 0,metadataFieldName:ue??void 0,errorFieldName:de??`err`},me=this._mergeGroups(ae)??void 0,he=!!m||(ce?!1:ie===null?this.contextManager.hasContextData():Object.keys(ie).length>0),ge={};if(he)if(le&&le===ue){let l=this.formatContext(f)[le],d=this.formatMetadata(m)[ue];ge={[le]:{...l,...d}}}else ge={...this.formatContext(f),...this.formatMetadata(m)};if(re){let l=oe?oe(re):re;se&&m&&ue?ge?.[ue]?ge[ue][de]=l:ge={...ge,[ue]:{[de]:l}}:ge=se&&!m&&ue?{...ge,[ue]:{[de]:l}}:{...ge,[de]:l},he=!0}te&&Object.keys(te).length>0&&(ge={...ge,...te},he=!0),this.pluginManager.hasPlugins(PluginCallbackType.onBeforeDataOut)&&(ge=this.pluginManager.runOnBeforeDataOut({data:he?ge:void 0,logLevel:l,error:re,metadata:m,context:f,groups:me,schema:pe,prefix:fe},this),ge&&!he&&(he=!0)),this.pluginManager.hasPlugins(PluginCallbackType.onBeforeMessageOut)&&(d=this.pluginManager.runOnBeforeMessageOut({messages:[...d],logLevel:l,groups:me,schema:pe,prefix:fe},this)),this.pluginManager.hasPlugins(PluginCallbackType.transformLogLevel)&&(l=this.pluginManager.runTransformLogLevel({data:he?ge:void 0,logLevel:l,messages:[...d],error:re,metadata:m,context:f,groups:me,schema:pe,prefix:fe},this));let _e={data:he?ge:void 0,error:re,metadata:m,context:f,groups:me,schema:pe,prefix:fe};if(this.hasMultipleTransports){let f=this._config.transport.filter(d=>!(!d.enabled||!this._shouldTransportReceiveLog(d.id,l,me))).map(async f=>{let m=l;if(!(this.pluginManager.hasPlugins(PluginCallbackType.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...d],logLevel:m,transportId:f.id,..._e},this)))return f._sendToLogger({logLevel:m,messages:[...d],hasData:he,..._e})});Promise.all(f).catch(l=>{this._config.consoleDebug&&console.error(`[LogLayer] Error executing transports:`,l)})}else{if(!this.singleTransport?.enabled||!this._shouldTransportReceiveLog(this.singleTransport.id,l,me)||this.pluginManager.hasPlugins(PluginCallbackType.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...d],logLevel:l,transportId:this.singleTransport.id,..._e},this))return;this.singleTransport._sendToLogger({logLevel:l,messages:[...d],hasData:he,..._e})}}},MockLogBuilder=class{debug(...l){}error(...l){}info(...l){}trace(...l){}warn(...l){}fatal(...l){}enableLogging(){return this}disableLogging(){return this}withMetadata(l){return this}withError(l){return this}withGroup(l){return this}},MockLogLayer=class{mockLogBuilder=new MockLogBuilder;mockContextManager=new MockContextManager;mockLogLevelManager=new MockLogLevelManager;info(...l){}warn(...l){}error(...l){}debug(...l){}trace(...l){}fatal(...l){}raw(l){}getLoggerInstance(l){}errorOnly(l,d){}metadataOnly(l,d){}addPlugins(l){}removePlugin(l){}enablePlugin(l){}disablePlugin(l){}withPrefix(l){return this}withGroup(l){return this}addGroup(l,d){return this}removeGroup(l){return this}enableGroup(l){return this}disableGroup(l){return this}setGroupLevel(l,d){return this}setActiveGroups(l){return this}getGroups(){return{}}withContext(l){return this}withError(l){return this.mockLogBuilder.withError(l)}withMetadata(l){return this.mockLogBuilder.withMetadata(l)}getContext(l){return{}}clearContext(l){return this}enableLogging(){return this}disableLogging(){return this}child(){return this}muteContext(){return this}unMuteContext(){return this}muteMetadata(){return this}unMuteMetadata(){return this}withFreshTransports(l){return this}addTransport(l){return this}removeTransport(l){return!0}withFreshPlugins(l){return this}withContextManager(l){return this}getContextManager(){return this.mockContextManager}withLogLevelManager(l){return this}getLogLevelManager(){return this.mockLogLevelManager}getConfig(){return{}}setMockLogBuilder(l){this.mockLogBuilder=l}enableIndividualLevel(l){return this}disableIndividualLevel(l){return this}setLevel(l){return this}isLevelEnabled(l){return!0}getMockLogBuilder(){return this.mockLogBuilder}resetMockLogBuilder(){this.mockLogBuilder=new MockLogBuilder}};const mixinRegistry={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var LogBuilder=class{err;metadata;structuredLogger;hasMetadata;pluginManager;_groups=null;constructor(l){this.err=null,this.metadata={},this.structuredLogger=l,this.hasMetadata=!1,this.pluginManager=l.pluginManager,mixinRegistry.logBuilderHandlers.length>0&&mixinRegistry.logBuilderHandlers.forEach(d=>{d.onConstruct&&d.onConstruct(this,l)})}withMetadata(l){let{pluginManager:d,structuredLogger:{_config:{consoleDebug:f}}}=this;if(!l)return f&&console.debug(`[LogLayer] withMetadata was called with no metadata; dropping.`),this;let m=l;return d.hasPlugins(PluginCallbackType.onMetadataCalled)&&(m=d.runOnMetadataCalled(l,this.structuredLogger),!m)?(f&&console.debug(`[LogLayer] Metadata was dropped due to plugin returning falsy value.`),this):(this.metadata={...this.metadata,...m},this.hasMetadata=!0,this)}withError(l){return this.err=l,this}withGroup(l){let d=Array.isArray(l)?l:[l];if(this._groups){let l=new Set([...this._groups,...d]);this._groups=Array.from(l)}else this._groups=[...d];return this}info(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.info))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.info,d)}warn(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.warn))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.warn,d)}error(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.error))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.error,d)}debug(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.debug))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.debug,d)}trace(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.trace))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.trace,d)}fatal(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.fatal))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.fatal,d)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(l,d){let{muteMetadata:f}=this.structuredLogger._config,m=f?!1:this.hasMetadata;return this.structuredLogger._formatLog({logLevel:l,params:d,metadata:m?this.metadata:null,err:this.err,groups:this._groups})}};const isNonErrorSymbol=Symbol(`isNonError`);function defineProperty(l,d,f){Object.defineProperty(l,d,{value:f,writable:!1,enumerable:!1,configurable:!1})}function stringify$3(l){if(l===void 0)return`undefined`;if(l===null)return`null`;if(typeof l==`string`)return l;if(typeof l==`number`||typeof l==`boolean`)return String(l);if(typeof l==`bigint`)return`${l}n`;if(typeof l==`symbol`)return l.toString();if(typeof l==`function`)return`[Function${l.name?` ${l.name}`:` (anonymous)`}]`;if(l instanceof Error)try{return String(l)}catch{return`<Unserializable error>`}try{return JSON.stringify(l)}catch{try{return String(l)}catch{return`<Unserializable value>`}}}var NonError$1=class l extends Error{constructor(d,{superclass:f=Error}={}){if(l.isNonError(d))return d;if(d instanceof Error)throw TypeError(`Do not pass Error instances to NonError. Throw the error directly instead.`);super(`Non-error value: ${stringify$3(d)}`),f!==Error&&Object.setPrototypeOf(this,f.prototype),defineProperty(this,`name`,`NonError`),defineProperty(this,isNonErrorSymbol,!0),defineProperty(this,`isNonError`,!0),defineProperty(this,`value`,d)}static isNonError(l){return l?.[isNonErrorSymbol]===!0}static#e(d,f){try{let m=d(...f);return m&&typeof m.then==`function`?(async()=>{try{return await m}catch(d){throw d instanceof Error?d:new l(d)}})():m}catch(d){throw d instanceof Error?d:new l(d)}}static try(d){return l.#e(d,[])}static wrap(d){return(...f)=>l.#e(d,f)}static[Symbol.hasInstance](d){return l.isNonError(d)}};const list$1=[Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(l=>[l.name,l]),errorConstructors=new Map(list$1),errorFactories=new Map,errorProperties=[{property:`name`,enumerable:!1},{property:`message`,enumerable:!1},{property:`stack`,enumerable:!1},{property:`code`,enumerable:!0},{property:`cause`,enumerable:!1},{property:`errors`,enumerable:!1}],toJsonWasCalled=new WeakSet,toJSON=l=>{toJsonWasCalled.add(l);let d=l.toJSON();return toJsonWasCalled.delete(l),d},newError=l=>{if(l===`NonError`)return new NonError$1;let d=errorFactories.get(l);if(d)return d();let f=errorConstructors.get(l)??Error;return f===AggregateError?new f([]):new f},destroyCircular=({from:l,seen:d,to:f,forceEnumerable:m,maxDepth:te,depth:re,useToJSON:ie,serialize:ae})=>{if(f||=Array.isArray(l)?[]:!ae&&isErrorLike(l)?newError(l.name):{},d.add(l),re>=te)return d.delete(l),f;if(ie&&typeof l.toJSON==`function`&&!toJsonWasCalled.has(l))return d.delete(l),toJSON(l);let oe=l=>destroyCircular({from:l,seen:d,forceEnumerable:m,maxDepth:te,depth:re+1,useToJSON:ie,serialize:ae});for(let m of Object.keys(l)){let te=l[m];if(te&&te instanceof Uint8Array&&te.constructor.name===`Buffer`){f[m]=ae?`[object Buffer]`:te;continue}if(typeof te==`object`&&te&&typeof te.pipe==`function`){f[m]=ae?`[object Stream]`:te;continue}if(typeof te==`function`){ae||(f[m]=te);continue}if(ae&&typeof te==`bigint`){f[m]=`${te}n`;continue}if(!te||typeof te!=`object`){try{f[m]=te}catch{}continue}if(!d.has(te)){f[m]=oe(te);continue}f[m]=`[Circular]`}if(ae||f instanceof Error)for(let{property:te,enumerable:re}of errorProperties){let ie=l[te];if(ie==null||Object.getOwnPropertyDescriptor(f,te)?.configurable===!1)continue;let ae=ie;typeof ie==`object`&&(ae=d.has(ie)?`[Circular]`:oe(ie)),Object.defineProperty(f,te,{value:ae,enumerable:m||re,configurable:!0,writable:!0})}return d.delete(l),f};function serializeError(l,d={}){let{maxDepth:f=1/0,useToJSON:m=!0}=d;return typeof l==`object`&&l?destroyCircular({from:l,seen:new Set,forceEnumerable:!0,maxDepth:f,depth:0,useToJSON:m,serialize:!0}):(typeof l==`function`&&(l=`<Function>`),destroyCircular({from:new NonError$1(l),seen:new Set,forceEnumerable:!0,maxDepth:f,depth:0,useToJSON:m,serialize:!0}))}function isErrorLike(l){return!!l&&typeof l==`object`&&typeof l.name==`string`&&typeof l.message==`string`&&typeof l.stack==`string`}var require_safe_stable_stringify=__commonJSMin(((l,d)=>{let{hasOwnProperty:f}=Object.prototype,m=he();m.configure=he,m.stringify=m,m.default=m,l.stringify=m,l.configure=he,d.exports=m;let te=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function re(l){return l.length<5e3&&!te.test(l)?`"${l}"`:JSON.stringify(l)}function ie(l,d){if(l.length>200||d)return l.sort(d);for(let d=1;d<l.length;d++){let f=l[d],m=d;for(;m!==0&&l[m-1]>f;)l[m]=l[m-1],m--;l[m]=f}return l}let ae=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function oe(l){return ae.call(l)!==void 0&&l.length!==0}function se(l,d,f){l.length<f&&(f=l.length);let m=d===`,`?``:` `,te=`"0":${m}${l[0]}`;for(let re=1;re<f;re++)te+=`${d}"${re}":${m}${l[re]}`;return te}function ce(l){if(f.call(l,`circularValue`)){let d=l.circularValue;if(typeof d==`string`)return`"${d}"`;if(d==null)return d;if(d===Error||d===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function le(l){let d;if(f.call(l,`deterministic`)&&(d=l.deterministic,typeof d!=`boolean`&&typeof d!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return d===void 0?!0:d}function ue(l,d){let m;if(f.call(l,d)&&(m=l[d],typeof m!=`boolean`))throw TypeError(`The "${d}" argument must be of type boolean`);return m===void 0?!0:m}function de(l,d){let m;if(f.call(l,d)){if(m=l[d],typeof m!=`number`)throw TypeError(`The "${d}" argument must be of type number`);if(!Number.isInteger(m))throw TypeError(`The "${d}" argument must be an integer`);if(m<1)throw RangeError(`The "${d}" argument must be >= 1`)}return m===void 0?1/0:m}function fe(l){return l===1?`1 item`:`${l} items`}function pe(l){let d=new Set;for(let f of l)(typeof f==`string`||typeof f==`number`)&&d.add(String(f));return d}function me(l){if(f.call(l,`strict`)){let d=l.strict;if(typeof d!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(d)return l=>{let d=`Object can not safely be stringified. Received type ${typeof l}`;throw typeof l!=`function`&&(d+=` (${l.toString()})`),Error(d)}}}function he(l){l={...l};let d=me(l);d&&(l.bigint===void 0&&(l.bigint=!1),`circularValue`in l||(l.circularValue=Error));let f=ce(l),m=ue(l,`bigint`),te=le(l),ae=typeof te==`function`?te:void 0,he=de(l,`maximumDepth`),ge=de(l,`maximumBreadth`);function _e(l,se,ce,le,ue,de){let pe=se[l];switch(typeof pe==`object`&&pe&&typeof pe.toJSON==`function`&&(pe=pe.toJSON(l)),pe=le.call(se,l,pe),typeof pe){case`string`:return re(pe);case`object`:{if(pe===null)return`null`;if(ce.indexOf(pe)!==-1)return f;let l=``,d=`,`,m=de;if(Array.isArray(pe)){if(pe.length===0)return`[]`;if(he<ce.length+1)return`"[Array]"`;ce.push(pe),ue!==``&&(de+=ue,l+=`\n${de}`,d=`,\n${de}`);let f=Math.min(pe.length,ge),te=0;for(;te<f-1;te++){let f=_e(String(te),pe,ce,le,ue,de);l+=f===void 0?`null`:f,l+=d}let re=_e(String(te),pe,ce,le,ue,de);if(l+=re===void 0?`null`:re,pe.length-1>ge){let f=pe.length-ge-1;l+=`${d}"... ${fe(f)} not stringified"`}return ue!==``&&(l+=`\n${m}`),ce.pop(),`[${l}]`}let se=Object.keys(pe),me=se.length;if(me===0)return`{}`;if(he<ce.length+1)return`"[Object]"`;let ve=``,ye=``;ue!==``&&(de+=ue,d=`,\n${de}`,ve=` `);let be=Math.min(me,ge);te&&!oe(pe)&&(se=ie(se,ae)),ce.push(pe);for(let f=0;f<be;f++){let m=se[f],te=_e(m,pe,ce,le,ue,de);te!==void 0&&(l+=`${ye}${re(m)}:${ve}${te}`,ye=d)}if(me>ge){let f=me-ge;l+=`${ye}"...":${ve}"${fe(f)} not stringified"`,ye=d}return ue!==``&&ye.length>1&&(l=`\n${de}${l}\n${m}`),ce.pop(),`{${l}}`}case`number`:return isFinite(pe)?String(pe):d?d(pe):`null`;case`boolean`:return pe===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(pe);default:return d?d(pe):void 0}}function ve(l,te,ie,ae,oe,se){switch(typeof te==`object`&&te&&typeof te.toJSON==`function`&&(te=te.toJSON(l)),typeof te){case`string`:return re(te);case`object`:{if(te===null)return`null`;if(ie.indexOf(te)!==-1)return f;let l=se,d=``,m=`,`;if(Array.isArray(te)){if(te.length===0)return`[]`;if(he<ie.length+1)return`"[Array]"`;ie.push(te),oe!==``&&(se+=oe,d+=`\n${se}`,m=`,\n${se}`);let f=Math.min(te.length,ge),re=0;for(;re<f-1;re++){let l=ve(String(re),te[re],ie,ae,oe,se);d+=l===void 0?`null`:l,d+=m}let ce=ve(String(re),te[re],ie,ae,oe,se);if(d+=ce===void 0?`null`:ce,te.length-1>ge){let l=te.length-ge-1;d+=`${m}"... ${fe(l)} not stringified"`}return oe!==``&&(d+=`\n${l}`),ie.pop(),`[${d}]`}ie.push(te);let ce=``;oe!==``&&(se+=oe,m=`,\n${se}`,ce=` `);let le=``;for(let l of ae){let f=ve(l,te[l],ie,ae,oe,se);f!==void 0&&(d+=`${le}${re(l)}:${ce}${f}`,le=m)}return oe!==``&&le.length>1&&(d=`\n${se}${d}\n${l}`),ie.pop(),`{${d}}`}case`number`:return isFinite(te)?String(te):d?d(te):`null`;case`boolean`:return te===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(te);default:return d?d(te):void 0}}function ye(l,ce,le,ue,de){switch(typeof ce){case`string`:return re(ce);case`object`:{if(ce===null)return`null`;if(typeof ce.toJSON==`function`){if(ce=ce.toJSON(l),typeof ce!=`object`)return ye(l,ce,le,ue,de);if(ce===null)return`null`}if(le.indexOf(ce)!==-1)return f;let d=de;if(Array.isArray(ce)){if(ce.length===0)return`[]`;if(he<le.length+1)return`"[Array]"`;le.push(ce),de+=ue;let l=`\n${de}`,f=`,\n${de}`,m=Math.min(ce.length,ge),te=0;for(;te<m-1;te++){let d=ye(String(te),ce[te],le,ue,de);l+=d===void 0?`null`:d,l+=f}let re=ye(String(te),ce[te],le,ue,de);if(l+=re===void 0?`null`:re,ce.length-1>ge){let d=ce.length-ge-1;l+=`${f}"... ${fe(d)} not stringified"`}return l+=`\n${d}`,le.pop(),`[${l}]`}let m=Object.keys(ce),pe=m.length;if(pe===0)return`{}`;if(he<le.length+1)return`"[Object]"`;de+=ue;let me=`,\n${de}`,_e=``,ve=``,be=Math.min(pe,ge);oe(ce)&&(_e+=se(ce,me,ge),m=m.slice(ce.length),be-=ce.length,ve=me),te&&(m=ie(m,ae)),le.push(ce);for(let l=0;l<be;l++){let d=m[l],f=ye(d,ce[d],le,ue,de);f!==void 0&&(_e+=`${ve}${re(d)}: ${f}`,ve=me)}if(pe>ge){let l=pe-ge;_e+=`${ve}"...": "${fe(l)} not stringified"`,ve=me}return ve!==``&&(_e=`\n${de}${_e}\n${d}`),le.pop(),`{${_e}}`}case`number`:return isFinite(ce)?String(ce):d?d(ce):`null`;case`boolean`:return ce===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(ce);default:return d?d(ce):void 0}}function be(l,ce,le){switch(typeof ce){case`string`:return re(ce);case`object`:{if(ce===null)return`null`;if(typeof ce.toJSON==`function`){if(ce=ce.toJSON(l),typeof ce!=`object`)return be(l,ce,le);if(ce===null)return`null`}if(le.indexOf(ce)!==-1)return f;let d=``,m=ce.length!==void 0;if(m&&Array.isArray(ce)){if(ce.length===0)return`[]`;if(he<le.length+1)return`"[Array]"`;le.push(ce);let l=Math.min(ce.length,ge),f=0;for(;f<l-1;f++){let l=be(String(f),ce[f],le);d+=l===void 0?`null`:l,d+=`,`}let m=be(String(f),ce[f],le);if(d+=m===void 0?`null`:m,ce.length-1>ge){let l=ce.length-ge-1;d+=`,"... ${fe(l)} not stringified"`}return le.pop(),`[${d}]`}let ue=Object.keys(ce),de=ue.length;if(de===0)return`{}`;if(he<le.length+1)return`"[Object]"`;let pe=``,me=Math.min(de,ge);m&&oe(ce)&&(d+=se(ce,`,`,ge),ue=ue.slice(ce.length),me-=ce.length,pe=`,`),te&&(ue=ie(ue,ae)),le.push(ce);for(let l=0;l<me;l++){let f=ue[l],m=be(f,ce[f],le);m!==void 0&&(d+=`${pe}${re(f)}:${m}`,pe=`,`)}if(de>ge){let l=de-ge;d+=`${pe}"...":"${fe(l)} not stringified"`}return le.pop(),`{${d}}`}case`number`:return isFinite(ce)?String(ce):d?d(ce):`null`;case`boolean`:return ce===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(ce);default:return d?d(ce):void 0}}function xe(l,d,f){if(arguments.length>1){let m=``;if(typeof f==`number`?m=` `.repeat(Math.min(f,10)):typeof f==`string`&&(m=f.slice(0,10)),d!=null){if(typeof d==`function`)return _e(``,{"":l},[],d,m,``);if(Array.isArray(d))return ve(``,l,[],pe(d),m,``)}if(m.length!==0)return ye(``,l,[],m,``)}return be(``,l,[])}return xe}})),import_safe_stable_stringify=__toESM(require_safe_stable_stringify());const configure$1=import_safe_stable_stringify.configure,stringify=import_safe_stable_stringify.default;var require_symbols=__commonJSMin(((l,d)=>{let f=typeof process<`u`&&process.env.TERM_PROGRAM===`Hyper`,m=typeof process<`u`&&process.platform===`win32`,te=typeof process<`u`&&process.platform===`linux`,re={ballotDisabled:`☒`,ballotOff:`☐`,ballotOn:`☑`,bullet:`•`,bulletWhite:`◦`,fullBlock:`█`,heart:`❤`,identicalTo:`≡`,line:`─`,mark:`※`,middot:`·`,minus:`-`,multiplication:`×`,obelus:`÷`,pencilDownRight:`✎`,pencilRight:`✏`,pencilUpRight:`✐`,percent:`%`,pilcrow2:`❡`,pilcrow:`¶`,plusMinus:`±`,question:`?`,section:`§`,starsOff:`☆`,starsOn:`★`,upDownArrow:`↕`},ie=Object.assign({},re,{check:`√`,cross:`×`,ellipsisLarge:`...`,ellipsis:`...`,info:`i`,questionSmall:`?`,pointer:`>`,pointerSmall:`»`,radioOff:`( )`,radioOn:`(*)`,warning:`‼`}),ae=Object.assign({},re,{ballotCross:`✘`,check:`✔`,cross:`✖`,ellipsisLarge:`⋯`,ellipsis:`…`,info:`ℹ`,questionFull:`?`,questionSmall:`﹖`,pointer:te?`▸`:`❯`,pointerSmall:te?`‣`:`›`,radioOff:`◯`,radioOn:`◉`,warning:`⚠`});d.exports=m&&!f?ie:ae,Reflect.defineProperty(d.exports,"common",{enumerable:!1,value:re}),Reflect.defineProperty(d.exports,"windows",{enumerable:!1,value:ie}),Reflect.defineProperty(d.exports,"other",{enumerable:!1,value:ae})})),require_ansi_colors=__commonJSMin(((l,d)=>{let f=l=>typeof l==`object`&&!!l&&!Array.isArray(l),m=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,te=()=>typeof process<`u`?process.env.FORCE_COLOR!==`0`:!1,re=()=>{let l={enabled:te(),visible:!0,styles:{},keys:{}},d=l=>{let d=l.open=`\u001b[${l.codes[0]}m`,f=l.close=`\u001b[${l.codes[1]}m`,m=l.regex=RegExp(`\\u001b\\[${l.codes[1]}m`,`g`);return l.wrap=(l,te)=>{l.includes(f)&&(l=l.replace(m,f+d));let re=d+l+f;return te?re.replace(/\r*\n/g,`${f}$&${d}`):re},l},re=(l,d,f)=>typeof l==`function`?l(d):l.wrap(d,f),ie=(d,f)=>{if(d===``||d==null)return``;if(l.enabled===!1)return d;if(l.visible===!1)return``;let m=``+d,te=m.includes(`
106
+ `,`f`),__classPrivateFieldSet(this,_YargsInstance_output,__classPrivateFieldGet(this,_YargsInstance_output,`f`)+l.join(` `),`f`)}}}[kDeleteFromParserHintObject](l){objectKeys(__classPrivateFieldGet(this,_YargsInstance_options,`f`)).forEach(d=>{if((l=>l===`configObjects`)(d))return;let f=__classPrivateFieldGet(this,_YargsInstance_options,`f`)[d];Array.isArray(f)?f.includes(l)&&f.splice(f.indexOf(l),1):typeof f==`object`&&delete f[l]}),delete __classPrivateFieldGet(this,_YargsInstance_usage,`f`).getDescriptions()[l]}[kEmitWarning](l,d,f){__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,`f`)[f]||(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.emitWarning(l,d),__classPrivateFieldGet(this,_YargsInstance_emittedWarnings,`f`)[f]=!0)}[kFreeze](){__classPrivateFieldGet(this,_YargsInstance_frozens,`f`).push({options:__classPrivateFieldGet(this,_YargsInstance_options,`f`),configObjects:__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`),groups:__classPrivateFieldGet(this,_YargsInstance_groups,`f`),strict:__classPrivateFieldGet(this,_YargsInstance_strict,`f`),strictCommands:__classPrivateFieldGet(this,_YargsInstance_strictCommands,`f`),strictOptions:__classPrivateFieldGet(this,_YargsInstance_strictOptions,`f`),completionCommand:__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`),output:__classPrivateFieldGet(this,_YargsInstance_output,`f`),exitError:__classPrivateFieldGet(this,_YargsInstance_exitError,`f`),hasOutput:__classPrivateFieldGet(this,_YargsInstance_hasOutput,`f`),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`),parseContext:__classPrivateFieldGet(this,_YargsInstance_parseContext,`f`)}),__classPrivateFieldGet(this,_YargsInstance_usage,`f`).freeze(),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).freeze(),__classPrivateFieldGet(this,_YargsInstance_command,`f`).freeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).freeze()}[kGetDollarZero](){let l=``,d;return d=/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.argv()[0])?__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.argv().slice(1,2):__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.argv().slice(0,1),l=d.map(l=>{let d=this[kRebase](__classPrivateFieldGet(this,_YargsInstance_cwd,`f`),l);return l.match(/^(\/|([a-zA-Z]:)?\\)/)&&d.length<l.length?d:l}).join(` `).trim(),__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`_`)&&__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getProcessArgvBin()===__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`_`)&&(l=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`_`).replace(`${__classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.dirname(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).process.execPath())}/`,``)),l}[kGetParserConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_parserConfig,`f`)}[kGetUsageConfiguration](){return __classPrivateFieldGet(this,_YargsInstance_usageConfig,`f`)}[kGuessLocale](){if(!__classPrivateFieldGet(this,_YargsInstance_detectLocale,`f`))return;let l=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LC_ALL`)||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LC_MESSAGES`)||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LANG`)||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).getEnv(`LANGUAGE`)||`en_US`;this.locale(l.replace(/[.:].*/,``))}[kGuessVersion](){return this[kPkgUp]().version||`unknown`}[kParsePositionalNumbers](l){let d=l[`--`]?l[`--`]:l._;for(let l=0,f;(f=d[l])!==void 0;l++)__classPrivateFieldGet(this,_YargsInstance_shim,`f`).Parser.looksLikeNumber(f)&&Number.isSafeInteger(Math.floor(parseFloat(`${f}`)))&&(d[l]=Number(f));return l}[kPkgUp](l){let d=l||`*`;if(__classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d])return __classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d];let f={};try{let d=l||__classPrivateFieldGet(this,_YargsInstance_shim,`f`).mainFilename;__classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.extname(d)&&(d=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.dirname(d));let m=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).findUp(d,(l,d)=>{if(d.includes(`package.json`))return`package.json`});assertNotStrictEqual(m,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),f=JSON.parse(__classPrivateFieldGet(this,_YargsInstance_shim,`f`).readFileSync(m,`utf8`))}catch{}return __classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d]=f||{},__classPrivateFieldGet(this,_YargsInstance_pkgs,`f`)[d]}[kPopulateParserHintArray](l,d){d=[].concat(d),d.forEach(d=>{d=this[kSanitizeKey](d),__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l].push(d)})}[kPopulateParserHintSingleValueDictionary](l,d,f,m){this[kPopulateParserHintDictionary](l,d,f,m,(l,d,f)=>{__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l][d]=f})}[kPopulateParserHintArrayDictionary](l,d,f,m){this[kPopulateParserHintDictionary](l,d,f,m,(l,d,f)=>{__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l][d]=(__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l][d]||[]).concat(f)})}[kPopulateParserHintDictionary](l,d,f,m,te){if(Array.isArray(f))f.forEach(d=>{l(d,m)});else if((l=>typeof l==`object`)(f))for(let d of objectKeys(f))l(d,f[d]);else te(d,this[kSanitizeKey](f),m)}[kSanitizeKey](l){return l===`__proto__`?`___proto___`:l}[kSetKey](l,d){return this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this),`key`,l,d),this}[kUnfreeze](){var l,d,f,m,te,re,ie,ae,oe,se,ce,le;let ue=__classPrivateFieldGet(this,_YargsInstance_frozens,`f`).pop();assertNotStrictEqual(ue,void 0,__classPrivateFieldGet(this,_YargsInstance_shim,`f`));let de;l=this,d=this,f=this,m=this,te=this,re=this,ie=this,ae=this,oe=this,se=this,ce=this,le=this,{options:{set value(d){__classPrivateFieldSet(l,_YargsInstance_options,d,`f`)}}.value,configObjects:de,exitProcess:{set value(l){__classPrivateFieldSet(d,_YargsInstance_exitProcess,l,`f`)}}.value,groups:{set value(l){__classPrivateFieldSet(f,_YargsInstance_groups,l,`f`)}}.value,output:{set value(l){__classPrivateFieldSet(m,_YargsInstance_output,l,`f`)}}.value,exitError:{set value(l){__classPrivateFieldSet(te,_YargsInstance_exitError,l,`f`)}}.value,hasOutput:{set value(l){__classPrivateFieldSet(re,_YargsInstance_hasOutput,l,`f`)}}.value,parsed:this.parsed,strict:{set value(l){__classPrivateFieldSet(ie,_YargsInstance_strict,l,`f`)}}.value,strictCommands:{set value(l){__classPrivateFieldSet(ae,_YargsInstance_strictCommands,l,`f`)}}.value,strictOptions:{set value(l){__classPrivateFieldSet(oe,_YargsInstance_strictOptions,l,`f`)}}.value,completionCommand:{set value(l){__classPrivateFieldSet(se,_YargsInstance_completionCommand,l,`f`)}}.value,parseFn:{set value(l){__classPrivateFieldSet(ce,_YargsInstance_parseFn,l,`f`)}}.value,parseContext:{set value(l){__classPrivateFieldSet(le,_YargsInstance_parseContext,l,`f`)}}.value}=ue,__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects=de,__classPrivateFieldGet(this,_YargsInstance_usage,`f`).unfreeze(),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unfreeze(),__classPrivateFieldGet(this,_YargsInstance_command,`f`).unfreeze(),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).unfreeze()}[kValidateAsync](l,d){return maybeAsyncResult(d,d=>(l(d),d))}getInternalMethods(){return{getCommandInstance:this[kGetCommandInstance].bind(this),getContext:this[kGetContext].bind(this),getHasOutput:this[kGetHasOutput].bind(this),getLoggerInstance:this[kGetLoggerInstance].bind(this),getParseContext:this[kGetParseContext].bind(this),getParserConfiguration:this[kGetParserConfiguration].bind(this),getUsageConfiguration:this[kGetUsageConfiguration].bind(this),getUsageInstance:this[kGetUsageInstance].bind(this),getValidationInstance:this[kGetValidationInstance].bind(this),hasParseCallback:this[kHasParseCallback].bind(this),isGlobalContext:this[kIsGlobalContext].bind(this),postProcess:this[kPostProcess].bind(this),reset:this[kReset].bind(this),runValidation:this[kRunValidation].bind(this),runYargsParserAndExecuteCommands:this[kRunYargsParserAndExecuteCommands].bind(this),setHasOutput:this[kSetHasOutput].bind(this)}}[kGetCommandInstance](){return __classPrivateFieldGet(this,_YargsInstance_command,`f`)}[kGetContext](){return __classPrivateFieldGet(this,_YargsInstance_context,`f`)}[kGetHasOutput](){return __classPrivateFieldGet(this,_YargsInstance_hasOutput,`f`)}[kGetLoggerInstance](){return __classPrivateFieldGet(this,_YargsInstance_logger,`f`)}[kGetParseContext](){return __classPrivateFieldGet(this,_YargsInstance_parseContext,`f`)||{}}[kGetUsageInstance](){return __classPrivateFieldGet(this,_YargsInstance_usage,`f`)}[kGetValidationInstance](){return __classPrivateFieldGet(this,_YargsInstance_validation,`f`)}[kHasParseCallback](){return!!__classPrivateFieldGet(this,_YargsInstance_parseFn,`f`)}[kIsGlobalContext](){return __classPrivateFieldGet(this,_YargsInstance_isGlobalContext,`f`)}[kPostProcess](l,d,f,m){return f||isPromise$1(l)?l:(d||(l=this[kCopyDoubleDash](l)),(this[kGetParserConfiguration]()[`parse-positional-numbers`]||this[kGetParserConfiguration]()[`parse-positional-numbers`]===void 0)&&(l=this[kParsePositionalNumbers](l)),m&&(l=applyMiddleware(l,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).getMiddleware(),!1)),l)}[kReset](l={}){__classPrivateFieldSet(this,_YargsInstance_options,__classPrivateFieldGet(this,_YargsInstance_options,`f`)||{},`f`);let d={};d.local=__classPrivateFieldGet(this,_YargsInstance_options,`f`).local||[],d.configObjects=__classPrivateFieldGet(this,_YargsInstance_options,`f`).configObjects||[];let f={};return d.local.forEach(d=>{f[d]=!0,(l[d]||[]).forEach(l=>{f[l]=!0})}),Object.assign(__classPrivateFieldGet(this,_YargsInstance_preservedGroups,`f`),Object.keys(__classPrivateFieldGet(this,_YargsInstance_groups,`f`)).reduce((l,d)=>{let m=__classPrivateFieldGet(this,_YargsInstance_groups,`f`)[d].filter(l=>!(l in f));return m.length>0&&(l[d]=m),l},{})),__classPrivateFieldSet(this,_YargsInstance_groups,{},`f`),[`array`,`boolean`,`string`,`skipValidation`,`count`,`normalize`,`number`,`hiddenOptions`].forEach(l=>{d[l]=(__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l]||[]).filter(l=>!f[l])}),[`narg`,`key`,`alias`,`default`,`defaultDescription`,`config`,`choices`,`demandedOptions`,`demandedCommands`,`deprecatedOptions`].forEach(l=>{d[l]=objFilter(__classPrivateFieldGet(this,_YargsInstance_options,`f`)[l],l=>!f[l])}),d.envPrefix=__classPrivateFieldGet(this,_YargsInstance_options,`f`).envPrefix,__classPrivateFieldSet(this,_YargsInstance_options,d,`f`),__classPrivateFieldSet(this,_YargsInstance_usage,__classPrivateFieldGet(this,_YargsInstance_usage,`f`)?__classPrivateFieldGet(this,_YargsInstance_usage,`f`).reset(f):usage(this,__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldSet(this,_YargsInstance_validation,__classPrivateFieldGet(this,_YargsInstance_validation,`f`)?__classPrivateFieldGet(this,_YargsInstance_validation,`f`).reset(f):validation(this,__classPrivateFieldGet(this,_YargsInstance_usage,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldSet(this,_YargsInstance_command,__classPrivateFieldGet(this,_YargsInstance_command,`f`)?__classPrivateFieldGet(this,_YargsInstance_command,`f`).reset():command(__classPrivateFieldGet(this,_YargsInstance_usage,`f`),__classPrivateFieldGet(this,_YargsInstance_validation,`f`),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldGet(this,_YargsInstance_completion,`f`)||__classPrivateFieldSet(this,_YargsInstance_completion,completion(this,__classPrivateFieldGet(this,_YargsInstance_usage,`f`),__classPrivateFieldGet(this,_YargsInstance_command,`f`),__classPrivateFieldGet(this,_YargsInstance_shim,`f`)),`f`),__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).reset(),__classPrivateFieldSet(this,_YargsInstance_completionCommand,null,`f`),__classPrivateFieldSet(this,_YargsInstance_output,``,`f`),__classPrivateFieldSet(this,_YargsInstance_exitError,null,`f`),__classPrivateFieldSet(this,_YargsInstance_hasOutput,!1,`f`),this.parsed=!1,this}[kRebase](l,d){return __classPrivateFieldGet(this,_YargsInstance_shim,`f`).path.relative(l,d)}[kRunYargsParserAndExecuteCommands](l,d,f,m=0,te=!1){var re,ie,ae,oe;let se=!!f||te;l||=__classPrivateFieldGet(this,_YargsInstance_processArgs,`f`),__classPrivateFieldGet(this,_YargsInstance_options,`f`).__=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).y18n.__,__classPrivateFieldGet(this,_YargsInstance_options,`f`).configuration=this[kGetParserConfiguration]();let ce=!!__classPrivateFieldGet(this,_YargsInstance_options,`f`).configuration[`populate--`],le=Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,`f`).configuration,{"populate--":!0}),ue=__classPrivateFieldGet(this,_YargsInstance_shim,`f`).Parser.detailed(l,Object.assign({},__classPrivateFieldGet(this,_YargsInstance_options,`f`),{configuration:{"parse-positional-numbers":!1,...le}})),de=Object.assign(ue.argv,__classPrivateFieldGet(this,_YargsInstance_parseContext,`f`)),fe,pe=ue.aliases,me=!1,he=!1;Object.keys(de).forEach(l=>{l===__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)&&de[l]?me=!0:l===__classPrivateFieldGet(this,_YargsInstance_versionOpt,`f`)&&de[l]&&(he=!0)}),de.$0=this.$0,this.parsed=ue,m===0&&__classPrivateFieldGet(this,_YargsInstance_usage,`f`).clearCachedHelpMessage();try{if(this[kGuessLocale](),d)return this[kPostProcess](de,ce,!!f,!1);__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)&&[__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)].concat(pe[__classPrivateFieldGet(this,_YargsInstance_helpOpt,`f`)]||[]).filter(l=>l.length>1).includes(``+de._[de._.length-1])&&(de._.pop(),me=!0),__classPrivateFieldSet(this,_YargsInstance_isGlobalContext,!1,`f`);let re=__classPrivateFieldGet(this,_YargsInstance_command,`f`).getCommands(),ie=__classPrivateFieldGet(this,_YargsInstance_completion,`f`)?.completionKey?[__classPrivateFieldGet(this,_YargsInstance_completion,`f`)?.completionKey,...this.getAliases()[__classPrivateFieldGet(this,_YargsInstance_completion,`f`)?.completionKey]??[]].some(l=>Object.prototype.hasOwnProperty.call(de,l)):!1,ae=me||ie||te;if(de._.length){if(re.length){let l;for(let d=m||0,ie;de._[d]!==void 0;d++)if(ie=String(de._[d]),re.includes(ie)&&ie!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)){let l=__classPrivateFieldGet(this,_YargsInstance_command,`f`).runCommand(ie,this,ue,d+1,te,me||he||te);return this[kPostProcess](l,ce,!!f,!1)}else if(!l&&ie!==__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)){l=ie;break}!__classPrivateFieldGet(this,_YargsInstance_command,`f`).hasDefaultCommand()&&__classPrivateFieldGet(this,_YargsInstance_recommendCommands,`f`)&&l&&!ae&&__classPrivateFieldGet(this,_YargsInstance_validation,`f`).recommendCommands(l,re)}__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`)&&de._.includes(__classPrivateFieldGet(this,_YargsInstance_completionCommand,`f`))&&!ie&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,_YargsInstance_command,`f`).hasDefaultCommand()&&!ae){let l=__classPrivateFieldGet(this,_YargsInstance_command,`f`).runCommand(null,this,ue,0,te,me||he||te);return this[kPostProcess](l,ce,!!f,!1)}if(ie){__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),l=[].concat(l);let d=l.slice(l.indexOf(`--${__classPrivateFieldGet(this,_YargsInstance_completion,`f`).completionKey}`)+1);return __classPrivateFieldGet(this,_YargsInstance_completion,`f`).getCompletion(d,(l,d)=>{if(l)throw new YError(l.message);(d||[]).forEach(l=>{__classPrivateFieldGet(this,_YargsInstance_logger,`f`).log(l)}),this.exit(0)}),this[kPostProcess](de,!ce,!!f,!1)}if(__classPrivateFieldGet(this,_YargsInstance_hasOutput,`f`)||(me?(__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),se=!0,this.showHelp(l=>{__classPrivateFieldGet(this,_YargsInstance_logger,`f`).log(l),this.exit(0)})):he&&(__classPrivateFieldGet(this,_YargsInstance_exitProcess,`f`)&&setBlocking(!0),se=!0,__classPrivateFieldGet(this,_YargsInstance_usage,`f`).showVersion(`log`),this.exit(0))),!se&&__classPrivateFieldGet(this,_YargsInstance_options,`f`).skipValidation.length>0&&(se=Object.keys(de).some(l=>__classPrivateFieldGet(this,_YargsInstance_options,`f`).skipValidation.indexOf(l)>=0&&de[l]===!0)),!se){if(ue.error)throw new YError(ue.error.message);if(!ie){let l=this[kRunValidation](pe,{},ue.error);f||(fe=applyMiddleware(de,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).getMiddleware(),!0)),fe=this[kValidateAsync](l,fe??de),isPromise$1(fe)&&!f&&(fe=fe.then(()=>applyMiddleware(de,this,__classPrivateFieldGet(this,_YargsInstance_globalMiddleware,`f`).getMiddleware(),!1)))}}}catch(l){if(l instanceof YError)__classPrivateFieldGet(this,_YargsInstance_usage,`f`).fail(l.message,l);else throw l}return this[kPostProcess](fe??de,ce,!!f,!0)}[kRunValidation](l,d,f,m){let te={...this.getDemandedOptions()};return re=>{if(f)throw new YError(f.message);__classPrivateFieldGet(this,_YargsInstance_validation,`f`).nonOptionCount(re),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).requiredArguments(re,te);let ie=!1;__classPrivateFieldGet(this,_YargsInstance_strictCommands,`f`)&&(ie=__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unknownCommands(re)),__classPrivateFieldGet(this,_YargsInstance_strict,`f`)&&!ie?__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unknownArguments(re,l,d,!!m):__classPrivateFieldGet(this,_YargsInstance_strictOptions,`f`)&&__classPrivateFieldGet(this,_YargsInstance_validation,`f`).unknownArguments(re,l,{},!1,!1),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).limitedChoices(re),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).implications(re),__classPrivateFieldGet(this,_YargsInstance_validation,`f`).conflicting(re)}}[kSetHasOutput](){__classPrivateFieldSet(this,_YargsInstance_hasOutput,!0,`f`)}[kTrackManuallySetKeys](l){if(typeof l==`string`)__classPrivateFieldGet(this,_YargsInstance_options,`f`).key[l]=!0;else for(let d of l)__classPrivateFieldGet(this,_YargsInstance_options,`f`).key[d]=!0}};function isYargsInstance(l){return!!l&&typeof l.getInternalMethods==`function`}const Yargs=YargsFactory(esm_default);function charAt(l,d){return l.charAt(d)}function join$4(l,d=``){return l.join(d)}function replaceAll(l,d,f=``){if(typeof l.replaceAll==`function`)return l.replaceAll(d,f);let m=new RegExp(d,`g`);return l.replace(m,f)}function slice(l,d=0,f=void 0){return l.slice(d,f)}function toLowerCase(l){return l.toLowerCase()}function toUpperCase(l){return l.toUpperCase()}function removeApostrophe(l){return replaceAll(l,`'`,``)}function capitalize(l){return join$4([toUpperCase(charAt(l,0)??``),slice(l,1)])}function pascalCaseAll(l){return l.map(l=>capitalize(toLowerCase(l)))}var UNESCAPED_SEPARATORS=[`[`,`]`,`{`,`}`,`(`,`)`,`|`,`/`,`-`,`\\`],SEPARATORS=[...UNESCAPED_SEPARATORS,` `,`_`,`.`];function escapeChar(l){return UNESCAPED_SEPARATORS.includes(l)?`\\${l}`:l}var SEPARATOR_REGEX=RegExp(`[${SEPARATORS.map(escapeChar).join(``)}]`,`g`);function words(l){return l.replace(SEPARATOR_REGEX,` `).replace(/([a-zA-Z])([0-9])/g,`$1 $2`).replace(/([0-9])([a-zA-Z])/g,`$1 $2`).replace(/([a-zA-Z0-9_\-./])([^a-zA-Z0-9_\-./'])/g,`$1 $2`).replace(/([^a-zA-Z0-9_\-./'])([a-zA-Z0-9_\-./])/g,`$1 $2`).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).trim().split(/\s+/g)}function pascalCase(l){return join$4(pascalCaseAll(words(removeApostrophe(l))))}function delimiterCase(l,d){return join$4(words(removeApostrophe(l)),d)}function kebabCase(l){return toLowerCase(delimiterCase(removeApostrophe(l),`-`))}function titleCase(l){return delimiterCase(pascalCase(l),` `)}var name=`metascope`,version$1=`0.8.5`,bin={metascope:`dist/bin/cli.js`};function isPlainObject$8(l){if(typeof l!=`object`||!l)return!1;let d=Object.getPrototypeOf(l);return d!==null&&d!==Object.prototype&&Object.getPrototypeOf(d)!==null||Symbol.iterator in l?!1:Symbol.toStringTag in l?Object.prototype.toString.call(l)===`[object Module]`:!0}function _defu(l,d,f=`.`,m){if(!isPlainObject$8(d))return _defu(l,{},f,m);let te={...d};for(let d of Object.keys(l)){if(d===`__proto__`||d===`constructor`)continue;let re=l[d];re!=null&&(m&&m(te,d,re,f)||(Array.isArray(re)&&Array.isArray(te[d])?te[d]=[...re,...te[d]]:isPlainObject$8(re)&&isPlainObject$8(te[d])?te[d]=_defu(re,te[d],(f?`${f}.`:``)+d.toString(),m):te[d]=re))}return te}function createDefu(l){return(...d)=>d.reduce((d,f)=>_defu(d,f,``,l),{})}const defu=createDefu(),defuFn=createDefu((l,d,f)=>{if(l[d]!==void 0&&typeof f==`function`)return l[d]=f(l[d]),!0}),defuArrayFn=createDefu((l,d,f)=>{if(Array.isArray(l[d])&&typeof f==`function`)return l[d]=f(l[d]),!0});let LogLevel=function(l){return l.info=`info`,l.warn=`warn`,l.error=`error`,l.debug=`debug`,l.trace=`trace`,l.fatal=`fatal`,l}({});const LogLevelPriority={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},LAZY_SYMBOL=Symbol.for(`loglayer.lazy`),LAZY_EVAL_ERROR=`[LazyEvalError]`;function isLazy(l){return typeof l==`object`&&!!l&&LAZY_SYMBOL in l}function countLazyValues(l){let d=0;for(let f of Object.keys(l))isLazy(l[f])&&d++;return d}function resolveLazyValues(l){let d=!1;for(let f of Object.keys(l))if(isLazy(l[f])){d=!0;break}if(!d)return{resolved:l,errors:null};let f={},m=null;for(let d of Object.keys(l)){let te=l[d];if(isLazy(te))try{f[d]=te[LAZY_SYMBOL]()}catch(l){f[d]=LAZY_EVAL_ERROR,m||=[],m.push({key:d,error:l})}else f[d]=te}return{resolved:f,errors:m}}function hasPromiseValues(l){for(let d of Object.keys(l))if(l[d]instanceof Promise)return!0;return!1}function replacePromiseValues(l){let d=null,f={};for(let m of Object.keys(l))l[m]instanceof Promise?(f[m]=LAZY_EVAL_ERROR,d||=[],d.push(m)):f[m]=l[m];return d?{resolved:f,asyncKeys:d}:{resolved:l,asyncKeys:null}}async function resolvePromiseValues(l){let d=Object.keys(l),f=await Promise.allSettled(d.map(d=>Promise.resolve(l[d]))),m={},te=null;for(let l=0;l<d.length;l++){let re=f[l];re.status===`fulfilled`?m[d[l]]=re.value:(m[d[l]]=LAZY_EVAL_ERROR,te||=[],te.push({key:d[l],error:re.reason}))}return{resolved:m,errors:te}}function resolveMessages(l){let d=l[0];if(Array.isArray(d)&&d.raw!==void 0){let f=d,m=l.slice(1),te=``;for(let l=0;l<f.length;l++)te+=f[l],l<m.length&&(te+=String(m[l]));return[te]}return l}let PluginCallbackType=function(l){return l.transformLogLevel=`transformLogLevel`,l.onBeforeDataOut=`onBeforeDataOut`,l.shouldSendToLogger=`shouldSendToLogger`,l.onMetadataCalled=`onMetadataCalled`,l.onBeforeMessageOut=`onBeforeMessageOut`,l.onContextCalled=`onContextCalled`,l}({});var DefaultContextManager=class l{context={};hasContext=!1;setContext(l){if(!l){this.context={},this.hasContext=!1;return}this.context=l,this.hasContext=!0}appendContext(l){this.context={...this.context,...l},this.hasContext=!0}getContext(){return this.context}hasContextData(){return this.hasContext}clearContext(l){if(l===void 0){this.context={},this.hasContext=!1;return}let d=Array.isArray(l)?l:[l];for(let l of d)delete this.context[l];this.hasContext=Object.keys(this.context).length>0}onChildLoggerCreated({parentContextManager:l,childContextManager:d}){if(l.hasContextData()){let f=l.getContext();d.setContext({...f})}}clone(){let d=new l;return d.setContext({...this.context}),d.hasContext=this.hasContext,d}},MockContextManager=class l{setContext(l){}appendContext(l){}getContext(){return{}}hasContextData(){return!1}clearContext(l){}onChildLoggerCreated(l){}clone(){return new l}},DefaultLogLevelManager=class l{logLevelEnabledStatus={info:!0,warn:!0,error:!0,debug:!0,trace:!0,fatal:!0};setLevel(l){let d=LogLevelPriority[l];for(let l of Object.values(LogLevel)){let f=l,m=LogLevelPriority[l];this.logLevelEnabledStatus[f]=m>=d}}enableIndividualLevel(l){let d=l;d in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[d]=!0)}disableIndividualLevel(l){let d=l;d in this.logLevelEnabledStatus&&(this.logLevelEnabledStatus[d]=!1)}isLevelEnabled(l){let d=l;return this.logLevelEnabledStatus[d]}enableLogging(){for(let l of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[l]=!0}disableLogging(){for(let l of Object.keys(this.logLevelEnabledStatus))this.logLevelEnabledStatus[l]=!1}onChildLoggerCreated({parentLogLevelManager:d,childLogLevelManager:f}){let m=d.logLevelEnabledStatus;f instanceof l&&(f.logLevelEnabledStatus={...m})}clone(){let d=new l;return d.logLevelEnabledStatus={...this.logLevelEnabledStatus},d}},MockLogLevelManager=class l{setLevel(l){}enableIndividualLevel(l){}disableIndividualLevel(l){}isLevelEnabled(l){return!0}enableLogging(){}disableLogging(){}onChildLoggerCreated(l){}clone(){return new l}},BaseTransport=class{id;logger;enabled;consoleDebug;level;constructor(l){this.id=l.id??Date.now().toString()+Math.random().toString(),this.logger=l.logger,this.enabled=l.enabled??!0,this.consoleDebug=l.consoleDebug??!1,this.level=l.level??`trace`}_sendToLogger(l){if(!this.enabled||LogLevelPriority[l.logLevel]<LogLevelPriority[this.level])return;let d=this.shipToLogger(l);if(this.consoleDebug)switch(l.logLevel){case LogLevel.info:console.info(...d);break;case LogLevel.warn:console.warn(...d);break;case LogLevel.error:console.error(...d);break;case LogLevel.trace:console.debug(...d);break;case LogLevel.debug:console.debug(...d);break;case LogLevel.fatal:console.debug(...d);break;default:console.log(...d)}}getLoggerInstance(){return this.logger}},LoggerlessTransport=class{id;enabled;level;consoleDebug;constructor(l){this.id=l.id??Date.now().toString()+Math.random().toString(),this.enabled=l.enabled??!0,this.consoleDebug=l.consoleDebug??!1,this.level=l.level??`trace`}_sendToLogger(l){if(!this.enabled||LogLevelPriority[l.logLevel]<LogLevelPriority[this.level])return;let d=this.shipToLogger(l);if(this.consoleDebug)switch(l.logLevel){case LogLevel.info:console.info(...d);break;case LogLevel.warn:console.warn(...d);break;case LogLevel.error:console.error(...d);break;case LogLevel.trace:console.debug(...d);break;case LogLevel.debug:console.debug(...d);break;case LogLevel.fatal:console.debug(...d);break;default:console.log(...d)}}getLoggerInstance(){throw Error(`This transport does not have a logger instance`)}};const CALLBACK_LIST=[PluginCallbackType.onBeforeDataOut,PluginCallbackType.onMetadataCalled,PluginCallbackType.onBeforeMessageOut,PluginCallbackType.transformLogLevel,PluginCallbackType.shouldSendToLogger,PluginCallbackType.onContextCalled];var PluginManager=class{idToPlugin;transformLogLevel=[];onBeforeDataOut=[];shouldSendToLogger=[];onMetadataCalled=[];onBeforeMessageOut=[];onContextCalled=[];constructor(l){this.idToPlugin={},this.mapPlugins(l),this.indexPlugins()}mapPlugins(l){for(let d of l){if(d.id||=Date.now().toString()+Math.random().toString(),this.idToPlugin[d.id])throw Error(`[LogLayer] Plugin with id ${d.id} already exists.`);d.registeredAt=Date.now(),this.idToPlugin[d.id]=d}}indexPlugins(){this.transformLogLevel=[],this.onBeforeDataOut=[],this.shouldSendToLogger=[],this.onMetadataCalled=[],this.onBeforeMessageOut=[],this.onContextCalled=[];let l=Object.values(this.idToPlugin).sort((l,d)=>l.registeredAt-d.registeredAt);for(let d of l){if(d.disabled)return;for(let l of CALLBACK_LIST)d[l]&&d.id&&this[l].push(d.id)}}hasPlugins(l){return this[l].length>0}countPlugins(l){return l?this[l].length:Object.keys(this.idToPlugin).length}addPlugins(l){this.mapPlugins(l),this.indexPlugins()}enablePlugin(l){let d=this.idToPlugin[l];d&&(d.disabled=!1),this.indexPlugins()}disablePlugin(l){let d=this.idToPlugin[l];d&&(d.disabled=!0),this.indexPlugins()}removePlugin(l){delete this.idToPlugin[l],this.indexPlugins()}runTransformLogLevel(l,d){let f=null;for(let m of this.transformLogLevel){let te=this.idToPlugin[m];if(te.transformLogLevel){let m=te.transformLogLevel({data:l.data,logLevel:l.logLevel,messages:l.messages,error:l.error,metadata:l.metadata,context:l.context,groups:l.groups,schema:l.schema,prefix:l.prefix},d);m!=null&&m!==!1&&(f=m)}}return f!=null&&f!==!1?f:l.logLevel}runOnBeforeDataOut(l,d){let f={...l},m=f.data;for(let l of this.onBeforeDataOut){let te=this.idToPlugin[l];if(te.onBeforeDataOut){let l=te.onBeforeDataOut({data:f.data,logLevel:f.logLevel,error:f.error,metadata:f.metadata,context:f.context,groups:f.groups,schema:f.schema,prefix:f.prefix},d);l&&(f.data||={},l!==m&&Object.assign(f.data,l))}}return f.data}runShouldSendToLogger(l,d){return!this.shouldSendToLogger.some(f=>!this.idToPlugin[f].shouldSendToLogger?.(l,d))}runOnMetadataCalled(l,d){let f={...l};for(let l of this.onMetadataCalled){let m=this.idToPlugin[l].onMetadataCalled?.(f,d);if(m)f=m;else return null}return f}runOnBeforeMessageOut(l,d){let f=[...l.messages];for(let m of this.onBeforeMessageOut){let te=this.idToPlugin[m].onBeforeMessageOut?.({messages:f,logLevel:l.logLevel,groups:l.groups,schema:l.schema,prefix:l.prefix},d);te&&(f=te)}return f}runOnContextCalled(l,d){let f={...l};for(let l of this.onContextCalled){let m=this.idToPlugin[l].onContextCalled?.(f,d);if(m)f=m;else return null}return f}},LogLayer=class l{pluginManager;idToTransport;hasMultipleTransports;singleTransport;contextManager;logLevelManager;_isLoggingLazyError=!1;_lazyContextCount=0;_assignedGroups=null;_groupsConfig=null;_activeGroups=null;_ungroupedBehavior=`all`;_config;constructor(l){this._config={...l,enabled:l.enabled??!0},this.contextManager=new DefaultContextManager,this.logLevelManager=new DefaultLogLevelManager,this._config.enabled||this.disableLogging();let d=[...l.plugins||[],...mixinRegistry.pluginsToInit];this.pluginManager=new PluginManager(d),this._config.errorFieldName||(this._config.errorFieldName=`err`),this._config.copyMsgOnOnlyError||(this._config.copyMsgOnOnlyError=!1),this._initializeTransports(this._config.transport),this._groupsConfig=l.groups?{...l.groups}:null,this._ungroupedBehavior=l.ungroupedBehavior??`all`,this._activeGroups=l.activeGroups?new Set(l.activeGroups):null,this._parseEnvGroups(),mixinRegistry.logLayerHandlers.length>0&&mixinRegistry.logLayerHandlers.forEach(d=>{d.onConstruct&&d.onConstruct(this,l)})}withContextManager(l){return this.contextManager&&typeof this.contextManager[Symbol.dispose]==`function`&&this.contextManager[Symbol.dispose](),this.contextManager=l,this._lazyContextCount=l.hasContextData()?countLazyValues(l.getContext()):0,this}getContextManager(){return this.contextManager}withLogLevelManager(l){return this.logLevelManager&&typeof this.logLevelManager[Symbol.dispose]==`function`&&this.logLevelManager[Symbol.dispose](),this.logLevelManager=l,this}getLogLevelManager(){return this.logLevelManager}getConfig(){return this._config}_initializeTransports(l){if(this.idToTransport)for(let l in this.idToTransport)this.idToTransport[l]&&typeof this.idToTransport[l][Symbol.dispose]==`function`&&this.idToTransport[l][Symbol.dispose]();this.hasMultipleTransports=Array.isArray(l)&&l.length>1,this.singleTransport=this.hasMultipleTransports?null:Array.isArray(l)?l[0]:l,Array.isArray(l)?this.idToTransport=l.reduce((l,d)=>(l[d.id]=d,l),{}):this.idToTransport={[l.id]:l}}withPrefix(l){let d=this.child();return d._config.prefix=l,d}withGroup(l){let d=this.child(),f=Array.isArray(l)?l:[l];if(d._assignedGroups){let l=new Set([...d._assignedGroups,...f]);d._assignedGroups=Array.from(l)}else d._assignedGroups=[...f];return d}addGroup(l,d){return this._groupsConfig||={},this._groupsConfig[l]={...d},this}removeGroup(l){return this._groupsConfig&&(delete this._groupsConfig[l],Object.keys(this._groupsConfig).length===0&&(this._groupsConfig=null)),this}enableGroup(l){return this._groupsConfig?.[l]&&(this._groupsConfig[l]={...this._groupsConfig[l],enabled:!0}),this}disableGroup(l){return this._groupsConfig?.[l]&&(this._groupsConfig[l]={...this._groupsConfig[l],enabled:!1}),this}setGroupLevel(l,d){return this._groupsConfig?.[l]&&(this._groupsConfig[l]={...this._groupsConfig[l],level:d}),this}setActiveGroups(l){return this._activeGroups=l?new Set(l):null,this}getGroups(){return this._groupsConfig?{...this._groupsConfig}:{}}withContext(l){let d=l;if(!l)return this._config.consoleDebug&&console.debug(`[LogLayer] withContext was called with no context; dropping.`),this;if(this.pluginManager.hasPlugins(PluginCallbackType.onContextCalled)&&(d=this.pluginManager.runOnContextCalled(l,this),!d))return this._config.consoleDebug&&console.debug(`[LogLayer] Context was dropped due to plugin returning falsy value.`),this;let f=this.contextManager.getContext();for(let l of Object.keys(d)){let m=l in f&&isLazy(f[l]),te=isLazy(d[l]);!m&&te?this._lazyContextCount++:m&&!te&&this._lazyContextCount--}return this.contextManager.appendContext(d),this}clearContext(l){if(l!==void 0&&this._lazyContextCount>0){let d=this.contextManager.getContext(),f=Array.isArray(l)?l:[l];for(let l of f)l in d&&isLazy(d[l])&&this._lazyContextCount--}else l===void 0&&(this._lazyContextCount=0);return this.contextManager.clearContext(l),this}getContext(l){let d=this.contextManager.getContext();if(l?.raw||this._lazyContextCount===0)return d;let{resolved:f,errors:m}=resolveLazyValues(d);m&&this._logLazyEvalErrors(m,`context`);let{resolved:te,asyncKeys:re}=replacePromiseValues(f);return re&&this._logAsyncLazyContextErrors(re),te}addPlugins(l){this.pluginManager.addPlugins(l)}enablePlugin(l){this.pluginManager.enablePlugin(l)}disablePlugin(l){this.pluginManager.disablePlugin(l)}removePlugin(l){this.pluginManager.removePlugin(l)}withMetadata(l){return new LogBuilder(this).withMetadata(l)}withError(l){return new LogBuilder(this).withError(l)}child(){let d=new l({...this._config,transport:Array.isArray(this._config.transport)?[...this._config.transport]:this._config.transport}).withPluginManager(this.pluginManager).withContextManager(this.contextManager.clone()).withLogLevelManager(this.logLevelManager.clone());return this.contextManager.onChildLoggerCreated({parentContextManager:this.contextManager,childContextManager:d.contextManager,parentLogger:this,childLogger:d}),this.logLevelManager.onChildLoggerCreated({parentLogLevelManager:this.logLevelManager,childLogLevelManager:d.logLevelManager,parentLogger:this,childLogger:d}),d._lazyContextCount=d.contextManager.hasContextData()?countLazyValues(d.contextManager.getContext()):0,d._groupsConfig=this._groupsConfig,d._activeGroups=this._activeGroups,d._ungroupedBehavior=this._ungroupedBehavior,d._assignedGroups=this._assignedGroups?[...this._assignedGroups]:null,d}withFreshTransports(l){return this._config.transport=l,this._initializeTransports(l),this}addTransport(l){let d=Array.isArray(l)?l:[l],f=Array.isArray(this._config.transport)?this._config.transport:[this._config.transport],m=new Set(d.map(l=>l.id));for(let l of d){let d=this.idToTransport[l.id];d&&typeof d[Symbol.dispose]==`function`&&d[Symbol.dispose]()}let te=[...f.filter(l=>!m.has(l.id)),...d];this._config.transport=te;for(let l of d)this.idToTransport[l.id]=l;return this.hasMultipleTransports=te.length>1,this.singleTransport=this.hasMultipleTransports?null:te[0],this}removeTransport(l){let d=this.idToTransport[l];if(!d)return!1;typeof d[Symbol.dispose]==`function`&&d[Symbol.dispose](),delete this.idToTransport[l];let f=(Array.isArray(this._config.transport)?this._config.transport:[this._config.transport]).filter(d=>d.id!==l);return this._config.transport=f.length===1?f[0]:f,this.hasMultipleTransports=f.length>1,this.singleTransport=this.hasMultipleTransports?null:f[0]||null,!0}withFreshPlugins(l){return this._config.plugins=l,this.pluginManager=new PluginManager(l),this}withPluginManager(l){return this.pluginManager=l,this}errorOnly(l,d){let f=d?.logLevel||LogLevel.error;if(!this.isLevelEnabled(f))return;let{copyMsgOnOnlyError:m}=this._config,te={logLevel:f,err:l};(m&&d?.copyMsg!==!1||d?.copyMsg===!0)&&l?.message&&(te.params=[l.message]),this._formatLog(te)}metadataOnly(l,d=LogLevel.info){if(!this.isLevelEnabled(d))return;let{muteMetadata:f,consoleDebug:m}=this._config;if(f)return;if(!l){m&&console.debug(`[LogLayer] metadataOnly was called with no metadata; dropping.`);return}let te=l;if(this.pluginManager.hasPlugins(PluginCallbackType.onMetadataCalled)&&(te=this.pluginManager.runOnMetadataCalled(l,this),!te)){m&&console.debug(`[LogLayer] Metadata was dropped due to plugin returning falsy value.`);return}let re={logLevel:d,metadata:te};return this._formatLog(re)}info(...l){if(!this.isLevelEnabled(LogLevel.info))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.info,params:d})}warn(...l){if(!this.isLevelEnabled(LogLevel.warn))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.warn,params:d})}error(...l){if(!this.isLevelEnabled(LogLevel.error))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.error,params:d})}debug(...l){if(!this.isLevelEnabled(LogLevel.debug))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.debug,params:d})}trace(...l){if(!this.isLevelEnabled(LogLevel.trace))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.trace,params:d})}fatal(...l){if(!this.isLevelEnabled(LogLevel.fatal))return;let d=resolveMessages(l);this._formatMessage(d),this._formatLog({logLevel:LogLevel.fatal,params:d})}raw(l){if(!this.isLevelEnabled(l.logLevel))return;let d={logLevel:l.logLevel,params:l.messages,metadata:l.metadata,rootData:l.rootData,err:l.error,context:l.context};return this._formatMessage(l.messages),this._formatLog(d)}disableLogging(){return this.logLevelManager.disableLogging(),this}enableLogging(){return this.logLevelManager.enableLogging(),this}muteContext(){return this._config.muteContext=!0,this}unMuteContext(){return this._config.muteContext=!1,this}muteMetadata(){return this._config.muteMetadata=!0,this}unMuteMetadata(){return this._config.muteMetadata=!1,this}enableIndividualLevel(l){return this.logLevelManager.enableIndividualLevel(l),this}disableIndividualLevel(l){return this.logLevelManager.disableIndividualLevel(l),this}setLevel(l){return this.logLevelManager.setLevel(l),this}isLevelEnabled(l){return this.logLevelManager.isLevelEnabled(l)}formatContext(l){let{contextFieldName:d,muteContext:f}=this._config;return l&&Object.keys(l).length>0&&!f?d?{[d]:{...l}}:{...l}:{}}formatMetadata(l=null){let{metadataFieldName:d,muteMetadata:f}=this._config;return l&&!f?d?{[d]:{...l}}:{...l}:{}}getLoggerInstance(l){let d=this.idToTransport[l];if(d)return d.getLoggerInstance()}_parseEnvGroups(){let l=typeof process<`u`?process.env?.LOGLAYER_GROUPS:void 0;if(!l)return;let d=l.split(`,`).map(l=>l.trim()).filter(Boolean),f=[];for(let l of d){let d=l.indexOf(`:`);if(d>0){let m=l.slice(0,d),te=l.slice(d+1);f.push(m),this._groupsConfig?.[m]&&(this._groupsConfig[m]={...this._groupsConfig[m],level:te})}else f.push(l)}this._activeGroups=new Set(f)}_mergeGroups(l){if(this._assignedGroups&&l){let d=new Set([...this._assignedGroups,...l]);return Array.from(d)}return l||this._assignedGroups}_applyUngroupedRules(l){return this._ungroupedBehavior===`all`?!0:this._ungroupedBehavior===`none`?!1:this._ungroupedBehavior.includes(l)}_shouldTransportReceiveLog(l,d,f){if(!this._groupsConfig)return!0;let m=this._mergeGroups(f);if(!m||m.length===0)return this._applyUngroupedRules(l);let te=!1;for(let f of m){let m=this._groupsConfig[f];if(m&&(te=!0,m.enabled!==!1&&!(this._activeGroups&&!this._activeGroups.has(f)))){if(m.level){let l=LogLevelPriority[m.level];if(LogLevelPriority[d]<l)continue}if(m.transports.includes(l))return!0}}return te?!1:this._applyUngroupedRules(l)}_formatMessage(l=[]){let{prefix:d}=this._config;d&&typeof l[0]==`string`&&(l[0]=`${d} ${l[0]}`)}_formatLog({logLevel:l,params:d=[],metadata:f=null,rootData:m=null,err:te,context:re=null,groups:ie=null}){let ae=re===null?this.contextManager.getContext():re,oe;if(this._lazyContextCount>0||re!==null){let l=resolveLazyValues(ae);l.errors&&this._logLazyEvalErrors(l.errors,`context`);let{resolved:d,asyncKeys:f}=replacePromiseValues(l.resolved);f&&this._logAsyncLazyContextErrors(f),oe=d}else oe=ae;let se=null;if(f){let l=resolveLazyValues(f);f=l.resolved,se=l.errors}if(se&&this._logLazyEvalErrors(se,`metadata`),f&&hasPromiseValues(f))return this._resolveAsyncAndProcess(l,d,oe,f,m,te,re,ie);this._processLog(l,d,oe,f,m,te,re,ie)}async _resolveAsyncAndProcess(l,d,f,m,te,re,ie,ae){let oe=null;if(m){let l=await resolvePromiseValues(m);oe=l.resolved,l.errors&&this._logLazyEvalErrors(l.errors,`metadata`)}this._processLog(l,d,f,oe,te,re,ie,ae)}_logLazyEvalErrors(l,d){if(this._isLoggingLazyError){for(let f of l)console.error(`[LogLayer] Lazy evaluation error in ${d} key "${f.key}":`,f.error);return}this._isLoggingLazyError=!0;try{for(let f of l){let l=f.error instanceof Error?f.error.message:String(f.error);this._processLog(LogLevel.error,[`[LogLayer] Lazy evaluation failed for ${d} key "${f.key}": ${l}`],{},null,null,f.error instanceof Error?f.error:void 0,{})}}finally{this._isLoggingLazyError=!1}}_logAsyncLazyContextErrors(l){if(this._isLoggingLazyError){for(let d of l)console.error(`[LogLayer] Async lazy values are not supported in context (key "${d}"). Use async lazy only in metadata.`);return}this._isLoggingLazyError=!0;try{for(let d of l)this._processLog(LogLevel.error,[`[LogLayer] Async lazy values are not supported in context (key "${d}"). Use async lazy only in metadata.`],{},null,null,void 0,{})}finally{this._isLoggingLazyError=!1}}_processLog(l,d,f,m,te,re,ie,ae=null){let{errorSerializer:oe,errorFieldInMetadata:se,muteContext:ce,contextFieldName:le,metadataFieldName:ue,errorFieldName:de,prefix:fe}=this._config,pe={contextFieldName:le??void 0,metadataFieldName:ue??void 0,errorFieldName:de??`err`},me=this._mergeGroups(ae)??void 0,he=!!m||(ce?!1:ie===null?this.contextManager.hasContextData():Object.keys(ie).length>0),ge={};if(he)if(le&&le===ue){let l=this.formatContext(f)[le],d=this.formatMetadata(m)[ue];ge={[le]:{...l,...d}}}else ge={...this.formatContext(f),...this.formatMetadata(m)};if(re){let l=oe?oe(re):re;se&&m&&ue?ge?.[ue]?ge[ue][de]=l:ge={...ge,[ue]:{[de]:l}}:ge=se&&!m&&ue?{...ge,[ue]:{[de]:l}}:{...ge,[de]:l},he=!0}te&&Object.keys(te).length>0&&(ge={...ge,...te},he=!0),this.pluginManager.hasPlugins(PluginCallbackType.onBeforeDataOut)&&(ge=this.pluginManager.runOnBeforeDataOut({data:he?ge:void 0,logLevel:l,error:re,metadata:m,context:f,groups:me,schema:pe,prefix:fe},this),ge&&!he&&(he=!0)),this.pluginManager.hasPlugins(PluginCallbackType.onBeforeMessageOut)&&(d=this.pluginManager.runOnBeforeMessageOut({messages:[...d],logLevel:l,groups:me,schema:pe,prefix:fe},this)),this.pluginManager.hasPlugins(PluginCallbackType.transformLogLevel)&&(l=this.pluginManager.runTransformLogLevel({data:he?ge:void 0,logLevel:l,messages:[...d],error:re,metadata:m,context:f,groups:me,schema:pe,prefix:fe},this));let _e={data:he?ge:void 0,error:re,metadata:m,context:f,groups:me,schema:pe,prefix:fe};if(this.hasMultipleTransports){let f=this._config.transport.filter(d=>!(!d.enabled||!this._shouldTransportReceiveLog(d.id,l,me))).map(async f=>{let m=l;if(!(this.pluginManager.hasPlugins(PluginCallbackType.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...d],logLevel:m,transportId:f.id,..._e},this)))return f._sendToLogger({logLevel:m,messages:[...d],hasData:he,..._e})});Promise.all(f).catch(l=>{this._config.consoleDebug&&console.error(`[LogLayer] Error executing transports:`,l)})}else{if(!this.singleTransport?.enabled||!this._shouldTransportReceiveLog(this.singleTransport.id,l,me)||this.pluginManager.hasPlugins(PluginCallbackType.shouldSendToLogger)&&!this.pluginManager.runShouldSendToLogger({messages:[...d],logLevel:l,transportId:this.singleTransport.id,..._e},this))return;this.singleTransport._sendToLogger({logLevel:l,messages:[...d],hasData:he,..._e})}}},MockLogBuilder=class{debug(...l){}error(...l){}info(...l){}trace(...l){}warn(...l){}fatal(...l){}enableLogging(){return this}disableLogging(){return this}withMetadata(l){return this}withError(l){return this}withGroup(l){return this}},MockLogLayer=class{mockLogBuilder=new MockLogBuilder;mockContextManager=new MockContextManager;mockLogLevelManager=new MockLogLevelManager;info(...l){}warn(...l){}error(...l){}debug(...l){}trace(...l){}fatal(...l){}raw(l){}getLoggerInstance(l){}errorOnly(l,d){}metadataOnly(l,d){}addPlugins(l){}removePlugin(l){}enablePlugin(l){}disablePlugin(l){}withPrefix(l){return this}withGroup(l){return this}addGroup(l,d){return this}removeGroup(l){return this}enableGroup(l){return this}disableGroup(l){return this}setGroupLevel(l,d){return this}setActiveGroups(l){return this}getGroups(){return{}}withContext(l){return this}withError(l){return this.mockLogBuilder.withError(l)}withMetadata(l){return this.mockLogBuilder.withMetadata(l)}getContext(l){return{}}clearContext(l){return this}enableLogging(){return this}disableLogging(){return this}child(){return this}muteContext(){return this}unMuteContext(){return this}muteMetadata(){return this}unMuteMetadata(){return this}withFreshTransports(l){return this}addTransport(l){return this}removeTransport(l){return!0}withFreshPlugins(l){return this}withContextManager(l){return this}getContextManager(){return this.mockContextManager}withLogLevelManager(l){return this}getLogLevelManager(){return this.mockLogLevelManager}getConfig(){return{}}setMockLogBuilder(l){this.mockLogBuilder=l}enableIndividualLevel(l){return this}disableIndividualLevel(l){return this}setLevel(l){return this}isLevelEnabled(l){return!0}getMockLogBuilder(){return this.mockLogBuilder}resetMockLogBuilder(){this.mockLogBuilder=new MockLogBuilder}};const mixinRegistry={logLayerHandlers:[],pluginsToInit:[],logBuilderHandlers:[]};var LogBuilder=class{err;metadata;structuredLogger;hasMetadata;pluginManager;_groups=null;constructor(l){this.err=null,this.metadata={},this.structuredLogger=l,this.hasMetadata=!1,this.pluginManager=l.pluginManager,mixinRegistry.logBuilderHandlers.length>0&&mixinRegistry.logBuilderHandlers.forEach(d=>{d.onConstruct&&d.onConstruct(this,l)})}withMetadata(l){let{pluginManager:d,structuredLogger:{_config:{consoleDebug:f}}}=this;if(!l)return f&&console.debug(`[LogLayer] withMetadata was called with no metadata; dropping.`),this;let m=l;return d.hasPlugins(PluginCallbackType.onMetadataCalled)&&(m=d.runOnMetadataCalled(l,this.structuredLogger),!m)?(f&&console.debug(`[LogLayer] Metadata was dropped due to plugin returning falsy value.`),this):(this.metadata={...this.metadata,...m},this.hasMetadata=!0,this)}withError(l){return this.err=l,this}withGroup(l){let d=Array.isArray(l)?l:[l];if(this._groups){let l=new Set([...this._groups,...d]);this._groups=Array.from(l)}else this._groups=[...d];return this}info(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.info))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.info,d)}warn(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.warn))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.warn,d)}error(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.error))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.error,d)}debug(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.debug))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.debug,d)}trace(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.trace))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.trace,d)}fatal(...l){if(!this.structuredLogger.isLevelEnabled(LogLevel.fatal))return;let d=resolveMessages(l);return this.structuredLogger._formatMessage(d),this.formatLog(LogLevel.fatal,d)}disableLogging(){return this.structuredLogger.disableLogging(),this}enableLogging(){return this.structuredLogger.enableLogging(),this}formatLog(l,d){let{muteMetadata:f}=this.structuredLogger._config,m=f?!1:this.hasMetadata;return this.structuredLogger._formatLog({logLevel:l,params:d,metadata:m?this.metadata:null,err:this.err,groups:this._groups})}};const isNonErrorSymbol=Symbol(`isNonError`);function defineProperty(l,d,f){Object.defineProperty(l,d,{value:f,writable:!1,enumerable:!1,configurable:!1})}function stringify$3(l){if(l===void 0)return`undefined`;if(l===null)return`null`;if(typeof l==`string`)return l;if(typeof l==`number`||typeof l==`boolean`)return String(l);if(typeof l==`bigint`)return`${l}n`;if(typeof l==`symbol`)return l.toString();if(typeof l==`function`)return`[Function${l.name?` ${l.name}`:` (anonymous)`}]`;if(l instanceof Error)try{return String(l)}catch{return`<Unserializable error>`}try{return JSON.stringify(l)}catch{try{return String(l)}catch{return`<Unserializable value>`}}}var NonError$1=class l extends Error{constructor(d,{superclass:f=Error}={}){if(l.isNonError(d))return d;if(d instanceof Error)throw TypeError(`Do not pass Error instances to NonError. Throw the error directly instead.`);super(`Non-error value: ${stringify$3(d)}`),f!==Error&&Object.setPrototypeOf(this,f.prototype),defineProperty(this,`name`,`NonError`),defineProperty(this,isNonErrorSymbol,!0),defineProperty(this,`isNonError`,!0),defineProperty(this,`value`,d)}static isNonError(l){return l?.[isNonErrorSymbol]===!0}static#e(d,f){try{let m=d(...f);return m&&typeof m.then==`function`?(async()=>{try{return await m}catch(d){throw d instanceof Error?d:new l(d)}})():m}catch(d){throw d instanceof Error?d:new l(d)}}static try(d){return l.#e(d,[])}static wrap(d){return(...f)=>l.#e(d,f)}static[Symbol.hasInstance](d){return l.isNonError(d)}};const list$1=[Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(l=>[l.name,l]),errorConstructors=new Map(list$1),errorFactories=new Map,errorProperties=[{property:`name`,enumerable:!1},{property:`message`,enumerable:!1},{property:`stack`,enumerable:!1},{property:`code`,enumerable:!0},{property:`cause`,enumerable:!1},{property:`errors`,enumerable:!1}],toJsonWasCalled=new WeakSet,toJSON=l=>{toJsonWasCalled.add(l);let d=l.toJSON();return toJsonWasCalled.delete(l),d},newError=l=>{if(l===`NonError`)return new NonError$1;let d=errorFactories.get(l);if(d)return d();let f=errorConstructors.get(l)??Error;return f===AggregateError?new f([]):new f},destroyCircular=({from:l,seen:d,to:f,forceEnumerable:m,maxDepth:te,depth:re,useToJSON:ie,serialize:ae})=>{if(f||=Array.isArray(l)?[]:!ae&&isErrorLike(l)?newError(l.name):{},d.add(l),re>=te)return d.delete(l),f;if(ie&&typeof l.toJSON==`function`&&!toJsonWasCalled.has(l))return d.delete(l),toJSON(l);let oe=l=>destroyCircular({from:l,seen:d,forceEnumerable:m,maxDepth:te,depth:re+1,useToJSON:ie,serialize:ae});for(let m of Object.keys(l)){let te=l[m];if(te&&te instanceof Uint8Array&&te.constructor.name===`Buffer`){f[m]=ae?`[object Buffer]`:te;continue}if(typeof te==`object`&&te&&typeof te.pipe==`function`){f[m]=ae?`[object Stream]`:te;continue}if(typeof te==`function`){ae||(f[m]=te);continue}if(ae&&typeof te==`bigint`){f[m]=`${te}n`;continue}if(!te||typeof te!=`object`){try{f[m]=te}catch{}continue}if(!d.has(te)){f[m]=oe(te);continue}f[m]=`[Circular]`}if(ae||f instanceof Error)for(let{property:te,enumerable:re}of errorProperties){let ie=l[te];if(ie==null||Object.getOwnPropertyDescriptor(f,te)?.configurable===!1)continue;let ae=ie;typeof ie==`object`&&(ae=d.has(ie)?`[Circular]`:oe(ie)),Object.defineProperty(f,te,{value:ae,enumerable:m||re,configurable:!0,writable:!0})}return d.delete(l),f};function serializeError(l,d={}){let{maxDepth:f=1/0,useToJSON:m=!0}=d;return typeof l==`object`&&l?destroyCircular({from:l,seen:new Set,forceEnumerable:!0,maxDepth:f,depth:0,useToJSON:m,serialize:!0}):(typeof l==`function`&&(l=`<Function>`),destroyCircular({from:new NonError$1(l),seen:new Set,forceEnumerable:!0,maxDepth:f,depth:0,useToJSON:m,serialize:!0}))}function isErrorLike(l){return!!l&&typeof l==`object`&&typeof l.name==`string`&&typeof l.message==`string`&&typeof l.stack==`string`}var require_safe_stable_stringify=__commonJSMin(((l,d)=>{let{hasOwnProperty:f}=Object.prototype,m=he();m.configure=he,m.stringify=m,m.default=m,l.stringify=m,l.configure=he,d.exports=m;let te=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function re(l){return l.length<5e3&&!te.test(l)?`"${l}"`:JSON.stringify(l)}function ie(l,d){if(l.length>200||d)return l.sort(d);for(let d=1;d<l.length;d++){let f=l[d],m=d;for(;m!==0&&l[m-1]>f;)l[m]=l[m-1],m--;l[m]=f}return l}let ae=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function oe(l){return ae.call(l)!==void 0&&l.length!==0}function se(l,d,f){l.length<f&&(f=l.length);let m=d===`,`?``:` `,te=`"0":${m}${l[0]}`;for(let re=1;re<f;re++)te+=`${d}"${re}":${m}${l[re]}`;return te}function ce(l){if(f.call(l,`circularValue`)){let d=l.circularValue;if(typeof d==`string`)return`"${d}"`;if(d==null)return d;if(d===Error||d===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function le(l){let d;if(f.call(l,`deterministic`)&&(d=l.deterministic,typeof d!=`boolean`&&typeof d!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return d===void 0?!0:d}function ue(l,d){let m;if(f.call(l,d)&&(m=l[d],typeof m!=`boolean`))throw TypeError(`The "${d}" argument must be of type boolean`);return m===void 0?!0:m}function de(l,d){let m;if(f.call(l,d)){if(m=l[d],typeof m!=`number`)throw TypeError(`The "${d}" argument must be of type number`);if(!Number.isInteger(m))throw TypeError(`The "${d}" argument must be an integer`);if(m<1)throw RangeError(`The "${d}" argument must be >= 1`)}return m===void 0?1/0:m}function fe(l){return l===1?`1 item`:`${l} items`}function pe(l){let d=new Set;for(let f of l)(typeof f==`string`||typeof f==`number`)&&d.add(String(f));return d}function me(l){if(f.call(l,`strict`)){let d=l.strict;if(typeof d!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(d)return l=>{let d=`Object can not safely be stringified. Received type ${typeof l}`;throw typeof l!=`function`&&(d+=` (${l.toString()})`),Error(d)}}}function he(l){l={...l};let d=me(l);d&&(l.bigint===void 0&&(l.bigint=!1),`circularValue`in l||(l.circularValue=Error));let f=ce(l),m=ue(l,`bigint`),te=le(l),ae=typeof te==`function`?te:void 0,he=de(l,`maximumDepth`),ge=de(l,`maximumBreadth`);function _e(l,se,ce,le,ue,de){let pe=se[l];switch(typeof pe==`object`&&pe&&typeof pe.toJSON==`function`&&(pe=pe.toJSON(l)),pe=le.call(se,l,pe),typeof pe){case`string`:return re(pe);case`object`:{if(pe===null)return`null`;if(ce.indexOf(pe)!==-1)return f;let l=``,d=`,`,m=de;if(Array.isArray(pe)){if(pe.length===0)return`[]`;if(he<ce.length+1)return`"[Array]"`;ce.push(pe),ue!==``&&(de+=ue,l+=`\n${de}`,d=`,\n${de}`);let f=Math.min(pe.length,ge),te=0;for(;te<f-1;te++){let f=_e(String(te),pe,ce,le,ue,de);l+=f===void 0?`null`:f,l+=d}let re=_e(String(te),pe,ce,le,ue,de);if(l+=re===void 0?`null`:re,pe.length-1>ge){let f=pe.length-ge-1;l+=`${d}"... ${fe(f)} not stringified"`}return ue!==``&&(l+=`\n${m}`),ce.pop(),`[${l}]`}let se=Object.keys(pe),me=se.length;if(me===0)return`{}`;if(he<ce.length+1)return`"[Object]"`;let ve=``,ye=``;ue!==``&&(de+=ue,d=`,\n${de}`,ve=` `);let be=Math.min(me,ge);te&&!oe(pe)&&(se=ie(se,ae)),ce.push(pe);for(let f=0;f<be;f++){let m=se[f],te=_e(m,pe,ce,le,ue,de);te!==void 0&&(l+=`${ye}${re(m)}:${ve}${te}`,ye=d)}if(me>ge){let f=me-ge;l+=`${ye}"...":${ve}"${fe(f)} not stringified"`,ye=d}return ue!==``&&ye.length>1&&(l=`\n${de}${l}\n${m}`),ce.pop(),`{${l}}`}case`number`:return isFinite(pe)?String(pe):d?d(pe):`null`;case`boolean`:return pe===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(pe);default:return d?d(pe):void 0}}function ve(l,te,ie,ae,oe,se){switch(typeof te==`object`&&te&&typeof te.toJSON==`function`&&(te=te.toJSON(l)),typeof te){case`string`:return re(te);case`object`:{if(te===null)return`null`;if(ie.indexOf(te)!==-1)return f;let l=se,d=``,m=`,`;if(Array.isArray(te)){if(te.length===0)return`[]`;if(he<ie.length+1)return`"[Array]"`;ie.push(te),oe!==``&&(se+=oe,d+=`\n${se}`,m=`,\n${se}`);let f=Math.min(te.length,ge),re=0;for(;re<f-1;re++){let l=ve(String(re),te[re],ie,ae,oe,se);d+=l===void 0?`null`:l,d+=m}let ce=ve(String(re),te[re],ie,ae,oe,se);if(d+=ce===void 0?`null`:ce,te.length-1>ge){let l=te.length-ge-1;d+=`${m}"... ${fe(l)} not stringified"`}return oe!==``&&(d+=`\n${l}`),ie.pop(),`[${d}]`}ie.push(te);let ce=``;oe!==``&&(se+=oe,m=`,\n${se}`,ce=` `);let le=``;for(let l of ae){let f=ve(l,te[l],ie,ae,oe,se);f!==void 0&&(d+=`${le}${re(l)}:${ce}${f}`,le=m)}return oe!==``&&le.length>1&&(d=`\n${se}${d}\n${l}`),ie.pop(),`{${d}}`}case`number`:return isFinite(te)?String(te):d?d(te):`null`;case`boolean`:return te===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(te);default:return d?d(te):void 0}}function ye(l,ce,le,ue,de){switch(typeof ce){case`string`:return re(ce);case`object`:{if(ce===null)return`null`;if(typeof ce.toJSON==`function`){if(ce=ce.toJSON(l),typeof ce!=`object`)return ye(l,ce,le,ue,de);if(ce===null)return`null`}if(le.indexOf(ce)!==-1)return f;let d=de;if(Array.isArray(ce)){if(ce.length===0)return`[]`;if(he<le.length+1)return`"[Array]"`;le.push(ce),de+=ue;let l=`\n${de}`,f=`,\n${de}`,m=Math.min(ce.length,ge),te=0;for(;te<m-1;te++){let d=ye(String(te),ce[te],le,ue,de);l+=d===void 0?`null`:d,l+=f}let re=ye(String(te),ce[te],le,ue,de);if(l+=re===void 0?`null`:re,ce.length-1>ge){let d=ce.length-ge-1;l+=`${f}"... ${fe(d)} not stringified"`}return l+=`\n${d}`,le.pop(),`[${l}]`}let m=Object.keys(ce),pe=m.length;if(pe===0)return`{}`;if(he<le.length+1)return`"[Object]"`;de+=ue;let me=`,\n${de}`,_e=``,ve=``,be=Math.min(pe,ge);oe(ce)&&(_e+=se(ce,me,ge),m=m.slice(ce.length),be-=ce.length,ve=me),te&&(m=ie(m,ae)),le.push(ce);for(let l=0;l<be;l++){let d=m[l],f=ye(d,ce[d],le,ue,de);f!==void 0&&(_e+=`${ve}${re(d)}: ${f}`,ve=me)}if(pe>ge){let l=pe-ge;_e+=`${ve}"...": "${fe(l)} not stringified"`,ve=me}return ve!==``&&(_e=`\n${de}${_e}\n${d}`),le.pop(),`{${_e}}`}case`number`:return isFinite(ce)?String(ce):d?d(ce):`null`;case`boolean`:return ce===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(ce);default:return d?d(ce):void 0}}function be(l,ce,le){switch(typeof ce){case`string`:return re(ce);case`object`:{if(ce===null)return`null`;if(typeof ce.toJSON==`function`){if(ce=ce.toJSON(l),typeof ce!=`object`)return be(l,ce,le);if(ce===null)return`null`}if(le.indexOf(ce)!==-1)return f;let d=``,m=ce.length!==void 0;if(m&&Array.isArray(ce)){if(ce.length===0)return`[]`;if(he<le.length+1)return`"[Array]"`;le.push(ce);let l=Math.min(ce.length,ge),f=0;for(;f<l-1;f++){let l=be(String(f),ce[f],le);d+=l===void 0?`null`:l,d+=`,`}let m=be(String(f),ce[f],le);if(d+=m===void 0?`null`:m,ce.length-1>ge){let l=ce.length-ge-1;d+=`,"... ${fe(l)} not stringified"`}return le.pop(),`[${d}]`}let ue=Object.keys(ce),de=ue.length;if(de===0)return`{}`;if(he<le.length+1)return`"[Object]"`;let pe=``,me=Math.min(de,ge);m&&oe(ce)&&(d+=se(ce,`,`,ge),ue=ue.slice(ce.length),me-=ce.length,pe=`,`),te&&(ue=ie(ue,ae)),le.push(ce);for(let l=0;l<me;l++){let f=ue[l],m=be(f,ce[f],le);m!==void 0&&(d+=`${pe}${re(f)}:${m}`,pe=`,`)}if(de>ge){let l=de-ge;d+=`${pe}"...":"${fe(l)} not stringified"`}return le.pop(),`{${d}}`}case`number`:return isFinite(ce)?String(ce):d?d(ce):`null`;case`boolean`:return ce===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(m)return String(ce);default:return d?d(ce):void 0}}function xe(l,d,f){if(arguments.length>1){let m=``;if(typeof f==`number`?m=` `.repeat(Math.min(f,10)):typeof f==`string`&&(m=f.slice(0,10)),d!=null){if(typeof d==`function`)return _e(``,{"":l},[],d,m,``);if(Array.isArray(d))return ve(``,l,[],pe(d),m,``)}if(m.length!==0)return ye(``,l,[],m,``)}return be(``,l,[])}return xe}})),import_safe_stable_stringify=__toESM(require_safe_stable_stringify());const configure$1=import_safe_stable_stringify.configure,stringify=import_safe_stable_stringify.default;var require_symbols=__commonJSMin(((l,d)=>{let f=typeof process<`u`&&process.env.TERM_PROGRAM===`Hyper`,m=typeof process<`u`&&process.platform===`win32`,te=typeof process<`u`&&process.platform===`linux`,re={ballotDisabled:`☒`,ballotOff:`☐`,ballotOn:`☑`,bullet:`•`,bulletWhite:`◦`,fullBlock:`█`,heart:`❤`,identicalTo:`≡`,line:`─`,mark:`※`,middot:`·`,minus:`-`,multiplication:`×`,obelus:`÷`,pencilDownRight:`✎`,pencilRight:`✏`,pencilUpRight:`✐`,percent:`%`,pilcrow2:`❡`,pilcrow:`¶`,plusMinus:`±`,question:`?`,section:`§`,starsOff:`☆`,starsOn:`★`,upDownArrow:`↕`},ie=Object.assign({},re,{check:`√`,cross:`×`,ellipsisLarge:`...`,ellipsis:`...`,info:`i`,questionSmall:`?`,pointer:`>`,pointerSmall:`»`,radioOff:`( )`,radioOn:`(*)`,warning:`‼`}),ae=Object.assign({},re,{ballotCross:`✘`,check:`✔`,cross:`✖`,ellipsisLarge:`⋯`,ellipsis:`…`,info:`ℹ`,questionFull:`?`,questionSmall:`﹖`,pointer:te?`▸`:`❯`,pointerSmall:te?`‣`:`›`,radioOff:`◯`,radioOn:`◉`,warning:`⚠`});d.exports=m&&!f?ie:ae,Reflect.defineProperty(d.exports,"common",{enumerable:!1,value:re}),Reflect.defineProperty(d.exports,"windows",{enumerable:!1,value:ie}),Reflect.defineProperty(d.exports,"other",{enumerable:!1,value:ae})})),require_ansi_colors=__commonJSMin(((l,d)=>{let f=l=>typeof l==`object`&&!!l&&!Array.isArray(l),m=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,te=()=>typeof process<`u`?process.env.FORCE_COLOR!==`0`:!1,re=()=>{let l={enabled:te(),visible:!0,styles:{},keys:{}},d=l=>{let d=l.open=`\u001b[${l.codes[0]}m`,f=l.close=`\u001b[${l.codes[1]}m`,m=l.regex=RegExp(`\\u001b\\[${l.codes[1]}m`,`g`);return l.wrap=(l,te)=>{l.includes(f)&&(l=l.replace(m,f+d));let re=d+l+f;return te?re.replace(/\r*\n/g,`${f}$&${d}`):re},l},re=(l,d,f)=>typeof l==`function`?l(d):l.wrap(d,f),ie=(d,f)=>{if(d===``||d==null)return``;if(l.enabled===!1)return d;if(l.visible===!1)return``;let m=``+d,te=m.includes(`
107
107
  `),ie=f.length;for(ie>0&&f.includes(`unstyle`)&&(f=[...new Set([`unstyle`,...f])].reverse());ie-->0;)m=re(l.styles[f[ie]],m,te);return m},ae=(f,m,te)=>{l.styles[f]=d({name:f,codes:m}),(l.keys[te]||(l.keys[te]=[])).push(f),Reflect.defineProperty(l,f,{configurable:!0,enumerable:!0,set(d){l.alias(f,d)},get(){let d=l=>ie(l,d.stack);return Reflect.setPrototypeOf(d,l),d.stack=this.stack?this.stack.concat(f):[f],d}})};return ae(`reset`,[0,0],`modifier`),ae(`bold`,[1,22],`modifier`),ae(`dim`,[2,22],`modifier`),ae(`italic`,[3,23],`modifier`),ae(`underline`,[4,24],`modifier`),ae(`inverse`,[7,27],`modifier`),ae(`hidden`,[8,28],`modifier`),ae(`strikethrough`,[9,29],`modifier`),ae(`black`,[30,39],`color`),ae(`red`,[31,39],`color`),ae(`green`,[32,39],`color`),ae(`yellow`,[33,39],`color`),ae(`blue`,[34,39],`color`),ae(`magenta`,[35,39],`color`),ae(`cyan`,[36,39],`color`),ae(`white`,[37,39],`color`),ae(`gray`,[90,39],`color`),ae(`grey`,[90,39],`color`),ae(`bgBlack`,[40,49],`bg`),ae(`bgRed`,[41,49],`bg`),ae(`bgGreen`,[42,49],`bg`),ae(`bgYellow`,[43,49],`bg`),ae(`bgBlue`,[44,49],`bg`),ae(`bgMagenta`,[45,49],`bg`),ae(`bgCyan`,[46,49],`bg`),ae(`bgWhite`,[47,49],`bg`),ae(`blackBright`,[90,39],`bright`),ae(`redBright`,[91,39],`bright`),ae(`greenBright`,[92,39],`bright`),ae(`yellowBright`,[93,39],`bright`),ae(`blueBright`,[94,39],`bright`),ae(`magentaBright`,[95,39],`bright`),ae(`cyanBright`,[96,39],`bright`),ae(`whiteBright`,[97,39],`bright`),ae(`bgBlackBright`,[100,49],`bgBright`),ae(`bgRedBright`,[101,49],`bgBright`),ae(`bgGreenBright`,[102,49],`bgBright`),ae(`bgYellowBright`,[103,49],`bgBright`),ae(`bgBlueBright`,[104,49],`bgBright`),ae(`bgMagentaBright`,[105,49],`bgBright`),ae(`bgCyanBright`,[106,49],`bgBright`),ae(`bgWhiteBright`,[107,49],`bgBright`),l.ansiRegex=m,l.hasColor=l.hasAnsi=d=>(l.ansiRegex.lastIndex=0,typeof d==`string`&&d!==``&&l.ansiRegex.test(d)),l.alias=(d,f)=>{let m=typeof f==`string`?l[f]:f;if(typeof m!=`function`)throw TypeError(`Expected alias to be the name of an existing color (string) or a function`);m.stack||=(Reflect.defineProperty(m,"name",{value:d}),l.styles[d]=m,[d]),Reflect.defineProperty(l,d,{configurable:!0,enumerable:!0,set(f){l.alias(d,f)},get(){let d=l=>ie(l,d.stack);return Reflect.setPrototypeOf(d,l),d.stack=this.stack?this.stack.concat(m.stack):m.stack,d}})},l.theme=d=>{if(!f(d))throw TypeError(`Expected theme to be an object`);for(let f of Object.keys(d))l.alias(f,d[f]);return l},l.alias(`unstyle`,d=>typeof d==`string`&&d!==``?(l.ansiRegex.lastIndex=0,d.replace(l.ansiRegex,``)):``),l.alias(`noop`,l=>l),l.none=l.clear=l.noop,l.stripColor=l.unstyle,l.symbols=require_symbols(),l.define=ae,l};d.exports=re(),d.exports.create=re})),import_ansi_colors=__toESM(require_ansi_colors(),1);const segmenter$2=new Intl.Segmenter,zeroWidthClusterRegex=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v,leadingNonPrintingRegex=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,rgiEmojiRegex=/^\p{RGI_Emoji}$/v,unqualifiedKeycapRegex=/^[\d#*]\u20E3$/,extendedPictographicRegex=/\p{Extended_Pictographic}/gu;function isDoubleWidthNonRgiEmojiSequence(l){if(l.length>50)return!1;if(unqualifiedKeycapRegex.test(l))return!0;if(l.includes(`‍`)){let d=l.match(extendedPictographicRegex);return d!==null&&d.length>=2}return!1}function baseVisible(l){return l.replace(leadingNonPrintingRegex,``)}function isZeroWidthCluster(l){return zeroWidthClusterRegex.test(l)}function isHangulLeadingJamo(l){return l>=4352&&l<=4447||l>=43360&&l<=43388}function isHangulVowelJamo(l){return l>=4448&&l<=4519||l>=55216&&l<=55238}function isHangulTrailingJamo(l){return l>=4520&&l<=4607||l>=55243&&l<=55291}function isHangulJamo(l){return isHangulLeadingJamo(l)||isHangulVowelJamo(l)||isHangulTrailingJamo(l)}function hangulClusterWidth(l,d){let f=[];for(let d of l)zeroWidthClusterRegex.test(d)||f.push(d.codePointAt(0));if(f.length===0)return;let m=0;for(let l=0;l<f.length;l++){let te=f[l];if(!isHangulJamo(te)){if(m===0)return;for(let te=l;te<f.length;te++)m+=eastAsianWidth(f[te],d);return m}if(isHangulLeadingJamo(te)&&isHangulVowelJamo(f[l+1])){m+=2,l+=isHangulTrailingJamo(f[l+2])?2:1;continue}m+=eastAsianWidth(te,d)}return m}function trailingHalfwidthWidth(l,d){let f=0,m=!0;for(let te of l){if(m){m=!1;continue}te>=`＀`&&te<=`￯`&&(f+=eastAsianWidth(te.codePointAt(0),d))}return f}function stringWidth(l,d={}){if(typeof l!=`string`||l.length===0)return 0;let{ambiguousIsNarrow:f=!0,countAnsiEscapeCodes:m=!1}=d,te=l;if(!m&&(te.includes(`\x1B`)||te.includes(`›`))&&(te=stripAnsi(te)),te.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(te))return te.length;let re=0,ie={ambiguousAsWide:!f};for(let{segment:l}of segmenter$2.segment(te)){if(isZeroWidthCluster(l))continue;if(rgiEmojiRegex.test(l)||isDoubleWidthNonRgiEmojiSequence(l)){re+=2;continue}let d=baseVisible(l),f=hangulClusterWidth(d,ie);if(f!==void 0){re+=f;continue}let m=d.codePointAt(0);re+=eastAsianWidth(m,ie),re+=trailingHalfwidthWidth(d,ie)}return re}const ANSI_ESCAPE=`\x1B`,ANSI_ESCAPE_CSI=`›`,ESCAPES=new Set([ANSI_ESCAPE,ANSI_ESCAPE_CSI]),ANSI_ESCAPE_BELL=`\x07`,ANSI_CSI=`[`,ANSI_OSC=`]`,ANSI_SGR_TERMINATOR=`m`,ANSI_SGR_RESET=0,ANSI_SGR_RESET_FOREGROUND=39,ANSI_SGR_RESET_BACKGROUND=49,ANSI_SGR_RESET_UNDERLINE_COLOR=59,ANSI_SGR_FOREGROUND_EXTENDED=38,ANSI_SGR_BACKGROUND_EXTENDED=48,ANSI_SGR_UNDERLINE_COLOR_EXTENDED=58,ANSI_SGR_COLOR_MODE_256=5,ANSI_SGR_COLOR_MODE_RGB=2,ANSI_ESCAPE_LINK=`${ANSI_OSC}8;;`,ANSI_ESCAPE_REGEX=RegExp(`^\\u001B(?:\\${ANSI_CSI}(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}|${ANSI_ESCAPE_LINK}(?<uri>[^\\u0007\\u001B]*)(?:\\u0007|\\u001B\\\\))`),ANSI_ESCAPE_CSI_REGEX=RegExp(`^\\u009B(?<sgr>[0-9;]*)${ANSI_SGR_TERMINATOR}`),ANSI_SGR_MODIFIER_CLOSE_CODES=new Set(ansiStyles.codes.values());ANSI_SGR_MODIFIER_CLOSE_CODES.delete(ANSI_SGR_RESET);const segmenter$1=new Intl.Segmenter,getGraphemes=l=>Array.from(segmenter$1.segment(l),({segment:l})=>l),TAB_SIZE=8,wrapAnsiCode=l=>`${ANSI_ESCAPE}${ANSI_CSI}${l}${ANSI_SGR_TERMINATOR}`,wrapAnsiHyperlink=l=>`${ANSI_ESCAPE}${ANSI_ESCAPE_LINK}${l}${ANSI_ESCAPE_BELL}`,getSgrTokens=l=>{let d=l.split(`;`).map(l=>l===``?ANSI_SGR_RESET:Number.parseInt(l,10)),f=[];for(let l=0;l<d.length;l++){let m=d[l];if(Number.isFinite(m)){if(m===ANSI_SGR_FOREGROUND_EXTENDED||m===ANSI_SGR_BACKGROUND_EXTENDED||m===ANSI_SGR_UNDERLINE_COLOR_EXTENDED){if(l+1>=d.length)break;let te=d[l+1];if(te===ANSI_SGR_COLOR_MODE_256&&Number.isFinite(d[l+2])){f.push([m,te,d[l+2]]),l+=2;continue}let re=d[l+2],ie=d[l+3],ae=d[l+4];if(te===ANSI_SGR_COLOR_MODE_RGB&&Number.isFinite(re)&&Number.isFinite(ie)&&Number.isFinite(ae)){f.push([m,te,re,ie,ae]),l+=4;continue}break}f.push([m])}}return f},removeActiveStyle=(l,d)=>{let f=l.findIndex(l=>l.family===d);f!==-1&&l.splice(f,1)},upsertActiveStyle=(l,d)=>{removeActiveStyle(l,d.family),l.push(d)},removeModifierStylesByClose=(l,d)=>{for(let f=l.length-1;f>=0;f--){let m=l[f];m.family.startsWith(`modifier-`)&&m.close===d&&l.splice(f,1)}},getColorStyle=(l,d)=>{if(l>=30&&l<=37||l>=90&&l<=97||l===ANSI_SGR_FOREGROUND_EXTENDED&&d.length>1)return{family:`foreground`,open:d.join(`;`),close:ANSI_SGR_RESET_FOREGROUND};if(l>=40&&l<=47||l>=100&&l<=107||l===ANSI_SGR_BACKGROUND_EXTENDED&&d.length>1)return{family:`background`,open:d.join(`;`),close:ANSI_SGR_RESET_BACKGROUND};if(l===ANSI_SGR_UNDERLINE_COLOR_EXTENDED&&d.length>1)return{family:`underlineColor`,open:d.join(`;`),close:ANSI_SGR_RESET_UNDERLINE_COLOR}},applySgrResetCode=(l,d)=>l===ANSI_SGR_RESET?(d.length=0,!0):l===ANSI_SGR_RESET_FOREGROUND?(removeActiveStyle(d,`foreground`),!0):l===ANSI_SGR_RESET_BACKGROUND?(removeActiveStyle(d,`background`),!0):l===ANSI_SGR_RESET_UNDERLINE_COLOR?(removeActiveStyle(d,`underlineColor`),!0):ANSI_SGR_MODIFIER_CLOSE_CODES.has(l)?(removeModifierStylesByClose(d,l),!0):!1,applySgrToken=(l,d)=>{let[f]=l;if(applySgrResetCode(f,d))return;let m=getColorStyle(f,l);if(m){upsertActiveStyle(d,m);return}let te=ansiStyles.codes.get(f);te!==void 0&&te!==ANSI_SGR_RESET&&upsertActiveStyle(d,{family:`modifier-${f}`,open:l.join(`;`),close:te})},applySgrParameters=(l,d)=>{for(let f of getSgrTokens(l))applySgrToken(f,d)},applySgrResets=(l,d)=>{for(let f of getSgrTokens(l)){let[l]=f;applySgrResetCode(l,d)}},applyLeadingSgrResets=(l,d)=>{let f=l;for(;f.length>0;){if(f.startsWith(ANSI_ESCAPE)&&f[1]!==`\\`){let l=ANSI_ESCAPE_REGEX.exec(f);if(!l)break;l.groups.sgr!==void 0&&applySgrResets(l.groups.sgr,d),f=f.slice(l[0].length);continue}if(f.startsWith(ANSI_ESCAPE_CSI)){let l=ANSI_ESCAPE_CSI_REGEX.exec(f);if(!l||l.groups.sgr===void 0)break;applySgrResets(l.groups.sgr,d),f=f.slice(l[0].length);continue}break}},getClosingSgrSequence=l=>[...l].reverse().map(l=>wrapAnsiCode(l.close)).join(``),getOpeningSgrSequence=l=>l.map(l=>wrapAnsiCode(l.open)).join(``),wordLengths=l=>l.split(` `).map(l=>stringWidth(l)),wrapWord=(l,d,f)=>{let m=getGraphemes(d),te=!1,re=!1,ie=stringWidth(stripAnsi(l.at(-1)));for(let[d,ae]of m.entries()){let oe=stringWidth(ae);if(ie+oe<=f?l[l.length-1]+=ae:(l.push(ae),ie=0),ESCAPES.has(ae)&&!(re&&ae===ANSI_ESCAPE&&m[d+1]===`\\`)&&(te=!0,re=m.slice(d+1,d+1+ANSI_ESCAPE_LINK.length).join(``)===ANSI_ESCAPE_LINK),te){re?(ae===ANSI_ESCAPE_BELL||ae===`\\`&&d>0&&m[d-1]===ANSI_ESCAPE)&&(te=!1,re=!1):ae===ANSI_SGR_TERMINATOR&&(te=!1);continue}ie+=oe,ie===f&&d<m.length-1&&(l.push(``),ie=0)}!ie&&l.at(-1).length>0&&l.length>1&&(l[l.length-2]+=l.pop())},stringVisibleTrimSpacesRight=l=>{let d=l.split(` `),f=d.length;for(;f>0&&!(stringWidth(d[f-1])>0);)f--;return f===d.length?l:d.slice(0,f).join(` `)+d.slice(f).join(``)},expandTabs=l=>{if(!l.includes(` `))return l;let d=l.split(` `),f=0,m=``;for(let[l,te]of d.entries())if(m+=te,f+=stringWidth(te),l<d.length-1){let l=TAB_SIZE-f%TAB_SIZE;m+=` `.repeat(l),f+=l}return m},exec$1=(l,d,f={})=>{if(f.trim!==!1&&l.trim()===``)return``;let m=``,te,re=[],ie=wordLengths(l),ae=[``];for(let[m,te]of l.split(` `).entries()){f.trim!==!1&&(ae[ae.length-1]=ae.at(-1).trimStart());let l=stringWidth(ae.at(-1));if(m!==0&&(l>=d&&(f.wordWrap===!1||f.trim===!1)&&(ae.push(``),l=0),(l>0||f.trim===!1)&&(ae[ae.length-1]+=` `,l++)),f.hard&&f.wordWrap!==!1&&ie[m]>d){let f=d-l,re=1+Math.floor((ie[m]-f-1)/d);Math.floor((ie[m]-1)/d)<re&&ae.push(``),wrapWord(ae,te,d);continue}if(l+ie[m]>d&&l>0&&ie[m]>0){if(f.wordWrap===!1&&l<d){wrapWord(ae,te,d);continue}ae.push(``)}if(l+ie[m]>d&&f.wordWrap===!1){wrapWord(ae,te,d);continue}ae[ae.length-1]+=te}f.trim!==!1&&(ae=ae.map(l=>stringVisibleTrimSpacesRight(l)));let oe=ae.join(`
108
108
  `),se=getGraphemes(oe),ce=0;for(let[l,d]of se.entries()){if(m+=d,d===ANSI_ESCAPE&&se[l+1]!==`\\`){let{groups:l}=ANSI_ESCAPE_REGEX.exec(oe.slice(ce))||{groups:{}};l.sgr===void 0?l.uri!==void 0&&(te=l.uri.length===0?void 0:l.uri):applySgrParameters(l.sgr,re)}else if(d===ANSI_ESCAPE_CSI){let{groups:l}=ANSI_ESCAPE_CSI_REGEX.exec(oe.slice(ce))||{groups:{}};l.sgr!==void 0&&applySgrParameters(l.sgr,re)}if(se[l+1]===`
109
109
  `)te&&(m+=wrapAnsiHyperlink(``)),m+=getClosingSgrSequence(re);else if(d===`
@@ -45679,7 +45679,7 @@ GFS4: `),console.error(l)}),f[ae]||(ce(f,global[ae]||[]),f.close=(function(l){fu
45679
45679
 
45680
45680
  `)?l.split(`
45681
45681
 
45682
- `):l.split(`,`)}switch(l){case`hoist-pattern`:case`public-hoist-pattern`:return f(d)}return d}d.exports=oe})),require_defaults=__commonJSMin((l=>{let d=__require$1(`os`),f=__require$1(`path`),m=d.tmpdir(),te=process.getuid?process.getuid():process.pid,re=()=>!0,ie=process.platform===`win32`,ae={editor:()=>process.env.EDITOR||process.env.VISUAL||(ie?`notepad.exe`:`vi`),shell:()=>ie?process.env.COMSPEC||`cmd.exe`:process.env.SHELL||`/bin/bash`},oe={fromString:()=>process.umask()},se=d.homedir();se?process.env.HOME=se:se=f.resolve(m,`npm-`+te);let ce=process.platform===`win32`?`npm-cache`:`.npm`,le=process.platform===`win32`&&process.env.APPDATA||se,ue=f.resolve(le,ce),de,fe;Object.defineProperty(l,"defaults",{get:function(){return de||(process.env.PREFIX?fe=process.env.PREFIX:process.platform===`win32`?fe=f.dirname(process.execPath):(fe=f.dirname(f.dirname(process.execPath)),process.env.DESTDIR&&(fe=f.join(process.env.DESTDIR,fe))),de={access:null,"allow-same-version":!1,"always-auth":!1,also:null,audit:!0,"auth-type":`legacy`,"bin-links":!0,browser:null,ca:null,cafile:null,cache:ue,"cache-lock-stale":6e4,"cache-lock-retries":10,"cache-lock-wait":1e4,"cache-max":1/0,"cache-min":10,cert:null,cidr:null,color:process.env.NO_COLOR==null,depth:1/0,description:!0,dev:!1,"dry-run":!1,editor:ae.editor(),"engine-strict":!1,force:!1,"fetch-retries":2,"fetch-retry-factor":10,"fetch-retry-mintimeout":1e4,"fetch-retry-maxtimeout":6e4,git:`git`,"git-tag-version":!0,"commit-hooks":!0,global:!1,globalconfig:f.resolve(fe,`etc`,`npmrc`),"global-style":!1,group:process.platform===`win32`?0:process.env.SUDO_GID||process.getgid&&process.getgid(),"ham-it-up":!1,heading:`npm`,"if-present":!1,"ignore-prepublish":!1,"ignore-scripts":!1,"init-module":f.resolve(se,`.npm-init.js`),"init-author-name":``,"init-author-email":``,"init-author-url":``,"init-version":`1.0.0`,"init-license":`ISC`,json:!1,key:null,"legacy-bundling":!1,link:!1,"local-address":void 0,loglevel:`notice`,logstream:process.stderr,"logs-max":10,long:!1,maxsockets:50,message:`%s`,"metrics-registry":null,"node-options":null,offline:!1,"onload-script":!1,only:null,optional:!0,otp:null,"package-lock":!0,"package-lock-only":!1,parseable:!1,"prefer-offline":!1,"prefer-online":!1,prefix:fe,production:!1,progress:!process.env.TRAVIS&&!process.env.CI,provenance:!1,proxy:null,"https-proxy":null,"no-proxy":null,"user-agent":`npm/{npm-version} node/{node-version} {platform} {arch}`,"read-only":!1,"rebuild-bundle":!0,registry:`https://registry.npmjs.org/`,rollback:!0,save:!0,"save-bundle":!1,"save-dev":!1,"save-exact":!1,"save-optional":!1,"save-prefix":`^`,"save-prod":!1,scope:``,"script-shell":null,"scripts-prepend-node-path":`warn-only`,searchopts:``,searchexclude:null,searchlimit:20,searchstaleness:900,"send-metrics":!1,shell:ae.shell(),shrinkwrap:!0,"sign-git-tag":!1,"sso-poll-frequency":500,"sso-type":`oauth`,"strict-ssl":!0,tag:`latest`,"tag-version-prefix":`v`,timing:!1,tmp:m,unicode:re(),"unsafe-perm":process.platform===`win32`||process.platform===`cygwin`||!(process.getuid&&process.setuid&&process.getgid&&process.setgid)||process.getuid()!==0,usage:!1,user:process.platform===`win32`?0:`nobody`,userconfig:f.resolve(se,`.npmrc`),umask:process.umask?process.umask():oe.fromString(`022`),version:!1,versions:!1,viewer:process.platform===`win32`?`browser`:`man`,_exit:!0},de)}})})),require_npm_conf=__commonJSMin(((l,d)=>{let f=__require$1(`path`),m=require_conf(),te=require_defaults();d.exports=(l,d,re)=>{let ie=new m(Object.assign({},te.defaults,re),d);ie.add(Object.assign({},l),`cli`);let ae=[],oe=!1;if(__require$1.resolve.paths){let l=__require$1.resolve.paths(`npm`),d;try{d=__require$1.resolve(`npm`,{paths:l.slice(-1)})}catch{oe=!0}d&&ae.push(ie.addFile(f.resolve(f.dirname(d),`..`,`npmrc`),`builtin`))}ie.addEnv(),ie.loadPrefix();let se=ie.get(`userconfig`),ce=ie.get(`prefix`);if(ce){let l=f.resolve(ce,`etc`);ie.root.globalconfig=f.resolve(l,`npmrc`),ie.root.globalignorefile=f.resolve(l,`npmignore`)}let le=ie.get(`globalconfig`),ue=f.resolve(ie.localPrefix,`.npmrc`),de=se;if(!ie.get(`global`)&&ue!==de?ae.push(ie.addFile(ue,`project`)):ie.add({},`project`),ie.get(`workspace-prefix`)&&ie.get(`workspace-prefix`)!==ue){let l=f.resolve(ie.get(`workspace-prefix`),`.npmrc`);ae.push(ie.addFile(l,`workspace`))}ae.push(ie.addFile(se,`user`)),ae.push(ie.addFile(le,`global`)),ie.loadUser();let fe=ie.get(`cafile`);return fe&&ie.loadCAFile(fe),{config:ie,warnings:ae.filter(Boolean),failedToLoadBuiltInConfig:oe}},Object.defineProperty(d.exports,"defaults",{get(){return te.defaults},enumerable:!0})})),require_registry_auth_token=__commonJSMin(((l,d)=>{let f=require_npm_conf(),m=`:_authToken`,te=`:_auth`,re=`:username`,ie=`:_password`;d.exports=function(){let l,d;arguments.length>=2?(l=arguments[0],d=Object.assign({},arguments[1])):typeof arguments[0]==`string`?l=arguments[0]:d=Object.assign({},arguments[0]),d||={};let m=d.npmrc;return d.npmrc=(d.npmrc?{config:{get:l=>m[l]}}:f()).config,l=l||d.npmrc.get(`registry`)||f.defaults.registry,oe(l,d)||se(d.npmrc)};function ae(l,d){let f=new URL(d,new URL(l.startsWith(`//`)?`./${l}`:l,`resolve://`));if(f.protocol===`resolve:`){let{pathname:l,search:d,hash:m}=f;return l+d+m}return f.toString()}function oe(l,d){let f=l instanceof URL?l:new URL(l.startsWith(`//`)?`http:${l}`:l),m;for(;m!==`/`&&f.pathname!==m;){m=f.pathname||`/`;let te=le(`//`+f.host+m.replace(/\/$/,``),d.npmrc);if(te)return te;if(!d.recursive)return/\/$/.test(l)?void 0:oe(new URL(`./`,f),d);f.pathname=ae(ce(m),`..`)||`/`}}function se(l){if(l.get(`_auth`))return{token:ue(l.get(`_auth`)),type:`Basic`}}function ce(l){return l[l.length-1]===`/`?l:l+`/`}function le(l,d){let f=de(d.get(l+`:_authToken`)||d.get(l+`/:_authToken`));if(f)return f;let m=fe(d.get(l+`:username`)||d.get(l+`/:username`),d.get(l+`:_password`)||d.get(l+`/:_password`));if(m)return m;let te=pe(d.get(l+`:_auth`)||d.get(l+`/:_auth`));if(te)return te}function ue(l){return l.replace(/^\$\{?([^}]*)\}?$/,function(l,d){return process.env[d]})}function de(l){if(l)return{token:ue(l),type:`Bearer`}}function fe(l,d){if(!l||!d)return;let f=Buffer.from(ue(d),`base64`).toString(`utf8`);return{token:Buffer.from(l+`:`+f,`utf8`).toString(`base64`),type:`Basic`,password:f,username:l}}function pe(l){if(l)return{token:ue(l),type:`Basic`}}})),import_registry_auth_token=__toESM(require_registry_auth_token(),1),PackageNotFoundError=class extends Error{constructor(l){super(`Package \`${l}\` could not be found`),this.name=`PackageNotFoundError`}},VersionNotFoundError=class extends Error{constructor(l,d){super(`Version \`${d}\` for package \`${l}\` could not be found`),this.name=`VersionNotFoundError`}};async function packageJson(l,d={}){let{version:f=`latest`}=d,{omitDeprecated:m=!0}=d,te=l.split(`/`)[0],re=d.registryUrl??registryUrl(te),ie=new URL(encodeURIComponent(l).replace(/^%40/,`@`),re),ae=(0,import_registry_auth_token.default)(re.toString(),{recursive:!0}),oe={accept:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`};d.fullMetadata&&delete oe.accept,ae&&(oe.authorization=`${ae.type} ${ae.token}`);let se;try{se=await ky(ie,{headers:oe,keepalive:!0}).json()}catch(d){throw d?.response?.status===404?new PackageNotFoundError(l):d}if(d.allVersions)return se;let ce=new VersionNotFoundError(l,f);if(se[`dist-tags`][f]){let{time:l}=se;se=se.versions[se[`dist-tags`][f]],se.time=l}else if(f){let l=!!se.versions[f];if(m&&!l)for(let[l,d]of Object.entries(se.versions))d.deprecated&&delete se.versions[l];if(!l){let l=Object.keys(se.versions);if(f=import_semver.default.maxSatisfying(l,f),!f)throw ce}let{time:d}=se;if(se=se.versions[f],se.time=d,!se)throw ce}return se}async function fetchWithRetry(l,d,f=5){let m;for(let te=0;te<=f;te++)try{let m=await fetch(l,d);if((m.status===429||m.status>=500)&&te<f){let d=getDelay(te,m);log$2.warn(`Fetch ${l} returned ${m.status}, retrying in ${d}ms (attempt ${te+1}/${f})`),await sleep(d);continue}return m}catch(d){if(m=d,te<f){let m=getDelay(te);log$2.warn(`Fetch ${l} failed: ${d instanceof Error?d.message:String(d)}, retrying in ${m}ms (attempt ${te+1}/${f})`),await sleep(m)}}throw m}function getDelay(l,d){let f=1e3*2**l,m=d?.headers.get(`retry-after`);if(m){let l=Number(m);if(!Number.isNaN(l))return Math.max(l*1e3,f)}return f}async function sleep(l){return new Promise(d=>{setTimeout(d,l)})}function parse$18(l){return parsePackage(l)}const nodePackageJsonSource=defineSource({async discover(l){return getMatches(l.options,[`package.json`])},key:`nodePackageJson`,async parse(l,d){return{data:parse$18(await readFile(resolve$1(d.options.path,l),`utf8`)),source:l}},phase:1}),nodeNpmRegistrySource=defineSource({async discover(l){if(l.options.offline)return log$2.debug(`Skipping Node NPM registry data source since we're in offline mode`),[];let d=ensureArray(l.metadata?.nodePackageJson);return d.length===0&&!l.completedSources?.has(`nodePackageJson`)&&(log$2.debug(`Missing nodePackageJson in source context metadata for ${l.options.path}, extracting it now...`),d=ensureArray(await nodePackageJsonSource.extract(l))),d.filter(d=>d.data.private===!0||d.data.publishConfig?.access===`restricted`?(log$2.debug(`Skipping NPM registry lookup for "${d.data.name}" in "${l.options.path}" because it is a private package`),!1):!0).map(l=>l.data.name)},key:`nodeNpmRegistry`,async parse(l){log$2.debug(`Extracting npm metadata...`);let d=l,[f,m,te,re,ie]=await Promise.all([packageJson(d,{fullMetadata:!0}).catch(()=>void 0),fetchDownloads(d,`last-week`),fetchDownloads(d,`last-month`),fetchDownloads(d,`last-year`),fetchDownloads(d,`2005-01-01:3000-01-01`)]);if(!f)return;let ae=!!(f.types??f.typings??(is.plainObject(f)?f.exports:void 0)),oe=is.plainObject(f.dist)?f.dist:void 0,se=is.plainObject(f.time)?f.time:void 0;return{data:{deprecated:typeof f.deprecated==`string`?f.deprecated:void 0,downloadsMonthly:te,downloadsTotal:ie||void 0,downloadsWeekly:m,downloadsYearly:re,fileCount:typeof oe?.fileCount==`number`?oe.fileCount:void 0,hasTypes:ae,publishDateLatest:typeof se?.modified==`string`?se.modified:void 0,unpackedSizeBytes:typeof oe?.unpackedSize==`number`?oe.unpackedSize:void 0,url:`https://www.npmjs.com/package/${encodeURIComponent(d)}`,versionLatest:f.version},source:`https://www.npmjs.com/package/${encodeURIComponent(d)}`}},phase:2}),npmDownloadsSchema=object({downloads:number()});async function fetchDownloads(l,d){try{let f=await fetchWithRetry(`https://api.npmjs.org/downloads/point/${d}/${encodeURIComponent(l)}`);return f.ok?npmDownloadsSchema.parse(await f.json()).downloads:void 0}catch{return}}const manifestSchema=object({author:string$2().optional(),authorUrl:string$2().optional(),description:string$2().optional(),fundingUrl:string$2().optional(),id:string$2(),isDesktopOnly:boolean().optional(),minAppVersion:string$2().optional(),name:string$2().optional(),version:string$2().optional()}),obsidianPluginManifestJsonSource=defineSource({async discover(l){return getMatches(l.options,[`manifest.json`])},key:`obsidianPluginManifestJson`,async parse(l,d){let f=await readFile(resolve$1(d.options.path,l),`utf8`),m=manifestSchema.safeParse(JSON.parse(f));if(m.success)return{data:m.data,source:l}},phase:1}),communityPluginsUrl=`https://raw.githubusercontent.com/obsidianmd/obsidian-releases/master/community-plugin-stats.json`,pluginStatsSchema=record(string$2(),record(string$2(),number())),obsidianPluginRegistrySource=defineSource({async discover(l){if(l.options.offline)return log$2.debug(`Skipping Obsidian plugin registry data source since we're in offline mode`),[];let d=ensureArray(l.metadata?.obsidianPluginManifestJson).map(l=>l.data.id);return d.length===0&&!l.completedSources?.has(`obsidianPluginManifestJson`)&&(log$2.debug(`Missing obsidianPluginManifestJson in source context metadata for ${l.options.path}, extracting it now...`),d=ensureArray(await obsidianPluginManifestJsonSource.extract(l)).map(l=>l.data.id)),d},key:`obsidianPluginRegistry`,async parse(l){log$2.debug(`Extracting Obsidian plugin registry metadata...`);let d=l,f=`https://obsidian.md/plugins?id=${encodeURIComponent(d)}`,m=await fetchWithRetry(communityPluginsUrl);return m.ok?{data:{downloadCount:pluginStatsSchema.parse(await m.json())[d]?.downloads||void 0,url:f},source:f}:{data:{url:f},source:f}},phase:2}),INLINE_COMMENT_REGEX=/#.*$/,SECTION_RE=/^[\w/][\w/-]*:$/,ASSIGNMENT_RE=/^(\w+)\s*(\+?=)\s*(.*)/,NON_PLATFORM_SECTIONS=new Set([`all`,`common`,`meta`]);function parseMakefileConfig(l){let d=new Map,f=[],m=new Set,te=``,re=!1;for(let ie of l.split(`
45682
+ `):l.split(`,`)}switch(l){case`hoist-pattern`:case`public-hoist-pattern`:return f(d)}return d}d.exports=oe})),require_defaults=__commonJSMin((l=>{let d=__require$1(`os`),f=__require$1(`path`),m=d.tmpdir(),te=process.getuid?process.getuid():process.pid,re=()=>!0,ie=process.platform===`win32`,ae={editor:()=>process.env.EDITOR||process.env.VISUAL||(ie?`notepad.exe`:`vi`),shell:()=>ie?process.env.COMSPEC||`cmd.exe`:process.env.SHELL||`/bin/bash`},oe={fromString:()=>process.umask()},se=d.homedir();se?process.env.HOME=se:se=f.resolve(m,`npm-`+te);let ce=process.platform===`win32`?`npm-cache`:`.npm`,le=process.platform===`win32`&&process.env.APPDATA||se,ue=f.resolve(le,ce),de,fe;Object.defineProperty(l,"defaults",{get:function(){return de||(process.env.PREFIX?fe=process.env.PREFIX:process.platform===`win32`?fe=f.dirname(process.execPath):(fe=f.dirname(f.dirname(process.execPath)),process.env.DESTDIR&&(fe=f.join(process.env.DESTDIR,fe))),de={access:null,"allow-same-version":!1,"always-auth":!1,also:null,audit:!0,"auth-type":`legacy`,"bin-links":!0,browser:null,ca:null,cafile:null,cache:ue,"cache-lock-stale":6e4,"cache-lock-retries":10,"cache-lock-wait":1e4,"cache-max":1/0,"cache-min":10,cert:null,cidr:null,color:process.env.NO_COLOR==null,depth:1/0,description:!0,dev:!1,"dry-run":!1,editor:ae.editor(),"engine-strict":!1,force:!1,"fetch-retries":2,"fetch-retry-factor":10,"fetch-retry-mintimeout":1e4,"fetch-retry-maxtimeout":6e4,git:`git`,"git-tag-version":!0,"commit-hooks":!0,global:!1,globalconfig:f.resolve(fe,`etc`,`npmrc`),"global-style":!1,group:process.platform===`win32`?0:process.env.SUDO_GID||process.getgid&&process.getgid(),"ham-it-up":!1,heading:`npm`,"if-present":!1,"ignore-prepublish":!1,"ignore-scripts":!1,"init-module":f.resolve(se,`.npm-init.js`),"init-author-name":``,"init-author-email":``,"init-author-url":``,"init-version":`1.0.0`,"init-license":`ISC`,json:!1,key:null,"legacy-bundling":!1,link:!1,"local-address":void 0,loglevel:`notice`,logstream:process.stderr,"logs-max":10,long:!1,maxsockets:50,message:`%s`,"metrics-registry":null,"node-options":null,offline:!1,"onload-script":!1,only:null,optional:!0,otp:null,"package-lock":!0,"package-lock-only":!1,parseable:!1,"prefer-offline":!1,"prefer-online":!1,prefix:fe,production:!1,progress:!process.env.TRAVIS&&!process.env.CI,provenance:!1,proxy:null,"https-proxy":null,"no-proxy":null,"user-agent":`npm/{npm-version} node/{node-version} {platform} {arch}`,"read-only":!1,"rebuild-bundle":!0,registry:`https://registry.npmjs.org/`,rollback:!0,save:!0,"save-bundle":!1,"save-dev":!1,"save-exact":!1,"save-optional":!1,"save-prefix":`^`,"save-prod":!1,scope:``,"script-shell":null,"scripts-prepend-node-path":`warn-only`,searchopts:``,searchexclude:null,searchlimit:20,searchstaleness:900,"send-metrics":!1,shell:ae.shell(),shrinkwrap:!0,"sign-git-tag":!1,"sso-poll-frequency":500,"sso-type":`oauth`,"strict-ssl":!0,tag:`latest`,"tag-version-prefix":`v`,timing:!1,tmp:m,unicode:re(),"unsafe-perm":process.platform===`win32`||process.platform===`cygwin`||!(process.getuid&&process.setuid&&process.getgid&&process.setgid)||process.getuid()!==0,usage:!1,user:process.platform===`win32`?0:`nobody`,userconfig:f.resolve(se,`.npmrc`),umask:process.umask?process.umask():oe.fromString(`022`),version:!1,versions:!1,viewer:process.platform===`win32`?`browser`:`man`,_exit:!0},de)}})})),require_npm_conf=__commonJSMin(((l,d)=>{let f=__require$1(`path`),m=require_conf(),te=require_defaults();d.exports=(l,d,re)=>{let ie=new m(Object.assign({},te.defaults,re),d);ie.add(Object.assign({},l),`cli`);let ae=[],oe=!1;if(__require$1.resolve.paths){let l=__require$1.resolve.paths(`npm`),d;try{d=__require$1.resolve(`npm`,{paths:l.slice(-1)})}catch{oe=!0}d&&ae.push(ie.addFile(f.resolve(f.dirname(d),`..`,`npmrc`),`builtin`))}ie.addEnv(),ie.loadPrefix();let se=ie.get(`userconfig`),ce=ie.get(`prefix`);if(ce){let l=f.resolve(ce,`etc`);ie.root.globalconfig=f.resolve(l,`npmrc`),ie.root.globalignorefile=f.resolve(l,`npmignore`)}let le=ie.get(`globalconfig`),ue=f.resolve(ie.localPrefix,`.npmrc`),de=se;if(!ie.get(`global`)&&ue!==de?ae.push(ie.addFile(ue,`project`)):ie.add({},`project`),ie.get(`workspace-prefix`)&&ie.get(`workspace-prefix`)!==ue){let l=f.resolve(ie.get(`workspace-prefix`),`.npmrc`);ae.push(ie.addFile(l,`workspace`))}ae.push(ie.addFile(se,`user`)),ae.push(ie.addFile(le,`global`)),ie.loadUser();let fe=ie.get(`cafile`);return fe&&ie.loadCAFile(fe),{config:ie,warnings:ae.filter(Boolean),failedToLoadBuiltInConfig:oe}},Object.defineProperty(d.exports,"defaults",{get(){return te.defaults},enumerable:!0})})),require_registry_auth_token=__commonJSMin(((l,d)=>{let f=require_npm_conf(),m=`:_authToken`,te=`:_auth`,re=`:username`,ie=`:_password`;d.exports=function(){let l,d;arguments.length>=2?(l=arguments[0],d=Object.assign({},arguments[1])):typeof arguments[0]==`string`?l=arguments[0]:d=Object.assign({},arguments[0]),d||={};let m=d.npmrc;return d.npmrc=(d.npmrc?{config:{get:l=>m[l]}}:f()).config,l=l||d.npmrc.get(`registry`)||f.defaults.registry,oe(l,d)||se(d.npmrc)};function ae(l,d){let f=new URL(d,new URL(l.startsWith(`//`)?`./${l}`:l,`resolve://`));if(f.protocol===`resolve:`){let{pathname:l,search:d,hash:m}=f;return l+d+m}return f.toString()}function oe(l,d){let f=l instanceof URL?l:new URL(l.startsWith(`//`)?`http:${l}`:l),m;for(;m!==`/`&&f.pathname!==m;){m=f.pathname||`/`;let te=le(`//`+f.host+m.replace(/\/$/,``),d.npmrc);if(te)return te;if(!d.recursive)return/\/$/.test(l)?void 0:oe(new URL(`./`,f),d);f.pathname=ae(ce(m),`..`)||`/`}}function se(l){if(l.get(`_auth`))return{token:ue(l.get(`_auth`)),type:`Basic`}}function ce(l){return l[l.length-1]===`/`?l:l+`/`}function le(l,d){let f=de(d.get(l+`:_authToken`)||d.get(l+`/:_authToken`));if(f)return f;let m=fe(d.get(l+`:username`)||d.get(l+`/:username`),d.get(l+`:_password`)||d.get(l+`/:_password`));if(m)return m;let te=pe(d.get(l+`:_auth`)||d.get(l+`/:_auth`));if(te)return te}function ue(l){return l.replace(/^\$\{?([^}]*)\}?$/,function(l,d){return process.env[d]})}function de(l){if(l)return{token:ue(l),type:`Bearer`}}function fe(l,d){if(!l||!d)return;let f=Buffer.from(ue(d),`base64`).toString(`utf8`);return{token:Buffer.from(l+`:`+f,`utf8`).toString(`base64`),type:`Basic`,password:f,username:l}}function pe(l){if(l)return{token:ue(l),type:`Basic`}}})),import_registry_auth_token=__toESM(require_registry_auth_token(),1),PackageNotFoundError=class extends Error{constructor(l){super(`Package \`${l}\` could not be found`),this.name=`PackageNotFoundError`}},VersionNotFoundError=class extends Error{constructor(l,d){super(`Version \`${d}\` for package \`${l}\` could not be found`),this.name=`VersionNotFoundError`}};async function packageJson(l,d={}){let{version:f=`latest`}=d,{omitDeprecated:m=!0}=d,te=l.split(`/`)[0],re=d.registryUrl??registryUrl(te),ie=new URL(encodeURIComponent(l).replace(/^%40/,`@`),re),ae=(0,import_registry_auth_token.default)(re.toString(),{recursive:!0}),oe={accept:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`};d.fullMetadata&&delete oe.accept,ae&&(oe.authorization=`${ae.type} ${ae.token}`);let se;try{se=await ky(ie,{headers:oe,keepalive:!0}).json()}catch(d){throw d?.response?.status===404?new PackageNotFoundError(l):d}if(d.allVersions)return se;let ce=new VersionNotFoundError(l,f);if(se[`dist-tags`][f]){let{time:l}=se;se=se.versions[se[`dist-tags`][f]],se.time=l}else if(f){let l=!!se.versions[f];if(m&&!l)for(let[l,d]of Object.entries(se.versions))d.deprecated&&delete se.versions[l];if(!l){let l=Object.keys(se.versions);if(f=import_semver.default.maxSatisfying(l,f),!f)throw ce}let{time:d}=se;if(se=se.versions[f],se.time=d,!se)throw ce}return se}const MIN_FETCH_INTERVAL_MS=300;let fetchChain=Promise.resolve(),lastFetchStart=0;async function waitForFetchTurn(){let l=fetchChain.then(async()=>{let l=lastFetchStart+MIN_FETCH_INTERVAL_MS-Date.now();l>0&&await sleep(l),lastFetchStart=Date.now()});return fetchChain=l,l}async function fetchWithRetry(l,d,f=5){let m;for(let te=0;te<=f;te++)try{await waitForFetchTurn();let m=await fetch(l,d);if((m.status===429||m.status>=500)&&te<f){let d=getDelay(te,m);log$2.warn(`Fetch ${l} returned ${m.status}, retrying in ${d}ms (attempt ${te+1}/${f})`),await sleep(d);continue}return m}catch(d){if(m=d,te<f){let m=getDelay(te);log$2.warn(`Fetch ${l} failed: ${d instanceof Error?d.message:String(d)}, retrying in ${m}ms (attempt ${te+1}/${f})`),await sleep(m)}}throw m}function getDelay(l,d){let f=1e3*2**l,m=d?.headers.get(`retry-after`);if(m){let l=Number(m);if(!Number.isNaN(l))return Math.max(l*1e3,f)}return f}async function sleep(l){return new Promise(d=>{setTimeout(d,l)})}function parse$18(l){return parsePackage(l)}const nodePackageJsonSource=defineSource({async discover(l){return getMatches(l.options,[`package.json`])},key:`nodePackageJson`,async parse(l,d){return{data:parse$18(await readFile(resolve$1(d.options.path,l),`utf8`)),source:l}},phase:1}),nodeNpmRegistrySource=defineSource({async discover(l){if(l.options.offline)return log$2.debug(`Skipping Node NPM registry data source since we're in offline mode`),[];let d=ensureArray(l.metadata?.nodePackageJson);return d.length===0&&!l.completedSources?.has(`nodePackageJson`)&&(log$2.debug(`Missing nodePackageJson in source context metadata for ${l.options.path}, extracting it now...`),d=ensureArray(await nodePackageJsonSource.extract(l))),d.filter(d=>d.data.private===!0||d.data.publishConfig?.access===`restricted`?(log$2.debug(`Skipping NPM registry lookup for "${d.data.name}" in "${l.options.path}" because it is a private package`),!1):!0).map(l=>l.data.name)},key:`nodeNpmRegistry`,async parse(l){log$2.debug(`Extracting npm metadata...`);let d=l,[f,m,te,re,ie]=await Promise.all([packageJson(d,{fullMetadata:!0}).catch(()=>void 0),fetchDownloads(d,`last-week`),fetchDownloads(d,`last-month`),fetchDownloads(d,`last-year`),fetchDownloads(d,`2005-01-01:3000-01-01`)]);if(!f)return;let ae=!!(f.types??f.typings??(is.plainObject(f)?f.exports:void 0)),oe=is.plainObject(f.dist)?f.dist:void 0,se=is.plainObject(f.time)?f.time:void 0;return{data:{deprecated:typeof f.deprecated==`string`?f.deprecated:void 0,downloadsMonthly:te,downloadsTotal:ie||void 0,downloadsWeekly:m,downloadsYearly:re,fileCount:typeof oe?.fileCount==`number`?oe.fileCount:void 0,hasTypes:ae,publishDateLatest:typeof se?.modified==`string`?se.modified:void 0,unpackedSizeBytes:typeof oe?.unpackedSize==`number`?oe.unpackedSize:void 0,url:`https://www.npmjs.com/package/${encodeURIComponent(d)}`,versionLatest:f.version},source:`https://www.npmjs.com/package/${encodeURIComponent(d)}`}},phase:2}),npmDownloadsSchema=object({downloads:number()});async function fetchDownloads(l,d){try{let f=await fetchWithRetry(`https://api.npmjs.org/downloads/point/${d}/${encodeURIComponent(l)}`);return f.ok?npmDownloadsSchema.parse(await f.json()).downloads:void 0}catch{return}}const manifestSchema=object({author:string$2().optional(),authorUrl:string$2().optional(),description:string$2().optional(),fundingUrl:string$2().optional(),id:string$2(),isDesktopOnly:boolean().optional(),minAppVersion:string$2().optional(),name:string$2().optional(),version:string$2().optional()}),obsidianPluginManifestJsonSource=defineSource({async discover(l){return getMatches(l.options,[`manifest.json`])},key:`obsidianPluginManifestJson`,async parse(l,d){let f=await readFile(resolve$1(d.options.path,l),`utf8`),m=manifestSchema.safeParse(JSON.parse(f));if(m.success)return{data:m.data,source:l}},phase:1}),communityPluginsUrl=`https://raw.githubusercontent.com/obsidianmd/obsidian-releases/master/community-plugin-stats.json`,pluginStatsSchema=record(string$2(),record(string$2(),number())),obsidianPluginRegistrySource=defineSource({async discover(l){if(l.options.offline)return log$2.debug(`Skipping Obsidian plugin registry data source since we're in offline mode`),[];let d=ensureArray(l.metadata?.obsidianPluginManifestJson).map(l=>l.data.id);return d.length===0&&!l.completedSources?.has(`obsidianPluginManifestJson`)&&(log$2.debug(`Missing obsidianPluginManifestJson in source context metadata for ${l.options.path}, extracting it now...`),d=ensureArray(await obsidianPluginManifestJsonSource.extract(l)).map(l=>l.data.id)),d},key:`obsidianPluginRegistry`,async parse(l){log$2.debug(`Extracting Obsidian plugin registry metadata...`);let d=l,f=`https://obsidian.md/plugins?id=${encodeURIComponent(d)}`,m=await fetchWithRetry(communityPluginsUrl);return m.ok?{data:{downloadCount:pluginStatsSchema.parse(await m.json())[d]?.downloads||void 0,url:f},source:f}:{data:{url:f},source:f}},phase:2}),INLINE_COMMENT_REGEX=/#.*$/,SECTION_RE=/^[\w/][\w/-]*:$/,ASSIGNMENT_RE=/^(\w+)\s*(\+?=)\s*(.*)/,NON_PLATFORM_SECTIONS=new Set([`all`,`common`,`meta`]);function parseMakefileConfig(l){let d=new Map,f=[],m=new Set,te=``,re=!1;for(let ie of l.split(`
45683
45683
  `)){let l=ie.replace(INLINE_COMMENT_REGEX,``).trim();if(l.length===0)continue;if(SECTION_RE.test(l)){re&&!NON_PLATFORM_SECTIONS.has(te)&&m.add(te),te=l.slice(0,-1),re=!1;continue}let ae=ASSIGNMENT_RE.exec(l);if(!ae)continue;let[,oe,se,ce]=ae;if(re=!0,te===`meta`){let l=tokenizeValues(ce);if(se===`+=`){let f=d.get(oe)??[];d.set(oe,[...f,...l])}else d.set(oe,l)}else if(te===`common`&&oe===`ADDON_DEPENDENCIES`){let l=tokenizeValues(ce);se===`+=`||(f.length=0),f.push(...l)}}return re&&!NON_PLATFORM_SECTIONS.has(te)&&m.add(te),{author:singleValue(d,`ADDON_AUTHOR`),dependencies:f,description:singleValue(d,`ADDON_DESCRIPTION`),name:singleValue(d,`ADDON_NAME`),platformSections:[...m],tags:d.get(`ADDON_TAGS`)??[],url:singleValue(d,`ADDON_URL`)}}function singleValue(l,d){let f=l.get(d);if(!f||f.length===0)return;let m=f.join(` `).trim();return m.length>0?m:void 0}function tokenizeValues(l){let d=l.trim();if(d.length===0)return[];let f=[];for(let[,l,m]of d.matchAll(/"([^"]+)"|(\S+)/g)){let d=l||m;d.length>0&&f.push(d)}return f}const openframeworksAddonConfigSchema=object({author:nonEmptyString,dependencies:stringArray,description:nonEmptyString,name:nonEmptyString,platformSections:stringArray,tags:stringArray,url:optionalUrl});function parse$17(l){let d=parseMakefileConfig(l);return openframeworksAddonConfigSchema.parse(d)}const openframeworksAddonConfigMkSource=defineSource({async discover(l){return getMatches(l.options,[`addon_config.mk`])},key:`openframeworksAddonConfigMk`,async parse(l,d){return{data:parse$17(await readFile(resolve$1(d.options.path,l),`utf8`)),source:l}},phase:1}),openframeworksInstallXmlSchema=object({author:nonEmptyString,codeUrl:optionalUrl,description:nonEmptyString,downloadUrl:optionalUrl,name:nonEmptyString,operatingSystems:stringArray,requirements:stringArray,siteUrl:optionalUrl,url:optionalUrl,version:nonEmptyString}),LIB_OS_MAP={linux:`Linux`,mac:`macOS`,win32:`Windows`};function parse$16(l){if(!l.toLowerCase().includes(`addons`))return;let d=l.replaceAll(`<[CDATA[`,`<![CDATA[`),f=new XMLParser({attributeNamePrefix:`@_`,ignoreAttributes:!1,parseTagValue:!1}),m;try{let l=f.parse(d);if(!is.plainObject(l))return;m=l}catch{return}if(!is.plainObject(m.install))return;let{install:te}=m;return openframeworksInstallXmlSchema.parse({author:getString$1(te.author),codeUrl:getString$1(te.code_url),description:getString$1(te.description),downloadUrl:getString$1(te.download_url),name:getString$1(te.name),operatingSystems:parseOperatingSystems$2(te),requirements:parseRequirements(te),siteUrl:getString$1(te.site_url),url:getString$1(te.url),version:getString$1(te.version)})}function getString$1(l){if(typeof l!=`string`)return;let d=l.trim();return d.length>0?d:void 0}function parseRequirements(l){let{requires:d}=l;if(d==null)return[];if(typeof d==`string`){let l=d.trim();return l.length>0?[l]:[]}if(is.plainObject(d)){let l=[];for(let f of ensureArray(d.addon)){let d=getString$1(f);d&&l.push(d)}return l}return[]}function parseOperatingSystems$2(l){if(!is.plainObject(l.add))return[];let{add:d}=l;if(!is.plainObject(d.link))return[];let{link:f}=d,m=[],te=new Set;for(let l of ensureArray(f.lib)){if(!is.plainObject(l))continue;let d=getString$1(l[`@_os`]);if(d){let l=LIB_OS_MAP[d.toLowerCase()]??d;te.has(l)||(te.add(l),m.push(l))}}return m}const openframeworksInstallXmlSource=defineSource({async discover(l){return getMatches(l.options,[`install.xml`])},key:`openframeworksInstallXml`,async parse(l,d){let f=parse$16(await readFile(resolve$1(d.options.path,l),`utf8`));if(f!==void 0)return{data:f,source:l}},phase:1}),AUTHOR_SEPARATOR_REGEX$1=/\band\b|,|&/,processingLibraryPropertiesAuthorEntrySchema=object({name:string$2(),url:string$2().optional()}),CANONICAL_CATEGORIES=[`3D`,`Animation`,`Compilations`,`Data`,`Fabrication`,`Geometry`,`GUI`,`Hardware`,`I/O`,`Language`,`Math`,`Simulation`,`Sound`,`Utilities`,`Typography`,`Video & Vision`],CATEGORY_MAP=new Map(CANONICAL_CATEGORIES.map(l=>[l.replaceAll(/[^a-z]/gi,``).toLowerCase(),l]));CATEGORY_MAP.set(`3d`,`3D`);const processingLibraryPropertiesSchema=object({authors:array(processingLibraryPropertiesAuthorEntrySchema),categories:array(_enum(CANONICAL_CATEGORIES)),download:optionalUrl,id:nonEmptyString,maxRevision:number(),minRevision:number(),name:nonEmptyString,paragraph:nonEmptyString,prettyVersion:nonEmptyString,raw:record(string$2(),string$2()),sentence:nonEmptyString,type:nonEmptyString,url:optionalUrl,version:number()});function parse$15(l){let d=parseProperties(l),f=get(d,`version`)??`0`,m=Number.parseInt(f,10),te=get(d,`prettyVersion`),re=te?stripInlineComment$1(te):void 0,ie=get(d,`minRevision`),ae=ie?Number.parseInt(ie,10):0,oe=get(d,`maxRevision`),se=oe?Number.parseInt(oe,10):0;return processingLibraryPropertiesSchema.parse({authors:parseAuthors$2(get(d,`authors`)??get(d,`authorList`)??``),categories:parseCategories(get(d,`categories`)??get(d,`category`)??``),download:nonEmpty$2(get(d,`download`)),id:nonEmpty$2(get(d,`id`)),maxRevision:Number.isNaN(se)?0:se,minRevision:Number.isNaN(ae)?0:ae,name:nonEmpty$2(get(d,`name`)),paragraph:nonEmpty$2(get(d,`paragraph`)),prettyVersion:nonEmpty$2(re),raw:d,sentence:nonEmpty$2(get(d,`sentence`)),type:nonEmpty$2(get(d,`type`)),url:nonEmpty$2(unescapeUrl$1(get(d,`url`)??``)),version:Number.isNaN(m)?0:m})}function get(l,d){return l[d]}function nonEmpty$2(l){if(l===void 0)return;let d=l.trim();return d.length>0?d:void 0}function stripInlineComment$1(l){let d=l.indexOf(` # `);return d===-1?l:l.slice(0,d).trim()}function unescapeUrl$1(l){return l.replaceAll(String.raw`\:`,`:`)}function parseAuthors$2(l){let d=l.trim();if(d.length===0)return[];let f=[],m=0;for(;m<d.length;){let l=d.indexOf(`[`,m);if(l===-1){addPlainAuthors$1(d.slice(m),f);break}l>m&&addPlainAuthors$1(d.slice(m,l),f);let te=d.indexOf(`]`,l);if(te===-1){addPlainAuthors$1(d.slice(l),f);break}let re=d.indexOf(`(`,te);if(re===-1||re!==te+1){addPlainAuthors$1(d.slice(l,te+1),f),m=te+1;continue}let ie=d.indexOf(`)`,re);if(ie===-1){addPlainAuthors$1(d.slice(l),f);break}let ae=d.slice(l+1,te).trim(),oe=nonEmpty$2(unescapeUrl$1(d.slice(re+1,ie).trim())),se=splitCommaSeparated(ae);for(let l of se)f.push({name:l,url:oe});m=ie+1}return f}function addPlainAuthors$1(l,d){let f=l.split(AUTHOR_SEPARATOR_REGEX$1).map(l=>l.trim()).filter(l=>l.length>0&&l.toLowerCase()!==`others`);for(let l of f)d.push({name:l,url:void 0})}function parseCategories(l){let d=l.trim();if(d.length===0)return[];let f=[];for(let l of d.split(`,`)){let d=l.trim().replaceAll(/^"|"$/g,``).trim();if(d.length===0)continue;let m=d.replaceAll(/[^a-z0-9]/gi,``).toLowerCase();if(m.length===0)continue;let te=CATEGORY_MAP.get(m);te&&!f.includes(te)&&f.push(te)}return f}const PROCESSING_SPECIFIC_FIELDS=new Set([`authorList`,`authors`,`dependencies`,`minrevision`,`prettyversion`]),ARDUINO_EXCLUSIVE_FIELDS=new Set([`architectures`,`depends`,`maintainer`]);function isProcessingLibraryProperties(l){let d=parseProperties(l),f=new Set(Object.keys(d).map(l=>l.toLowerCase()));if(!f.has(`name`)||!f.has(`version`))return!1;for(let l of ARDUINO_EXCLUSIVE_FIELDS)if(f.has(l))return!1;for(let l of PROCESSING_SPECIFIC_FIELDS)if(f.has(l))return!0;return!1}const processingLibraryPropertiesSource=defineSource({async discover(l){return getMatches(l.options,[`library.properties`])},key:`processingLibraryProperties`,async parse(l,d){let f=await readFile(resolve$1(d.options.path,l),`utf8`);if(isProcessingLibraryProperties(f))return{data:parse$15(f),source:l}},phase:1}),AUTHOR_SEPARATOR_REGEX=/\band\b|,|&/,processingSketchPropertiesAuthorEntrySchema=object({name:string$2(),url:string$2().optional()}),processingSketchPropertiesSchema=object({authors:array(processingSketchPropertiesAuthorEntrySchema),component:nonEmptyString,download:optionalUrl,main:nonEmptyString,manifestLabel:nonEmptyString,manifestOrientation:nonEmptyString,manifestPackage:nonEmptyString,manifestPermissions:array(string$2()),manifestSdkMin:number().optional(),manifestSdkTarget:number().optional(),manifestVersionCode:number().optional(),manifestVersionName:nonEmptyString,maxRevision:number(),minRevision:number(),mode:nonEmptyString,modeId:nonEmptyString,name:nonEmptyString,paragraph:nonEmptyString,prettyVersion:nonEmptyString,raw:record(string$2(),string$2()),sentence:nonEmptyString,templates:nonEmptyString,url:optionalUrl,version:number(),zipfilename:nonEmptyString});function parse$14(l){let d=parseProperties(l),f=d.version??`0`,m=Number.parseInt(f,10),te=d.prettyVersion,re=te?stripInlineComment(te):void 0,ie=d.minRevision,ae=ie?Number.parseInt(ie,10):0,oe=d.maxRevision,se=oe?Number.parseInt(oe,10):0,ce=d[`manifest.version.code`],le=ce?Number.parseInt(ce,10):void 0,ue=d[`manifest.sdk.target`],de=ue?Number.parseInt(ue,10):void 0,fe=d[`manifest.sdk.min`],pe=fe?Number.parseInt(fe,10):void 0,me=splitCommaSeparated(d[`manifest.permissions`]??``);return processingSketchPropertiesSchema.parse({authors:parseAuthors$1(d.authors??d.authorList??``),component:nonEmpty$1(d.component),download:nonEmpty$1(unescapeUrl(d.download??``)),main:nonEmpty$1(d.main),manifestLabel:nonEmpty$1(d[`manifest.label`]),manifestOrientation:nonEmpty$1(d[`manifest.orientation`]),manifestPackage:nonEmpty$1(d[`manifest.package`]),manifestPermissions:me,manifestSdkMin:Number.isNaN(pe)?void 0:pe,manifestSdkTarget:Number.isNaN(de)?void 0:de,manifestVersionCode:Number.isNaN(le)?void 0:le,manifestVersionName:nonEmpty$1(d[`manifest.version.name`]),maxRevision:Number.isNaN(se)?0:se,minRevision:Number.isNaN(ae)?0:ae,mode:nonEmpty$1(d.mode),modeId:nonEmpty$1(d[`mode.id`]),name:nonEmpty$1(d.name),paragraph:nonEmpty$1(d.paragraph),prettyVersion:nonEmpty$1(re),raw:d,sentence:nonEmpty$1(d.sentence),templates:nonEmpty$1(d.templates),url:nonEmpty$1(unescapeUrl(d.url??``)),version:Number.isNaN(m)?0:m,zipfilename:nonEmpty$1(d.zipfilename)})}function nonEmpty$1(l){if(l===void 0)return;let d=l.trim();return d.length>0?d:void 0}function stripInlineComment(l){let d=l.indexOf(` # `);return d===-1?l:l.slice(0,d).trim()}function unescapeUrl(l){return l.replaceAll(String.raw`\:`,`:`)}function parseAuthors$1(l){let d=l.trim();if(d.length===0)return[];let f=[],m=0;for(;m<d.length;){let l=d.indexOf(`[`,m);if(l===-1){addPlainAuthors(d.slice(m),f);break}l>m&&addPlainAuthors(d.slice(m,l),f);let te=d.indexOf(`]`,l);if(te===-1){addPlainAuthors(d.slice(l),f);break}let re=d.indexOf(`(`,te);if(re===-1||re!==te+1){addPlainAuthors(d.slice(l,te+1),f),m=te+1;continue}let ie=d.indexOf(`)`,re);if(ie===-1){addPlainAuthors(d.slice(l),f);break}let ae=d.slice(l+1,te).trim(),oe=nonEmpty$1(unescapeUrl(d.slice(re+1,ie).trim())),se=splitCommaSeparated(ae);for(let l of se)f.push({name:l,url:oe});m=ie+1}return f}function addPlainAuthors(l,d){let f=l.split(AUTHOR_SEPARATOR_REGEX).map(l=>l.trim()).filter(l=>l.length>0&&l.toLowerCase()!==`others`);for(let l of f)d.push({name:l,url:void 0})}function isProcessingSketchProperties(l){let d=parseProperties(l);return Object.keys(d).some(l=>l===`main`||l===`mode`||l===`mode.id`||l.startsWith(`manifest.`))}const processingSketchPropertiesSource=defineSource({async discover(l){return getMatches(l.options,[`sketch.properties`])},key:`processingSketchProperties`,async parse(l,d){let f=await readFile(resolve$1(d.options.path,l),`utf8`);if(isProcessingSketchProperties(f))return{data:parse$14(f),source:l}},phase:1}),publiccodeContactEntrySchema=object({affiliation:string$2().optional(),email:string$2().optional(),name:string$2(),phone:string$2().optional()}),publiccodeContractorEntrySchema=object({name:string$2(),until:string$2().optional(),website:string$2().optional()}),publiccodeDependencyEntrySchema=object({category:_enum([`hardware`,`open`,`proprietary`]),name:string$2(),optional:boolean().optional(),version:string$2().optional(),versionMax:string$2().optional(),versionMin:string$2().optional()}),publiccodeDescriptionSchema=object({documentation:string$2().optional(),features:array(string$2()),genericName:string$2().optional(),localisedName:string$2().optional(),longDescription:string$2().optional(),shortDescription:string$2().optional()}),publiccodeSchema=object({applicationSuite:nonEmptyString,availableLanguages:stringArray,categories:stringArray,contacts:array(publiccodeContactEntrySchema),contractors:array(publiccodeContractorEntrySchema),dependencies:array(publiccodeDependencyEntrySchema),description:publiccodeDescriptionSchema.optional(),descriptions:record(string$2(),publiccodeDescriptionSchema),developmentStatus:nonEmptyString,inputTypes:stringArray,isBasedOn:optionalUrl,landingUrl:optionalUrl,license:nonEmptyString,localisationReady:boolean().optional(),logo:optionalUrl,mainCopyrightOwner:nonEmptyString,maintenanceType:nonEmptyString,monochromeLogo:optionalUrl,name:nonEmptyString,outputTypes:stringArray,platforms:stringArray,publiccodeYmlVersion:nonEmptyString,releaseDate:nonEmptyString,repoOwner:nonEmptyString,roadmap:optionalUrl,softwareType:nonEmptyString,softwareVersion:nonEmptyString,url:optionalUrl,usedBy:stringArray});function toString$2(l){if(typeof l==`string`)return l;if(typeof l==`number`)return String(l);if(l instanceof Date)return l.toISOString().slice(0,10)}function isNonEmptyString(l){return typeof l==`string`&&l.trim().length>0}function isPlainObject$2(l){return typeof l==`object`&&!!l&&!Array.isArray(l)&&!(l instanceof Date)}function toStringArray$1(l){return Array.isArray(l)?l.filter(l=>typeof l==`string`):[]}function parseDescription(l){let d=[];if(Array.isArray(l.features)){for(let f of l.features)if(typeof f==`string`)d.push(f);else if(isPlainObject$2(f))for(let[l,m]of Object.entries(f))d.push(typeof m==`string`?`${l}: ${m}`:l)}return{...isNonEmptyString(l.documentation)?{documentation:l.documentation}:{},features:d,...isNonEmptyString(l.genericName)?{genericName:l.genericName}:{},...isNonEmptyString(l.localisedName)?{localisedName:l.localisedName}:{},...isNonEmptyString(l.longDescription)?{longDescription:l.longDescription.trim()}:{},...isNonEmptyString(l.shortDescription)?{shortDescription:l.shortDescription.trim()}:{}}}function parse$13(l){let d;try{d=(0,import_dist.parse)(l)}catch{return}if(!isPlainObject$2(d)||!isNonEmptyString(d.name)&&!isNonEmptyString(d.url))return;let f={},m;if(isPlainObject$2(d.description)){let l=d.description;for(let[d,m]of Object.entries(l))isPlainObject$2(m)&&(f[d]=parseDescription(m));let te=`en`in f?`en`:Object.keys(f)[0];te&&(m=f[te])}let te=[];if(isPlainObject$2(d.maintenance)){let{maintenance:l}=d;if(Array.isArray(l.contacts)){for(let d of l.contacts)if(isPlainObject$2(d)&&isNonEmptyString(d.name)){let l={name:d.name};isNonEmptyString(d.email)&&(l.email=d.email),isNonEmptyString(d.phone)&&(l.phone=d.phone),isNonEmptyString(d.affiliation)&&(l.affiliation=d.affiliation),te.push(l)}}}let re=[];if(isPlainObject$2(d.maintenance)){let{maintenance:l}=d;if(Array.isArray(l.contractors)){for(let d of l.contractors)if(isPlainObject$2(d)&&isNonEmptyString(d.name)){let l={name:d.name},f=toString$2(d.until);f&&(l.until=f),isNonEmptyString(d.website)&&(l.website=d.website),re.push(l)}}}let ie=[];if(isPlainObject$2(d.dependsOn)){let{dependsOn:l}=d;for(let d of[`open`,`proprietary`,`hardware`]){let f=l[d];if(Array.isArray(f)){for(let l of f)if(isPlainObject$2(l)&&isNonEmptyString(l.name)){let f={category:d,name:l.name},m=toString$2(l.version);m&&(f.version=m);let te=toString$2(l.versionMin);te&&(f.versionMin=te);let re=toString$2(l.versionMax);re&&(f.versionMax=re),typeof l.optional==`boolean`&&(f.optional=l.optional),ie.push(f)}}}}let ae=[],oe;if(isPlainObject$2(d.localisation)){let l=d.localisation;ae=toStringArray$1(l.availableLanguages),typeof l.localisationReady==`boolean`&&(oe=l.localisationReady)}let se,ce,le;if(isPlainObject$2(d.legal)){let{legal:l}=d;isNonEmptyString(l.license)&&(se=l.license),isNonEmptyString(l.mainCopyrightOwner)&&(ce=l.mainCopyrightOwner),isNonEmptyString(l.repoOwner)&&(le=l.repoOwner)}let ue=toString$2(d.softwareVersion),de=toString$2(d.releaseDate);return publiccodeSchema.parse({...isNonEmptyString(d.applicationSuite)?{applicationSuite:d.applicationSuite}:{},availableLanguages:ae,categories:toStringArray$1(d.categories),contacts:te,contractors:re,dependencies:ie,...m?{description:m}:{},descriptions:f,...isNonEmptyString(d.developmentStatus)?{developmentStatus:d.developmentStatus}:{},inputTypes:toStringArray$1(d.inputTypes),...isNonEmptyString(d.isBasedOn)?{isBasedOn:d.isBasedOn}:{},...isNonEmptyString(d.landingURL)?{landingUrl:d.landingURL}:{},...se?{license:se}:{},...oe===void 0?{}:{localisationReady:oe},...isNonEmptyString(d.logo)?{logo:d.logo}:{},...ce?{mainCopyrightOwner:ce}:{},...isPlainObject$2(d.maintenance)&&isNonEmptyString(d.maintenance.type)?{maintenanceType:d.maintenance.type}:{},...isNonEmptyString(d.monochromeLogo)?{monochromeLogo:d.monochromeLogo}:{},...isNonEmptyString(d.name)?{name:d.name}:{},outputTypes:toStringArray$1(d.outputTypes),platforms:toStringArray$1(d.platforms),...isNonEmptyString(d.publiccodeYmlVersion)?{publiccodeYmlVersion:d.publiccodeYmlVersion}:toString$2(d.publiccodeYmlVersion)?{publiccodeYmlVersion:toString$2(d.publiccodeYmlVersion)}:{},...de?{releaseDate:de}:{},...le?{repoOwner:le}:{},...isNonEmptyString(d.roadmap)?{roadmap:d.roadmap}:{},...isNonEmptyString(d.softwareType)?{softwareType:d.softwareType}:{},...ue?{softwareVersion:ue}:{},...isNonEmptyString(d.url)?{url:d.url}:{},usedBy:toStringArray$1(d.usedBy)})}const publiccodeYamlSource=defineSource({async discover(l){return getMatches(l.options,[`publiccode.yml`,`publiccode.yaml`])},key:`publiccodeYaml`,async parse(l,d){let f=parse$13(await readFile(resolve$1(d.options.path,l),`utf8`));if(f!==void 0)return{data:f,source:l}},phase:1}),LEADING_WHITESPACE_REGEX$1=/^\s/,MULTI_VALUE_HEADERS=new Set([`Classifier`,`Platform`,`Project-URL`,`Requires-Dist`,`Requires-External`,`Supported-Platform`]);function parseRfc822Headers(l){let d={},f=``;for(let m of l.split(`
45684
45684
  `)){if(m.trim()===``)break;if(LEADING_WHITESPACE_REGEX$1.test(m)&&f){let l=m.trim();l&&(d[f]=`${d[f]}\n${l}`);continue}let l=m.indexOf(`: `);if(l>0){let te=m.slice(0,l),re=m.slice(l+2).trim();d[te]=MULTI_VALUE_HEADERS.has(te)&&d[te]?`${d[te]}\n${re}`:re,f=te}}return d}function extractRfc822Body(l){let d=l.indexOf(`
45685
45685
 
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
2
  var name = "metascope";
3
- var version = "0.8.4";
3
+ var version = "0.8.5";
4
4
  //#endregion
5
5
  export { name, version };
@@ -1,12 +1,26 @@
1
1
  import { log } from "../log.js";
2
2
  //#region src/lib/utilities/fetch.ts
3
+ const MIN_FETCH_INTERVAL_MS = 300;
4
+ let fetchChain = Promise.resolve();
5
+ let lastFetchStart = 0;
6
+ async function waitForFetchTurn() {
7
+ const turn = fetchChain.then(async () => {
8
+ const wait = lastFetchStart + MIN_FETCH_INTERVAL_MS - Date.now();
9
+ if (wait > 0) await sleep(wait);
10
+ lastFetchStart = Date.now();
11
+ });
12
+ fetchChain = turn;
13
+ return turn;
14
+ }
3
15
  /**
4
16
  * Fetch with automatic retries and exponential backoff. Retries on network
5
- * errors and 429/5xx responses.
17
+ * errors and 429/5xx responses. Request starts are paced globally to stay under
18
+ * per-IP rate limits.
6
19
  */
7
20
  async function fetchWithRetry(url, options, maxRetries = 5) {
8
21
  let lastError;
9
22
  for (let attempt = 0; attempt <= maxRetries; attempt++) try {
23
+ await waitForFetchTurn();
10
24
  const response = await fetch(url, options);
11
25
  if ((response.status === 429 || response.status >= 500) && attempt < maxRetries) {
12
26
  const delay = getDelay(attempt, response);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metascope",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "A CLI tool and TypeScript library to easily extract metadata from all kinds of software repositories.",
5
5
  "keywords": [
6
6
  "metadata",