@layerzerolabs/verify-contract 1.1.7 → 1.1.8

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/cli/index.js CHANGED
@@ -23,4 +23,4 @@ Please provide the API URL:
23
23
  - As an apiUrl config parameter in ${r} config
24
24
  - As a SCAN_API_URL_${r} enviornment variable
25
25
  - As a SCAN_API_URL_${normalizeNetworkName(r)} enviornment variable
26
- `);const u=i.apiKey||getScanApiKeyFromEnv(r);if(!u){e.debug(`Could not find scan API key for network ${a.default.bold(r)}\n \nPlease provide the API key:\n\n- As an apiKey config parameter in ${r} config\n- As a SCAN_API_KEY_${r} enviornment variable\n- As a SCAN_API_KEY_${normalizeNetworkName(r)} enviornment variable`)}const c=i.browserUrl||getScanBrowserUrlFromEnv(r)||(0,n.tryGetScanBrowserUrlFromScanUrl)(l);if(!c){e.debug(`Could not find scan browser URL key for network ${a.default.bold(r)}\n\n Browser URL is used to display a link to the verified contract\n after successful verification.\n \n Please provide the browser URL:\n \n - As an browserUrl config parameter in ${r} config\n - As a SCAN_BROWSER_URL_${r} enviornment variable\n - As a SCAN_BROWSER_URL_${normalizeNetworkName(r)} enviornment variable`)}return{...t,[r]:{apiUrl:l,apiKey:u,browserUrl:c}}}),{});t.parseNetworksConfig=parseNetworksConfig;const getScanApiUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanBrowserUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_BROWSER_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_BROWSER_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanApiKeyFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_KEY_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_KEY_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const normalizeNetworkName=e=>e.toUpperCase().replaceAll("-","_")},7364:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createVerification=void 0;const n=r(3301);const s=r(824);const o=i(r(2361));const a=i(r(1391));class Verification extends o.default{constructor(e){super();this.props=e}async verify(){try{const e=await this.__submit();if(isAlreadyVerifiedResult(e.result)){return{alreadyVerified:true}}if(e.status!==1){throw new Error(`Verification failed with result "${e.result}", status ${e.status} (${e.message})`)}const t=e.result;if(t==null){throw new Error(`Missing GUID from the response: ${e}`)}return await this.__poll(t)}catch(e){throw new Error(`Verification error: ${e}`)}}async __submit(){const e=createVerificationRequest(this.props);return await(0,s.retry)((async()=>{const t=await submitRequest(this.props.apiUrl,e);if(isApiRateLimitedResult(t.result)){throw new Error(`API Rate limit has been exceeded`)}return t}),3,(async(e,t)=>{this.emit("retry",e,t);await(0,s.sleep)(2e3)}))}async __poll(e){while(true){this.emit("poll",e);const t=await checkGuid(this.props.apiUrl,e);if(t.status===1)return{alreadyVerified:false};if(isAlreadyVerifiedResult(t.result))return{alreadyVerified:true};if(isPendingResult(t.result)){await(0,s.sleep)(1e4);continue}if(isApiRateLimitedResult(t.result)){await(0,s.sleep)(1e4);continue}throw new Error(`Verification failed with result "${t.result}", status ${t.status} (${t.message})`)}}}const createVerification=e=>new Verification(e);t.createVerification=createVerification;const isPendingResult=e=>!!(e===null||e===void 0?void 0:e.match(/Pending/gi));const isAlreadyVerifiedResult=e=>!!(e===null||e===void 0?void 0:e.match(/already verified/gi));const isApiRateLimitedResult=e=>!!(e===null||e===void 0?void 0:e.match(/rate/));const submitRequest=async(e,t)=>{try{const r=await(0,a.default)(e,{method:"POST",form:t,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return l.parse(r)}catch(e){throw new Error(`Failed to submit verification request: ${e}`)}};const checkGuid=async(e,t)=>{const r=new URL(e);r.searchParams.set("module","contract");r.searchParams.set("action","checkverifystatus");r.searchParams.set("guid",t);try{const e=await(0,a.default)(r).json();return l.parse(e)}catch(e){throw new Error(`Failed to check verification status: ${e}`)}};const createVerificationRequest=({apiKey:e,address:t,contractName:r,constructorArguments:i,compilerVersion:n,optimizerRuns:s=0,sourceCode:o,evmVersion:a,licenseType:l})=>{const u={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:t,contractname:r,compilerversion:`v${n}`,optimizationUsed:s>0?"1":"0",sourceCode:o};if(e!=null)u.apikey=e;if(s!=null)u.runs=String(s);if(i!=null)u.constructorArguements=i;if(a!=null)u.evmversion=a;if(l!=null)u.licenseType=String(l);return u};const l=n.z.object({status:n.z.coerce.number().nullish(),message:n.z.string().nullish(),result:n.z.string().nullish()})},8194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isFile=t.isDirectory=void 0;const i=r(7147);const isDirectory=e=>{try{return(0,i.lstatSync)(e).isDirectory()}catch(e){return false}};t.isDirectory=isDirectory;const isFile=e=>{try{return(0,i.lstatSync)(e).isFile()}catch(e){return false}};t.isFile=isFile},4963:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findLicenseType=t.LicenseType=void 0;var r;(function(e){e[e["None"]=1]="None";e[e["Unlicense"]=2]="Unlicense";e[e["MIT"]=3]="MIT";e[e["GNU-GPLv2"]=4]="GNU-GPLv2";e[e["GNU-GPLv3"]=5]="GNU-GPLv3";e[e["GNU-LGPLv2.1"]=6]="GNU-LGPLv2.1";e[e["GNU-LGPLv3"]=7]="GNU-LGPLv3";e[e["BSD-2-Clause"]=8]="BSD-2-Clause";e[e["BSD-3-Clause"]=9]="BSD-3-Clause";e[e["MPL-2.0"]=10]="MPL-2.0";e[e["OSL-3.0"]=11]="OSL-3.0";e[e["Apache-2.0"]=12]="Apache-2.0";e[e["GNU-AGPLv3"]=13]="GNU-AGPLv3";e[e["BUSL-1.1"]=14]="BUSL-1.1"})(r||(t.LicenseType=r={}));const findLicenseType=e=>{const t=e.match(/\/\/\s*SPDX-License-Identifier\:\s*(.*)\s*/i);const i=t===null||t===void 0?void 0:t[1];if(i==null)return r.None;if(!(i in r)){console.warn("Found unknown SPDX license identifier: %s",i)}return r[i]};t.findLicenseType=findLicenseType},8989:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createRecordLogger=t.anonymizeValue=t.COLORS=t.createLogger=void 0;const n=i(r(8818));const s=i(r(4158));const createLogger=e=>s.default.createLogger({level:e,format:s.default.format.cli(),transports:[new s.default.transports.Console]});t.createLogger=createLogger;t.COLORS={default:n.default.white,error:n.default.red,success:n.default.green,palette:[n.default.magenta,n.default.cyan,n.default.yellow,n.default.blue,n.default.magentaBright,n.default.cyanBright,n.default.blueBright]};const anonymizeValue=e=>{const t=Math.min(Math.max(0,e.length-2),4);const r=e.length-t;const i=e.slice(0,t);const n=Array.from({length:r}).fill("*").join("");return`${i}${n}`};t.anonymizeValue=anonymizeValue;const createRecordLogger=(e,t="\t")=>r=>{e.info("");Object.entries(r).forEach((([r,i])=>{if(Array.isArray(i)){e.info(`${r}:`);i.forEach((r=>{e.info(`${t}\t- ${n.default.bold(formatLoggableValue(r))}`)}))}else{e.info(`${r}:${t}${n.default.bold(formatLoggableValue(i))}`)}}))};t.createRecordLogger=createRecordLogger;const formatLoggableValue=e=>{if(e==null)return"-";switch(typeof e){case"boolean":return e?o:a;default:return String(e)}};const o=t.COLORS.success`✓`;const a=t.COLORS.error`⚠`},824:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.retry=t.sleep=void 0;const n=i(r(9491));const sleep=e=>new Promise((t=>{setTimeout(t,e)}));t.sleep=sleep;const retry=async(e,t,r)=>{(0,n.default)(t>0,`Number of attempts for retry must be larger than 0, got ${t}`);for(let i=0;i<t-1;i++){try{return await e()}catch(e){await(r===null||r===void 0?void 0:r(e,i))}}return e()};t.retry=retry},2953:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DeploymentSchema=t.MetadataSchema=t.MinimalAbiSchema=t.SourcesSchema=t.OptimizerSchema=void 0;const i=r(3301);t.OptimizerSchema=i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()});t.SourcesSchema=i.z.record(i.z.string(),i.z.object({content:i.z.string()}));t.MinimalAbiSchema=i.z.array(i.z.record(i.z.string(),i.z.any()));t.MetadataSchema=i.z.object({language:i.z.string(),compiler:i.z.object({version:i.z.string()}),settings:i.z.object({compilationTarget:i.z.record(i.z.string(),i.z.string()),evmVersion:i.z.string(),optimizer:i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()})}),sources:i.z.record(i.z.string(),i.z.object({content:i.z.string()}))});t.DeploymentSchema=i.z.object({address:i.z.string(),abi:t.MinimalAbiSchema,args:i.z.array(i.z.any()),solcInputHash:i.z.string(),metadata:i.z.string().transform(((e,t)=>{try{return JSON.parse(e)}catch(e){t.addIssue({code:"custom",message:"Invalid JSON"});return i.z.NEVER}})).pipe(t.MetadataSchema),bytecode:i.z.string(),deployedBytecode:i.z.string()})},2413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.tryCreateScanContractUrl=t.tryGetScanBrowserUrlFromScanUrl=t.getDefaultScanApiUrl=void 0;const getDefaultScanApiUrl=e=>r.get(e);t.getDefaultScanApiUrl=getDefaultScanApiUrl;const tryGetScanBrowserUrlFromScanUrl=e=>{try{const t=new URL(e);if(!t.hostname.startsWith("api.")&&!t.hostname.startsWith("api-"))return undefined;t.hostname=t.hostname.replace(/^api[.-]/,"");t.pathname="/";return t.toString()}catch(e){return undefined}};t.tryGetScanBrowserUrlFromScanUrl=tryGetScanBrowserUrlFromScanUrl;const tryCreateScanContractUrl=(e,t)=>{try{const r=new URL(e);r.pathname=`/address/${t}`;return r.toString()}catch(e){return undefined}};t.tryCreateScanContractUrl=tryCreateScanContractUrl;const r=new Map([["avalanche","https://api.snowtrace.io/api"],["avalanche-mainnet","https://api.snowtrace.io/api"],["fuji","https://api-testnet.snowtrace.io/api"],["avalanche-testnet","https://api-testnet.snowtrace.io/api"],["arbitrum","https://api.arbiscan.io/api"],["arbitrum-goerli","https://api-goerli.arbiscan.io/api"],["bsc","https://api.bscscan.com/api"],["bsc-testnet","https://api-testnet.bscscan.com/api"],["ethereum","https://api.etherscan.io/api"],["ethereum-goerli","https://api-goerli.etherscan.io/api"],["goerli","https://api-goerli.etherscan.io/api"],["fantom","https://api.ftmscan.com/api"],["fantom-testnet","https://api-testnet.ftmscan.com/api"],["kava","https://kavascan.com/api"],["kava-mainnet","https://kavascan.com/api"],["kava-testnet","https://testnet.kavascan.com/api"],["polygon","https://api.polygonscan.com/api"],["mumbai","https://api-testnet.polygonscan.com/api"],["optimism","https://api-optimistic.etherscan.io/api"],["optimism-goerli","https://api-goerli-optimistic.etherscan.io/api"],["gnosis","https://api.gnosisscan.io/api"],["zkpolygon","https://api-zkevm.polygonscan.com/api"],["zkpolygon-mainnet","https://api-zkevm.polygonscan.com/api"],["base","https://api.basescan.org/api"],["base-mainnet","https://api.basescan.org/api"],["base-goerli","https://api-goerli.basescan.org/api"],["linea","https://api.lineascan.build/api"],["linea-mainnet","https://api.lineascan.build/api"],["zkconsensys","https://api.lineascan.build/api"],["zkconsensys-mainnet","https://api.lineascan.build/api"],["moonbeam","https://api-moonbeam.moonscan.io/api"],["moonbeam-testnet","https://api-moonbase.moonscan.io/api"]])},4367:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseFilterConfig=t.parsePathsConfig=void 0;const n=i(r(1017));const parsePathsConfig=e=>{var t;return{deployments:(t=e===null||e===void 0?void 0:e.deployments)!==null&&t!==void 0?t:n.default.resolve(process.cwd(),"deployments")}};t.parsePathsConfig=parsePathsConfig;const parseFilterConfig=e=>{if(e==null)return()=>true;switch(typeof e){case"boolean":return()=>e;case"string":return t=>t===e;case"function":return e;case"object":if(Array.isArray(e)){const t=new Set(e);return e=>t.has(e)}if(e instanceof RegExp){return t=>e.test(t)}default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${e}`)}};t.parseFilterConfig=parseFilterConfig},2066:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extractSolcInputFromMetadata=void 0;const extractSolcInputFromMetadata=e=>{const{compilationTarget:t,...r}=e.settings;const i=Object.entries(e.sources).reduce(((e,[t,r])=>({...e,[t]:{content:r.content}})),{});return{language:e.language,settings:r,sources:i}};t.extractSolcInputFromMetadata=extractSolcInputFromMetadata},8584:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.verifyTarget=t.verifyNonTarget=void 0;const n=r(6348);const s=r(1017);const o=r(4963);const a=r(7364);const l=i(r(8818));const u=r(8989);const c=r(2413);const h=r(2953);const d=r(2066);const p=r(3718);const m=r(4367);const g=r(8194);const y=r(7147);const verifyNonTarget=async(e,t)=>{const r=(0,n.parseNetworksConfig)(t,e.networks);const i=(0,m.parsePathsConfig)(e.paths);const a=(0,u.createRecordLogger)(t);const l=createVerifyAll(t);const c=createLogVerificationResult(a);const y=e.contracts.flatMap((e=>{var n;const{address:l,network:c,contractName:m,deployment:y}=e;t.info(`Collectiong information for contract ${m} on network ${c}`);const _=r[c];if(_==null){t.info(`No network configured for contract ${m} on network ${c}`);return[]}const v=`${(0,s.basename)(y,".json")}.json`;const b=(0,s.resolve)(i.deployments,c,v);if(!(0,g.isFile)(b)){t.error(u.COLORS.error`Deployment file ${b} does not exist or is not a file`);return[]}const x=require(b);const T=h.DeploymentSchema.safeParse(x);if(!T.success){t.error(u.COLORS.error`No network configured for contract ${m} on network ${c}`);return[]}const w=T.data;const S=(0,s.basename)(m,".sol");const E=w.metadata.sources[m];if(E==null){t.error(u.COLORS.error`Missing source for contract ${m} for network ${c} in ${v}`);return[]}const A=(0,o.findLicenseType)(E.content);const C=(0,p.getContructorABIFromSource)(E.content);const N=(0,p.encodeContructorArguments)(C,e.constructorArguments);const O=(0,d.extractSolcInputFromMetadata)(w.metadata);const R={apiUrl:_.apiUrl,apiKey:_.apiKey,address:l,contractName:`${m}:${S}`,constructorArguments:N,licenseType:A,compilerVersion:w.metadata.compiler.version,sourceCode:JSON.stringify(O),evmVersion:w.metadata.settings.evmVersion,optimizerRuns:(n=w.metadata.settings.optimizer)===null||n===void 0?void 0:n.runs};a({Contract:m,Network:c,Address:R.address,License:R.licenseType,Arguments:e.constructorArguments?JSON.stringify(e.constructorArguments):undefined,Sources:Object.keys(w.metadata.sources),"Scan URL":R.apiUrl,"Scan API Key":R.apiKey?(0,u.anonymizeValue)(R.apiKey):undefined});return[{networkName:c,networkConfig:_,submitProps:R}]}));if(y.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const _=await Promise.all(l(y));_.forEach(c);return _};t.verifyNonTarget=verifyNonTarget;const verifyTarget=async(e,t)=>{const r=(0,m.parseFilterConfig)(e.filter);const i=(0,n.parseNetworksConfig)(t,e.networks);const a=(0,m.parsePathsConfig)(e.paths);const l=(0,u.createRecordLogger)(t);const c=createVerifyAll(t);const _=createLogVerificationResult(l);if(!(0,g.isDirectory)(a.deployments)){throw new Error(`Path ${a.deployments} is not a directory`)}const v=new Set((0,y.readdirSync)(a.deployments));const b=Object.entries(i);t.debug("Verifying deployments for following networks:");b.forEach((([e,r])=>{t.debug(`\t\t- ${e} (API URL ${r.apiUrl})`)}));const x=b.flatMap((([e,i])=>{t.info(`Collecting deployments for ${e}...`);if(!v.has(e)){t.warn(`Could not find deployment for network ${e} in ${a.deployments}`);return[]}const n=(0,s.resolve)(a.deployments,e);const c=(0,y.readdirSync)(n).filter((e=>e.endsWith(".json")));return c.flatMap((a=>{t.info(`Inspecting deployment file ${a} on network ${e}`);const c=(0,s.resolve)(n,a);const m=require(c);const g=h.DeploymentSchema.safeParse(m);if(!g.success){throw new Error(`Error parsing deployment file ${a} on network ${e}: ${g.error}`)}const y=g.data;const _=y.metadata.settings.compilationTarget;return Object.entries(_).flatMap((([n,s])=>{var c;const h=r(s,n,e);if(!h){t.debug(`Not verifying ${s} in ${a} on network ${e}`);return[]}const m=y.metadata.sources[n];if(m==null){t.error(u.COLORS.error`Could not find source for ${s} (${n})`);return[]}const g=(0,o.findLicenseType)(m.content);const _=(0,p.encodeContructorArguments)(y.abi,y.args);const v=(0,d.extractSolcInputFromMetadata)(y.metadata);const b={apiUrl:i.apiUrl,apiKey:i.apiKey,address:y.address,contractName:`${n}:${s}`,constructorArguments:_,licenseType:g,compilerVersion:y.metadata.compiler.version,sourceCode:JSON.stringify(v),evmVersion:y.metadata.settings.evmVersion,optimizerRuns:(c=y.metadata.settings.optimizer)===null||c===void 0?void 0:c.runs};l({Contract:s,Network:e,Address:y.address,License:b.licenseType,Arguments:JSON.stringify(y.args),Sources:Object.keys(y.metadata.sources),"Scan URL":b.apiUrl,"Scan API Key":b.apiKey?(0,u.anonymizeValue)(b.apiKey):undefined});return{submitProps:b,networkName:e,networkConfig:i}}))}))}));if(x.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const T=await Promise.all(c(x));T.forEach(_);return T};t.verifyTarget=verifyTarget;const createVerifyAll=e=>t=>t.map((async(r,i)=>{const{submitProps:n}=r;const s=u.COLORS.palette[i%u.COLORS.palette.length];const o=`[${i+1}/${t.length}]`;const c=l.default.bold(n.contractName);const h=l.default.bold(r.networkName);e.info(s`Verifying contract ${c} for network ${h} ${o}`);try{const t=(0,a.createVerification)(n);t.on("poll",(t=>{e.info(s`Polling for verification status of ${c} for network ${h} (GUID ${t}) ${o}`)}));t.on("retry",((t,r)=>{e.info(s`Retrying failed verification attempt of ${c} for network ${h} (attempt ${r+1}) ${o}`)}));const i=await t.verify();return{artifact:r,result:i}}catch(t){e.error(u.COLORS.error`Problem verifying contract ${c} for network ${h} ${o}: ${t} `);return{artifact:r,error:t}}}));const createLogVerificationResult=e=>({artifact:t,response:r,error:i})=>{const n=l.default.bold(t.submitProps.contractName);const s=l.default.bold(t.networkName);const o=t.networkConfig.browserUrl?(0,c.tryCreateScanContractUrl)(t.networkConfig.browserUrl,t.submitProps.address):undefined;e({Contract:n,Network:s,Result:i==null,"Was verified":r===null||r===void 0?void 0:r.alreadyVerified,"Contract URL":o,Error:i?u.COLORS.error(i):undefined})}},9491:e=>{"use strict";e.exports=require("assert")},4300:e=>{"use strict";e.exports=require("buffer")},2081:e=>{"use strict";e.exports=require("child_process")},2361:e=>{"use strict";e.exports=require("events")},7147:e=>{"use strict";e.exports=require("fs")},3685:e=>{"use strict";e.exports=require("http")},5158:e=>{"use strict";e.exports=require("http2")},5687:e=>{"use strict";e.exports=require("https")},1808:e=>{"use strict";e.exports=require("net")},2037:e=>{"use strict";e.exports=require("os")},1017:e=>{"use strict";e.exports=require("path")},7282:e=>{"use strict";e.exports=require("process")},2781:e=>{"use strict";e.exports=require("stream")},1576:e=>{"use strict";e.exports=require("string_decoder")},4404:e=>{"use strict";e.exports=require("tls")},6224:e=>{"use strict";e.exports=require("tty")},7310:e=>{"use strict";e.exports=require("url")},3837:e=>{"use strict";e.exports=require("util")},9796:e=>{"use strict";e.exports=require("zlib")},4379:(e,t,r)=>{const{Argument:i}=r(9414);const{Command:n}=r(552);const{CommanderError:s,InvalidArgumentError:o}=r(2625);const{Help:a}=r(5153);const{Option:l}=r(6558);t=e.exports=new n;t.program=t;t.Argument=i;t.Command=n;t.CommanderError=s;t.Help=a;t.InvalidArgumentError=o;t.InvalidOptionArgumentError=o;t.Option=l},9414:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Argument{constructor(e,t){this.description=t||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(e[0]){case"<":this.required=true;this._name=e.slice(1,-1);break;case"[":this.required=false;this._name=e.slice(1,-1);break;default:this.required=true;this._name=e;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}argParser(e){this.parseArg=e;return this}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(e){const t=e.name()+(e.variadic===true?"...":"");return e.required?"<"+t+">":"["+t+"]"}t.Argument=Argument;t.humanReadableArgName=humanReadableArgName},552:(e,t,r)=>{const i=r(2361).EventEmitter;const n=r(2081);const s=r(1017);const o=r(7147);const a=r(7282);const{Argument:l,humanReadableArgName:u}=r(9414);const{CommanderError:c}=r(2625);const{Help:h}=r(5153);const{Option:d,splitOptionFlags:p,DualOptions:m}=r(6558);const{suggestSimilar:g}=r(7592);class Command extends i{constructor(e){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this._args=[];this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=e||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:undefined,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:undefined,outputError:(e,t)=>t(e)};this._hidden=false;this._hasHelpOption=true;this._helpFlags="-h, --help";this._helpDescription="display help for command";this._helpShortFlag="-h";this._helpLongFlag="--help";this._addImplicitHelpCommand=undefined;this._helpCommandName="help";this._helpCommandnameAndArgs="help [command]";this._helpCommandDescription="display help for command";this._helpConfiguration={}}copyInheritedSettings(e){this._outputConfiguration=e._outputConfiguration;this._hasHelpOption=e._hasHelpOption;this._helpFlags=e._helpFlags;this._helpDescription=e._helpDescription;this._helpShortFlag=e._helpShortFlag;this._helpLongFlag=e._helpLongFlag;this._helpCommandName=e._helpCommandName;this._helpCommandnameAndArgs=e._helpCommandnameAndArgs;this._helpCommandDescription=e._helpCommandDescription;this._helpConfiguration=e._helpConfiguration;this._exitCallback=e._exitCallback;this._storeOptionsAsProperties=e._storeOptionsAsProperties;this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue;this._allowExcessArguments=e._allowExcessArguments;this._enablePositionalOptions=e._enablePositionalOptions;this._showHelpAfterError=e._showHelpAfterError;this._showSuggestionAfterError=e._showSuggestionAfterError;return this}command(e,t,r){let i=t;let n=r;if(typeof i==="object"&&i!==null){n=i;i=null}n=n||{};const[,s,o]=e.match(/([^ ]+) *(.*)/);const a=this.createCommand(s);if(i){a.description(i);a._executableHandler=true}if(n.isDefault)this._defaultCommandName=a._name;a._hidden=!!(n.noHelp||n.hidden);a._executableFile=n.executableFile||null;if(o)a.arguments(o);this.commands.push(a);a.parent=this;a.copyInheritedSettings(this);if(i)return this;return a}createCommand(e){return new Command(e)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(e){if(e===undefined)return this._helpConfiguration;this._helpConfiguration=e;return this}configureOutput(e){if(e===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,e);return this}showHelpAfterError(e=true){if(typeof e!=="string")e=!!e;this._showHelpAfterError=e;return this}showSuggestionAfterError(e=true){this._showSuggestionAfterError=!!e;return this}addCommand(e,t){if(!e._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}t=t||{};if(t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=true;this.commands.push(e);e.parent=this;return this}createArgument(e,t){return new l(e,t)}argument(e,t,r,i){const n=this.createArgument(e,t);if(typeof r==="function"){n.default(i).argParser(r)}else{n.default(r)}this.addArgument(n);return this}arguments(e){e.trim().split(/ +/).forEach((e=>{this.argument(e)}));return this}addArgument(e){const t=this._args.slice(-1)[0];if(t&&t.variadic){throw new Error(`only the last argument can be variadic '${t.name()}'`)}if(e.required&&e.defaultValue!==undefined&&e.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${e.name()}'`)}this._args.push(e);return this}addHelpCommand(e,t){if(e===false){this._addImplicitHelpCommand=false}else{this._addImplicitHelpCommand=true;if(typeof e==="string"){this._helpCommandName=e.split(" ")[0];this._helpCommandnameAndArgs=e}this._helpCommandDescription=t||this._helpCommandDescription}return this}_hasImplicitHelpCommand(){if(this._addImplicitHelpCommand===undefined){return this.commands.length&&!this._actionHandler&&!this._findCommand("help")}return this._addImplicitHelpCommand}hook(e,t){const r=["preSubcommand","preAction","postAction"];if(!r.includes(e)){throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${r.join("', '")}'`)}if(this._lifeCycleHooks[e]){this._lifeCycleHooks[e].push(t)}else{this._lifeCycleHooks[e]=[t]}return this}exitOverride(e){if(e){this._exitCallback=e}else{this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync"){throw e}else{}}}return this}_exit(e,t,r){if(this._exitCallback){this._exitCallback(new c(e,t,r))}a.exit(e)}action(e){const listener=t=>{const r=this._args.length;const i=t.slice(0,r);if(this._storeOptionsAsProperties){i[r]=this}else{i[r]=this.opts()}i.push(this);return e.apply(this,i)};this._actionHandler=listener;return this}createOption(e,t){return new d(e,t)}addOption(e){const t=e.name();const r=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");if(!this._findOption(t)){this.setOptionValueWithSource(r,e.defaultValue===undefined?true:e.defaultValue,"default")}}else if(e.defaultValue!==undefined){this.setOptionValueWithSource(r,e.defaultValue,"default")}this.options.push(e);const handleOptionValue=(t,i,n)=>{if(t==null&&e.presetArg!==undefined){t=e.presetArg}const s=this.getOptionValue(r);if(t!==null&&e.parseArg){try{t=e.parseArg(t,s)}catch(e){if(e.code==="commander.invalidArgument"){const t=`${i} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}else if(t!==null&&e.variadic){t=e._concatValue(t,s)}if(t==null){if(e.negate){t=false}else if(e.isBoolean()||e.optional){t=true}else{t=""}}this.setOptionValueWithSource(r,t,n)};this.on("option:"+t,(t=>{const r=`error: option '${e.flags}' argument '${t}' is invalid.`;handleOptionValue(t,r,"cli")}));if(e.envVar){this.on("optionEnv:"+t,(t=>{const r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;handleOptionValue(t,r,"env")}))}return this}_optionEx(e,t,r,i,n){if(typeof t==="object"&&t instanceof d){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const s=this.createOption(t,r);s.makeOptionMandatory(!!e.mandatory);if(typeof i==="function"){s.default(n).argParser(i)}else if(i instanceof RegExp){const e=i;i=(t,r)=>{const i=e.exec(t);return i?i[0]:r};s.default(n).argParser(i)}else{s.default(i)}return this.addOption(s)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:true},e,t,r,i)}combineFlagAndOptionalValue(e=true){this._combineFlagAndOptionalValue=!!e;return this}allowUnknownOption(e=true){this._allowUnknownOption=!!e;return this}allowExcessArguments(e=true){this._allowExcessArguments=!!e;return this}enablePositionalOptions(e=true){this._enablePositionalOptions=!!e;return this}passThroughOptions(e=true){this._passThroughOptions=!!e;if(!!this.parent&&e&&!this.parent._enablePositionalOptions){throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)")}return this}storeOptionsAsProperties(e=true){this._storeOptionsAsProperties=!!e;if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}return this}getOptionValue(e){if(this._storeOptionsAsProperties){return this[e]}return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,undefined)}setOptionValueWithSource(e,t,r){if(this._storeOptionsAsProperties){this[e]=t}else{this._optionValues[e]=t}this._optionValueSources[e]=r;return this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;getCommandAndParents(this).forEach((r=>{if(r.getOptionValueSource(e)!==undefined){t=r.getOptionValueSource(e)}}));return t}_prepareUserArgs(e,t){if(e!==undefined&&!Array.isArray(e)){throw new Error("first parameter to parse must be array or undefined")}t=t||{};if(e===undefined){e=a.argv;if(a.versions&&a.versions.electron){t.from="electron"}}this.rawArgs=e.slice();let r;switch(t.from){case undefined:case"node":this._scriptPath=e[1];r=e.slice(2);break;case"electron":if(a.defaultApp){this._scriptPath=e[1];r=e.slice(2)}else{r=e.slice(1)}break;case"user":r=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return r}parse(e,t){const r=this._prepareUserArgs(e,t);this._parseCommand([],r);return this}async parseAsync(e,t){const r=this._prepareUserArgs(e,t);await this._parseCommand([],r);return this}_executeSubCommand(e,t){t=t.slice();let r=false;const i=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(e,t){const r=s.resolve(e,t);if(o.existsSync(r))return r;if(i.includes(s.extname(t)))return undefined;const n=i.find((e=>o.existsSync(`${r}${e}`)));if(n)return`${r}${n}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let l=e._executableFile||`${this._name}-${e._name}`;let u=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}u=s.resolve(s.dirname(e),u)}if(u){let t=findFile(u,l);if(!t&&!e._executableFile&&this._scriptPath){const r=s.basename(this._scriptPath,s.extname(this._scriptPath));if(r!==this._name){t=findFile(u,`${r}-${e._name}`)}}l=t||l}r=i.includes(s.extname(l));let h;if(a.platform!=="win32"){if(r){t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.argv[0],t,{stdio:"inherit"})}else{h=n.spawn(l,t,{stdio:"inherit"})}}else{t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.execPath,t,{stdio:"inherit"})}if(!h.killed){const e=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];e.forEach((e=>{a.on(e,(()=>{if(h.killed===false&&h.exitCode===null){h.kill(e)}}))}))}const d=this._exitCallback;if(!d){h.on("close",a.exit.bind(a))}else{h.on("close",(()=>{d(new c(a.exitCode||0,"commander.executeSubCommandAsync","(close)"))}))}h.on("error",(t=>{if(t.code==="ENOENT"){const t=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const r=`'${l}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(r)}else if(t.code==="EACCES"){throw new Error(`'${l}' not executable`)}if(!d){a.exit(1)}else{const e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t;d(e)}}));this.runningCommand=h}_dispatchSubcommand(e,t,r){const i=this._findCommand(e);if(!i)this.help({error:true});let n;n=this._chainOrCallSubCommandHook(n,i,"preSubcommand");n=this._chainOrCall(n,(()=>{if(i._executableHandler){this._executeSubCommand(i,t.concat(r))}else{return i._parseCommand(t,r)}}));return n}_dispatchHelpCommand(e){if(!e){this.help()}const t=this._findCommand(e);if(t&&!t._executableHandler){t.help()}return this._dispatchSubcommand(e,[],[this._helpLongFlag])}_checkNumberOfArguments(){this._args.forEach(((e,t)=>{if(e.required&&this.args[t]==null){this.missingArgument(e.name())}}));if(this._args.length>0&&this._args[this._args.length-1].variadic){return}if(this.args.length>this._args.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(e,t,r)=>{let i=t;if(t!==null&&e.parseArg){try{i=e.parseArg(t,r)}catch(r){if(r.code==="commander.invalidArgument"){const i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'. ${r.message}`;this.error(i,{exitCode:r.exitCode,code:r.code})}throw r}}return i};this._checkNumberOfArguments();const e=[];this._args.forEach(((t,r)=>{let i=t.defaultValue;if(t.variadic){if(r<this.args.length){i=this.args.slice(r);if(t.parseArg){i=i.reduce(((e,r)=>myParseArg(t,r,e)),t.defaultValue)}}else if(i===undefined){i=[]}}else if(r<this.args.length){i=this.args[r];if(t.parseArg){i=myParseArg(t,i,t.defaultValue)}}e[r]=i}));this.processedArgs=e}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function"){return e.then((()=>t()))}return t()}_chainOrCallHooks(e,t){let r=e;const i=[];getCommandAndParents(this).reverse().filter((e=>e._lifeCycleHooks[t]!==undefined)).forEach((e=>{e._lifeCycleHooks[t].forEach((t=>{i.push({hookedCommand:e,callback:t})}))}));if(t==="postAction"){i.reverse()}i.forEach((e=>{r=this._chainOrCall(r,(()=>e.callback(e.hookedCommand,this)))}));return r}_chainOrCallSubCommandHook(e,t,r){let i=e;if(this._lifeCycleHooks[r]!==undefined){this._lifeCycleHooks[r].forEach((e=>{i=this._chainOrCall(i,(()=>e(this,t)))}))}return i}_parseCommand(e,t){const r=this.parseOptions(t);this._parseOptionsEnv();this._parseOptionsImplied();e=e.concat(r.operands);t=r.unknown;this.args=e.concat(t);if(e&&this._findCommand(e[0])){return this._dispatchSubcommand(e[0],e.slice(1),t)}if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName){return this._dispatchHelpCommand(e[1])}if(this._defaultCommandName){outputHelpIfRequested(this,t);return this._dispatchSubcommand(this._defaultCommandName,e,t)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}outputHelpIfRequested(this,r.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(r.unknown.length>0){this.unknownOption(r.unknown[0])}};const i=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let r;r=this._chainOrCallHooks(r,"preAction");r=this._chainOrCall(r,(()=>this._actionHandler(this.processedArgs)));if(this.parent){r=this._chainOrCall(r,(()=>{this.parent.emit(i,e,t)}))}r=this._chainOrCallHooks(r,"postAction");return r}if(this.parent&&this.parent.listenerCount(i)){checkForUnknownOptions();this._processArguments();this.parent.emit(i,e,t)}else if(e.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",e,t)}if(this.listenerCount("command:*")){this.emit("command:*",e,t)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(e){if(!e)return undefined;return this.commands.find((t=>t._name===e||t._aliases.includes(e)))}_findOption(e){return this.options.find((t=>t.is(e)))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent){e.options.forEach((t=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===undefined){e.missingMandatoryOptionValue(t)}}))}}_checkForConflictingLocalOptions(){const e=this.options.filter((e=>{const t=e.attributeName();if(this.getOptionValue(t)===undefined){return false}return this.getOptionValueSource(t)!=="default"}));const t=e.filter((e=>e.conflictsWith.length>0));t.forEach((t=>{const r=e.find((e=>t.conflictsWith.includes(e.attributeName())));if(r){this._conflictingOption(t,r)}}))}_checkForConflictingOptions(){for(let e=this;e;e=e.parent){e._checkForConflictingLocalOptions()}}parseOptions(e){const t=[];const r=[];let i=t;const n=e.slice();function maybeOption(e){return e.length>1&&e[0]==="-"}let s=null;while(n.length){const e=n.shift();if(e==="--"){if(i===r)i.push(e);i.push(...n);break}if(s&&!maybeOption(e)){this.emit(`option:${s.name()}`,e);continue}s=null;if(maybeOption(e)){const t=this._findOption(e);if(t){if(t.required){const e=n.shift();if(e===undefined)this.optionMissingArgument(t);this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;if(n.length>0&&!maybeOption(n[0])){e=n.shift()}this.emit(`option:${t.name()}`,e)}else{this.emit(`option:${t.name()}`)}s=t.variadic?t:null;continue}}if(e.length>2&&e[0]==="-"&&e[1]!=="-"){const t=this._findOption(`-${e[1]}`);if(t){if(t.required||t.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${t.name()}`,e.slice(2))}else{this.emit(`option:${t.name()}`);n.unshift(`-${e.slice(2)}`)}continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("=");const r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(maybeOption(e)){i=r}if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(e)){t.push(e);if(n.length>0)r.push(...n);break}else if(e===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(e);if(n.length>0)t.push(...n);break}else if(this._defaultCommandName){r.push(e);if(n.length>0)r.push(...n);break}}if(this._passThroughOptions){i.push(e);if(n.length>0)i.push(...n);break}i.push(e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){const e={};const t=this.options.length;for(let r=0;r<t;r++){const t=this.options[r].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return getCommandAndParents(this).reduce(((e,t)=>Object.assign(e,t.opts())),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const r=t||{};const i=r.exitCode||1;const n=r.code||"commander.error";this._exit(i,n,e)}_parseOptionsEnv(){this.options.forEach((e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();if(this.getOptionValue(t)===undefined||["default","config","env"].includes(this.getOptionValueSource(t))){if(e.required||e.optional){this.emit(`optionEnv:${e.name()}`,a.env[e.envVar])}else{this.emit(`optionEnv:${e.name()}`)}}}}))}_parseOptionsImplied(){const e=new m(this.options);const hasCustomOptionValue=e=>this.getOptionValue(e)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter((t=>t.implied!==undefined&&hasCustomOptionValue(t.attributeName())&&e.valueFromOption(this.getOptionValue(t.attributeName()),t))).forEach((e=>{Object.keys(e.implied).filter((e=>!hasCustomOptionValue(e))).forEach((t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")}))}))}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const findBestOptionFromValue=e=>{const t=e.attributeName();const r=this.getOptionValue(t);const i=this.options.find((e=>e.negate&&t===e.attributeName()));const n=this.options.find((e=>!e.negate&&t===e.attributeName()));if(i&&(i.presetArg===undefined&&r===false||i.presetArg!==undefined&&r===i.presetArg)){return i}return n||e};const getErrorMessage=e=>{const t=findBestOptionFromValue(e);const r=t.attributeName();const i=this.getOptionValueSource(r);if(i==="env"){return`environment variable '${t.envVar}'`}return`option '${t.flags}'`};const r=`error: ${getErrorMessage(e)} cannot be used with ${getErrorMessage(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[];let i=this;do{const e=i.createHelp().visibleOptions(i).filter((e=>e.long)).map((e=>e.long));r=r.concat(e);i=i.parent}while(i&&!i._enablePositionalOptions);t=g(e,r)}const r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this._args.length;const r=t===1?"":"s";const i=this.parent?` for '${this.name()}'`:"";const n=`error: too many arguments${i}. Expected ${t} argument${r} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const r=[];this.createHelp().visibleCommands(this).forEach((e=>{r.push(e.name());if(e.alias())r.push(e.alias())}));t=g(e,r)}const r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===undefined)return this._version;this._version=e;t=t||"-V, --version";r=r||"output the version number";const i=this.createOption(t,r);this._versionOptionName=i.attributeName();this.options.push(i);this.on("option:"+i.name(),(()=>{this._outputConfiguration.writeOut(`${e}\n`);this._exit(0,"commander.version",e)}));return this}description(e,t){if(e===undefined&&t===undefined)return this._description;this._description=e;if(t){this._argsDescription=t}return this}summary(e){if(e===undefined)return this._summary;this._summary=e;return this}alias(e){if(e===undefined)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){t=this.commands[this.commands.length-1]}if(e===t._name)throw new Error("Command alias can't be the same as its name");t._aliases.push(e);return this}aliases(e){if(e===undefined)return this._aliases;e.forEach((e=>this.alias(e)));return this}usage(e){if(e===undefined){if(this._usage)return this._usage;const e=this._args.map((e=>u(e)));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}this._usage=e;return this}name(e){if(e===undefined)return this._name;this._name=e;return this}nameFromFilename(e){this._name=s.basename(e,s.extname(e));return this}executableDir(e){if(e===undefined)return this._executableDir;this._executableDir=e;return this}helpInformation(e){const t=this.createHelp();if(t.helpWidth===undefined){t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};const t={error:!!e.error};let r;if(t.error){r=e=>this._outputConfiguration.writeErr(e)}else{r=e=>this._outputConfiguration.writeOut(e)}t.write=e.write||r;t.command=this;return t}outputHelp(e){let t;if(typeof e==="function"){t=e;e=undefined}const r=this._getHelpContext(e);getCommandAndParents(this).reverse().forEach((e=>e.emit("beforeAllHelp",r)));this.emit("beforeHelp",r);let i=this.helpInformation(r);if(t){i=t(i);if(typeof i!=="string"&&!Buffer.isBuffer(i)){throw new Error("outputHelp callback must return a string or a Buffer")}}r.write(i);this.emit(this._helpLongFlag);this.emit("afterHelp",r);getCommandAndParents(this).forEach((e=>e.emit("afterAllHelp",r)))}helpOption(e,t){if(typeof e==="boolean"){this._hasHelpOption=e;return this}this._helpFlags=e||this._helpFlags;this._helpDescription=t||this._helpDescription;const r=p(this._helpFlags);this._helpShortFlag=r.shortFlag;this._helpLongFlag=r.longFlag;return this}help(e){this.outputHelp(e);let t=a.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error){t=1}this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const r=["beforeAll","before","after","afterAll"];if(!r.includes(e)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${r.join("', '")}'`)}const i=`${e}Help`;this.on(i,(e=>{let r;if(typeof t==="function"){r=t({error:e.error,command:e.command})}else{r=t}if(r){e.write(`${r}\n`)}}));return this}}function outputHelpIfRequested(e,t){const r=e._hasHelpOption&&t.find((t=>t===e._helpLongFlag||t===e._helpShortFlag));if(r){e.outputHelp();e._exit(0,"commander.helpDisplayed","(outputHelp)")}}function incrementNodeInspectorPort(e){return e.map((e=>{if(!e.startsWith("--inspect")){return e}let t;let r="127.0.0.1";let i="9229";let n;if((n=e.match(/^(--inspect(-brk)?)$/))!==null){t=n[1]}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){t=n[1];if(/^\d+$/.test(n[3])){i=n[3]}else{r=n[3]}}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){t=n[1];r=n[3];i=n[4]}if(t&&i!=="0"){return`${t}=${r}:${parseInt(i)+1}`}return e}))}function getCommandAndParents(e){const t=[];for(let r=e;r;r=r.parent){t.push(r)}return t}t.Command=Command},2625:(e,t)=>{class CommanderError extends Error{constructor(e,t,r){super(r);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=t;this.exitCode=e;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}t.CommanderError=CommanderError;t.InvalidArgumentError=InvalidArgumentError},5153:(e,t,r)=>{const{humanReadableArgName:i}=r(9414);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(e){const t=e.commands.filter((e=>!e._hidden));if(e._hasImplicitHelpCommand()){const[,r,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);const n=e.createCommand(r).helpOption(false);n.description(e._helpCommandDescription);if(i)n.arguments(i);t.push(n)}if(this.sortSubcommands){t.sort(((e,t)=>e.name().localeCompare(t.name())))}return t}compareOptions(e,t){const getSortKey=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return getSortKey(e).localeCompare(getSortKey(t))}visibleOptions(e){const t=e.options.filter((e=>!e.hidden));const r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag);const i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||i){let n;if(!r){n=e.createOption(e._helpLongFlag,e._helpDescription)}else if(!i){n=e.createOption(e._helpShortFlag,e._helpDescription)}else{n=e.createOption(e._helpFlags,e._helpDescription)}t.push(n)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let r=e.parent;r;r=r.parent){const e=r.options.filter((e=>!e.hidden));t.push(...e)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleArguments(e){if(e._argsDescription){e._args.forEach((t=>{t.description=t.description||e._argsDescription[t.name()]||""}))}if(e._args.find((e=>e.description))){return e._args}return[]}subcommandTerm(e){const t=e._args.map((e=>i(e))).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce(((e,r)=>Math.max(e,t.subcommandTerm(r).length)),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce(((e,r)=>Math.max(e,t.argumentTerm(r).length)),0)}commandUsage(e){let t=e._name;if(e._aliases[0]){t=t+"|"+e._aliases[0]}let r="";for(let t=e.parent;t;t=t.parent){r=t.name()+" "+r}return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){const r=e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean";if(r){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}}if(e.presetArg!==undefined&&e.optional){t.push(`preset: ${JSON.stringify(e.presetArg)}`)}if(e.envVar!==undefined){t.push(`env: ${e.envVar}`)}if(t.length>0){return`${e.description} (${t.join(", ")})`}return e.description}argumentDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(t.length>0){const r=`(${t.join(", ")})`;if(e.description){return`${e.description} ${r}`}return r}return e.description}formatHelp(e,t){const r=t.padWidth(e,t);const i=t.helpWidth||80;const n=2;const s=2;function formatItem(e,o){if(o){const a=`${e.padEnd(r+s)}${o}`;return t.wrap(a,i-n,r+s)}return e}function formatList(e){return e.join("\n").replace(/^/gm," ".repeat(n))}let o=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);if(a.length>0){o=o.concat([t.wrap(a,i,0),""])}const l=t.visibleArguments(e).map((e=>formatItem(t.argumentTerm(e),t.argumentDescription(e))));if(l.length>0){o=o.concat(["Arguments:",formatList(l),""])}const u=t.visibleOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(u.length>0){o=o.concat(["Options:",formatList(u),""])}if(this.showGlobalOptions){const r=t.visibleGlobalOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(r.length>0){o=o.concat(["Global Options:",formatList(r),""])}}const c=t.visibleCommands(e).map((e=>formatItem(t.subcommandTerm(e),t.subcommandDescription(e))));if(c.length>0){o=o.concat(["Commands:",formatList(c),""])}return o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,i=40){const n=" \\f\\t\\v   -    \ufeff";const s=new RegExp(`[\\n][${n}]+`);if(e.match(s))return e;const o=t-r;if(o<i)return e;const a=e.slice(0,r);const l=e.slice(r).replace("\r\n","\n");const u=" ".repeat(r);const c="​";const h=`\\s${c}`;const d=new RegExp(`\n|.{1,${o-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g");const p=l.match(d)||[];return a+p.map(((e,t)=>{if(e==="\n")return"";return(t>0?u:"")+e.trimEnd()})).join("\n")}}t.Help=Help},6558:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Option{constructor(e,t){this.flags=e;this.description=t||"";this.required=e.includes("<");this.optional=e.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(e);this.mandatory=false;const r=splitOptionFlags(e);this.short=r.shortFlag;this.long=r.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}preset(e){this.presetArg=e;return this}conflicts(e){this.conflictsWith=this.conflictsWith.concat(e);return this}implies(e){let t=e;if(typeof e==="string"){t={[e]:true}}this.implied=Object.assign(this.implied||{},t);return this}env(e){this.envVar=e;return this}argParser(e){this.parseArg=e;return this}makeOptionMandatory(e=true){this.mandatory=!!e;return this}hideHelp(e=true){this.hidden=!!e;return this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(e){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;e.forEach((e=>{if(e.negate){this.negativeOptions.set(e.attributeName(),e)}else{this.positiveOptions.set(e.attributeName(),e)}}));this.negativeOptions.forEach(((e,t)=>{if(this.positiveOptions.has(t)){this.dualOptions.add(t)}}))}valueFromOption(e,t){const r=t.attributeName();if(!this.dualOptions.has(r))return true;const i=this.negativeOptions.get(r).presetArg;const n=i!==undefined?i:false;return t.negate===(n===e)}}function camelcase(e){return e.split("-").reduce(((e,t)=>e+t[0].toUpperCase()+t.slice(1)))}function splitOptionFlags(e){let t;let r;const i=e.split(/[ |,]+/);if(i.length>1&&!/^[[<]/.test(i[1]))t=i.shift();r=i.shift();if(!t&&/^-[^-]$/.test(r)){t=r;r=undefined}return{shortFlag:t,longFlag:r}}t.Option=Option;t.splitOptionFlags=splitOptionFlags;t.DualOptions=DualOptions},7592:(e,t)=>{const r=3;function editDistance(e,t){if(Math.abs(e.length-t.length)>r)return Math.max(e.length,t.length);const i=[];for(let t=0;t<=e.length;t++){i[t]=[t]}for(let e=0;e<=t.length;e++){i[0][e]=e}for(let r=1;r<=t.length;r++){for(let n=1;n<=e.length;n++){let s=1;if(e[n-1]===t[r-1]){s=0}else{s=1}i[n][r]=Math.min(i[n-1][r]+1,i[n][r-1]+1,i[n-1][r-1]+s);if(n>1&&r>1&&e[n-1]===t[r-2]&&e[n-2]===t[r-1]){i[n][r]=Math.min(i[n][r],i[n-2][r-2]+1)}}}return i[e.length][t.length]}function suggestSimilar(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));const i=e.startsWith("--");if(i){e=e.slice(2);t=t.map((e=>e.slice(2)))}let n=[];let s=r;const o=.4;t.forEach((t=>{if(t.length<=1)return;const r=editDistance(e,t);const i=Math.max(e.length,t.length);const a=(i-r)/i;if(a>o){if(r<s){s=r;n=[t]}else if(r===s){n.push(t)}}}));n.sort(((e,t)=>e.localeCompare(t)));if(i){n=n.map((e=>`--${e}`))}if(n.length>1){return`\n(Did you mean one of ${n.join(", ")}?)`}if(n.length===1){return`\n(Did you mean ${n[0]}?)`}return""}t.suggestSimilar=suggestSimilar},1391:(e,t,r)=>{"use strict";r.r(t);r.d(t,{AbortError:()=>AbortError,CacheError:()=>CacheError,CancelError:()=>types_CancelError,HTTPError:()=>HTTPError,MaxRedirectsError:()=>MaxRedirectsError,Options:()=>Options,ParseError:()=>ParseError,ReadError:()=>ReadError,RequestError:()=>RequestError,RetryError:()=>RetryError,TimeoutError:()=>TimeoutError,UploadError:()=>UploadError,calculateRetryDelay:()=>te,create:()=>Re,default:()=>Le,got:()=>Pe,isResponseOk:()=>isResponseOk,parseBody:()=>parseBody,parseLinkHeader:()=>parseLinkHeader});const i=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function isTypedArrayName(e){return i.includes(e)}const n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...i];function isObjectTypeName(e){return n.includes(e)}const s=["null","undefined","string","number","bigint","boolean","symbol"];function isPrimitiveTypeName(e){return s.includes(e)}function isOfType(e){return t=>typeof t===e}const{toString:o}=Object.prototype;const getObjectType=e=>{const t=o.call(e).slice(8,-1);if(/HTML\w+Element/.test(t)&&is.domElement(e)){return"HTMLElement"}if(isObjectTypeName(t)){return t}return undefined};const isObjectOfType=e=>t=>getObjectType(t)===e;function is(e){if(e===null){return"null"}switch(typeof e){case"undefined":{return"undefined"}case"string":{return"string"}case"number":{return Number.isNaN(e)?"NaN":"number"}case"boolean":{return"boolean"}case"function":{return"Function"}case"bigint":{return"bigint"}case"symbol":{return"symbol"}default:}if(is.observable(e)){return"Observable"}if(is.array(e)){return"Array"}if(is.buffer(e)){return"Buffer"}const t=getObjectType(e);if(t){return t}if(e instanceof String||e instanceof Boolean||e instanceof Number){throw new TypeError("Please don't use object wrappers for primitive types")}return"Object"}is.undefined=isOfType("undefined");is.string=isOfType("string");const a=isOfType("number");is.number=e=>a(e)&&!is.nan(e);is.positiveNumber=e=>is.number(e)&&e>0;is.negativeNumber=e=>is.number(e)&&e<0;is.bigint=isOfType("bigint");is.function_=isOfType("function");is.null_=e=>e===null;is.class_=e=>is.function_(e)&&e.toString().startsWith("class ");is.boolean=e=>e===true||e===false;is.symbol=isOfType("symbol");is.numericString=e=>is.string(e)&&!is.emptyStringOrWhitespace(e)&&!Number.isNaN(Number(e));is.array=(e,t)=>{if(!Array.isArray(e)){return false}if(!is.function_(t)){return true}return e.every((e=>t(e)))};is.buffer=e=>e?.constructor?.isBuffer?.(e)??false;is.blob=e=>isObjectOfType("Blob")(e);is.nullOrUndefined=e=>is.null_(e)||is.undefined(e);is.object=e=>!is.null_(e)&&(typeof e==="object"||is.function_(e));is.iterable=e=>is.function_(e?.[Symbol.iterator]);is.asyncIterable=e=>is.function_(e?.[Symbol.asyncIterator]);is.generator=e=>is.iterable(e)&&is.function_(e?.next)&&is.function_(e?.throw);is.asyncGenerator=e=>is.asyncIterable(e)&&is.function_(e.next)&&is.function_(e.throw);is.nativePromise=e=>isObjectOfType("Promise")(e);const hasPromiseApi=e=>is.function_(e?.then)&&is.function_(e?.catch);is.promise=e=>is.nativePromise(e)||hasPromiseApi(e);is.generatorFunction=isObjectOfType("GeneratorFunction");is.asyncGeneratorFunction=e=>getObjectType(e)==="AsyncGeneratorFunction";is.asyncFunction=e=>getObjectType(e)==="AsyncFunction";is.boundFunction=e=>is.function_(e)&&!e.hasOwnProperty("prototype");is.regExp=isObjectOfType("RegExp");is.date=isObjectOfType("Date");is.error=isObjectOfType("Error");is.map=e=>isObjectOfType("Map")(e);is.set=e=>isObjectOfType("Set")(e);is.weakMap=e=>isObjectOfType("WeakMap")(e);is.weakSet=e=>isObjectOfType("WeakSet")(e);is.weakRef=e=>isObjectOfType("WeakRef")(e);is.int8Array=isObjectOfType("Int8Array");is.uint8Array=isObjectOfType("Uint8Array");is.uint8ClampedArray=isObjectOfType("Uint8ClampedArray");is.int16Array=isObjectOfType("Int16Array");is.uint16Array=isObjectOfType("Uint16Array");is.int32Array=isObjectOfType("Int32Array");is.uint32Array=isObjectOfType("Uint32Array");is.float32Array=isObjectOfType("Float32Array");is.float64Array=isObjectOfType("Float64Array");is.bigInt64Array=isObjectOfType("BigInt64Array");is.bigUint64Array=isObjectOfType("BigUint64Array");is.arrayBuffer=isObjectOfType("ArrayBuffer");is.sharedArrayBuffer=isObjectOfType("SharedArrayBuffer");is.dataView=isObjectOfType("DataView");is.enumCase=(e,t)=>Object.values(t).includes(e);is.directInstanceOf=(e,t)=>Object.getPrototypeOf(e)===t.prototype;is.urlInstance=e=>isObjectOfType("URL")(e);is.urlString=e=>{if(!is.string(e)){return false}try{new URL(e);return true}catch{return false}};is.truthy=e=>Boolean(e);is.falsy=e=>!e;is.nan=e=>Number.isNaN(e);is.primitive=e=>is.null_(e)||isPrimitiveTypeName(typeof e);is.integer=e=>Number.isInteger(e);is.safeInteger=e=>Number.isSafeInteger(e);is.plainObject=e=>{if(typeof e!=="object"||e===null){return false}const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)};is.typedArray=e=>isTypedArrayName(getObjectType(e));const isValidLength=e=>is.safeInteger(e)&&e>=0;is.arrayLike=e=>!is.nullOrUndefined(e)&&!is.function_(e)&&isValidLength(e.length);is.tupleLike=(e,t)=>{if(is.array(t)&&is.array(e)&&t.length===e.length){return t.every(((t,r)=>t(e[r])))}return false};is.inRange=(e,t)=>{if(is.number(t)){return e>=Math.min(0,t)&&e<=Math.max(t,0)}if(is.array(t)&&t.length===2){return e>=Math.min(...t)&&e<=Math.max(...t)}throw new TypeError(`Invalid range: ${JSON.stringify(t)}`)};const l=1;const u=["innerHTML","ownerDocument","style","attributes","nodeValue"];is.domElement=e=>is.object(e)&&e.nodeType===l&&is.string(e.nodeName)&&!is.plainObject(e)&&u.every((t=>t in e));is.observable=e=>{if(!e){return false}if(e===e[Symbol.observable]?.()){return true}if(e===e["@@observable"]?.()){return true}return false};is.nodeStream=e=>is.object(e)&&is.function_(e.pipe)&&!is.observable(e);is.infinite=e=>e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY;const isAbsoluteMod2=e=>t=>is.integer(t)&&Math.abs(t%2)===e;is.evenInteger=isAbsoluteMod2(0);is.oddInteger=isAbsoluteMod2(1);is.emptyArray=e=>is.array(e)&&e.length===0;is.nonEmptyArray=e=>is.array(e)&&e.length>0;is.emptyString=e=>is.string(e)&&e.length===0;const isWhiteSpaceString=e=>is.string(e)&&!/\S/.test(e);is.emptyStringOrWhitespace=e=>is.emptyString(e)||isWhiteSpaceString(e);is.nonEmptyString=e=>is.string(e)&&e.length>0;is.nonEmptyStringAndNotWhitespace=e=>is.string(e)&&!is.emptyStringOrWhitespace(e);is.emptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length===0;is.nonEmptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length>0;is.emptySet=e=>is.set(e)&&e.size===0;is.nonEmptySet=e=>is.set(e)&&e.size>0;is.emptyMap=e=>is.map(e)&&e.size===0;is.nonEmptyMap=e=>is.map(e)&&e.size>0;is.propertyKey=e=>is.any([is.string,is.number,is.symbol],e);is.formData=e=>isObjectOfType("FormData")(e);is.urlSearchParams=e=>isObjectOfType("URLSearchParams")(e);const predicateOnArray=(e,t,r)=>{if(!is.function_(t)){throw new TypeError(`Invalid predicate: ${JSON.stringify(t)}`)}if(r.length===0){throw new TypeError("Invalid number of values")}return e.call(r,t)};is.any=(e,...t)=>{const r=is.array(e)?e:[e];return r.some((e=>predicateOnArray(Array.prototype.some,e,t)))};is.all=(e,...t)=>predicateOnArray(Array.prototype.every,e,t);const assertType=(e,t,r,i={})=>{if(!e){const{multipleValues:e}=i;const n=e?`received values of types ${[...new Set(r.map((e=>`\`${is(e)}\``)))].join(", ")}`:`received value of type \`${is(r)}\``;throw new TypeError(`Expected value which is \`${t}\`, ${n}.`)}};const c={undefined:e=>assertType(is.undefined(e),"undefined",e),string:e=>assertType(is.string(e),"string",e),number:e=>assertType(is.number(e),"number",e),positiveNumber:e=>assertType(is.positiveNumber(e),"positive number",e),negativeNumber:e=>assertType(is.negativeNumber(e),"negative number",e),bigint:e=>assertType(is.bigint(e),"bigint",e),function_:e=>assertType(is.function_(e),"Function",e),null_:e=>assertType(is.null_(e),"null",e),class_:e=>assertType(is.class_(e),"Class",e),boolean:e=>assertType(is.boolean(e),"boolean",e),symbol:e=>assertType(is.symbol(e),"symbol",e),numericString:e=>assertType(is.numericString(e),"string with a number",e),array:(e,t)=>{const r=assertType;r(is.array(e),"Array",e);if(t){e.forEach(t)}},buffer:e=>assertType(is.buffer(e),"Buffer",e),blob:e=>assertType(is.blob(e),"Blob",e),nullOrUndefined:e=>assertType(is.nullOrUndefined(e),"null or undefined",e),object:e=>assertType(is.object(e),"Object",e),iterable:e=>assertType(is.iterable(e),"Iterable",e),asyncIterable:e=>assertType(is.asyncIterable(e),"AsyncIterable",e),generator:e=>assertType(is.generator(e),"Generator",e),asyncGenerator:e=>assertType(is.asyncGenerator(e),"AsyncGenerator",e),nativePromise:e=>assertType(is.nativePromise(e),"native Promise",e),promise:e=>assertType(is.promise(e),"Promise",e),generatorFunction:e=>assertType(is.generatorFunction(e),"GeneratorFunction",e),asyncGeneratorFunction:e=>assertType(is.asyncGeneratorFunction(e),"AsyncGeneratorFunction",e),asyncFunction:e=>assertType(is.asyncFunction(e),"AsyncFunction",e),boundFunction:e=>assertType(is.boundFunction(e),"Function",e),regExp:e=>assertType(is.regExp(e),"RegExp",e),date:e=>assertType(is.date(e),"Date",e),error:e=>assertType(is.error(e),"Error",e),map:e=>assertType(is.map(e),"Map",e),set:e=>assertType(is.set(e),"Set",e),weakMap:e=>assertType(is.weakMap(e),"WeakMap",e),weakSet:e=>assertType(is.weakSet(e),"WeakSet",e),weakRef:e=>assertType(is.weakRef(e),"WeakRef",e),int8Array:e=>assertType(is.int8Array(e),"Int8Array",e),uint8Array:e=>assertType(is.uint8Array(e),"Uint8Array",e),uint8ClampedArray:e=>assertType(is.uint8ClampedArray(e),"Uint8ClampedArray",e),int16Array:e=>assertType(is.int16Array(e),"Int16Array",e),uint16Array:e=>assertType(is.uint16Array(e),"Uint16Array",e),int32Array:e=>assertType(is.int32Array(e),"Int32Array",e),uint32Array:e=>assertType(is.uint32Array(e),"Uint32Array",e),float32Array:e=>assertType(is.float32Array(e),"Float32Array",e),float64Array:e=>assertType(is.float64Array(e),"Float64Array",e),bigInt64Array:e=>assertType(is.bigInt64Array(e),"BigInt64Array",e),bigUint64Array:e=>assertType(is.bigUint64Array(e),"BigUint64Array",e),arrayBuffer:e=>assertType(is.arrayBuffer(e),"ArrayBuffer",e),sharedArrayBuffer:e=>assertType(is.sharedArrayBuffer(e),"SharedArrayBuffer",e),dataView:e=>assertType(is.dataView(e),"DataView",e),enumCase:(e,t)=>assertType(is.enumCase(e,t),"EnumCase",e),urlInstance:e=>assertType(is.urlInstance(e),"URL",e),urlString:e=>assertType(is.urlString(e),"string with a URL",e),truthy:e=>assertType(is.truthy(e),"truthy",e),falsy:e=>assertType(is.falsy(e),"falsy",e),nan:e=>assertType(is.nan(e),"NaN",e),primitive:e=>assertType(is.primitive(e),"primitive",e),integer:e=>assertType(is.integer(e),"integer",e),safeInteger:e=>assertType(is.safeInteger(e),"integer",e),plainObject:e=>assertType(is.plainObject(e),"plain object",e),typedArray:e=>assertType(is.typedArray(e),"TypedArray",e),arrayLike:e=>assertType(is.arrayLike(e),"array-like",e),tupleLike:(e,t)=>assertType(is.tupleLike(e,t),"tuple-like",e),domElement:e=>assertType(is.domElement(e),"HTMLElement",e),observable:e=>assertType(is.observable(e),"Observable",e),nodeStream:e=>assertType(is.nodeStream(e),"Node.js Stream",e),infinite:e=>assertType(is.infinite(e),"infinite number",e),emptyArray:e=>assertType(is.emptyArray(e),"empty array",e),nonEmptyArray:e=>assertType(is.nonEmptyArray(e),"non-empty array",e),emptyString:e=>assertType(is.emptyString(e),"empty string",e),emptyStringOrWhitespace:e=>assertType(is.emptyStringOrWhitespace(e),"empty string or whitespace",e),nonEmptyString:e=>assertType(is.nonEmptyString(e),"non-empty string",e),nonEmptyStringAndNotWhitespace:e=>assertType(is.nonEmptyStringAndNotWhitespace(e),"non-empty string and not whitespace",e),emptyObject:e=>assertType(is.emptyObject(e),"empty object",e),nonEmptyObject:e=>assertType(is.nonEmptyObject(e),"non-empty object",e),emptySet:e=>assertType(is.emptySet(e),"empty set",e),nonEmptySet:e=>assertType(is.nonEmptySet(e),"non-empty set",e),emptyMap:e=>assertType(is.emptyMap(e),"empty map",e),nonEmptyMap:e=>assertType(is.nonEmptyMap(e),"non-empty map",e),propertyKey:e=>assertType(is.propertyKey(e),"PropertyKey",e),formData:e=>assertType(is.formData(e),"FormData",e),urlSearchParams:e=>assertType(is.urlSearchParams(e),"URLSearchParams",e),evenInteger:e=>assertType(is.evenInteger(e),"even integer",e),oddInteger:e=>assertType(is.oddInteger(e),"odd integer",e),directInstanceOf:(e,t)=>assertType(is.directInstanceOf(e,t),"T",e),inRange:(e,t)=>assertType(is.inRange(e,t),"in range",e),any:(e,...t)=>assertType(is.any(e,...t),"predicate returns truthy for any value",t,{multipleValues:true}),all:(e,...t)=>assertType(is.all(e,...t),"predicate returns truthy for all values",t,{multipleValues:true})};Object.defineProperties(is,{class:{value:is.class_},function:{value:is.function_},null:{value:is.null_}});Object.defineProperties(c,{class:{value:c.class_},function:{value:c.function_},null:{value:c.null_}});const h=is;const d=require("node:events");class CancelError extends Error{constructor(e){super(e||"Promise was canceled");this.name="CancelError"}get isCanceled(){return true}}class PCancelable{static fn(e){return(...t)=>new PCancelable(((r,i,n)=>{t.push(n);e(...t).then(r,i)}))}constructor(e){this._cancelHandlers=[];this._isPending=true;this._isCanceled=false;this._rejectOnCancel=true;this._promise=new Promise(((t,r)=>{this._reject=r;const onResolve=e=>{if(!this._isCanceled||!onCancel.shouldReject){this._isPending=false;t(e)}};const onReject=e=>{this._isPending=false;r(e)};const onCancel=e=>{if(!this._isPending){throw new Error("The `onCancel` handler was attached after the promise settled.")}this._cancelHandlers.push(e)};Object.defineProperties(onCancel,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}});e(onResolve,onReject,onCancel)}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!this._isPending||this._isCanceled){return}this._isCanceled=true;if(this._cancelHandlers.length>0){try{for(const e of this._cancelHandlers){e()}}catch(e){this._reject(e);return}}if(this._rejectOnCancel){this._reject(new CancelError(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(PCancelable.prototype,Promise.prototype);function isRequest(e){return h.object(e)&&"_onResponse"in e}class RequestError extends Error{constructor(e,t,r){super(e);Object.defineProperty(this,"input",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"stack",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Error.captureStackTrace(this,this.constructor);this.name="RequestError";this.code=t.code??"ERR_GOT_REQUEST_ERROR";this.input=t.input;if(isRequest(r)){Object.defineProperty(this,"request",{enumerable:false,value:r});Object.defineProperty(this,"response",{enumerable:false,value:r.response});this.options=r.options}else{this.options=r}this.timings=this.request?.timings;if(h.string(t.stack)&&h.string(this.stack)){const e=this.stack.indexOf(this.message)+this.message.length;const r=this.stack.slice(e).split("\n").reverse();const i=t.stack.slice(t.stack.indexOf(t.message)+t.message.length).split("\n").reverse();while(i.length>0&&i[0]===r[0]){r.shift()}this.stack=`${this.stack.slice(0,e)}${r.reverse().join("\n")}${i.reverse().join("\n")}`}}}class MaxRedirectsError extends RequestError{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e);this.name="MaxRedirectsError";this.code="ERR_TOO_MANY_REDIRECTS"}}class HTTPError extends RequestError{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request);this.name="HTTPError";this.code="ERR_NON_2XX_3XX_RESPONSE"}}class CacheError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="CacheError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_CACHE_ACCESS":this.code}}class UploadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="UploadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_UPLOAD":this.code}}class TimeoutError extends RequestError{constructor(e,t,r){super(e.message,e,r);Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.event=e.event;this.timings=t}}class ReadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="ReadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_READING_RESPONSE_STREAM":this.code}}class RetryError extends RequestError{constructor(e){super("Retrying",{},e);this.name="RetryError";this.code="ERR_RETRYING"}}class AbortError extends RequestError{constructor(e){super("This operation was aborted.",{},e);this.code="ERR_ABORTED";this.name="AbortError"}}const p=require("node:process");const m=require("node:buffer");const g=require("node:stream");const y=require("node:url");const _=require("node:http");var v=r(2361);var b=r(3837);var x=r(6214);const timer=e=>{if(e.timings){return e.timings}const t={start:Date.now(),socket:undefined,lookup:undefined,connect:undefined,secureConnect:undefined,upload:undefined,response:undefined,end:undefined,error:undefined,abort:undefined,phases:{wait:undefined,dns:undefined,tcp:undefined,tls:undefined,request:undefined,firstByte:undefined,download:undefined,total:undefined}};e.timings=t;const handleError=e=>{e.once(v.errorMonitor,(()=>{t.error=Date.now();t.phases.total=t.error-t.start}))};handleError(e);const onAbort=()=>{t.abort=Date.now();t.phases.total=t.abort-t.start};e.prependOnceListener("abort",onAbort);const onSocket=e=>{t.socket=Date.now();t.phases.wait=t.socket-t.start;if(b.types.isProxy(e)){return}const lookupListener=()=>{t.lookup=Date.now();t.phases.dns=t.lookup-t.socket};e.prependOnceListener("lookup",lookupListener);x(e,{connect:()=>{t.connect=Date.now();if(t.lookup===undefined){e.removeListener("lookup",lookupListener);t.lookup=t.connect;t.phases.dns=t.lookup-t.socket}t.phases.tcp=t.connect-t.lookup},secureConnect:()=>{t.secureConnect=Date.now();t.phases.tls=t.secureConnect-t.connect}})};if(e.socket){onSocket(e.socket)}else{e.prependOnceListener("socket",onSocket)}const onUpload=()=>{t.upload=Date.now();t.phases.request=t.upload-(t.secureConnect??t.connect)};if(e.writableFinished){onUpload()}else{e.prependOnceListener("finish",onUpload)}e.prependOnceListener("response",(r=>{t.response=Date.now();t.phases.firstByte=t.response-t.upload;r.timings=t;handleError(r);r.prependOnceListener("end",(()=>{e.off("abort",onAbort);r.off("aborted",onAbort);if(t.phases.total){return}t.end=Date.now();t.phases.download=t.end-t.response;t.phases.total=t.end-t.start}));r.prependOnceListener("aborted",onAbort)}));return t};const T=timer;const w=require("node:crypto");const S="text/plain";const E="us-ascii";const testParameter=(e,t)=>t.some((t=>t instanceof RegExp?t.test(e):t===e));const A=new Set(["https:","http:","file:"]);const hasCustomProtocol=e=>{try{const{protocol:t}=new URL(e);return t.endsWith(":")&&!A.has(t)}catch{return false}};const normalizeDataURL=(e,{stripHash:t})=>{const r=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(e);if(!r){throw new Error(`Invalid URL: ${e}`)}let{type:i,data:n,hash:s}=r.groups;const o=i.split(";");s=t?"":s;let a=false;if(o[o.length-1]==="base64"){o.pop();a=true}const l=o.shift()?.toLowerCase()??"";const u=o.map((e=>{let[t,r=""]=e.split("=").map((e=>e.trim()));if(t==="charset"){r=r.toLowerCase();if(r===E){return""}}return`${t}${r?`=${r}`:""}`})).filter(Boolean);const c=[...u];if(a){c.push("base64")}if(c.length>0||l&&l!==S){c.unshift(l)}return`data:${c.join(";")},${a?n.trim():n}${s?`#${s}`:""}`};function normalizeUrl(e,t){t={defaultProtocol:"http",normalizeProtocol:true,forceHttp:false,forceHttps:false,stripAuthentication:true,stripHash:false,stripTextFragment:true,stripWWW:true,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:true,removeSingleSlash:true,removeDirectoryIndex:false,removeExplicitPort:false,sortQueryParameters:true,...t};if(typeof t.defaultProtocol==="string"&&!t.defaultProtocol.endsWith(":")){t.defaultProtocol=`${t.defaultProtocol}:`}e=e.trim();if(/^data:/i.test(e)){return normalizeDataURL(e,t)}if(hasCustomProtocol(e)){return e}const r=e.startsWith("//");const i=!r&&/^\.*\//.test(e);if(!i){e=e.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol)}const n=new URL(e);if(t.forceHttp&&t.forceHttps){throw new Error("The `forceHttp` and `forceHttps` options cannot be used together")}if(t.forceHttp&&n.protocol==="https:"){n.protocol="http:"}if(t.forceHttps&&n.protocol==="http:"){n.protocol="https:"}if(t.stripAuthentication){n.username="";n.password=""}if(t.stripHash){n.hash=""}else if(t.stripTextFragment){n.hash=n.hash.replace(/#?:~:text.*?$/i,"")}if(n.pathname){const e=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let t=0;let r="";for(;;){const i=e.exec(n.pathname);if(!i){break}const s=i[0];const o=i.index;const a=n.pathname.slice(t,o);r+=a.replace(/\/{2,}/g,"/");r+=s;t=o+s.length}const i=n.pathname.slice(t,n.pathname.length);r+=i.replace(/\/{2,}/g,"/");n.pathname=r}if(n.pathname){try{n.pathname=decodeURI(n.pathname)}catch{}}if(t.removeDirectoryIndex===true){t.removeDirectoryIndex=[/^index\.[a-z]+$/]}if(Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let e=n.pathname.split("/");const r=e[e.length-1];if(testParameter(r,t.removeDirectoryIndex)){e=e.slice(0,-1);n.pathname=e.slice(1).join("/")+"/"}}if(n.hostname){n.hostname=n.hostname.replace(/\.$/,"");if(t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(n.hostname)){n.hostname=n.hostname.replace(/^www\./,"")}}if(Array.isArray(t.removeQueryParameters)){for(const e of[...n.searchParams.keys()]){if(testParameter(e,t.removeQueryParameters)){n.searchParams.delete(e)}}}if(!Array.isArray(t.keepQueryParameters)&&t.removeQueryParameters===true){n.search=""}if(Array.isArray(t.keepQueryParameters)&&t.keepQueryParameters.length>0){for(const e of[...n.searchParams.keys()]){if(!testParameter(e,t.keepQueryParameters)){n.searchParams.delete(e)}}}if(t.sortQueryParameters){n.searchParams.sort();try{n.search=decodeURIComponent(n.search)}catch{}}if(t.removeTrailingSlash){n.pathname=n.pathname.replace(/\/$/,"")}if(t.removeExplicitPort&&n.port){n.port=""}const s=e;e=n.toString();if(!t.removeSingleSlash&&n.pathname==="/"&&!s.endsWith("/")&&n.hash===""){e=e.replace(/\/$/,"")}if((t.removeTrailingSlash||n.pathname==="/")&&n.hash===""&&t.removeSingleSlash){e=e.replace(/\/$/,"")}if(r&&!t.normalizeProtocol){e=e.replace(/^http:\/\//,"//")}if(t.stripProtocol){e=e.replace(/^(?:https?:)?\/\//,"")}return e}var C=r(1766);var N=r(1002);function lowercaseKeys(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e.toLowerCase(),t])))}class Response extends g.Readable{statusCode;headers;body;url;constructor({statusCode:e,headers:t,body:r,url:i}){if(typeof e!=="number"){throw new TypeError("Argument `statusCode` should be a number")}if(typeof t!=="object"){throw new TypeError("Argument `headers` should be an object")}if(!(r instanceof Uint8Array)){throw new TypeError("Argument `body` should be a buffer")}if(typeof i!=="string"){throw new TypeError("Argument `url` should be a string")}super({read(){this.push(r);this.push(null)}});this.statusCode=e;this.headers=lowercaseKeys(t);this.body=r;this.url=i}}var O=r(1531);const R=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];function mimicResponse(e,t){if(t._readableState.autoDestroy){throw new Error("The second stream must have the `autoDestroy` option set to `false`")}const r=new Set([...Object.keys(e),...R]);const i={};for(const n of r){if(n in t){continue}i[n]={get(){const t=e[n];const r=typeof t==="function";return r?t.bind(e):t},set(t){e[n]=t},enumerable:true,configurable:false}}Object.defineProperties(t,i);e.once("aborted",(()=>{t.destroy();t.emit("aborted")}));e.once("close",(()=>{if(e.complete){if(t.readable){t.once("end",(()=>{t.emit("close")}))}else{t.emit("close")}}else{t.emit("close")}}));return t}class types_RequestError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class types_CacheError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class CacheableRequest{constructor(e,t){this.hooks=new Map;this.request=()=>(e,t)=>{let r;if(typeof e==="string"){r=normalizeUrlObject(y.parse(e));e={}}else if(e instanceof y.URL){r=normalizeUrlObject(y.parse(e.toString()));e={}}else{const[t,...i]=(e.path??"").split("?");const n=i.length>0?`?${i.join("?")}`:"";r=normalizeUrlObject({...e,pathname:t,search:n})}e={headers:{},method:"GET",cache:true,strictTtl:false,automaticFailover:false,...e,...urlObjectToRequestOptions(r)};e.headers=Object.fromEntries(k(e.headers).map((([e,t])=>[e.toLowerCase(),t])));const i=new d;const n=normalizeUrl(y.format(r),{stripWWW:false,removeTrailingSlash:false,stripAuthentication:false});let s=`${e.method}:${n}`;if(e.body&&e.method!==undefined&&["POST","PATCH","PUT"].includes(e.method)){if(e.body instanceof g.Readable){e.cache=false}else{s+=`:${w.createHash("md5").update(e.body).digest("hex")}`}}let o=false;let a=false;const makeRequest=e=>{a=true;let r=false;let requestErrorCallback=()=>{};const n=new Promise((e=>{requestErrorCallback=()=>{if(!r){r=true;e()}}}));const handler=async r=>{if(o){r.status=r.statusCode;const t=N.fromObject(o.cachePolicy).revalidatedPolicy(e,r);if(!t.modified){r.resume();await new Promise((e=>{r.once("end",e)}));const e=convertHeaders(t.policy.responseHeaders());r=new Response({statusCode:o.statusCode,headers:e,body:o.body,url:o.url});r.cachePolicy=t.policy;r.fromCache=true}}if(!r.fromCache){r.cachePolicy=new N(e,r,e);r.fromCache=false}let a;if(e.cache&&r.cachePolicy.storable()){a=cloneResponse(r);(async()=>{try{const t=C.buffer(r);await Promise.race([n,new Promise((e=>r.once("end",e))),new Promise((e=>r.once("close",e)))]);const i=await t;let a={url:r.url,statusCode:r.fromCache?o.statusCode:r.statusCode,body:i,cachePolicy:r.cachePolicy.toObject()};let l=e.strictTtl?r.cachePolicy.timeToLive():undefined;if(e.maxTtl){l=l?Math.min(l,e.maxTtl):e.maxTtl}if(this.hooks.size>0){for(const e of this.hooks.keys()){a=await this.runHook(e,a,r)}}await this.cache.set(s,a,l)}catch(e){i.emit("error",new types_CacheError(e))}})()}else if(e.cache&&o){(async()=>{try{await this.cache.delete(s)}catch(e){i.emit("error",new types_CacheError(e))}})()}i.emit("response",a??r);if(typeof t==="function"){t(a??r)}};try{const t=this.cacheRequest(e,handler);t.once("error",requestErrorCallback);t.once("abort",requestErrorCallback);t.once("destroy",requestErrorCallback);i.emit("request",t)}catch(e){i.emit("error",new types_RequestError(e))}};(async()=>{const get=async e=>{await Promise.resolve();const r=e.cache?await this.cache.get(s):undefined;if(r===undefined&&!e.forceRefresh){makeRequest(e);return}const n=N.fromObject(r.cachePolicy);if(n.satisfiesWithoutRevalidation(e)&&!e.forceRefresh){const e=convertHeaders(n.responseHeaders());const s=new Response({statusCode:r.statusCode,headers:e,body:r.body,url:r.url});s.cachePolicy=n;s.fromCache=true;i.emit("response",s);if(typeof t==="function"){t(s)}}else if(n.satisfiesWithoutRevalidation(e)&&Date.now()>=n.timeToLive()&&e.forceRefresh){await this.cache.delete(s);e.headers=n.revalidationHeaders(e);makeRequest(e)}else{o=r;e.headers=n.revalidationHeaders(e);makeRequest(e)}};const errorHandler=e=>i.emit("error",new types_CacheError(e));if(this.cache instanceof O){const e=this.cache;e.once("error",errorHandler);i.on("error",(()=>e.removeListener("error",errorHandler)));i.on("response",(()=>e.removeListener("error",errorHandler)))}try{await get(e)}catch(t){if(e.automaticFailover&&!a){makeRequest(e)}i.emit("error",new types_CacheError(t))}})();return i};this.addHook=(e,t)=>{if(!this.hooks.has(e)){this.hooks.set(e,t)}};this.removeHook=e=>this.hooks.delete(e);this.getHook=e=>this.hooks.get(e);this.runHook=async(e,...t)=>this.hooks.get(e)?.(...t);if(t instanceof O){this.cache=t}else if(typeof t==="string"){this.cache=new O({uri:t,namespace:"cacheable-request"})}else{this.cache=new O({store:t,namespace:"cacheable-request"})}this.request=this.request.bind(this);this.cacheRequest=e}}const k=Object.entries;const cloneResponse=e=>{const t=new g.PassThrough({autoDestroy:false});mimicResponse(e,t);return e.pipe(t)};const urlObjectToRequestOptions=e=>{const t={...e};t.path=`${e.pathname||"/"}${e.search||""}`;delete t.pathname;delete t.search;return t};const normalizeUrlObject=e=>({protocol:e.protocol,auth:e.auth,hostname:e.hostname||e.host||"localhost",port:e.port,pathname:e.pathname,search:e.search});const convertHeaders=e=>{const t=[];for(const r of Object.keys(e)){t[r.toLowerCase()]=e[r]}return t};const P=CacheableRequest;const L="onResponse";var I=r(2391);const isFunction=e=>typeof e==="function";const isFormData=e=>Boolean(e&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&isFunction(e.append)&&isFunction(e.getAll)&&isFunction(e.entries)&&isFunction(e[Symbol.iterator]));const isAsyncIterable=e=>isFunction(e[Symbol.asyncIterator]);async function*readStream(e){const t=e.getReader();while(true){const{done:e,value:r}=await t.read();if(e){break}yield r}}const getStreamIterator=e=>{if(isAsyncIterable(e)){return e}if(isFunction(e.getReader)){return readStream(e)}throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")};const M="abcdefghijklmnopqrstuvwxyz0123456789";function createBoundary(){let e=16;let t="";while(e--){t+=M[Math.random()*M.length<<0]}return t}const normalizeValue=e=>String(e).replace(/\r|\n/g,((e,t,r)=>{if(e==="\r"&&r[t+1]!=="\n"||e==="\n"&&r[t-1]!=="\r"){return"\r\n"}return e}));const getType=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase();function isPlainObject(e){if(getType(e)!=="object"){return false}const t=Object.getPrototypeOf(e);if(t===null||t===undefined){return true}const r=t.constructor&&t.constructor.toString();return r===Object.toString()}function getProperty(e,t){if(typeof t==="string"){for(const[r,i]of Object.entries(e)){if(t.toLowerCase()===r.toLowerCase()){return i}}}return undefined}const proxyHeaders=e=>new Proxy(e,{get:(e,t)=>getProperty(e,t),has:(e,t)=>getProperty(e,t)!==undefined});const escapeName=e=>String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22");const isFile=e=>Boolean(e&&typeof e==="object"&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="File"&&isFunction(e.stream)&&e.name!=null);const D=null&&isFile;var F=undefined&&undefined.__classPrivateFieldSet||function(e,t,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r};var j=undefined&&undefined.__classPrivateFieldGet||function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)};var B,U,H,z,K,V,q,Z,G,$,W;const Y={enableAdditionalHeaders:false};const J={writable:false,configurable:false};class FormDataEncoder{constructor(e,t,r){B.add(this);U.set(this,"\r\n");H.set(this,void 0);z.set(this,void 0);K.set(this,"-".repeat(2));V.set(this,new TextEncoder);q.set(this,void 0);Z.set(this,void 0);G.set(this,void 0);if(!isFormData(e)){throw new TypeError("Expected first argument to be a FormData instance.")}let i;if(isPlainObject(t)){r=t}else{i=t}if(!i){i=createBoundary()}if(typeof i!=="string"){throw new TypeError("Expected boundary argument to be a string.")}if(r&&!isPlainObject(r)){throw new TypeError("Expected options argument to be an object.")}F(this,Z,Array.from(e.entries()),"f");F(this,G,{...Y,...r},"f");F(this,H,j(this,V,"f").encode(j(this,U,"f")),"f");F(this,z,j(this,H,"f").byteLength,"f");this.boundary=`form-data-boundary-${i}`;this.contentType=`multipart/form-data; boundary=${this.boundary}`;F(this,q,j(this,V,"f").encode(`${j(this,K,"f")}${this.boundary}${j(this,K,"f")}${j(this,U,"f").repeat(2)}`),"f");const n={"Content-Type":this.contentType};const s=j(this,B,"m",W).call(this);if(s){this.contentLength=s;n["Content-Length"]=s}this.headers=proxyHeaders(Object.freeze(n));Object.defineProperties(this,{boundary:J,contentType:J,contentLength:J,headers:J})}getContentLength(){return this.contentLength==null?undefined:Number(this.contentLength)}*values(){for(const[e,t]of j(this,Z,"f")){const r=isFile(t)?t:j(this,V,"f").encode(normalizeValue(t));yield j(this,B,"m",$).call(this,e,r);yield r;yield j(this,H,"f")}yield j(this,q,"f")}async*encode(){for(const e of this.values()){if(isFile(e)){yield*getStreamIterator(e.stream())}else{yield e}}}[(U=new WeakMap,H=new WeakMap,z=new WeakMap,K=new WeakMap,V=new WeakMap,q=new WeakMap,Z=new WeakMap,G=new WeakMap,B=new WeakSet,$=function _FormDataEncoder_getFieldHeader(e,t){let r="";r+=`${j(this,K,"f")}${this.boundary}${j(this,U,"f")}`;r+=`Content-Disposition: form-data; name="${escapeName(e)}"`;if(isFile(t)){r+=`; filename="${escapeName(t.name)}"${j(this,U,"f")}`;r+=`Content-Type: ${t.type||"application/octet-stream"}`}const i=isFile(t)?t.size:t.byteLength;if(j(this,G,"f").enableAdditionalHeaders===true&&i!=null&&!isNaN(i)){r+=`${j(this,U,"f")}Content-Length: ${isFile(t)?t.size:t.byteLength}`}return j(this,V,"f").encode(`${r}${j(this,U,"f").repeat(2)}`)},W=function _FormDataEncoder_getContentLength(){let e=0;for(const[t,r]of j(this,Z,"f")){const i=isFile(r)?r:j(this,V,"f").encode(normalizeValue(r));const n=isFile(i)?i.size:i.byteLength;if(n==null||isNaN(n)){return undefined}e+=j(this,B,"m",$).call(this,t,i).byteLength;e+=n;e+=j(this,z,"f")}return String(e+j(this,q,"f").byteLength)},Symbol.iterator)](){return this.values()}[Symbol.asyncIterator](){return this.encode()}}const Q=require("node:util");function is_form_data_isFormData(e){return h.nodeStream(e)&&h.function_(e.getBoundary)}async function getBodySize(e,t){if(t&&"content-length"in t){return Number(t["content-length"])}if(!e){return 0}if(h.string(e)){return m.Buffer.byteLength(e)}if(h.buffer(e)){return e.length}if(is_form_data_isFormData(e)){return(0,Q.promisify)(e.getLength.bind(e))()}return undefined}function proxyEvents(e,t,r){const i={};for(const n of r){const eventFunction=(...e)=>{t.emit(n,...e)};i[n]=eventFunction;e.on(n,eventFunction)}return()=>{for(const[t,r]of Object.entries(i)){e.off(t,r)}}}const X=require("node:net");function unhandle(){const e=[];return{once(t,r,i){t.once(r,i);e.push({origin:t,event:r,fn:i})},unhandleAll(){for(const t of e){const{origin:e,event:r,fn:i}=t;e.removeListener(r,i)}e.length=0}}}const ee=Symbol("reentry");const noop=()=>{};class timed_out_TimeoutError extends Error{constructor(e,t){super(`Timeout awaiting '${t}' for ${e}ms`);Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:t});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.code="ETIMEDOUT"}}function timedOut(e,t,r){if(ee in e){return noop}e[ee]=true;const i=[];const{once:n,unhandleAll:s}=unhandle();const addTimeout=(e,t,r)=>{const n=setTimeout(t,e,e,r);n.unref?.();const cancel=()=>{clearTimeout(n)};i.push(cancel);return cancel};const{host:o,hostname:a}=r;const timeoutHandler=(t,r)=>{e.destroy(new timed_out_TimeoutError(t,r))};const cancelTimeouts=()=>{for(const e of i){e()}s()};e.once("error",(t=>{cancelTimeouts();if(e.listenerCount("error")===0){throw t}}));if(typeof t.request!=="undefined"){const r=addTimeout(t.request,timeoutHandler,"request");n(e,"response",(e=>{n(e,"end",r)}))}if(typeof t.socket!=="undefined"){const{socket:r}=t;const socketTimeoutHandler=()=>{timeoutHandler(r,"socket")};e.setTimeout(r,socketTimeoutHandler);i.push((()=>{e.removeListener("timeout",socketTimeoutHandler)}))}const l=typeof t.lookup!=="undefined";const u=typeof t.connect!=="undefined";const c=typeof t.secureConnect!=="undefined";const h=typeof t.send!=="undefined";if(l||u||c||h){n(e,"socket",(i=>{const{socketPath:s}=e;if(i.connecting){const e=Boolean(s??X.isIP(a??o??"")!==0);if(l&&!e&&typeof i.address().address==="undefined"){const e=addTimeout(t.lookup,timeoutHandler,"lookup");n(i,"lookup",e)}if(u){const timeConnect=()=>addTimeout(t.connect,timeoutHandler,"connect");if(e){n(i,"connect",timeConnect())}else{n(i,"lookup",(e=>{if(e===null){n(i,"connect",timeConnect())}}))}}if(c&&r.protocol==="https:"){n(i,"connect",(()=>{const e=addTimeout(t.secureConnect,timeoutHandler,"secureConnect");n(i,"secureConnect",e)}))}}if(h){const timeRequest=()=>addTimeout(t.send,timeoutHandler,"send");if(i.connecting){n(i,"connect",(()=>{n(e,"upload-complete",timeRequest())}))}else{n(e,"upload-complete",timeRequest())}}}))}if(typeof t.response!=="undefined"){n(e,"upload-complete",(()=>{const r=addTimeout(t.response,timeoutHandler,"response");n(e,"response",r)}))}if(typeof t.read!=="undefined"){n(e,"response",(e=>{const r=addTimeout(t.read,timeoutHandler,"read");n(e,"end",r)}))}return cancelTimeouts}function urlToOptions(e){e=e;const t={protocol:e.protocol,hostname:h.string(e.hostname)&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,host:e.host,hash:e.hash,search:e.search,pathname:e.pathname,href:e.href,path:`${e.pathname||""}${e.search||""}`};if(h.string(e.port)&&e.port.length>0){t.port=Number(e.port)}if(e.username||e.password){t.auth=`${e.username||""}:${e.password||""}`}return t}class WeakableMap{constructor(){Object.defineProperty(this,"weakMap",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"map",{enumerable:true,configurable:true,writable:true,value:void 0});this.weakMap=new WeakMap;this.map=new Map}set(e,t){if(typeof e==="object"){this.weakMap.set(e,t)}else{this.map.set(e,t)}}get(e){if(typeof e==="object"){return this.weakMap.get(e)}return this.map.get(e)}has(e){if(typeof e==="object"){return this.weakMap.has(e)}return this.map.has(e)}}const calculateRetryDelay=({attemptCount:e,retryOptions:t,error:r,retryAfter:i,computedValue:n})=>{if(r.name==="RetryError"){return 1}if(e>t.limit){return 0}const s=t.methods.includes(r.options.method);const o=t.errorCodes.includes(r.code);const a=r.response&&t.statusCodes.includes(r.response.statusCode);if(!s||!o&&!a){return 0}if(r.response){if(i){if(i>n){return 0}return i}if(r.response.statusCode===413){return 0}}const l=Math.random()*t.noise;return Math.min(2**(e-1)*1e3,t.backoffLimit)+l};const te=calculateRetryDelay;const re=require("node:tls");const ie=require("node:https");const ne=require("node:dns");const se=require("node:os");const{Resolver:oe}=ne.promises;const ae=Symbol("cacheableLookupCreateConnection");const le=Symbol("cacheableLookupInstance");const ue=Symbol("expires");const ce=typeof ne.ALL==="number";const verifyAgent=e=>{if(!(e&&typeof e.createConnection==="function")){throw new Error("Expected an Agent instance as the first argument")}};const map4to6=e=>{for(const t of e){if(t.family===6){continue}t.address=`::ffff:${t.address}`;t.family=6}};const getIfaceInfo=()=>{let e=false;let t=false;for(const r of Object.values(se.networkInterfaces())){for(const i of r){if(i.internal){continue}if(i.family==="IPv6"){t=true}else{e=true}if(e&&t){return{has4:e,has6:t}}}}return{has4:e,has6:t}};const isIterable=e=>Symbol.iterator in e;const ignoreNoResultErrors=e=>e.catch((e=>{if(e.code==="ENODATA"||e.code==="ENOTFOUND"||e.code==="ENOENT"){return[]}throw e}));const he={ttl:true};const de={all:true};const fe={all:true,family:4};const pe={all:true,family:6};class CacheableLookup{constructor({cache:e=new Map,maxTtl:t=Infinity,fallbackDuration:r=3600,errorTtl:i=.15,resolver:n=new oe,lookup:s=ne.lookup}={}){this.maxTtl=t;this.errorTtl=i;this._cache=e;this._resolver=n;this._dnsLookup=s&&(0,Q.promisify)(s);this.stats={cache:0,query:0};if(this._resolver instanceof oe){this._resolve4=this._resolver.resolve4.bind(this._resolver);this._resolve6=this._resolver.resolve6.bind(this._resolver)}else{this._resolve4=(0,Q.promisify)(this._resolver.resolve4.bind(this._resolver));this._resolve6=(0,Q.promisify)(this._resolver.resolve6.bind(this._resolver))}this._iface=getIfaceInfo();this._pending={};this._nextRemovalTime=false;this._hostnamesToFallback=new Set;this.fallbackDuration=r;if(r>0){const e=setInterval((()=>{this._hostnamesToFallback.clear()}),r*1e3);if(e.unref){e.unref()}this._fallbackInterval=e}this.lookup=this.lookup.bind(this);this.lookupAsync=this.lookupAsync.bind(this)}set servers(e){this.clear();this._resolver.setServers(e)}get servers(){return this._resolver.getServers()}lookup(e,t,r){if(typeof t==="function"){r=t;t={}}else if(typeof t==="number"){t={family:t}}if(!r){throw new Error("Callback must be a function.")}this.lookupAsync(e,t).then((e=>{if(t.all){r(null,e)}else{r(null,e.address,e.family,e.expires,e.ttl,e.source)}}),r)}async lookupAsync(e,t={}){if(typeof t==="number"){t={family:t}}let r=await this.query(e);if(t.family===6){const e=r.filter((e=>e.family===6));if(t.hints&ne.V4MAPPED){if(ce&&t.hints&ne.ALL||e.length===0){map4to6(r)}else{r=e}}else{r=e}}else if(t.family===4){r=r.filter((e=>e.family===4))}if(t.hints&ne.ADDRCONFIG){const{_iface:e}=this;r=r.filter((t=>t.family===6?e.has6:e.has4))}if(r.length===0){const t=new Error(`cacheableLookup ENOTFOUND ${e}`);t.code="ENOTFOUND";t.hostname=e;throw t}if(t.all){return r}return r[0]}async query(e){let t="cache";let r=await this._cache.get(e);if(r){this.stats.cache++}if(!r){const i=this._pending[e];if(i){this.stats.cache++;r=await i}else{t="query";const i=this.queryAndCache(e);this._pending[e]=i;this.stats.query++;try{r=await i}finally{delete this._pending[e]}}}r=r.map((e=>({...e,source:t})));return r}async _resolve(e){const[t,r]=await Promise.all([ignoreNoResultErrors(this._resolve4(e,he)),ignoreNoResultErrors(this._resolve6(e,he))]);let i=0;let n=0;let s=0;const o=Date.now();for(const e of t){e.family=4;e.expires=o+e.ttl*1e3;i=Math.max(i,e.ttl)}for(const e of r){e.family=6;e.expires=o+e.ttl*1e3;n=Math.max(n,e.ttl)}if(t.length>0){if(r.length>0){s=Math.min(i,n)}else{s=i}}else{s=n}return{entries:[...t,...r],cacheTtl:s}}async _lookup(e){try{const[t,r]=await Promise.all([ignoreNoResultErrors(this._dnsLookup(e,fe)),ignoreNoResultErrors(this._dnsLookup(e,pe))]);return{entries:[...t,...r],cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set(e,t,r){if(this.maxTtl>0&&r>0){r=Math.min(r,this.maxTtl)*1e3;t[ue]=Date.now()+r;try{await this._cache.set(e,t,r)}catch(e){this.lookupAsync=async()=>{const t=new Error("Cache Error. Please recreate the CacheableLookup instance.");t.cause=e;throw t}}if(isIterable(this._cache)){this._tick(r)}}}async queryAndCache(e){if(this._hostnamesToFallback.has(e)){return this._dnsLookup(e,de)}let t=await this._resolve(e);if(t.entries.length===0&&this._dnsLookup){t=await this._lookup(e);if(t.entries.length!==0&&this.fallbackDuration>0){this._hostnamesToFallback.add(e)}}const r=t.entries.length===0?this.errorTtl:t.cacheTtl;await this._set(e,t.entries,r);return t.entries}_tick(e){const t=this._nextRemovalTime;if(!t||e<t){clearTimeout(this._removalTimeout);this._nextRemovalTime=e;this._removalTimeout=setTimeout((()=>{this._nextRemovalTime=false;let e=Infinity;const t=Date.now();for(const[r,i]of this._cache){const n=i[ue];if(t>=n){this._cache.delete(r)}else if(n<e){e=n}}if(e!==Infinity){this._tick(e-t)}}),e);if(this._removalTimeout.unref){this._removalTimeout.unref()}}}install(e){verifyAgent(e);if(ae in e){throw new Error("CacheableLookup has been already installed")}e[ae]=e.createConnection;e[le]=this;e.createConnection=(t,r)=>{if(!("lookup"in t)){t.lookup=this.lookup}return e[ae](t,r)}}uninstall(e){verifyAgent(e);if(e[ae]){if(e[le]!==this){throw new Error("The agent is not owned by this CacheableLookup instance")}e.createConnection=e[ae];delete e[ae];delete e[le]}}updateInterfaceInfo(){const{_iface:e}=this;this._iface=getIfaceInfo();if(e.has4&&!this._iface.has4||e.has6&&!this._iface.has6){this._cache.clear()}}clear(e){if(e){this._cache.delete(e);return}this._cache.clear()}}var me=r(4645);function parseLinkHeader(e){const t=[];const r=e.split(",");for(const i of r){const[r,...n]=i.split(";");const s=r.trim();if(s[0]!=="<"||s[s.length-1]!==">"){throw new Error(`Invalid format of the Link header reference: ${s}`)}const o=s.slice(1,-1);const a={};if(n.length===0){throw new Error(`Unexpected end of Link header parameters: ${n.join(";")}`)}for(const t of n){const r=t.trim();const i=r.indexOf("=");if(i===-1){throw new Error(`Failed to parse Link header: ${e}`)}const n=r.slice(0,i).trim();const s=r.slice(i+1).trim();a[n]=s}t.push({reference:o,parameters:a})}return t}const[ge,ye]=p.versions.node.split(".").map(Number);function validateSearchParameters(e){for(const t in e){const r=e[t];c.any([h.string,h.number,h.boolean,h.null_,h.undefined],r)}}const _e=new Map;let ve;const getGlobalDnsCache=()=>{if(ve){return ve}ve=new CacheableLookup;return ve};const be={request:undefined,agent:{http:undefined,https:undefined,http2:undefined},h2session:undefined,decompress:true,timeout:{connect:undefined,lookup:undefined,read:undefined,request:undefined,response:undefined,secureConnect:undefined,send:undefined,socket:undefined},prefixUrl:"",body:undefined,form:undefined,json:undefined,cookieJar:undefined,ignoreInvalidCookies:false,searchParams:undefined,dnsLookup:undefined,dnsCache:undefined,context:{},hooks:{init:[],beforeRequest:[],beforeError:[],beforeRedirect:[],beforeRetry:[],afterResponse:[]},followRedirect:true,maxRedirects:10,cache:undefined,throwHttpErrors:true,username:"",password:"",http2:false,allowGetBody:false,headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},methodRewriting:false,dnsLookupIpVersion:undefined,parseJson:JSON.parse,stringifyJson:JSON.stringify,retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:undefined,calculateDelay:({computedValue:e})=>e,backoffLimit:Number.POSITIVE_INFINITY,noise:100},localAddress:undefined,method:"GET",createConnection:undefined,cacheOptions:{shared:undefined,cacheHeuristic:undefined,immutableMinTimeToLive:undefined,ignoreCargoCult:undefined},https:{alpnProtocols:undefined,rejectUnauthorized:undefined,checkServerIdentity:undefined,certificateAuthority:undefined,key:undefined,certificate:undefined,passphrase:undefined,pfx:undefined,ciphers:undefined,honorCipherOrder:undefined,minVersion:undefined,maxVersion:undefined,signatureAlgorithms:undefined,tlsSessionLifetime:undefined,dhparam:undefined,ecdhCurve:undefined,certificateRevocationLists:undefined},encoding:undefined,resolveBodyOnly:false,isStream:false,responseType:"text",url:undefined,pagination:{transform(e){if(e.request.options.responseType==="json"){return e.body}return JSON.parse(e.body)},paginate({response:e}){const t=e.headers.link;if(typeof t!=="string"||t.trim()===""){return false}const r=parseLinkHeader(t);const i=r.find((e=>e.parameters.rel==="next"||e.parameters.rel==='"next"'));if(i){return{url:new y.URL(i.reference,e.url)}}return false},filter:()=>true,shouldContinue:()=>true,countLimit:Number.POSITIVE_INFINITY,backoff:0,requestLimit:1e4,stackAllItems:false},setHost:true,maxHeaderSize:undefined,signal:undefined,enableUnixSockets:true};const cloneInternals=e=>{const{hooks:t,retry:r}=e;const i={...e,context:{...e.context},cacheOptions:{...e.cacheOptions},https:{...e.https},agent:{...e.agent},headers:{...e.headers},retry:{...r,errorCodes:[...r.errorCodes],methods:[...r.methods],statusCodes:[...r.statusCodes]},timeout:{...e.timeout},hooks:{init:[...t.init],beforeRequest:[...t.beforeRequest],beforeError:[...t.beforeError],beforeRedirect:[...t.beforeRedirect],beforeRetry:[...t.beforeRetry],afterResponse:[...t.afterResponse]},searchParams:e.searchParams?new y.URLSearchParams(e.searchParams):undefined,pagination:{...e.pagination}};if(i.url!==undefined){i.prefixUrl=""}return i};const cloneRaw=e=>{const{hooks:t,retry:r}=e;const i={...e};if(h.object(e.context)){i.context={...e.context}}if(h.object(e.cacheOptions)){i.cacheOptions={...e.cacheOptions}}if(h.object(e.https)){i.https={...e.https}}if(h.object(e.cacheOptions)){i.cacheOptions={...i.cacheOptions}}if(h.object(e.agent)){i.agent={...e.agent}}if(h.object(e.headers)){i.headers={...e.headers}}if(h.object(r)){i.retry={...r};if(h.array(r.errorCodes)){i.retry.errorCodes=[...r.errorCodes]}if(h.array(r.methods)){i.retry.methods=[...r.methods]}if(h.array(r.statusCodes)){i.retry.statusCodes=[...r.statusCodes]}}if(h.object(e.timeout)){i.timeout={...e.timeout}}if(h.object(t)){i.hooks={...t};if(h.array(t.init)){i.hooks.init=[...t.init]}if(h.array(t.beforeRequest)){i.hooks.beforeRequest=[...t.beforeRequest]}if(h.array(t.beforeError)){i.hooks.beforeError=[...t.beforeError]}if(h.array(t.beforeRedirect)){i.hooks.beforeRedirect=[...t.beforeRedirect]}if(h.array(t.beforeRetry)){i.hooks.beforeRetry=[...t.beforeRetry]}if(h.array(t.afterResponse)){i.hooks.afterResponse=[...t.afterResponse]}}if(h.object(e.pagination)){i.pagination={...e.pagination}}return i};const getHttp2TimeoutOption=e=>{const t=[e.timeout.socket,e.timeout.connect,e.timeout.lookup,e.timeout.request,e.timeout.secureConnect].filter((e=>typeof e==="number"));if(t.length>0){return Math.min(...t)}return undefined};const init=(e,t,r)=>{const i=e.hooks?.init;if(i){for(const e of i){e(t,r)}}};class Options{constructor(e,t,r){Object.defineProperty(this,"_unixOptions",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_internals",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_merging",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_init",{enumerable:true,configurable:true,writable:true,value:void 0});c.any([h.string,h.urlInstance,h.object,h.undefined],e);c.any([h.object,h.undefined],t);c.any([h.object,h.undefined],r);if(e instanceof Options||t instanceof Options){throw new TypeError("The defaults must be passed as the third argument")}this._internals=cloneInternals(r?._internals??r??be);this._init=[...r?._init??[]];this._merging=false;this._unixOptions=undefined;try{if(h.plainObject(e)){try{this.merge(e);this.merge(t)}finally{this.url=e.url}}else{try{this.merge(t)}finally{if(t?.url!==undefined){if(e===undefined){this.url=t.url}else{throw new TypeError("The `url` option is mutually exclusive with the `input` argument")}}else if(e!==undefined){this.url=e}}}}catch(e){e.options=this;throw e}}merge(e){if(!e){return}if(e instanceof Options){for(const t of e._init){this.merge(t)}return}e=cloneRaw(e);init(this,e,this);init(e,e,this);this._merging=true;if("isStream"in e){this.isStream=e.isStream}try{let t=false;for(const r in e){if(r==="mutableDefaults"||r==="handlers"){continue}if(r==="url"){continue}if(!(r in this)){throw new Error(`Unexpected option: ${r}`)}this[r]=e[r];t=true}if(t){this._init.push(e)}}finally{this._merging=false}}get request(){return this._internals.request}set request(e){c.any([h.function_,h.undefined],e);this._internals.request=e}get agent(){return this._internals.agent}set agent(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.agent)){throw new TypeError(`Unexpected agent option: ${t}`)}c.any([h.object,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.agent,e)}else{this._internals.agent={...e}}}get h2session(){return this._internals.h2session}set h2session(e){this._internals.h2session=e}get decompress(){return this._internals.decompress}set decompress(e){c.boolean(e);this._internals.decompress=e}get timeout(){return this._internals.timeout}set timeout(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.timeout)){throw new Error(`Unexpected timeout option: ${t}`)}c.any([h.number,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.timeout,e)}else{this._internals.timeout={...e}}}get prefixUrl(){return this._internals.prefixUrl}set prefixUrl(e){c.any([h.string,h.urlInstance],e);if(e===""){this._internals.prefixUrl="";return}e=e.toString();if(!e.endsWith("/")){e+="/"}if(this._internals.prefixUrl&&this._internals.url){const{href:t}=this._internals.url;this._internals.url.href=e+t.slice(this._internals.prefixUrl.length)}this._internals.prefixUrl=e}get body(){return this._internals.body}set body(e){c.any([h.string,h.buffer,h.nodeStream,h.generator,h.asyncGenerator,isFormData,h.undefined],e);if(h.nodeStream(e)){c.truthy(e.readable)}if(e!==undefined){c.undefined(this._internals.form);c.undefined(this._internals.json)}this._internals.body=e}get form(){return this._internals.form}set form(e){c.any([h.plainObject,h.undefined],e);if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.json)}this._internals.form=e}get json(){return this._internals.json}set json(e){if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.form)}this._internals.json=e}get url(){return this._internals.url}set url(e){c.any([h.string,h.urlInstance,h.undefined],e);if(e===undefined){this._internals.url=undefined;return}if(h.string(e)&&e.startsWith("/")){throw new Error("`url` must not start with a slash")}const t=`${this.prefixUrl}${e.toString()}`;const r=new y.URL(t);this._internals.url=r;if(r.protocol==="unix:"){r.href=`http://unix${r.pathname}${r.search}`}if(r.protocol!=="http:"&&r.protocol!=="https:"){const e=new Error(`Unsupported protocol: ${r.protocol}`);e.code="ERR_UNSUPPORTED_PROTOCOL";throw e}if(this._internals.username){r.username=this._internals.username;this._internals.username=""}if(this._internals.password){r.password=this._internals.password;this._internals.password=""}if(this._internals.searchParams){r.search=this._internals.searchParams.toString();this._internals.searchParams=undefined}if(r.hostname==="unix"){if(!this._internals.enableUnixSockets){throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled")}const e=/(?<socketPath>.+?):(?<path>.+)/.exec(`${r.pathname}${r.search}`);if(e?.groups){const{socketPath:t,path:r}=e.groups;this._unixOptions={socketPath:t,path:r,host:""}}else{this._unixOptions=undefined}return}this._unixOptions=undefined}get cookieJar(){return this._internals.cookieJar}set cookieJar(e){c.any([h.object,h.undefined],e);if(e===undefined){this._internals.cookieJar=undefined;return}let{setCookie:t,getCookieString:r}=e;c.function_(t);c.function_(r);if(t.length===4&&r.length===0){t=(0,Q.promisify)(t.bind(e));r=(0,Q.promisify)(r.bind(e));this._internals.cookieJar={setCookie:t,getCookieString:r}}else{this._internals.cookieJar=e}}get signal(){return this._internals.signal}set signal(e){c.object(e);this._internals.signal=e}get ignoreInvalidCookies(){return this._internals.ignoreInvalidCookies}set ignoreInvalidCookies(e){c.boolean(e);this._internals.ignoreInvalidCookies=e}get searchParams(){if(this._internals.url){return this._internals.url.searchParams}if(this._internals.searchParams===undefined){this._internals.searchParams=new y.URLSearchParams}return this._internals.searchParams}set searchParams(e){c.any([h.string,h.object,h.undefined],e);const t=this._internals.url;if(e===undefined){this._internals.searchParams=undefined;if(t){t.search=""}return}const r=this.searchParams;let i;if(h.string(e)){i=new y.URLSearchParams(e)}else if(e instanceof y.URLSearchParams){i=e}else{validateSearchParameters(e);i=new y.URLSearchParams;for(const t in e){const n=e[t];if(n===null){i.append(t,"")}else if(n===undefined){r.delete(t)}else{i.append(t,n)}}}if(this._merging){for(const e of i.keys()){r.delete(e)}for(const[e,t]of i){r.append(e,t)}}else if(t){t.search=r.toString()}else{this._internals.searchParams=r}}get searchParameters(){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}set searchParameters(e){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}get dnsLookup(){return this._internals.dnsLookup}set dnsLookup(e){c.any([h.function_,h.undefined],e);this._internals.dnsLookup=e}get dnsCache(){return this._internals.dnsCache}set dnsCache(e){c.any([h.object,h.boolean,h.undefined],e);if(e===true){this._internals.dnsCache=getGlobalDnsCache()}else if(e===false){this._internals.dnsCache=undefined}else{this._internals.dnsCache=e}}get context(){return this._internals.context}set context(e){c.object(e);if(this._merging){Object.assign(this._internals.context,e)}else{this._internals.context={...e}}}get hooks(){return this._internals.hooks}set hooks(e){c.object(e);for(const t in e){if(!(t in this._internals.hooks)){throw new Error(`Unexpected hook event: ${t}`)}const r=t;const i=e[r];c.any([h.array,h.undefined],i);if(i){for(const e of i){c.function_(e)}}if(this._merging){if(i){this._internals.hooks[r].push(...i)}}else{if(!i){throw new Error(`Missing hook event: ${t}`)}this._internals.hooks[t]=[...i]}}}get followRedirect(){return this._internals.followRedirect}set followRedirect(e){c.boolean(e);this._internals.followRedirect=e}get followRedirects(){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}set followRedirects(e){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}get maxRedirects(){return this._internals.maxRedirects}set maxRedirects(e){c.number(e);this._internals.maxRedirects=e}get cache(){return this._internals.cache}set cache(e){c.any([h.object,h.string,h.boolean,h.undefined],e);if(e===true){this._internals.cache=_e}else if(e===false){this._internals.cache=undefined}else{this._internals.cache=e}}get throwHttpErrors(){return this._internals.throwHttpErrors}set throwHttpErrors(e){c.boolean(e);this._internals.throwHttpErrors=e}get username(){const e=this._internals.url;const t=e?e.username:this._internals.username;return decodeURIComponent(t)}set username(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.username=r}else{this._internals.username=r}}get password(){const e=this._internals.url;const t=e?e.password:this._internals.password;return decodeURIComponent(t)}set password(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.password=r}else{this._internals.password=r}}get http2(){return this._internals.http2}set http2(e){c.boolean(e);this._internals.http2=e}get allowGetBody(){return this._internals.allowGetBody}set allowGetBody(e){c.boolean(e);this._internals.allowGetBody=e}get headers(){return this._internals.headers}set headers(e){c.plainObject(e);if(this._merging){Object.assign(this._internals.headers,lowercaseKeys(e))}else{this._internals.headers=lowercaseKeys(e)}}get methodRewriting(){return this._internals.methodRewriting}set methodRewriting(e){c.boolean(e);this._internals.methodRewriting=e}get dnsLookupIpVersion(){return this._internals.dnsLookupIpVersion}set dnsLookupIpVersion(e){if(e!==undefined&&e!==4&&e!==6){throw new TypeError(`Invalid DNS lookup IP version: ${e}`)}this._internals.dnsLookupIpVersion=e}get parseJson(){return this._internals.parseJson}set parseJson(e){c.function_(e);this._internals.parseJson=e}get stringifyJson(){return this._internals.stringifyJson}set stringifyJson(e){c.function_(e);this._internals.stringifyJson=e}get retry(){return this._internals.retry}set retry(e){c.plainObject(e);c.any([h.function_,h.undefined],e.calculateDelay);c.any([h.number,h.undefined],e.maxRetryAfter);c.any([h.number,h.undefined],e.limit);c.any([h.array,h.undefined],e.methods);c.any([h.array,h.undefined],e.statusCodes);c.any([h.array,h.undefined],e.errorCodes);c.any([h.number,h.undefined],e.noise);if(e.noise&&Math.abs(e.noise)>100){throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${e.noise}`)}for(const t in e){if(!(t in this._internals.retry)){throw new Error(`Unexpected retry option: ${t}`)}}if(this._merging){Object.assign(this._internals.retry,e)}else{this._internals.retry={...e}}const{retry:t}=this._internals;t.methods=[...new Set(t.methods.map((e=>e.toUpperCase())))];t.statusCodes=[...new Set(t.statusCodes)];t.errorCodes=[...new Set(t.errorCodes)]}get localAddress(){return this._internals.localAddress}set localAddress(e){c.any([h.string,h.undefined],e);this._internals.localAddress=e}get method(){return this._internals.method}set method(e){c.string(e);this._internals.method=e.toUpperCase()}get createConnection(){return this._internals.createConnection}set createConnection(e){c.any([h.function_,h.undefined],e);this._internals.createConnection=e}get cacheOptions(){return this._internals.cacheOptions}set cacheOptions(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.shared);c.any([h.number,h.undefined],e.cacheHeuristic);c.any([h.number,h.undefined],e.immutableMinTimeToLive);c.any([h.boolean,h.undefined],e.ignoreCargoCult);for(const t in e){if(!(t in this._internals.cacheOptions)){throw new Error(`Cache option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.cacheOptions,e)}else{this._internals.cacheOptions={...e}}}get https(){return this._internals.https}set https(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.rejectUnauthorized);c.any([h.function_,h.undefined],e.checkServerIdentity);c.any([h.string,h.object,h.array,h.undefined],e.certificateAuthority);c.any([h.string,h.object,h.array,h.undefined],e.key);c.any([h.string,h.object,h.array,h.undefined],e.certificate);c.any([h.string,h.undefined],e.passphrase);c.any([h.string,h.buffer,h.array,h.undefined],e.pfx);c.any([h.array,h.undefined],e.alpnProtocols);c.any([h.string,h.undefined],e.ciphers);c.any([h.string,h.buffer,h.undefined],e.dhparam);c.any([h.string,h.undefined],e.signatureAlgorithms);c.any([h.string,h.undefined],e.minVersion);c.any([h.string,h.undefined],e.maxVersion);c.any([h.boolean,h.undefined],e.honorCipherOrder);c.any([h.number,h.undefined],e.tlsSessionLifetime);c.any([h.string,h.undefined],e.ecdhCurve);c.any([h.string,h.buffer,h.array,h.undefined],e.certificateRevocationLists);for(const t in e){if(!(t in this._internals.https)){throw new Error(`HTTPS option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.https,e)}else{this._internals.https={...e}}}get encoding(){return this._internals.encoding}set encoding(e){if(e===null){throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead")}c.any([h.string,h.undefined],e);this._internals.encoding=e}get resolveBodyOnly(){return this._internals.resolveBodyOnly}set resolveBodyOnly(e){c.boolean(e);this._internals.resolveBodyOnly=e}get isStream(){return this._internals.isStream}set isStream(e){c.boolean(e);this._internals.isStream=e}get responseType(){return this._internals.responseType}set responseType(e){if(e===undefined){this._internals.responseType="text";return}if(e!=="text"&&e!=="buffer"&&e!=="json"){throw new Error(`Invalid \`responseType\` option: ${e}`)}this._internals.responseType=e}get pagination(){return this._internals.pagination}set pagination(e){c.object(e);if(this._merging){Object.assign(this._internals.pagination,e)}else{this._internals.pagination=e}}get auth(){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}set auth(e){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}get setHost(){return this._internals.setHost}set setHost(e){c.boolean(e);this._internals.setHost=e}get maxHeaderSize(){return this._internals.maxHeaderSize}set maxHeaderSize(e){c.any([h.number,h.undefined],e);this._internals.maxHeaderSize=e}get enableUnixSockets(){return this._internals.enableUnixSockets}set enableUnixSockets(e){c.boolean(e);this._internals.enableUnixSockets=e}toJSON(){return{...this._internals}}[Symbol.for("nodejs.util.inspect.custom")](e,t){return(0,Q.inspect)(this._internals,t)}createNativeRequestOptions(){const e=this._internals;const t=e.url;let r;if(t.protocol==="https:"){r=e.http2?e.agent:e.agent.https}else{r=e.agent.http}const{https:i}=e;let{pfx:n}=i;if(h.array(n)&&h.plainObject(n[0])){n=n.map((e=>({buf:e.buffer,passphrase:e.passphrase})))}return{...e.cacheOptions,...this._unixOptions,ALPNProtocols:i.alpnProtocols,ca:i.certificateAuthority,cert:i.certificate,key:i.key,passphrase:i.passphrase,pfx:i.pfx,rejectUnauthorized:i.rejectUnauthorized,checkServerIdentity:i.checkServerIdentity??re.checkServerIdentity,ciphers:i.ciphers,honorCipherOrder:i.honorCipherOrder,minVersion:i.minVersion,maxVersion:i.maxVersion,sigalgs:i.signatureAlgorithms,sessionTimeout:i.tlsSessionLifetime,dhparam:i.dhparam,ecdhCurve:i.ecdhCurve,crl:i.certificateRevocationLists,lookup:e.dnsLookup??e.dnsCache?.lookup,family:e.dnsLookupIpVersion,agent:r,setHost:e.setHost,method:e.method,maxHeaderSize:e.maxHeaderSize,localAddress:e.localAddress,headers:e.headers,createConnection:e.createConnection,timeout:e.http2?getHttp2TimeoutOption(e):undefined,h2session:e.h2session}}getRequestFunction(){const e=this._internals.url;const{request:t}=this._internals;if(!t&&e){return this.getFallbackRequestFunction()}return t}getFallbackRequestFunction(){const e=this._internals.url;if(!e){return}if(e.protocol==="https:"){if(this._internals.http2){if(ge<15||ge===15&&ye<10){const e=new Error("To use the `http2` option, install Node.js 15.10.0 or above");e.code="EUNSUPPORTED";throw e}return me.auto}return ie.request}return _.request}freeze(){const e=this._internals;Object.freeze(e);Object.freeze(e.hooks);Object.freeze(e.hooks.afterResponse);Object.freeze(e.hooks.beforeError);Object.freeze(e.hooks.beforeRedirect);Object.freeze(e.hooks.beforeRequest);Object.freeze(e.hooks.beforeRetry);Object.freeze(e.hooks.init);Object.freeze(e.https);Object.freeze(e.cacheOptions);Object.freeze(e.agent);Object.freeze(e.headers);Object.freeze(e.timeout);Object.freeze(e.retry);Object.freeze(e.retry.errorCodes);Object.freeze(e.retry.methods);Object.freeze(e.retry.statusCodes)}}const isResponseOk=e=>{const{statusCode:t}=e;const r=e.request.options.followRedirect?299:399;return t>=200&&t<=r||t===304};class ParseError extends RequestError{constructor(e,t){const{options:r}=t.request;super(`${e.message} in "${r.url.toString()}"`,e,t.request);this.name="ParseError";this.code="ERR_BODY_PARSE_FAILURE"}}const parseBody=(e,t,r,i)=>{const{rawBody:n}=e;try{if(t==="text"){return n.toString(i)}if(t==="json"){return n.length===0?"":r(n.toString(i))}if(t==="buffer"){return n}}catch(t){throw new ParseError(t,e)}throw new ParseError({message:`Unknown body type '${t}'`,name:"Error"},e)};function isClientRequest(e){return e.writable&&!e.writableEnded}const xe=isClientRequest;function isUnixSocketURL(e){return e.protocol==="unix:"||e.hostname==="unix"}const{buffer:Te}=C;const we=h.string(p.versions.brotli);const Se=new Set(["GET","HEAD"]);const Ee=new WeakableMap;const Ae=new Set([300,301,302,303,304,307,308]);const Ce=["socket","connect","continue","information","upgrade"];const core_noop=()=>{};class Request extends g.Duplex{constructor(e,t,r){super({autoDestroy:false,highWaterMark:0});Object.defineProperty(this,"constructor",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_noPipe",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"options",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"requestUrl",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"redirectUrls",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"retryCount",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopRetry",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_downloadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_uploadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopReading",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_pipedServerResponses",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_responseSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_bodySize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_unproxyEvents",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_isFromCache",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cannotHaveBody",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_triggerRead",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cancelTimeouts",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_removeListeners",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_nativeResponse",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_flushed",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_aborted",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_requestInitialized",{enumerable:true,configurable:true,writable:true,value:void 0});this._downloadedSize=0;this._uploadedSize=0;this._stopReading=false;this._pipedServerResponses=new Set;this._cannotHaveBody=false;this._unproxyEvents=core_noop;this._triggerRead=false;this._cancelTimeouts=core_noop;this._removeListeners=core_noop;this._jobs=[];this._flushed=false;this._requestInitialized=false;this._aborted=false;this.redirectUrls=[];this.retryCount=0;this._stopRetry=core_noop;this.on("pipe",(e=>{if(e?.headers){Object.assign(this.options.headers,e.headers)}}));this.on("newListener",(e=>{if(e==="retry"&&this.listenerCount("retry")>0){throw new Error("A retry listener has been attached already.")}}));try{this.options=new Options(e,t,r);if(!this.options.url){if(this.options.prefixUrl===""){throw new TypeError("Missing `url` property")}this.options.url=""}this.requestUrl=this.options.url}catch(e){const{options:t}=e;if(t){this.options=t}this.flush=async()=>{this.flush=async()=>{};this.destroy(e)};return}const{body:i}=this.options;if(h.nodeStream(i)){i.once("error",(e=>{if(this._flushed){this._beforeError(new UploadError(e,this))}else{this.flush=async()=>{this.flush=async()=>{};this._beforeError(new UploadError(e,this))}}}))}if(this.options.signal){const abort=()=>{this.destroy(new AbortError(this))};if(this.options.signal.aborted){abort()}else{this.options.signal.addEventListener("abort",abort);this._removeListeners=()=>{this.options.signal.removeEventListener("abort",abort)}}}}async flush(){if(this._flushed){return}this._flushed=true;try{await this._finalizeBody();if(this.destroyed){return}await this._makeRequest();if(this.destroyed){this._request?.destroy();return}for(const e of this._jobs){e()}this._jobs.length=0;this._requestInitialized=true}catch(e){this._beforeError(e)}}_beforeError(e){if(this._stopReading){return}const{response:t,options:r}=this;const i=this.retryCount+(e.name==="RetryError"?0:1);this._stopReading=true;if(!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}const n=e;void(async()=>{if(t?.readable&&!t.rawBody&&!this._request?.socket?.destroyed){t.setEncoding(this.readableEncoding);const e=await this._setRawBody(t);if(e){t.body=t.rawBody.toString()}}if(this.listenerCount("retry")!==0){let s;try{let e;if(t&&"retry-after"in t.headers){e=Number(t.headers["retry-after"]);if(Number.isNaN(e)){e=Date.parse(t.headers["retry-after"])-Date.now();if(e<=0){e=1}}else{e*=1e3}}const o=r.retry;s=await o.calculateDelay({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:te({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:o.maxRetryAfter??r.timeout.request??Number.POSITIVE_INFINITY})})}catch(e){void this._error(new RequestError(e.message,e,this));return}if(s){await new Promise((e=>{const t=setTimeout(e,s);this._stopRetry=()=>{clearTimeout(t);e()}}));if(this.destroyed){return}try{for(const e of this.options.hooks.beforeRetry){await e(n,this.retryCount+1)}}catch(t){void this._error(new RequestError(t.message,e,this));return}if(this.destroyed){return}this.destroy();this.emit("retry",this.retryCount+1,e,(e=>{const t=new Request(r.url,e,r);t.retryCount=this.retryCount+1;p.nextTick((()=>{void t.flush()}));return t}));return}}void this._error(n)})()}_read(){this._triggerRead=true;const{response:e}=this;if(e&&!this._stopReading){if(e.readableLength){this._triggerRead=false}let t;while((t=e.read())!==null){this._downloadedSize+=t.length;const e=this.downloadProgress;if(e.percent<1){this.emit("downloadProgress",e)}this.push(t)}}}_write(e,t,r){const write=()=>{this._writeRequest(e,t,r)};if(this._requestInitialized){write()}else{this._jobs.push(write)}}_final(e){const endRequest=()=>{if(!this._request||this._request.destroyed){e();return}this._request.end((t=>{if(this._request._writableState?.errored){return}if(!t){this._bodySize=this._uploadedSize;this.emit("uploadProgress",this.uploadProgress);this._request.emit("upload-complete")}e(t)}))};if(this._requestInitialized){endRequest()}else{this._jobs.push(endRequest)}}_destroy(e,t){this._stopReading=true;this.flush=async()=>{};this._stopRetry();this._cancelTimeouts();this._removeListeners();if(this.options){const{body:e}=this.options;if(h.nodeStream(e)){e.destroy()}}if(this._request){this._request.destroy()}if(e!==null&&!h.undefined(e)&&!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}t(e)}pipe(e,t){if(e instanceof _.ServerResponse){this._pipedServerResponses.add(e)}return super.pipe(e,t)}unpipe(e){if(e instanceof _.ServerResponse){this._pipedServerResponses.delete(e)}super.unpipe(e);return this}async _finalizeBody(){const{options:e}=this;const{headers:t}=e;const r=!h.undefined(e.form);const i=!h.undefined(e.json);const n=!h.undefined(e.body);const s=Se.has(e.method)&&!(e.method==="GET"&&e.allowGetBody);this._cannotHaveBody=s;if(r||i||n){if(s){throw new TypeError(`The \`${e.method}\` method cannot be used with a body`)}const i=!h.string(t["content-type"]);if(n){if(isFormData(e.body)){const r=new FormDataEncoder(e.body);if(i){t["content-type"]=r.headers["Content-Type"]}if("Content-Length"in r.headers){t["content-length"]=r.headers["Content-Length"]}e.body=r.encode()}if(is_form_data_isFormData(e.body)&&i){t["content-type"]=`multipart/form-data; boundary=${e.body.getBoundary()}`}}else if(r){if(i){t["content-type"]="application/x-www-form-urlencoded"}const{form:r}=e;e.form=undefined;e.body=new y.URLSearchParams(r).toString()}else{if(i){t["content-type"]="application/json"}const{json:r}=e;e.json=undefined;e.body=e.stringifyJson(r)}const o=await getBodySize(e.body,e.headers);if(h.undefined(t["content-length"])&&h.undefined(t["transfer-encoding"])&&!s&&!h.undefined(o)){t["content-length"]=String(o)}}if(e.responseType==="json"&&!("accept"in e.headers)){e.headers.accept="application/json"}this._bodySize=Number(t["content-length"])||undefined}async _onResponseBase(e){if(this.isAborted){return}const{options:t}=this;const{url:r}=t;this._nativeResponse=e;if(t.decompress){e=I(e)}const i=e.statusCode;const n=e;n.statusMessage=n.statusMessage??_.STATUS_CODES[i];n.url=t.url.toString();n.requestUrl=this.requestUrl;n.redirectUrls=this.redirectUrls;n.request=this;n.isFromCache=this._nativeResponse.fromCache??false;n.ip=this.ip;n.retryCount=this.retryCount;n.ok=isResponseOk(n);this._isFromCache=n.isFromCache;this._responseSize=Number(e.headers["content-length"])||undefined;this.response=n;e.once("end",(()=>{this._responseSize=this._downloadedSize;this.emit("downloadProgress",this.downloadProgress)}));e.once("error",(t=>{this._aborted=true;e.destroy();this._beforeError(new ReadError(t,this))}));e.once("aborted",(()=>{this._aborted=true;this._beforeError(new ReadError({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}));this.emit("downloadProgress",this.downloadProgress);const s=e.headers["set-cookie"];if(h.object(t.cookieJar)&&s){let e=s.map((async e=>t.cookieJar.setCookie(e,r.toString())));if(t.ignoreInvalidCookies){e=e.map((async e=>{try{await e}catch{}}))}try{await Promise.all(e)}catch(e){this._beforeError(e);return}}if(this.isAborted){return}if(t.followRedirect&&e.headers.location&&Ae.has(i)){e.resume();this._cancelTimeouts();this._unproxyEvents();if(this.redirectUrls.length>=t.maxRedirects){this._beforeError(new MaxRedirectsError(this));return}this._request=undefined;const s=new Options(undefined,undefined,this.options);const o=i===303&&s.method!=="GET"&&s.method!=="HEAD";const a=i!==307&&i!==308;const l=s.methodRewriting&&a;if(o||l){s.method="GET";s.body=undefined;s.json=undefined;s.form=undefined;delete s.headers["content-length"]}try{const t=m.Buffer.from(e.headers.location,"binary").toString();const i=new y.URL(t,r);if(!isUnixSocketURL(r)&&isUnixSocketURL(i)){this._beforeError(new RequestError("Cannot redirect to UNIX socket",{},this));return}if(i.hostname!==r.hostname||i.port!==r.port){if("host"in s.headers){delete s.headers.host}if("cookie"in s.headers){delete s.headers.cookie}if("authorization"in s.headers){delete s.headers.authorization}if(s.username||s.password){s.username="";s.password=""}}else{i.username=s.username;i.password=s.password}this.redirectUrls.push(i);s.prefixUrl="";s.url=i;for(const e of s.hooks.beforeRedirect){await e(s,n)}this.emit("redirect",s,n);this.options=s;await this._makeRequest()}catch(e){this._beforeError(e);return}return}if(t.isStream&&t.throwHttpErrors&&!isResponseOk(n)){this._beforeError(new HTTPError(n));return}e.on("readable",(()=>{if(this._triggerRead){this._read()}}));this.on("resume",(()=>{e.resume()}));this.on("pause",(()=>{e.pause()}));e.once("end",(()=>{this.push(null)}));if(this._noPipe){const t=await this._setRawBody();if(t){this.emit("response",e)}return}this.emit("response",e);for(const r of this._pipedServerResponses){if(r.headersSent){continue}for(const i in e.headers){const n=t.decompress?i!=="content-encoding":true;const s=e.headers[i];if(n){r.setHeader(i,s)}}r.statusCode=i}}async _setRawBody(e=this){if(e.readableEnded){return false}try{const t=await Te(e);if(!this.isAborted){this.response.rawBody=t;return true}}catch{}return false}async _onResponse(e){try{await this._onResponseBase(e)}catch(e){this._beforeError(e)}}_onRequest(e){const{options:t}=this;const{timeout:r,url:i}=t;T(e);if(this.options.http2){e.setTimeout(0)}this._cancelTimeouts=timedOut(e,r,i);const n=t.cache?"cacheableResponse":"response";e.once(n,(e=>{void this._onResponse(e)}));e.once("error",(t=>{this._aborted=true;e.destroy();t=t instanceof timed_out_TimeoutError?new TimeoutError(t,this.timings,this):new RequestError(t.message,t,this);this._beforeError(t)}));this._unproxyEvents=proxyEvents(e,this,Ce);this._request=e;this.emit("uploadProgress",this.uploadProgress);this._sendBody();this.emit("request",e)}async _asyncWrite(e){return new Promise(((t,r)=>{super.write(e,(e=>{if(e){r(e);return}t()}))}))}_sendBody(){const{body:e}=this.options;const t=this.redirectUrls.length===0?this:this._request??this;if(h.nodeStream(e)){e.pipe(t)}else if(h.generator(e)||h.asyncGenerator(e)){(async()=>{try{for await(const t of e){await this._asyncWrite(t)}super.end()}catch(e){this._beforeError(e)}})()}else if(!h.undefined(e)){this._writeRequest(e,undefined,(()=>{}));t.end()}else if(this._cannotHaveBody||this._noPipe){t.end()}}_prepareCache(e){if(!Ee.has(e)){const t=new P(((e,t)=>{const r=e._request(e,t);if(h.promise(r)){r.once=(e,t)=>{if(e==="error"){(async()=>{try{await r}catch(e){t(e)}})()}else if(e==="abort"){(async()=>{try{const e=await r;e.once("abort",t)}catch{}})()}else{throw new Error(`Unknown HTTP2 promise event: ${e}`)}return r}}return r}),e);Ee.set(e,t.request())}}async _createCacheableRequest(e,t){return new Promise(((r,i)=>{Object.assign(t,urlToOptions(e));let n;const s=Ee.get(t.cache)(t,(async e=>{e._readableState.autoDestroy=false;if(n){const fix=()=>{if(e.req){e.complete=e.req.res.complete}};e.prependOnceListener("end",fix);fix();(await n).emit("cacheableResponse",e)}r(e)}));s.once("error",i);s.once("request",(async e=>{n=e;r(n)}))}))}async _makeRequest(){const{options:e}=this;const{headers:t,username:r,password:i}=e;const n=e.cookieJar;for(const e in t){if(h.undefined(t[e])){delete t[e]}else if(h.null_(t[e])){throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${e}\` header`)}}if(e.decompress&&h.undefined(t["accept-encoding"])){t["accept-encoding"]=we?"gzip, deflate, br":"gzip, deflate"}if(r||i){const e=m.Buffer.from(`${r}:${i}`).toString("base64");t.authorization=`Basic ${e}`}if(n){const r=await n.getCookieString(e.url.toString());if(h.nonEmptyString(r)){t.cookie=r}}e.prefixUrl="";let s;for(const t of e.hooks.beforeRequest){const r=await t(e);if(!h.undefined(r)){s=()=>r;break}}if(!s){s=e.getRequestFunction()}const o=e.url;this._requestOptions=e.createNativeRequestOptions();if(e.cache){this._requestOptions._request=s;this._requestOptions.cache=e.cache;this._requestOptions.body=e.body;this._prepareCache(e.cache)}const a=e.cache?this._createCacheableRequest:s;try{let t=a(o,this._requestOptions);if(h.promise(t)){t=await t}if(h.undefined(t)){t=e.getFallbackRequestFunction()(o,this._requestOptions);if(h.promise(t)){t=await t}}if(xe(t)){this._onRequest(t)}else if(this.writable){this.once("finish",(()=>{void this._onResponse(t)}));this._sendBody()}else{void this._onResponse(t)}}catch(e){if(e instanceof types_CacheError){throw new CacheError(e,this)}throw e}}async _error(e){try{if(e instanceof HTTPError&&!this.options.throwHttpErrors){}else{for(const t of this.options.hooks.beforeError){e=await t(e)}}}catch(t){e=new RequestError(t.message,t,this)}this.destroy(e)}_writeRequest(e,t,r){if(!this._request||this._request.destroyed){return}this._request.write(e,t,(i=>{if(!i&&!this._request.destroyed){this._uploadedSize+=m.Buffer.byteLength(e,t);const r=this.uploadProgress;if(r.percent<1){this.emit("uploadProgress",r)}}r(i)}))}get ip(){return this.socket?.remoteAddress}get isAborted(){return this._aborted}get socket(){return this._request?.socket??undefined}get downloadProgress(){let e;if(this._responseSize){e=this._downloadedSize/this._responseSize}else if(this._responseSize===this._downloadedSize){e=1}else{e=0}return{percent:e,transferred:this._downloadedSize,total:this._responseSize}}get uploadProgress(){let e;if(this._bodySize){e=this._uploadedSize/this._bodySize}else if(this._bodySize===this._uploadedSize){e=1}else{e=0}return{percent:e,transferred:this._uploadedSize,total:this._bodySize}}get timings(){return this._request?.timings}get isFromCache(){return this._isFromCache}get reusedSocket(){return this._request?.reusedSocket}}class types_CancelError extends RequestError{constructor(e){super("Promise was canceled",{},e);this.name="CancelError";this.code="ERR_CANCELED"}get isCanceled(){return true}}const Ne=["request","response","redirect","uploadProgress","downloadProgress"];function asPromise(e){let t;let r;let i;const n=new d.EventEmitter;const s=new PCancelable(((o,a,l)=>{l((()=>{t.destroy()}));l.shouldReject=false;l((()=>{a(new types_CancelError(t))}));const makeRequest=u=>{l((()=>{}));const c=e??new Request(undefined,undefined,i);c.retryCount=u;c._noPipe=true;t=c;c.once("response",(async e=>{const t=(e.headers["content-encoding"]??"").toLowerCase();const i=t==="gzip"||t==="deflate"||t==="br";const{options:n}=c;if(i&&!n.decompress){e.body=e.rawBody}else{try{e.body=parseBody(e,n.responseType,n.parseJson,n.encoding)}catch(t){e.body=e.rawBody.toString();if(isResponseOk(e)){c._beforeError(t);return}}}try{const t=n.hooks.afterResponse;for(const[r,i]of t.entries()){e=await i(e,(async e=>{n.merge(e);n.prefixUrl="";if(e.url){n.url=e.url}n.hooks.afterResponse=n.hooks.afterResponse.slice(0,r);throw new RetryError(c)}));if(!(h.object(e)&&h.number(e.statusCode)&&!h.nullOrUndefined(e.body))){throw new TypeError("The `afterResponse` hook returned an invalid value")}}}catch(e){c._beforeError(e);return}r=e;if(!isResponseOk(e)){c._beforeError(new HTTPError(e));return}c.destroy();o(c.options.resolveBodyOnly?e.body:e)}));const onError=e=>{if(s.isCanceled){return}const{options:t}=c;if(e instanceof HTTPError&&!t.throwHttpErrors){const{response:t}=e;c.destroy();o(c.options.resolveBodyOnly?t.body:t);return}a(e)};c.once("error",onError);const d=c.options?.body;c.once("retry",((t,r)=>{e=undefined;const n=c.options.body;if(d===n&&h.nodeStream(n)){r.message="Cannot retry with consumed body stream";onError(r);return}i=c.options;makeRequest(t)}));proxyEvents(c,n,Ne);if(h.undefined(e)){void c.flush()}};makeRequest(0)}));s.on=(e,t)=>{n.on(e,t);return s};s.off=(e,t)=>{n.off(e,t);return s};const shortcut=e=>{const t=(async()=>{await s;const{options:t}=r.request;return parseBody(r,e,t.parseJson,t.encoding)})();Object.defineProperties(t,Object.getOwnPropertyDescriptors(s));return t};s.json=()=>{if(t.options){const{headers:e}=t.options;if(!t.writableFinished&&!("accept"in e)){e.accept="application/json"}}return shortcut("json")};s.buffer=()=>shortcut("buffer");s.text=()=>shortcut("text");return s}const delay=async e=>new Promise((t=>{setTimeout(t,e)}));const isGotInstance=e=>h.function_(e);const Oe=["get","post","put","patch","head","delete"];const create=e=>{e={options:new Options(undefined,undefined,e.options),handlers:[...e.handlers],mutableDefaults:e.mutableDefaults};Object.defineProperty(e,"mutableDefaults",{enumerable:true,configurable:false,writable:false});const got=(t,r,i=e.options)=>{const n=new Request(t,r,i);let s;const lastHandler=e=>{n.options=e;n._noPipe=!e.isStream;void n.flush();if(e.isStream){return n}if(!s){s=asPromise(n)}return s};let o=0;const iterateHandlers=t=>{const r=e.handlers[o++]??lastHandler;const i=r(t,iterateHandlers);if(h.promise(i)&&!n.options.isStream){if(!s){s=asPromise(n)}if(i!==s){const e=Object.getOwnPropertyDescriptors(s);for(const t in e){if(t in i){delete e[t]}}Object.defineProperties(i,e);i.cancel=s.cancel}}return i};return iterateHandlers(n.options)};got.extend=(...t)=>{const r=new Options(undefined,undefined,e.options);const i=[...e.handlers];let n;for(const e of t){if(isGotInstance(e)){r.merge(e.defaults.options);i.push(...e.defaults.handlers);n=e.defaults.mutableDefaults}else{r.merge(e);if(e.handlers){i.push(...e.handlers)}n=e.mutableDefaults}}return create({options:r,handlers:i,mutableDefaults:Boolean(n)})};const paginateEach=async function*(t,r){let i=new Options(t,r,e.options);i.resolveBodyOnly=false;const{pagination:n}=i;c.function_(n.transform);c.function_(n.shouldContinue);c.function_(n.filter);c.function_(n.paginate);c.number(n.countLimit);c.number(n.requestLimit);c.number(n.backoff);const s=[];let{countLimit:o}=n;let a=0;while(a<n.requestLimit){if(a!==0){await delay(n.backoff)}const e=await got(undefined,undefined,i);const t=await n.transform(e);const r=[];c.array(t);for(const e of t){if(n.filter({item:e,currentItems:r,allItems:s})){if(!n.shouldContinue({item:e,currentItems:r,allItems:s})){return}yield e;if(n.stackAllItems){s.push(e)}r.push(e);if(--o<=0){return}}}const l=n.paginate({response:e,currentItems:r,allItems:s});if(l===false){return}if(l===e.request.options){i=e.request.options}else{i.merge(l);c.any([h.urlInstance,h.undefined],l.url);if(l.url!==undefined){i.prefixUrl="";i.url=l.url}}a++}};got.paginate=paginateEach;got.paginate.all=async(e,t)=>{const r=[];for await(const i of paginateEach(e,t)){r.push(i)}return r};got.paginate.each=paginateEach;got.stream=(e,t)=>got(e,{...t,isStream:true});for(const e of Oe){got[e]=(t,r)=>got(t,{...r,method:e});got.stream[e]=(t,r)=>got(t,{...r,method:e,isStream:true})}if(!e.mutableDefaults){Object.freeze(e.handlers);e.options.freeze()}Object.defineProperty(got,"defaults",{value:e,writable:false,configurable:false,enumerable:true});return got};const Re=create;const ke={options:new Options,handlers:[],mutableDefaults:false};const Pe=Re(ke);const Le=Pe},2561:e=>{"use strict";e.exports={version:"3.10.0"}}};var t={};function __nccwpck_require__(r){var i=t[r];if(i!==undefined){return i.exports}var n=t[r]={id:r,loaded:false,exports:{}};var s=true;try{e[r].call(n.exports,n,n.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}n.loaded=true;return n.exports}(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:true});const t=__nccwpck_require__(4379);const i=__nccwpck_require__(8584);const n=__nccwpck_require__(8989);const s=new t.Option("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info");const o=new t.Option("-d,--deployments <path>","Path to the deployments folder");const a=new t.Option("--dry-run","Do not verify anything, just output the verifications that would be performed");const l=new t.Option("-n,--network <network name>","Network to verify").makeOptionMandatory();const u=new t.Option("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)");const c=new t.Option("-k,--api-key <key>","Scan API Key");const h=new t.Command("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',(e=>{try{const t=JSON.parse(e);if(!Array.isArray(t)){throw new Error(`Constructor arguments must be an array, got ${t}`)}return t}catch(e){throw new t.InvalidOptionArgumentError(`Malformed constructor arguments specified: ${e}`)}})).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},contracts:[{network:e.network,address:e.address,contractName:e.name,deployment:e.deployment,constructorArguments:e.arguments}]};try{await(0,i.verifyNonTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));const d=new t.Command("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",(e=>(e===null||e===void 0?void 0:e.trim())?e.split(",").map((e=>e.trim())):undefined)).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},filter:e.contracts};try{await(0,i.verifyTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));new t.Command("lz-verify-contract").description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(h).addCommand(d,{isDefault:true}).parseAsync()})();module.exports=r})();
26
+ `);const u=i.apiKey||getScanApiKeyFromEnv(r);if(!u){e.debug(`Could not find scan API key for network ${a.default.bold(r)}\n \nPlease provide the API key:\n\n- As an apiKey config parameter in ${r} config\n- As a SCAN_API_KEY_${r} enviornment variable\n- As a SCAN_API_KEY_${normalizeNetworkName(r)} enviornment variable`)}const c=i.browserUrl||getScanBrowserUrlFromEnv(r)||(0,n.tryGetScanBrowserUrlFromScanUrl)(l);if(!c){e.debug(`Could not find scan browser URL key for network ${a.default.bold(r)}\n\n Browser URL is used to display a link to the verified contract\n after successful verification.\n \n Please provide the browser URL:\n \n - As an browserUrl config parameter in ${r} config\n - As a SCAN_BROWSER_URL_${r} enviornment variable\n - As a SCAN_BROWSER_URL_${normalizeNetworkName(r)} enviornment variable`)}return{...t,[r]:{apiUrl:l,apiKey:u,browserUrl:c}}}),{});t.parseNetworksConfig=parseNetworksConfig;const getScanApiUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanBrowserUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_BROWSER_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_BROWSER_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanApiKeyFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_KEY_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_KEY_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const normalizeNetworkName=e=>e.toUpperCase().replaceAll("-","_")},7364:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createVerification=void 0;const n=r(3301);const s=r(824);const o=i(r(2361));const a=i(r(1391));class Verification extends o.default{constructor(e,t){super();this.props=e;this.logger=t}async verify(){try{this.logger.verbose(`Submitting verification for ${this.props.contractName} on address ${this.props.address} to ${this.props.apiUrl}`);const e=await this.__submit();this.logger.verbose(`Received response for ${this.props.contractName} on address ${this.props.address} to ${this.props.apiUrl}`);this.logger.verbose(JSON.stringify(e));if(isAlreadyVerifiedResult(e.result)){return{alreadyVerified:true}}if(e.status!==1){throw new Error(`Verification failed with result "${e.result}", status ${e.status} (${e.message})`)}const t=e.result;if(t==null){throw new Error(`Missing GUID from the response: ${e}`)}return await this.__poll(t)}catch(e){throw new Error(`Verification error: ${e}`)}}async __submit(){const e=createVerificationRequest(this.props);return await(0,s.retry)((async()=>{const t=await submitRequest(this.props.apiUrl,e);if(isApiRateLimitedResult(t.result)){throw new Error(`API Rate limit has been exceeded`)}return t}),3,(async(e,t)=>{this.emit("retry",e,t);await(0,s.sleep)(2e3)}))}async __poll(e){while(true){this.emit("poll",e);const t=await checkGuid(this.props.apiUrl,e);if(t.status===1)return{alreadyVerified:false};if(isAlreadyVerifiedResult(t.result))return{alreadyVerified:true};if(isPendingResult(t.result)){await(0,s.sleep)(1e4);continue}if(isApiRateLimitedResult(t.result)){await(0,s.sleep)(1e4);continue}throw new Error(`Verification failed with result "${t.result}", status ${t.status} (${t.message})`)}}}const createVerification=(e,t)=>new Verification(e,t);t.createVerification=createVerification;const isPendingResult=e=>!!(e===null||e===void 0?void 0:e.match(/Pending/gi));const isAlreadyVerifiedResult=e=>!!(e===null||e===void 0?void 0:e.match(/already verified/gi));const isApiRateLimitedResult=e=>!!(e===null||e===void 0?void 0:e.match(/rate/));const submitRequest=async(e,t)=>{try{const r=await(0,a.default)(e,{method:"POST",form:t,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return l.parse(r)}catch(e){throw new Error(`Failed to submit verification request: ${e}`)}};const checkGuid=async(e,t)=>{const r=new URL(e);r.searchParams.set("module","contract");r.searchParams.set("action","checkverifystatus");r.searchParams.set("guid",t);try{const e=await(0,a.default)(r).json();return l.parse(e)}catch(e){throw new Error(`Failed to check verification status: ${e}`)}};const createVerificationRequest=({apiKey:e,address:t,contractName:r,constructorArguments:i,compilerVersion:n,optimizerRuns:s=0,sourceCode:o,evmVersion:a,licenseType:l})=>{const u={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:t,contractname:r,compilerversion:`v${n}`,optimizationUsed:s>0?"1":"0",sourceCode:o};if(e!=null)u.apikey=e;if(s!=null)u.runs=String(s);if(i!=null)u.constructorArguements=i;if(a!=null)u.evmversion=a;if(l!=null)u.licenseType=String(l);return u};const l=n.z.object({status:n.z.coerce.number().nullish(),message:n.z.string().nullish(),result:n.z.string().nullish()})},8194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isFile=t.isDirectory=void 0;const i=r(7147);const isDirectory=e=>{try{return(0,i.lstatSync)(e).isDirectory()}catch(e){return false}};t.isDirectory=isDirectory;const isFile=e=>{try{return(0,i.lstatSync)(e).isFile()}catch(e){return false}};t.isFile=isFile},4963:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findLicenseType=t.LicenseType=void 0;var r;(function(e){e[e["None"]=1]="None";e[e["Unlicense"]=2]="Unlicense";e[e["MIT"]=3]="MIT";e[e["GNU-GPLv2"]=4]="GNU-GPLv2";e[e["GNU-GPLv3"]=5]="GNU-GPLv3";e[e["GNU-LGPLv2.1"]=6]="GNU-LGPLv2.1";e[e["GNU-LGPLv3"]=7]="GNU-LGPLv3";e[e["BSD-2-Clause"]=8]="BSD-2-Clause";e[e["BSD-3-Clause"]=9]="BSD-3-Clause";e[e["MPL-2.0"]=10]="MPL-2.0";e[e["OSL-3.0"]=11]="OSL-3.0";e[e["Apache-2.0"]=12]="Apache-2.0";e[e["GNU-AGPLv3"]=13]="GNU-AGPLv3";e[e["BUSL-1.1"]=14]="BUSL-1.1"})(r||(t.LicenseType=r={}));const findLicenseType=e=>{const t=e.match(/\/\/\s*SPDX-License-Identifier\:\s*(.*)\s*/i);const i=t===null||t===void 0?void 0:t[1];if(i==null)return r.None;if(!(i in r)){console.warn("Found unknown SPDX license identifier: %s",i)}return r[i]};t.findLicenseType=findLicenseType},8989:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createRecordLogger=t.anonymizeValue=t.COLORS=t.createLogger=void 0;const n=i(r(8818));const s=i(r(4158));const createLogger=e=>s.default.createLogger({level:e,format:s.default.format.cli(),transports:[new s.default.transports.Console]});t.createLogger=createLogger;t.COLORS={default:n.default.white,error:n.default.red,success:n.default.green,palette:[n.default.magenta,n.default.cyan,n.default.yellow,n.default.blue,n.default.magentaBright,n.default.cyanBright,n.default.blueBright]};const anonymizeValue=e=>{const t=Math.min(Math.max(0,e.length-2),4);const r=e.length-t;const i=e.slice(0,t);const n=Array.from({length:r}).fill("*").join("");return`${i}${n}`};t.anonymizeValue=anonymizeValue;const createRecordLogger=(e,t="\t")=>r=>{e.info("");Object.entries(r).forEach((([r,i])=>{if(Array.isArray(i)){e.info(`${r}:`);i.forEach((r=>{e.info(`${t}\t- ${n.default.bold(formatLoggableValue(r))}`)}))}else{e.info(`${r}:${t}${n.default.bold(formatLoggableValue(i))}`)}}))};t.createRecordLogger=createRecordLogger;const formatLoggableValue=e=>{if(e==null)return"-";switch(typeof e){case"boolean":return e?o:a;default:return String(e)}};const o=t.COLORS.success`✓`;const a=t.COLORS.error`⚠`},824:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.retry=t.sleep=void 0;const n=i(r(9491));const sleep=e=>new Promise((t=>{setTimeout(t,e)}));t.sleep=sleep;const retry=async(e,t,r)=>{(0,n.default)(t>0,`Number of attempts for retry must be larger than 0, got ${t}`);for(let i=0;i<t-1;i++){try{return await e()}catch(e){await(r===null||r===void 0?void 0:r(e,i))}}return e()};t.retry=retry},2953:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DeploymentSchema=t.MetadataSchema=t.MinimalAbiSchema=t.SourcesSchema=t.OptimizerSchema=void 0;const i=r(3301);t.OptimizerSchema=i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()});t.SourcesSchema=i.z.record(i.z.string(),i.z.object({content:i.z.string()}));t.MinimalAbiSchema=i.z.array(i.z.record(i.z.string(),i.z.any()));t.MetadataSchema=i.z.object({language:i.z.string(),compiler:i.z.object({version:i.z.string()}),settings:i.z.object({compilationTarget:i.z.record(i.z.string(),i.z.string()),evmVersion:i.z.string(),optimizer:i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()})}),sources:i.z.record(i.z.string(),i.z.object({content:i.z.string()}))});t.DeploymentSchema=i.z.object({address:i.z.string(),abi:t.MinimalAbiSchema,args:i.z.array(i.z.any()),solcInputHash:i.z.string(),metadata:i.z.string().transform(((e,t)=>{try{return JSON.parse(e)}catch(e){t.addIssue({code:"custom",message:"Invalid JSON"});return i.z.NEVER}})).pipe(t.MetadataSchema),bytecode:i.z.string(),deployedBytecode:i.z.string()})},2413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.tryCreateScanContractUrl=t.tryGetScanBrowserUrlFromScanUrl=t.getDefaultScanApiUrl=void 0;const getDefaultScanApiUrl=e=>r.get(e);t.getDefaultScanApiUrl=getDefaultScanApiUrl;const tryGetScanBrowserUrlFromScanUrl=e=>{try{const t=new URL(e);if(!t.hostname.startsWith("api.")&&!t.hostname.startsWith("api-"))return undefined;t.hostname=t.hostname.replace(/^api[.-]/,"");t.pathname="/";return t.toString()}catch(e){return undefined}};t.tryGetScanBrowserUrlFromScanUrl=tryGetScanBrowserUrlFromScanUrl;const tryCreateScanContractUrl=(e,t)=>{try{const r=new URL(e);r.pathname=`/address/${t}`;return r.toString()}catch(e){return undefined}};t.tryCreateScanContractUrl=tryCreateScanContractUrl;const r=new Map([["avalanche","https://api.snowtrace.io/api"],["avalanche-mainnet","https://api.snowtrace.io/api"],["fuji","https://api-testnet.snowtrace.io/api"],["avalanche-testnet","https://api-testnet.snowtrace.io/api"],["arbitrum","https://api.arbiscan.io/api"],["arbitrum-goerli","https://api-goerli.arbiscan.io/api"],["bsc","https://api.bscscan.com/api"],["bsc-testnet","https://api-testnet.bscscan.com/api"],["ethereum","https://api.etherscan.io/api"],["ethereum-goerli","https://api-goerli.etherscan.io/api"],["goerli","https://api-goerli.etherscan.io/api"],["fantom","https://api.ftmscan.com/api"],["fantom-testnet","https://api-testnet.ftmscan.com/api"],["kava","https://kavascan.com/api"],["kava-mainnet","https://kavascan.com/api"],["kava-testnet","https://testnet.kavascan.com/api"],["polygon","https://api.polygonscan.com/api"],["mumbai","https://api-testnet.polygonscan.com/api"],["optimism","https://api-optimistic.etherscan.io/api"],["optimism-goerli","https://api-goerli-optimistic.etherscan.io/api"],["gnosis","https://api.gnosisscan.io/api"],["zkpolygon","https://api-zkevm.polygonscan.com/api"],["zkpolygon-mainnet","https://api-zkevm.polygonscan.com/api"],["base","https://api.basescan.org/api"],["base-mainnet","https://api.basescan.org/api"],["base-goerli","https://api-goerli.basescan.org/api"],["linea","https://api.lineascan.build/api"],["linea-mainnet","https://api.lineascan.build/api"],["zkconsensys","https://api.lineascan.build/api"],["zkconsensys-mainnet","https://api.lineascan.build/api"],["moonbeam","https://api-moonbeam.moonscan.io/api"],["moonbeam-testnet","https://api-moonbase.moonscan.io/api"]])},4367:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseFilterConfig=t.parsePathsConfig=void 0;const n=i(r(1017));const parsePathsConfig=e=>{var t;return{deployments:(t=e===null||e===void 0?void 0:e.deployments)!==null&&t!==void 0?t:n.default.resolve(process.cwd(),"deployments")}};t.parsePathsConfig=parsePathsConfig;const parseFilterConfig=e=>{if(e==null)return()=>true;switch(typeof e){case"boolean":return()=>e;case"string":return t=>t===e;case"function":return e;case"object":if(Array.isArray(e)){const t=new Set(e);return e=>t.has(e)}if(e instanceof RegExp){return t=>e.test(t)}default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${e}`)}};t.parseFilterConfig=parseFilterConfig},2066:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extractSolcInputFromMetadata=void 0;const extractSolcInputFromMetadata=e=>{const{compilationTarget:t,...r}=e.settings;const i=Object.entries(e.sources).reduce(((e,[t,r])=>({...e,[t]:{content:r.content}})),{});return{language:e.language,settings:r,sources:i}};t.extractSolcInputFromMetadata=extractSolcInputFromMetadata},8584:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.verifyTarget=t.verifyNonTarget=void 0;const n=r(6348);const s=r(1017);const o=r(4963);const a=r(7364);const l=i(r(8818));const u=r(8989);const c=r(2413);const h=r(2953);const d=r(2066);const p=r(3718);const m=r(4367);const g=r(8194);const y=r(7147);const verifyNonTarget=async(e,t)=>{const r=(0,n.parseNetworksConfig)(t,e.networks);const i=(0,m.parsePathsConfig)(e.paths);const a=(0,u.createRecordLogger)(t);const l=createVerifyAll(t);const c=createLogVerificationResult(a);const y=e.contracts.flatMap((e=>{var n;const{address:l,network:c,contractName:m,deployment:y}=e;t.info(`Collectiong information for contract ${m} on network ${c}`);const _=r[c];if(_==null){t.info(`No network configured for contract ${m} on network ${c}`);return[]}const v=`${(0,s.basename)(y,".json")}.json`;const b=(0,s.resolve)(i.deployments,c,v);if(!(0,g.isFile)(b)){t.error(u.COLORS.error`Deployment file ${b} does not exist or is not a file`);return[]}const x=require(b);const T=h.DeploymentSchema.safeParse(x);if(!T.success){t.error(u.COLORS.error`No network configured for contract ${m} on network ${c}`);return[]}const w=T.data;const S=(0,s.basename)(m,".sol");const E=w.metadata.sources[m];if(E==null){t.error(u.COLORS.error`Missing source for contract ${m} for network ${c} in ${v}`);return[]}const A=(0,o.findLicenseType)(E.content);const C=(0,p.getContructorABIFromSource)(E.content);const N=(0,p.encodeContructorArguments)(C,e.constructorArguments);const O=(0,d.extractSolcInputFromMetadata)(w.metadata);const R={apiUrl:_.apiUrl,apiKey:_.apiKey,address:l,contractName:`${m}:${S}`,constructorArguments:N,licenseType:A,compilerVersion:w.metadata.compiler.version,sourceCode:JSON.stringify(O),evmVersion:w.metadata.settings.evmVersion,optimizerRuns:(n=w.metadata.settings.optimizer)===null||n===void 0?void 0:n.runs};a({Contract:m,Network:c,Address:R.address,License:R.licenseType,Arguments:e.constructorArguments?JSON.stringify(e.constructorArguments):undefined,Sources:Object.keys(w.metadata.sources),"Scan URL":R.apiUrl,"Scan API Key":R.apiKey?(0,u.anonymizeValue)(R.apiKey):undefined});return[{networkName:c,networkConfig:_,submitProps:R}]}));if(y.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const _=await Promise.all(l(y));_.forEach(c);return _};t.verifyNonTarget=verifyNonTarget;const verifyTarget=async(e,t)=>{const r=(0,m.parseFilterConfig)(e.filter);const i=(0,n.parseNetworksConfig)(t,e.networks);const a=(0,m.parsePathsConfig)(e.paths);const l=(0,u.createRecordLogger)(t);const c=createVerifyAll(t);const _=createLogVerificationResult(l);if(!(0,g.isDirectory)(a.deployments)){throw new Error(`Path ${a.deployments} is not a directory`)}const v=new Set((0,y.readdirSync)(a.deployments));const b=Object.entries(i);t.debug("Verifying deployments for following networks:");b.forEach((([e,r])=>{t.debug(`\t\t- ${e} (API URL ${r.apiUrl})`)}));const x=b.flatMap((([e,i])=>{t.info(`Collecting deployments for ${e}...`);if(!v.has(e)){t.warn(`Could not find deployment for network ${e} in ${a.deployments}`);return[]}const n=(0,s.resolve)(a.deployments,e);const c=(0,y.readdirSync)(n).filter((e=>e.endsWith(".json")));return c.flatMap((a=>{t.info(`Inspecting deployment file ${a} on network ${e}`);const c=(0,s.resolve)(n,a);const m=require(c);const g=h.DeploymentSchema.safeParse(m);if(!g.success){throw new Error(`Error parsing deployment file ${a} on network ${e}: ${g.error}`)}const y=g.data;const _=(0,s.basename)(a,".json");const v=y.metadata.settings.compilationTarget;return Object.entries(v).flatMap((([n,s])=>{var c;const h=r(s,n,e);if(!h){t.debug(`Not verifying ${s} in ${a} on network ${e}`);return[]}const m=y.metadata.sources[n];if(m==null){t.error(u.COLORS.error`Could not find source for ${s} (${n})`);return[]}const g=(0,o.findLicenseType)(m.content);const _=(0,p.encodeContructorArguments)(y.abi,y.args);const v=(0,d.extractSolcInputFromMetadata)(y.metadata);const b={apiUrl:i.apiUrl,apiKey:i.apiKey,address:y.address,contractName:`${n}:${s}`,constructorArguments:_,licenseType:g,compilerVersion:y.metadata.compiler.version,sourceCode:JSON.stringify(v),evmVersion:y.metadata.settings.evmVersion,optimizerRuns:(c=y.metadata.settings.optimizer)===null||c===void 0?void 0:c.runs};l({Contract:s,Network:e,Address:y.address,License:b.licenseType,Arguments:JSON.stringify(y.args),Sources:Object.keys(y.metadata.sources),"Scan URL":b.apiUrl,"Scan API Key":b.apiKey?(0,u.anonymizeValue)(b.apiKey):undefined});return{submitProps:b,networkName:e,networkConfig:i}}))}))}));if(x.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const T=await Promise.all(c(x));T.forEach(_);return T};t.verifyTarget=verifyTarget;const createVerifyAll=e=>t=>t.map((async(r,i)=>{const{submitProps:n}=r;const s=u.COLORS.palette[i%u.COLORS.palette.length];const o=`[${i+1}/${t.length}]`;const c=l.default.bold(n.contractName);const h=l.default.bold(r.networkName);e.info(s`Verifying contract ${c} for network ${h} ${o}`);try{const t=(0,a.createVerification)(n,e);t.on("poll",(t=>{e.info(s`Polling for verification status of ${c} for network ${h} (GUID ${t}) ${o}`)}));t.on("retry",((t,r)=>{e.verbose(`Received an error: ${t}`);e.info(s`Retrying failed verification attempt of ${c} for network ${h} (attempt ${r+1}) ${o}`)}));const i=await t.verify();return{artifact:r,result:i}}catch(t){e.error(u.COLORS.error`Problem verifying contract ${c} for network ${h} ${o}: ${t} `);return{artifact:r,error:t}}}));const createLogVerificationResult=e=>({artifact:t,response:r,error:i})=>{const n=l.default.bold(t.submitProps.contractName);const s=l.default.bold(t.networkName);const o=t.networkConfig.browserUrl?(0,c.tryCreateScanContractUrl)(t.networkConfig.browserUrl,t.submitProps.address):undefined;e({Contract:n,Network:s,Result:i==null,"Was verified":r===null||r===void 0?void 0:r.alreadyVerified,"Contract URL":o,Error:i?u.COLORS.error(i):undefined})}},9491:e=>{"use strict";e.exports=require("assert")},4300:e=>{"use strict";e.exports=require("buffer")},2081:e=>{"use strict";e.exports=require("child_process")},2361:e=>{"use strict";e.exports=require("events")},7147:e=>{"use strict";e.exports=require("fs")},3685:e=>{"use strict";e.exports=require("http")},5158:e=>{"use strict";e.exports=require("http2")},5687:e=>{"use strict";e.exports=require("https")},1808:e=>{"use strict";e.exports=require("net")},2037:e=>{"use strict";e.exports=require("os")},1017:e=>{"use strict";e.exports=require("path")},7282:e=>{"use strict";e.exports=require("process")},2781:e=>{"use strict";e.exports=require("stream")},1576:e=>{"use strict";e.exports=require("string_decoder")},4404:e=>{"use strict";e.exports=require("tls")},6224:e=>{"use strict";e.exports=require("tty")},7310:e=>{"use strict";e.exports=require("url")},3837:e=>{"use strict";e.exports=require("util")},9796:e=>{"use strict";e.exports=require("zlib")},4379:(e,t,r)=>{const{Argument:i}=r(9414);const{Command:n}=r(552);const{CommanderError:s,InvalidArgumentError:o}=r(2625);const{Help:a}=r(5153);const{Option:l}=r(6558);t=e.exports=new n;t.program=t;t.Argument=i;t.Command=n;t.CommanderError=s;t.Help=a;t.InvalidArgumentError=o;t.InvalidOptionArgumentError=o;t.Option=l},9414:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Argument{constructor(e,t){this.description=t||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(e[0]){case"<":this.required=true;this._name=e.slice(1,-1);break;case"[":this.required=false;this._name=e.slice(1,-1);break;default:this.required=true;this._name=e;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}argParser(e){this.parseArg=e;return this}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(e){const t=e.name()+(e.variadic===true?"...":"");return e.required?"<"+t+">":"["+t+"]"}t.Argument=Argument;t.humanReadableArgName=humanReadableArgName},552:(e,t,r)=>{const i=r(2361).EventEmitter;const n=r(2081);const s=r(1017);const o=r(7147);const a=r(7282);const{Argument:l,humanReadableArgName:u}=r(9414);const{CommanderError:c}=r(2625);const{Help:h}=r(5153);const{Option:d,splitOptionFlags:p,DualOptions:m}=r(6558);const{suggestSimilar:g}=r(7592);class Command extends i{constructor(e){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this._args=[];this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=e||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:undefined,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:undefined,outputError:(e,t)=>t(e)};this._hidden=false;this._hasHelpOption=true;this._helpFlags="-h, --help";this._helpDescription="display help for command";this._helpShortFlag="-h";this._helpLongFlag="--help";this._addImplicitHelpCommand=undefined;this._helpCommandName="help";this._helpCommandnameAndArgs="help [command]";this._helpCommandDescription="display help for command";this._helpConfiguration={}}copyInheritedSettings(e){this._outputConfiguration=e._outputConfiguration;this._hasHelpOption=e._hasHelpOption;this._helpFlags=e._helpFlags;this._helpDescription=e._helpDescription;this._helpShortFlag=e._helpShortFlag;this._helpLongFlag=e._helpLongFlag;this._helpCommandName=e._helpCommandName;this._helpCommandnameAndArgs=e._helpCommandnameAndArgs;this._helpCommandDescription=e._helpCommandDescription;this._helpConfiguration=e._helpConfiguration;this._exitCallback=e._exitCallback;this._storeOptionsAsProperties=e._storeOptionsAsProperties;this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue;this._allowExcessArguments=e._allowExcessArguments;this._enablePositionalOptions=e._enablePositionalOptions;this._showHelpAfterError=e._showHelpAfterError;this._showSuggestionAfterError=e._showSuggestionAfterError;return this}command(e,t,r){let i=t;let n=r;if(typeof i==="object"&&i!==null){n=i;i=null}n=n||{};const[,s,o]=e.match(/([^ ]+) *(.*)/);const a=this.createCommand(s);if(i){a.description(i);a._executableHandler=true}if(n.isDefault)this._defaultCommandName=a._name;a._hidden=!!(n.noHelp||n.hidden);a._executableFile=n.executableFile||null;if(o)a.arguments(o);this.commands.push(a);a.parent=this;a.copyInheritedSettings(this);if(i)return this;return a}createCommand(e){return new Command(e)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(e){if(e===undefined)return this._helpConfiguration;this._helpConfiguration=e;return this}configureOutput(e){if(e===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,e);return this}showHelpAfterError(e=true){if(typeof e!=="string")e=!!e;this._showHelpAfterError=e;return this}showSuggestionAfterError(e=true){this._showSuggestionAfterError=!!e;return this}addCommand(e,t){if(!e._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}t=t||{};if(t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=true;this.commands.push(e);e.parent=this;return this}createArgument(e,t){return new l(e,t)}argument(e,t,r,i){const n=this.createArgument(e,t);if(typeof r==="function"){n.default(i).argParser(r)}else{n.default(r)}this.addArgument(n);return this}arguments(e){e.trim().split(/ +/).forEach((e=>{this.argument(e)}));return this}addArgument(e){const t=this._args.slice(-1)[0];if(t&&t.variadic){throw new Error(`only the last argument can be variadic '${t.name()}'`)}if(e.required&&e.defaultValue!==undefined&&e.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${e.name()}'`)}this._args.push(e);return this}addHelpCommand(e,t){if(e===false){this._addImplicitHelpCommand=false}else{this._addImplicitHelpCommand=true;if(typeof e==="string"){this._helpCommandName=e.split(" ")[0];this._helpCommandnameAndArgs=e}this._helpCommandDescription=t||this._helpCommandDescription}return this}_hasImplicitHelpCommand(){if(this._addImplicitHelpCommand===undefined){return this.commands.length&&!this._actionHandler&&!this._findCommand("help")}return this._addImplicitHelpCommand}hook(e,t){const r=["preSubcommand","preAction","postAction"];if(!r.includes(e)){throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${r.join("', '")}'`)}if(this._lifeCycleHooks[e]){this._lifeCycleHooks[e].push(t)}else{this._lifeCycleHooks[e]=[t]}return this}exitOverride(e){if(e){this._exitCallback=e}else{this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync"){throw e}else{}}}return this}_exit(e,t,r){if(this._exitCallback){this._exitCallback(new c(e,t,r))}a.exit(e)}action(e){const listener=t=>{const r=this._args.length;const i=t.slice(0,r);if(this._storeOptionsAsProperties){i[r]=this}else{i[r]=this.opts()}i.push(this);return e.apply(this,i)};this._actionHandler=listener;return this}createOption(e,t){return new d(e,t)}addOption(e){const t=e.name();const r=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");if(!this._findOption(t)){this.setOptionValueWithSource(r,e.defaultValue===undefined?true:e.defaultValue,"default")}}else if(e.defaultValue!==undefined){this.setOptionValueWithSource(r,e.defaultValue,"default")}this.options.push(e);const handleOptionValue=(t,i,n)=>{if(t==null&&e.presetArg!==undefined){t=e.presetArg}const s=this.getOptionValue(r);if(t!==null&&e.parseArg){try{t=e.parseArg(t,s)}catch(e){if(e.code==="commander.invalidArgument"){const t=`${i} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}else if(t!==null&&e.variadic){t=e._concatValue(t,s)}if(t==null){if(e.negate){t=false}else if(e.isBoolean()||e.optional){t=true}else{t=""}}this.setOptionValueWithSource(r,t,n)};this.on("option:"+t,(t=>{const r=`error: option '${e.flags}' argument '${t}' is invalid.`;handleOptionValue(t,r,"cli")}));if(e.envVar){this.on("optionEnv:"+t,(t=>{const r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;handleOptionValue(t,r,"env")}))}return this}_optionEx(e,t,r,i,n){if(typeof t==="object"&&t instanceof d){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const s=this.createOption(t,r);s.makeOptionMandatory(!!e.mandatory);if(typeof i==="function"){s.default(n).argParser(i)}else if(i instanceof RegExp){const e=i;i=(t,r)=>{const i=e.exec(t);return i?i[0]:r};s.default(n).argParser(i)}else{s.default(i)}return this.addOption(s)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:true},e,t,r,i)}combineFlagAndOptionalValue(e=true){this._combineFlagAndOptionalValue=!!e;return this}allowUnknownOption(e=true){this._allowUnknownOption=!!e;return this}allowExcessArguments(e=true){this._allowExcessArguments=!!e;return this}enablePositionalOptions(e=true){this._enablePositionalOptions=!!e;return this}passThroughOptions(e=true){this._passThroughOptions=!!e;if(!!this.parent&&e&&!this.parent._enablePositionalOptions){throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)")}return this}storeOptionsAsProperties(e=true){this._storeOptionsAsProperties=!!e;if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}return this}getOptionValue(e){if(this._storeOptionsAsProperties){return this[e]}return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,undefined)}setOptionValueWithSource(e,t,r){if(this._storeOptionsAsProperties){this[e]=t}else{this._optionValues[e]=t}this._optionValueSources[e]=r;return this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;getCommandAndParents(this).forEach((r=>{if(r.getOptionValueSource(e)!==undefined){t=r.getOptionValueSource(e)}}));return t}_prepareUserArgs(e,t){if(e!==undefined&&!Array.isArray(e)){throw new Error("first parameter to parse must be array or undefined")}t=t||{};if(e===undefined){e=a.argv;if(a.versions&&a.versions.electron){t.from="electron"}}this.rawArgs=e.slice();let r;switch(t.from){case undefined:case"node":this._scriptPath=e[1];r=e.slice(2);break;case"electron":if(a.defaultApp){this._scriptPath=e[1];r=e.slice(2)}else{r=e.slice(1)}break;case"user":r=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return r}parse(e,t){const r=this._prepareUserArgs(e,t);this._parseCommand([],r);return this}async parseAsync(e,t){const r=this._prepareUserArgs(e,t);await this._parseCommand([],r);return this}_executeSubCommand(e,t){t=t.slice();let r=false;const i=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(e,t){const r=s.resolve(e,t);if(o.existsSync(r))return r;if(i.includes(s.extname(t)))return undefined;const n=i.find((e=>o.existsSync(`${r}${e}`)));if(n)return`${r}${n}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let l=e._executableFile||`${this._name}-${e._name}`;let u=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}u=s.resolve(s.dirname(e),u)}if(u){let t=findFile(u,l);if(!t&&!e._executableFile&&this._scriptPath){const r=s.basename(this._scriptPath,s.extname(this._scriptPath));if(r!==this._name){t=findFile(u,`${r}-${e._name}`)}}l=t||l}r=i.includes(s.extname(l));let h;if(a.platform!=="win32"){if(r){t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.argv[0],t,{stdio:"inherit"})}else{h=n.spawn(l,t,{stdio:"inherit"})}}else{t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.execPath,t,{stdio:"inherit"})}if(!h.killed){const e=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];e.forEach((e=>{a.on(e,(()=>{if(h.killed===false&&h.exitCode===null){h.kill(e)}}))}))}const d=this._exitCallback;if(!d){h.on("close",a.exit.bind(a))}else{h.on("close",(()=>{d(new c(a.exitCode||0,"commander.executeSubCommandAsync","(close)"))}))}h.on("error",(t=>{if(t.code==="ENOENT"){const t=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const r=`'${l}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(r)}else if(t.code==="EACCES"){throw new Error(`'${l}' not executable`)}if(!d){a.exit(1)}else{const e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t;d(e)}}));this.runningCommand=h}_dispatchSubcommand(e,t,r){const i=this._findCommand(e);if(!i)this.help({error:true});let n;n=this._chainOrCallSubCommandHook(n,i,"preSubcommand");n=this._chainOrCall(n,(()=>{if(i._executableHandler){this._executeSubCommand(i,t.concat(r))}else{return i._parseCommand(t,r)}}));return n}_dispatchHelpCommand(e){if(!e){this.help()}const t=this._findCommand(e);if(t&&!t._executableHandler){t.help()}return this._dispatchSubcommand(e,[],[this._helpLongFlag])}_checkNumberOfArguments(){this._args.forEach(((e,t)=>{if(e.required&&this.args[t]==null){this.missingArgument(e.name())}}));if(this._args.length>0&&this._args[this._args.length-1].variadic){return}if(this.args.length>this._args.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(e,t,r)=>{let i=t;if(t!==null&&e.parseArg){try{i=e.parseArg(t,r)}catch(r){if(r.code==="commander.invalidArgument"){const i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'. ${r.message}`;this.error(i,{exitCode:r.exitCode,code:r.code})}throw r}}return i};this._checkNumberOfArguments();const e=[];this._args.forEach(((t,r)=>{let i=t.defaultValue;if(t.variadic){if(r<this.args.length){i=this.args.slice(r);if(t.parseArg){i=i.reduce(((e,r)=>myParseArg(t,r,e)),t.defaultValue)}}else if(i===undefined){i=[]}}else if(r<this.args.length){i=this.args[r];if(t.parseArg){i=myParseArg(t,i,t.defaultValue)}}e[r]=i}));this.processedArgs=e}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function"){return e.then((()=>t()))}return t()}_chainOrCallHooks(e,t){let r=e;const i=[];getCommandAndParents(this).reverse().filter((e=>e._lifeCycleHooks[t]!==undefined)).forEach((e=>{e._lifeCycleHooks[t].forEach((t=>{i.push({hookedCommand:e,callback:t})}))}));if(t==="postAction"){i.reverse()}i.forEach((e=>{r=this._chainOrCall(r,(()=>e.callback(e.hookedCommand,this)))}));return r}_chainOrCallSubCommandHook(e,t,r){let i=e;if(this._lifeCycleHooks[r]!==undefined){this._lifeCycleHooks[r].forEach((e=>{i=this._chainOrCall(i,(()=>e(this,t)))}))}return i}_parseCommand(e,t){const r=this.parseOptions(t);this._parseOptionsEnv();this._parseOptionsImplied();e=e.concat(r.operands);t=r.unknown;this.args=e.concat(t);if(e&&this._findCommand(e[0])){return this._dispatchSubcommand(e[0],e.slice(1),t)}if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName){return this._dispatchHelpCommand(e[1])}if(this._defaultCommandName){outputHelpIfRequested(this,t);return this._dispatchSubcommand(this._defaultCommandName,e,t)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}outputHelpIfRequested(this,r.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(r.unknown.length>0){this.unknownOption(r.unknown[0])}};const i=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let r;r=this._chainOrCallHooks(r,"preAction");r=this._chainOrCall(r,(()=>this._actionHandler(this.processedArgs)));if(this.parent){r=this._chainOrCall(r,(()=>{this.parent.emit(i,e,t)}))}r=this._chainOrCallHooks(r,"postAction");return r}if(this.parent&&this.parent.listenerCount(i)){checkForUnknownOptions();this._processArguments();this.parent.emit(i,e,t)}else if(e.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",e,t)}if(this.listenerCount("command:*")){this.emit("command:*",e,t)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(e){if(!e)return undefined;return this.commands.find((t=>t._name===e||t._aliases.includes(e)))}_findOption(e){return this.options.find((t=>t.is(e)))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent){e.options.forEach((t=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===undefined){e.missingMandatoryOptionValue(t)}}))}}_checkForConflictingLocalOptions(){const e=this.options.filter((e=>{const t=e.attributeName();if(this.getOptionValue(t)===undefined){return false}return this.getOptionValueSource(t)!=="default"}));const t=e.filter((e=>e.conflictsWith.length>0));t.forEach((t=>{const r=e.find((e=>t.conflictsWith.includes(e.attributeName())));if(r){this._conflictingOption(t,r)}}))}_checkForConflictingOptions(){for(let e=this;e;e=e.parent){e._checkForConflictingLocalOptions()}}parseOptions(e){const t=[];const r=[];let i=t;const n=e.slice();function maybeOption(e){return e.length>1&&e[0]==="-"}let s=null;while(n.length){const e=n.shift();if(e==="--"){if(i===r)i.push(e);i.push(...n);break}if(s&&!maybeOption(e)){this.emit(`option:${s.name()}`,e);continue}s=null;if(maybeOption(e)){const t=this._findOption(e);if(t){if(t.required){const e=n.shift();if(e===undefined)this.optionMissingArgument(t);this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;if(n.length>0&&!maybeOption(n[0])){e=n.shift()}this.emit(`option:${t.name()}`,e)}else{this.emit(`option:${t.name()}`)}s=t.variadic?t:null;continue}}if(e.length>2&&e[0]==="-"&&e[1]!=="-"){const t=this._findOption(`-${e[1]}`);if(t){if(t.required||t.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${t.name()}`,e.slice(2))}else{this.emit(`option:${t.name()}`);n.unshift(`-${e.slice(2)}`)}continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("=");const r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(maybeOption(e)){i=r}if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(e)){t.push(e);if(n.length>0)r.push(...n);break}else if(e===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(e);if(n.length>0)t.push(...n);break}else if(this._defaultCommandName){r.push(e);if(n.length>0)r.push(...n);break}}if(this._passThroughOptions){i.push(e);if(n.length>0)i.push(...n);break}i.push(e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){const e={};const t=this.options.length;for(let r=0;r<t;r++){const t=this.options[r].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return getCommandAndParents(this).reduce(((e,t)=>Object.assign(e,t.opts())),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const r=t||{};const i=r.exitCode||1;const n=r.code||"commander.error";this._exit(i,n,e)}_parseOptionsEnv(){this.options.forEach((e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();if(this.getOptionValue(t)===undefined||["default","config","env"].includes(this.getOptionValueSource(t))){if(e.required||e.optional){this.emit(`optionEnv:${e.name()}`,a.env[e.envVar])}else{this.emit(`optionEnv:${e.name()}`)}}}}))}_parseOptionsImplied(){const e=new m(this.options);const hasCustomOptionValue=e=>this.getOptionValue(e)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter((t=>t.implied!==undefined&&hasCustomOptionValue(t.attributeName())&&e.valueFromOption(this.getOptionValue(t.attributeName()),t))).forEach((e=>{Object.keys(e.implied).filter((e=>!hasCustomOptionValue(e))).forEach((t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")}))}))}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const findBestOptionFromValue=e=>{const t=e.attributeName();const r=this.getOptionValue(t);const i=this.options.find((e=>e.negate&&t===e.attributeName()));const n=this.options.find((e=>!e.negate&&t===e.attributeName()));if(i&&(i.presetArg===undefined&&r===false||i.presetArg!==undefined&&r===i.presetArg)){return i}return n||e};const getErrorMessage=e=>{const t=findBestOptionFromValue(e);const r=t.attributeName();const i=this.getOptionValueSource(r);if(i==="env"){return`environment variable '${t.envVar}'`}return`option '${t.flags}'`};const r=`error: ${getErrorMessage(e)} cannot be used with ${getErrorMessage(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[];let i=this;do{const e=i.createHelp().visibleOptions(i).filter((e=>e.long)).map((e=>e.long));r=r.concat(e);i=i.parent}while(i&&!i._enablePositionalOptions);t=g(e,r)}const r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this._args.length;const r=t===1?"":"s";const i=this.parent?` for '${this.name()}'`:"";const n=`error: too many arguments${i}. Expected ${t} argument${r} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const r=[];this.createHelp().visibleCommands(this).forEach((e=>{r.push(e.name());if(e.alias())r.push(e.alias())}));t=g(e,r)}const r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===undefined)return this._version;this._version=e;t=t||"-V, --version";r=r||"output the version number";const i=this.createOption(t,r);this._versionOptionName=i.attributeName();this.options.push(i);this.on("option:"+i.name(),(()=>{this._outputConfiguration.writeOut(`${e}\n`);this._exit(0,"commander.version",e)}));return this}description(e,t){if(e===undefined&&t===undefined)return this._description;this._description=e;if(t){this._argsDescription=t}return this}summary(e){if(e===undefined)return this._summary;this._summary=e;return this}alias(e){if(e===undefined)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){t=this.commands[this.commands.length-1]}if(e===t._name)throw new Error("Command alias can't be the same as its name");t._aliases.push(e);return this}aliases(e){if(e===undefined)return this._aliases;e.forEach((e=>this.alias(e)));return this}usage(e){if(e===undefined){if(this._usage)return this._usage;const e=this._args.map((e=>u(e)));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}this._usage=e;return this}name(e){if(e===undefined)return this._name;this._name=e;return this}nameFromFilename(e){this._name=s.basename(e,s.extname(e));return this}executableDir(e){if(e===undefined)return this._executableDir;this._executableDir=e;return this}helpInformation(e){const t=this.createHelp();if(t.helpWidth===undefined){t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};const t={error:!!e.error};let r;if(t.error){r=e=>this._outputConfiguration.writeErr(e)}else{r=e=>this._outputConfiguration.writeOut(e)}t.write=e.write||r;t.command=this;return t}outputHelp(e){let t;if(typeof e==="function"){t=e;e=undefined}const r=this._getHelpContext(e);getCommandAndParents(this).reverse().forEach((e=>e.emit("beforeAllHelp",r)));this.emit("beforeHelp",r);let i=this.helpInformation(r);if(t){i=t(i);if(typeof i!=="string"&&!Buffer.isBuffer(i)){throw new Error("outputHelp callback must return a string or a Buffer")}}r.write(i);this.emit(this._helpLongFlag);this.emit("afterHelp",r);getCommandAndParents(this).forEach((e=>e.emit("afterAllHelp",r)))}helpOption(e,t){if(typeof e==="boolean"){this._hasHelpOption=e;return this}this._helpFlags=e||this._helpFlags;this._helpDescription=t||this._helpDescription;const r=p(this._helpFlags);this._helpShortFlag=r.shortFlag;this._helpLongFlag=r.longFlag;return this}help(e){this.outputHelp(e);let t=a.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error){t=1}this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const r=["beforeAll","before","after","afterAll"];if(!r.includes(e)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${r.join("', '")}'`)}const i=`${e}Help`;this.on(i,(e=>{let r;if(typeof t==="function"){r=t({error:e.error,command:e.command})}else{r=t}if(r){e.write(`${r}\n`)}}));return this}}function outputHelpIfRequested(e,t){const r=e._hasHelpOption&&t.find((t=>t===e._helpLongFlag||t===e._helpShortFlag));if(r){e.outputHelp();e._exit(0,"commander.helpDisplayed","(outputHelp)")}}function incrementNodeInspectorPort(e){return e.map((e=>{if(!e.startsWith("--inspect")){return e}let t;let r="127.0.0.1";let i="9229";let n;if((n=e.match(/^(--inspect(-brk)?)$/))!==null){t=n[1]}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){t=n[1];if(/^\d+$/.test(n[3])){i=n[3]}else{r=n[3]}}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){t=n[1];r=n[3];i=n[4]}if(t&&i!=="0"){return`${t}=${r}:${parseInt(i)+1}`}return e}))}function getCommandAndParents(e){const t=[];for(let r=e;r;r=r.parent){t.push(r)}return t}t.Command=Command},2625:(e,t)=>{class CommanderError extends Error{constructor(e,t,r){super(r);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=t;this.exitCode=e;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}t.CommanderError=CommanderError;t.InvalidArgumentError=InvalidArgumentError},5153:(e,t,r)=>{const{humanReadableArgName:i}=r(9414);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(e){const t=e.commands.filter((e=>!e._hidden));if(e._hasImplicitHelpCommand()){const[,r,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);const n=e.createCommand(r).helpOption(false);n.description(e._helpCommandDescription);if(i)n.arguments(i);t.push(n)}if(this.sortSubcommands){t.sort(((e,t)=>e.name().localeCompare(t.name())))}return t}compareOptions(e,t){const getSortKey=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return getSortKey(e).localeCompare(getSortKey(t))}visibleOptions(e){const t=e.options.filter((e=>!e.hidden));const r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag);const i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||i){let n;if(!r){n=e.createOption(e._helpLongFlag,e._helpDescription)}else if(!i){n=e.createOption(e._helpShortFlag,e._helpDescription)}else{n=e.createOption(e._helpFlags,e._helpDescription)}t.push(n)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let r=e.parent;r;r=r.parent){const e=r.options.filter((e=>!e.hidden));t.push(...e)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleArguments(e){if(e._argsDescription){e._args.forEach((t=>{t.description=t.description||e._argsDescription[t.name()]||""}))}if(e._args.find((e=>e.description))){return e._args}return[]}subcommandTerm(e){const t=e._args.map((e=>i(e))).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce(((e,r)=>Math.max(e,t.subcommandTerm(r).length)),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce(((e,r)=>Math.max(e,t.argumentTerm(r).length)),0)}commandUsage(e){let t=e._name;if(e._aliases[0]){t=t+"|"+e._aliases[0]}let r="";for(let t=e.parent;t;t=t.parent){r=t.name()+" "+r}return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){const r=e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean";if(r){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}}if(e.presetArg!==undefined&&e.optional){t.push(`preset: ${JSON.stringify(e.presetArg)}`)}if(e.envVar!==undefined){t.push(`env: ${e.envVar}`)}if(t.length>0){return`${e.description} (${t.join(", ")})`}return e.description}argumentDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(t.length>0){const r=`(${t.join(", ")})`;if(e.description){return`${e.description} ${r}`}return r}return e.description}formatHelp(e,t){const r=t.padWidth(e,t);const i=t.helpWidth||80;const n=2;const s=2;function formatItem(e,o){if(o){const a=`${e.padEnd(r+s)}${o}`;return t.wrap(a,i-n,r+s)}return e}function formatList(e){return e.join("\n").replace(/^/gm," ".repeat(n))}let o=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);if(a.length>0){o=o.concat([t.wrap(a,i,0),""])}const l=t.visibleArguments(e).map((e=>formatItem(t.argumentTerm(e),t.argumentDescription(e))));if(l.length>0){o=o.concat(["Arguments:",formatList(l),""])}const u=t.visibleOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(u.length>0){o=o.concat(["Options:",formatList(u),""])}if(this.showGlobalOptions){const r=t.visibleGlobalOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(r.length>0){o=o.concat(["Global Options:",formatList(r),""])}}const c=t.visibleCommands(e).map((e=>formatItem(t.subcommandTerm(e),t.subcommandDescription(e))));if(c.length>0){o=o.concat(["Commands:",formatList(c),""])}return o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,i=40){const n=" \\f\\t\\v   -    \ufeff";const s=new RegExp(`[\\n][${n}]+`);if(e.match(s))return e;const o=t-r;if(o<i)return e;const a=e.slice(0,r);const l=e.slice(r).replace("\r\n","\n");const u=" ".repeat(r);const c="​";const h=`\\s${c}`;const d=new RegExp(`\n|.{1,${o-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g");const p=l.match(d)||[];return a+p.map(((e,t)=>{if(e==="\n")return"";return(t>0?u:"")+e.trimEnd()})).join("\n")}}t.Help=Help},6558:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Option{constructor(e,t){this.flags=e;this.description=t||"";this.required=e.includes("<");this.optional=e.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(e);this.mandatory=false;const r=splitOptionFlags(e);this.short=r.shortFlag;this.long=r.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}preset(e){this.presetArg=e;return this}conflicts(e){this.conflictsWith=this.conflictsWith.concat(e);return this}implies(e){let t=e;if(typeof e==="string"){t={[e]:true}}this.implied=Object.assign(this.implied||{},t);return this}env(e){this.envVar=e;return this}argParser(e){this.parseArg=e;return this}makeOptionMandatory(e=true){this.mandatory=!!e;return this}hideHelp(e=true){this.hidden=!!e;return this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(e){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;e.forEach((e=>{if(e.negate){this.negativeOptions.set(e.attributeName(),e)}else{this.positiveOptions.set(e.attributeName(),e)}}));this.negativeOptions.forEach(((e,t)=>{if(this.positiveOptions.has(t)){this.dualOptions.add(t)}}))}valueFromOption(e,t){const r=t.attributeName();if(!this.dualOptions.has(r))return true;const i=this.negativeOptions.get(r).presetArg;const n=i!==undefined?i:false;return t.negate===(n===e)}}function camelcase(e){return e.split("-").reduce(((e,t)=>e+t[0].toUpperCase()+t.slice(1)))}function splitOptionFlags(e){let t;let r;const i=e.split(/[ |,]+/);if(i.length>1&&!/^[[<]/.test(i[1]))t=i.shift();r=i.shift();if(!t&&/^-[^-]$/.test(r)){t=r;r=undefined}return{shortFlag:t,longFlag:r}}t.Option=Option;t.splitOptionFlags=splitOptionFlags;t.DualOptions=DualOptions},7592:(e,t)=>{const r=3;function editDistance(e,t){if(Math.abs(e.length-t.length)>r)return Math.max(e.length,t.length);const i=[];for(let t=0;t<=e.length;t++){i[t]=[t]}for(let e=0;e<=t.length;e++){i[0][e]=e}for(let r=1;r<=t.length;r++){for(let n=1;n<=e.length;n++){let s=1;if(e[n-1]===t[r-1]){s=0}else{s=1}i[n][r]=Math.min(i[n-1][r]+1,i[n][r-1]+1,i[n-1][r-1]+s);if(n>1&&r>1&&e[n-1]===t[r-2]&&e[n-2]===t[r-1]){i[n][r]=Math.min(i[n][r],i[n-2][r-2]+1)}}}return i[e.length][t.length]}function suggestSimilar(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));const i=e.startsWith("--");if(i){e=e.slice(2);t=t.map((e=>e.slice(2)))}let n=[];let s=r;const o=.4;t.forEach((t=>{if(t.length<=1)return;const r=editDistance(e,t);const i=Math.max(e.length,t.length);const a=(i-r)/i;if(a>o){if(r<s){s=r;n=[t]}else if(r===s){n.push(t)}}}));n.sort(((e,t)=>e.localeCompare(t)));if(i){n=n.map((e=>`--${e}`))}if(n.length>1){return`\n(Did you mean one of ${n.join(", ")}?)`}if(n.length===1){return`\n(Did you mean ${n[0]}?)`}return""}t.suggestSimilar=suggestSimilar},1391:(e,t,r)=>{"use strict";r.r(t);r.d(t,{AbortError:()=>AbortError,CacheError:()=>CacheError,CancelError:()=>types_CancelError,HTTPError:()=>HTTPError,MaxRedirectsError:()=>MaxRedirectsError,Options:()=>Options,ParseError:()=>ParseError,ReadError:()=>ReadError,RequestError:()=>RequestError,RetryError:()=>RetryError,TimeoutError:()=>TimeoutError,UploadError:()=>UploadError,calculateRetryDelay:()=>te,create:()=>Re,default:()=>Le,got:()=>Pe,isResponseOk:()=>isResponseOk,parseBody:()=>parseBody,parseLinkHeader:()=>parseLinkHeader});const i=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function isTypedArrayName(e){return i.includes(e)}const n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...i];function isObjectTypeName(e){return n.includes(e)}const s=["null","undefined","string","number","bigint","boolean","symbol"];function isPrimitiveTypeName(e){return s.includes(e)}function isOfType(e){return t=>typeof t===e}const{toString:o}=Object.prototype;const getObjectType=e=>{const t=o.call(e).slice(8,-1);if(/HTML\w+Element/.test(t)&&is.domElement(e)){return"HTMLElement"}if(isObjectTypeName(t)){return t}return undefined};const isObjectOfType=e=>t=>getObjectType(t)===e;function is(e){if(e===null){return"null"}switch(typeof e){case"undefined":{return"undefined"}case"string":{return"string"}case"number":{return Number.isNaN(e)?"NaN":"number"}case"boolean":{return"boolean"}case"function":{return"Function"}case"bigint":{return"bigint"}case"symbol":{return"symbol"}default:}if(is.observable(e)){return"Observable"}if(is.array(e)){return"Array"}if(is.buffer(e)){return"Buffer"}const t=getObjectType(e);if(t){return t}if(e instanceof String||e instanceof Boolean||e instanceof Number){throw new TypeError("Please don't use object wrappers for primitive types")}return"Object"}is.undefined=isOfType("undefined");is.string=isOfType("string");const a=isOfType("number");is.number=e=>a(e)&&!is.nan(e);is.positiveNumber=e=>is.number(e)&&e>0;is.negativeNumber=e=>is.number(e)&&e<0;is.bigint=isOfType("bigint");is.function_=isOfType("function");is.null_=e=>e===null;is.class_=e=>is.function_(e)&&e.toString().startsWith("class ");is.boolean=e=>e===true||e===false;is.symbol=isOfType("symbol");is.numericString=e=>is.string(e)&&!is.emptyStringOrWhitespace(e)&&!Number.isNaN(Number(e));is.array=(e,t)=>{if(!Array.isArray(e)){return false}if(!is.function_(t)){return true}return e.every((e=>t(e)))};is.buffer=e=>e?.constructor?.isBuffer?.(e)??false;is.blob=e=>isObjectOfType("Blob")(e);is.nullOrUndefined=e=>is.null_(e)||is.undefined(e);is.object=e=>!is.null_(e)&&(typeof e==="object"||is.function_(e));is.iterable=e=>is.function_(e?.[Symbol.iterator]);is.asyncIterable=e=>is.function_(e?.[Symbol.asyncIterator]);is.generator=e=>is.iterable(e)&&is.function_(e?.next)&&is.function_(e?.throw);is.asyncGenerator=e=>is.asyncIterable(e)&&is.function_(e.next)&&is.function_(e.throw);is.nativePromise=e=>isObjectOfType("Promise")(e);const hasPromiseApi=e=>is.function_(e?.then)&&is.function_(e?.catch);is.promise=e=>is.nativePromise(e)||hasPromiseApi(e);is.generatorFunction=isObjectOfType("GeneratorFunction");is.asyncGeneratorFunction=e=>getObjectType(e)==="AsyncGeneratorFunction";is.asyncFunction=e=>getObjectType(e)==="AsyncFunction";is.boundFunction=e=>is.function_(e)&&!e.hasOwnProperty("prototype");is.regExp=isObjectOfType("RegExp");is.date=isObjectOfType("Date");is.error=isObjectOfType("Error");is.map=e=>isObjectOfType("Map")(e);is.set=e=>isObjectOfType("Set")(e);is.weakMap=e=>isObjectOfType("WeakMap")(e);is.weakSet=e=>isObjectOfType("WeakSet")(e);is.weakRef=e=>isObjectOfType("WeakRef")(e);is.int8Array=isObjectOfType("Int8Array");is.uint8Array=isObjectOfType("Uint8Array");is.uint8ClampedArray=isObjectOfType("Uint8ClampedArray");is.int16Array=isObjectOfType("Int16Array");is.uint16Array=isObjectOfType("Uint16Array");is.int32Array=isObjectOfType("Int32Array");is.uint32Array=isObjectOfType("Uint32Array");is.float32Array=isObjectOfType("Float32Array");is.float64Array=isObjectOfType("Float64Array");is.bigInt64Array=isObjectOfType("BigInt64Array");is.bigUint64Array=isObjectOfType("BigUint64Array");is.arrayBuffer=isObjectOfType("ArrayBuffer");is.sharedArrayBuffer=isObjectOfType("SharedArrayBuffer");is.dataView=isObjectOfType("DataView");is.enumCase=(e,t)=>Object.values(t).includes(e);is.directInstanceOf=(e,t)=>Object.getPrototypeOf(e)===t.prototype;is.urlInstance=e=>isObjectOfType("URL")(e);is.urlString=e=>{if(!is.string(e)){return false}try{new URL(e);return true}catch{return false}};is.truthy=e=>Boolean(e);is.falsy=e=>!e;is.nan=e=>Number.isNaN(e);is.primitive=e=>is.null_(e)||isPrimitiveTypeName(typeof e);is.integer=e=>Number.isInteger(e);is.safeInteger=e=>Number.isSafeInteger(e);is.plainObject=e=>{if(typeof e!=="object"||e===null){return false}const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)};is.typedArray=e=>isTypedArrayName(getObjectType(e));const isValidLength=e=>is.safeInteger(e)&&e>=0;is.arrayLike=e=>!is.nullOrUndefined(e)&&!is.function_(e)&&isValidLength(e.length);is.tupleLike=(e,t)=>{if(is.array(t)&&is.array(e)&&t.length===e.length){return t.every(((t,r)=>t(e[r])))}return false};is.inRange=(e,t)=>{if(is.number(t)){return e>=Math.min(0,t)&&e<=Math.max(t,0)}if(is.array(t)&&t.length===2){return e>=Math.min(...t)&&e<=Math.max(...t)}throw new TypeError(`Invalid range: ${JSON.stringify(t)}`)};const l=1;const u=["innerHTML","ownerDocument","style","attributes","nodeValue"];is.domElement=e=>is.object(e)&&e.nodeType===l&&is.string(e.nodeName)&&!is.plainObject(e)&&u.every((t=>t in e));is.observable=e=>{if(!e){return false}if(e===e[Symbol.observable]?.()){return true}if(e===e["@@observable"]?.()){return true}return false};is.nodeStream=e=>is.object(e)&&is.function_(e.pipe)&&!is.observable(e);is.infinite=e=>e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY;const isAbsoluteMod2=e=>t=>is.integer(t)&&Math.abs(t%2)===e;is.evenInteger=isAbsoluteMod2(0);is.oddInteger=isAbsoluteMod2(1);is.emptyArray=e=>is.array(e)&&e.length===0;is.nonEmptyArray=e=>is.array(e)&&e.length>0;is.emptyString=e=>is.string(e)&&e.length===0;const isWhiteSpaceString=e=>is.string(e)&&!/\S/.test(e);is.emptyStringOrWhitespace=e=>is.emptyString(e)||isWhiteSpaceString(e);is.nonEmptyString=e=>is.string(e)&&e.length>0;is.nonEmptyStringAndNotWhitespace=e=>is.string(e)&&!is.emptyStringOrWhitespace(e);is.emptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length===0;is.nonEmptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length>0;is.emptySet=e=>is.set(e)&&e.size===0;is.nonEmptySet=e=>is.set(e)&&e.size>0;is.emptyMap=e=>is.map(e)&&e.size===0;is.nonEmptyMap=e=>is.map(e)&&e.size>0;is.propertyKey=e=>is.any([is.string,is.number,is.symbol],e);is.formData=e=>isObjectOfType("FormData")(e);is.urlSearchParams=e=>isObjectOfType("URLSearchParams")(e);const predicateOnArray=(e,t,r)=>{if(!is.function_(t)){throw new TypeError(`Invalid predicate: ${JSON.stringify(t)}`)}if(r.length===0){throw new TypeError("Invalid number of values")}return e.call(r,t)};is.any=(e,...t)=>{const r=is.array(e)?e:[e];return r.some((e=>predicateOnArray(Array.prototype.some,e,t)))};is.all=(e,...t)=>predicateOnArray(Array.prototype.every,e,t);const assertType=(e,t,r,i={})=>{if(!e){const{multipleValues:e}=i;const n=e?`received values of types ${[...new Set(r.map((e=>`\`${is(e)}\``)))].join(", ")}`:`received value of type \`${is(r)}\``;throw new TypeError(`Expected value which is \`${t}\`, ${n}.`)}};const c={undefined:e=>assertType(is.undefined(e),"undefined",e),string:e=>assertType(is.string(e),"string",e),number:e=>assertType(is.number(e),"number",e),positiveNumber:e=>assertType(is.positiveNumber(e),"positive number",e),negativeNumber:e=>assertType(is.negativeNumber(e),"negative number",e),bigint:e=>assertType(is.bigint(e),"bigint",e),function_:e=>assertType(is.function_(e),"Function",e),null_:e=>assertType(is.null_(e),"null",e),class_:e=>assertType(is.class_(e),"Class",e),boolean:e=>assertType(is.boolean(e),"boolean",e),symbol:e=>assertType(is.symbol(e),"symbol",e),numericString:e=>assertType(is.numericString(e),"string with a number",e),array:(e,t)=>{const r=assertType;r(is.array(e),"Array",e);if(t){e.forEach(t)}},buffer:e=>assertType(is.buffer(e),"Buffer",e),blob:e=>assertType(is.blob(e),"Blob",e),nullOrUndefined:e=>assertType(is.nullOrUndefined(e),"null or undefined",e),object:e=>assertType(is.object(e),"Object",e),iterable:e=>assertType(is.iterable(e),"Iterable",e),asyncIterable:e=>assertType(is.asyncIterable(e),"AsyncIterable",e),generator:e=>assertType(is.generator(e),"Generator",e),asyncGenerator:e=>assertType(is.asyncGenerator(e),"AsyncGenerator",e),nativePromise:e=>assertType(is.nativePromise(e),"native Promise",e),promise:e=>assertType(is.promise(e),"Promise",e),generatorFunction:e=>assertType(is.generatorFunction(e),"GeneratorFunction",e),asyncGeneratorFunction:e=>assertType(is.asyncGeneratorFunction(e),"AsyncGeneratorFunction",e),asyncFunction:e=>assertType(is.asyncFunction(e),"AsyncFunction",e),boundFunction:e=>assertType(is.boundFunction(e),"Function",e),regExp:e=>assertType(is.regExp(e),"RegExp",e),date:e=>assertType(is.date(e),"Date",e),error:e=>assertType(is.error(e),"Error",e),map:e=>assertType(is.map(e),"Map",e),set:e=>assertType(is.set(e),"Set",e),weakMap:e=>assertType(is.weakMap(e),"WeakMap",e),weakSet:e=>assertType(is.weakSet(e),"WeakSet",e),weakRef:e=>assertType(is.weakRef(e),"WeakRef",e),int8Array:e=>assertType(is.int8Array(e),"Int8Array",e),uint8Array:e=>assertType(is.uint8Array(e),"Uint8Array",e),uint8ClampedArray:e=>assertType(is.uint8ClampedArray(e),"Uint8ClampedArray",e),int16Array:e=>assertType(is.int16Array(e),"Int16Array",e),uint16Array:e=>assertType(is.uint16Array(e),"Uint16Array",e),int32Array:e=>assertType(is.int32Array(e),"Int32Array",e),uint32Array:e=>assertType(is.uint32Array(e),"Uint32Array",e),float32Array:e=>assertType(is.float32Array(e),"Float32Array",e),float64Array:e=>assertType(is.float64Array(e),"Float64Array",e),bigInt64Array:e=>assertType(is.bigInt64Array(e),"BigInt64Array",e),bigUint64Array:e=>assertType(is.bigUint64Array(e),"BigUint64Array",e),arrayBuffer:e=>assertType(is.arrayBuffer(e),"ArrayBuffer",e),sharedArrayBuffer:e=>assertType(is.sharedArrayBuffer(e),"SharedArrayBuffer",e),dataView:e=>assertType(is.dataView(e),"DataView",e),enumCase:(e,t)=>assertType(is.enumCase(e,t),"EnumCase",e),urlInstance:e=>assertType(is.urlInstance(e),"URL",e),urlString:e=>assertType(is.urlString(e),"string with a URL",e),truthy:e=>assertType(is.truthy(e),"truthy",e),falsy:e=>assertType(is.falsy(e),"falsy",e),nan:e=>assertType(is.nan(e),"NaN",e),primitive:e=>assertType(is.primitive(e),"primitive",e),integer:e=>assertType(is.integer(e),"integer",e),safeInteger:e=>assertType(is.safeInteger(e),"integer",e),plainObject:e=>assertType(is.plainObject(e),"plain object",e),typedArray:e=>assertType(is.typedArray(e),"TypedArray",e),arrayLike:e=>assertType(is.arrayLike(e),"array-like",e),tupleLike:(e,t)=>assertType(is.tupleLike(e,t),"tuple-like",e),domElement:e=>assertType(is.domElement(e),"HTMLElement",e),observable:e=>assertType(is.observable(e),"Observable",e),nodeStream:e=>assertType(is.nodeStream(e),"Node.js Stream",e),infinite:e=>assertType(is.infinite(e),"infinite number",e),emptyArray:e=>assertType(is.emptyArray(e),"empty array",e),nonEmptyArray:e=>assertType(is.nonEmptyArray(e),"non-empty array",e),emptyString:e=>assertType(is.emptyString(e),"empty string",e),emptyStringOrWhitespace:e=>assertType(is.emptyStringOrWhitespace(e),"empty string or whitespace",e),nonEmptyString:e=>assertType(is.nonEmptyString(e),"non-empty string",e),nonEmptyStringAndNotWhitespace:e=>assertType(is.nonEmptyStringAndNotWhitespace(e),"non-empty string and not whitespace",e),emptyObject:e=>assertType(is.emptyObject(e),"empty object",e),nonEmptyObject:e=>assertType(is.nonEmptyObject(e),"non-empty object",e),emptySet:e=>assertType(is.emptySet(e),"empty set",e),nonEmptySet:e=>assertType(is.nonEmptySet(e),"non-empty set",e),emptyMap:e=>assertType(is.emptyMap(e),"empty map",e),nonEmptyMap:e=>assertType(is.nonEmptyMap(e),"non-empty map",e),propertyKey:e=>assertType(is.propertyKey(e),"PropertyKey",e),formData:e=>assertType(is.formData(e),"FormData",e),urlSearchParams:e=>assertType(is.urlSearchParams(e),"URLSearchParams",e),evenInteger:e=>assertType(is.evenInteger(e),"even integer",e),oddInteger:e=>assertType(is.oddInteger(e),"odd integer",e),directInstanceOf:(e,t)=>assertType(is.directInstanceOf(e,t),"T",e),inRange:(e,t)=>assertType(is.inRange(e,t),"in range",e),any:(e,...t)=>assertType(is.any(e,...t),"predicate returns truthy for any value",t,{multipleValues:true}),all:(e,...t)=>assertType(is.all(e,...t),"predicate returns truthy for all values",t,{multipleValues:true})};Object.defineProperties(is,{class:{value:is.class_},function:{value:is.function_},null:{value:is.null_}});Object.defineProperties(c,{class:{value:c.class_},function:{value:c.function_},null:{value:c.null_}});const h=is;const d=require("node:events");class CancelError extends Error{constructor(e){super(e||"Promise was canceled");this.name="CancelError"}get isCanceled(){return true}}class PCancelable{static fn(e){return(...t)=>new PCancelable(((r,i,n)=>{t.push(n);e(...t).then(r,i)}))}constructor(e){this._cancelHandlers=[];this._isPending=true;this._isCanceled=false;this._rejectOnCancel=true;this._promise=new Promise(((t,r)=>{this._reject=r;const onResolve=e=>{if(!this._isCanceled||!onCancel.shouldReject){this._isPending=false;t(e)}};const onReject=e=>{this._isPending=false;r(e)};const onCancel=e=>{if(!this._isPending){throw new Error("The `onCancel` handler was attached after the promise settled.")}this._cancelHandlers.push(e)};Object.defineProperties(onCancel,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}});e(onResolve,onReject,onCancel)}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!this._isPending||this._isCanceled){return}this._isCanceled=true;if(this._cancelHandlers.length>0){try{for(const e of this._cancelHandlers){e()}}catch(e){this._reject(e);return}}if(this._rejectOnCancel){this._reject(new CancelError(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(PCancelable.prototype,Promise.prototype);function isRequest(e){return h.object(e)&&"_onResponse"in e}class RequestError extends Error{constructor(e,t,r){super(e);Object.defineProperty(this,"input",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"stack",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Error.captureStackTrace(this,this.constructor);this.name="RequestError";this.code=t.code??"ERR_GOT_REQUEST_ERROR";this.input=t.input;if(isRequest(r)){Object.defineProperty(this,"request",{enumerable:false,value:r});Object.defineProperty(this,"response",{enumerable:false,value:r.response});this.options=r.options}else{this.options=r}this.timings=this.request?.timings;if(h.string(t.stack)&&h.string(this.stack)){const e=this.stack.indexOf(this.message)+this.message.length;const r=this.stack.slice(e).split("\n").reverse();const i=t.stack.slice(t.stack.indexOf(t.message)+t.message.length).split("\n").reverse();while(i.length>0&&i[0]===r[0]){r.shift()}this.stack=`${this.stack.slice(0,e)}${r.reverse().join("\n")}${i.reverse().join("\n")}`}}}class MaxRedirectsError extends RequestError{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e);this.name="MaxRedirectsError";this.code="ERR_TOO_MANY_REDIRECTS"}}class HTTPError extends RequestError{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request);this.name="HTTPError";this.code="ERR_NON_2XX_3XX_RESPONSE"}}class CacheError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="CacheError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_CACHE_ACCESS":this.code}}class UploadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="UploadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_UPLOAD":this.code}}class TimeoutError extends RequestError{constructor(e,t,r){super(e.message,e,r);Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.event=e.event;this.timings=t}}class ReadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="ReadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_READING_RESPONSE_STREAM":this.code}}class RetryError extends RequestError{constructor(e){super("Retrying",{},e);this.name="RetryError";this.code="ERR_RETRYING"}}class AbortError extends RequestError{constructor(e){super("This operation was aborted.",{},e);this.code="ERR_ABORTED";this.name="AbortError"}}const p=require("node:process");const m=require("node:buffer");const g=require("node:stream");const y=require("node:url");const _=require("node:http");var v=r(2361);var b=r(3837);var x=r(6214);const timer=e=>{if(e.timings){return e.timings}const t={start:Date.now(),socket:undefined,lookup:undefined,connect:undefined,secureConnect:undefined,upload:undefined,response:undefined,end:undefined,error:undefined,abort:undefined,phases:{wait:undefined,dns:undefined,tcp:undefined,tls:undefined,request:undefined,firstByte:undefined,download:undefined,total:undefined}};e.timings=t;const handleError=e=>{e.once(v.errorMonitor,(()=>{t.error=Date.now();t.phases.total=t.error-t.start}))};handleError(e);const onAbort=()=>{t.abort=Date.now();t.phases.total=t.abort-t.start};e.prependOnceListener("abort",onAbort);const onSocket=e=>{t.socket=Date.now();t.phases.wait=t.socket-t.start;if(b.types.isProxy(e)){return}const lookupListener=()=>{t.lookup=Date.now();t.phases.dns=t.lookup-t.socket};e.prependOnceListener("lookup",lookupListener);x(e,{connect:()=>{t.connect=Date.now();if(t.lookup===undefined){e.removeListener("lookup",lookupListener);t.lookup=t.connect;t.phases.dns=t.lookup-t.socket}t.phases.tcp=t.connect-t.lookup},secureConnect:()=>{t.secureConnect=Date.now();t.phases.tls=t.secureConnect-t.connect}})};if(e.socket){onSocket(e.socket)}else{e.prependOnceListener("socket",onSocket)}const onUpload=()=>{t.upload=Date.now();t.phases.request=t.upload-(t.secureConnect??t.connect)};if(e.writableFinished){onUpload()}else{e.prependOnceListener("finish",onUpload)}e.prependOnceListener("response",(r=>{t.response=Date.now();t.phases.firstByte=t.response-t.upload;r.timings=t;handleError(r);r.prependOnceListener("end",(()=>{e.off("abort",onAbort);r.off("aborted",onAbort);if(t.phases.total){return}t.end=Date.now();t.phases.download=t.end-t.response;t.phases.total=t.end-t.start}));r.prependOnceListener("aborted",onAbort)}));return t};const T=timer;const w=require("node:crypto");const S="text/plain";const E="us-ascii";const testParameter=(e,t)=>t.some((t=>t instanceof RegExp?t.test(e):t===e));const A=new Set(["https:","http:","file:"]);const hasCustomProtocol=e=>{try{const{protocol:t}=new URL(e);return t.endsWith(":")&&!A.has(t)}catch{return false}};const normalizeDataURL=(e,{stripHash:t})=>{const r=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(e);if(!r){throw new Error(`Invalid URL: ${e}`)}let{type:i,data:n,hash:s}=r.groups;const o=i.split(";");s=t?"":s;let a=false;if(o[o.length-1]==="base64"){o.pop();a=true}const l=o.shift()?.toLowerCase()??"";const u=o.map((e=>{let[t,r=""]=e.split("=").map((e=>e.trim()));if(t==="charset"){r=r.toLowerCase();if(r===E){return""}}return`${t}${r?`=${r}`:""}`})).filter(Boolean);const c=[...u];if(a){c.push("base64")}if(c.length>0||l&&l!==S){c.unshift(l)}return`data:${c.join(";")},${a?n.trim():n}${s?`#${s}`:""}`};function normalizeUrl(e,t){t={defaultProtocol:"http",normalizeProtocol:true,forceHttp:false,forceHttps:false,stripAuthentication:true,stripHash:false,stripTextFragment:true,stripWWW:true,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:true,removeSingleSlash:true,removeDirectoryIndex:false,removeExplicitPort:false,sortQueryParameters:true,...t};if(typeof t.defaultProtocol==="string"&&!t.defaultProtocol.endsWith(":")){t.defaultProtocol=`${t.defaultProtocol}:`}e=e.trim();if(/^data:/i.test(e)){return normalizeDataURL(e,t)}if(hasCustomProtocol(e)){return e}const r=e.startsWith("//");const i=!r&&/^\.*\//.test(e);if(!i){e=e.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol)}const n=new URL(e);if(t.forceHttp&&t.forceHttps){throw new Error("The `forceHttp` and `forceHttps` options cannot be used together")}if(t.forceHttp&&n.protocol==="https:"){n.protocol="http:"}if(t.forceHttps&&n.protocol==="http:"){n.protocol="https:"}if(t.stripAuthentication){n.username="";n.password=""}if(t.stripHash){n.hash=""}else if(t.stripTextFragment){n.hash=n.hash.replace(/#?:~:text.*?$/i,"")}if(n.pathname){const e=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let t=0;let r="";for(;;){const i=e.exec(n.pathname);if(!i){break}const s=i[0];const o=i.index;const a=n.pathname.slice(t,o);r+=a.replace(/\/{2,}/g,"/");r+=s;t=o+s.length}const i=n.pathname.slice(t,n.pathname.length);r+=i.replace(/\/{2,}/g,"/");n.pathname=r}if(n.pathname){try{n.pathname=decodeURI(n.pathname)}catch{}}if(t.removeDirectoryIndex===true){t.removeDirectoryIndex=[/^index\.[a-z]+$/]}if(Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let e=n.pathname.split("/");const r=e[e.length-1];if(testParameter(r,t.removeDirectoryIndex)){e=e.slice(0,-1);n.pathname=e.slice(1).join("/")+"/"}}if(n.hostname){n.hostname=n.hostname.replace(/\.$/,"");if(t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(n.hostname)){n.hostname=n.hostname.replace(/^www\./,"")}}if(Array.isArray(t.removeQueryParameters)){for(const e of[...n.searchParams.keys()]){if(testParameter(e,t.removeQueryParameters)){n.searchParams.delete(e)}}}if(!Array.isArray(t.keepQueryParameters)&&t.removeQueryParameters===true){n.search=""}if(Array.isArray(t.keepQueryParameters)&&t.keepQueryParameters.length>0){for(const e of[...n.searchParams.keys()]){if(!testParameter(e,t.keepQueryParameters)){n.searchParams.delete(e)}}}if(t.sortQueryParameters){n.searchParams.sort();try{n.search=decodeURIComponent(n.search)}catch{}}if(t.removeTrailingSlash){n.pathname=n.pathname.replace(/\/$/,"")}if(t.removeExplicitPort&&n.port){n.port=""}const s=e;e=n.toString();if(!t.removeSingleSlash&&n.pathname==="/"&&!s.endsWith("/")&&n.hash===""){e=e.replace(/\/$/,"")}if((t.removeTrailingSlash||n.pathname==="/")&&n.hash===""&&t.removeSingleSlash){e=e.replace(/\/$/,"")}if(r&&!t.normalizeProtocol){e=e.replace(/^http:\/\//,"//")}if(t.stripProtocol){e=e.replace(/^(?:https?:)?\/\//,"")}return e}var C=r(1766);var N=r(1002);function lowercaseKeys(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e.toLowerCase(),t])))}class Response extends g.Readable{statusCode;headers;body;url;constructor({statusCode:e,headers:t,body:r,url:i}){if(typeof e!=="number"){throw new TypeError("Argument `statusCode` should be a number")}if(typeof t!=="object"){throw new TypeError("Argument `headers` should be an object")}if(!(r instanceof Uint8Array)){throw new TypeError("Argument `body` should be a buffer")}if(typeof i!=="string"){throw new TypeError("Argument `url` should be a string")}super({read(){this.push(r);this.push(null)}});this.statusCode=e;this.headers=lowercaseKeys(t);this.body=r;this.url=i}}var O=r(1531);const R=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];function mimicResponse(e,t){if(t._readableState.autoDestroy){throw new Error("The second stream must have the `autoDestroy` option set to `false`")}const r=new Set([...Object.keys(e),...R]);const i={};for(const n of r){if(n in t){continue}i[n]={get(){const t=e[n];const r=typeof t==="function";return r?t.bind(e):t},set(t){e[n]=t},enumerable:true,configurable:false}}Object.defineProperties(t,i);e.once("aborted",(()=>{t.destroy();t.emit("aborted")}));e.once("close",(()=>{if(e.complete){if(t.readable){t.once("end",(()=>{t.emit("close")}))}else{t.emit("close")}}else{t.emit("close")}}));return t}class types_RequestError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class types_CacheError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class CacheableRequest{constructor(e,t){this.hooks=new Map;this.request=()=>(e,t)=>{let r;if(typeof e==="string"){r=normalizeUrlObject(y.parse(e));e={}}else if(e instanceof y.URL){r=normalizeUrlObject(y.parse(e.toString()));e={}}else{const[t,...i]=(e.path??"").split("?");const n=i.length>0?`?${i.join("?")}`:"";r=normalizeUrlObject({...e,pathname:t,search:n})}e={headers:{},method:"GET",cache:true,strictTtl:false,automaticFailover:false,...e,...urlObjectToRequestOptions(r)};e.headers=Object.fromEntries(k(e.headers).map((([e,t])=>[e.toLowerCase(),t])));const i=new d;const n=normalizeUrl(y.format(r),{stripWWW:false,removeTrailingSlash:false,stripAuthentication:false});let s=`${e.method}:${n}`;if(e.body&&e.method!==undefined&&["POST","PATCH","PUT"].includes(e.method)){if(e.body instanceof g.Readable){e.cache=false}else{s+=`:${w.createHash("md5").update(e.body).digest("hex")}`}}let o=false;let a=false;const makeRequest=e=>{a=true;let r=false;let requestErrorCallback=()=>{};const n=new Promise((e=>{requestErrorCallback=()=>{if(!r){r=true;e()}}}));const handler=async r=>{if(o){r.status=r.statusCode;const t=N.fromObject(o.cachePolicy).revalidatedPolicy(e,r);if(!t.modified){r.resume();await new Promise((e=>{r.once("end",e)}));const e=convertHeaders(t.policy.responseHeaders());r=new Response({statusCode:o.statusCode,headers:e,body:o.body,url:o.url});r.cachePolicy=t.policy;r.fromCache=true}}if(!r.fromCache){r.cachePolicy=new N(e,r,e);r.fromCache=false}let a;if(e.cache&&r.cachePolicy.storable()){a=cloneResponse(r);(async()=>{try{const t=C.buffer(r);await Promise.race([n,new Promise((e=>r.once("end",e))),new Promise((e=>r.once("close",e)))]);const i=await t;let a={url:r.url,statusCode:r.fromCache?o.statusCode:r.statusCode,body:i,cachePolicy:r.cachePolicy.toObject()};let l=e.strictTtl?r.cachePolicy.timeToLive():undefined;if(e.maxTtl){l=l?Math.min(l,e.maxTtl):e.maxTtl}if(this.hooks.size>0){for(const e of this.hooks.keys()){a=await this.runHook(e,a,r)}}await this.cache.set(s,a,l)}catch(e){i.emit("error",new types_CacheError(e))}})()}else if(e.cache&&o){(async()=>{try{await this.cache.delete(s)}catch(e){i.emit("error",new types_CacheError(e))}})()}i.emit("response",a??r);if(typeof t==="function"){t(a??r)}};try{const t=this.cacheRequest(e,handler);t.once("error",requestErrorCallback);t.once("abort",requestErrorCallback);t.once("destroy",requestErrorCallback);i.emit("request",t)}catch(e){i.emit("error",new types_RequestError(e))}};(async()=>{const get=async e=>{await Promise.resolve();const r=e.cache?await this.cache.get(s):undefined;if(r===undefined&&!e.forceRefresh){makeRequest(e);return}const n=N.fromObject(r.cachePolicy);if(n.satisfiesWithoutRevalidation(e)&&!e.forceRefresh){const e=convertHeaders(n.responseHeaders());const s=new Response({statusCode:r.statusCode,headers:e,body:r.body,url:r.url});s.cachePolicy=n;s.fromCache=true;i.emit("response",s);if(typeof t==="function"){t(s)}}else if(n.satisfiesWithoutRevalidation(e)&&Date.now()>=n.timeToLive()&&e.forceRefresh){await this.cache.delete(s);e.headers=n.revalidationHeaders(e);makeRequest(e)}else{o=r;e.headers=n.revalidationHeaders(e);makeRequest(e)}};const errorHandler=e=>i.emit("error",new types_CacheError(e));if(this.cache instanceof O){const e=this.cache;e.once("error",errorHandler);i.on("error",(()=>e.removeListener("error",errorHandler)));i.on("response",(()=>e.removeListener("error",errorHandler)))}try{await get(e)}catch(t){if(e.automaticFailover&&!a){makeRequest(e)}i.emit("error",new types_CacheError(t))}})();return i};this.addHook=(e,t)=>{if(!this.hooks.has(e)){this.hooks.set(e,t)}};this.removeHook=e=>this.hooks.delete(e);this.getHook=e=>this.hooks.get(e);this.runHook=async(e,...t)=>this.hooks.get(e)?.(...t);if(t instanceof O){this.cache=t}else if(typeof t==="string"){this.cache=new O({uri:t,namespace:"cacheable-request"})}else{this.cache=new O({store:t,namespace:"cacheable-request"})}this.request=this.request.bind(this);this.cacheRequest=e}}const k=Object.entries;const cloneResponse=e=>{const t=new g.PassThrough({autoDestroy:false});mimicResponse(e,t);return e.pipe(t)};const urlObjectToRequestOptions=e=>{const t={...e};t.path=`${e.pathname||"/"}${e.search||""}`;delete t.pathname;delete t.search;return t};const normalizeUrlObject=e=>({protocol:e.protocol,auth:e.auth,hostname:e.hostname||e.host||"localhost",port:e.port,pathname:e.pathname,search:e.search});const convertHeaders=e=>{const t=[];for(const r of Object.keys(e)){t[r.toLowerCase()]=e[r]}return t};const P=CacheableRequest;const L="onResponse";var I=r(2391);const isFunction=e=>typeof e==="function";const isFormData=e=>Boolean(e&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&isFunction(e.append)&&isFunction(e.getAll)&&isFunction(e.entries)&&isFunction(e[Symbol.iterator]));const isAsyncIterable=e=>isFunction(e[Symbol.asyncIterator]);async function*readStream(e){const t=e.getReader();while(true){const{done:e,value:r}=await t.read();if(e){break}yield r}}const getStreamIterator=e=>{if(isAsyncIterable(e)){return e}if(isFunction(e.getReader)){return readStream(e)}throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")};const M="abcdefghijklmnopqrstuvwxyz0123456789";function createBoundary(){let e=16;let t="";while(e--){t+=M[Math.random()*M.length<<0]}return t}const normalizeValue=e=>String(e).replace(/\r|\n/g,((e,t,r)=>{if(e==="\r"&&r[t+1]!=="\n"||e==="\n"&&r[t-1]!=="\r"){return"\r\n"}return e}));const getType=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase();function isPlainObject(e){if(getType(e)!=="object"){return false}const t=Object.getPrototypeOf(e);if(t===null||t===undefined){return true}const r=t.constructor&&t.constructor.toString();return r===Object.toString()}function getProperty(e,t){if(typeof t==="string"){for(const[r,i]of Object.entries(e)){if(t.toLowerCase()===r.toLowerCase()){return i}}}return undefined}const proxyHeaders=e=>new Proxy(e,{get:(e,t)=>getProperty(e,t),has:(e,t)=>getProperty(e,t)!==undefined});const escapeName=e=>String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22");const isFile=e=>Boolean(e&&typeof e==="object"&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="File"&&isFunction(e.stream)&&e.name!=null);const D=null&&isFile;var F=undefined&&undefined.__classPrivateFieldSet||function(e,t,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r};var j=undefined&&undefined.__classPrivateFieldGet||function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)};var B,U,H,z,K,V,q,Z,G,$,W;const Y={enableAdditionalHeaders:false};const J={writable:false,configurable:false};class FormDataEncoder{constructor(e,t,r){B.add(this);U.set(this,"\r\n");H.set(this,void 0);z.set(this,void 0);K.set(this,"-".repeat(2));V.set(this,new TextEncoder);q.set(this,void 0);Z.set(this,void 0);G.set(this,void 0);if(!isFormData(e)){throw new TypeError("Expected first argument to be a FormData instance.")}let i;if(isPlainObject(t)){r=t}else{i=t}if(!i){i=createBoundary()}if(typeof i!=="string"){throw new TypeError("Expected boundary argument to be a string.")}if(r&&!isPlainObject(r)){throw new TypeError("Expected options argument to be an object.")}F(this,Z,Array.from(e.entries()),"f");F(this,G,{...Y,...r},"f");F(this,H,j(this,V,"f").encode(j(this,U,"f")),"f");F(this,z,j(this,H,"f").byteLength,"f");this.boundary=`form-data-boundary-${i}`;this.contentType=`multipart/form-data; boundary=${this.boundary}`;F(this,q,j(this,V,"f").encode(`${j(this,K,"f")}${this.boundary}${j(this,K,"f")}${j(this,U,"f").repeat(2)}`),"f");const n={"Content-Type":this.contentType};const s=j(this,B,"m",W).call(this);if(s){this.contentLength=s;n["Content-Length"]=s}this.headers=proxyHeaders(Object.freeze(n));Object.defineProperties(this,{boundary:J,contentType:J,contentLength:J,headers:J})}getContentLength(){return this.contentLength==null?undefined:Number(this.contentLength)}*values(){for(const[e,t]of j(this,Z,"f")){const r=isFile(t)?t:j(this,V,"f").encode(normalizeValue(t));yield j(this,B,"m",$).call(this,e,r);yield r;yield j(this,H,"f")}yield j(this,q,"f")}async*encode(){for(const e of this.values()){if(isFile(e)){yield*getStreamIterator(e.stream())}else{yield e}}}[(U=new WeakMap,H=new WeakMap,z=new WeakMap,K=new WeakMap,V=new WeakMap,q=new WeakMap,Z=new WeakMap,G=new WeakMap,B=new WeakSet,$=function _FormDataEncoder_getFieldHeader(e,t){let r="";r+=`${j(this,K,"f")}${this.boundary}${j(this,U,"f")}`;r+=`Content-Disposition: form-data; name="${escapeName(e)}"`;if(isFile(t)){r+=`; filename="${escapeName(t.name)}"${j(this,U,"f")}`;r+=`Content-Type: ${t.type||"application/octet-stream"}`}const i=isFile(t)?t.size:t.byteLength;if(j(this,G,"f").enableAdditionalHeaders===true&&i!=null&&!isNaN(i)){r+=`${j(this,U,"f")}Content-Length: ${isFile(t)?t.size:t.byteLength}`}return j(this,V,"f").encode(`${r}${j(this,U,"f").repeat(2)}`)},W=function _FormDataEncoder_getContentLength(){let e=0;for(const[t,r]of j(this,Z,"f")){const i=isFile(r)?r:j(this,V,"f").encode(normalizeValue(r));const n=isFile(i)?i.size:i.byteLength;if(n==null||isNaN(n)){return undefined}e+=j(this,B,"m",$).call(this,t,i).byteLength;e+=n;e+=j(this,z,"f")}return String(e+j(this,q,"f").byteLength)},Symbol.iterator)](){return this.values()}[Symbol.asyncIterator](){return this.encode()}}const Q=require("node:util");function is_form_data_isFormData(e){return h.nodeStream(e)&&h.function_(e.getBoundary)}async function getBodySize(e,t){if(t&&"content-length"in t){return Number(t["content-length"])}if(!e){return 0}if(h.string(e)){return m.Buffer.byteLength(e)}if(h.buffer(e)){return e.length}if(is_form_data_isFormData(e)){return(0,Q.promisify)(e.getLength.bind(e))()}return undefined}function proxyEvents(e,t,r){const i={};for(const n of r){const eventFunction=(...e)=>{t.emit(n,...e)};i[n]=eventFunction;e.on(n,eventFunction)}return()=>{for(const[t,r]of Object.entries(i)){e.off(t,r)}}}const X=require("node:net");function unhandle(){const e=[];return{once(t,r,i){t.once(r,i);e.push({origin:t,event:r,fn:i})},unhandleAll(){for(const t of e){const{origin:e,event:r,fn:i}=t;e.removeListener(r,i)}e.length=0}}}const ee=Symbol("reentry");const noop=()=>{};class timed_out_TimeoutError extends Error{constructor(e,t){super(`Timeout awaiting '${t}' for ${e}ms`);Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:t});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.code="ETIMEDOUT"}}function timedOut(e,t,r){if(ee in e){return noop}e[ee]=true;const i=[];const{once:n,unhandleAll:s}=unhandle();const addTimeout=(e,t,r)=>{const n=setTimeout(t,e,e,r);n.unref?.();const cancel=()=>{clearTimeout(n)};i.push(cancel);return cancel};const{host:o,hostname:a}=r;const timeoutHandler=(t,r)=>{e.destroy(new timed_out_TimeoutError(t,r))};const cancelTimeouts=()=>{for(const e of i){e()}s()};e.once("error",(t=>{cancelTimeouts();if(e.listenerCount("error")===0){throw t}}));if(typeof t.request!=="undefined"){const r=addTimeout(t.request,timeoutHandler,"request");n(e,"response",(e=>{n(e,"end",r)}))}if(typeof t.socket!=="undefined"){const{socket:r}=t;const socketTimeoutHandler=()=>{timeoutHandler(r,"socket")};e.setTimeout(r,socketTimeoutHandler);i.push((()=>{e.removeListener("timeout",socketTimeoutHandler)}))}const l=typeof t.lookup!=="undefined";const u=typeof t.connect!=="undefined";const c=typeof t.secureConnect!=="undefined";const h=typeof t.send!=="undefined";if(l||u||c||h){n(e,"socket",(i=>{const{socketPath:s}=e;if(i.connecting){const e=Boolean(s??X.isIP(a??o??"")!==0);if(l&&!e&&typeof i.address().address==="undefined"){const e=addTimeout(t.lookup,timeoutHandler,"lookup");n(i,"lookup",e)}if(u){const timeConnect=()=>addTimeout(t.connect,timeoutHandler,"connect");if(e){n(i,"connect",timeConnect())}else{n(i,"lookup",(e=>{if(e===null){n(i,"connect",timeConnect())}}))}}if(c&&r.protocol==="https:"){n(i,"connect",(()=>{const e=addTimeout(t.secureConnect,timeoutHandler,"secureConnect");n(i,"secureConnect",e)}))}}if(h){const timeRequest=()=>addTimeout(t.send,timeoutHandler,"send");if(i.connecting){n(i,"connect",(()=>{n(e,"upload-complete",timeRequest())}))}else{n(e,"upload-complete",timeRequest())}}}))}if(typeof t.response!=="undefined"){n(e,"upload-complete",(()=>{const r=addTimeout(t.response,timeoutHandler,"response");n(e,"response",r)}))}if(typeof t.read!=="undefined"){n(e,"response",(e=>{const r=addTimeout(t.read,timeoutHandler,"read");n(e,"end",r)}))}return cancelTimeouts}function urlToOptions(e){e=e;const t={protocol:e.protocol,hostname:h.string(e.hostname)&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,host:e.host,hash:e.hash,search:e.search,pathname:e.pathname,href:e.href,path:`${e.pathname||""}${e.search||""}`};if(h.string(e.port)&&e.port.length>0){t.port=Number(e.port)}if(e.username||e.password){t.auth=`${e.username||""}:${e.password||""}`}return t}class WeakableMap{constructor(){Object.defineProperty(this,"weakMap",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"map",{enumerable:true,configurable:true,writable:true,value:void 0});this.weakMap=new WeakMap;this.map=new Map}set(e,t){if(typeof e==="object"){this.weakMap.set(e,t)}else{this.map.set(e,t)}}get(e){if(typeof e==="object"){return this.weakMap.get(e)}return this.map.get(e)}has(e){if(typeof e==="object"){return this.weakMap.has(e)}return this.map.has(e)}}const calculateRetryDelay=({attemptCount:e,retryOptions:t,error:r,retryAfter:i,computedValue:n})=>{if(r.name==="RetryError"){return 1}if(e>t.limit){return 0}const s=t.methods.includes(r.options.method);const o=t.errorCodes.includes(r.code);const a=r.response&&t.statusCodes.includes(r.response.statusCode);if(!s||!o&&!a){return 0}if(r.response){if(i){if(i>n){return 0}return i}if(r.response.statusCode===413){return 0}}const l=Math.random()*t.noise;return Math.min(2**(e-1)*1e3,t.backoffLimit)+l};const te=calculateRetryDelay;const re=require("node:tls");const ie=require("node:https");const ne=require("node:dns");const se=require("node:os");const{Resolver:oe}=ne.promises;const ae=Symbol("cacheableLookupCreateConnection");const le=Symbol("cacheableLookupInstance");const ue=Symbol("expires");const ce=typeof ne.ALL==="number";const verifyAgent=e=>{if(!(e&&typeof e.createConnection==="function")){throw new Error("Expected an Agent instance as the first argument")}};const map4to6=e=>{for(const t of e){if(t.family===6){continue}t.address=`::ffff:${t.address}`;t.family=6}};const getIfaceInfo=()=>{let e=false;let t=false;for(const r of Object.values(se.networkInterfaces())){for(const i of r){if(i.internal){continue}if(i.family==="IPv6"){t=true}else{e=true}if(e&&t){return{has4:e,has6:t}}}}return{has4:e,has6:t}};const isIterable=e=>Symbol.iterator in e;const ignoreNoResultErrors=e=>e.catch((e=>{if(e.code==="ENODATA"||e.code==="ENOTFOUND"||e.code==="ENOENT"){return[]}throw e}));const he={ttl:true};const de={all:true};const fe={all:true,family:4};const pe={all:true,family:6};class CacheableLookup{constructor({cache:e=new Map,maxTtl:t=Infinity,fallbackDuration:r=3600,errorTtl:i=.15,resolver:n=new oe,lookup:s=ne.lookup}={}){this.maxTtl=t;this.errorTtl=i;this._cache=e;this._resolver=n;this._dnsLookup=s&&(0,Q.promisify)(s);this.stats={cache:0,query:0};if(this._resolver instanceof oe){this._resolve4=this._resolver.resolve4.bind(this._resolver);this._resolve6=this._resolver.resolve6.bind(this._resolver)}else{this._resolve4=(0,Q.promisify)(this._resolver.resolve4.bind(this._resolver));this._resolve6=(0,Q.promisify)(this._resolver.resolve6.bind(this._resolver))}this._iface=getIfaceInfo();this._pending={};this._nextRemovalTime=false;this._hostnamesToFallback=new Set;this.fallbackDuration=r;if(r>0){const e=setInterval((()=>{this._hostnamesToFallback.clear()}),r*1e3);if(e.unref){e.unref()}this._fallbackInterval=e}this.lookup=this.lookup.bind(this);this.lookupAsync=this.lookupAsync.bind(this)}set servers(e){this.clear();this._resolver.setServers(e)}get servers(){return this._resolver.getServers()}lookup(e,t,r){if(typeof t==="function"){r=t;t={}}else if(typeof t==="number"){t={family:t}}if(!r){throw new Error("Callback must be a function.")}this.lookupAsync(e,t).then((e=>{if(t.all){r(null,e)}else{r(null,e.address,e.family,e.expires,e.ttl,e.source)}}),r)}async lookupAsync(e,t={}){if(typeof t==="number"){t={family:t}}let r=await this.query(e);if(t.family===6){const e=r.filter((e=>e.family===6));if(t.hints&ne.V4MAPPED){if(ce&&t.hints&ne.ALL||e.length===0){map4to6(r)}else{r=e}}else{r=e}}else if(t.family===4){r=r.filter((e=>e.family===4))}if(t.hints&ne.ADDRCONFIG){const{_iface:e}=this;r=r.filter((t=>t.family===6?e.has6:e.has4))}if(r.length===0){const t=new Error(`cacheableLookup ENOTFOUND ${e}`);t.code="ENOTFOUND";t.hostname=e;throw t}if(t.all){return r}return r[0]}async query(e){let t="cache";let r=await this._cache.get(e);if(r){this.stats.cache++}if(!r){const i=this._pending[e];if(i){this.stats.cache++;r=await i}else{t="query";const i=this.queryAndCache(e);this._pending[e]=i;this.stats.query++;try{r=await i}finally{delete this._pending[e]}}}r=r.map((e=>({...e,source:t})));return r}async _resolve(e){const[t,r]=await Promise.all([ignoreNoResultErrors(this._resolve4(e,he)),ignoreNoResultErrors(this._resolve6(e,he))]);let i=0;let n=0;let s=0;const o=Date.now();for(const e of t){e.family=4;e.expires=o+e.ttl*1e3;i=Math.max(i,e.ttl)}for(const e of r){e.family=6;e.expires=o+e.ttl*1e3;n=Math.max(n,e.ttl)}if(t.length>0){if(r.length>0){s=Math.min(i,n)}else{s=i}}else{s=n}return{entries:[...t,...r],cacheTtl:s}}async _lookup(e){try{const[t,r]=await Promise.all([ignoreNoResultErrors(this._dnsLookup(e,fe)),ignoreNoResultErrors(this._dnsLookup(e,pe))]);return{entries:[...t,...r],cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set(e,t,r){if(this.maxTtl>0&&r>0){r=Math.min(r,this.maxTtl)*1e3;t[ue]=Date.now()+r;try{await this._cache.set(e,t,r)}catch(e){this.lookupAsync=async()=>{const t=new Error("Cache Error. Please recreate the CacheableLookup instance.");t.cause=e;throw t}}if(isIterable(this._cache)){this._tick(r)}}}async queryAndCache(e){if(this._hostnamesToFallback.has(e)){return this._dnsLookup(e,de)}let t=await this._resolve(e);if(t.entries.length===0&&this._dnsLookup){t=await this._lookup(e);if(t.entries.length!==0&&this.fallbackDuration>0){this._hostnamesToFallback.add(e)}}const r=t.entries.length===0?this.errorTtl:t.cacheTtl;await this._set(e,t.entries,r);return t.entries}_tick(e){const t=this._nextRemovalTime;if(!t||e<t){clearTimeout(this._removalTimeout);this._nextRemovalTime=e;this._removalTimeout=setTimeout((()=>{this._nextRemovalTime=false;let e=Infinity;const t=Date.now();for(const[r,i]of this._cache){const n=i[ue];if(t>=n){this._cache.delete(r)}else if(n<e){e=n}}if(e!==Infinity){this._tick(e-t)}}),e);if(this._removalTimeout.unref){this._removalTimeout.unref()}}}install(e){verifyAgent(e);if(ae in e){throw new Error("CacheableLookup has been already installed")}e[ae]=e.createConnection;e[le]=this;e.createConnection=(t,r)=>{if(!("lookup"in t)){t.lookup=this.lookup}return e[ae](t,r)}}uninstall(e){verifyAgent(e);if(e[ae]){if(e[le]!==this){throw new Error("The agent is not owned by this CacheableLookup instance")}e.createConnection=e[ae];delete e[ae];delete e[le]}}updateInterfaceInfo(){const{_iface:e}=this;this._iface=getIfaceInfo();if(e.has4&&!this._iface.has4||e.has6&&!this._iface.has6){this._cache.clear()}}clear(e){if(e){this._cache.delete(e);return}this._cache.clear()}}var me=r(4645);function parseLinkHeader(e){const t=[];const r=e.split(",");for(const i of r){const[r,...n]=i.split(";");const s=r.trim();if(s[0]!=="<"||s[s.length-1]!==">"){throw new Error(`Invalid format of the Link header reference: ${s}`)}const o=s.slice(1,-1);const a={};if(n.length===0){throw new Error(`Unexpected end of Link header parameters: ${n.join(";")}`)}for(const t of n){const r=t.trim();const i=r.indexOf("=");if(i===-1){throw new Error(`Failed to parse Link header: ${e}`)}const n=r.slice(0,i).trim();const s=r.slice(i+1).trim();a[n]=s}t.push({reference:o,parameters:a})}return t}const[ge,ye]=p.versions.node.split(".").map(Number);function validateSearchParameters(e){for(const t in e){const r=e[t];c.any([h.string,h.number,h.boolean,h.null_,h.undefined],r)}}const _e=new Map;let ve;const getGlobalDnsCache=()=>{if(ve){return ve}ve=new CacheableLookup;return ve};const be={request:undefined,agent:{http:undefined,https:undefined,http2:undefined},h2session:undefined,decompress:true,timeout:{connect:undefined,lookup:undefined,read:undefined,request:undefined,response:undefined,secureConnect:undefined,send:undefined,socket:undefined},prefixUrl:"",body:undefined,form:undefined,json:undefined,cookieJar:undefined,ignoreInvalidCookies:false,searchParams:undefined,dnsLookup:undefined,dnsCache:undefined,context:{},hooks:{init:[],beforeRequest:[],beforeError:[],beforeRedirect:[],beforeRetry:[],afterResponse:[]},followRedirect:true,maxRedirects:10,cache:undefined,throwHttpErrors:true,username:"",password:"",http2:false,allowGetBody:false,headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},methodRewriting:false,dnsLookupIpVersion:undefined,parseJson:JSON.parse,stringifyJson:JSON.stringify,retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:undefined,calculateDelay:({computedValue:e})=>e,backoffLimit:Number.POSITIVE_INFINITY,noise:100},localAddress:undefined,method:"GET",createConnection:undefined,cacheOptions:{shared:undefined,cacheHeuristic:undefined,immutableMinTimeToLive:undefined,ignoreCargoCult:undefined},https:{alpnProtocols:undefined,rejectUnauthorized:undefined,checkServerIdentity:undefined,certificateAuthority:undefined,key:undefined,certificate:undefined,passphrase:undefined,pfx:undefined,ciphers:undefined,honorCipherOrder:undefined,minVersion:undefined,maxVersion:undefined,signatureAlgorithms:undefined,tlsSessionLifetime:undefined,dhparam:undefined,ecdhCurve:undefined,certificateRevocationLists:undefined},encoding:undefined,resolveBodyOnly:false,isStream:false,responseType:"text",url:undefined,pagination:{transform(e){if(e.request.options.responseType==="json"){return e.body}return JSON.parse(e.body)},paginate({response:e}){const t=e.headers.link;if(typeof t!=="string"||t.trim()===""){return false}const r=parseLinkHeader(t);const i=r.find((e=>e.parameters.rel==="next"||e.parameters.rel==='"next"'));if(i){return{url:new y.URL(i.reference,e.url)}}return false},filter:()=>true,shouldContinue:()=>true,countLimit:Number.POSITIVE_INFINITY,backoff:0,requestLimit:1e4,stackAllItems:false},setHost:true,maxHeaderSize:undefined,signal:undefined,enableUnixSockets:true};const cloneInternals=e=>{const{hooks:t,retry:r}=e;const i={...e,context:{...e.context},cacheOptions:{...e.cacheOptions},https:{...e.https},agent:{...e.agent},headers:{...e.headers},retry:{...r,errorCodes:[...r.errorCodes],methods:[...r.methods],statusCodes:[...r.statusCodes]},timeout:{...e.timeout},hooks:{init:[...t.init],beforeRequest:[...t.beforeRequest],beforeError:[...t.beforeError],beforeRedirect:[...t.beforeRedirect],beforeRetry:[...t.beforeRetry],afterResponse:[...t.afterResponse]},searchParams:e.searchParams?new y.URLSearchParams(e.searchParams):undefined,pagination:{...e.pagination}};if(i.url!==undefined){i.prefixUrl=""}return i};const cloneRaw=e=>{const{hooks:t,retry:r}=e;const i={...e};if(h.object(e.context)){i.context={...e.context}}if(h.object(e.cacheOptions)){i.cacheOptions={...e.cacheOptions}}if(h.object(e.https)){i.https={...e.https}}if(h.object(e.cacheOptions)){i.cacheOptions={...i.cacheOptions}}if(h.object(e.agent)){i.agent={...e.agent}}if(h.object(e.headers)){i.headers={...e.headers}}if(h.object(r)){i.retry={...r};if(h.array(r.errorCodes)){i.retry.errorCodes=[...r.errorCodes]}if(h.array(r.methods)){i.retry.methods=[...r.methods]}if(h.array(r.statusCodes)){i.retry.statusCodes=[...r.statusCodes]}}if(h.object(e.timeout)){i.timeout={...e.timeout}}if(h.object(t)){i.hooks={...t};if(h.array(t.init)){i.hooks.init=[...t.init]}if(h.array(t.beforeRequest)){i.hooks.beforeRequest=[...t.beforeRequest]}if(h.array(t.beforeError)){i.hooks.beforeError=[...t.beforeError]}if(h.array(t.beforeRedirect)){i.hooks.beforeRedirect=[...t.beforeRedirect]}if(h.array(t.beforeRetry)){i.hooks.beforeRetry=[...t.beforeRetry]}if(h.array(t.afterResponse)){i.hooks.afterResponse=[...t.afterResponse]}}if(h.object(e.pagination)){i.pagination={...e.pagination}}return i};const getHttp2TimeoutOption=e=>{const t=[e.timeout.socket,e.timeout.connect,e.timeout.lookup,e.timeout.request,e.timeout.secureConnect].filter((e=>typeof e==="number"));if(t.length>0){return Math.min(...t)}return undefined};const init=(e,t,r)=>{const i=e.hooks?.init;if(i){for(const e of i){e(t,r)}}};class Options{constructor(e,t,r){Object.defineProperty(this,"_unixOptions",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_internals",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_merging",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_init",{enumerable:true,configurable:true,writable:true,value:void 0});c.any([h.string,h.urlInstance,h.object,h.undefined],e);c.any([h.object,h.undefined],t);c.any([h.object,h.undefined],r);if(e instanceof Options||t instanceof Options){throw new TypeError("The defaults must be passed as the third argument")}this._internals=cloneInternals(r?._internals??r??be);this._init=[...r?._init??[]];this._merging=false;this._unixOptions=undefined;try{if(h.plainObject(e)){try{this.merge(e);this.merge(t)}finally{this.url=e.url}}else{try{this.merge(t)}finally{if(t?.url!==undefined){if(e===undefined){this.url=t.url}else{throw new TypeError("The `url` option is mutually exclusive with the `input` argument")}}else if(e!==undefined){this.url=e}}}}catch(e){e.options=this;throw e}}merge(e){if(!e){return}if(e instanceof Options){for(const t of e._init){this.merge(t)}return}e=cloneRaw(e);init(this,e,this);init(e,e,this);this._merging=true;if("isStream"in e){this.isStream=e.isStream}try{let t=false;for(const r in e){if(r==="mutableDefaults"||r==="handlers"){continue}if(r==="url"){continue}if(!(r in this)){throw new Error(`Unexpected option: ${r}`)}this[r]=e[r];t=true}if(t){this._init.push(e)}}finally{this._merging=false}}get request(){return this._internals.request}set request(e){c.any([h.function_,h.undefined],e);this._internals.request=e}get agent(){return this._internals.agent}set agent(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.agent)){throw new TypeError(`Unexpected agent option: ${t}`)}c.any([h.object,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.agent,e)}else{this._internals.agent={...e}}}get h2session(){return this._internals.h2session}set h2session(e){this._internals.h2session=e}get decompress(){return this._internals.decompress}set decompress(e){c.boolean(e);this._internals.decompress=e}get timeout(){return this._internals.timeout}set timeout(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.timeout)){throw new Error(`Unexpected timeout option: ${t}`)}c.any([h.number,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.timeout,e)}else{this._internals.timeout={...e}}}get prefixUrl(){return this._internals.prefixUrl}set prefixUrl(e){c.any([h.string,h.urlInstance],e);if(e===""){this._internals.prefixUrl="";return}e=e.toString();if(!e.endsWith("/")){e+="/"}if(this._internals.prefixUrl&&this._internals.url){const{href:t}=this._internals.url;this._internals.url.href=e+t.slice(this._internals.prefixUrl.length)}this._internals.prefixUrl=e}get body(){return this._internals.body}set body(e){c.any([h.string,h.buffer,h.nodeStream,h.generator,h.asyncGenerator,isFormData,h.undefined],e);if(h.nodeStream(e)){c.truthy(e.readable)}if(e!==undefined){c.undefined(this._internals.form);c.undefined(this._internals.json)}this._internals.body=e}get form(){return this._internals.form}set form(e){c.any([h.plainObject,h.undefined],e);if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.json)}this._internals.form=e}get json(){return this._internals.json}set json(e){if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.form)}this._internals.json=e}get url(){return this._internals.url}set url(e){c.any([h.string,h.urlInstance,h.undefined],e);if(e===undefined){this._internals.url=undefined;return}if(h.string(e)&&e.startsWith("/")){throw new Error("`url` must not start with a slash")}const t=`${this.prefixUrl}${e.toString()}`;const r=new y.URL(t);this._internals.url=r;if(r.protocol==="unix:"){r.href=`http://unix${r.pathname}${r.search}`}if(r.protocol!=="http:"&&r.protocol!=="https:"){const e=new Error(`Unsupported protocol: ${r.protocol}`);e.code="ERR_UNSUPPORTED_PROTOCOL";throw e}if(this._internals.username){r.username=this._internals.username;this._internals.username=""}if(this._internals.password){r.password=this._internals.password;this._internals.password=""}if(this._internals.searchParams){r.search=this._internals.searchParams.toString();this._internals.searchParams=undefined}if(r.hostname==="unix"){if(!this._internals.enableUnixSockets){throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled")}const e=/(?<socketPath>.+?):(?<path>.+)/.exec(`${r.pathname}${r.search}`);if(e?.groups){const{socketPath:t,path:r}=e.groups;this._unixOptions={socketPath:t,path:r,host:""}}else{this._unixOptions=undefined}return}this._unixOptions=undefined}get cookieJar(){return this._internals.cookieJar}set cookieJar(e){c.any([h.object,h.undefined],e);if(e===undefined){this._internals.cookieJar=undefined;return}let{setCookie:t,getCookieString:r}=e;c.function_(t);c.function_(r);if(t.length===4&&r.length===0){t=(0,Q.promisify)(t.bind(e));r=(0,Q.promisify)(r.bind(e));this._internals.cookieJar={setCookie:t,getCookieString:r}}else{this._internals.cookieJar=e}}get signal(){return this._internals.signal}set signal(e){c.object(e);this._internals.signal=e}get ignoreInvalidCookies(){return this._internals.ignoreInvalidCookies}set ignoreInvalidCookies(e){c.boolean(e);this._internals.ignoreInvalidCookies=e}get searchParams(){if(this._internals.url){return this._internals.url.searchParams}if(this._internals.searchParams===undefined){this._internals.searchParams=new y.URLSearchParams}return this._internals.searchParams}set searchParams(e){c.any([h.string,h.object,h.undefined],e);const t=this._internals.url;if(e===undefined){this._internals.searchParams=undefined;if(t){t.search=""}return}const r=this.searchParams;let i;if(h.string(e)){i=new y.URLSearchParams(e)}else if(e instanceof y.URLSearchParams){i=e}else{validateSearchParameters(e);i=new y.URLSearchParams;for(const t in e){const n=e[t];if(n===null){i.append(t,"")}else if(n===undefined){r.delete(t)}else{i.append(t,n)}}}if(this._merging){for(const e of i.keys()){r.delete(e)}for(const[e,t]of i){r.append(e,t)}}else if(t){t.search=r.toString()}else{this._internals.searchParams=r}}get searchParameters(){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}set searchParameters(e){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}get dnsLookup(){return this._internals.dnsLookup}set dnsLookup(e){c.any([h.function_,h.undefined],e);this._internals.dnsLookup=e}get dnsCache(){return this._internals.dnsCache}set dnsCache(e){c.any([h.object,h.boolean,h.undefined],e);if(e===true){this._internals.dnsCache=getGlobalDnsCache()}else if(e===false){this._internals.dnsCache=undefined}else{this._internals.dnsCache=e}}get context(){return this._internals.context}set context(e){c.object(e);if(this._merging){Object.assign(this._internals.context,e)}else{this._internals.context={...e}}}get hooks(){return this._internals.hooks}set hooks(e){c.object(e);for(const t in e){if(!(t in this._internals.hooks)){throw new Error(`Unexpected hook event: ${t}`)}const r=t;const i=e[r];c.any([h.array,h.undefined],i);if(i){for(const e of i){c.function_(e)}}if(this._merging){if(i){this._internals.hooks[r].push(...i)}}else{if(!i){throw new Error(`Missing hook event: ${t}`)}this._internals.hooks[t]=[...i]}}}get followRedirect(){return this._internals.followRedirect}set followRedirect(e){c.boolean(e);this._internals.followRedirect=e}get followRedirects(){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}set followRedirects(e){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}get maxRedirects(){return this._internals.maxRedirects}set maxRedirects(e){c.number(e);this._internals.maxRedirects=e}get cache(){return this._internals.cache}set cache(e){c.any([h.object,h.string,h.boolean,h.undefined],e);if(e===true){this._internals.cache=_e}else if(e===false){this._internals.cache=undefined}else{this._internals.cache=e}}get throwHttpErrors(){return this._internals.throwHttpErrors}set throwHttpErrors(e){c.boolean(e);this._internals.throwHttpErrors=e}get username(){const e=this._internals.url;const t=e?e.username:this._internals.username;return decodeURIComponent(t)}set username(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.username=r}else{this._internals.username=r}}get password(){const e=this._internals.url;const t=e?e.password:this._internals.password;return decodeURIComponent(t)}set password(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.password=r}else{this._internals.password=r}}get http2(){return this._internals.http2}set http2(e){c.boolean(e);this._internals.http2=e}get allowGetBody(){return this._internals.allowGetBody}set allowGetBody(e){c.boolean(e);this._internals.allowGetBody=e}get headers(){return this._internals.headers}set headers(e){c.plainObject(e);if(this._merging){Object.assign(this._internals.headers,lowercaseKeys(e))}else{this._internals.headers=lowercaseKeys(e)}}get methodRewriting(){return this._internals.methodRewriting}set methodRewriting(e){c.boolean(e);this._internals.methodRewriting=e}get dnsLookupIpVersion(){return this._internals.dnsLookupIpVersion}set dnsLookupIpVersion(e){if(e!==undefined&&e!==4&&e!==6){throw new TypeError(`Invalid DNS lookup IP version: ${e}`)}this._internals.dnsLookupIpVersion=e}get parseJson(){return this._internals.parseJson}set parseJson(e){c.function_(e);this._internals.parseJson=e}get stringifyJson(){return this._internals.stringifyJson}set stringifyJson(e){c.function_(e);this._internals.stringifyJson=e}get retry(){return this._internals.retry}set retry(e){c.plainObject(e);c.any([h.function_,h.undefined],e.calculateDelay);c.any([h.number,h.undefined],e.maxRetryAfter);c.any([h.number,h.undefined],e.limit);c.any([h.array,h.undefined],e.methods);c.any([h.array,h.undefined],e.statusCodes);c.any([h.array,h.undefined],e.errorCodes);c.any([h.number,h.undefined],e.noise);if(e.noise&&Math.abs(e.noise)>100){throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${e.noise}`)}for(const t in e){if(!(t in this._internals.retry)){throw new Error(`Unexpected retry option: ${t}`)}}if(this._merging){Object.assign(this._internals.retry,e)}else{this._internals.retry={...e}}const{retry:t}=this._internals;t.methods=[...new Set(t.methods.map((e=>e.toUpperCase())))];t.statusCodes=[...new Set(t.statusCodes)];t.errorCodes=[...new Set(t.errorCodes)]}get localAddress(){return this._internals.localAddress}set localAddress(e){c.any([h.string,h.undefined],e);this._internals.localAddress=e}get method(){return this._internals.method}set method(e){c.string(e);this._internals.method=e.toUpperCase()}get createConnection(){return this._internals.createConnection}set createConnection(e){c.any([h.function_,h.undefined],e);this._internals.createConnection=e}get cacheOptions(){return this._internals.cacheOptions}set cacheOptions(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.shared);c.any([h.number,h.undefined],e.cacheHeuristic);c.any([h.number,h.undefined],e.immutableMinTimeToLive);c.any([h.boolean,h.undefined],e.ignoreCargoCult);for(const t in e){if(!(t in this._internals.cacheOptions)){throw new Error(`Cache option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.cacheOptions,e)}else{this._internals.cacheOptions={...e}}}get https(){return this._internals.https}set https(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.rejectUnauthorized);c.any([h.function_,h.undefined],e.checkServerIdentity);c.any([h.string,h.object,h.array,h.undefined],e.certificateAuthority);c.any([h.string,h.object,h.array,h.undefined],e.key);c.any([h.string,h.object,h.array,h.undefined],e.certificate);c.any([h.string,h.undefined],e.passphrase);c.any([h.string,h.buffer,h.array,h.undefined],e.pfx);c.any([h.array,h.undefined],e.alpnProtocols);c.any([h.string,h.undefined],e.ciphers);c.any([h.string,h.buffer,h.undefined],e.dhparam);c.any([h.string,h.undefined],e.signatureAlgorithms);c.any([h.string,h.undefined],e.minVersion);c.any([h.string,h.undefined],e.maxVersion);c.any([h.boolean,h.undefined],e.honorCipherOrder);c.any([h.number,h.undefined],e.tlsSessionLifetime);c.any([h.string,h.undefined],e.ecdhCurve);c.any([h.string,h.buffer,h.array,h.undefined],e.certificateRevocationLists);for(const t in e){if(!(t in this._internals.https)){throw new Error(`HTTPS option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.https,e)}else{this._internals.https={...e}}}get encoding(){return this._internals.encoding}set encoding(e){if(e===null){throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead")}c.any([h.string,h.undefined],e);this._internals.encoding=e}get resolveBodyOnly(){return this._internals.resolveBodyOnly}set resolveBodyOnly(e){c.boolean(e);this._internals.resolveBodyOnly=e}get isStream(){return this._internals.isStream}set isStream(e){c.boolean(e);this._internals.isStream=e}get responseType(){return this._internals.responseType}set responseType(e){if(e===undefined){this._internals.responseType="text";return}if(e!=="text"&&e!=="buffer"&&e!=="json"){throw new Error(`Invalid \`responseType\` option: ${e}`)}this._internals.responseType=e}get pagination(){return this._internals.pagination}set pagination(e){c.object(e);if(this._merging){Object.assign(this._internals.pagination,e)}else{this._internals.pagination=e}}get auth(){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}set auth(e){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}get setHost(){return this._internals.setHost}set setHost(e){c.boolean(e);this._internals.setHost=e}get maxHeaderSize(){return this._internals.maxHeaderSize}set maxHeaderSize(e){c.any([h.number,h.undefined],e);this._internals.maxHeaderSize=e}get enableUnixSockets(){return this._internals.enableUnixSockets}set enableUnixSockets(e){c.boolean(e);this._internals.enableUnixSockets=e}toJSON(){return{...this._internals}}[Symbol.for("nodejs.util.inspect.custom")](e,t){return(0,Q.inspect)(this._internals,t)}createNativeRequestOptions(){const e=this._internals;const t=e.url;let r;if(t.protocol==="https:"){r=e.http2?e.agent:e.agent.https}else{r=e.agent.http}const{https:i}=e;let{pfx:n}=i;if(h.array(n)&&h.plainObject(n[0])){n=n.map((e=>({buf:e.buffer,passphrase:e.passphrase})))}return{...e.cacheOptions,...this._unixOptions,ALPNProtocols:i.alpnProtocols,ca:i.certificateAuthority,cert:i.certificate,key:i.key,passphrase:i.passphrase,pfx:i.pfx,rejectUnauthorized:i.rejectUnauthorized,checkServerIdentity:i.checkServerIdentity??re.checkServerIdentity,ciphers:i.ciphers,honorCipherOrder:i.honorCipherOrder,minVersion:i.minVersion,maxVersion:i.maxVersion,sigalgs:i.signatureAlgorithms,sessionTimeout:i.tlsSessionLifetime,dhparam:i.dhparam,ecdhCurve:i.ecdhCurve,crl:i.certificateRevocationLists,lookup:e.dnsLookup??e.dnsCache?.lookup,family:e.dnsLookupIpVersion,agent:r,setHost:e.setHost,method:e.method,maxHeaderSize:e.maxHeaderSize,localAddress:e.localAddress,headers:e.headers,createConnection:e.createConnection,timeout:e.http2?getHttp2TimeoutOption(e):undefined,h2session:e.h2session}}getRequestFunction(){const e=this._internals.url;const{request:t}=this._internals;if(!t&&e){return this.getFallbackRequestFunction()}return t}getFallbackRequestFunction(){const e=this._internals.url;if(!e){return}if(e.protocol==="https:"){if(this._internals.http2){if(ge<15||ge===15&&ye<10){const e=new Error("To use the `http2` option, install Node.js 15.10.0 or above");e.code="EUNSUPPORTED";throw e}return me.auto}return ie.request}return _.request}freeze(){const e=this._internals;Object.freeze(e);Object.freeze(e.hooks);Object.freeze(e.hooks.afterResponse);Object.freeze(e.hooks.beforeError);Object.freeze(e.hooks.beforeRedirect);Object.freeze(e.hooks.beforeRequest);Object.freeze(e.hooks.beforeRetry);Object.freeze(e.hooks.init);Object.freeze(e.https);Object.freeze(e.cacheOptions);Object.freeze(e.agent);Object.freeze(e.headers);Object.freeze(e.timeout);Object.freeze(e.retry);Object.freeze(e.retry.errorCodes);Object.freeze(e.retry.methods);Object.freeze(e.retry.statusCodes)}}const isResponseOk=e=>{const{statusCode:t}=e;const r=e.request.options.followRedirect?299:399;return t>=200&&t<=r||t===304};class ParseError extends RequestError{constructor(e,t){const{options:r}=t.request;super(`${e.message} in "${r.url.toString()}"`,e,t.request);this.name="ParseError";this.code="ERR_BODY_PARSE_FAILURE"}}const parseBody=(e,t,r,i)=>{const{rawBody:n}=e;try{if(t==="text"){return n.toString(i)}if(t==="json"){return n.length===0?"":r(n.toString(i))}if(t==="buffer"){return n}}catch(t){throw new ParseError(t,e)}throw new ParseError({message:`Unknown body type '${t}'`,name:"Error"},e)};function isClientRequest(e){return e.writable&&!e.writableEnded}const xe=isClientRequest;function isUnixSocketURL(e){return e.protocol==="unix:"||e.hostname==="unix"}const{buffer:Te}=C;const we=h.string(p.versions.brotli);const Se=new Set(["GET","HEAD"]);const Ee=new WeakableMap;const Ae=new Set([300,301,302,303,304,307,308]);const Ce=["socket","connect","continue","information","upgrade"];const core_noop=()=>{};class Request extends g.Duplex{constructor(e,t,r){super({autoDestroy:false,highWaterMark:0});Object.defineProperty(this,"constructor",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_noPipe",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"options",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"requestUrl",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"redirectUrls",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"retryCount",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopRetry",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_downloadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_uploadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopReading",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_pipedServerResponses",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_responseSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_bodySize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_unproxyEvents",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_isFromCache",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cannotHaveBody",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_triggerRead",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cancelTimeouts",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_removeListeners",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_nativeResponse",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_flushed",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_aborted",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_requestInitialized",{enumerable:true,configurable:true,writable:true,value:void 0});this._downloadedSize=0;this._uploadedSize=0;this._stopReading=false;this._pipedServerResponses=new Set;this._cannotHaveBody=false;this._unproxyEvents=core_noop;this._triggerRead=false;this._cancelTimeouts=core_noop;this._removeListeners=core_noop;this._jobs=[];this._flushed=false;this._requestInitialized=false;this._aborted=false;this.redirectUrls=[];this.retryCount=0;this._stopRetry=core_noop;this.on("pipe",(e=>{if(e?.headers){Object.assign(this.options.headers,e.headers)}}));this.on("newListener",(e=>{if(e==="retry"&&this.listenerCount("retry")>0){throw new Error("A retry listener has been attached already.")}}));try{this.options=new Options(e,t,r);if(!this.options.url){if(this.options.prefixUrl===""){throw new TypeError("Missing `url` property")}this.options.url=""}this.requestUrl=this.options.url}catch(e){const{options:t}=e;if(t){this.options=t}this.flush=async()=>{this.flush=async()=>{};this.destroy(e)};return}const{body:i}=this.options;if(h.nodeStream(i)){i.once("error",(e=>{if(this._flushed){this._beforeError(new UploadError(e,this))}else{this.flush=async()=>{this.flush=async()=>{};this._beforeError(new UploadError(e,this))}}}))}if(this.options.signal){const abort=()=>{this.destroy(new AbortError(this))};if(this.options.signal.aborted){abort()}else{this.options.signal.addEventListener("abort",abort);this._removeListeners=()=>{this.options.signal.removeEventListener("abort",abort)}}}}async flush(){if(this._flushed){return}this._flushed=true;try{await this._finalizeBody();if(this.destroyed){return}await this._makeRequest();if(this.destroyed){this._request?.destroy();return}for(const e of this._jobs){e()}this._jobs.length=0;this._requestInitialized=true}catch(e){this._beforeError(e)}}_beforeError(e){if(this._stopReading){return}const{response:t,options:r}=this;const i=this.retryCount+(e.name==="RetryError"?0:1);this._stopReading=true;if(!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}const n=e;void(async()=>{if(t?.readable&&!t.rawBody&&!this._request?.socket?.destroyed){t.setEncoding(this.readableEncoding);const e=await this._setRawBody(t);if(e){t.body=t.rawBody.toString()}}if(this.listenerCount("retry")!==0){let s;try{let e;if(t&&"retry-after"in t.headers){e=Number(t.headers["retry-after"]);if(Number.isNaN(e)){e=Date.parse(t.headers["retry-after"])-Date.now();if(e<=0){e=1}}else{e*=1e3}}const o=r.retry;s=await o.calculateDelay({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:te({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:o.maxRetryAfter??r.timeout.request??Number.POSITIVE_INFINITY})})}catch(e){void this._error(new RequestError(e.message,e,this));return}if(s){await new Promise((e=>{const t=setTimeout(e,s);this._stopRetry=()=>{clearTimeout(t);e()}}));if(this.destroyed){return}try{for(const e of this.options.hooks.beforeRetry){await e(n,this.retryCount+1)}}catch(t){void this._error(new RequestError(t.message,e,this));return}if(this.destroyed){return}this.destroy();this.emit("retry",this.retryCount+1,e,(e=>{const t=new Request(r.url,e,r);t.retryCount=this.retryCount+1;p.nextTick((()=>{void t.flush()}));return t}));return}}void this._error(n)})()}_read(){this._triggerRead=true;const{response:e}=this;if(e&&!this._stopReading){if(e.readableLength){this._triggerRead=false}let t;while((t=e.read())!==null){this._downloadedSize+=t.length;const e=this.downloadProgress;if(e.percent<1){this.emit("downloadProgress",e)}this.push(t)}}}_write(e,t,r){const write=()=>{this._writeRequest(e,t,r)};if(this._requestInitialized){write()}else{this._jobs.push(write)}}_final(e){const endRequest=()=>{if(!this._request||this._request.destroyed){e();return}this._request.end((t=>{if(this._request._writableState?.errored){return}if(!t){this._bodySize=this._uploadedSize;this.emit("uploadProgress",this.uploadProgress);this._request.emit("upload-complete")}e(t)}))};if(this._requestInitialized){endRequest()}else{this._jobs.push(endRequest)}}_destroy(e,t){this._stopReading=true;this.flush=async()=>{};this._stopRetry();this._cancelTimeouts();this._removeListeners();if(this.options){const{body:e}=this.options;if(h.nodeStream(e)){e.destroy()}}if(this._request){this._request.destroy()}if(e!==null&&!h.undefined(e)&&!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}t(e)}pipe(e,t){if(e instanceof _.ServerResponse){this._pipedServerResponses.add(e)}return super.pipe(e,t)}unpipe(e){if(e instanceof _.ServerResponse){this._pipedServerResponses.delete(e)}super.unpipe(e);return this}async _finalizeBody(){const{options:e}=this;const{headers:t}=e;const r=!h.undefined(e.form);const i=!h.undefined(e.json);const n=!h.undefined(e.body);const s=Se.has(e.method)&&!(e.method==="GET"&&e.allowGetBody);this._cannotHaveBody=s;if(r||i||n){if(s){throw new TypeError(`The \`${e.method}\` method cannot be used with a body`)}const i=!h.string(t["content-type"]);if(n){if(isFormData(e.body)){const r=new FormDataEncoder(e.body);if(i){t["content-type"]=r.headers["Content-Type"]}if("Content-Length"in r.headers){t["content-length"]=r.headers["Content-Length"]}e.body=r.encode()}if(is_form_data_isFormData(e.body)&&i){t["content-type"]=`multipart/form-data; boundary=${e.body.getBoundary()}`}}else if(r){if(i){t["content-type"]="application/x-www-form-urlencoded"}const{form:r}=e;e.form=undefined;e.body=new y.URLSearchParams(r).toString()}else{if(i){t["content-type"]="application/json"}const{json:r}=e;e.json=undefined;e.body=e.stringifyJson(r)}const o=await getBodySize(e.body,e.headers);if(h.undefined(t["content-length"])&&h.undefined(t["transfer-encoding"])&&!s&&!h.undefined(o)){t["content-length"]=String(o)}}if(e.responseType==="json"&&!("accept"in e.headers)){e.headers.accept="application/json"}this._bodySize=Number(t["content-length"])||undefined}async _onResponseBase(e){if(this.isAborted){return}const{options:t}=this;const{url:r}=t;this._nativeResponse=e;if(t.decompress){e=I(e)}const i=e.statusCode;const n=e;n.statusMessage=n.statusMessage??_.STATUS_CODES[i];n.url=t.url.toString();n.requestUrl=this.requestUrl;n.redirectUrls=this.redirectUrls;n.request=this;n.isFromCache=this._nativeResponse.fromCache??false;n.ip=this.ip;n.retryCount=this.retryCount;n.ok=isResponseOk(n);this._isFromCache=n.isFromCache;this._responseSize=Number(e.headers["content-length"])||undefined;this.response=n;e.once("end",(()=>{this._responseSize=this._downloadedSize;this.emit("downloadProgress",this.downloadProgress)}));e.once("error",(t=>{this._aborted=true;e.destroy();this._beforeError(new ReadError(t,this))}));e.once("aborted",(()=>{this._aborted=true;this._beforeError(new ReadError({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}));this.emit("downloadProgress",this.downloadProgress);const s=e.headers["set-cookie"];if(h.object(t.cookieJar)&&s){let e=s.map((async e=>t.cookieJar.setCookie(e,r.toString())));if(t.ignoreInvalidCookies){e=e.map((async e=>{try{await e}catch{}}))}try{await Promise.all(e)}catch(e){this._beforeError(e);return}}if(this.isAborted){return}if(t.followRedirect&&e.headers.location&&Ae.has(i)){e.resume();this._cancelTimeouts();this._unproxyEvents();if(this.redirectUrls.length>=t.maxRedirects){this._beforeError(new MaxRedirectsError(this));return}this._request=undefined;const s=new Options(undefined,undefined,this.options);const o=i===303&&s.method!=="GET"&&s.method!=="HEAD";const a=i!==307&&i!==308;const l=s.methodRewriting&&a;if(o||l){s.method="GET";s.body=undefined;s.json=undefined;s.form=undefined;delete s.headers["content-length"]}try{const t=m.Buffer.from(e.headers.location,"binary").toString();const i=new y.URL(t,r);if(!isUnixSocketURL(r)&&isUnixSocketURL(i)){this._beforeError(new RequestError("Cannot redirect to UNIX socket",{},this));return}if(i.hostname!==r.hostname||i.port!==r.port){if("host"in s.headers){delete s.headers.host}if("cookie"in s.headers){delete s.headers.cookie}if("authorization"in s.headers){delete s.headers.authorization}if(s.username||s.password){s.username="";s.password=""}}else{i.username=s.username;i.password=s.password}this.redirectUrls.push(i);s.prefixUrl="";s.url=i;for(const e of s.hooks.beforeRedirect){await e(s,n)}this.emit("redirect",s,n);this.options=s;await this._makeRequest()}catch(e){this._beforeError(e);return}return}if(t.isStream&&t.throwHttpErrors&&!isResponseOk(n)){this._beforeError(new HTTPError(n));return}e.on("readable",(()=>{if(this._triggerRead){this._read()}}));this.on("resume",(()=>{e.resume()}));this.on("pause",(()=>{e.pause()}));e.once("end",(()=>{this.push(null)}));if(this._noPipe){const t=await this._setRawBody();if(t){this.emit("response",e)}return}this.emit("response",e);for(const r of this._pipedServerResponses){if(r.headersSent){continue}for(const i in e.headers){const n=t.decompress?i!=="content-encoding":true;const s=e.headers[i];if(n){r.setHeader(i,s)}}r.statusCode=i}}async _setRawBody(e=this){if(e.readableEnded){return false}try{const t=await Te(e);if(!this.isAborted){this.response.rawBody=t;return true}}catch{}return false}async _onResponse(e){try{await this._onResponseBase(e)}catch(e){this._beforeError(e)}}_onRequest(e){const{options:t}=this;const{timeout:r,url:i}=t;T(e);if(this.options.http2){e.setTimeout(0)}this._cancelTimeouts=timedOut(e,r,i);const n=t.cache?"cacheableResponse":"response";e.once(n,(e=>{void this._onResponse(e)}));e.once("error",(t=>{this._aborted=true;e.destroy();t=t instanceof timed_out_TimeoutError?new TimeoutError(t,this.timings,this):new RequestError(t.message,t,this);this._beforeError(t)}));this._unproxyEvents=proxyEvents(e,this,Ce);this._request=e;this.emit("uploadProgress",this.uploadProgress);this._sendBody();this.emit("request",e)}async _asyncWrite(e){return new Promise(((t,r)=>{super.write(e,(e=>{if(e){r(e);return}t()}))}))}_sendBody(){const{body:e}=this.options;const t=this.redirectUrls.length===0?this:this._request??this;if(h.nodeStream(e)){e.pipe(t)}else if(h.generator(e)||h.asyncGenerator(e)){(async()=>{try{for await(const t of e){await this._asyncWrite(t)}super.end()}catch(e){this._beforeError(e)}})()}else if(!h.undefined(e)){this._writeRequest(e,undefined,(()=>{}));t.end()}else if(this._cannotHaveBody||this._noPipe){t.end()}}_prepareCache(e){if(!Ee.has(e)){const t=new P(((e,t)=>{const r=e._request(e,t);if(h.promise(r)){r.once=(e,t)=>{if(e==="error"){(async()=>{try{await r}catch(e){t(e)}})()}else if(e==="abort"){(async()=>{try{const e=await r;e.once("abort",t)}catch{}})()}else{throw new Error(`Unknown HTTP2 promise event: ${e}`)}return r}}return r}),e);Ee.set(e,t.request())}}async _createCacheableRequest(e,t){return new Promise(((r,i)=>{Object.assign(t,urlToOptions(e));let n;const s=Ee.get(t.cache)(t,(async e=>{e._readableState.autoDestroy=false;if(n){const fix=()=>{if(e.req){e.complete=e.req.res.complete}};e.prependOnceListener("end",fix);fix();(await n).emit("cacheableResponse",e)}r(e)}));s.once("error",i);s.once("request",(async e=>{n=e;r(n)}))}))}async _makeRequest(){const{options:e}=this;const{headers:t,username:r,password:i}=e;const n=e.cookieJar;for(const e in t){if(h.undefined(t[e])){delete t[e]}else if(h.null_(t[e])){throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${e}\` header`)}}if(e.decompress&&h.undefined(t["accept-encoding"])){t["accept-encoding"]=we?"gzip, deflate, br":"gzip, deflate"}if(r||i){const e=m.Buffer.from(`${r}:${i}`).toString("base64");t.authorization=`Basic ${e}`}if(n){const r=await n.getCookieString(e.url.toString());if(h.nonEmptyString(r)){t.cookie=r}}e.prefixUrl="";let s;for(const t of e.hooks.beforeRequest){const r=await t(e);if(!h.undefined(r)){s=()=>r;break}}if(!s){s=e.getRequestFunction()}const o=e.url;this._requestOptions=e.createNativeRequestOptions();if(e.cache){this._requestOptions._request=s;this._requestOptions.cache=e.cache;this._requestOptions.body=e.body;this._prepareCache(e.cache)}const a=e.cache?this._createCacheableRequest:s;try{let t=a(o,this._requestOptions);if(h.promise(t)){t=await t}if(h.undefined(t)){t=e.getFallbackRequestFunction()(o,this._requestOptions);if(h.promise(t)){t=await t}}if(xe(t)){this._onRequest(t)}else if(this.writable){this.once("finish",(()=>{void this._onResponse(t)}));this._sendBody()}else{void this._onResponse(t)}}catch(e){if(e instanceof types_CacheError){throw new CacheError(e,this)}throw e}}async _error(e){try{if(e instanceof HTTPError&&!this.options.throwHttpErrors){}else{for(const t of this.options.hooks.beforeError){e=await t(e)}}}catch(t){e=new RequestError(t.message,t,this)}this.destroy(e)}_writeRequest(e,t,r){if(!this._request||this._request.destroyed){return}this._request.write(e,t,(i=>{if(!i&&!this._request.destroyed){this._uploadedSize+=m.Buffer.byteLength(e,t);const r=this.uploadProgress;if(r.percent<1){this.emit("uploadProgress",r)}}r(i)}))}get ip(){return this.socket?.remoteAddress}get isAborted(){return this._aborted}get socket(){return this._request?.socket??undefined}get downloadProgress(){let e;if(this._responseSize){e=this._downloadedSize/this._responseSize}else if(this._responseSize===this._downloadedSize){e=1}else{e=0}return{percent:e,transferred:this._downloadedSize,total:this._responseSize}}get uploadProgress(){let e;if(this._bodySize){e=this._uploadedSize/this._bodySize}else if(this._bodySize===this._uploadedSize){e=1}else{e=0}return{percent:e,transferred:this._uploadedSize,total:this._bodySize}}get timings(){return this._request?.timings}get isFromCache(){return this._isFromCache}get reusedSocket(){return this._request?.reusedSocket}}class types_CancelError extends RequestError{constructor(e){super("Promise was canceled",{},e);this.name="CancelError";this.code="ERR_CANCELED"}get isCanceled(){return true}}const Ne=["request","response","redirect","uploadProgress","downloadProgress"];function asPromise(e){let t;let r;let i;const n=new d.EventEmitter;const s=new PCancelable(((o,a,l)=>{l((()=>{t.destroy()}));l.shouldReject=false;l((()=>{a(new types_CancelError(t))}));const makeRequest=u=>{l((()=>{}));const c=e??new Request(undefined,undefined,i);c.retryCount=u;c._noPipe=true;t=c;c.once("response",(async e=>{const t=(e.headers["content-encoding"]??"").toLowerCase();const i=t==="gzip"||t==="deflate"||t==="br";const{options:n}=c;if(i&&!n.decompress){e.body=e.rawBody}else{try{e.body=parseBody(e,n.responseType,n.parseJson,n.encoding)}catch(t){e.body=e.rawBody.toString();if(isResponseOk(e)){c._beforeError(t);return}}}try{const t=n.hooks.afterResponse;for(const[r,i]of t.entries()){e=await i(e,(async e=>{n.merge(e);n.prefixUrl="";if(e.url){n.url=e.url}n.hooks.afterResponse=n.hooks.afterResponse.slice(0,r);throw new RetryError(c)}));if(!(h.object(e)&&h.number(e.statusCode)&&!h.nullOrUndefined(e.body))){throw new TypeError("The `afterResponse` hook returned an invalid value")}}}catch(e){c._beforeError(e);return}r=e;if(!isResponseOk(e)){c._beforeError(new HTTPError(e));return}c.destroy();o(c.options.resolveBodyOnly?e.body:e)}));const onError=e=>{if(s.isCanceled){return}const{options:t}=c;if(e instanceof HTTPError&&!t.throwHttpErrors){const{response:t}=e;c.destroy();o(c.options.resolveBodyOnly?t.body:t);return}a(e)};c.once("error",onError);const d=c.options?.body;c.once("retry",((t,r)=>{e=undefined;const n=c.options.body;if(d===n&&h.nodeStream(n)){r.message="Cannot retry with consumed body stream";onError(r);return}i=c.options;makeRequest(t)}));proxyEvents(c,n,Ne);if(h.undefined(e)){void c.flush()}};makeRequest(0)}));s.on=(e,t)=>{n.on(e,t);return s};s.off=(e,t)=>{n.off(e,t);return s};const shortcut=e=>{const t=(async()=>{await s;const{options:t}=r.request;return parseBody(r,e,t.parseJson,t.encoding)})();Object.defineProperties(t,Object.getOwnPropertyDescriptors(s));return t};s.json=()=>{if(t.options){const{headers:e}=t.options;if(!t.writableFinished&&!("accept"in e)){e.accept="application/json"}}return shortcut("json")};s.buffer=()=>shortcut("buffer");s.text=()=>shortcut("text");return s}const delay=async e=>new Promise((t=>{setTimeout(t,e)}));const isGotInstance=e=>h.function_(e);const Oe=["get","post","put","patch","head","delete"];const create=e=>{e={options:new Options(undefined,undefined,e.options),handlers:[...e.handlers],mutableDefaults:e.mutableDefaults};Object.defineProperty(e,"mutableDefaults",{enumerable:true,configurable:false,writable:false});const got=(t,r,i=e.options)=>{const n=new Request(t,r,i);let s;const lastHandler=e=>{n.options=e;n._noPipe=!e.isStream;void n.flush();if(e.isStream){return n}if(!s){s=asPromise(n)}return s};let o=0;const iterateHandlers=t=>{const r=e.handlers[o++]??lastHandler;const i=r(t,iterateHandlers);if(h.promise(i)&&!n.options.isStream){if(!s){s=asPromise(n)}if(i!==s){const e=Object.getOwnPropertyDescriptors(s);for(const t in e){if(t in i){delete e[t]}}Object.defineProperties(i,e);i.cancel=s.cancel}}return i};return iterateHandlers(n.options)};got.extend=(...t)=>{const r=new Options(undefined,undefined,e.options);const i=[...e.handlers];let n;for(const e of t){if(isGotInstance(e)){r.merge(e.defaults.options);i.push(...e.defaults.handlers);n=e.defaults.mutableDefaults}else{r.merge(e);if(e.handlers){i.push(...e.handlers)}n=e.mutableDefaults}}return create({options:r,handlers:i,mutableDefaults:Boolean(n)})};const paginateEach=async function*(t,r){let i=new Options(t,r,e.options);i.resolveBodyOnly=false;const{pagination:n}=i;c.function_(n.transform);c.function_(n.shouldContinue);c.function_(n.filter);c.function_(n.paginate);c.number(n.countLimit);c.number(n.requestLimit);c.number(n.backoff);const s=[];let{countLimit:o}=n;let a=0;while(a<n.requestLimit){if(a!==0){await delay(n.backoff)}const e=await got(undefined,undefined,i);const t=await n.transform(e);const r=[];c.array(t);for(const e of t){if(n.filter({item:e,currentItems:r,allItems:s})){if(!n.shouldContinue({item:e,currentItems:r,allItems:s})){return}yield e;if(n.stackAllItems){s.push(e)}r.push(e);if(--o<=0){return}}}const l=n.paginate({response:e,currentItems:r,allItems:s});if(l===false){return}if(l===e.request.options){i=e.request.options}else{i.merge(l);c.any([h.urlInstance,h.undefined],l.url);if(l.url!==undefined){i.prefixUrl="";i.url=l.url}}a++}};got.paginate=paginateEach;got.paginate.all=async(e,t)=>{const r=[];for await(const i of paginateEach(e,t)){r.push(i)}return r};got.paginate.each=paginateEach;got.stream=(e,t)=>got(e,{...t,isStream:true});for(const e of Oe){got[e]=(t,r)=>got(t,{...r,method:e});got.stream[e]=(t,r)=>got(t,{...r,method:e,isStream:true})}if(!e.mutableDefaults){Object.freeze(e.handlers);e.options.freeze()}Object.defineProperty(got,"defaults",{value:e,writable:false,configurable:false,enumerable:true});return got};const Re=create;const ke={options:new Options,handlers:[],mutableDefaults:false};const Pe=Re(ke);const Le=Pe},2561:e=>{"use strict";e.exports={version:"3.10.0"}}};var t={};function __nccwpck_require__(r){var i=t[r];if(i!==undefined){return i.exports}var n=t[r]={id:r,loaded:false,exports:{}};var s=true;try{e[r].call(n.exports,n,n.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}n.loaded=true;return n.exports}(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:true});const t=__nccwpck_require__(4379);const i=__nccwpck_require__(8584);const n=__nccwpck_require__(8989);const s=new t.Option("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info");const o=new t.Option("-d,--deployments <path>","Path to the deployments folder");const a=new t.Option("--dry-run","Do not verify anything, just output the verifications that would be performed");const l=new t.Option("-n,--network <network name>","Network to verify").makeOptionMandatory();const u=new t.Option("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)");const c=new t.Option("-k,--api-key <key>","Scan API Key");const h=new t.Command("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',(e=>{try{const t=JSON.parse(e);if(!Array.isArray(t)){throw new Error(`Constructor arguments must be an array, got ${t}`)}return t}catch(e){throw new t.InvalidOptionArgumentError(`Malformed constructor arguments specified: ${e}`)}})).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},contracts:[{network:e.network,address:e.address,contractName:e.name,deployment:e.deployment,constructorArguments:e.arguments}]};try{await(0,i.verifyNonTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));const d=new t.Command("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",(e=>(e===null||e===void 0?void 0:e.trim())?e.split(",").map((e=>e.trim())):undefined)).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},filter:e.contracts};try{await(0,i.verifyTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));new t.Command("lz-verify-contract").description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(h).addCommand(d,{isDefault:true}).parseAsync()})();module.exports=r})();