chunk-L3YIWUQY.js 62 KB

1234567891011121314151617181920212223242526272829
  1. import { createRequire as topLevelCreateRequire } from 'module';
  2. const require = topLevelCreateRequire(import.meta.url);
  3. import{a as C,b as w,c as H,d as Fe,f as te,g as Ct}from"./chunk-XVZDMLED.js";var It=w((ei,$t)=>{$t.exports=Ot;Ot.sync=Mn;var Rt=C("fs");function Fn(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}function Pt(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Fn(t,r)}function Ot(e,t,r){Rt.stat(e,function(n,o){r(n,n?!1:Pt(o,e,t))})}function Mn(e,t){return Pt(Rt.statSync(e),e,t)}});var Bt=w((ti,Nt)=>{Nt.exports=kt;kt.sync=jn;var At=C("fs");function kt(e,t,r){At.stat(e,function(n,o){r(n,n?!1:Lt(o,t))})}function jn(e,t){return Lt(At.statSync(e),t)}function Lt(e,t){return e.isFile()&&Dn(e,t)}function Dn(e,t){var r=e.mode,n=e.uid,o=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,p=r&c||r&u&&o===i||r&a&&n===s||r&l&&s===0;return p}});var Gt=w((ni,Ut)=>{var ri=C("fs"),fe;process.platform==="win32"||global.TESTING_WINDOWS?fe=It():fe=Bt();Ut.exports=Me;Me.sync=_n;function Me(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){Me(e,t||{},function(s,i){s?o(s):n(i)})})}fe(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function _n(e,t){try{return fe.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var zt=w((oi,Ht)=>{var z=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Ft=C("path"),Hn=z?";":":",Mt=Gt(),jt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Dt=(e,t)=>{let r=t.colon||Hn,n=e.match(/\//)||z&&e.match(/\\/)?[""]:[...z?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=z?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=z?o.split(r):[""];return z&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:o}},_t=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:s}=Dt(e,t),i=[],a=c=>new Promise((l,p)=>{if(c===n.length)return t.all&&i.length?l(i):p(jt(e));let m=n[c],d=/^".*"$/.test(m)?m.slice(1,-1):m,f=Ft.join(d,e),h=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;l(u(h,c,0))}),u=(c,l,p)=>new Promise((m,d)=>{if(p===o.length)return m(a(l+1));let f=o[p];Mt(c+f,{pathExt:s},(h,b)=>{if(!h&&b)if(t.all)i.push(c+f);else return m(c+f);return m(u(c,l,p+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},zn=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Dt(e,t),s=[];for(let i=0;i<r.length;i++){let a=r[i],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=Ft.join(u,e),l=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let p=0;p<n.length;p++){let m=l+n[p];try{if(Mt.sync(m,{pathExt:o}))if(t.all)s.push(m);else return m}catch(d){}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw jt(e)};Ht.exports=_t;_t.sync=zn});var qt=w((si,je)=>{"use strict";var Wt=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};je.exports=Wt;je.exports.default=Wt});var Yt=w((ii,Xt)=>{"use strict";var Vt=C("path"),Wn=zt(),qn=qt();function Kt(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,s=o&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch(a){}let i;try{i=Wn.sync(e.command,{path:r[qn({env:r})],pathExt:t?Vt.delimiter:void 0})}catch(a){}finally{s&&process.chdir(n)}return i&&(i=Vt.resolve(o?e.options.cwd:"",i)),i}function Vn(e){return Kt(e)||Kt(e,!0)}Xt.exports=Vn});var Jt=w((ai,_e)=>{"use strict";var De=/([()\][%!^"`<>&|;, *?])/g;function Kn(e){return e=e.replace(De,"^$1"),e}function Xn(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(De,"^$1"),t&&(e=e.replace(De,"^$1")),e}_e.exports.command=Kn;_e.exports.argument=Xn});var Qt=w((ci,Zt)=>{"use strict";Zt.exports=/^#!(.*)/});var tr=w((ui,er)=>{"use strict";var Yn=Qt();er.exports=(e="")=>{let t=e.match(Yn);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var nr=w((li,rr)=>{"use strict";var He=C("fs"),Jn=tr();function Zn(e){let r=Buffer.alloc(150),n;try{n=He.openSync(e,"r"),He.readSync(n,r,0,150,0),He.closeSync(n)}catch(o){}return Jn(r.toString())}rr.exports=Zn});var ar=w((fi,ir)=>{"use strict";var Qn=C("path"),or=Yt(),sr=Jt(),eo=nr(),to=process.platform==="win32",ro=/\.(?:com|exe)$/i,no=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function oo(e){e.file=or(e);let t=e.file&&eo(e.file);return t?(e.args.unshift(e.file),e.command=t,or(e)):e.file}function so(e){if(!to)return e;let t=oo(e),r=!ro.test(t);if(e.options.forceShell||r){let n=no.test(t);e.command=Qn.normalize(e.command),e.command=sr.command(e.command),e.args=e.args.map(s=>sr.argument(s,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function io(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:so(n)}ir.exports=io});var lr=w((mi,ur)=>{"use strict";var ze=process.platform==="win32";function We(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ao(e,t){if(!ze)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let s=cr(o,t,"spawn");if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function cr(e,t){return ze&&e===1&&!t.file?We(t.original,"spawn"):null}function co(e,t){return ze&&e===1&&!t.file?We(t.original,"spawnSync"):null}ur.exports={hookChildProcess:ao,verifyENOENT:cr,verifyENOENTSync:co,notFoundError:We}});var dr=w((di,W)=>{"use strict";var fr=C("child_process"),qe=ar(),Ve=lr();function mr(e,t,r){let n=qe(e,t,r),o=fr.spawn(n.command,n.args,n.options);return Ve.hookChildProcess(o,n),o}function uo(e,t,r){let n=qe(e,t,r),o=fr.spawnSync(n.command,n.args,n.options);return o.error=o.error||Ve.verifyENOENTSync(o.status,n),o}W.exports=mr;W.exports.spawn=mr;W.exports.sync=uo;W.exports._parse=qe;W.exports._enoent=Ve});var Tr=w((Gi,ge)=>{ge.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&ge.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ge.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Or=w((Fi,K)=>{var g=global.process,D=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};D(g)?(vr=C("assert"),q=Tr(),Cr=/^win/i.test(g.platform),oe=C("events"),typeof oe!="function"&&(oe=oe.EventEmitter),g.__signal_exit_emitter__?S=g.__signal_exit_emitter__:(S=g.__signal_exit_emitter__=new oe,S.count=0,S.emitted={}),S.infinite||(S.setMaxListeners(1/0),S.infinite=!0),K.exports=function(e,t){if(!D(global.process))return function(){};vr.equal(typeof e,"function","a callback must be provided for exit handler"),V===!1&&Je();var r="exit";t&&t.alwaysLast&&(r="afterexit");var n=function(){S.removeListener(r,e),S.listeners("exit").length===0&&S.listeners("afterexit").length===0&&ye()};return S.on(r,e),n},ye=function(){!V||!D(global.process)||(V=!1,q.forEach(function(t){try{g.removeListener(t,be[t])}catch(r){}}),g.emit=we,g.reallyExit=Ze,S.count-=1)},K.exports.unload=ye,_=function(t,r,n){S.emitted[t]||(S.emitted[t]=!0,S.emit(t,r,n))},be={},q.forEach(function(e){be[e]=function(){if(D(global.process)){var r=g.listeners(e);r.length===S.count&&(ye(),_("exit",null,e),_("afterexit",null,e),Cr&&e==="SIGHUP"&&(e="SIGINT"),g.kill(g.pid,e))}}}),K.exports.signals=function(){return q},V=!1,Je=function(){V||!D(global.process)||(V=!0,S.count+=1,q=q.filter(function(t){try{return g.on(t,be[t]),!0}catch(r){return!1}}),g.emit=Pr,g.reallyExit=Rr)},K.exports.load=Je,Ze=g.reallyExit,Rr=function(t){D(global.process)&&(g.exitCode=t||0,_("exit",g.exitCode,null),_("afterexit",g.exitCode,null),Ze.call(g,g.exitCode))},we=g.emit,Pr=function(t,r){if(t==="exit"&&D(global.process)){r!==void 0&&(g.exitCode=r);var n=we.apply(this,arguments);return _("exit",g.exitCode,null),_("afterexit",g.exitCode,null),n}else return we.apply(this,arguments)}):K.exports=function(){return function(){}};var vr,q,Cr,oe,S,ye,_,be,V,Je,Ze,Rr,we,Pr});var Gr=w((qi,Ur)=>{"use strict";var{PassThrough:Do}=C("stream");Ur.exports=e=>{e={...e};let{array:t}=e,{encoding:r}=e,n=r==="buffer",o=!1;t?o=!(r||n):r=r||"utf8",n&&(r=null);let s=new Do({objectMode:o});r&&s.setEncoding(r);let i=0,a=[];return s.on("data",u=>{a.push(u),o?i=a.length:i+=u.length}),s.getBufferedValue=()=>t?a:n?Buffer.concat(a,i):a.join(""),s.getBufferedLength=()=>i,s}});var Fr=w((Vi,se)=>{"use strict";var{constants:_o}=C("buffer"),Ho=C("stream"),{promisify:zo}=C("util"),Wo=Gr(),qo=zo(Ho.pipeline),Se=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function tt(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};let{maxBuffer:r}=t,n=Wo(t);return await new Promise((o,s)=>{let i=a=>{a&&n.getBufferedLength()<=_o.MAX_LENGTH&&(a.bufferedData=n.getBufferedValue()),s(a)};(async()=>{try{await qo(e,n),o()}catch(a){i(a)}})(),n.on("data",()=>{n.getBufferedLength()>r&&i(new Se)})}),n.getBufferedValue()}se.exports=tt;se.exports.buffer=(e,t)=>tt(e,{...t,encoding:"buffer"});se.exports.array=(e,t)=>tt(e,{...t,array:!0});se.exports.MaxBufferError=Se});var jr=w((Ki,Mr)=>{"use strict";var{PassThrough:Vo}=C("stream");Mr.exports=function(){var e=[],t=new Vo({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(r),t;function r(s){return Array.isArray(s)?(s.forEach(r),this):(e.push(s),s.once("end",o.bind(null,s)),s.once("error",t.emit.bind(t,"error")),s.pipe(t,{end:!1}),this)}function n(){return e.length==0}function o(s){e=e.filter(function(i){return i!==s}),!e.length&&t.readable&&t.end()}}});var mt=w((Ta,ft)=>{var ys=C("tty"),bs=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||ys.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),y=(e,t,r=e)=>n=>{let o=""+n,s=o.indexOf(t,e.length);return~s?e+rn(o,t,r,s)+t:e+o+t},rn=(e,t,r,n)=>{let o=e.substring(0,n)+r,s=e.substring(n+t.length),i=s.indexOf(t);return~i?o+rn(s,t,r,i):o+s},nn=(e=bs)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?y("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?y("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?y("\x1B[3m","\x1B[23m"):String,underline:e?y("\x1B[4m","\x1B[24m"):String,inverse:e?y("\x1B[7m","\x1B[27m"):String,hidden:e?y("\x1B[8m","\x1B[28m"):String,strikethrough:e?y("\x1B[9m","\x1B[29m"):String,black:e?y("\x1B[30m","\x1B[39m"):String,red:e?y("\x1B[31m","\x1B[39m"):String,green:e?y("\x1B[32m","\x1B[39m"):String,yellow:e?y("\x1B[33m","\x1B[39m"):String,blue:e?y("\x1B[34m","\x1B[39m"):String,magenta:e?y("\x1B[35m","\x1B[39m"):String,cyan:e?y("\x1B[36m","\x1B[39m"):String,white:e?y("\x1B[37m","\x1B[39m"):String,gray:e?y("\x1B[90m","\x1B[39m"):String,bgBlack:e?y("\x1B[40m","\x1B[49m"):String,bgRed:e?y("\x1B[41m","\x1B[49m"):String,bgGreen:e?y("\x1B[42m","\x1B[49m"):String,bgYellow:e?y("\x1B[43m","\x1B[49m"):String,bgBlue:e?y("\x1B[44m","\x1B[49m"):String,bgMagenta:e?y("\x1B[45m","\x1B[49m"):String,bgCyan:e?y("\x1B[46m","\x1B[49m"):String,bgWhite:e?y("\x1B[47m","\x1B[49m"):String});ft.exports=nn();ft.exports.createColors=nn});import{existsSync as Vs,promises as Tt}from"fs";var Qr=H(dr(),1);import{Buffer as ls}from"buffer";import fs from"path";import lt from"child_process";import Te from"process";function Ke(e){let t=typeof e=="string"?`
  4. `:`
  5. `.charCodeAt(),r=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}import de from"process";import re from"path";import lo from"url";function me(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}function fo(e={}){let{cwd:t=de.cwd(),path:r=de.env[me()],execPath:n=de.execPath}=e,o,s=t instanceof URL?lo.fileURLToPath(t):t,i=re.resolve(s),a=[];for(;o!==i;)a.push(re.join(i,"node_modules/.bin")),o=i,i=re.resolve(i,"..");return a.push(re.resolve(s,n,"..")),[...a,r].join(re.delimiter)}function pr({env:e=de.env,...t}={}){e={...e};let r=me({env:e});return t.path=e[r],e[r]=fo(t),e}var mo=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let o=Object.getOwnPropertyDescriptor(e,r),s=Object.getOwnPropertyDescriptor(t,r);!po(o,s)&&n||Object.defineProperty(e,r,s)},po=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},ho=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},go=(e,t)=>`/* Wrapped ${e}*/
  6. ${t}`,yo=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),bo=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),wo=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=go.bind(null,n,t.toString());Object.defineProperty(o,"name",bo),Object.defineProperty(e,"toString",{...yo,value:o})};function Xe(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))mo(e,t,o,r);return ho(e,t),wo(e,t,n),e}var pe=new WeakMap,hr=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,o=e.displayName||e.name||"<anonymous>",s=function(...i){if(pe.set(s,++n),n===1)r=e.apply(this,i),e=null;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return Xe(s,e),pe.set(s,n),s};hr.callCount=e=>{if(!pe.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return pe.get(e)};var gr=hr;import{constants as To}from"os";var yr=()=>{let e=wr-br+1;return Array.from({length:e},xo)},xo=(e,t)=>({name:`SIGRT${t+1}`,number:br+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),br=34,wr=64;import{constants as So}from"os";var xr=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var Ye=()=>{let e=yr();return[...xr,...e].map(Eo)},Eo=({name:e,number:t,description:r,action:n,forced:o=!1,standard:s})=>{let{signals:{[e]:i}}=So,a=i!==void 0;return{name:e,number:a?i:t,description:r,supported:a,action:n,forced:o,standard:s}};var vo=()=>{let e=Ye();return Object.fromEntries(e.map(Co))},Co=({name:e,number:t,description:r,supported:n,action:o,forced:s,standard:i})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:s,standard:i}],Sr=vo(),Ro=()=>{let e=Ye(),t=64+1,r=Array.from({length:t},(n,o)=>Po(o,e));return Object.assign({},...r)},Po=(e,t)=>{let r=Oo(e,t);if(r===void 0)return{};let{name:n,description:o,supported:s,action:i,forced:a,standard:u}=r;return{[e]:{name:n,number:e,description:o,supported:s,action:i,forced:a,standard:u}}},Oo=(e,t)=>{let r=t.find(({name:n})=>To.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},ki=Ro();var $o=({timedOut:e,timeout:t,errorCode:r,signal:n,signalDescription:o,exitCode:s,isCanceled:i})=>e?`timed out after ${t} milliseconds`:i?"was canceled":r!==void 0?`failed with ${r}`:n!==void 0?`was killed with ${n} (${o})`:s!==void 0?`failed with exit code ${s}`:"failed",ne=({stdout:e,stderr:t,all:r,error:n,signal:o,exitCode:s,command:i,escapedCommand:a,timedOut:u,isCanceled:c,killed:l,parsed:{options:{timeout:p}}})=>{s=s===null?void 0:s,o=o===null?void 0:o;let m=o===void 0?void 0:Sr[o].description,d=n&&n.code,h=`Command ${$o({timedOut:u,timeout:p,errorCode:d,signal:o,signalDescription:m,exitCode:s,isCanceled:c})}: ${i}`,b=Object.prototype.toString.call(n)==="[object Error]",O=b?`${h}
  7. ${n.message}`:h,N=[O,t,e].filter(Boolean).join(`
  8. `);return b?(n.originalMessage=n.message,n.message=N):n=new Error(N),n.shortMessage=O,n.command=i,n.escapedCommand=a,n.exitCode=s,n.signal=o,n.signalDescription=m,n.stdout=e,n.stderr=t,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!u,n.isCanceled=c,n.killed=l&&!u,n};var he=["stdin","stdout","stderr"],Io=e=>he.some(t=>e[t]!==void 0),Er=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return he.map(n=>e[n]);if(Io(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${he.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,he.length);return Array.from({length:r},(n,o)=>t[o])};var $r=H(Or(),1);import Ao from"os";var ko=1e3*5,Ir=(e,t="SIGTERM",r={})=>{let n=e(t);return Lo(e,t,r,n),n},Lo=(e,t,r,n)=>{if(!No(t,r,n))return;let o=Uo(r),s=setTimeout(()=>{e("SIGKILL")},o);s.unref&&s.unref()},No=(e,{forceKillAfterTimeout:t},r)=>Bo(e)&&t!==!1&&r,Bo=e=>e===Ao.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Uo=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return ko;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Ar=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Go=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},kr=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let o,s=new Promise((a,u)=>{o=setTimeout(()=>{Go(e,r,u)},t)}),i=n.finally(()=>{clearTimeout(o)});return Promise.race([s,i])},Lr=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Nr=async(e,{cleanup:t,detached:r},n)=>{if(!t||r)return n;let o=(0,$r.default)(()=>{e.kill()});return n.finally(()=>{o()})};import{createWriteStream as Fo}from"fs";import{ChildProcess as Mo}from"child_process";function xe(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function Qe(e){return xe(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}var jo=e=>e instanceof Mo&&typeof e.then=="function",et=(e,t,r)=>{if(typeof r=="string")return e[t].pipe(Fo(r)),e;if(Qe(r))return e[t].pipe(r),e;if(!jo(r))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Qe(r.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(r.stdin),r},Br=e=>{e.stdout!==null&&(e.pipeStdout=et.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=et.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=et.bind(void 0,e,"all"))};import{createReadStream as Ko,readFileSync as Xo}from"fs";var ot=H(Fr(),1),Dr=H(jr(),1),_r=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},Yo=({input:e,inputFile:t})=>typeof t!="string"?e:(_r(e),Xo(t)),Hr=e=>{let t=Yo(e);if(xe(t))throw new TypeError("The `input` option cannot be a stream in sync mode");return t},Jo=({input:e,inputFile:t})=>typeof t!="string"?e:(_r(e),Ko(t)),zr=(e,t)=>{let r=Jo(t);r!==void 0&&(xe(r)?r.pipe(e.stdin):e.stdin.end(r))},Wr=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let r=(0,Dr.default)();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},rt=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(r){return r.bufferedData}}},nt=(e,{encoding:t,buffer:r,maxBuffer:n})=>{if(!(!e||!r))return t?(0,ot.default)(e,{encoding:t,maxBuffer:n}):ot.default.buffer(e,{maxBuffer:n})},qr=async({stdout:e,stderr:t,all:r},{encoding:n,buffer:o,maxBuffer:s},i)=>{let a=nt(e,{encoding:n,buffer:o,maxBuffer:s}),u=nt(t,{encoding:n,buffer:o,maxBuffer:s}),c=nt(r,{encoding:n,buffer:o,maxBuffer:s*2});try{return await Promise.all([i,a,u,c])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},rt(e,a),rt(t,u),rt(r,c)])}};var Zo=(async()=>{})().constructor.prototype,Qo=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Zo,e)]),st=(e,t)=>{for(let[r,n]of Qo){let o=typeof t=="function"?(...s)=>Reflect.apply(n.value,t(),s):n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},Vr=e=>new Promise((t,r)=>{e.on("exit",(n,o)=>{t({exitCode:n,signal:o})}),e.on("error",n=>{r(n)}),e.stdin&&e.stdin.on("error",n=>{r(n)})});import{Buffer as es}from"buffer";import{ChildProcess as ts}from"child_process";var Yr=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],rs=/^[\w.-]+$/,ns=/"/g,os=e=>typeof e!="string"||rs.test(e)?e:`"${e.replace(ns,'\\"')}"`,it=(e,t)=>Yr(e,t).join(" "),at=(e,t)=>Yr(e,t).map(r=>os(r)).join(" "),ss=/ +/g;var Kr=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(t==="object"&&e!==null&&!(e instanceof ts)&&"stdout"in e){let r=typeof e.stdout;if(r==="string")return e.stdout;if(es.isBuffer(e.stdout))return e.stdout.toString();throw new TypeError(`Unexpected "${r}" stdout in template expression`)}throw new TypeError(`Unexpected "${t}" in template expression`)},Xr=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e[e.length-1]}${t[0]}`,...t.slice(1)],is=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{let s=o!=null?o:e.raw[n],i=s.split(ss).filter(Boolean),a=Xr(r,i,s.startsWith(" "));if(n===t.length)return a;let u=t[n],c=Array.isArray(u)?u.map(l=>Kr(l)):[Kr(u)];return Xr(a,c,s.endsWith(" "))},ct=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=is({templates:e,expressions:t,tokens:r,index:n,template:o});return r};import{debuglog as as}from"util";import cs from"process";var Jr=as("execa").enabled,Ee=(e,t)=>String(e).padStart(t,"0"),us=()=>{let e=new Date;return`${Ee(e.getHours(),2)}:${Ee(e.getMinutes(),2)}:${Ee(e.getSeconds(),2)}.${Ee(e.getMilliseconds(),3)}`},ut=(e,{verbose:t})=>{t&&cs.stderr.write(`[${us()}] ${e}
  9. `)};var ms=1e3*1e3*100,ds=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:o})=>{let s=t?{...Te.env,...e}:e;return r?pr({env:s,cwd:n,execPath:o}):s},en=(e,t,r={})=>{let n=Qr.default._parse(e,t,r);return e=n.command,t=n.args,r=n.options,r={maxBuffer:ms,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||Te.cwd(),execPath:Te.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Jr,...r},r.env=ds(r),r.stdio=Er(r),Te.platform==="win32"&&fs.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},ie=(e,t,r)=>typeof t!="string"&&!ls.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?Ke(t):t;function ps(e,t,r){let n=en(e,t,r),o=it(e,t),s=at(e,t);ut(s,n.options),Lr(n.options);let i;try{i=lt.spawn(n.file,n.args,n.options)}catch(d){let f=new lt.ChildProcess,h=Promise.reject(ne({error:d,stdout:"",stderr:"",all:"",command:o,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return st(f,h),f}let a=Vr(i),u=kr(i,n.options,a),c=Nr(i,n.options,u),l={isCanceled:!1};i.kill=Ir.bind(null,i.kill.bind(i)),i.cancel=Ar.bind(null,i,l);let m=gr(async()=>{let[{error:d,exitCode:f,signal:h,timedOut:b},O,N,Ge]=await qr(i,n.options,c),x=ie(n.options,O),A=ie(n.options,N),v=ie(n.options,Ge);if(d||f!==0||h!==null){let ee=ne({error:d,exitCode:f,signal:h,stdout:x,stderr:A,all:v,command:o,escapedCommand:s,parsed:n,timedOut:b,isCanceled:l.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:i.killed});if(!n.options.reject)return ee;throw ee}return{command:o,escapedCommand:s,exitCode:0,stdout:x,stderr:A,all:v,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return zr(i,n.options),i.all=Wr(i,n.options),Br(i),st(i,m),i}function hs(e,t,r){let n=en(e,t,r),o=it(e,t),s=at(e,t);ut(s,n.options);let i=Hr(n.options),a;try{a=lt.spawnSync(n.file,n.args,{...n.options,input:i})}catch(l){throw ne({error:l,stdout:"",stderr:"",all:"",command:o,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let u=ie(n.options,a.stdout,a.error),c=ie(n.options,a.stderr,a.error);if(a.error||a.status!==0||a.signal!==null){let l=ne({stdout:u,stderr:c,error:a.error,signal:a.signal,exitCode:a.status,command:o,escapedCommand:s,parsed:n,timedOut:a.error&&a.error.code==="ETIMEDOUT",isCanceled:!1,killed:a.signal!==null});if(!n.options.reject)return l;throw l}return{command:o,escapedCommand:s,exitCode:0,stdout:u,stderr:c,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var gs=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Zr=(e={})=>({preferLocal:!0,...gs(e),...e});function tn(e){function t(r,...n){if(!Array.isArray(r))return tn({...e,...r});let[o,...s]=ct(r,n);return ps(o,s,Zr(e))}return t.sync=(r,...n)=>{if(!Array.isArray(r))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[o,...s]=ct(r,n);return hs(o,s,Zr(e))},t}var X=tn();var k=H(mt(),1);import $s from"http";import Is from"https";import Z from"zlib";import Tn,{PassThrough as vn,pipeline as Q}from"stream";import{Buffer as Ie}from"buffer";function ws(e){if(!/^data:/i.test(e))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");let t=e.indexOf(",");if(t===-1||t<=4)throw new TypeError("malformed data: URI");let r=e.substring(5,t).split(";"),n="",o=!1,s=r[0]||"text/plain",i=s;for(let l=1;l<r.length;l++)r[l]==="base64"?o=!0:r[l]&&(i+=`;${r[l]}`,r[l].indexOf("charset=")===0&&(n=r[l].substring(8)));!r[0]&&!n.length&&(i+=";charset=US-ASCII",n="US-ASCII");let a=o?"base64":"ascii",u=unescape(e.substring(t+1)),c=Buffer.from(u,a);return c.type=s,c.typeFull=i,c.charset=n,c}var on=ws;import M,{PassThrough as un}from"stream";import{types as ln,deprecate as ht,promisify as xs}from"util";import{Buffer as L}from"buffer";var G=class extends Error{constructor(t,r){super(t),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var $=class extends G{constructor(t,r,n){super(t,r),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}};var ve=Symbol.toStringTag,dt=e=>typeof e=="object"&&typeof e.append=="function"&&typeof e.delete=="function"&&typeof e.get=="function"&&typeof e.getAll=="function"&&typeof e.has=="function"&&typeof e.set=="function"&&typeof e.sort=="function"&&e[ve]==="URLSearchParams",ae=e=>e&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&typeof e.constructor=="function"&&/^(Blob|File)$/.test(e[ve]),sn=e=>typeof e=="object"&&(e[ve]==="AbortSignal"||e[ve]==="EventTarget"),an=(e,t)=>{let r=new URL(t).hostname,n=new URL(e).hostname;return r===n||r.endsWith(`.${n}`)},cn=(e,t)=>{let r=new URL(t).protocol,n=new URL(e).protocol;return r===n};var Ss=xs(M.pipeline),I=Symbol("Body internals"),U=class{constructor(t,{size:r=0}={}){let n=null;t===null?t=null:dt(t)?t=L.from(t.toString()):ae(t)||L.isBuffer(t)||(ln.isAnyArrayBuffer(t)?t=L.from(t):ArrayBuffer.isView(t)?t=L.from(t.buffer,t.byteOffset,t.byteLength):t instanceof M||(t instanceof te?(t=Ct(t),n=t.type.split("=")[1]):t=L.from(String(t))));let o=t;L.isBuffer(t)?o=M.Readable.from(t):ae(t)&&(o=M.Readable.from(t.stream())),this[I]={body:t,stream:o,boundary:n,disturbed:!1,error:null},this.size=r,t instanceof M&&t.on("error",s=>{let i=s instanceof G?s:new $(`Invalid response body while trying to fetch ${this.url}: ${s.message}`,"system",s);this[I].error=i})}get body(){return this[I].stream}get bodyUsed(){return this[I].disturbed}async arrayBuffer(){let{buffer:t,byteOffset:r,byteLength:n}=await pt(this);return t.slice(r,r+n)}async formData(){let t=this.headers.get("content-type");if(t.startsWith("application/x-www-form-urlencoded")){let n=new te,o=new URLSearchParams(await this.text());for(let[s,i]of o)n.append(s,i);return n}let{toFormData:r}=await import("./multipart-parser-YOS7MX5H.js");return r(this.body,t)}async blob(){let t=this.headers&&this.headers.get("content-type")||this[I].body&&this[I].body.type||"",r=await this.arrayBuffer();return new Fe([r],{type:t})}async json(){let t=await this.text();return JSON.parse(t)}async text(){let t=await pt(this);return new TextDecoder().decode(t)}buffer(){return pt(this)}};U.prototype.buffer=ht(U.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(U.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:ht(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function pt(e){if(e[I].disturbed)throw new TypeError(`body used already for: ${e.url}`);if(e[I].disturbed=!0,e[I].error)throw e[I].error;let{body:t}=e;if(t===null)return L.alloc(0);if(!(t instanceof M))return L.alloc(0);let r=[],n=0;try{for await(let o of t){if(e.size>0&&n+o.length>e.size){let s=new $(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw t.destroy(s),s}n+=o.length,r.push(o)}}catch(o){throw o instanceof G?o:new $(`Invalid response body while trying to fetch ${e.url}: ${o.message}`,"system",o)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return r.every(o=>typeof o=="string")?L.from(r.join("")):L.concat(r,n)}catch(o){throw new $(`Could not create Buffer from response body for ${e.url}: ${o.message}`,"system",o)}else throw new $(`Premature close of server response while trying to fetch ${e.url}`)}var Y=(e,t)=>{let r,n,{body:o}=e[I];if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof M&&typeof o.getBoundary!="function"&&(r=new un({highWaterMark:t}),n=new un({highWaterMark:t}),o.pipe(r),o.pipe(n),e[I].stream=r,o=n),o},Es=ht(e=>e.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),Ce=(e,t)=>e===null?null:typeof e=="string"?"text/plain;charset=UTF-8":dt(e)?"application/x-www-form-urlencoded;charset=UTF-8":ae(e)?e.type||null:L.isBuffer(e)||ln.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof te?`multipart/form-data; boundary=${t[I].boundary}`:e&&typeof e.getBoundary=="function"?`multipart/form-data;boundary=${Es(e)}`:e instanceof M?null:"text/plain;charset=UTF-8",fn=e=>{let{body:t}=e[I];return t===null?0:ae(t)?t.size:L.isBuffer(t)?t.length:t&&typeof t.getLengthSync=="function"&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},mn=async(e,{body:t})=>{t===null?e.end():await Ss(t,e)};import{types as dn}from"util";import Pe from"http";var Re=typeof Pe.validateHeaderName=="function"?Pe.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=new TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},gt=typeof Pe.validateHeaderValue=="function"?Pe.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let r=new TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}},R=class extends URLSearchParams{constructor(t){let r=[];if(t instanceof R){let n=t.raw();for(let[o,s]of Object.entries(n))r.push(...s.map(i=>[o,i]))}else if(t!=null)if(typeof t=="object"&&!dn.isBoxedPrimitive(t)){let n=t[Symbol.iterator];if(n==null)r.push(...Object.entries(t));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");r=[...t].map(o=>{if(typeof o!="object"||dn.isBoxedPrimitive(o))throw new TypeError("Each header pair must be an iterable object");return[...o]}).map(o=>{if(o.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return r=r.length>0?r.map(([n,o])=>(Re(n),gt(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0,super(r),new Proxy(this,{get(n,o,s){switch(o){case"append":case"set":return(i,a)=>(Re(i),gt(i,String(a)),URLSearchParams.prototype[o].call(n,String(i).toLowerCase(),String(a)));case"delete":case"has":case"getAll":return i=>(Re(i),URLSearchParams.prototype[o].call(n,String(i).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,s)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){let r=this.getAll(t);if(r.length===0)return null;let n=r.join(", ");return/^content-encoding$/i.test(t)&&(n=n.toLowerCase()),n}forEach(t,r=void 0){for(let n of this.keys())Reflect.apply(t,r,[this.get(n),n,this])}*values(){for(let t of this.keys())yield this.get(t)}*entries(){for(let t of this.keys())yield[t,this.get(t)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((t,r)=>(t[r]=this.getAll(r),t),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((t,r)=>{let n=this.getAll(r);return r==="host"?t[r]=n[0]:t[r]=n.length>1?n:n[0],t},{})}};Object.defineProperties(R.prototype,["get","entries","forEach","values"].reduce((e,t)=>(e[t]={enumerable:!0},e),{}));function pn(e=[]){return new R(e.reduce((t,r,n,o)=>(n%2===0&&t.push(o.slice(n,n+2)),t),[]).filter(([t,r])=>{try{return Re(t),gt(t,String(r)),!0}catch(n){return!1}}))}var Ts=new Set([301,302,303,307,308]),Oe=e=>Ts.has(e);var B=Symbol("Response internals"),T=class extends U{constructor(t=null,r={}){super(t,r);let n=r.status!=null?r.status:200,o=new R(r.headers);if(t!==null&&!o.has("Content-Type")){let s=Ce(t,this);s&&o.append("Content-Type",s)}this[B]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[B].type}get url(){return this[B].url||""}get status(){return this[B].status}get ok(){return this[B].status>=200&&this[B].status<300}get redirected(){return this[B].counter>0}get statusText(){return this[B].statusText}get headers(){return this[B].headers}get highWaterMark(){return this[B].highWaterMark}clone(){return new T(Y(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,r=302){if(!Oe(r))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new T(null,{headers:{location:new URL(t).toString()},status:r})}static error(){let t=new T(null,{status:0,statusText:""});return t[B].type="error",t}static json(t=void 0,r={}){let n=JSON.stringify(t);if(n===void 0)throw new TypeError("data is not JSON serializable");let o=new R(r&&r.headers);return o.has("content-type")||o.set("content-type","application/json"),new T(n,{...r,headers:o})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(T.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});import{format as Rs}from"url";import{deprecate as Ps}from"util";var hn=e=>{if(e.search)return e.search;let t=e.href.length-1,r=e.hash||(e.href[t]==="#"?"#":"");return e.href[t-r.length]==="?"?"?":""};import{isIP as vs}from"net";function gn(e,t=!1){return e==null||(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))?"no-referrer":(e.username="",e.password="",e.hash="",t&&(e.pathname="",e.search=""),e)}var yn=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),bn="strict-origin-when-cross-origin";function wn(e){if(!yn.has(e))throw new TypeError(`Invalid referrerPolicy: ${e}`);return e}function Cs(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,""),r=vs(t);return r===4&&/^127\./.test(t)||r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t)?!0:e.host==="localhost"||e.host.endsWith(".localhost")?!1:e.protocol==="file:"}function J(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol==="data:"||/^(blob|filesystem):$/.test(e.protocol)?!0:Cs(e)}function xn(e,{referrerURLCallback:t,referrerOriginCallback:r}={}){if(e.referrer==="no-referrer"||e.referrerPolicy==="")return null;let n=e.referrerPolicy;if(e.referrer==="about:client")return"no-referrer";let o=e.referrer,s=gn(o),i=gn(o,!0);s.toString().length>4096&&(s=i),t&&(s=t(s)),r&&(i=r(i));let a=new URL(e.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return i;case"unsafe-url":return s;case"strict-origin":return J(s)&&!J(a)?"no-referrer":i.toString();case"strict-origin-when-cross-origin":return s.origin===a.origin?s:J(s)&&!J(a)?"no-referrer":i;case"same-origin":return s.origin===a.origin?s:"no-referrer";case"origin-when-cross-origin":return s.origin===a.origin?s:i;case"no-referrer-when-downgrade":return J(s)&&!J(a)?"no-referrer":s;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function Sn(e){let t=(e.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let n of t)n&&yn.has(n)&&(r=n);return r}var E=Symbol("Request internals"),ce=e=>typeof e=="object"&&typeof e[E]=="object",Os=Ps(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),F=class extends U{constructor(t,r={}){let n;if(ce(t)?n=new URL(t.url):(n=new URL(t),t={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let o=r.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)&&(o=o.toUpperCase()),!ce(r)&&"data"in r&&Os(),(r.body!=null||ce(t)&&t.body!==null)&&(o==="GET"||o==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let s=r.body?r.body:ce(t)&&t.body!==null?Y(t):null;super(s,{size:r.size||t.size||0});let i=new R(r.headers||t.headers||{});if(s!==null&&!i.has("Content-Type")){let c=Ce(s,this);c&&i.set("Content-Type",c)}let a=ce(t)?t.signal:null;if("signal"in r&&(a=r.signal),a!=null&&!sn(a))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let u=r.referrer==null?t.referrer:r.referrer;if(u==="")u="no-referrer";else if(u){let c=new URL(u);u=/^about:(\/\/)?client$/.test(c)?"client":c}else u=void 0;this[E]={method:o,redirect:r.redirect||t.redirect||"follow",headers:i,parsedURL:n,signal:a,referrer:u},this.follow=r.follow===void 0?t.follow===void 0?20:t.follow:r.follow,this.compress=r.compress===void 0?t.compress===void 0?!0:t.compress:r.compress,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent,this.highWaterMark=r.highWaterMark||t.highWaterMark||16384,this.insecureHTTPParser=r.insecureHTTPParser||t.insecureHTTPParser||!1,this.referrerPolicy=r.referrerPolicy||t.referrerPolicy||""}get method(){return this[E].method}get url(){return Rs(this[E].parsedURL)}get headers(){return this[E].headers}get redirect(){return this[E].redirect}get signal(){return this[E].signal}get referrer(){if(this[E].referrer==="no-referrer")return"";if(this[E].referrer==="client")return"about:client";if(this[E].referrer)return this[E].referrer.toString()}get referrerPolicy(){return this[E].referrerPolicy}set referrerPolicy(t){this[E].referrerPolicy=wn(t)}clone(){return new F(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(F.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var En=e=>{let{parsedURL:t}=e[E],r=new R(e[E].headers);r.has("Accept")||r.set("Accept","*/*");let n=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(n="0"),e.body!==null){let a=fn(e);typeof a=="number"&&!Number.isNaN(a)&&(n=String(a))}n&&r.set("Content-Length",n),e.referrerPolicy===""&&(e.referrerPolicy=bn),e.referrer&&e.referrer!=="no-referrer"?e[E].referrer=xn(e):e[E].referrer="no-referrer",e[E].referrer instanceof URL&&r.set("Referer",e.referrer),r.has("User-Agent")||r.set("User-Agent","node-fetch"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=e;typeof o=="function"&&(o=o(t)),!r.has("Connection")&&!o&&r.set("Connection","close");let s=hn(t),i={path:t.pathname+s,method:e.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:o};return{parsedURL:t,options:i}};var $e=class extends G{constructor(t,r="aborted"){super(t,r)}};var As=new Set(["data:","http:","https:"]);async function Ae(e,t){return new Promise((r,n)=>{let o=new F(e,t),{parsedURL:s,options:i}=En(o);if(!As.has(s.protocol))throw new TypeError(`node-fetch cannot load ${e}. URL scheme "${s.protocol.replace(/:$/,"")}" is not supported.`);if(s.protocol==="data:"){let f=on(o.url),h=new T(f,{headers:{"Content-Type":f.typeFull}});r(h);return}let a=(s.protocol==="https:"?Is:$s).request,{signal:u}=o,c=null,l=()=>{let f=new $e("The operation was aborted.");n(f),o.body&&o.body instanceof Tn.Readable&&o.body.destroy(f),!(!c||!c.body)&&c.body.emit("error",f)};if(u&&u.aborted){l();return}let p=()=>{l(),d()},m=a(s.toString(),i);u&&u.addEventListener("abort",p);let d=()=>{m.abort(),u&&u.removeEventListener("abort",p)};m.on("error",f=>{n(new $(`request to ${o.url} failed, reason: ${f.message}`,"system",f)),d()}),ks(m,f=>{c&&c.body&&c.body.destroy(f)}),process.version<"v14"&&m.on("socket",f=>{let h;f.prependListener("end",()=>{h=f._eventsCount}),f.prependListener("close",b=>{if(c&&h<f._eventsCount&&!b){let O=new Error("Premature close");O.code="ERR_STREAM_PREMATURE_CLOSE",c.body.emit("error",O)}})}),m.on("response",f=>{m.setTimeout(0);let h=pn(f.rawHeaders);if(Oe(f.statusCode)){let x=h.get("Location"),A=null;try{A=x===null?null:new URL(x,o.url)}catch(v){if(o.redirect!=="manual"){n(new $(`uri requested responds with an invalid redirect URL: ${x}`,"invalid-redirect")),d();return}}switch(o.redirect){case"error":n(new $(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),d();return;case"manual":break;case"follow":{if(A===null)break;if(o.counter>=o.follow){n(new $(`maximum redirect reached at: ${o.url}`,"max-redirect")),d();return}let v={headers:new R(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:Y(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!an(o.url,A)||!cn(o.url,A))for(let Gn of["authorization","www-authenticate","cookie","cookie2"])v.headers.delete(Gn);if(f.statusCode!==303&&o.body&&t.body instanceof Tn.Readable){n(new $("Cannot follow redirect with body being a readable stream","unsupported-redirect")),d();return}(f.statusCode===303||(f.statusCode===301||f.statusCode===302)&&o.method==="POST")&&(v.method="GET",v.body=void 0,v.headers.delete("content-length"));let ee=Sn(h);ee&&(v.referrerPolicy=ee),r(Ae(new F(A,v))),d();return}default:return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}u&&f.once("end",()=>{u.removeEventListener("abort",p)});let b=Q(f,new vn,x=>{x&&n(x)});process.version<"v12.10"&&f.on("aborted",p);let O={url:o.url,status:f.statusCode,statusText:f.statusMessage,headers:h,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},N=h.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||N===null||f.statusCode===204||f.statusCode===304){c=new T(b,O),r(c);return}let Ge={flush:Z.Z_SYNC_FLUSH,finishFlush:Z.Z_SYNC_FLUSH};if(N==="gzip"||N==="x-gzip"){b=Q(b,Z.createGunzip(Ge),x=>{x&&n(x)}),c=new T(b,O),r(c);return}if(N==="deflate"||N==="x-deflate"){let x=Q(f,new vn,A=>{A&&n(A)});x.once("data",A=>{(A[0]&15)===8?b=Q(b,Z.createInflate(),v=>{v&&n(v)}):b=Q(b,Z.createInflateRaw(),v=>{v&&n(v)}),c=new T(b,O),r(c)}),x.once("end",()=>{c||(c=new T(b,O),r(c))});return}if(N==="br"){b=Q(b,Z.createBrotliDecompress(),x=>{x&&n(x)}),c=new T(b,O),r(c);return}c=new T(b,O),r(c)}),mn(m,o).catch(n)})}function ks(e,t){let r=Ie.from(`0\r
  10. \r
  11. `),n=!1,o=!1,s;e.on("response",i=>{let{headers:a}=i;n=a["transfer-encoding"]==="chunked"&&!a["content-length"]}),e.on("socket",i=>{let a=()=>{if(n&&!o){let c=new Error("Premature close");c.code="ERR_STREAM_PREMATURE_CLOSE",t(c)}},u=c=>{o=Ie.compare(c.slice(-5),r)===0,!o&&s&&(o=Ie.compare(s.slice(-3),r.slice(0,3))===0&&Ie.compare(c.slice(-2),r.slice(3))===0),s=c};i.prependListener("close",a),i.on("data",u),e.on("close",()=>{i.removeListener("close",a),i.removeListener("data",u)})})}import{EventEmitter as Ls}from"events";function yt(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ns(e,t,r,n){var o,s=e[t],i=~n.string.indexOf(t)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~n.boolean.indexOf(t)?r==="false"?!1:r==="true"||(e._.push((o=+r,o*0===0?o:r)),!!r):(o=+r,o*0===0?o:r);e[t]=s==null?i:Array.isArray(s)?s.concat(i):[s,i]}function Bs(e,t){e=e||[],t=t||{};var r,n,o,s,i,a={_:[]},u=0,c=0,l=0,p=e.length;let m=t.alias!==void 0,d=t.unknown!==void 0,f=t.default!==void 0;if(t.alias=t.alias||{},t.string=yt(t.string),t.boolean=yt(t.boolean),m)for(r in t.alias)for(n=t.alias[r]=yt(t.alias[r]),u=0;u<n.length;u++)(t.alias[n[u]]=n.concat(r)).splice(u,1);for(u=t.boolean.length;u-- >0;)for(n=t.alias[t.boolean[u]]||[],c=n.length;c-- >0;)t.boolean.push(n[c]);for(u=t.string.length;u-- >0;)for(n=t.alias[t.string[u]]||[],c=n.length;c-- >0;)t.string.push(n[c]);if(f){for(r in t.default)if(s=typeof t.default[r],n=t.alias[r]=t.alias[r]||[],t[s]!==void 0)for(t[s].push(r),u=0;u<n.length;u++)t[s].push(n[u])}let h=d?Object.keys(t.alias):[];for(u=0;u<p;u++){if(o=e[u],o==="--"){a._=a._.concat(e.slice(++u));break}for(c=0;c<o.length&&o.charCodeAt(c)===45;c++);if(c===0)a._.push(o);else if(o.substring(c,c+3)==="no-"){if(s=o.substring(c+3),d&&!~h.indexOf(s))return t.unknown(o);a[s]=!1}else{for(l=c+1;l<o.length&&o.charCodeAt(l)!==61;l++);for(s=o.substring(c,l),i=o.substring(++l)||u+1===p||(""+e[u+1]).charCodeAt(0)===45||e[++u],n=c===2?[s]:s,l=0;l<n.length;l++){if(s=n[l],d&&!~h.indexOf(s))return t.unknown("-".repeat(c)+s);Ns(a,s,l+1<n.length||i,t)}}}if(f)for(r in t.default)a[r]===void 0&&(a[r]=t.default[r]);if(m)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a}var Pn=e=>e.replace(/[<[].+/,"").trim(),Us=e=>{let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],o=a=>{let u=!1,c=a[1];return c.startsWith("...")&&(c=c.slice(3),u=!0),{required:a[0].startsWith("<"),value:c,variadic:u}},s;for(;s=t.exec(e);)n.push(o(s));let i;for(;i=r.exec(e);)n.push(o(i));return n},Gs=e=>{let t={alias:{},boolean:[]};for(let[r,n]of e.entries())n.names.length>1&&(t.alias[n.names[0]]=n.names.slice(1)),n.isBoolean&&(n.negated&&e.some((s,i)=>i!==r&&s.names.some(a=>n.names.includes(a))&&typeof s.required=="boolean")||t.boolean.push(n.names[0]));return t},Cn=e=>e.sort((t,r)=>t.length>r.length?-1:1)[0],Rn=(e,t)=>e.length>=t?e:`${e}${" ".repeat(t-e.length)}`,Fs=e=>e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase()),Ms=(e,t,r)=>{let n=0,o=t.length,s=e,i;for(;n<o;++n)i=s[t[n]],s=s[t[n]]=n===o-1?r:i!=null?i:~t[n+1].indexOf(".")||!(+t[n+1]>-1)?{}:[]},js=(e,t)=>{for(let r of Object.keys(t)){let n=t[r];n.shouldTransform&&(e[r]=Array.prototype.concat.call([],e[r]),typeof n.transformFunction=="function"&&(e[r]=e[r].map(n.transformFunction)))}},Ds=e=>{let t=/([^\\\/]+)$/.exec(e);return t?t[1]:""},On=e=>e.split(".").map((t,r)=>r===0?Fs(t):t).join("."),ue=class extends Error{constructor(t){super(t),this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(t).stack}},bt=class{constructor(t,r,n){this.rawName=t,this.description=r,this.config=Object.assign({},n),t=t.replace(/\.\*/g,""),this.negated=!1,this.names=Pn(t).split(",").map(o=>{let s=o.trim().replace(/^-{1,2}/,"");return s.startsWith("no-")&&(this.negated=!0,s=s.replace(/^no-/,"")),On(s)}).sort((o,s)=>o.length>s.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),t.includes("<")?this.required=!0:t.includes("[")?this.required=!1:this.isBoolean=!0}},_s=process.argv,Hs=`${process.platform}-${process.arch} node-${process.version}`,Le=class{constructor(t,r,n={},o){this.rawName=t,this.description=r,this.config=n,this.cli=o,this.options=[],this.aliasNames=[],this.name=Pn(t),this.args=Us(t),this.examples=[]}usage(t){return this.usageText=t,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(t,r="-v, --version"){return this.versionNumber=t,this.option(r,"Display version number"),this}example(t){return this.examples.push(t),this}option(t,r,n){let o=new bt(t,r,n);return this.options.push(o),this}alias(t){return this.aliasNames.push(t),this}action(t){return this.commandAction=t,this}isMatched(t){return this.name===t||this.aliasNames.includes(t)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Ne}hasOption(t){return t=t.split(".")[0],this.options.find(r=>r.names.includes(t))}outputHelp(){let{name:t,commands:r}=this.cli,{versionNumber:n,options:o,helpCallback:s}=this.cli.globalCommand,i=[{body:`${t}${n?`/${n}`:""}`}];if(i.push({title:"Usage",body:` $ ${t} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&r.length>0){let c=Cn(r.map(l=>l.rawName));i.push({title:"Commands",body:r.map(l=>` ${Rn(l.rawName,c.length)} ${l.description}`).join(`
  12. `)}),i.push({title:"For more info, run any command with the `--help` flag",body:r.map(l=>` $ ${t}${l.name===""?"":` ${l.name}`} --help`).join(`
  13. `)})}let u=this.isGlobalCommand?o:[...this.options,...o||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(u=u.filter(c=>c.name!=="version")),u.length>0){let c=Cn(u.map(l=>l.rawName));i.push({title:"Options",body:u.map(l=>` ${Rn(l.rawName,c.length)} ${l.description} ${l.config.default===void 0?"":`(default: ${l.config.default})`}`).join(`
  14. `)})}this.examples.length>0&&i.push({title:"Examples",body:this.examples.map(c=>typeof c=="function"?c(t):c).join(`
  15. `)}),s&&(i=s(i)||i),console.log(i.map(c=>c.title?`${c.title}:
  16. ${c.body}`:c.body).join(`
  17. `))}outputVersion(){let{name:t}=this.cli,{versionNumber:r}=this.cli.globalCommand;r&&console.log(`${t}/${r} ${Hs}`)}checkRequiredArgs(){let t=this.args.filter(r=>r.required).length;if(this.cli.args.length<t)throw new ue(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:t,globalCommand:r}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(t))if(n!=="--"&&!this.hasOption(n)&&!r.hasOption(n))throw new ue(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:t,globalCommand:r}=this.cli,n=[...r.options,...this.options];for(let o of n){let s=t[o.name.split(".")[0]];if(o.required){let i=n.some(a=>a.negated&&a.names.includes(o.name));if(s===!0||s===!1&&!i)throw new ue(`option \`${o.rawName}\` value is missing`)}}}},Ne=class extends Le{constructor(t){super("@@global@@","",{},t)}},ke=Object.assign,wt=class extends Ls{constructor(t=""){super(),this.name=t,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Ne(this),this.globalCommand.usage("<command> [options]")}usage(t){return this.globalCommand.usage(t),this}command(t,r,n){let o=new Le(t,r||"",n,this);return o.globalCommand=this.globalCommand,this.commands.push(o),o}option(t,r,n){return this.globalCommand.option(t,r,n),this}help(t){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=t,this.showHelpOnExit=!0,this}version(t,r="-v, --version"){return this.globalCommand.version(t,r),this.showVersionOnExit=!0,this}example(t){return this.globalCommand.example(t),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:t,options:r},n,o){return this.args=t,this.options=r,n&&(this.matchedCommand=n),o&&(this.matchedCommandName=o),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(t=_s,{run:r=!0}={}){this.rawArgs=t,this.name||(this.name=t[1]?Ds(t[1]):"cli");let n=!0;for(let s of this.commands){let i=this.mri(t.slice(2),s),a=i.args[0];if(s.isMatched(a)){n=!1;let u=ke(ke({},i),{args:i.args.slice(1)});this.setParsedInfo(u,s,a),this.emit(`command:${a}`,s)}}if(n){for(let s of this.commands)if(s.name===""){n=!1;let i=this.mri(t.slice(2),s);this.setParsedInfo(i,s),this.emit("command:!",s)}}if(n){let s=this.mri(t.slice(2));this.setParsedInfo(s)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),r=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),r=!1,this.unsetMatchedCommand());let o={args:this.args,options:this.options};return r&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit("command:*"),o}mri(t,r){let n=[...this.globalCommand.options,...r?r.options:[]],o=Gs(n),s=[],i=t.indexOf("--");i>-1&&(s=t.slice(i+1),t=t.slice(0,i));let a=Bs(t,o);a=Object.keys(a).reduce((m,d)=>ke(ke({},m),{[On(d)]:a[d]}),{_:[]});let u=a._,c={"--":s},l=r&&r.config.ignoreOptionDefaultValue?r.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,p=Object.create(null);for(let m of n){if(!l&&m.config.default!==void 0)for(let d of m.names)c[d]=m.config.default;Array.isArray(m.config.type)&&p[m.name]===void 0&&(p[m.name]=Object.create(null),p[m.name].shouldTransform=!0,p[m.name].transformFunction=m.config.type[0])}for(let m of Object.keys(a))if(m!=="_"){let d=m.split(".");Ms(c,d,a[m]),js(c,p)}return{args:u,options:c}}runMatchedCommand(){let{args:t,options:r,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let o=[];return n.args.forEach((s,i)=>{s.variadic?o.push(t.slice(i)):o.push(t[i])}),o.push(r),n.commandAction.apply(this,o)}},$n=(e="")=>new wt(e);var In={name:"hcny",type:"module",version:"0.2.3",packageManager:"pnpm@8.6.0",description:"npm\u3001yarn\u7684 \u79C1\u6709npm\u4ED3\u5E93\u7684\u955C\u50CF\u6E90\u5207\u6362\u5DE5\u5177",license:"MIT",keywords:["npm","registry","toggle","yarn"],main:"./dist/index.js",module:"./dist/index.js",bin:{hcny:"dist/index.js",hnrm:"dist/index.js",hyrm:"dist/yrm.js",hprm:"dist/prm.js"},files:["dist","LICENSE","README.md","registries.json"],engines:{node:"^12.20.0 || ^14.13.1 || >=16.0.0"},scripts:{build:"tsup",coverage:"vitest run --coverage",dev:"tsup --watch",lint:"eslint .",ls:"node dist/index.js ls",play:"node dist/index.js",prepublishOnly:"npm run build"},devDependencies:{"@antfu/eslint-config":"^0.39.4","@vitest/coverage-c8":"^0.31.3",bumpp:"^9.1.0",cac:"^6.7.14",eslint:"^8.41.0",execa:"^7.1.1","lint-staged":"^13.2.2","node-fetch":"^3.3.1",picocolors:"^1.0.0","simple-git-hooks":"^2.8.1",tsup:"^6.7.0",typescript:"^5.0.4",vitest:"^0.31.3"},"simple-git-hooks":{"pre-commit":"pnpm lint-staged"},"lint-staged":{"*":"eslint --fix"}};var An={npm:{home:"https://www.npmjs.org",registry:"https://registry.npmjs.org/"},yarn:{home:"https://yarnpkg.com",registry:"https://registry.yarnpkg.com/"},taobao:{home:"https://npmmirror.com/",registry:"https://registry.npmmirror.com/"},tencent:{home:"https://mirrors.cloud.tencent.com/npm/",registry:"https://mirrors.cloud.tencent.com/npm/"},npmMirror:{home:"https://skimdb.npmjs.com/",registry:"https://skimdb.npmjs.com/registry/"},github:{home:"https://npm.pkg.github.com/",registry:"https://npm.pkg.github.com/"},hc:{home:"http://39.108.216.210:9000/",registry:"http://39.108.216.210:9000/"}};var Ln=H(mt(),1);import{existsSync as qs,promises as xt}from"fs";import kn from"path";var Be=kn.join(process.env.HOME||process.env.USERPROFILE,".nnrm"),St=kn.join(Be,"registries.json");async function Ue(){let e={};try{let t=await xt.readFile(St,"utf-8");e=JSON.parse(t.trim()||"{}")}catch(t){let r=`
  18. We will create '${(0,Ln.yellow)(St)}' to record your custom registries.
  19. `;if(console.log(r),!qs(Be))try{await xt.mkdir(Be,{recursive:!0})}catch(n){console.log(n.message),await X`mkdir ${Be}`.catch(o=>{console.log(o.message)})}await Et(e)}return e}async function Et(e){return xt.writeFile(St,JSON.stringify(e,null,2))}async function Nn(e,t,r){let n=await Ue();t.slice(-1)!=="/"&&(t+="/"),n[e]={home:r||t,registry:t},await Et(n)}async function Bn(e){let t=await Ue();t[e]&&delete t[e],await Et(t)}var j=$n(),P={pkgManager:"npm",registries:{}};function Un(e){let t=Math.max(...Object.keys(P.registries).map(n=>n.length))+3,r=new Array(Math.max(1,t-e.length)).join("-");return`${e} ${r}`}function Ks(e,t){return t.endsWith(e)?t:t+e}async function vt(){let e=await Ue();return Object.assign({},An,e)}async function Xs(){let e="",t=await Ys(P.pkgManager),r=!1;return Object.keys(P.registries).forEach(n=>{let o=n===t;o&&(r=!0);let i=`
  20. ${o?"*":" "} ${Un(n)} ${P.registries[n].registry}`;e+=o?(0,k.green)(i):i}),{inList:r,list:e,currentRegistry:t}}async function le(){let{inList:e,list:t,currentRegistry:r}=await Xs();return e||console.log(`
  21. ${(0,k.red)("Unknown")} registry: ${(0,k.yellow)(r)}`),console.log(`${t}
  22. `),t}async function Ys(e="npm"){let t="";try{let{stdout:r=""}=await X`${e} config get registry`;t=r.trim()}catch(r){let{stdout:n=""}=await X`${e} config get npmRegistryServer`;t=n.trim()}for(let r in P.registries)if(P.registries[r].registry===Ks("/",t))return r;return t}async function Js(e,t="npm"){if(!P.registries[e]){console.log(`
  23. ${(0,k.red)("Unknown")} registry: ${(0,k.yellow)(e)}`);return}await X`${t} config set registry ${P.registries[e].registry}`}async function Zs(e){let t=+new Date;return Ae(e).then(()=>{let r=+new Date-t,n=`${r} ms`;return r<500?(0,k.green)(n):r<1e3?(0,k.yellow)(n):(0,k.red)(n)}).catch(r=>(0,k.red)("Timeout"))}async function Qs(){return await Promise.all(Object.keys(P.registries).map(async e=>{let t=await Zs(P.registries[e].registry),r=` ${Un(e)} ${t}`;console.log(r)}))}async function Hc(e="npm"){P.registries=await vt(),P.pkgManager=e;let t=async()=>{await le()};j.command("ls","List all the registries").action(t),j.command("use [registry]","Change registry").option("-l, --local","set '.npmrc' for local").action(async(r,n)=>{if(!r)console.log(`
  24. nnrm use <registry>
  25. Example: ${(0,k.yellow)("nnrm use taobao")}
  26. `);else if(n.l||n.local){let o=`registry=${P.registries[r].registry}`;if(Vs(".npmrc")){let s=await Tt.readFile(".npmrc","utf-8");await Tt.writeFile(".npmrc",s.replace(/^registry=.*/gm,o))}else await Tt.writeFile(".npmrc",o),await le()}else await Js(r,e),await le()}),j.command("test","Show response time for all registries").action(async()=>{console.log(),await Qs(),console.log()}),j.command("add <registry> <url> [home]","Add a custom registry").action(async(r,n,o)=>{await Nn(r,n,o),P.registries=await vt(),await le()}),j.command("remove <registry>","Remove a custom registry").action(async r=>{await Bn(r),P.registries=await vt(),await le()}),j.help(),j.version(In.version),j.parse()}export{Hc as a};