diff --git a/Makefile b/Makefile index cf16a62f92d4cb..4e5ac94e1899d1 100644 --- a/Makefile +++ b/Makefile @@ -1029,6 +1029,13 @@ $(PKG): release-only # Builds the macOS installer for releases. pkg: $(PKG) +corepack-update: + rm -rf /tmp/node-corepack-clone + git clone 'https://github.com/arcanis/pmm.git' /tmp/node-corepack-clone + cd /tmp/node-corepack-clone && yarn pack + rm -rf deps/corepack && mkdir -p deps/corepack + cd deps/corepack && tar xf /tmp/node-corepack-clone/package.tgz --strip-components=1 + # Note: this is strictly for release builds on release machines only. pkg-upload: pkg ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" diff --git a/deps/corepack/README.md b/deps/corepack/README.md new file mode 100644 index 00000000000000..054900ea7ae5b0 --- /dev/null +++ b/deps/corepack/README.md @@ -0,0 +1,121 @@ +# corepack + +Corepack is a zero-runtime-dependency Node script that acts as a bridge between Node projects and the package managers they are intended to be used with during development. + +**Important:** At the moment, Corepack only covers Yarn and pnpm. Given that we have little control on the npm project, we prefer to focus on the Yarn and pnpm use cases. As a result, Corepack doesn't have any effect at all on the way you use npm. + +## How to Install + +### Default Installs + +Corepack isn't intended to be installed manually. While it's certainly possible, we're working with the Node TSC to provide Corepack by default starting from Node 15, thus ensuring that all package managers can be used with little to no friction. + +### Manual Installs + +
+Click here to see how to install Corepack using npm + +First uninstall your global Yarn and pnpm binaries (just leave npm). In general, you'd do this by running the following command: + +```shell +npm uninstall -g yarn pnpm + +# That should be enough, but if you installed Yarn without going through npm it might +# be more tedious - for example, you might need to run `brew uninstall yarn` as well. +``` + +Then install Corepack: + +```shell +npm install -g corepack +``` + +We do acknowledge the irony and overhead of using npm to install Corepack, which is at least part of why the preferred option is to use the Corepack version that will be distributed along with Node itself. + +
+ +### Prebuilt Binaries + +
+Click here to see how to download prebuilt Corepack Node distributions + +We have a few prebuilt Node binaries (based on the [following branch](https://github.com/arcanis/node/tree/mael/pmm)) that you can just download, unpack somewhere, and add to your `PATH` environment variable. + +1. Go to [this page](https://github.com/arcanis/pmm/actions?query=workflow%3ABuild) +2. Open the latest build (the one at the top) +3. Download the right artifact (Linux or Darwin) +4. Unzip the artifact, then untar it +5. Add the `node-v15.0.0-nightlyYYYY-MM-DDXXXX-linux-x64/bin` directory to your `$PATH` + +
+ +## Usage + +Just use your package managers as you usually would. Run `yarn install` in Yarn projects, `pnpm install` in pnpm projects, and `npm` in npm projects. Corepack will catch these calls, and depending on the situation: + +- **If the local project is configured for the package manager you're using**, Corepack will silently download and cache the latest compatible version. + +- **If the local project is configured for a different package manager**, Corepack will request you to run the command again using the right package manager - thus avoiding corruptions of your install artifacts. + +- **If the local project isn't configured for any package manager**, Corepack will assume that you know what you're doing, and will use whatever package manager version has been pinned as "known good release". Check the relevant section for more details. + +## Known Good Releases + +When running Yarn or pnpm within projects that don't list a supported package manager, Corepack will default to a set of Known Good Releases. In a way, you can compare this to Node, where each version ships with a specific version of npm. + +The Known Good Releases can be updated system-wide using the `--activate` flag from the `corepack prepare` and `corepack hydrate` commands. + +## Offline Workflow + +The utility commands detailed in the next section. + +- Either you can use the network while building your container image, in which case you'll simply run `corepack prepare --cache-only ` to make sure that your image includes the Last Known Good release for the specified package manager. + + - If you want to have *all* Last Known Good releases for all package managers, just use the `--all` flag which will do just that. + +- Or you're publishing your project to a system where the network is unavailable, in which case you'll preemptively generate a package manager archive from your local computer (using `corepack prepare`) before storing it somewhere your container will be able to access (for example within your repository). After that, it's just a matter of running `corepack hydrate ` to setup the cache. + +## Utility Commands + +### `corepack prepare [name@version]` + +| Option | Description | +| --- | --- | +| `--all` | Prepare the "Last Known Good" version of all supported package managers | +| `--cache-only` | Just populate the cache, don't generate an archive | +| `--activate` | Also update the "Last Known Good" release | + +This command will download the given package manager (or the one configured for the local project if no argument is passed in parameter) and store it within the Corepack cache. Unless the `--cache-only` flag is set, an archive will also be generated that can be used by the `corepack hydrate` command. + +### `corepack hydrate ` + +| Option | Description | +| --- | --- | +| `--activate` | Also update the "Last Known Good" release | + +This command will retrieve the given package manager from the specified archive and will install it within the Corepack cache, ready to be used without further network interaction. + +## Contributing + +If you want to build corepack yourself things yourself, you can build the project like this: + +1. Clone this repository +2. Run `yarn build` (no need for `yarn install`) +3. The `dist/` directory now contains the pmm build and the shims +4. Call `node ./dist/pmm --version` and behold + +You can also run the tests with `yarn jest` (still no install needed). + +## Design + +Various tidbits about Corepack's design are explained in more details in [DESIGN.md](/DESIGN.md). + +## License (MIT) + +> **Copyright © 2019 Maël Nison** +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/corepack/dist/corepack.js b/deps/corepack/dist/corepack.js new file mode 100755 index 00000000000000..85eff25d04878b --- /dev/null +++ b/deps/corepack/dist/corepack.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node +!function(t,e){for(var s in e)t[s]=e[s];e.__esModule&&Object.defineProperty(t,"__esModule",{value:!0})}(exports,(()=>{var t={8256:(t,e,s)=>{e.log=function(...t){return"object"==typeof console&&console.log&&console.log(...t)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;e.splice(1,0,s,"color: inherit");let i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(i++,"%c"===t&&(r=i))}),e.splice(r,0,s)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=s(514)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},514:(t,e,s)=>{t.exports=function(t){function e(t){let e=0;for(let s=0;s{if("%%"===s)return s;a++;const n=i.formatters[r];if("function"==typeof n){const i=t[a];s=n.call(e,i),t.splice(a,1),a--}return s}),i.formatArgs.call(e,t);(e.log||i.log).apply(e,t)}return o.namespace=t,o.enabled=i.enabled(t),o.useColors=i.useColors(),o.color=e(t),o.destroy=r,o.extend=n,"function"==typeof i.init&&i.init(o),i.instances.push(o),o}function r(){const t=i.instances.indexOf(this);return-1!==t&&(i.instances.splice(t,1),!0)}function n(t,e){const s=i(this.namespace+(void 0===e?":":e)+t);return s.log=this.log,s}function o(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return i.debug=i,i.default=i,i.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},i.disable=function(){const t=[...i.names.map(o),...i.skips.map(o).map(t=>"-"+t)].join(",");return i.enable(""),t},i.enable=function(t){let e;i.save(t),i.names=[],i.skips=[];const s=("string"==typeof t?t:"").split(/[\s,]+/),r=s.length;for(e=0;e{i[e]=t[e]}),i.instances=[],i.names=[],i.skips=[],i.formatters={},i.selectColor=e,i.enable(i.load()),i}},324:(t,e,s)=>{"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?t.exports=s(8256):t.exports=s(7390)},7390:(t,e,s)=>{const i=s(3867),r=s(1669);e.init=function(t){t.inspectOpts={};const s=Object.keys(e.inspectOpts);for(let i=0;i=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(t){}e.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{const s=e.substring(6).toLowerCase().replace(/_([a-z])/g,(t,e)=>e.toUpperCase());let i=process.env[e];return i=!!/^(yes|on|true|enabled)$/i.test(i)||!/^(no|off|false|disabled)$/i.test(i)&&("null"===i?null:Number(i)),t[s]=i,t},{}),t.exports=s(514)(e);const{formatters:n}=t.exports;n.o=function(t){return this.inspectOpts.colors=this.useColors,r.inspect(t,this.inspectOpts).replace(/\s*\n\s*/g," ")},n.O=function(t){return this.inspectOpts.colors=this.useColors,r.inspect(t,this.inspectOpts)}},8791:(t,e,s)=>{"use strict";s.r(e),s.d(e,{main:()=>G,runMain:()=>H});var i=s(1249),r=s(3129),n=s(5747),o=s.n(n),a=s(324),h=s.n(a),l=s(5622),c=s.n(l),u=s(8775),p=s.n(u),d=s(150),m=s(2087);function f(){var t;return null!==(t=process.env.COREPACK_HOME)&&void 0!==t?t:(0,l.join)((0,m.homedir)(),".node/corepack")}var g=s(5229),y=s(1669);const w=h()("corepack");async function b(t,e){await o().promises.symlink((0,l.relative)((0,l.dirname)(t),e),t,"file")}var E=s(7211),v=s.n(E);function O(t,e={}){if("0"===process.env.COREPACK_ENABLE_NETWORK)throw new i.Oi("Network access disabled by the environment; can't reach "+t);return new Promise((s,i)=>{v().get(t,e,t=>{var e;const r=null!==(e=t.statusCode)&&void 0!==e?e:500;return r>=200&&r<300?s(t):i(new Error("Server answered with HTTP "+r))}).on("error",t=>{i(t)})})}async function x(t,e){const s=(await async function(t,e){const s=await O(t,e);return new Promise((t,e)=>{const i=[];s.on("data",t=>{i.push(t)}),s.on("error",t=>{e(t)}),s.on("end",()=>{t(Buffer.concat(i))})})}(t,e)).toString();try{return JSON.parse(s)}catch(t){const e=s.length>30?s.slice(0,30)+"...":s;throw new Error("Couldn't parse JSON data: "+JSON.stringify(e))}}const R=(0,y.promisify)(r.execFile),S=/\n/,C=/^[a-f0-9]+\trefs\/tags\/(.*)\^\{\}$/;async function _(t){switch(t.type){case"npm":{const e=await x("https://registry.npmjs.org/"+t.package,{headers:{Accept:"application/vnd.npm.install-v1+json"}});return Object.keys(e.versions)}case"git":{const{stdout:e}=await R("git",["ls-remote","--tags",t.repository]),s=e.split(S),i=new RegExp(`^${t.pattern.replace("{}","(.*)")}$`),r=[];for(const t of s){const e=t.match(C);if(!e)continue;const s=e[1].match(i);s&&r.push(s[1])}return r}default:throw new Error("Unsupported specification "+JSON.stringify(t))}}async function I(t,e,{spec:s}){const i=c().join(t,e.name,e.reference);if(o().existsSync(i))return w(`Reusing ${e.name}@${e.reference}`),i;const r=s.url.replace("{}",e.reference);return w(`Installing ${e.name}@${e.reference} from ${r}`),await async function(t,e){return await e()}(0,async()=>{const e=function(t=(0,m.tmpdir)()){for((0,n.mkdirSync)(t,{recursive:!0});;){const e=(4294967296*Math.random()).toString(16).padStart(8,"0"),s=(0,l.join)(t,`corepack-${process.pid}-${e}`);try{return(0,n.mkdirSync)(s),s}catch(t){if("EEXIST"===t.code)continue;throw t}}}(t),a=await O(r),h=new URL(r),u=c().posix.extname(h.pathname);let p,d=null;if(".tgz"===u?p=g.x({strip:1,cwd:e}):".js"===u&&(d=c().join(e,c().posix.basename(h.pathname)),p=o().createWriteStream(d)),a.pipe(p),await new Promise(t=>{p.on("finish",t)}),await o().promises.mkdir(c().join(e,".bin")),Array.isArray(s.bin)){if(null===d)throw new Error("Assertion failed");for(const t of s.bin)await b(c().join(e,".bin",t),d)}else for(const[t,i]of Object.entries(s.bin))b(c().join(e,".bin",t),c().join(e,i));return await o().promises.mkdir(c().dirname(i),{recursive:!0}),await o().promises.rename(e,i),w("Install finished"),i})}var k;!function(t){t.Npm="npm",t.Pnpm="pnpm",t.Yarn="yarn"}(k||(k={}));const T=new Set(Object.values(k));class N{constructor(t=d){this.config=t}async getDefaultDescriptors(){const t=[];for(const e of T)t.push({name:e,range:await this.getDefaultVersion(e)});return t}async getDefaultVersion(t){const e=this.config.definitions[t];if(void 0===e)throw new i.Oi(`This package manager (${t}) isn't supported by this corepack build`);let s;try{s=JSON.parse(await o().promises.readFile(this.getLastKnownGoodFile(),"utf8"))}catch(t){}if("object"!=typeof s||null===s)return e.default;if(!Object.prototype.hasOwnProperty.call(s,t))return e.default;const r=s[t];return"string"!=typeof r?e.default:r}async activatePackageManager(t){const e=this.getLastKnownGoodFile();let s;try{s=JSON.parse(await o().promises.readFile(e,"utf8"))}catch(t){}"object"==typeof s&&null!==s||(s={}),s[t.name]=t.reference,await o().promises.mkdir(c().dirname(e),{recursive:!0}),await o().promises.writeFile(e,JSON.stringify(s,null,2)+"\n")}async ensurePackageManager(t){const e=this.config.definitions[t.name];if(void 0===e)throw new i.Oi(`This package manager (${t.name}) isn't supported by this corepack build`);const s=Object.keys(e.ranges).reverse(),r=s.find(e=>p().satisfies(t.reference,e));if(void 0===r)throw new Error(`Assertion failed: Specified resolution (${t.reference}) isn't supported by any of ${s.join(", ")}`);return await I(f(),t,{spec:e.ranges[r]})}async resolveDescriptor(t,{useCache:e=!0}={}){const s=this.config.definitions[t.name];if(void 0===s)throw new i.Oi(`This package manager (${t.name}) isn't supported by this corepack build`);const r=await async function(t,e){const s=c().join(t,e.name);let i;try{i=await o().promises.readdir(s)}catch(t){if("ENOENT"!==t.code)throw t;i=[]}const r=[];for(const t of i)t.startsWith(".")||r.push(t);const n=p().maxSatisfying(r,e.range);return null===n?null:n}(f(),t);if(null!==r&&e)return{name:t.name,reference:r};const n=Object.keys(s.ranges).filter(e=>p().intersects(e,t.range)),a=await Promise.all(n.map(async t=>[t,await _(s.ranges[t].tags)])),h=new Map;for(const[t,e]of a)for(const s of e)h.set(s,t);const l=[...h.keys()],u=p().maxSatisfying(l,t.range);return null===u?null:{name:t.name,reference:u}}getLastKnownGoodFile(){return c().join(f(),"lastKnownGood.json")}}var A=s(4217),L=s.n(A),$=function(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o};class P extends i.mY{constructor(){super(...arguments),this.activate=!1}async execute(){const t=f(),e=c().resolve(this.context.cwd,this.fileName),s=new Set,r=new Set;let n=!1;if(await g.t({file:e,onentry:t=>{const e=t.header.path.split(/\//g);e.length<3?n=!0:(s.add(e[0]),r.add(e[1]))}}),n||1!==s.size||1!==r.size)throw new i.Oi("Invalid archive format; did it get generated by 'corepack prepare'?");const o=[...s][0],a=[...r][0];if(!T.has(o))throw new i.Oi(`Unsupported package manager '${o}'`);await g.x({file:e,cwd:t}),this.activate&&await this.context.engine.activatePackageManager({name:o,reference:a}),this.context.stdout.write(`Hydrated ${o}@${a}\n`)}}P.usage=i.mY.Usage({description:"Import a package manager into the cache",details:"\n This command unpacks a package manager archive into the cache. The archive must have been generated by the `corepack pack` command - no other will work.\n ",examples:[["Import a package manager in the cache","$0 hydrate corepack-yarn-2.2.2.tgz"]]}),$([i.mY.String()],P.prototype,"fileName",void 0),$([i.mY.Boolean("--activate")],P.prototype,"activate",void 0),$([i.mY.Path("hydrate")],P.prototype,"execute",null);class D extends Error{}function M(t,e){if("string"!=typeof t)throw new i.Oi(`Invalid package manager specification in ${e}; expected a string`);const s=t.match(/^(?!_)(.+)@(.+)$/);if(null===s||!p().validRange(s[2]))throw new i.Oi(`Invalid package manager specification in ${e}; expected a semver range`);if(!T.has(s[1]))throw new i.Oi(`Unsupported package manager specification (${s})`);return{name:s[1],range:s[2]}}async function F(t){let e=t,s="",r=null;for(;e!==s&&null===r;){s=e,e=c().dirname(s);const n=c().join(s,"package.json");if(!o().existsSync(n))continue;const a=await o().promises.readFile(n,"utf8");let h;try{h=JSON.parse(a)}catch(t){}if("object"!=typeof h||null===h)throw new i.Oi("Invalid package.json in "+c().relative(t,n));r={data:h,manifestPath:n}}if(null===r)return{type:"NoProject",target:c().join(t,"package.json")};const n=r.data.packageManager;return void 0===n?{type:"NoSpec",target:r.manifestPath}:{type:"Found",spec:M(n,c().relative(t,r.manifestPath))}}async function j(t,e,s){const i=`${e.name}@^${e.reference}`;let r;try{r=await L().prompt([{type:"confirm",name:"confirm",initial:!0,message:s.replace("{}",i)}])}catch(t){if(""!==t)throw t;r=!1}if(!r)throw new D;const n=o().existsSync(t)?await o().promises.readFile(t,"utf8"):"{}",a=JSON.parse(n);a.packageManager=i;const h=JSON.stringify(a,null,2);await o().promises.writeFile(t,h+"\n")}async function B(t,e){return await j(t,e,"No configured project yet; set it to {}?")}var U=function(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o};class z extends i.mY{constructor(){super(...arguments),this.cacheOnly=!1,this.activate=!1,this.all=!1,this.json=!1}async execute(){if(this.all&&void 0!==this.spec)throw new i.Oi("The --all option cannot be used along with an explicit package manager specification");const t=this.all?await this.context.engine.getDefaultDescriptors():[this.spec];for(const e of t){let t;if(void 0===e){const e=await F(this.context.cwd);switch(e.type){case"NoProject":throw new i.Oi("Couldn't find a project in the local directory - please explicit the package manager to pack, or run this command from a valid project");case"NoSpec":throw new i.Oi("The local project doesn't feature a 'packageManager' field - please explicit the package manager to pack, or update the manifest to reference it");default:t=e.spec}}else t="string"==typeof e?M(e,"CLI arguments"):e;const s=await this.context.engine.resolveDescriptor(t);if(null===s)throw new i.Oi(`Failed to successfully resolve '${t.range}' to a valid ${t.name} release`);const r=f(),n=await this.context.engine.ensurePackageManager(s);if(this.activate&&await this.context.engine.activatePackageManager(s),this.cacheOnly)continue;const o=void 0!==e?c().join(this.context.cwd,`corepack-${s.name}-${s.reference}.tgz`):c().join(this.context.cwd,`corepack-${s.name}.tgz`);await g.c({gzip:!0,cwd:r,file:o},[c().relative(r,n)]),this.json?this.context.stdout.write(JSON.stringify(o)+"\n"):this.context.stdout.write(`Packed ${o}\n`)}}}async function G(t,e){const s=t[0];if(n=s,T.has(n)){const n=s,o=t[1],a=new i.zl({binaryName:o}),h={name:n,reference:await e.engine.getDefaultVersion(s)};class l extends i.mY{constructor(){super(...arguments),this.proxy=[]}async execute(){let t;try{t=await async function(t,e){for(;;){const s=await F(t);switch(s.type){case"NoProject":await B(s.target,e);break;case"NoSpec":return{name:e.name,range:e.reference};case"Found":if(s.spec.name!==e.name)throw new i.Oi("This project is configured to use "+s.spec.name);return s.spec}}}(this.context.cwd,h)}catch(t){if(t instanceof D)return 1;throw t}const s=await e.engine.resolveDescriptor(t);if(null===s)throw new i.Oi(`Failed to successfully resolve '${t.range}' to a valid ${t.name} release`);const n=await e.engine.ensurePackageManager(s);return await async function(t,e,s,i,n){const o=c().join(t,".bin",s);return new Promise((t,e)=>{process.on("SIGINT",()=>{});const s=["pipe","pipe","pipe"];n.stdin===process.stdin&&(s[0]="inherit"),n.stdout===process.stdout&&(s[1]="inherit"),n.stderr===process.stderr&&(s[2]="inherit");const a=(0,r.spawn)(process.execPath,[o,...i],{cwd:n.cwd,stdio:s});n.stdin!==process.stdin&&n.stdin.pipe(a.stdin),n.stdout!==process.stdout&&a.stdout.pipe(n.stdout),n.stderr!==process.stderr&&a.stderr.pipe(n.stderr),a.on("exit",e=>{t(null!==e?e:1)})})}(n,0,o,this.proxy,this.context)}}return l.addPath(),l.addOption("proxy",i.mY.Proxy()),a.register(l),await a.run(t.slice(2),Object.assign(Object.assign({},i.zl.defaultContext),e))}{const s=new i.zl({binaryName:"corepack"});return s.register(i.mY.Entries.Help),s.register(P),s.register(z),await s.run(t,Object.assign(Object.assign({},i.zl.defaultContext),e))}var n}function H(t){G(t,{cwd:process.cwd(),engine:new N}).then(t=>{process.exitCode=t},t=>{console.error(t.stack),process.exitCode=1})}z.usage=i.mY.Usage({description:"Generate a package manager archive",details:"\n This command generates an archive for the specified package manager, in a format suitable for later hydratation via the `corepack hydrate` command.\n\n If run without parameter, it'll extract the package manager spec from the active project. Otherwise an explicit spec string is required, that Corepack will resolve before installing and packing.\n ",examples:[["Generate an archive from the active project","$0 prepare"],["Generate an archive from a specific Yarn version","$0 prepare yarn@2.2.2"]]}),U([i.mY.String({required:!1})],z.prototype,"spec",void 0),U([i.mY.Boolean("--cache-only")],z.prototype,"cacheOnly",void 0),U([i.mY.Boolean("--activate")],z.prototype,"activate",void 0),U([i.mY.Boolean("--all")],z.prototype,"all",void 0),U([i.mY.Boolean("--json")],z.prototype,"json",void 0),U([i.mY.Path("prepare")],z.prototype,"execute",null),t=s.hmd(t),"undefined"==typeof require&&process.mainModule===t&&H(process.argv.slice(2))},2230:(t,e,s)=>{"use strict";const i=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,r=()=>{const t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled="0"!==process.env.FORCE_COLOR);const e=(t,e,s)=>"function"==typeof t?t(e):t.wrap(e,s),r=(s,i)=>{if(""===s||null==s)return"";if(!1===t.enabled)return s;if(!1===t.visible)return"";let r=""+s,n=r.includes("\n"),o=i.length;for(o>0&&i.includes("unstyle")&&(i=[...new Set(["unstyle",...i])].reverse());o-- >0;)r=e(t.styles[i[o]],r,n);return r},n=(e,s,i)=>{t.styles[e]=(t=>{let e=t.open=`[${t.codes[0]}m`,s=t.close=`[${t.codes[1]}m`,i=t.regex=new RegExp(`\\u001b\\[${t.codes[1]}m`,"g");return t.wrap=(t,r)=>{t.includes(s)&&(t=t.replace(i,s+e));let n=e+t+s;return r?n.replace(/\r*\n/g,`${s}$&${e}`):n},t})({name:e,codes:s}),(t.keys[i]||(t.keys[i]=[])).push(e),Reflect.defineProperty(t,e,{configurable:!0,enumerable:!0,set(s){t.alias(e,s)},get(){let s=t=>r(t,s.stack);return Reflect.setPrototypeOf(s,t),s.stack=this.stack?this.stack.concat(e):[e],s}})};return n("reset",[0,0],"modifier"),n("bold",[1,22],"modifier"),n("dim",[2,22],"modifier"),n("italic",[3,23],"modifier"),n("underline",[4,24],"modifier"),n("inverse",[7,27],"modifier"),n("hidden",[8,28],"modifier"),n("strikethrough",[9,29],"modifier"),n("black",[30,39],"color"),n("red",[31,39],"color"),n("green",[32,39],"color"),n("yellow",[33,39],"color"),n("blue",[34,39],"color"),n("magenta",[35,39],"color"),n("cyan",[36,39],"color"),n("white",[37,39],"color"),n("gray",[90,39],"color"),n("grey",[90,39],"color"),n("bgBlack",[40,49],"bg"),n("bgRed",[41,49],"bg"),n("bgGreen",[42,49],"bg"),n("bgYellow",[43,49],"bg"),n("bgBlue",[44,49],"bg"),n("bgMagenta",[45,49],"bg"),n("bgCyan",[46,49],"bg"),n("bgWhite",[47,49],"bg"),n("blackBright",[90,39],"bright"),n("redBright",[91,39],"bright"),n("greenBright",[92,39],"bright"),n("yellowBright",[93,39],"bright"),n("blueBright",[94,39],"bright"),n("magentaBright",[95,39],"bright"),n("cyanBright",[96,39],"bright"),n("whiteBright",[97,39],"bright"),n("bgBlackBright",[100,49],"bgBright"),n("bgRedBright",[101,49],"bgBright"),n("bgGreenBright",[102,49],"bgBright"),n("bgYellowBright",[103,49],"bgBright"),n("bgBlueBright",[104,49],"bgBright"),n("bgMagentaBright",[105,49],"bgBright"),n("bgCyanBright",[106,49],"bgBright"),n("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=i,t.hasColor=t.hasAnsi=e=>(t.ansiRegex.lastIndex=0,"string"==typeof e&&""!==e&&t.ansiRegex.test(e)),t.alias=(e,s)=>{let i="string"==typeof s?t[s]:s;if("function"!=typeof i)throw new TypeError("Expected alias to be the name of an existing color (string) or a function");i.stack||(Reflect.defineProperty(i,"name",{value:e}),t.styles[e]=i,i.stack=[e]),Reflect.defineProperty(t,e,{configurable:!0,enumerable:!0,set(s){t.alias(e,s)},get(){let e=t=>r(t,e.stack);return Reflect.setPrototypeOf(e,t),e.stack=this.stack?this.stack.concat(i.stack):i.stack,e}})},t.theme=e=>{if(null===(s=e)||"object"!=typeof s||Array.isArray(s))throw new TypeError("Expected theme to be an object");var s;for(let s of Object.keys(e))t.alias(s,e[s]);return t},t.alias("unstyle",e=>"string"==typeof e&&""!==e?(t.ansiRegex.lastIndex=0,e.replace(t.ansiRegex,"")):""),t.alias("noop",t=>t),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=s(5589),t.define=n,t};t.exports=r(),t.exports.create=r},5589:t=>{"use strict";const e="Hyper"===process.env.TERM_PROGRAM,s="win32"===process.platform,i="linux"===process.platform,r={ballotDisabled:"☒",ballotOff:"☐",ballotOn:"☑",bullet:"•",bulletWhite:"◦",fullBlock:"█",heart:"❤",identicalTo:"≡",line:"─",mark:"※",middot:"·",minus:"-",multiplication:"×",obelus:"÷",pencilDownRight:"✎",pencilRight:"✏",pencilUpRight:"✐",percent:"%",pilcrow2:"❡",pilcrow:"¶",plusMinus:"±",section:"§",starsOff:"☆",starsOn:"★",upDownArrow:"↕"},n=Object.assign({},r,{check:"√",cross:"×",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"»",radioOff:"( )",radioOn:"(*)",warning:"‼"}),o=Object.assign({},r,{ballotCross:"✘",check:"✔",cross:"✖",ellipsisLarge:"⋯",ellipsis:"…",info:"ℹ",question:"?",questionFull:"?",questionSmall:"﹖",pointer:i?"▸":"❯",pointerSmall:i?"‣":"›",radioOff:"◯",radioOn:"◉",warning:"⚠"});t.exports=s&&!e?n:o,Reflect.defineProperty(t.exports,"common",{enumerable:!1,value:r}),Reflect.defineProperty(t.exports,"windows",{enumerable:!1,value:n}),Reflect.defineProperty(t.exports,"other",{enumerable:!1,value:o})},7059:(t,e,s)=>{"use strict";const i=s(5747),r=s(5622),n=i.lchown?"lchown":"chown",o=i.lchownSync?"lchownSync":"chownSync",a=i.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),h=(t,e,s)=>{try{return i[o](t,e,s)}catch(t){if("ENOENT"!==t.code)throw t}},l=a?(t,e,s,r)=>n=>{n&&"EISDIR"===n.code?i.chown(t,e,s,r):r(n)}:(t,e,s,i)=>i,c=a?(t,e,s)=>{try{return h(t,e,s)}catch(r){if("EISDIR"!==r.code)throw r;((t,e,s)=>{try{i.chownSync(t,e,s)}catch(t){if("ENOENT"!==t.code)throw t}})(t,e,s)}}:(t,e,s)=>h(t,e,s),u=process.version;let p=(t,e,s)=>i.readdir(t,e,s);/^v4\./.test(u)&&(p=(t,e,s)=>i.readdir(t,s));const d=(t,e,s,r)=>{i[n](t,e,s,l(t,e,s,t=>{r(t&&"ENOENT"!==t.code?t:null)}))},m=(t,e,s,n,o)=>{if("string"==typeof e)return i.lstat(r.resolve(t,e),(i,r)=>{if(i)return o("ENOENT"!==i.code?i:null);r.name=e,m(t,r,s,n,o)});if(e.isDirectory())f(r.resolve(t,e.name),s,n,i=>{if(i)return o(i);const a=r.resolve(t,e.name);d(a,s,n,o)});else{const i=r.resolve(t,e.name);d(i,s,n,o)}},f=(t,e,s,i)=>{p(t,{withFileTypes:!0},(r,n)=>{if(r){if("ENOENT"===r.code)return i();if("ENOTDIR"!==r.code&&"ENOTSUP"!==r.code)return i(r)}if(r||!n.length)return d(t,e,s,i);let o=n.length,a=null;const h=r=>{if(!a)return r?i(a=r):0==--o?d(t,e,s,i):void 0};n.forEach(i=>m(t,i,e,s,h))})},g=(t,e,s)=>{let n;try{n=((t,e)=>i.readdirSync(t,e))(t,{withFileTypes:!0})}catch(i){if("ENOENT"===i.code)return;if("ENOTDIR"===i.code||"ENOTSUP"===i.code)return c(t,e,s);throw i}return n&&n.length&&n.forEach(n=>((t,e,s,n)=>{if("string"==typeof e)try{const s=i.lstatSync(r.resolve(t,e));s.name=e,e=s}catch(t){if("ENOENT"===t.code)return;throw t}e.isDirectory()&&g(r.resolve(t,e.name),s,n),c(r.resolve(t,e.name),s,n)})(t,n,e,s)),c(t,e,s)};t.exports=f,f.sync=g},1249:(t,e)=>{"use strict";class s{constructor(){this.help=!1}static getMeta(t){const e=t.constructor;return e.meta=Object.prototype.hasOwnProperty.call(e,"meta")?e.meta:{definitions:[],transformers:[(t,e)=>{for(const{name:s,value:i}of t.options)"-h"!==s&&"--help"!==s||(e.help=i)}]}}static resolveMeta(t){const e=[],i=[];for(let r=t;r instanceof s;r=r.__proto__){const t=this.getMeta(r);for(const s of t.definitions)e.push(s);for(const e of t.transformers)i.push(e)}return{definitions:e,transformers:i}}static registerDefinition(t,e){this.getMeta(t).definitions.push(e)}static registerTransformer(t,e){this.getMeta(t).transformers.push(e)}static addPath(...t){this.Path(...t)(this.prototype,"execute")}static addOption(t,e){e(this.prototype,t)}static Path(...t){return(e,s)=>{this.registerDefinition(e,e=>{e.addPath(t)})}}static Boolean(t,{hidden:e=!1}={}){return(s,i)=>{const r=t.split(",");this.registerDefinition(s,t=>{t.addOption({names:r,arity:0,hidden:e,allowBinding:!1})}),this.registerTransformer(s,(t,e)=>{for(const{name:s,value:n}of t.options)r.includes(s)&&(e[i]=n)})}}static String(t={required:!0},{tolerateBoolean:e=!1,hidden:s=!1}={}){return(i,r)=>{if("string"==typeof t){const n=t.split(",");this.registerDefinition(i,t=>{t.addOption({names:n,arity:e?0:1,hidden:s})}),this.registerTransformer(i,(t,e)=>{for(const{name:s,value:i}of t.options)n.includes(s)&&(e[r]=i)})}else this.registerDefinition(i,e=>{e.addPositional({name:r,required:t.required})}),this.registerTransformer(i,(t,e)=>{t.positionals.length>0&&(e[r]=t.positionals.shift().value)})}}static Array(t,{hidden:e=!1}={}){return(s,i)=>{const r=t.split(",");this.registerDefinition(s,t=>{t.addOption({names:r,arity:1,hidden:e})}),this.registerTransformer(s,(t,e)=>{for(const{name:s,value:n}of t.options)r.includes(s)&&(e[i]=e[i]||[],e[i].push(n))})}}static Rest({required:t=0}={}){return(e,s)=>{this.registerDefinition(e,e=>{e.addRest({name:s,required:t})}),this.registerTransformer(e,(t,e)=>{e[s]=t.positionals.map(({value:t})=>t)})}}static Proxy({required:t=0}={}){return(e,s)=>{this.registerDefinition(e,e=>{e.addProxy({required:t})}),this.registerTransformer(e,(t,e)=>{e[s]=t.positionals.map(({value:t})=>t)})}}static Usage(t){return t}static Schema(t){return t}async validateAndExecute(){const t=this.constructor.schema;if(void 0!==t)try{await t.validate(this)}catch(t){throw"ValidationError"===t.name&&(t.clipanion={type:"usage"}),t}const e=await this.execute();return void 0!==e?e:0}} +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +function i(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}s.Entries={};class r extends s{async execute(){this.context.stdout.write(this.cli.usage(null))}}i([s.Path("--help"),s.Path("-h")],r.prototype,"execute",null);class n extends s{async execute(){var t;this.context.stdout.write((null!==(t=this.cli.binaryVersion)&&void 0!==t?t:"")+"\n")}}i([s.Path("--version"),s.Path("-v")],n.prototype,"execute",null);const o=/^(-h|--help)(?:=([0-9]+))?$/,a=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,h=/^-[a-zA-Z]{2,}$/,l=/^([^=]+)=([\s\S]*)$/,c="1"===process.env.DEBUG_CLI;class u extends Error{constructor(t){super(t),this.clipanion={type:"usage"},this.name="UsageError"}}class p extends Error{constructor(t,e){if(super(),this.input=t,this.candidates=e,this.clipanion={type:"none"},this.name="UnknownSyntaxError",0===this.candidates.length)this.message="Command not found, but we're not sure what's the alternative.";else if(1===this.candidates.length&&null!==this.candidates[0].reason){const[{usage:t,reason:e}]=this.candidates;this.message=`${e}\n\n$ ${t}`}else if(1===this.candidates.length){const[{usage:e}]=this.candidates;this.message=`Command not found; did you mean:\n\n$ ${e}\n${m(t)}`}else this.message=`Command not found; did you mean one of:\n\n${this.candidates.map(({usage:t},e)=>`${(e+".").padStart(4)} ${t}`).join("\n")}\n\n${m(t)}`}}class d extends Error{constructor(t,e){super(),this.input=t,this.usages=e,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find who to pick amongst the following alternatives:\n\n${this.usages.map((t,e)=>`${(e+".").padStart(4)} ${t}`).join("\n")}\n\n${m(t)}`}}const m=t=>"While running "+t.filter(t=>"\0"!==t).map(t=>{const e=JSON.stringify(t);return t.match(/\s/)||0===t.length||e!==`"${t}"`?e:t}).join(" ");function f(t){c&&console.log(t)}function g(t,e){return t.nodes.push(e),t.nodes.length-1}function y(t,e,s=!1){f("Running a vm on "+JSON.stringify(e));let i=[{node:0,state:{candidateUsage:null,errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null}}];!function(t,{prefix:e=""}={}){f(e+"Nodes are:");for(let s=0;s2!==t).map(({state:t})=>({usage:t.candidateUsage,reason:null})));if(a.every(({node:t})=>2===t))throw new p(e,a.map(({state:t})=>({usage:t.candidateUsage,reason:t.errorMessage})));i=E(a)}if(i.length>0){f(" Results:");for(const t of i)f(` - ${t.node} -> ${JSON.stringify(t.state)}`)}else f(" No results");return i}function w(t,e){if(null!==e.selectedIndex)return!0;if(Object.prototype.hasOwnProperty.call(t.statics,"\0"))for(const{to:e}of t.statics["\0"])if(1===e)return!0;return!1}function b(t,e){return function(t,e){const s=e.filter(t=>null!==t.selectedIndex);if(0===s.length)throw new Error;let i=0;for(const t of s)t.path.length>i&&(i=t.path.length);const r=s.filter(t=>t.path.length===i),n=t=>t.positionals.filter(({extra:t})=>!t).length+t.options.length,o=r.map(t=>({state:t,positionalCount:n(t)}));let a=0;for(const{positionalCount:t}of o)t>a&&(a=t);const h=function(t){const e=[],s=[];for(const i of t)-1===i.selectedIndex?s.push(i):e.push(i);s.length>0&&e.push({candidateUsage:null,errorMessage:null,ignoreOptions:!1,path:v(...s.map(t=>t.path)),positionals:[],options:s.reduce((t,e)=>t.concat(e.options),[]),remainder:null,selectedIndex:-1});return e}(o.filter(({positionalCount:t})=>t===a).map(({state:t})=>t));if(h.length>1)throw new d(t,h.map(t=>t.candidateUsage));return h[0]}(e,y(t,[...e,"\0"]).map(({state:t})=>t))}function E(t){let e=0;for(const{state:s}of t)s.path.length>e&&(e=s.path.length);return t.filter(({state:t})=>t.path.length===e)}function v(t,e,...s){return void 0===e?Array.from(t):v(t.filter((t,s)=>t===e[s]),...s)}function O(t){return 1===t||2===t}function x(t,e=0){return{to:O(t.to)?t.to:t.to>2?t.to+e-2:t.to+e,reducer:t.reducer}}function R(t,e=0){const s={dynamics:[],shortcuts:[],statics:{}};for(const[i,r]of t.dynamics)s.dynamics.push([i,x(r,e)]);for(const i of t.shortcuts)s.shortcuts.push(x(i,e));for(const[i,r]of Object.entries(t.statics))s.statics[i]=r.map(t=>x(t,e));return s}function S(t,e,s,i,r){t.nodes[e].dynamics.push([s,{to:i,reducer:r}])}function C(t,e,s,i){t.nodes[e].shortcuts.push({to:s,reducer:i})}function _(t,e,s,i,r){(Object.prototype.hasOwnProperty.call(t.nodes[e].statics,s)?t.nodes[e].statics[s]:t.nodes[e].statics[s]=[]).push({to:i,reducer:r})}function I(t,e,s,i){if(Array.isArray(e)){const[r,...n]=e;return t[r](s,i,...n)}return t[e](s,i)}function k(t,e){const s=Array.isArray(t)?T[t[0]]:T[t];if(void 0===s.suggest)return null;const i=Array.isArray(t)?t.slice(1):[];return s.suggest(e,...i)}const T={always:()=>!0,isNotOptionLike:(t,e)=>t.ignoreOptions||!e.startsWith("-"),isOption:(t,e,s,i)=>!t.ignoreOptions&&e===s,isBatchOption:(t,e,s)=>!t.ignoreOptions&&h.test(e)&&[...e.slice(1)].every(t=>s.includes("-"+t)),isBoundOption:(t,e,s,i)=>{const r=e.match(l);return!t.ignoreOptions&&!!r&&a.test(r[1])&&s.includes(r[1])&&i.filter(t=>t.names.includes(r[1])).every(t=>t.allowBinding)},isNegatedOption:(t,e,s)=>!t.ignoreOptions&&e==="--no-"+s.slice(2),isHelp:(t,e)=>!t.ignoreOptions&&o.test(e),isUnsupportedOption:(t,e,s)=>!t.ignoreOptions&&e.startsWith("-")&&a.test(e)&&!s.includes(e),isInvalidOption:(t,e)=>!t.ignoreOptions&&e.startsWith("-")&&!a.test(e)};T.isOption.suggest=(t,e,s=!0)=>s?null:[e];const N={setCandidateUsage:(t,e,s)=>Object.assign(Object.assign({},t),{candidateUsage:s}),setSelectedIndex:(t,e,s)=>Object.assign(Object.assign({},t),{selectedIndex:s}),pushBatch:(t,e)=>Object.assign(Object.assign({},t),{options:t.options.concat([...e.slice(1)].map(t=>({name:"-"+t,value:!0})))}),pushBound:(t,e)=>{const[,s,i]=e.match(l);return Object.assign(Object.assign({},t),{options:t.options.concat({name:s,value:i})})},pushPath:(t,e)=>Object.assign(Object.assign({},t),{path:t.path.concat(e)}),pushPositional:(t,e)=>Object.assign(Object.assign({},t),{positionals:t.positionals.concat({value:e,extra:!1})}),pushExtra:(t,e)=>Object.assign(Object.assign({},t),{positionals:t.positionals.concat({value:e,extra:!0})}),pushTrue:(t,e,s=e)=>Object.assign(Object.assign({},t),{options:t.options.concat({name:e,value:!0})}),pushFalse:(t,e,s=e)=>Object.assign(Object.assign({},t),{options:t.options.concat({name:s,value:!1})}),pushUndefined:(t,e)=>Object.assign(Object.assign({},t),{options:t.options.concat({name:e,value:void 0})}),setStringValue:(t,e)=>Object.assign(Object.assign({},t),{options:t.options.slice(0,-1).concat(Object.assign(Object.assign({},t.options[t.options.length-1]),{value:e}))}),inhibateOptions:t=>Object.assign(Object.assign({},t),{ignoreOptions:!0}),useHelp:(t,e,s)=>{const[,i,r]=e.match(o);return void 0!==r?Object.assign(Object.assign({},t),{options:[{name:"-c",value:String(s)},{name:"-i",value:r}]}):Object.assign(Object.assign({},t),{options:[{name:"-c",value:String(s)}]})},setError:(t,e,s)=>"\0"===e?Object.assign(Object.assign({},t),{errorMessage:s+"."}):Object.assign(Object.assign({},t),{errorMessage:`${s} ("${e}").`})},A=Symbol();class L{constructor(t,e){this.allOptionNames=[],this.arity={leading:[],trailing:[],extra:[],proxy:!1},this.options=[],this.paths=[],this.cliIndex=t,this.cliOpts=e}addPath(t){this.paths.push(t)}setArity({leading:t=this.arity.leading,trailing:e=this.arity.trailing,extra:s=this.arity.extra,proxy:i=this.arity.proxy}){Object.assign(this.arity,{leading:t,trailing:e,extra:s,proxy:i})}addPositional({name:t="arg",required:e=!0}={}){if(!e&&this.arity.extra===A)throw new Error("Optional parameters cannot be declared when using .rest() or .proxy()");if(!e&&this.arity.trailing.length>0)throw new Error("Optional parameters cannot be declared after the required trailing positional arguments");e||this.arity.extra===A?this.arity.extra!==A&&0===this.arity.extra.length?this.arity.leading.push(t):this.arity.trailing.push(t):this.arity.extra.push(t)}addRest({name:t="arg",required:e=0}={}){if(this.arity.extra===A)throw new Error("Infinite lists cannot be declared multiple times in the same command");if(this.arity.trailing.length>0)throw new Error("Infinite lists cannot be declared after the required trailing positional arguments");for(let s=0;s0&&e.push(...this.paths[0]),t){for(const{names:t,arity:s,hidden:i}of this.options){if(i)continue;const r=[];for(let t=0;t`<${t}>`)),this.arity.extra===A?e.push("..."):e.push(...this.arity.extra.map(t=>`[${t}]`)),e.push(...this.arity.trailing.map(t=>`<${t}>`))}return e.join(" ")}compile(){if(void 0===this.context)throw new Error("Assertion failed: No context attached");const t={nodes:[{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}}]};let e=0;e=g(t,{dynamics:[],shortcuts:[],statics:{}}),_(t,0,"",e,["setCandidateUsage",this.usage()]);const s=this.arity.proxy?"always":"isNotOptionLike",i=this.paths.length>0?this.paths:[[]];for(const r of i){let i=e;if(r.length>0){const e=g(t,{dynamics:[],shortcuts:[],statics:{}});C(t,i,e),this.registerOptions(t,e),i=e}for(let e=0;e0||!this.arity.proxy){const e=g(t,{dynamics:[],shortcuts:[],statics:{}});S(t,i,"isHelp",e,["useHelp",this.cliIndex]),_(t,e,"\0",1,["setSelectedIndex",-1]),this.registerOptions(t,i)}this.arity.leading.length>0&&_(t,i,"\0",2,["setError","Not enough positional arguments"]);let n=i;for(let e=0;e0||e+1!==this.arity.leading.length)&&_(t,s,"\0",2,["setError","Not enough positional arguments"]),S(t,n,"isNotOptionLike",s,"pushPositional"),n=s}let o=n;if(this.arity.extra===A||this.arity.extra.length>0){const e=g(t,{dynamics:[],shortcuts:[],statics:{}});if(C(t,n,e),this.arity.extra===A){const i=g(t,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy||this.registerOptions(t,i),S(t,n,s,i,"pushExtra"),S(t,i,s,i,"pushExtra"),C(t,i,e)}else for(let i=0;i0&&_(t,o,"\0",2,["setError","Not enough positional arguments"]);let a=o;for(let e=0;ee.length>t.length?e:t,"");if(0===s.arity)for(const r of s.names)S(t,e,["isOption",r,s.hidden||r!==i],e,"pushTrue"),r.startsWith("--")&&S(t,e,["isNegatedOption",r,s.hidden||r!==i],e,["pushFalse",r]);else{if(1!==s.arity)throw new Error(`Unsupported option arity (${s.arity})`);{const r=g(t,{dynamics:[],shortcuts:[],statics:{}});S(t,r,"isNotOptionLike",e,"setStringValue");for(const n of s.names)S(t,e,["isOption",n,s.hidden||n!==i],r,"pushUndefined")}}}}}class ${constructor({binaryName:t="..."}={}){this.builders=[],this.opts={binaryName:t}}static build(t,e={}){return new $(e).commands(t).compile()}getBuilderByIndex(t){if(!(t>=0&&t{if(e.has(i))return;e.add(i);const r=t.nodes[i];for(const t of Object.values(r.statics))for(const{to:e}of t)s(e);for(const[,{to:t}]of r.dynamics)s(t);for(const{to:t}of r.shortcuts)s(t);const n=new Set(r.shortcuts.map(({to:t})=>t));for(;r.shortcuts.length>0;){const{to:e}=r.shortcuts.shift(),s=t.nodes[e];for(const[t,e]of Object.entries(s.statics)){let s=Object.prototype.hasOwnProperty.call(r.statics,t)?r.statics[t]:r.statics[t]=[];for(const t of e)s.some(({to:e})=>t.to===e)||s.push(t)}for(const[t,e]of s.dynamics)r.dynamics.some(([s,{to:i}])=>t===s&&e.to===i)||r.dynamics.push([t,e]);for(const t of s.shortcuts)n.has(t.to)||(r.shortcuts.push(t),n.add(t.to))}};s(0)}(s),{machine:s,contexts:e,process:t=>b(s,t),suggest:(t,e)=>function(t,e,s){const i=s&&e.length>0?[""]:[],r=y(t,e,s),n=[],o=new Set,a=(e,s,i=!0)=>{let r=[s];for(;r.length>0;){const s=r;r=[];for(const n of s){const s=t.nodes[n],o=Object.keys(s.statics);for(const t of Object.keys(s.statics)){const t=o[0];for(const{to:n,reducer:o}of s.statics[t])"pushPath"===o&&(i||e.push(t),r.push(n))}}i=!1}const a=JSON.stringify(e);o.has(a)||(n.push(e),o.add(a))};for(const{node:e,state:s}of r){if(null!==s.remainder){a([s.remainder],e);continue}const r=t.nodes[e],n=w(r,s);for(const[t,s]of Object.entries(r.statics))(n&&"\0"!==t||!t.startsWith("-")&&s.some(({reducer:t})=>"pushPath"===t))&&a([...i,t],e);if(n)for(const[t,{to:n}]of r.dynamics){if(2===n)continue;const r=k(t,s);if(null!==r)for(const t of r)a([...i,t],e)}}return[...n].sort()}(s,t,e)}}}const P={bold:t=>`${t}`,error:t=>`${t}`,code:t=>`${t}`},D={bold:t=>t,error:t=>t,code:t=>t};function M(t,{format:e,paragraphs:s}){return t=(t=(t=(t=(t=t.replace(/\r\n?/g,"\n")).replace(/^[\t ]+|[\t ]+$/gm,"")).replace(/^\n+|\n+$/g,"")).replace(/^-([^\n]*?)\n+/gm,"-$1\n\n")).replace(/\n(\n)?\n*/g,"$1"),s&&(t=t.split(/\n/).map((function(t){let e=t.match(/^[*-][\t ]+(.*)/);return e?e[1].match(/(.{1,78})(?: |$)/g).map((t,e)=>(0===e?"- ":" ")+t).join("\n"):t.match(/(.{1,80})(?: |$)/g).join("\n")})).join("\n\n")),(t=t.replace(/(`+)((?:.|[\n])*?)\1/g,(function(t,s,i){return e.code(s+i+s)})))?t+"\n":""}class F extends s{constructor(t,e){super(),this.realCli=t,this.contexts=e,this.commands=[]}static from(t,e,s){const i=new F(e,s);i.path=t.path;for(const e of t.options)switch(e.name){case"-c":i.commands.push(Number(e.value));break;case"-i":i.index=Number(e.value)}return i}async execute(){let t=this.commands;if(void 0!==this.index&&this.index>=0&&this.index1){this.context.stdout.write("Multiple commands match your selection:\n"),this.context.stdout.write("\n");let t=0;for(const e of this.commands)this.context.stdout.write(this.realCli.usage(this.contexts[e].commandClass,{prefix:(t+++". ").padStart(5)}));this.context.stdout.write("\n"),this.context.stdout.write("Run again with -h= to see the longer details of any of those commands.\n")}}}function j(){return"0"!==process.env.FORCE_COLOR&&("1"===process.env.FORCE_COLOR||!(void 0===process.stdout||!process.stdout.isTTY))}class B{constructor({binaryLabel:t,binaryName:e="...",binaryVersion:s,enableColors:i=j()}={}){this.registrations=new Map,this.builder=new $({binaryName:e}),this.binaryLabel=t,this.binaryName=e,this.binaryVersion=s,this.enableColors=i}static from(t,e={}){const s=new B(e);for(const e of t)s.register(e);return s}register(t){const e=this.builder.command();this.registrations.set(t,e.cliIndex);const{definitions:s}=t.resolveMeta(t.prototype);for(const t of s)t(e);e.setContext({commandClass:t})}process(t){const{contexts:e,process:s}=this.builder.compile(),i=s(t);switch(i.selectedIndex){case-1:return F.from(i,this,e);default:{const{commandClass:t}=e[i.selectedIndex],s=new t;s.path=i.path;const{transformers:r}=t.resolveMeta(t.prototype);for(const t of r)t(i,s);return s}}}async run(t,e){let s,i;if(Array.isArray(t))try{s=this.process(t)}catch(t){return e.stdout.write(this.error(t)),1}else s=t;if(s.help)return e.stdout.write(this.usage(s,{detailed:!0})),0;s.context=e,s.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableColors:this.enableColors,definitions:()=>this.definitions(),error:(t,e)=>this.error(t,e),process:t=>this.process(t),run:(t,s)=>this.run(t,Object.assign(Object.assign({},e),s)),usage:(t,e)=>this.usage(t,e)};try{i=await s.validateAndExecute()}catch(t){return e.stdout.write(this.error(t,{command:s})),1}return i}async runExit(t,e){process.exitCode=await this.run(t,e)}suggest(t,e){const{contexts:s,process:i,suggest:r}=this.builder.compile();return r(t,e)}definitions({colored:t=!1}={}){const e=[];for(const[s,i]of this.registrations){if(void 0===s.usage)continue;const r=this.getUsageByIndex(i,{detailed:!1}),n=this.getUsageByIndex(i,{detailed:!0}),o=void 0!==s.usage.category?M(s.usage.category,{format:this.format(t),paragraphs:!1}):void 0,a=void 0!==s.usage.description?M(s.usage.description,{format:this.format(t),paragraphs:!1}):void 0,h=void 0!==s.usage.details?M(s.usage.details,{format:this.format(t),paragraphs:!0}):void 0,l=void 0!==s.usage.examples?s.usage.examples.map(([e,s])=>[M(e,{format:this.format(t),paragraphs:!1}),s.replace(/\$0/g,this.binaryName)]):void 0;e.push({path:r,usage:n,category:o,description:a,details:h,examples:l})}return e}usage(t=null,{colored:e,detailed:s=!1,prefix:i="$ "}={}){const r=null!==t&&void 0===t.getMeta?t.constructor:t;let n="";if(r)if(s){const{description:t="",details:s="",examples:o=[]}=r.usage||{};if(""!==t&&(n+=M(t,{format:this.format(e),paragraphs:!1}).replace(/^./,t=>t.toUpperCase()),n+="\n"),(""!==s||o.length>0)&&(n+=this.format(e).bold("Usage:")+"\n",n+="\n"),n+=`${this.format(e).bold(i)}${this.getUsageByRegistration(r)}\n`,""!==s&&(n+="\n",n+=this.format(e).bold("Details:")+"\n",n+="\n",n+=M(s,{format:this.format(e),paragraphs:!0})),o.length>0){n+="\n",n+=this.format(e).bold("Examples:")+"\n";for(let[t,s]of o)n+="\n",n+=M(t,{format:this.format(e),paragraphs:!1}),n+=s.replace(/^/m," "+this.format(e).bold(i)).replace(/\$0/g,this.binaryName)+"\n"}}else n+=`${this.format(e).bold(i)}${this.getUsageByRegistration(r)}\n`;else{const t=new Map;for(const[s,i]of this.registrations.entries()){if(void 0===s.usage)continue;const r=void 0!==s.usage.category?M(s.usage.category,{format:this.format(e),paragraphs:!1}):null;let n=t.get(r);void 0===n&&t.set(r,n=[]);const o=this.getUsageByIndex(i);n.push({commandClass:s,usage:o})}const s=Array.from(t.keys()).sort((t,e)=>null===t?-1:null===e?1:t.localeCompare(e,"en",{usage:"sort",caseFirst:"upper"})),r=void 0!==this.binaryLabel,o=void 0!==this.binaryVersion;r||o?(n+=r&&o?this.format(e).bold(`${this.binaryLabel} - ${this.binaryVersion}`)+"\n\n":r?this.format(e).bold(""+this.binaryLabel)+"\n":this.format(e).bold(""+this.binaryVersion)+"\n",n+=` ${this.format(e).bold(i)}${this.binaryName} \n`):n+=`${this.format(e).bold(i)}${this.binaryName} \n`;for(let i of s){const s=t.get(i).slice().sort((t,e)=>t.usage.localeCompare(e.usage,"en",{usage:"sort",caseFirst:"upper"})),r=null!==i?i.trim():"Where is one of";n+="\n",n+=this.format(e).bold(r+":")+"\n";for(let{commandClass:t,usage:i}of s){const s=t.usage.description||"undocumented";n+="\n",n+=` ${this.format(e).bold(i)}\n`,n+=" "+M(s,{format:this.format(e),paragraphs:!1})}}n+="\n",n+=M("You can also print more details about any of these commands by calling them after adding the `-h,--help` flag right after the command name.",{format:this.format(e),paragraphs:!0})}return n}error(t,{colored:e,command:s=null}={}){t instanceof Error||(t=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(t)})`));let i="",r=t.name.replace(/([a-z])([A-Z])/g,"$1 $2");"Error"===r&&(r="Internal Error"),i+=`${this.format(e).error(r)}: ${t.message}\n`;const n=t.clipanion;return void 0!==n?"usage"===n.type&&(i+="\n",i+=this.usage(s)):t.stack&&(i+=t.stack.replace(/^.*\n/,"")+"\n"),i}getUsageByRegistration(t,e){const s=this.registrations.get(t);if(void 0===s)throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(s,e)}getUsageByIndex(t,e){return this.builder.getBuilderByIndex(t).usage(e)}format(t=this.enableColors){return t?P:D}}B.defaultContext={stdin:process.stdin,stdout:process.stdout,stderr:process.stderr},s.Entries.Help=r,s.Entries.Version=n,e.zl=B,e.mY=s,e.Oi=u},4217:(t,e,s)=>{"use strict";const i=s(2357),r=s(8614),n=s(3765);class o extends r{constructor(t,e){super(),this.options=n.merge({},t),this.answers={...e}}register(t,e){if(n.isObject(t)){for(let e of Object.keys(t))this.register(e,t[e]);return this}i.equal(typeof e,"function","expected a function");let s=t.toLowerCase();return e.prototype instanceof this.Prompt?this.prompts[s]=e:this.prompts[s]=e(this.Prompt,this),this}async prompt(t=[]){for(let e of[].concat(t))try{"function"==typeof e&&(e=await e.call(this)),await this.ask(n.merge({},this.options,e))}catch(t){return Promise.reject(t)}return this.answers}async ask(t){"function"==typeof t&&(t=await t.call(this));let e=n.merge({},this.options,t),{type:s,name:r}=t,{set:o,get:a}=n;if("function"==typeof s&&(s=await s.call(this,t,this.answers)),!s)return this.answers[r];i(this.prompts[s],`Prompt "${s}" is not registered`);let h=new this.prompts[s](e),l=a(this.answers,r);h.state.answers=this.answers,h.enquirer=this,r&&h.on("submit",t=>{this.emit("answer",r,t,h),o(this.answers,r,t)});let c=h.emit.bind(h);return h.emit=(...t)=>(this.emit.call(this,...t),c(...t)),this.emit("prompt",h,this),e.autofill&&null!=l?(h.value=h.input=l,"show"===e.autofill&&await h.submit()):l=h.value=await h.run(),l}use(t){return t.call(this,this),this}set Prompt(t){this._Prompt=t}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(t){this._Prompt=t}static get Prompt(){return this._Prompt||s(7086)}static get prompts(){return s(370)}static get types(){return s(7463)}static get prompt(){const t=(e,...s)=>{let i=new this(...s),r=i.emit.bind(i);return i.emit=(...e)=>(t.emit(...e),r(...e)),i.prompt(e)};return n.mixinEmitter(t,new r),t}}n.mixinEmitter(o,new r);const a=o.prompts;for(let t of Object.keys(a)){let e=t.toLowerCase(),s=e=>new a[t](e).run();o.prompt[e]=s,o[e]=s,o[t]||Reflect.defineProperty(o,t,{get:()=>a[t]})}const h=t=>{n.defineExport(o,t,()=>o.types[t])};h("ArrayPrompt"),h("AuthPrompt"),h("BooleanPrompt"),h("NumberPrompt"),h("StringPrompt"),t.exports=o},5196:(t,e,s)=>{"use strict";const i="Apple_Terminal"===process.env.TERM_PROGRAM,r=s(2230),n=s(3765),o=t.exports=e,a="[";let h=!1;const l=o.code={bell:"",beep:"",beginning:"",down:"",esc:a,getPosition:"",hide:"[?25l",line:"",lineEnd:"",lineStart:"",restorePosition:a+(i?"8":"u"),savePosition:a+(i?"7":"s"),screen:"",show:"[?25h",up:""},c=o.cursor={get hidden(){return h},hide:()=>(h=!0,l.hide),show:()=>(h=!1,l.show),forward:(t=1)=>`[${t}C`,backward:(t=1)=>`[${t}D`,nextLine:(t=1)=>"".repeat(t),prevLine:(t=1)=>"".repeat(t),up:(t=1)=>t?`[${t}A`:"",down:(t=1)=>t?`[${t}B`:"",right:(t=1)=>t?`[${t}C`:"",left:(t=1)=>t?`[${t}D`:"",to:(t,e)=>e?`[${e+1};${t+1}H`:`[${t+1}G`,move(t=0,e=0){let s="";return s+=t<0?c.left(-t):t>0?c.right(t):"",s+=e<0?c.up(-e):e>0?c.down(e):"",s},restore(t={}){let{after:e,cursor:s,initial:i,input:r,prompt:a,size:h,value:l}=t;if(i=n.isPrimitive(i)?String(i):"",r=n.isPrimitive(r)?String(r):"",l=n.isPrimitive(l)?String(l):"",h){let t=o.cursor.up(h)+o.cursor.to(a.length),e=r.length-s;return e>0&&(t+=o.cursor.left(e)),t}if(l||e){let t=!r&&i?-i.length:-r.length+s;return e&&(t-=e.length),""===r&&i&&!a.includes(i)&&(t+=i.length),o.cursor.move(t)}}},u=o.erase={screen:l.screen,up:l.up,down:l.down,line:l.line,lineEnd:l.lineEnd,lineStart:l.lineStart,lines(t){let e="";for(let s=0;s{if(!e)return u.line+c.to(0);let s=t.split(/\r?\n/),i=0;for(let t of s)i+=1+Math.floor(Math.max((n=t,[...r.unstyle(n)].length-1),0)/e);var n;return(u.line+c.prevLine()).repeat(i-1)+u.line+c.to(0)}},2366:(t,e)=>{"use strict";e.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"},e.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"},e.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"},e.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"},e.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}},2091:t=>{"use strict";const e=t=>(t=>t.filter((e,s)=>t.lastIndexOf(e)===s))(t).filter(Boolean);t.exports=(t,s={},i="")=>{let r,n,{past:o=[],present:a=""}=s;switch(t){case"prev":case"undo":return r=o.slice(0,o.length-1),n=o[o.length-1]||"",{past:e([i,...r]),present:n};case"next":case"redo":return r=o.slice(1),n=o[0]||"",{past:e([...r,i]),present:n};case"save":return{past:e([...o,i]),present:""};case"remove":return n=e(o.filter(t=>t!==i)),a="",n.length&&(a=n.pop()),{past:n,present:a};default:throw new Error(`Invalid action: "${t}"`)}}},9958:(t,e,s)=>{"use strict";const i=s(2230);class r{constructor(t){this.name=t.key,this.field=t.field||{},this.value=((t="")=>"string"==typeof t?t.replace(/^['"]|['"]$/g,""):"")(t.initial||this.field.initial||""),this.message=t.message||this.name,this.cursor=0,this.input="",this.lines=[]}}function n(t,e,s,i){return(s,r,n,o)=>"function"==typeof n.field[t]?n.field[t].call(e,s,r,n,o):[i,s].find(t=>e.isValue(t))}t.exports=async t=>{let e=t.options,s=new Set(!0===e.required?[]:e.required||[]),o={...e.values,...e.initial},{tabstops:a,items:h,keys:l}=await(async(t={},e={},s=(t=>t))=>{let i=new Set,n=t.fields||[],o=t.template,a=[],h=[],l=[],c=1;"function"==typeof o&&(o=await o());let u=-1,p=()=>o[++u],d=()=>o[u+1],m=t=>{t.line=c,a.push(t)};for(m({type:"bos",value:""});ut.name===a.key);a.field=n.find(t=>t.name===a.key),c||(c=new r(a),h.push(c)),c.lines.push(a.line-1);continue}let o=a[a.length-1];"text"===o.type&&o.line===c?o.value+=t:m({type:"text",value:t})}return m({type:"eos",value:""}),{input:o,tabstops:a,unique:i,keys:l,items:h}})(e,o),c=n("result",t,e),u=n("format",t,e),p=n("validate",t,e,!0),d=t.isValue.bind(t);return async(r={},n=!1)=>{let o=0;r.required=s,r.items=h,r.keys=l,r.output="";let m=async(t,e,s,i)=>{let r=await p(t,e,s,i);return!1===r?"Invalid field "+s.name:r};for(let s of a){let a=s.value,l=s.key;if("template"===s.type){if("template"===s.type){let p=h.find(t=>t.name===l);!0===e.required&&r.required.add(p.name);let f=[p.input,r.values[p.value],p.value,a].find(d),g=(p.field||{}).message||s.inner;if(n){let t=await m(r.values[l],r,p,o);if(t&&"string"==typeof t||!1===t){r.invalid.set(l,t);continue}r.invalid.delete(l);let e=await c(r.values[l],r,p,o);r.output+=i.unstyle(e);continue}p.placeholder=!1;let y=a;a=await u(a,r,p,o),f!==a?(r.values[l]=f,a=t.styles.typing(f),r.missing.delete(g)):(r.values[l]=void 0,f=`<${g}>`,a=t.styles.primary(f),p.placeholder=!0,r.required.has(l)&&r.missing.add(g)),r.missing.has(g)&&r.validating&&(a=t.styles.warning(f)),r.invalid.has(l)&&r.validating&&(a=t.styles.danger(f)),o===r.index&&(a=y!==a?t.styles.underline(a):t.styles.heading(i.unstyle(a))),o++}a&&(r.output+=a)}else a&&(r.output+=a)}let f=r.output.split("\n").map(t=>" "+t),g=h.length,y=0;for(let e of h)r.invalid.has(e.name)&&e.lines.forEach(t=>{" "===f[t][0]&&(f[t]=r.styles.danger(r.symbols.bullet)+f[t].slice(1))}),t.isValue(r.values[e.name])&&y++;return r.completed=(y/g*100).toFixed(0),r.output=f.join("\n"),r.output}}},6663:(t,e,s)=>{"use strict";const i=s(1058),r=s(2366),n=/^(?:\x1b)([a-zA-Z0-9])$/,o=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,a={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};const h=(t="",e={})=>{let s,i={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t,...e};if(Buffer.isBuffer(t)?t[0]>127&&void 0===t[1]?(t[0]-=128,t=""+String(t)):t=String(t):void 0!==t&&"string"!=typeof t?t=String(t):t||(t=i.sequence||""),i.sequence=i.sequence||t||i.name,"\r"===t)i.raw=void 0,i.name="return";else if("\n"===t)i.name="enter";else if("\t"===t)i.name="tab";else if("\b"===t||""===t||""===t||"\b"===t)i.name="backspace",i.meta=""===t.charAt(0);else if(""===t||""===t)i.name="escape",i.meta=2===t.length;else if(" "===t||" "===t)i.name="space",i.meta=2===t.length;else if(t<="")i.name=String.fromCharCode(t.charCodeAt(0)+"a".charCodeAt(0)-1),i.ctrl=!0;else if(1===t.length&&t>="0"&&t<="9")i.name="number";else if(1===t.length&&t>="a"&&t<="z")i.name=t;else if(1===t.length&&t>="A"&&t<="Z")i.name=t.toLowerCase(),i.shift=!0;else if(s=n.exec(t))i.meta=!0,i.shift=/^[A-Z]$/.test(s[1]);else if(s=o.exec(t)){let e=[...t];""===e[0]&&""===e[1]&&(i.option=!0);let r=[s[1],s[2],s[4],s[6]].filter(Boolean).join(""),n=(s[3]||s[5]||1)-1;i.ctrl=!!(4&n),i.meta=!!(10&n),i.shift=!!(1&n),i.code=r,i.name=a[r],i.shift=function(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}(r)||i.shift,i.ctrl=function(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}(r)||i.ctrl}return i};h.listen=(t={},e)=>{let{stdin:s}=t;if(!s||s!==process.stdin&&!s.isTTY)throw new Error("Invalid stream passed");let r=i.createInterface({terminal:!0,input:s});i.emitKeypressEvents(s,r);let n=(t,s)=>e(t,h(t,s),r),o=s.isRaw;s.isTTY&&s.setRawMode(!0),s.on("keypress",n),r.resume();return()=>{s.isTTY&&s.setRawMode(o),s.removeListener("keypress",n),r.pause(),r.close()}},h.action=(t,e,s)=>{let i={...r,...s};return e.ctrl?(e.action=i.ctrl[e.name],e):e.option&&i.option?(e.action=i.option[e.name],e):e.shift?(e.action=i.shift[e.name],e):(e.action=i.keys[e.name],e)},t.exports=h},3893:(t,e,s)=>{"use strict";const i=s(3765);t.exports=(t,e={})=>{t.cursorHide();let{input:s="",initial:r="",pos:n,showCursor:o=!0,color:a}=e,h=a||t.styles.placeholder,l=i.inverse(t.styles.primary),c=e=>l(t.styles.black(e)),u=s,p=c(" ");if(t.blink&&!0===t.blink.off&&(c=t=>t,p=""),o&&0===n&&""===r&&""===s)return c(" ");if(o&&0===n&&(s===r||""===s))return c(r[0])+h(r.slice(1));r=i.isPrimitive(r)?""+r:"",s=i.isPrimitive(s)?""+s:"";let d=r&&r.startsWith(s)&&r!==s,m=d?c(r[s.length]):p;if(n!==s.length&&!0===o&&(u=s.slice(0,n)+c(s[n])+s.slice(n+1),m=""),!1===o&&(m=""),d){let e=t.styles.unstyle(u+m);return u+m+h(r.slice(e.length))}return u+m}},7086:(t,e,s)=>{"use strict";const i=s(8614),r=s(2230),n=s(6663),o=s(2017),a=s(7750),h=s(4101),l=s(3765),c=s(5196);class u extends i{constructor(t={}){super(),this.name=t.name,this.type=t.type,this.options=t,h(this),o(this),this.state=new a(this),this.initial=[t.initial,t.default].find(t=>null!=t),this.stdout=t.stdout||process.stdout,this.stdin=t.stdin||process.stdin,this.scale=t.scale||1,this.term=this.options.term||process.env.TERM_PROGRAM,this.margin=function(t){"number"==typeof t&&(t=[t,t,t,t]);let e=[].concat(t||[]),s=t=>t%2==0?"\n":" ",i=[];for(let t=0;t<4;t++){let r=s(t);e[t]?i.push(r.repeat(e[t])):i.push("")}return i}(this.options.margin),this.setMaxListeners(0),function(t){let e=e=>void 0===t[e]||"function"==typeof t[e],s=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],i=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let r of Object.keys(t.options)){if(s.includes(r))continue;if(/^on[A-Z]/.test(r))continue;let n=t.options[r];"function"==typeof n&&e(r)?i.includes(r)||(t[r]=n.bind(t)):"function"!=typeof t[r]&&(t[r]=n)}}(this)}async keypress(t,e={}){this.keypressed=!0;let s=n.action(t,n(t,e),this.options.actions);this.state.keypress=s,this.emit("keypress",t,s),this.emit("state",this.state.clone());let i=this.options[s.action]||this[s.action]||this.dispatch;if("function"==typeof i)return await i.call(this,t,s);this.alert()}alert(){delete this.state.alert,!1===this.options.show?this.emit("alert"):this.stdout.write(c.code.beep)}cursorHide(){this.stdout.write(c.cursor.hide()),l.onExit(()=>this.cursorShow())}cursorShow(){this.stdout.write(c.cursor.show())}write(t){t&&(this.stdout&&!1!==this.state.show&&this.stdout.write(t),this.state.buffer+=t)}clear(t=0){let e=this.state.buffer;this.state.buffer="",(e||t)&&!1!==this.options.show&&this.stdout.write(c.cursor.down(t)+c.clear(e,this.width))}restore(){if(this.state.closed||!1===this.options.show)return;let{prompt:t,after:e,rest:s}=this.sections(),{cursor:i,initial:r="",input:n="",value:o=""}=this,a={after:e,cursor:i,initial:r,input:n,prompt:t,size:this.state.size=s.length,value:o},h=c.cursor.restore(a);h&&this.stdout.write(h)}sections(){let{buffer:t,input:e,prompt:s}=this.state;s=r.unstyle(s);let i=r.unstyle(t),n=i.indexOf(s),o=i.slice(0,n),a=i.slice(n).split("\n"),h=a[0],l=a[a.length-1],c=(s+(e?" "+e:"")).length,u=ct.call(this,this.value),this.result=()=>s.call(this,this.value),"function"==typeof e.initial&&(this.initial=await e.initial.call(this,this)),"function"==typeof e.onRun&&await e.onRun.call(this,this),"function"==typeof e.onSubmit){let t=e.onSubmit.bind(this),s=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await t(this.name,this.value,this),s())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(t,e)=>{if(this.once("submit",t),this.once("cancel",e),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(t,e,s){let{options:i,state:r,symbols:n,timers:o}=this,a=o&&o[t];r.timer=a;let h=i[t]||r[t]||n[t],l=e&&null!=e[t]?e[t]:await h;if(""===l)return l;let c=await this.resolve(l,r,e,s);return!c&&e&&e[t]?this.resolve(h,r,e,s):c}async prefix(){let t=await this.element("prefix")||this.symbols,e=this.timers&&this.timers.prefix,s=this.state;if(s.timer=e,l.isObject(t)&&(t=t[s.status]||t.pending),!l.hasColor(t)){return(this.styles[s.status]||this.styles.pending)(t)}return t}async message(){let t=await this.element("message");return l.hasColor(t)?t:this.styles.strong(t)}async separator(){let t=await this.element("separator")||this.symbols,e=this.timers&&this.timers.separator,s=this.state;s.timer=e;let i=t[s.status]||t.pending||s.separator,r=await this.resolve(i,s);return l.isObject(r)&&(r=r[s.status]||r.pending),l.hasColor(r)?r:this.styles.muted(r)}async pointer(t,e){let s=await this.element("pointer",t,e);if("string"==typeof s&&l.hasColor(s))return s;if(s){let t=this.styles,i=this.index===e,r=i?t.primary:t=>t,n=await this.resolve(s[i?"on":"off"]||s,this.state),o=l.hasColor(n)?n:r(n);return i?o:" ".repeat(n.length)}}async indicator(t,e){let s=await this.element("indicator",t,e);if("string"==typeof s&&l.hasColor(s))return s;if(s){let e=this.styles,i=!0===t.enabled,r=i?e.success:e.dark,n=s[i?"on":"off"]||s;return l.hasColor(n)?n:r(n)}return""}body(){return null}footer(){if("pending"===this.state.status)return this.element("footer")}header(){if("pending"===this.state.status)return this.element("header")}async hint(){if("pending"===this.state.status&&!this.isValue(this.state.input)){let t=await this.element("hint");return l.hasColor(t)?t:this.styles.muted(t)}}error(t){return this.state.submitted?"":t||this.state.error}format(t){return t}result(t){return t}validate(t){return!0!==this.options.required||this.isValue(t)}isValue(t){return null!=t&&""!==t}resolve(t,...e){return l.resolve(this,t,...e)}get base(){return u.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||l.height(this.stdout,25)}get width(){return this.options.columns||l.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(t){this.state.cursor=t}get cursor(){return this.state.cursor}set input(t){this.state.input=t}get input(){return this.state.input}set value(t){this.state.value=t}get value(){let{input:t,value:e}=this.state,s=[e,t].find(this.isValue.bind(this));return this.isValue(s)?s:this.initial}static get prompt(){return t=>new this(t).run()}}t.exports=u},2362:(t,e,s)=>{"use strict";const i=s(4245);t.exports=class extends i{constructor(t){super(t),this.cursorShow()}moveCursor(t){this.state.cursor+=t}dispatch(t){return this.append(t)}space(t){return this.options.multiple?super.space(t):this.append(t)}append(t){let{cursor:e,input:s}=this.state;return this.input=s.slice(0,e)+t+s.slice(e),this.moveCursor(1),this.complete()}delete(){let{cursor:t,input:e}=this.state;return e?(this.input=e.slice(0,t-1)+e.slice(t),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:t,input:e}=this.state;return void 0===e[t]?this.alert():(this.input=(""+e).slice(0,t)+(""+e).slice(t+1),this.complete())}number(t){return this.append(t)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(t=this.input,e=this.state._choices){if("function"==typeof this.options.suggest)return this.options.suggest.call(this,t,e);let s=t.toLowerCase();return e.filter(t=>t.message.toLowerCase().includes(s))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(t=>this.styles.primary(t.message)).join(", ");if(this.state.submitted){let t=this.value=this.input=this.focused.value;return this.styles.primary(t)}return this.input}async render(){if("pending"!==this.state.status)return super.render();let t=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,e=((t,e)=>{let s=t.toLowerCase();return t=>{let i=t.toLowerCase().indexOf(s),r=e(t.slice(i,i+s.length));return i>=0?t.slice(0,i)+r+t.slice(i+s.length):t}})(this.input,t),s=this.choices;this.choices=s.map(t=>({...t,message:e(t.message)})),await super.render(),this.choices=s}submit(){return this.options.multiple&&(this.value=this.selected.map(t=>t.name)),super.submit()}}},8514:(t,e,s)=>{"use strict";const i=s(6613);function r(t,e){return t.username===this.options.username&&t.password===this.options.password}const n=(t=r)=>{const e=[{name:"username",message:"username"},{name:"password",message:"password",format(t){if(this.options.showPassword)return t;return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(t.length))}}];class s extends(i.create(t)){constructor(t){super({...t,choices:e})}static create(t){return n(t)}}return s};t.exports=n()},1901:(t,e,s)=>{"use strict";const i=s(6936);t.exports=class extends i{constructor(t){super(t),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}}},8227:(t,e,s)=>{"use strict";const i=s(4245),r=s(2681).prototype;t.exports=class extends i{constructor(t){super({...t,multiple:!0}),this.align=[this.options.align,"left"].find(t=>null!=t),this.emptyError="",this.values={}}dispatch(t,e){let s=this.focused,i=s.parent||{};return s.editable||i.editable||"a"!==t&&"i"!==t?r.dispatch.call(this,t,e):super[t]()}append(t,e){return r.append.call(this,t,e)}delete(t,e){return r.delete.call(this,t,e)}space(t){return this.focused.editable?this.append(t):super.space()}number(t){return this.focused.editable?this.append(t):super.number(t)}next(){return this.focused.editable?r.next.call(this):super.next()}prev(){return this.focused.editable?r.prev.call(this):super.prev()}async indicator(t,e){let s=t.indicator||"",i=t.editable?s:super.indicator(t,e);return await this.resolve(i,this.state,t,e)||""}indent(t){return"heading"===t.role?"":t.editable?" ":" "}async renderChoice(t,e){return t.indent="",t.editable?r.renderChoice.call(this,t,e):super.renderChoice(t,e)}error(){return""}footer(){return this.state.error}async validate(){let t=!0;for(let e of this.choices){if("function"!=typeof e.validate)continue;if("heading"===e.role)continue;let s=e.parent?this.value[e.parent.name]:this.value;if(e.editable?s=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(s=!0===e.enabled),t=await e.validate(s,this.state),!0!==t)break}return!0!==t&&(this.state.error="string"==typeof t?t:"Invalid Input"),t}submit(){if(!0===this.focused.newChoice)return super.submit();if(this.choices.some(t=>t.newChoice))return this.alert();this.value={};for(let t of this.choices){let e=t.parent?this.value[t.parent.name]:this.value;"heading"!==t.role?t.editable?e[t.name]=t.value===t.name?t.initial||"":t.value:this.isDisabled(t)||(e[t.name]=!0===t.enabled):this.value[t.name]={}}return this.base.submit.call(this)}}},2681:(t,e,s)=>{"use strict";const i=s(2230),r=s(4245),n=s(3893);t.exports=class extends r{constructor(t){super({...t,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(t=>null!=t),this.emptyError="",this.values={}}async reset(t){return await super.reset(),!0===t&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(t=>t.reset&&t.reset()),this.render()}dispatch(t){return!!t&&this.append(t)}append(t){let e=this.focused;if(!e)return this.alert();let{cursor:s,input:i}=e;return e.value=e.input=i.slice(0,s)+t+i.slice(s),e.cursor++,this.render()}delete(){let t=this.focused;if(!t||t.cursor<=0)return this.alert();let{cursor:e,input:s}=t;return t.value=t.input=s.slice(0,e-1)+s.slice(e),t.cursor--,this.render()}deleteForward(){let t=this.focused;if(!t)return this.alert();let{cursor:e,input:s}=t;if(void 0===s[e])return this.alert();let i=(""+s).slice(0,e)+(""+s).slice(e+1);return t.value=t.input=i,this.render()}right(){let t=this.focused;return t?t.cursor>=t.input.length?this.alert():(t.cursor++,this.render()):this.alert()}left(){let t=this.focused;return t?t.cursor<=0?this.alert():(t.cursor--,this.render()):this.alert()}space(t,e){return this.dispatch(t,e)}number(t,e){return this.dispatch(t,e)}next(){let t=this.focused;if(!t)return this.alert();let{initial:e,input:s}=t;return e&&e.startsWith(s)&&s!==e?(t.value=t.input=e,t.cursor=t.value.length,this.render()):super.next()}prev(){let t=this.focused;return t?0===t.cursor?super.prev():(t.value=t.input="",t.cursor=0,this.render()):this.alert()}separator(){return""}format(t){return this.state.submitted?"":super.format(t)}pointer(){return""}indicator(t){return t.input?"⦿":"⊙"}async choiceSeparator(t,e){let s=await this.resolve(t.separator,this.state,t,e)||":";return s?" "+this.styles.disabled(s):""}async renderChoice(t,e){await this.onChoice(t,e);let{state:s,styles:r}=this,{cursor:o,initial:a="",name:h,hint:l,input:c=""}=t,{muted:u,submitted:p,primary:d,danger:m}=r,f=l,g=this.index===e,y=t.validate||(()=>!0),w=await this.choiceSeparator(t,e),b=t.message;"right"===this.align&&(b=b.padStart(this.longest+1," ")),"left"===this.align&&(b=b.padEnd(this.longest+1," "));let E=this.values[h]=c||a,v=c?"success":"dark";!0!==await y.call(t,E,this.state)&&(v="danger");let O=(0,r[v])(await this.indicator(t,e))+(t.pad||""),x=this.indent(t),R=()=>[x,O,b+w,c,f].filter(Boolean).join(" ");if(s.submitted)return b=i.unstyle(b),c=p(c),f="",R();if(t.format)c=await t.format.call(this,c,t,e);else{let t=this.styles.muted;c=n(this,{input:c,initial:a,pos:o,showCursor:g,color:t})}return this.isValue(c)||(c=this.styles.muted(this.symbols.ellipsis)),t.result&&(this.values[h]=await t.result.call(this,E,t,e)),g&&(b=d(b)),t.error?c+=(c?" ":"")+m(t.error.trim()):t.hint&&(c+=(c?" ":"")+u(t.hint.trim())),R()}async submit(){return this.value=this.values,super.base.submit.call(this)}}},370:(t,e,s)=>{"use strict";const i=s(3765),r=(t,s)=>{i.defineExport(e,t,s),i.defineExport(e,t.toLowerCase(),s)};r("AutoComplete",()=>s(2362)),r("BasicAuth",()=>s(8514)),r("Confirm",()=>s(1901)),r("Editable",()=>s(8227)),r("Form",()=>s(2681)),r("Input",()=>s(1394)),r("Invisible",()=>s(8516)),r("List",()=>s(8830)),r("MultiSelect",()=>s(1382)),r("Numeral",()=>s(4696)),r("Password",()=>s(9129)),r("Scale",()=>s(8273)),r("Select",()=>s(4245)),r("Snippet",()=>s(579)),r("Sort",()=>s(9237)),r("Survey",()=>s(2120)),r("Text",()=>s(1108)),r("Toggle",()=>s(8592)),r("Quiz",()=>s(9914))},1394:(t,e,s)=>{"use strict";const i=s(4697),r=s(2091);t.exports=class extends i{constructor(t){super(t);let e=this.options.history;if(e&&e.store){let t=e.values||this.initial;this.autosave=!!e.autosave,this.store=e.store,this.data=this.store.get("values")||{past:[],present:t},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(t){return this.store?(this.data=r(t,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){this.store&&(this.data=r("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&!0===this.autosave&&this.save(),super.submit()}}},8516:(t,e,s)=>{"use strict";const i=s(4697);t.exports=class extends i{format(){return""}}},8830:(t,e,s)=>{"use strict";const i=s(4697);t.exports=class extends i{constructor(t={}){super(t),this.sep=this.options.separator||/, */,this.initial=t.initial||""}split(t=this.value){return t?String(t).split(this.sep):[]}format(){let t=this.state.submitted?this.styles.primary:t=>t;return this.list.map(t).join(", ")}async submit(t){let e=this.state.error||await this.validate(this.list,this.state);return!0!==e?(this.state.error=e,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}}},1382:(t,e,s)=>{"use strict";const i=s(4245);t.exports=class extends i{constructor(t){super({...t,multiple:!0})}}},4696:(t,e,s)=>{t.exports=s(1158)},9129:(t,e,s)=>{"use strict";const i=s(4697);t.exports=class extends i{constructor(t){super(t),this.cursorShow()}format(t=this.input){if(!this.keypressed)return"";return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(t.length))}}},9914:(t,e,s)=>{"use strict";const i=s(4245);t.exports=class extends i{constructor(t){if(super(t),"number"!=typeof this.options.correctChoice||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(t,e){let s=await super.toChoices(t,e);if(s.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>s.length)throw new Error("Please specify the index of the correct answer from the list of choices");return s}check(t){return t.index===this.options.correctChoice}async result(t){return{selectedAnswer:t,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}}},8273:(t,e,s)=>{"use strict";const i=s(2230),r=s(7538),n=s(3765);t.exports=class extends r{constructor(t={}){super(t),this.widths=[].concat(t.messageWidth||50),this.align=[].concat(t.align||"left"),this.linebreak=t.linebreak||!1,this.edgeLength=t.edgeLength||3,this.newline=t.newline||"\n ";let e=t.startNumber||1;"number"==typeof this.scale&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((t,s)=>({name:s+e})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(!0===this.tableized)return;this.tableized=!0;let t=0;for(let e of this.choices){t=Math.max(t,e.message.length),e.scaleIndex=e.initial||2,e.scale=[];for(let t=0;t=this.scale.length-1?this.alert():(t.scaleIndex++,this.render())}left(){let t=this.focused;return t.scaleIndex<=0?this.alert():(t.scaleIndex--,this.render())}indent(){return""}format(){if(this.state.submitted){return this.choices.map(t=>this.styles.info(t.index)).join(", ")}return""}pointer(){return""}renderScaleKey(){if(!1===this.scaleKey)return"";if(this.state.submitted)return"";return["",...this.scale.map(t=>` ${t.name} - ${t.message}`)].map(t=>this.styles.muted(t)).join("\n")}renderScaleHeading(t){let e=this.scale.map(t=>t.name);"function"==typeof this.options.renderScaleHeading&&(e=this.options.renderScaleHeading.call(this,t));let s=this.scaleLength-e.join("").length,i=Math.round(s/(e.length-1)),r=e.map(t=>this.styles.strong(t)).join(" ".repeat(i)),n=" ".repeat(this.widths[0]);return this.margin[3]+n+this.margin[1]+r}scaleIndicator(t,e,s){if("function"==typeof this.options.scaleIndicator)return this.options.scaleIndicator.call(this,t,e,s);let i=t.scaleIndex===e.index;return e.disabled?this.styles.hint(this.symbols.radio.disabled):i?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(t,e){let s=t.scale.map(s=>this.scaleIndicator(t,s,e)),i="Hyper"===this.term?"":" ";return s.join(i+this.symbols.line.repeat(this.edgeLength))}async renderChoice(t,e){await this.onChoice(t,e);let s=this.index===e,r=await this.pointer(t,e),o=await t.hint;o&&!n.hasColor(o)&&(o=this.styles.muted(o));let a=t=>this.margin[3]+t.replace(/\s+$/,"").padEnd(this.widths[0]," "),h=this.newline,l=this.indent(t),c=await this.resolve(t.message,this.state,t,e),u=await this.renderScale(t,e),p=this.margin[1]+this.margin[3];this.scaleLength=i.unstyle(u).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-p.length);let d=n.wordWrap(c,{width:this.widths[0],newline:h}).split("\n").map(t=>a(t)+this.margin[1]);return s&&(u=this.styles.info(u),d=d.map(t=>this.styles.info(t))),d[0]+=u,this.linebreak&&d.push(""),[l+r,d.join("\n")].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let t=this.visible.map(async(t,e)=>await this.renderChoice(t,e)),e=await Promise.all(t),s=await this.renderScaleHeading();return this.margin[0]+[s,...e.map(t=>t.join(" "))].join("\n")}async render(){let{submitted:t,size:e}=this.state,s=await this.prefix(),i=await this.separator(),r=await this.message(),n="";!1!==this.options.promptLine&&(n=[s,r,i,""].join(" "),this.state.prompt=n);let o=await this.header(),a=await this.format(),h=await this.renderScaleKey(),l=await this.error()||await this.hint(),c=await this.renderChoices(),u=await this.footer(),p=this.emptyError;a&&(n+=a),l&&!n.includes(l)&&(n+=" "+l),t&&!a&&!c.trim()&&this.multiple&&null!=p&&(n+=this.styles.danger(p)),this.clear(e),this.write([o,n,h,c,u].filter(Boolean).join("\n")),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let t of this.choices)this.value[t.name]=t.scaleIndex;return this.base.submit.call(this)}}},4245:(t,e,s)=>{"use strict";const i=s(7538),r=s(3765);t.exports=class extends i{constructor(t){super(t),this.emptyError=this.options.emptyError||"No items were selected"}async dispatch(t,e){if(this.multiple)return this[e.name]?await this[e.name](t,e):await super.dispatch(t,e);this.alert()}separator(){if(this.options.separator)return super.separator();let t=this.styles.muted(this.symbols.ellipsis);return this.state.submitted?super.separator():t}pointer(t,e){return!this.multiple||this.options.pointer?super.pointer(t,e):""}indicator(t,e){return this.multiple?super.indicator(t,e):""}choiceMessage(t,e){let s=this.resolve(t.message,this.state,t,e);return"heading"!==t.role||r.hasColor(s)||(s=this.styles.strong(s)),this.resolve(s,this.state,t,e)}choiceSeparator(){return":"}async renderChoice(t,e){await this.onChoice(t,e);let s=this.index===e,i=await this.pointer(t,e),n=await this.indicator(t,e)+(t.pad||""),o=await this.resolve(t.hint,this.state,t,e);o&&!r.hasColor(o)&&(o=this.styles.muted(o));let a=this.indent(t),h=await this.choiceMessage(t,e),l=()=>[this.margin[3],a+i+n,h,this.margin[1],o].filter(Boolean).join(" ");return"heading"===t.role?l():t.disabled?(r.hasColor(h)||(h=this.styles.disabled(h)),l()):(s&&(h=this.styles.em(h)),l())}async renderChoices(){if("choices"===this.state.loading)return this.styles.warning("Loading choices");if(this.state.submitted)return"";let t=this.visible.map(async(t,e)=>await this.renderChoice(t,e)),e=await Promise.all(t);e.length||e.push(this.styles.danger("No matching choices"));let s,i=this.margin[0]+e.join("\n");return this.options.choicesHeader&&(s=await this.resolve(this.options.choicesHeader,this.state)),[s,i].filter(Boolean).join("\n")}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(t=>this.styles.primary(t.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:t,size:e}=this.state,s="",i=await this.header(),r=await this.prefix(),n=await this.separator(),o=await this.message();!1!==this.options.promptLine&&(s=[r,o,n,""].join(" "),this.state.prompt=s);let a=await this.format(),h=await this.error()||await this.hint(),l=await this.renderChoices(),c=await this.footer();a&&(s+=a),h&&!s.includes(h)&&(s+=" "+h),t&&!a&&!l.trim()&&this.multiple&&null!=this.emptyError&&(s+=this.styles.danger(this.emptyError)),this.clear(e),this.write([i,s,l,c].filter(Boolean).join("\n")),this.write(this.margin[2]),this.restore()}}},579:(t,e,s)=>{"use strict";const i=s(2230),r=s(9958),n=s(7086);t.exports=class extends n{constructor(t){super(t),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await r(this),await super.initialize()}async reset(t){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},!0!==t&&(await this.initialize(),await this.render())}moveCursor(t){let e=this.getItem();this.cursor+=t,e.cursor+=t}dispatch(t,e){e.code||e.ctrl||null==t||!this.getItem()?this.alert():this.append(t,e)}append(t,e){let s=this.getItem(),i=s.input.slice(0,this.cursor),r=s.input.slice(this.cursor);this.input=s.input=`${i}${t}${r}`,this.moveCursor(1),this.render()}delete(){let t=this.getItem();if(this.cursor<=0||!t.input)return this.alert();let e=t.input.slice(this.cursor),s=t.input.slice(0,this.cursor-1);this.input=t.input=`${s}${e}`,this.moveCursor(-1),this.render()}increment(t){return t>=this.state.keys.length-1?0:t+1}decrement(t){return t<=0?this.state.keys.length-1:t-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(t){let e=this.state.completed<100?this.styles.warning:this.styles.success;return!0===this.state.submitted&&100!==this.state.completed&&(e=this.styles.danger),e(this.state.completed+"% completed")}async render(){let{index:t,keys:e=[],submitted:s,size:i}=this.state,r=[this.options.newline,"\n"].find(t=>null!=t),n=await this.prefix(),o=await this.separator(),a=[n,await this.message(),o].filter(Boolean).join(" ");this.state.prompt=a;let h=await this.header(),l=await this.error()||"",c=await this.hint()||"",u=s?"":await this.interpolate(this.state),p=this.state.key=e[t]||"",d=await this.format(p),m=await this.footer();d&&(a+=" "+d),c&&!d&&0===this.state.completed&&(a+=" "+c),this.clear(i);let f=[h,a,u,m,l.trim()];this.write(f.filter(Boolean).join(r)),this.restore()}getItem(t){let{items:e,keys:s,index:i}=this.state,r=e.find(t=>t.name===s[i]);return r&&null!=r.input&&(this.input=r.input,this.cursor=r.cursor),r}async submit(){"function"!=typeof this.interpolate&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:t,missing:e,output:s,values:r}=this.state;if(t.size){let e="";for(let[s,i]of t)e+=`Invalid ${s}: ${i}\n`;return this.state.error=e,super.submit()}if(e.size)return this.state.error="Required: "+[...e.keys()].join(", "),super.submit();let n=i.unstyle(s).split("\n").map(t=>t.slice(1)).join("\n");return this.value={values:r,result:n},super.submit()}}},9237:(t,e,s)=>{"use strict";const i="(Use + to sort)",r=s(4245);t.exports=class extends r{constructor(t){super({...t,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,i].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(t,e){let s=await super.renderChoice(t,e),i=this.symbols.identicalTo+" ",r=this.index===e&&this.sorting?this.styles.muted(i):" ";return!1===this.options.drag&&(r=""),!0===this.options.numbered?r+(e+1+" - ")+s:r+s}get selected(){return this.choices}submit(){return this.value=this.choices.map(t=>t.value),super.submit()}}},2120:(t,e,s)=>{"use strict";const i=s(7538);function r(t,e={}){if(Array.isArray(e.scale))return e.scale.map(t=>({...t}));let s=[];for(let e=1;ethis.styles.muted(t)),this.state.header=t.join("\n ")}}async toChoices(...t){if(this.createdScales)return!1;this.createdScales=!0;let e=await super.toChoices(...t);for(let t of e)t.scale=r(5,this.options),t.scaleIdx=2;return e}dispatch(){this.alert()}space(){let t=this.focused,e=t.scale[t.scaleIdx],s=e.selected;return t.scale.forEach(t=>t.selected=!1),e.selected=!s,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let t=this.focused;return t.scaleIdx>=t.scale.length-1?this.alert():(t.scaleIdx++,this.render())}left(){let t=this.focused;return t.scaleIdx<=0?this.alert():(t.scaleIdx--,this.render())}indent(){return" "}async renderChoice(t,e){await this.onChoice(t,e);let s=this.index===e,i="Hyper"===this.term,r=i?9:8,n=i?"":" ",o=this.symbols.line.repeat(r),a=" ".repeat(r+(i?0:1)),h=t=>(t?this.styles.success("◉"):"◯")+n,l=e+1+".",c=s?this.styles.heading:this.styles.noop,u=await this.resolve(t.message,this.state,t,e),p=this.indent(t),d=p+t.scale.map((e,s)=>h(s===t.scaleIdx)).join(o),m=p+t.scale.map((e,s)=>(e=>e===t.scaleIdx?c(e):e)(s)).join(a);return s&&(d=this.styles.cyan(d),m=this.styles.cyan(m)),[[l,u].filter(Boolean).join(" "),d,m," "].filter(Boolean).join("\n")}async renderChoices(){if(this.state.submitted)return"";let t=this.visible.map(async(t,e)=>await this.renderChoice(t,e)),e=await Promise.all(t);return e.length||e.push(this.styles.danger("No matching choices")),e.join("\n")}format(){if(this.state.submitted){return this.choices.map(t=>this.styles.info(t.scaleIdx)).join(", ")}return""}async render(){let{submitted:t,size:e}=this.state,s=await this.prefix(),i=await this.separator(),r=[s,await this.message(),i].filter(Boolean).join(" ");this.state.prompt=r;let n=await this.header(),o=await this.format(),a=await this.error()||await this.hint(),h=await this.renderChoices(),l=await this.footer();!o&&a||(r+=" "+o),a&&!r.includes(a)&&(r+=" "+a),t&&!o&&!h&&this.multiple&&"form"!==this.type&&(r+=this.styles.danger(this.emptyError)),this.clear(e),this.write([r,n,h,l].filter(Boolean).join("\n")),this.restore()}submit(){this.value={};for(let t of this.choices)this.value[t.name]=t.scaleIdx;return this.base.submit.call(this)}}},1108:(t,e,s)=>{t.exports=s(1394)},8592:(t,e,s)=>{"use strict";const i=s(6936);t.exports=class extends i{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(!0===this.value)return this.alert();this.value=!0,this.render()}disable(){if(!1===this.value)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(t="",e){switch(t.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let t=t=>this.styles.primary.underline(t);return[this.value?this.disabled:t(this.disabled),this.value?t(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:t}=this.state,e=await this.header(),s=await this.prefix(),i=await this.separator(),r=await this.message(),n=await this.format(),o=await this.error()||await this.hint(),a=await this.footer(),h=[s,r,i,n].join(" ");this.state.prompt=h,o&&!h.includes(o)&&(h+=" "+o),this.clear(t),this.write([e,h,a].filter(Boolean).join("\n")),this.write(this.margin[2]),this.restore()}}},2468:(t,e,s)=>{"use strict";const i=s(3765),r={default:(t,e)=>e,checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading:(t,e)=>(e.disabled="",e.indicator=[e.indicator," "].find(t=>null!=t),e.message=e.message||"",e),input(t,e){throw new Error("input role is not implemented yet")},option:(t,e)=>r.default(t,e),radio(t,e){throw new Error("radio role is not implemented yet")},separator:(t,e)=>(e.disabled="",e.indicator=[e.indicator," "].find(t=>null!=t),e.message=e.message||t.symbols.line.repeat(5),e),spacer:(t,e)=>e};t.exports=(t,e={})=>{let s=i.merge({},r,e.roles);return s[t]||s.default}},7750:(t,e,s)=>{"use strict";const{define:i,width:r}=s(3765);t.exports=class{constructor(t){let e=t.options;i(this,"_prompt",t),this.type=t.type,this.name=t.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=r(e.stdout||process.stdout),Object.assign(this,e),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=t.symbols,this.styles=t.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let t={...this};return t.status=this.status,t.buffer=Buffer.from(t.buffer),delete t.clone,t}set color(t){this._color=t}get color(){let t=this.prompt.styles;if(this.cancelled)return t.cancelled;if(this.submitted)return t.submitted;let e=this._color||t[this.status];return"function"==typeof e?e:t.pending}set loading(t){this._loading=t}get loading(){return"boolean"==typeof this._loading?this._loading:!!this.loadingChoices&&"choices"}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}}},8186:(t,e,s)=>{"use strict";const i=s(3765),r=s(2230),n={default:r.noop,noop:r.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||i.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||i.complement(this.primary)},primary:r.cyan,success:r.green,danger:r.magenta,strong:r.bold,warning:r.yellow,muted:r.dim,disabled:r.gray,dark:r.dim.gray,underline:r.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse},merge:(t={})=>{t.styles&&"boolean"==typeof t.styles.enabled&&(r.enabled=t.styles.enabled),t.styles&&"boolean"==typeof t.styles.visible&&(r.visible=t.styles.visible);let e=i.merge({},n,t.styles);delete e.merge;for(let t of Object.keys(r))e.hasOwnProperty(t)||Reflect.defineProperty(e,t,{get:()=>r[t]});for(let t of Object.keys(r.styles))e.hasOwnProperty(t)||Reflect.defineProperty(e,t,{get:()=>r[t]});return e}};t.exports=n},3048:(t,e,s)=>{"use strict";const i="win32"===process.platform,r=s(2230),n=s(3765),o={...r.symbols,upDownDoubleArrow:"⇕",upDownDoubleArrow2:"⬍",upDownArrow:"↕",asterisk:"*",asterism:"⁂",bulletWhite:"◦",electricArrow:"⌁",ellipsisLarge:"⋯",ellipsisSmall:"…",fullBlock:"█",identicalTo:"≡",indicator:r.symbols.check,leftAngle:"‹",mark:"※",minus:"−",multiplication:"×",obelus:"÷",percent:"%",pilcrow:"¶",pilcrow2:"❡",pencilUpRight:"✐",pencilDownRight:"✎",pencilRight:"✏",plus:"+",plusMinus:"±",pointRight:"☞",rightAngle:"›",section:"§",hexagon:{off:"⬡",on:"⬢",disabled:"⬢"},ballot:{on:"☑",off:"☐",disabled:"☒"},stars:{on:"★",off:"☆",disabled:"☆"},folder:{on:"▼",off:"▶",disabled:"▶"},prefix:{pending:r.symbols.question,submitted:r.symbols.check,cancelled:r.symbols.cross},separator:{pending:r.symbols.pointerSmall,submitted:r.symbols.middot,cancelled:r.symbols.middot},radio:{off:i?"( )":"◯",on:i?"(*)":"◉",disabled:i?"(|)":"Ⓘ"},numbers:["⓪","①","②","③","④","⑤","⑥","⑦","⑧","⑨","⑩","⑪","⑫","⑬","⑭","⑮","⑯","⑰","⑱","⑲","⑳","㉑","㉒","㉓","㉔","㉕","㉖","㉗","㉘","㉙","㉚","㉛","㉜","㉝","㉞","㉟","㊱","㊲","㊳","㊴","㊵","㊶","㊷","㊸","㊹","㊺","㊻","㊼","㊽","㊾","㊿"]};o.merge=t=>{let e=n.merge({},r.symbols,o,t.symbols);return delete e.merge,e},t.exports=o},4101:(t,e,s)=>{"use strict";const i=s(8186),r=s(3048),n=s(3765);t.exports=t=>{t.options=n.merge({},t.options.theme,t.options),t.symbols=r.merge(t.options),t.styles=i.merge(t.options)}},2017:t=>{"use strict";function e(t,e,s={}){let i=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},r=s.interval||120;i.frames=s.frames||[],i.loading=!0;let n=setInterval(()=>{i.ms=Date.now()-i.start,i.tick++,t.render()},r);return i.stop=()=>{i.loading=!1,clearInterval(n)},Reflect.defineProperty(i,"interval",{value:n}),t.once("close",()=>i.stop()),i.stop}t.exports=t=>{t.timers=t.timers||{};let s=t.options.timers;if(s)for(let i of Object.keys(s)){let r=s[i];"number"==typeof r&&(r={interval:r}),e(t,i,r)}}},7538:(t,e,s)=>{"use strict";const i=s(2230),r=s(7086),n=s(2468),o=s(3765),{reorder:a,scrollUp:h,scrollDown:l,isObject:c,swap:u}=o;function p(t,e){if(e instanceof Promise)return e;if("function"==typeof e){if(o.isAsyncFn(e))return e;e=e.call(t,t)}for(let s of e){if(Array.isArray(s.choices)){let e=s.choices.filter(e=>!t.isDisabled(e));s.enabled=e.every(t=>!0===t.enabled)}!0===t.isDisabled(s)&&delete s.enabled}return e}t.exports=class extends r{constructor(t){super(t),this.cursorHide(),this.maxSelected=t.maxSelected||1/0,this.multiple=t.multiple||!1,this.initial=t.initial||0,this.delay=t.delay||0,this.longest=0,this.num=""}async initialize(){"function"==typeof this.options.initial&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:t,initial:e,autofocus:s,suggest:i}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(t)),this.choices.forEach(t=>t.enabled=!1),"function"!=typeof i&&0===this.selectable.length)throw new Error("At least one choice must be selectable");c(e)&&(e=Object.keys(e)),Array.isArray(e)?(null!=s&&(this.index=this.findIndex(s)),e.forEach(t=>this.enable(this.find(t))),await this.render()):(null!=s&&(e=s),"string"==typeof e&&(e=this.findIndex(e)),"number"==typeof e&&e>-1&&(this.index=Math.max(0,Math.min(e,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(t,e){this.state.loadingChoices=!0;let s=[],i=0,r=async(t,e)=>{"function"==typeof t&&(t=await t.call(this)),t instanceof Promise&&(t=await t);for(let n=0;n(this.state.loadingChoices=!1,t))}async toChoice(t,e,s){if("function"==typeof t&&(t=await t.call(this,this)),t instanceof Promise&&(t=await t),"string"==typeof t&&(t={name:t}),t.normalized)return t;t.normalized=!0;let r=t.value,a=n(t.role,this.options);if("string"!=typeof(t=a(this,t)).disabled||t.hint||(t.hint=t.disabled,t.disabled=!0),!0===t.disabled&&null==t.hint&&(t.hint="(disabled)"),null!=t.index)return t;t.name=t.name||t.key||t.title||t.value||t.message,t.message=t.message||t.name||"",t.value=[t.value,t.name].find(this.isValue.bind(this)),t.input="",t.index=e,t.cursor=0,o.define(t,"parent",s),t.level=s?s.level+1:1,null==t.indent&&(t.indent=s?s.indent+" ":t.indent||""),t.path=s?s.path+"."+t.name:t.name,t.enabled=!(!this.multiple||this.isDisabled(t)||!t.enabled&&!this.isSelected(t)),this.isDisabled(t)||(this.longest=Math.max(this.longest,i.unstyle(t.message).length));let h={...t};return t.reset=(e=h.input,s=h.value)=>{for(let e of Object.keys(h))t[e]=h[e];t.input=e,t.value=s},null==r&&"function"==typeof t.initial&&(t.input=await t.initial.call(this,this.state,t,e)),t}async onChoice(t,e){this.emit("choice",t,e,this),"function"==typeof t.onChoice&&await t.onChoice.call(this,this.state,t,e)}async addChoice(t,e,s){let i=await this.toChoice(t,e,s);return this.choices.push(i),this.index=this.choices.length-1,this.limit=this.choices.length,i}async newItem(t,e,s){let i={name:"New choice name?",editable:!0,newChoice:!0,...t},r=await this.addChoice(i,e,s);return r.updateChoice=()=>{delete r.newChoice,r.name=r.message=r.input,r.input="",r.cursor=0},this.render()}indent(t){return null==t.indent?t.level>1?" ".repeat(t.level-1):"":t.indent}dispatch(t,e){if(this.multiple&&this[e.name])return this[e.name]();this.alert()}focus(t,e){return"boolean"!=typeof e&&(e=t.enabled),e&&!t.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=t.index,t.enabled=e&&!this.isDisabled(t),t)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelectedt.enabled);return this.choices.forEach(e=>e.enabled=!t),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(t=>t.enabled=!t.enabled),this.render())}g(t=this.focused){return this.choices.some(t=>!!t.parent)?(this.toggle(t.parent&&!t.choices?t.parent:t),this.render()):this.a()}toggle(t,e){if(!t.enabled&&this.selected.length>=this.maxSelected)return this.alert();"boolean"!=typeof e&&(e=!t.enabled),t.enabled=e,t.choices&&t.choices.forEach(t=>this.toggle(t,e));let s=t.parent;for(;s;){let t=s.choices.filter(t=>this.isDisabled(t));s.enabled=t.every(t=>!0===t.enabled),s=s.parent}return p(this,this.choices),this.emit("toggle",t,this),t}enable(t){return this.selected.length>=this.maxSelected?this.alert():(t.enabled=!this.isDisabled(t),t.choices&&t.choices.forEach(this.enable.bind(this)),t)}disable(t){return t.enabled=!1,t.choices&&t.choices.forEach(this.disable.bind(this)),t}number(t){this.num+=t;let e=t=>{let e=Number(t);if(e>this.choices.length-1)return this.alert();let s=this.focused,i=this.choices.find(t=>e===t.index);if(!i.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(-1===this.visible.indexOf(i)){let t=a(this.choices),e=t.indexOf(i);if(s.index>e){let s=t.slice(e,e+this.limit),i=t.filter(t=>!s.includes(t));this.choices=s.concat(i)}else{let s=e-this.limit+1;this.choices=t.slice(s).concat(t.slice(0,s))}}return this.index=this.choices.indexOf(i),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise(t=>{let s=this.choices.length,i=this.num,r=(s=!1,r)=>{clearTimeout(this.numberTimeout),s&&(r=e(i)),this.num="",t(r)};return"0"===i||1===i.length&&Number(i+"0")>s?r(!0):Number(i)>s?r(!1,this.alert()):void(this.numberTimeout=setTimeout(()=>r(!0),this.delay))})}home(){return this.choices=a(this.choices),this.index=0,this.render()}end(){let t=this.choices.length-this.limit,e=a(this.choices);return this.choices=e.slice(t).concat(e.slice(0,t)),this.index=this.limit-1,this.render()}first(){return this.index=0,this.render()}last(){return this.index=this.visible.length-1,this.render()}prev(){return this.visible.length<=1?this.alert():this.up()}next(){return this.visible.length<=1?this.alert():this.down()}right(){return this.cursor>=this.input.length?this.alert():(this.cursor++,this.render())}left(){return this.cursor<=0?this.alert():(this.cursor--,this.render())}up(){let t=this.choices.length,e=this.visible.length,s=this.index;return!1===this.options.scroll&&0===s?this.alert():t>e&&0===s?this.scrollUp():(this.index=(s-1%t+t)%t,this.isDisabled()?this.up():this.render())}down(){let t=this.choices.length,e=this.visible.length,s=this.index;return!1===this.options.scroll&&s===e-1?this.alert():t>e&&s===e-1?this.scrollDown():(this.index=(s+1)%t,this.isDisabled()?this.down():this.render())}scrollUp(t=0){return this.choices=h(this.choices),this.index=t,this.isDisabled()?this.up():this.render()}scrollDown(t=this.visible.length-1){return this.choices=l(this.choices),this.index=t,this.isDisabled()?this.down():this.render()}async shiftUp(){return!0===this.options.sort?(this.sorting=!0,this.swap(this.index-1),await this.up(),void(this.sorting=!1)):this.scrollUp(this.index)}async shiftDown(){return!0===this.options.sort?(this.sorting=!0,this.swap(this.index+1),await this.down(),void(this.sorting=!1)):this.scrollDown(this.index)}pageUp(){return this.visible.length<=1?this.alert():(this.limit=Math.max(this.limit-1,0),this.index=Math.min(this.limit-1,this.index),this._limit=this.limit,this.isDisabled()?this.up():this.render())}pageDown(){return this.visible.length>=this.choices.length?this.alert():(this.index=Math.max(0,this.index),this.limit=Math.min(this.limit+1,this.choices.length),this._limit=this.limit,this.isDisabled()?this.down():this.render())}swap(t){u(this.choices,this.index,t)}isDisabled(t=this.focused){return!(!t||!["disabled","collapsed","hidden","completing","readonly"].some(e=>!0===t[e]))||t&&"heading"===t.role}isEnabled(t=this.focused){if(Array.isArray(t))return t.every(t=>this.isEnabled(t));if(t.choices){let e=t.choices.filter(t=>!this.isDisabled(t));return t.enabled&&e.every(t=>this.isEnabled(t))}return t.enabled&&!this.isDisabled(t)}isChoice(t,e){return t.name===e||t.index===Number(e)}isSelected(t){return Array.isArray(this.initial)?this.initial.some(e=>this.isChoice(t,e)):this.isChoice(t,this.initial)}map(t=[],e="value"){return[].concat(t||[]).reduce((t,s)=>(t[s]=this.find(s,e),t),{})}filter(t,e){let s="function"==typeof t?t:(e,s)=>[e.name,s].includes(t),i=(this.options.multiple?this.state._choices:this.choices).filter(s);return e?i.map(t=>t[e]):i}find(t,e){if(c(t))return e?t[e]:t;let s="function"==typeof t?t:(e,s)=>[e.name,s].includes(t),i=this.choices.find(s);return i?e?i[e]:i:void 0}findIndex(t){return this.choices.indexOf(this.find(t))}async submit(){let t=this.focused;if(!t)return this.alert();if(t.newChoice)return t.input?(t.updateChoice(),this.render()):this.alert();if(this.choices.some(t=>t.newChoice))return this.alert();let{reorder:e,sort:s}=this.options,i=!0===this.multiple,r=this.selected;return void 0===r?this.alert():(Array.isArray(r)&&!1!==e&&!0!==s&&(r=o.reorder(r)),this.value=i?r.map(t=>t.name):r.name,super.submit())}set choices(t=[]){this.state._choices=this.state._choices||[],this.state.choices=t;for(let e of t)this.state._choices.some(t=>t.name===e.name)||this.state._choices.push(e);if(!this._initial&&this.options.initial){this._initial=!0;let t=this.initial;if("string"==typeof t||"number"==typeof t){let e=this.find(t);e&&(this.initial=e.index,this.focus(e,!0))}}}get choices(){return p(this,this.state.choices||[])}set visible(t){this.state.visible=t}get visible(){return(this.state.visible||this.choices).slice(0,this.limit)}set limit(t){this.state.limit=t}get limit(){let{state:t,options:e,choices:s}=this,i=t.limit||this._limit||e.limit||s.length;return Math.min(i,this.height)}set value(t){super.value=t}get value(){return"string"!=typeof super.value&&super.value===this.initial?this.input:super.value}set index(t){this.state.index=t}get index(){return Math.max(0,this.state?this.state.index:0)}get enabled(){return this.filter(this.isEnabled.bind(this))}get focused(){let t=this.choices[this.index];return t&&this.state.submitted&&!0!==this.multiple&&(t.enabled=!0),t}get selectable(){return this.choices.filter(t=>!this.isDisabled(t))}get selected(){return this.multiple?this.enabled:this.focused}}},6613:(t,e,s)=>{"use strict";const i=s(2681),r=()=>{throw new Error("expected prompt to have a custom authenticate method")},n=(t=r)=>class extends i{constructor(t){super(t)}async submit(){this.value=await t.call(this,this.values,this.state),super.base.submit.call(this)}static create(t){return n(t)}};t.exports=n()},6936:(t,e,s)=>{"use strict";const i=s(7086),{isPrimitive:r,hasColor:n}=s(3765);t.exports=class extends i{constructor(t){super(t),this.cursorHide()}async initialize(){let t=await this.resolve(this.initial,this.state);this.input=await this.cast(t),await super.initialize()}dispatch(t){return this.isValue(t)?(this.input=t,this.submit()):this.alert()}format(t){let{styles:e,state:s}=this;return s.submitted?e.success(t):e.primary(t)}cast(t){return this.isTrue(t)}isTrue(t){return/^[ty1]/i.test(t)}isFalse(t){return/^[fn0]/i.test(t)}isValue(t){return r(t)&&(this.isTrue(t)||this.isFalse(t))}async hint(){if("pending"===this.state.status){let t=await this.element("hint");return n(t)?t:this.styles.muted(t)}}async render(){let{input:t,size:e}=this.state,s=await this.prefix(),i=await this.separator(),r=[s,await this.message(),this.styles.muted(this.default),i].filter(Boolean).join(" ");this.state.prompt=r;let n=await this.header(),o=this.value=this.cast(t),a=await this.format(o),h=await this.error()||await this.hint(),l=await this.footer();h&&!r.includes(h)&&(a+=" "+h),r+=" "+a,this.clear(e),this.write([n,r,l].filter(Boolean).join("\n")),this.restore()}set value(t){super.value=t}get value(){return this.cast(super.value)}}},7463:(t,e,s)=>{t.exports={ArrayPrompt:s(7538),AuthPrompt:s(6613),BooleanPrompt:s(6936),NumberPrompt:s(1158),StringPrompt:s(4697)}},1158:(t,e,s)=>{"use strict";const i=s(4697);t.exports=class extends i{constructor(t={}){super({style:"number",...t}),this.min=this.isValue(t.min)?this.toNumber(t.min):-1/0,this.max=this.isValue(t.max)?this.toNumber(t.max):1/0,this.delay=null!=t.delay?t.delay:1e3,this.float=!1!==t.float,this.round=!0===t.round||!1===t.float,this.major=t.major||10,this.minor=t.minor||1,this.initial=null!=t.initial?t.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(t){return!/[-+.]/.test(t)||"."===t&&this.input.includes(".")?this.alert("invalid number"):super.append(t)}number(t){return super.append(t)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(t){let e=t||this.minor,s=this.toNumber(this.input);return s>this.max+e?this.alert():(this.input=""+(s+e),this.render())}down(t){let e=t||this.minor,s=this.toNumber(this.input);return sthis.isValue(t));return this.value=this.toNumber(t||0),super.submit()}}},4697:(t,e,s)=>{"use strict";const i=s(7086),r=s(3893),{isPrimitive:n}=s(3765);t.exports=class extends i{constructor(t){super(t),this.initial=n(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(t,e={}){let s=this.state.prevKeypress;return this.state.prevKeypress=e,!0!==this.options.multiline||"return"!==e.name||s&&"return"===s.name?super.keypress(t,e):this.append("\n",e)}moveCursor(t){this.cursor+=t}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(t,e){if(!t||e.ctrl||e.code)return this.alert();this.append(t)}append(t){let{cursor:e,input:s}=this.state;this.input=(""+s).slice(0,e)+t+(""+s).slice(e),this.moveCursor(String(t).length),this.render()}insert(t){this.append(t)}delete(){let{cursor:t,input:e}=this.state;if(t<=0)return this.alert();this.input=(""+e).slice(0,t-1)+(""+e).slice(t),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:t,input:e}=this.state;if(void 0===e[t])return this.alert();this.input=(""+e).slice(0,t)+(""+e).slice(t+1),this.render()}cutForward(){let t=this.cursor;if(this.input.length<=t)return this.alert();this.state.clipboard.push(this.input.slice(t)),this.input=this.input.slice(0,t),this.render()}cutLeft(){let t=this.cursor;if(0===t)return this.alert();let e=this.input.slice(0,t),s=this.input.slice(t),i=e.split(" ");this.state.clipboard.push(i.pop()),this.input=i.join(" "),this.cursor=this.input.length,this.input+=s,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let t=null!=this.initial?String(this.initial):"";if(!t||!t.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(t){return!!t}async format(t=this.value){let e=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(t||e):r(this,{input:t,initial:e,pos:this.cursor})}async render(){let t=this.state.size,e=await this.prefix(),s=await this.separator(),i=[e,await this.message(),s].filter(Boolean).join(" ");this.state.prompt=i;let r=await this.header(),n=await this.format(),o=await this.error()||await this.hint(),a=await this.footer();o&&!n.includes(o)&&(n+=" "+o),i+=" "+n,this.clear(t),this.write([r,i,a].filter(Boolean).join("\n")),this.restore()}}},3765:(t,e,s)=>{"use strict";const i=Object.prototype.toString,r=s(2230);let n=!1,o=[];const a={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};e.longest=(t,e)=>t.reduce((t,s)=>Math.max(t,e?s[e].length:s.length),0),e.hasColor=t=>!!t&&r.hasColor(t);const h=e.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t);e.nativeType=t=>i.call(t).slice(8,-1).toLowerCase().replace(/\s/g,""),e.isAsyncFn=t=>"asyncfunction"===e.nativeType(t),e.isPrimitive=t=>null!=t&&"object"!=typeof t&&"function"!=typeof t,e.resolve=(t,e,...s)=>"function"==typeof e?e.call(t,...s):e,e.scrollDown=(t=[])=>[...t.slice(1),t[0]],e.scrollUp=(t=[])=>[t.pop(),...t],e.reorder=(t=[])=>{let e=t.slice();return e.sort((t,e)=>t.index>e.index?1:t.index{let i=t.length,r=s===i?0:s<0?i-1:s,n=t[e];t[e]=t[r],t[r]=n},e.width=(t,e=80)=>{let s=t&&t.columns?t.columns:e;return t&&"function"==typeof t.getWindowSize&&(s=t.getWindowSize()[0]),"win32"===process.platform?s-1:s},e.height=(t,e=20)=>{let s=t&&t.rows?t.rows:e;return t&&"function"==typeof t.getWindowSize&&(s=t.getWindowSize()[1]),s},e.wordWrap=(t,e={})=>{if(!t)return t;"number"==typeof e&&(e={width:e});let{indent:s="",newline:i="\n"+s,width:r=80}=e,n=(i+s).match(/[^\S\n]/g)||[];r-=n.length;let o=`.{1,${r}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,a=t.trim(),h=new RegExp(o,"g"),l=a.match(h)||[];return l=l.map(t=>t.replace(/\n$/,"")),e.padEnd&&(l=l.map(t=>t.padEnd(r," "))),e.padStart&&(l=l.map(t=>t.padStart(r," "))),s+l.join(i)},e.unmute=t=>{let e=t.stack.find(t=>r.keys.color.includes(t));return e?r[e]:t.stack.find(t=>"bg"===t.slice(2))?r[e.slice(2)]:t=>t},e.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"",e.inverse=t=>{if(!t||!t.stack)return t;let s=t.stack.find(t=>r.keys.color.includes(t));if(s){let i=r["bg"+e.pascal(s)];return i?i.black:t}let i=t.stack.find(t=>"bg"===t.slice(0,2));return i?r[i.slice(2).toLowerCase()]||t:r.none},e.complement=t=>{if(!t||!t.stack)return t;let s=t.stack.find(t=>r.keys.color.includes(t)),i=t.stack.find(t=>"bg"===t.slice(0,2));if(s&&!i)return r[a[s]||s];if(i){let s=i.slice(2).toLowerCase(),n=a[s];return n&&r["bg"+e.pascal(n)]||t}return r.none},e.meridiem=t=>{let e=t.getHours(),s=t.getMinutes(),i=e>=12?"pm":"am";return e%=12,(0===e?12:e)+":"+(s<10?"0"+s:s)+" "+i},e.set=(t={},s="",i)=>s.split(".").reduce((t,s,r,n)=>{let o=n.length-1>r?t[s]||{}:i;return!e.isObject(o)&&r{let i=null==t[e]?e.split(".").reduce((t,e)=>t&&t[e],t):t[e];return null==i?s:i},e.mixin=(t,s)=>{if(!h(t))return s;if(!h(s))return t;for(let i of Object.keys(s)){let r=Object.getOwnPropertyDescriptor(s,i);if(r.hasOwnProperty("value"))if(t.hasOwnProperty(i)&&h(r.value)){let n=Object.getOwnPropertyDescriptor(t,i);h(n.value)?t[i]=e.merge({},t[i],s[i]):Reflect.defineProperty(t,i,r)}else Reflect.defineProperty(t,i,r);else Reflect.defineProperty(t,i,r)}return t},e.merge=(...t)=>{let s={};for(let i of t)e.mixin(s,i);return s},e.mixinEmitter=(t,s)=>{let i=s.constructor.prototype;for(let r of Object.keys(i)){let n=i[r];"function"==typeof n?e.define(t,r,n.bind(s)):e.define(t,r,n)}},e.onExit=t=>{const e=(t,e)=>{n||(n=!0,o.forEach(t=>t()),!0===t&&process.exit(128+e))};0===o.length&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),o.push(t)},e.define=(t,e,s)=>{Reflect.defineProperty(t,e,{value:s})},e.defineExport=(t,e,s)=>{let i;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(t){i=t},get:()=>i?i():s()})}},4889:(t,e,s)=>{"use strict";const i=s(4309),r=s(8614).EventEmitter,n=s(5747);let o=n.writev;if(!o){const t=process.binding("fs"),e=t.FSReqWrap||t.FSReqCallback;o=(s,i,r,n)=>{const o=new e;o.oncomplete=(t,e)=>n(t,e,i),t.writeBuffers(s,i,r,o)}}const a=Symbol("_autoClose"),h=Symbol("_close"),l=Symbol("_ended"),c=Symbol("_fd"),u=Symbol("_finished"),p=Symbol("_flags"),d=Symbol("_flush"),m=Symbol("_handleChunk"),f=Symbol("_makeBuf"),g=Symbol("_mode"),y=Symbol("_needDrain"),w=Symbol("_onerror"),b=Symbol("_onopen"),E=Symbol("_onread"),v=Symbol("_onwrite"),O=Symbol("_open"),x=Symbol("_path"),R=Symbol("_pos"),S=Symbol("_queue"),C=Symbol("_read"),_=Symbol("_readSize"),I=Symbol("_reading"),k=Symbol("_remain"),T=Symbol("_size"),N=Symbol("_write"),A=Symbol("_writing"),L=Symbol("_defaultFlag"),$=Symbol("_errored");class P extends i{constructor(t,e){if(super(e=e||{}),this.readable=!0,this.writable=!1,"string"!=typeof t)throw new TypeError("path must be a string");this[$]=!1,this[c]="number"==typeof e.fd?e.fd:null,this[x]=t,this[_]=e.readSize||16777216,this[I]=!1,this[T]="number"==typeof e.size?e.size:1/0,this[k]=this[T],this[a]="boolean"!=typeof e.autoClose||e.autoClose,"number"==typeof this[c]?this[C]():this[O]()}get fd(){return this[c]}get path(){return this[x]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[O](){n.open(this[x],"r",(t,e)=>this[b](t,e))}[b](t,e){t?this[w](t):(this[c]=e,this.emit("open",e),this[C]())}[f](){return Buffer.allocUnsafe(Math.min(this[_],this[k]))}[C](){if(!this[I]){this[I]=!0;const t=this[f]();if(0===t.length)return process.nextTick(()=>this[E](null,0,t));n.read(this[c],t,0,t.length,null,(t,e,s)=>this[E](t,e,s))}}[E](t,e,s){this[I]=!1,t?this[w](t):this[m](e,s)&&this[C]()}[h](){if(this[a]&&"number"==typeof this[c]){const t=this[c];this[c]=null,n.close(t,t=>t?this.emit("error",t):this.emit("close"))}}[w](t){this[I]=!0,this[h](),this.emit("error",t)}[m](t,e){let s=!1;return this[k]-=t,t>0&&(s=super.write(tthis[b](t,e))}[b](t,e){this[L]&&"r+"===this[p]&&t&&"ENOENT"===t.code?(this[p]="w",this[O]()):t?this[w](t):(this[c]=e,this.emit("open",e),this[d]())}end(t,e){return t&&this.write(t,e),this[l]=!0,this[A]||this[S].length||"number"!=typeof this[c]||this[v](null,0),this}write(t,e){return"string"==typeof t&&(t=Buffer.from(t,e)),this[l]?(this.emit("error",new Error("write() after end()")),!1):null===this[c]||this[A]||this[S].length?(this[S].push(t),this[y]=!0,!1):(this[A]=!0,this[N](t),!0)}[N](t){n.write(this[c],t,0,t.length,this[R],(t,e)=>this[v](t,e))}[v](t,e){t?this[w](t):(null!==this[R]&&(this[R]+=e),this[S].length?this[d]():(this[A]=!1,this[l]&&!this[u]?(this[u]=!0,this[h](),this.emit("finish")):this[y]&&(this[y]=!1,this.emit("drain"))))}[d](){if(0===this[S].length)this[l]&&this[v](null,0);else if(1===this[S].length)this[N](this[S].pop());else{const t=this[S];this[S]=[],o(this[c],t,this[R],(t,e)=>this[v](t,e))}}[h](){if(this[a]&&"number"==typeof this[c]){const t=this[c];this[c]=null,n.close(t,t=>t?this.emit("error",t):this.emit("close"))}}}e.ReadStream=P,e.ReadStreamSync=class extends P{[O](){let t=!0;try{this[b](null,n.openSync(this[x],"r")),t=!1}finally{t&&this[h]()}}[C](){let t=!0;try{if(!this[I]){for(this[I]=!0;;){const t=this[f](),e=0===t.length?0:n.readSync(this[c],t,0,t.length,null);if(!this[m](e,t))break}this[I]=!1}t=!1}finally{t&&this[h]()}}[h](){if(this[a]&&"number"==typeof this[c]){const t=this[c];this[c]=null,n.closeSync(t),this.emit("close")}}},e.WriteStream=D,e.WriteStreamSync=class extends D{[O](){let t;if(this[L]&&"r+"===this[p])try{t=n.openSync(this[x],this[p],this[g])}catch(t){if("ENOENT"===t.code)return this[p]="w",this[O]();throw t}else t=n.openSync(this[x],this[p],this[g]);this[b](null,t)}[h](){if(this[a]&&"number"==typeof this[c]){const t=this[c];this[c]=null,n.closeSync(t),this.emit("close")}}[N](t){let e=!0;try{this[v](null,n.writeSync(this[c],t,0,t.length,this[R])),e=!1}finally{if(e)try{this[h]()}catch(t){}}}}},6603:t=>{"use strict";t.exports=(t,e=process.argv)=>{const s=t.startsWith("-")?"":1===t.length?"-":"--",i=e.indexOf(s+t),r=e.indexOf("--");return-1!==i&&(-1===r||i{"use strict";const i=s(8614),r=s(2413),n=s(7638),o=s(4304).StringDecoder,a=Symbol("EOF"),h=Symbol("maybeEmitEnd"),l=Symbol("emittedEnd"),c=Symbol("emittingEnd"),u=Symbol("closed"),p=Symbol("read"),d=Symbol("flush"),m=Symbol("flushChunk"),f=Symbol("encoding"),g=Symbol("decoder"),y=Symbol("flowing"),w=Symbol("paused"),b=Symbol("resume"),E=Symbol("bufferLength"),v=Symbol("bufferPush"),O=Symbol("bufferShift"),x=Symbol("objectMode"),R=Symbol("destroyed"),S="1"!==global._MP_NO_ITERATOR_SYMBOLS_,C=S&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),_=S&&Symbol.iterator||Symbol("iterator not implemented"),I=t=>"end"===t||"finish"===t||"prefinish"===t;t.exports=class t extends r{constructor(t){super(),this[y]=!1,this[w]=!1,this.pipes=new n,this.buffer=new n,this[x]=t&&t.objectMode||!1,this[x]?this[f]=null:this[f]=t&&t.encoding||null,"buffer"===this[f]&&(this[f]=null),this[g]=this[f]?new o(this[f]):null,this[a]=!1,this[l]=!1,this[c]=!1,this[u]=!1,this.writable=!0,this.readable=!0,this[E]=0,this[R]=!1}get bufferLength(){return this[E]}get encoding(){return this[f]}set encoding(t){if(this[x])throw new Error("cannot set encoding in objectMode");if(this[f]&&t!==this[f]&&(this[g]&&this[g].lastNeed||this[E]))throw new Error("cannot change encoding");this[f]!==t&&(this[g]=t?new o(t):null,this.buffer.length&&(this.buffer=this.buffer.map(t=>this[g].write(t)))),this[f]=t}setEncoding(t){this.encoding=t}get objectMode(){return this[x]}set objectMode(t){this[x]=this[x]||!!t}write(t,e,s){if(this[a])throw new Error("write after end");if(this[R])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;var i;if("function"==typeof e&&(s=e,e="utf8"),e||(e="utf8"),this[x]||Buffer.isBuffer(t)||(i=t,!Buffer.isBuffer(i)&&ArrayBuffer.isView(i)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):(t=>t instanceof ArrayBuffer||"object"==typeof t&&t.constructor&&"ArrayBuffer"===t.constructor.name&&t.byteLength>=0)(t)?t=Buffer.from(t):"string"!=typeof t&&(this.objectMode=!0)),!this.objectMode&&!t.length){const t=this.flowing;return 0!==this[E]&&this.emit("readable"),s&&s(),t}"string"!=typeof t||this[x]||e===this[f]&&!this[g].lastNeed||(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[f]&&(t=this[g].write(t));try{return this.flowing?(this.emit("data",t),this.flowing):(this[v](t),!1)}finally{0!==this[E]&&this.emit("readable"),s&&s()}}read(t){if(this[R])return null;try{return 0===this[E]||0===t||t>this[E]?null:(this[x]&&(t=null),this.buffer.length>1&&!this[x]&&(this.encoding?this.buffer=new n([Array.from(this.buffer).join("")]):this.buffer=new n([Buffer.concat(Array.from(this.buffer),this[E])])),this[p](t||null,this.buffer.head.value))}finally{this[h]()}}[p](t,e){return t===e.length||null===t?this[O]():(this.buffer.head.value=e.slice(t),e=e.slice(0,t),this[E]-=t),this.emit("data",e),this.buffer.length||this[a]||this.emit("drain"),e}end(t,e,s){return"function"==typeof t&&(s=t,t=null),"function"==typeof e&&(s=e,e="utf8"),t&&this.write(t,e),s&&this.once("end",s),this[a]=!0,this.writable=!1,!this.flowing&&this[w]||this[h](),this}[b](){this[R]||(this[w]=!1,this[y]=!0,this.emit("resume"),this.buffer.length?this[d]():this[a]?this[h]():this.emit("drain"))}resume(){return this[b]()}pause(){this[y]=!1,this[w]=!0}get destroyed(){return this[R]}get flowing(){return this[y]}get paused(){return this[w]}[v](t){return this[x]?this[E]+=1:this[E]+=t.length,this.buffer.push(t)}[O](){return this.buffer.length&&(this[x]?this[E]-=1:this[E]-=this.buffer.head.value.length),this.buffer.shift()}[d](){do{}while(this[m](this[O]()));this.buffer.length||this[a]||this.emit("drain")}[m](t){return!!t&&(this.emit("data",t),this.flowing)}pipe(t,e){if(this[R])return;const s=this[l];e=e||{},t===process.stdout||t===process.stderr?e.end=!1:e.end=!1!==e.end;const i={dest:t,opts:e,ondrain:t=>this[b]()};return this.pipes.push(i),t.on("drain",i.ondrain),this[b](),s&&i.opts.end&&i.dest.end(),t}addListener(t,e){return this.on(t,e)}on(t,e){try{return super.on(t,e)}finally{"data"!==t||this.pipes.length||this.flowing?I(t)&&this[l]&&(super.emit(t),this.removeAllListeners(t)):this[b]()}}get emittedEnd(){return this[l]}[h](){this[c]||this[l]||this[R]||0!==this.buffer.length||!this[a]||(this[c]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[u]&&this.emit("close"),this[c]=!1)}emit(t,e){if("error"!==t&&"close"!==t&&t!==R&&this[R])return;if("data"===t){if(!e)return;this.pipes.length&&this.pipes.forEach(t=>!1===t.dest.write(e)&&this.pause())}else if("end"===t){if(!0===this[l])return;this[l]=!0,this.readable=!1,this[g]&&(e=this[g].end())&&(this.pipes.forEach(t=>t.dest.write(e)),super.emit("data",e)),this.pipes.forEach(t=>{t.dest.removeListener("drain",t.ondrain),t.opts.end&&t.dest.end()})}else if("close"===t&&(this[u]=!0,!this[l]&&!this[R]))return;const s=new Array(arguments.length);if(s[0]=t,s[1]=e,arguments.length>2)for(let t=2;t{t.push(e),this[x]||(t.dataLength+=e.length)}),e.then(()=>t)}concat(){return this[x]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(t=>this[x]?Promise.reject(new Error("cannot concat in objectMode")):this[f]?t.join(""):Buffer.concat(t,t.dataLength))}promise(){return new Promise((t,e)=>{this.on(R,()=>e(new Error("stream destroyed"))),this.on("end",()=>t()),this.on("error",t=>e(t))})}[C](){return{next:()=>{const t=this.read();if(null!==t)return Promise.resolve({done:!1,value:t});if(this[a])return Promise.resolve({done:!0});let e=null,s=null;const i=t=>{this.removeListener("data",r),this.removeListener("end",n),s(t)},r=t=>{this.removeListener("error",i),this.removeListener("end",n),this.pause(),e({value:t,done:!!this[a]})},n=()=>{this.removeListener("error",i),this.removeListener("data",r),e({done:!0})},o=()=>i(new Error("stream destroyed"));return new Promise((t,a)=>{s=a,e=t,this.once(R,o),this.once("error",i),this.once("end",n),this.once("data",r)})}}}[_](){return{next:()=>{const t=this.read();return{value:t,done:null===t}}}}destroy(t){return this[R]?(t?this.emit("error",t):this.emit(R),this):(this[R]=!0,this.buffer=new n,this[E]=0,"function"!=typeof this.close||this[u]||this.close(),t?this.emit("error",t):this.emit(R),this)}static isStream(e){return!!e&&(e instanceof t||e instanceof r||e instanceof i&&("function"==typeof e.pipe||"function"==typeof e.write&&"function"==typeof e.end))}}},1690:(t,e,s)=>{const i=s(8761).constants||{ZLIB_VERNUM:4736};t.exports=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},i))},8855:(t,e,s)=>{"use strict";const i=s(2357),r=s(4293).Buffer,n=s(8761),o=e.constants=s(1690),a=s(4309),h=r.concat,l=Symbol("_superWrite");class c extends Error{constructor(t){super("zlib: "+t.message),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const u=Symbol("opts"),p=Symbol("flushFlag"),d=Symbol("finishFlushFlag"),m=Symbol("fullFlushFlag"),f=Symbol("handle"),g=Symbol("onError"),y=Symbol("sawError"),w=Symbol("level"),b=Symbol("strategy"),E=Symbol("ended");Symbol("_defaultFullFlush");class v extends a{constructor(t,e){if(!t||"object"!=typeof t)throw new TypeError("invalid options for ZlibBase constructor");super(t),this[E]=!1,this[u]=t,this[p]=t.flush,this[d]=t.finishFlush;try{this[f]=new n[e](t)}catch(t){throw new c(t)}this[g]=t=>{this[y]=!0,this.close(),this.emit("error",t)},this[f].on("error",t=>this[g](new c(t))),this.once("end",()=>this.close)}close(){this[f]&&(this[f].close(),this[f]=null,this.emit("close"))}reset(){if(!this[y])return i(this[f],"zlib binding closed"),this[f].reset()}flush(t){this.ended||("number"!=typeof t&&(t=this[m]),this.write(Object.assign(r.alloc(0),{[p]:t})))}end(t,e,s){return t&&this.write(t,e),this.flush(this[d]),this[E]=!0,super.end(null,null,s)}get ended(){return this[E]}write(t,e,s){if("function"==typeof e&&(s=e,e="utf8"),"string"==typeof t&&(t=r.from(t,e)),this[y])return;i(this[f],"zlib binding closed");const n=this[f]._handle,o=n.close;n.close=()=>{};const a=this[f].close;let u,d;this[f].close=()=>{},r.concat=t=>t;try{const e="number"==typeof t[p]?t[p]:this[p];u=this[f]._processChunk(t,e),r.concat=h}catch(t){r.concat=h,this[g](new c(t))}finally{this[f]&&(this[f]._handle=n,n.close=o,this[f].close=a,this[f].removeAllListeners("error"))}if(u)if(Array.isArray(u)&&u.length>0){d=this[l](r.from(u[0]));for(let t=1;t{this.flush(t),e()};try{this[f].params(t,e)}finally{this[f].flush=s}this[f]&&(this[w]=t,this[b]=e)}}}}const x=Symbol("_portable");class R extends v{constructor(t,e){(t=t||{}).flush=t.flush||o.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||o.BROTLI_OPERATION_FINISH,super(t,e),this[m]=o.BROTLI_OPERATION_FLUSH}}class S extends R{constructor(t){super(t,"BrotliCompress")}}class C extends R{constructor(t){super(t,"BrotliDecompress")}}e.Deflate=class extends O{constructor(t){super(t,"Deflate")}},e.Inflate=class extends O{constructor(t){super(t,"Inflate")}},e.Gzip=class extends O{constructor(t){super(t,"Gzip"),this[x]=t&&!!t.portable}[l](t){return this[x]?(this[x]=!1,t[9]=255,super[l](t)):super[l](t)}},e.Gunzip=class extends O{constructor(t){super(t,"Gunzip")}},e.DeflateRaw=class extends O{constructor(t){super(t,"DeflateRaw")}},e.InflateRaw=class extends O{constructor(t){super(t,"InflateRaw")}},e.Unzip=class extends O{constructor(t){super(t,"Unzip")}},"function"==typeof n.BrotliCompress?(e.BrotliCompress=S,e.BrotliDecompress=C):e.BrotliCompress=e.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}}},1679:(t,e,s)=>{const i=s(4338),r=s(8780),{mkdirpNative:n,mkdirpNativeSync:o}=s(2639),{mkdirpManual:a,mkdirpManualSync:h}=s(4489),{useNative:l,useNativeSync:c}=s(4146),u=(t,e)=>(t=r(t),e=i(e),l(e)?n(t,e):a(t,e));u.sync=(t,e)=>(t=r(t),e=i(e),c(e)?o(t,e):h(t,e)),u.native=(t,e)=>n(r(t),i(e)),u.manual=(t,e)=>a(r(t),i(e)),u.nativeSync=(t,e)=>o(r(t),i(e)),u.manualSync=(t,e)=>h(r(t),i(e)),t.exports=u},9522:(t,e,s)=>{const{dirname:i}=s(5622),r=(t,e,s)=>s===e?Promise.resolve():t.statAsync(e).then(t=>t.isDirectory()?s:void 0,s=>"ENOENT"===s.code?r(t,i(e),e):void 0),n=(t,e,s)=>{if(s!==e)try{return t.statSync(e).isDirectory()?s:void 0}catch(s){return"ENOENT"===s.code?n(t,i(e),e):void 0}};t.exports={findMade:r,findMadeSync:n}},4489:(t,e,s)=>{const{dirname:i}=s(5622),r=(t,e,s)=>{e.recursive=!1;const n=i(t);return n===t?e.mkdirAsync(t,e).catch(t=>{if("EISDIR"!==t.code)throw t}):e.mkdirAsync(t,e).then(()=>s||t,i=>{if("ENOENT"===i.code)return r(n,e).then(s=>r(t,e,s));if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;return e.statAsync(t).then(t=>{if(t.isDirectory())return s;throw i},()=>{throw i})})},n=(t,e,s)=>{const r=i(t);if(e.recursive=!1,r===t)try{return e.mkdirSync(t,e)}catch(t){if("EISDIR"!==t.code)throw t;return}try{return e.mkdirSync(t,e),s||t}catch(i){if("ENOENT"===i.code)return n(t,e,n(r,e,s));if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;try{if(!e.statSync(t).isDirectory())throw i}catch(t){throw i}}};t.exports={mkdirpManual:r,mkdirpManualSync:n}},2639:(t,e,s)=>{const{dirname:i}=s(5622),{findMade:r,findMadeSync:n}=s(9522),{mkdirpManual:o,mkdirpManualSync:a}=s(4489);t.exports={mkdirpNative:(t,e)=>{e.recursive=!0;return i(t)===t?e.mkdirAsync(t,e):r(e,t).then(s=>e.mkdirAsync(t,e).then(()=>s).catch(s=>{if("ENOENT"===s.code)return o(t,e);throw s}))},mkdirpNativeSync:(t,e)=>{e.recursive=!0;if(i(t)===t)return e.mkdirSync(t,e);const s=n(e,t);try{return e.mkdirSync(t,e),s}catch(s){if("ENOENT"===s.code)return a(t,e);throw s}}}},4338:(t,e,s)=>{const{promisify:i}=s(1669),r=s(5747);t.exports=t=>{if(t)if("object"==typeof t)t={mode:511&~process.umask(),fs:r,...t};else if("number"==typeof t)t={mode:t,fs:r};else{if("string"!=typeof t)throw new TypeError("invalid options argument");t={mode:parseInt(t,8),fs:r}}else t={mode:511&~process.umask(),fs:r};return t.mkdir=t.mkdir||t.fs.mkdir||r.mkdir,t.mkdirAsync=i(t.mkdir),t.stat=t.stat||t.fs.stat||r.stat,t.statAsync=i(t.stat),t.statSync=t.statSync||t.fs.statSync||r.statSync,t.mkdirSync=t.mkdirSync||t.fs.mkdirSync||r.mkdirSync,t}},8780:(t,e,s)=>{const i=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:r,parse:n}=s(5622);t.exports=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=r(t),"win32"===i){const e=/[*|"<>?:]/,{root:s}=n(t);if(e.test(t.substr(s.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t}},4146:(t,e,s)=>{const i=s(5747),r=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),n=+r[0]>10||10==+r[0]&&+r[1]>=12,o=n?t=>t.mkdir===i.mkdir:()=>!1,a=n?t=>t.mkdirSync===i.mkdirSync:()=>!1;t.exports={useNative:o,useNativeSync:a}},322:t=>{var e=1e3,s=6e4,i=60*s,r=24*i;function n(t,e,s,i){var r=e>=1.5*s;return Math.round(t/s)+" "+i+(r?"s":"")}t.exports=function(t,o){o=o||{};var a=typeof t;if("string"===a&&t.length>0)return function(t){if((t=String(t)).length>100)return;var n=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!n)return;var o=parseFloat(n[1]);switch((n[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*r;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return o*s;case"seconds":case"second":case"secs":case"sec":case"s":return o*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}(t);if("number"===a&&isFinite(t))return o.long?function(t){var o=Math.abs(t);if(o>=r)return n(t,o,r,"day");if(o>=i)return n(t,o,i,"hour");if(o>=s)return n(t,o,s,"minute");if(o>=e)return n(t,o,e,"second");return t+" ms"}(t):function(t){var n=Math.abs(t);if(n>=r)return Math.round(t/r)+"d";if(n>=i)return Math.round(t/i)+"h";if(n>=s)return Math.round(t/s)+"m";if(n>=e)return Math.round(t/e)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},4636:(t,e,s)=>{const i=Symbol("SemVer ANY");class r{static get ANY(){return i}constructor(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof r){if(t.loose===!!e.loose)return t;t=t.value}h("comparator",t,e),this.options=e,this.loose=!!e.loose,this.parse(t),this.semver===i?this.value="":this.value=this.operator+this.semver.version,h("comp",this)}parse(t){const e=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],s=t.match(e);if(!s)throw new TypeError("Invalid comparator: "+t);this.operator=void 0!==s[1]?s[1]:"","="===this.operator&&(this.operator=""),s[2]?this.semver=new l(s[2],this.options.loose):this.semver=i}toString(){return this.value}test(t){if(h("Comparator.test",t,this.options.loose),this.semver===i||t===i)return!0;if("string"==typeof t)try{t=new l(t,this.options)}catch(t){return!1}return a(t,this.operator,this.semver,this.options)}intersects(t,e){if(!(t instanceof r))throw new TypeError("a Comparator is required");if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),""===this.operator)return""===this.value||new c(t.value,e).test(this.value);if(""===t.operator)return""===t.value||new c(this.value,e).test(t.semver);const s=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),n=this.semver.version===t.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),h=a(this.semver,"<",t.semver,e)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),l=a(this.semver,">",t.semver,e)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return s||i||n&&o||h||l}}t.exports=r;const{re:n,t:o}=s(5315),a=s(477),h=s(6245),l=s(8048),c=s(15)},15:(t,e,s)=>{class i{constructor(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof i)return t.loose===!!e.loose&&t.includePrerelease===!!e.includePrerelease?t:new i(t.raw,e);if(t instanceof r)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map(t=>this.parseRange(t.trim())).filter(t=>t.length),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){const e=this.options.loose;t=t.trim();const s=e?a[h.HYPHENRANGELOOSE]:a[h.HYPHENRANGE];t=t.replace(s,O),n("hyphen replace",t),t=t.replace(a[h.COMPARATORTRIM],l),n("comparator trim",t,a[h.COMPARATORTRIM]),t=(t=(t=t.replace(a[h.TILDETRIM],c)).replace(a[h.CARETTRIM],u)).split(/\s+/).join(" ");const i=e?a[h.COMPARATORLOOSE]:a[h.COMPARATOR];return t.split(" ").map(t=>d(t,this.options)).join(" ").split(/\s+/).filter(this.options.loose?t=>!!t.match(i):()=>!0).map(t=>new r(t,this.options))}intersects(t,e){if(!(t instanceof i))throw new TypeError("a Range is required");return this.set.some(s=>p(s,e)&&t.set.some(t=>p(t,e)&&s.every(s=>t.every(t=>s.intersects(t,e)))))}test(t){if(!t)return!1;if("string"==typeof t)try{t=new o(t,this.options)}catch(t){return!1}for(let e=0;e{let s=!0;const i=t.slice();let r=i.pop();for(;s&&i.length;)s=i.every(t=>r.intersects(t,e)),r=i.pop();return s},d=(t,e)=>(n("comp",t,e),t=y(t,e),n("caret",t),t=f(t,e),n("tildes",t),t=b(t,e),n("xrange",t),t=v(t,e),n("stars",t),t),m=t=>!t||"x"===t.toLowerCase()||"*"===t,f=(t,e)=>t.trim().split(/\s+/).map(t=>g(t,e)).join(" "),g=(t,e)=>{const s=e.loose?a[h.TILDELOOSE]:a[h.TILDE];return t.replace(s,(e,s,i,r,o)=>{let a;return n("tilde",t,e,s,i,r,o),m(s)?a="":m(i)?a=`>=${s}.0.0 <${+s+1}.0.0`:m(r)?a=`>=${s}.${i}.0 <${s}.${+i+1}.0`:o?(n("replaceTilde pr",o),a=`>=${s}.${i}.${r}-${o} <${s}.${+i+1}.0`):a=`>=${s}.${i}.${r} <${s}.${+i+1}.0`,n("tilde return",a),a})},y=(t,e)=>t.trim().split(/\s+/).map(t=>w(t,e)).join(" "),w=(t,e)=>{n("caret",t,e);const s=e.loose?a[h.CARETLOOSE]:a[h.CARET];return t.replace(s,(e,s,i,r,o)=>{let a;return n("caret",t,e,s,i,r,o),m(s)?a="":m(i)?a=`>=${s}.0.0 <${+s+1}.0.0`:m(r)?a="0"===s?`>=${s}.${i}.0 <${s}.${+i+1}.0`:`>=${s}.${i}.0 <${+s+1}.0.0`:o?(n("replaceCaret pr",o),a="0"===s?"0"===i?`>=${s}.${i}.${r}-${o} <${s}.${i}.${+r+1}`:`>=${s}.${i}.${r}-${o} <${s}.${+i+1}.0`:`>=${s}.${i}.${r}-${o} <${+s+1}.0.0`):(n("no pr"),a="0"===s?"0"===i?`>=${s}.${i}.${r} <${s}.${i}.${+r+1}`:`>=${s}.${i}.${r} <${s}.${+i+1}.0`:`>=${s}.${i}.${r} <${+s+1}.0.0`),n("caret return",a),a})},b=(t,e)=>(n("replaceXRanges",t,e),t.split(/\s+/).map(t=>E(t,e)).join(" ")),E=(t,e)=>{t=t.trim();const s=e.loose?a[h.XRANGELOOSE]:a[h.XRANGE];return t.replace(s,(s,i,r,o,a,h)=>{n("xRange",t,s,i,r,o,a,h);const l=m(r),c=l||m(o),u=c||m(a),p=u;return"="===i&&p&&(i=""),h=e.includePrerelease?"-0":"",l?s=">"===i||"<"===i?"<0.0.0-0":"*":i&&p?(c&&(o=0),a=0,">"===i?(i=">=",c?(r=+r+1,o=0,a=0):(o=+o+1,a=0)):"<="===i&&(i="<",c?r=+r+1:o=+o+1),s=`${i+r}.${o}.${a}${h}`):c?s=`>=${r}.0.0${h} <${+r+1}.0.0${h}`:u&&(s=`>=${r}.${o}.0${h} <${r}.${+o+1}.0${h}`),n("xRange return",s),s})},v=(t,e)=>(n("replaceStars",t,e),t.trim().replace(a[h.STAR],"")),O=(t,e,s,i,r,n,o,a,h,l,c,u,p)=>`${e=m(s)?"":m(i)?`>=${s}.0.0`:m(r)?`>=${s}.${i}.0`:">="+e} ${a=m(h)?"":m(l)?`<${+h+1}.0.0`:m(c)?`<${h}.${+l+1}.0`:u?`<=${h}.${l}.${c}-${u}`:"<="+a}`.trim(),x=(t,e,s)=>{for(let s=0;s0){const i=t[s].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}},8048:(t,e,s)=>{const i=s(6245),{MAX_LENGTH:r,MAX_SAFE_INTEGER:n}=s(8182),{re:o,t:a}=s(5315),{compareIdentifiers:h}=s(2055);class l{constructor(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof l){if(t.loose===!!e.loose&&t.includePrerelease===!!e.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>r)throw new TypeError(`version is longer than ${r} characters`);i("SemVer",t,e),this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease;const s=t.trim().match(e.loose?o[a.LOOSE]:o[a.FULL]);if(!s)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(t=>{if(/^[0-9]+$/.test(t)){const e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[t]&&(this.prerelease[t]++,t=-2);-1===t&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.format(),this.raw=this.version,this}}t.exports=l},6928:(t,e,s)=>{const i=s(9722);t.exports=(t,e)=>{const s=i(t.trim().replace(/^[=v]+/,""),e);return s?s.version:null}},477:(t,e,s)=>{const i=s(5618),r=s(1395),n=s(1891),o=s(101),a=s(5689),h=s(8004);t.exports=(t,e,s,l)=>{switch(e){case"===":return"object"==typeof t&&(t=t.version),"object"==typeof s&&(s=s.version),t===s;case"!==":return"object"==typeof t&&(t=t.version),"object"==typeof s&&(s=s.version),t!==s;case"":case"=":case"==":return i(t,s,l);case"!=":return r(t,s,l);case">":return n(t,s,l);case">=":return o(t,s,l);case"<":return a(t,s,l);case"<=":return h(t,s,l);default:throw new TypeError("Invalid operator: "+e)}}},1595:(t,e,s)=>{const i=s(8048),r=s(9722),{re:n,t:o}=s(5315);t.exports=(t,e)=>{if(t instanceof i)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;let s=null;if((e=e||{}).rtl){let e;for(;(e=n[o.COERCERTL].exec(t))&&(!s||s.index+s[0].length!==t.length);)s&&e.index+e[0].length===s.index+s[0].length||(s=e),n[o.COERCERTL].lastIndex=e.index+e[1].length+e[2].length;n[o.COERCERTL].lastIndex=-1}else s=t.match(n[o.COERCE]);return null===s?null:r(`${s[2]}.${s[3]||"0"}.${s[4]||"0"}`,e)}},2250:(t,e,s)=>{const i=s(8048);t.exports=(t,e,s)=>{const r=new i(t,s),n=new i(e,s);return r.compare(n)||r.compareBuild(n)}},8570:(t,e,s)=>{const i=s(7682);t.exports=(t,e)=>i(t,e,!0)},7682:(t,e,s)=>{const i=s(8048);t.exports=(t,e,s)=>new i(t,s).compare(new i(e,s))},2281:(t,e,s)=>{const i=s(9722),r=s(5618);t.exports=(t,e)=>{if(r(t,e))return null;{const s=i(t),r=i(e),n=s.prerelease.length||r.prerelease.length,o=n?"pre":"",a=n?"prerelease":"";for(const t in s)if(("major"===t||"minor"===t||"patch"===t)&&s[t]!==r[t])return o+t;return a}}},5618:(t,e,s)=>{const i=s(7682);t.exports=(t,e,s)=>0===i(t,e,s)},1891:(t,e,s)=>{const i=s(7682);t.exports=(t,e,s)=>i(t,e,s)>0},101:(t,e,s)=>{const i=s(7682);t.exports=(t,e,s)=>i(t,e,s)>=0},5049:(t,e,s)=>{const i=s(8048);t.exports=(t,e,s,r)=>{"string"==typeof s&&(r=s,s=void 0);try{return new i(t,s).inc(e,r).version}catch(t){return null}}},5689:(t,e,s)=>{const i=s(7682);t.exports=(t,e,s)=>i(t,e,s)<0},8004:(t,e,s)=>{const i=s(7682);t.exports=(t,e,s)=>i(t,e,s)<=0},7249:(t,e,s)=>{const i=s(8048);t.exports=(t,e)=>new i(t,e).major},2518:(t,e,s)=>{const i=s(8048);t.exports=(t,e)=>new i(t,e).minor},1395:(t,e,s)=>{const i=s(7682);t.exports=(t,e,s)=>0!==i(t,e,s)},9722:(t,e,s)=>{const{MAX_LENGTH:i}=s(8182),{re:r,t:n}=s(5315),o=s(8048);t.exports=(t,e)=>{if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof o)return t;if("string"!=typeof t)return null;if(t.length>i)return null;if(!(e.loose?r[n.LOOSE]:r[n.FULL]).test(t))return null;try{return new o(t,e)}catch(t){return null}}},8813:(t,e,s)=>{const i=s(8048);t.exports=(t,e)=>new i(t,e).patch},4778:(t,e,s)=>{const i=s(9722);t.exports=(t,e)=>{const s=i(t,e);return s&&s.prerelease.length?s.prerelease:null}},820:(t,e,s)=>{const i=s(7682);t.exports=(t,e,s)=>i(e,t,s)},8137:(t,e,s)=>{const i=s(2250);t.exports=(t,e)=>t.sort((t,s)=>i(s,t,e))},8970:(t,e,s)=>{const i=s(15);t.exports=(t,e,s)=>{try{e=new i(e,s)}catch(t){return!1}return e.test(t)}},2370:(t,e,s)=>{const i=s(2250);t.exports=(t,e)=>t.sort((t,s)=>i(t,s,e))},2815:(t,e,s)=>{const i=s(9722);t.exports=(t,e)=>{const s=i(t,e);return s?s.version:null}},8775:(t,e,s)=>{const i=s(5315);t.exports={re:i.re,src:i.src,tokens:i.t,SEMVER_SPEC_VERSION:s(8182).SEMVER_SPEC_VERSION,SemVer:s(8048),compareIdentifiers:s(2055).compareIdentifiers,rcompareIdentifiers:s(2055).rcompareIdentifiers,parse:s(9722),valid:s(2815),clean:s(6928),inc:s(5049),diff:s(2281),major:s(7249),minor:s(2518),patch:s(8813),prerelease:s(4778),compare:s(7682),rcompare:s(820),compareLoose:s(8570),compareBuild:s(2250),sort:s(2370),rsort:s(8137),gt:s(1891),lt:s(5689),eq:s(5618),neq:s(1395),gte:s(101),lte:s(8004),cmp:s(477),coerce:s(1595),Comparator:s(4636),Range:s(15),satisfies:s(8970),toComparators:s(6426),maxSatisfying:s(2965),minSatisfying:s(3042),minVersion:s(6850),validRange:s(5017),outside:s(8796),gtr:s(8576),ltr:s(6846),intersects:s(9344)}},8182:t=>{const e=Number.MAX_SAFE_INTEGER||9007199254740991;t.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:e,MAX_SAFE_COMPONENT_LENGTH:16}},6245:t=>{const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};t.exports=e},2055:t=>{const e=/^[0-9]+$/,s=(t,s)=>{const i=e.test(t),r=e.test(s);return i&&r&&(t=+t,s=+s),t===s?0:i&&!r?-1:r&&!i?1:ts(e,t)}},5315:(t,e,s)=>{const{MAX_SAFE_COMPONENT_LENGTH:i}=s(8182),r=s(6245),n=(e=t.exports={}).re=[],o=e.src=[],a=e.t={};let h=0;const l=(t,e,s)=>{const i=h++;r(i,e),a[t]=i,o[i]=e,n[i]=new RegExp(e,s?"g":void 0)};l("NUMERICIDENTIFIER","0|[1-9]\\d*"),l("NUMERICIDENTIFIERLOOSE","[0-9]+"),l("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),l("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),l("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),l("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),l("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),l("BUILDIDENTIFIER","[0-9A-Za-z-]+"),l("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),l("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),l("FULL",`^${o[a.FULLPLAIN]}$`),l("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),l("LOOSE",`^${o[a.LOOSEPLAIN]}$`),l("GTLT","((?:<|>)?=?)"),l("XRANGEIDENTIFIERLOOSE",o[a.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*"),l("XRANGEIDENTIFIER",o[a.NUMERICIDENTIFIER]+"|x|X|\\*"),l("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),l("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),l("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),l("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),l("COERCE",`(^|[^\\d])(\\d{1,${i}})(?:\\.(\\d{1,${i}}))?(?:\\.(\\d{1,${i}}))?(?:$|[^\\d])`),l("COERCERTL",o[a.COERCE],!0),l("LONETILDE","(?:~>?)"),l("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",l("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),l("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),l("LONECARET","(?:\\^)"),l("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",l("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),l("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),l("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),l("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),l("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",l("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),l("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),l("STAR","(<|>)?=?\\s*\\*")},8576:(t,e,s)=>{const i=s(8796);t.exports=(t,e,s)=>i(t,e,">",s)},9344:(t,e,s)=>{const i=s(15);t.exports=(t,e,s)=>(t=new i(t,s),e=new i(e,s),t.intersects(e))},6846:(t,e,s)=>{const i=s(8796);t.exports=(t,e,s)=>i(t,e,"<",s)},2965:(t,e,s)=>{const i=s(8048),r=s(15);t.exports=(t,e,s)=>{let n=null,o=null,a=null;try{a=new r(e,s)}catch(t){return null}return t.forEach(t=>{a.test(t)&&(n&&-1!==o.compare(t)||(n=t,o=new i(n,s)))}),n}},3042:(t,e,s)=>{const i=s(8048),r=s(15);t.exports=(t,e,s)=>{let n=null,o=null,a=null;try{a=new r(e,s)}catch(t){return null}return t.forEach(t=>{a.test(t)&&(n&&1!==o.compare(t)||(n=t,o=new i(n,s)))}),n}},6850:(t,e,s)=>{const i=s(8048),r=s(15),n=s(1891);t.exports=(t,e)=>{t=new r(t,e);let s=new i("0.0.0");if(t.test(s))return s;if(s=new i("0.0.0-0"),t.test(s))return s;s=null;for(let e=0;e{const e=new i(t.semver.version);switch(t.operator){case">":0===e.prerelease.length?e.patch++:e.prerelease.push(0),e.raw=e.format();case"":case">=":s&&!n(s,e)||(s=e);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+t.operator)}})}return s&&t.test(s)?s:null}},8796:(t,e,s)=>{const i=s(8048),r=s(4636),{ANY:n}=r,o=s(15),a=s(8970),h=s(1891),l=s(5689),c=s(8004),u=s(101);t.exports=(t,e,s,p)=>{let d,m,f,g,y;switch(t=new i(t,p),e=new o(e,p),s){case">":d=h,m=c,f=l,g=">",y=">=";break;case"<":d=l,m=u,f=h,g="<",y="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(t,e,p))return!1;for(let s=0;s{t.semver===n&&(t=new r(">=0.0.0")),o=o||t,a=a||t,d(t.semver,o.semver,p)?o=t:f(t.semver,a.semver,p)&&(a=t)}),o.operator===g||o.operator===y)return!1;if((!a.operator||a.operator===g)&&m(t,a.semver))return!1;if(a.operator===y&&f(t,a.semver))return!1}return!0}},6426:(t,e,s)=>{const i=s(15);t.exports=(t,e)=>new i(t,e).set.map(t=>t.map(t=>t.value).join(" ").trim().split(" "))},5017:(t,e,s)=>{const i=s(15);t.exports=(t,e)=>{try{return new i(t,e).range||"*"}catch(t){return null}}},7953:(t,e,s)=>{"use strict";const i=s(2087),r=s(3867),n=s(6603),{env:o}=process;let a;function h(t){return 0!==t&&{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function l(t,e){if(0===a)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!e&&void 0===a)return 0;const s=a||0;if("dumb"===o.TERM)return s;if("win32"===process.platform){const t=i.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in o)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in o)||"codeship"===o.CI_NAME?1:s;if("TEAMCITY_VERSION"in o)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0;if("GITHUB_ACTIONS"in o)return 1;if("truecolor"===o.COLORTERM)return 3;if("TERM_PROGRAM"in o){const t=parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||"COLORTERM"in o?1:s}n("no-color")||n("no-colors")||n("color=false")||n("color=never")?a=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(a=1),"FORCE_COLOR"in o&&(a="true"===o.FORCE_COLOR?1:"false"===o.FORCE_COLOR?0:0===o.FORCE_COLOR.length?1:Math.min(parseInt(o.FORCE_COLOR,10),3)),t.exports={supportsColor:function(t){return h(l(t,t&&t.isTTY))},stdout:h(l(!0,r.isatty(1))),stderr:h(l(!0,r.isatty(2)))}},5229:(t,e,s)=>{"use strict";e.c=s(4033),s(3830),e.t=s(571),s(5336),e.x=s(5244),s(7414),s(5110),s(3706),s(5908),s(4563),s(1577),s(1379),s(501)},4033:(t,e,s)=>{"use strict";const i=s(8029),r=s(7414),n=(s(5747),s(4889)),o=s(571),a=s(5622),h=(t.exports=(t,e,s)=>{if("function"==typeof e&&(s=e),Array.isArray(t)&&(e=t,t={}),!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");e=Array.from(e);const r=i(t);if(r.sync&&"function"==typeof s)throw new TypeError("callback not supported for sync tar functions");if(!r.file&&"function"==typeof s)throw new TypeError("callback only supported with file option");return r.file&&r.sync?h(r,e):r.file?l(r,e,s):r.sync?p(r,e):d(r,e)},(t,e)=>{const s=new r.Sync(t),i=new n.WriteStreamSync(t.file,{mode:t.mode||438});s.pipe(i),c(s,e)}),l=(t,e,s)=>{const i=new r(t),o=new n.WriteStream(t.file,{mode:t.mode||438});i.pipe(o);const a=new Promise((t,e)=>{o.on("error",e),o.on("close",t),i.on("error",e)});return u(i,e),s?a.then(s,s):a},c=(t,e)=>{e.forEach(e=>{"@"===e.charAt(0)?o({file:a.resolve(t.cwd,e.substr(1)),sync:!0,noResume:!0,onentry:e=>t.add(e)}):t.add(e)}),t.end()},u=(t,e)=>{for(;e.length;){const s=e.shift();if("@"===s.charAt(0))return o({file:a.resolve(t.cwd,s.substr(1)),noResume:!0,onentry:e=>t.add(e)}).then(s=>u(t,e));t.add(s)}t.end()},p=(t,e)=>{const s=new r.Sync(t);return c(s,e),s},d=(t,e)=>{const s=new r(t);return u(s,e),s}},5244:(t,e,s)=>{"use strict";const i=s(8029),r=s(5110),n=s(5747),o=s(4889),a=s(5622),h=(t.exports=(t,e,s)=>{"function"==typeof t?(s=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),"function"==typeof e&&(s=e,e=null),e=e?Array.from(e):[];const r=i(t);if(r.sync&&"function"==typeof s)throw new TypeError("callback not supported for sync tar functions");if(!r.file&&"function"==typeof s)throw new TypeError("callback only supported with file option");return e.length&&h(r,e),r.file&&r.sync?l(r):r.file?c(r,s):r.sync?u(r):p(r)},(t,e)=>{const s=new Map(e.map(t=>[t.replace(/\/+$/,""),!0])),i=t.filter,r=(t,e)=>{const i=e||a.parse(t).root||".",n=t!==i&&(s.has(t)?s.get(t):r(a.dirname(t),i));return s.set(t,n),n};t.filter=i?(t,e)=>i(t,e)&&r(t.replace(/\/+$/,"")):t=>r(t.replace(/\/+$/,""))}),l=t=>{const e=new r.Sync(t),s=t.file;const i=n.statSync(s),a=t.maxReadSize||16777216;new o.ReadStreamSync(s,{readSize:a,size:i.size}).pipe(e)},c=(t,e)=>{const s=new r(t),i=t.maxReadSize||16777216,a=t.file,h=new Promise((t,e)=>{s.on("error",e),s.on("close",t),n.stat(a,(t,r)=>{if(t)e(t);else{const t=new o.ReadStream(a,{readSize:i,size:r.size});t.on("error",e),t.pipe(s)}})});return e?h.then(e,e):h},u=t=>new r.Sync(t),p=t=>new r(t)},8191:(t,e,s)=>{const i="win32"===(process.env.__FAKE_PLATFORM__||process.platform),r=global.__FAKE_TESTING_FS__||s(5747),{O_CREAT:n,O_TRUNC:o,O_WRONLY:a,UV_FS_O_FILEMAP:h=0}=r.constants,l=i&&!!h,c=h|o|n|a;t.exports=l?t=>t<524288?c:"w":()=>"w"},1577:(t,e,s)=>{"use strict";const i=s(501),r=s(5622).posix,n=s(540),o=Symbol("slurp"),a=Symbol("type");const h=(t,e)=>{let s,i=t,n="";const o=r.parse(t).root||".";if(Buffer.byteLength(i)<100)s=[i,n,!1];else{n=r.dirname(i),i=r.basename(i);do{Buffer.byteLength(i)<=100&&Buffer.byteLength(n)<=e?s=[i,n,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(n)<=e?s=[i.substr(0,99),n,!0]:(i=r.join(r.basename(n),i),n=r.dirname(n))}while(n!==o&&!s);s||(s=[t.substr(0,99),"",!0])}return s},l=(t,e,s)=>t.slice(e,e+s).toString("utf8").replace(/\0.*/,""),c=(t,e,s)=>u(p(t,e,s)),u=t=>null===t?null:new Date(1e3*t),p=(t,e,s)=>128&t[e]?n.parse(t.slice(e,e+s)):d(t,e,s),d=(t,e,s)=>{return i=parseInt(t.slice(e,e+s).toString("utf8").replace(/\0.*$/,"").trim(),8),isNaN(i)?null:i;var i},m={12:8589934591,8:2097151},f=(t,e,s,i)=>null!==i&&(i>m[s]||i<0?(n.encode(i,t.slice(e,e+s)),!0):(g(t,e,s,i),!1)),g=(t,e,s,i)=>t.write(y(i,s),e,s,"ascii"),y=(t,e)=>w(Math.floor(t).toString(8),e),w=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",b=(t,e,s,i)=>null!==i&&f(t,e,s,i.getTime()/1e3),E=new Array(156).join("\0"),v=(t,e,s,i)=>null!==i&&(t.write(i+E,e,s,"utf8"),i.length!==Buffer.byteLength(i)||i.length>s);t.exports=class{constructor(t,e,s,i){this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[a]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(t)?this.decode(t,e||0,s,i):t&&this.set(t)}decode(t,e,s,i){if(e||(e=0),!(t&&t.length>=e+512))throw new Error("need 512 bytes for header");if(this.path=l(t,e,100),this.mode=p(t,e+100,8),this.uid=p(t,e+108,8),this.gid=p(t,e+116,8),this.size=p(t,e+124,12),this.mtime=c(t,e+136,12),this.cksum=p(t,e+148,12),this[o](s),this[o](i,!0),this[a]=l(t,e+156,1),""===this[a]&&(this[a]="0"),"0"===this[a]&&"/"===this.path.substr(-1)&&(this[a]="5"),"5"===this[a]&&(this.size=0),this.linkpath=l(t,e+157,100),"ustar\x0000"===t.slice(e+257,e+265).toString())if(this.uname=l(t,e+265,32),this.gname=l(t,e+297,32),this.devmaj=p(t,e+329,8),this.devmin=p(t,e+337,8),0!==t[e+475]){const s=l(t,e+345,155);this.path=s+"/"+this.path}else{const s=l(t,e+345,130);s&&(this.path=s+"/"+this.path),this.atime=c(t,e+476,12),this.ctime=c(t,e+488,12)}let r=256;for(let s=e;s=e+512))throw new Error("need 512 bytes for header");const s=this.ctime||this.atime?130:155,i=h(this.path||"",s),r=i[0],n=i[1];this.needPax=i[2],this.needPax=v(t,e,100,r)||this.needPax,this.needPax=f(t,e+100,8,this.mode)||this.needPax,this.needPax=f(t,e+108,8,this.uid)||this.needPax,this.needPax=f(t,e+116,8,this.gid)||this.needPax,this.needPax=f(t,e+124,12,this.size)||this.needPax,this.needPax=b(t,e+136,12,this.mtime)||this.needPax,t[e+156]=this[a].charCodeAt(0),this.needPax=v(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=v(t,e+265,32,this.uname)||this.needPax,this.needPax=v(t,e+297,32,this.gname)||this.needPax,this.needPax=f(t,e+329,8,this.devmaj)||this.needPax,this.needPax=f(t,e+337,8,this.devmin)||this.needPax,this.needPax=v(t,e+345,s,n)||this.needPax,0!==t[e+475]?this.needPax=v(t,e+345,155,n)||this.needPax:(this.needPax=v(t,e+345,130,n)||this.needPax,this.needPax=b(t,e+476,12,this.atime)||this.needPax,this.needPax=b(t,e+488,12,this.ctime)||this.needPax);let o=256;for(let s=e;s{"use strict";const e=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);t.exports=t=>t?Object.keys(t).map(s=>[e.has(s)?e.get(s):s,t[s]]).reduce((t,e)=>(t[e[0]]=e[1],t),Object.create(null)):{}},540:(t,e)=>{"use strict";e.encode=(t,e)=>{if(!Number.isSafeInteger(t))throw Error("cannot encode number outside of javascript safe integer range");return t<0?i(t,e):s(t,e),e};const s=(t,e)=>{e[0]=128;for(var s=e.length;s>1;s--)e[s-1]=255&t,t=Math.floor(t/256)},i=(t,e)=>{e[0]=255;var s=!1;t*=-1;for(var i=e.length;i>1;i--){var r=255&t;t=Math.floor(t/256),s?e[i-1]=o(r):0===r?e[i-1]=0:(s=!0,e[i-1]=a(r))}},r=(e.parse=t=>{t[t.length-1];var e,s=t[0];if(128===s)e=n(t.slice(1,t.length));else{if(255!==s)throw Error("invalid base256 encoding");e=r(t)}if(!Number.isSafeInteger(e))throw Error("parsed number outside of javascript safe integer range");return e},t=>{for(var e=t.length,s=0,i=!1,r=e-1;r>-1;r--){var n,h=t[r];i?n=o(h):0===h?n=h:(i=!0,n=a(h)),0!==n&&(s-=n*Math.pow(256,e-r-1))}return s}),n=t=>{for(var e=t.length,s=0,i=e-1;i>-1;i--){var r=t[i];0!==r&&(s+=r*Math.pow(256,e-i-1))}return s},o=t=>255&(255^t),a=t=>1+(255^t)&255},571:(t,e,s)=>{"use strict";const i=s(8029),r=s(3706),n=s(5747),o=s(4889),a=s(5622),h=(t.exports=(t,e,s)=>{"function"==typeof t?(s=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),"function"==typeof e&&(s=e,e=null),e=e?Array.from(e):[];const r=i(t);if(r.sync&&"function"==typeof s)throw new TypeError("callback not supported for sync tar functions");if(!r.file&&"function"==typeof s)throw new TypeError("callback only supported with file option");return e.length&&l(r,e),r.noResume||h(r),r.file&&r.sync?c(r):r.file?u(r,s):p(r)},t=>{const e=t.onentry;t.onentry=e?t=>{e(t),t.resume()}:t=>t.resume()}),l=(t,e)=>{const s=new Map(e.map(t=>[t.replace(/\/+$/,""),!0])),i=t.filter,r=(t,e)=>{const i=e||a.parse(t).root||".",n=t!==i&&(s.has(t)?s.get(t):r(a.dirname(t),i));return s.set(t,n),n};t.filter=i?(t,e)=>i(t,e)&&r(t.replace(/\/+$/,"")):t=>r(t.replace(/\/+$/,""))},c=t=>{const e=p(t),s=t.file;let i,r=!0;try{const o=n.statSync(s),a=t.maxReadSize||16777216;if(o.size{const s=new r(t),i=t.maxReadSize||16777216,a=t.file,h=new Promise((t,e)=>{s.on("error",e),s.on("end",t),n.stat(a,(t,r)=>{if(t)e(t);else{const t=new o.ReadStream(a,{readSize:i,size:r.size});t.on("error",e),t.pipe(s)}})});return e?h.then(e,e):h},p=t=>new r(t)},2985:(t,e,s)=>{"use strict";const i=s(1679),r=s(5747),n=s(5622),o=s(7059);class a extends Error{constructor(t,e){super("Cannot extract through symbolic link"),this.path=e,this.symlink=t}get name(){return"SylinkError"}}class h extends Error{constructor(t,e){super(e+": Cannot cd into '"+t+"'"),this.path=t,this.code=e}get name(){return"CwdError"}}t.exports=(t,e,s)=>{const a=e.umask,c=448|e.mode,u=0!=(c&a),p=e.uid,d=e.gid,m="number"==typeof p&&"number"==typeof d&&(p!==e.processUid||d!==e.processGid),f=e.preserve,g=e.unlink,y=e.cache,w=e.cwd,b=(e,i)=>{e?s(e):(y.set(t,!0),i&&m?o(i,p,d,t=>b(t)):u?r.chmod(t,c,s):s())};if(y&&!0===y.get(t))return b();if(t===w)return r.stat(t,(e,s)=>{!e&&s.isDirectory()||(e=new h(t,e&&e.code||"ENOTDIR")),b(e)});if(f)return i(t,{mode:c}).then(t=>b(null,t),b);const E=n.relative(w,t).split(/\/|\\/);l(w,E,c,y,g,w,null,b)};const l=(t,e,s,i,n,o,a,h)=>{if(!e.length)return h(null,a);const u=t+"/"+e.shift();if(i.get(u))return l(u,e,s,i,n,o,a,h);r.mkdir(u,s,c(u,e,s,i,n,o,a,h))},c=(t,e,s,i,o,u,p,d)=>m=>{if(m){if(m.path&&n.dirname(m.path)===u&&("ENOTDIR"===m.code||"ENOENT"===m.code))return d(new h(u,m.code));r.lstat(t,(n,h)=>{if(n)d(n);else if(h.isDirectory())l(t,e,s,i,o,u,p,d);else if(o)r.unlink(t,n=>{if(n)return d(n);r.mkdir(t,s,c(t,e,s,i,o,u,p,d))});else{if(h.isSymbolicLink())return d(new a(t,t+"/"+e.join("/")));d(m)}})}else l(t,e,s,i,o,u,p=p||t,d)};t.exports.sync=(t,e)=>{const s=e.umask,l=448|e.mode,c=0!=(l&s),u=e.uid,p=e.gid,d="number"==typeof u&&"number"==typeof p&&(u!==e.processUid||p!==e.processGid),m=e.preserve,f=e.unlink,g=e.cache,y=e.cwd,w=e=>{g.set(t,!0),e&&d&&o.sync(e,u,p),c&&r.chmodSync(t,l)};if(g&&!0===g.get(t))return w();if(t===y){let e=!1,s="ENOTDIR";try{e=r.statSync(t).isDirectory()}catch(t){s=t.code}finally{if(!e)throw new h(t,s)}return void w()}if(m)return w(i.sync(t,l));const b=n.relative(y,t).split(/\/|\\/);let E=null;for(let t=b.shift(),e=y;t&&(e+="/"+t);t=b.shift())if(!g.get(e))try{r.mkdirSync(e,l),E=E||e,g.set(e,!0)}catch(t){if(t.path&&n.dirname(t.path)===y&&("ENOTDIR"===t.code||"ENOENT"===t.code))return new h(y,t.code);const s=r.lstatSync(e);if(s.isDirectory()){g.set(e,!0);continue}if(f){r.unlinkSync(e),r.mkdirSync(e,l),E=E||e,g.set(e,!0);continue}if(s.isSymbolicLink())return new a(e,e+"/"+b.join("/"))}return w(E)}},8073:t=>{"use strict";t.exports=(t,e,s)=>(t&=4095,s&&(t=-19&(384|t)),e&&(256&t&&(t|=64),32&t&&(t|=8),4&t&&(t|=1)),t)},7414:(t,e,s)=>{"use strict";class i{constructor(t,e){this.path=t||"./",this.absolute=e,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}const r=s(4309),n=s(8855),o=s(5908),a=s(4563),h=a.Sync,l=a.Tar,c=s(7638),u=Buffer.alloc(1024),p=Symbol("onStat"),d=Symbol("ended"),m=Symbol("queue"),f=Symbol("current"),g=Symbol("process"),y=Symbol("processing"),w=Symbol("processJob"),b=Symbol("jobs"),E=Symbol("jobDone"),v=Symbol("addFSEntry"),O=Symbol("addTarEntry"),x=Symbol("stat"),R=Symbol("readdir"),S=Symbol("onreaddir"),C=Symbol("pipe"),_=Symbol("entry"),I=Symbol("entryOpt"),k=Symbol("writeEntryClass"),T=Symbol("write"),N=Symbol("ondrain"),A=s(5747),L=s(5622),$=s(2020)(class extends r{constructor(t){super(t),t=t||Object.create(null),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=(t.prefix||"").replace(/(\\|\/)+$/,""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this[k]=a,"function"==typeof t.onwarn&&this.on("warn",t.onwarn),this.portable=!!t.portable,this.zip=null,t.gzip?("object"!=typeof t.gzip&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new n.Gzip(t.gzip),this.zip.on("data",t=>super.write(t)),this.zip.on("end",t=>super.end()),this.zip.on("drain",t=>this[N]()),this.on("resume",t=>this.zip.resume())):this.on("drain",this[N]),this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,this.mtime=t.mtime||null,this.filter="function"==typeof t.filter?t.filter:t=>!0,this[m]=new c,this[b]=0,this.jobs=+t.jobs||4,this[y]=!1,this[d]=!1}[T](t){return super.write(t)}add(t){return this.write(t),this}end(t){return t&&this.write(t),this[d]=!0,this[g](),this}write(t){if(this[d])throw new Error("write after end");return t instanceof o?this[O](t):this[v](t),this.flowing}[O](t){const e=L.resolve(this.cwd,t.path);if(this.prefix&&(t.path=this.prefix+"/"+t.path.replace(/^\.(\/+|$)/,"")),this.filter(t.path,t)){const s=new i(t.path,e,!1);s.entry=new l(t,this[I](s)),s.entry.on("end",t=>this[E](s)),this[b]+=1,this[m].push(s)}else t.resume();this[g]()}[v](t){const e=L.resolve(this.cwd,t);this.prefix&&(t=this.prefix+"/"+t.replace(/^\.(\/+|$)/,"")),this[m].push(new i(t,e)),this[g]()}[x](t){t.pending=!0,this[b]+=1;const e=this.follow?"stat":"lstat";A[e](t.absolute,(e,s)=>{t.pending=!1,this[b]-=1,e?this.emit("error",e):this[p](t,s)})}[p](t,e){this.statCache.set(t.absolute,e),t.stat=e,this.filter(t.path,e)||(t.ignore=!0),this[g]()}[R](t){t.pending=!0,this[b]+=1,A.readdir(t.absolute,(e,s)=>{if(t.pending=!1,this[b]-=1,e)return this.emit("error",e);this[S](t,s)})}[S](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[g]()}[g](){if(!this[y]){this[y]=!0;for(let t=this[m].head;null!==t&&this[b]this.warn(t,e,s),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime}}[_](t){this[b]+=1;try{return new this[k](t.path,this[I](t)).on("end",()=>this[E](t)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[N](){this[f]&&this[f].entry&&this[f].entry.resume()}[C](t){t.piped=!0,t.readdir&&t.readdir.forEach(e=>{const s=this.prefix?t.path.slice(this.prefix.length+1)||"./":t.path,i="./"===s?"":s.replace(/\/*$/,"/");this[v](i+e)});const e=t.entry,s=this.zip;s?e.on("data",t=>{s.write(t)||e.pause()}):e.on("data",t=>{super.write(t)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}});$.Sync=class extends ${constructor(t){super(t),this[k]=h}pause(){}resume(){}[x](t){const e=this.follow?"statSync":"lstatSync";this[p](t,A[e](t.absolute))}[R](t,e){this[S](t,A.readdirSync(t.absolute))}[C](t){const e=t.entry,s=this.zip;t.readdir&&t.readdir.forEach(e=>{const s=this.prefix?t.path.slice(this.prefix.length+1)||"./":t.path,i="./"===s?"":s.replace(/\/*$/,"/");this[v](i+e)}),s?e.on("data",t=>{s.write(t)}):e.on("data",t=>{super[T](t)})}},t.exports=$},3706:(t,e,s)=>{"use strict";const i=s(2020),r=(s(5622),s(1577)),n=s(8614),o=s(7638),a=s(5908),h=s(1379),l=s(8855),c=Buffer.from([31,139]),u=Symbol("state"),p=Symbol("writeEntry"),d=Symbol("readEntry"),m=Symbol("nextEntry"),f=Symbol("processEntry"),g=Symbol("extendedHeader"),y=Symbol("globalExtendedHeader"),w=Symbol("meta"),b=Symbol("emitMeta"),E=Symbol("buffer"),v=Symbol("queue"),O=Symbol("ended"),x=Symbol("emittedEnd"),R=Symbol("emit"),S=Symbol("unzip"),C=Symbol("consumeChunk"),_=Symbol("consumeChunkSub"),I=Symbol("consumeBody"),k=Symbol("consumeMeta"),T=Symbol("consumeHeader"),N=Symbol("consuming"),A=Symbol("bufferConcat"),L=Symbol("maybeEnd"),$=Symbol("writing"),P=Symbol("aborted"),D=Symbol("onDone"),M=Symbol("sawValidEntry"),F=Symbol("sawNullBlock"),j=Symbol("sawEOF"),B=t=>!0;t.exports=i(class extends n{constructor(t){super(t=t||{}),this.file=t.file||"",this[M]=null,this.on(D,t=>{"begin"!==this[u]&&!1!==this[M]||this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(D,t.ondone):this.on(D,t=>{this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close")}),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||1048576,this.filter="function"==typeof t.filter?t.filter:B,this.writable=!0,this.readable=!1,this[v]=new o,this[E]=null,this[d]=null,this[p]=null,this[u]="begin",this[w]="",this[g]=null,this[y]=null,this[O]=!1,this[S]=null,this[P]=!1,this[F]=!1,this[j]=!1,"function"==typeof t.onwarn&&this.on("warn",t.onwarn),"function"==typeof t.onentry&&this.on("entry",t.onentry)}[T](t,e){let s;null===this[M]&&(this[M]=!1);try{s=new r(t,e,this[g],this[y])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(s.nullBlock)this[F]?(this[j]=!0,"begin"===this[u]&&(this[u]="header"),this[R]("eof")):(this[F]=!0,this[R]("nullBlock"));else if(this[F]=!1,s.cksumValid)if(s.path){const t=s.type;if(/^(Symbolic)?Link$/.test(t)&&!s.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:s});else if(!/^(Symbolic)?Link$/.test(t)&&s.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:s});else{const t=this[p]=new a(s,this[g],this[y]);if(!this[M])if(t.remain){const e=()=>{t.invalid||(this[M]=!0)};t.on("end",e)}else this[M]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[R]("ignoredEntry",t),this[u]="ignore",t.resume()):t.size>0&&(this[w]="",t.on("data",t=>this[w]+=t),this[u]="meta"):(this[g]=null,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[R]("ignoredEntry",t),this[u]=t.remain?"ignore":"header",t.resume()):(t.remain?this[u]="body":(this[u]="header",t.end()),this[d]?this[v].push(t):(this[v].push(t),this[m]())))}}else this.warn("TAR_ENTRY_INVALID","path is required",{header:s});else this.warn("TAR_ENTRY_INVALID","checksum failure",{header:s})}[f](t){let e=!0;return t?Array.isArray(t)?this.emit.apply(this,t):(this[d]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",t=>this[m]()),e=!1)):(this[d]=null,e=!1),e}[m](){do{}while(this[f](this[v].shift()));if(!this[v].length){const t=this[d];!t||t.flowing||t.size===t.remain?this[$]||this.emit("drain"):t.once("drain",t=>this.emit("drain"))}}[I](t,e){const s=this[p],i=s.blockRemain,r=i>=t.length&&0===e?t:t.slice(e,e+i);return s.write(r),s.blockRemain||(this[u]="header",this[p]=null,s.end()),r.length}[k](t,e){const s=this[p],i=this[I](t,e);return this[p]||this[b](s),i}[R](t,e,s){this[v].length||this[d]?this[v].push([t,e,s]):this.emit(t,e,s)}[b](t){switch(this[R]("meta",this[w]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[g]=h.parse(this[w],this[g],!1);break;case"GlobalExtendedHeader":this[y]=h.parse(this[w],this[y],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[g]=this[g]||Object.create(null),this[g].path=this[w].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[g]=this[g]||Object.create(null),this[g].linkpath=this[w].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+t.type)}}abort(t){this[P]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t){if(this[P])return;if(null===this[S]&&t){if(this[E]&&(t=Buffer.concat([this[E],t]),this[E]=null),t.lengththis[C](t)),this[S].on("error",t=>this.abort(t)),this[S].on("end",t=>{this[O]=!0,this[C]()}),this[$]=!0;const s=this[S][e?"end":"write"](t);return this[$]=!1,s}}this[$]=!0,this[S]?this[S].write(t):this[C](t),this[$]=!1;const e=!this[v].length&&(!this[d]||this[d].flowing);return e||this[v].length||this[d].once("drain",t=>this.emit("drain")),e}[A](t){t&&!this[P]&&(this[E]=this[E]?Buffer.concat([this[E],t]):t)}[L](){if(this[O]&&!this[x]&&!this[P]&&!this[N]){this[x]=!0;const t=this[p];if(t&&t.blockRemain){const e=this[E]?this[E].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[E]&&t.write(this[E]),t.end()}this[R](D)}}[C](t){if(this[N])this[A](t);else if(t||this[E]){if(this[N]=!0,this[E]){this[A](t);const e=this[E];this[E]=null,this[_](e)}else this[_](t);for(;this[E]&&this[E].length>=512&&!this[P]&&!this[j];){const t=this[E];this[E]=null,this[_](t)}this[N]=!1}else this[L]();this[E]&&!this[O]||this[L]()}[_](t){let e=0,s=t.length;for(;e+512<=s&&!this[P]&&!this[j];)switch(this[u]){case"begin":case"header":this[T](t,e),e+=512;break;case"ignore":case"body":e+=this[I](t,e);break;case"meta":e+=this[k](t,e);break;default:throw new Error("invalid state: "+this[u])}e{const i=s(2357);t.exports=()=>{const t=new Map,e=new Map,{join:r}=s(5622),n=new Set,o=s=>{const{paths:i,dirs:r}=(s=>{const i=e.get(s);if(!i)throw new Error("function does not have any path reservations");return{paths:i.paths.map(e=>t.get(e)),dirs:[...i.dirs].map(e=>t.get(e))}})(s);return i.every(t=>t[0]===s)&&r.every(t=>t[0]instanceof Set&&t[0].has(s))},a=t=>!(n.has(t)||!o(t))&&(n.add(t),t(()=>h(t)),!0),h=s=>{if(!n.has(s))return!1;const{paths:r,dirs:o}=e.get(s),h=new Set;return r.forEach(e=>{const r=t.get(e);i.equal(r[0],s),1===r.length?t.delete(e):(r.shift(),"function"==typeof r[0]?h.add(r[0]):r[0].forEach(t=>h.add(t)))}),o.forEach(e=>{const r=t.get(e);i(r[0]instanceof Set),1===r[0].size&&1===r.length?t.delete(e):1===r[0].size?(r.shift(),h.add(r[0])):r[0].delete(s)}),n.delete(s),h.forEach(t=>a(t)),!0};return{check:o,reserve:(s,i)=>{const n=new Set(s.map(t=>(t=>r(t).split(/[\\\/]/).slice(0,-1).reduce((t,e)=>t.length?t.concat(r(t[t.length-1],e)):[e],[]))(t)).reduce((t,e)=>t.concat(e)));return e.set(i,{dirs:n,paths:s}),s.forEach(e=>{const s=t.get(e);s?s.push(i):t.set(e,[i])}),n.forEach(e=>{const s=t.get(e);s?s[s.length-1]instanceof Set?s[s.length-1].add(i):s.push(new Set([i])):t.set(e,[new Set([i])])}),a(i)}}}},1379:(t,e,s)=>{"use strict";const i=s(1577),r=s(5622);class n{constructor(t,e){this.atime=t.atime||null,this.charset=t.charset||null,this.comment=t.comment||null,this.ctime=t.ctime||null,this.gid=t.gid||null,this.gname=t.gname||null,this.linkpath=t.linkpath||null,this.mtime=t.mtime||null,this.path=t.path||null,this.size=t.size||null,this.uid=t.uid||null,this.uname=t.uname||null,this.dev=t.dev||null,this.ino=t.ino||null,this.nlink=t.nlink||null,this.global=e||!1}encode(){const t=this.encodeBody();if(""===t)return null;const e=Buffer.byteLength(t),s=512*Math.ceil(1+e/512),n=Buffer.allocUnsafe(s);for(let t=0;t<512;t++)n[t]=0;new i({path:("PaxHeader/"+r.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:e,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(n),n.write(t,512,e,"utf8");for(let t=e+512;t=Math.pow(10,i)&&(i+=1);return i+s+e}}n.parse=(t,e,s)=>new n(o(a(t),e),s);const o=(t,e)=>e?Object.keys(t).reduce((e,s)=>(e[s]=t[s],e),e):t,a=t=>t.replace(/\n$/,"").split("\n").reduce(h,Object.create(null)),h=(t,e)=>{const s=parseInt(e,10);if(s!==Buffer.byteLength(e)+1)return t;const i=(e=e.substr((s+" ").length)).split("="),r=i.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!r)return t;const n=i.join("=");return t[r]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(r)?new Date(1e3*n):/^[0-9]+$/.test(n)?+n:n,t};t.exports=n},5908:(t,e,s)=>{"use strict";s(501);const i=s(4309),r=Symbol("slurp");t.exports=class extends i{constructor(t,e,s){switch(super(),this.pause(),this.extended=e,this.globalExtended=s,this.header=t,this.startBlockSize=512*Math.ceil(t.size/512),this.blockRemain=this.startBlockSize,this.remain=t.size,this.type=t.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}this.path=t.path,this.mode=t.mode,this.mode&&(this.mode=4095&this.mode),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=t.size,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath,this.uname=t.uname,this.gname=t.gname,e&&this[r](e),s&&this[r](s,!0)}write(t){const e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");const s=this.remain,i=this.blockRemain;return this.remain=Math.max(0,s-e),this.blockRemain=Math.max(0,i-e),!!this.ignore||(s>=e?super.write(t):super.write(t.slice(0,s)))}[r](t,e){for(let s in t)null===t[s]||void 0===t[s]||e&&"path"===s||(this[s]=t[s])}}},3830:(t,e,s)=>{"use strict";const i=s(8029),r=s(7414),n=(s(3706),s(5747)),o=s(4889),a=s(571),h=s(5622),l=s(1577),c=(t.exports=(t,e,s)=>{const r=i(t);if(!r.file)throw new TypeError("file is required");if(r.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),r.sync?c(r,e):p(r,e,s)},(t,e)=>{const s=new r.Sync(t);let i,o,a=!0;try{try{i=n.openSync(t.file,"r+")}catch(e){if("ENOENT"!==e.code)throw e;i=n.openSync(t.file,"w+")}const r=n.fstatSync(i),h=Buffer.alloc(512);t:for(o=0;or.size)break;o+=s,t.mtimeCache&&t.mtimeCache.set(e.path,e.mtime)}a=!1,u(t,s,o,i,e)}finally{if(a)try{n.closeSync(i)}catch(t){}}}),u=(t,e,s,i,r)=>{const n=new o.WriteStreamSync(t.file,{fd:i,start:s});e.pipe(n),d(e,r)},p=(t,e,s)=>{e=Array.from(e);const i=new r(t),a=new Promise((s,r)=>{i.on("error",r);let a="r+";const h=(c,u)=>c&&"ENOENT"===c.code&&"r+"===a?(a="w+",n.open(t.file,a,h)):c?r(c):void n.fstat(u,(a,h)=>{if(a)return r(a);((e,s,i)=>{const r=(t,s)=>{t?n.close(e,e=>i(t)):i(null,s)};let o=0;if(0===s)return r(null,0);let a=0;const h=Buffer.alloc(512),c=(i,u)=>{if(i)return r(i);if(a+=u,a<512&&u)return n.read(e,h,a,h.length-a,o+a,c);if(0===o&&31===h[0]&&139===h[1])return r(new Error("cannot append to compressed archives"));if(a<512)return r(null,o);const p=new l(h);if(!p.cksumValid)return r(null,o);const d=512*Math.ceil(p.size/512);return o+d+512>s?r(null,o):(o+=d+512,o>=s?r(null,o):(t.mtimeCache&&t.mtimeCache.set(p.path,p.mtime),a=0,void n.read(e,h,0,512,o,c)))};n.read(e,h,0,512,o,c)})(u,h.size,(n,a)=>{if(n)return r(n);const h=new o.WriteStream(t.file,{fd:u,start:a});i.pipe(h),h.on("error",r),h.on("close",s),m(i,e)})});n.open(t.file,a,h)});return s?a.then(s,s):a},d=(t,e)=>{e.forEach(e=>{"@"===e.charAt(0)?a({file:h.resolve(t.cwd,e.substr(1)),sync:!0,noResume:!0,onentry:e=>t.add(e)}):t.add(e)}),t.end()},m=(t,e)=>{for(;e.length;){const s=e.shift();if("@"===s.charAt(0))return a({file:h.resolve(t.cwd,s.substr(1)),noResume:!0,onentry:e=>t.add(e)}).then(s=>m(t,e));t.add(s)}t.end()}},501:(t,e)=>{"use strict";e.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),e.code=new Map(Array.from(e.name).map(t=>[t[1],t[0]]))},5110:(t,e,s)=>{"use strict";const i=s(2357),r=(s(8614).EventEmitter,s(3706)),n=s(5747),o=s(4889),a=s(5622),h=s(2985),l=(h.sync,s(5317)),c=s(516),u=Symbol("onEntry"),p=Symbol("checkFs"),d=Symbol("checkFs2"),m=Symbol("isReusable"),f=Symbol("makeFs"),g=Symbol("file"),y=Symbol("directory"),w=Symbol("link"),b=Symbol("symlink"),E=Symbol("hardlink"),v=Symbol("unsupported"),O=(Symbol("unknown"),Symbol("checkPath")),x=Symbol("mkdir"),R=Symbol("onError"),S=Symbol("pending"),C=Symbol("pend"),_=Symbol("unpend"),I=Symbol("ended"),k=Symbol("maybeClose"),T=Symbol("skip"),N=Symbol("doChown"),A=Symbol("uid"),L=Symbol("gid"),$=s(6417),P=s(8191),D=()=>{throw new Error("sync function called cb somehow?!?")},M=(t,e,s)=>t===t>>>0?t:e===e>>>0?e:s;class F extends r{constructor(t){if(t||(t={}),t.ondone=t=>{this[I]=!0,this[k]()},super(t),this.reservations=c(),this.transform="function"==typeof t.transform?t.transform:null,this.writable=!0,this.readable=!1,this[S]=0,this[I]=!1,this.dirCache=t.dirCache||new Map,"number"==typeof t.uid||"number"==typeof t.gid){if("number"!=typeof t.uid||"number"!=typeof t.gid)throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;void 0===t.preserveOwner&&"number"!=typeof t.uid?this.preserveOwner=process.getuid&&0===process.getuid():this.preserveOwner=!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.forceChown=!0===t.forceChown,this.win32=!!t.win32||"win32"===process.platform,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=a.resolve(t.cwd||process.cwd()),this.strip=+t.strip||0,this.processUmask=process.umask(),this.umask="number"==typeof t.umask?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",t=>this[u](t))}warn(t,e,s={}){return"TAR_BAD_ARCHIVE"!==t&&"TAR_ABORT"!==t||(s.recoverable=!1),super.warn(t,e,s)}[k](){this[I]&&0===this[S]&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close"))}[O](t){if(this.strip){const e=t.path.split(/\/|\\/);if(e.length=this.strip&&(t.linkpath=e.slice(this.strip).join("/"))}}if(!this.preservePaths){const e=t.path;if(e.match(/(^|\/|\\)\.\.(\\|\/|$)/))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:t,path:e}),!1;if(a.win32.isAbsolute(e)){const s=a.win32.parse(e);t.path=e.substr(s.root.length);const i=s.root;this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:t,path:e})}}if(this.win32){const e=a.win32.parse(t.path);t.path=""===e.root?l.encode(t.path):e.root+l.encode(t.path.substr(e.root.length))}return a.isAbsolute(t.path)?t.absolute=t.path:t.absolute=a.resolve(this.cwd,t.path),!0}[u](t){if(!this[O](t))return t.resume();switch(i.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=448|t.mode);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[p](t);case"CharacterDevice":case"BlockDevice":case"FIFO":return this[v](t)}}[R](t,e){"CwdError"===t.name?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[_](),e.resume())}[x](t,e,s){h(t,{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e},s)}[N](t){return this.forceChown||this.preserveOwner&&("number"==typeof t.uid&&t.uid!==this.processUid||"number"==typeof t.gid&&t.gid!==this.processGid)||"number"==typeof this.uid&&this.uid!==this.processUid||"number"==typeof this.gid&&this.gid!==this.processGid}[A](t){return M(this.uid,t.uid,this.processUid)}[L](t){return M(this.gid,t.gid,this.processGid)}[g](t,e){const s=4095&t.mode||this.fmode,i=new o.WriteStream(t.absolute,{flags:P(t.size),mode:s,autoClose:!1});i.on("error",e=>this[R](e,t));let r=1;const a=s=>{if(s)return this[R](s,t);0==--r&&n.close(i.fd,s=>{e(),s?this[R](s,t):this[_]()})};i.on("finish",e=>{const s=t.absolute,o=i.fd;if(t.mtime&&!this.noMtime){r++;const e=t.atime||new Date,i=t.mtime;n.futimes(o,e,i,t=>t?n.utimes(s,e,i,e=>a(e&&t)):a())}if(this[N](t)){r++;const e=this[A](t),i=this[L](t);n.fchown(o,e,i,t=>t?n.chown(s,e,i,e=>a(e&&t)):a())}a()});const h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",e=>this[R](e,t)),t.pipe(h)),h.pipe(i)}[y](t,e){const s=4095&t.mode||this.dmode;this[x](t.absolute,s,s=>{if(s)return e(),this[R](s,t);let i=1;const r=s=>{0==--i&&(e(),this[_](),t.resume())};t.mtime&&!this.noMtime&&(i++,n.utimes(t.absolute,t.atime||new Date,t.mtime,r)),this[N](t)&&(i++,n.chown(t.absolute,this[A](t),this[L](t),r)),r()})}[v](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED","unsupported entry type: "+t.type,{entry:t}),t.resume()}[b](t,e){this[w](t,t.linkpath,"symlink",e)}[E](t,e){this[w](t,a.resolve(this.cwd,t.linkpath),"link",e)}[C](){this[S]++}[_](){this[S]--,this[k]()}[T](t){this[_](),t.resume()}[m](t,e){return"File"===t.type&&!this.unlink&&e.isFile()&&e.nlink<=1&&"win32"!==process.platform}[p](t){this[C]();const e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,e=>this[d](t,e))}[d](t,e){this[x](a.dirname(t.absolute),this.dmode,s=>{if(s)return e(),this[R](s,t);n.lstat(t.absolute,(s,i)=>{i&&(this.keep||this.newer&&i.mtime>t.mtime)?(this[T](t),e()):s||this[m](t,i)?this[f](null,t,e):i.isDirectory()?"Directory"===t.type?t.mode&&(4095&i.mode)!==t.mode?n.chmod(t.absolute,t.mode,s=>this[f](s,t,e)):this[f](null,t,e):n.rmdir(t.absolute,s=>this[f](s,t,e)):((t,e)=>{if("win32"!==process.platform)return n.unlink(t,e);const s=t+".DELETE."+$.randomBytes(16).toString("hex");n.rename(t,s,t=>{if(t)return e(t);n.unlink(s,e)})})(t.absolute,s=>this[f](s,t,e))})})}[f](t,e,s){if(t)return this[R](t,e);switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[g](e,s);case"Link":return this[E](e,s);case"SymbolicLink":return this[b](e,s);case"Directory":case"GNUDumpDir":return this[y](e,s)}}[w](t,e,s,i){n[s](e,t.absolute,e=>{if(e)return this[R](e,t);i(),this[_](),t.resume()})}}F.Sync=class extends F{constructor(t){super(t)}[p](t){const e=this[x](a.dirname(t.absolute),this.dmode,D);if(e)return this[R](e,t);try{const s=n.lstatSync(t.absolute);if(this.keep||this.newer&&s.mtime>t.mtime)return this[T](t);if(this[m](t,s))return this[f](null,t,D);try{return s.isDirectory()?"Directory"===t.type?t.mode&&(4095&s.mode)!==t.mode&&n.chmodSync(t.absolute,t.mode):n.rmdirSync(t.absolute):(t=>{if("win32"!==process.platform)return n.unlinkSync(t);const e=t+".DELETE."+$.randomBytes(16).toString("hex");n.renameSync(t,e),n.unlinkSync(e)})(t.absolute),this[f](null,t,D)}catch(e){return this[R](e,t)}}catch(e){return this[f](null,t,D)}}[g](t,e){const s=4095&t.mode||this.fmode,i=e=>{let s;try{n.closeSync(r)}catch(t){s=t}(e||s)&&this[R](e||s,t)};let r;try{r=n.openSync(t.absolute,P(t.size),s)}catch(t){return i(t)}const o=this.transform&&this.transform(t)||t;o!==t&&(o.on("error",e=>this[R](e,t)),t.pipe(o)),o.on("data",t=>{try{n.writeSync(r,t,0,t.length)}catch(t){i(t)}}),o.on("end",e=>{let s=null;if(t.mtime&&!this.noMtime){const e=t.atime||new Date,i=t.mtime;try{n.futimesSync(r,e,i)}catch(r){try{n.utimesSync(t.absolute,e,i)}catch(t){s=r}}}if(this[N](t)){const e=this[A](t),i=this[L](t);try{n.fchownSync(r,e,i)}catch(r){try{n.chownSync(t.absolute,e,i)}catch(t){s=s||r}}}i(s)})}[y](t,e){const s=4095&t.mode||this.dmode,i=this[x](t.absolute,s);if(i)return this[R](i,t);if(t.mtime&&!this.noMtime)try{n.utimesSync(t.absolute,t.atime||new Date,t.mtime)}catch(i){}if(this[N](t))try{n.chownSync(t.absolute,this[A](t),this[L](t))}catch(i){}t.resume()}[x](t,e){try{return h.sync(t,{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e})}catch(t){return t}}[w](t,e,s,i){try{n[s+"Sync"](e,t.absolute),t.resume()}catch(e){return this[R](e,t)}}},t.exports=F},5336:(t,e,s)=>{"use strict";const i=s(8029),r=s(3830),n=(t.exports=(t,e,s)=>{const o=i(t);if(!o.file)throw new TypeError("file is required");if(o.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),n(o),r(o,e,s)},t=>{const e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(s,i)=>e(s,i)&&!(t.mtimeCache.get(s)>i.mtime):(e,s)=>!(t.mtimeCache.get(e)>s.mtime)})},2020:t=>{"use strict";t.exports=t=>class extends t{warn(t,e,s={}){this.file&&(s.file=this.file),this.cwd&&(s.cwd=this.cwd),s.code=e instanceof Error&&e.code||t,s.tarCode=t,this.strict||!1===s.recoverable?e instanceof Error?this.emit("error",Object.assign(e,s)):this.emit("error",Object.assign(new Error(`${t}: ${e}`),s)):(e instanceof Error&&(s=Object.assign(e,s),e=e.message),this.emit("warn",s.tarCode,e,s))}}},5317:t=>{"use strict";const e=["|","<",">","?",":"],s=e.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),i=new Map(e.map((t,e)=>[t,s[e]])),r=new Map(s.map((t,s)=>[t,e[s]]));t.exports={encode:t=>e.reduce((t,e)=>t.split(e).join(i.get(e)),t),decode:t=>s.reduce((t,e)=>t.split(e).join(r.get(e)),t)}},4563:(t,e,s)=>{"use strict";const i=s(4309),r=s(1379),n=s(1577),o=(s(5908),s(5747)),a=s(5622),h=(s(501),Symbol("process")),l=Symbol("file"),c=Symbol("directory"),u=Symbol("symlink"),p=Symbol("hardlink"),d=Symbol("header"),m=Symbol("read"),f=Symbol("lstat"),g=Symbol("onlstat"),y=Symbol("onread"),w=Symbol("onreadlink"),b=Symbol("openfile"),E=Symbol("onopenfile"),v=Symbol("close"),O=Symbol("mode"),x=s(2020),R=s(5317),S=s(8073),C=x(class extends i{constructor(t,e){if(super(e=e||{}),"string"!=typeof t)throw new TypeError("path is required");this.path=t,this.portable=!!e.portable,this.myuid=process.getuid&&process.getuid(),this.myuser=process.env.USER||"",this.maxReadSize=e.maxReadSize||16777216,this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.preservePaths=!!e.preservePaths,this.cwd=e.cwd||process.cwd(),this.strict=!!e.strict,this.noPax=!!e.noPax,this.noMtime=!!e.noMtime,this.mtime=e.mtime||null,"function"==typeof e.onwarn&&this.on("warn",e.onwarn);let s=!1;if(!this.preservePaths&&a.win32.isAbsolute(t)){const e=a.win32.parse(t);this.path=t.substr(e.root.length),s=e.root}this.win32=!!e.win32||"win32"===process.platform,this.win32&&(this.path=R.decode(this.path.replace(/\\/g,"/")),t=t.replace(/\\/g,"/")),this.absolute=e.absolute||a.resolve(this.cwd,t),""===this.path&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path}),this.statCache.has(this.absolute)?this[g](this.statCache.get(this.absolute)):this[f]()}[f](){o.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[g](e)})}[g](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=I(t),this.emit("stat",t),this[h]()}[h](){switch(this.type){case"File":return this[l]();case"Directory":return this[c]();case"SymbolicLink":return this[u]();default:return this.end()}}[O](t){return S(t,"Directory"===this.type,this.portable)}[d](){"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.header=new n({path:this.path,linkpath:this.linkpath,mode:this[O](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&this.write(new r({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this.path,linkpath:this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),this.write(this.header.block)}[c](){"/"!==this.path.substr(-1)&&(this.path+="/"),this.stat.size=0,this[d](),this.end()}[u](){o.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[w](e)})}[w](t){this.linkpath=t.replace(/\\/g,"/"),this[d](),this.end()}[p](t){this.type="Link",this.linkpath=a.relative(this.cwd,t).replace(/\\/g,"/"),this.stat.size=0,this[d](),this.end()}[l](){if(this.stat.nlink>1){const t=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(t)){const e=this.linkCache.get(t);if(0===e.indexOf(this.cwd))return this[p](e)}this.linkCache.set(t,this.absolute)}if(this[d](),0===this.stat.size)return this.end();this[b]()}[b](){o.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[E](e)})}[E](t){const e=512*Math.ceil(this.stat.size/512),s=Math.min(e,this.maxReadSize),i=Buffer.allocUnsafe(s);this[m](t,i,0,i.length,0,this.stat.size,e)}[m](t,e,s,i,r,n,a){o.read(t,e,s,i,r,(o,h)=>{if(o)return this[v](t,()=>this.emit("error",o));this[y](t,e,s,i,r,n,a,h)})}[v](t,e){o.close(t,e)}[y](t,e,s,i,r,n,o,a){if(a<=0&&n>0){const e=new Error("encountered unexpected EOF");return e.path=this.absolute,e.syscall="read",e.code="EOF",this[v](t,()=>this.emit("error",e))}if(a>n){const e=new Error("did not encounter expected EOF");return e.path=this.absolute,e.syscall="read",e.code="EOF",this[v](t,()=>this.emit("error",e))}if(a===n)for(let t=a;tt?this.emit("error",t):this.end());s>=i&&(e=Buffer.allocUnsafe(i),s=0),i=e.length-s,this[m](t,e,s,i,r,n,o)}});const _=x(class extends i{constructor(t,e){super(e=e||{}),this.preservePaths=!!e.preservePaths,this.portable=!!e.portable,this.strict=!!e.strict,this.noPax=!!e.noPax,this.noMtime=!!e.noMtime,this.readEntry=t,this.type=t.type,"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.path=t.path,this.mode=this[O](t.mode),this.uid=this.portable?null:t.uid,this.gid=this.portable?null:t.gid,this.uname=this.portable?null:t.uname,this.gname=this.portable?null:t.gname,this.size=t.size,this.mtime=this.noMtime?null:e.mtime||t.mtime,this.atime=this.portable?null:t.atime,this.ctime=this.portable?null:t.ctime,this.linkpath=t.linkpath,"function"==typeof e.onwarn&&this.on("warn",e.onwarn);let s=!1;if(a.isAbsolute(this.path)&&!this.preservePaths){const t=a.parse(this.path);s=t.root,this.path=this.path.substr(t.root.length)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.header=new n({path:this.path,linkpath:this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path}),this.header.encode()&&!this.noPax&&super.write(new r({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this.path,linkpath:this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),t.pipe(this)}[O](t){return S(t,"Directory"===this.type,this.portable)}write(t){const e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=e,super.write(t)}end(){return this.blockRemain&&this.write(Buffer.alloc(this.blockRemain)),super.end()}});C.Sync=class extends C{constructor(t,e){super(t,e)}[f](){this[g](o.lstatSync(this.absolute))}[u](){this[w](o.readlinkSync(this.absolute))}[b](){this[E](o.openSync(this.absolute,"r"))}[m](t,e,s,i,r,n,a){let h=!0;try{const l=o.readSync(t,e,s,i,r);this[y](t,e,s,i,r,n,a,l),h=!1}finally{if(h)try{this[v](t,()=>{})}catch(t){}}}[v](t,e){o.closeSync(t),e()}},C.Tar=_;const I=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";t.exports=C},4878:t=>{"use strict";t.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},7638:(t,e,s)=>{"use strict";function i(t){var e=this;if(e instanceof i||(e=new i),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var s=0,r=arguments.length;s1)s=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,s=this.head.value}for(var r=0;null!==i;r++)s=t(s,i.value,r),i=i.next;return s},i.prototype.reduceReverse=function(t,e){var s,i=this.tail;if(arguments.length>1)s=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,s=this.tail.value}for(var r=this.length-1;null!==i;r--)s=t(s,i.value,r),i=i.prev;return s},i.prototype.toArray=function(){for(var t=new Array(this.length),e=0,s=this.head;null!==s;e++)t[e]=s.value,s=s.next;return t},i.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,s=this.tail;null!==s;e++)t[e]=s.value,s=s.prev;return t},i.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var s=new i;if(ethis.length&&(e=this.length);for(var r=0,n=this.head;null!==n&&rthis.length&&(e=this.length);for(var r=this.length,n=this.tail;null!==n&&r>e;r--)n=n.prev;for(;null!==n&&r>t;r--,n=n.prev)s.push(n.value);return s},i.prototype.splice=function(t,e,...s){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var i=0,n=this.head;null!==n&&i{"use strict";t.exports=JSON.parse('{"definitions":{"npm":{"default":"6.14.7","ranges":{"*":{"url":"https://registry.npmjs.org/npm/-/npm-{}.tgz","bin":{"npm":"./bin/npm-cli.js","npx":"./bin/npx-cli.js"},"tags":{"type":"npm","package":"npm"}}}},"pnpm":{"default":"5.4.11","ranges":{"*":{"url":"https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz","bin":{"pnpm":"./bin/pnpm.js","pnpx":"./bin/pnpx.js"},"tags":{"type":"npm","package":"pnpm"}}}},"yarn":{"default":"1.22.4","ranges":{"<2.0.0-0":{"url":"https://registry.yarnpkg.com/yarn/-/yarn-{}.tgz","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"tags":{"type":"npm","package":"yarn"}},">=2.0.0-0":{"name":"yarn","url":"https://raw.githubusercontent.com/yarnpkg/berry/%40yarnpkg/cli/{}/packages/yarnpkg-cli/bin/yarn.js","bin":["yarn","yarnpkg"],"tags":{"type":"git","repository":"https://github.com/yarnpkg/berry.git","pattern":"@yarnpkg/cli/{}"}}}}}}')},2357:t=>{"use strict";t.exports=require("assert")},4293:t=>{"use strict";t.exports=require("buffer")},3129:t=>{"use strict";t.exports=require("child_process")},6417:t=>{"use strict";t.exports=require("crypto")},8614:t=>{"use strict";t.exports=require("events")},5747:t=>{"use strict";t.exports=require("fs")},7211:t=>{"use strict";t.exports=require("https")},2087:t=>{"use strict";t.exports=require("os")},5622:t=>{"use strict";t.exports=require("path")},1058:t=>{"use strict";t.exports=require("readline")},2413:t=>{"use strict";t.exports=require("stream")},4304:t=>{"use strict";t.exports=require("string_decoder")},3867:t=>{"use strict";t.exports=require("tty")},1669:t=>{"use strict";t.exports=require("util")},8761:t=>{"use strict";t.exports=require("zlib")}},e={};function s(i){if(e[i])return e[i].exports;var r=e[i]={id:i,loaded:!1,exports:{}};return t[i](r,r.exports,s),r.loaded=!0,r.exports}return s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s(8791)})()); \ No newline at end of file diff --git a/deps/corepack/dist/npm.js b/deps/corepack/dist/npm.js new file mode 100755 index 00000000000000..99181a02f1bd1d --- /dev/null +++ b/deps/corepack/dist/npm.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['npm', 'npm', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/npx.js b/deps/corepack/dist/npx.js new file mode 100755 index 00000000000000..28f32c8195a0be --- /dev/null +++ b/deps/corepack/dist/npx.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['npm', 'npx', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/pnpm.js b/deps/corepack/dist/pnpm.js new file mode 100755 index 00000000000000..58dbad0824d58f --- /dev/null +++ b/deps/corepack/dist/pnpm.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['pnpm', 'pnpm', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/pnpx.js b/deps/corepack/dist/pnpx.js new file mode 100755 index 00000000000000..5ed2162df845ea --- /dev/null +++ b/deps/corepack/dist/pnpx.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['pnpm', 'pnpx', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/yarn.js b/deps/corepack/dist/yarn.js new file mode 100755 index 00000000000000..5d6c2ff856493e --- /dev/null +++ b/deps/corepack/dist/yarn.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['yarn', 'yarn', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/yarnpkg.js b/deps/corepack/dist/yarnpkg.js new file mode 100755 index 00000000000000..2f408b7e8f29f0 --- /dev/null +++ b/deps/corepack/dist/yarnpkg.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['yarn', 'yarnpkg', ...process.argv.slice(2)]); diff --git a/deps/corepack/package.json b/deps/corepack/package.json new file mode 100644 index 00000000000000..5a1b00e85b20cf --- /dev/null +++ b/deps/corepack/package.json @@ -0,0 +1,77 @@ +{ + "name": "corepack", + "version": "0.3.0", + "bin": { + "corepack": "./dist/corepack.js", + "pnpm": "./dist/pnpm.js", + "pnpx": "./dist/pnpx.js", + "yarn": "./dist/yarn.js", + "yarnpkg": "./dist/yarnpkg.js" + }, + "packageManager": "yarn@^2.0.0-rc.29", + "devDependencies": { + "@babel/core": "^7.11.0", + "@babel/plugin-proposal-class-properties": "^7.10.4", + "@babel/plugin-proposal-decorators": "^7.10.5", + "@babel/plugin-transform-modules-commonjs": "^7.8.3", + "@babel/preset-typescript": "^7.10.4", + "@types/debug": "^4.1.5", + "@types/jest": "^25.1.4", + "@types/node": "^13.9.2", + "@types/semver": "^7.1.0", + "@types/tar": "^4.0.3", + "@typescript-eslint/eslint-plugin": "^2.0.0", + "@typescript-eslint/parser": "^4.2.0", + "@yarnpkg/eslint-config": "^0.1.0", + "@yarnpkg/fslib": "^2.1.0", + "@zkochan/cmd-shim": "^5.0.0", + "clipanion": "^2.4.4", + "debug": "^4.1.1", + "enquirer": "^2.3.6", + "eslint": "^7.10.0", + "eslint-plugin-arca": "^0.9.5", + "jest": "^25.1.0", + "semver": "^7.1.3", + "supports-color": "^7.1.0", + "tar": "^6.0.1", + "terser-webpack-plugin": "^3.1.0", + "ts-loader": "^8.0.2", + "ts-node": "^8.10.2", + "typescript": "^3.9.7", + "webpack": "next", + "webpack-cli": "^3.3.11" + }, + "scripts": { + "build": "rm -rf dist && yarn webpack && yarn ts-node ./mkshims.ts", + "corepack": "ts-node ./sources/main.ts", + "prepack": "yarn build", + "postpack": "rm -rf dist shims" + }, + "files": [ + "dist", + "shims" + ], + "publishConfig": { + "executableFiles": [ + "./dist/npm.js", + "./dist/npx.js", + "./dist/pnpm.js", + "./dist/pnpx.js", + "./dist/yarn.js", + "./dist/yarnpkg.js", + "./dist/corepack.js", + "./shims/npm", + "./shims/npm.ps1", + "./shims/npx", + "./shims/npx.ps1", + "./shims/pnpm", + "./shims/pnpm.ps1", + "./shims/pnpx", + "./shims/pnpx.ps1", + "./shims/yarn", + "./shims/yarn.ps1", + "./shims/yarnpkg", + "./shims/yarnpkg.ps1" + ] + } +} \ No newline at end of file diff --git a/deps/corepack/shims/npm b/deps/corepack/shims/npm new file mode 100755 index 00000000000000..5e4ec9a230e5de --- /dev/null +++ b/deps/corepack/shims/npm @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/npm.js" "$@" +else + exec node "$basedir/../dist/npm.js" "$@" +fi diff --git a/deps/corepack/shims/npm.ps1 b/deps/corepack/shims/npm.ps1 new file mode 100755 index 00000000000000..3f6d6516892031 --- /dev/null +++ b/deps/corepack/shims/npm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/npm.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/npm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/npm.js" $args + } else { + & "node$exe" "$basedir/../dist/npm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/npx b/deps/corepack/shims/npx new file mode 100755 index 00000000000000..f17a82d7ff8506 --- /dev/null +++ b/deps/corepack/shims/npx @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/npx.js" "$@" +else + exec node "$basedir/../dist/npx.js" "$@" +fi diff --git a/deps/corepack/shims/npx.ps1 b/deps/corepack/shims/npx.ps1 new file mode 100755 index 00000000000000..950c2212ed9f9a --- /dev/null +++ b/deps/corepack/shims/npx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/npx.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/npx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/npx.js" $args + } else { + & "node$exe" "$basedir/../dist/npx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/pnpm b/deps/corepack/shims/pnpm new file mode 100755 index 00000000000000..785c7d75e2bbe9 --- /dev/null +++ b/deps/corepack/shims/pnpm @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/pnpm.js" "$@" +else + exec node "$basedir/../dist/pnpm.js" "$@" +fi diff --git a/deps/corepack/shims/pnpm.ps1 b/deps/corepack/shims/pnpm.ps1 new file mode 100755 index 00000000000000..35046e1ef7dfc9 --- /dev/null +++ b/deps/corepack/shims/pnpm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/pnpm.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/pnpm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/pnpm.js" $args + } else { + & "node$exe" "$basedir/../dist/pnpm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/pnpx b/deps/corepack/shims/pnpx new file mode 100755 index 00000000000000..12bd7cc4f565e3 --- /dev/null +++ b/deps/corepack/shims/pnpx @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/pnpx.js" "$@" +else + exec node "$basedir/../dist/pnpx.js" "$@" +fi diff --git a/deps/corepack/shims/pnpx.ps1 b/deps/corepack/shims/pnpx.ps1 new file mode 100755 index 00000000000000..341bb49fbead7a --- /dev/null +++ b/deps/corepack/shims/pnpx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/pnpx.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/pnpx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/pnpx.js" $args + } else { + & "node$exe" "$basedir/../dist/pnpx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/yarn b/deps/corepack/shims/yarn new file mode 100755 index 00000000000000..298711ea934fbf --- /dev/null +++ b/deps/corepack/shims/yarn @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/yarn.js" "$@" +else + exec node "$basedir/../dist/yarn.js" "$@" +fi diff --git a/deps/corepack/shims/yarn.ps1 b/deps/corepack/shims/yarn.ps1 new file mode 100755 index 00000000000000..f40254603d8aae --- /dev/null +++ b/deps/corepack/shims/yarn.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/yarn.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/yarn.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/yarn.js" $args + } else { + & "node$exe" "$basedir/../dist/yarn.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/yarnpkg b/deps/corepack/shims/yarnpkg new file mode 100755 index 00000000000000..3aa289648ad107 --- /dev/null +++ b/deps/corepack/shims/yarnpkg @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/yarnpkg.js" "$@" +else + exec node "$basedir/../dist/yarnpkg.js" "$@" +fi diff --git a/deps/corepack/shims/yarnpkg.ps1 b/deps/corepack/shims/yarnpkg.ps1 new file mode 100755 index 00000000000000..825935c07351da --- /dev/null +++ b/deps/corepack/shims/yarnpkg.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/yarnpkg.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/yarnpkg.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/yarnpkg.js" $args + } else { + & "node$exe" "$basedir/../dist/yarnpkg.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/tools/install.py b/tools/install.py index 655802980a6ea9..064801825f5f7d 100755 --- a/tools/install.py +++ b/tools/install.py @@ -79,8 +79,8 @@ def uninstall(paths, dst): for path in paths: try_remove(path, dst) -def npm_files(action): - target_path = 'lib/node_modules/npm/' +def package_files(action, name, bins): + target_path = 'lib/node_modules/' + name + '/' # don't install npm if the target path is a symlink, it probably means # that a dev version of npm is installed there @@ -88,28 +88,36 @@ def npm_files(action): # npm has a *lot* of files and it'd be a pain to maintain a fixed list here # so we walk its source directory instead... - for dirname, subdirs, basenames in os.walk('deps/npm', topdown=True): + root = 'deps/' + name + for dirname, subdirs, basenames in os.walk(root, topdown=True): subdirs[:] = [subdir for subdir in subdirs if subdir != 'test'] paths = [os.path.join(dirname, basename) for basename in basenames] - action(paths, target_path + dirname[9:] + '/') - - # create/remove symlink - link_path = abspath(install_path, 'bin/npm') - if action == uninstall: - action([link_path], 'bin/npm') - elif action == install: - try_symlink('../lib/node_modules/npm/bin/npm-cli.js', link_path) - else: - assert 0 # unhandled action type - - # create/remove symlink - link_path = abspath(install_path, 'bin/npx') - if action == uninstall: - action([link_path], 'bin/npx') - elif action == install: - try_symlink('../lib/node_modules/npm/bin/npx-cli.js', link_path) - else: - assert 0 # unhandled action type + action(paths, target_path + dirname[len(root) + 1:] + '/') + + # create/remove symlinks + for bin_name, bin_target in bins.items(): + link_path = abspath(install_path, 'bin/' + bin_name) + if action == uninstall: + action([link_path], 'bin/' + bin_name) + elif action == install: + try_symlink('../lib/node_modules/' + name + '/' + bin_target, link_path) + else: + assert 0 # unhandled action type + +def npm_files(action): + package_files(action, 'npm', { + 'npm': 'bin/npm-cli.js', + 'npx': 'bin/npx-cli.js', + }) + +def corepack_files(action): + package_files(action, 'corepack', { + 'corepack': 'dist/corepack.js', + 'yarn': 'dist/yarn.js', + 'yarnpkg': 'dist/yarn.js', + 'pnpm': 'dist/pnpm.js', + 'pnpx': 'dist/pnpx.js', + }) def subdir_files(path, dest, action): ret = {} @@ -156,7 +164,9 @@ def files(action): else: action(['doc/node.1'], 'share/man/man1/') - if 'true' == variables.get('node_install_npm'): npm_files(action) + if 'true' == variables.get('node_install_npm'): + npm_files(action) + corepack_files(action) headers(action)