create-waku 0.10.2 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,30 +1,154 @@
1
- import{createRequire as t}from"module";var i={3164:t=>{
2
- /*!
3
- * @description Recursive object extending
4
- * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
5
- * @license MIT
6
- *
7
- * The MIT License (MIT)
8
- *
9
- * Copyright (c) 2013-2018 Viacheslav Lotsmanov
10
- *
11
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
12
- * this software and associated documentation files (the "Software"), to deal in
13
- * the Software without restriction, including without limitation the rights to
14
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15
- * the Software, and to permit persons to whom the Software is furnished to do so,
16
- * subject to the following conditions:
17
- *
18
- * The above copyright notice and this permission notice shall be included in all
19
- * copies or substantial portions of the Software.
20
- *
21
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
23
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
24
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
25
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
- */
28
- function isSpecificValue(t){return t instanceof Buffer||t instanceof Date||t instanceof RegExp?true:false}function cloneSpecificValue(t){if(t instanceof Buffer){var i=Buffer.alloc?Buffer.alloc(t.length):new Buffer(t.length);t.copy(i);return i}else if(t instanceof Date){return new Date(t.getTime())}else if(t instanceof RegExp){return new RegExp(t)}else{throw new Error("Unexpected situation")}}function deepCloneArray(t){var r=[];t.forEach((function(t,o){if(typeof t==="object"&&t!==null){if(Array.isArray(t)){r[o]=deepCloneArray(t)}else if(isSpecificValue(t)){r[o]=cloneSpecificValue(t)}else{r[o]=i({},t)}}else{r[o]=t}}));return r}function safeGetProperty(t,i){return i==="__proto__"?undefined:t[i]}var i=t.exports=function(){if(arguments.length<1||typeof arguments[0]!=="object"){return false}if(arguments.length<2){return arguments[0]}var t=arguments[0];var r=Array.prototype.slice.call(arguments,1);var o,a,h;r.forEach((function(r){if(typeof r!=="object"||r===null||Array.isArray(r)){return}Object.keys(r).forEach((function(h){a=safeGetProperty(t,h);o=safeGetProperty(r,h);if(o===t){return}else if(typeof o!=="object"||o===null){t[h]=o;return}else if(Array.isArray(o)){t[h]=deepCloneArray(o);return}else if(isSpecificValue(o)){t[h]=cloneSpecificValue(o);return}else if(typeof a!=="object"||a===null||Array.isArray(a)){t[h]=i({},o);return}else{t[h]=i(a,o);return}}))}));return t}},2966:(t,i,r)=>{const o=r(8806);const a=r(6928);const h=r(2260).mkdirsSync;const c=r(3369).utimesMillisSync;const l=r(7300);function copySync(t,i,r){if(typeof r==="function"){r={filter:r}}r=r||{};r.clobber="clobber"in r?!!r.clobber:true;r.overwrite="overwrite"in r?!!r.overwrite:r.clobber;if(r.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002")}const{srcStat:c,destStat:u}=l.checkPathsSync(t,i,"copy",r);l.checkParentPathsSync(t,c,i,"copy");if(r.filter&&!r.filter(t,i))return;const d=a.dirname(i);if(!o.existsSync(d))h(d);return getStats(u,t,i,r)}function getStats(t,i,r,a){const h=a.dereference?o.statSync:o.lstatSync;const c=h(i);if(c.isDirectory())return onDir(c,t,i,r,a);else if(c.isFile()||c.isCharacterDevice()||c.isBlockDevice())return onFile(c,t,i,r,a);else if(c.isSymbolicLink())return onLink(t,i,r,a);else if(c.isSocket())throw new Error(`Cannot copy a socket file: ${i}`);else if(c.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${i}`);throw new Error(`Unknown file: ${i}`)}function onFile(t,i,r,o,a){if(!i)return copyFile(t,r,o,a);return mayCopyFile(t,r,o,a)}function mayCopyFile(t,i,r,a){if(a.overwrite){o.unlinkSync(r);return copyFile(t,i,r,a)}else if(a.errorOnExist){throw new Error(`'${r}' already exists`)}}function copyFile(t,i,r,a){o.copyFileSync(i,r);if(a.preserveTimestamps)handleTimestamps(t.mode,i,r);return setDestMode(r,t.mode)}function handleTimestamps(t,i,r){if(fileIsNotWritable(t))makeFileWritable(r,t);return setDestTimestamps(i,r)}function fileIsNotWritable(t){return(t&128)===0}function makeFileWritable(t,i){return setDestMode(t,i|128)}function setDestMode(t,i){return o.chmodSync(t,i)}function setDestTimestamps(t,i){const r=o.statSync(t);return c(i,r.atime,r.mtime)}function onDir(t,i,r,o,a){if(!i)return mkDirAndCopy(t.mode,r,o,a);return copyDir(r,o,a)}function mkDirAndCopy(t,i,r,a){o.mkdirSync(r);copyDir(i,r,a);return setDestMode(r,t)}function copyDir(t,i,r){o.readdirSync(t).forEach((o=>copyDirItem(o,t,i,r)))}function copyDirItem(t,i,r,o){const h=a.join(i,t);const c=a.join(r,t);if(o.filter&&!o.filter(h,c))return;const{destStat:u}=l.checkPathsSync(h,c,"copy",o);return getStats(u,h,c,o)}function onLink(t,i,r,h){let c=o.readlinkSync(i);if(h.dereference){c=a.resolve(process.cwd(),c)}if(!t){return o.symlinkSync(c,r)}else{let t;try{t=o.readlinkSync(r)}catch(t){if(t.code==="EINVAL"||t.code==="UNKNOWN")return o.symlinkSync(c,r);throw t}if(h.dereference){t=a.resolve(process.cwd(),t)}if(l.isSrcSubdir(c,t)){throw new Error(`Cannot copy '${c}' to a subdirectory of itself, '${t}'.`)}if(l.isSrcSubdir(t,c)){throw new Error(`Cannot overwrite '${t}' with '${c}'.`)}return copyLink(c,r)}}function copyLink(t,i){o.unlinkSync(i);return o.symlinkSync(t,i)}t.exports=copySync},7396:(t,i,r)=>{const o=r(7763);const a=r(6928);const{mkdirs:h}=r(2260);const{pathExists:c}=r(3662);const{utimesMillis:l}=r(3369);const u=r(7300);async function copy(t,i,r={}){if(typeof r==="function"){r={filter:r}}r.clobber="clobber"in r?!!r.clobber:true;r.overwrite="overwrite"in r?!!r.overwrite:r.clobber;if(r.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001")}const{srcStat:o,destStat:l}=await u.checkPaths(t,i,"copy",r);await u.checkParentPaths(t,o,i,"copy");const d=await runFilter(t,i,r);if(!d)return;const p=a.dirname(i);const m=await c(p);if(!m){await h(p)}await getStatsAndPerformCopy(l,t,i,r)}async function runFilter(t,i,r){if(!r.filter)return true;return r.filter(t,i)}async function getStatsAndPerformCopy(t,i,r,a){const h=a.dereference?o.stat:o.lstat;const c=await h(i);if(c.isDirectory())return onDir(c,t,i,r,a);if(c.isFile()||c.isCharacterDevice()||c.isBlockDevice())return onFile(c,t,i,r,a);if(c.isSymbolicLink())return onLink(t,i,r,a);if(c.isSocket())throw new Error(`Cannot copy a socket file: ${i}`);if(c.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${i}`);throw new Error(`Unknown file: ${i}`)}async function onFile(t,i,r,a,h){if(!i)return copyFile(t,r,a,h);if(h.overwrite){await o.unlink(a);return copyFile(t,r,a,h)}if(h.errorOnExist){throw new Error(`'${a}' already exists`)}}async function copyFile(t,i,r,a){await o.copyFile(i,r);if(a.preserveTimestamps){if(fileIsNotWritable(t.mode)){await makeFileWritable(r,t.mode)}const a=await o.stat(i);await l(r,a.atime,a.mtime)}return o.chmod(r,t.mode)}function fileIsNotWritable(t){return(t&128)===0}function makeFileWritable(t,i){return o.chmod(t,i|128)}async function onDir(t,i,r,h,c){if(!i){await o.mkdir(h)}const l=await o.readdir(r);await Promise.all(l.map((async t=>{const i=a.join(r,t);const o=a.join(h,t);const l=await runFilter(i,o,c);if(!l)return;const{destStat:d}=await u.checkPaths(i,o,"copy",c);return getStatsAndPerformCopy(d,i,o,c)})));if(!i){await o.chmod(h,t.mode)}}async function onLink(t,i,r,h){let c=await o.readlink(i);if(h.dereference){c=a.resolve(process.cwd(),c)}if(!t){return o.symlink(c,r)}let l=null;try{l=await o.readlink(r)}catch(t){if(t.code==="EINVAL"||t.code==="UNKNOWN")return o.symlink(c,r);throw t}if(h.dereference){l=a.resolve(process.cwd(),l)}if(u.isSrcSubdir(c,l)){throw new Error(`Cannot copy '${c}' to a subdirectory of itself, '${l}'.`)}if(u.isSrcSubdir(l,c)){throw new Error(`Cannot overwrite '${l}' with '${c}'.`)}await o.unlink(r);return o.symlink(c,r)}t.exports=copy},3521:(t,i,r)=>{const o=r(4124).fromPromise;t.exports={copy:o(r(7396)),copySync:r(2966)}},6781:(t,i,r)=>{const o=r(4124).fromPromise;const a=r(7763);const h=r(6928);const c=r(2260);const l=r(3348);const u=o((async function emptyDir(t){let i;try{i=await a.readdir(t)}catch{return c.mkdirs(t)}return Promise.all(i.map((i=>l.remove(h.join(t,i)))))}));function emptyDirSync(t){let i;try{i=a.readdirSync(t)}catch{return c.mkdirsSync(t)}i.forEach((i=>{i=h.join(t,i);l.removeSync(i)}))}t.exports={emptyDirSync:emptyDirSync,emptydirSync:emptyDirSync,emptyDir:u,emptydir:u}},6730:(t,i,r)=>{const o=r(4124).fromPromise;const a=r(6928);const h=r(7763);const c=r(2260);async function createFile(t){let i;try{i=await h.stat(t)}catch{}if(i&&i.isFile())return;const r=a.dirname(t);let o=null;try{o=await h.stat(r)}catch(i){if(i.code==="ENOENT"){await c.mkdirs(r);await h.writeFile(t,"");return}else{throw i}}if(o.isDirectory()){await h.writeFile(t,"")}else{await h.readdir(r)}}function createFileSync(t){let i;try{i=h.statSync(t)}catch{}if(i&&i.isFile())return;const r=a.dirname(t);try{if(!h.statSync(r).isDirectory()){h.readdirSync(r)}}catch(t){if(t&&t.code==="ENOENT")c.mkdirsSync(r);else throw t}h.writeFileSync(t,"")}t.exports={createFile:o(createFile),createFileSync:createFileSync}},7374:(t,i,r)=>{const{createFile:o,createFileSync:a}=r(6730);const{createLink:h,createLinkSync:c}=r(2416);const{createSymlink:l,createSymlinkSync:u}=r(4505);t.exports={createFile:o,createFileSync:a,ensureFile:o,ensureFileSync:a,createLink:h,createLinkSync:c,ensureLink:h,ensureLinkSync:c,createSymlink:l,createSymlinkSync:u,ensureSymlink:l,ensureSymlinkSync:u}},2416:(t,i,r)=>{const o=r(4124).fromPromise;const a=r(6928);const h=r(7763);const c=r(2260);const{pathExists:l}=r(3662);const{areIdentical:u}=r(7300);async function createLink(t,i){let r;try{r=await h.lstat(i)}catch{}let o;try{o=await h.lstat(t)}catch(t){t.message=t.message.replace("lstat","ensureLink");throw t}if(r&&u(o,r))return;const d=a.dirname(i);const p=await l(d);if(!p){await c.mkdirs(d)}await h.link(t,i)}function createLinkSync(t,i){let r;try{r=h.lstatSync(i)}catch{}try{const i=h.lstatSync(t);if(r&&u(i,r))return}catch(t){t.message=t.message.replace("lstat","ensureLink");throw t}const o=a.dirname(i);const l=h.existsSync(o);if(l)return h.linkSync(t,i);c.mkdirsSync(o);return h.linkSync(t,i)}t.exports={createLink:o(createLink),createLinkSync:createLinkSync}},3336:(t,i,r)=>{const o=r(6928);const a=r(7763);const{pathExists:h}=r(3662);const c=r(4124).fromPromise;async function symlinkPaths(t,i){if(o.isAbsolute(t)){try{await a.lstat(t)}catch(t){t.message=t.message.replace("lstat","ensureSymlink");throw t}return{toCwd:t,toDst:t}}const r=o.dirname(i);const c=o.join(r,t);const l=await h(c);if(l){return{toCwd:c,toDst:t}}try{await a.lstat(t)}catch(t){t.message=t.message.replace("lstat","ensureSymlink");throw t}return{toCwd:t,toDst:o.relative(r,t)}}function symlinkPathsSync(t,i){if(o.isAbsolute(t)){const i=a.existsSync(t);if(!i)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}const r=o.dirname(i);const h=o.join(r,t);const c=a.existsSync(h);if(c){return{toCwd:h,toDst:t}}const l=a.existsSync(t);if(!l)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:o.relative(r,t)}}t.exports={symlinkPaths:c(symlinkPaths),symlinkPathsSync:symlinkPathsSync}},7114:(t,i,r)=>{const o=r(7763);const a=r(4124).fromPromise;async function symlinkType(t,i){if(i)return i;let r;try{r=await o.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function symlinkTypeSync(t,i){if(i)return i;let r;try{r=o.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}t.exports={symlinkType:a(symlinkType),symlinkTypeSync:symlinkTypeSync}},4505:(t,i,r)=>{const o=r(4124).fromPromise;const a=r(6928);const h=r(7763);const{mkdirs:c,mkdirsSync:l}=r(2260);const{symlinkPaths:u,symlinkPathsSync:d}=r(3336);const{symlinkType:p,symlinkTypeSync:m}=r(7114);const{pathExists:y}=r(3662);const{areIdentical:g}=r(7300);async function createSymlink(t,i,r){let o;try{o=await h.lstat(i)}catch{}if(o&&o.isSymbolicLink()){const[r,o]=await Promise.all([h.stat(t),h.stat(i)]);if(g(r,o))return}const l=await u(t,i);t=l.toDst;const d=await p(l.toCwd,r);const m=a.dirname(i);if(!await y(m)){await c(m)}return h.symlink(t,i,d)}function createSymlinkSync(t,i,r){let o;try{o=h.lstatSync(i)}catch{}if(o&&o.isSymbolicLink()){const r=h.statSync(t);const o=h.statSync(i);if(g(r,o))return}const c=d(t,i);t=c.toDst;r=m(c.toCwd,r);const u=a.dirname(i);const p=h.existsSync(u);if(p)return h.symlinkSync(t,i,r);l(u);return h.symlinkSync(t,i,r)}t.exports={createSymlink:o(createSymlink),createSymlinkSync:createSymlinkSync}},7763:(t,i,r)=>{const o=r(4124).fromCallback;const a=r(8806);const h=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((t=>typeof a[t]==="function"));Object.assign(i,a);h.forEach((t=>{i[t]=o(a[t])}));i.exists=function(t,i){if(typeof i==="function"){return a.exists(t,i)}return new Promise((i=>a.exists(t,i)))};i.read=function(t,i,r,o,h,c){if(typeof c==="function"){return a.read(t,i,r,o,h,c)}return new Promise(((c,l)=>{a.read(t,i,r,o,h,((t,i,r)=>{if(t)return l(t);c({bytesRead:i,buffer:r})}))}))};i.write=function(t,i,...r){if(typeof r[r.length-1]==="function"){return a.write(t,i,...r)}return new Promise(((o,h)=>{a.write(t,i,...r,((t,i,r)=>{if(t)return h(t);o({bytesWritten:i,buffer:r})}))}))};i.readv=function(t,i,...r){if(typeof r[r.length-1]==="function"){return a.readv(t,i,...r)}return new Promise(((o,h)=>{a.readv(t,i,...r,((t,i,r)=>{if(t)return h(t);o({bytesRead:i,buffers:r})}))}))};i.writev=function(t,i,...r){if(typeof r[r.length-1]==="function"){return a.writev(t,i,...r)}return new Promise(((o,h)=>{a.writev(t,i,...r,((t,i,r)=>{if(t)return h(t);o({bytesWritten:i,buffers:r})}))}))};if(typeof a.realpath.native==="function"){i.realpath.native=o(a.realpath.native)}else{process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}},34:(t,i,r)=>{const o=r(4124).fromPromise;const a=r(7164);a.outputJson=o(r(9132));a.outputJsonSync=r(2558);a.outputJSON=a.outputJson;a.outputJSONSync=a.outputJsonSync;a.writeJSON=a.writeJson;a.writeJSONSync=a.writeJsonSync;a.readJSON=a.readJson;a.readJSONSync=a.readJsonSync;t.exports=a},7164:(t,i,r)=>{const o=r(2476);t.exports={readJson:o.readFile,readJsonSync:o.readFileSync,writeJson:o.writeFile,writeJsonSync:o.writeFileSync}},2558:(t,i,r)=>{const{stringify:o}=r(565);const{outputFileSync:a}=r(8046);function outputJsonSync(t,i,r){const h=o(i,r);a(t,h,r)}t.exports=outputJsonSync},9132:(t,i,r)=>{const{stringify:o}=r(565);const{outputFile:a}=r(8046);async function outputJson(t,i,r={}){const h=o(i,r);await a(t,h,r)}t.exports=outputJson},2260:(t,i,r)=>{const o=r(4124).fromPromise;const{makeDir:a,makeDirSync:h}=r(3330);const c=o(a);t.exports={mkdirs:c,mkdirsSync:h,mkdirp:c,mkdirpSync:h,ensureDir:c,ensureDirSync:h}},3330:(t,i,r)=>{const o=r(7763);const{checkPath:a}=r(349);const getMode=t=>{const i={mode:511};if(typeof t==="number")return t;return{...i,...t}.mode};t.exports.makeDir=async(t,i)=>{a(t);return o.mkdir(t,{mode:getMode(i),recursive:true})};t.exports.makeDirSync=(t,i)=>{a(t);return o.mkdirSync(t,{mode:getMode(i),recursive:true})}},349:(t,i,r)=>{const o=r(6928);t.exports.checkPath=function checkPath(t){if(process.platform==="win32"){const i=/[<>:"|?*]/.test(t.replace(o.parse(t).root,""));if(i){const i=new Error(`Path contains invalid characters: ${t}`);i.code="EINVAL";throw i}}}},7105:(t,i,r)=>{const o=r(4124).fromPromise;t.exports={move:o(r(5132)),moveSync:r(8334)}},8334:(t,i,r)=>{const o=r(8806);const a=r(6928);const h=r(3521).copySync;const c=r(3348).removeSync;const l=r(2260).mkdirpSync;const u=r(7300);function moveSync(t,i,r){r=r||{};const o=r.overwrite||r.clobber||false;const{srcStat:h,isChangingCase:c=false}=u.checkPathsSync(t,i,"move",r);u.checkParentPathsSync(t,h,i,"move");if(!isParentRoot(i))l(a.dirname(i));return doRename(t,i,o,c)}function isParentRoot(t){const i=a.dirname(t);const r=a.parse(i);return r.root===i}function doRename(t,i,r,a){if(a)return rename(t,i,r);if(r){c(i);return rename(t,i,r)}if(o.existsSync(i))throw new Error("dest already exists.");return rename(t,i,r)}function rename(t,i,r){try{o.renameSync(t,i)}catch(o){if(o.code!=="EXDEV")throw o;return moveAcrossDevice(t,i,r)}}function moveAcrossDevice(t,i,r){const o={overwrite:r,errorOnExist:true,preserveTimestamps:true};h(t,i,o);return c(t)}t.exports=moveSync},5132:(t,i,r)=>{const o=r(7763);const a=r(6928);const{copy:h}=r(3521);const{remove:c}=r(3348);const{mkdirp:l}=r(2260);const{pathExists:u}=r(3662);const d=r(7300);async function move(t,i,r={}){const o=r.overwrite||r.clobber||false;const{srcStat:h,isChangingCase:c=false}=await d.checkPaths(t,i,"move",r);await d.checkParentPaths(t,h,i,"move");const u=a.dirname(i);const p=a.parse(u);if(p.root!==u){await l(u)}return doRename(t,i,o,c)}async function doRename(t,i,r,a){if(!a){if(r){await c(i)}else if(await u(i)){throw new Error("dest already exists.")}}try{await o.rename(t,i)}catch(o){if(o.code!=="EXDEV"){throw o}await moveAcrossDevice(t,i,r)}}async function moveAcrossDevice(t,i,r){const o={overwrite:r,errorOnExist:true,preserveTimestamps:true};await h(t,i,o);return c(t)}t.exports=move},8046:(t,i,r)=>{const o=r(4124).fromPromise;const a=r(7763);const h=r(6928);const c=r(2260);const l=r(3662).pathExists;async function outputFile(t,i,r="utf-8"){const o=h.dirname(t);if(!await l(o)){await c.mkdirs(o)}return a.writeFile(t,i,r)}function outputFileSync(t,...i){const r=h.dirname(t);if(!a.existsSync(r)){c.mkdirsSync(r)}a.writeFileSync(t,...i)}t.exports={outputFile:o(outputFile),outputFileSync:outputFileSync}},3662:(t,i,r)=>{const o=r(4124).fromPromise;const a=r(7763);function pathExists(t){return a.access(t).then((()=>true)).catch((()=>false))}t.exports={pathExists:o(pathExists),pathExistsSync:a.existsSync}},3348:(t,i,r)=>{const o=r(8806);const a=r(4124).fromCallback;function remove(t,i){o.rm(t,{recursive:true,force:true},i)}function removeSync(t){o.rmSync(t,{recursive:true,force:true})}t.exports={remove:a(remove),removeSync:removeSync}},7300:(t,i,r)=>{const o=r(7763);const a=r(6928);const h=r(4124).fromPromise;function getStats(t,i,r){const a=r.dereference?t=>o.stat(t,{bigint:true}):t=>o.lstat(t,{bigint:true});return Promise.all([a(t),a(i).catch((t=>{if(t.code==="ENOENT")return null;throw t}))]).then((([t,i])=>({srcStat:t,destStat:i})))}function getStatsSync(t,i,r){let a;const h=r.dereference?t=>o.statSync(t,{bigint:true}):t=>o.lstatSync(t,{bigint:true});const c=h(t);try{a=h(i)}catch(t){if(t.code==="ENOENT")return{srcStat:c,destStat:null};throw t}return{srcStat:c,destStat:a}}async function checkPaths(t,i,r,o){const{srcStat:h,destStat:c}=await getStats(t,i,o);if(c){if(areIdentical(h,c)){const o=a.basename(t);const l=a.basename(i);if(r==="move"&&o!==l&&o.toLowerCase()===l.toLowerCase()){return{srcStat:h,destStat:c,isChangingCase:true}}throw new Error("Source and destination must not be the same.")}if(h.isDirectory()&&!c.isDirectory()){throw new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`)}if(!h.isDirectory()&&c.isDirectory()){throw new Error(`Cannot overwrite directory '${i}' with non-directory '${t}'.`)}}if(h.isDirectory()&&isSrcSubdir(t,i)){throw new Error(errMsg(t,i,r))}return{srcStat:h,destStat:c}}function checkPathsSync(t,i,r,o){const{srcStat:h,destStat:c}=getStatsSync(t,i,o);if(c){if(areIdentical(h,c)){const o=a.basename(t);const l=a.basename(i);if(r==="move"&&o!==l&&o.toLowerCase()===l.toLowerCase()){return{srcStat:h,destStat:c,isChangingCase:true}}throw new Error("Source and destination must not be the same.")}if(h.isDirectory()&&!c.isDirectory()){throw new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`)}if(!h.isDirectory()&&c.isDirectory()){throw new Error(`Cannot overwrite directory '${i}' with non-directory '${t}'.`)}}if(h.isDirectory()&&isSrcSubdir(t,i)){throw new Error(errMsg(t,i,r))}return{srcStat:h,destStat:c}}async function checkParentPaths(t,i,r,h){const c=a.resolve(a.dirname(t));const l=a.resolve(a.dirname(r));if(l===c||l===a.parse(l).root)return;let u;try{u=await o.stat(l,{bigint:true})}catch(t){if(t.code==="ENOENT")return;throw t}if(areIdentical(i,u)){throw new Error(errMsg(t,r,h))}return checkParentPaths(t,i,l,h)}function checkParentPathsSync(t,i,r,h){const c=a.resolve(a.dirname(t));const l=a.resolve(a.dirname(r));if(l===c||l===a.parse(l).root)return;let u;try{u=o.statSync(l,{bigint:true})}catch(t){if(t.code==="ENOENT")return;throw t}if(areIdentical(i,u)){throw new Error(errMsg(t,r,h))}return checkParentPathsSync(t,i,l,h)}function areIdentical(t,i){return i.ino&&i.dev&&i.ino===t.ino&&i.dev===t.dev}function isSrcSubdir(t,i){const r=a.resolve(t).split(a.sep).filter((t=>t));const o=a.resolve(i).split(a.sep).filter((t=>t));return r.every(((t,i)=>o[i]===t))}function errMsg(t,i,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${i}'.`}t.exports={checkPaths:h(checkPaths),checkPathsSync:checkPathsSync,checkParentPaths:h(checkParentPaths),checkParentPathsSync:checkParentPathsSync,isSrcSubdir:isSrcSubdir,areIdentical:areIdentical}},3369:(t,i,r)=>{const o=r(7763);const a=r(4124).fromPromise;async function utimesMillis(t,i,r){const a=await o.open(t,"r+");let h=null;try{await o.futimes(a,i,r)}finally{try{await o.close(a)}catch(t){h=t}}if(h){throw h}}function utimesMillisSync(t,i,r){const a=o.openSync(t,"r+");o.futimesSync(a,i,r);return o.closeSync(a)}t.exports={utimesMillis:a(utimesMillis),utimesMillisSync:utimesMillisSync}},4934:t=>{t.exports=clone;var i=Object.getPrototypeOf||function(t){return t.__proto__};function clone(t){if(t===null||typeof t!=="object")return t;if(t instanceof Object)var r={__proto__:i(t)};else var r=Object.create(null);Object.getOwnPropertyNames(t).forEach((function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))}));return r}},8806:(t,i,r)=>{var o=r(9896);var a=r(8223);var h=r(5380);var c=r(4934);var l=r(9023);var u;var d;if(typeof Symbol==="function"&&typeof Symbol.for==="function"){u=Symbol.for("graceful-fs.queue");d=Symbol.for("graceful-fs.previous")}else{u="___graceful-fs.queue";d="___graceful-fs.previous"}function noop(){}function publishQueue(t,i){Object.defineProperty(t,u,{get:function(){return i}})}var p=noop;if(l.debuglog)p=l.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))p=function(){var t=l.format.apply(l,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: ");console.error(t)};if(!o[u]){var m=global[u]||[];publishQueue(o,m);o.close=function(t){function close(i,r){return t.call(o,i,(function(t){if(!t){resetQueue()}if(typeof r==="function")r.apply(this,arguments)}))}Object.defineProperty(close,d,{value:t});return close}(o.close);o.closeSync=function(t){function closeSync(i){t.apply(o,arguments);resetQueue()}Object.defineProperty(closeSync,d,{value:t});return closeSync}(o.closeSync);if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")){process.on("exit",(function(){p(o[u]);r(2613).equal(o[u].length,0)}))}}if(!global[u]){publishQueue(global,o[u])}t.exports=patch(c(o));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!o.__patched){t.exports=patch(o);o.__patched=true}function patch(t){a(t);t.gracefulify=patch;t.createReadStream=createReadStream;t.createWriteStream=createWriteStream;var i=t.readFile;t.readFile=readFile;function readFile(t,r,o){if(typeof r==="function")o=r,r=null;return go$readFile(t,r,o);function go$readFile(t,r,o,a){return i(t,r,(function(i){if(i&&(i.code==="EMFILE"||i.code==="ENFILE"))enqueue([go$readFile,[t,r,o],i,a||Date.now(),Date.now()]);else{if(typeof o==="function")o.apply(this,arguments)}}))}}var r=t.writeFile;t.writeFile=writeFile;function writeFile(t,i,o,a){if(typeof o==="function")a=o,o=null;return go$writeFile(t,i,o,a);function go$writeFile(t,i,o,a,h){return r(t,i,o,(function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))enqueue([go$writeFile,[t,i,o,a],r,h||Date.now(),Date.now()]);else{if(typeof a==="function")a.apply(this,arguments)}}))}}var o=t.appendFile;if(o)t.appendFile=appendFile;function appendFile(t,i,r,a){if(typeof r==="function")a=r,r=null;return go$appendFile(t,i,r,a);function go$appendFile(t,i,r,a,h){return o(t,i,r,(function(o){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))enqueue([go$appendFile,[t,i,r,a],o,h||Date.now(),Date.now()]);else{if(typeof a==="function")a.apply(this,arguments)}}))}}var c=t.copyFile;if(c)t.copyFile=copyFile;function copyFile(t,i,r,o){if(typeof r==="function"){o=r;r=0}return go$copyFile(t,i,r,o);function go$copyFile(t,i,r,o,a){return c(t,i,r,(function(h){if(h&&(h.code==="EMFILE"||h.code==="ENFILE"))enqueue([go$copyFile,[t,i,r,o],h,a||Date.now(),Date.now()]);else{if(typeof o==="function")o.apply(this,arguments)}}))}}var l=t.readdir;t.readdir=readdir;var u=/^v[0-5]\./;function readdir(t,i,r){if(typeof i==="function")r=i,i=null;var o=u.test(process.version)?function go$readdir(t,i,r,o){return l(t,fs$readdirCallback(t,i,r,o))}:function go$readdir(t,i,r,o){return l(t,i,fs$readdirCallback(t,i,r,o))};return o(t,i,r);function fs$readdirCallback(t,i,r,a){return function(h,c){if(h&&(h.code==="EMFILE"||h.code==="ENFILE"))enqueue([o,[t,i,r],h,a||Date.now(),Date.now()]);else{if(c&&c.sort)c.sort();if(typeof r==="function")r.call(this,h,c)}}}}if(process.version.substr(0,4)==="v0.8"){var d=h(t);ReadStream=d.ReadStream;WriteStream=d.WriteStream}var p=t.ReadStream;if(p){ReadStream.prototype=Object.create(p.prototype);ReadStream.prototype.open=ReadStream$open}var m=t.WriteStream;if(m){WriteStream.prototype=Object.create(m.prototype);WriteStream.prototype.open=WriteStream$open}Object.defineProperty(t,"ReadStream",{get:function(){return ReadStream},set:function(t){ReadStream=t},enumerable:true,configurable:true});Object.defineProperty(t,"WriteStream",{get:function(){return WriteStream},set:function(t){WriteStream=t},enumerable:true,configurable:true});var y=ReadStream;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(t){y=t},enumerable:true,configurable:true});var g=WriteStream;Object.defineProperty(t,"FileWriteStream",{get:function(){return g},set:function(t){g=t},enumerable:true,configurable:true});function ReadStream(t,i){if(this instanceof ReadStream)return p.apply(this,arguments),this;else return ReadStream.apply(Object.create(ReadStream.prototype),arguments)}function ReadStream$open(){var t=this;open(t.path,t.flags,t.mode,(function(i,r){if(i){if(t.autoClose)t.destroy();t.emit("error",i)}else{t.fd=r;t.emit("open",r);t.read()}}))}function WriteStream(t,i){if(this instanceof WriteStream)return m.apply(this,arguments),this;else return WriteStream.apply(Object.create(WriteStream.prototype),arguments)}function WriteStream$open(){var t=this;open(t.path,t.flags,t.mode,(function(i,r){if(i){t.destroy();t.emit("error",i)}else{t.fd=r;t.emit("open",r)}}))}function createReadStream(i,r){return new t.ReadStream(i,r)}function createWriteStream(i,r){return new t.WriteStream(i,r)}var b=t.open;t.open=open;function open(t,i,r,o){if(typeof r==="function")o=r,r=null;return go$open(t,i,r,o);function go$open(t,i,r,o,a){return b(t,i,r,(function(h,c){if(h&&(h.code==="EMFILE"||h.code==="ENFILE"))enqueue([go$open,[t,i,r,o],h,a||Date.now(),Date.now()]);else{if(typeof o==="function")o.apply(this,arguments)}}))}}return t}function enqueue(t){p("ENQUEUE",t[0].name,t[1]);o[u].push(t);retry()}var y;function resetQueue(){var t=Date.now();for(var i=0;i<o[u].length;++i){if(o[u][i].length>2){o[u][i][3]=t;o[u][i][4]=t}}retry()}function retry(){clearTimeout(y);y=undefined;if(o[u].length===0)return;var t=o[u].shift();var i=t[0];var r=t[1];var a=t[2];var h=t[3];var c=t[4];if(h===undefined){p("RETRY",i.name,r);i.apply(null,r)}else if(Date.now()-h>=6e4){p("TIMEOUT",i.name,r);var l=r.pop();if(typeof l==="function")l.call(null,a)}else{var d=Date.now()-c;var m=Math.max(c-h,1);var g=Math.min(m*1.2,100);if(d>=g){p("RETRY",i.name,r);i.apply(null,r.concat([h]))}else{o[u].push(t)}}if(y===undefined){y=setTimeout(retry,0)}}},5380:(t,i,r)=>{var o=r(2203).Stream;t.exports=legacy;function legacy(t){return{ReadStream:ReadStream,WriteStream:WriteStream};function ReadStream(i,r){if(!(this instanceof ReadStream))return new ReadStream(i,r);o.call(this);var a=this;this.path=i;this.fd=null;this.readable=true;this.paused=false;this.flags="r";this.mode=438;this.bufferSize=64*1024;r=r||{};var h=Object.keys(r);for(var c=0,l=h.length;c<l;c++){var u=h[c];this[u]=r[u]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==undefined){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.end===undefined){this.end=Infinity}else if("number"!==typeof this.end){throw TypeError("end must be a Number")}if(this.start>this.end){throw new Error("start must be <= end")}this.pos=this.start}if(this.fd!==null){process.nextTick((function(){a._read()}));return}t.open(this.path,this.flags,this.mode,(function(t,i){if(t){a.emit("error",t);a.readable=false;return}a.fd=i;a.emit("open",i);a._read()}))}function WriteStream(i,r){if(!(this instanceof WriteStream))return new WriteStream(i,r);o.call(this);this.path=i;this.fd=null;this.writable=true;this.flags="w";this.encoding="binary";this.mode=438;this.bytesWritten=0;r=r||{};var a=Object.keys(r);for(var h=0,c=a.length;h<c;h++){var l=a[h];this[l]=r[l]}if(this.start!==undefined){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.start<0){throw new Error("start must be >= zero")}this.pos=this.start}this.busy=false;this._queue=[];if(this.fd===null){this._open=t.open;this._queue.push([this._open,this.path,this.flags,this.mode,undefined]);this.flush()}}}},8223:(t,i,r)=>{var o=r(9140);var a=process.cwd;var h=null;var c=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!h)h=a.call(process);return h};try{process.cwd()}catch(t){}if(typeof process.chdir==="function"){var l=process.chdir;process.chdir=function(t){h=null;l.call(process,t)};if(Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,l)}t.exports=patch;function patch(t){if(o.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)){patchLchmod(t)}if(!t.lutimes){patchLutimes(t)}t.chown=chownFix(t.chown);t.fchown=chownFix(t.fchown);t.lchown=chownFix(t.lchown);t.chmod=chmodFix(t.chmod);t.fchmod=chmodFix(t.fchmod);t.lchmod=chmodFix(t.lchmod);t.chownSync=chownFixSync(t.chownSync);t.fchownSync=chownFixSync(t.fchownSync);t.lchownSync=chownFixSync(t.lchownSync);t.chmodSync=chmodFixSync(t.chmodSync);t.fchmodSync=chmodFixSync(t.fchmodSync);t.lchmodSync=chmodFixSync(t.lchmodSync);t.stat=statFix(t.stat);t.fstat=statFix(t.fstat);t.lstat=statFix(t.lstat);t.statSync=statFixSync(t.statSync);t.fstatSync=statFixSync(t.fstatSync);t.lstatSync=statFixSync(t.lstatSync);if(t.chmod&&!t.lchmod){t.lchmod=function(t,i,r){if(r)process.nextTick(r)};t.lchmodSync=function(){}}if(t.chown&&!t.lchown){t.lchown=function(t,i,r,o){if(o)process.nextTick(o)};t.lchownSync=function(){}}if(c==="win32"){t.rename=typeof t.rename!=="function"?t.rename:function(i){function rename(r,o,a){var h=Date.now();var c=0;i(r,o,(function CB(l){if(l&&(l.code==="EACCES"||l.code==="EPERM"||l.code==="EBUSY")&&Date.now()-h<6e4){setTimeout((function(){t.stat(o,(function(t,h){if(t&&t.code==="ENOENT")i(r,o,CB);else a(l)}))}),c);if(c<100)c+=10;return}if(a)a(l)}))}if(Object.setPrototypeOf)Object.setPrototypeOf(rename,i);return rename}(t.rename)}t.read=typeof t.read!=="function"?t.read:function(i){function read(r,o,a,h,c,l){var u;if(l&&typeof l==="function"){var d=0;u=function(p,m,y){if(p&&p.code==="EAGAIN"&&d<10){d++;return i.call(t,r,o,a,h,c,u)}l.apply(this,arguments)}}return i.call(t,r,o,a,h,c,u)}if(Object.setPrototypeOf)Object.setPrototypeOf(read,i);return read}(t.read);t.readSync=typeof t.readSync!=="function"?t.readSync:function(i){return function(r,o,a,h,c){var l=0;while(true){try{return i.call(t,r,o,a,h,c)}catch(t){if(t.code==="EAGAIN"&&l<10){l++;continue}throw t}}}}(t.readSync);function patchLchmod(t){t.lchmod=function(i,r,a){t.open(i,o.O_WRONLY|o.O_SYMLINK,r,(function(i,o){if(i){if(a)a(i);return}t.fchmod(o,r,(function(i){t.close(o,(function(t){if(a)a(i||t)}))}))}))};t.lchmodSync=function(i,r){var a=t.openSync(i,o.O_WRONLY|o.O_SYMLINK,r);var h=true;var c;try{c=t.fchmodSync(a,r);h=false}finally{if(h){try{t.closeSync(a)}catch(t){}}else{t.closeSync(a)}}return c}}function patchLutimes(t){if(o.hasOwnProperty("O_SYMLINK")&&t.futimes){t.lutimes=function(i,r,a,h){t.open(i,o.O_SYMLINK,(function(i,o){if(i){if(h)h(i);return}t.futimes(o,r,a,(function(i){t.close(o,(function(t){if(h)h(i||t)}))}))}))};t.lutimesSync=function(i,r,a){var h=t.openSync(i,o.O_SYMLINK);var c;var l=true;try{c=t.futimesSync(h,r,a);l=false}finally{if(l){try{t.closeSync(h)}catch(t){}}else{t.closeSync(h)}}return c}}else if(t.futimes){t.lutimes=function(t,i,r,o){if(o)process.nextTick(o)};t.lutimesSync=function(){}}}function chmodFix(i){if(!i)return i;return function(r,o,a){return i.call(t,r,o,(function(t){if(chownErOk(t))t=null;if(a)a.apply(this,arguments)}))}}function chmodFixSync(i){if(!i)return i;return function(r,o){try{return i.call(t,r,o)}catch(t){if(!chownErOk(t))throw t}}}function chownFix(i){if(!i)return i;return function(r,o,a,h){return i.call(t,r,o,a,(function(t){if(chownErOk(t))t=null;if(h)h.apply(this,arguments)}))}}function chownFixSync(i){if(!i)return i;return function(r,o,a){try{return i.call(t,r,o,a)}catch(t){if(!chownErOk(t))throw t}}}function statFix(i){if(!i)return i;return function(r,o,a){if(typeof o==="function"){a=o;o=null}function callback(t,i){if(i){if(i.uid<0)i.uid+=4294967296;if(i.gid<0)i.gid+=4294967296}if(a)a.apply(this,arguments)}return o?i.call(t,r,o,callback):i.call(t,r,callback)}}function statFixSync(i){if(!i)return i;return function(r,o){var a=o?i.call(t,r,o):i.call(t,r);if(a){if(a.uid<0)a.uid+=4294967296;if(a.gid<0)a.gid+=4294967296}return a}}function chownErOk(t){if(!t)return true;if(t.code==="ENOSYS")return true;var i=!process.getuid||process.getuid()!==0;if(i){if(t.code==="EINVAL"||t.code==="EPERM")return true}return false}}},8277:(t,i)=>{i.parse=i.decode=decode;i.stringify=i.encode=encode;i.safe=safe;i.unsafe=unsafe;var r=typeof process!=="undefined"&&process.platform==="win32"?"\r\n":"\n";function encode(t,i){var o=[];var a="";if(typeof i==="string"){i={section:i,whitespace:false}}else{i=i||{};i.whitespace=i.whitespace===true}var h=i.whitespace?" = ":"=";Object.keys(t).forEach((function(i,c,l){var u=t[i];if(u&&Array.isArray(u)){u.forEach((function(t){a+=safe(i+"[]")+h+safe(t)+"\n"}))}else if(u&&typeof u==="object")o.push(i);else a+=safe(i)+h+safe(u)+r}));if(i.section&&a.length)a="["+safe(i.section)+"]"+r+a;o.forEach((function(o,h,c){var l=dotSplit(o).join("\\.");var u=(i.section?i.section+".":"")+l;var d=encode(t[o],{section:u,whitespace:i.whitespace});if(a.length&&d.length)a+=r;a+=d}));return a}function dotSplit(t){return t.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map((function(t){return t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")}))}function decode(t){var i={};var r=i;var o=null;var a=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;var h=t.split(/[\r\n]+/g);h.forEach((function(t,h,c){if(!t||t.match(/^\s*[;#]/))return;var l=t.match(a);if(!l)return;if(l[1]!==undefined){o=unsafe(l[1]);if(o==="__proto__"){r={};return}r=i[o]=i[o]||{};return}var u=unsafe(l[2]);if(u==="__proto__")return;var d=l[3]?unsafe(l[4]):true;switch(d){case"true":case"false":case"null":d=JSON.parse(d)}if(u.length>2&&u.slice(-2)==="[]"){u=u.substring(0,u.length-2);if(u==="__proto__")return;if(!r[u])r[u]=[];else if(!Array.isArray(r[u]))r[u]=[r[u]]}if(Array.isArray(r[u]))r[u].push(d);else r[u]=d}));Object.keys(i).filter((function(t,r,o){if(!i[t]||typeof i[t]!=="object"||Array.isArray(i[t]))return false;var a=dotSplit(t);var h=i;var c=a.pop();var l=c.replace(/\\\./g,".");a.forEach((function(t,i,r){if(t==="__proto__")return;if(!h[t]||typeof h[t]!=="object")h[t]={};h=h[t]}));if(h===i&&l===c)return false;h[l]=i[t];return true})).forEach((function(t,r,o){delete i[t]}));return i}function isQuoted(t){return t.charAt(0)==='"'&&t.slice(-1)==='"'||t.charAt(0)==="'"&&t.slice(-1)==="'"}function safe(t){return typeof t!=="string"||t.match(/[=\r\n]/)||t.match(/^\[/)||t.length>1&&isQuoted(t)||t!==t.trim()?JSON.stringify(t):t.replace(/;/g,"\\;").replace(/#/g,"\\#")}function unsafe(t,i){t=(t||"").trim();if(isQuoted(t)){if(t.charAt(0)==="'")t=t.substr(1,t.length-2);try{t=JSON.parse(t)}catch(t){}}else{var r=false;var o="";for(var a=0,h=t.length;a<h;a++){var c=t.charAt(a);if(r){if("\\;#".indexOf(c)!==-1)o+=c;else o+="\\"+c;r=false}else if(";#".indexOf(c)!==-1)break;else if(c==="\\")r=true;else o+=c}if(r)o+="\\";return o.trim()}return t}},2476:(t,i,r)=>{let o;try{o=r(8806)}catch(t){o=r(9896)}const a=r(4124);const{stringify:h,stripBom:c}=r(565);async function _readFile(t,i={}){if(typeof i==="string"){i={encoding:i}}const r=i.fs||o;const h="throws"in i?i.throws:true;let l=await a.fromCallback(r.readFile)(t,i);l=c(l);let u;try{u=JSON.parse(l,i?i.reviver:null)}catch(i){if(h){i.message=`${t}: ${i.message}`;throw i}else{return null}}return u}const l=a.fromPromise(_readFile);function readFileSync(t,i={}){if(typeof i==="string"){i={encoding:i}}const r=i.fs||o;const a="throws"in i?i.throws:true;try{let o=r.readFileSync(t,i);o=c(o);return JSON.parse(o,i.reviver)}catch(i){if(a){i.message=`${t}: ${i.message}`;throw i}else{return null}}}async function _writeFile(t,i,r={}){const c=r.fs||o;const l=h(i,r);await a.fromCallback(c.writeFile)(t,l,r)}const u=a.fromPromise(_writeFile);function writeFileSync(t,i,r={}){const a=r.fs||o;const c=h(i,r);return a.writeFileSync(t,c,r)}const d={readFile:l,readFileSync:readFileSync,writeFile:u,writeFileSync:writeFileSync};t.exports=d},565:t=>{function stringify(t,{EOL:i="\n",finalEOL:r=true,replacer:o=null,spaces:a}={}){const h=r?i:"";const c=JSON.stringify(t,o,a);return c.replace(/\n/g,i)+h}function stripBom(t){if(Buffer.isBuffer(t))t=t.toString("utf8");return t.replace(/^\uFEFF/,"")}t.exports={stringify:stringify,stripBom:stripBom}},9727:t=>{const{FORCE_COLOR:i,NODE_DISABLE_COLORS:r,TERM:o}=process.env;const a={enabled:!r&&o!=="dumb"&&i!=="0",reset:init(0,0),bold:init(1,22),dim:init(2,22),italic:init(3,23),underline:init(4,24),inverse:init(7,27),hidden:init(8,28),strikethrough:init(9,29),black:init(30,39),red:init(31,39),green:init(32,39),yellow:init(33,39),blue:init(34,39),magenta:init(35,39),cyan:init(36,39),white:init(37,39),gray:init(90,39),grey:init(90,39),bgBlack:init(40,49),bgRed:init(41,49),bgGreen:init(42,49),bgYellow:init(43,49),bgBlue:init(44,49),bgMagenta:init(45,49),bgCyan:init(46,49),bgWhite:init(47,49)};function run(t,i){let r=0,o,a="",h="";for(;r<t.length;r++){o=t[r];a+=o.open;h+=o.close;if(i.includes(o.close)){i=i.replace(o.rgx,o.close+o.open)}}return a+i+h}function chain(t,i){let r={has:t,keys:i};r.reset=a.reset.bind(r);r.bold=a.bold.bind(r);r.dim=a.dim.bind(r);r.italic=a.italic.bind(r);r.underline=a.underline.bind(r);r.inverse=a.inverse.bind(r);r.hidden=a.hidden.bind(r);r.strikethrough=a.strikethrough.bind(r);r.black=a.black.bind(r);r.red=a.red.bind(r);r.green=a.green.bind(r);r.yellow=a.yellow.bind(r);r.blue=a.blue.bind(r);r.magenta=a.magenta.bind(r);r.cyan=a.cyan.bind(r);r.white=a.white.bind(r);r.gray=a.gray.bind(r);r.grey=a.grey.bind(r);r.bgBlack=a.bgBlack.bind(r);r.bgRed=a.bgRed.bind(r);r.bgGreen=a.bgGreen.bind(r);r.bgYellow=a.bgYellow.bind(r);r.bgBlue=a.bgBlue.bind(r);r.bgMagenta=a.bgMagenta.bind(r);r.bgCyan=a.bgCyan.bind(r);r.bgWhite=a.bgWhite.bind(r);return r}function init(t,i){let r={open:`[${t}m`,close:`[${i}m`,rgx:new RegExp(`\\x1b\\[${i}m`,"g")};return function(i){if(this!==void 0&&this.has!==void 0){this.has.includes(t)||(this.has.push(t),this.keys.push(r));return i===void 0?this:a.enabled?run(this.keys,i+""):i+""}return i===void 0?chain([t],[r]):a.enabled?run([r],i+""):i+""}}t.exports=a},7688:t=>{function hasKey(t,i){var r=t;i.slice(0,-1).forEach((function(t){r=r[t]||{}}));var o=i[i.length-1];return o in r}function isNumber(t){if(typeof t==="number"){return true}if(/^0x[0-9a-f]+$/i.test(t)){return true}return/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function isConstructorOrProto(t,i){return i==="constructor"&&typeof t[i]==="function"||i==="__proto__"}t.exports=function(t,i){if(!i){i={}}var r={bools:{},strings:{},unknownFn:null};if(typeof i.unknown==="function"){r.unknownFn=i.unknown}if(typeof i.boolean==="boolean"&&i.boolean){r.allBools=true}else{[].concat(i.boolean).filter(Boolean).forEach((function(t){r.bools[t]=true}))}var o={};function aliasIsBoolean(t){return o[t].some((function(t){return r.bools[t]}))}Object.keys(i.alias||{}).forEach((function(t){o[t]=[].concat(i.alias[t]);o[t].forEach((function(i){o[i]=[t].concat(o[t].filter((function(t){return i!==t})))}))}));[].concat(i.string).filter(Boolean).forEach((function(t){r.strings[t]=true;if(o[t]){[].concat(o[t]).forEach((function(t){r.strings[t]=true}))}}));var a=i.default||{};var h={_:[]};function argDefined(t,i){return r.allBools&&/^--[^=]+$/.test(i)||r.strings[t]||r.bools[t]||o[t]}function setKey(t,i,o){var a=t;for(var h=0;h<i.length-1;h++){var c=i[h];if(isConstructorOrProto(a,c)){return}if(a[c]===undefined){a[c]={}}if(a[c]===Object.prototype||a[c]===Number.prototype||a[c]===String.prototype){a[c]={}}if(a[c]===Array.prototype){a[c]=[]}a=a[c]}var l=i[i.length-1];if(isConstructorOrProto(a,l)){return}if(a===Object.prototype||a===Number.prototype||a===String.prototype){a={}}if(a===Array.prototype){a=[]}if(a[l]===undefined||r.bools[l]||typeof a[l]==="boolean"){a[l]=o}else if(Array.isArray(a[l])){a[l].push(o)}else{a[l]=[a[l],o]}}function setArg(t,i,a){if(a&&r.unknownFn&&!argDefined(t,a)){if(r.unknownFn(a)===false){return}}var c=!r.strings[t]&&isNumber(i)?Number(i):i;setKey(h,t.split("."),c);(o[t]||[]).forEach((function(t){setKey(h,t.split("."),c)}))}Object.keys(r.bools).forEach((function(t){setArg(t,a[t]===undefined?false:a[t])}));var c=[];if(t.indexOf("--")!==-1){c=t.slice(t.indexOf("--")+1);t=t.slice(0,t.indexOf("--"))}for(var l=0;l<t.length;l++){var u=t[l];var d;var p;if(/^--.+=/.test(u)){var m=u.match(/^--([^=]+)=([\s\S]*)$/);d=m[1];var y=m[2];if(r.bools[d]){y=y!=="false"}setArg(d,y,u)}else if(/^--no-.+/.test(u)){d=u.match(/^--no-(.+)/)[1];setArg(d,false,u)}else if(/^--.+/.test(u)){d=u.match(/^--(.+)/)[1];p=t[l+1];if(p!==undefined&&!/^(-|--)[^-]/.test(p)&&!r.bools[d]&&!r.allBools&&(o[d]?!aliasIsBoolean(d):true)){setArg(d,p,u);l+=1}else if(/^(true|false)$/.test(p)){setArg(d,p==="true",u);l+=1}else{setArg(d,r.strings[d]?"":true,u)}}else if(/^-[^-]+/.test(u)){var g=u.slice(1,-1).split("");var b=false;for(var w=0;w<g.length;w++){p=u.slice(w+2);if(p==="-"){setArg(g[w],p,u);continue}if(/[A-Za-z]/.test(g[w])&&p[0]==="="){setArg(g[w],p.slice(1),u);b=true;break}if(/[A-Za-z]/.test(g[w])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(p)){setArg(g[w],p,u);b=true;break}if(g[w+1]&&g[w+1].match(/\W/)){setArg(g[w],u.slice(w+2),u);b=true;break}else{setArg(g[w],r.strings[g[w]]?"":true,u)}}d=u.slice(-1)[0];if(!b&&d!=="-"){if(t[l+1]&&!/^(-|--)[^-]/.test(t[l+1])&&!r.bools[d]&&(o[d]?!aliasIsBoolean(d):true)){setArg(d,t[l+1],u);l+=1}else if(t[l+1]&&/^(true|false)$/.test(t[l+1])){setArg(d,t[l+1]==="true",u);l+=1}else{setArg(d,r.strings[d]?"":true,u)}}}else{if(!r.unknownFn||r.unknownFn(u)!==false){h._.push(r.strings._||!isNumber(u)?u:Number(u))}if(i.stopEarly){h._.push.apply(h._,t.slice(l+1));break}}}Object.keys(a).forEach((function(t){if(!hasKey(h,t.split("."))){setKey(h,t.split("."),a[t]);(o[t]||[]).forEach((function(i){setKey(h,i.split("."),a[t])}))}}));if(i["--"]){h["--"]=c.slice()}else{c.forEach((function(t){h._.push(t)}))}return h}},5348:t=>{class DatePart{constructor({token:t,date:i,parts:r,locales:o}){this.token=t;this.date=i||new Date;this.parts=r||[this];this.locales=o||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((i,r)=>r>t&&i instanceof DatePart))}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const i=t.indexOf(this);return t.find(((t,r)=>r>i&&t instanceof DatePart))}toString(){return String(this.date)}}t.exports=DatePart},4935:(t,i,r)=>{const o=r(5348);const pos=t=>{t=t%10;return t===1?"st":t===2?"nd":t===3?"rd":"th"};class Day extends o{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate();let i=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+pos(t):this.token==="d"?i+1:this.token==="ddd"?this.locales.weekdaysShort[i]:this.token==="dddd"?this.locales.weekdays[i]:t}}t.exports=Day},3810:(t,i,r)=>{const o=r(5348);class Hours extends o{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();if(/h/.test(this.token))t=t%12||12;return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Hours},7865:(t,i,r)=>{t.exports={DatePart:r(5348),Meridiem:r(2555),Day:r(4935),Hours:r(3810),Milliseconds:r(4923),Minutes:r(1028),Month:r(6395),Seconds:r(2212),Year:r(1820)}},2555:(t,i,r)=>{const o=r(5348);class Meridiem extends o{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}t.exports=Meridiem},4923:(t,i,r)=>{const o=r(5348);class Milliseconds extends o{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}t.exports=Milliseconds},1028:(t,i,r)=>{const o=r(5348);class Minutes extends o{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Minutes},6395:(t,i,r)=>{const o=r(5348);class Month extends o{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth();let i=this.token.length;return i===2?String(t+1).padStart(2,"0"):i===3?this.locales.monthsShort[t]:i===4?this.locales.months[t]:String(t+1)}}t.exports=Month},2212:(t,i,r)=>{const o=r(5348);class Seconds extends o{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Seconds},1820:(t,i,r)=>{const o=r(5348);class Year extends o{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}t.exports=Year},2962:(t,i,r)=>{function asyncGeneratorStep(t,i,r,o,a,h,c){try{var l=t[h](c);var u=l.value}catch(t){r(t);return}if(l.done){i(u)}else{Promise.resolve(u).then(o,a)}}function _asyncToGenerator(t){return function(){var i=this,r=arguments;return new Promise((function(o,a){var h=t.apply(i,r);function _next(t){asyncGeneratorStep(h,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(h,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=r(9727);const a=r(7700);const h=r(5424),c=h.erase,l=h.cursor;const u=r(6601),d=u.style,p=u.clear,m=u.figures,y=u.wrap,g=u.entriesToDisplay;const getVal=(t,i)=>t[i]&&(t[i].value||t[i].title||t[i]);const getTitle=(t,i)=>t[i]&&(t[i].title||t[i].value||t[i]);const getIndex=(t,i)=>{const r=t.findIndex((t=>t.value===i||t.title===i));return r>-1?r:undefined};class AutocompletePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.suggest=t.suggest;this.choices=t.choices;this.initial=typeof t.initial==="number"?t.initial:getIndex(t.choices,t.initial);this.select=this.initial||t.cursor||0;this.i18n={noMatches:t.noMatches||"no matches found"};this.fallback=t.fallback||this.initial;this.clearFirst=t.clearFirst||false;this.suggestions=[];this.input="";this.limit=t.limit||10;this.cursor=0;this.transform=d.render(t.style);this.scale=this.transform.scale;this.render=this.render.bind(this);this.complete=this.complete.bind(this);this.clear=p("",this.out.columns);this.complete(this.render);this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;if(typeof this._fb==="number")t=this.choices[this._fb];else if(typeof this._fb==="string")t={title:this._fb};return t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t;if(this.suggestions.length>0)this.value=getVal(this.suggestions,t);else this.value=this.fallback.value;this.fire()}complete(t){var i=this;return _asyncToGenerator((function*(){const r=i.completing=i.suggest(i.input,i.choices);const o=yield r;if(i.completing!==r)return;i.suggestions=o.map(((t,i,r)=>({title:getTitle(r,i),value:getVal(r,i),description:t.description})));i.completing=false;const a=Math.max(o.length-1,0);i.moveSelect(Math.min(a,i.select));t&&t()}))()}reset(){this.input="";this.complete((()=>{this.moveSelect(this.initial!==void 0?this.initial:0);this.render()}));this.render()}exit(){if(this.clearFirst&&this.input.length>0){this.reset()}else{this.done=this.exited=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}}abort(){this.done=this.aborted=true;this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,i){let r=this.input.slice(0,this.cursor);let o=this.input.slice(this.cursor);this.input=`${r}${t}${o}`;this.cursor=r.length+1;this.complete(this.render);this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1);let i=this.input.slice(this.cursor);this.input=`${t}${i}`;this.complete(this.render);this.cursor=this.cursor-1;this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor);let i=this.input.slice(this.cursor+1);this.input=`${t}${i}`;this.complete(this.render);this.render()}first(){this.moveSelect(0);this.render()}last(){this.moveSelect(this.suggestions.length-1);this.render()}up(){if(this.select===0){this.moveSelect(this.suggestions.length-1)}else{this.moveSelect(this.select-1)}this.render()}down(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else{this.moveSelect(this.select+1)}this.render()}next(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1));this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0));this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1;this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1;this.render()}renderOption(t,i,r,a){let h;let c=r?m.arrowUp:a?m.arrowDown:" ";let l=i?o.cyan().underline(t.title):t.title;c=(i?o.cyan(m.pointer)+" ":" ")+c;if(t.description){h=` - ${t.description}`;if(c.length+l.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1){h="\n"+y(t.description,{margin:3,width:this.out.columns})}}return c+" "+l+o.gray(h||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(l.hide);else this.out.write(p(this.outputText,this.out.columns));super.render();let t=g(this.select,this.choices.length,this.limit),i=t.startIndex,r=t.endIndex;this.outputText=[d.symbol(this.done,this.aborted,this.exited),o.bold(this.msg),d.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" ");if(!this.done){const t=this.suggestions.slice(i,r).map(((t,o)=>this.renderOption(t,this.select===o+i,o===0&&i>0,o+i===r-1&&r<this.choices.length))).join("\n");this.outputText+=`\n`+(t||o.gray(this.fallback.title))}this.out.write(c.line+l.to(0)+this.outputText)}}t.exports=AutocompletePrompt},3513:(t,i,r)=>{const o=r(9727);const a=r(5424),h=a.cursor;const c=r(7281);const l=r(6601),u=l.clear,d=l.style,p=l.figures;class AutocompleteMultiselectPrompt extends c{constructor(t={}){t.overrideRender=true;super(t);this.inputValue="";this.clear=u("",this.out.columns);this.filteredOptions=this.value;this.render()}last(){this.cursor=this.filteredOptions.length-1;this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length;this.render()}up(){if(this.cursor===0){this.cursor=this.filteredOptions.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.filteredOptions.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.filteredOptions[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true;this.render()}delete(){if(this.inputValue.length){this.inputValue=this.inputValue.substr(0,this.inputValue.length-1);this.updateFilteredOptions()}}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((t=>{if(this.inputValue){if(typeof t.title==="string"){if(t.title.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}if(typeof t.value==="string"){if(t.value.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}return false}return true}));const i=this.filteredOptions.findIndex((i=>i===t));this.cursor=i<0?0:i;this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t;this.updateFilteredOptions()}_(t,i){if(t===" "){this.handleSpaceToggle()}else{this.handleInputChange(t)}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return`\nInstructions:\n ${p.arrowUp}/${p.arrowDown}: Highlight option\n ${p.arrowLeft}/${p.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`}return""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:o.gray("Enter something to filter")}\n`}renderOption(t,i,r){let a;if(i.disabled)a=t===r?o.gray().underline(i.title):o.strikethrough().gray(i.title);else a=t===r?o.cyan().underline(i.title):i.title;return(i.selected?o.green(p.radioOn):p.radioOff)+" "+a}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(h.hide);super.render();let t=[d.symbol(this.done,this.aborted),o.bold(this.msg),d.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.filteredOptions);this.out.write(this.clear+t);this.clear=u(t,this.out.columns)}}t.exports=AutocompleteMultiselectPrompt},128:(t,i,r)=>{const o=r(9727);const a=r(7700);const h=r(6601),c=h.style,l=h.clear;const u=r(5424),d=u.erase,p=u.cursor;class ConfirmPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=t.initial;this.initialValue=!!t.initial;this.yesMsg=t.yes||"yes";this.yesOption=t.yesOption||"(Y/n)";this.noMsg=t.no||"no";this.noOption=t.noOption||"(y/N)";this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.value=this.value||false;this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,i){if(t.toLowerCase()==="y"){this.value=true;return this.submit()}if(t.toLowerCase()==="n"){this.value=false;return this.submit()}return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(p.hide);else this.out.write(l(this.outputText,this.out.columns));super.render();this.outputText=[c.symbol(this.done,this.aborted),o.bold(this.msg),c.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:o.gray(this.initialValue?this.yesOption:this.noOption)].join(" ");this.out.write(d.line+p.to(0)+this.outputText)}}t.exports=ConfirmPrompt},5094:(t,i,r)=>{function asyncGeneratorStep(t,i,r,o,a,h,c){try{var l=t[h](c);var u=l.value}catch(t){r(t);return}if(l.done){i(u)}else{Promise.resolve(u).then(o,a)}}function _asyncToGenerator(t){return function(){var i=this,r=arguments;return new Promise((function(o,a){var h=t.apply(i,r);function _next(t){asyncGeneratorStep(h,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(h,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=r(9727);const a=r(7700);const h=r(6601),c=h.style,l=h.clear,u=h.figures;const d=r(5424),p=d.erase,m=d.cursor;const y=r(7865),g=y.DatePart,b=y.Meridiem,w=y.Day,v=y.Hours,S=y.Milliseconds,E=y.Minutes,_=y.Month,x=y.Seconds,k=y.Year;const O=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;const R={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new w(t),3:t=>new _(t),4:t=>new k(t),5:t=>new b(t),6:t=>new v(t),7:t=>new E(t),8:t=>new x(t),9:t=>new S(t)};const T={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class DatePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.cursor=0;this.typed="";this.locales=Object.assign(T,t.locales);this._date=t.initial||new Date;this.errorMsg=t.error||"Please Enter A Valid Value";this.validator=t.validate||(()=>true);this.mask=t.mask||"YYYY-MM-DD HH:mm:ss";this.clear=l("",this.out.columns);this.render()}get value(){return this.date}get date(){return this._date}set date(t){if(t)this._date.setTime(t.getTime())}set mask(t){let i;this.parts=[];while(i=O.exec(t)){let t=i.shift();let r=i.findIndex((t=>t!=null));this.parts.push(r in R?R[r]({token:i[r]||t,date:this.date,parts:this.parts,locales:this.locales}):i[r]||t)}let r=this.parts.reduce(((t,i)=>{if(typeof i==="string"&&typeof t[t.length-1]==="string")t[t.length-1]+=i;else t.push(i);return t}),[]);this.parts.splice(0);this.parts.push(...r);this.reset()}moveCursor(t){this.typed="";this.cursor=t;this.fire()}reset(){this.moveCursor(this.parts.findIndex((t=>t instanceof g)));this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write("\n");this.close()}validate(){var t=this;return _asyncToGenerator((function*(){let i=yield t.validator(t.value);if(typeof i==="string"){t.errorMsg=i;i=false}t.error=!i}))()}submit(){var t=this;return _asyncToGenerator((function*(){yield t.validate();if(t.error){t.color="red";t.fire();t.render();return}t.done=true;t.aborted=false;t.fire();t.render();t.out.write("\n");t.close()}))()}up(){this.typed="";this.parts[this.cursor].up();this.render()}down(){this.typed="";this.parts[this.cursor].down();this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex((t=>t instanceof g)));this.render()}_(t){if(/\d/.test(t)){this.typed+=t;this.parts[this.cursor].setTo(this.typed);this.render()}}render(){if(this.closed)return;if(this.firstRender)this.out.write(m.hide);else this.out.write(l(this.outputText,this.out.columns));super.render();this.outputText=[c.symbol(this.done,this.aborted),o.bold(this.msg),c.delimiter(false),this.parts.reduce(((t,i,r)=>t.concat(r===this.cursor&&!this.done?o.cyan().underline(i.toString()):i)),[]).join("")].join(" ");if(this.error){this.outputText+=this.errorMsg.split("\n").reduce(((t,i,r)=>t+`\n${r?` `:u.pointerSmall} ${o.red().italic(i)}`),``)}this.out.write(p.line+m.to(0)+this.outputText)}}t.exports=DatePrompt},5188:(t,i,r)=>{t.exports={TextPrompt:r(9581),SelectPrompt:r(306),TogglePrompt:r(170),DatePrompt:r(5094),NumberPrompt:r(6707),MultiselectPrompt:r(7281),AutocompletePrompt:r(2962),AutocompleteMultiselectPrompt:r(3513),ConfirmPrompt:r(128)}},7281:(t,i,r)=>{const o=r(9727);const a=r(5424),h=a.cursor;const c=r(7700);const l=r(6601),u=l.clear,d=l.figures,p=l.style,m=l.wrap,y=l.entriesToDisplay;class MultiselectPrompt extends c{constructor(t={}){super(t);this.msg=t.message;this.cursor=t.cursor||0;this.scrollIndex=t.cursor||0;this.hint=t.hint||"";this.warn=t.warn||"- This option is disabled -";this.minSelected=t.min;this.showMinError=false;this.maxChoices=t.max;this.instructions=t.instructions;this.optionsPerPage=t.optionsPerPage||10;this.value=t.choices.map(((t,i)=>{if(typeof t==="string")t={title:t,value:i};return{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===undefined?i:t.value),selected:t&&t.selected,disabled:t&&t.disabled}}));this.clear=u("",this.out.columns);if(!t.overrideRender){this.render()}}reset(){this.value.map((t=>!t.selected));this.cursor=0;this.fire();this.render()}selected(){return this.value.filter((t=>t.selected))}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){const t=this.value.filter((t=>t.selected));if(this.minSelected&&t.length<this.minSelected){this.showMinError=true;this.render()}else{this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}}first(){this.cursor=0;this.render()}last(){this.cursor=this.value.length-1;this.render()}next(){this.cursor=(this.cursor+1)%this.value.length;this.render()}up(){if(this.cursor===0){this.cursor=this.value.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.value.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.value[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true;this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}toggleAll(){if(this.maxChoices!==undefined||this.value[this.cursor].disabled){return this.bell()}const t=!this.value[this.cursor].selected;this.value.filter((t=>!t.disabled)).forEach((i=>i.selected=t));this.render()}_(t,i){if(t===" "){this.handleSpaceToggle()}else if(t==="a"){this.toggleAll()}else{return this.bell()}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return"\nInstructions:\n"+` ${d.arrowUp}/${d.arrowDown}: Highlight option\n`+` ${d.arrowLeft}/${d.arrowRight}/[space]: Toggle selection\n`+(this.maxChoices===undefined?` a: Toggle all\n`:"")+` enter/return: Complete answer`}return""}renderOption(t,i,r,a){const h=(i.selected?o.green(d.radioOn):d.radioOff)+" "+a+" ";let c,l;if(i.disabled){c=t===r?o.gray().underline(i.title):o.strikethrough().gray(i.title)}else{c=t===r?o.cyan().underline(i.title):i.title;if(t===r&&i.description){l=` - ${i.description}`;if(h.length+c.length+l.length>=this.out.columns||i.description.split(/\r?\n/).length>1){l="\n"+m(i.description,{margin:h.length,width:this.out.columns})}}}return h+c+o.gray(l||"")}paginateOptions(t){if(t.length===0){return o.red("No matches for this query.")}let i=y(this.cursor,t.length,this.optionsPerPage),r=i.startIndex,a=i.endIndex;let h,c=[];for(let i=r;i<a;i++){if(i===r&&r>0){h=d.arrowUp}else if(i===a-1&&a<t.length){h=d.arrowDown}else{h=" "}c.push(this.renderOption(this.cursor,t[i],i,h))}return"\n"+c.join("\n")}renderOptions(t){if(!this.done){return this.paginateOptions(t)}return""}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(h.hide);super.render();let t=[p.symbol(this.done,this.aborted),o.bold(this.msg),p.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.value);this.out.write(this.clear+t);this.clear=u(t,this.out.columns)}}t.exports=MultiselectPrompt},6707:(t,i,r)=>{function asyncGeneratorStep(t,i,r,o,a,h,c){try{var l=t[h](c);var u=l.value}catch(t){r(t);return}if(l.done){i(u)}else{Promise.resolve(u).then(o,a)}}function _asyncToGenerator(t){return function(){var i=this,r=arguments;return new Promise((function(o,a){var h=t.apply(i,r);function _next(t){asyncGeneratorStep(h,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(h,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=r(9727);const a=r(7700);const h=r(5424),c=h.cursor,l=h.erase;const u=r(6601),d=u.style,p=u.figures,m=u.clear,y=u.lines;const g=/[0-9]/;const isDef=t=>t!==undefined;const round=(t,i)=>{let r=Math.pow(10,i);return Math.round(t*r)/r};class NumberPrompt extends a{constructor(t={}){super(t);this.transform=d.render(t.style);this.msg=t.message;this.initial=isDef(t.initial)?t.initial:"";this.float=!!t.float;this.round=t.round||2;this.inc=t.increment||1;this.min=isDef(t.min)?t.min:-Infinity;this.max=isDef(t.max)?t.max:Infinity;this.errorMsg=t.error||`Please Enter A Valid Value`;this.validator=t.validate||(()=>true);this.color=`cyan`;this.value=``;this.typed=``;this.lastHit=0;this.render()}set value(t){if(!t&&t!==0){this.placeholder=true;this.rendered=o.gray(this.transform.render(`${this.initial}`));this._value=``}else{this.placeholder=false;this.rendered=this.transform.render(`${round(t,this.round)}`);this._value=round(t,this.round)}this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t===`-`||t===`.`&&this.float||g.test(t)}reset(){this.typed=``;this.value=``;this.fire();this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==``?t:this.initial;this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}validate(){var t=this;return _asyncToGenerator((function*(){let i=yield t.validator(t.value);if(typeof i===`string`){t.errorMsg=i;i=false}t.error=!i}))()}submit(){var t=this;return _asyncToGenerator((function*(){yield t.validate();if(t.error){t.color=`red`;t.fire();t.render();return}let i=t.value;t.value=i!==``?i:t.initial;t.done=true;t.aborted=false;t.error=false;t.fire();t.render();t.out.write(`\n`);t.close()}))()}up(){this.typed=``;if(this.value===""){this.value=this.min-this.inc}if(this.value>=this.max)return this.bell();this.value+=this.inc;this.color=`cyan`;this.fire();this.render()}down(){this.typed=``;if(this.value===""){this.value=this.min+this.inc}if(this.value<=this.min)return this.bell();this.value-=this.inc;this.color=`cyan`;this.fire();this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||``;if(this.value!==""&&this.value<this.min){this.value=this.min}this.color=`cyan`;this.fire();this.render()}next(){this.value=this.initial;this.fire();this.render()}_(t,i){if(!this.valid(t))return this.bell();const r=Date.now();if(r-this.lastHit>1e3)this.typed=``;this.typed+=t;this.lastHit=r;this.color=`cyan`;if(t===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max);if(this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire();this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(c.down(y(this.outputError,this.out.columns)-1)+m(this.outputError,this.out.columns));this.out.write(m(this.outputText,this.out.columns))}super.render();this.outputError="";this.outputText=[d.symbol(this.done,this.aborted),o.bold(this.msg),d.delimiter(this.done),!this.done||!this.done&&!this.placeholder?o[this.color]().underline(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,i,r)=>t+`\n${r?` `:p.pointerSmall} ${o.red().italic(i)}`),``)}this.out.write(l.line+c.to(0)+this.outputText+c.save+this.outputError+c.restore)}}t.exports=NumberPrompt},7700:(t,i,r)=>{const o=r(3785);const a=r(6601),h=a.action;const c=r(4434);const l=r(5424),u=l.beep,d=l.cursor;const p=r(9727);class Prompt extends c{constructor(t={}){super();this.firstRender=true;this.in=t.stdin||process.stdin;this.out=t.stdout||process.stdout;this.onRender=(t.onRender||(()=>void 0)).bind(this);const i=o.createInterface({input:this.in,escapeCodeTimeout:50});o.emitKeypressEvents(this.in,i);if(this.in.isTTY)this.in.setRawMode(true);const r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1;const keypress=(t,i)=>{let o=h(i,r);if(o===false){this._&&this._(t,i)}else if(typeof this[o]==="function"){this[o](i)}else{this.bell()}};this.close=()=>{this.out.write(d.show);this.in.removeListener("keypress",keypress);if(this.in.isTTY)this.in.setRawMode(false);i.close();this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value);this.closed=true};this.in.on("keypress",keypress)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(u)}render(){this.onRender(p);if(this.firstRender)this.firstRender=false}}t.exports=Prompt},306:(t,i,r)=>{const o=r(9727);const a=r(7700);const h=r(6601),c=h.style,l=h.clear,u=h.figures,d=h.wrap,p=h.entriesToDisplay;const m=r(5424),y=m.cursor;class SelectPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.hint=t.hint||"- Use arrow-keys. Return to submit.";this.warn=t.warn||"- This option is disabled";this.cursor=t.initial||0;this.choices=t.choices.map(((t,i)=>{if(typeof t==="string")t={title:t,value:i};return{title:t&&(t.title||t.value||t),value:t&&(t.value===undefined?i:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled}}));this.optionsPerPage=t.optionsPerPage||10;this.value=(this.choices[this.cursor]||{}).value;this.clear=l("",this.out.columns);this.render()}moveCursor(t){this.cursor=t;this.value=this.choices[t].value;this.fire()}reset(){this.moveCursor(0);this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){if(!this.selection.disabled){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}else this.bell()}first(){this.moveCursor(0);this.render()}last(){this.moveCursor(this.choices.length-1);this.render()}up(){if(this.cursor===0){this.moveCursor(this.choices.length-1)}else{this.moveCursor(this.cursor-1)}this.render()}down(){if(this.cursor===this.choices.length-1){this.moveCursor(0)}else{this.moveCursor(this.cursor+1)}this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length);this.render()}_(t,i){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(y.hide);else this.out.write(l(this.outputText,this.out.columns));super.render();let t=p(this.cursor,this.choices.length,this.optionsPerPage),i=t.startIndex,r=t.endIndex;this.outputText=[c.symbol(this.done,this.aborted),o.bold(this.msg),c.delimiter(false),this.done?this.selection.title:this.selection.disabled?o.yellow(this.warn):o.gray(this.hint)].join(" ");if(!this.done){this.outputText+="\n";for(let t=i;t<r;t++){let a,h,c="",l=this.choices[t];if(t===i&&i>0){h=u.arrowUp}else if(t===r-1&&r<this.choices.length){h=u.arrowDown}else{h=" "}if(l.disabled){a=this.cursor===t?o.gray().underline(l.title):o.strikethrough().gray(l.title);h=(this.cursor===t?o.bold().gray(u.pointer)+" ":" ")+h}else{a=this.cursor===t?o.cyan().underline(l.title):l.title;h=(this.cursor===t?o.cyan(u.pointer)+" ":" ")+h;if(l.description&&this.cursor===t){c=` - ${l.description}`;if(h.length+a.length+c.length>=this.out.columns||l.description.split(/\r?\n/).length>1){c="\n"+d(l.description,{margin:3,width:this.out.columns})}}}this.outputText+=`${h} ${a}${o.gray(c)}\n`}}this.out.write(this.outputText)}}t.exports=SelectPrompt},9581:(t,i,r)=>{function asyncGeneratorStep(t,i,r,o,a,h,c){try{var l=t[h](c);var u=l.value}catch(t){r(t);return}if(l.done){i(u)}else{Promise.resolve(u).then(o,a)}}function _asyncToGenerator(t){return function(){var i=this,r=arguments;return new Promise((function(o,a){var h=t.apply(i,r);function _next(t){asyncGeneratorStep(h,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(h,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=r(9727);const a=r(7700);const h=r(5424),c=h.erase,l=h.cursor;const u=r(6601),d=u.style,p=u.clear,m=u.lines,y=u.figures;class TextPrompt extends a{constructor(t={}){super(t);this.transform=d.render(t.style);this.scale=this.transform.scale;this.msg=t.message;this.initial=t.initial||``;this.validator=t.validate||(()=>true);this.value=``;this.errorMsg=t.error||`Please Enter A Valid Value`;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.clear=p(``,this.out.columns);this.render()}set value(t){if(!t&&this.initial){this.placeholder=true;this.rendered=o.gray(this.transform.render(this.initial))}else{this.placeholder=false;this.rendered=this.transform.render(t)}this._value=t;this.fire()}get value(){return this._value}reset(){this.value=``;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.fire();this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial;this.done=this.aborted=true;this.error=false;this.red=false;this.fire();this.render();this.out.write("\n");this.close()}validate(){var t=this;return _asyncToGenerator((function*(){let i=yield t.validator(t.value);if(typeof i===`string`){t.errorMsg=i;i=false}t.error=!i}))()}submit(){var t=this;return _asyncToGenerator((function*(){t.value=t.value||t.initial;t.cursorOffset=0;t.cursor=t.rendered.length;yield t.validate();if(t.error){t.red=true;t.fire();t.render();return}t.done=true;t.aborted=false;t.fire();t.render();t.out.write("\n");t.close()}))()}next(){if(!this.placeholder)return this.bell();this.value=this.initial;this.cursor=this.rendered.length;this.fire();this.render()}moveCursor(t){if(this.placeholder)return;this.cursor=this.cursor+t;this.cursorOffset+=t}_(t,i){let r=this.value.slice(0,this.cursor);let o=this.value.slice(this.cursor);this.value=`${r}${t}${o}`;this.red=false;this.cursor=this.placeholder?0:r.length+1;this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1);let i=this.value.slice(this.cursor);this.value=`${t}${i}`;this.red=false;if(this.isCursorAtStart()){this.cursorOffset=0}else{this.cursorOffset++;this.moveCursor(-1)}this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor);let i=this.value.slice(this.cursor+1);this.value=`${t}${i}`;this.red=false;if(this.isCursorAtEnd()){this.cursorOffset=0}else{this.cursorOffset++}this.render()}first(){this.cursor=0;this.render()}last(){this.cursor=this.value.length;this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1);this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1);this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(l.down(m(this.outputError,this.out.columns)-1)+p(this.outputError,this.out.columns));this.out.write(p(this.outputText,this.out.columns))}super.render();this.outputError="";this.outputText=[d.symbol(this.done,this.aborted),o.bold(this.msg),d.delimiter(this.done),this.red?o.red(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,i,r)=>t+`\n${r?" ":y.pointerSmall} ${o.red().italic(i)}`),``)}this.out.write(c.line+l.to(0)+this.outputText+l.save+this.outputError+l.restore+l.move(this.cursorOffset,0))}}t.exports=TextPrompt},170:(t,i,r)=>{const o=r(9727);const a=r(7700);const h=r(6601),c=h.style,l=h.clear;const u=r(5424),d=u.cursor,p=u.erase;class TogglePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=!!t.initial;this.active=t.active||"on";this.inactive=t.inactive||"off";this.initialValue=this.value;this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}deactivate(){if(this.value===false)return this.bell();this.value=false;this.render()}activate(){if(this.value===true)return this.bell();this.value=true;this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value;this.fire();this.render()}_(t,i){if(t===" "){this.value=!this.value}else if(t==="1"){this.value=true}else if(t==="0"){this.value=false}else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(d.hide);else this.out.write(l(this.outputText,this.out.columns));super.render();this.outputText=[c.symbol(this.done,this.aborted),o.bold(this.msg),c.delimiter(this.done),this.value?this.inactive:o.cyan().underline(this.inactive),o.gray("/"),this.value?o.cyan().underline(this.active):this.active].join(" ");this.out.write(p.line+d.to(0)+this.outputText)}}t.exports=TogglePrompt},6528:(t,i,r)=>{function ownKeys(t,i){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);if(i){o=o.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))}r.push.apply(r,o)}return r}function _objectSpread(t){for(var i=1;i<arguments.length;i++){var r=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(r),true).forEach((function(i){_defineProperty(t,i,r[i])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))}else{ownKeys(Object(r)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))}))}}return t}function _defineProperty(t,i,r){if(i in t){Object.defineProperty(t,i,{value:r,enumerable:true,configurable:true,writable:true})}else{t[i]=r}return t}function _createForOfIteratorHelper(t,i){var r=typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_unsupportedIterableToArray(t))||i&&t&&typeof t.length==="number"){if(r)t=r;var o=0;var a=function F(){};return{s:a,n:function n(){if(o>=t.length)return{done:true};return{done:false,value:t[o++]}},e:function e(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h=true,c=false,l;return{s:function s(){r=r.call(t)},n:function n(){var t=r.next();h=t.done;return t},e:function e(t){c=true;l=t},f:function f(){try{if(!h&&r.return!=null)r.return()}finally{if(c)throw l}}}}function _unsupportedIterableToArray(t,i){if(!t)return;if(typeof t==="string")return _arrayLikeToArray(t,i);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _arrayLikeToArray(t,i)}function _arrayLikeToArray(t,i){if(i==null||i>t.length)i=t.length;for(var r=0,o=new Array(i);r<i;r++)o[r]=t[r];return o}function asyncGeneratorStep(t,i,r,o,a,h,c){try{var l=t[h](c);var u=l.value}catch(t){r(t);return}if(l.done){i(u)}else{Promise.resolve(u).then(o,a)}}function _asyncToGenerator(t){return function(){var i=this,r=arguments;return new Promise((function(o,a){var h=t.apply(i,r);function _next(t){asyncGeneratorStep(h,o,a,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(h,o,a,_next,_throw,"throw",t)}_next(undefined)}))}}const o=r(2951);const a=["suggest","format","onState","validate","onRender","type"];const noop=()=>{};function prompt(){return _prompt.apply(this,arguments)}function _prompt(){_prompt=_asyncToGenerator((function*(t=[],{onSubmit:i=noop,onCancel:r=noop}={}){const h={};const c=prompt._override||{};t=[].concat(t);let l,u,d,p,m,y;const g=function(){var t=_asyncToGenerator((function*(t,i,r=false){if(!r&&t.validate&&t.validate(i)!==true){return}return t.format?yield t.format(i,h):i}));return function getFormattedAnswer(i,r){return t.apply(this,arguments)}}();var b=_createForOfIteratorHelper(t),w;try{for(b.s();!(w=b.n()).done;){u=w.value;var v=u;p=v.name;m=v.type;if(typeof m==="function"){m=yield m(l,_objectSpread({},h),u);u["type"]=m}if(!m)continue;for(let t in u){if(a.includes(t))continue;let i=u[t];u[t]=typeof i==="function"?yield i(l,_objectSpread({},h),y):i}y=u;if(typeof u.message!=="string"){throw new Error("prompt message is required")}var S=u;p=S.name;m=S.type;if(o[m]===void 0){throw new Error(`prompt type (${m}) is not defined`)}if(c[u.name]!==undefined){l=yield g(u,c[u.name]);if(l!==undefined){h[p]=l;continue}}try{l=prompt._injected?getInjectedAnswer(prompt._injected,u.initial):yield o[m](u);h[p]=l=yield g(u,l,true);d=yield i(u,l,h)}catch(t){d=!(yield r(u,h))}if(d)return h}}catch(t){b.e(t)}finally{b.f()}return h}));return _prompt.apply(this,arguments)}function getInjectedAnswer(t,i){const r=t.shift();if(r instanceof Error){throw r}return r===undefined?i:r}function inject(t){prompt._injected=(prompt._injected||[]).concat(t)}function override(t){prompt._override=Object.assign({},t)}t.exports=Object.assign(prompt,{prompt:prompt,prompts:o,inject:inject,override:override})},2951:(t,i,r)=>{const o=i;const a=r(5188);const noop=t=>t;function toPrompt(t,i,r={}){return new Promise(((o,h)=>{const c=new a[t](i);const l=r.onAbort||noop;const u=r.onSubmit||noop;const d=r.onExit||noop;c.on("state",i.onState||noop);c.on("submit",(t=>o(u(t))));c.on("exit",(t=>o(d(t))));c.on("abort",(t=>h(l(t))))}))}o.text=t=>toPrompt("TextPrompt",t);o.password=t=>{t.style="password";return o.text(t)};o.invisible=t=>{t.style="invisible";return o.text(t)};o.number=t=>toPrompt("NumberPrompt",t);o.date=t=>toPrompt("DatePrompt",t);o.confirm=t=>toPrompt("ConfirmPrompt",t);o.list=t=>{const i=t.separator||",";return toPrompt("TextPrompt",t,{onSubmit:t=>t.split(i).map((t=>t.trim()))})};o.toggle=t=>toPrompt("TogglePrompt",t);o.select=t=>toPrompt("SelectPrompt",t);o.multiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("MultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};o.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("AutocompleteMultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};const byTitle=(t,i)=>Promise.resolve(i.filter((i=>i.title.slice(0,t.length).toLowerCase()===t.toLowerCase())));o.autocomplete=t=>{t.suggest=t.suggest||byTitle;t.choices=[].concat(t.choices||[]);return toPrompt("AutocompletePrompt",t)}},31:t=>{t.exports=(t,i)=>{if(t.meta&&t.name!=="escape")return;if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c")return"abort";if(t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(i){if(t.name==="j")return"down";if(t.name==="k")return"up"}if(t.name==="return")return"submit";if(t.name==="enter")return"submit";if(t.name==="backspace")return"delete";if(t.name==="delete")return"deleteForward";if(t.name==="abort")return"abort";if(t.name==="escape")return"exit";if(t.name==="tab")return"next";if(t.name==="pagedown")return"nextPage";if(t.name==="pageup")return"prevPage";if(t.name==="home")return"home";if(t.name==="end")return"end";if(t.name==="up")return"up";if(t.name==="down")return"down";if(t.name==="right")return"right";if(t.name==="left")return"left";return false}},3744:(t,i,r)=>{function _createForOfIteratorHelper(t,i){var r=typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_unsupportedIterableToArray(t))||i&&t&&typeof t.length==="number"){if(r)t=r;var o=0;var a=function F(){};return{s:a,n:function n(){if(o>=t.length)return{done:true};return{done:false,value:t[o++]}},e:function e(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h=true,c=false,l;return{s:function s(){r=r.call(t)},n:function n(){var t=r.next();h=t.done;return t},e:function e(t){c=true;l=t},f:function f(){try{if(!h&&r.return!=null)r.return()}finally{if(c)throw l}}}}function _unsupportedIterableToArray(t,i){if(!t)return;if(typeof t==="string")return _arrayLikeToArray(t,i);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _arrayLikeToArray(t,i)}function _arrayLikeToArray(t,i){if(i==null||i>t.length)i=t.length;for(var r=0,o=new Array(i);r<i;r++)o[r]=t[r];return o}const o=r(4059);const a=r(5424),h=a.erase,c=a.cursor;const width=t=>[...o(t)].length;t.exports=function(t,i){if(!i)return h.line+c.to(0);let r=0;const o=t.split(/\r?\n/);var a=_createForOfIteratorHelper(o),l;try{for(a.s();!(l=a.n()).done;){let t=l.value;r+=1+Math.floor(Math.max(width(t)-1,0)/i)}}catch(t){a.e(t)}finally{a.f()}return h.lines(r)}},5852:t=>{t.exports=(t,i,r)=>{r=r||i;let o=Math.min(i-r,t-Math.floor(r/2));if(o<0)o=0;let a=Math.min(o+r,i);return{startIndex:o,endIndex:a}}},2692:t=>{const i={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"};const r={arrowUp:i.arrowUp,arrowDown:i.arrowDown,arrowLeft:i.arrowLeft,arrowRight:i.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};const o=process.platform==="win32"?r:i;t.exports=o},6601:(t,i,r)=>{t.exports={action:r(31),clear:r(3744),style:r(4812),strip:r(4059),figures:r(2692),lines:r(3274),wrap:r(4385),entriesToDisplay:r(5852)}},3274:(t,i,r)=>{const o=r(4059);t.exports=function(t,i){let r=String(o(t)||"").split(/\r?\n/);if(!i)return r.length;return r.map((t=>Math.ceil(t.length/i))).reduce(((t,i)=>t+i))}},4059:t=>{t.exports=t=>{const i=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");const r=new RegExp(i,"g");return typeof t==="string"?t.replace(r,""):t}},4812:(t,i,r)=>{const o=r(9727);const a=r(2692);const h=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"😃".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}});const render=t=>h[t]||h.default;const c=Object.freeze({aborted:o.red(a.cross),done:o.green(a.tick),exited:o.yellow(a.cross),default:o.cyan("?")});const symbol=(t,i,r)=>i?c.aborted:r?c.exited:t?c.done:c.default;const delimiter=t=>o.gray(t?a.ellipsis:a.pointerSmall);const item=(t,i)=>o.gray(t?i?a.pointerSmall:"+":a.line);t.exports={styles:h,render:render,symbols:c,symbol:symbol,delimiter:delimiter,item:item}},4385:t=>{t.exports=(t,i={})=>{const r=Number.isSafeInteger(parseInt(i.margin))?new Array(parseInt(i.margin)).fill(" ").join(""):i.margin||"";const o=i.width;return(t||"").split(/\r?\n/g).map((t=>t.split(/\s+/g).reduce(((t,i)=>{if(i.length+r.length>=o||t[t.length-1].length+i.length+1<o)t[t.length-1]+=` ${i}`;else t.push(`${r}${i}`);return t}),[r]).join("\n"))).join("\n")}},795:(t,i,r)=>{function isNodeLT(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let i=0,r=process.versions.node.split(".").map(Number);for(;i<t.length;i++){if(r[i]>t[i])return false;if(t[i]>r[i])return true}return false}t.exports=isNodeLT("8.6.0")?r(6528):r(4667)},6277:t=>{class DatePart{constructor({token:t,date:i,parts:r,locales:o}){this.token=t;this.date=i||new Date;this.parts=r||[this];this.locales=o||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find(((i,r)=>r>t&&i instanceof DatePart))}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const i=t.indexOf(this);return t.find(((t,r)=>r>i&&t instanceof DatePart))}toString(){return String(this.date)}}t.exports=DatePart},9732:(t,i,r)=>{const o=r(6277);const pos=t=>{t=t%10;return t===1?"st":t===2?"nd":t===3?"rd":"th"};class Day extends o{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate();let i=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+pos(t):this.token==="d"?i+1:this.token==="ddd"?this.locales.weekdaysShort[i]:this.token==="dddd"?this.locales.weekdays[i]:t}}t.exports=Day},6077:(t,i,r)=>{const o=r(6277);class Hours extends o{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();if(/h/.test(this.token))t=t%12||12;return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Hours},7994:(t,i,r)=>{t.exports={DatePart:r(6277),Meridiem:r(5710),Day:r(9732),Hours:r(6077),Milliseconds:r(4686),Minutes:r(9295),Month:r(1844),Seconds:r(6263),Year:r(353)}},5710:(t,i,r)=>{const o=r(6277);class Meridiem extends o{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}t.exports=Meridiem},4686:(t,i,r)=>{const o=r(6277);class Milliseconds extends o{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}t.exports=Milliseconds},9295:(t,i,r)=>{const o=r(6277);class Minutes extends o{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Minutes},1844:(t,i,r)=>{const o=r(6277);class Month extends o{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth();let i=this.token.length;return i===2?String(t+1).padStart(2,"0"):i===3?this.locales.monthsShort[t]:i===4?this.locales.months[t]:String(t+1)}}t.exports=Month},6263:(t,i,r)=>{const o=r(6277);class Seconds extends o{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}t.exports=Seconds},353:(t,i,r)=>{const o=r(6277);class Year extends o{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}t.exports=Year},7133:(t,i,r)=>{const o=r(9727);const a=r(1343);const{erase:h,cursor:c}=r(5424);const{style:l,clear:u,figures:d,wrap:p,entriesToDisplay:m}=r(3148);const getVal=(t,i)=>t[i]&&(t[i].value||t[i].title||t[i]);const getTitle=(t,i)=>t[i]&&(t[i].title||t[i].value||t[i]);const getIndex=(t,i)=>{const r=t.findIndex((t=>t.value===i||t.title===i));return r>-1?r:undefined};class AutocompletePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.suggest=t.suggest;this.choices=t.choices;this.initial=typeof t.initial==="number"?t.initial:getIndex(t.choices,t.initial);this.select=this.initial||t.cursor||0;this.i18n={noMatches:t.noMatches||"no matches found"};this.fallback=t.fallback||this.initial;this.clearFirst=t.clearFirst||false;this.suggestions=[];this.input="";this.limit=t.limit||10;this.cursor=0;this.transform=l.render(t.style);this.scale=this.transform.scale;this.render=this.render.bind(this);this.complete=this.complete.bind(this);this.clear=u("",this.out.columns);this.complete(this.render);this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;if(typeof this._fb==="number")t=this.choices[this._fb];else if(typeof this._fb==="string")t={title:this._fb};return t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t;if(this.suggestions.length>0)this.value=getVal(this.suggestions,t);else this.value=this.fallback.value;this.fire()}async complete(t){const i=this.completing=this.suggest(this.input,this.choices);const r=await i;if(this.completing!==i)return;this.suggestions=r.map(((t,i,r)=>({title:getTitle(r,i),value:getVal(r,i),description:t.description})));this.completing=false;const o=Math.max(r.length-1,0);this.moveSelect(Math.min(o,this.select));t&&t()}reset(){this.input="";this.complete((()=>{this.moveSelect(this.initial!==void 0?this.initial:0);this.render()}));this.render()}exit(){if(this.clearFirst&&this.input.length>0){this.reset()}else{this.done=this.exited=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}}abort(){this.done=this.aborted=true;this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=this.exited=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,i){let r=this.input.slice(0,this.cursor);let o=this.input.slice(this.cursor);this.input=`${r}${t}${o}`;this.cursor=r.length+1;this.complete(this.render);this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1);let i=this.input.slice(this.cursor);this.input=`${t}${i}`;this.complete(this.render);this.cursor=this.cursor-1;this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor);let i=this.input.slice(this.cursor+1);this.input=`${t}${i}`;this.complete(this.render);this.render()}first(){this.moveSelect(0);this.render()}last(){this.moveSelect(this.suggestions.length-1);this.render()}up(){if(this.select===0){this.moveSelect(this.suggestions.length-1)}else{this.moveSelect(this.select-1)}this.render()}down(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else{this.moveSelect(this.select+1)}this.render()}next(){if(this.select===this.suggestions.length-1){this.moveSelect(0)}else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1));this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0));this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1;this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1;this.render()}renderOption(t,i,r,a){let h;let c=r?d.arrowUp:a?d.arrowDown:" ";let l=i?o.cyan().underline(t.title):t.title;c=(i?o.cyan(d.pointer)+" ":" ")+c;if(t.description){h=` - ${t.description}`;if(c.length+l.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1){h="\n"+p(t.description,{margin:3,width:this.out.columns})}}return c+" "+l+o.gray(h||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(c.hide);else this.out.write(u(this.outputText,this.out.columns));super.render();let{startIndex:t,endIndex:i}=m(this.select,this.choices.length,this.limit);this.outputText=[l.symbol(this.done,this.aborted,this.exited),o.bold(this.msg),l.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" ");if(!this.done){const r=this.suggestions.slice(t,i).map(((r,o)=>this.renderOption(r,this.select===o+t,o===0&&t>0,o+t===i-1&&i<this.choices.length))).join("\n");this.outputText+=`\n`+(r||o.gray(this.fallback.title))}this.out.write(h.line+c.to(0)+this.outputText)}}t.exports=AutocompletePrompt},8936:(t,i,r)=>{const o=r(9727);const{cursor:a}=r(5424);const h=r(5240);const{clear:c,style:l,figures:u}=r(3148);class AutocompleteMultiselectPrompt extends h{constructor(t={}){t.overrideRender=true;super(t);this.inputValue="";this.clear=c("",this.out.columns);this.filteredOptions=this.value;this.render()}last(){this.cursor=this.filteredOptions.length-1;this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length;this.render()}up(){if(this.cursor===0){this.cursor=this.filteredOptions.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.filteredOptions.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.filteredOptions[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true;this.render()}delete(){if(this.inputValue.length){this.inputValue=this.inputValue.substr(0,this.inputValue.length-1);this.updateFilteredOptions()}}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((t=>{if(this.inputValue){if(typeof t.title==="string"){if(t.title.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}if(typeof t.value==="string"){if(t.value.toLowerCase().includes(this.inputValue.toLowerCase())){return true}}return false}return true}));const i=this.filteredOptions.findIndex((i=>i===t));this.cursor=i<0?0:i;this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t;this.updateFilteredOptions()}_(t,i){if(t===" "){this.handleSpaceToggle()}else{this.handleInputChange(t)}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return`\nInstructions:\n ${u.arrowUp}/${u.arrowDown}: Highlight option\n ${u.arrowLeft}/${u.arrowRight}/[space]: Toggle selection\n [a,b,c]/delete: Filter choices\n enter/return: Complete answer\n`}return""}renderCurrentInput(){return`\nFiltered results for: ${this.inputValue?this.inputValue:o.gray("Enter something to filter")}\n`}renderOption(t,i,r){let a;if(i.disabled)a=t===r?o.gray().underline(i.title):o.strikethrough().gray(i.title);else a=t===r?o.cyan().underline(i.title):i.title;return(i.selected?o.green(u.radioOn):u.radioOff)+" "+a}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(a.hide);super.render();let t=[l.symbol(this.done,this.aborted),o.bold(this.msg),l.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.filteredOptions);this.out.write(this.clear+t);this.clear=c(t,this.out.columns)}}t.exports=AutocompleteMultiselectPrompt},5085:(t,i,r)=>{const o=r(9727);const a=r(1343);const{style:h,clear:c}=r(3148);const{erase:l,cursor:u}=r(5424);class ConfirmPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=t.initial;this.initialValue=!!t.initial;this.yesMsg=t.yes||"yes";this.yesOption=t.yesOption||"(Y/n)";this.noMsg=t.no||"no";this.noOption=t.noOption||"(y/N)";this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.value=this.value||false;this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}_(t,i){if(t.toLowerCase()==="y"){this.value=true;return this.submit()}if(t.toLowerCase()==="n"){this.value=false;return this.submit()}return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(u.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();this.outputText=[h.symbol(this.done,this.aborted),o.bold(this.msg),h.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:o.gray(this.initialValue?this.yesOption:this.noOption)].join(" ");this.out.write(l.line+u.to(0)+this.outputText)}}t.exports=ConfirmPrompt},2673:(t,i,r)=>{const o=r(9727);const a=r(1343);const{style:h,clear:c,figures:l}=r(3148);const{erase:u,cursor:d}=r(5424);const{DatePart:p,Meridiem:m,Day:y,Hours:g,Milliseconds:b,Minutes:w,Month:v,Seconds:S,Year:E}=r(7994);const _=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;const x={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new y(t),3:t=>new v(t),4:t=>new E(t),5:t=>new m(t),6:t=>new g(t),7:t=>new w(t),8:t=>new S(t),9:t=>new b(t)};const k={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class DatePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.cursor=0;this.typed="";this.locales=Object.assign(k,t.locales);this._date=t.initial||new Date;this.errorMsg=t.error||"Please Enter A Valid Value";this.validator=t.validate||(()=>true);this.mask=t.mask||"YYYY-MM-DD HH:mm:ss";this.clear=c("",this.out.columns);this.render()}get value(){return this.date}get date(){return this._date}set date(t){if(t)this._date.setTime(t.getTime())}set mask(t){let i;this.parts=[];while(i=_.exec(t)){let t=i.shift();let r=i.findIndex((t=>t!=null));this.parts.push(r in x?x[r]({token:i[r]||t,date:this.date,parts:this.parts,locales:this.locales}):i[r]||t)}let r=this.parts.reduce(((t,i)=>{if(typeof i==="string"&&typeof t[t.length-1]==="string")t[t.length-1]+=i;else t.push(i);return t}),[]);this.parts.splice(0);this.parts.push(...r);this.reset()}moveCursor(t){this.typed="";this.cursor=t;this.fire()}reset(){this.moveCursor(this.parts.findIndex((t=>t instanceof p)));this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write("\n");this.close()}async validate(){let t=await this.validator(this.value);if(typeof t==="string"){this.errorMsg=t;t=false}this.error=!t}async submit(){await this.validate();if(this.error){this.color="red";this.fire();this.render();return}this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}up(){this.typed="";this.parts[this.cursor].up();this.render()}down(){this.typed="";this.parts[this.cursor].down();this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t));this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex((t=>t instanceof p)));this.render()}_(t){if(/\d/.test(t)){this.typed+=t;this.parts[this.cursor].setTo(this.typed);this.render()}}render(){if(this.closed)return;if(this.firstRender)this.out.write(d.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();this.outputText=[h.symbol(this.done,this.aborted),o.bold(this.msg),h.delimiter(false),this.parts.reduce(((t,i,r)=>t.concat(r===this.cursor&&!this.done?o.cyan().underline(i.toString()):i)),[]).join("")].join(" ");if(this.error){this.outputText+=this.errorMsg.split("\n").reduce(((t,i,r)=>t+`\n${r?` `:l.pointerSmall} ${o.red().italic(i)}`),``)}this.out.write(u.line+d.to(0)+this.outputText)}}t.exports=DatePrompt},3305:(t,i,r)=>{t.exports={TextPrompt:r(7810),SelectPrompt:r(3125),TogglePrompt:r(5541),DatePrompt:r(2673),NumberPrompt:r(8068),MultiselectPrompt:r(5240),AutocompletePrompt:r(7133),AutocompleteMultiselectPrompt:r(8936),ConfirmPrompt:r(5085)}},5240:(t,i,r)=>{const o=r(9727);const{cursor:a}=r(5424);const h=r(1343);const{clear:c,figures:l,style:u,wrap:d,entriesToDisplay:p}=r(3148);class MultiselectPrompt extends h{constructor(t={}){super(t);this.msg=t.message;this.cursor=t.cursor||0;this.scrollIndex=t.cursor||0;this.hint=t.hint||"";this.warn=t.warn||"- This option is disabled -";this.minSelected=t.min;this.showMinError=false;this.maxChoices=t.max;this.instructions=t.instructions;this.optionsPerPage=t.optionsPerPage||10;this.value=t.choices.map(((t,i)=>{if(typeof t==="string")t={title:t,value:i};return{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===undefined?i:t.value),selected:t&&t.selected,disabled:t&&t.disabled}}));this.clear=c("",this.out.columns);if(!t.overrideRender){this.render()}}reset(){this.value.map((t=>!t.selected));this.cursor=0;this.fire();this.render()}selected(){return this.value.filter((t=>t.selected))}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){const t=this.value.filter((t=>t.selected));if(this.minSelected&&t.length<this.minSelected){this.showMinError=true;this.render()}else{this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}}first(){this.cursor=0;this.render()}last(){this.cursor=this.value.length-1;this.render()}next(){this.cursor=(this.cursor+1)%this.value.length;this.render()}up(){if(this.cursor===0){this.cursor=this.value.length-1}else{this.cursor--}this.render()}down(){if(this.cursor===this.value.length-1){this.cursor=0}else{this.cursor++}this.render()}left(){this.value[this.cursor].selected=false;this.render()}right(){if(this.value.filter((t=>t.selected)).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true;this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected){t.selected=false;this.render()}else if(t.disabled||this.value.filter((t=>t.selected)).length>=this.maxChoices){return this.bell()}else{t.selected=true;this.render()}}toggleAll(){if(this.maxChoices!==undefined||this.value[this.cursor].disabled){return this.bell()}const t=!this.value[this.cursor].selected;this.value.filter((t=>!t.disabled)).forEach((i=>i.selected=t));this.render()}_(t,i){if(t===" "){this.handleSpaceToggle()}else if(t==="a"){this.toggleAll()}else{return this.bell()}}renderInstructions(){if(this.instructions===undefined||this.instructions){if(typeof this.instructions==="string"){return this.instructions}return"\nInstructions:\n"+` ${l.arrowUp}/${l.arrowDown}: Highlight option\n`+` ${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection\n`+(this.maxChoices===undefined?` a: Toggle all\n`:"")+` enter/return: Complete answer`}return""}renderOption(t,i,r,a){const h=(i.selected?o.green(l.radioOn):l.radioOff)+" "+a+" ";let c,u;if(i.disabled){c=t===r?o.gray().underline(i.title):o.strikethrough().gray(i.title)}else{c=t===r?o.cyan().underline(i.title):i.title;if(t===r&&i.description){u=` - ${i.description}`;if(h.length+c.length+u.length>=this.out.columns||i.description.split(/\r?\n/).length>1){u="\n"+d(i.description,{margin:h.length,width:this.out.columns})}}}return h+c+o.gray(u||"")}paginateOptions(t){if(t.length===0){return o.red("No matches for this query.")}let{startIndex:i,endIndex:r}=p(this.cursor,t.length,this.optionsPerPage);let a,h=[];for(let o=i;o<r;o++){if(o===i&&i>0){a=l.arrowUp}else if(o===r-1&&r<t.length){a=l.arrowDown}else{a=" "}h.push(this.renderOption(this.cursor,t[o],o,a))}return"\n"+h.join("\n")}renderOptions(t){if(!this.done){return this.paginateOptions(t)}return""}renderDoneOrInstructions(){if(this.done){return this.value.filter((t=>t.selected)).map((t=>t.title)).join(", ")}const t=[o.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled){t.push(o.yellow(this.warn))}return t.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(a.hide);super.render();let t=[u.symbol(this.done,this.aborted),o.bold(this.msg),u.delimiter(false),this.renderDoneOrInstructions()].join(" ");if(this.showMinError){t+=o.red(`You must select a minimum of ${this.minSelected} choices.`);this.showMinError=false}t+=this.renderOptions(this.value);this.out.write(this.clear+t);this.clear=c(t,this.out.columns)}}t.exports=MultiselectPrompt},8068:(t,i,r)=>{const o=r(9727);const a=r(1343);const{cursor:h,erase:c}=r(5424);const{style:l,figures:u,clear:d,lines:p}=r(3148);const m=/[0-9]/;const isDef=t=>t!==undefined;const round=(t,i)=>{let r=Math.pow(10,i);return Math.round(t*r)/r};class NumberPrompt extends a{constructor(t={}){super(t);this.transform=l.render(t.style);this.msg=t.message;this.initial=isDef(t.initial)?t.initial:"";this.float=!!t.float;this.round=t.round||2;this.inc=t.increment||1;this.min=isDef(t.min)?t.min:-Infinity;this.max=isDef(t.max)?t.max:Infinity;this.errorMsg=t.error||`Please Enter A Valid Value`;this.validator=t.validate||(()=>true);this.color=`cyan`;this.value=``;this.typed=``;this.lastHit=0;this.render()}set value(t){if(!t&&t!==0){this.placeholder=true;this.rendered=o.gray(this.transform.render(`${this.initial}`));this._value=``}else{this.placeholder=false;this.rendered=this.transform.render(`${round(t,this.round)}`);this._value=round(t,this.round)}this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t===`-`||t===`.`&&this.float||m.test(t)}reset(){this.typed=``;this.value=``;this.fire();this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==``?t:this.initial;this.done=this.aborted=true;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}async validate(){let t=await this.validator(this.value);if(typeof t===`string`){this.errorMsg=t;t=false}this.error=!t}async submit(){await this.validate();if(this.error){this.color=`red`;this.fire();this.render();return}let t=this.value;this.value=t!==``?t:this.initial;this.done=true;this.aborted=false;this.error=false;this.fire();this.render();this.out.write(`\n`);this.close()}up(){this.typed=``;if(this.value===""){this.value=this.min-this.inc}if(this.value>=this.max)return this.bell();this.value+=this.inc;this.color=`cyan`;this.fire();this.render()}down(){this.typed=``;if(this.value===""){this.value=this.min+this.inc}if(this.value<=this.min)return this.bell();this.value-=this.inc;this.color=`cyan`;this.fire();this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||``;if(this.value!==""&&this.value<this.min){this.value=this.min}this.color=`cyan`;this.fire();this.render()}next(){this.value=this.initial;this.fire();this.render()}_(t,i){if(!this.valid(t))return this.bell();const r=Date.now();if(r-this.lastHit>1e3)this.typed=``;this.typed+=t;this.lastHit=r;this.color=`cyan`;if(t===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max);if(this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire();this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(h.down(p(this.outputError,this.out.columns)-1)+d(this.outputError,this.out.columns));this.out.write(d(this.outputText,this.out.columns))}super.render();this.outputError="";this.outputText=[l.symbol(this.done,this.aborted),o.bold(this.msg),l.delimiter(this.done),!this.done||!this.done&&!this.placeholder?o[this.color]().underline(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,i,r)=>t+`\n${r?` `:u.pointerSmall} ${o.red().italic(i)}`),``)}this.out.write(c.line+h.to(0)+this.outputText+h.save+this.outputError+h.restore)}}t.exports=NumberPrompt},1343:(t,i,r)=>{const o=r(3785);const{action:a}=r(3148);const h=r(4434);const{beep:c,cursor:l}=r(5424);const u=r(9727);class Prompt extends h{constructor(t={}){super();this.firstRender=true;this.in=t.stdin||process.stdin;this.out=t.stdout||process.stdout;this.onRender=(t.onRender||(()=>void 0)).bind(this);const i=o.createInterface({input:this.in,escapeCodeTimeout:50});o.emitKeypressEvents(this.in,i);if(this.in.isTTY)this.in.setRawMode(true);const r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1;const keypress=(t,i)=>{let o=a(i,r);if(o===false){this._&&this._(t,i)}else if(typeof this[o]==="function"){this[o](i)}else{this.bell()}};this.close=()=>{this.out.write(l.show);this.in.removeListener("keypress",keypress);if(this.in.isTTY)this.in.setRawMode(false);i.close();this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value);this.closed=true};this.in.on("keypress",keypress)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(c)}render(){this.onRender(u);if(this.firstRender)this.firstRender=false}}t.exports=Prompt},3125:(t,i,r)=>{const o=r(9727);const a=r(1343);const{style:h,clear:c,figures:l,wrap:u,entriesToDisplay:d}=r(3148);const{cursor:p}=r(5424);class SelectPrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.hint=t.hint||"- Use arrow-keys. Return to submit.";this.warn=t.warn||"- This option is disabled";this.cursor=t.initial||0;this.choices=t.choices.map(((t,i)=>{if(typeof t==="string")t={title:t,value:i};return{title:t&&(t.title||t.value||t),value:t&&(t.value===undefined?i:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled}}));this.optionsPerPage=t.optionsPerPage||10;this.value=(this.choices[this.cursor]||{}).value;this.clear=c("",this.out.columns);this.render()}moveCursor(t){this.cursor=t;this.value=this.choices[t].value;this.fire()}reset(){this.moveCursor(0);this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){if(!this.selection.disabled){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}else this.bell()}first(){this.moveCursor(0);this.render()}last(){this.moveCursor(this.choices.length-1);this.render()}up(){if(this.cursor===0){this.moveCursor(this.choices.length-1)}else{this.moveCursor(this.cursor-1)}this.render()}down(){if(this.cursor===this.choices.length-1){this.moveCursor(0)}else{this.moveCursor(this.cursor+1)}this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length);this.render()}_(t,i){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(p.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();let{startIndex:t,endIndex:i}=d(this.cursor,this.choices.length,this.optionsPerPage);this.outputText=[h.symbol(this.done,this.aborted),o.bold(this.msg),h.delimiter(false),this.done?this.selection.title:this.selection.disabled?o.yellow(this.warn):o.gray(this.hint)].join(" ");if(!this.done){this.outputText+="\n";for(let r=t;r<i;r++){let a,h,c="",d=this.choices[r];if(r===t&&t>0){h=l.arrowUp}else if(r===i-1&&i<this.choices.length){h=l.arrowDown}else{h=" "}if(d.disabled){a=this.cursor===r?o.gray().underline(d.title):o.strikethrough().gray(d.title);h=(this.cursor===r?o.bold().gray(l.pointer)+" ":" ")+h}else{a=this.cursor===r?o.cyan().underline(d.title):d.title;h=(this.cursor===r?o.cyan(l.pointer)+" ":" ")+h;if(d.description&&this.cursor===r){c=` - ${d.description}`;if(h.length+a.length+c.length>=this.out.columns||d.description.split(/\r?\n/).length>1){c="\n"+u(d.description,{margin:3,width:this.out.columns})}}}this.outputText+=`${h} ${a}${o.gray(c)}\n`}}this.out.write(this.outputText)}}t.exports=SelectPrompt},7810:(t,i,r)=>{const o=r(9727);const a=r(1343);const{erase:h,cursor:c}=r(5424);const{style:l,clear:u,lines:d,figures:p}=r(3148);class TextPrompt extends a{constructor(t={}){super(t);this.transform=l.render(t.style);this.scale=this.transform.scale;this.msg=t.message;this.initial=t.initial||``;this.validator=t.validate||(()=>true);this.value=``;this.errorMsg=t.error||`Please Enter A Valid Value`;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.clear=u(``,this.out.columns);this.render()}set value(t){if(!t&&this.initial){this.placeholder=true;this.rendered=o.gray(this.transform.render(this.initial))}else{this.placeholder=false;this.rendered=this.transform.render(t)}this._value=t;this.fire()}get value(){return this._value}reset(){this.value=``;this.cursor=Number(!!this.initial);this.cursorOffset=0;this.fire();this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial;this.done=this.aborted=true;this.error=false;this.red=false;this.fire();this.render();this.out.write("\n");this.close()}async validate(){let t=await this.validator(this.value);if(typeof t===`string`){this.errorMsg=t;t=false}this.error=!t}async submit(){this.value=this.value||this.initial;this.cursorOffset=0;this.cursor=this.rendered.length;await this.validate();if(this.error){this.red=true;this.fire();this.render();return}this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial;this.cursor=this.rendered.length;this.fire();this.render()}moveCursor(t){if(this.placeholder)return;this.cursor=this.cursor+t;this.cursorOffset+=t}_(t,i){let r=this.value.slice(0,this.cursor);let o=this.value.slice(this.cursor);this.value=`${r}${t}${o}`;this.red=false;this.cursor=this.placeholder?0:r.length+1;this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1);let i=this.value.slice(this.cursor);this.value=`${t}${i}`;this.red=false;if(this.isCursorAtStart()){this.cursorOffset=0}else{this.cursorOffset++;this.moveCursor(-1)}this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor);let i=this.value.slice(this.cursor+1);this.value=`${t}${i}`;this.red=false;if(this.isCursorAtEnd()){this.cursorOffset=0}else{this.cursorOffset++}this.render()}first(){this.cursor=0;this.render()}last(){this.cursor=this.value.length;this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1);this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1);this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(c.down(d(this.outputError,this.out.columns)-1)+u(this.outputError,this.out.columns));this.out.write(u(this.outputText,this.out.columns))}super.render();this.outputError="";this.outputText=[l.symbol(this.done,this.aborted),o.bold(this.msg),l.delimiter(this.done),this.red?o.red(this.rendered):this.rendered].join(` `);if(this.error){this.outputError+=this.errorMsg.split(`\n`).reduce(((t,i,r)=>t+`\n${r?" ":p.pointerSmall} ${o.red().italic(i)}`),``)}this.out.write(h.line+c.to(0)+this.outputText+c.save+this.outputError+c.restore+c.move(this.cursorOffset,0))}}t.exports=TextPrompt},5541:(t,i,r)=>{const o=r(9727);const a=r(1343);const{style:h,clear:c}=r(3148);const{cursor:l,erase:u}=r(5424);class TogglePrompt extends a{constructor(t={}){super(t);this.msg=t.message;this.value=!!t.initial;this.active=t.active||"on";this.inactive=t.inactive||"off";this.initialValue=this.value;this.render()}reset(){this.value=this.initialValue;this.fire();this.render()}exit(){this.abort()}abort(){this.done=this.aborted=true;this.fire();this.render();this.out.write("\n");this.close()}submit(){this.done=true;this.aborted=false;this.fire();this.render();this.out.write("\n");this.close()}deactivate(){if(this.value===false)return this.bell();this.value=false;this.render()}activate(){if(this.value===true)return this.bell();this.value=true;this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value;this.fire();this.render()}_(t,i){if(t===" "){this.value=!this.value}else if(t==="1"){this.value=true}else if(t==="0"){this.value=false}else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(l.hide);else this.out.write(c(this.outputText,this.out.columns));super.render();this.outputText=[h.symbol(this.done,this.aborted),o.bold(this.msg),h.delimiter(this.done),this.value?this.inactive:o.cyan().underline(this.inactive),o.gray("/"),this.value?o.cyan().underline(this.active):this.active].join(" ");this.out.write(u.line+l.to(0)+this.outputText)}}t.exports=TogglePrompt},4667:(t,i,r)=>{const o=r(260);const a=["suggest","format","onState","validate","onRender","type"];const noop=()=>{};async function prompt(t=[],{onSubmit:i=noop,onCancel:r=noop}={}){const h={};const c=prompt._override||{};t=[].concat(t);let l,u,d,p,m,y;const getFormattedAnswer=async(t,i,r=false)=>{if(!r&&t.validate&&t.validate(i)!==true){return}return t.format?await t.format(i,h):i};for(u of t){({name:p,type:m}=u);if(typeof m==="function"){m=await m(l,{...h},u);u["type"]=m}if(!m)continue;for(let t in u){if(a.includes(t))continue;let i=u[t];u[t]=typeof i==="function"?await i(l,{...h},y):i}y=u;if(typeof u.message!=="string"){throw new Error("prompt message is required")}({name:p,type:m}=u);if(o[m]===void 0){throw new Error(`prompt type (${m}) is not defined`)}if(c[u.name]!==undefined){l=await getFormattedAnswer(u,c[u.name]);if(l!==undefined){h[p]=l;continue}}try{l=prompt._injected?getInjectedAnswer(prompt._injected,u.initial):await o[m](u);h[p]=l=await getFormattedAnswer(u,l,true);d=await i(u,l,h)}catch(t){d=!await r(u,h)}if(d)return h}return h}function getInjectedAnswer(t,i){const r=t.shift();if(r instanceof Error){throw r}return r===undefined?i:r}function inject(t){prompt._injected=(prompt._injected||[]).concat(t)}function override(t){prompt._override=Object.assign({},t)}t.exports=Object.assign(prompt,{prompt:prompt,prompts:o,inject:inject,override:override})},260:(t,i,r)=>{const o=i;const a=r(3305);const noop=t=>t;function toPrompt(t,i,r={}){return new Promise(((o,h)=>{const c=new a[t](i);const l=r.onAbort||noop;const u=r.onSubmit||noop;const d=r.onExit||noop;c.on("state",i.onState||noop);c.on("submit",(t=>o(u(t))));c.on("exit",(t=>o(d(t))));c.on("abort",(t=>h(l(t))))}))}o.text=t=>toPrompt("TextPrompt",t);o.password=t=>{t.style="password";return o.text(t)};o.invisible=t=>{t.style="invisible";return o.text(t)};o.number=t=>toPrompt("NumberPrompt",t);o.date=t=>toPrompt("DatePrompt",t);o.confirm=t=>toPrompt("ConfirmPrompt",t);o.list=t=>{const i=t.separator||",";return toPrompt("TextPrompt",t,{onSubmit:t=>t.split(i).map((t=>t.trim()))})};o.toggle=t=>toPrompt("TogglePrompt",t);o.select=t=>toPrompt("SelectPrompt",t);o.multiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("MultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};o.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);const toSelected=t=>t.filter((t=>t.selected)).map((t=>t.value));return toPrompt("AutocompleteMultiselectPrompt",t,{onAbort:toSelected,onSubmit:toSelected})};const byTitle=(t,i)=>Promise.resolve(i.filter((i=>i.title.slice(0,t.length).toLowerCase()===t.toLowerCase())));o.autocomplete=t=>{t.suggest=t.suggest||byTitle;t.choices=[].concat(t.choices||[]);return toPrompt("AutocompletePrompt",t)}},1672:t=>{t.exports=(t,i)=>{if(t.meta&&t.name!=="escape")return;if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c")return"abort";if(t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(i){if(t.name==="j")return"down";if(t.name==="k")return"up"}if(t.name==="return")return"submit";if(t.name==="enter")return"submit";if(t.name==="backspace")return"delete";if(t.name==="delete")return"deleteForward";if(t.name==="abort")return"abort";if(t.name==="escape")return"exit";if(t.name==="tab")return"next";if(t.name==="pagedown")return"nextPage";if(t.name==="pageup")return"prevPage";if(t.name==="home")return"home";if(t.name==="end")return"end";if(t.name==="up")return"up";if(t.name==="down")return"down";if(t.name==="right")return"right";if(t.name==="left")return"left";return false}},209:(t,i,r)=>{const o=r(4758);const{erase:a,cursor:h}=r(5424);const width=t=>[...o(t)].length;t.exports=function(t,i){if(!i)return a.line+h.to(0);let r=0;const o=t.split(/\r?\n/);for(let t of o){r+=1+Math.floor(Math.max(width(t)-1,0)/i)}return a.lines(r)}},2943:t=>{t.exports=(t,i,r)=>{r=r||i;let o=Math.min(i-r,t-Math.floor(r/2));if(o<0)o=0;let a=Math.min(o+r,i);return{startIndex:o,endIndex:a}}},8149:t=>{const i={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"};const r={arrowUp:i.arrowUp,arrowDown:i.arrowDown,arrowLeft:i.arrowLeft,arrowRight:i.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};const o=process.platform==="win32"?r:i;t.exports=o},3148:(t,i,r)=>{t.exports={action:r(1672),clear:r(209),style:r(3677),strip:r(4758),figures:r(8149),lines:r(7519),wrap:r(5890),entriesToDisplay:r(2943)}},7519:(t,i,r)=>{const o=r(4758);t.exports=function(t,i){let r=String(o(t)||"").split(/\r?\n/);if(!i)return r.length;return r.map((t=>Math.ceil(t.length/i))).reduce(((t,i)=>t+i))}},4758:t=>{t.exports=t=>{const i=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");const r=new RegExp(i,"g");return typeof t==="string"?t.replace(r,""):t}},3677:(t,i,r)=>{const o=r(9727);const a=r(8149);const h=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"😃".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}});const render=t=>h[t]||h.default;const c=Object.freeze({aborted:o.red(a.cross),done:o.green(a.tick),exited:o.yellow(a.cross),default:o.cyan("?")});const symbol=(t,i,r)=>i?c.aborted:r?c.exited:t?c.done:c.default;const delimiter=t=>o.gray(t?a.ellipsis:a.pointerSmall);const item=(t,i)=>o.gray(t?i?a.pointerSmall:"+":a.line);t.exports={styles:h,render:render,symbols:c,symbol:symbol,delimiter:delimiter,item:item}},5890:t=>{t.exports=(t,i={})=>{const r=Number.isSafeInteger(parseInt(i.margin))?new Array(parseInt(i.margin)).fill(" ").join(""):i.margin||"";const o=i.width;return(t||"").split(/\r?\n/g).map((t=>t.split(/\s+/g).reduce(((t,i)=>{if(i.length+r.length>=o||t[t.length-1].length+i.length+1<o)t[t.length-1]+=` ${i}`;else t.push(`${r}${i}`);return t}),[r]).join("\n"))).join("\n")}},2920:(t,i,r)=>{var o=r(8397);var a=r(6928).join;var h=r(3164);var c="/etc";var l=process.platform==="win32";var u=l?process.env.USERPROFILE:process.env.HOME;t.exports=function(t,i,d,p){if("string"!==typeof t)throw new Error("rc(name): name *must* be string");if(!d)d=r(7688)(process.argv.slice(2));i=("string"===typeof i?o.json(i):i)||{};p=p||o.parse;var m=o.env(t+"_");var y=[i];var g=[];function addConfigFile(t){if(g.indexOf(t)>=0)return;var i=o.file(t);if(i){y.push(p(i));g.push(t)}}if(!l)[a(c,t,"config"),a(c,t+"rc")].forEach(addConfigFile);if(u)[a(u,".config",t,"config"),a(u,".config",t),a(u,"."+t,"config"),a(u,"."+t+"rc")].forEach(addConfigFile);addConfigFile(o.find("."+t+"rc"));if(m.config)addConfigFile(m.config);if(d.config)addConfigFile(d.config);return h.apply(null,y.concat([m,d,g.length?{configs:g,config:g[g.length-1]}:undefined]))}},8397:(t,i,r)=>{var o=r(9896);var a=r(8277);var h=r(6928);var c=r(6854);var l=i.parse=function(t){if(/^\s*{/.test(t))return JSON.parse(c(t));return a.parse(t)};var u=i.file=function(){var t=[].slice.call(arguments).filter((function(t){return t!=null}));for(var i in t)if("string"!==typeof t[i])return;var r=h.join.apply(null,t);var a;try{return o.readFileSync(r,"utf-8")}catch(t){return}};var d=i.json=function(){var t=u.apply(null,arguments);return t?l(t):null};var p=i.env=function(t,i){i=i||process.env;var r={};var o=t.length;for(var a in i){if(a.toLowerCase().indexOf(t.toLowerCase())===0){var h=a.substring(o).split("__");var c;while((c=h.indexOf(""))>-1){h.splice(c,1)}var l=r;h.forEach((function _buildSubObj(t,r){if(!t||typeof l!=="object")return;if(r===h.length-1)l[t]=i[a];if(l[t]===undefined)l[t]={};l=l[t]}))}}return r};var m=i.find=function(){var t=h.join.apply(null,[].slice.call(arguments));function find(t,i){var r=h.join(t,i);try{o.statSync(r);return r}catch(r){if(h.dirname(t)!==t)return find(h.dirname(t),i)}}return find(process.cwd(),t)}},5728:(t,i,r)=>{const o=r(5135).Buffer;function decodeBase64(t){return o.from(t,"base64").toString("utf8")}function encodeBase64(t){return o.from(t,"utf8").toString("base64")}t.exports={decodeBase64:decodeBase64,encodeBase64:encodeBase64}},8143:(t,i,r)=>{var o=r(7016);var a=r(5728);var h=a.decodeBase64;var c=a.encodeBase64;var l=":_authToken";var u=":username";var d=":_password";t.exports=function(){var t;var i;if(arguments.length>=2){t=arguments[0];i=arguments[1]}else if(typeof arguments[0]==="string"){t=arguments[0]}else{i=arguments[0]}i=i||{};i.npmrc=i.npmrc||r(2920)("npm",{registry:"https://registry.npmjs.org/"});t=t||i.npmrc.registry;return getRegistryAuthInfo(t,i)||getLegacyAuthInfo(i.npmrc)};function getRegistryAuthInfo(t,i){var r=o.parse(t,false,true);var a;while(a!=="/"&&r.pathname!==a){a=r.pathname||"/";var h="//"+r.host+a.replace(/\/$/,"");var c=getAuthInfoForUrl(h,i.npmrc);if(c){return c}if(!i.recursive){return/\/$/.test(t)?undefined:getRegistryAuthInfo(o.resolve(t,"."),i)}r.pathname=o.resolve(normalizePath(a),"..")||"/"}return undefined}function getLegacyAuthInfo(t){if(t._auth){return{token:t._auth,type:"Basic"}}return undefined}function normalizePath(t){return t[t.length-1]==="/"?t:t+"/"}function getAuthInfoForUrl(t,i){var r=getBearerToken(i[t+l]||i[t+"/"+l]);if(r){return r}var o=i[t+u]||i[t+"/"+u];var a=i[t+d]||i[t+"/"+d];var h=getTokenForUsernameAndPassword(o,a);if(h){return h}return undefined}function getBearerToken(t){if(!t){return undefined}var i=t.replace(/^\$\{?([^}]*)\}?$/,(function(t,i){return process.env[i]}));return{token:i,type:"Bearer"}}function getTokenForUsernameAndPassword(t,i){if(!t||!i){return undefined}var r=h(i.replace(/^\$\{?([^}]*)\}?$/,(function(t,i){return process.env[i]})));var o=c(t+":"+r);return{token:o,type:"Basic",password:r,username:t}}},359:(t,i,r)=>{t.exports=function(t){var i=r(2920)("npm",{registry:"https://registry.npmjs.org/"});var o=i[t+":registry"]||i.registry;return o.slice(-1)==="/"?o:o+"/"}},5135:(t,i,r)=>{
29
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
30
- var o=r(181);var a=o.Buffer;function copyProps(t,i){for(var r in t){i[r]=t[r]}}if(a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow){t.exports=o}else{copyProps(o,i);i.Buffer=SafeBuffer}function SafeBuffer(t,i,r){return a(t,i,r)}SafeBuffer.prototype=Object.create(a.prototype);copyProps(a,SafeBuffer);SafeBuffer.from=function(t,i,r){if(typeof t==="number"){throw new TypeError("Argument must not be a number")}return a(t,i,r)};SafeBuffer.alloc=function(t,i,r){if(typeof t!=="number"){throw new TypeError("Argument must be a number")}var o=a(t);if(i!==undefined){if(typeof r==="string"){o.fill(i,r)}else{o.fill(i)}}else{o.fill(0)}return o};SafeBuffer.allocUnsafe=function(t){if(typeof t!=="number"){throw new TypeError("Argument must be a number")}return a(t)};SafeBuffer.allocUnsafeSlow=function(t){if(typeof t!=="number"){throw new TypeError("Argument must be a number")}return o.SlowBuffer(t)}},5424:t=>{const i="";const r=`${i}[`;const o="";const a={to(t,i){if(!i)return`${r}${t+1}G`;return`${r}${i+1};${t+1}H`},move(t,i){let o="";if(t<0)o+=`${r}${-t}D`;else if(t>0)o+=`${r}${t}C`;if(i<0)o+=`${r}${-i}A`;else if(i>0)o+=`${r}${i}B`;return o},up:(t=1)=>`${r}${t}A`,down:(t=1)=>`${r}${t}B`,forward:(t=1)=>`${r}${t}C`,backward:(t=1)=>`${r}${t}D`,nextLine:(t=1)=>`${r}E`.repeat(t),prevLine:(t=1)=>`${r}F`.repeat(t),left:`${r}G`,hide:`${r}?25l`,show:`${r}?25h`,save:`${i}7`,restore:`${i}8`};const h={up:(t=1)=>`${r}S`.repeat(t),down:(t=1)=>`${r}T`.repeat(t)};const c={screen:`${r}2J`,up:(t=1)=>`${r}1J`.repeat(t),down:(t=1)=>`${r}J`.repeat(t),line:`${r}2K`,lineEnd:`${r}K`,lineStart:`${r}1K`,lines(t){let i="";for(let r=0;r<t;r++)i+=this.line+(r<t-1?a.up():"");if(t)i+=a.left;return i}};t.exports={cursor:a,scroll:h,erase:c,beep:o}},6854:t=>{var i=1;var r=2;function stripWithoutWhitespace(){return""}function stripWithWhitespace(t,i,r){return t.slice(i,r).replace(/\S/g," ")}t.exports=function(t,o){o=o||{};var a;var h;var c=false;var l=false;var u=0;var d="";var p=o.whitespace===false?stripWithoutWhitespace:stripWithWhitespace;for(var m=0;m<t.length;m++){a=t[m];h=t[m+1];if(!l&&a==='"'){var y=t[m-1]==="\\"&&t[m-2]!=="\\";if(!y){c=!c}}if(c){continue}if(!l&&a+h==="//"){d+=t.slice(u,m);u=m;l=i;m++}else if(l===i&&a+h==="\r\n"){m++;l=false;d+=p(t,u,m);u=m;continue}else if(l===i&&a==="\n"){l=false;d+=p(t,u,m);u=m}else if(!l&&a+h==="/*"){d+=t.slice(u,m);u=m;l=r;m++;continue}else if(l===r&&a+h==="*/"){m++;l=false;d+=p(t,u,m+1);u=m+1;continue}}return d+(l?p(t.substr(u)):t.substr(u))}},4124:(t,i)=>{i.fromCallback=function(t){return Object.defineProperty((function(...i){if(typeof i[i.length-1]==="function")t.apply(this,i);else{return new Promise(((r,o)=>{i.push(((t,i)=>t!=null?o(t):r(i)));t.apply(this,i)}))}}),"name",{value:t.name})};i.fromPromise=function(t){return Object.defineProperty((function(...i){const r=i[i.length-1];if(typeof r!=="function")return t.apply(this,i);else{i.pop();t.apply(this,i).then((t=>r(null,t)),r)}}),"name",{value:t.name})}},2321:(t,i,r)=>{const{URL:o}=r(7016);const{join:a}=r(6928);const h=r(9896);const{promisify:c}=r(9023);const{tmpdir:l}=r(857);const u=r(359);const d=c(h.writeFile);const p=c(h.mkdir);const m=c(h.readFile);const compareVersions=(t,i)=>t.localeCompare(i,"en-US",{numeric:true});const encode=t=>encodeURIComponent(t).replace(/^%40/,"@");const getFile=async(t,i)=>{const r=l();const o=a(r,"update-check");if(!h.existsSync(o)){await p(o)}let c=`${t.name}-${i}.json`;if(t.scope){c=`${t.scope}-${c}`}return a(o,c)};const evaluateCache=async(t,i,r)=>{if(h.existsSync(t)){const o=await m(t,"utf8");const{lastUpdate:a,latest:h}=JSON.parse(o);const c=a+r;if(c>i){return{shouldCheck:false,latest:h}}}return{shouldCheck:true,latest:null}};const updateCache=async(t,i,r)=>{const o=JSON.stringify({latest:i,lastUpdate:r});await d(t,o,"utf8")};const loadPackage=(t,i)=>new Promise(((o,a)=>{const h={host:t.hostname,path:t.pathname,port:t.port,headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},timeout:2e3};if(i){h.headers.authorization=`${i.type} ${i.token}`}const{get:c}=r(t.protocol==="https:"?5692:8611);c(h,(t=>{const{statusCode:i}=t;if(i!==200){const r=new Error(`Request failed with code ${i}`);r.code=i;a(r);t.resume();return}let r="";t.setEncoding("utf8");t.on("data",(t=>{r+=t}));t.on("end",(()=>{try{const t=JSON.parse(r);o(t)}catch(t){a(t)}}))})).on("error",a).on("timeout",a)}));const getMostRecent=async({full:t,scope:i},a)=>{const h=u(i);const c=new o(t,h);let l=null;try{l=await loadPackage(c)}catch(t){if(t.code&&String(t.code).startsWith(4)){const t=r(8143);const i=t(h,{recursive:true});l=await loadPackage(c,i)}else{throw t}}const d=l["dist-tags"][a];if(!d){throw new Error(`Distribution tag ${a} is not available`)}return d};const y={interval:36e5,distTag:"latest"};const getDetails=t=>{const i={full:encode(t)};if(t.includes("/")){const r=t.split("/");i.scope=r[0];i.name=r[1]}else{i.scope=null;i.name=t}return i};t.exports=async(t,i)=>{if(typeof t!=="object"){throw new Error("The first parameter should be your package.json file content")}const r=getDetails(t.name);const o=Date.now();const{distTag:a,interval:h}=Object.assign({},y,i);const c=await getFile(r,a);let l=null;let u=true;({shouldCheck:u,latest:l}=await evaluateCache(c,o,h));if(u){l=await getMostRecent(r,a);await updateCache(c,l,o)}const d=compareVersions(t.version,l);if(d===-1){return{latest:l,fromCache:!u}}return null}},2613:i=>{i.exports=t(import.meta.url)("assert")},181:i=>{i.exports=t(import.meta.url)("buffer")},9140:i=>{i.exports=t(import.meta.url)("constants")},4434:i=>{i.exports=t(import.meta.url)("events")},9896:i=>{i.exports=t(import.meta.url)("fs")},8611:i=>{i.exports=t(import.meta.url)("http")},5692:i=>{i.exports=t(import.meta.url)("https")},857:i=>{i.exports=t(import.meta.url)("os")},6928:i=>{i.exports=t(import.meta.url)("path")},3785:i=>{i.exports=t(import.meta.url)("readline")},2203:i=>{i.exports=t(import.meta.url)("stream")},7016:i=>{i.exports=t(import.meta.url)("url")},9023:i=>{i.exports=t(import.meta.url)("util")}};var r={};function __nccwpck_require__(t){var o=r[t];if(o!==undefined){return o.exports}var a=r[t]={exports:{}};var h=true;try{i[t](a,a.exports,__nccwpck_require__);h=false}finally{if(h)delete r[t]}return a.exports}(()=>{__nccwpck_require__.n=t=>{var i=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(i,{a:i});return i}})();(()=>{__nccwpck_require__.d=(t,i)=>{for(var r in i){if(__nccwpck_require__.o(i,r)&&!__nccwpck_require__.o(t,r)){Object.defineProperty(t,r,{enumerable:true,get:i[r]})}}}})();(()=>{__nccwpck_require__.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i)})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=new URL(".",import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/)?1:0,-1)+"/";var o={};const a=t(import.meta.url)("node:fs");const h=t(import.meta.url)("node:fs/promises");var c=__nccwpck_require__.n(h);const l=t(import.meta.url)("node:path");var u=__nccwpck_require__.n(l);const d=t(import.meta.url)("node:url");const p=t(import.meta.url)("node:util");var m=__nccwpck_require__(795);var y=__nccwpck_require__.n(m);let g=true;const b=typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};let w=0;if(b.process&&b.process.env&&b.process.stdout){const{FORCE_COLOR:t,NODE_DISABLE_COLORS:i,NO_COLOR:r,TERM:o,COLORTERM:a}=b.process.env;if(i||r||t==="0"){g=false}else if(t==="1"||t==="2"||t==="3"){g=true}else if(o==="dumb"){g=false}else if("CI"in b.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((t=>t in b.process.env))){g=true}else{g=process.stdout.isTTY}if(g){if(process.platform==="win32"){w=3}else{if(a&&(a==="truecolor"||a==="24bit")){w=3}else if(o&&(o.endsWith("-256color")||o.endsWith("256"))){w=2}else{w=1}}}}let v={enabled:g,supportLevel:w};function kolorist(t,i,r=1){const o=`[${t}m`;const a=`[${i}m`;const h=new RegExp(`\\x1b\\[${i}m`,"g");return t=>v.enabled&&v.supportLevel>=r?o+(""+t).replace(h,o)+a:""+t}function rgbToAnsi256(t,i,r){if(t>>4===i>>4&&i>>4===r>>4){if(t<8){return 16}if(t>248){return 231}return Math.round((t-8)/247*24)+232}const o=16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(r/255*5);return o}function stripColors(t){return(""+t).replace(/\x1b\[[0-9;]+m/g,"").replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g,((t,i)=>i))}const S=kolorist(0,0);const E=kolorist(1,22);const _=kolorist(2,22);const x=kolorist(3,23);const k=kolorist(4,24);const O=kolorist(7,27);const R=kolorist(8,28);const T=kolorist(9,29);const P=kolorist(30,39);const D=kolorist(31,39);const A=kolorist(32,39);const M=kolorist(33,39);const I=kolorist(34,39);const L=kolorist(35,39);const C=kolorist(36,39);const N=kolorist(97,39);const $=kolorist(90,39);const j=kolorist(37,39);const B=kolorist(91,39);const U=kolorist(92,39);const z=kolorist(93,39);const W=kolorist(94,39);const H=kolorist(95,39);const G=kolorist(96,39);const Y=kolorist(40,49);const V=kolorist(41,49);const Z=kolorist(42,49);const q=kolorist(43,49);const J=kolorist(44,49);const K=kolorist(45,49);const X=kolorist(46,49);const Q=kolorist(107,49);const tt=kolorist(100,49);const et=kolorist(101,49);const it=kolorist(102,49);const st=kolorist(103,49);const rt=kolorist(104,49);const nt=kolorist(105,49);const ot=kolorist(106,49);const at=kolorist(47,49);const ansi256=t=>kolorist("38;5;"+t,0,2);const ansi256Bg=t=>kolorist("48;5;"+t,0,2);const trueColor=(t,i,r)=>v.supportLevel===2?ansi256(rgbToAnsi256(t,i,r)):kolorist(`38;2;${t};${i};${r}`,0,3);const trueColorBg=(t,i,r)=>v.supportLevel===2?ansi256Bg(rgbToAnsi256(t,i,r)):kolorist(`48;2;${t};${i};${r}`,0,3);const ht="]";const ct="";const lt=";";function esm_link(t,i){return v.enabled?ht+"8"+lt+lt+i+ct+t+ht+"8"+lt+lt+ct:`${t} (​${i}​)`}var ut=__nccwpck_require__(3521);var ft=__nccwpck_require__(6781);var dt=__nccwpck_require__(7374);var pt=__nccwpck_require__(34);var mt=__nccwpck_require__(2260);var yt=__nccwpck_require__(7105);var gt=__nccwpck_require__(8046);var bt=__nccwpck_require__(3662);var wt=__nccwpck_require__(3348);const vt=ut.copy;const St=ut.copySync;const Et=ft.emptyDirSync;const _t=ft.emptydirSync;const xt=ft.emptyDir;const kt=ft.emptydir;const Ot=dt.createFile;const Rt=dt.createFileSync;const Tt=dt.ensureFile;const Pt=dt.ensureFileSync;const Dt=dt.createLink;const At=dt.createLinkSync;const Ft=dt.ensureLink;const Mt=dt.ensureLinkSync;const It=dt.createSymlink;const Lt=dt.createSymlinkSync;const Ct=dt.ensureSymlink;const Nt=dt.ensureSymlinkSync;const $t=pt.readJson;const jt=pt.readJSON;const Bt=pt.readJsonSync;const Ut=pt.readJSONSync;const zt=pt.writeJson;const Wt=pt.writeJSON;const Ht=pt.writeJsonSync;const Gt=pt.writeJSONSync;const Yt=pt.outputJson;const Vt=pt.outputJSON;const Zt=pt.outputJsonSync;const qt=pt.outputJSONSync;const Jt=mt.mkdirs;const Kt=mt.mkdirsSync;const Xt=mt.mkdirp;const Qt=mt.mkdirpSync;const te=mt.ensureDir;const ee=mt.ensureDirSync;const ie=yt.move;const se=yt.moveSync;const re=gt.outputFile;const ne=gt.outputFileSync;const oe=bt.pathExists;const ae=bt.pathExistsSync;const he=wt.remove;const ce=wt.removeSync;const le={...ut,...ft,...dt,...pt,...mt,...yt,...gt,...bt,...wt};var ue=__nccwpck_require__(2321);var fe=__nccwpck_require__.n(ue);async function getTemplateNames(t){const i=(await c().readdir(t)).filter((t=>!t.startsWith(".")));return i}async function installTemplate(t,i,r,o){const h={name:i,version:"0.0.0"};const l=u().join(r,o);const d=u().join(t,"package.json");const p=u().join(l,"package.json");const m=JSON.parse(await c().readFile(p,"utf-8"));le.copySync(l,t);await c().writeFile(d,JSON.stringify({...m,...h},null,2));if((0,a.existsSync)(u().join(t,"gitignore"))){await c().rename(u().join(t,"gitignore"),u().join(t,".gitignore"))}}const de=t(import.meta.url)("node:stream");const pe=t(import.meta.url)("node:stream/promises");var me=__nccwpck_require__(4434);var ye=__nccwpck_require__(9896);const ge=t(import.meta.url)("node:events");const be=t(import.meta.url)("node:string_decoder");const we=typeof process==="object"&&process?process:{stdout:null,stderr:null};const isStream=t=>!!t&&typeof t==="object"&&(t instanceof Minipass||t instanceof de||isReadable(t)||isWritable(t));const isReadable=t=>!!t&&typeof t==="object"&&t instanceof ge.EventEmitter&&typeof t.pipe==="function"&&t.pipe!==de.Writable.prototype.pipe;const isWritable=t=>!!t&&typeof t==="object"&&t instanceof ge.EventEmitter&&typeof t.write==="function"&&typeof t.end==="function";const ve=Symbol("EOF");const Se=Symbol("maybeEmitEnd");const Ee=Symbol("emittedEnd");const _e=Symbol("emittingEnd");const xe=Symbol("emittedError");const ke=Symbol("closed");const Oe=Symbol("read");const Re=Symbol("flush");const Te=Symbol("flushChunk");const Pe=Symbol("encoding");const De=Symbol("decoder");const Ae=Symbol("flowing");const Fe=Symbol("paused");const Me=Symbol("resume");const Ie=Symbol("buffer");const Le=Symbol("pipes");const Ce=Symbol("bufferLength");const Ne=Symbol("bufferPush");const $e=Symbol("bufferShift");const je=Symbol("objectMode");const Be=Symbol("destroyed");const Ue=Symbol("error");const ze=Symbol("emitData");const We=Symbol("emitEnd");const He=Symbol("emitEnd2");const Ge=Symbol("async");const Ye=Symbol("abort");const Ve=Symbol("aborted");const Ze=Symbol("signal");const qe=Symbol("dataListeners");const Je=Symbol("discarded");const defer=t=>Promise.resolve().then(t);const nodefer=t=>t();const isEndish=t=>t==="end"||t==="finish"||t==="prefinish";const isArrayBufferLike=t=>t instanceof ArrayBuffer||!!t&&typeof t==="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0;const isArrayBufferView=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t);class Pipe{src;dest;opts;ondrain;constructor(t,i,r){this.src=t;this.dest=i;this.opts=r;this.ondrain=()=>t[Me]();this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe();if(this.opts.end)this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors);super.unpipe()}constructor(t,i,r){super(t,i,r);this.proxyErrors=t=>i.emit("error",t);t.on("error",this.proxyErrors)}}const isObjectModeOptions=t=>!!t.objectMode;const isEncodingOptions=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer";class Minipass extends ge.EventEmitter{[Ae]=false;[Fe]=false;[Le]=[];[Ie]=[];[je];[Pe];[Ge];[De];[ve]=false;[Ee]=false;[_e]=false;[ke]=false;[xe]=null;[Ce]=0;[Be]=false;[Ze];[Ve]=false;[qe]=0;[Je]=false;writable=true;readable=true;constructor(...t){const i=t[0]||{};super();if(i.objectMode&&typeof i.encoding==="string"){throw new TypeError("Encoding and objectMode may not be used together")}if(isObjectModeOptions(i)){this[je]=true;this[Pe]=null}else if(isEncodingOptions(i)){this[Pe]=i.encoding;this[je]=false}else{this[je]=false;this[Pe]=null}this[Ge]=!!i.async;this[De]=this[Pe]?new be.StringDecoder(this[Pe]):null;if(i&&i.debugExposeBuffer===true){Object.defineProperty(this,"buffer",{get:()=>this[Ie]})}if(i&&i.debugExposePipes===true){Object.defineProperty(this,"pipes",{get:()=>this[Le]})}const{signal:r}=i;if(r){this[Ze]=r;if(r.aborted){this[Ye]()}else{r.addEventListener("abort",(()=>this[Ye]()))}}}get bufferLength(){return this[Ce]}get encoding(){return this[Pe]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[je]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[Ge]}set["async"](t){this[Ge]=this[Ge]||!!t}[Ye](){this[Ve]=true;this.emit("abort",this[Ze]?.reason);this.destroy(this[Ze]?.reason)}get aborted(){return this[Ve]}set aborted(t){}write(t,i,r){if(this[Ve])return false;if(this[ve])throw new Error("write after end");if(this[Be]){this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"}));return true}if(typeof i==="function"){r=i;i="utf8"}if(!i)i="utf8";const o=this[Ge]?defer:nodefer;if(!this[je]&&!Buffer.isBuffer(t)){if(isArrayBufferView(t)){t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(isArrayBufferLike(t)){t=Buffer.from(t)}else if(typeof t!=="string"){throw new Error("Non-contiguous data written to non-objectMode stream")}}if(this[je]){if(this[Ae]&&this[Ce]!==0)this[Re](true);if(this[Ae])this.emit("data",t);else this[Ne](t);if(this[Ce]!==0)this.emit("readable");if(r)o(r);return this[Ae]}if(!t.length){if(this[Ce]!==0)this.emit("readable");if(r)o(r);return this[Ae]}if(typeof t==="string"&&!(i===this[Pe]&&!this[De]?.lastNeed)){t=Buffer.from(t,i)}if(Buffer.isBuffer(t)&&this[Pe]){t=this[De].write(t)}if(this[Ae]&&this[Ce]!==0)this[Re](true);if(this[Ae])this.emit("data",t);else this[Ne](t);if(this[Ce]!==0)this.emit("readable");if(r)o(r);return this[Ae]}read(t){if(this[Be])return null;this[Je]=false;if(this[Ce]===0||t===0||t&&t>this[Ce]){this[Se]();return null}if(this[je])t=null;if(this[Ie].length>1&&!this[je]){this[Ie]=[this[Pe]?this[Ie].join(""):Buffer.concat(this[Ie],this[Ce])]}const i=this[Oe](t||null,this[Ie][0]);this[Se]();return i}[Oe](t,i){if(this[je])this[$e]();else{const r=i;if(t===r.length||t===null)this[$e]();else if(typeof r==="string"){this[Ie][0]=r.slice(t);i=r.slice(0,t);this[Ce]-=t}else{this[Ie][0]=r.subarray(t);i=r.subarray(0,t);this[Ce]-=t}}this.emit("data",i);if(!this[Ie].length&&!this[ve])this.emit("drain");return i}end(t,i,r){if(typeof t==="function"){r=t;t=undefined}if(typeof i==="function"){r=i;i="utf8"}if(t!==undefined)this.write(t,i);if(r)this.once("end",r);this[ve]=true;this.writable=false;if(this[Ae]||!this[Fe])this[Se]();return this}[Me](){if(this[Be])return;if(!this[qe]&&!this[Le].length){this[Je]=true}this[Fe]=false;this[Ae]=true;this.emit("resume");if(this[Ie].length)this[Re]();else if(this[ve])this[Se]();else this.emit("drain")}resume(){return this[Me]()}pause(){this[Ae]=false;this[Fe]=true;this[Je]=false}get destroyed(){return this[Be]}get flowing(){return this[Ae]}get paused(){return this[Fe]}[Ne](t){if(this[je])this[Ce]+=1;else this[Ce]+=t.length;this[Ie].push(t)}[$e](){if(this[je])this[Ce]-=1;else this[Ce]-=this[Ie][0].length;return this[Ie].shift()}[Re](t=false){do{}while(this[Te](this[$e]())&&this[Ie].length);if(!t&&!this[Ie].length&&!this[ve])this.emit("drain")}[Te](t){this.emit("data",t);return this[Ae]}pipe(t,i){if(this[Be])return t;this[Je]=false;const r=this[Ee];i=i||{};if(t===we.stdout||t===we.stderr)i.end=false;else i.end=i.end!==false;i.proxyErrors=!!i.proxyErrors;if(r){if(i.end)t.end()}else{this[Le].push(!i.proxyErrors?new Pipe(this,t,i):new PipeProxyErrors(this,t,i));if(this[Ge])defer((()=>this[Me]()));else this[Me]()}return t}unpipe(t){const i=this[Le].find((i=>i.dest===t));if(i){if(this[Le].length===1){if(this[Ae]&&this[qe]===0){this[Ae]=false}this[Le]=[]}else this[Le].splice(this[Le].indexOf(i),1);i.unpipe()}}addListener(t,i){return this.on(t,i)}on(t,i){const r=super.on(t,i);if(t==="data"){this[Je]=false;this[qe]++;if(!this[Le].length&&!this[Ae]){this[Me]()}}else if(t==="readable"&&this[Ce]!==0){super.emit("readable")}else if(isEndish(t)&&this[Ee]){super.emit(t);this.removeAllListeners(t)}else if(t==="error"&&this[xe]){const t=i;if(this[Ge])defer((()=>t.call(this,this[xe])));else t.call(this,this[xe])}return r}removeListener(t,i){return this.off(t,i)}off(t,i){const r=super.off(t,i);if(t==="data"){this[qe]=this.listeners("data").length;if(this[qe]===0&&!this[Je]&&!this[Le].length){this[Ae]=false}}return r}removeAllListeners(t){const i=super.removeAllListeners(t);if(t==="data"||t===undefined){this[qe]=0;if(!this[Je]&&!this[Le].length){this[Ae]=false}}return i}get emittedEnd(){return this[Ee]}[Se](){if(!this[_e]&&!this[Ee]&&!this[Be]&&this[Ie].length===0&&this[ve]){this[_e]=true;this.emit("end");this.emit("prefinish");this.emit("finish");if(this[ke])this.emit("close");this[_e]=false}}emit(t,...i){const r=i[0];if(t!=="error"&&t!=="close"&&t!==Be&&this[Be]){return false}else if(t==="data"){return!this[je]&&!r?false:this[Ge]?(defer((()=>this[ze](r))),true):this[ze](r)}else if(t==="end"){return this[We]()}else if(t==="close"){this[ke]=true;if(!this[Ee]&&!this[Be])return false;const t=super.emit("close");this.removeAllListeners("close");return t}else if(t==="error"){this[xe]=r;super.emit(Ue,r);const t=!this[Ze]||this.listeners("error").length?super.emit("error",r):false;this[Se]();return t}else if(t==="resume"){const t=super.emit("resume");this[Se]();return t}else if(t==="finish"||t==="prefinish"){const i=super.emit(t);this.removeAllListeners(t);return i}const o=super.emit(t,...i);this[Se]();return o}[ze](t){for(const i of this[Le]){if(i.dest.write(t)===false)this.pause()}const i=this[Je]?false:super.emit("data",t);this[Se]();return i}[We](){if(this[Ee])return false;this[Ee]=true;this.readable=false;return this[Ge]?(defer((()=>this[He]())),true):this[He]()}[He](){if(this[De]){const t=this[De].end();if(t){for(const i of this[Le]){i.dest.write(t)}if(!this[Je])super.emit("data",t)}}for(const t of this[Le]){t.end()}const t=super.emit("end");this.removeAllListeners("end");return t}async collect(){const t=Object.assign([],{dataLength:0});if(!this[je])t.dataLength=0;const i=this.promise();this.on("data",(i=>{t.push(i);if(!this[je])t.dataLength+=i.length}));await i;return t}async concat(){if(this[je]){throw new Error("cannot concat in objectMode")}const t=await this.collect();return this[Pe]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,i)=>{this.on(Be,(()=>i(new Error("stream destroyed"))));this.on("error",(t=>i(t)));this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[Je]=false;let t=false;const stop=async()=>{this.pause();t=true;return{value:undefined,done:true}};const next=()=>{if(t)return stop();const i=this.read();if(i!==null)return Promise.resolve({done:false,value:i});if(this[ve])return stop();let r;let o;const onerr=t=>{this.off("data",ondata);this.off("end",onend);this.off(Be,ondestroy);stop();o(t)};const ondata=t=>{this.off("error",onerr);this.off("end",onend);this.off(Be,ondestroy);this.pause();r({value:t,done:!!this[ve]})};const onend=()=>{this.off("error",onerr);this.off("data",ondata);this.off(Be,ondestroy);stop();r({done:true,value:undefined})};const ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,i)=>{o=i;r=t;this.once(Be,ondestroy);this.once("error",onerr);this.once("end",onend);this.once("data",ondata)}))};return{next:next,throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Je]=false;let t=false;const stop=()=>{this.pause();this.off(Ue,stop);this.off(Be,stop);this.off("end",stop);t=true;return{done:true,value:undefined}};const next=()=>{if(t)return stop();const i=this.read();return i===null?stop():{done:false,value:i}};this.once("end",stop);this.once(Ue,stop);this.once(Be,stop);return{next:next,throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[Be]){if(t)this.emit("error",t);else this.emit(Be);return this}this[Be]=true;this[Je]=true;this[Ie].length=0;this[Ce]=0;const i=this;if(typeof i.close==="function"&&!this[ke])i.close();if(t)this.emit("error",t);else this.emit(Be);return this}static get isStream(){return isStream}}const Ke=ye.writev;const Xe=Symbol("_autoClose");const Qe=Symbol("_close");const ti=Symbol("_ended");const ei=Symbol("_fd");const ii=Symbol("_finished");const si=Symbol("_flags");const ri=Symbol("_flush");const ni=Symbol("_handleChunk");const oi=Symbol("_makeBuf");const ai=Symbol("_mode");const hi=Symbol("_needDrain");const ci=Symbol("_onerror");const li=Symbol("_onopen");const ui=Symbol("_onread");const fi=Symbol("_onwrite");const di=Symbol("_open");const pi=Symbol("_path");const mi=Symbol("_pos");const yi=Symbol("_queue");const gi=Symbol("_read");const bi=Symbol("_readSize");const wi=Symbol("_reading");const vi=Symbol("_remain");const Si=Symbol("_size");const Ei=Symbol("_write");const _i=Symbol("_writing");const xi=Symbol("_defaultFlag");const ki=Symbol("_errored");class ReadStream extends Minipass{[ki]=false;[ei];[pi];[bi];[wi]=false;[Si];[vi];[Xe];constructor(t,i){i=i||{};super(i);this.readable=true;this.writable=false;if(typeof t!=="string"){throw new TypeError("path must be a string")}this[ki]=false;this[ei]=typeof i.fd==="number"?i.fd:undefined;this[pi]=t;this[bi]=i.readSize||16*1024*1024;this[wi]=false;this[Si]=typeof i.size==="number"?i.size:Infinity;this[vi]=this[Si];this[Xe]=typeof i.autoClose==="boolean"?i.autoClose:true;if(typeof this[ei]==="number"){this[gi]()}else{this[di]()}}get fd(){return this[ei]}get path(){return this[pi]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[di](){ye.open(this[pi],"r",((t,i)=>this[li](t,i)))}[li](t,i){if(t){this[ci](t)}else{this[ei]=i;this.emit("open",i);this[gi]()}}[oi](){return Buffer.allocUnsafe(Math.min(this[bi],this[vi]))}[gi](){if(!this[wi]){this[wi]=true;const t=this[oi]();if(t.length===0){return process.nextTick((()=>this[ui](null,0,t)))}ye.read(this[ei],t,0,t.length,null,((t,i,r)=>this[ui](t,i,r)))}}[ui](t,i,r){this[wi]=false;if(t){this[ci](t)}else if(this[ni](i,r)){this[gi]()}}[Qe](){if(this[Xe]&&typeof this[ei]==="number"){const t=this[ei];this[ei]=undefined;ye.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[ci](t){this[wi]=true;this[Qe]();this.emit("error",t)}[ni](t,i){let r=false;this[vi]-=t;if(t>0){r=super.write(t<i.length?i.subarray(0,t):i)}if(t===0||this[vi]<=0){r=false;this[Qe]();super.end()}return r}emit(t,...i){switch(t){case"prefinish":case"finish":return false;case"drain":if(typeof this[ei]==="number"){this[gi]()}return false;case"error":if(this[ki]){return false}this[ki]=true;return super.emit(t,...i);default:return super.emit(t,...i)}}}class ReadStreamSync extends ReadStream{[di](){let t=true;try{this[li](null,ye.openSync(this[pi],"r"));t=false}finally{if(t){this[Qe]()}}}[gi](){let t=true;try{if(!this[wi]){this[wi]=true;do{const t=this[oi]();const i=t.length===0?0:ye.readSync(this[ei],t,0,t.length,null);if(!this[ni](i,t)){break}}while(true);this[wi]=false}t=false}finally{if(t){this[Qe]()}}}[Qe](){if(this[Xe]&&typeof this[ei]==="number"){const t=this[ei];this[ei]=undefined;ye.closeSync(t);this.emit("close")}}}class WriteStream extends me{readable=false;writable=true;[ki]=false;[_i]=false;[ti]=false;[yi]=[];[hi]=false;[pi];[ai];[Xe];[ei];[xi];[si];[ii]=false;[mi];constructor(t,i){i=i||{};super(i);this[pi]=t;this[ei]=typeof i.fd==="number"?i.fd:undefined;this[ai]=i.mode===undefined?438:i.mode;this[mi]=typeof i.start==="number"?i.start:undefined;this[Xe]=typeof i.autoClose==="boolean"?i.autoClose:true;const r=this[mi]!==undefined?"r+":"w";this[xi]=i.flags===undefined;this[si]=i.flags===undefined?r:i.flags;if(this[ei]===undefined){this[di]()}}emit(t,...i){if(t==="error"){if(this[ki]){return false}this[ki]=true}return super.emit(t,...i)}get fd(){return this[ei]}get path(){return this[pi]}[ci](t){this[Qe]();this[_i]=true;this.emit("error",t)}[di](){ye.open(this[pi],this[si],this[ai],((t,i)=>this[li](t,i)))}[li](t,i){if(this[xi]&&this[si]==="r+"&&t&&t.code==="ENOENT"){this[si]="w";this[di]()}else if(t){this[ci](t)}else{this[ei]=i;this.emit("open",i);if(!this[_i]){this[ri]()}}}end(t,i){if(t){this.write(t,i)}this[ti]=true;if(!this[_i]&&!this[yi].length&&typeof this[ei]==="number"){this[fi](null,0)}return this}write(t,i){if(typeof t==="string"){t=Buffer.from(t,i)}if(this[ti]){this.emit("error",new Error("write() after end()"));return false}if(this[ei]===undefined||this[_i]||this[yi].length){this[yi].push(t);this[hi]=true;return false}this[_i]=true;this[Ei](t);return true}[Ei](t){ye.write(this[ei],t,0,t.length,this[mi],((t,i)=>this[fi](t,i)))}[fi](t,i){if(t){this[ci](t)}else{if(this[mi]!==undefined&&typeof i==="number"){this[mi]+=i}if(this[yi].length){this[ri]()}else{this[_i]=false;if(this[ti]&&!this[ii]){this[ii]=true;this[Qe]();this.emit("finish")}else if(this[hi]){this[hi]=false;this.emit("drain")}}}}[ri](){if(this[yi].length===0){if(this[ti]){this[fi](null,0)}}else if(this[yi].length===1){this[Ei](this[yi].pop())}else{const t=this[yi];this[yi]=[];Ke(this[ei],t,this[mi],((t,i)=>this[fi](t,i)))}}[Qe](){if(this[Xe]&&typeof this[ei]==="number"){const t=this[ei];this[ei]=undefined;ye.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[di](){let t;if(this[xi]&&this[si]==="r+"){try{t=ye.openSync(this[pi],this[si],this[ai])}catch(t){if(t?.code==="ENOENT"){this[si]="w";return this[di]()}else{throw t}}}else{t=ye.openSync(this[pi],this[si],this[ai])}this[li](null,t)}[Qe](){if(this[Xe]&&typeof this[ei]==="number"){const t=this[ei];this[ei]=undefined;ye.closeSync(t);this.emit("close")}}[Ei](t){let i=true;try{this[fi](null,ye.writeSync(this[ei],t,0,t.length,this[mi]));i=false}finally{if(i){try{this[Qe]()}catch{}}}}}var Oi=__nccwpck_require__(6928);const Ri=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"],["onentry","onReadEntry"]]);const isSyncFile=t=>!!t.sync&&!!t.file;const isAsyncFile=t=>!t.sync&&!!t.file;const isSyncNoFile=t=>!!t.sync&&!t.file;const isAsyncNoFile=t=>!t.sync&&!t.file;const isSync=t=>!!t.sync;const isAsync=t=>!t.sync;const isFile=t=>!!t.file;const isNoFile=t=>!t.file;const dealiasKey=t=>{const i=Ri.get(t);if(i)return i;return t};const dealias=(t={})=>{if(!t)return{};const i={};for(const[r,o]of Object.entries(t)){const t=dealiasKey(r);i[t]=o}if(i.chmod===undefined&&i.noChmod===false){i.chmod=true}delete i.noChmod;return i};const makeCommand=(t,i,r,o,a)=>Object.assign(((h=[],c,l)=>{if(Array.isArray(h)){c=h;h={}}if(typeof c==="function"){l=c;c=undefined}if(!c){c=[]}else{c=Array.from(c)}const u=dealias(h);a?.(u,c);if(isSyncFile(u)){if(typeof l==="function"){throw new TypeError("callback not supported for sync tar functions")}return t(u,c)}else if(isAsyncFile(u)){const t=i(u,c);const r=l?l:undefined;return r?t.then((()=>r()),r):t}else if(isSyncNoFile(u)){if(typeof l==="function"){throw new TypeError("callback not supported for sync tar functions")}return r(u,c)}else if(isAsyncNoFile(u)){if(typeof l==="function"){throw new TypeError("callback only supported with file option")}return o(u,c)}else{throw new Error("impossible options??")}}),{syncFile:t,asyncFile:i,syncNoFile:r,asyncNoFile:o,validate:a});var Ti=__nccwpck_require__(2613);var Pi=__nccwpck_require__(181);const Di=t(import.meta.url)("zlib");const Ai=Di.constants||{ZLIB_VERNUM:4736};const Fi=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:Infinity,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},Ai));const Mi=Pi.Buffer.concat;const Ii=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message);this.code=t.code;this.errno=t.errno;if(!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+t.message;Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const Li=Symbol("flushFlag");class ZlibBase extends Minipass{#t=false;#e=false;#i;#s;#r;#n;#o;get sawError(){return this.#t}get handle(){return this.#n}get flushFlag(){return this.#i}constructor(t,i){if(!t||typeof t!=="object")throw new TypeError("invalid options for ZlibBase constructor");super(t);this.#i=t.flush??0;this.#s=t.finishFlush??0;this.#r=t.fullFlushFlag??0;try{this.#n=new Di[i](t)}catch(t){throw new ZlibError(t)}this.#o=t=>{if(this.#t)return;this.#t=true;this.close();this.emit("error",t)};this.#n?.on("error",(t=>this.#o(new ZlibError(t))));this.once("end",(()=>this.close))}close(){if(this.#n){this.#n.close();this.#n=undefined;this.emit("close")}}reset(){if(!this.#t){Ti(this.#n,"zlib binding closed");return this.#n.reset?.()}}flush(t){if(this.ended)return;if(typeof t!=="number")t=this.#r;this.write(Object.assign(Pi.Buffer.alloc(0),{[Li]:t}))}end(t,i,r){if(typeof t==="function"){r=t;i=undefined;t=undefined}if(typeof i==="function"){r=i;i=undefined}if(t){if(i)this.write(t,i);else this.write(t)}this.flush(this.#s);this.#e=true;return super.end(r)}get ended(){return this.#e}[Ii](t){return super.write(t)}write(t,i,r){if(typeof i==="function")r=i,i="utf8";if(typeof t==="string")t=Pi.Buffer.from(t,i);if(this.#t)return;Ti(this.#n,"zlib binding closed");const o=this.#n._handle;const a=o.close;o.close=()=>{};const h=this.#n.close;this.#n.close=()=>{};Pi.Buffer.concat=t=>t;let c=undefined;try{const i=typeof t[Li]==="number"?t[Li]:this.#i;c=this.#n._processChunk(t,i);Pi.Buffer.concat=Mi}catch(t){Pi.Buffer.concat=Mi;this.#o(new ZlibError(t))}finally{if(this.#n){this.#n._handle=o;o.close=a;this.#n.close=h;this.#n.removeAllListeners("error")}}if(this.#n)this.#n.on("error",(t=>this.#o(new ZlibError(t))));let l;if(c){if(Array.isArray(c)&&c.length>0){const t=c[0];l=this[Ii](Pi.Buffer.from(t));for(let t=1;t<c.length;t++){l=this[Ii](c[t])}}else{l=this[Ii](Pi.Buffer.from(c))}}if(r)r();return l}}class Zlib extends ZlibBase{#a;#h;constructor(t,i){t=t||{};t.flush=t.flush||Fi.Z_NO_FLUSH;t.finishFlush=t.finishFlush||Fi.Z_FINISH;t.fullFlushFlag=Fi.Z_FULL_FLUSH;super(t,i);this.#a=t.level;this.#h=t.strategy}params(t,i){if(this.sawError)return;if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#a!==t||this.#h!==i){this.flush(Fi.Z_SYNC_FLUSH);Ti(this.handle,"zlib binding closed");const r=this.handle.flush;this.handle.flush=(t,i)=>{if(typeof t==="function"){i=t;t=this.flushFlag}this.flush(t);i?.()};try{this.handle.params(t,i)}finally{this.handle.flush=r}if(this.handle){this.#a=t;this.#h=i}}}}class Deflate extends Zlib{constructor(t){super(t,"Deflate")}}class Inflate extends Zlib{constructor(t){super(t,"Inflate")}}class Gzip extends Zlib{#c;constructor(t){super(t,"Gzip");this.#c=t&&!!t.portable}[Ii](t){if(!this.#c)return super[Ii](t);this.#c=false;t[9]=255;return super[Ii](t)}}class Gunzip extends Zlib{constructor(t){super(t,"Gunzip")}}class DeflateRaw extends Zlib{constructor(t){super(t,"DeflateRaw")}}class InflateRaw extends Zlib{constructor(t){super(t,"InflateRaw")}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,i){t=t||{};t.flush=t.flush||Fi.BROTLI_OPERATION_PROCESS;t.finishFlush=t.finishFlush||Fi.BROTLI_OPERATION_FINISH;t.fullFlushFlag=Fi.BROTLI_OPERATION_FLUSH;super(t,i)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const i of t){this.push(i)}}*[Symbol.iterator](){for(let t=this.head;t;t=t.next){yield t.value}}removeNode(t){if(t.list!==this){throw new Error("removing node which does not belong to this list")}const i=t.next;const r=t.prev;if(i){i.prev=r}if(r){r.next=i}if(t===this.head){this.head=i}if(t===this.tail){this.tail=r}this.length--;t.next=undefined;t.prev=undefined;t.list=undefined;return i}unshiftNode(t){if(t===this.head){return}if(t.list){t.list.removeNode(t)}const i=this.head;t.list=this;t.next=i;if(i){i.prev=t}this.head=t;if(!this.tail){this.tail=t}this.length++}pushNode(t){if(t===this.tail){return}if(t.list){t.list.removeNode(t)}const i=this.tail;t.list=this;t.prev=i;if(i){i.next=t}this.tail=t;if(!this.head){this.head=t}this.length++}push(...t){for(let i=0,r=t.length;i<r;i++){push(this,t[i])}return this.length}unshift(...t){for(var i=0,r=t.length;i<r;i++){unshift(this,t[i])}return this.length}pop(){if(!this.tail){return undefined}const t=this.tail.value;const i=this.tail;this.tail=this.tail.prev;if(this.tail){this.tail.next=undefined}else{this.head=undefined}i.list=undefined;this.length--;return t}shift(){if(!this.head){return undefined}const t=this.head.value;const i=this.head;this.head=this.head.next;if(this.head){this.head.prev=undefined}else{this.tail=undefined}i.list=undefined;this.length--;return t}forEach(t,i){i=i||this;for(let r=this.head,o=0;!!r;o++){t.call(i,r.value,o,this);r=r.next}}forEachReverse(t,i){i=i||this;for(let r=this.tail,o=this.length-1;!!r;o--){t.call(i,r.value,o,this);r=r.prev}}get(t){let i=0;let r=this.head;for(;!!r&&i<t;i++){r=r.next}if(i===t&&!!r){return r.value}}getReverse(t){let i=0;let r=this.tail;for(;!!r&&i<t;i++){r=r.prev}if(i===t&&!!r){return r.value}}map(t,i){i=i||this;const r=new Yallist;for(let o=this.head;!!o;){r.push(t.call(i,o.value,this));o=o.next}return r}mapReverse(t,i){i=i||this;var r=new Yallist;for(let o=this.tail;!!o;){r.push(t.call(i,o.value,this));o=o.prev}return r}reduce(t,i){let r;let o=this.head;if(arguments.length>1){r=i}else if(this.head){o=this.head.next;r=this.head.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(var a=0;!!o;a++){r=t(r,o.value,a);o=o.next}return r}reduceReverse(t,i){let r;let o=this.tail;if(arguments.length>1){r=i}else if(this.tail){o=this.tail.prev;r=this.tail.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(let i=this.length-1;!!o;i--){r=t(r,o.value,i);o=o.prev}return r}toArray(){const t=new Array(this.length);for(let i=0,r=this.head;!!r;i++){t[i]=r.value;r=r.next}return t}toArrayReverse(){const t=new Array(this.length);for(let i=0,r=this.tail;!!r;i++){t[i]=r.value;r=r.prev}return t}slice(t=0,i=this.length){if(i<0){i+=this.length}if(t<0){t+=this.length}const r=new Yallist;if(i<t||i<0){return r}if(t<0){t=0}if(i>this.length){i=this.length}let o=this.head;let a=0;for(a=0;!!o&&a<t;a++){o=o.next}for(;!!o&&a<i;a++,o=o.next){r.push(o.value)}return r}sliceReverse(t=0,i=this.length){if(i<0){i+=this.length}if(t<0){t+=this.length}const r=new Yallist;if(i<t||i<0){return r}if(t<0){t=0}if(i>this.length){i=this.length}let o=this.length;let a=this.tail;for(;!!a&&o>i;o--){a=a.prev}for(;!!a&&o>t;o--,a=a.prev){r.push(a.value)}return r}splice(t,i=0,...r){if(t>this.length){t=this.length-1}if(t<0){t=this.length+t}let o=this.head;for(let i=0;!!o&&i<t;i++){o=o.next}const a=[];for(let t=0;!!o&&t<i;t++){a.push(o.value);o=this.removeNode(o)}if(!o){o=this.tail}else if(o!==this.tail){o=o.prev}for(const t of r){o=insertAfter(this,o,t)}return a}reverse(){const t=this.head;const i=this.tail;for(let i=t;!!i;i=i.prev){const t=i.prev;i.prev=i.next;i.next=t}this.head=i;this.tail=t;return this}}function insertAfter(t,i,r){const o=i;const a=i?i.next:t.head;const h=new Node(r,o,a,t);if(h.next===undefined){t.tail=h}if(h.prev===undefined){t.head=h}t.length++;return h}function push(t,i){t.tail=new Node(i,t.tail,undefined,t);if(!t.head){t.head=t.tail}t.length++}function unshift(t,i){t.head=new Node(i,undefined,t.head,t);if(!t.tail){t.tail=t.head}t.length++}class Node{list;next;prev;value;constructor(t,i,r,o){this.list=o;this.value=t;if(i){i.next=this;this.prev=i}else{this.prev=undefined}if(r){r.prev=this;this.next=r}else{this.next=undefined}}}const encode=(t,i)=>{if(!Number.isSafeInteger(t)){throw Error("cannot encode number outside of javascript safe integer range")}else if(t<0){encodeNegative(t,i)}else{encodePositive(t,i)}return i};const encodePositive=(t,i)=>{i[0]=128;for(var r=i.length;r>1;r--){i[r-1]=t&255;t=Math.floor(t/256)}};const encodeNegative=(t,i)=>{i[0]=255;var r=false;t=t*-1;for(var o=i.length;o>1;o--){var a=t&255;t=Math.floor(t/256);if(r){i[o-1]=onesComp(a)}else if(a===0){i[o-1]=0}else{r=true;i[o-1]=twosComp(a)}}};const parse=t=>{const i=t[0];const r=i===128?pos(t.subarray(1,t.length)):i===255?twos(t):null;if(r===null){throw Error("invalid base256 encoding")}if(!Number.isSafeInteger(r)){throw Error("parsed number outside of javascript safe integer range")}return r};const twos=t=>{var i=t.length;var r=0;var o=false;for(var a=i-1;a>-1;a--){var h=Number(t[a]);var c;if(o){c=onesComp(h)}else if(h===0){c=h}else{o=true;c=twosComp(h)}if(c!==0){r-=c*Math.pow(256,i-a-1)}}return r};const pos=t=>{var i=t.length;var r=0;for(var o=i-1;o>-1;o--){var a=Number(t[o]);if(a!==0){r+=a*Math.pow(256,i-o-1)}}return r};const onesComp=t=>(255^t)&255;const twosComp=t=>(255^t)+1&255;const isCode=t=>Ci.has(t);const isName=t=>Ni.has(t);const Ci=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"]]);const Ni=new Map(Array.from(Ci).map((t=>[t[1],t[0]])));class Header{cksumValid=false;needPax=false;nullBlock=false;block;path;mode;uid;gid;size;cksum;#l="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,i=0,r,o){if(Buffer.isBuffer(t)){this.decode(t,i||0,r,o)}else if(t){this.#u(t)}}decode(t,i,r,o){if(!i){i=0}if(!t||!(t.length>=i+512)){throw new Error("need 512 bytes for header")}this.path=decString(t,i,100);this.mode=decNumber(t,i+100,8);this.uid=decNumber(t,i+108,8);this.gid=decNumber(t,i+116,8);this.size=decNumber(t,i+124,12);this.mtime=decDate(t,i+136,12);this.cksum=decNumber(t,i+148,12);if(o)this.#u(o,true);if(r)this.#u(r);const a=decString(t,i+156,1);if(isCode(a)){this.#l=a||"0"}if(this.#l==="0"&&this.path.slice(-1)==="/"){this.#l="5"}if(this.#l==="5"){this.size=0}this.linkpath=decString(t,i+157,100);if(t.subarray(i+257,i+265).toString()==="ustar\x0000"){this.uname=decString(t,i+265,32);this.gname=decString(t,i+297,32);this.devmaj=decNumber(t,i+329,8)??0;this.devmin=decNumber(t,i+337,8)??0;if(t[i+475]!==0){const r=decString(t,i+345,155);this.path=r+"/"+this.path}else{const r=decString(t,i+345,130);if(r){this.path=r+"/"+this.path}this.atime=decDate(t,i+476,12);this.ctime=decDate(t,i+488,12)}}let h=8*32;for(let r=i;r<i+148;r++){h+=t[r]}for(let r=i+156;r<i+512;r++){h+=t[r]}this.cksumValid=h===this.cksum;if(this.cksum===undefined&&h===8*32){this.nullBlock=true}}#u(t,i=false){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,r])=>!(r===null||r===undefined||t==="path"&&i||t==="linkpath"&&i||t==="global")))))}encode(t,i=0){if(!t){t=this.block=Buffer.alloc(512)}if(this.#l==="Unsupported"){this.#l="0"}if(!(t.length>=i+512)){throw new Error("need 512 bytes for header")}const r=this.ctime||this.atime?130:155;const o=splitPrefix(this.path||"",r);const a=o[0];const h=o[1];this.needPax=!!o[2];this.needPax=encString(t,i,100,a)||this.needPax;this.needPax=encNumber(t,i+100,8,this.mode)||this.needPax;this.needPax=encNumber(t,i+108,8,this.uid)||this.needPax;this.needPax=encNumber(t,i+116,8,this.gid)||this.needPax;this.needPax=encNumber(t,i+124,12,this.size)||this.needPax;this.needPax=encDate(t,i+136,12,this.mtime)||this.needPax;t[i+156]=this.#l.charCodeAt(0);this.needPax=encString(t,i+157,100,this.linkpath)||this.needPax;t.write("ustar\x0000",i+257,8);this.needPax=encString(t,i+265,32,this.uname)||this.needPax;this.needPax=encString(t,i+297,32,this.gname)||this.needPax;this.needPax=encNumber(t,i+329,8,this.devmaj)||this.needPax;this.needPax=encNumber(t,i+337,8,this.devmin)||this.needPax;this.needPax=encString(t,i+345,r,h)||this.needPax;if(t[i+475]!==0){this.needPax=encString(t,i+345,155,h)||this.needPax}else{this.needPax=encString(t,i+345,130,h)||this.needPax;this.needPax=encDate(t,i+476,12,this.atime)||this.needPax;this.needPax=encDate(t,i+488,12,this.ctime)||this.needPax}let c=8*32;for(let r=i;r<i+148;r++){c+=t[r]}for(let r=i+156;r<i+512;r++){c+=t[r]}this.cksum=c;encNumber(t,i+148,8,this.cksum);this.cksumValid=true;return this.needPax}get type(){return this.#l==="Unsupported"?this.#l:Ci.get(this.#l)}get typeKey(){return this.#l}set type(t){const i=String(Ni.get(t));if(isCode(i)||i==="Unsupported"){this.#l=i}else if(isCode(t)){this.#l=t}else{throw new TypeError("invalid entry type: "+t)}}}const splitPrefix=(t,i)=>{const r=100;let o=t;let a="";let h=undefined;const c=l.posix.parse(t).root||".";if(Buffer.byteLength(o)<r){h=[o,a,false]}else{a=l.posix.dirname(o);o=l.posix.basename(o);do{if(Buffer.byteLength(o)<=r&&Buffer.byteLength(a)<=i){h=[o,a,false]}else if(Buffer.byteLength(o)>r&&Buffer.byteLength(a)<=i){h=[o.slice(0,r-1),a,true]}else{o=l.posix.join(l.posix.basename(a),o);a=l.posix.dirname(a)}}while(a!==c&&h===undefined);if(!h){h=[t.slice(0,r-1),"",true]}}return h};const decString=(t,i,r)=>t.subarray(i,i+r).toString("utf8").replace(/\0.*/,"");const decDate=(t,i,r)=>numToDate(decNumber(t,i,r));const numToDate=t=>t===undefined?undefined:new Date(t*1e3);const decNumber=(t,i,r)=>Number(t[i])&128?parse(t.subarray(i,i+r)):decSmallNumber(t,i,r);const nanUndef=t=>isNaN(t)?undefined:t;const decSmallNumber=(t,i,r)=>nanUndef(parseInt(t.subarray(i,i+r).toString("utf8").replace(/\0.*$/,"").trim(),8));const $i={12:8589934591,8:2097151};const encNumber=(t,i,r,o)=>o===undefined?false:o>$i[r]||o<0?(encode(o,t.subarray(i,i+r)),true):(encSmallNumber(t,i,r,o),false);const encSmallNumber=(t,i,r,o)=>t.write(octalString(o,r),i,r,"ascii");const octalString=(t,i)=>padOctal(Math.floor(t).toString(8),i);const padOctal=(t,i)=>(t.length===i-1?t:new Array(i-t.length-1).join("0")+t+" ")+"\0";const encDate=(t,i,r,o)=>o===undefined?false:encNumber(t,i,r,o.getTime()/1e3);const ji=new Array(156).join("\0");const encString=(t,i,r,o)=>o===undefined?false:(t.write(o+ji,i,r,"utf8"),o.length!==Buffer.byteLength(o)||o.length>r);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=false){this.atime=t.atime;this.charset=t.charset;this.comment=t.comment;this.ctime=t.ctime;this.dev=t.dev;this.gid=t.gid;this.global=i;this.gname=t.gname;this.ino=t.ino;this.linkpath=t.linkpath;this.mtime=t.mtime;this.nlink=t.nlink;this.path=t.path;this.size=t.size;this.uid=t.uid;this.uname=t.uname}encode(){const t=this.encodeBody();if(t===""){return Buffer.allocUnsafe(0)}const i=Buffer.byteLength(t);const r=512*Math.ceil(1+i/512);const o=Buffer.allocUnsafe(r);for(let t=0;t<512;t++){o[t]=0}new Header({path:("PaxHeader/"+(0,l.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(o);o.write(t,512,i,"utf8");for(let t=i+512;t<o.length;t++){o[t]=0}return o}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===undefined){return""}const i=this[t];const r=i instanceof Date?i.getTime()/1e3:i;const o=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+r+"\n";const a=Buffer.byteLength(o);let h=Math.floor(Math.log(a)/Math.log(10))+1;if(a+h>=Math.pow(10,h)){h+=1}const c=h+a;return c+o}static parse(t,i,r=false){return new Pax(merge(parseKV(t),i),r)}}const merge=(t,i)=>i?Object.assign({},i,t):t;const parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null));const parseKVLine=(t,i)=>{const r=parseInt(i,10);if(r!==Buffer.byteLength(i)+1){return t}i=i.slice((r+" ").length);const o=i.split("=");const a=o.shift();if(!a){return t}const h=a.replace(/^SCHILY\.(dev|ino|nlink)/,"$1");const c=o.join("=");t[h]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(h)?new Date(Number(c)*1e3):/^[0-9]+$/.test(c)?+c:c;return t};const Bi=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const Ui=Bi!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends Minipass{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=false;ignore=false;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=false;absolute;unsupported=false;constructor(t,i,r){super({});this.pause();this.extended=i;this.globalExtended=r;this.header=t;this.remain=t.size??0;this.startBlockSize=512*Math.ceil(this.remain/512);this.blockRemain=this.startBlockSize;this.type=t.type;switch(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=true;break;default:this.ignore=true}if(!t.path){throw new Error("no path provided for tar.ReadEntry")}this.path=Ui(t.path);this.mode=t.mode;if(this.mode){this.mode=this.mode&4095}this.uid=t.uid;this.gid=t.gid;this.uname=t.uname;this.gname=t.gname;this.size=this.remain;this.mtime=t.mtime;this.atime=t.atime;this.ctime=t.ctime;this.linkpath=t.linkpath?Ui(t.linkpath):undefined;this.uname=t.uname;this.gname=t.gname;if(i){this.#u(i)}if(r){this.#u(r,true)}}write(t){const i=t.length;if(i>this.blockRemain){throw new Error("writing more to entry than is appropriate")}const r=this.remain;const o=this.blockRemain;this.remain=Math.max(0,r-i);this.blockRemain=Math.max(0,o-i);if(this.ignore){return true}if(r>=i){return super.write(t)}return super.write(t.subarray(0,r))}#u(t,i=false){if(t.path)t.path=Ui(t.path);if(t.linkpath)t.linkpath=Ui(t.linkpath);Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,r])=>!(r===null||r===undefined||t==="path"&&i)))))}}const warnMethod=(t,i,r,o={})=>{if(t.file){o.file=t.file}if(t.cwd){o.cwd=t.cwd}o.code=r instanceof Error&&r.code||i;o.tarCode=i;if(!t.strict&&o.recoverable!==false){if(r instanceof Error){o=Object.assign(r,o);r=r.message}t.emit("warn",i,r,o)}else if(r instanceof Error){t.emit("error",Object.assign(r,o))}else{t.emit("error",Object.assign(new Error(`${i}: ${r}`),o))}};const zi=1024*1024;const Wi=Buffer.from([31,139]);const Hi=Symbol("state");const Gi=Symbol("writeEntry");const Yi=Symbol("readEntry");const Vi=Symbol("nextEntry");const Zi=Symbol("processEntry");const qi=Symbol("extendedHeader");const Ji=Symbol("globalExtendedHeader");const Ki=Symbol("meta");const Xi=Symbol("emitMeta");const Qi=Symbol("buffer");const ts=Symbol("queue");const es=Symbol("ended");const is=Symbol("emittedEnd");const ss=Symbol("emit");const rs=Symbol("unzip");const ns=Symbol("consumeChunk");const os=Symbol("consumeChunkSub");const as=Symbol("consumeBody");const hs=Symbol("consumeMeta");const cs=Symbol("consumeHeader");const ls=Symbol("consuming");const us=Symbol("bufferConcat");const fs=Symbol("maybeEnd");const ds=Symbol("writing");const ps=Symbol("aborted");const ms=Symbol("onDone");const ys=Symbol("sawValidEntry");const gs=Symbol("sawNullBlock");const bs=Symbol("sawEOF");const ws=Symbol("closeStream");const noop=()=>true;class Parser extends me.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=true;readable=false;[ts]=new Yallist;[Qi];[Yi];[Gi];[Hi]="begin";[Ki]="";[qi];[Ji];[es]=false;[rs];[ps]=false;[ys];[gs]=false;[bs]=false;[ds]=false;[ls]=false;[is]=false;constructor(t={}){super();this.file=t.file||"";this.on(ms,(()=>{if(this[Hi]==="begin"||this[ys]===false){this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}}));if(t.ondone){this.on(ms,t.ondone)}else{this.on(ms,(()=>{this.emit("prefinish");this.emit("finish");this.emit("end")}))}this.strict=!!t.strict;this.maxMetaEntrySize=t.maxMetaEntrySize||zi;this.filter=typeof t.filter==="function"?t.filter:noop;const i=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!t.gzip&&t.brotli!==undefined?t.brotli:i?undefined:false;this.on("end",(()=>this[ws]()));if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}if(typeof t.onReadEntry==="function"){this.on("entry",t.onReadEntry)}}warn(t,i,r={}){warnMethod(this,t,i,r)}[cs](t,i){if(this[ys]===undefined){this[ys]=false}let r;try{r=new Header(t,i,this[qi],this[Ji])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(r.nullBlock){if(this[gs]){this[bs]=true;if(this[Hi]==="begin"){this[Hi]="header"}this[ss]("eof")}else{this[gs]=true;this[ss]("nullBlock")}}else{this[gs]=false;if(!r.cksumValid){this.warn("TAR_ENTRY_INVALID","checksum failure",{header:r})}else if(!r.path){this.warn("TAR_ENTRY_INVALID","path is required",{header:r})}else{const t=r.type;if(/^(Symbolic)?Link$/.test(t)&&!r.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath required",{header:r})}else if(!/^(Symbolic)?Link$/.test(t)&&!/^(Global)?ExtendedHeader$/.test(t)&&r.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:r})}else{const t=this[Gi]=new ReadEntry(r,this[qi],this[Ji]);if(!this[ys]){if(t.remain){const onend=()=>{if(!t.invalid){this[ys]=true}};t.on("end",onend)}else{this[ys]=true}}if(t.meta){if(t.size>this.maxMetaEntrySize){t.ignore=true;this[ss]("ignoredEntry",t);this[Hi]="ignore";t.resume()}else if(t.size>0){this[Ki]="";t.on("data",(t=>this[Ki]+=t));this[Hi]="meta"}}else{this[qi]=undefined;t.ignore=t.ignore||!this.filter(t.path,t);if(t.ignore){this[ss]("ignoredEntry",t);this[Hi]=t.remain?"ignore":"header";t.resume()}else{if(t.remain){this[Hi]="body"}else{this[Hi]="header";t.end()}if(!this[Yi]){this[ts].push(t);this[Vi]()}else{this[ts].push(t)}}}}}}}[ws](){queueMicrotask((()=>this.emit("close")))}[Zi](t){let i=true;if(!t){this[Yi]=undefined;i=false}else if(Array.isArray(t)){const[i,...r]=t;this.emit(i,...r)}else{this[Yi]=t;this.emit("entry",t);if(!t.emittedEnd){t.on("end",(()=>this[Vi]()));i=false}}return i}[Vi](){do{}while(this[Zi](this[ts].shift()));if(!this[ts].length){const t=this[Yi];const i=!t||t.flowing||t.size===t.remain;if(i){if(!this[ds]){this.emit("drain")}}else{t.once("drain",(()=>this.emit("drain")))}}}[as](t,i){const r=this[Gi];if(!r){throw new Error("attempt to consume body without entry??")}const o=r.blockRemain??0;const a=o>=t.length&&i===0?t:t.subarray(i,i+o);r.write(a);if(!r.blockRemain){this[Hi]="header";this[Gi]=undefined;r.end()}return a.length}[hs](t,i){const r=this[Gi];const o=this[as](t,i);if(!this[Gi]&&r){this[Xi](r)}return o}[ss](t,i,r){if(!this[ts].length&&!this[Yi]){this.emit(t,i,r)}else{this[ts].push([t,i,r])}}[Xi](t){this[ss]("meta",this[Ki]);switch(t.type){case"ExtendedHeader":case"OldExtendedHeader":this[qi]=Pax.parse(this[Ki],this[qi],false);break;case"GlobalExtendedHeader":this[Ji]=Pax.parse(this[Ki],this[Ji],true);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[qi]??Object.create(null);this[qi]=t;t.path=this[Ki].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[qi]||Object.create(null);this[qi]=t;t.linkpath=this[Ki].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[ps]=true;this.emit("abort",t);this.warn("TAR_ABORT",t,{recoverable:false})}write(t,i,r){if(typeof i==="function"){r=i;i=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof i==="string"?i:"utf8")}if(this[ps]){r?.();return false}const o=this[rs]===undefined||this.brotli===undefined&&this[rs]===false;if(o&&t){if(this[Qi]){t=Buffer.concat([this[Qi],t]);this[Qi]=undefined}if(t.length<Wi.length){this[Qi]=t;r?.();return true}for(let i=0;this[rs]===undefined&&i<Wi.length;i++){if(t[i]!==Wi[i]){this[rs]=false}}const i=this.brotli===undefined;if(this[rs]===false&&i){if(t.length<512){if(this[es]){this.brotli=true}else{this[Qi]=t;r?.();return true}}else{try{new Header(t.subarray(0,512));this.brotli=false}catch(t){this.brotli=true}}}if(this[rs]===undefined||this[rs]===false&&this.brotli){const i=this[es];this[es]=false;this[rs]=this[rs]===undefined?new Unzip({}):new BrotliDecompress({});this[rs].on("data",(t=>this[ns](t)));this[rs].on("error",(t=>this.abort(t)));this[rs].on("end",(()=>{this[es]=true;this[ns]()}));this[ds]=true;const o=!!this[rs][i?"end":"write"](t);this[ds]=false;r?.();return o}}this[ds]=true;if(this[rs]){this[rs].write(t)}else{this[ns](t)}this[ds]=false;const a=this[ts].length?false:this[Yi]?this[Yi].flowing:true;if(!a&&!this[ts].length){this[Yi]?.once("drain",(()=>this.emit("drain")))}r?.();return a}[us](t){if(t&&!this[ps]){this[Qi]=this[Qi]?Buffer.concat([this[Qi],t]):t}}[fs](){if(this[es]&&!this[is]&&!this[ps]&&!this[ls]){this[is]=true;const t=this[Gi];if(t&&t.blockRemain){const i=this[Qi]?this[Qi].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${i} available)`,{entry:t});if(this[Qi]){t.write(this[Qi])}t.end()}this[ss](ms)}}[ns](t){if(this[ls]&&t){this[us](t)}else if(!t&&!this[Qi]){this[fs]()}else if(t){this[ls]=true;if(this[Qi]){this[us](t);const i=this[Qi];this[Qi]=undefined;this[os](i)}else{this[os](t)}while(this[Qi]&&this[Qi]?.length>=512&&!this[ps]&&!this[bs]){const t=this[Qi];this[Qi]=undefined;this[os](t)}this[ls]=false}if(!this[Qi]||this[es]){this[fs]()}}[os](t){let i=0;const r=t.length;while(i+512<=r&&!this[ps]&&!this[bs]){switch(this[Hi]){case"begin":case"header":this[cs](t,i);i+=512;break;case"ignore":case"body":i+=this[as](t,i);break;case"meta":i+=this[hs](t,i);break;default:throw new Error("invalid state: "+this[Hi])}}if(i<r){if(this[Qi]){this[Qi]=Buffer.concat([t.subarray(i),this[Qi]])}else{this[Qi]=t.subarray(i)}}}end(t,i,r){if(typeof t==="function"){r=t;i=undefined;t=undefined}if(typeof i==="function"){r=i;i=undefined}if(typeof t==="string"){t=Buffer.from(t,i)}if(r)this.once("finish",r);if(!this[ps]){if(this[rs]){if(t)this[rs].write(t);this[rs].end()}else{this[es]=true;if(this.brotli===undefined)t=t||Buffer.alloc(0);if(t)this.write(t);this[fs]()}}return this}}const stripTrailingSlashes=t=>{let i=t.length-1;let r=-1;while(i>-1&&t.charAt(i)==="/"){r=i;i--}return r===-1?t:t.slice(0,r)};const onReadEntryFunction=t=>{const i=t.onReadEntry;t.onReadEntry=i?t=>{i(t);t.resume()}:t=>t.resume()};const filesFilter=(t,i)=>{const r=new Map(i.map((t=>[stripTrailingSlashes(t),true])));const o=t.filter;const mapHas=(t,i="")=>{const o=i||(0,Oi.parse)(t).root||".";let a;if(t===o)a=false;else{const i=r.get(t);if(i!==undefined){a=i}else{a=mapHas((0,Oi.dirname)(t),o)}}r.set(t,a);return a};t.filter=o?(t,i)=>o(t,i)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))};const listFileSync=t=>{const i=new Parser(t);const r=t.file;let o;try{const h=a.statSync(r);const c=t.maxReadSize||16*1024*1024;if(h.size<c){i.end(a.readFileSync(r))}else{let t=0;const l=Buffer.allocUnsafe(c);o=a.openSync(r,"r");while(t<h.size){const r=a.readSync(o,l,0,c,t);t+=r;i.write(l.subarray(0,r))}i.end()}}finally{if(typeof o==="number"){try{a.closeSync(o)}catch(t){}}}};const listFile=(t,i)=>{const r=new Parser(t);const o=t.maxReadSize||16*1024*1024;const h=t.file;const c=new Promise(((t,i)=>{r.on("error",i);r.on("end",t);a.stat(h,((t,a)=>{if(t){i(t)}else{const t=new ReadStream(h,{readSize:o,size:a.size});t.on("error",i);t.pipe(r)}}))}));return c};const vs=makeCommand(listFileSync,listFile,(t=>new Parser(t)),(t=>new Parser(t)),((t,i)=>{if(i?.length)filesFilter(t,i);if(!t.noResume)onReadEntryFunction(t)}));const modeFix=(t,i,r)=>{t&=4095;if(r){t=(t|384)&~18}if(i){if(t&256){t|=64}if(t&32){t|=8}if(t&4){t|=1}}return t};const{isAbsolute:Ss,parse:Es}=l.win32;const stripAbsolutePath=t=>{let i="";let r=Es(t);while(Ss(t)||r.root){const o=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":r.root;t=t.slice(o.length);i+=o;r=Es(t)}return[i,t]};const _s=["|","<",">","?",":"];const xs=_s.map((t=>String.fromCharCode(61440+t.charCodeAt(0))));const ks=new Map(_s.map(((t,i)=>[t,xs[i]])));const Os=new Map(xs.map(((t,i)=>[t,_s[i]])));const winchars_encode=t=>_s.reduce(((t,i)=>t.split(i).join(ks.get(i))),t);const decode=t=>xs.reduce(((t,i)=>t.split(i).join(Os.get(i))),t);const prefixPath=(t,i)=>{if(!i){return Ui(t)}t=Ui(t).replace(/^\.(\/|$)/,"");return stripTrailingSlashes(i)+"/"+t};const Rs=16*1024*1024;const Ts=Symbol("process");const Ps=Symbol("file");const Ds=Symbol("directory");const As=Symbol("symlink");const Fs=Symbol("hardlink");const Ms=Symbol("header");const Is=Symbol("read");const Ls=Symbol("lstat");const Cs=Symbol("onlstat");const Ns=Symbol("onread");const $s=Symbol("onreadlink");const js=Symbol("openfile");const Bs=Symbol("onopenfile");const Us=Symbol("close");const zs=Symbol("mode");const Ws=Symbol("awaitDrain");const Hs=Symbol("ondrain");const Gs=Symbol("prefix");class WriteEntry extends Minipass{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#f=false;constructor(t,i={}){const r=dealias(i);super();this.path=Ui(t);this.portable=!!r.portable;this.maxReadSize=r.maxReadSize||Rs;this.linkCache=r.linkCache||new Map;this.statCache=r.statCache||new Map;this.preservePaths=!!r.preservePaths;this.cwd=Ui(r.cwd||process.cwd());this.strict=!!r.strict;this.noPax=!!r.noPax;this.noMtime=!!r.noMtime;this.mtime=r.mtime;this.prefix=r.prefix?Ui(r.prefix):undefined;this.onWriteEntry=r.onWriteEntry;if(typeof r.onwarn==="function"){this.on("warn",r.onwarn)}let o=false;if(!this.preservePaths){const[t,i]=stripAbsolutePath(this.path);if(t&&typeof i==="string"){this.path=i;o=t}}this.win32=!!r.win32||process.platform==="win32";if(this.win32){this.path=decode(this.path.replace(/\\/g,"/"));t=t.replace(/\\/g,"/")}this.absolute=Ui(r.absolute||Oi.resolve(this.cwd,t));if(this.path===""){this.path="./"}if(o){this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path})}const a=this.statCache.get(this.absolute);if(a){this[Cs](a)}else{this[Ls]()}}warn(t,i,r={}){return warnMethod(this,t,i,r)}emit(t,...i){if(t==="error"){this.#f=true}return super.emit(t,...i)}[Ls](){ye.lstat(this.absolute,((t,i)=>{if(t){return this.emit("error",t)}this[Cs](i)}))}[Cs](t){this.statCache.set(this.absolute,t);this.stat=t;if(!t.isFile()){t.size=0}this.type=getType(t);this.emit("stat",t);this[Ts]()}[Ts](){switch(this.type){case"File":return this[Ps]();case"Directory":return this[Ds]();case"SymbolicLink":return this[As]();default:return this.end()}}[zs](t){return modeFix(t,this.type==="Directory",this.portable)}[Gs](t){return prefixPath(t,this.prefix)}[Ms](){if(!this.stat){throw new Error("cannot write header before stat")}if(this.type==="Directory"&&this.portable){this.noMtime=true}this.onWriteEntry?.(this);this.header=new Header({path:this[Gs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[Gs](this.linkpath):this.linkpath,mode:this[zs](this.stat.mode),uid:this.portable?undefined:this.stat.uid,gid:this.portable?undefined:this.stat.gid,size:this.stat.size,mtime:this.noMtime?undefined:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?undefined:this.type,uname:this.portable?undefined:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?undefined:this.stat.atime,ctime:this.portable?undefined:this.stat.ctime});if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.header.atime,ctime:this.portable?undefined:this.header.ctime,gid:this.portable?undefined:this.header.gid,mtime:this.noMtime?undefined:this.mtime||this.header.mtime,path:this[Gs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[Gs](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?undefined:this.header.uid,uname:this.portable?undefined:this.header.uname,dev:this.portable?undefined:this.stat.dev,ino:this.portable?undefined:this.stat.ino,nlink:this.portable?undefined:this.stat.nlink}).encode())}const t=this.header?.block;if(!t){throw new Error("failed to encode header")}super.write(t)}[Ds](){if(!this.stat){throw new Error("cannot create directory entry without stat")}if(this.path.slice(-1)!=="/"){this.path+="/"}this.stat.size=0;this[Ms]();this.end()}[As](){ye.readlink(this.absolute,((t,i)=>{if(t){return this.emit("error",t)}this[$s](i)}))}[$s](t){this.linkpath=Ui(t);this[Ms]();this.end()}[Fs](t){if(!this.stat){throw new Error("cannot create link entry without stat")}this.type="Link";this.linkpath=Ui(Oi.relative(this.cwd,t));this.stat.size=0;this[Ms]();this.end()}[Ps](){if(!this.stat){throw new Error("cannot create file entry without stat")}if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`;const i=this.linkCache.get(t);if(i?.indexOf(this.cwd)===0){return this[Fs](i)}this.linkCache.set(t,this.absolute)}this[Ms]();if(this.stat.size===0){return this.end()}this[js]()}[js](){ye.open(this.absolute,"r",((t,i)=>{if(t){return this.emit("error",t)}this[Bs](i)}))}[Bs](t){this.fd=t;if(this.#f){return this[Us]()}if(!this.stat){throw new Error("should stat before calling onopenfile")}this.blockLen=512*Math.ceil(this.stat.size/512);this.blockRemain=this.blockLen;const i=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(i);this.offset=0;this.pos=0;this.remain=this.stat.size;this.length=this.buf.length;this[Is]()}[Is](){const{fd:t,buf:i,offset:r,length:o,pos:a}=this;if(t===undefined||i===undefined){throw new Error("cannot read file without first opening")}ye.read(t,i,r,o,a,((t,i)=>{if(t){return this[Us]((()=>this.emit("error",t)))}this[Ns](i)}))}[Us](t=()=>{}){if(this.fd!==undefined)ye.close(this.fd,t)}[Ns](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Us]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Us]((()=>this.emit("error",t)))}if(!this.buf){throw new Error("should have created buffer prior to reading")}if(t===this.remain){for(let i=t;i<this.length&&t<this.blockRemain;i++){this.buf[i+this.offset]=0;t++;this.remain++}}const i=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);const r=this.write(i);if(!r){this[Ws]((()=>this[Hs]()))}else{this[Hs]()}}[Ws](t){this.once("drain",t)}write(t,i,r){if(typeof i==="function"){r=i;i=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof i==="string"?i:"utf8")}if(this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}this.remain-=t.length;this.blockRemain-=t.length;this.pos+=t.length;this.offset+=t.length;return super.write(t,null,r)}[Hs](){if(!this.remain){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}return this[Us]((t=>t?this.emit("error",t):this.end()))}if(!this.buf){throw new Error("buffer lost somehow in ONDRAIN")}if(this.offset>=this.length){this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length));this.offset=0}this.length=this.buf.length-this.offset;this[Is]()}}class WriteEntrySync extends WriteEntry{sync=true;[Ls](){this[Cs](ye.lstatSync(this.absolute))}[As](){this[$s](ye.readlinkSync(this.absolute))}[js](){this[Bs](ye.openSync(this.absolute,"r"))}[Is](){let t=true;try{const{fd:i,buf:r,offset:o,length:a,pos:h}=this;if(i===undefined||r===undefined){throw new Error("fd and buf must be set in READ method")}const c=ye.readSync(i,r,o,a,h);this[Ns](c);t=false}finally{if(t){try{this[Us]((()=>{}))}catch(t){}}}}[Ws](t){t()}[Us](t=()=>{}){if(this.fd!==undefined)ye.closeSync(this.fd);t()}}class WriteEntryTar extends Minipass{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,i,r={}){return warnMethod(this,t,i,r)}constructor(t,i={}){const r=dealias(i);super();this.preservePaths=!!r.preservePaths;this.portable=!!r.portable;this.strict=!!r.strict;this.noPax=!!r.noPax;this.noMtime=!!r.noMtime;this.onWriteEntry=r.onWriteEntry;this.readEntry=t;const{type:o}=t;if(o==="Unsupported"){throw new Error("writing entry that should be ignored")}this.type=o;if(this.type==="Directory"&&this.portable){this.noMtime=true}this.prefix=r.prefix;this.path=Ui(t.path);this.mode=t.mode!==undefined?this[zs](t.mode):undefined;this.uid=this.portable?undefined:t.uid;this.gid=this.portable?undefined:t.gid;this.uname=this.portable?undefined:t.uname;this.gname=this.portable?undefined:t.gname;this.size=t.size;this.mtime=this.noMtime?undefined:r.mtime||t.mtime;this.atime=this.portable?undefined:t.atime;this.ctime=this.portable?undefined:t.ctime;this.linkpath=t.linkpath!==undefined?Ui(t.linkpath):undefined;if(typeof r.onwarn==="function"){this.on("warn",r.onwarn)}let a=false;if(!this.preservePaths){const[t,i]=stripAbsolutePath(this.path);if(t&&typeof i==="string"){this.path=i;a=t}}this.remain=t.size;this.blockRemain=t.startBlockSize;this.onWriteEntry?.(this);this.header=new Header({path:this[Gs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[Gs](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?undefined:this.uid,gid:this.portable?undefined:this.gid,size:this.size,mtime:this.noMtime?undefined:this.mtime,type:this.type,uname:this.portable?undefined:this.uname,atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime});if(a){this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:this,path:a+this.path})}if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime,gid:this.portable?undefined:this.gid,mtime:this.noMtime?undefined:this.mtime,path:this[Gs](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[Gs](this.linkpath):this.linkpath,size:this.size,uid:this.portable?undefined:this.uid,uname:this.portable?undefined:this.uname,dev:this.portable?undefined:this.readEntry.dev,ino:this.portable?undefined:this.readEntry.ino,nlink:this.portable?undefined:this.readEntry.nlink}).encode())}const h=this.header?.block;if(!h)throw new Error("failed to encode header");super.write(h);t.pipe(this)}[Gs](t){return prefixPath(t,this.prefix)}[zs](t){return modeFix(t,this.type==="Directory",this.portable)}write(t,i,r){if(typeof i==="function"){r=i;i=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof i==="string"?i:"utf8")}const o=t.length;if(o>this.blockRemain){throw new Error("writing more to entry than is appropriate")}this.blockRemain-=o;return super.write(t,r)}end(t,i,r){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}if(typeof t==="function"){r=t;i=undefined;t=undefined}if(typeof i==="function"){r=i;i=undefined}if(typeof t==="string"){t=Buffer.from(t,i??"utf8")}if(r)this.once("finish",r);t?super.end(t,r):super.end(r);return this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=false;ignore=false;piped=false;constructor(t,i){this.path=t||"./";this.absolute=i}}const Ys=Buffer.alloc(1024);const Vs=Symbol("onStat");const Zs=Symbol("ended");const qs=Symbol("queue");const Js=Symbol("current");const Ks=Symbol("process");const Xs=Symbol("processing");const Qs=Symbol("processJob");const tr=Symbol("jobs");const er=Symbol("jobDone");const ir=Symbol("addFSEntry");const sr=Symbol("addTarEntry");const rr=Symbol("stat");const nr=Symbol("readdir");const or=Symbol("onreaddir");const ar=Symbol("pipe");const hr=Symbol("entry");const cr=Symbol("entryOpt");const lr=Symbol("writeEntryClass");const ur=Symbol("write");const fr=Symbol("ondrain");class Pack extends Minipass{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[lr];onWriteEntry;[qs];[tr]=0;[Xs]=false;[Zs]=false;constructor(t={}){super();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=Ui(t.prefix||"");this.linkCache=t.linkCache||new Map;this.statCache=t.statCache||new Map;this.readdirCache=t.readdirCache||new Map;this.onWriteEntry=t.onWriteEntry;this[lr]=WriteEntry;if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}this.portable=!!t.portable;if(t.gzip||t.brotli){if(t.gzip&&t.brotli){throw new TypeError("gzip and brotli are mutually exclusive")}if(t.gzip){if(typeof t.gzip!=="object"){t.gzip={}}if(this.portable){t.gzip.portable=true}this.zip=new Gzip(t.gzip)}if(t.brotli){if(typeof t.brotli!=="object"){t.brotli={}}this.zip=new BrotliCompress(t.brotli)}if(!this.zip)throw new Error("impossible");const i=this.zip;i.on("data",(t=>super.write(t)));i.on("end",(()=>super.end()));i.on("drain",(()=>this[fr]()));this.on("resume",(()=>i.resume()))}else{this.on("drain",this[fr])}this.noDirRecurse=!!t.noDirRecurse;this.follow=!!t.follow;this.noMtime=!!t.noMtime;if(t.mtime)this.mtime=t.mtime;this.filter=typeof t.filter==="function"?t.filter:()=>true;this[qs]=new Yallist;this[tr]=0;this.jobs=Number(t.jobs)||4;this[Xs]=false;this[Zs]=false}[ur](t){return super.write(t)}add(t){this.write(t);return this}end(t,i,r){if(typeof t==="function"){r=t;t=undefined}if(typeof i==="function"){r=i;i=undefined}if(t){this.add(t)}this[Zs]=true;this[Ks]();if(r)r();return this}write(t){if(this[Zs]){throw new Error("write after end")}if(t instanceof ReadEntry){this[sr](t)}else{this[ir](t)}return this.flowing}[sr](t){const i=Ui(Oi.resolve(this.cwd,t.path));if(!this.filter(t.path,t)){t.resume()}else{const r=new PackJob(t.path,i);r.entry=new WriteEntryTar(t,this[cr](r));r.entry.on("end",(()=>this[er](r)));this[tr]+=1;this[qs].push(r)}this[Ks]()}[ir](t){const i=Ui(Oi.resolve(this.cwd,t));this[qs].push(new PackJob(t,i));this[Ks]()}[rr](t){t.pending=true;this[tr]+=1;const i=this.follow?"stat":"lstat";ye[i](t.absolute,((i,r)=>{t.pending=false;this[tr]-=1;if(i){this.emit("error",i)}else{this[Vs](t,r)}}))}[Vs](t,i){this.statCache.set(t.absolute,i);t.stat=i;if(!this.filter(t.path,i)){t.ignore=true}this[Ks]()}[nr](t){t.pending=true;this[tr]+=1;ye.readdir(t.absolute,((i,r)=>{t.pending=false;this[tr]-=1;if(i){return this.emit("error",i)}this[or](t,r)}))}[or](t,i){this.readdirCache.set(t.absolute,i);t.readdir=i;this[Ks]()}[Ks](){if(this[Xs]){return}this[Xs]=true;for(let t=this[qs].head;!!t&&this[tr]<this.jobs;t=t.next){this[Qs](t.value);if(t.value.ignore){const i=t.next;this[qs].removeNode(t);t.next=i}}this[Xs]=false;if(this[Zs]&&!this[qs].length&&this[tr]===0){if(this.zip){this.zip.end(Ys)}else{super.write(Ys);super.end()}}}get[Js](){return this[qs]&&this[qs].head&&this[qs].head.value}[er](t){this[qs].shift();this[tr]-=1;this[Ks]()}[Qs](t){if(t.pending){return}if(t.entry){if(t===this[Js]&&!t.piped){this[ar](t)}return}if(!t.stat){const i=this.statCache.get(t.absolute);if(i){this[Vs](t,i)}else{this[rr](t)}}if(!t.stat){return}if(t.ignore){return}if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const i=this.readdirCache.get(t.absolute);if(i){this[or](t,i)}else{this[nr](t)}if(!t.readdir){return}}t.entry=this[hr](t);if(!t.entry){t.ignore=true;return}if(t===this[Js]&&!t.piped){this[ar](t)}}[cr](t){return{onwarn:(t,i,r)=>this.warn(t,i,r),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,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[hr](t){this[tr]+=1;try{const i=new this[lr](t.path,this[cr](t));return i.on("end",(()=>this[er](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[fr](){if(this[Js]&&this[Js].entry){this[Js].entry.resume()}}[ar](t){t.piped=true;if(t.readdir){t.readdir.forEach((i=>{const r=t.path;const o=r==="./"?"":r.replace(/\/*$/,"/");this[ir](o+i)}))}const i=t.entry;const r=this.zip;if(!i)throw new Error("cannot pipe without source");if(r){i.on("data",(t=>{if(!r.write(t)){i.pause()}}))}else{i.on("data",(t=>{if(!super.write(t)){i.pause()}}))}}pause(){if(this.zip){this.zip.pause()}return super.pause()}warn(t,i,r={}){warnMethod(this,t,i,r)}}class PackSync extends Pack{sync=true;constructor(t){super(t);this[lr]=WriteEntrySync}pause(){}resume(){}[rr](t){const i=this.follow?"statSync":"lstatSync";this[Vs](t,ye[i](t.absolute))}[nr](t){this[or](t,ye.readdirSync(t.absolute))}[ar](t){const i=t.entry;const r=this.zip;if(t.readdir){t.readdir.forEach((i=>{const r=t.path;const o=r==="./"?"":r.replace(/\/*$/,"/");this[ir](o+i)}))}if(!i)throw new Error("Cannot pipe without source");if(r){i.on("data",(t=>{r.write(t)}))}else{i.on("data",(t=>{super[ur](t)}))}}}const create_createFileSync=(t,i)=>{const r=new PackSync(t);const o=new WriteStreamSync(t.file,{mode:t.mode||438});r.pipe(o);addFilesSync(r,i)};const create_createFile=(t,i)=>{const r=new Pack(t);const o=new WriteStream(t.file,{mode:t.mode||438});r.pipe(o);const a=new Promise(((t,i)=>{o.on("error",i);o.on("close",t);r.on("error",i)}));addFilesAsync(r,i);return a};const addFilesSync=(t,i)=>{i.forEach((i=>{if(i.charAt(0)==="@"){vs({file:l.resolve(t.cwd,i.slice(1)),sync:true,noResume:true,onReadEntry:i=>t.add(i)})}else{t.add(i)}}));t.end()};const addFilesAsync=async(t,i)=>{for(let r=0;r<i.length;r++){const o=String(i[r]);if(o.charAt(0)==="@"){await vs({file:l.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:i=>{t.add(i)}})}else{t.add(o)}}t.end()};const createSync=(t,i)=>{const r=new PackSync(t);addFilesSync(r,i);return r};const createAsync=(t,i)=>{const r=new Pack(t);addFilesAsync(r,i);return r};const dr=makeCommand(create_createFileSync,create_createFile,createSync,createAsync,((t,i)=>{if(!i?.length){throw new TypeError("no paths specified to add to archive")}}));const pr=t(import.meta.url)("node:assert");const mr=t(import.meta.url)("node:crypto");const yr=process.env.__FAKE_PLATFORM__||process.platform;const gr=yr==="win32";const{O_CREAT:br,O_TRUNC:wr,O_WRONLY:vr}=ye.constants;const Sr=Number(process.env.__FAKE_FS_O_FILENAME__)||ye.constants.UV_FS_O_FILEMAP||0;const Er=gr&&!!Sr;const _r=512*1024;const xr=Sr|wr|br|vr;const kr=!Er?()=>"w":t=>t<_r?xr:"w";const lchownSync=(t,i,r)=>{try{return a.lchownSync(t,i,r)}catch(t){if(t?.code!=="ENOENT")throw t}};const chown=(t,i,r,o)=>{a.lchown(t,i,r,(t=>{o(t&&t?.code!=="ENOENT"?t:null)}))};const chownrKid=(t,i,r,o,a)=>{if(i.isDirectory()){chownr(l.resolve(t,i.name),r,o,(h=>{if(h)return a(h);const c=l.resolve(t,i.name);chown(c,r,o,a)}))}else{const h=l.resolve(t,i.name);chown(h,r,o,a)}};const chownr=(t,i,r,o)=>{a.readdir(t,{withFileTypes:true},((a,h)=>{if(a){if(a.code==="ENOENT")return o();else if(a.code!=="ENOTDIR"&&a.code!=="ENOTSUP")return o(a)}if(a||!h.length)return chown(t,i,r,o);let c=h.length;let l=null;const then=a=>{if(l)return;if(a)return o(l=a);if(--c===0)return chown(t,i,r,o)};for(const o of h){chownrKid(t,o,i,r,then)}}))};const chownrKidSync=(t,i,r,o)=>{if(i.isDirectory())chownrSync(l.resolve(t,i.name),r,o);lchownSync(l.resolve(t,i.name),r,o)};const chownrSync=(t,i,r)=>{let o;try{o=a.readdirSync(t,{withFileTypes:true})}catch(o){const a=o;if(a?.code==="ENOENT")return;else if(a?.code==="ENOTDIR"||a?.code==="ENOTSUP")return lchownSync(t,i,r);else throw a}for(const a of o){chownrKidSync(t,a,i,r)}return lchownSync(t,i,r)};const optsArg=t=>{if(!t){t={mode:511}}else if(typeof t==="object"){t={mode:511,...t}}else if(typeof t==="number"){t={mode:t}}else if(typeof t==="string"){t={mode:parseInt(t,8)}}else{throw new TypeError("invalid options argument")}const i=t;const r=t.fs||{};t.mkdir=t.mkdir||r.mkdir||ye.mkdir;t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(t,r)=>new Promise(((o,a)=>i.mkdir(t,r,((t,i)=>t?a(t):o(i)))));t.stat=t.stat||r.stat||ye.stat;t.statAsync=t.statAsync?t.statAsync:async t=>new Promise(((r,o)=>i.stat(t,((t,i)=>t?o(t):r(i)))));t.statSync=t.statSync||r.statSync||ye.statSync;t.mkdirSync=t.mkdirSync||r.mkdirSync||ye.mkdirSync;return i};const mkdirp_manual_mkdirpManualSync=(t,i,r)=>{const o=(0,Oi.dirname)(t);const a={...optsArg(i),recursive:false};if(o===t){try{return a.mkdirSync(t,a)}catch(t){const i=t;if(i&&i.code!=="EISDIR"){throw t}return}}try{a.mkdirSync(t,a);return r||t}catch(i){const h=i;if(h&&h.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,a,mkdirp_manual_mkdirpManualSync(o,a,r))}if(h&&h.code!=="EEXIST"&&h&&h.code!=="EROFS"){throw i}try{if(!a.statSync(t).isDirectory())throw i}catch(t){throw i}}};const Or=Object.assign((async(t,i,r)=>{const o=optsArg(i);o.recursive=false;const a=(0,Oi.dirname)(t);if(a===t){return o.mkdirAsync(t,o).catch((t=>{const i=t;if(i&&i.code!=="EISDIR"){throw t}}))}return o.mkdirAsync(t,o).then((()=>r||t),(async i=>{const h=i;if(h&&h.code==="ENOENT"){return Or(a,o).then((i=>Or(t,o,i)))}if(h&&h.code!=="EEXIST"&&h.code!=="EROFS"){throw i}return o.statAsync(t).then((t=>{if(t.isDirectory()){return r}else{throw i}}),(()=>{throw i}))}))}),{sync:mkdirp_manual_mkdirpManualSync});const findMade=async(t,i,r)=>{if(r===i){return}return t.statAsync(i).then((t=>t.isDirectory()?r:undefined),(r=>{const o=r;return o&&o.code==="ENOENT"?findMade(t,(0,Oi.dirname)(i),i):undefined}))};const findMadeSync=(t,i,r)=>{if(r===i){return undefined}try{return t.statSync(i).isDirectory()?r:undefined}catch(r){const o=r;return o&&o.code==="ENOENT"?findMadeSync(t,(0,Oi.dirname)(i),i):undefined}};const mkdirp_native_mkdirpNativeSync=(t,i)=>{const r=optsArg(i);r.recursive=true;const o=(0,Oi.dirname)(t);if(o===t){return r.mkdirSync(t,r)}const a=findMadeSync(r,t);try{r.mkdirSync(t,r);return a}catch(i){const o=i;if(o&&o.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,r)}else{throw i}}};const Rr=Object.assign((async(t,i)=>{const r={...optsArg(i),recursive:true};const o=(0,Oi.dirname)(t);if(o===t){return await r.mkdirAsync(t,r)}return findMade(r,t).then((i=>r.mkdirAsync(t,r).then((t=>i||t)).catch((i=>{const o=i;if(o&&o.code==="ENOENT"){return Or(t,r)}else{throw i}}))))}),{sync:mkdirp_native_mkdirpNativeSync});const Tr=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform;const pathArg=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"})}t=(0,Oi.resolve)(t);if(Tr==="win32"){const i=/[*|"<>?:]/;const{root:r}=(0,Oi.parse)(t);if(i.test(t.substring(r.length))){throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}}return t};const Pr=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version;const Dr=Pr.replace(/^v/,"").split(".");const Ar=+Dr[0]>10||+Dr[0]===10&&+Dr[1]>=12;const Fr=!Ar?()=>false:t=>optsArg(t).mkdirSync===ye.mkdirSync;const Mr=Object.assign(!Ar?()=>false:t=>optsArg(t).mkdir===ye.mkdir,{sync:Fr});const mjs_mkdirpSync=(t,i)=>{t=pathArg(t);const r=optsArg(i);return Fr(r)?mkdirp_native_mkdirpNativeSync(t,r):mkdirp_manual_mkdirpManualSync(t,r)};const Ir=null&&mjs_mkdirpSync;const Lr=null&&mkdirpManual;const Cr=null&&mkdirpManualSync;const Nr=null&&mkdirpNative;const $r=null&&mkdirpNativeSync;const jr=Object.assign((async(t,i)=>{t=pathArg(t);const r=optsArg(i);return Mr(r)?Rr(t,r):Or(t,r)}),{mkdirpSync:mjs_mkdirpSync,mkdirpNative:Rr,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:Or,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mjs_mkdirpSync,native:Rr,nativeSync:mkdirp_native_mkdirpNativeSync,manual:Or,manualSync:mkdirp_manual_mkdirpManualSync,useNative:Mr,useNativeSync:Fr});class CwdError extends Error{path;code;syscall="chdir";constructor(t,i){super(`${i}: Cannot cd into '${t}'`);this.path=t;this.code=i}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,i){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=t;this.path=i}get name(){return"SymlinkError"}}const cGet=(t,i)=>t.get(Ui(i));const cSet=(t,i,r)=>t.set(Ui(i),r);const checkCwd=(t,i)=>{ye.stat(t,((r,o)=>{if(r||!o.isDirectory()){r=new CwdError(t,r?.code||"ENOTDIR")}i(r)}))};const mkdir=(t,i,r)=>{t=Ui(t);const o=i.umask??18;const a=i.mode|448;const h=(a&o)!==0;const c=i.uid;const u=i.gid;const d=typeof c==="number"&&typeof u==="number"&&(c!==i.processUid||u!==i.processGid);const p=i.preserve;const m=i.unlink;const y=i.cache;const g=Ui(i.cwd);const done=(i,o)=>{if(i){r(i)}else{cSet(y,t,true);if(o&&d){chownr(o,c,u,(t=>done(t)))}else if(h){ye.chmod(t,a,r)}else{r()}}};if(y&&cGet(y,t)===true){return done()}if(t===g){return checkCwd(t,done)}if(p){return jr(t,{mode:a}).then((t=>done(null,t??undefined)),done)}const b=Ui(l.relative(g,t));const w=b.split("/");mkdir_(g,w,a,y,m,g,undefined,done)};const mkdir_=(t,i,r,o,a,h,c,u)=>{if(!i.length){return u(null,c)}const d=i.shift();const p=Ui(l.resolve(t+"/"+d));if(cGet(o,p)){return mkdir_(p,i,r,o,a,h,c,u)}ye.mkdir(p,r,onmkdir(p,i,r,o,a,h,c,u))};const onmkdir=(t,i,r,o,a,h,c,l)=>u=>{if(u){ye.lstat(t,((d,p)=>{if(d){d.path=d.path&&Ui(d.path);l(d)}else if(p.isDirectory()){mkdir_(t,i,r,o,a,h,c,l)}else if(a){ye.unlink(t,(u=>{if(u){return l(u)}ye.mkdir(t,r,onmkdir(t,i,r,o,a,h,c,l))}))}else if(p.isSymbolicLink()){return l(new SymlinkError(t,t+"/"+i.join("/")))}else{l(u)}}))}else{c=c||t;mkdir_(t,i,r,o,a,h,c,l)}};const checkCwdSync=t=>{let i=false;let r=undefined;try{i=ye.statSync(t).isDirectory()}catch(t){r=t?.code}finally{if(!i){throw new CwdError(t,r??"ENOTDIR")}}};const mkdirSync=(t,i)=>{t=Ui(t);const r=i.umask??18;const o=i.mode|448;const a=(o&r)!==0;const h=i.uid;const c=i.gid;const u=typeof h==="number"&&typeof c==="number"&&(h!==i.processUid||c!==i.processGid);const d=i.preserve;const p=i.unlink;const m=i.cache;const y=Ui(i.cwd);const done=i=>{cSet(m,t,true);if(i&&u){chownrSync(i,h,c)}if(a){ye.chmodSync(t,o)}};if(m&&cGet(m,t)===true){return done()}if(t===y){checkCwdSync(y);return done()}if(d){return done(mjs_mkdirpSync(t,o)??undefined)}const g=Ui(l.relative(y,t));const b=g.split("/");let w=undefined;for(let t=b.shift(),i=y;t&&(i+="/"+t);t=b.shift()){i=Ui(l.resolve(i));if(cGet(m,i)){continue}try{ye.mkdirSync(i,o);w=w||i;cSet(m,i,true)}catch(t){const r=ye.lstatSync(i);if(r.isDirectory()){cSet(m,i,true);continue}else if(p){ye.unlinkSync(i);ye.mkdirSync(i,o);w=w||i;cSet(m,i,true);continue}else if(r.isSymbolicLink()){return new SymlinkError(i,i+"/"+b.join("/"))}}}return done(w)};const Br=Object.create(null);const{hasOwnProperty:Ur}=Object.prototype;const normalizeUnicode=t=>{if(!Ur.call(Br,t)){Br[t]=t.normalize("NFD")}return Br[t]};const zr=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const Wr=zr==="win32";const getDirs=t=>{const i=t.split("/").slice(0,-1).reduce(((t,i)=>{const r=t[t.length-1];if(r!==undefined){i=(0,l.join)(r,i)}t.push(i||"/");return t}),[]);return i};class PathReservations{#d=new Map;#p=new Map;#m=new Set;reserve(t,i){t=Wr?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,l.join)(normalizeUnicode(t))).toLowerCase()));const r=new Set(t.map((t=>getDirs(t))).reduce(((t,i)=>t.concat(i))));this.#p.set(i,{dirs:r,paths:t});for(const r of t){const t=this.#d.get(r);if(!t){this.#d.set(r,[i])}else{t.push(i)}}for(const t of r){const r=this.#d.get(t);if(!r){this.#d.set(t,[new Set([i])])}else{const t=r[r.length-1];if(t instanceof Set){t.add(i)}else{r.push(new Set([i]))}}}return this.#y(i)}#g(t){const i=this.#p.get(t);if(!i){throw new Error("function does not have any path reservations")}return{paths:i.paths.map((t=>this.#d.get(t))),dirs:[...i.dirs].map((t=>this.#d.get(t)))}}check(t){const{paths:i,dirs:r}=this.#g(t);return i.every((i=>i&&i[0]===t))&&r.every((i=>i&&i[0]instanceof Set&&i[0].has(t)))}#y(t){if(this.#m.has(t)||!this.check(t)){return false}this.#m.add(t);t((()=>this.#b(t)));return true}#b(t){if(!this.#m.has(t)){return false}const i=this.#p.get(t);if(!i){throw new Error("invalid reservation")}const{paths:r,dirs:o}=i;const a=new Set;for(const i of r){const r=this.#d.get(i);if(!r||r?.[0]!==t){continue}const o=r[1];if(!o){this.#d.delete(i);continue}r.shift();if(typeof o==="function"){a.add(o)}else{for(const t of o){a.add(t)}}}for(const i of o){const r=this.#d.get(i);const o=r?.[0];if(!r||!(o instanceof Set))continue;if(o.size===1&&r.length===1){this.#d.delete(i);continue}else if(o.size===1){r.shift();const t=r[0];if(typeof t==="function"){a.add(t)}}else{o.delete(t)}}this.#m.delete(t);a.forEach((t=>this.#y(t)));return true}}const Hr=Symbol("onEntry");const Gr=Symbol("checkFs");const Yr=Symbol("checkFs2");const Vr=Symbol("pruneCache");const Zr=Symbol("isReusable");const qr=Symbol("makeFs");const Jr=Symbol("file");const Kr=Symbol("directory");const Xr=Symbol("link");const Qr=Symbol("symlink");const tn=Symbol("hardlink");const en=Symbol("unsupported");const sn=Symbol("checkPath");const rn=Symbol("mkdir");const nn=Symbol("onError");const on=Symbol("pending");const an=Symbol("pend");const hn=Symbol("unpend");const cn=Symbol("ended");const ln=Symbol("maybeClose");const un=Symbol("skip");const fn=Symbol("doChown");const dn=Symbol("uid");const pn=Symbol("gid");const mn=Symbol("checkedCwd");const yn=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const gn=yn==="win32";const bn=1024;const unlinkFile=(t,i)=>{if(!gn){return a.unlink(t,i)}const r=t+".DELETE."+(0,mr.randomBytes)(16).toString("hex");a.rename(t,r,(t=>{if(t){return i(t)}a.unlink(r,i)}))};const unlinkFileSync=t=>{if(!gn){return a.unlinkSync(t)}const i=t+".DELETE."+(0,mr.randomBytes)(16).toString("hex");a.renameSync(t,i);a.unlinkSync(i)};const uint32=(t,i,r)=>t!==undefined&&t===t>>>0?t:i!==undefined&&i===i>>>0?i:r;const cacheKeyNormalize=t=>stripTrailingSlashes(Ui(normalizeUnicode(t))).toLowerCase();const pruneCache=(t,i)=>{i=cacheKeyNormalize(i);for(const r of t.keys()){const o=cacheKeyNormalize(r);if(o===i||o.indexOf(i+"/")===0){t.delete(r)}}};const dropCache=t=>{for(const i of t.keys()){t.delete(i)}};class Unpack extends Parser{[cn]=false;[mn]=false;[on]=0;reservations=new PathReservations;transform;writable=true;readable=false;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){t.ondone=()=>{this[cn]=true;this[ln]()};super(t);this.transform=t.transform;this.dirCache=t.dirCache||new Map;this.chmod=!!t.chmod;if(typeof t.uid==="number"||typeof t.gid==="number"){if(typeof t.uid!=="number"||typeof t.gid!=="number"){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=true}else{this.uid=undefined;this.gid=undefined;this.setOwner=false}if(t.preserveOwner===undefined&&typeof t.uid!=="number"){this.preserveOwner=!!(process.getuid&&process.getuid()===0)}else{this.preserveOwner=!!t.preserveOwner}this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():undefined;this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():undefined;this.maxDepth=typeof t.maxDepth==="number"?t.maxDepth:bn;this.forceChown=t.forceChown===true;this.win32=!!t.win32||gn;this.newer=!!t.newer;this.keep=!!t.keep;this.noMtime=!!t.noMtime;this.preservePaths=!!t.preservePaths;this.unlink=!!t.unlink;this.cwd=Ui(l.resolve(t.cwd||process.cwd()));this.strip=Number(t.strip)||0;this.processUmask=!this.chmod?0:typeof t.processUmask==="number"?t.processUmask:process.umask();this.umask=typeof t.umask==="number"?t.umask:this.processUmask;this.dmode=t.dmode||511&~this.umask;this.fmode=t.fmode||438&~this.umask;this.on("entry",(t=>this[Hr](t)))}warn(t,i,r={}){if(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT"){r.recoverable=false}return super.warn(t,i,r)}[ln](){if(this[cn]&&this[on]===0){this.emit("prefinish");this.emit("finish");this.emit("end")}}[sn](t){const i=Ui(t.path);const r=i.split("/");if(this.strip){if(r.length<this.strip){return false}if(t.type==="Link"){const i=Ui(String(t.linkpath)).split("/");if(i.length>=this.strip){t.linkpath=i.slice(this.strip).join("/")}else{return false}}r.splice(0,this.strip);t.path=r.join("/")}if(isFinite(this.maxDepth)&&r.length>this.maxDepth){this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:i,depth:r.length,maxDepth:this.maxDepth});return false}if(!this.preservePaths){if(r.includes("..")||gn&&/^[a-z]:\.\.$/i.test(r[0]??"")){this.warn("TAR_ENTRY_ERROR",`path contains '..'`,{entry:t,path:i});return false}const[o,a]=stripAbsolutePath(i);if(o){t.path=String(a);this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:t,path:i})}}if(l.isAbsolute(t.path)){t.absolute=Ui(l.resolve(t.path))}else{t.absolute=Ui(l.resolve(this.cwd,t.path))}if(!this.preservePaths&&typeof t.absolute==="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd){this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:Ui(t.path),resolvedPath:t.absolute,cwd:this.cwd});return false}if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir"){return false}if(this.win32){const{root:i}=l.win32.parse(String(t.absolute));t.absolute=i+winchars_encode(String(t.absolute).slice(i.length));const{root:r}=l.win32.parse(t.path);t.path=r+winchars_encode(t.path.slice(r.length))}return true}[Hr](t){if(!this[sn](t)){return t.resume()}pr.equal(typeof t.absolute,"string");switch(t.type){case"Directory":case"GNUDumpDir":if(t.mode){t.mode=t.mode|448}case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Gr](t);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[en](t)}}[nn](t,i){if(t.name==="CwdError"){this.emit("error",t)}else{this.warn("TAR_ENTRY_ERROR",t,{entry:i});this[hn]();i.resume()}}[rn](t,i,r){mkdir(Ui(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:i},r)}[fn](t){return this.forceChown||this.preserveOwner&&(typeof t.uid==="number"&&t.uid!==this.processUid||typeof t.gid==="number"&&t.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[dn](t){return uint32(this.uid,t.uid,this.processUid)}[pn](t){return uint32(this.gid,t.gid,this.processGid)}[Jr](t,i){const r=typeof t.mode==="number"?t.mode&4095:this.fmode;const o=new WriteStream(String(t.absolute),{flags:kr(t.size),mode:r,autoClose:false});o.on("error",(r=>{if(o.fd){a.close(o.fd,(()=>{}))}o.write=()=>true;this[nn](r,t);i()}));let h=1;const done=r=>{if(r){if(o.fd){a.close(o.fd,(()=>{}))}this[nn](r,t);i();return}if(--h===0){if(o.fd!==undefined){a.close(o.fd,(r=>{if(r){this[nn](r,t)}else{this[hn]()}i()}))}}};o.on("finish",(()=>{const i=String(t.absolute);const r=o.fd;if(typeof r==="number"&&t.mtime&&!this.noMtime){h++;const o=t.atime||new Date;const c=t.mtime;a.futimes(r,o,c,(t=>t?a.utimes(i,o,c,(i=>done(i&&t))):done()))}if(typeof r==="number"&&this[fn](t)){h++;const o=this[dn](t);const c=this[pn](t);if(typeof o==="number"&&typeof c==="number"){a.fchown(r,o,c,(t=>t?a.chown(i,o,c,(i=>done(i&&t))):done()))}}done()}));const c=this.transform?this.transform(t)||t:t;if(c!==t){c.on("error",(r=>{this[nn](r,t);i()}));t.pipe(c)}c.pipe(o)}[Kr](t,i){const r=typeof t.mode==="number"?t.mode&4095:this.dmode;this[rn](String(t.absolute),r,(r=>{if(r){this[nn](r,t);i();return}let o=1;const done=()=>{if(--o===0){i();this[hn]();t.resume()}};if(t.mtime&&!this.noMtime){o++;a.utimes(String(t.absolute),t.atime||new Date,t.mtime,done)}if(this[fn](t)){o++;a.chown(String(t.absolute),Number(this[dn](t)),Number(this[pn](t)),done)}done()}))}[en](t){t.unsupported=true;this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t});t.resume()}[Qr](t,i){this[Xr](t,String(t.linkpath),"symlink",i)}[tn](t,i){const r=Ui(l.resolve(this.cwd,String(t.linkpath)));this[Xr](t,r,"link",i)}[an](){this[on]++}[hn](){this[on]--;this[ln]()}[un](t){this[hn]();t.resume()}[Zr](t,i){return t.type==="File"&&!this.unlink&&i.isFile()&&i.nlink<=1&&!gn}[Gr](t){this[an]();const i=[t.path];if(t.linkpath){i.push(t.linkpath)}this.reservations.reserve(i,(i=>this[Yr](t,i)))}[Vr](t){if(t.type==="SymbolicLink"){dropCache(this.dirCache)}else if(t.type!=="Directory"){pruneCache(this.dirCache,String(t.absolute))}}[Yr](t,i){this[Vr](t);const done=r=>{this[Vr](t);i(r)};const checkCwd=()=>{this[rn](this.cwd,this.dmode,(i=>{if(i){this[nn](i,t);done();return}this[mn]=true;start()}))};const start=()=>{if(t.absolute!==this.cwd){const i=Ui(l.dirname(String(t.absolute)));if(i!==this.cwd){return this[rn](i,this.dmode,(i=>{if(i){this[nn](i,t);done();return}afterMakeParent()}))}}afterMakeParent()};const afterMakeParent=()=>{a.lstat(String(t.absolute),((i,r)=>{if(r&&(this.keep||this.newer&&r.mtime>(t.mtime??r.mtime))){this[un](t);done();return}if(i||this[Zr](t,r)){return this[qr](null,t,done)}if(r.isDirectory()){if(t.type==="Directory"){const i=this.chmod&&t.mode&&(r.mode&4095)!==t.mode;const afterChmod=i=>this[qr](i??null,t,done);if(!i){return afterChmod()}return a.chmod(String(t.absolute),Number(t.mode),afterChmod)}if(t.absolute!==this.cwd){return a.rmdir(String(t.absolute),(i=>this[qr](i??null,t,done)))}}if(t.absolute===this.cwd){return this[qr](null,t,done)}unlinkFile(String(t.absolute),(i=>this[qr](i??null,t,done)))}))};if(this[mn]){start()}else{checkCwd()}}[qr](t,i,r){if(t){this[nn](t,i);r();return}switch(i.type){case"File":case"OldFile":case"ContiguousFile":return this[Jr](i,r);case"Link":return this[tn](i,r);case"SymbolicLink":return this[Qr](i,r);case"Directory":case"GNUDumpDir":return this[Kr](i,r)}}[Xr](t,i,r,o){a[r](i,String(t.absolute),(i=>{if(i){this[nn](i,t)}else{this[hn]();t.resume()}o()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=true;[qr](t,i){return super[qr](t,i,(()=>{}))}[Gr](t){this[Vr](t);if(!this[mn]){const i=this[rn](this.cwd,this.dmode);if(i){return this[nn](i,t)}this[mn]=true}if(t.absolute!==this.cwd){const i=Ui(l.dirname(String(t.absolute)));if(i!==this.cwd){const r=this[rn](i,this.dmode);if(r){return this[nn](r,t)}}}const[i,r]=callSync((()=>a.lstatSync(String(t.absolute))));if(r&&(this.keep||this.newer&&r.mtime>(t.mtime??r.mtime))){return this[un](t)}if(i||this[Zr](t,r)){return this[qr](null,t)}if(r.isDirectory()){if(t.type==="Directory"){const i=this.chmod&&t.mode&&(r.mode&4095)!==t.mode;const[o]=i?callSync((()=>{a.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[qr](o,t)}const[i]=callSync((()=>a.rmdirSync(String(t.absolute))));this[qr](i,t)}const[o]=t.absolute===this.cwd?[]:callSync((()=>unlinkFileSync(String(t.absolute))));this[qr](o,t)}[Jr](t,i){const r=typeof t.mode==="number"?t.mode&4095:this.fmode;const oner=r=>{let h;try{a.closeSync(o)}catch(t){h=t}if(r||h){this[nn](r||h,t)}i()};let o;try{o=a.openSync(String(t.absolute),kr(t.size),r)}catch(t){return oner(t)}const h=this.transform?this.transform(t)||t:t;if(h!==t){h.on("error",(i=>this[nn](i,t)));t.pipe(h)}h.on("data",(t=>{try{a.writeSync(o,t,0,t.length)}catch(t){oner(t)}}));h.on("end",(()=>{let i=null;if(t.mtime&&!this.noMtime){const r=t.atime||new Date;const h=t.mtime;try{a.futimesSync(o,r,h)}catch(o){try{a.utimesSync(String(t.absolute),r,h)}catch(t){i=o}}}if(this[fn](t)){const r=this[dn](t);const h=this[pn](t);try{a.fchownSync(o,Number(r),Number(h))}catch(o){try{a.chownSync(String(t.absolute),Number(r),Number(h))}catch(t){i=i||o}}}oner(i)}))}[Kr](t,i){const r=typeof t.mode==="number"?t.mode&4095:this.dmode;const o=this[rn](String(t.absolute),r);if(o){this[nn](o,t);i();return}if(t.mtime&&!this.noMtime){try{a.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch(o){}}if(this[fn](t)){try{a.chownSync(String(t.absolute),Number(this[dn](t)),Number(this[pn](t)))}catch(o){}}i();t.resume()}[rn](t,i){try{return mkdirSync(Ui(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:i})}catch(t){return t}}[Xr](t,i,r,o){const h=`${r}Sync`;try{a[h](i,String(t.absolute));o();t.resume()}catch(i){return this[nn](i,t)}}}const extractFileSync=t=>{const i=new UnpackSync(t);const r=t.file;const o=a.statSync(r);const h=t.maxReadSize||16*1024*1024;const c=new ReadStreamSync(r,{readSize:h,size:o.size});c.pipe(i)};const extractFile=(t,i)=>{const r=new Unpack(t);const o=t.maxReadSize||16*1024*1024;const h=t.file;const c=new Promise(((t,i)=>{r.on("error",i);r.on("close",t);a.stat(h,((t,a)=>{if(t){i(t)}else{const t=new ReadStream(h,{readSize:o,size:a.size});t.on("error",i);t.pipe(r)}}))}));return c};const wn=makeCommand(extractFileSync,extractFile,(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,i)=>{if(i?.length)filesFilter(t,i)}));const replaceSync=(t,i)=>{const r=new PackSync(t);let o=true;let h;let c;try{try{h=a.openSync(t.file,"r+")}catch(i){if(i?.code==="ENOENT"){h=a.openSync(t.file,"w+")}else{throw i}}const l=a.fstatSync(h);const u=Buffer.alloc(512);t:for(c=0;c<l.size;c+=512){for(let t=0,i=0;t<512;t+=i){i=a.readSync(h,u,t,u.length-t,c+t);if(c===0&&u[0]===31&&u[1]===139){throw new Error("cannot append to compressed archives")}if(!i){break t}}const i=new Header(u);if(!i.cksumValid){break}const r=512*Math.ceil((i.size||0)/512);if(c+r+512>l.size){break}c+=r;if(t.mtimeCache&&i.mtime){t.mtimeCache.set(String(i.path),i.mtime)}}o=false;streamSync(t,r,c,h,i)}finally{if(o){try{a.closeSync(h)}catch(t){}}}};const streamSync=(t,i,r,o,a)=>{const h=new WriteStreamSync(t.file,{fd:o,start:r});i.pipe(h);replace_addFilesSync(i,a)};const replaceAsync=(t,i)=>{i=Array.from(i);const r=new Pack(t);const getPos=(i,r,o)=>{const cb=(t,r)=>{if(t){a.close(i,(i=>o(t)))}else{o(null,r)}};let h=0;if(r===0){return cb(null,0)}let c=0;const l=Buffer.alloc(512);const onread=(o,u)=>{if(o||typeof u==="undefined"){return cb(o)}c+=u;if(c<512&&u){return a.read(i,l,c,l.length-c,h+c,onread)}if(h===0&&l[0]===31&&l[1]===139){return cb(new Error("cannot append to compressed archives"))}if(c<512){return cb(null,h)}const d=new Header(l);if(!d.cksumValid){return cb(null,h)}const p=512*Math.ceil((d.size??0)/512);if(h+p+512>r){return cb(null,h)}h+=p+512;if(h>=r){return cb(null,h)}if(t.mtimeCache&&d.mtime){t.mtimeCache.set(String(d.path),d.mtime)}c=0;a.read(i,l,0,512,h,onread)};a.read(i,l,0,512,h,onread)};const o=new Promise(((o,h)=>{r.on("error",h);let c="r+";const onopen=(l,u)=>{if(l&&l.code==="ENOENT"&&c==="r+"){c="w+";return a.open(t.file,c,onopen)}if(l||!u){return h(l)}a.fstat(u,((c,l)=>{if(c){return a.close(u,(()=>h(c)))}getPos(u,l.size,((a,c)=>{if(a){return h(a)}const l=new WriteStream(t.file,{fd:u,start:c});r.pipe(l);l.on("error",h);l.on("close",o);replace_addFilesAsync(r,i)}))}))};a.open(t.file,c,onopen)}));return o};const replace_addFilesSync=(t,i)=>{i.forEach((i=>{if(i.charAt(0)==="@"){vs({file:l.resolve(t.cwd,i.slice(1)),sync:true,noResume:true,onReadEntry:i=>t.add(i)})}else{t.add(i)}}));t.end()};const replace_addFilesAsync=async(t,i)=>{for(let r=0;r<i.length;r++){const o=String(i[r]);if(o.charAt(0)==="@"){await vs({file:l.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:i=>t.add(i)})}else{t.add(o)}}t.end()};const vn=makeCommand(replaceSync,replaceAsync,(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,i)=>{if(!isFile(t)){throw new TypeError("file is required")}if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr")){throw new TypeError("cannot append to compressed archives")}if(!i?.length){throw new TypeError("no paths specified to add/replace")}}));const Sn=makeCommand(vn.syncFile,vn.asyncFile,vn.syncNoFile,vn.asyncNoFile,((t,i=[])=>{vn.validate?.(t,i);mtimeFilter(t)}));const mtimeFilter=t=>{const i=t.filter;if(!t.mtimeCache){t.mtimeCache=new Map}t.filter=i?(r,o)=>i(r,o)&&!((t.mtimeCache?.get(r)??o.mtime??0)>(o.mtime??0)):(i,r)=>!((t.mtimeCache?.get(i)??r.mtime??0)>(r.mtime??0))};async function isUrlOk(t){try{const i=await fetch(t,{method:"HEAD"});return i.status===200}catch{return false}}async function getRepoInfo(t){const[,i,r,o,a,...h]=t.pathname.split("/");const c=h.join("/");if(o===undefined||o===""&&a===undefined){try{const t=await fetch(`https://api.github.com/repos/${i}/${r}`);if(t.status!==200){return}const o=await t.json();return{username:i,name:r,branch:o["default_branch"],filePath:c}}catch{return}}if(i&&r&&a&&o==="tree"){return{username:i,name:r,branch:a,filePath:c}}}function hasRepo({username:t,name:i,branch:r,filePath:o}){const a=`https://api.github.com/repos/${t}/${i}/contents`;const h=`${o?`/${o}`:""}/package.json`;return isUrlOk(a+h+`?ref=${r}`)}async function downloadTarStream(t){const i=await fetch(t);if(!i.body){throw new Error(`Failed to download: ${t}`)}return de.Readable.fromWeb(i.body)}async function downloadAndExtractRepo(t,{username:i,name:r,branch:o,filePath:a}){await(0,pe.pipeline)(await downloadTarStream(`https://codeload.github.com/${i}/${r}/tar.gz/${o}`),wn({cwd:t,strip:a?a.split("/").length+1:1,filter:t=>t.startsWith(`${r}-${o?.replace(/\//g,"-")}${a?`/${a}/`:"/"}`)}))}function getValidURL(t){try{return new URL(t)}catch(t){const i=t;if(i.code!=="ERR_INVALID_URL"){console.error(t);process.exit(1)}}}async function parseExampleOption(t){if(!t){return null}const i=getValidURL(t);if(!i){console.error(`Not a valid URL ${D(`"${t}"`)}. Please check the URL syntax and try again.`);process.exit(1)}if(i.origin!=="https://github.com"&&i.origin!=="https://www.github.com"){console.error(`Invalid URL: ${D(`"${t}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);process.exit(1)}const r=await getRepoInfo(i);if(!r){console.error(`Found invalid GitHub URL: ${D(`"${t}"`)}. Please fix the URL and try again.`);process.exit(1)}if(!await hasRepo(r)){console.error(`Could not locate the repository for ${D(`"${t}"`)}. Please check that the repository exists and try again.`);process.exit(1)}return{example:t,repoInfo:r}}async function downloadAndExtract(t,{example:i,repoInfo:r}){console.log(`Downloading files from repo ${C(i)}. This might take a moment.\n`);await downloadAndExtractRepo(t,r)}const En=t(import.meta.url)("node:child_process");const _n=process.env.npm_config_user_agent||"";const xn=/pnpm/.test(_n)?"pnpm":/yarn/.test(_n)?"yarn":"npm";const kn={pnpm:{install:"pnpm install",dev:"pnpm dev",create:"pnpm create waku"},yarn:{install:"yarn",dev:"yarn dev",create:"yarn create waku"},npm:{install:"npm install",dev:"npm run dev",create:"npm create waku"}}[xn];const On=u().join((0,d.fileURLToPath)(import.meta.url),"../../template");const{values:Rn}=(0,p.parseArgs)({args:process.argv.slice(2),options:{choose:{type:"boolean"},example:{type:"string"},help:{type:"boolean",short:"h"}}});async function doPrompts(){const isValidPackageName=t=>/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t);const toValidPackageName=t=>t.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z0-9-~]+/g,"-");const canSafelyOverwrite=t=>!(0,a.existsSync)(t)||(0,a.readdirSync)(t).length===0;const t=await getTemplateNames(On);const i="waku-project";let r="";try{const o=await y()([{name:"projectName",type:"text",message:"Project Name",initial:i,onState:t=>r=String(t.value).trim()||i},{name:"shouldOverwrite",type:()=>canSafelyOverwrite(r)?null:"confirm",message:`${r} is not empty. Remove existing files and continue?`},{name:"overwriteChecker",type:t=>{if(t===false){throw new Error(D("✖")+" Operation cancelled")}return null}},{name:"packageName",type:()=>isValidPackageName(r)?null:"text",message:"Package name",initial:()=>toValidPackageName(r),validate:t=>isValidPackageName(t)||"Invalid package.json name"},{name:"templateName",type:Rn["choose"]?"select":null,message:"Choose a starter template",choices:t.map((t=>({title:t,value:t})))}],{onCancel:()=>{throw new Error(D("✖")+" Operation cancelled")}});return{...o,packageName:o.packageName??toValidPackageName(r),templateName:o.templateName??t[0],targetDir:r}}catch(t){if(t instanceof Error){console.log(t.message)}process.exit(1)}}function displayUsage(){console.log(`\nUsage: ${kn.create} [options]\n\nOptions:\n --choose Choose from the template list\n --example Specify an example use as a template\n -h, --help Display this help message\n`)}async function notifyUpdate(){const t=undefined("../package.json");const i=await fe()(t).catch((()=>{}));if(i?.latest){console.log(`A new version of 'create-waku' is available!`);console.log("You can update by running: ");console.log();console.log(` npm i -g create-waku`)}}async function init(){if(Rn.help){displayUsage();return}const t=await parseExampleOption(Rn.example);const{packageName:i,templateName:r,shouldOverwrite:o,targetDir:h}=await doPrompts();const l=u().resolve(h);console.log("Setting up project...");if(o){le.emptyDirSync(l)}else if(!(0,a.existsSync)(l)){await c().mkdir(l,{recursive:true})}if(t){await downloadAndExtract(l,t)}else{await installTemplate(l,i,On,r)}console.log();console.log(`Installing dependencies by running ${kn.install}...`);const d=(0,En.spawn)(xn,["install"],{stdio:"inherit",shell:process.platform==="win32",cwd:h});d.on("close",(t=>{if(t!==0){console.error(`Could not execute ${kn.install}. Please run`);console.log(`${E(A(`cd ${h}`))}`);console.log(`${E(A(kn.install))}`);console.log(`${E(A(kn.dev))}`);console.log()}else{console.log(`\nDone. Now run:\n`);console.log(`${E(A(`cd ${h}`))}`);console.log(`${E(A(kn.dev))}`);console.log()}}))}init().then(notifyUpdate).catch((t=>{console.error(t)}));
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var Fp=Object.create;var ih=Object.defineProperty;var Lp=Object.getOwnPropertyDescriptor;var Mp=Object.getOwnPropertyNames;var qp=Object.getPrototypeOf,Bp=Object.prototype.hasOwnProperty;var _=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var m=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var $p=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Mp(e))!Bp.call(i,s)&&s!==t&&ih(i,s,{get:()=>e[s],enumerable:!(r=Lp(e,s))||r.enumerable});return i};var xe=(i,e,t)=>(t=i!=null?Fp(qp(i)):{},$p(e||!i||!i.__esModule?ih(t,"default",{value:i,enumerable:!0}):t,i));var M=m((Bx,sh)=>{"use strict";var{FORCE_COLOR:Up,NODE_DISABLE_COLORS:jp,TERM:zp}=process.env,A={enabled:!jp&&zp!=="dumb"&&Up!=="0",reset:P(0,0),bold:P(1,22),dim:P(2,22),italic:P(3,23),underline:P(4,24),inverse:P(7,27),hidden:P(8,28),strikethrough:P(9,29),black:P(30,39),red:P(31,39),green:P(32,39),yellow:P(33,39),blue:P(34,39),magenta:P(35,39),cyan:P(36,39),white:P(37,39),gray:P(90,39),grey:P(90,39),bgBlack:P(40,49),bgRed:P(41,49),bgGreen:P(42,49),bgYellow:P(43,49),bgBlue:P(44,49),bgMagenta:P(45,49),bgCyan:P(46,49),bgWhite:P(47,49)};function rh(i,e){let t=0,r,s="",n="";for(;t<i.length;t++)r=i[t],s+=r.open,n+=r.close,e.includes(r.close)&&(e=e.replace(r.rgx,r.close+r.open));return s+e+n}function Hp(i,e){let t={has:i,keys:e};return t.reset=A.reset.bind(t),t.bold=A.bold.bind(t),t.dim=A.dim.bind(t),t.italic=A.italic.bind(t),t.underline=A.underline.bind(t),t.inverse=A.inverse.bind(t),t.hidden=A.hidden.bind(t),t.strikethrough=A.strikethrough.bind(t),t.black=A.black.bind(t),t.red=A.red.bind(t),t.green=A.green.bind(t),t.yellow=A.yellow.bind(t),t.blue=A.blue.bind(t),t.magenta=A.magenta.bind(t),t.cyan=A.cyan.bind(t),t.white=A.white.bind(t),t.gray=A.gray.bind(t),t.grey=A.grey.bind(t),t.bgBlack=A.bgBlack.bind(t),t.bgRed=A.bgRed.bind(t),t.bgGreen=A.bgGreen.bind(t),t.bgYellow=A.bgYellow.bind(t),t.bgBlue=A.bgBlue.bind(t),t.bgMagenta=A.bgMagenta.bind(t),t.bgCyan=A.bgCyan.bind(t),t.bgWhite=A.bgWhite.bind(t),t}function P(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(r){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),r===void 0?this:A.enabled?rh(this.keys,r+""):r+""):r===void 0?Hp([i],[t]):A.enabled?rh([t],r+""):r+""}}sh.exports=A});var oh=m(($x,nh)=>{"use strict";nh.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Br=m((Ux,ah)=>{"use strict";ah.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var B=m((jx,hh)=>{"use strict";var wn="\x1B",q=`${wn}[`,Wp="\x07",bn={to(i,e){return e?`${q}${e+1};${i+1}H`:`${q}${i+1}G`},move(i,e){let t="";return i<0?t+=`${q}${-i}D`:i>0&&(t+=`${q}${i}C`),e<0?t+=`${q}${-e}A`:e>0&&(t+=`${q}${e}B`),t},up:(i=1)=>`${q}${i}A`,down:(i=1)=>`${q}${i}B`,forward:(i=1)=>`${q}${i}C`,backward:(i=1)=>`${q}${i}D`,nextLine:(i=1)=>`${q}E`.repeat(i),prevLine:(i=1)=>`${q}F`.repeat(i),left:`${q}G`,hide:`${q}?25l`,show:`${q}?25h`,save:`${wn}7`,restore:`${wn}8`},Yp={up:(i=1)=>`${q}S`.repeat(i),down:(i=1)=>`${q}T`.repeat(i)},Gp={screen:`${q}2J`,up:(i=1)=>`${q}1J`.repeat(i),down:(i=1)=>`${q}J`.repeat(i),line:`${q}2K`,lineEnd:`${q}K`,lineStart:`${q}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?bn.up():"");return i&&(e+=bn.left),e}};hh.exports={cursor:bn,scroll:Yp,erase:Gp,beep:Wp}});var dh=m((zx,fh)=>{"use strict";function Vp(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Jp(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(l){throw l},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return n=l.done,l},e:function(l){o=!0,a=l},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function Jp(i,e){if(i){if(typeof i=="string")return lh(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return lh(i,e)}}function lh(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var Kp=Br(),uh=B(),ch=uh.erase,Zp=uh.cursor,Xp=i=>[...Kp(i)].length;fh.exports=function(i,e){if(!e)return ch.line+Zp.to(0);let t=0,r=i.split(/\r?\n/);var s=Vp(r),n;try{for(s.s();!(n=s.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(Xp(o)-1,0)/e)}}catch(o){s.e(o)}finally{s.f()}return ch.lines(t)}});var Sn=m((Hx,mh)=>{"use strict";var ji={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Qp={arrowUp:ji.arrowUp,arrowDown:ji.arrowDown,arrowLeft:ji.arrowLeft,arrowRight:ji.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},ey=process.platform==="win32"?Qp:ji;mh.exports=ey});var yh=m((Wx,ph)=>{"use strict";var ai=M(),Bt=Sn(),vn=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),ty=i=>vn[i]||vn.default,zi=Object.freeze({aborted:ai.red(Bt.cross),done:ai.green(Bt.tick),exited:ai.yellow(Bt.cross),default:ai.cyan("?")}),iy=(i,e,t)=>e?zi.aborted:t?zi.exited:i?zi.done:zi.default,ry=i=>ai.gray(i?Bt.ellipsis:Bt.pointerSmall),sy=(i,e)=>ai.gray(i?e?Bt.pointerSmall:"+":Bt.line);ph.exports={styles:vn,render:ty,symbols:zi,symbol:iy,delimiter:ry,item:sy}});var wh=m((Yx,gh)=>{"use strict";var ny=Br();gh.exports=function(i,e){let t=String(ny(i)||"").split(/\r?\n/);return e?t.map(r=>Math.ceil(r.length/e)).reduce((r,s)=>r+s):t.length}});var Sh=m((Gx,bh)=>{"use strict";bh.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",r=e.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=r||n[n.length-1].length+o.length+1<r?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
4
+ `)).join(`
5
+ `)}});var Eh=m((Vx,vh)=>{"use strict";vh.exports=(i,e,t)=>{t=t||e;let r=Math.min(e-t,i-Math.floor(t/2));r<0&&(r=0);let s=Math.min(r+t,e);return{startIndex:r,endIndex:s}}});var Oe=m((Jx,xh)=>{"use strict";xh.exports={action:oh(),clear:dh(),style:yh(),strip:Br(),figures:Sn(),lines:wh(),wrap:Sh(),entriesToDisplay:Eh()}});var Je=m((Kx,Rh)=>{"use strict";var Oh=_("readline"),oy=Oe(),ay=oy.action,hy=_("events"),_h=B(),ly=_h.beep,cy=_h.cursor,uy=M(),En=class extends hy{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=Oh.createInterface({input:this.in,escapeCodeTimeout:50});Oh.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let a=ay(o,r);a===!1?this._&&this._(n,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(cy.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(ly)}render(){this.onRender(uy),this.firstRender&&(this.firstRender=!1)}};Rh.exports=En});var Ih=m((Zx,Ah)=>{"use strict";function Th(i,e,t,r,s,n,o){try{var a=i[n](o),h=a.value}catch(l){t(l);return}a.done?e(h):Promise.resolve(h).then(r,s)}function Dh(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){Th(n,r,s,o,a,"next",h)}function a(h){Th(n,r,s,o,a,"throw",h)}o(void 0)})}}var $r=M(),fy=Je(),kh=B(),dy=kh.erase,Hi=kh.cursor,Ur=Oe(),xn=Ur.style,On=Ur.clear,my=Ur.lines,py=Ur.figures,_n=class extends fy{constructor(e={}){super(e),this.transform=xn.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=On("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=$r.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
6
+ `),this.close()}validate(){var e=this;return Dh(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Dh(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
7
+ `),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Hi.down(my(this.outputError,this.out.columns)-1)+On(this.outputError,this.out.columns)),this.out.write(On(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[xn.symbol(this.done,this.aborted),$r.bold(this.msg),xn.delimiter(this.done),this.red?$r.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
8
+ `).reduce((e,t,r)=>e+`
9
+ ${r?" ":py.pointerSmall} ${$r.red().italic(t)}`,"")),this.out.write(dy.line+Hi.to(0)+this.outputText+Hi.save+this.outputError+Hi.restore+Hi.move(this.cursorOffset,0)))}};Ah.exports=_n});var Fh=m((Xx,Nh)=>{"use strict";var Ke=M(),yy=Je(),Wi=Oe(),Ch=Wi.style,Ph=Wi.clear,jr=Wi.figures,gy=Wi.wrap,wy=Wi.entriesToDisplay,by=B(),Sy=by.cursor,Rn=class extends yy{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Ph("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
10
+ `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
11
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Sy.hide):this.out.write(Ph(this.outputText,this.out.columns)),super.render();let e=wy(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,r=e.endIndex;if(this.outputText=[Ch.symbol(this.done,this.aborted),Ke.bold(this.msg),Ch.delimiter(!1),this.done?this.selection.title:this.selection.disabled?Ke.yellow(this.warn):Ke.gray(this.hint)].join(" "),!this.done){this.outputText+=`
12
+ `;for(let s=t;s<r;s++){let n,o,a="",h=this.choices[s];s===t&&t>0?o=jr.arrowUp:s===r-1&&r<this.choices.length?o=jr.arrowDown:o=" ",h.disabled?(n=this.cursor===s?Ke.gray().underline(h.title):Ke.strikethrough().gray(h.title),o=(this.cursor===s?Ke.bold().gray(jr.pointer)+" ":" ")+o):(n=this.cursor===s?Ke.cyan().underline(h.title):h.title,o=(this.cursor===s?Ke.cyan(jr.pointer)+" ":" ")+o,h.description&&this.cursor===s&&(a=` - ${h.description}`,(o.length+n.length+a.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(a=`
13
+ `+gy(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${Ke.gray(a)}
14
+ `}}this.out.write(this.outputText)}};Nh.exports=Rn});var Uh=m((Qx,$h)=>{"use strict";var zr=M(),vy=Je(),qh=Oe(),Lh=qh.style,Ey=qh.clear,Bh=B(),Mh=Bh.cursor,xy=Bh.erase,Tn=class extends vy{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
15
+ `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
16
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Mh.hide):this.out.write(Ey(this.outputText,this.out.columns)),super.render(),this.outputText=[Lh.symbol(this.done,this.aborted),zr.bold(this.msg),Lh.delimiter(this.done),this.value?this.inactive:zr.cyan().underline(this.inactive),zr.gray("/"),this.value?zr.cyan().underline(this.active):this.active].join(" "),this.out.write(xy.line+Mh.to(0)+this.outputText))}};$h.exports=Tn});var Ce=m((e0,jh)=>{"use strict";var Dn=class i{constructor({token:e,date:t,parts:r,locales:s}){this.token=e,this.date=t||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,r)=>r>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((r,s)=>s>t&&r instanceof i)}toString(){return String(this.date)}};jh.exports=Dn});var Hh=m((t0,zh)=>{"use strict";var Oy=Ce(),kn=class extends Oy{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};zh.exports=kn});var Yh=m((i0,Wh)=>{"use strict";var _y=Ce(),Ry=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),An=class extends _y{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Ry(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Wh.exports=An});var Vh=m((r0,Gh)=>{"use strict";var Ty=Ce(),In=class extends Ty{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Gh.exports=In});var Kh=m((s0,Jh)=>{"use strict";var Dy=Ce(),Cn=class extends Dy{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Jh.exports=Cn});var Xh=m((n0,Zh)=>{"use strict";var ky=Ce(),Pn=class extends ky{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Zh.exports=Pn});var el=m((o0,Qh)=>{"use strict";var Ay=Ce(),Nn=class extends Ay{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Qh.exports=Nn});var il=m((a0,tl)=>{"use strict";var Iy=Ce(),Fn=class extends Iy{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};tl.exports=Fn});var sl=m((h0,rl)=>{"use strict";var Cy=Ce(),Ln=class extends Cy{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};rl.exports=Ln});var ol=m((l0,nl)=>{"use strict";nl.exports={DatePart:Ce(),Meridiem:Hh(),Day:Yh(),Hours:Vh(),Milliseconds:Kh(),Minutes:Xh(),Month:el(),Seconds:il(),Year:sl()}});var yl=m((c0,pl)=>{"use strict";function al(i,e,t,r,s,n,o){try{var a=i[n](o),h=a.value}catch(l){t(l);return}a.done?e(h):Promise.resolve(h).then(r,s)}function hl(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){al(n,r,s,o,a,"next",h)}function a(h){al(n,r,s,o,a,"throw",h)}o(void 0)})}}var Mn=M(),Py=Je(),Bn=Oe(),ll=Bn.style,cl=Bn.clear,Ny=Bn.figures,ml=B(),Fy=ml.erase,ul=ml.cursor,Ze=ol(),fl=Ze.DatePart,Ly=Ze.Meridiem,My=Ze.Day,qy=Ze.Hours,By=Ze.Milliseconds,$y=Ze.Minutes,Uy=Ze.Month,jy=Ze.Seconds,zy=Ze.Year,Hy=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,dl={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new My(i),3:i=>new Uy(i),4:i=>new zy(i),5:i=>new Ly(i),6:i=>new qy(i),7:i=>new $y(i),8:i=>new jy(i),9:i=>new By(i)},Wy={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},qn=class extends Py{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Wy,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=cl("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=Hy.exec(e);){let s=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in dl?dl[n]({token:t[n]||s,date:this.date,parts:this.parts,locales:this.locales}):t[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof fl)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
17
+ `),this.close()}validate(){var e=this;return hl(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return hl(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
18
+ `),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof fl)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(ul.hide):this.out.write(cl(this.outputText,this.out.columns)),super.render(),this.outputText=[ll.symbol(this.done,this.aborted),Mn.bold(this.msg),ll.delimiter(!1),this.parts.reduce((e,t,r)=>e.concat(r===this.cursor&&!this.done?Mn.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
19
+ `).reduce((e,t,r)=>e+`
20
+ ${r?" ":Ny.pointerSmall} ${Mn.red().italic(t)}`,"")),this.out.write(Fy.line+ul.to(0)+this.outputText))}};pl.exports=qn});var xl=m((u0,El)=>{"use strict";function gl(i,e,t,r,s,n,o){try{var a=i[n](o),h=a.value}catch(l){t(l);return}a.done?e(h):Promise.resolve(h).then(r,s)}function wl(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){gl(n,r,s,o,a,"next",h)}function a(h){gl(n,r,s,o,a,"throw",h)}o(void 0)})}}var Hr=M(),Yy=Je(),vl=B(),Wr=vl.cursor,Gy=vl.erase,Yr=Oe(),$n=Yr.style,Vy=Yr.figures,bl=Yr.clear,Jy=Yr.lines,Ky=/[0-9]/,Un=i=>i!==void 0,Sl=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},jn=class extends Yy{constructor(e={}){super(e),this.transform=$n.render(e.style),this.msg=e.message,this.initial=Un(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Un(e.min)?e.min:-1/0,this.max=Un(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Hr.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Sl(e,this.round)}`),this._value=Sl(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Ky.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
21
+ `),this.close()}validate(){var e=this;return wl(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return wl(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
22
+ `),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Wr.down(Jy(this.outputError,this.out.columns)-1)+bl(this.outputError,this.out.columns)),this.out.write(bl(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[$n.symbol(this.done,this.aborted),Hr.bold(this.msg),$n.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Hr[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
23
+ `).reduce((e,t,r)=>e+`
24
+ ${r?" ":Vy.pointerSmall} ${Hr.red().italic(t)}`,"")),this.out.write(Gy.line+Wr.to(0)+this.outputText+Wr.save+this.outputError+Wr.restore))}};El.exports=jn});var Hn=m((f0,Rl)=>{"use strict";var Pe=M(),Zy=B(),Xy=Zy.cursor,Qy=Je(),Yi=Oe(),Ol=Yi.clear,pt=Yi.figures,_l=Yi.style,eg=Yi.wrap,tg=Yi.entriesToDisplay,zn=class extends Qy{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=Ol("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
25
+ `),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
26
+ `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
27
+ Instructions:
28
+ ${pt.arrowUp}/${pt.arrowDown}: Highlight option
29
+ ${pt.arrowLeft}/${pt.arrowRight}/[space]: Toggle selection
30
+ `+(this.maxChoices===void 0?` a: Toggle all
31
+ `:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?Pe.green(pt.radioOn):pt.radioOff)+" "+s+" ",o,a;return t.disabled?o=e===r?Pe.gray().underline(t.title):Pe.strikethrough().gray(t.title):(o=e===r?Pe.cyan().underline(t.title):t.title,e===r&&t.description&&(a=` - ${t.description}`,(n.length+o.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
32
+ `+eg(t.description,{margin:n.length,width:this.out.columns})))),n+o+Pe.gray(a||"")}paginateOptions(e){if(e.length===0)return Pe.red("No matches for this query.");let t=tg(this.cursor,e.length,this.optionsPerPage),r=t.startIndex,s=t.endIndex,n,o=[];for(let a=r;a<s;a++)a===r&&r>0?n=pt.arrowUp:a===s-1&&s<e.length?n=pt.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[a],a,n));return`
33
+ `+o.join(`
34
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[Pe.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Pe.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xy.hide),super.render();let e=[_l.symbol(this.done,this.aborted),Pe.bold(this.msg),_l.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Pe.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=Ol(e,this.out.columns)}};Rl.exports=zn});var Pl=m((d0,Cl)=>{"use strict";function Tl(i,e,t,r,s,n,o){try{var a=i[n](o),h=a.value}catch(l){t(l);return}a.done?e(h):Promise.resolve(h).then(r,s)}function ig(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){Tl(n,r,s,o,a,"next",h)}function a(h){Tl(n,r,s,o,a,"throw",h)}o(void 0)})}}var Gi=M(),rg=Je(),Il=B(),sg=Il.erase,Dl=Il.cursor,Vi=Oe(),Wn=Vi.style,kl=Vi.clear,Yn=Vi.figures,ng=Vi.wrap,og=Vi.entriesToDisplay,Al=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),ag=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),hg=(i,e)=>{let t=i.findIndex(r=>r.value===e||r.title===e);return t>-1?t:void 0},Gn=class extends rg{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:hg(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Wn.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=kl("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Al(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return ig(function*(){let r=t.completing=t.suggest(t.input,t.choices),s=yield r;if(t.completing!==r)return;t.suggestions=s.map((o,a,h)=>({title:ag(h,a),value:Al(h,a),description:o.description})),t.completing=!1;let n=Math.max(s.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
35
+ `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
36
+ `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
37
+ `),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?Yn.arrowUp:s?Yn.arrowDown:" ",a=t?Gi.cyan().underline(e.title):e.title;return o=(t?Gi.cyan(Yn.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+a.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
38
+ `+ng(e.description,{margin:3,width:this.out.columns}))),o+" "+a+Gi.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Dl.hide):this.out.write(kl(this.outputText,this.out.columns)),super.render();let e=og(this.select,this.choices.length,this.limit),t=e.startIndex,r=e.endIndex;if(this.outputText=[Wn.symbol(this.done,this.aborted,this.exited),Gi.bold(this.msg),Wn.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let s=this.suggestions.slice(t,r).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===r-1&&r<this.choices.length)).join(`
39
+ `);this.outputText+=`
40
+ `+(s||Gi.gray(this.fallback.title))}this.out.write(sg.line+Dl.to(0)+this.outputText)}};Cl.exports=Gn});var Ml=m((m0,Ll)=>{"use strict";var Xe=M(),lg=B(),cg=lg.cursor,ug=Hn(),Jn=Oe(),Nl=Jn.clear,Fl=Jn.style,hi=Jn.figures,Vn=class extends ug{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Nl("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(r=>r===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
41
+ Instructions:
42
+ ${hi.arrowUp}/${hi.arrowDown}: Highlight option
43
+ ${hi.arrowLeft}/${hi.arrowRight}/[space]: Toggle selection
44
+ [a,b,c]/delete: Filter choices
45
+ enter/return: Complete answer
46
+ `:""}renderCurrentInput(){return`
47
+ Filtered results for: ${this.inputValue?this.inputValue:Xe.gray("Enter something to filter")}
48
+ `}renderOption(e,t,r){let s;return t.disabled?s=e===r?Xe.gray().underline(t.title):Xe.strikethrough().gray(t.title):s=e===r?Xe.cyan().underline(t.title):t.title,(t.selected?Xe.green(hi.radioOn):hi.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[Xe.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(Xe.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(cg.hide),super.render();let e=[Fl.symbol(this.done,this.aborted),Xe.bold(this.msg),Fl.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Xe.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Nl(e,this.out.columns)}};Ll.exports=Vn});var Hl=m((p0,zl)=>{"use strict";var ql=M(),fg=Je(),Ul=Oe(),Bl=Ul.style,dg=Ul.clear,jl=B(),mg=jl.erase,$l=jl.cursor,Kn=class extends fg{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
49
+ `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
50
+ `),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write($l.hide):this.out.write(dg(this.outputText,this.out.columns)),super.render(),this.outputText=[Bl.symbol(this.done,this.aborted),ql.bold(this.msg),Bl.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:ql.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(mg.line+$l.to(0)+this.outputText))}};zl.exports=Kn});var Yl=m((y0,Wl)=>{"use strict";Wl.exports={TextPrompt:Ih(),SelectPrompt:Fh(),TogglePrompt:Uh(),DatePrompt:yl(),NumberPrompt:xl(),MultiselectPrompt:Hn(),AutocompletePrompt:Pl(),AutocompleteMultiselectPrompt:Ml(),ConfirmPrompt:Hl()}});var Vl=m(Gl=>{"use strict";var he=Gl,pg=Yl(),Gr=i=>i;function Ne(i,e,t={}){return new Promise((r,s)=>{let n=new pg[i](e),o=t.onAbort||Gr,a=t.onSubmit||Gr,h=t.onExit||Gr;n.on("state",e.onState||Gr),n.on("submit",l=>r(a(l))),n.on("exit",l=>r(h(l))),n.on("abort",l=>s(o(l)))})}he.text=i=>Ne("TextPrompt",i);he.password=i=>(i.style="password",he.text(i));he.invisible=i=>(i.style="invisible",he.text(i));he.number=i=>Ne("NumberPrompt",i);he.date=i=>Ne("DatePrompt",i);he.confirm=i=>Ne("ConfirmPrompt",i);he.list=i=>{let e=i.separator||",";return Ne("TextPrompt",i,{onSubmit:t=>t.split(e).map(r=>r.trim())})};he.toggle=i=>Ne("TogglePrompt",i);he.select=i=>Ne("SelectPrompt",i);he.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return Ne("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};he.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return Ne("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var yg=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));he.autocomplete=i=>(i.suggest=i.suggest||yg,i.choices=[].concat(i.choices||[]),Ne("AutocompletePrompt",i))});var ic=m((w0,tc)=>{"use strict";function Jl(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function Kl(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jl(Object(t),!0).forEach(function(r){gg(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Jl(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function gg(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function wg(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=bg(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(l){throw l},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
51
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return n=l.done,l},e:function(l){o=!0,a=l},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function bg(i,e){if(i){if(typeof i=="string")return Zl(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Zl(i,e)}}function Zl(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}function Xl(i,e,t,r,s,n,o){try{var a=i[n](o),h=a.value}catch(l){t(l);return}a.done?e(h):Promise.resolve(h).then(r,s)}function Ql(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(h){Xl(n,r,s,o,a,"next",h)}function a(h){Xl(n,r,s,o,a,"throw",h)}o(void 0)})}}var Zn=Vl(),Sg=["suggest","format","onState","validate","onRender","type"],ec=()=>{};function yt(){return Xn.apply(this,arguments)}function Xn(){return Xn=Ql(function*(i=[],{onSubmit:e=ec,onCancel:t=ec}={}){let r={},s=yt._override||{};i=[].concat(i);let n,o,a,h,l,c,u=function(){var g=Ql(function*(y,I,O=!1){if(!(!O&&y.validate&&y.validate(I)!==!0))return y.format?yield y.format(I,r):I});return function(I,O){return g.apply(this,arguments)}}();var f=wg(i),d;try{for(f.s();!(d=f.n()).done;){o=d.value;var p=o;if(h=p.name,l=p.type,typeof l=="function"&&(l=yield l(n,Kl({},r),o),o.type=l),!!l){for(let g in o){if(Sg.includes(g))continue;let y=o[g];o[g]=typeof y=="function"?yield y(n,Kl({},r),c):y}if(c=o,typeof o.message!="string")throw new Error("prompt message is required");var b=o;if(h=b.name,l=b.type,Zn[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(s[o.name]!==void 0&&(n=yield u(o,s[o.name]),n!==void 0)){r[h]=n;continue}try{n=yt._injected?vg(yt._injected,o.initial):yield Zn[l](o),r[h]=n=yield u(o,n,!0),a=yield e(o,n,r)}catch{a=!(yield t(o,r))}if(a)return r}}}catch(g){f.e(g)}finally{f.f()}return r}),Xn.apply(this,arguments)}function vg(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Eg(i){yt._injected=(yt._injected||[]).concat(i)}function xg(i){yt._override=Object.assign({},i)}tc.exports=Object.assign(yt,{prompt:yt,prompts:Zn,inject:Eg,override:xg})});var sc=m((b0,rc)=>{"use strict";rc.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Vr=m((S0,nc)=>{"use strict";nc.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var hc=m((v0,ac)=>{"use strict";var Og=Vr(),{erase:oc,cursor:_g}=B(),Rg=i=>[...Og(i)].length;ac.exports=function(i,e){if(!e)return oc.line+_g.to(0);let t=0,r=i.split(/\r?\n/);for(let s of r)t+=1+Math.floor(Math.max(Rg(s)-1,0)/e);return oc.lines(t)}});var Qn=m((E0,lc)=>{"use strict";var Ji={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Tg={arrowUp:Ji.arrowUp,arrowDown:Ji.arrowDown,arrowLeft:Ji.arrowLeft,arrowRight:Ji.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Dg=process.platform==="win32"?Tg:Ji;lc.exports=Dg});var uc=m((x0,cc)=>{"use strict";var li=M(),$t=Qn(),eo=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),kg=i=>eo[i]||eo.default,Ki=Object.freeze({aborted:li.red($t.cross),done:li.green($t.tick),exited:li.yellow($t.cross),default:li.cyan("?")}),Ag=(i,e,t)=>e?Ki.aborted:t?Ki.exited:i?Ki.done:Ki.default,Ig=i=>li.gray(i?$t.ellipsis:$t.pointerSmall),Cg=(i,e)=>li.gray(i?e?$t.pointerSmall:"+":$t.line);cc.exports={styles:eo,render:kg,symbols:Ki,symbol:Ag,delimiter:Ig,item:Cg}});var dc=m((O0,fc)=>{"use strict";var Pg=Vr();fc.exports=function(i,e){let t=String(Pg(i)||"").split(/\r?\n/);return e?t.map(r=>Math.ceil(r.length/e)).reduce((r,s)=>r+s):t.length}});var pc=m((_0,mc)=>{"use strict";mc.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",r=e.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=r||n[n.length-1].length+o.length+1<r?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
52
+ `)).join(`
53
+ `)}});var gc=m((R0,yc)=>{"use strict";yc.exports=(i,e,t)=>{t=t||e;let r=Math.min(e-t,i-Math.floor(t/2));r<0&&(r=0);let s=Math.min(r+t,e);return{startIndex:r,endIndex:s}}});var _e=m((T0,wc)=>{"use strict";wc.exports={action:sc(),clear:hc(),style:uc(),strip:Vr(),figures:Qn(),lines:dc(),wrap:pc(),entriesToDisplay:gc()}});var Qe=m((D0,Sc)=>{"use strict";var bc=_("readline"),{action:Ng}=_e(),Fg=_("events"),{beep:Lg,cursor:Mg}=B(),qg=M(),to=class extends Fg{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=bc.createInterface({input:this.in,escapeCodeTimeout:50});bc.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let a=Ng(o,r);a===!1?this._&&this._(n,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(Mg.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Lg)}render(){this.onRender(qg),this.firstRender&&(this.firstRender=!1)}};Sc.exports=to});var Ec=m((k0,vc)=>{"use strict";var Jr=M(),Bg=Qe(),{erase:$g,cursor:Zi}=B(),{style:io,clear:ro,lines:Ug,figures:jg}=_e(),so=class extends Bg{constructor(e={}){super(e),this.transform=io.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ro("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Jr.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
54
+ `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
55
+ `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Zi.down(Ug(this.outputError,this.out.columns)-1)+ro(this.outputError,this.out.columns)),this.out.write(ro(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[io.symbol(this.done,this.aborted),Jr.bold(this.msg),io.delimiter(this.done),this.red?Jr.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
56
+ `).reduce((e,t,r)=>e+`
57
+ ${r?" ":jg.pointerSmall} ${Jr.red().italic(t)}`,"")),this.out.write($g.line+Zi.to(0)+this.outputText+Zi.save+this.outputError+Zi.restore+Zi.move(this.cursorOffset,0)))}};vc.exports=so});var Rc=m((A0,_c)=>{"use strict";var et=M(),zg=Qe(),{style:xc,clear:Oc,figures:Kr,wrap:Hg,entriesToDisplay:Wg}=_e(),{cursor:Yg}=B(),no=class extends zg{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Oc("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
58
+ `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
59
+ `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Yg.hide):this.out.write(Oc(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Wg(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[xc.symbol(this.done,this.aborted),et.bold(this.msg),xc.delimiter(!1),this.done?this.selection.title:this.selection.disabled?et.yellow(this.warn):et.gray(this.hint)].join(" "),!this.done){this.outputText+=`
60
+ `;for(let r=e;r<t;r++){let s,n,o="",a=this.choices[r];r===e&&e>0?n=Kr.arrowUp:r===t-1&&t<this.choices.length?n=Kr.arrowDown:n=" ",a.disabled?(s=this.cursor===r?et.gray().underline(a.title):et.strikethrough().gray(a.title),n=(this.cursor===r?et.bold().gray(Kr.pointer)+" ":" ")+n):(s=this.cursor===r?et.cyan().underline(a.title):a.title,n=(this.cursor===r?et.cyan(Kr.pointer)+" ":" ")+n,a.description&&this.cursor===r&&(o=` - ${a.description}`,(n.length+s.length+o.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(o=`
61
+ `+Hg(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${s}${et.gray(o)}
62
+ `}}this.out.write(this.outputText)}};_c.exports=no});var Ac=m((I0,kc)=>{"use strict";var Zr=M(),Gg=Qe(),{style:Tc,clear:Vg}=_e(),{cursor:Dc,erase:Jg}=B(),oo=class extends Gg{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
63
+ `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
64
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Dc.hide):this.out.write(Vg(this.outputText,this.out.columns)),super.render(),this.outputText=[Tc.symbol(this.done,this.aborted),Zr.bold(this.msg),Tc.delimiter(this.done),this.value?this.inactive:Zr.cyan().underline(this.inactive),Zr.gray("/"),this.value?Zr.cyan().underline(this.active):this.active].join(" "),this.out.write(Jg.line+Dc.to(0)+this.outputText))}};kc.exports=oo});var Fe=m((C0,Ic)=>{"use strict";var ao=class i{constructor({token:e,date:t,parts:r,locales:s}){this.token=e,this.date=t||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,r)=>r>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((r,s)=>s>t&&r instanceof i)}toString(){return String(this.date)}};Ic.exports=ao});var Pc=m((P0,Cc)=>{"use strict";var Kg=Fe(),ho=class extends Kg{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Cc.exports=ho});var Fc=m((N0,Nc)=>{"use strict";var Zg=Fe(),Xg=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),lo=class extends Zg{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Xg(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Nc.exports=lo});var Mc=m((F0,Lc)=>{"use strict";var Qg=Fe(),co=class extends Qg{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Lc.exports=co});var Bc=m((L0,qc)=>{"use strict";var ew=Fe(),uo=class extends ew{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};qc.exports=uo});var Uc=m((M0,$c)=>{"use strict";var tw=Fe(),fo=class extends tw{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};$c.exports=fo});var zc=m((q0,jc)=>{"use strict";var iw=Fe(),mo=class extends iw{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};jc.exports=mo});var Wc=m((B0,Hc)=>{"use strict";var rw=Fe(),po=class extends rw{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Hc.exports=po});var Gc=m(($0,Yc)=>{"use strict";var sw=Fe(),yo=class extends sw{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Yc.exports=yo});var Jc=m((U0,Vc)=>{"use strict";Vc.exports={DatePart:Fe(),Meridiem:Pc(),Day:Fc(),Hours:Mc(),Milliseconds:Bc(),Minutes:Uc(),Month:zc(),Seconds:Wc(),Year:Gc()}});var iu=m((j0,tu)=>{"use strict";var go=M(),nw=Qe(),{style:Kc,clear:Zc,figures:ow}=_e(),{erase:aw,cursor:Xc}=B(),{DatePart:Qc,Meridiem:hw,Day:lw,Hours:cw,Milliseconds:uw,Minutes:fw,Month:dw,Seconds:mw,Year:pw}=Jc(),yw=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,eu={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new lw(i),3:i=>new dw(i),4:i=>new pw(i),5:i=>new hw(i),6:i=>new cw(i),7:i=>new fw(i),8:i=>new mw(i),9:i=>new uw(i)},gw={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},wo=class extends nw{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(gw,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Zc("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=yw.exec(e);){let s=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in eu?eu[n]({token:t[n]||s,date:this.date,parts:this.parts,locales:this.locales}):t[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof Qc)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
65
+ `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
66
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof Qc)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Xc.hide):this.out.write(Zc(this.outputText,this.out.columns)),super.render(),this.outputText=[Kc.symbol(this.done,this.aborted),go.bold(this.msg),Kc.delimiter(!1),this.parts.reduce((e,t,r)=>e.concat(r===this.cursor&&!this.done?go.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
67
+ `).reduce((e,t,r)=>e+`
68
+ ${r?" ":ow.pointerSmall} ${go.red().italic(t)}`,"")),this.out.write(aw.line+Xc.to(0)+this.outputText))}};tu.exports=wo});var ou=m((z0,nu)=>{"use strict";var Xr=M(),ww=Qe(),{cursor:Qr,erase:bw}=B(),{style:bo,figures:Sw,clear:ru,lines:vw}=_e(),Ew=/[0-9]/,So=i=>i!==void 0,su=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},vo=class extends ww{constructor(e={}){super(e),this.transform=bo.render(e.style),this.msg=e.message,this.initial=So(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=So(e.min)?e.min:-1/0,this.max=So(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Xr.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${su(e,this.round)}`),this._value=su(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Ew.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
69
+ `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
70
+ `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Qr.down(vw(this.outputError,this.out.columns)-1)+ru(this.outputError,this.out.columns)),this.out.write(ru(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[bo.symbol(this.done,this.aborted),Xr.bold(this.msg),bo.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Xr[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
71
+ `).reduce((e,t,r)=>e+`
72
+ ${r?" ":Sw.pointerSmall} ${Xr.red().italic(t)}`,"")),this.out.write(bw.line+Qr.to(0)+this.outputText+Qr.save+this.outputError+Qr.restore))}};nu.exports=vo});var xo=m((H0,lu)=>{"use strict";var Le=M(),{cursor:xw}=B(),Ow=Qe(),{clear:au,figures:gt,style:hu,wrap:_w,entriesToDisplay:Rw}=_e(),Eo=class extends Ow{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=au("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
73
+ `),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
74
+ `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
75
+ Instructions:
76
+ ${gt.arrowUp}/${gt.arrowDown}: Highlight option
77
+ ${gt.arrowLeft}/${gt.arrowRight}/[space]: Toggle selection
78
+ `+(this.maxChoices===void 0?` a: Toggle all
79
+ `:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?Le.green(gt.radioOn):gt.radioOff)+" "+s+" ",o,a;return t.disabled?o=e===r?Le.gray().underline(t.title):Le.strikethrough().gray(t.title):(o=e===r?Le.cyan().underline(t.title):t.title,e===r&&t.description&&(a=` - ${t.description}`,(n.length+o.length+a.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(a=`
80
+ `+_w(t.description,{margin:n.length,width:this.out.columns})))),n+o+Le.gray(a||"")}paginateOptions(e){if(e.length===0)return Le.red("No matches for this query.");let{startIndex:t,endIndex:r}=Rw(this.cursor,e.length,this.optionsPerPage),s,n=[];for(let o=t;o<r;o++)o===t&&t>0?s=gt.arrowUp:o===r-1&&r<e.length?s=gt.arrowDown:s=" ",n.push(this.renderOption(this.cursor,e[o],o,s));return`
81
+ `+n.join(`
82
+ `)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[Le.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Le.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xw.hide),super.render();let e=[hu.symbol(this.done,this.aborted),Le.bold(this.msg),hu.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Le.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=au(e,this.out.columns)}};lu.exports=Eo});var mu=m((W0,du)=>{"use strict";var Xi=M(),Tw=Qe(),{erase:Dw,cursor:cu}=B(),{style:Oo,clear:uu,figures:_o,wrap:kw,entriesToDisplay:Aw}=_e(),fu=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Iw=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Cw=(i,e)=>{let t=i.findIndex(r=>r.value===e||r.title===e);return t>-1?t:void 0},Ro=class extends Tw{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Cw(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Oo.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=uu("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=fu(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),r=await t;if(this.completing!==t)return;this.suggestions=r.map((n,o,a)=>({title:Iw(a,o),value:fu(a,o),description:n.description})),this.completing=!1;let s=Math.max(r.length-1,0);this.moveSelect(Math.min(s,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
83
+ `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
84
+ `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
85
+ `),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?_o.arrowUp:s?_o.arrowDown:" ",a=t?Xi.cyan().underline(e.title):e.title;return o=(t?Xi.cyan(_o.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+a.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
86
+ `+kw(e.description,{margin:3,width:this.out.columns}))),o+" "+a+Xi.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(cu.hide):this.out.write(uu(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Aw(this.select,this.choices.length,this.limit);if(this.outputText=[Oo.symbol(this.done,this.aborted,this.exited),Xi.bold(this.msg),Oo.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let r=this.suggestions.slice(e,t).map((s,n)=>this.renderOption(s,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
87
+ `);this.outputText+=`
88
+ `+(r||Xi.gray(this.fallback.title))}this.out.write(Dw.line+cu.to(0)+this.outputText)}};du.exports=Ro});var wu=m((Y0,gu)=>{"use strict";var tt=M(),{cursor:Pw}=B(),Nw=xo(),{clear:pu,style:yu,figures:ci}=_e(),To=class extends Nw{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=pu("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(r=>r===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
89
+ Instructions:
90
+ ${ci.arrowUp}/${ci.arrowDown}: Highlight option
91
+ ${ci.arrowLeft}/${ci.arrowRight}/[space]: Toggle selection
92
+ [a,b,c]/delete: Filter choices
93
+ enter/return: Complete answer
94
+ `:""}renderCurrentInput(){return`
95
+ Filtered results for: ${this.inputValue?this.inputValue:tt.gray("Enter something to filter")}
96
+ `}renderOption(e,t,r){let s;return t.disabled?s=e===r?tt.gray().underline(t.title):tt.strikethrough().gray(t.title):s=e===r?tt.cyan().underline(t.title):t.title,(t.selected?tt.green(ci.radioOn):ci.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[tt.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(tt.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Pw.hide),super.render();let e=[yu.symbol(this.done,this.aborted),tt.bold(this.msg),yu.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=tt.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=pu(e,this.out.columns)}};gu.exports=To});var xu=m((G0,Eu)=>{"use strict";var bu=M(),Fw=Qe(),{style:Su,clear:Lw}=_e(),{erase:Mw,cursor:vu}=B(),Do=class extends Fw{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
97
+ `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
98
+ `),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(vu.hide):this.out.write(Lw(this.outputText,this.out.columns)),super.render(),this.outputText=[Su.symbol(this.done,this.aborted),bu.bold(this.msg),Su.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:bu.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Mw.line+vu.to(0)+this.outputText))}};Eu.exports=Do});var _u=m((V0,Ou)=>{"use strict";Ou.exports={TextPrompt:Ec(),SelectPrompt:Rc(),TogglePrompt:Ac(),DatePrompt:iu(),NumberPrompt:ou(),MultiselectPrompt:xo(),AutocompletePrompt:mu(),AutocompleteMultiselectPrompt:wu(),ConfirmPrompt:xu()}});var Tu=m(Ru=>{"use strict";var le=Ru,qw=_u(),es=i=>i;function Me(i,e,t={}){return new Promise((r,s)=>{let n=new qw[i](e),o=t.onAbort||es,a=t.onSubmit||es,h=t.onExit||es;n.on("state",e.onState||es),n.on("submit",l=>r(a(l))),n.on("exit",l=>r(h(l))),n.on("abort",l=>s(o(l)))})}le.text=i=>Me("TextPrompt",i);le.password=i=>(i.style="password",le.text(i));le.invisible=i=>(i.style="invisible",le.text(i));le.number=i=>Me("NumberPrompt",i);le.date=i=>Me("DatePrompt",i);le.confirm=i=>Me("ConfirmPrompt",i);le.list=i=>{let e=i.separator||",";return Me("TextPrompt",i,{onSubmit:t=>t.split(e).map(r=>r.trim())})};le.toggle=i=>Me("TogglePrompt",i);le.select=i=>Me("SelectPrompt",i);le.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return Me("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};le.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return Me("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Bw=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));le.autocomplete=i=>(i.suggest=i.suggest||Bw,i.choices=[].concat(i.choices||[]),Me("AutocompletePrompt",i))});var Au=m((K0,ku)=>{"use strict";var ko=Tu(),$w=["suggest","format","onState","validate","onRender","type"],Du=()=>{};async function wt(i=[],{onSubmit:e=Du,onCancel:t=Du}={}){let r={},s=wt._override||{};i=[].concat(i);let n,o,a,h,l,c,u=async(f,d,p=!1)=>{if(!(!p&&f.validate&&f.validate(d)!==!0))return f.format?await f.format(d,r):d};for(o of i)if({name:h,type:l}=o,typeof l=="function"&&(l=await l(n,{...r},o),o.type=l),!!l){for(let f in o){if($w.includes(f))continue;let d=o[f];o[f]=typeof d=="function"?await d(n,{...r},c):d}if(c=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:h,type:l}=o,ko[l]===void 0)throw new Error(`prompt type (${l}) is not defined`);if(s[o.name]!==void 0&&(n=await u(o,s[o.name]),n!==void 0)){r[h]=n;continue}try{n=wt._injected?Uw(wt._injected,o.initial):await ko[l](o),r[h]=n=await u(o,n,!0),a=await e(o,n,r)}catch{a=!await t(o,r)}if(a)return r}return r}function Uw(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function jw(i){wt._injected=(wt._injected||[]).concat(i)}function zw(i){wt._override=Object.assign({},i)}ku.exports=Object.assign(wt,{prompt:wt,prompts:ko,inject:jw,override:zw})});var Cu=m((Z0,Iu)=>{"use strict";function Hw(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let e=0,t=process.versions.node.split(".").map(Number);for(;e<i.length;e++){if(t[e]>i[e])return!1;if(i[e]>t[e])return!0}return!1}Iu.exports=Hw("8.6.0")?ic():Au()});var Y=m(Ao=>{"use strict";Ao.fromCallback=function(i){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")i.apply(this,e);else return new Promise((t,r)=>{e.push((s,n)=>s!=null?r(s):t(n)),i.apply(this,e)})},"name",{value:i.name})};Ao.fromPromise=function(i){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return i.apply(this,e);e.pop(),i.apply(this,e).then(r=>t(null,r),t)},"name",{value:i.name})}});var Lu=m((LO,Fu)=>{"use strict";var St=_("constants"),Ww=process.cwd,ts=null,Yw=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ts||(ts=Ww.call(process)),ts};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Io=process.chdir,process.chdir=function(i){ts=null,Io.call(process,i)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Io));var Io;Fu.exports=Gw;function Gw(i){St.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(i),i.lutimes||t(i),i.chown=n(i.chown),i.fchown=n(i.fchown),i.lchown=n(i.lchown),i.chmod=r(i.chmod),i.fchmod=r(i.fchmod),i.lchmod=r(i.lchmod),i.chownSync=o(i.chownSync),i.fchownSync=o(i.fchownSync),i.lchownSync=o(i.lchownSync),i.chmodSync=s(i.chmodSync),i.fchmodSync=s(i.fchmodSync),i.lchmodSync=s(i.lchmodSync),i.stat=a(i.stat),i.fstat=a(i.fstat),i.lstat=a(i.lstat),i.statSync=h(i.statSync),i.fstatSync=h(i.fstatSync),i.lstatSync=h(i.lstatSync),i.chmod&&!i.lchmod&&(i.lchmod=function(c,u,f){f&&process.nextTick(f)},i.lchmodSync=function(){}),i.chown&&!i.lchown&&(i.lchown=function(c,u,f,d){d&&process.nextTick(d)},i.lchownSync=function(){}),Yw==="win32"&&(i.rename=typeof i.rename!="function"?i.rename:function(c){function u(f,d,p){var b=Date.now(),g=0;c(f,d,function y(I){if(I&&(I.code==="EACCES"||I.code==="EPERM"||I.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){i.stat(d,function(O,v){O&&O.code==="ENOENT"?c(f,d,y):p(I)})},g),g<100&&(g+=10);return}p&&p(I)})}return Object.setPrototypeOf&&Object.setPrototypeOf(u,c),u}(i.rename)),i.read=typeof i.read!="function"?i.read:function(c){function u(f,d,p,b,g,y){var I;if(y&&typeof y=="function"){var O=0;I=function(v,U,we){if(v&&v.code==="EAGAIN"&&O<10)return O++,c.call(i,f,d,p,b,g,I);y.apply(this,arguments)}}return c.call(i,f,d,p,b,g,I)}return Object.setPrototypeOf&&Object.setPrototypeOf(u,c),u}(i.read),i.readSync=typeof i.readSync!="function"?i.readSync:function(c){return function(u,f,d,p,b){for(var g=0;;)try{return c.call(i,u,f,d,p,b)}catch(y){if(y.code==="EAGAIN"&&g<10){g++;continue}throw y}}}(i.readSync);function e(c){c.lchmod=function(u,f,d){c.open(u,St.O_WRONLY|St.O_SYMLINK,f,function(p,b){if(p){d&&d(p);return}c.fchmod(b,f,function(g){c.close(b,function(y){d&&d(g||y)})})})},c.lchmodSync=function(u,f){var d=c.openSync(u,St.O_WRONLY|St.O_SYMLINK,f),p=!0,b;try{b=c.fchmodSync(d,f),p=!1}finally{if(p)try{c.closeSync(d)}catch{}else c.closeSync(d)}return b}}function t(c){St.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(u,f,d,p){c.open(u,St.O_SYMLINK,function(b,g){if(b){p&&p(b);return}c.futimes(g,f,d,function(y){c.close(g,function(I){p&&p(y||I)})})})},c.lutimesSync=function(u,f,d){var p=c.openSync(u,St.O_SYMLINK),b,g=!0;try{b=c.futimesSync(p,f,d),g=!1}finally{if(g)try{c.closeSync(p)}catch{}else c.closeSync(p)}return b}):c.futimes&&(c.lutimes=function(u,f,d,p){p&&process.nextTick(p)},c.lutimesSync=function(){})}function r(c){return c&&function(u,f,d){return c.call(i,u,f,function(p){l(p)&&(p=null),d&&d.apply(this,arguments)})}}function s(c){return c&&function(u,f){try{return c.call(i,u,f)}catch(d){if(!l(d))throw d}}}function n(c){return c&&function(u,f,d,p){return c.call(i,u,f,d,function(b){l(b)&&(b=null),p&&p.apply(this,arguments)})}}function o(c){return c&&function(u,f,d){try{return c.call(i,u,f,d)}catch(p){if(!l(p))throw p}}}function a(c){return c&&function(u,f,d){typeof f=="function"&&(d=f,f=null);function p(b,g){g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),d&&d.apply(this,arguments)}return f?c.call(i,u,f,p):c.call(i,u,p)}}function h(c){return c&&function(u,f){var d=f?c.call(i,u,f):c.call(i,u);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function l(c){if(!c||c.code==="ENOSYS")return!0;var u=!process.getuid||process.getuid()!==0;return!!(u&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var Bu=m((MO,qu)=>{"use strict";var Mu=_("stream").Stream;qu.exports=Vw;function Vw(i){return{ReadStream:e,WriteStream:t};function e(r,s){if(!(this instanceof e))return new e(r,s);Mu.call(this);var n=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,s=s||{};for(var o=Object.keys(s),a=0,h=o.length;a<h;a++){var l=o[a];this[l]=s[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){n._read()});return}i.open(this.path,this.flags,this.mode,function(c,u){if(c){n.emit("error",c),n.readable=!1;return}n.fd=u,n.emit("open",u),n._read()})}function t(r,s){if(!(this instanceof t))return new t(r,s);Mu.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,s=s||{};for(var n=Object.keys(s),o=0,a=n.length;o<a;o++){var h=n[o];this[h]=s[h]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=i.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Uu=m((qO,$u)=>{"use strict";$u.exports=Kw;var Jw=Object.getPrototypeOf||function(i){return i.__proto__};function Kw(i){if(i===null||typeof i!="object")return i;if(i instanceof Object)var e={__proto__:Jw(i)};else var e=Object.create(null);return Object.getOwnPropertyNames(i).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}),e}});var pi=m((BO,No)=>{"use strict";var $=_("fs"),Zw=Lu(),Xw=Bu(),Qw=Uu(),is=_("util"),ee,ss;typeof Symbol=="function"&&typeof Symbol.for=="function"?(ee=Symbol.for("graceful-fs.queue"),ss=Symbol.for("graceful-fs.previous")):(ee="___graceful-fs.queue",ss="___graceful-fs.previous");function eb(){}function Hu(i,e){Object.defineProperty(i,ee,{get:function(){return e}})}var jt=eb;is.debuglog?jt=is.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(jt=function(){var i=is.format.apply(is,arguments);i="GFS4: "+i.split(/\n/).join(`
99
+ GFS4: `),console.error(i)});$[ee]||(ju=global[ee]||[],Hu($,ju),$.close=function(i){function e(t,r){return i.call($,t,function(s){s||zu(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(e,ss,{value:i}),e}($.close),$.closeSync=function(i){function e(t){i.apply($,arguments),zu()}return Object.defineProperty(e,ss,{value:i}),e}($.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){jt($[ee]),_("assert").equal($[ee].length,0)}));var ju;global[ee]||Hu(global,$[ee]);No.exports=Co(Qw($));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!$.__patched&&(No.exports=Co($),$.__patched=!0);function Co(i){Zw(i),i.gracefulify=Co,i.createReadStream=U,i.createWriteStream=we;var e=i.readFile;i.readFile=t;function t(w,x,T){return typeof x=="function"&&(T=x,x=null),Z(w,x,T);function Z(X,W,L,j){return e(X,W,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?mi([Z,[X,W,L],C,j||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var r=i.writeFile;i.writeFile=s;function s(w,x,T,Z){return typeof T=="function"&&(Z=T,T=null),X(w,x,T,Z);function X(W,L,j,C,Q){return r(W,L,j,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([X,[W,L,j,C],F,Q||Date.now(),Date.now()]):typeof C=="function"&&C.apply(this,arguments)})}}var n=i.appendFile;n&&(i.appendFile=o);function o(w,x,T,Z){return typeof T=="function"&&(Z=T,T=null),X(w,x,T,Z);function X(W,L,j,C,Q){return n(W,L,j,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([X,[W,L,j,C],F,Q||Date.now(),Date.now()]):typeof C=="function"&&C.apply(this,arguments)})}}var a=i.copyFile;a&&(i.copyFile=h);function h(w,x,T,Z){return typeof T=="function"&&(Z=T,T=0),X(w,x,T,Z);function X(W,L,j,C,Q){return a(W,L,j,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([X,[W,L,j,C],F,Q||Date.now(),Date.now()]):typeof C=="function"&&C.apply(this,arguments)})}}var l=i.readdir;i.readdir=u;var c=/^v[0-5]\./;function u(w,x,T){typeof x=="function"&&(T=x,x=null);var Z=c.test(process.version)?function(L,j,C,Q){return l(L,X(L,j,C,Q))}:function(L,j,C,Q){return l(L,j,X(L,j,C,Q))};return Z(w,x,T);function X(W,L,j,C){return function(Q,F){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?mi([Z,[W,L,j],Q,C||Date.now(),Date.now()]):(F&&F.sort&&F.sort(),typeof j=="function"&&j.call(this,Q,F))}}}if(process.version.substr(0,4)==="v0.8"){var f=Xw(i);y=f.ReadStream,O=f.WriteStream}var d=i.ReadStream;d&&(y.prototype=Object.create(d.prototype),y.prototype.open=I);var p=i.WriteStream;p&&(O.prototype=Object.create(p.prototype),O.prototype.open=v),Object.defineProperty(i,"ReadStream",{get:function(){return y},set:function(w){y=w},enumerable:!0,configurable:!0}),Object.defineProperty(i,"WriteStream",{get:function(){return O},set:function(w){O=w},enumerable:!0,configurable:!0});var b=y;Object.defineProperty(i,"FileReadStream",{get:function(){return b},set:function(w){b=w},enumerable:!0,configurable:!0});var g=O;Object.defineProperty(i,"FileWriteStream",{get:function(){return g},set:function(w){g=w},enumerable:!0,configurable:!0});function y(w,x){return this instanceof y?(d.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function I(){var w=this;Ve(w.path,w.flags,w.mode,function(x,T){x?(w.autoClose&&w.destroy(),w.emit("error",x)):(w.fd=T,w.emit("open",T),w.read())})}function O(w,x){return this instanceof O?(p.apply(this,arguments),this):O.apply(Object.create(O.prototype),arguments)}function v(){var w=this;Ve(w.path,w.flags,w.mode,function(x,T){x?(w.destroy(),w.emit("error",x)):(w.fd=T,w.emit("open",T))})}function U(w,x){return new i.ReadStream(w,x)}function we(w,x){return new i.WriteStream(w,x)}var D=i.open;i.open=Ve;function Ve(w,x,T,Z){return typeof T=="function"&&(Z=T,T=null),X(w,x,T,Z);function X(W,L,j,C,Q){return D(W,L,j,function(F,Mx){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([X,[W,L,j,C],F,Q||Date.now(),Date.now()]):typeof C=="function"&&C.apply(this,arguments)})}}return i}function mi(i){jt("ENQUEUE",i[0].name,i[1]),$[ee].push(i),Po()}var rs;function zu(){for(var i=Date.now(),e=0;e<$[ee].length;++e)$[ee][e].length>2&&($[ee][e][3]=i,$[ee][e][4]=i);Po()}function Po(){if(clearTimeout(rs),rs=void 0,$[ee].length!==0){var i=$[ee].shift(),e=i[0],t=i[1],r=i[2],s=i[3],n=i[4];if(s===void 0)jt("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-s>=6e4){jt("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,r)}else{var a=Date.now()-n,h=Math.max(n-s,1),l=Math.min(h*1.2,100);a>=l?(jt("RETRY",e.name,t),e.apply(null,t.concat([s]))):$[ee].push(i)}rs===void 0&&(rs=setTimeout(Po,0))}}});var ce=m(it=>{"use strict";var Wu=Y().fromCallback,se=pi(),tb=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(i=>typeof se[i]=="function");Object.assign(it,se);tb.forEach(i=>{it[i]=Wu(se[i])});it.exists=function(i,e){return typeof e=="function"?se.exists(i,e):new Promise(t=>se.exists(i,t))};it.read=function(i,e,t,r,s,n){return typeof n=="function"?se.read(i,e,t,r,s,n):new Promise((o,a)=>{se.read(i,e,t,r,s,(h,l,c)=>{if(h)return a(h);o({bytesRead:l,buffer:c})})})};it.write=function(i,e,...t){return typeof t[t.length-1]=="function"?se.write(i,e,...t):new Promise((r,s)=>{se.write(i,e,...t,(n,o,a)=>{if(n)return s(n);r({bytesWritten:o,buffer:a})})})};it.readv=function(i,e,...t){return typeof t[t.length-1]=="function"?se.readv(i,e,...t):new Promise((r,s)=>{se.readv(i,e,...t,(n,o,a)=>{if(n)return s(n);r({bytesRead:o,buffers:a})})})};it.writev=function(i,e,...t){return typeof t[t.length-1]=="function"?se.writev(i,e,...t):new Promise((r,s)=>{se.writev(i,e,...t,(n,o,a)=>{if(n)return s(n);r({bytesWritten:o,buffers:a})})})};typeof se.realpath.native=="function"?it.realpath.native=Wu(se.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var Gu=m((UO,Yu)=>{"use strict";var ib=_("path");Yu.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(ib.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}}});var Zu=m((jO,Fo)=>{"use strict";var Vu=ce(),{checkPath:Ju}=Gu(),Ku=i=>{let e={mode:511};return typeof i=="number"?i:{...e,...i}.mode};Fo.exports.makeDir=async(i,e)=>(Ju(i),Vu.mkdir(i,{mode:Ku(e),recursive:!0}));Fo.exports.makeDirSync=(i,e)=>(Ju(i),Vu.mkdirSync(i,{mode:Ku(e),recursive:!0}))});var Re=m((zO,Xu)=>{"use strict";var rb=Y().fromPromise,{makeDir:sb,makeDirSync:Lo}=Zu(),Mo=rb(sb);Xu.exports={mkdirs:Mo,mkdirsSync:Lo,mkdirp:Mo,mkdirpSync:Lo,ensureDir:Mo,ensureDirSync:Lo}});var vt=m((HO,ef)=>{"use strict";var nb=Y().fromPromise,Qu=ce();function ob(i){return Qu.access(i).then(()=>!0).catch(()=>!1)}ef.exports={pathExists:nb(ob),pathExistsSync:Qu.existsSync}});var qo=m((WO,tf)=>{"use strict";var yi=ce(),ab=Y().fromPromise;async function hb(i,e,t){let r=await yi.open(i,"r+"),s=null;try{await yi.futimes(r,e,t)}finally{try{await yi.close(r)}catch(n){s=n}}if(s)throw s}function lb(i,e,t){let r=yi.openSync(i,"r+");return yi.futimesSync(r,e,t),yi.closeSync(r)}tf.exports={utimesMillis:ab(hb),utimesMillisSync:lb}});var zt=m((YO,of)=>{"use strict";var gi=ce(),G=_("path"),rf=Y().fromPromise;function cb(i,e,t){let r=t.dereference?s=>gi.stat(s,{bigint:!0}):s=>gi.lstat(s,{bigint:!0});return Promise.all([r(i),r(e).catch(s=>{if(s.code==="ENOENT")return null;throw s})]).then(([s,n])=>({srcStat:s,destStat:n}))}function ub(i,e,t){let r,s=t.dereference?o=>gi.statSync(o,{bigint:!0}):o=>gi.lstatSync(o,{bigint:!0}),n=s(i);try{r=s(e)}catch(o){if(o.code==="ENOENT")return{srcStat:n,destStat:null};throw o}return{srcStat:n,destStat:r}}async function fb(i,e,t,r){let{srcStat:s,destStat:n}=await cb(i,e,r);if(n){if(er(s,n)){let o=G.basename(i),a=G.basename(e);if(t==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:s,destStat:n,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!n.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${i}'.`);if(!s.isDirectory()&&n.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${i}'.`)}if(s.isDirectory()&&Bo(i,e))throw new Error(ns(i,e,t));return{srcStat:s,destStat:n}}function db(i,e,t,r){let{srcStat:s,destStat:n}=ub(i,e,r);if(n){if(er(s,n)){let o=G.basename(i),a=G.basename(e);if(t==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:s,destStat:n,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!n.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${i}'.`);if(!s.isDirectory()&&n.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${i}'.`)}if(s.isDirectory()&&Bo(i,e))throw new Error(ns(i,e,t));return{srcStat:s,destStat:n}}async function sf(i,e,t,r){let s=G.resolve(G.dirname(i)),n=G.resolve(G.dirname(t));if(n===s||n===G.parse(n).root)return;let o;try{o=await gi.stat(n,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(er(e,o))throw new Error(ns(i,t,r));return sf(i,e,n,r)}function nf(i,e,t,r){let s=G.resolve(G.dirname(i)),n=G.resolve(G.dirname(t));if(n===s||n===G.parse(n).root)return;let o;try{o=gi.statSync(n,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(er(e,o))throw new Error(ns(i,t,r));return nf(i,e,n,r)}function er(i,e){return e.ino&&e.dev&&e.ino===i.ino&&e.dev===i.dev}function Bo(i,e){let t=G.resolve(i).split(G.sep).filter(s=>s),r=G.resolve(e).split(G.sep).filter(s=>s);return t.every((s,n)=>r[n]===s)}function ns(i,e,t){return`Cannot ${t} '${i}' to a subdirectory of itself, '${e}'.`}of.exports={checkPaths:rf(fb),checkPathsSync:db,checkParentPaths:rf(sf),checkParentPathsSync:nf,isSrcSubdir:Bo,areIdentical:er}});var uf=m((GO,cf)=>{"use strict";var te=ce(),tr=_("path"),{mkdirs:mb}=Re(),{pathExists:pb}=vt(),{utimesMillis:yb}=qo(),ir=zt();async function gb(i,e,t={}){typeof t=="function"&&(t={filter:t}),t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
100
+
101
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:s}=await ir.checkPaths(i,e,"copy",t);if(await ir.checkParentPaths(i,r,e,"copy"),!await hf(i,e,t))return;let o=tr.dirname(e);await pb(o)||await mb(o),await lf(s,i,e,t)}async function hf(i,e,t){return t.filter?t.filter(i,e):!0}async function lf(i,e,t,r){let n=await(r.dereference?te.stat:te.lstat)(e);if(n.isDirectory())return vb(n,i,e,t,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return wb(n,i,e,t,r);if(n.isSymbolicLink())return Eb(i,e,t,r);throw n.isSocket()?new Error(`Cannot copy a socket file: ${e}`):n.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function wb(i,e,t,r,s){if(!e)return af(i,t,r,s);if(s.overwrite)return await te.unlink(r),af(i,t,r,s);if(s.errorOnExist)throw new Error(`'${r}' already exists`)}async function af(i,e,t,r){if(await te.copyFile(e,t),r.preserveTimestamps){bb(i.mode)&&await Sb(t,i.mode);let s=await te.stat(e);await yb(t,s.atime,s.mtime)}return te.chmod(t,i.mode)}function bb(i){return(i&128)===0}function Sb(i,e){return te.chmod(i,e|128)}async function vb(i,e,t,r,s){e||await te.mkdir(r);let n=await te.readdir(t);await Promise.all(n.map(async o=>{let a=tr.join(t,o),h=tr.join(r,o);if(!await hf(a,h,s))return;let{destStat:c}=await ir.checkPaths(a,h,"copy",s);return lf(c,a,h,s)})),e||await te.chmod(r,i.mode)}async function Eb(i,e,t,r){let s=await te.readlink(e);if(r.dereference&&(s=tr.resolve(process.cwd(),s)),!i)return te.symlink(s,t);let n=null;try{n=await te.readlink(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return te.symlink(s,t);throw o}if(r.dereference&&(n=tr.resolve(process.cwd(),n)),ir.isSrcSubdir(s,n))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${n}'.`);if(ir.isSrcSubdir(n,s))throw new Error(`Cannot overwrite '${n}' with '${s}'.`);return await te.unlink(t),te.symlink(s,t)}cf.exports=gb});var yf=m((VO,pf)=>{"use strict";var ne=pi(),rr=_("path"),xb=Re().mkdirsSync,Ob=qo().utimesMillisSync,sr=zt();function _b(i,e,t){typeof t=="function"&&(t={filter:t}),t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
102
+
103
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:s}=sr.checkPathsSync(i,e,"copy",t);if(sr.checkParentPathsSync(i,r,e,"copy"),t.filter&&!t.filter(i,e))return;let n=rr.dirname(e);return ne.existsSync(n)||xb(n),ff(s,i,e,t)}function ff(i,e,t,r){let n=(r.dereference?ne.statSync:ne.lstatSync)(e);if(n.isDirectory())return Cb(n,i,e,t,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return Rb(n,i,e,t,r);if(n.isSymbolicLink())return Fb(i,e,t,r);throw n.isSocket()?new Error(`Cannot copy a socket file: ${e}`):n.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function Rb(i,e,t,r,s){return e?Tb(i,t,r,s):df(i,t,r,s)}function Tb(i,e,t,r){if(r.overwrite)return ne.unlinkSync(t),df(i,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}function df(i,e,t,r){return ne.copyFileSync(e,t),r.preserveTimestamps&&Db(i.mode,e,t),$o(t,i.mode)}function Db(i,e,t){return kb(i)&&Ab(t,i),Ib(e,t)}function kb(i){return(i&128)===0}function Ab(i,e){return $o(i,e|128)}function $o(i,e){return ne.chmodSync(i,e)}function Ib(i,e){let t=ne.statSync(i);return Ob(e,t.atime,t.mtime)}function Cb(i,e,t,r,s){return e?mf(t,r,s):Pb(i.mode,t,r,s)}function Pb(i,e,t,r){return ne.mkdirSync(t),mf(e,t,r),$o(t,i)}function mf(i,e,t){ne.readdirSync(i).forEach(r=>Nb(r,i,e,t))}function Nb(i,e,t,r){let s=rr.join(e,i),n=rr.join(t,i);if(r.filter&&!r.filter(s,n))return;let{destStat:o}=sr.checkPathsSync(s,n,"copy",r);return ff(o,s,n,r)}function Fb(i,e,t,r){let s=ne.readlinkSync(e);if(r.dereference&&(s=rr.resolve(process.cwd(),s)),i){let n;try{n=ne.readlinkSync(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return ne.symlinkSync(s,t);throw o}if(r.dereference&&(n=rr.resolve(process.cwd(),n)),sr.isSrcSubdir(s,n))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${n}'.`);if(sr.isSrcSubdir(n,s))throw new Error(`Cannot overwrite '${n}' with '${s}'.`);return Lb(s,t)}else return ne.symlinkSync(s,t)}function Lb(i,e){return ne.unlinkSync(e),ne.symlinkSync(i,e)}pf.exports=_b});var os=m((JO,gf)=>{"use strict";var Mb=Y().fromPromise;gf.exports={copy:Mb(uf()),copySync:yf()}});var nr=m((KO,bf)=>{"use strict";var wf=pi(),qb=Y().fromCallback;function Bb(i,e){wf.rm(i,{recursive:!0,force:!0},e)}function $b(i){wf.rmSync(i,{recursive:!0,force:!0})}bf.exports={remove:qb(Bb),removeSync:$b}});var Tf=m((ZO,Rf)=>{"use strict";var Ub=Y().fromPromise,Ef=ce(),xf=_("path"),Of=Re(),_f=nr(),Sf=Ub(async function(e){let t;try{t=await Ef.readdir(e)}catch{return Of.mkdirs(e)}return Promise.all(t.map(r=>_f.remove(xf.join(e,r))))});function vf(i){let e;try{e=Ef.readdirSync(i)}catch{return Of.mkdirsSync(i)}e.forEach(t=>{t=xf.join(i,t),_f.removeSync(t)})}Rf.exports={emptyDirSync:vf,emptydirSync:vf,emptyDir:Sf,emptydir:Sf}});var If=m((XO,Af)=>{"use strict";var jb=Y().fromPromise,Df=_("path"),rt=ce(),kf=Re();async function zb(i){let e;try{e=await rt.stat(i)}catch{}if(e&&e.isFile())return;let t=Df.dirname(i),r=null;try{r=await rt.stat(t)}catch(s){if(s.code==="ENOENT"){await kf.mkdirs(t),await rt.writeFile(i,"");return}else throw s}r.isDirectory()?await rt.writeFile(i,""):await rt.readdir(t)}function Hb(i){let e;try{e=rt.statSync(i)}catch{}if(e&&e.isFile())return;let t=Df.dirname(i);try{rt.statSync(t).isDirectory()||rt.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")kf.mkdirsSync(t);else throw r}rt.writeFileSync(i,"")}Af.exports={createFile:jb(zb),createFileSync:Hb}});var Lf=m((QO,Ff)=>{"use strict";var Wb=Y().fromPromise,Cf=_("path"),Et=ce(),Pf=Re(),{pathExists:Yb}=vt(),{areIdentical:Nf}=zt();async function Gb(i,e){let t;try{t=await Et.lstat(e)}catch{}let r;try{r=await Et.lstat(i)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(t&&Nf(r,t))return;let s=Cf.dirname(e);await Yb(s)||await Pf.mkdirs(s),await Et.link(i,e)}function Vb(i,e){let t;try{t=Et.lstatSync(e)}catch{}try{let n=Et.lstatSync(i);if(t&&Nf(n,t))return}catch(n){throw n.message=n.message.replace("lstat","ensureLink"),n}let r=Cf.dirname(e);return Et.existsSync(r)||Pf.mkdirsSync(r),Et.linkSync(i,e)}Ff.exports={createLink:Wb(Gb),createLinkSync:Vb}});var qf=m((e_,Mf)=>{"use strict";var xt=_("path"),or=ce(),{pathExists:Jb}=vt(),Kb=Y().fromPromise;async function Zb(i,e){if(xt.isAbsolute(i)){try{await or.lstat(i)}catch(n){throw n.message=n.message.replace("lstat","ensureSymlink"),n}return{toCwd:i,toDst:i}}let t=xt.dirname(e),r=xt.join(t,i);if(await Jb(r))return{toCwd:r,toDst:i};try{await or.lstat(i)}catch(n){throw n.message=n.message.replace("lstat","ensureSymlink"),n}return{toCwd:i,toDst:xt.relative(t,i)}}function Xb(i,e){if(xt.isAbsolute(i)){if(!or.existsSync(i))throw new Error("absolute srcpath does not exist");return{toCwd:i,toDst:i}}let t=xt.dirname(e),r=xt.join(t,i);if(or.existsSync(r))return{toCwd:r,toDst:i};if(!or.existsSync(i))throw new Error("relative srcpath does not exist");return{toCwd:i,toDst:xt.relative(t,i)}}Mf.exports={symlinkPaths:Kb(Zb),symlinkPathsSync:Xb}});var Uf=m((t_,$f)=>{"use strict";var Bf=ce(),Qb=Y().fromPromise;async function eS(i,e){if(e)return e;let t;try{t=await Bf.lstat(i)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}function tS(i,e){if(e)return e;let t;try{t=Bf.lstatSync(i)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}$f.exports={symlinkType:Qb(eS),symlinkTypeSync:tS}});var Wf=m((i_,Hf)=>{"use strict";var iS=Y().fromPromise,jf=_("path"),qe=ce(),{mkdirs:rS,mkdirsSync:sS}=Re(),{symlinkPaths:nS,symlinkPathsSync:oS}=qf(),{symlinkType:aS,symlinkTypeSync:hS}=Uf(),{pathExists:lS}=vt(),{areIdentical:zf}=zt();async function cS(i,e,t){let r;try{r=await qe.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[a,h]=await Promise.all([qe.stat(i),qe.stat(e)]);if(zf(a,h))return}let s=await nS(i,e);i=s.toDst;let n=await aS(s.toCwd,t),o=jf.dirname(e);return await lS(o)||await rS(o),qe.symlink(i,e,n)}function uS(i,e,t){let r;try{r=qe.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let a=qe.statSync(i),h=qe.statSync(e);if(zf(a,h))return}let s=oS(i,e);i=s.toDst,t=hS(s.toCwd,t);let n=jf.dirname(e);return qe.existsSync(n)||sS(n),qe.symlinkSync(i,e,t)}Hf.exports={createSymlink:iS(cS),createSymlinkSync:uS}});var Qf=m((r_,Xf)=>{"use strict";var{createFile:Yf,createFileSync:Gf}=If(),{createLink:Vf,createLinkSync:Jf}=Lf(),{createSymlink:Kf,createSymlinkSync:Zf}=Wf();Xf.exports={createFile:Yf,createFileSync:Gf,ensureFile:Yf,ensureFileSync:Gf,createLink:Vf,createLinkSync:Jf,ensureLink:Vf,ensureLinkSync:Jf,createSymlink:Kf,createSymlinkSync:Zf,ensureSymlink:Kf,ensureSymlinkSync:Zf}});var as=m((s_,ed)=>{"use strict";function fS(i,{EOL:e=`
104
+ `,finalEOL:t=!0,replacer:r=null,spaces:s}={}){let n=t?e:"";return JSON.stringify(i,r,s).replace(/\n/g,e)+n}function dS(i){return Buffer.isBuffer(i)&&(i=i.toString("utf8")),i.replace(/^\uFEFF/,"")}ed.exports={stringify:fS,stripBom:dS}});var sd=m((n_,rd)=>{"use strict";var wi;try{wi=pi()}catch{wi=_("fs")}var hs=Y(),{stringify:td,stripBom:id}=as();async function mS(i,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||wi,r="throws"in e?e.throws:!0,s=await hs.fromCallback(t.readFile)(i,e);s=id(s);let n;try{n=JSON.parse(s,e?e.reviver:null)}catch(o){if(r)throw o.message=`${i}: ${o.message}`,o;return null}return n}var pS=hs.fromPromise(mS);function yS(i,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||wi,r="throws"in e?e.throws:!0;try{let s=t.readFileSync(i,e);return s=id(s),JSON.parse(s,e.reviver)}catch(s){if(r)throw s.message=`${i}: ${s.message}`,s;return null}}async function gS(i,e,t={}){let r=t.fs||wi,s=td(e,t);await hs.fromCallback(r.writeFile)(i,s,t)}var wS=hs.fromPromise(gS);function bS(i,e,t={}){let r=t.fs||wi,s=td(e,t);return r.writeFileSync(i,s,t)}var SS={readFile:pS,readFileSync:yS,writeFile:wS,writeFileSync:bS};rd.exports=SS});var od=m((o_,nd)=>{"use strict";var ls=sd();nd.exports={readJson:ls.readFile,readJsonSync:ls.readFileSync,writeJson:ls.writeFile,writeJsonSync:ls.writeFileSync}});var cs=m((a_,ld)=>{"use strict";var vS=Y().fromPromise,Uo=ce(),ad=_("path"),hd=Re(),ES=vt().pathExists;async function xS(i,e,t="utf-8"){let r=ad.dirname(i);return await ES(r)||await hd.mkdirs(r),Uo.writeFile(i,e,t)}function OS(i,...e){let t=ad.dirname(i);Uo.existsSync(t)||hd.mkdirsSync(t),Uo.writeFileSync(i,...e)}ld.exports={outputFile:vS(xS),outputFileSync:OS}});var ud=m((h_,cd)=>{"use strict";var{stringify:_S}=as(),{outputFile:RS}=cs();async function TS(i,e,t={}){let r=_S(e,t);await RS(i,r,t)}cd.exports=TS});var dd=m((l_,fd)=>{"use strict";var{stringify:DS}=as(),{outputFileSync:kS}=cs();function AS(i,e,t){let r=DS(e,t);kS(i,r,t)}fd.exports=AS});var pd=m((c_,md)=>{"use strict";var IS=Y().fromPromise,oe=od();oe.outputJson=IS(ud());oe.outputJsonSync=dd();oe.outputJSON=oe.outputJson;oe.outputJSONSync=oe.outputJsonSync;oe.writeJSON=oe.writeJson;oe.writeJSONSync=oe.writeJsonSync;oe.readJSON=oe.readJson;oe.readJSONSync=oe.readJsonSync;md.exports=oe});var Sd=m((u_,bd)=>{"use strict";var CS=ce(),yd=_("path"),{copy:PS}=os(),{remove:wd}=nr(),{mkdirp:NS}=Re(),{pathExists:FS}=vt(),gd=zt();async function LS(i,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:s,isChangingCase:n=!1}=await gd.checkPaths(i,e,"move",t);await gd.checkParentPaths(i,s,e,"move");let o=yd.dirname(e);return yd.parse(o).root!==o&&await NS(o),MS(i,e,r,n)}async function MS(i,e,t,r){if(!r){if(t)await wd(e);else if(await FS(e))throw new Error("dest already exists.")}try{await CS.rename(i,e)}catch(s){if(s.code!=="EXDEV")throw s;await qS(i,e,t)}}async function qS(i,e,t){return await PS(i,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),wd(i)}bd.exports=LS});var _d=m((f_,Od)=>{"use strict";var Ed=pi(),zo=_("path"),BS=os().copySync,xd=nr().removeSync,$S=Re().mkdirpSync,vd=zt();function US(i,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:s,isChangingCase:n=!1}=vd.checkPathsSync(i,e,"move",t);return vd.checkParentPathsSync(i,s,e,"move"),jS(e)||$S(zo.dirname(e)),zS(i,e,r,n)}function jS(i){let e=zo.dirname(i);return zo.parse(e).root===e}function zS(i,e,t,r){if(r)return jo(i,e,t);if(t)return xd(e),jo(i,e,t);if(Ed.existsSync(e))throw new Error("dest already exists.");return jo(i,e,t)}function jo(i,e,t){try{Ed.renameSync(i,e)}catch(r){if(r.code!=="EXDEV")throw r;return HS(i,e,t)}}function HS(i,e,t){return BS(i,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),xd(i)}Od.exports=US});var Td=m((d_,Rd)=>{"use strict";var WS=Y().fromPromise;Rd.exports={move:WS(Sd()),moveSync:_d()}});var Id=m(Ht=>{"use strict";Ht.parse=Ht.decode=YS;Ht.stringify=Ht.encode=Dd;Ht.safe=Si;Ht.unsafe=gs;var Ho=typeof process<"u"&&process.platform==="win32"?`\r
105
+ `:`
106
+ `;function Dd(i,e){var t=[],r="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var s=e.whitespace?" = ":"=";return Object.keys(i).forEach(function(n,o,a){var h=i[n];h&&Array.isArray(h)?h.forEach(function(l){r+=Si(n+"[]")+s+Si(l)+`
107
+ `}):h&&typeof h=="object"?t.push(n):r+=Si(n)+s+Si(h)+Ho}),e.section&&r.length&&(r="["+Si(e.section)+"]"+Ho+r),t.forEach(function(n,o,a){var h=kd(n).join("\\."),l=(e.section?e.section+".":"")+h,c=Dd(i[n],{section:l,whitespace:e.whitespace});r.length&&c.length&&(r+=Ho),r+=c}),r}function kd(i){return i.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function YS(i){var e={},t=e,r=null,s=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,n=i.split(/[\r\n]+/g);return n.forEach(function(o,a,h){if(!(!o||o.match(/^\s*[;#]/))){var l=o.match(s);if(l){if(l[1]!==void 0){if(r=gs(l[1]),r==="__proto__"){t={};return}t=e[r]=e[r]||{};return}var c=gs(l[2]);if(c!=="__proto__"){var u=l[3]?gs(l[4]):!0;switch(u){case"true":case"false":case"null":u=JSON.parse(u)}if(c.length>2&&c.slice(-2)==="[]"){if(c=c.substring(0,c.length-2),c==="__proto__")return;t[c]?Array.isArray(t[c])||(t[c]=[t[c]]):t[c]=[]}Array.isArray(t[c])?t[c].push(u):t[c]=u}}}}),Object.keys(e).filter(function(o,a,h){if(!e[o]||typeof e[o]!="object"||Array.isArray(e[o]))return!1;var l=kd(o),c=e,u=l.pop(),f=u.replace(/\\\./g,".");return l.forEach(function(d,p,b){d!=="__proto__"&&((!c[d]||typeof c[d]!="object")&&(c[d]={}),c=c[d])}),c===e&&f===u?!1:(c[f]=e[o],!0)}).forEach(function(o,a,h){delete e[o]}),e}function Ad(i){return i.charAt(0)==='"'&&i.slice(-1)==='"'||i.charAt(0)==="'"&&i.slice(-1)==="'"}function Si(i){return typeof i!="string"||i.match(/[=\r\n]/)||i.match(/^\[/)||i.length>1&&Ad(i)||i!==i.trim()?JSON.stringify(i):i.replace(/;/g,"\\;").replace(/#/g,"\\#")}function gs(i,e){if(i=(i||"").trim(),Ad(i)){i.charAt(0)==="'"&&(i=i.substr(1,i.length-2));try{i=JSON.parse(i)}catch{}}else{for(var t=!1,r="",s=0,n=i.length;s<n;s++){var o=i.charAt(s);if(t)"\\;#".indexOf(o)!==-1?r+=o:r+="\\"+o,t=!1;else{if(";#".indexOf(o)!==-1)break;o==="\\"?t=!0:r+=o}}return t&&(r+="\\"),r.trim()}return i}});var Nd=m((oR,Pd)=>{"use strict";var Wo=1,Cd=2;function GS(){return""}function VS(i,e,t){return i.slice(e,t).replace(/\S/g," ")}Pd.exports=function(i,e){e=e||{};for(var t,r,s=!1,n=!1,o=0,a="",h=e.whitespace===!1?GS:VS,l=0;l<i.length;l++){if(t=i[l],r=i[l+1],!n&&t==='"'){var c=i[l-1]==="\\"&&i[l-2]!=="\\";c||(s=!s)}if(!s){if(!n&&t+r==="//")a+=i.slice(o,l),o=l,n=Wo,l++;else if(n===Wo&&t+r===`\r
108
+ `){l++,n=!1,a+=h(i,o,l),o=l;continue}else if(n===Wo&&t===`
109
+ `)n=!1,a+=h(i,o,l),o=l;else if(!n&&t+r==="/*"){a+=i.slice(o,l),o=l,n=Cd,l++;continue}else if(n===Cd&&t+r==="*/"){l++,n=!1,a+=h(i,o,l+1),o=l+1;continue}}}return a+(n?h(i.substr(o)):i.substr(o))}});var Ld=m(vi=>{"use strict";var Fd=_("fs"),JS=Id(),ar=_("path"),KS=Nd(),ZS=vi.parse=function(i){return/^\s*{/.test(i)?JSON.parse(KS(i)):JS.parse(i)},XS=vi.file=function(){var i=[].slice.call(arguments).filter(function(s){return s!=null});for(var e in i)if(typeof i[e]!="string")return;var t=ar.join.apply(null,i),r;try{return Fd.readFileSync(t,"utf-8")}catch{return}},aR=vi.json=function(){var i=XS.apply(null,arguments);return i?ZS(i):null},hR=vi.env=function(i,e){e=e||process.env;var t={},r=i.length;for(var s in e)if(s.toLowerCase().indexOf(i.toLowerCase())===0){for(var n=s.substring(r).split("__"),o;(o=n.indexOf(""))>-1;)n.splice(o,1);var a=t;n.forEach(function(l,c){!l||typeof a!="object"||(c===n.length-1&&(a[l]=e[s]),a[l]===void 0&&(a[l]={}),a=a[l])})}return t},lR=vi.find=function(){var i=ar.join.apply(null,[].slice.call(arguments));function e(t,r){var s=ar.join(t,r);try{return Fd.statSync(s),s}catch{if(ar.dirname(t)!==t)return e(ar.dirname(t),r)}}return e(process.cwd(),i)}});var jd=m((uR,Ud)=>{"use strict";function qd(i){return i instanceof Buffer||i instanceof Date||i instanceof RegExp}function Bd(i){if(i instanceof Buffer){var e=Buffer.alloc?Buffer.alloc(i.length):new Buffer(i.length);return i.copy(e),e}else{if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp)return new RegExp(i);throw new Error("Unexpected situation")}}function $d(i){var e=[];return i.forEach(function(t,r){typeof t=="object"&&t!==null?Array.isArray(t)?e[r]=$d(t):qd(t)?e[r]=Bd(t):e[r]=Yo({},t):e[r]=t}),e}function Md(i,e){return e==="__proto__"?void 0:i[e]}var Yo=Ud.exports=function(){if(arguments.length<1||typeof arguments[0]!="object")return!1;if(arguments.length<2)return arguments[0];var i=arguments[0],e=Array.prototype.slice.call(arguments,1),t,r,s;return e.forEach(function(n){typeof n!="object"||n===null||Array.isArray(n)||Object.keys(n).forEach(function(o){if(r=Md(i,o),t=Md(n,o),t!==i)if(typeof t!="object"||t===null){i[o]=t;return}else if(Array.isArray(t)){i[o]=$d(t);return}else if(qd(t)){i[o]=Bd(t);return}else if(typeof r!="object"||r===null||Array.isArray(r)){i[o]=Yo({},t);return}else{i[o]=Yo(r,t);return}})}),i}});var Yd=m((fR,Wd)=>{"use strict";function QS(i,e){var t=i;e.slice(0,-1).forEach(function(s){t=t[s]||{}});var r=e[e.length-1];return r in t}function zd(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function Hd(i,e){return e==="constructor"&&typeof i[e]=="function"||e==="__proto__"}Wd.exports=function(i,e){e||(e={});var t={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(t.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?t.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(v){t.bools[v]=!0});var r={};function s(v){return r[v].some(function(U){return t.bools[U]})}Object.keys(e.alias||{}).forEach(function(v){r[v]=[].concat(e.alias[v]),r[v].forEach(function(U){r[U]=[v].concat(r[v].filter(function(we){return U!==we}))})}),[].concat(e.string).filter(Boolean).forEach(function(v){t.strings[v]=!0,r[v]&&[].concat(r[v]).forEach(function(U){t.strings[U]=!0})});var n=e.default||{},o={_:[]};function a(v,U){return t.allBools&&/^--[^=]+$/.test(U)||t.strings[v]||t.bools[v]||r[v]}function h(v,U,we){for(var D=v,Ve=0;Ve<U.length-1;Ve++){var w=U[Ve];if(Hd(D,w))return;D[w]===void 0&&(D[w]={}),(D[w]===Object.prototype||D[w]===Number.prototype||D[w]===String.prototype)&&(D[w]={}),D[w]===Array.prototype&&(D[w]=[]),D=D[w]}var x=U[U.length-1];Hd(D,x)||((D===Object.prototype||D===Number.prototype||D===String.prototype)&&(D={}),D===Array.prototype&&(D=[]),D[x]===void 0||t.bools[x]||typeof D[x]=="boolean"?D[x]=we:Array.isArray(D[x])?D[x].push(we):D[x]=[D[x],we])}function l(v,U,we){if(!(we&&t.unknownFn&&!a(v,we)&&t.unknownFn(we)===!1)){var D=!t.strings[v]&&zd(U)?Number(U):U;h(o,v.split("."),D),(r[v]||[]).forEach(function(Ve){h(o,Ve.split("."),D)})}}Object.keys(t.bools).forEach(function(v){l(v,n[v]===void 0?!1:n[v])});var c=[];i.indexOf("--")!==-1&&(c=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var u=0;u<i.length;u++){var f=i[u],d,p;if(/^--.+=/.test(f)){var b=f.match(/^--([^=]+)=([\s\S]*)$/);d=b[1];var g=b[2];t.bools[d]&&(g=g!=="false"),l(d,g,f)}else if(/^--no-.+/.test(f))d=f.match(/^--no-(.+)/)[1],l(d,!1,f);else if(/^--.+/.test(f))d=f.match(/^--(.+)/)[1],p=i[u+1],p!==void 0&&!/^(-|--)[^-]/.test(p)&&!t.bools[d]&&!t.allBools&&(!r[d]||!s(d))?(l(d,p,f),u+=1):/^(true|false)$/.test(p)?(l(d,p==="true",f),u+=1):l(d,t.strings[d]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var y=f.slice(1,-1).split(""),I=!1,O=0;O<y.length;O++){if(p=f.slice(O+2),p==="-"){l(y[O],p,f);continue}if(/[A-Za-z]/.test(y[O])&&p[0]==="="){l(y[O],p.slice(1),f),I=!0;break}if(/[A-Za-z]/.test(y[O])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(p)){l(y[O],p,f),I=!0;break}if(y[O+1]&&y[O+1].match(/\W/)){l(y[O],f.slice(O+2),f),I=!0;break}else l(y[O],t.strings[y[O]]?"":!0,f)}d=f.slice(-1)[0],!I&&d!=="-"&&(i[u+1]&&!/^(-|--)[^-]/.test(i[u+1])&&!t.bools[d]&&(!r[d]||!s(d))?(l(d,i[u+1],f),u+=1):i[u+1]&&/^(true|false)$/.test(i[u+1])?(l(d,i[u+1]==="true",f),u+=1):l(d,t.strings[d]?"":!0,f))}else if((!t.unknownFn||t.unknownFn(f)!==!1)&&o._.push(t.strings._||!zd(f)?f:Number(f)),e.stopEarly){o._.push.apply(o._,i.slice(u+1));break}}return Object.keys(n).forEach(function(v){QS(o,v.split("."))||(h(o,v.split("."),n[v]),(r[v]||[]).forEach(function(U){h(o,U.split("."),n[v])}))}),e["--"]?o["--"]=c.slice():c.forEach(function(v){o._.push(v)}),o}});var Go=m((dR,Jd)=>{"use strict";var hr=Ld(),Ei=_("path").join,ev=jd(),Gd="/etc",Vd=process.platform==="win32",lr=Vd?process.env.USERPROFILE:process.env.HOME;Jd.exports=function(i,e,t,r){if(typeof i!="string")throw new Error("rc(name): name *must* be string");t||(t=Yd()(process.argv.slice(2))),e=(typeof e=="string"?hr.json(e):e)||{},r=r||hr.parse;var s=hr.env(i+"_"),n=[e],o=[];function a(h){if(!(o.indexOf(h)>=0)){var l=hr.file(h);l&&(n.push(r(l)),o.push(h))}}return Vd||[Ei(Gd,i,"config"),Ei(Gd,i+"rc")].forEach(a),lr&&[Ei(lr,".config",i,"config"),Ei(lr,".config",i),Ei(lr,"."+i,"config"),Ei(lr,"."+i+"rc")].forEach(a),a(hr.find("."+i+"rc")),s.config&&a(s.config),t.config&&a(t.config),ev.apply(null,n.concat([s,t,o.length?{configs:o,config:o[o.length-1]}:void 0]))}});var Zd=m((mR,Kd)=>{"use strict";Kd.exports=function(i){var e=Go()("npm",{registry:"https://registry.npmjs.org/"}),t=e[i+":registry"]||e.registry;return t.slice(-1)==="/"?t:t+"/"}});var em=m((Vo,Qd)=>{"use strict";var ws=_("buffer"),Be=ws.Buffer;function Xd(i,e){for(var t in i)e[t]=i[t]}Be.from&&Be.alloc&&Be.allocUnsafe&&Be.allocUnsafeSlow?Qd.exports=ws:(Xd(ws,Vo),Vo.Buffer=Wt);function Wt(i,e,t){return Be(i,e,t)}Wt.prototype=Object.create(Be.prototype);Xd(Be,Wt);Wt.from=function(i,e,t){if(typeof i=="number")throw new TypeError("Argument must not be a number");return Be(i,e,t)};Wt.alloc=function(i,e,t){if(typeof i!="number")throw new TypeError("Argument must be a number");var r=Be(i);return e!==void 0?typeof t=="string"?r.fill(e,t):r.fill(e):r.fill(0),r};Wt.allocUnsafe=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return Be(i)};Wt.allocUnsafeSlow=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return ws.SlowBuffer(i)}});var rm=m((pR,im)=>{"use strict";var tm=em().Buffer;function tv(i){return tm.from(i,"base64").toString("utf8")}function iv(i){return tm.from(i,"utf8").toString("base64")}im.exports={decodeBase64:tv,encodeBase64:iv}});var cm=m((yR,lm)=>{"use strict";var Jo=_("url"),am=rm(),rv=am.decodeBase64,sv=am.encodeBase64,sm=":_authToken",nm=":username",om=":_password";lm.exports=function(){var i,e;return arguments.length>=2?(i=arguments[0],e=arguments[1]):typeof arguments[0]=="string"?i=arguments[0]:e=arguments[0],e=e||{},e.npmrc=e.npmrc||Go()("npm",{registry:"https://registry.npmjs.org/"}),i=i||e.npmrc.registry,hm(i,e)||nv(e.npmrc)};function hm(i,e){for(var t=Jo.parse(i,!1,!0),r;r!=="/"&&t.pathname!==r;){r=t.pathname||"/";var s="//"+t.host+r.replace(/\/$/,""),n=av(s,e.npmrc);if(n)return n;if(!e.recursive)return/\/$/.test(i)?void 0:hm(Jo.resolve(i,"."),e);t.pathname=Jo.resolve(ov(r),"..")||"/"}}function nv(i){if(i._auth)return{token:i._auth,type:"Basic"}}function ov(i){return i[i.length-1]==="/"?i:i+"/"}function av(i,e){var t=hv(e[i+sm]||e[i+"/"+sm]);if(t)return t;var r=e[i+nm]||e[i+"/"+nm],s=e[i+om]||e[i+"/"+om],n=lv(r,s);if(n)return n}function hv(i){if(i){var e=i.replace(/^\$\{?([^}]*)\}?$/,function(t,r){return process.env[r]});return{token:e,type:"Bearer"}}}function lv(i,e){if(!(!i||!e)){var t=rv(e.replace(/^\$\{?([^}]*)\}?$/,function(s,n){return process.env[n]})),r=sv(i+":"+t);return{token:r,type:"Basic",password:t,username:i}}}});var mm=m((gR,dm)=>{"use strict";var{URL:cv}=_("url"),{join:um}=_("path"),cr=_("fs"),{promisify:Ko}=_("util"),{tmpdir:uv}=_("os"),fv=Zd(),dv=Ko(cr.writeFile),mv=Ko(cr.mkdir),pv=Ko(cr.readFile),yv=(i,e)=>i.localeCompare(e,"en-US",{numeric:!0}),gv=i=>encodeURIComponent(i).replace(/^%40/,"@"),wv=async(i,e)=>{let t=uv(),r=um(t,"update-check");cr.existsSync(r)||await mv(r);let s=`${i.name}-${e}.json`;return i.scope&&(s=`${i.scope}-${s}`),um(r,s)},bv=async(i,e,t)=>{if(cr.existsSync(i)){let r=await pv(i,"utf8"),{lastUpdate:s,latest:n}=JSON.parse(r);if(s+t>e)return{shouldCheck:!1,latest:n}}return{shouldCheck:!0,latest:null}},Sv=async(i,e,t)=>{let r=JSON.stringify({latest:e,lastUpdate:t});await dv(i,r,"utf8")},fm=(i,e)=>new Promise((t,r)=>{let s={host:i.hostname,path:i.pathname,port:i.port,headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},timeout:2e3};e&&(s.headers.authorization=`${e.type} ${e.token}`);let{get:n}=i.protocol==="https:"?_("https"):_("http");n(s,o=>{let{statusCode:a}=o;if(a!==200){let l=new Error(`Request failed with code ${a}`);l.code=a,r(l),o.resume();return}let h="";o.setEncoding("utf8"),o.on("data",l=>{h+=l}),o.on("end",()=>{try{let l=JSON.parse(h);t(l)}catch(l){r(l)}})}).on("error",r).on("timeout",r)}),vv=async({full:i,scope:e},t)=>{let r=fv(e),s=new cv(i,r),n=null;try{n=await fm(s)}catch(a){if(a.code&&String(a.code).startsWith(4)){let l=cm()(r,{recursive:!0});n=await fm(s,l)}else throw a}let o=n["dist-tags"][t];if(!o)throw new Error(`Distribution tag ${t} is not available`);return o},Ev={interval:36e5,distTag:"latest"},xv=i=>{let e={full:gv(i)};if(i.includes("/")){let t=i.split("/");e.scope=t[0],e.name=t[1]}else e.scope=null,e.name=i;return e};dm.exports=async(i,e)=>{if(typeof i!="object")throw new Error("The first parameter should be your package.json file content");let t=xv(i.name),r=Date.now(),{distTag:s,interval:n}=Object.assign({},Ev,e),o=await wv(t,s),a=null,h=!0;return{shouldCheck:h,latest:a}=await bv(o,r,n),h&&(a=await vv(t,s),await Sv(o,a,r)),yv(i.version,a)===-1?{latest:a,fromCache:!h}:null}});var Ip=xe(Cu(),1);import{existsSync as kp,readdirSync as Tx,readFileSync as Dx}from"node:fs";import kx from"node:fs/promises";import Ap from"node:path";import{fileURLToPath as Ax}from"node:url";import{parseArgs as Ix}from"node:util";var Ut=!0,ui=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},Qi=0;if(ui.process&&ui.process.env&&ui.process.stdout){let{FORCE_COLOR:i,NODE_DISABLE_COLORS:e,NO_COLOR:t,TERM:r,COLORTERM:s}=ui.process.env;e||t||i==="0"?Ut=!1:i==="1"||i==="2"||i==="3"?Ut=!0:r==="dumb"?Ut=!1:"CI"in ui.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(n=>n in ui.process.env)?Ut=!0:Ut=process.stdout.isTTY,Ut&&(process.platform==="win32"||s&&(s==="truecolor"||s==="24bit")?Qi=3:r&&(r.endsWith("-256color")||r.endsWith("256"))?Qi=2:Qi=1)}var Pu={enabled:Ut,supportLevel:Qi};function E(i,e,t=1){let r=`\x1B[${i}m`,s=`\x1B[${e}m`,n=new RegExp(`\\x1b\\[${e}m`,"g");return o=>Pu.enabled&&Pu.supportLevel>=t?r+(""+o).replace(n,r)+s:""+o}var X0=E(0,0),fi=E(1,22),Q0=E(2,22),eO=E(3,23),tO=E(4,24),iO=E(7,27),rO=E(8,28),sO=E(9,29),nO=E(30,39),bt=E(31,39),di=E(32,39),oO=E(33,39),aO=E(34,39),hO=E(35,39),Nu=E(36,39),lO=E(97,39),cO=E(90,39),uO=E(37,39),fO=E(91,39),dO=E(92,39),mO=E(93,39),pO=E(94,39),yO=E(95,39),gO=E(96,39),wO=E(40,49),bO=E(41,49),SO=E(42,49),vO=E(43,49),EO=E(44,49),xO=E(45,49),OO=E(46,49),_O=E(107,49),RO=E(100,49),TO=E(101,49),DO=E(102,49),kO=E(103,49),AO=E(104,49),IO=E(105,49),CO=E(106,49),PO=E(47,49);var us=xe(os(),1),bi=xe(Tf(),1),ue=xe(Qf(),1),fe=xe(pd(),1),Ot=xe(Re(),1),fs=xe(Td(),1),ds=xe(cs(),1),ms=xe(vt(),1),ps=xe(nr(),1),m_=us.default.copy,p_=us.default.copySync,y_=bi.default.emptyDirSync,g_=bi.default.emptydirSync,w_=bi.default.emptyDir,b_=bi.default.emptydir,S_=ue.default.createFile,v_=ue.default.createFileSync,E_=ue.default.ensureFile,x_=ue.default.ensureFileSync,O_=ue.default.createLink,__=ue.default.createLinkSync,R_=ue.default.ensureLink,T_=ue.default.ensureLinkSync,D_=ue.default.createSymlink,k_=ue.default.createSymlinkSync,A_=ue.default.ensureSymlink,I_=ue.default.ensureSymlinkSync,C_=fe.default.readJson,P_=fe.default.readJSON,N_=fe.default.readJsonSync,F_=fe.default.readJSONSync,L_=fe.default.writeJson,M_=fe.default.writeJSON,q_=fe.default.writeJsonSync,B_=fe.default.writeJSONSync,$_=fe.default.outputJson,U_=fe.default.outputJSON,j_=fe.default.outputJsonSync,z_=fe.default.outputJSONSync,H_=Ot.default.mkdirs,W_=Ot.default.mkdirsSync,Y_=Ot.default.mkdirp,G_=Ot.default.mkdirpSync,V_=Ot.default.ensureDir,J_=Ot.default.ensureDirSync,K_=fs.default.move,Z_=fs.default.moveSync,X_=ds.default.outputFile,Q_=ds.default.outputFileSync,eR=ms.default.pathExists,tR=ms.default.pathExistsSync,iR=ps.default.remove,rR=ps.default.removeSync,ys={...us.default,...bi.default,...ue.default,...fe.default,...Ot.default,...fs.default,...ds.default,...ms.default,...ps.default};var Cp=xe(mm(),1);import{existsSync as Ov}from"node:fs";import bs from"node:fs/promises";import xi from"node:path";async function pm(i){return(await bs.readdir(i)).filter(t=>!t.startsWith("."))}async function ym(i,e,t,r){let s={name:e,version:"0.0.0"},n=xi.join(t,r),o=xi.join(i,"package.json"),a=xi.join(n,"package.json"),h=JSON.parse(await bs.readFile(a,"utf-8"));ys.copySync(n,i),await bs.writeFile(o,JSON.stringify({...h,...s},null,2)),Ov(xi.join(i,"gitignore"))&&await bs.rename(xi.join(i,"gitignore"),xi.join(i,".gitignore"))}import{Readable as bx}from"node:stream";import{pipeline as Sx}from"node:stream/promises";import Fv from"events";import me from"fs";import{EventEmitter as ra}from"node:events";import vm from"node:stream";import{StringDecoder as _v}from"node:string_decoder";var gm=typeof process=="object"&&process?process:{stdout:null,stderr:null},Rv=i=>!!i&&typeof i=="object"&&(i instanceof de||i instanceof vm||Tv(i)||Dv(i)),Tv=i=>!!i&&typeof i=="object"&&i instanceof ra&&typeof i.pipe=="function"&&i.pipe!==vm.Writable.prototype.pipe,Dv=i=>!!i&&typeof i=="object"&&i instanceof ra&&typeof i.write=="function"&&typeof i.end=="function",st=Symbol("EOF"),nt=Symbol("maybeEmitEnd"),_t=Symbol("emittedEnd"),Ss=Symbol("emittingEnd"),ur=Symbol("emittedError"),vs=Symbol("closed"),wm=Symbol("read"),Es=Symbol("flush"),bm=Symbol("flushChunk"),Te=Symbol("encoding"),Oi=Symbol("decoder"),V=Symbol("flowing"),fr=Symbol("paused"),_i=Symbol("resume"),J=Symbol("buffer"),ae=Symbol("pipes"),K=Symbol("bufferLength"),Zo=Symbol("bufferPush"),xs=Symbol("bufferShift"),ie=Symbol("objectMode"),z=Symbol("destroyed"),Xo=Symbol("error"),Qo=Symbol("emitData"),Sm=Symbol("emitEnd"),ea=Symbol("emitEnd2"),$e=Symbol("async"),ta=Symbol("abort"),Os=Symbol("aborted"),dr=Symbol("signal"),Yt=Symbol("dataListeners"),pe=Symbol("discarded"),mr=i=>Promise.resolve().then(i),kv=i=>i(),Av=i=>i==="end"||i==="finish"||i==="prefinish",Iv=i=>i instanceof ArrayBuffer||!!i&&typeof i=="object"&&i.constructor&&i.constructor.name==="ArrayBuffer"&&i.byteLength>=0,Cv=i=>!Buffer.isBuffer(i)&&ArrayBuffer.isView(i),_s=class{src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[_i](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ia=class extends _s{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=s=>t.emit("error",s),e.on("error",this.proxyErrors)}},Pv=i=>!!i.objectMode,Nv=i=>!i.objectMode&&!!i.encoding&&i.encoding!=="buffer",de=class extends ra{[V]=!1;[fr]=!1;[ae]=[];[J]=[];[ie];[Te];[$e];[Oi];[st]=!1;[_t]=!1;[Ss]=!1;[vs]=!1;[ur]=null;[K]=0;[z]=!1;[dr];[Os]=!1;[Yt]=0;[pe]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Pv(t)?(this[ie]=!0,this[Te]=null):Nv(t)?(this[Te]=t.encoding,this[ie]=!1):(this[ie]=!1,this[Te]=null),this[$e]=!!t.async,this[Oi]=this[Te]?new _v(this[Te]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[J]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[ae]});let{signal:r}=t;r&&(this[dr]=r,r.aborted?this[ta]():r.addEventListener("abort",()=>this[ta]()))}get bufferLength(){return this[K]}get encoding(){return this[Te]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[ie]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[$e]}set async(e){this[$e]=this[$e]||!!e}[ta](){this[Os]=!0,this.emit("abort",this[dr]?.reason),this.destroy(this[dr]?.reason)}get aborted(){return this[Os]}set aborted(e){}write(e,t,r){if(this[Os])return!1;if(this[st])throw new Error("write after end");if(this[z])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let s=this[$e]?mr:kv;if(!this[ie]&&!Buffer.isBuffer(e)){if(Cv(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Iv(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[ie]?(this[V]&&this[K]!==0&&this[Es](!0),this[V]?this.emit("data",e):this[Zo](e),this[K]!==0&&this.emit("readable"),r&&s(r),this[V]):e.length?(typeof e=="string"&&!(t===this[Te]&&!this[Oi]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Te]&&(e=this[Oi].write(e)),this[V]&&this[K]!==0&&this[Es](!0),this[V]?this.emit("data",e):this[Zo](e),this[K]!==0&&this.emit("readable"),r&&s(r),this[V]):(this[K]!==0&&this.emit("readable"),r&&s(r),this[V])}read(e){if(this[z])return null;if(this[pe]=!1,this[K]===0||e===0||e&&e>this[K])return this[nt](),null;this[ie]&&(e=null),this[J].length>1&&!this[ie]&&(this[J]=[this[Te]?this[J].join(""):Buffer.concat(this[J],this[K])]);let t=this[wm](e||null,this[J][0]);return this[nt](),t}[wm](e,t){if(this[ie])this[xs]();else{let r=t;e===r.length||e===null?this[xs]():typeof r=="string"?(this[J][0]=r.slice(e),t=r.slice(0,e),this[K]-=e):(this[J][0]=r.subarray(e),t=r.subarray(0,e),this[K]-=e)}return this.emit("data",t),!this[J].length&&!this[st]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[st]=!0,this.writable=!1,(this[V]||!this[fr])&&this[nt](),this}[_i](){this[z]||(!this[Yt]&&!this[ae].length&&(this[pe]=!0),this[fr]=!1,this[V]=!0,this.emit("resume"),this[J].length?this[Es]():this[st]?this[nt]():this.emit("drain"))}resume(){return this[_i]()}pause(){this[V]=!1,this[fr]=!0,this[pe]=!1}get destroyed(){return this[z]}get flowing(){return this[V]}get paused(){return this[fr]}[Zo](e){this[ie]?this[K]+=1:this[K]+=e.length,this[J].push(e)}[xs](){return this[ie]?this[K]-=1:this[K]-=this[J][0].length,this[J].shift()}[Es](e=!1){do;while(this[bm](this[xs]())&&this[J].length);!e&&!this[J].length&&!this[st]&&this.emit("drain")}[bm](e){return this.emit("data",e),this[V]}pipe(e,t){if(this[z])return e;this[pe]=!1;let r=this[_t];return t=t||{},e===gm.stdout||e===gm.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[ae].push(t.proxyErrors?new ia(this,e,t):new _s(this,e,t)),this[$e]?mr(()=>this[_i]()):this[_i]()),e}unpipe(e){let t=this[ae].find(r=>r.dest===e);t&&(this[ae].length===1?(this[V]&&this[Yt]===0&&(this[V]=!1),this[ae]=[]):this[ae].splice(this[ae].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[pe]=!1,this[Yt]++,!this[ae].length&&!this[V]&&this[_i]();else if(e==="readable"&&this[K]!==0)super.emit("readable");else if(Av(e)&&this[_t])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ur]){let s=t;this[$e]?mr(()=>s.call(this,this[ur])):s.call(this,this[ur])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Yt]=this.listeners("data").length,this[Yt]===0&&!this[pe]&&!this[ae].length&&(this[V]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Yt]=0,!this[pe]&&!this[ae].length&&(this[V]=!1)),t}get emittedEnd(){return this[_t]}[nt](){!this[Ss]&&!this[_t]&&!this[z]&&this[J].length===0&&this[st]&&(this[Ss]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[vs]&&this.emit("close"),this[Ss]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==z&&this[z])return!1;if(e==="data")return!this[ie]&&!r?!1:this[$e]?(mr(()=>this[Qo](r)),!0):this[Qo](r);if(e==="end")return this[Sm]();if(e==="close"){if(this[vs]=!0,!this[_t]&&!this[z])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[ur]=r,super.emit(Xo,r);let n=!this[dr]||this.listeners("error").length?super.emit("error",r):!1;return this[nt](),n}else if(e==="resume"){let n=super.emit("resume");return this[nt](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let s=super.emit(e,...t);return this[nt](),s}[Qo](e){for(let r of this[ae])r.dest.write(e)===!1&&this.pause();let t=this[pe]?!1:super.emit("data",e);return this[nt](),t}[Sm](){return this[_t]?!1:(this[_t]=!0,this.readable=!1,this[$e]?(mr(()=>this[ea]()),!0):this[ea]())}[ea](){if(this[Oi]){let t=this[Oi].end();if(t){for(let r of this[ae])r.dest.write(t);this[pe]||super.emit("data",t)}}for(let t of this[ae])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[ie]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[ie]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[ie])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Te]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(z,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[pe]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[st])return t();let n,o,a=u=>{this.off("data",h),this.off("end",l),this.off(z,c),t(),o(u)},h=u=>{this.off("error",a),this.off("end",l),this.off(z,c),this.pause(),n({value:u,done:!!this[st]})},l=()=>{this.off("error",a),this.off("data",h),this.off(z,c),t(),n({done:!0,value:void 0})},c=()=>a(new Error("stream destroyed"));return new Promise((u,f)=>{o=f,n=u,this.once(z,c),this.once("error",a),this.once("end",l),this.once("data",h)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[pe]=!1;let e=!1,t=()=>(this.pause(),this.off(Xo,t),this.off(z,t),this.off("end",t),e=!0,{done:!0,value:void 0}),r=()=>{if(e)return t();let s=this.read();return s===null?t():{done:!1,value:s}};return this.once("end",t),this.once(Xo,t),this.once(z,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[z])return e?this.emit("error",e):this.emit(z),this;this[z]=!0,this[pe]=!0,this[J].length=0,this[K]=0;let t=this;return typeof t.close=="function"&&!this[vs]&&t.close(),e?this.emit("error",e):this.emit(z),this}static get isStream(){return Rv}};var Lv=me.writev,Tt=Symbol("_autoClose"),ke=Symbol("_close"),pr=Symbol("_ended"),k=Symbol("_fd"),sa=Symbol("_finished"),at=Symbol("_flags"),na=Symbol("_flush"),la=Symbol("_handleChunk"),ca=Symbol("_makeBuf"),gr=Symbol("_mode"),Rs=Symbol("_needDrain"),Di=Symbol("_onerror"),ki=Symbol("_onopen"),oa=Symbol("_onread"),Ri=Symbol("_onwrite"),Dt=Symbol("_open"),De=Symbol("_path"),Rt=Symbol("_pos"),Ue=Symbol("_queue"),Ti=Symbol("_read"),aa=Symbol("_readSize"),ot=Symbol("_reading"),yr=Symbol("_remain"),ha=Symbol("_size"),Ts=Symbol("_write"),Gt=Symbol("_writing"),Ds=Symbol("_defaultFlag"),Vt=Symbol("_errored"),Jt=class extends de{[Vt]=!1;[k];[De];[aa];[ot]=!1;[ha];[yr];[Tt];constructor(e,t){if(t=t||{},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[Vt]=!1,this[k]=typeof t.fd=="number"?t.fd:void 0,this[De]=e,this[aa]=t.readSize||16*1024*1024,this[ot]=!1,this[ha]=typeof t.size=="number"?t.size:1/0,this[yr]=this[ha],this[Tt]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[k]=="number"?this[Ti]():this[Dt]()}get fd(){return this[k]}get path(){return this[De]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Dt](){me.open(this[De],"r",(e,t)=>this[ki](e,t))}[ki](e,t){e?this[Di](e):(this[k]=t,this.emit("open",t),this[Ti]())}[ca](){return Buffer.allocUnsafe(Math.min(this[aa],this[yr]))}[Ti](){if(!this[ot]){this[ot]=!0;let e=this[ca]();if(e.length===0)return process.nextTick(()=>this[oa](null,0,e));me.read(this[k],e,0,e.length,null,(t,r,s)=>this[oa](t,r,s))}}[oa](e,t,r){this[ot]=!1,e?this[Di](e):this[la](t,r)&&this[Ti]()}[ke](){if(this[Tt]&&typeof this[k]=="number"){let e=this[k];this[k]=void 0,me.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Di](e){this[ot]=!0,this[ke](),this.emit("error",e)}[la](e,t){let r=!1;return this[yr]-=e,e>0&&(r=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[yr]<=0)&&(r=!1,this[ke](),super.end()),r}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[k]=="number"&&this[Ti](),!1;case"error":return this[Vt]?!1:(this[Vt]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},ks=class extends Jt{[Dt](){let e=!0;try{this[ki](null,me.openSync(this[De],"r")),e=!1}finally{e&&this[ke]()}}[Ti](){let e=!0;try{if(!this[ot]){this[ot]=!0;do{let t=this[ca](),r=t.length===0?0:me.readSync(this[k],t,0,t.length,null);if(!this[la](r,t))break}while(!0);this[ot]=!1}e=!1}finally{e&&this[ke]()}}[ke](){if(this[Tt]&&typeof this[k]=="number"){let e=this[k];this[k]=void 0,me.closeSync(e),this.emit("close")}}},ht=class extends Fv{readable=!1;writable=!0;[Vt]=!1;[Gt]=!1;[pr]=!1;[Ue]=[];[Rs]=!1;[De];[gr];[Tt];[k];[Ds];[at];[sa]=!1;[Rt];constructor(e,t){t=t||{},super(t),this[De]=e,this[k]=typeof t.fd=="number"?t.fd:void 0,this[gr]=t.mode===void 0?438:t.mode,this[Rt]=typeof t.start=="number"?t.start:void 0,this[Tt]=typeof t.autoClose=="boolean"?t.autoClose:!0;let r=this[Rt]!==void 0?"r+":"w";this[Ds]=t.flags===void 0,this[at]=t.flags===void 0?r:t.flags,this[k]===void 0&&this[Dt]()}emit(e,...t){if(e==="error"){if(this[Vt])return!1;this[Vt]=!0}return super.emit(e,...t)}get fd(){return this[k]}get path(){return this[De]}[Di](e){this[ke](),this[Gt]=!0,this.emit("error",e)}[Dt](){me.open(this[De],this[at],this[gr],(e,t)=>this[ki](e,t))}[ki](e,t){this[Ds]&&this[at]==="r+"&&e&&e.code==="ENOENT"?(this[at]="w",this[Dt]()):e?this[Di](e):(this[k]=t,this.emit("open",t),this[Gt]||this[na]())}end(e,t){return e&&this.write(e,t),this[pr]=!0,!this[Gt]&&!this[Ue].length&&typeof this[k]=="number"&&this[Ri](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[pr]?(this.emit("error",new Error("write() after end()")),!1):this[k]===void 0||this[Gt]||this[Ue].length?(this[Ue].push(e),this[Rs]=!0,!1):(this[Gt]=!0,this[Ts](e),!0)}[Ts](e){me.write(this[k],e,0,e.length,this[Rt],(t,r)=>this[Ri](t,r))}[Ri](e,t){e?this[Di](e):(this[Rt]!==void 0&&typeof t=="number"&&(this[Rt]+=t),this[Ue].length?this[na]():(this[Gt]=!1,this[pr]&&!this[sa]?(this[sa]=!0,this[ke](),this.emit("finish")):this[Rs]&&(this[Rs]=!1,this.emit("drain"))))}[na](){if(this[Ue].length===0)this[pr]&&this[Ri](null,0);else if(this[Ue].length===1)this[Ts](this[Ue].pop());else{let e=this[Ue];this[Ue]=[],Lv(this[k],e,this[Rt],(t,r)=>this[Ri](t,r))}}[ke](){if(this[Tt]&&typeof this[k]=="number"){let e=this[k];this[k]=void 0,me.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Ai=class extends ht{[Dt](){let e;if(this[Ds]&&this[at]==="r+")try{e=me.openSync(this[De],this[at],this[gr])}catch(t){if(t?.code==="ENOENT")return this[at]="w",this[Dt]();throw t}else e=me.openSync(this[De],this[at],this[gr]);this[ki](null,e)}[ke](){if(this[Tt]&&typeof this[k]=="number"){let e=this[k];this[k]=void 0,me.closeSync(e),this.emit("close")}}[Ts](e){let t=!0;try{this[Ri](null,me.writeSync(this[k],e,0,e.length,this[Rt])),t=!1}finally{if(t)try{this[ke]()}catch{}}}};import ep from"node:path";import Li from"node:fs";import{dirname as mE,parse as pE}from"path";var Mv=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"],["onentry","onReadEntry"]]),Em=i=>!!i.sync&&!!i.file,xm=i=>!i.sync&&!!i.file,Om=i=>!!i.sync&&!i.file,_m=i=>!i.sync&&!i.file;var Rm=i=>!!i.file;var qv=i=>{let e=Mv.get(i);return e||i},wr=(i={})=>{if(!i)return{};let e={};for(let[t,r]of Object.entries(i)){let s=qv(t);e[s]=r}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};var je=(i,e,t,r,s)=>Object.assign((n=[],o,a)=>{Array.isArray(n)&&(o=n,n={}),typeof o=="function"&&(a=o,o=void 0),o?o=Array.from(o):o=[];let h=wr(n);if(s?.(h,o),Em(h)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return i(h,o)}else if(xm(h)){let l=e(h,o),c=a||void 0;return c?l.then(()=>c(),c):l}else if(Om(h)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return t(h,o)}else if(_m(h)){if(typeof a=="function")throw new TypeError("callback only supported with file option");return r(h,o)}else throw new Error("impossible options??")},{syncFile:i,asyncFile:e,syncNoFile:t,asyncNoFile:r,validate:s});import{EventEmitter as uE}from"events";import da from"assert";import{Buffer as kt}from"buffer";import Uv from"zlib";import Bv from"zlib";var $v=Bv.constants||{ZLIB_VERNUM:4736},lt=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},$v));var Tm=kt.concat,Kt=Symbol("_superWrite"),Ii=class extends Error{code;errno;constructor(e){super("zlib: "+e.message),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}},fa=Symbol("flushFlag"),As=class extends de{#e=!1;#i=!1;#r;#n;#s;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#r}constructor(e,t){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");super(e),this.#r=e.flush??0,this.#n=e.finishFlush??0,this.#s=e.fullFlushFlag??0;try{this.#t=new Uv[t](e)}catch(r){throw new Ii(r)}this.#o=r=>{this.#e||(this.#e=!0,this.close(),this.emit("error",r))},this.#t?.on("error",r=>this.#o(new Ii(r))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return da(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#s),this.write(Object.assign(kt.alloc(0),{[fa]:e})))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#n),this.#i=!0,super.end(r)}get ended(){return this.#i}[Kt](e){return super.write(e)}write(e,t,r){if(typeof t=="function"&&(r=t,t="utf8"),typeof e=="string"&&(e=kt.from(e,t)),this.#e)return;da(this.#t,"zlib binding closed");let s=this.#t._handle,n=s.close;s.close=()=>{};let o=this.#t.close;this.#t.close=()=>{},kt.concat=l=>l;let a;try{let l=typeof e[fa]=="number"?e[fa]:this.#r;a=this.#t._processChunk(e,l),kt.concat=Tm}catch(l){kt.concat=Tm,this.#o(new Ii(l))}finally{this.#t&&(this.#t._handle=s,s.close=n,this.#t.close=o,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#o(new Ii(l)));let h;if(a)if(Array.isArray(a)&&a.length>0){let l=a[0];h=this[Kt](kt.from(l));for(let c=1;c<a.length;c++)h=this[Kt](a[c])}else h=this[Kt](kt.from(a));return r&&r(),h}},Is=class extends As{#e;#i;constructor(e,t){e=e||{},e.flush=e.flush||lt.Z_NO_FLUSH,e.finishFlush=e.finishFlush||lt.Z_FINISH,e.fullFlushFlag=lt.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush(lt.Z_SYNC_FLUSH),da(this.handle,"zlib binding closed");let r=this.handle.flush;this.handle.flush=(s,n)=>{typeof s=="function"&&(n=s,s=this.flushFlag),this.flush(s),n?.()};try{this.handle.params(e,t)}finally{this.handle.flush=r}this.handle&&(this.#e=e,this.#i=t)}}}};var Cs=class extends Is{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[Kt](e){return this.#e?(this.#e=!1,e[9]=255,super[Kt](e)):super[Kt](e)}};var Ps=class extends Is{constructor(e){super(e,"Unzip")}},Ns=class extends As{constructor(e,t){e=e||{},e.flush=e.flush||lt.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||lt.BROTLI_OPERATION_FINISH,e.fullFlushFlag=lt.BROTLI_OPERATION_FLUSH,super(e,t)}},Fs=class extends Ns{constructor(e){super(e,"BrotliCompress")}},Ls=class extends Ns{constructor(e){super(e,"BrotliDecompress")}};var Ci=class i{tail;head;length=0;static create(e=[]){return new i(e)}constructor(e=[]){for(let t of e)this.push(t)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");let t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,t}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}push(...e){for(let t=0,r=e.length;t<r;t++)Hv(this,e[t]);return this.length}unshift(...e){for(var t=0,r=e.length;t<r;t++)Wv(this,e[t]);return this.length}pop(){if(!this.tail)return;let e=this.tail.value,t=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,t.list=void 0,this.length--,e}shift(){if(!this.head)return;let e=this.head.value,t=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,t.list=void 0,this.length--,e}forEach(e,t){t=t||this;for(let r=this.head,s=0;r;s++)e.call(t,r.value,s,this),r=r.next}forEachReverse(e,t){t=t||this;for(let r=this.tail,s=this.length-1;r;s--)e.call(t,r.value,s,this),r=r.prev}get(e){let t=0,r=this.head;for(;r&&t<e;t++)r=r.next;if(t===e&&r)return r.value}getReverse(e){let t=0,r=this.tail;for(;r&&t<e;t++)r=r.prev;if(t===e&&r)return r.value}map(e,t){t=t||this;let r=new i;for(let s=this.head;s;)r.push(e.call(t,s.value,this)),s=s.next;return r}mapReverse(e,t){t=t||this;var r=new i;for(let s=this.tail;s;)r.push(e.call(t,s.value,this)),s=s.prev;return r}reduce(e,t){let r,s=this.head;if(arguments.length>1)r=t;else if(this.head)s=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;s;n++)r=e(r,s.value,n),s=s.next;return r}reduceReverse(e,t){let r,s=this.tail;if(arguments.length>1)r=t;else if(this.tail)s=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let n=this.length-1;s;n--)r=e(r,s.value,n),s=s.prev;return r}toArray(){let e=new Array(this.length);for(let t=0,r=this.head;r;t++)e[t]=r.value,r=r.next;return e}toArrayReverse(){let e=new Array(this.length);for(let t=0,r=this.tail;r;t++)e[t]=r.value,r=r.prev;return e}slice(e=0,t=this.length){t<0&&(t+=this.length),e<0&&(e+=this.length);let r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);let s=this.head,n=0;for(n=0;s&&n<e;n++)s=s.next;for(;s&&n<t;n++,s=s.next)r.push(s.value);return r}sliceReverse(e=0,t=this.length){t<0&&(t+=this.length),e<0&&(e+=this.length);let r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);let s=this.length,n=this.tail;for(;n&&s>t;s--)n=n.prev;for(;n&&s>e;s--,n=n.prev)r.push(n.value);return r}splice(e,t=0,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let s=this.head;for(let o=0;s&&o<e;o++)s=s.next;let n=[];for(let o=0;s&&o<t;o++)n.push(s.value),s=this.removeNode(s);s?s!==this.tail&&(s=s.prev):s=this.tail;for(let o of r)s=zv(this,s,o);return n}reverse(){let e=this.head,t=this.tail;for(let r=e;r;r=r.prev){let s=r.prev;r.prev=r.next,r.next=s}return this.head=t,this.tail=e,this}};function zv(i,e,t){let r=e,s=e?e.next:i.head,n=new br(t,r,s,i);return n.next===void 0&&(i.tail=n),n.prev===void 0&&(i.head=n),i.length++,n}function Hv(i,e){i.tail=new br(e,i.tail,void 0,i),i.head||(i.head=i.tail),i.length++}function Wv(i,e){i.head=new br(e,void 0,i.head,i),i.tail||(i.tail=i.head),i.length++}var br=class{list;next;prev;value;constructor(e,t,r,s){this.list=s,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,r?(r.prev=this,this.next=r):this.next=void 0}};import{posix as Pi}from"node:path";var Dm=(i,e)=>{if(Number.isSafeInteger(i))i<0?Gv(i,e):Yv(i,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Yv=(i,e)=>{e[0]=128;for(var t=e.length;t>1;t--)e[t-1]=i&255,i=Math.floor(i/256)},Gv=(i,e)=>{e[0]=255;var t=!1;i=i*-1;for(var r=e.length;r>1;r--){var s=i&255;i=Math.floor(i/256),t?e[r-1]=Am(s):s===0?e[r-1]=0:(t=!0,e[r-1]=Im(s))}},km=i=>{let e=i[0],t=e===128?Jv(i.subarray(1,i.length)):e===255?Vv(i):null;if(t===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(t))throw Error("parsed number outside of javascript safe integer range");return t},Vv=i=>{for(var e=i.length,t=0,r=!1,s=e-1;s>-1;s--){var n=Number(i[s]),o;r?o=Am(n):n===0?o=n:(r=!0,o=Im(n)),o!==0&&(t-=o*Math.pow(256,e-s-1))}return t},Jv=i=>{for(var e=i.length,t=0,r=e-1;r>-1;r--){var s=Number(i[r]);s!==0&&(t+=s*Math.pow(256,e-r-1))}return t},Am=i=>(255^i)&255,Im=i=>(255^i)+1&255;var Ms=i=>qs.has(i);var qs=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"]]),Cm=new Map(Array.from(qs).map(i=>[i[1],i[0]]));var ye=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,r,s){Buffer.isBuffer(e)?this.decode(e,t||0,r,s):e&&this.#i(e)}decode(e,t,r,s){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");this.path=Zt(e,t,100),this.mode=At(e,t+100,8),this.uid=At(e,t+108,8),this.gid=At(e,t+116,8),this.size=At(e,t+124,12),this.mtime=ma(e,t+136,12),this.cksum=At(e,t+148,12),s&&this.#i(s,!0),r&&this.#i(r);let n=Zt(e,t+156,1);if(Ms(n)&&(this.#e=n||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=Zt(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=Zt(e,t+265,32),this.gname=Zt(e,t+297,32),this.devmaj=At(e,t+329,8)??0,this.devmin=At(e,t+337,8)??0,e[t+475]!==0){let a=Zt(e,t+345,155);this.path=a+"/"+this.path}else{let a=Zt(e,t+345,130);a&&(this.path=a+"/"+this.path),this.atime=ma(e,t+476,12),this.ctime=ma(e,t+488,12)}let o=8*32;for(let a=t;a<t+148;a++)o+=e[a];for(let a=t+156;a<t+512;a++)o+=e[a];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===8*32&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,s])=>!(s==null||r==="path"&&t||r==="linkpath"&&t||r==="global"))))}encode(e,t=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw new Error("need 512 bytes for header");let r=this.ctime||this.atime?130:155,s=Zv(this.path||"",r),n=s[0],o=s[1];this.needPax=!!s[2],this.needPax=Xt(e,t,100,n)||this.needPax,this.needPax=It(e,t+100,8,this.mode)||this.needPax,this.needPax=It(e,t+108,8,this.uid)||this.needPax,this.needPax=It(e,t+116,8,this.gid)||this.needPax,this.needPax=It(e,t+124,12,this.size)||this.needPax,this.needPax=pa(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this.#e.charCodeAt(0),this.needPax=Xt(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=Xt(e,t+265,32,this.uname)||this.needPax,this.needPax=Xt(e,t+297,32,this.gname)||this.needPax,this.needPax=It(e,t+329,8,this.devmaj)||this.needPax,this.needPax=It(e,t+337,8,this.devmin)||this.needPax,this.needPax=Xt(e,t+345,r,o)||this.needPax,e[t+475]!==0?this.needPax=Xt(e,t+345,155,o)||this.needPax:(this.needPax=Xt(e,t+345,130,o)||this.needPax,this.needPax=pa(e,t+476,12,this.atime)||this.needPax,this.needPax=pa(e,t+488,12,this.ctime)||this.needPax);let a=8*32;for(let h=t;h<t+148;h++)a+=e[h];for(let h=t+156;h<t+512;h++)a+=e[h];return this.cksum=a,It(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:qs.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Cm.get(e));if(Ms(t)||t==="Unsupported")this.#e=t;else if(Ms(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},Zv=(i,e)=>{let r=i,s="",n,o=Pi.parse(i).root||".";if(Buffer.byteLength(r)<100)n=[r,s,!1];else{s=Pi.dirname(r),r=Pi.basename(r);do Buffer.byteLength(r)<=100&&Buffer.byteLength(s)<=e?n=[r,s,!1]:Buffer.byteLength(r)>100&&Buffer.byteLength(s)<=e?n=[r.slice(0,99),s,!0]:(r=Pi.join(Pi.basename(s),r),s=Pi.dirname(s));while(s!==o&&n===void 0);n||(n=[i.slice(0,99),"",!0])}return n},Zt=(i,e,t)=>i.subarray(e,e+t).toString("utf8").replace(/\0.*/,""),ma=(i,e,t)=>Xv(At(i,e,t)),Xv=i=>i===void 0?void 0:new Date(i*1e3),At=(i,e,t)=>Number(i[e])&128?km(i.subarray(e,e+t)):eE(i,e,t),Qv=i=>isNaN(i)?void 0:i,eE=(i,e,t)=>Qv(parseInt(i.subarray(e,e+t).toString("utf8").replace(/\0.*$/,"").trim(),8)),tE={12:8589934591,8:2097151},It=(i,e,t,r)=>r===void 0?!1:r>tE[t]||r<0?(Dm(r,i.subarray(e,e+t)),!0):(iE(i,e,t,r),!1),iE=(i,e,t,r)=>i.write(rE(r,t),e,t,"ascii"),rE=(i,e)=>sE(Math.floor(i).toString(8),e),sE=(i,e)=>(i.length===e-1?i:new Array(e-i.length-1).join("0")+i+" ")+"\0",pa=(i,e,t,r)=>r===void 0?!1:It(i,e,t,r.getTime()/1e3),nE=new Array(156).join("\0"),Xt=(i,e,t,r)=>r===void 0?!1:(i.write(r+nE,e,t,"utf8"),r.length!==Buffer.byteLength(r)||r.length>t);import{basename as oE}from"node:path";var Ct=class i{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,t=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=t,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let t=Buffer.byteLength(e),r=512*Math.ceil(1+t/512),s=Buffer.allocUnsafe(r);for(let n=0;n<512;n++)s[n]=0;new ye({path:("PaxHeader/"+oE(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:t,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(s),s.write(e,512,t,"utf8");for(let n=t+512;n<s.length;n++)s[n]=0;return s}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let t=this[e],r=t instanceof Date?t.getTime()/1e3:t,s=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+r+`
110
+ `,n=Buffer.byteLength(s),o=Math.floor(Math.log(n)/Math.log(10))+1;return n+o>=Math.pow(10,o)&&(o+=1),o+n+s}static parse(e,t,r=!1){return new i(aE(hE(e),t),r)}},aE=(i,e)=>e?Object.assign({},e,i):i,hE=i=>i.replace(/\n$/,"").split(`
111
+ `).reduce(lE,Object.create(null)),lE=(i,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return i;e=e.slice((t+" ").length);let r=e.split("="),s=r.shift();if(!s)return i;let n=s.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=r.join("=");return i[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(Number(o)*1e3):/^[0-9]+$/.test(o)?+o:o,i};var cE=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,S=cE!=="win32"?i=>i:i=>i&&i.replace(/\\/g,"/");var Ni=class extends de{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,r){switch(super({}),this.pause(),this.extended=t,this.globalExtended=r,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,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}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=S(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?S(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),r&&this.#e(r,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let r=this.remain,s=this.blockRemain;return this.remain=Math.max(0,r-t),this.blockRemain=Math.max(0,s-t),this.ignore?!0:r>=t?super.write(e):super.write(e.subarray(0,r))}#e(e,t=!1){e.path&&(e.path=S(e.path)),e.linkpath&&(e.linkpath=S(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,s])=>!(s==null||r==="path"&&t))))}};var Qt=(i,e,t,r={})=>{i.file&&(r.file=i.file),i.cwd&&(r.cwd=i.cwd),r.code=t instanceof Error&&t.code||e,r.tarCode=e,!i.strict&&r.recoverable!==!1?(t instanceof Error&&(r=Object.assign(t,r),t=t.message),i.emit("warn",e,t,r)):t instanceof Error?i.emit("error",Object.assign(t,r)):i.emit("error",Object.assign(new Error(`${e}: ${t}`),r))};var fE=1024*1024,ya=Buffer.from([31,139]),be=Symbol("state"),ei=Symbol("writeEntry"),ct=Symbol("readEntry"),ga=Symbol("nextEntry"),Nm=Symbol("processEntry"),ze=Symbol("extendedHeader"),Sr=Symbol("globalExtendedHeader"),Pt=Symbol("meta"),Fm=Symbol("emitMeta"),N=Symbol("buffer"),ut=Symbol("queue"),Nt=Symbol("ended"),wa=Symbol("emittedEnd"),ti=Symbol("emit"),H=Symbol("unzip"),Bs=Symbol("consumeChunk"),$s=Symbol("consumeChunkSub"),ba=Symbol("consumeBody"),Lm=Symbol("consumeMeta"),Mm=Symbol("consumeHeader"),vr=Symbol("consuming"),Sa=Symbol("bufferConcat"),Us=Symbol("maybeEnd"),Fi=Symbol("writing"),Ft=Symbol("aborted"),js=Symbol("onDone"),ii=Symbol("sawValidEntry"),zs=Symbol("sawNullBlock"),Hs=Symbol("sawEOF"),qm=Symbol("closeStream"),dE=()=>!0,ft=class extends uE{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[ut]=new Ci;[N];[ct];[ei];[be]="begin";[Pt]="";[ze];[Sr];[Nt]=!1;[H];[Ft]=!1;[ii];[zs]=!1;[Hs]=!1;[Fi]=!1;[vr]=!1;[wa]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(js,()=>{(this[be]==="begin"||this[ii]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(js,e.ondone):this.on(js,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||fE,this.filter=typeof e.filter=="function"?e.filter:dE;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!e.gzip&&e.brotli!==void 0?e.brotli:t?void 0:!1,this.on("end",()=>this[qm]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,r={}){Qt(this,e,t,r)}[Mm](e,t){this[ii]===void 0&&(this[ii]=!1);let r;try{r=new ye(e,t,this[ze],this[Sr])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(r.nullBlock)this[zs]?(this[Hs]=!0,this[be]==="begin"&&(this[be]="header"),this[ti]("eof")):(this[zs]=!0,this[ti]("nullBlock"));else if(this[zs]=!1,!r.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:r});else if(!r.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:r});else{let s=r.type;if(/^(Symbolic)?Link$/.test(s)&&!r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:r});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:r});else{let n=this[ei]=new Ni(r,this[ze],this[Sr]);if(!this[ii])if(n.remain){let o=()=>{n.invalid||(this[ii]=!0)};n.on("end",o)}else this[ii]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[ti]("ignoredEntry",n),this[be]="ignore",n.resume()):n.size>0&&(this[Pt]="",n.on("data",o=>this[Pt]+=o),this[be]="meta"):(this[ze]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[ti]("ignoredEntry",n),this[be]=n.remain?"ignore":"header",n.resume()):(n.remain?this[be]="body":(this[be]="header",n.end()),this[ct]?this[ut].push(n):(this[ut].push(n),this[ga]())))}}}[qm](){queueMicrotask(()=>this.emit("close"))}[Nm](e){let t=!0;if(!e)this[ct]=void 0,t=!1;else if(Array.isArray(e)){let[r,...s]=e;this.emit(r,...s)}else this[ct]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[ga]()),t=!1);return t}[ga](){do;while(this[Nm](this[ut].shift()));if(!this[ut].length){let e=this[ct];!e||e.flowing||e.size===e.remain?this[Fi]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ba](e,t){let r=this[ei];if(!r)throw new Error("attempt to consume body without entry??");let s=r.blockRemain??0,n=s>=e.length&&t===0?e:e.subarray(t,t+s);return r.write(n),r.blockRemain||(this[be]="header",this[ei]=void 0,r.end()),n.length}[Lm](e,t){let r=this[ei],s=this[ba](e,t);return!this[ei]&&r&&this[Fm](r),s}[ti](e,t,r){!this[ut].length&&!this[ct]?this.emit(e,t,r):this[ut].push([e,t,r])}[Fm](e){switch(this[ti]("meta",this[Pt]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[ze]=Ct.parse(this[Pt],this[ze],!1);break;case"GlobalExtendedHeader":this[Sr]=Ct.parse(this[Pt],this[Sr],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[ze]??Object.create(null);this[ze]=t,t.path=this[Pt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[ze]||Object.create(null);this[ze]=t,t.linkpath=this[Pt].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Ft]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[Ft])return r?.(),!1;if((this[H]===void 0||this.brotli===void 0&&this[H]===!1)&&e){if(this[N]&&(e=Buffer.concat([this[N],e]),this[N]=void 0),e.length<ya.length)return this[N]=e,r?.(),!0;for(let a=0;this[H]===void 0&&a<ya.length;a++)e[a]!==ya[a]&&(this[H]=!1);let o=this.brotli===void 0;if(this[H]===!1&&o)if(e.length<512)if(this[Nt])this.brotli=!0;else return this[N]=e,r?.(),!0;else try{new ye(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[H]===void 0||this[H]===!1&&this.brotli){let a=this[Nt];this[Nt]=!1,this[H]=this[H]===void 0?new Ps({}):new Ls({}),this[H].on("data",l=>this[Bs](l)),this[H].on("error",l=>this.abort(l)),this[H].on("end",()=>{this[Nt]=!0,this[Bs]()}),this[Fi]=!0;let h=!!this[H][a?"end":"write"](e);return this[Fi]=!1,r?.(),h}}this[Fi]=!0,this[H]?this[H].write(e):this[Bs](e),this[Fi]=!1;let n=this[ut].length?!1:this[ct]?this[ct].flowing:!0;return!n&&!this[ut].length&&this[ct]?.once("drain",()=>this.emit("drain")),r?.(),n}[Sa](e){e&&!this[Ft]&&(this[N]=this[N]?Buffer.concat([this[N],e]):e)}[Us](){if(this[Nt]&&!this[wa]&&!this[Ft]&&!this[vr]){this[wa]=!0;let e=this[ei];if(e&&e.blockRemain){let t=this[N]?this[N].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[N]&&e.write(this[N]),e.end()}this[ti](js)}}[Bs](e){if(this[vr]&&e)this[Sa](e);else if(!e&&!this[N])this[Us]();else if(e){if(this[vr]=!0,this[N]){this[Sa](e);let t=this[N];this[N]=void 0,this[$s](t)}else this[$s](e);for(;this[N]&&this[N]?.length>=512&&!this[Ft]&&!this[Hs];){let t=this[N];this[N]=void 0,this[$s](t)}this[vr]=!1}(!this[N]||this[Nt])&&this[Us]()}[$s](e){let t=0,r=e.length;for(;t+512<=r&&!this[Ft]&&!this[Hs];)switch(this[be]){case"begin":case"header":this[Mm](e,t),t+=512;break;case"ignore":case"body":t+=this[ba](e,t);break;case"meta":t+=this[Lm](e,t);break;default:throw new Error("invalid state: "+this[be])}t<r&&(this[N]?this[N]=Buffer.concat([e.subarray(t),this[N]]):this[N]=e.subarray(t))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),r&&this.once("finish",r),this[Ft]||(this[H]?(e&&this[H].write(e),this[H].end()):(this[Nt]=!0,this.brotli===void 0&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[Us]())),this}};var He=i=>{let e=i.length-1,t=-1;for(;e>-1&&i.charAt(e)==="/";)t=e,e--;return t===-1?i:i.slice(0,t)};var yE=i=>{let e=i.onReadEntry;i.onReadEntry=e?t=>{e(t),t.resume()}:t=>t.resume()},va=(i,e)=>{let t=new Map(e.map(n=>[He(n),!0])),r=i.filter,s=(n,o="")=>{let a=o||pE(n).root||".",h;if(n===a)h=!1;else{let l=t.get(n);l!==void 0?h=l:h=s(mE(n),a)}return t.set(n,h),h};i.filter=r?(n,o)=>r(n,o)&&s(He(n)):n=>s(He(n))},gE=i=>{let e=new ft(i),t=i.file,r;try{let s=Li.statSync(t),n=i.maxReadSize||16*1024*1024;if(s.size<n)e.end(Li.readFileSync(t));else{let o=0,a=Buffer.allocUnsafe(n);for(r=Li.openSync(t,"r");o<s.size;){let h=Li.readSync(r,a,0,n,o);o+=h,e.write(a.subarray(0,h))}e.end()}}finally{if(typeof r=="number")try{Li.closeSync(r)}catch{}}},wE=(i,e)=>{let t=new ft(i),r=i.maxReadSize||16*1024*1024,s=i.file;return new Promise((o,a)=>{t.on("error",a),t.on("end",o),Li.stat(s,(h,l)=>{if(h)a(h);else{let c=new Jt(s,{readSize:r,size:l.size});c.on("error",a),c.pipe(t)}})})},ri=je(gE,wE,i=>new ft(i),i=>new ft(i),(i,e)=>{e?.length&&va(i,e),i.noResume||yE(i)});import rn from"fs";import We from"fs";import jm from"path";var Ea=(i,e,t)=>(i&=4095,t&&(i=(i|384)&-19),e&&(i&256&&(i|=64),i&32&&(i|=8),i&4&&(i|=1)),i);import{win32 as bE}from"node:path";var{isAbsolute:SE,parse:Bm}=bE,Er=i=>{let e="",t=Bm(i);for(;SE(i)||t.root;){let r=i.charAt(0)==="/"&&i.slice(0,4)!=="//?/"?"/":t.root;i=i.slice(r.length),e+=r,t=Bm(i)}return[e,i]};var Ws=["|","<",">","?",":"],xa=Ws.map(i=>String.fromCharCode(61440+i.charCodeAt(0))),vE=new Map(Ws.map((i,e)=>[i,xa[e]])),EE=new Map(xa.map((i,e)=>[i,Ws[e]])),Oa=i=>Ws.reduce((e,t)=>e.split(t).join(vE.get(t)),i),$m=i=>xa.reduce((e,t)=>e.split(t).join(EE.get(t)),i);var Gm=(i,e)=>e?(i=S(i).replace(/^\.(\/|$)/,""),He(e)+"/"+i):S(i),xE=16*1024*1024,zm=Symbol("process"),Hm=Symbol("file"),Wm=Symbol("directory"),Ra=Symbol("symlink"),Ym=Symbol("hardlink"),xr=Symbol("header"),Ys=Symbol("read"),Ta=Symbol("lstat"),Gs=Symbol("onlstat"),Da=Symbol("onread"),ka=Symbol("onreadlink"),Aa=Symbol("openfile"),Ia=Symbol("onopenfile"),Lt=Symbol("close"),Vs=Symbol("mode"),Ca=Symbol("awaitDrain"),_a=Symbol("ondrain"),Ye=Symbol("prefix"),Or=class extends de{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let r=wr(t);super(),this.path=S(e),this.portable=!!r.portable,this.maxReadSize=r.maxReadSize||xE,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=S(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime,this.prefix=r.prefix?S(r.prefix):void 0,this.onWriteEntry=r.onWriteEntry,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let s=!1;if(!this.preservePaths){let[o,a]=Er(this.path);o&&typeof a=="string"&&(this.path=a,s=o)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=$m(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=S(r.absolute||jm.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let n=this.statCache.get(this.absolute);n?this[Gs](n):this[Ta]()}warn(e,t,r={}){return Qt(this,e,t,r)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Ta](){We.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Gs](t)})}[Gs](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=OE(e),this.emit("stat",e),this[zm]()}[zm](){switch(this.type){case"File":return this[Hm]();case"Directory":return this[Wm]();case"SymbolicLink":return this[Ra]();default:return this.end()}}[Vs](e){return Ea(e,this.type==="Directory",this.portable)}[Ye](e){return Gm(e,this.prefix)}[xr](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ye({path:this[Ye](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ye](this.linkpath):this.linkpath,mode:this[Vs](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Ct({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Ye](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ye](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[Wm](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[xr](),this.end()}[Ra](){We.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[ka](t)})}[ka](e){this.linkpath=S(e),this[xr](),this.end()}[Ym](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=S(jm.relative(this.cwd,e)),this.stat.size=0,this[xr](),this.end()}[Hm](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[Ym](t);this.linkCache.set(e,this.absolute)}if(this[xr](),this.stat.size===0)return this.end();this[Aa]()}[Aa](){We.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Ia](t)})}[Ia](e){if(this.fd=e,this.#e)return this[Lt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Ys]()}[Ys](){let{fd:e,buf:t,offset:r,length:s,pos:n}=this;if(e===void 0||t===void 0)throw new Error("cannot read file without first opening");We.read(e,t,r,s,n,(o,a)=>{if(o)return this[Lt](()=>this.emit("error",o));this[Da](a)})}[Lt](e=()=>{}){this.fd!==void 0&&We.close(this.fd,e)}[Da](e){if(e<=0&&this.remain>0){let s=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Lt](()=>this.emit("error",s))}if(e>this.remain){let s=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Lt](()=>this.emit("error",s))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let s=e;s<this.length&&e<this.blockRemain;s++)this.buf[s+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[_a]():this[Ca](()=>this[_a]())}[Ca](e){this.once("drain",e)}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let s=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",s)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,r)}[_a](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Lt](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Ys]()}},Js=class extends Or{sync=!0;[Ta](){this[Gs](We.lstatSync(this.absolute))}[Ra](){this[ka](We.readlinkSync(this.absolute))}[Aa](){this[Ia](We.openSync(this.absolute,"r"))}[Ys](){let e=!0;try{let{fd:t,buf:r,offset:s,length:n,pos:o}=this;if(t===void 0||r===void 0)throw new Error("fd and buf must be set in READ method");let a=We.readSync(t,r,s,n,o);this[Da](a),e=!1}finally{if(e)try{this[Lt](()=>{})}catch{}}}[Ca](e){e()}[Lt](e=()=>{}){this.fd!==void 0&&We.closeSync(this.fd),e()}},Ks=class extends de{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,r={}){return Qt(this,e,t,r)}constructor(e,t={}){let r=wr(t);super(),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.onWriteEntry=r.onWriteEntry,this.readEntry=e;let{type:s}=e;if(s==="Unsupported")throw new Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix,this.path=S(e.path),this.mode=e.mode!==void 0?this[Vs](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:r.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?S(e.linkpath):void 0,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let n=!1;if(!this.preservePaths){let[a,h]=Er(this.path);a&&typeof h=="string"&&(this.path=h,n=a)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new ye({path:this[Ye](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ye](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new Ct({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Ye](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ye](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw new Error("failed to encode header");super.write(o),e.pipe(this)}[Ye](e){return Gm(e,this.prefix)}[Vs](e){return Ea(e,this.type==="Directory",this.portable)}write(e,t,r){typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let s=e.length;if(s>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(e,r)}end(e,t,r){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),r&&this.once("finish",r),e?super.end(e,r):super.end(r),this}},OE=i=>i.isFile()?"File":i.isDirectory()?"Directory":i.isSymbolicLink()?"SymbolicLink":"Unsupported";import Xm from"path";var sn=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},Vm=Buffer.alloc(1024),Zs=Symbol("onStat"),_r=Symbol("ended"),Ae=Symbol("queue"),Mi=Symbol("current"),si=Symbol("process"),Rr=Symbol("processing"),Jm=Symbol("processJob"),Ie=Symbol("jobs"),Pa=Symbol("jobDone"),Xs=Symbol("addFSEntry"),Km=Symbol("addTarEntry"),La=Symbol("stat"),Ma=Symbol("readdir"),Qs=Symbol("onreaddir"),en=Symbol("pipe"),Zm=Symbol("entry"),Na=Symbol("entryOpt"),tn=Symbol("writeEntryClass"),Qm=Symbol("write"),Fa=Symbol("ondrain"),Mt=class extends de{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[tn];onWriteEntry;[Ae];[Ie]=0;[Rr]=!1;[_r]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=S(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[tn]=Or,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli){if(e.gzip&&e.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Cs(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Fs(e.brotli)),!this.zip)throw new Error("impossible");let t=this.zip;t.on("data",r=>super.write(r)),t.on("end",()=>super.end()),t.on("drain",()=>this[Fa]()),this.on("resume",()=>t.resume())}else this.on("drain",this[Fa]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[Ae]=new Ci,this[Ie]=0,this.jobs=Number(e.jobs)||4,this[Rr]=!1,this[_r]=!1}[Qm](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&this.add(e),this[_r]=!0,this[si](),r&&r(),this}write(e){if(this[_r])throw new Error("write after end");return e instanceof Ni?this[Km](e):this[Xs](e),this.flowing}[Km](e){let t=S(Xm.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let r=new sn(e.path,t);r.entry=new Ks(e,this[Na](r)),r.entry.on("end",()=>this[Pa](r)),this[Ie]+=1,this[Ae].push(r)}this[si]()}[Xs](e){let t=S(Xm.resolve(this.cwd,e));this[Ae].push(new sn(e,t)),this[si]()}[La](e){e.pending=!0,this[Ie]+=1;let t=this.follow?"stat":"lstat";rn[t](e.absolute,(r,s)=>{e.pending=!1,this[Ie]-=1,r?this.emit("error",r):this[Zs](e,s)})}[Zs](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)||(e.ignore=!0),this[si]()}[Ma](e){e.pending=!0,this[Ie]+=1,rn.readdir(e.absolute,(t,r)=>{if(e.pending=!1,this[Ie]-=1,t)return this.emit("error",t);this[Qs](e,r)})}[Qs](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[si]()}[si](){if(!this[Rr]){this[Rr]=!0;for(let e=this[Ae].head;e&&this[Ie]<this.jobs;e=e.next)if(this[Jm](e.value),e.value.ignore){let t=e.next;this[Ae].removeNode(e),e.next=t}this[Rr]=!1,this[_r]&&!this[Ae].length&&this[Ie]===0&&(this.zip?this.zip.end(Vm):(super.write(Vm),super.end()))}}get[Mi](){return this[Ae]&&this[Ae].head&&this[Ae].head.value}[Pa](e){this[Ae].shift(),this[Ie]-=1,this[si]()}[Jm](e){if(!e.pending){if(e.entry){e===this[Mi]&&!e.piped&&this[en](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[Zs](e,t):this[La](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[Qs](e,t):this[Ma](e),!e.readdir)return}if(e.entry=this[Zm](e),!e.entry){e.ignore=!0;return}e===this[Mi]&&!e.piped&&this[en](e)}}}[Na](e){return{onwarn:(t,r,s)=>this.warn(t,r,s),noPax:this.noPax,cwd:this.cwd,absolute:e.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,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Zm](e){this[Ie]+=1;try{return new this[tn](e.path,this[Na](e)).on("end",()=>this[Pa](e)).on("error",r=>this.emit("error",r))}catch(t){this.emit("error",t)}}[Fa](){this[Mi]&&this[Mi].entry&&this[Mi].entry.resume()}[en](e){e.piped=!0,e.readdir&&e.readdir.forEach(s=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[Xs](o+s)});let t=e.entry,r=this.zip;if(!t)throw new Error("cannot pipe without source");r?t.on("data",s=>{r.write(s)||t.pause()}):t.on("data",s=>{super.write(s)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,r={}){Qt(this,e,t,r)}},ni=class extends Mt{sync=!0;constructor(e){super(e),this[tn]=Js}pause(){}resume(){}[La](e){let t=this.follow?"statSync":"lstatSync";this[Zs](e,rn[t](e.absolute))}[Ma](e){this[Qs](e,rn.readdirSync(e.absolute))}[en](e){let t=e.entry,r=this.zip;if(e.readdir&&e.readdir.forEach(s=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[Xs](o+s)}),!t)throw new Error("Cannot pipe without source");r?t.on("data",s=>{r.write(s)}):t.on("data",s=>{super[Qm](s)})}};var _E=(i,e)=>{let t=new ni(i),r=new Ai(i.file,{mode:i.mode||438});t.pipe(r),tp(t,e)},RE=(i,e)=>{let t=new Mt(i),r=new ht(i.file,{mode:i.mode||438});t.pipe(r);let s=new Promise((n,o)=>{r.on("error",o),r.on("close",n),t.on("error",o)});return ip(t,e),s},tp=(i,e)=>{e.forEach(t=>{t.charAt(0)==="@"?ri({file:ep.resolve(i.cwd,t.slice(1)),sync:!0,noResume:!0,onReadEntry:r=>i.add(r)}):i.add(t)}),i.end()},ip=async(i,e)=>{for(let t=0;t<e.length;t++){let r=String(e[t]);r.charAt(0)==="@"?await ri({file:ep.resolve(String(i.cwd),r.slice(1)),noResume:!0,onReadEntry:s=>{i.add(s)}}):i.add(r)}i.end()},TE=(i,e)=>{let t=new ni(i);return tp(t,e),t},DE=(i,e)=>{let t=new Mt(i);return ip(t,e),t},kE=je(_E,RE,TE,DE,(i,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});import Op from"node:fs";import ix from"node:assert";import{randomBytes as xp}from"node:crypto";import R from"node:fs";import mt from"node:path";import rp from"fs";var AE=process.env.__FAKE_PLATFORM__||process.platform,IE=AE==="win32",{O_CREAT:CE,O_TRUNC:PE,O_WRONLY:NE}=rp.constants,sp=Number(process.env.__FAKE_FS_O_FILENAME__)||rp.constants.UV_FS_O_FILEMAP||0,FE=IE&&!!sp,LE=512*1024,ME=sp|PE|CE|NE,qa=FE?i=>i<LE?ME:"w":()=>"w";import on from"node:fs";import Tr from"node:path";var Ba=(i,e,t)=>{try{return on.lchownSync(i,e,t)}catch(r){if(r?.code!=="ENOENT")throw r}},nn=(i,e,t,r)=>{on.lchown(i,e,t,s=>{r(s&&s?.code!=="ENOENT"?s:null)})},qE=(i,e,t,r,s)=>{if(e.isDirectory())$a(Tr.resolve(i,e.name),t,r,n=>{if(n)return s(n);let o=Tr.resolve(i,e.name);nn(o,t,r,s)});else{let n=Tr.resolve(i,e.name);nn(n,t,r,s)}},$a=(i,e,t,r)=>{on.readdir(i,{withFileTypes:!0},(s,n)=>{if(s){if(s.code==="ENOENT")return r();if(s.code!=="ENOTDIR"&&s.code!=="ENOTSUP")return r(s)}if(s||!n.length)return nn(i,e,t,r);let o=n.length,a=null,h=l=>{if(!a){if(l)return r(a=l);if(--o===0)return nn(i,e,t,r)}};for(let l of n)qE(i,l,e,t,h)})},BE=(i,e,t,r)=>{e.isDirectory()&&Ua(Tr.resolve(i,e.name),t,r),Ba(Tr.resolve(i,e.name),t,r)},Ua=(i,e,t)=>{let r;try{r=on.readdirSync(i,{withFileTypes:!0})}catch(s){let n=s;if(n?.code==="ENOENT")return;if(n?.code==="ENOTDIR"||n?.code==="ENOTSUP")return Ba(i,e,t);throw n}for(let s of r)BE(i,s,e,t);return Ba(i,e,t)};import ve from"fs";import{dirname as np}from"path";import{mkdir as $E,mkdirSync as UE,stat as jE,statSync as zE}from"fs";var Se=i=>{if(!i)i={mode:511};else if(typeof i=="object")i={mode:511,...i};else if(typeof i=="number")i={mode:i};else if(typeof i=="string")i={mode:parseInt(i,8)};else throw new TypeError("invalid options argument");let e=i,t=i.fs||{};return i.mkdir=i.mkdir||t.mkdir||$E,i.mkdirAsync=i.mkdirAsync?i.mkdirAsync:async(r,s)=>new Promise((n,o)=>e.mkdir(r,s,(a,h)=>a?o(a):n(h))),i.stat=i.stat||t.stat||jE,i.statAsync=i.statAsync?i.statAsync:async r=>new Promise((s,n)=>e.stat(r,(o,a)=>o?n(o):s(a))),i.statSync=i.statSync||t.statSync||zE,i.mkdirSync=i.mkdirSync||t.mkdirSync||UE,e};var Ge=(i,e,t)=>{let r=np(i),s={...Se(e),recursive:!1};if(r===i)try{return s.mkdirSync(i,s)}catch(n){let o=n;if(o&&o.code!=="EISDIR")throw n;return}try{return s.mkdirSync(i,s),t||i}catch(n){let o=n;if(o&&o.code==="ENOENT")return Ge(i,s,Ge(r,s,t));if(o&&o.code!=="EEXIST"&&o&&o.code!=="EROFS")throw n;try{if(!s.statSync(i).isDirectory())throw n}catch{throw n}}},dt=Object.assign(async(i,e,t)=>{let r=Se(e);r.recursive=!1;let s=np(i);return s===i?r.mkdirAsync(i,r).catch(n=>{let o=n;if(o&&o.code!=="EISDIR")throw n}):r.mkdirAsync(i,r).then(()=>t||i,async n=>{let o=n;if(o&&o.code==="ENOENT")return dt(s,r).then(a=>dt(i,r,a));if(o&&o.code!=="EEXIST"&&o.code!=="EROFS")throw n;return r.statAsync(i).then(a=>{if(a.isDirectory())return t;throw n},()=>{throw n})})},{sync:Ge});import{dirname as ap}from"path";import{dirname as op}from"path";var ja=async(i,e,t)=>{if(t!==e)return i.statAsync(e).then(r=>r.isDirectory()?t:void 0,r=>{let s=r;return s&&s.code==="ENOENT"?ja(i,op(e),e):void 0})},za=(i,e,t)=>{if(t!==e)try{return i.statSync(e).isDirectory()?t:void 0}catch(r){let s=r;return s&&s.code==="ENOENT"?za(i,op(e),e):void 0}};var qi=(i,e)=>{let t=Se(e);if(t.recursive=!0,ap(i)===i)return t.mkdirSync(i,t);let s=za(t,i);try{return t.mkdirSync(i,t),s}catch(n){let o=n;if(o&&o.code==="ENOENT")return Ge(i,t);throw n}},Dr=Object.assign(async(i,e)=>{let t={...Se(e),recursive:!0};return ap(i)===i?await t.mkdirAsync(i,t):ja(t,i).then(s=>t.mkdirAsync(i,t).then(n=>s||n).catch(n=>{let o=n;if(o&&o.code==="ENOENT")return dt(i,t);throw n}))},{sync:qi});import{parse as WE,resolve as YE}from"path";var HE=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,Ha=i=>{if(/\0/.test(i))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:i,code:"ERR_INVALID_ARG_VALUE"});if(i=YE(i),HE==="win32"){let e=/[*|"<>?:]/,{root:t}=WE(i);if(e.test(i.substring(t.length)))throw Object.assign(new Error("Illegal characters in path."),{path:i,code:"EINVAL"})}return i};import{mkdir as GE,mkdirSync as VE}from"fs";var JE=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,Wa=JE.replace(/^v/,"").split("."),hp=+Wa[0]>10||+Wa[0]==10&&+Wa[1]>=12,kr=hp?i=>Se(i).mkdirSync===VE:()=>!1,an=Object.assign(hp?i=>Se(i).mkdir===GE:()=>!1,{sync:kr});var hn=(i,e)=>{i=Ha(i);let t=Se(e);return kr(t)?qi(i,t):Ge(i,t)};var lp=Object.assign(async(i,e)=>{i=Ha(i);let t=Se(e);return an(t)?Dr(i,t):dt(i,t)},{mkdirpSync:hn,mkdirpNative:Dr,mkdirpNativeSync:qi,mkdirpManual:dt,mkdirpManualSync:Ge,sync:hn,native:Dr,nativeSync:qi,manual:dt,manualSync:Ge,useNative:an,useNativeSync:kr});import ln from"node:path";var Ar=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}};var Ir=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}};var cn=(i,e)=>i.get(S(e)),Cr=(i,e,t)=>i.set(S(e),t),KE=(i,e)=>{ve.stat(i,(t,r)=>{(t||!r.isDirectory())&&(t=new Ar(i,t?.code||"ENOTDIR")),e(t)})},cp=(i,e,t)=>{i=S(i);let r=e.umask??18,s=e.mode|448,n=(s&r)!==0,o=e.uid,a=e.gid,h=typeof o=="number"&&typeof a=="number"&&(o!==e.processUid||a!==e.processGid),l=e.preserve,c=e.unlink,u=e.cache,f=S(e.cwd),d=(g,y)=>{g?t(g):(Cr(u,i,!0),y&&h?$a(y,o,a,I=>d(I)):n?ve.chmod(i,s,t):t())};if(u&&cn(u,i)===!0)return d();if(i===f)return KE(i,d);if(l)return lp(i,{mode:s}).then(g=>d(null,g??void 0),d);let b=S(ln.relative(f,i)).split("/");un(f,b,s,u,c,f,void 0,d)},un=(i,e,t,r,s,n,o,a)=>{if(!e.length)return a(null,o);let h=e.shift(),l=S(ln.resolve(i+"/"+h));if(cn(r,l))return un(l,e,t,r,s,n,o,a);ve.mkdir(l,t,up(l,e,t,r,s,n,o,a))},up=(i,e,t,r,s,n,o,a)=>h=>{h?ve.lstat(i,(l,c)=>{if(l)l.path=l.path&&S(l.path),a(l);else if(c.isDirectory())un(i,e,t,r,s,n,o,a);else if(s)ve.unlink(i,u=>{if(u)return a(u);ve.mkdir(i,t,up(i,e,t,r,s,n,o,a))});else{if(c.isSymbolicLink())return a(new Ir(i,i+"/"+e.join("/")));a(h)}}):(o=o||i,un(i,e,t,r,s,n,o,a))},ZE=i=>{let e=!1,t;try{e=ve.statSync(i).isDirectory()}catch(r){t=r?.code}finally{if(!e)throw new Ar(i,t??"ENOTDIR")}},fp=(i,e)=>{i=S(i);let t=e.umask??18,r=e.mode|448,s=(r&t)!==0,n=e.uid,o=e.gid,a=typeof n=="number"&&typeof o=="number"&&(n!==e.processUid||o!==e.processGid),h=e.preserve,l=e.unlink,c=e.cache,u=S(e.cwd),f=g=>{Cr(c,i,!0),g&&a&&Ua(g,n,o),s&&ve.chmodSync(i,r)};if(c&&cn(c,i)===!0)return f();if(i===u)return ZE(u),f();if(h)return f(hn(i,r)??void 0);let p=S(ln.relative(u,i)).split("/"),b;for(let g=p.shift(),y=u;g&&(y+="/"+g);g=p.shift())if(y=S(ln.resolve(y)),!cn(c,y))try{ve.mkdirSync(y,r),b=b||y,Cr(c,y,!0)}catch{let O=ve.lstatSync(y);if(O.isDirectory()){Cr(c,y,!0);continue}else if(l){ve.unlinkSync(y),ve.mkdirSync(y,r),b=b||y,Cr(c,y,!0);continue}else if(O.isSymbolicLink())return new Ir(y,y+"/"+p.join("/"))}return f(b)};var Ya=Object.create(null),{hasOwnProperty:XE}=Object.prototype,fn=i=>(XE.call(Ya,i)||(Ya[i]=i.normalize("NFD")),Ya[i]);import{join as dp}from"node:path";var QE=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,ex=QE==="win32",tx=i=>i.split("/").slice(0,-1).reduce((t,r)=>{let s=t[t.length-1];return s!==void 0&&(r=dp(s,r)),t.push(r||"/"),t},[]),dn=class{#e=new Map;#i=new Map;#r=new Set;reserve(e,t){e=ex?["win32 parallelization disabled"]:e.map(s=>He(dp(fn(s))).toLowerCase());let r=new Set(e.map(s=>tx(s)).reduce((s,n)=>s.concat(n)));this.#i.set(t,{dirs:r,paths:e});for(let s of e){let n=this.#e.get(s);n?n.push(t):this.#e.set(s,[t])}for(let s of r){let n=this.#e.get(s);if(!n)this.#e.set(s,[new Set([t])]);else{let o=n[n.length-1];o instanceof Set?o.add(t):n.push(new Set([t]))}}return this.#s(t)}#n(e){let t=this.#i.get(e);if(!t)throw new Error("function does not have any path reservations");return{paths:t.paths.map(r=>this.#e.get(r)),dirs:[...t.dirs].map(r=>this.#e.get(r))}}check(e){let{paths:t,dirs:r}=this.#n(e);return t.every(s=>s&&s[0]===e)&&r.every(s=>s&&s[0]instanceof Set&&s[0].has(e))}#s(e){return this.#r.has(e)||!this.check(e)?!1:(this.#r.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#r.has(e))return!1;let t=this.#i.get(e);if(!t)throw new Error("invalid reservation");let{paths:r,dirs:s}=t,n=new Set;for(let o of r){let a=this.#e.get(o);if(!a||a?.[0]!==e)continue;let h=a[1];if(!h){this.#e.delete(o);continue}if(a.shift(),typeof h=="function")n.add(h);else for(let l of h)n.add(l)}for(let o of s){let a=this.#e.get(o),h=a?.[0];if(!(!a||!(h instanceof Set)))if(h.size===1&&a.length===1){this.#e.delete(o);continue}else if(h.size===1){a.shift();let l=a[0];typeof l=="function"&&n.add(l)}else h.delete(e)}return this.#r.delete(e),n.forEach(o=>this.#s(o)),!0}};var mp=Symbol("onEntry"),Ja=Symbol("checkFs"),pp=Symbol("checkFs2"),yn=Symbol("pruneCache"),Ka=Symbol("isReusable"),Ee=Symbol("makeFs"),Za=Symbol("file"),Xa=Symbol("directory"),gn=Symbol("link"),yp=Symbol("symlink"),gp=Symbol("hardlink"),wp=Symbol("unsupported"),bp=Symbol("checkPath"),qt=Symbol("mkdir"),re=Symbol("onError"),mn=Symbol("pending"),Sp=Symbol("pend"),Bi=Symbol("unpend"),Ga=Symbol("ended"),Va=Symbol("maybeClose"),Qa=Symbol("skip"),Pr=Symbol("doChown"),Nr=Symbol("uid"),Fr=Symbol("gid"),Lr=Symbol("checkedCwd"),rx=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Mr=rx==="win32",sx=1024,nx=(i,e)=>{if(!Mr)return R.unlink(i,e);let t=i+".DELETE."+xp(16).toString("hex");R.rename(i,t,r=>{if(r)return e(r);R.unlink(t,e)})},ox=i=>{if(!Mr)return R.unlinkSync(i);let e=i+".DELETE."+xp(16).toString("hex");R.renameSync(i,e),R.unlinkSync(e)},vp=(i,e,t)=>i!==void 0&&i===i>>>0?i:e!==void 0&&e===e>>>0?e:t,Ep=i=>He(S(fn(i))).toLowerCase(),ax=(i,e)=>{e=Ep(e);for(let t of i.keys()){let r=Ep(t);(r===e||r.indexOf(e+"/")===0)&&i.delete(t)}},hx=i=>{for(let e of i.keys())i.delete(e)},$i=class extends ft{[Ga]=!1;[Lr]=!1;[mn]=0;reservations=new dn;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Ga]=!0,this[Va]()},super(e),this.transform=e.transform,this.dirCache=e.dirCache||new Map,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:sx,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Mr,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=S(mt.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[mp](t))}warn(e,t,r={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(r.recoverable=!1),super.warn(e,t,r)}[Va](){this[Ga]&&this[mn]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[bp](e){let t=S(e.path),r=t.split("/");if(this.strip){if(r.length<this.strip)return!1;if(e.type==="Link"){let s=S(String(e.linkpath)).split("/");if(s.length>=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}r.splice(0,this.strip),e.path=r.join("/")}if(isFinite(this.maxDepth)&&r.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:r.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(r.includes("..")||Mr&&/^[a-z]:\.\.$/i.test(r[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:t}),!1;let[s,n]=Er(t);s&&(e.path=String(n),this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:e,path:t}))}if(mt.isAbsolute(e.path)?e.absolute=S(mt.resolve(e.path)):e.absolute=S(mt.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:S(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=mt.win32.parse(String(e.absolute));e.absolute=s+Oa(String(e.absolute).slice(s.length));let{root:n}=mt.win32.parse(e.path);e.path=n+Oa(e.path.slice(n.length))}return!0}[mp](e){if(!this[bp](e))return e.resume();switch(ix.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ja](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[wp](e)}}[re](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Bi](),t.resume())}[qt](e,t,r){cp(S(e),{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:t},r)}[Pr](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[Nr](e){return vp(this.uid,e.uid,this.processUid)}[Fr](e){return vp(this.gid,e.gid,this.processGid)}[Za](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,s=new ht(String(e.absolute),{flags:qa(e.size),mode:r,autoClose:!1});s.on("error",h=>{s.fd&&R.close(s.fd,()=>{}),s.write=()=>!0,this[re](h,e),t()});let n=1,o=h=>{if(h){s.fd&&R.close(s.fd,()=>{}),this[re](h,e),t();return}--n===0&&s.fd!==void 0&&R.close(s.fd,l=>{l?this[re](l,e):this[Bi](),t()})};s.on("finish",()=>{let h=String(e.absolute),l=s.fd;if(typeof l=="number"&&e.mtime&&!this.noMtime){n++;let c=e.atime||new Date,u=e.mtime;R.futimes(l,c,u,f=>f?R.utimes(h,c,u,d=>o(d&&f)):o())}if(typeof l=="number"&&this[Pr](e)){n++;let c=this[Nr](e),u=this[Fr](e);typeof c=="number"&&typeof u=="number"&&R.fchown(l,c,u,f=>f?R.chown(h,c,u,d=>o(d&&f)):o())}o()});let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",h=>{this[re](h,e),t()}),e.pipe(a)),a.pipe(s)}[Xa](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode;this[qt](String(e.absolute),r,s=>{if(s){this[re](s,e),t();return}let n=1,o=()=>{--n===0&&(t(),this[Bi](),e.resume())};e.mtime&&!this.noMtime&&(n++,R.utimes(String(e.absolute),e.atime||new Date,e.mtime,o)),this[Pr](e)&&(n++,R.chown(String(e.absolute),Number(this[Nr](e)),Number(this[Fr](e)),o)),o()})}[wp](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[yp](e,t){this[gn](e,String(e.linkpath),"symlink",t)}[gp](e,t){let r=S(mt.resolve(this.cwd,String(e.linkpath)));this[gn](e,r,"link",t)}[Sp](){this[mn]++}[Bi](){this[mn]--,this[Va]()}[Qa](e){this[Bi](),e.resume()}[Ka](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!Mr}[Ja](e){this[Sp]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,r=>this[pp](e,r))}[yn](e){e.type==="SymbolicLink"?hx(this.dirCache):e.type!=="Directory"&&ax(this.dirCache,String(e.absolute))}[pp](e,t){this[yn](e);let r=a=>{this[yn](e),t(a)},s=()=>{this[qt](this.cwd,this.dmode,a=>{if(a){this[re](a,e),r();return}this[Lr]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let a=S(mt.dirname(String(e.absolute)));if(a!==this.cwd)return this[qt](a,this.dmode,h=>{if(h){this[re](h,e),r();return}o()})}o()},o=()=>{R.lstat(String(e.absolute),(a,h)=>{if(h&&(this.keep||this.newer&&h.mtime>(e.mtime??h.mtime))){this[Qa](e),r();return}if(a||this[Ka](e,h))return this[Ee](null,e,r);if(h.isDirectory()){if(e.type==="Directory"){let l=this.chmod&&e.mode&&(h.mode&4095)!==e.mode,c=u=>this[Ee](u??null,e,r);return l?R.chmod(String(e.absolute),Number(e.mode),c):c()}if(e.absolute!==this.cwd)return R.rmdir(String(e.absolute),l=>this[Ee](l??null,e,r))}if(e.absolute===this.cwd)return this[Ee](null,e,r);nx(String(e.absolute),l=>this[Ee](l??null,e,r))})};this[Lr]?n():s()}[Ee](e,t,r){if(e){this[re](e,t),r();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Za](t,r);case"Link":return this[gp](t,r);case"SymbolicLink":return this[yp](t,r);case"Directory":case"GNUDumpDir":return this[Xa](t,r)}}[gn](e,t,r,s){R[r](t,String(e.absolute),n=>{n?this[re](n,e):(this[Bi](),e.resume()),s()})}},pn=i=>{try{return[null,i()]}catch(e){return[e,null]}},qr=class extends $i{sync=!0;[Ee](e,t){return super[Ee](e,t,()=>{})}[Ja](e){if(this[yn](e),!this[Lr]){let n=this[qt](this.cwd,this.dmode);if(n)return this[re](n,e);this[Lr]=!0}if(e.absolute!==this.cwd){let n=S(mt.dirname(String(e.absolute)));if(n!==this.cwd){let o=this[qt](n,this.dmode);if(o)return this[re](o,e)}}let[t,r]=pn(()=>R.lstatSync(String(e.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(e.mtime??r.mtime)))return this[Qa](e);if(t||this[Ka](e,r))return this[Ee](null,e);if(r.isDirectory()){if(e.type==="Directory"){let o=this.chmod&&e.mode&&(r.mode&4095)!==e.mode,[a]=o?pn(()=>{R.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[Ee](a,e)}let[n]=pn(()=>R.rmdirSync(String(e.absolute)));this[Ee](n,e)}let[s]=e.absolute===this.cwd?[]:pn(()=>ox(String(e.absolute)));this[Ee](s,e)}[Za](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,s=a=>{let h;try{R.closeSync(n)}catch(l){h=l}(a||h)&&this[re](a||h,e),t()},n;try{n=R.openSync(String(e.absolute),qa(e.size),r)}catch(a){return s(a)}let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",a=>this[re](a,e)),e.pipe(o)),o.on("data",a=>{try{R.writeSync(n,a,0,a.length)}catch(h){s(h)}}),o.on("end",()=>{let a=null;if(e.mtime&&!this.noMtime){let h=e.atime||new Date,l=e.mtime;try{R.futimesSync(n,h,l)}catch(c){try{R.utimesSync(String(e.absolute),h,l)}catch{a=c}}}if(this[Pr](e)){let h=this[Nr](e),l=this[Fr](e);try{R.fchownSync(n,Number(h),Number(l))}catch(c){try{R.chownSync(String(e.absolute),Number(h),Number(l))}catch{a=a||c}}}s(a)})}[Xa](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode,s=this[qt](String(e.absolute),r);if(s){this[re](s,e),t();return}if(e.mtime&&!this.noMtime)try{R.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Pr](e))try{R.chownSync(String(e.absolute),Number(this[Nr](e)),Number(this[Fr](e)))}catch{}t(),e.resume()}[qt](e,t){try{return fp(S(e),{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:t})}catch(r){return r}}[gn](e,t,r,s){let n=`${r}Sync`;try{R[n](t,String(e.absolute)),s(),e.resume()}catch(o){return this[re](o,e)}}};var lx=i=>{let e=new qr(i),t=i.file,r=Op.statSync(t),s=i.maxReadSize||16*1024*1024;new ks(t,{readSize:s,size:r.size}).pipe(e)},cx=(i,e)=>{let t=new $i(i),r=i.maxReadSize||16*1024*1024,s=i.file;return new Promise((o,a)=>{t.on("error",a),t.on("close",o),Op.stat(s,(h,l)=>{if(h)a(h);else{let c=new Jt(s,{readSize:r,size:l.size});c.on("error",a),c.pipe(t)}})})},eh=je(lx,cx,i=>new qr(i),i=>new $i(i),(i,e)=>{e?.length&&va(i,e)});import ge from"node:fs";import _p from"node:path";var ux=(i,e)=>{let t=new ni(i),r=!0,s,n;try{try{s=ge.openSync(i.file,"r+")}catch(h){if(h?.code==="ENOENT")s=ge.openSync(i.file,"w+");else throw h}let o=ge.fstatSync(s),a=Buffer.alloc(512);e:for(n=0;n<o.size;n+=512){for(let c=0,u=0;c<512;c+=u){if(u=ge.readSync(s,a,c,a.length-c,n+c),n===0&&a[0]===31&&a[1]===139)throw new Error("cannot append to compressed archives");if(!u)break e}let h=new ye(a);if(!h.cksumValid)break;let l=512*Math.ceil((h.size||0)/512);if(n+l+512>o.size)break;n+=l,i.mtimeCache&&h.mtime&&i.mtimeCache.set(String(h.path),h.mtime)}r=!1,fx(i,t,n,s,e)}finally{if(r)try{ge.closeSync(s)}catch{}}},fx=(i,e,t,r,s)=>{let n=new Ai(i.file,{fd:r,start:t});e.pipe(n),mx(e,s)},dx=(i,e)=>{e=Array.from(e);let t=new Mt(i),r=(n,o,a)=>{let h=(d,p)=>{d?ge.close(n,b=>a(d)):a(null,p)},l=0;if(o===0)return h(null,0);let c=0,u=Buffer.alloc(512),f=(d,p)=>{if(d||typeof p>"u")return h(d);if(c+=p,c<512&&p)return ge.read(n,u,c,u.length-c,l+c,f);if(l===0&&u[0]===31&&u[1]===139)return h(new Error("cannot append to compressed archives"));if(c<512)return h(null,l);let b=new ye(u);if(!b.cksumValid)return h(null,l);let g=512*Math.ceil((b.size??0)/512);if(l+g+512>o||(l+=g+512,l>=o))return h(null,l);i.mtimeCache&&b.mtime&&i.mtimeCache.set(String(b.path),b.mtime),c=0,ge.read(n,u,0,512,l,f)};ge.read(n,u,0,512,l,f)};return new Promise((n,o)=>{t.on("error",o);let a="r+",h=(l,c)=>{if(l&&l.code==="ENOENT"&&a==="r+")return a="w+",ge.open(i.file,a,h);if(l||!c)return o(l);ge.fstat(c,(u,f)=>{if(u)return ge.close(c,()=>o(u));r(c,f.size,(d,p)=>{if(d)return o(d);let b=new ht(i.file,{fd:c,start:p});t.pipe(b),b.on("error",o),b.on("close",n),px(t,e)})})};ge.open(i.file,a,h)})},mx=(i,e)=>{e.forEach(t=>{t.charAt(0)==="@"?ri({file:_p.resolve(i.cwd,t.slice(1)),sync:!0,noResume:!0,onReadEntry:r=>i.add(r)}):i.add(t)}),i.end()},px=async(i,e)=>{for(let t=0;t<e.length;t++){let r=String(e[t]);r.charAt(0)==="@"?await ri({file:_p.resolve(String(i.cwd),r.slice(1)),noResume:!0,onReadEntry:s=>i.add(s)}):i.add(r)}i.end()},oi=je(ux,dx,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(i,e)=>{if(!Rm(i))throw new TypeError("file is required");if(i.gzip||i.brotli||i.file.endsWith(".br")||i.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")});var yx=je(oi.syncFile,oi.asyncFile,oi.syncNoFile,oi.asyncNoFile,(i,e=[])=>{oi.validate?.(i,e),gx(i)}),gx=i=>{let e=i.filter;i.mtimeCache||(i.mtimeCache=new Map),i.filter=e?(t,r)=>e(t,r)&&!((i.mtimeCache?.get(t)??r.mtime??0)>(r.mtime??0)):(t,r)=>!((i.mtimeCache?.get(t)??r.mtime??0)>(r.mtime??0))};async function vx(i){try{return(await fetch(i,{method:"HEAD"})).status===200}catch{return!1}}async function Ex(i){let[,e,t,r,s,...n]=i.pathname.split("/"),o=n.join("/");if(r===void 0||r===""&&s===void 0)try{let a=await fetch(`https://api.github.com/repos/${e}/${t}`);if(a.status!==200)return;let h=await a.json();return{username:e,name:t,branch:h.default_branch,filePath:o}}catch{return}if(e&&t&&s&&r==="tree")return{username:e,name:t,branch:s,filePath:o}}function xx({username:i,name:e,branch:t,filePath:r}){let s=`https://api.github.com/repos/${i}/${e}/contents`,n=`${r?`/${r}`:""}/package.json`;return vx(s+n+`?ref=${t}`)}async function Ox(i){let e=await fetch(i);if(!e.body)throw new Error(`Failed to download: ${i}`);return bx.fromWeb(e.body)}async function _x(i,{username:e,name:t,branch:r,filePath:s}){await Sx(await Ox(`https://codeload.github.com/${e}/${t}/tar.gz/${r}`),eh({cwd:i,strip:s?s.split("/").length+1:1,filter:n=>n.startsWith(`${t}-${r?.replace(/\//g,"-")}${s?`/${s}/`:"/"}`)}))}function Rx(i){try{return new URL(i)}catch(e){e.code!=="ERR_INVALID_URL"&&(console.error(e),process.exit(1))}}async function Rp(i){if(!i)return null;let e=Rx(i);e||(console.error(`Not a valid URL ${bt(`"${i}"`)}. Please check the URL syntax and try again.`),process.exit(1)),e.origin!=="https://github.com"&&e.origin!=="https://www.github.com"&&(console.error(`Invalid URL: ${bt(`"${i}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`),process.exit(1));let t=await Ex(e);return t||(console.error(`Found invalid GitHub URL: ${bt(`"${i}"`)}. Please fix the URL and try again.`),process.exit(1)),await xx(t)||(console.error(`Could not locate the repository for ${bt(`"${i}"`)}. Please check that the repository exists and try again.`),process.exit(1)),{example:i,repoInfo:t}}async function Tp(i,{example:e,repoInfo:t}){console.log(`Downloading files from repo ${Nu(e)}. This might take a moment.
112
+ `),await _x(i,t)}import{spawn as Cx}from"node:child_process";var Dp=process.env.npm_config_user_agent||"",Pp=/pnpm/.test(Dp)?"pnpm":/yarn/.test(Dp)?"yarn":"npm",Ui={pnpm:{install:"pnpm install",dev:"pnpm dev",create:"pnpm create waku"},yarn:{install:"yarn",dev:"yarn dev",create:"yarn create waku"},npm:{install:"npm install",dev:"npm run dev",create:"npm create waku"}}[Pp],Np=Ap.join(Ax(import.meta.url),"../../template"),{values:th}=Ix({args:process.argv.slice(2),options:{choose:{type:"boolean"},example:{type:"string"},help:{type:"boolean",short:"h"}}});async function Px(){let i=o=>/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(o),e=o=>o.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z0-9-~]+/g,"-"),t=o=>!kp(o)||Tx(o).length===0,r=await pm(Np),s="waku-project",n="";try{let o=await(0,Ip.default)([{name:"projectName",type:"text",message:"Project Name",initial:s,onState:a=>n=String(a.value).trim()||s},{name:"shouldOverwrite",type:()=>t(n)?null:"confirm",message:`${n} is not empty. Remove existing files and continue?`},{name:"overwriteChecker",type:a=>{if(a===!1)throw new Error(bt("\u2716")+" Operation cancelled");return null}},{name:"packageName",type:()=>i(n)?null:"text",message:"Package name",initial:()=>e(n),validate:a=>i(a)||"Invalid package.json name"},{name:"templateName",type:th.choose?"select":null,message:"Choose a starter template",choices:r.map(a=>({title:a,value:a}))}],{onCancel:()=>{throw new Error(bt("\u2716")+" Operation cancelled")}});return{...o,packageName:o.packageName??e(n),templateName:o.templateName??r[0],targetDir:n}}catch(o){o instanceof Error&&console.log(o.message),process.exit(1)}}function Nx(){console.log(`
113
+ Usage: ${Ui.create} [options]
114
+
115
+ Options:
116
+ --choose Choose from the template list
117
+ --example Specify an example use as a template
118
+ -h, --help Display this help message
119
+ `)}async function Fx(){let i=JSON.parse(Dx("../package.json","utf8"));(await(0,Cp.default)(i).catch(()=>{}))?.latest&&(console.log("A new version of 'create-waku' is available!"),console.log("You can update by running: "),console.log(),console.log(" npm i -g create-waku"))}async function Lx(){if(th.help){Nx();return}let i=await Rp(th.example),{packageName:e,templateName:t,shouldOverwrite:r,targetDir:s}=await Px(),n=Ap.resolve(s);console.log("Setting up project..."),r?ys.emptyDirSync(n):kp(n)||await kx.mkdir(n,{recursive:!0}),i?await Tp(n,i):await ym(n,e,Np,t),console.log(),console.log(`Installing dependencies by running ${Ui.install}...`),Cx(Pp,["install"],{stdio:"inherit",shell:process.platform==="win32",cwd:s}).on("close",a=>{a!==0?(console.error(`Could not execute ${Ui.install}. Please run`),console.log(`${fi(di(`cd ${s}`))}`),console.log(`${fi(di(Ui.install))}`),console.log(`${fi(di(Ui.dev))}`),console.log()):(console.log(`
120
+ Done. Now run:
121
+ `),console.log(`${fi(di(`cd ${s}`))}`),console.log(`${fi(di(Ui.dev))}`),console.log())})}Lx().then(Fx).catch(i=>{console.error(i)});
122
+ /*! Bundled license information:
123
+
124
+ deep-extend/lib/deep-extend.js:
125
+ (*!
126
+ * @description Recursive object extending
127
+ * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
128
+ * @license MIT
129
+ *
130
+ * The MIT License (MIT)
131
+ *
132
+ * Copyright (c) 2013-2018 Viacheslav Lotsmanov
133
+ *
134
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
135
+ * this software and associated documentation files (the "Software"), to deal in
136
+ * the Software without restriction, including without limitation the rights to
137
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
138
+ * the Software, and to permit persons to whom the Software is furnished to do so,
139
+ * subject to the following conditions:
140
+ *
141
+ * The above copyright notice and this permission notice shall be included in all
142
+ * copies or substantial portions of the Software.
143
+ *
144
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
145
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
146
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
147
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
148
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
149
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
150
+ *)
151
+
152
+ safe-buffer/index.js:
153
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
154
+ */