mcp-fetch
Version:
A Model Context Protocol server providing tools for HTTP requests, GraphQL queries, WebSocket connections, and browser automation
2 lines • 83.9 kB
JavaScript
/*! For license information please see 683.js.LICENSE.txt */
"use strict";exports.id=683,exports.ids=[683],exports.modules={1868:(t,e,s)=>{function n(){return process.versions.electron&&!process.defaultApp?0:1}function i(t){return t.slice(n()+1)}function r(){return process.argv[n()]}s.d(e,{a:()=>i,h:()=>r})},3768:(t,e,s)=>{s.d(e,{e:()=>o});var n=s(5455);let i,r=[];function o(t,e,s,l){i=l;let c={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return c;const a=/\.json|\..*rc$/.test(t.extends);let l=null;if(a)l=function(t,e){return i.path.resolve(t,e)}(e,t.extends);else try{l=require.resolve(t.extends)}catch(e){return t}!function(t){if(r.indexOf(t)>-1)throw new n.w(`Circular extended configurations: '${t}'.`)}(l),r.push(l),c=a?JSON.parse(i.readFileSync(l,"utf8")):require(t.extends),delete t.extends,c=o(c,i.path.dirname(l),s,i)}return r=[],s?a(c,t):Object.assign({},c,t)}function a(t,e){const s={};function n(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const i of Object.keys(e))n(e[i])&&n(s[i])?s[i]=a(t[i],e[i]):s[i]=e[i];return s}},4998:(t,e,s)=>{s.d(e,{A:()=>E});var n=s(4770);const i={right:function(t,e){t=t.trim();const s=a.stringWidth(t);return s<e?" ".repeat(e-s)+t:t},center:function(t,e){t=t.trim();const s=a.stringWidth(t);return s>=e?t:" ".repeat(e-s>>1)+t}};class r{constructor(t){var e;this.width=t.width,this.wrap=null===(e=t.wrap)||void 0===e||e,this.rows=[]}span(...t){this.div(...t).span=!0}resetOutput(){this.rows=[]}div(...t){if(0===t.length&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&"string"==typeof t[0])return this.applyLayoutDSL(t[0]);const e=t.map(t=>"string"==typeof t?this.colFromString(t):t);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return 1===t.length&&"string"==typeof t[0]&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){const e=t.split("\n").map(t=>t.split("\t"));let s=0;return e.forEach(t=>{t.length>1&&a.stringWidth(t[0])>s&&(s=Math.min(Math.floor(.5*this.width),a.stringWidth(t[0])))}),e.forEach(t=>{this.div(...t.map((e,n)=>({text:e.trim(),padding:this.measurePadding(e),width:0===n&&t.length>1?s:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){const e=a.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){const t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(t=>!t.hidden).map(t=>t.text).join("\n")}rowToString(t,e){return this.rasterize(t).forEach((s,n)=>{let r="";s.forEach((s,l)=>{const{width:c}=t[l],h=this.negatePadding(t[l]);let f=s;h>a.stringWidth(s)&&(f+=" ".repeat(h-a.stringWidth(s))),t[l].align&&"left"!==t[l].align&&this.wrap&&(f=(0,i[t[l].align])(f,h),a.stringWidth(f)<h&&(f+=" ".repeat((c||0)-a.stringWidth(f)-1)));const u=t[l].padding||[0,0,0,0];u[3]&&(r+=" ".repeat(u[3])),r+=o(t[l],f,"| "),r+=f,r+=o(t[l],f," |"),u[1]&&(r+=" ".repeat(u[1])),0===n&&e.length>0&&(r=this.renderInline(r,e[e.length-1]))}),e.push({text:r.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){const s=t.match(/^ */),n=s?s[0].length:0,i=e.text,r=a.stringWidth(i.trimRight());return e.span?this.wrap?n<r?t:(e.hidden=!0,i.trimRight()+" ".repeat(n-r)+t.trimLeft()):(e.hidden=!0,i+t):t}rasterize(t){const e=[],s=this.columnWidths(t);let n;return t.forEach((t,i)=>{t.width=s[i],n=this.wrap?a.wrap(t.text,this.negatePadding(t),{hard:!0}).split("\n"):t.text.split("\n"),t.border&&(n.unshift("."+"-".repeat(this.negatePadding(t)+2)+"."),n.push("'"+"-".repeat(this.negatePadding(t)+2)+"'")),t.padding&&(n.unshift(...new Array(t.padding[0]||0).fill("")),n.push(...new Array(t.padding[2]||0).fill(""))),n.forEach((t,s)=>{e[s]||e.push([]);const n=e[s];for(let t=0;t<i;t++)void 0===n[t]&&n.push("");n.push(t)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[3]||0)+(t.padding[1]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(t=>t.width||a.stringWidth(t.text));let e=t.length,s=this.width;const n=t.map(t=>{if(t.width)return e--,s-=t.width,t.width}),i=e?Math.floor(s/e):0;return n.map((e,s)=>void 0===e?Math.max(i,function(t){const e=t.padding||[],s=1+(e[3]||0)+(e[1]||0);return t.border?s+4:s}(t[s])):e)}}function o(t,e,s){return t.border?/[.']-+[.']/.test(e)?"":0!==e.trim().length?s:" ":""}let a;const l=new RegExp("(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function c(t){return t.replace(l,"")}function h(t,e){const[s,n]=t.match(l)||["",""];t=c(t);let i="";for(let s=0;s<t.length;s++)0!==s&&s%e===0&&(i+="\n"),i+=t.charAt(s);return s&&n&&(i=`${s}${i}${n}`),i}var f=s(2003),u=s(4383),d=s(2460),p=s(6857),g=s(7791),m=s(1868),y=s(5455);const b={fs:{readFileSync:u.readFileSync,writeFile:u.writeFile},format:d.format,resolve:f.resolve,exists:t=>{try{return(0,u.statSync)(t).isFile()}catch(t){return!1}}};let v;class w{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles="boolean"!=typeof t.updateFiles||t.updateFiles,this.locale=t.locale||"en",this.fallbackToLanguage="boolean"!=typeof t.fallbackToLanguage||t.fallbackToLanguage,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if("string"!=typeof arguments[0])return this._taggedLiteral(arguments[0],...arguments);const e=t.shift();let s=function(){};return"function"==typeof t[t.length-1]&&(s=t.pop()),s=s||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s(),v.format.apply(v.format,[this.cache[this.locale][e]||e].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),e=t.shift(),s=t.shift(),n=t.shift();let i=function(){};"function"==typeof t[t.length-1]&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let r=1===n?e:s;this.cache[this.locale][e]&&(r=this.cache[this.locale][e][1===n?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:s},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const o=[r];return~r.indexOf("%d")&&o.push(n),v.format.apply(v.format,o.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let s="";return t.forEach(function(t,n){const i=e[n+1];s+=t,void 0!==i&&(s+="%s")}),this.__.apply(this,[s].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),1===this.writeQueue.length&&this._processWriteQueue()}_processWriteQueue(){const t=this,e=this.writeQueue[0],s=e.directory,n=e.locale,i=e.cb,r=this._resolveLocaleFile(s,n),o=JSON.stringify(this.cache[n],null,2);v.fs.writeFile(r,o,"utf-8",function(e){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(e)})}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{v.fs.readFileSync&&(t=JSON.parse(v.fs.readFileSync(e,"utf-8")))}catch(s){if(s instanceof SyntaxError&&(s.message="syntax error in "+e),"ENOENT"!==s.code)throw s;t={}}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let s=v.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(s)&&~e.lastIndexOf("_")){const n=v.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(n)&&(s=n)}return s}_fileExistsSync(t){return v.exists(t)}}const O="loading a directory of commands is not supported yet for ESM";let j;try{j=(0,p.fileURLToPath)("file:///Users/matiasgf/repos/mcps/mcp-fetch/node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs")}catch(t){j=process.cwd()}const _=j.substring(0,j.lastIndexOf("node_modules")),E={assert:{notStrictEqual:n.notStrictEqual,strictEqual:n.strictEqual},cliui:function(t){return function(t,e){return a=e,new r({width:(null==t?void 0:t.width)||("object"==typeof process&&process.stdout&&process.stdout.columns?process.stdout.columns:80),wrap:null==t?void 0:t.wrap})}(t,{stringWidth:t=>[...t].length,stripAnsi:c,wrap:h})},findUp:function(t,e){let s,n=(0,f.resolve)(".",t);for((0,u.statSync)(n).isDirectory()||(n=(0,f.dirname)(n));;){if(s=e(n,(0,u.readdirSync)(n)),s)return(0,f.resolve)(n,s);if(n=(0,f.dirname)(s=n),s===n)break}},getEnv:t=>process.env[t],inspect:d.inspect,getCallerFile:()=>{throw new y.w(O)},getProcessArgvBin:m.h,mainFilename:_||process.cwd(),Parser:g.A,path:{basename:f.basename,dirname:f.dirname,extname:f.extname,relative:f.relative,resolve:f.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:u.readFileSync,require:()=>{throw new y.w("require is not supported by ESM")},requireDirectory:()=>{throw new y.w(O)},stringWidth:t=>[...t].length,y18n:(A={directory:(0,f.resolve)(j,"../../../locales"),updateFiles:!1},function(t,e){v=e;const s=new w(t);return{__:s.__.bind(s),__n:s.__n.bind(s),setLocale:s.setLocale.bind(s),getLocale:s.getLocale.bind(s),updateLocale:s.updateLocale.bind(s),locale:s.locale}}(A,b))};var A},5455:(t,e,s)=>{s.d(e,{w:()=>n});class n extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,n)}}},7791:(t,e,s)=>{s.d(e,{A:()=>O});var n,i=s(2460),r=s(2003);function o(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),-1===t.indexOf("-")&&-1===t.indexOf("_"))return t;{let e="",s=!1;const n=t.match(/^-+/);for(let i=n?n[0].length:0;i<t.length;i++){let n=t.charAt(i);s&&(s=!1,n=n.toUpperCase()),0===i||"-"!==n&&"_"!==n?"-"!==n&&"_"!==n&&(e+=n):s=!0}return e}}function a(t,e){const s=t.toLowerCase();e=e||"-";let n="";for(let i=0;i<t.length;i++){const r=s.charAt(i),o=t.charAt(i);n+=r!==o&&i>0?`${e}${s.charAt(i)}`:o}return n}function l(t){return null!=t&&("number"==typeof t||!!/^0x[0-9a-f]+$/i.test(t)||!/^0[^.]/.test(t)&&/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t))}let c;function h(t){return void 0!==t?t+1:1}function f(t){return"__proto__"===t?"___proto___":t}!function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"}(n||(n={}));var u,d,p,g=s(4383);const m=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,y=null!==(d=null===(u=null===process||void 0===process?void 0:process.versions)||void 0===u?void 0:u.node)&&void 0!==d?d:null===(p=null===process||void 0===process?void 0:process.version)||void 0===p?void 0:p.slice(1);if(y&&Number(y.match(/^([^.]+)/)[1])<m)throw Error(`yargs parser supports a minimum Node.js version of ${m}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const b=process?process.env:{},v=new class{constructor(t){c=t}parse(t,e){const s=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),i=function(t){if(Array.isArray(t))return t.map(t=>"string"!=typeof t?t+"":t);t=t.trim();let e=0,s=null,n=null,i=null;const r=[];for(let o=0;o<t.length;o++)s=n,n=t.charAt(o)," "!==n||i?(n===i?i=null:"'"!==n&&'"'!==n||i||(i=n),r[e]||(r[e]=""),r[e]+=n):" "!==s&&e++;return r}(t),r="string"==typeof t,u=function(t){const e=[],s=Object.create(null);let n=!0;for(Object.keys(t).forEach(function(s){e.push([].concat(t[s],s))});n;){n=!1;for(let t=0;t<e.length;t++)for(let s=t+1;s<e.length;s++)if(e[t].filter(function(t){return-1!==e[s].indexOf(t)}).length){e[t]=e[t].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(t){const e=(t=t.filter(function(t,e,s){return s.indexOf(t)===e})).pop();void 0!==e&&"string"==typeof e&&(s[e]=t)}),s}(Object.assign(Object.create(null),s.alias)),d=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},s.configuration),p=Object.assign(Object.create(null),s.default),g=s.configObjects||[],m=s.envPrefix,y=d["populate--"],b=y?"--":"_",v=Object.create(null),w=Object.create(null),O=s.__||c.format,j={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},_=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,E=new RegExp("^--"+d["negation-prefix"]+"(.+)");[].concat(s.array||[]).filter(Boolean).forEach(function(t){const e="object"==typeof t?t.key:t,s=Object.keys(t).map(function(t){return{boolean:"bools",string:"strings",number:"numbers"}[t]}).filter(Boolean).pop();s&&(j[s][e]=!0),j.arrays[e]=!0,j.keys.push(e)}),[].concat(s.boolean||[]).filter(Boolean).forEach(function(t){j.bools[t]=!0,j.keys.push(t)}),[].concat(s.string||[]).filter(Boolean).forEach(function(t){j.strings[t]=!0,j.keys.push(t)}),[].concat(s.number||[]).filter(Boolean).forEach(function(t){j.numbers[t]=!0,j.keys.push(t)}),[].concat(s.count||[]).filter(Boolean).forEach(function(t){j.counts[t]=!0,j.keys.push(t)}),[].concat(s.normalize||[]).filter(Boolean).forEach(function(t){j.normalize[t]=!0,j.keys.push(t)}),"object"==typeof s.narg&&Object.entries(s.narg).forEach(([t,e])=>{"number"==typeof e&&(j.nargs[t]=e,j.keys.push(t))}),"object"==typeof s.coerce&&Object.entries(s.coerce).forEach(([t,e])=>{"function"==typeof e&&(j.coercions[t]=e,j.keys.push(t))}),void 0!==s.config&&(Array.isArray(s.config)||"string"==typeof s.config?[].concat(s.config).filter(Boolean).forEach(function(t){j.configs[t]=!0}):"object"==typeof s.config&&Object.entries(s.config).forEach(([t,e])=>{"boolean"!=typeof e&&"function"!=typeof e||(j.configs[t]=e)})),function(...t){t.forEach(function(t){Object.keys(t||{}).forEach(function(t){j.aliases[t]||(j.aliases[t]=[].concat(u[t]||[]),j.aliases[t].concat(t).forEach(function(e){if(/-/.test(e)&&d["camel-case-expansion"]){const s=o(e);s!==t&&-1===j.aliases[t].indexOf(s)&&(j.aliases[t].push(s),v[s]=!0)}}),j.aliases[t].concat(t).forEach(function(e){if(e.length>1&&/[A-Z]/.test(e)&&d["camel-case-expansion"]){const s=a(e,"-");s!==t&&-1===j.aliases[t].indexOf(s)&&(j.aliases[t].push(s),v[s]=!0)}}),j.aliases[t].forEach(function(e){j.aliases[e]=[t].concat(j.aliases[t].filter(function(t){return e!==t}))}))})})}(s.key,u,s.default,j.arrays),Object.keys(p).forEach(function(t){(j.aliases[t]||[]).forEach(function(e){p[e]=p[t]})});let A=null;Object.keys(j.counts).find(t=>U(t,j.arrays)?(A=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",t)),!0):!!U(t,j.nargs)&&(A=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",t)),!0));let C=[];const k=Object.assign(Object.create(null),{_:[]}),x={};for(let t=0;t<i.length;t++){const e=i[t],s=e.replace(/^-{3,}/,"---");let n,r,o,a,l,c;if("--"!==e&&/^-/.test(e)&&q(e))M(e);else{if(s.match(/^---+(=|$)/)){M(e);continue}if(e.match(/^--.+=/)||!d["short-option-groups"]&&e.match(/^-.+=/))a=e.match(/^--?([^=]+)=([\s\S]*)$/),null!==a&&Array.isArray(a)&&a.length>=3&&(U(a[1],j.arrays)?t=P(t,a[1],i,a[2]):!1!==U(a[1],j.nargs)?t=S(t,a[1],i,a[2]):$(a[1],a[2],!0));else if(e.match(E)&&d["boolean-negation"])a=e.match(E),null!==a&&Array.isArray(a)&&a.length>=2&&(r=a[1],$(r,!!U(r,j.arrays)&&[!1]));else if(e.match(/^--.+/)||!d["short-option-groups"]&&e.match(/^-[^-]+/))a=e.match(/^--?(.+)/),null!==a&&Array.isArray(a)&&a.length>=2&&(r=a[1],U(r,j.arrays)?t=P(t,r,i):!1!==U(r,j.nargs)?t=S(t,r,i):(l=i[t+1],void 0===l||l.match(/^-/)&&!l.match(_)||U(r,j.bools)||U(r,j.counts)?/^(true|false)$/.test(l)?($(r,l),t++):$(r,B(r)):($(r,l),t++)));else if(e.match(/^-.\..+=/))a=e.match(/^-([^=]+)=([\s\S]*)$/),null!==a&&Array.isArray(a)&&a.length>=3&&$(a[1],a[2]);else if(e.match(/^-.\..+/)&&!e.match(_))l=i[t+1],a=e.match(/^-(.\..+)/),null!==a&&Array.isArray(a)&&a.length>=2&&(r=a[1],void 0===l||l.match(/^-/)||U(r,j.bools)||U(r,j.counts)?$(r,B(r)):($(r,l),t++));else if(e.match(/^-[^-]+/)&&!e.match(_)){o=e.slice(1,-1).split(""),n=!1;for(let s=0;s<o.length;s++){if(l=e.slice(s+2),o[s+1]&&"="===o[s+1]){c=e.slice(s+3),r=o[s],U(r,j.arrays)?t=P(t,r,i,c):!1!==U(r,j.nargs)?t=S(t,r,i,c):$(r,c),n=!0;break}if("-"!==l){if(/[A-Za-z]/.test(o[s])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(l)&&!1===U(l,j.bools)){$(o[s],l),n=!0;break}if(o[s+1]&&o[s+1].match(/\W/)){$(o[s],l),n=!0;break}$(o[s],B(o[s]))}else $(o[s],l)}r=e.slice(-1)[0],n||"-"===r||(U(r,j.arrays)?t=P(t,r,i):!1!==U(r,j.nargs)?t=S(t,r,i):(l=i[t+1],void 0===l||/^(-|--)[^-]/.test(l)&&!l.match(_)||U(r,j.bools)||U(r,j.counts)?/^(true|false)$/.test(l)?($(r,l),t++):$(r,B(r)):($(r,l),t++)))}else if(e.match(/^-[0-9]$/)&&e.match(_)&&U(e.slice(1),j.bools))r=e.slice(1),$(r,B(r));else{if("--"===e){C=i.slice(t+1);break}if(d["halt-at-non-option"]){C=i.slice(t);break}M(e)}}}function M(t){const e=W("_",t);"string"!=typeof e&&"number"!=typeof e||k._.push(e)}function S(t,e,s,n){let i,r=U(e,j.nargs);if(r="number"!=typeof r||isNaN(r)?1:r,0===r)return T(n)||(A=Error(O("Argument unexpected for: %s",e))),$(e,B(e)),t;let o=T(n)?0:1;if(d["nargs-eats-options"])s.length-(t+1)+o<r&&(A=Error(O("Not enough arguments following: %s",e))),o=r;else{for(i=t+1;i<s.length&&(!s[i].match(/^-[^0-9]/)||s[i].match(_)||q(s[i]));i++)o++;o<r&&(A=Error(O("Not enough arguments following: %s",e)))}let a=Math.min(o,r);for(!T(n)&&a>0&&($(e,n),a--),i=t+1;i<a+t+1;i++)$(e,s[i]);return t+a}function P(t,e,s,n){let i=[],o=n||s[t+1];const a=U(e,j.nargs);if(U(e,j.bools)&&!/^(true|false)$/.test(o))i.push(!0);else if(T(o)||T(n)&&/^-/.test(o)&&!_.test(o)&&!q(o)){if(void 0!==p[e]){const t=p[e];i=Array.isArray(t)?t:[t]}}else{T(n)||i.push(N(e,n,!0));for(let n=t+1;n<s.length&&!(!d["greedy-arrays"]&&i.length>0||a&&"number"==typeof a&&i.length>=a)&&(o=s[n],!/^-/.test(o)||_.test(o)||q(o));n++)t=n,i.push(N(e,o,r))}return"number"==typeof a&&(a&&i.length<a||isNaN(a)&&0===i.length)&&(A=Error(O("Not enough arguments following: %s",e))),$(e,i),t}function $(t,e,s=r){if(/-/.test(t)&&d["camel-case-expansion"]){const e=t.split(".").map(function(t){return o(t)}).join(".");I(t,e)}const n=N(t,e,s),i=t.split(".");H(k,i,n),j.aliases[t]&&j.aliases[t].forEach(function(t){const e=t.split(".");H(k,e,n)}),i.length>1&&d["dot-notation"]&&(j.aliases[i[0]]||[]).forEach(function(e){let s=e.split(".");const r=[].concat(i);r.shift(),s=s.concat(r),(j.aliases[t]||[]).includes(s.join("."))||H(k,s,n)}),U(t,j.normalize)&&!U(t,j.arrays)&&[t].concat(j.aliases[t]||[]).forEach(function(t){Object.defineProperty(x,t,{enumerable:!0,get:()=>e,set(t){e="string"==typeof t?c.normalize(t):t}})})}function I(t,e){j.aliases[t]&&j.aliases[t].length||(j.aliases[t]=[e],v[e]=!0),j.aliases[e]&&j.aliases[e].length||I(e,t)}function N(t,e,s){s&&(e=function(t){return"string"!=typeof t||"'"!==t[0]&&'"'!==t[0]||t[t.length-1]!==t[0]?t:t.substring(1,t.length-1)}(e)),(U(t,j.bools)||U(t,j.counts))&&"string"==typeof e&&(e="true"===e);let n=Array.isArray(e)?e.map(function(e){return W(t,e)}):W(t,e);return U(t,j.counts)&&(T(n)||"boolean"==typeof n)&&(n=h()),U(t,j.normalize)&&U(t,j.arrays)&&(n=Array.isArray(e)?e.map(t=>c.normalize(t)):c.normalize(e)),n}function W(t,e){return d["parse-positional-numbers"]||"_"!==t?(U(t,j.strings)||U(t,j.bools)||Array.isArray(e)||(l(e)&&d["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${e}`)))||!T(e)&&U(t,j.numbers))&&(e=Number(e)),e):e}function L(t,e){Object.keys(t).forEach(function(s){const n=t[s],i=e?e+"."+s:s;"object"==typeof n&&null!==n&&!Array.isArray(n)&&d["dot-notation"]?L(n,i):(!D(k,i.split("."))||U(i,j.arrays)&&d["combine-arrays"])&&$(i,n)})}function z(t,e){if(void 0===m)return;const s="string"==typeof m?m:"",n=c.env();Object.keys(n).forEach(function(i){if(""===s||0===i.lastIndexOf(s,0)){const r=i.split("__").map(function(t,e){return 0===e&&(t=t.substring(s.length)),o(t)});(e&&j.configs[r.join(".")]||!e)&&!D(t,r)&&$(r.join("."),n[i])}})}function F(t,e,s,n=!1){Object.keys(s).forEach(function(i){D(t,i.split("."))||(H(t,i.split("."),s[i]),n&&(w[i]=!0),(e[i]||[]).forEach(function(e){D(t,e.split("."))||H(t,e.split("."),s[i])}))})}function D(t,e){let s=t;d["dot-notation"]||(e=[e.join(".")]),e.slice(0,-1).forEach(function(t){s=s[t]||{}});const n=e[e.length-1];return"object"==typeof s&&n in s}function H(t,e,s){let n=t;d["dot-notation"]||(e=[e.join(".")]),e.slice(0,-1).forEach(function(t){t=f(t),"object"==typeof n&&void 0===n[t]&&(n[t]={}),"object"!=typeof n[t]||Array.isArray(n[t])?(Array.isArray(n[t])?n[t].push({}):n[t]=[n[t],{}],n=n[t][n[t].length-1]):n=n[t]});const i=f(e[e.length-1]),r=U(e.join("."),j.arrays),o=Array.isArray(s);let a=d["duplicate-arguments-array"];!a&&U(i,j.nargs)&&(a=!0,(!T(n[i])&&1===j.nargs[i]||Array.isArray(n[i])&&n[i].length===j.nargs[i])&&(n[i]=void 0)),s===h()?n[i]=h(n[i]):Array.isArray(n[i])?a&&r&&o?n[i]=d["flatten-duplicate-arrays"]?n[i].concat(s):(Array.isArray(n[i][0])?n[i]:[n[i]]).concat([s]):a||Boolean(r)!==Boolean(o)?n[i]=n[i].concat([s]):n[i]=s:void 0===n[i]&&r?n[i]=o?s:[s]:!a||void 0===n[i]||U(i,j.counts)||U(i,j.bools)?n[i]=s:n[i]=[n[i],s]}function U(t,e){const s=[].concat(j.aliases[t]||[],t),n=Object.keys(e),i=s.find(t=>n.includes(t));return!!i&&e[i]}function R(t){const e=Object.keys(j);return[].concat(e.map(t=>j[t])).some(function(e){return Array.isArray(e)?e.includes(t):e[t]})}function q(t){return d["unknown-options-as-args"]&&function(t){return!(t=t.replace(/^-{3,}/,"--")).match(_)&&(!function(t){if(t.match(_)||!t.match(/^-[^-]+/))return!1;let e,s=!0;const n=t.slice(1).split("");for(let i=0;i<n.length;i++){if(e=t.slice(i+2),!R(n[i])){s=!1;break}if(n[i+1]&&"="===n[i+1]||"-"===e||/[A-Za-z]/.test(n[i])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(e)||n[i+1]&&n[i+1].match(/\W/))break}return s}(t)&&!function(t,...e){return[].concat(...e).some(function(e){const s=t.match(e);return s&&R(s[1])})}(t,/^-+([^=]+?)=[\s\S]*$/,E,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/))}(t)}function B(t){return U(t,j.bools)||U(t,j.counts)||!(`${t}`in p)?(e=function(t){let e=n.BOOLEAN;return U(t,j.strings)?e=n.STRING:U(t,j.numbers)?e=n.NUMBER:U(t,j.bools)?e=n.BOOLEAN:U(t,j.arrays)&&(e=n.ARRAY),e}(t),{[n.BOOLEAN]:!0,[n.STRING]:"",[n.NUMBER]:void 0,[n.ARRAY]:[]}[e]):p[t];var e}function T(t){return void 0===t}return z(k,!0),z(k,!1),function(t){const e=Object.create(null);F(e,j.aliases,p),Object.keys(j.configs).forEach(function(s){const n=t[s]||e[s];if(n)try{let t=null;const e=c.resolve(c.cwd(),n),i=j.configs[s];if("function"==typeof i){try{t=i(e)}catch(e){t=e}if(t instanceof Error)return void(A=t)}else t=c.require(e);L(t)}catch(e){"PermissionDenied"===e.name?A=e:t[s]&&(A=Error(O("Invalid JSON config file: %s",n)))}})}(k),void 0!==g&&g.forEach(function(t){L(t)}),F(k,j.aliases,p,!0),function(t){let e;const s=new Set;Object.keys(t).forEach(function(n){if(!s.has(n)&&(e=U(n,j.coercions),"function"==typeof e))try{const i=W(n,e(t[n]));[].concat(j.aliases[n]||[],n).forEach(e=>{s.add(e),t[e]=i})}catch(t){A=t}})}(k),d["set-placeholder-key"]&&function(t){j.keys.forEach(e=>{~e.indexOf(".")||void 0===t[e]&&(t[e]=void 0)})}(k),Object.keys(j.counts).forEach(function(t){D(k,t.split("."))||$(t,0)}),y&&C.length&&(k[b]=[]),C.forEach(function(t){k[b].push(t)}),d["camel-case-expansion"]&&d["strip-dashed"]&&Object.keys(k).filter(t=>"--"!==t&&t.includes("-")).forEach(t=>{delete k[t]}),d["strip-aliased"]&&[].concat(...Object.keys(u).map(t=>u[t])).forEach(t=>{d["camel-case-expansion"]&&t.includes("-")&&delete k[t.split(".").map(t=>o(t)).join(".")],delete k[t]}),{aliases:Object.assign({},j.aliases),argv:Object.assign(x,k),configuration:d,defaulted:Object.assign({},w),error:A,newAliases:Object.assign({},v)}}}({cwd:process.cwd,env:()=>b,format:i.format,normalize:r.normalize,resolve:r.resolve,require:t=>{if("undefined"!=typeof require)return require(t);if(t.match(/\.json$/))return JSON.parse((0,g.readFileSync)(t,"utf8"));throw Error("only .json config files are supported in ESM")}}),w=function(t,e){return v.parse(t.slice(),e).argv};w.detailed=function(t,e){return v.parse(t.slice(),e)},w.camelCase=o,w.decamelize=a,w.looksLikeNumber=l;const O=w},9683:(t,e,s)=>{s.d(e,{default:()=>Xt});var n=s(4998);function i(t,e,s,n){s.assert.notStrictEqual(t,e,n)}function r(t,e){e.assert.strictEqual(typeof t,"string")}function o(t){return Object.keys(t)}function a(t){return!!t&&!!t.then&&"function"==typeof t.then}var l=s(5455);function c(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,n=e.shift();if(!n)throw new Error(`No command found in: ${t}`);const i={cmd:n.replace(s,""),demanded:[],optional:[]};return e.forEach((t,n)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&n===e.length-1&&(r=!0),/^\[/.test(t)?i.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):i.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})}),i}const h=["first","second","third","fourth","fifth","sixth"];function f(t,e,s){try{let n=0;const[i,r,o]="object"==typeof t?[{demanded:[],optional:[]},t,e]:[c(`cmd ${t}`),e,s],a=[].slice.call(r);for(;a.length&&void 0===a[a.length-1];)a.pop();const h=o||a.length;if(h<i.demanded.length)throw new l.w(`Not enough arguments provided. Expected ${i.demanded.length} but received ${a.length}.`);const f=i.demanded.length+i.optional.length;if(h>f)throw new l.w(`Too many arguments provided. Expected max ${f} but received ${h}.`);i.demanded.forEach(t=>{const e=u(a.shift());0===t.cmd.filter(t=>t===e||"*"===t).length&&d(e,t.cmd,n),n+=1}),i.optional.forEach(t=>{if(0===a.length)return;const e=u(a.shift());0===t.cmd.filter(t=>t===e||"*"===t).length&&d(e,t.cmd,n),n+=1})}catch(t){console.warn(t.stack)}}function u(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function d(t,e,s){throw new l.w(`Invalid ${h[s]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}class p{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,n=!1){if(f("<array|function> [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let n=0;n<t.length;n++){if("function"!=typeof t[n])throw Error("middleware must be a function");const i=t[n];i.applyBeforeValidation=e,i.global=s}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const i=t;i.applyBeforeValidation=e,i.global=s,i.mutates=n,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(t=>{const n=[...s[e]||[],e];return!t.option||!n.includes(t.option)}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}}function g(t,e,s,n){return s.reduce((t,s)=>{if(s.applyBeforeValidation!==n)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(a(t))return t.then(t=>Promise.all([t,s(t,e)])).then(([t,e])=>Object.assign(t,e));{const n=s(t,e);return a(n)?n.then(e=>Object.assign(t,e)):Object.assign(t,n)}},t)}function m(t,e,s=t=>{throw t}){try{const s="function"==typeof t?t():t;return a(s)?s.then(t=>e(t)):e(s)}catch(t){return s(t)}}const y=/(^\*)|(^\$0)/;class b{constructor(t,e,s,n){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=n,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,n){"boolean"!=typeof(n=n||{}).recurse&&(n.recurse=!1),Array.isArray(n.extensions)||(n.extensions=["js"]);const i="function"==typeof n.visit?n.visit:t=>t;n.visit=(t,e,s)=>{const n=i(t,e,s);if(n){if(this.requireCache.has(e))return n;this.requireCache.add(e),this.addHandler(n)}return n},this.shim.requireDirectory({require:e,filename:s},t,n)}addHandler(t,e,s,n,i,r){let o=[];const a=function(t){return t?t.map(t=>(t.applyBeforeValidation=!1,t)):[]}(i);if(n=n||(()=>{}),Array.isArray(t))if(function(t){return t.every(t=>"string"==typeof t)}(t))[t,...o]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(v(s))return void this.addHandler([t].concat(o),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const i=c(t);o=o.map(t=>c(t).cmd);let l=!1;const h=[i.cmd].concat(o).filter(t=>!y.test(t)||(l=!0,!1));0===h.length&&l&&h.push("$0"),l&&(i.cmd=h[0],o=h.slice(1),t=t.replace(y,i.cmd)),o.forEach(t=>{this.aliasMap[t]=i.cmd}),!1!==e&&this.usage.command(t,e,l,o,r),this.handlers[i.cmd]={original:t,description:e,handler:n,builder:s||{},middlewares:a,deprecated:r,demanded:i.demanded,optional:i.optional},l&&(this.defaultCommand=this.handlers[i.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,n,i,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,l=e.getInternalMethods().getContext(),c=l.commands.slice(),h=!t;t&&(l.commands.push(t),l.fullCommands.push(o.original));const f=this.applyBuilderUpdateUsageAndParse(h,o,e,s.aliases,c,n,i,r);return a(f)?f.then(t=>this.applyMiddlewareAndGetResult(h,o,t.innerArgv,l,i,t.aliases,e)):this.applyMiddlewareAndGetResult(h,o,f.innerArgv,l,i,f.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,n,i,r,o,l){const c=e.builder;let h=s;if(w(c)){s.getInternalMethods().getUsageInstance().freeze();const f=c(s.getInternalMethods().reset(n),l);if(a(f))return f.then(n=>{var a;return h=(a=n)&&"function"==typeof a.getInternalMethods?n:s,this.parseAndUpdateUsage(t,e,h,i,r,o)})}else(function(t){return"object"==typeof t})(c)&&(s.getInternalMethods().getUsageInstance().freeze(),h=s.getInternalMethods().reset(n),Object.keys(e.builder).forEach(t=>{h.option(t,c[t])}));return this.parseAndUpdateUsage(t,e,h,i,r,o)}parseAndUpdateUsage(t,e,s,n,i,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(n,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return a(o)?o.then(t=>({aliases:s.parsed.aliases,innerArgv:t})):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=y.test(e.original)?e.original.replace(y,"").trim():e.original,n=t.filter(t=>!y.test(t));return n.push(s),`$0 ${n.join(" ")}`}handleValidationAndGetResult(t,e,s,n,i,r,o,l){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(i,l,r.parsed.error,t);s=m(s,t=>(e(t),t))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const n=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,n,!1,!1),s=m(s=g(s,r,o,!1),t=>{const s=e.handler(t);return a(s)?s.then(()=>t):t}),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),a(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch(t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}})}return t||(n.commands.pop(),n.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,n,i,r,o){let l={};if(i)return s;o.getInternalMethods().getHasOutput()||(l=this.populatePositionals(e,s,n,o));const c=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),h=g(s,o,c,!0);return a(h)?h.then(s=>this.handleValidationAndGetResult(t,e,s,n,r,o,c,l)):this.handleValidationAndGetResult(t,e,h,n,r,o,c,l)}populatePositionals(t,e,s,n){e._=e._.slice(s.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const t=i.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map(t=>""+t)),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),n),o}populatePositional(t,e,s){const n=t.cmd[0];t.variadic?s[n]=e._.splice(0).map(String):e._.length&&(s[n]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=c(t);return s.demanded.forEach(t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n,e.demand[s]=!0}),s.optional.forEach(t=>{const[s,...n]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=n}),e}postProcessPositionals(t,e,s,n){const i=Object.assign({},n.getOptions());i.default=Object.assign(s.default,i.default);for(const t of Object.keys(s.alias))i.alias[t]=(i.alias[t]||[]).concat(s.alias[t]);i.array=i.array.concat(s.array),i.config={};const r=[];if(Object.keys(e).forEach(t=>{e[t].map(e=>{i.configuration["unknown-options-as-args"]&&(i.key[t]=!0),r.push(`--${t}`),r.push(e)})}),!r.length)return;const o=Object.assign({},i.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:o}));if(a.error)n.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach(t=>{s.push(...a.aliases[t])}),Object.keys(a.argv).forEach(i=>{s.includes(i)&&(e[i]||(e[i]=a.argv[i]),!this.isInConfigs(n,i)&&!this.isDefaulted(n,i)&&Object.prototype.hasOwnProperty.call(t,i)&&Object.prototype.hasOwnProperty.call(a.argv,i)&&(Array.isArray(t[i])||Array.isArray(a.argv[i]))?t[i]=[].concat(t[i],a.argv[i]):t[i]=a.argv[i])})}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some(t=>Object.prototype.hasOwnProperty.call(t,e))||s.some(t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=y.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(w(e))return e(t,!0);v(e)||Object.keys(e).forEach(s=>{t.option(s,e[s])})}moduleName(t){const e=function(t){if("undefined"==typeof require)return null;for(let e,s=0,n=Object.keys(require.cache);s<n.length;s++)if(e=require.cache[n[s]],e.exports===t)return e;return null}(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:s}){for(const n of[t,e,s]){if("string"==typeof n||!1===n)return n;i(n,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();i(t,void 0,this.shim),({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t)}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function v(t){return"object"==typeof t&&!!t.builder&&"function"==typeof t.handler}function w(t){return"function"==typeof t}function O(t={},e=()=>!0){const s={};return o(t).forEach(n=>{e(n,t[n])&&(s[n]=t[n])}),s}function j(t){"undefined"!=typeof process&&[process.stdout,process.stderr].forEach(e=>{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)})}function _(t){return"boolean"==typeof t}function E(t){return"object"==typeof t}function A(t){return E(t)?t.indentation:0}function C(t){return E(t)?t.text:t}class k{constructor(t,e,s,n){var i,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=n,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(i=this.shim.getEnv("SHELL"))||void 0===i?void 0:i.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,n){const i=this.command.getCommandHandlers();for(let e=0,s=t.length;e<s;++e)if(i[t[e]]&&i[t[e]].builder){const s=i[t[e]].builder;if(w(s)){this.indexAfterLastReset=e+1;const t=this.yargs.getInternalMethods().reset();return s(t,!0),t.argv}}const r=[];this.commandCompletions(r,t,s),this.optionCompletions(r,t,e,s),this.choicesFromOptionsCompletions(r,t,e,s),this.choicesFromPositionalsCompletions(r,t,e,s),n(null,r)}commandCompletions(t,e,s){const n=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||n[n.length-1]===s||this.previousArgHasChoices(e)||this.usage.getCommands().forEach(s=>{const n=c(s[0]).cmd;if(-1===e.indexOf(n))if(this.zshShell){const e=s[1]||"";t.push(n.replace(/:/g,"\\:")+":"+e)}else t.push(n)})}optionCompletions(t,e,s,n){if((n.match(/^-/)||""===n&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);i.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||this.completeOptionKey(r,t,n,o&&!!s.default[r])})}}choicesFromOptionsCompletions(t,e,s,n){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map(t=>t.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,s,n){if(""===n&&t.length>0&&this.previousArgHasChoices(e))return;const i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=i[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(n)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const n=e.replace(/^-+/,""),i=this.yargs.getOptions(),r=[n,...this.yargs.getAliases()[n]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(i.key,t)&&Array.isArray(i.choices[t])){o=i.choices[t];break}return o?o.filter(t=>!s||t.startsWith(s)):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const n=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(n(e))return!0;if(s&&n(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(n(t))return!0;return!1}completeOptionKey(t,e,s,n){var i,r,o,a;let l=t;if(this.zshShell){const e=this.usage.getDescriptions(),s=null===(r=null===(i=null==this?void 0:this.aliases)||void 0===i?void 0:i[t])||void 0===r?void 0:r.find(t=>{const s=e[t];return"string"==typeof s&&s.length>0}),n=s?e[s]:void 0,c=null!==(a=null!==(o=e[t])&&void 0!==o?o:n)&&void 0!==a?a:"";l=`${t.replace(/:/g,"\\:")}:${c.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const c=!/^--/.test(s)&&/^[^0-9]$/.test(t)?"-":"--";e.push(c+l),n&&e.push(c+"no-"+l)}customCompletion(t,e,s,n){if(i(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return a(t)?t.then(t=>{this.shim.process.nextTick(()=>{n(null,t)})}).catch(t=>{this.shim.process.nextTick(()=>{n(t,void 0)})}):n(null,t)}return this.customCompletionFunction.length>3?this.customCompletionFunction(s,e,(i=n)=>this.defaultCompletion(t,e,s,i),t=>{n(null,t)}):this.customCompletionFunction(s,e,t=>{n(null,t)})}getCompletion(t,e){const s=t.length?t[t.length-1]:"",n=this.yargs.parse(t,!0),i=this.customCompletionFunction?n=>this.customCompletion(t,n,s,e):n=>this.defaultCompletion(t,n,s,e);return a(n)?n.then(i):i(n)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const n=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,n),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function x(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let n,i;for(n=0;n<=e.length;n++)s[n]=[n];for(i=0;i<=t.length;i++)s[0][i]=i;for(n=1;n<=e.length;n++)for(i=1;i<=t.length;i++)e.charAt(n-1)===t.charAt(i-1)?s[n][i]=s[n-1][i-1]:n>1&&i>1&&e.charAt(n-2)===t.charAt(i-1)&&e.charAt(n-1)===t.charAt(i-2)?s[n][i]=s[n-2][i-2]+1:s[n][i]=Math.min(s[n-1][i-1]+1,Math.min(s[n][i-1]+1,s[n-1][i]+1));return s[e.length][t.length]}const M=["$0","--","_"];var S,P,$,I,N,W,L,z,F,D,H,U,R,q,B,T,V,G,Y,K,J,Q,Z,X,tt,et,st,nt,it,rt,ot,at,lt,ct,ht,ft=s(3768),ut=function(t,e,s,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,s):i?i.value=s:e.set(t,s),s},dt=function(t,e,s,n){if("a"===s&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?n:"a"===s?n.call(t):n?n.value:e.get(t)};const pt=Symbol("copyDoubleDash"),gt=Symbol("copyDoubleDash"),mt=Symbol("deleteFromParserHintObject"),yt=Symbol("emitWarning"),bt=Symbol("freeze"),vt=Symbol("getDollarZero"),wt=Symbol("getParserConfiguration"),Ot=Symbol("getUsageConfiguration"),jt=Symbol("guessLocale"),_t=Symbol("guessVersion"),Et=Symbol("parsePositionalNumbers"),At=Symbol("pkgUp"),Ct=Symbol("populateParserHintArray"),kt=Symbol("populateParserHintSingleValueDictionary"),xt=Symbol("populateParserHintArrayDictionary"),Mt=Symbol("populateParserHintDictionary"),St=Symbol("sanitizeKey"),Pt=Symbol("setKey"),$t=Symbol("unfreeze"),It=Symbol("validateAsync"),Nt=Symbol("getCommandInstance"),Wt=Symbol("getContext"),Lt=Symbol("getHasOutput"),zt=Symbol("getLoggerInstance"),Ft=Symbol("getParseContext"),Dt=Symbol("getUsageInstance"),Ht=Symbol("getValidationInstance"),Ut=Symbol("hasParseCallback"),Rt=Symbol("isGlobalContext"),qt=Symbol("postProcess"),Bt=Symbol("rebase"),Tt=Symbol("reset"),Vt=Symbol("runYargsParserAndExecuteCommands"),Gt=Symbol("runValidation"),Yt=Symbol("setHasOutput"),Kt=Symbol("kTrackManuallySetKeys");class Jt{constructor(t=[],e,s,n){this.customScriptName=!1,this.parsed=!1,S.set(this,void 0),P.set(this,void 0),$.set(this,{commands:[],fullCommands:[]}),I.set(this,null),N.set(this,null),W.set(this,"show-hidden"),L.set(this,null),z.set(this,!0),F.set(this,{}),D.set(this,!0),H.set(this,[]),U.set(this,void 0),R.set(this,{}),q.set(this,!1),B.set(this,null),T.set(this,!0),V.set(this,void 0),G.set(this,""),Y.set(this,void 0),K.set(this,void 0),J.set(this,{}),Q.set(this,null),Z.set(this,null),X.set(this,{}),tt.set(this,{}),et.set(this,void 0),st.set(this,!1),nt.set(this,void 0),it.set(this,!1),rt.set(this,!1),ot.set(this,!1),at.set(this,void 0),lt.set(this,{}),ct.set(this,null),ht.set(this,void 0),ut(this,nt,n,"f"),ut(this,et,t,"f"),ut(this,P,e,"f"),ut(this,K,s,"f"),ut(this,U,new p(this),"f"),this.$0=this[vt](),this[Tt](),ut(this,S,dt(this,S,"f"),"f"),ut(this,at,dt(this,at,"f"),"f"),ut(this,ht,dt(this,ht,"f"),"f"),ut(this,Y,dt(this,Y,"f"),"f"),dt(this,Y,"f").showHiddenOpt=dt(this,W,"f"),ut(this,V,this[gt](),"f")}addHelpOpt(t,e){return f("[string|boolean] [string]",[t,e],arguments.length),dt(this,B,"f")&&(this[mt](dt(this,B,"f")),ut(this,B,null,"f")),!1===t&&void 0===e||(ut(this,B,"string"==typeof t?t:"help","f"),this.boolean(dt(this,B,"f")),this.describe(dt(this,B,"f"),e||dt(this,at,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(f("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:dt(this,W,"f");return this.boolean(s),this.describe(s,e||dt(this,at,"f").deferY18nLookup("Show hidden options")),dt(this,Y,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return f("<object|string|array> [string|array]",[t,e],arguments.length),this[xt](this.alias.bind(this),"alias",t,e),this}array(t){return f("<array|string>",[t],arguments.length),this[Ct]("array",t),this[Kt](t),this}boolean(t){return f("<array|string>",[t],arguments.length),this[Ct]("boolean",t),this[Kt](t),this}check(t,e){return f("<function> [boolean]",[t,e],arguments.length),this.middleware((e,s)=>m(()=>t(e,s.getOptions()),s=>(s?("string"==typeof s||s instanceof Error)&&dt(this,at,"f").fail(s.toString(),s):dt(this,at,"f").fail(dt(this,nt,"f").y18n.__("Argument check failed: %s",t.toString())),e),t=>(dt(this,at,"f").fail(t.message?t.message:t.toString(),t),e)),!1,e),this}choices(t,e){return f("<object|string|array> [string|array]",[t,e],arguments.length),this[xt](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(f("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new l.w("coerce callback must be provided");for(const s of t)this.coerce(s,e);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!e)throw new l.w("coerce callback must be provided");return dt(this,Y,"f").key[t]=!0,dt(this,U,"f").addCoerceMiddleware((s,n)=>{let i;return Object.prototype.hasOwnProperty.call(s,t)?m(()=>(i=n.getAliases(),e(s[t])),e=>{s[t]=e;const r=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&!0!==r)for(const n of i[t])s[n]=e;return s},t=>{throw new l.w(t.message)}):s},t),this}conflicts(t,e){return f("<string|object> [string|array]",[t,e],arguments.length),dt(this,ht,"f").conflicts(t,e),this}config(t="config",e,s){return f("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||dt(this,at,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(t=>{dt(this,Y,"f").config[t]=s||!0}),this):(t=(0,ft.e)(t,dt(this,P,"f"),this[wt]()["deep-merge-config"]||!1,dt(this,nt,"f")),dt(this,Y,"f").configObjects=(dt(this,Y,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return f("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),ut(this,N,t||dt(this,N,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(dt(this,N,"f"),e),s&&dt(this,I,"f").registerFunction(s),this}command(t,e,s,n,i,r){return f("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,n,i,r],arguments.length),dt(this,S,"f").addHandler(t,e,s,n,i,r),this}commands(t,e,s,n,i,r){return this.command(t,e,s,n,i,r)}commandDir(t,e){f("<string> [object]",[t,e],arguments.length);const s=dt(this,K,"f")||dt(this,nt,"f").require;return dt(this,S,"f").addDirectory(t,s,dt(this,nt,"f").getCallerFile(),e),this}count(t){return f("<array|string>",[t],arguments.length),this[Ct]("count",t),this[Kt](t),this}default(t,e,s){return f("<object|string|array> [*] [string]",[t,e,s],arguments.length),s&&(r(t,dt(this,nt,"f")),dt(this,Y,"f").defaultDescription[t]=s),"function"==typeof e&&(r(t,dt(this,nt,"f")),dt(this,Y,"f").defaultDescription[t]||(dt(this,Y,"f").defaultDescription[t]=dt(this,at,"f").functionDescription(e)),e=e.call()),this[kt](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,n){return f("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,n],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),dt(this,Y,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:n},this}demand(t,e,s){return Array.isArray(e)?(e.forEach(t=>{i(s,!0,dt(this,nt,"f")),this.demandOption(t,s)}),e=1/0):"number"!=typeof