@libp2p/daemon 2.0.4 → 2.0.6
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/README.md +3 -3
- package/dist/index.min.js +107 -0
- package/dist/src/index.js +0 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](http://libp2p.io/)
|
|
4
4
|
[](https://discuss.libp2p.io)
|
|
5
5
|
[](https://codecov.io/gh/libp2p/js-libp2p-daemon)
|
|
6
|
-
[](https://github.com/libp2p/js-libp2p-daemon/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
|
|
7
7
|
|
|
8
8
|
> libp2p-daemon JavaScript implementation
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
- [Specs](#specs)
|
|
14
14
|
- [Usage](#usage)
|
|
15
15
|
- [License](#license)
|
|
16
|
-
- [
|
|
16
|
+
- [Contribution](#contribution)
|
|
17
17
|
|
|
18
18
|
## Install
|
|
19
19
|
|
|
@@ -48,6 +48,6 @@ Licensed under either of
|
|
|
48
48
|
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
49
49
|
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
|
50
50
|
|
|
51
|
-
##
|
|
51
|
+
## Contribution
|
|
52
52
|
|
|
53
53
|
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDaemon = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
3
|
+
"use strict";var Libp2PDaemon=(()=>{var Wi=Object.create;var Re=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var Vi=Object.getOwnPropertyNames;var qi=Object.getPrototypeOf,Hi=Object.prototype.hasOwnProperty;var H=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});var ue=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),gt=(s,t)=>{for(var e in t)Re(s,e,{get:t[e],enumerable:!0})},Ns=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Vi(t))!Hi.call(s,r)&&r!==e&&Re(s,r,{get:()=>t[r],enumerable:!(n=Ri(t,r))||n.enumerable});return s};var Wt=(s,t,e)=>(e=s!=null?Wi(qi(s)):{},Ns(t||!s||!s.__esModule?Re(e,"default",{value:s,enumerable:!0}):e,s)),Yi=s=>Ns(Re({},"__esModule",{value:!0}),s);var rr=ue((pl,sr)=>{sr.exports=Hn;var nr=128,oa=127,aa=~oa,ca=Math.pow(2,31);function Hn(s,t,e){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw Hn.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;s>=ca;)t[e++]=s&255|nr,s/=128;for(;s&aa;)t[e++]=s&255|nr,s>>>=7;return t[e]=s|0,Hn.bytes=e-n+1,t}});var ar=ue((ml,or)=>{or.exports=Yn;var la=128,ir=127;function Yn(s,n){var e=0,n=n||0,r=0,i=n,a,c=s.length;do{if(i>=c||r>49)throw Yn.bytes=0,new RangeError("Could not decode varint");a=s[i++],e+=r<28?(a&ir)<<r:(a&ir)*Math.pow(2,r),r+=7}while(a>=la);return Yn.bytes=i-n,e}});var lr=ue((gl,cr)=>{var fa=Math.pow(2,7),ha=Math.pow(2,14),ua=Math.pow(2,21),da=Math.pow(2,28),pa=Math.pow(2,35),ma=Math.pow(2,42),ga=Math.pow(2,49),ba=Math.pow(2,56),wa=Math.pow(2,63);cr.exports=function(s){return s<fa?1:s<ha?2:s<ua?3:s<da?4:s<pa?5:s<ma?6:s<ga?7:s<ba?8:s<wa?9:10}});var Ke=ue((bl,fr)=>{fr.exports={encode:rr(),decode:ar(),encodingLength:lr()}});var Er=ue((Fl,Or)=>{"use strict";function xr(s,t){for(let e in t)Object.defineProperty(s,e,{value:t[e],enumerable:!0,configurable:!0});return s}function Ta(s,t,e){if(!s||typeof s=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return xr(s,e)}catch{e.message=s.message,e.stack=s.stack;let r=function(){};return r.prototype=Object.create(Object.getPrototypeOf(s)),xr(new r,e)}}Or.exports=Ta});var zi=ue((vh,Ni)=>{var vs=class{constructor(t,e){this.ctx=e||{},this.yargs=t,this.parse=this.parse.bind(this),this.command=this.yargs.command,this.commandDir=this.yargs.commandDir}parse(t){let e=this.yargs,n;return new Promise((r,i)=>{let a=Object.assign({},this.ctx,{resolve:r,reject:i});e.parse(t,a,function(c,m,w){return n=m,c?m.reject(c):m.resolve(w)})}).then(r=>Promise.resolve(r)).then(r=>r&&r.argv?r:{data:r,argv:n}).catch(r=>Promise.resolve(r).then(i=>i&&i.argv?Promise.reject(i):Promise.reject({error:i,argv:n})))}};Ni.exports=vs});var gc={};gt(gc,{createLibp2pServer:()=>Bi,default:()=>Ts});var Rt=H("node:net");function Ve(s){return Boolean((0,Rt.isIP)(s))}var An={};gt(An,{identity:()=>Xi});function Gi(s,t){if(s.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<s.length;r++){var i=s.charAt(r),a=i.charCodeAt(0);if(e[a]!==255)throw new TypeError(i+" is ambiguous");e[a]=r}var c=s.length,m=s.charAt(0),w=Math.log(c)/Math.log(256),p=Math.log(256)/Math.log(c);function u(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var O=0,d=0,T=0,F=x.length;T!==F&&x[T]===0;)T++,O++;for(var B=(F-T)*p+1>>>0,U=new Uint8Array(B);T!==F;){for(var W=x[T],ft=0,Z=B-1;(W!==0||ft<d)&&Z!==-1;Z--,ft++)W+=256*U[Z]>>>0,U[Z]=W%c>>>0,W=W/c>>>0;if(W!==0)throw new Error("Non-zero carry");d=ft,T++}for(var ht=B-d;ht!==B&&U[ht]===0;)ht++;for(var Ot=m.repeat(O);ht<B;++ht)Ot+=s.charAt(U[ht]);return Ot}function g(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var O=0;if(x[O]!==" "){for(var d=0,T=0;x[O]===m;)d++,O++;for(var F=(x.length-O)*w+1>>>0,B=new Uint8Array(F);x[O];){var U=e[x.charCodeAt(O)];if(U===255)return;for(var W=0,ft=F-1;(U!==0||W<T)&&ft!==-1;ft--,W++)U+=c*B[ft]>>>0,B[ft]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");T=W,O++}if(x[O]!==" "){for(var Z=F-T;Z!==F&&B[Z]===0;)Z++;for(var ht=new Uint8Array(d+(F-Z)),Ot=d;Z!==F;)ht[Ot++]=B[Z++];return ht}}}function y(x){var O=g(x);if(O)return O;throw new Error(`Non-${t} character`)}return{encode:u,decodeUnsafe:g,decode:y}}var Ki=Gi,Ji=Ki,zs=Ji;var Oc=new Uint8Array(0);var Us=(s,t)=>{if(s===t)return!0;if(s.byteLength!==t.byteLength)return!1;for(let e=0;e<s.byteLength;e++)if(s[e]!==t[e])return!1;return!0},Et=s=>{if(s instanceof Uint8Array&&s.constructor.name==="Uint8Array")return s;if(s instanceof ArrayBuffer)return new Uint8Array(s);if(ArrayBuffer.isView(s))return new Uint8Array(s.buffer,s.byteOffset,s.byteLength);throw new Error("Unknown type, must be binary type")};var Fs=s=>new TextEncoder().encode(s),Ds=s=>new TextDecoder().decode(s);var On=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},En=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Bs(this,t)}},_n=class{constructor(t){this.decoders=t}or(t){return Bs(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Bs=(s,t)=>new _n({...s.decoders||{[s.prefix]:s},...t.decoders||{[t.prefix]:t}}),Cn=class{constructor(t,e,n,r){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=r,this.encoder=new On(t,e,n),this.decoder=new En(t,e,r)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},de=({name:s,prefix:t,encode:e,decode:n})=>new Cn(s,t,e,n),Vt=({prefix:s,name:t,alphabet:e})=>{let{encode:n,decode:r}=zs(e,t);return de({prefix:s,name:t,encode:n,decode:i=>Et(r(i))})},Qi=(s,t,e,n)=>{let r={};for(let p=0;p<t.length;++p)r[t[p]]=p;let i=s.length;for(;s[i-1]==="=";)--i;let a=new Uint8Array(i*e/8|0),c=0,m=0,w=0;for(let p=0;p<i;++p){let u=r[s[p]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<e|u,c+=e,c>=8&&(c-=8,a[w++]=255&m>>c)}if(c>=e||255&m<<8-c)throw new SyntaxError("Unexpected end of data");return a},Zi=(s,t,e)=>{let n=t[t.length-1]==="=",r=(1<<e)-1,i="",a=0,c=0;for(let m=0;m<s.length;++m)for(c=c<<8|s[m],a+=8;a>e;)a-=e,i+=t[r&c>>a];if(a&&(i+=t[r&c<<e-a]),n)for(;i.length*e&7;)i+="=";return i},nt=({name:s,prefix:t,bitsPerChar:e,alphabet:n})=>de({prefix:t,name:s,encode(r){return Zi(r,n,e)},decode(r){return Qi(r,n,e,s)}});var Xi=de({prefix:"\0",name:"identity",encode:s=>Ds(s),decode:s=>Fs(s)});var Sn={};gt(Sn,{base2:()=>ki});var ki=nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var jn={};gt(jn,{base8:()=>to});var to=nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var vn={};gt(vn,{base10:()=>eo});var eo=Vt({prefix:"9",name:"base10",alphabet:"0123456789"});var Pn={};gt(Pn,{base16:()=>no,base16upper:()=>so});var no=nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),so=nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mn={};gt(Mn,{base32:()=>Ft,base32hex:()=>ao,base32hexpad:()=>lo,base32hexpadupper:()=>fo,base32hexupper:()=>co,base32pad:()=>io,base32padupper:()=>oo,base32upper:()=>ro,base32z:()=>ho});var Ft=nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ro=nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),io=nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oo=nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ao=nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),co=nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lo=nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fo=nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ho=nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var In={};gt(In,{base36:()=>uo,base36upper:()=>po});var uo=Vt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),po=Vt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $n={};gt($n,{base58btc:()=>pt,base58flickr:()=>mo});var pt=Vt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mo=Vt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Tn={};gt(Tn,{base64:()=>go,base64pad:()=>bo,base64url:()=>wo,base64urlpad:()=>yo});var go=nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bo=nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wo=nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yo=nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Nn={};gt(Nn,{base256emoji:()=>Co});var Ws=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),xo=Ws.reduce((s,t,e)=>(s[e]=t,s),[]),Oo=Ws.reduce((s,t,e)=>(s[t.codePointAt(0)]=e,s),[]);function Eo(s){return s.reduce((t,e)=>(t+=xo[e],t),"")}function _o(s){let t=[];for(let e of s){let n=Oo[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Co=de({prefix:"\u{1F680}",name:"base256emoji",encode:Eo,decode:_o});var Ln={};gt(Ln,{sha256:()=>Vo,sha512:()=>qo});var Dn=Wt(H("crypto"),1);var Ao=qs,Rs=128,So=127,jo=~So,vo=Math.pow(2,31);function qs(s,t,e){t=t||[],e=e||0;for(var n=e;s>=vo;)t[e++]=s&255|Rs,s/=128;for(;s&jo;)t[e++]=s&255|Rs,s>>>=7;return t[e]=s|0,qs.bytes=e-n+1,t}var Po=zn,Mo=128,Vs=127;function zn(s,n){var e=0,n=n||0,r=0,i=n,a,c=s.length;do{if(i>=c)throw zn.bytes=0,new RangeError("Could not decode varint");a=s[i++],e+=r<28?(a&Vs)<<r:(a&Vs)*Math.pow(2,r),r+=7}while(a>=Mo);return zn.bytes=i-n,e}var Io=Math.pow(2,7),$o=Math.pow(2,14),To=Math.pow(2,21),No=Math.pow(2,28),zo=Math.pow(2,35),Uo=Math.pow(2,42),Fo=Math.pow(2,49),Do=Math.pow(2,56),Lo=Math.pow(2,63),Bo=function(s){return s<Io?1:s<$o?2:s<To?3:s<No?4:s<zo?5:s<Uo?6:s<Fo?7:s<Do?8:s<Lo?9:10},Wo={encode:Ao,decode:Po,encodingLength:Bo},Ro=Wo,ve=Ro;var Pe=(s,t=0)=>[ve.decode(s,t),ve.decode.bytes],pe=(s,t,e=0)=>(ve.encode(s,t,e),t),me=s=>ve.encodingLength(s);var Xt=(s,t)=>{let e=t.byteLength,n=me(s),r=n+me(e),i=new Uint8Array(r+e);return pe(s,i,0),pe(e,i,n),i.set(t,r),new ge(s,e,t,i)},He=s=>{let t=Et(s),[e,n]=Pe(t),[r,i]=Pe(t.subarray(n)),a=t.subarray(n+i);if(a.byteLength!==r)throw new Error("Incorrect length");return new ge(e,r,a,t)},Hs=(s,t)=>{if(s===t)return!0;{let e=t;return s.code===e.code&&s.size===e.size&&e.bytes instanceof Uint8Array&&Us(s.bytes,e.bytes)}},ge=class{constructor(t,e,n,r){this.code=t,this.size=e,this.digest=n,this.bytes=r}};var Fn=({name:s,code:t,encode:e})=>new Un(s,t,e),Un=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Xt(this.code,e):e.then(n=>Xt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Vo=Fn({name:"sha2-256",code:18,encode:s=>Et(Dn.default.createHash("sha256").update(s).digest())}),qo=Fn({name:"sha2-512",code:19,encode:s=>Et(Dn.default.createHash("sha512").update(s).digest())});var Bn={};gt(Bn,{identity:()=>Go});var Gs=0,Ho="identity",Ks=Et,Yo=s=>Xt(Gs,Ks(s)),Go={code:Gs,name:Ho,encode:Ks,digest:Yo};var Vc=new TextEncoder,qc=new TextDecoder;var Js=(s,t)=>{let{bytes:e,version:n}=s;switch(n){case 0:return Zo(e,Wn(s),t||pt.encoder);default:return Xo(e,Wn(s),t||Ft.encoder)}};var Qs=new WeakMap,Wn=s=>{let t=Qs.get(s);if(t==null){let e=new Map;return Qs.set(s,e),e}return t},Q=class{constructor(t,e,n,r){this.code=e,this.version=t,this.multihash=n,this.bytes=r,this["/"]=r}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==Me)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==ko)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Q.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Xt(t,e);return Q.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return Q.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Hs(t.multihash,n.multihash)}toString(t){return Js(this,t)}toJSON(){return{"/":Js(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof Q)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:r,multihash:i,bytes:a}=e;return new Q(n,r,i,a||Zs(n,r,i.bytes))}else if(e[ta]===!0){let{version:n,multihash:r,code:i}=e,a=He(r);return Q.create(n,i,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Me)throw new Error(`Version 0 CID must use dag-pb (code: ${Me}) block encoding`);return new Q(t,e,n,n.bytes)}case 1:{let r=Zs(t,e,n.bytes);return new Q(t,e,n,r)}default:throw new Error("Invalid version")}}static createV0(t){return Q.create(0,Me,t)}static createV1(t,e){return Q.create(1,t,e)}static decode(t){let[e,n]=Q.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=Q.inspectBytes(t),n=e.size-e.multihashSize,r=Et(t.subarray(n,n+e.multihashSize));if(r.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=r.subarray(e.multihashSize-e.digestSize),a=new ge(e.multihashCode,e.digestSize,i,r);return[e.version===0?Q.createV0(a):Q.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[u,g]=Pe(t.subarray(e));return e+=g,u},r=n(),i=Me;if(r===18?(r=0,e=0):i=n(),r!==0&&r!==1)throw new RangeError(`Invalid CID version ${r}`);let a=e,c=n(),m=n(),w=e+m,p=w-a;return{version:r,codec:i,multihashCode:c,digestSize:m,multihashSize:p,size:w}}static parse(t,e){let[n,r]=Qo(t,e),i=Q.decode(r);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Wn(i).set(n,t),i}},Qo=(s,t)=>{switch(s[0]){case"Q":{let e=t||pt;return[pt.prefix,e.decode(`${pt.prefix}${s}`)]}case pt.prefix:{let e=t||pt;return[pt.prefix,e.decode(s)]}case Ft.prefix:{let e=t||Ft;return[Ft.prefix,e.decode(s)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[s[0],t.decode(s)]}}},Zo=(s,t,e)=>{let{prefix:n}=e;if(n!==pt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let r=t.get(n);if(r==null){let i=e.encode(s).slice(1);return t.set(n,i),i}else return r},Xo=(s,t,e)=>{let{prefix:n}=e,r=t.get(n);if(r==null){let i=e.encode(s);return t.set(n,i),i}else return r},Me=112,ko=18,Zs=(s,t,e)=>{let n=me(s),r=n+me(t),i=new Uint8Array(r+e.byteLength);return pe(s,i,0),pe(t,i,n),i.set(e,r),i},ta=Symbol.for("@ipld/js-cid/CID");var Ie={...An,...Sn,...jn,...vn,...Pn,...Mn,...In,...$n,...Tn,...Nn},tl={...Ln,...Bn};function we(s){return globalThis.Buffer!=null?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):s}function Ye(s=0){return globalThis.Buffer?.allocUnsafe!=null?we(globalThis.Buffer.allocUnsafe(s)):new Uint8Array(s)}function ks(s,t,e,n){return{name:s,prefix:t,encoder:{name:s,prefix:t,encode:e},decoder:{decode:n}}}var Xs=ks("utf8","u",s=>"u"+new TextDecoder("utf8").decode(s),s=>new TextEncoder().encode(s.substring(1))),Rn=ks("ascii","a",s=>{let t="a";for(let e=0;e<s.length;e++)t+=String.fromCharCode(s[e]);return t},s=>{s=s.substring(1);let t=Ye(s.length);for(let e=0;e<s.length;e++)t[e]=s.charCodeAt(e);return t}),ea={utf8:Xs,"utf-8":Xs,hex:Ie.base16,latin1:Rn,ascii:Rn,binary:Rn,...Ie},Ge=ea;function mt(s,t="utf8"){let e=Ge[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(s.buffer,s.byteOffset,s.byteLength).toString("utf8"):e.encoder.encode(s).substring(1)}var tr=Rt.isIPv4,na=Rt.isIPv6,Vn=function(s){let t=0;if(s=s.toString().trim(),tr(s)){let e=new Uint8Array(t+4);return s.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(na(s)){let e=s.split(":",8),n;for(n=0;n<e.length;n++){let i=tr(e[n]),a;i&&(a=Vn(e[n]),e[n]=mt(a.slice(0,2),"base16")),a!=null&&++n<8&&e.splice(n,0,mt(a.slice(2,4),"base16"))}if(e[0]==="")for(;e.length<8;)e.unshift("0");else if(e[e.length-1]==="")for(;e.length<8;)e.push("0");else if(e.length<8){for(n=0;n<e.length&&e[n]!=="";n++);let i=[n,1];for(n=9-e.length;n>0;n--)i.push("0");e.splice.apply(e,i)}let r=new Uint8Array(t+16);for(n=0;n<e.length;n++){let i=parseInt(e[n],16);r[t++]=i>>8&255,r[t++]=i&255}return r}throw new Error("invalid ip address")},er=function(s,t=0,e){t=~~t,e=e??s.length-t;let n=new DataView(s.buffer);if(e===4){let r=[];for(let i=0;i<e;i++)r.push(s[t+i]);return r.join(".")}if(e===16){let r=[];for(let i=0;i<e;i+=2)r.push(n.getUint16(t+i).toString(16));return r.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var $e={},qn={},ra=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];ra.forEach(s=>{let t=ia(...s);qn[t.code]=t,$e[t.name]=t});function ia(s,t,e,n,r){return{code:s,size:t,name:e,resolvable:Boolean(n),path:Boolean(r)}}function k(s){if(typeof s=="number"){if(qn[s]!=null)return qn[s];throw new Error(`no protocol with code: ${s}`)}else if(typeof s=="string"){if($e[s]!=null)return $e[s];throw new Error(`no protocol with name: ${s}`)}throw new Error(`invalid protocol id type: ${typeof s}`)}var $t=Wt(Ke(),1);function Gn(s,t="utf8"){let e=Ge[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?we(globalThis.Buffer.from(s,"utf-8")):e.decoder.decode(`${e.prefix}${s}`)}function Dt(s,t){t==null&&(t=s.reduce((r,i)=>r+i.length,0));let e=Ye(t),n=0;for(let r of s)e.set(r,n),n+=r.length;return we(e)}function mr(s,t){switch(k(s).code){case 4:case 41:return xa(t);case 42:return dr(t);case 6:case 273:case 33:case 132:return br(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return dr(t);case 421:return Ca(t);case 444:return pr(t);case 445:return pr(t);case 466:return _a(t);default:return mt(t,"base16")}}function gr(s,t){switch(k(s).code){case 4:return hr(t);case 41:return hr(t);case 42:return ur(t);case 6:case 273:case 33:case 132:return Jn(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return ur(t);case 421:return Oa(t);case 444:return Aa(t);case 445:return Sa(t);case 466:return Ea(t);default:return Gn(t,"base16")}}var Kn=Object.values(Ie).map(s=>s.decoder),ya=function(){let s=Kn[0].or(Kn[1]);return Kn.slice(2).forEach(t=>s=s.or(t)),s}();function hr(s){if(!Ve(s))throw new Error("invalid ip address");return Vn(s)}function xa(s){let t=er(s,0,s.length);if(t==null)throw new Error("ipBuff is required");if(!Ve(t))throw new Error("invalid ip address");return t}function Jn(s){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,s),new Uint8Array(t)}function br(s){return new DataView(s.buffer).getUint16(s.byteOffset)}function ur(s){let t=Gn(s),e=Uint8Array.from($t.default.encode(t.length));return Dt([e,t],e.length+t.length)}function dr(s){let t=$t.default.decode(s);if(s=s.slice($t.default.decode.bytes),s.length!==t)throw new Error("inconsistent lengths");return mt(s)}function Oa(s){let t;s[0]==="Q"||s[0]==="1"?t=He(pt.decode(`z${s}`)).bytes:t=Q.parse(s).multihash.bytes;let e=Uint8Array.from($t.default.encode(t.length));return Dt([e,t],e.length+t.length)}function Ea(s){let t=ya.decode(s),e=Uint8Array.from($t.default.encode(t.length));return Dt([e,t],e.length+t.length)}function _a(s){let t=$t.default.decode(s),e=s.slice($t.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+mt(e,"base64url")}function Ca(s){let t=$t.default.decode(s),e=s.slice($t.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return mt(e,"base58btc")}function Aa(s){let t=s.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let e=Ft.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let r=Jn(n);return Dt([e,r],e.length+r.length)}function Sa(s){let t=s.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let e=Ft.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let r=Jn(n);return Dt([e,r],e.length+r.length)}function pr(s){let t=s.slice(0,s.length-2),e=s.slice(s.length-2),n=mt(t,"base32"),r=br(e);return`${n}:${r}`}var ye=Wt(Ke(),1);function ja(s){let t=[],e=s.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let r=e[n],i=k(r);if(i.size===0){t.push([r]);continue}if(n++,n>=e.length)throw yr("invalid address: "+s);if(i.path===!0){t.push([r,ts(e.slice(n).join("/"))]);break}t.push([r,e[n]])}return t}function va(s){let t=[];return s.map(e=>{let n=Ze(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),ts(t.join("/"))}function Pa(s){return s.map(t=>{Array.isArray(t)||(t=[t]);let e=Ze(t);return t.length>1?[e.code,gr(e.code,t[1])]:[e.code]})}function Qn(s){return s.map(t=>{let e=Ze(t);return t[1]!=null?[e.code,mr(e.code,t[1])]:[e.code]})}function Zn(s){return Qe(Dt(s.map(t=>{let e=Ze(t),n=Uint8Array.from(ye.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=Dt([n,t[1]])),n})))}function Xn(s,t){return s.size>0?s.size/8:s.size===0?0:ye.default.decode(t)+(ye.default.decode.bytes??0)}function Je(s){let t=[],e=0;for(;e<s.length;){let n=ye.default.decode(s,e),r=ye.default.decode.bytes??0,i=k(n),a=Xn(i,s.slice(e+r));if(a===0){t.push([n]),e+=r;continue}let c=s.slice(e+r,e+r+a);if(e+=a+r,e>s.length)throw yr("Invalid address Uint8Array: "+mt(s,"base16"));t.push([n,c])}return t}function kn(s){let t=Je(s),e=Qn(t);return va(e)}function Ma(s){s=ts(s);let t=ja(s),e=Pa(t);return Zn(e)}function wr(s){return Ma(s)}function Qe(s){let t=Ia(s);if(t!=null)throw t;return Uint8Array.from(s)}function Ia(s){try{Je(s)}catch(t){return t}}function ts(s){return"/"+s.trim().split("/").filter(t=>t).join("/")}function yr(s){return new Error("Error parsing address: "+s)}function Ze(s){return k(s[0])}var ns=Wt(Ke(),1);var Ar=Wt(Er(),1);function _r(s,t){if(s===t)return!0;if(s.byteLength!==t.byteLength)return!1;for(let e=0;e<s.byteLength;e++)if(s[e]!==t[e])return!1;return!0}var xe=function(s,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!n:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(s):n?n.value:t.get(s)},es=function(s,t,e,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!r:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(s,e):r?r.value=e:t.set(s,e),e},Te,Ne,ze,Cr,Na=Symbol.for("nodejs.util.inspect.custom"),za=[k("dns").code,k("dns4").code,k("dns6").code,k("dnsaddr").code],Ua=new Map,Sr=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Fa(s){return Boolean(s?.[Sr])}var Lt=class{constructor(t){if(Te.set(this,void 0),Ne.set(this,void 0),ze.set(this,void 0),this[Cr]=!0,t==null&&(t=""),t instanceof Uint8Array)this.bytes=Qe(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=wr(t)}else if(Fa(t))this.bytes=Qe(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return xe(this,Te,"f")==null&&es(this,Te,kn(this.bytes),"f"),xe(this,Te,"f")}toJSON(){return this.toString()}toOptions(){let t,e,n,r,i="",a=k("tcp"),c=k("udp"),m=k("ip4"),w=k("ip6"),p=k("dns6"),u=k("ip6zone");for(let[y,x]of this.stringTuples())y===u.code&&(i=`%${x??""}`),za.includes(y)&&(e=a.name,r=443,n=`${x??""}${i}`,t=y===p.code?6:4),(y===a.code||y===c.code)&&(e=k(y).name,r=parseInt(x??"")),(y===m.code||y===w.code)&&(e=k(y).name,n=`${x??""}${i}`,t=y===w.code?6:4);if(t==null||e==null||n==null||r==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:r}}protos(){return this.protoCodes().map(t=>Object.assign({},k(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let r=ns.default.decode(e,n),i=ns.default.decode.bytes??0,a=k(r),c=Xn(a,e.slice(n+i));n+=c+i,t.push(r)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return xe(this,Ne,"f")==null&&es(this,Ne,Je(this.bytes),"f"),xe(this,Ne,"f")}stringTuples(){return xe(this,ze,"f")==null&&es(this,ze,Qn(this.tuples()),"f"),xe(this,ze,"f")}encapsulate(t){return t=new Lt(t),new Lt(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),r=n.lastIndexOf(e);if(r<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new Lt(n.slice(0,r))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new Lt(Zn(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===$e.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?mt(pt.decode(`z${n}`),"base58btc"):mt(Q.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(e=>k(e[0]).path===!0)[0][1],t==null&&(t=null)}catch{t=null}return t}equals(t){return _r(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(i=>i.resolvable);if(e==null)return[this];let n=Ua.get(e.name);if(n==null)throw(0,Ar.default)(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(i=>new Lt(i))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let e=(t??this).protos();return!(e.length!==2||e[0].code!==4&&e[0].code!==41||e[1].code!==6&&e[1].code!==273)}[(Te=new WeakMap,Ne=new WeakMap,ze=new WeakMap,Cr=Sr,Na)](){return`Multiaddr(${kn(this.bytes)})`}};function jr(s){return new Lt(s)}var on=H("assert");var Da={right:Va,center:qa},La=0,Xe=1,Ba=2,ke=3,ss=class{constructor(t){var e;this.width=t.width,this.wrap=(e=t.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...t){let e=this.div(...t);e.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);let e=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){let e=t.split(`
|
|
4
|
+
`).map(r=>r.split(" ")),n=0;return e.forEach(r=>{r.length>1&&bt.stringWidth(r[0])>n&&(n=Math.min(Math.floor(this.width*.5),bt.stringWidth(r[0])))}),e.forEach(r=>{this.div(...r.map((i,a)=>({text:i.trim(),padding:this.measurePadding(i),width:a===0&&r.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=bt.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(e=>!e.hidden).map(e=>e.text).join(`
|
|
5
|
+
`)}rowToString(t,e){return this.rasterize(t).forEach((n,r)=>{let i="";n.forEach((a,c)=>{let{width:m}=t[c],w=this.negatePadding(t[c]),p=a;if(w>bt.stringWidth(a)&&(p+=" ".repeat(w-bt.stringWidth(a))),t[c].align&&t[c].align!=="left"&&this.wrap){let g=Da[t[c].align];p=g(p,w),bt.stringWidth(p)<w&&(p+=" ".repeat((m||0)-bt.stringWidth(p)-1))}let u=t[c].padding||[0,0,0,0];u[ke]&&(i+=" ".repeat(u[ke])),i+=vr(t[c],p,"| "),i+=p,i+=vr(t[c],p," |"),u[Xe]&&(i+=" ".repeat(u[Xe])),r===0&&e.length>0&&(i=this.renderInline(i,e[e.length-1]))}),e.push({text:i.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),r=n?n[0].length:0,i=e.text,a=bt.stringWidth(i.trimRight());return e.span?this.wrap?r<a?t:(e.hidden=!0,i.trimRight()+" ".repeat(r-a)+t.trimLeft()):(e.hidden=!0,i+t):t}rasterize(t){let e=[],n=this.columnWidths(t),r;return t.forEach((i,a)=>{i.width=n[a],this.wrap?r=bt.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
|
|
6
|
+
`):r=i.text.split(`
|
|
7
|
+
`),i.border&&(r.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),r.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(r.unshift(...new Array(i.padding[La]||0).fill("")),r.push(...new Array(i.padding[Ba]||0).fill(""))),r.forEach((c,m)=>{e[m]||e.push([]);let w=e[m];for(let p=0;p<a;p++)w[p]===void 0&&w.push("");w.push(c)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[ke]||0)+(t.padding[Xe]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||bt.stringWidth(a.text));let e=t.length,n=this.width,r=t.map(a=>{if(a.width)return e--,n-=a.width,a.width}),i=e?Math.floor(n/e):0;return r.map((a,c)=>a===void 0?Math.max(i,Wa(t[c])):a)}};function vr(s,t,e){return s.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function Wa(s){let t=s.padding||[],e=1+(t[ke]||0)+(t[Xe]||0);return s.border?e+4:e}function Ra(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Va(s,t){s=s.trim();let e=bt.stringWidth(s);return e<t?" ".repeat(t-e)+s:s}function qa(s,t){s=s.trim();let e=bt.stringWidth(s);return e>=t?s:" ".repeat(t-e>>1)+s}var bt;function Pr(s,t){return bt=t,new ss({width:s?.width||Ra(),wrap:s?.wrap})}var Mr=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function rs(s){return s.replace(Mr,"")}function Ir(s,t){let[e,n]=s.match(Mr)||["",""];s=rs(s);let r="";for(let i=0;i<s.length;i++)i!==0&&i%t===0&&(r+=`
|
|
8
|
+
`),r+=s.charAt(i);return e&&n&&(r=`${e}${r}${n}`),r}function is(s){return Pr(s,{stringWidth:t=>[...t].length,stripAnsi:rs,wrap:Ir})}var Oe=H("path"),tn=H("fs");function $r(s,t){let e=(0,Oe.resolve)(".",s),n;for((0,tn.statSync)(e).isDirectory()||(e=(0,Oe.dirname)(e));;){if(n=t(e,(0,tn.readdirSync)(e)),n)return(0,Oe.resolve)(e,n);if(e=(0,Oe.dirname)(n=e),n===e)break}}var Kr=H("util"),Jr=H("fs"),Qr=H("url");var Fr=H("util"),rn=H("path");function kt(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let e="",n=!1,r=s.match(/^-+/);for(let i=r?r[0].length:0;i<s.length;i++){let a=s.charAt(i);n&&(n=!1,a=a.toUpperCase()),i!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(e+=a)}return e}}function en(s,t){let e=s.toLowerCase();t=t||"-";let n="";for(let r=0;r<s.length;r++){let i=e.charAt(r),a=s.charAt(r);i!==a&&r>0?n+=`${t}${e.charAt(r)}`:n+=a}return n}function nn(s){return s==null?!1:typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^0[^.]/.test(s)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Tr(s){if(Array.isArray(s))return s.map(a=>typeof a!="string"?a+"":a);s=s.trim();let t=0,e=null,n=null,r=null,i=[];for(let a=0;a<s.length;a++){if(e=n,n=s.charAt(a),n===" "&&!r){e!==" "&&t++;continue}n===r?r=null:(n==="'"||n==='"')&&!r&&(r=n),i[t]||(i[t]=""),i[t]+=n}return i}var _t;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(_t||(_t={}));var Bt,sn=class{constructor(t){Bt=t}parse(t,e){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),r=Tr(t),i=typeof t=="string",a=Ha(Object.assign(Object.create(null),n.alias)),c=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),m=Object.assign(Object.create(null),n.default),w=n.configObjects||[],p=n.envPrefix,u=c["populate--"],g=u?"--":"_",y=Object.create(null),x=Object.create(null),O=n.__||Bt.format,d={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},T=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,F=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let h=typeof l=="object"?l.key:l,E=Object.keys(l).map(function(b){return{boolean:"bools",string:"strings",number:"numbers"}[b]}).filter(Boolean).pop();E&&(d[E][h]=!0),d.arrays[h]=!0,d.keys.push(h)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){d.bools[l]=!0,d.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){d.strings[l]=!0,d.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){d.numbers[l]=!0,d.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){d.counts[l]=!0,d.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){d.normalize[l]=!0,d.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,h])=>{typeof h=="number"&&(d.nargs[l]=h,d.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,h])=>{typeof h=="function"&&(d.coercions[l]=h,d.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){d.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,h])=>{(typeof h=="boolean"||typeof h=="function")&&(d.configs[l]=h)})),Zt(n.key,a,n.default,d.arrays),Object.keys(m).forEach(function(l){(d.aliases[l]||[]).forEach(function(h){m[h]=m[l]})});let B=null;We();let U=[],W=Object.assign(Object.create(null),{_:[]}),ft={};for(let l=0;l<r.length;l++){let h=r[l],E=h.replace(/^-{3,}/,"---"),b,f,v,C,I,ct;if(h!=="--"&&/^-/.test(h)&&tt(h))Z(h);else if(E.match(/^---+(=|$)/)){Z(h);continue}else if(h.match(/^--.+=/)||!c["short-option-groups"]&&h.match(/^-.+=/))C=h.match(/^--?([^=]+)=([\s\S]*)$/),C!==null&&Array.isArray(C)&&C.length>=3&&(N(C[1],d.arrays)?l=Ot(l,C[1],r,C[2]):N(C[1],d.nargs)!==!1?l=ht(l,C[1],r,C[2]):Y(C[1],C[2],!0));else if(h.match(F)&&c["boolean-negation"])C=h.match(F),C!==null&&Array.isArray(C)&&C.length>=2&&(f=C[1],Y(f,N(f,d.arrays)?[!1]:!1));else if(h.match(/^--.+/)||!c["short-option-groups"]&&h.match(/^-[^-]+/))C=h.match(/^--?(.+)/),C!==null&&Array.isArray(C)&&C.length>=2&&(f=C[1],N(f,d.arrays)?l=Ot(l,f,r):N(f,d.nargs)!==!1?l=ht(l,f,r):(I=r[l+1],I!==void 0&&(!I.match(/^-/)||I.match(T))&&!N(f,d.bools)&&!N(f,d.counts)||/^(true|false)$/.test(I)?(Y(f,I),l++):Y(f,et(f))));else if(h.match(/^-.\..+=/))C=h.match(/^-([^=]+)=([\s\S]*)$/),C!==null&&Array.isArray(C)&&C.length>=3&&Y(C[1],C[2]);else if(h.match(/^-.\..+/)&&!h.match(T))I=r[l+1],C=h.match(/^-(.\..+)/),C!==null&&Array.isArray(C)&&C.length>=2&&(f=C[1],I!==void 0&&!I.match(/^-/)&&!N(f,d.bools)&&!N(f,d.counts)?(Y(f,I),l++):Y(f,et(f)));else if(h.match(/^-[^-]+/)&&!h.match(T)){v=h.slice(1,-1).split(""),b=!1;for(let ut=0;ut<v.length;ut++){if(I=h.slice(ut+2),v[ut+1]&&v[ut+1]==="="){ct=h.slice(ut+3),f=v[ut],N(f,d.arrays)?l=Ot(l,f,r,ct):N(f,d.nargs)!==!1?l=ht(l,f,r,ct):Y(f,ct),b=!0;break}if(I==="-"){Y(v[ut],I);continue}if(/[A-Za-z]/.test(v[ut])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(I)&&N(I,d.bools)===!1){Y(v[ut],I),b=!0;break}if(v[ut+1]&&v[ut+1].match(/\W/)){Y(v[ut],I),b=!0;break}else Y(v[ut],et(v[ut]))}f=h.slice(-1)[0],!b&&f!=="-"&&(N(f,d.arrays)?l=Ot(l,f,r):N(f,d.nargs)!==!1?l=ht(l,f,r):(I=r[l+1],I!==void 0&&(!/^(-|--)[^-]/.test(I)||I.match(T))&&!N(f,d.bools)&&!N(f,d.counts)||/^(true|false)$/.test(I)?(Y(f,I),l++):Y(f,et(f))))}else if(h.match(/^-[0-9]$/)&&h.match(T)&&N(h.slice(1),d.bools))f=h.slice(1),Y(f,et(f));else if(h==="--"){U=r.slice(l+1);break}else if(c["halt-at-non-option"]){U=r.slice(l);break}else Z(h)}V(W,!0),V(W,!1),L(W),ot(),X(W,d.aliases,m,!0),at(W),c["set-placeholder-key"]&&Qt(W),Object.keys(d.counts).forEach(function(l){zt(W,l.split("."))||Y(l,0)}),u&&U.length&&(W[g]=[]),U.forEach(function(l){W[g].push(l)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(W).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete W[l]}),c["strip-aliased"]&&[].concat(...Object.keys(a).map(l=>a[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete W[l.split(".").map(h=>kt(h)).join(".")],delete W[l]});function Z(l){let h=j("_",l);(typeof h=="string"||typeof h=="number")&&W._.push(h)}function ht(l,h,E,b){let f,v=N(h,d.nargs);if(v=typeof v!="number"||isNaN(v)?1:v,v===0)return Pt(b)||(B=Error(O("Argument unexpected for: %s",h))),Y(h,et(h)),l;let C=Pt(b)?0:1;if(c["nargs-eats-options"])E.length-(l+1)+C<v&&(B=Error(O("Not enough arguments following: %s",h))),C=v;else{for(f=l+1;f<E.length&&(!E[f].match(/^-[^0-9]/)||E[f].match(T)||tt(E[f]));f++)C++;C<v&&(B=Error(O("Not enough arguments following: %s",h)))}let I=Math.min(C,v);for(!Pt(b)&&I>0&&(Y(h,b),I--),f=l+1;f<I+l+1;f++)Y(h,E[f]);return l+I}function Ot(l,h,E,b){let f=[],v=b||E[l+1],C=N(h,d.nargs);if(N(h,d.bools)&&!/^(true|false)$/.test(v))f.push(!0);else if(Pt(v)||Pt(b)&&/^-/.test(v)&&!T.test(v)&&!tt(v)){if(m[h]!==void 0){let I=m[h];f=Array.isArray(I)?I:[I]}}else{Pt(b)||f.push(_(h,b,!0));for(let I=l+1;I<E.length&&!(!c["greedy-arrays"]&&f.length>0||C&&typeof C=="number"&&f.length>=C||(v=E[I],/^-/.test(v)&&!T.test(v)&&!tt(v)));I++)l=I,f.push(_(h,v,i))}return typeof C=="number"&&(C&&f.length<C||isNaN(C)&&f.length===0)&&(B=Error(O("Not enough arguments following: %s",h))),Y(h,f),l}function Y(l,h,E=i){if(/-/.test(l)&&c["camel-case-expansion"]){let v=l.split(".").map(function(C){return kt(C)}).join(".");P(l,v)}let b=_(l,h,E),f=l.split(".");Ut(W,f,b),d.aliases[l]&&d.aliases[l].forEach(function(v){let C=v.split(".");Ut(W,C,b)}),f.length>1&&c["dot-notation"]&&(d.aliases[f[0]]||[]).forEach(function(v){let C=v.split("."),I=[].concat(f);I.shift(),C=C.concat(I),(d.aliases[l]||[]).includes(C.join("."))||Ut(W,C,b)}),N(l,d.normalize)&&!N(l,d.arrays)&&[l].concat(d.aliases[l]||[]).forEach(function(C){Object.defineProperty(ft,C,{enumerable:!0,get(){return h},set(I){h=typeof I=="string"?Bt.normalize(I):I}})})}function P(l,h){d.aliases[l]&&d.aliases[l].length||(d.aliases[l]=[h],y[h]=!0),d.aliases[h]&&d.aliases[h].length||P(h,l)}function _(l,h,E){E&&(h=Ya(h)),(N(l,d.bools)||N(l,d.counts))&&typeof h=="string"&&(h=h==="true");let b=Array.isArray(h)?h.map(function(f){return j(l,f)}):j(l,h);return N(l,d.counts)&&(Pt(b)||typeof b=="boolean")&&(b=os()),N(l,d.normalize)&&N(l,d.arrays)&&(Array.isArray(h)?b=h.map(f=>Bt.normalize(f)):b=Bt.normalize(h)),b}function j(l,h){return!c["parse-positional-numbers"]&&l==="_"||!N(l,d.strings)&&!N(l,d.bools)&&!Array.isArray(h)&&(nn(h)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${h}`)))||!Pt(h)&&N(l,d.numbers))&&(h=Number(h)),h}function L(l){let h=Object.create(null);X(h,d.aliases,m),Object.keys(d.configs).forEach(function(E){let b=l[E]||h[E];if(b)try{let f=null,v=Bt.resolve(Bt.cwd(),b),C=d.configs[E];if(typeof C=="function"){try{f=C(v)}catch(I){f=I}if(f instanceof Error){B=f;return}}else f=Bt.require(v);q(f)}catch(f){f.name==="PermissionDenied"?B=f:l[E]&&(B=Error(O("Invalid JSON config file: %s",b)))}})}function q(l,h){Object.keys(l).forEach(function(E){let b=l[E],f=h?h+"."+E:E;typeof b=="object"&&b!==null&&!Array.isArray(b)&&c["dot-notation"]?q(b,f):(!zt(W,f.split("."))||N(f,d.arrays)&&c["combine-arrays"])&&Y(f,b)})}function ot(){typeof w<"u"&&w.forEach(function(l){q(l)})}function V(l,h){if(typeof p>"u")return;let E=typeof p=="string"?p:"",b=Bt.env();Object.keys(b).forEach(function(f){if(E===""||f.lastIndexOf(E,0)===0){let v=f.split("__").map(function(C,I){return I===0&&(C=C.substring(E.length)),kt(C)});(h&&d.configs[v.join(".")]||!h)&&!zt(l,v)&&Y(v.join("."),b[f])}})}function at(l){let h,E=new Set;Object.keys(l).forEach(function(b){if(!E.has(b)&&(h=N(b,d.coercions),typeof h=="function"))try{let f=j(b,h(l[b]));[].concat(d.aliases[b]||[],b).forEach(v=>{E.add(v),l[v]=f})}catch(f){B=f}})}function Qt(l){return d.keys.forEach(h=>{~h.indexOf(".")||typeof l[h]>"u"&&(l[h]=void 0)}),l}function X(l,h,E,b=!1){Object.keys(E).forEach(function(f){zt(l,f.split("."))||(Ut(l,f.split("."),E[f]),b&&(x[f]=!0),(h[f]||[]).forEach(function(v){zt(l,v.split("."))||Ut(l,v.split("."),E[f])}))})}function zt(l,h){let E=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(f){E=E[f]||{}});let b=h[h.length-1];return typeof E!="object"?!1:b in E}function Ut(l,h,E){let b=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(ct){ct=Nr(ct),typeof b=="object"&&b[ct]===void 0&&(b[ct]={}),typeof b[ct]!="object"||Array.isArray(b[ct])?(Array.isArray(b[ct])?b[ct].push({}):b[ct]=[b[ct],{}],b=b[ct][b[ct].length-1]):b=b[ct]});let f=Nr(h[h.length-1]),v=N(h.join("."),d.arrays),C=Array.isArray(E),I=c["duplicate-arguments-array"];!I&&N(f,d.nargs)&&(I=!0,(!Pt(b[f])&&d.nargs[f]===1||Array.isArray(b[f])&&b[f].length===d.nargs[f])&&(b[f]=void 0)),E===os()?b[f]=os(b[f]):Array.isArray(b[f])?I&&v&&C?b[f]=c["flatten-duplicate-arrays"]?b[f].concat(E):(Array.isArray(b[f][0])?b[f]:[b[f]]).concat([E]):!I&&Boolean(v)===Boolean(C)?b[f]=E:b[f]=b[f].concat([E]):b[f]===void 0&&v?b[f]=C?E:[E]:I&&!(b[f]===void 0||N(f,d.counts)||N(f,d.bools))?b[f]=[b[f],E]:b[f]=E}function Zt(...l){l.forEach(function(h){Object.keys(h||{}).forEach(function(E){d.aliases[E]||(d.aliases[E]=[].concat(a[E]||[]),d.aliases[E].concat(E).forEach(function(b){if(/-/.test(b)&&c["camel-case-expansion"]){let f=kt(b);f!==E&&d.aliases[E].indexOf(f)===-1&&(d.aliases[E].push(f),y[f]=!0)}}),d.aliases[E].concat(E).forEach(function(b){if(b.length>1&&/[A-Z]/.test(b)&&c["camel-case-expansion"]){let f=en(b,"-");f!==E&&d.aliases[E].indexOf(f)===-1&&(d.aliases[E].push(f),y[f]=!0)}}),d.aliases[E].forEach(function(b){d.aliases[b]=[E].concat(d.aliases[E].filter(function(f){return b!==f}))}))})})}function N(l,h){let E=[].concat(d.aliases[l]||[],l),b=Object.keys(h),f=E.find(v=>b.includes(v));return f?h[f]:!1}function xn(l){let h=Object.keys(d);return[].concat(h.map(b=>d[b])).some(function(b){return Array.isArray(b)?b.includes(l):b[l]})}function $(l,...h){return[].concat(...h).some(function(b){let f=l.match(b);return f&&xn(f[1])})}function J(l){if(l.match(T)||!l.match(/^-[^-]+/))return!1;let h=!0,E,b=l.slice(1).split("");for(let f=0;f<b.length;f++){if(E=l.slice(f+2),!xn(b[f])){h=!1;break}if(b[f+1]&&b[f+1]==="="||E==="-"||/[A-Za-z]/.test(b[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(E)||b[f+1]&&b[f+1].match(/\W/))break}return h}function tt(l){return c["unknown-options-as-args"]&&R(l)}function R(l){return l=l.replace(/^-{3,}/,"--"),l.match(T)||J(l)?!1:!$(l,/^-+([^=]+?)=[\s\S]*$/,F,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function et(l){return!N(l,d.bools)&&!N(l,d.counts)&&`${l}`in m?m[l]:rt(vt(l))}function rt(l){return{[_t.BOOLEAN]:!0,[_t.STRING]:"",[_t.NUMBER]:void 0,[_t.ARRAY]:[]}[l]}function vt(l){let h=_t.BOOLEAN;return N(l,d.strings)?h=_t.STRING:N(l,d.numbers)?h=_t.NUMBER:N(l,d.bools)?h=_t.BOOLEAN:N(l,d.arrays)&&(h=_t.ARRAY),h}function Pt(l){return l===void 0}function We(){Object.keys(d.counts).find(l=>N(l,d.arrays)?(B=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):N(l,d.nargs)?(B=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign(ft,W),configuration:c,defaulted:Object.assign({},x),error:B,newAliases:Object.assign({},y)}}};function Ha(s){let t=[],e=Object.create(null),n=!0;for(Object.keys(s).forEach(function(r){t.push([].concat(s[r],r))});n;){n=!1;for(let r=0;r<t.length;r++)for(let i=r+1;i<t.length;i++)if(t[r].filter(function(c){return t[i].indexOf(c)!==-1}).length){t[r]=t[r].concat(t[i]),t.splice(i,1),n=!0;break}}return t.forEach(function(r){r=r.filter(function(a,c,m){return m.indexOf(a)===c});let i=r.pop();i!==void 0&&typeof i=="string"&&(e[i]=r)}),e}function os(s){return s!==void 0?s+1:1}function Nr(s){return s==="__proto__"?"___proto___":s}function Ya(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}var Dr=H("fs");var as,cs,ls,zr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Ur=(cs=(as=process==null?void 0:process.versions)===null||as===void 0?void 0:as.node)!==null&&cs!==void 0?cs:(ls=process==null?void 0:process.version)===null||ls===void 0?void 0:ls.slice(1);if(Ur&&Number(Ur.match(/^([^.]+)/)[1])<zr)throw Error(`yargs parser supports a minimum Node.js version of ${zr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Ga=process?process.env:{},Lr=new sn({cwd:process.cwd,env:()=>Ga,format:Fr.format,normalize:rn.normalize,resolve:rn.resolve,require:s=>{if(typeof H<"u")return H(s);if(s.match(/\.json$/))return JSON.parse((0,Dr.readFileSync)(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),Ue=function(t,e){return Lr.parse(t.slice(),e).argv};Ue.detailed=function(s,t){return Lr.parse(s.slice(),t)};Ue.camelCase=kt;Ue.decamelize=en;Ue.looksLikeNumber=nn;var Br=Ue;var It=H("path");function Ka(){return Ja()?0:1}function Ja(){return Qa()&&!process.defaultApp}function Qa(){return!!process.versions.electron}function Wr(){return process.argv[Ka()]}var G=class extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,G)}};var Ee=H("fs"),Rr=H("util"),Vr=H("path"),qr={fs:{readFileSync:Ee.readFileSync,writeFile:Ee.writeFile},format:Rr.format,resolve:Vr.resolve,exists:s=>{try{return(0,Ee.statSync)(s).isFile()}catch{return!1}}};var Mt,fs=class{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let e=t.shift(),n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Mt.format.apply(Mt.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),r=t.shift(),i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let a=r===1?e:n;this.cache[this.locale][e]&&(a=this.cache[this.locale][e][r===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();let c=[a];return~a.indexOf("%d")&&c.push(r),Mt.format.apply(Mt.format,c.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(r,i){let a=e[i+1];n+=r,typeof a<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,e=this.writeQueue[0],n=e.directory,r=e.locale,i=e.cb,a=this._resolveLocaleFile(n,r),c=JSON.stringify(this.cache[r],null,2);Mt.fs.writeFile(a,c,"utf-8",function(m){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(m)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{Mt.fs.readFileSync&&(t=JSON.parse(Mt.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=Mt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let r=Mt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(t){return Mt.exists(t)}};function Hr(s,t){Mt=t;let e=new fs(s);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}var Za=s=>Hr(s,qr),Yr=Za;var tc={},Xa="require is not supported by ESM",Gr="loading a directory of commands is not supported yet for ESM",Fe;try{Fe=(0,Qr.fileURLToPath)(tc.url)}catch{Fe=process.cwd()}var ka=Fe.substring(0,Fe.lastIndexOf("node_modules")),Zr={assert:{notStrictEqual:on.notStrictEqual,strictEqual:on.strictEqual},cliui:is,findUp:$r,getEnv:s=>process.env[s],inspect:Kr.inspect,getCallerFile:()=>{throw new G(Gr)},getProcessArgvBin:Wr,mainFilename:ka||process.cwd(),Parser:Br,path:{basename:It.basename,dirname:It.dirname,extname:It.extname,relative:It.relative,resolve:It.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,t)=>process.emitWarning(s,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Jr.readFileSync,require:()=>{throw new G(Xa)},requireDirectory:()=>{throw new G(Gr)},stringWidth:s=>[...s].length,y18n:Yr({directory:(0,It.resolve)(Fe,"../../../locales"),updateFiles:!1})};function dt(s,t,e,n){e.assert.notStrictEqual(s,t,n)}function hs(s,t){t.assert.strictEqual(typeof s,"string")}function _e(s){return Object.keys(s)}function K(s){return!!s&&!!s.then&&typeof s.then=="function"}function qt(s){let e=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,r=e.shift();if(!r)throw new Error(`No command found in: ${s}`);let i={cmd:r.replace(n,""),demanded:[],optional:[]};return e.forEach((a,c)=>{let m=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&c===e.length-1&&(m=!0),/^\[/.test(a)?i.optional.push({cmd:a.replace(n,"").split("|"),variadic:m}):i.demanded.push({cmd:a.replace(n,"").split("|"),variadic:m})}),i}var ec=["first","second","third","fourth","fifth","sixth"];function A(s,t,e){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,t]:[qt(`cmd ${s}`),t,e]}try{let r=0,[i,a,c]=n(),m=[].slice.call(a);for(;m.length&&m[m.length-1]===void 0;)m.pop();let w=c||m.length;if(w<i.demanded.length)throw new G(`Not enough arguments provided. Expected ${i.demanded.length} but received ${m.length}.`);let p=i.demanded.length+i.optional.length;if(w>p)throw new G(`Too many arguments provided. Expected max ${p} but received ${w}.`);i.demanded.forEach(u=>{let g=m.shift(),y=Xr(g);u.cmd.filter(O=>O===y||O==="*").length===0&&kr(y,u.cmd,r),r+=1}),i.optional.forEach(u=>{if(m.length===0)return;let g=m.shift(),y=Xr(g);u.cmd.filter(O=>O===y||O==="*").length===0&&kr(y,u.cmd,r),r+=1})}catch(r){console.warn(r.stack)}}function Xr(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function kr(s,t,e){throw new G(`Invalid ${ec[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${s}.`)}var an=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,r=!1){if(A("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if(typeof t[i]!="function")throw Error("middleware must be a function");let a=t[i];a.applyBeforeValidation=e,a.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let i=t;i.applyBeforeValidation=e,i.global=n,i.mutates=r,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(r=>{let i=[...n[e]||[],e];return r.option?!i.includes(r.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}};function ti(s){return s?s.map(t=>(t.applyBeforeValidation=!1,t)):[]}function te(s,t,e,n){return e.reduce((r,i)=>{if(i.applyBeforeValidation!==n)return r;if(i.mutates){if(i.applied)return r;i.applied=!0}if(K(r))return r.then(a=>Promise.all([a,i(a,t)])).then(([a,c])=>Object.assign(a,c));{let a=i(r,t);return K(a)?a.then(c=>Object.assign(r,c)):Object.assign(r,a)}},s)}function ee(s,t,e=n=>{throw n}){try{let n=nc(s)?s():s;return K(n)?n.then(r=>t(r)):t(n)}catch(n){return e(n)}}function nc(s){return typeof s=="function"}function us(s){if(typeof H>"u")return null;for(let t=0,e=Object.keys(H.cache),n;t<e.length;t++)if(n=H.cache[e[t]],n.exports===s)return n;return null}var Ce=/(^\*)|(^\$0)/,ds=class{constructor(t,e,n,r){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,r){r=r||{},typeof r.recurse!="boolean"&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=["js"]);let i=typeof r.visit=="function"?r.visit:a=>a;r.visit=(a,c,m)=>{let w=i(a,c,m);if(w){if(this.requireCache.has(c))return w;this.requireCache.add(c),this.addHandler(w)}return w},this.shim.requireDirectory({require:e,filename:n},t,r)}addHandler(t,e,n,r,i,a){let c=[],m=ti(i);if(r=r||(()=>{}),Array.isArray(t))if(sc(t))[t,...c]=t;else for(let w of t)this.addHandler(w);else if(ic(t)){let w=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(w=[].concat(w).concat(t.aliases)),this.addHandler(w,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(ei(n)){this.addHandler([t].concat(c),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let w=qt(t);c=c.map(g=>qt(g).cmd);let p=!1,u=[w.cmd].concat(c).filter(g=>Ce.test(g)?(p=!0,!1):!0);u.length===0&&p&&u.push("$0"),p&&(w.cmd=u[0],c=u.slice(1),t=t.replace(Ce,w.cmd)),c.forEach(g=>{this.aliasMap[g]=w.cmd}),e!==!1&&this.usage.command(t,e,p,c,a),this.handlers[w.cmd]={original:t,description:e,handler:r,builder:n||{},middlewares:m,deprecated:a,demanded:w.demanded,optional:w.optional},p&&(this.defaultCommand=this.handlers[w.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,r,i,a){let c=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,m=e.getInternalMethods().getContext(),w=m.commands.slice(),p=!t;t&&(m.commands.push(t),m.fullCommands.push(c.original));let u=this.applyBuilderUpdateUsageAndParse(p,c,e,n.aliases,w,r,i,a);return K(u)?u.then(g=>this.applyMiddlewareAndGetResult(p,c,g.innerArgv,m,i,g.aliases,e)):this.applyMiddlewareAndGetResult(p,c,u.innerArgv,m,i,u.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,r,i,a,c,m){let w=e.builder,p=n;if(cn(w)){n.getInternalMethods().getUsageInstance().freeze();let u=w(n.getInternalMethods().reset(r),m);if(K(u))return u.then(g=>(p=si(g)?g:n,this.parseAndUpdateUsage(t,e,p,i,a,c)))}else rc(w)&&(n.getInternalMethods().getUsageInstance().freeze(),p=n.getInternalMethods().reset(r),Object.keys(e.builder).forEach(u=>{p.option(u,w[u])}));return this.parseAndUpdateUsage(t,e,p,i,a,c)}parseAndUpdateUsage(t,e,n,r,i,a){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,e),e.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,a);return K(c)?c.then(m=>({aliases:n.parsed.aliases,innerArgv:m})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=Ce.test(e.original)?e.original.replace(Ce,"").trim():e.original,r=t.filter(i=>!Ce.test(i));return r.push(n),`$0 ${r.join(" ")}`}handleValidationAndGetResult(t,e,n,r,i,a,c,m){if(!a.getInternalMethods().getHasOutput()){let w=a.getInternalMethods().runValidation(i,m,a.parsed.error,t);n=ee(n,p=>(w(p),p))}if(e.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let w=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,w,!1,!1),n=te(n,a,c,!1),n=ee(n,p=>{let u=e.handler(p);return K(u)?u.then(()=>p):p}),t||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),K(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(p=>{try{a.getInternalMethods().getUsageInstance().fail(null,p)}catch{}})}return t||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,r,i,a,c){let m={};if(i)return n;c.getInternalMethods().getHasOutput()||(m=this.populatePositionals(e,n,r,c));let w=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),p=te(n,c,w,!0);return K(p)?p.then(u=>this.handleValidationAndGetResult(t,e,u,r,a,c,w,m)):this.handleValidationAndGetResult(t,e,p,r,a,c,w,m)}populatePositionals(t,e,n,r){e._=e._.slice(n.commands.length);let i=t.demanded.slice(0),a=t.optional.slice(0),c={};for(this.validation.positionalCount(i.length,e._.length);i.length;){let m=i.shift();this.populatePositional(m,e,c)}for(;a.length;){let m=a.shift();this.populatePositional(m,e,c)}return e._=n.commands.concat(e._.map(m=>""+m)),this.postProcessPositionals(e,c,this.cmdToParseOptions(t.original),r),c}populatePositional(t,e,n){let r=t.cmd[0];t.variadic?n[r]=e._.splice(0).map(String):e._.length&&(n[r]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=qt(t);return n.demanded.forEach(r=>{let[i,...a]=r.cmd;r.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=a,e.demand[i]=!0}),n.optional.forEach(r=>{let[i,...a]=r.cmd;r.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=a}),e}postProcessPositionals(t,e,n,r){let i=Object.assign({},r.getOptions());i.default=Object.assign(n.default,i.default);for(let w of Object.keys(n.alias))i.alias[w]=(i.alias[w]||[]).concat(n.alias[w]);i.array=i.array.concat(n.array),i.config={};let a=[];if(Object.keys(e).forEach(w=>{e[w].map(p=>{i.configuration["unknown-options-as-args"]&&(i.key[w]=!0),a.push(`--${w}`),a.push(p)})}),!a.length)return;let c=Object.assign({},i.configuration,{"populate--":!1}),m=this.shim.Parser.detailed(a,Object.assign({},i,{configuration:c}));if(m.error)r.getInternalMethods().getUsageInstance().fail(m.error.message,m.error);else{let w=Object.keys(e);Object.keys(e).forEach(p=>{w.push(...m.aliases[p])}),Object.keys(m.argv).forEach(p=>{w.includes(p)&&(e[p]||(e[p]=m.argv[p]),!this.isInConfigs(r,p)&&!this.isDefaulted(r,p)&&Object.prototype.hasOwnProperty.call(t,p)&&Object.prototype.hasOwnProperty.call(m.argv,p)&&(Array.isArray(t[p])||Array.isArray(m.argv[p]))?t[p]=[].concat(t[p],m.argv[p]):t[p]=m.argv[p])})}}isDefaulted(t,e){let{default:n}=t.getOptions();return Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(e))}isInConfigs(t,e){let{configObjects:n}=t.getOptions();return n.some(r=>Object.prototype.hasOwnProperty.call(r,e))||n.some(r=>Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=Ce.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let e=this.defaultCommand.builder;if(cn(e))return e(t,!0);ei(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=us(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(let r of[t,e,n]){if(typeof r=="string"||r===!1)return r;dt(r,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();dt(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function ni(s,t,e,n){return new ds(s,t,e,n)}function ei(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function sc(s){return s.every(t=>typeof t=="string")}function cn(s){return typeof s=="function"}function rc(s){return typeof s=="object"}function ic(s){return typeof s=="object"&&!Array.isArray(s)}function Ht(s={},t=()=>!0){let e={};return _e(s).forEach(n=>{t(n,s[n])&&(e[n]=s[n])}),e}function Yt(s){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(s)})}function oc(s){return typeof s=="boolean"}function ii(s,t){let e=t.y18n.__,n={},r=[];n.failFn=function(_){r.push(_)};let i=null,a=null,c=!0;n.showHelpOnFail=function(_=!0,j){let[L,q]=typeof _=="string"?[!0,_]:[_,j];return s.getInternalMethods().isGlobalContext()&&(a=q),i=q,c=L,n};let m=!1;n.fail=function(_,j){let L=s.getInternalMethods().getLoggerInstance();if(r.length)for(let q=r.length-1;q>=0;--q){let ot=r[q];if(oc(ot)){if(j)throw j;if(_)throw Error(_)}else ot(_,j,n)}else{if(s.getExitProcess()&&Yt(!0),!m){m=!0,c&&(s.showHelp("error"),L.error()),(_||j)&&L.error(_||j);let q=i||a;q&&((_||j)&&L.error(""),L.error(q))}if(j=j||new G(_),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,j);throw j}};let w=[],p=!1;n.usage=(P,_)=>P===null?(p=!0,w=[],n):(p=!1,w.push([P,_||""]),n),n.getUsage=()=>w,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>e("Positionals:");let u=[];n.example=(P,_)=>{u.push([P,_||""])};let g=[];n.command=function(_,j,L,q,ot=!1){L&&(g=g.map(V=>(V[2]=!1,V))),g.push([_,j||"",L,q,ot])},n.getCommands=()=>g;let y={};n.describe=function(_,j){Array.isArray(_)?_.forEach(L=>{n.describe(L,j)}):typeof _=="object"?Object.keys(_).forEach(L=>{n.describe(L,_[L])}):y[_]=j},n.getDescriptions=()=>y;let x=[];n.epilog=P=>{x.push(P)};let O=!1,d;n.wrap=P=>{O=!0,d=P},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(O||(d=ht(),O=!0),d);let T="__yargsString__:";n.deferY18nLookup=P=>T+P,n.help=function(){if(U)return U;B();let _=s.customScriptName?s.$0:t.path.basename(s.$0),j=s.getDemandedOptions(),L=s.getDemandedCommands(),q=s.getDeprecatedOptions(),ot=s.getGroups(),V=s.getOptions(),at=[];at=at.concat(Object.keys(y)),at=at.concat(Object.keys(j)),at=at.concat(Object.keys(L)),at=at.concat(Object.keys(V.default)),at=at.filter(ft),at=Object.keys(at.reduce(($,J)=>(J!=="_"&&($[J]=!0),$),{}));let Qt=n.getWrap(),X=t.cliui({width:Qt,wrap:!!Qt});if(!p){if(w.length)w.forEach($=>{X.div({text:`${$[0].replace(/\$0/g,_)}`}),$[1]&&X.div({text:`${$[1]}`,padding:[1,0,0,0]})}),X.div();else if(g.length){let $=null;L._?$=`${_} <${e("command")}>
|
|
9
|
+
`:$=`${_} [${e("command")}]
|
|
10
|
+
`,X.div(`${$}`)}}if(g.length>1||g.length===1&&!g[0][2]){X.div(e("Commands:"));let $=s.getInternalMethods().getContext(),J=$.commands.length?`${$.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(g=g.sort((R,et)=>R[0].localeCompare(et[0])));let tt=_?`${_} `:"";g.forEach(R=>{let et=`${tt}${J}${R[0].replace(/^\$0 ?/,"")}`;X.span({text:et,padding:[0,2,0,2],width:F(g,Qt,`${_}${J}`)+4},{text:R[1]});let rt=[];R[2]&&rt.push(`[${e("default")}]`),R[3]&&R[3].length&&rt.push(`[${e("aliases:")} ${R[3].join(", ")}]`),R[4]&&(typeof R[4]=="string"?rt.push(`[${e("deprecated: %s",R[4])}]`):rt.push(`[${e("deprecated")}]`)),rt.length?X.div({text:rt.join(" "),padding:[0,0,0,2],align:"right"}):X.div()}),X.div()}let zt=(Object.keys(V.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);at=at.filter($=>!s.parsed.newAliases[$]&&zt.every(J=>(V.alias[J]||[]).indexOf($)===-1));let Ut=e("Options:");ot[Ut]||(ot[Ut]=[]),W(at,V.alias,ot,Ut);let Zt=$=>/^--/.test(ln($)),N=Object.keys(ot).filter($=>ot[$].length>0).map($=>{let J=ot[$].filter(ft).map(tt=>{if(zt.includes(tt))return tt;for(let R=0,et;(et=zt[R])!==void 0;R++)if((V.alias[et]||[]).includes(tt))return et;return tt});return{groupName:$,normalizedKeys:J}}).filter(({normalizedKeys:$})=>$.length>0).map(({groupName:$,normalizedKeys:J})=>{let tt=J.reduce((R,et)=>(R[et]=[et].concat(V.alias[et]||[]).map(rt=>$===n.getPositionalGroupName()?rt:(/^[0-9]$/.test(rt)?V.boolean.includes(et)?"-":"--":rt.length>1?"--":"-")+rt).sort((rt,vt)=>Zt(rt)===Zt(vt)?0:Zt(rt)?1:-1).join(", "),R),{});return{groupName:$,normalizedKeys:J,switches:tt}});if(N.filter(({groupName:$})=>$!==n.getPositionalGroupName()).some(({normalizedKeys:$,switches:J})=>!$.every(tt=>Zt(J[tt])))&&N.filter(({groupName:$})=>$!==n.getPositionalGroupName()).forEach(({normalizedKeys:$,switches:J})=>{$.forEach(tt=>{Zt(J[tt])&&(J[tt]=ac(J[tt],4))})}),N.forEach(({groupName:$,normalizedKeys:J,switches:tt})=>{X.div($),J.forEach(R=>{let et=tt[R],rt=y[R]||"",vt=null;rt.includes(T)&&(rt=e(rt.substring(T.length))),V.boolean.includes(R)&&(vt=`[${e("boolean")}]`),V.count.includes(R)&&(vt=`[${e("count")}]`),V.string.includes(R)&&(vt=`[${e("string")}]`),V.normalize.includes(R)&&(vt=`[${e("string")}]`),V.array.includes(R)&&(vt=`[${e("array")}]`),V.number.includes(R)&&(vt=`[${e("number")}]`);let Pt=h=>typeof h=="string"?`[${e("deprecated: %s",h)}]`:`[${e("deprecated")}]`,We=[R in q?Pt(q[R]):null,vt,R in j?`[${e("required")}]`:null,V.choices&&V.choices[R]?`[${e("choices:")} ${n.stringifiedValues(V.choices[R])}]`:null,Z(V.default[R],V.defaultDescription[R])].filter(Boolean).join(" ");X.span({text:ln(et),padding:[0,2,0,2+ri(et)],width:F(tt,Qt)+4},rt);let l=s.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;We&&!l?X.div({text:We,padding:[0,0,0,2],align:"right"}):X.div()}),X.div()}),u.length&&(X.div(e("Examples:")),u.forEach($=>{$[0]=$[0].replace(/\$0/g,_)}),u.forEach($=>{$[1]===""?X.div({text:$[0],padding:[0,2,0,2]}):X.div({text:$[0],padding:[0,2,0,2],width:F(u,Qt)+4},{text:$[1]})}),X.div()),x.length>0){let $=x.map(J=>J.replace(/\$0/g,_)).join(`
|
|
11
|
+
`);X.div(`${$}
|
|
12
|
+
`)}return X.toString().replace(/\s*$/,"")};function F(P,_,j){let L=0;return Array.isArray(P)||(P=Object.values(P).map(q=>[q])),P.forEach(q=>{L=Math.max(t.stringWidth(j?`${j} ${ln(q[0])}`:ln(q[0]))+ri(q[0]),L)}),_&&(L=Math.min(L,parseInt((_*.5).toString(),10))),L}function B(){let P=s.getDemandedOptions(),_=s.getOptions();(Object.keys(_.alias)||[]).forEach(j=>{_.alias[j].forEach(L=>{y[L]&&n.describe(j,y[L]),L in P&&s.demandOption(j,P[L]),_.boolean.includes(L)&&s.boolean(j),_.count.includes(L)&&s.count(j),_.string.includes(L)&&s.string(j),_.normalize.includes(L)&&s.normalize(j),_.array.includes(L)&&s.array(j),_.number.includes(L)&&s.number(j)})})}let U;n.cacheHelpMessage=function(){U=this.help()},n.clearCachedHelpMessage=function(){U=void 0},n.hasCachedHelpMessage=function(){return!!U};function W(P,_,j,L){let q=[],ot=null;return Object.keys(j).forEach(V=>{q=q.concat(j[V])}),P.forEach(V=>{ot=[V].concat(_[V]),ot.some(at=>q.indexOf(at)!==-1)||j[L].push(V)}),q}function ft(P){return s.getOptions().hiddenOptions.indexOf(P)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=P=>{let _=s.getInternalMethods().getLoggerInstance();P||(P="error"),(typeof P=="function"?P:_[P])(n.help())},n.functionDescription=P=>["(",P.name?t.Parser.decamelize(P.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(_,j){let L="",q=j||", ",ot=[].concat(_);return!_||!ot.length||ot.forEach(V=>{L.length&&(L+=q),L+=JSON.stringify(V)}),L};function Z(P,_){let j=`[${e("default:")} `;if(P===void 0&&!_)return null;if(_)j+=_;else switch(typeof P){case"string":j+=`"${P}"`;break;case"object":j+=JSON.stringify(P);break;default:j+=P}return`${j}]`}function ht(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let Ot=null;n.version=P=>{Ot=P},n.showVersion=P=>{let _=s.getInternalMethods().getLoggerInstance();P||(P="error"),(typeof P=="function"?P:_[P])(Ot)},n.reset=function(_){return i=null,m=!1,w=[],p=!1,x=[],u=[],g=[],y=Ht(y,j=>!_[j]),n};let Y=[];return n.freeze=function(){Y.push({failMessage:i,failureOutput:m,usages:w,usageDisabled:p,epilogs:x,examples:u,commands:g,descriptions:y})},n.unfreeze=function(_=!1){let j=Y.pop();j&&(_?(y={...j.descriptions,...y},g=[...j.commands,...g],w=[...j.usages,...w],u=[...j.examples,...u],x=[...j.epilogs,...x]):{failMessage:i,failureOutput:m,usages:w,usageDisabled:p,epilogs:x,examples:u,commands:g,descriptions:y}=j)},n}function ps(s){return typeof s=="object"}function ac(s,t){return ps(s)?{text:s.text,indentation:s.indentation+t}:{text:s,indentation:t}}function ri(s){return ps(s)?s.indentation:0}function ln(s){return ps(s)?s.text:s}var oi=`###-begin-{{app_name}}-completions-###
|
|
13
|
+
#
|
|
14
|
+
# yargs command completion script
|
|
15
|
+
#
|
|
16
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
|
|
17
|
+
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
|
|
18
|
+
#
|
|
19
|
+
_{{app_name}}_yargs_completions()
|
|
20
|
+
{
|
|
21
|
+
local cur_word args type_list
|
|
22
|
+
|
|
23
|
+
cur_word="\${COMP_WORDS[COMP_CWORD]}"
|
|
24
|
+
args=("\${COMP_WORDS[@]}")
|
|
25
|
+
|
|
26
|
+
# ask yargs to generate completions.
|
|
27
|
+
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
|
|
28
|
+
|
|
29
|
+
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
|
|
30
|
+
|
|
31
|
+
# if no match was found, fall back to filename completion
|
|
32
|
+
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|
|
33
|
+
COMPREPLY=()
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
return 0
|
|
37
|
+
}
|
|
38
|
+
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
39
|
+
###-end-{{app_name}}-completions-###
|
|
40
|
+
`,ai=`#compdef {{app_name}}
|
|
41
|
+
###-begin-{{app_name}}-completions-###
|
|
42
|
+
#
|
|
43
|
+
# yargs command completion script
|
|
44
|
+
#
|
|
45
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
|
46
|
+
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
|
47
|
+
#
|
|
48
|
+
_{{app_name}}_yargs_completions()
|
|
49
|
+
{
|
|
50
|
+
local reply
|
|
51
|
+
local si=$IFS
|
|
52
|
+
IFS=$'
|
|
53
|
+
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
|
54
|
+
IFS=$si
|
|
55
|
+
_describe 'values' reply
|
|
56
|
+
}
|
|
57
|
+
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
58
|
+
###-end-{{app_name}}-completions-###
|
|
59
|
+
`;var ms=class{constructor(t,e,n,r){var i,a,c;this.yargs=t,this.usage=e,this.command=n,this.shim=r,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((i=this.shim.getEnv("SHELL"))===null||i===void 0?void 0:i.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&c!==void 0?c:!1}defaultCompletion(t,e,n,r){let i=this.command.getCommandHandlers();for(let c=0,m=t.length;c<m;++c)if(i[t[c]]&&i[t[c]].builder){let w=i[t[c]].builder;if(cn(w)){this.indexAfterLastReset=c+1;let p=this.yargs.getInternalMethods().reset();return w(p,!0),p.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,e,n),this.choicesFromOptionsCompletions(a,t,e,n),this.choicesFromPositionalsCompletions(a,t,e,n),r(null,a)}commandCompletions(t,e,n){let r=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&r[r.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(i=>{let a=qt(i[0]).cmd;if(e.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let c=i[1]||"";t.push(a.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(t,e,n,r){if((r.match(/^-/)||r===""&&t.length===0)&&!this.previousArgHasChoices(e)){let i=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach(c=>{let m=!!i.configuration["boolean-negation"]&&i.boolean.includes(c);!a.includes(c)&&!i.hiddenOptions.includes(c)&&!this.argsContainKey(e,c,m)&&(this.completeOptionKey(c,t,r),m&&i.default[c]&&this.completeOptionKey(`no-${c}`,t,r))})}}choicesFromOptionsCompletions(t,e,n,r){if(this.previousArgHasChoices(e)){let i=this.getPreviousArgChoices(e);i&&i.length>0&&t.push(...i.map(a=>a.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,r){if(r===""&&t.length>0&&this.previousArgHasChoices(e))return;let i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],a=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=i[n._.length-a-1];if(!c)return;let m=this.yargs.getOptions().choices[c]||[];for(let w of m)w.startsWith(r)&&t.push(w.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;let r=e.replace(/^-+/,""),i=this.yargs.getOptions(),a=[r,...this.yargs.getAliases()[r]||[]],c;for(let m of a)if(Object.prototype.hasOwnProperty.call(i.key,m)&&Array.isArray(i.choices[m])){c=i.choices[m];break}if(c)return c.filter(m=>!n||m.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){let r=i=>t.indexOf((/^[^0-9]$/.test(i)?"-":"--")+i)!==-1;if(r(e)||n&&r(`no-${e}`))return!0;if(this.aliases){for(let i of this.aliases[e])if(r(i))return!0}return!1}completeOptionKey(t,e,n){var r,i,a;let c=this.usage.getDescriptions(),m=u=>/^--/.test(u),w=u=>/^[^0-9]$/.test(u),p=!m(n)&&w(t)?"-":"--";if(!this.zshShell)e.push(p+t);else{let u=(r=this===null||this===void 0?void 0:this.aliases)===null||r===void 0?void 0:r[t].find(x=>{let O=c[x];return typeof O=="string"&&O.length>0}),g=u?c[u]:void 0,y=(a=(i=c[t])!==null&&i!==void 0?i:g)!==null&&a!==void 0?a:"";e.push(p+`${t.replace(/:/g,"\\:")}:${y.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`)}}customCompletion(t,e,n,r){if(dt(this.customCompletionFunction,null,this.shim),lc(this.customCompletionFunction)){let i=this.customCompletionFunction(n,e);return K(i)?i.then(a=>{this.shim.process.nextTick(()=>{r(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{r(a,void 0)})}):r(null,i)}else return fc(this.customCompletionFunction)?this.customCompletionFunction(n,e,(i=r)=>this.defaultCompletion(t,e,n,i),i=>{r(null,i)}):this.customCompletionFunction(n,e,i=>{r(null,i)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",r=this.yargs.parse(t,!0),i=this.customCompletionFunction?a=>this.customCompletion(t,a,n,e):a=>this.defaultCompletion(t,a,n,e);return K(r)?r.then(i):i(r)}generateCompletionScript(t,e){let n=this.zshShell?ai:oi,r=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,r),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}};function ci(s,t,e,n){return new ms(s,t,e,n)}function lc(s){return s.length<3}function fc(s){return s.length>3}function li(s,t){if(s.length===0)return t.length;if(t.length===0)return s.length;let e=[],n;for(n=0;n<=t.length;n++)e[n]=[n];let r;for(r=0;r<=s.length;r++)e[0][r]=r;for(n=1;n<=t.length;n++)for(r=1;r<=s.length;r++)t.charAt(n-1)===s.charAt(r-1)?e[n][r]=e[n-1][r-1]:n>1&&r>1&&t.charAt(n-2)===s.charAt(r-1)&&t.charAt(n-1)===s.charAt(r-2)?e[n][r]=e[n-2][r-2]+1:e[n][r]=Math.min(e[n-1][r-1]+1,Math.min(e[n][r-1]+1,e[n-1][r]+1));return e[t.length][s.length]}var fi=["$0","--","_"];function hi(s,t,e){let n=e.y18n.__,r=e.y18n.__n,i={};i.nonOptionCount=function(u){let g=s.getDemandedCommands(),x=u._.length+(u["--"]?u["--"].length:0)-s.getInternalMethods().getContext().commands.length;g._&&(x<g._.min||x>g._.max)&&(x<g._.min?g._.minMsg!==void 0?t.fail(g._.minMsg?g._.minMsg.replace(/\$0/g,x.toString()).replace(/\$1/,g._.min.toString()):null):t.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",x,x.toString(),g._.min.toString())):x>g._.max&&(g._.maxMsg!==void 0?t.fail(g._.maxMsg?g._.maxMsg.replace(/\$0/g,x.toString()).replace(/\$1/,g._.max.toString()):null):t.fail(r("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",x,x.toString(),g._.max.toString()))))},i.positionalCount=function(u,g){g<u&&t.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",g,g+"",u+""))},i.requiredArguments=function(u,g){let y=null;for(let x of Object.keys(g))(!Object.prototype.hasOwnProperty.call(u,x)||typeof u[x]>"u")&&(y=y||{},y[x]=g[x]);if(y){let x=[];for(let d of Object.keys(y)){let T=y[d];T&&x.indexOf(T)<0&&x.push(T)}let O=x.length?`
|
|
60
|
+
${x.join(`
|
|
61
|
+
`)}`:"";t.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(y).length,Object.keys(y).join(", ")+O))}},i.unknownArguments=function(u,g,y,x,O=!0){var d;let T=s.getInternalMethods().getCommandInstance().getCommands(),F=[],B=s.getInternalMethods().getContext();if(Object.keys(u).forEach(U=>{!fi.includes(U)&&!Object.prototype.hasOwnProperty.call(y,U)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),U)&&!i.isValidAndSomeAliasIsNotNew(U,g)&&F.push(U)}),O&&(B.commands.length>0||T.length>0||x)&&u._.slice(B.commands.length).forEach(U=>{T.includes(""+U)||F.push(""+U)}),O){let W=((d=s.getDemandedCommands()._)===null||d===void 0?void 0:d.max)||0,ft=B.commands.length+W;ft<u._.length&&u._.slice(ft).forEach(Z=>{Z=String(Z),!B.commands.includes(Z)&&!F.includes(Z)&&F.push(Z)})}F.length&&t.fail(r("Unknown argument: %s","Unknown arguments: %s",F.length,F.map(U=>U.trim()?U:`"${U}"`).join(", ")))},i.unknownCommands=function(u){let g=s.getInternalMethods().getCommandInstance().getCommands(),y=[],x=s.getInternalMethods().getContext();return(x.commands.length>0||g.length>0)&&u._.slice(x.commands.length).forEach(O=>{g.includes(""+O)||y.push(""+O)}),y.length>0?(t.fail(r("Unknown command: %s","Unknown commands: %s",y.length,y.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(u,g){if(!Object.prototype.hasOwnProperty.call(g,u))return!1;let y=s.parsed.newAliases;return[u,...g[u]].some(x=>!Object.prototype.hasOwnProperty.call(y,x)||!y[u])},i.limitedChoices=function(u){let g=s.getOptions(),y={};if(!Object.keys(g.choices).length)return;Object.keys(u).forEach(d=>{fi.indexOf(d)===-1&&Object.prototype.hasOwnProperty.call(g.choices,d)&&[].concat(u[d]).forEach(T=>{g.choices[d].indexOf(T)===-1&&T!==void 0&&(y[d]=(y[d]||[]).concat(T))})});let x=Object.keys(y);if(!x.length)return;let O=n("Invalid values:");x.forEach(d=>{O+=`
|
|
62
|
+
${n("Argument: %s, Given: %s, Choices: %s",d,t.stringifiedValues(y[d]),t.stringifiedValues(g.choices[d]))}`}),t.fail(O)};let a={};i.implies=function(u,g){A("<string|object> [array|number|string]",[u,g],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{i.implies(y,u[y])}):(s.global(u),a[u]||(a[u]=[]),Array.isArray(g)?g.forEach(y=>i.implies(u,y)):(dt(g,void 0,e),a[u].push(g)))},i.getImplied=function(){return a};function c(p,u){let g=Number(u);return u=isNaN(g)?u:g,typeof u=="number"?u=p._.length>=u:u.match(/^--no-.+/)?(u=u.match(/^--no-(.+)/)[1],u=!Object.prototype.hasOwnProperty.call(p,u)):u=Object.prototype.hasOwnProperty.call(p,u),u}i.implications=function(u){let g=[];if(Object.keys(a).forEach(y=>{let x=y;(a[y]||[]).forEach(O=>{let d=x,T=O;d=c(u,d),O=c(u,O),d&&!O&&g.push(` ${x} -> ${T}`)})}),g.length){let y=`${n("Implications failed:")}
|
|
63
|
+
`;g.forEach(x=>{y+=x}),t.fail(y)}};let m={};i.conflicts=function(u,g){A("<string|object> [array|string]",[u,g],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{i.conflicts(y,u[y])}):(s.global(u),m[u]||(m[u]=[]),Array.isArray(g)?g.forEach(y=>i.conflicts(u,y)):m[u].push(g))},i.getConflicting=()=>m,i.conflicting=function(u){Object.keys(u).forEach(g=>{m[g]&&m[g].forEach(y=>{y&&u[g]!==void 0&&u[y]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(m).forEach(g=>{m[g].forEach(y=>{y&&u[e.Parser.camelCase(g)]!==void 0&&u[e.Parser.camelCase(y)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",g,y))})})},i.recommendCommands=function(u,g){g=g.sort((d,T)=>T.length-d.length);let x=null,O=1/0;for(let d=0,T;(T=g[d])!==void 0;d++){let F=li(u,T);F<=3&&F<O&&(O=F,x=T)}x&&t.fail(n("Did you mean %s?",x))},i.reset=function(u){return a=Ht(a,g=>!u[g]),m=Ht(m,g=>!u[g]),i};let w=[];return i.freeze=function(){w.push({implied:a,conflicting:m})},i.unfreeze=function(){let u=w.pop();dt(u,void 0,e),{implied:a,conflicting:m}=u},i}var gs=[],De;function fn(s,t,e,n){De=n;let r={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return r;let i=/\.json|\..*rc$/.test(s.extends),a=null;if(i)a=uc(t,s.extends);else try{a=H.resolve(s.extends)}catch{return s}hc(a),gs.push(a),r=i?JSON.parse(De.readFileSync(a,"utf8")):H(s.extends),delete s.extends,r=fn(r,De.path.dirname(a),e,De)}return gs=[],e?ui(r,s):Object.assign({},r,s)}function hc(s){if(gs.indexOf(s)>-1)throw new G(`Circular extended configurations: '${s}'.`)}function uc(s,t){return De.path.resolve(s,t)}function ui(s,t){let e={};function n(r){return r&&typeof r=="object"&&!Array.isArray(r)}Object.assign(e,s);for(let r of Object.keys(t))n(t[r])&&n(e[r])?e[r]=ui(s[r],t[r]):e[r]=t[r];return e}var S=function(s,t,e,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!r:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(s,e):r?r.value=e:t.set(s,e),e},o=function(s,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!n:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(s):n?n.value:t.get(s)},it,ne,Le,Ct,wt,hn,Gt,se,un,At,dn,St,Tt,yt,jt,pn,Ae,lt,M,mn,gn,xt,re,Se,ie,Kt,bn,z,oe,ae,ce,D,wn,Nt,st;function $i(s){return(t=[],e=s.process.cwd(),n)=>{let r=new js(t,e,n,s);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}var di=Symbol("copyDoubleDash"),pi=Symbol("copyDoubleDash"),bs=Symbol("deleteFromParserHintObject"),mi=Symbol("emitWarning"),gi=Symbol("freeze"),bi=Symbol("getDollarZero"),le=Symbol("getParserConfiguration"),wi=Symbol("getUsageConfiguration"),ws=Symbol("guessLocale"),yi=Symbol("guessVersion"),xi=Symbol("parsePositionalNumbers"),ys=Symbol("pkgUp"),Jt=Symbol("populateParserHintArray"),je=Symbol("populateParserHintSingleValueDictionary"),xs=Symbol("populateParserHintArrayDictionary"),Os=Symbol("populateParserHintDictionary"),Es=Symbol("sanitizeKey"),_s=Symbol("setKey"),Cs=Symbol("unfreeze"),Oi=Symbol("validateAsync"),Ei=Symbol("getCommandInstance"),_i=Symbol("getContext"),Ci=Symbol("getHasOutput"),Ai=Symbol("getLoggerInstance"),Si=Symbol("getParseContext"),ji=Symbol("getUsageInstance"),vi=Symbol("getValidationInstance"),yn=Symbol("hasParseCallback"),Pi=Symbol("isGlobalContext"),fe=Symbol("postProcess"),Mi=Symbol("rebase"),As=Symbol("reset"),Be=Symbol("runYargsParserAndExecuteCommands"),Ss=Symbol("runValidation"),Ii=Symbol("setHasOutput"),he=Symbol("kTrackManuallySetKeys"),js=class{constructor(t=[],e,n,r){this.customScriptName=!1,this.parsed=!1,it.set(this,void 0),ne.set(this,void 0),Le.set(this,{commands:[],fullCommands:[]}),Ct.set(this,null),wt.set(this,null),hn.set(this,"show-hidden"),Gt.set(this,null),se.set(this,!0),un.set(this,{}),At.set(this,!0),dn.set(this,[]),St.set(this,void 0),Tt.set(this,{}),yt.set(this,!1),jt.set(this,null),pn.set(this,!0),Ae.set(this,void 0),lt.set(this,""),M.set(this,void 0),mn.set(this,void 0),gn.set(this,{}),xt.set(this,null),re.set(this,null),Se.set(this,{}),ie.set(this,{}),Kt.set(this,void 0),bn.set(this,!1),z.set(this,void 0),oe.set(this,!1),ae.set(this,!1),ce.set(this,!1),D.set(this,void 0),wn.set(this,{}),Nt.set(this,null),st.set(this,void 0),S(this,z,r,"f"),S(this,Kt,t,"f"),S(this,ne,e,"f"),S(this,mn,n,"f"),S(this,St,new an(this),"f"),this.$0=this[bi](),this[As](),S(this,it,o(this,it,"f"),"f"),S(this,D,o(this,D,"f"),"f"),S(this,st,o(this,st,"f"),"f"),S(this,M,o(this,M,"f"),"f"),o(this,M,"f").showHiddenOpt=o(this,hn,"f"),S(this,Ae,this[pi](),"f")}addHelpOpt(t,e){let n="help";return A("[string|boolean] [string]",[t,e],arguments.length),o(this,jt,"f")&&(this[bs](o(this,jt,"f")),S(this,jt,null,"f")),t===!1&&e===void 0?this:(S(this,jt,typeof t=="string"?t:n,"f"),this.boolean(o(this,jt,"f")),this.describe(o(this,jt,"f"),e||o(this,D,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(A("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:o(this,hn,"f");return this.boolean(n),this.describe(n,e||o(this,D,"f").deferY18nLookup("Show hidden options")),o(this,M,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return A("<object|string|array> [string|array]",[t,e],arguments.length),this[xs](this.alias.bind(this),"alias",t,e),this}array(t){return A("<array|string>",[t],arguments.length),this[Jt]("array",t),this[he](t),this}boolean(t){return A("<array|string>",[t],arguments.length),this[Jt]("boolean",t),this[he](t),this}check(t,e){return A("<function> [boolean]",[t,e],arguments.length),this.middleware((n,r)=>ee(()=>t(n,r.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&o(this,D,"f").fail(i.toString(),i):o(this,D,"f").fail(o(this,z,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(o(this,D,"f").fail(i.message?i.message:i.toString(),i),n)),!1,e),this}choices(t,e){return A("<object|string|array> [string|array]",[t,e],arguments.length),this[xs](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(A("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new G("coerce callback must be provided");for(let n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new G("coerce callback must be provided");return o(this,M,"f").key[t]=!0,o(this,St,"f").addCoerceMiddleware((n,r)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?ee(()=>(i=r.getAliases(),e(n[t])),c=>{n[t]=c;let m=r.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&m!==!0)for(let w of i[t])n[w]=c;return n},c=>{throw new G(c.message)}):n},t),this}conflicts(t,e){return A("<string|object> [string|array]",[t,e],arguments.length),o(this,st,"f").conflicts(t,e),this}config(t="config",e,n){return A("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=fn(t,o(this,ne,"f"),this[le]()["deep-merge-config"]||!1,o(this,z,"f")),o(this,M,"f").configObjects=(o(this,M,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||o(this,D,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(r=>{o(this,M,"f").config[r]=n||!0}),this)}completion(t,e,n){return A("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),S(this,wt,t||o(this,wt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(o(this,wt,"f"),e),n&&o(this,Ct,"f").registerFunction(n),this}command(t,e,n,r,i,a){return A("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,r,i,a],arguments.length),o(this,it,"f").addHandler(t,e,n,r,i,a),this}commands(t,e,n,r,i,a){return this.command(t,e,n,r,i,a)}commandDir(t,e){A("<string> [object]",[t,e],arguments.length);let n=o(this,mn,"f")||o(this,z,"f").require;return o(this,it,"f").addDirectory(t,n,o(this,z,"f").getCallerFile(),e),this}count(t){return A("<array|string>",[t],arguments.length),this[Jt]("count",t),this[he](t),this}default(t,e,n){return A("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(hs(t,o(this,z,"f")),o(this,M,"f").defaultDescription[t]=n),typeof e=="function"&&(hs(t,o(this,z,"f")),o(this,M,"f").defaultDescription[t]||(o(this,M,"f").defaultDescription[t]=o(this,D,"f").functionDescription(e)),e=e.call()),this[je](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,r){return A("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,r],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),o(this,M,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:r},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(r=>{dt(n,!0,o(this,z,"f")),this.demandOption(r,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(dt(n,!0,o(this,z,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(r=>{dt(n,!0,o(this,z,"f")),this.demandOption(r,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return A("<object|string|array> [string]",[t,e],arguments.length),this[je](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return A("<string> [string|boolean]",[t,e],arguments.length),o(this,M,"f").deprecatedOptions[t]=e,this}describe(t,e){return A("<object|string|array> [string]",[t,e],arguments.length),this[_s](t,!0),o(this,D,"f").describe(t,e),this}detectLocale(t){return A("<boolean>",[t],arguments.length),S(this,se,t,"f"),this}env(t){return A("[string|boolean]",[t],arguments.length),t===!1?delete o(this,M,"f").envPrefix:o(this,M,"f").envPrefix=t||"",this}epilogue(t){return A("<string>",[t],arguments.length),o(this,D,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return A("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):o(this,D,"f").example(t,e),this}exit(t,e){S(this,yt,!0,"f"),S(this,Gt,e,"f"),o(this,At,"f")&&o(this,z,"f").process.exit(t)}exitProcess(t=!0){return A("[boolean]",[t],arguments.length),S(this,At,t,"f"),this}fail(t){if(A("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new G("Invalid first argument. Expected function or boolean 'false'");return o(this,D,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return A("<array> [function]",[t,e],arguments.length),e?o(this,Ct,"f").getCompletion(t,e):new Promise((n,r)=>{o(this,Ct,"f").getCompletion(t,(i,a)=>{i?r(i):n(a)})})}getDemandedOptions(){return A([],0),o(this,M,"f").demandedOptions}getDemandedCommands(){return A([],0),o(this,M,"f").demandedCommands}getDeprecatedOptions(){return A([],0),o(this,M,"f").deprecatedOptions}getDetectLocale(){return o(this,se,"f")}getExitProcess(){return o(this,At,"f")}getGroups(){return Object.assign({},o(this,Tt,"f"),o(this,ie,"f"))}getHelp(){if(S(this,yt,!0,"f"),!o(this,D,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[Be](o(this,Kt,"f"),void 0,void 0,0,!0);if(K(e))return e.then(()=>o(this,D,"f").help())}let t=o(this,it,"f").runDefaultBuilderOn(this);if(K(t))return t.then(()=>o(this,D,"f").help())}return Promise.resolve(o(this,D,"f").help())}getOptions(){return o(this,M,"f")}getStrict(){return o(this,oe,"f")}getStrictCommands(){return o(this,ae,"f")}getStrictOptions(){return o(this,ce,"f")}global(t,e){return A("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?o(this,M,"f").local=o(this,M,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{o(this,M,"f").local.includes(n)||o(this,M,"f").local.push(n)}),this}group(t,e){A("<string|array> <string>",[t,e],arguments.length);let n=o(this,ie,"f")[e]||o(this,Tt,"f")[e];o(this,ie,"f")[e]&&delete o(this,ie,"f")[e];let r={};return o(this,Tt,"f")[e]=(n||[]).concat(t).filter(i=>r[i]?!1:r[i]=!0),this}hide(t){return A("<string>",[t],arguments.length),o(this,M,"f").hiddenOptions.push(t),this}implies(t,e){return A("<string|object> [number|string|array]",[t,e],arguments.length),o(this,st,"f").implies(t,e),this}locale(t){return A("[string]",[t],arguments.length),t===void 0?(this[ws](),o(this,z,"f").y18n.getLocale()):(S(this,se,!1,"f"),o(this,z,"f").y18n.setLocale(t),this)}middleware(t,e,n){return o(this,St,"f").addMiddleware(t,!!e,n)}nargs(t,e){return A("<string|object|array> [number]",[t,e],arguments.length),this[je](this.nargs.bind(this),"narg",t,e),this}normalize(t){return A("<array|string>",[t],arguments.length),this[Jt]("normalize",t),this}number(t){return A("<array|string>",[t],arguments.length),this[Jt]("number",t),this[he](t),this}option(t,e){if(A("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[he](t),o(this,Nt,"f")&&(t==="version"||e?.alias==="version")&&this[mi](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
64
|
+
`),void 0,"versionWarning"),o(this,M,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let r=e.demand||e.required||e.require;r&&this.demand(t,r),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(o(this,M,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let i=e.describe||e.description||e.desc,a=o(this,D,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(a,t)||typeof i=="string")&&this.describe(t,i),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){A("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[gi](),typeof t>"u"&&(t=o(this,Kt,"f")),typeof e=="object"&&(S(this,re,e,"f"),e=n),typeof e=="function"&&(S(this,xt,e,"f"),e=!1),e||S(this,Kt,t,"f"),o(this,xt,"f")&&S(this,At,!1,"f");let r=this[Be](t,!!e),i=this.parsed;return o(this,Ct,"f").setParsed(this.parsed),K(r)?r.then(a=>(o(this,xt,"f")&&o(this,xt,"f").call(this,o(this,Gt,"f"),a,o(this,lt,"f")),a)).catch(a=>{throw o(this,xt,"f")&&o(this,xt,"f")(a,this.parsed.argv,o(this,lt,"f")),a}).finally(()=>{this[Cs](),this.parsed=i}):(o(this,xt,"f")&&o(this,xt,"f").call(this,o(this,Gt,"f"),r,o(this,lt,"f")),this[Cs](),this.parsed=i,r)}parseAsync(t,e,n){let r=this.parse(t,e,n);return K(r)?r:Promise.resolve(r)}parseSync(t,e,n){let r=this.parse(t,e,n);if(K(r))throw new G(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return r}parserConfiguration(t){return A("<object>",[t],arguments.length),S(this,gn,t,"f"),this}pkgConf(t,e){A("<string> [string]",[t,e],arguments.length);let n=null,r=this[ys](e||o(this,ne,"f"));return r[t]&&typeof r[t]=="object"&&(n=fn(r[t],e||o(this,ne,"f"),this[le]()["deep-merge-config"]||!1,o(this,z,"f")),o(this,M,"f").configObjects=(o(this,M,"f").configObjects||[]).concat(n)),this}positional(t,e){A("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=Ht(e,(a,c)=>a==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(a));let r=o(this,Le,"f").fullCommands[o(this,Le,"f").fullCommands.length-1],i=r?o(this,it,"f").cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return _e(i).forEach(a=>{let c=i[a];Array.isArray(c)?c.indexOf(t)!==-1&&(e[a]=!0):c[t]&&!(a in e)&&(e[a]=c[t])}),this.group(t,o(this,D,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return A("[boolean]",[t],arguments.length),S(this,bn,t,"f"),this}required(t,e,n){return this.demand(t,e,n)}require(t,e,n){return this.demand(t,e,n)}requiresArg(t){return A("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&o(this,M,"f").narg[t]?this:(this[je](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return A("[string] [string]",[t,e],arguments.length),t=t||this.$0,o(this,Ae,"f").log(o(this,Ct,"f").generateCompletionScript(t,e||o(this,wt,"f")||"completion")),this}showHelp(t){if(A("[string|function]",[t],arguments.length),S(this,yt,!0,"f"),!o(this,D,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Be](o(this,Kt,"f"),void 0,void 0,0,!0);if(K(n))return n.then(()=>{o(this,D,"f").showHelp(t)}),this}let e=o(this,it,"f").runDefaultBuilderOn(this);if(K(e))return e.then(()=>{o(this,D,"f").showHelp(t)}),this}return o(this,D,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return A("[boolean|string] [string]",[t,e],arguments.length),o(this,D,"f").showHelpOnFail(t,e),this}showVersion(t){return A("[string|function]",[t],arguments.length),o(this,D,"f").showVersion(t),this}skipValidation(t){return A("<array|string>",[t],arguments.length),this[Jt]("skipValidation",t),this}strict(t){return A("[boolean]",[t],arguments.length),S(this,oe,t!==!1,"f"),this}strictCommands(t){return A("[boolean]",[t],arguments.length),S(this,ae,t!==!1,"f"),this}strictOptions(t){return A("[boolean]",[t],arguments.length),S(this,ce,t!==!1,"f"),this}string(t){return A("<array|string>",[t],arguments.length),this[Jt]("string",t),this[he](t),this}terminalWidth(){return A([],0),o(this,z,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return A("<object>",[t],arguments.length),S(this,se,!1,"f"),o(this,z,"f").y18n.updateLocale(t),this}usage(t,e,n,r){if(A("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,r],arguments.length),e!==void 0){if(dt(t,null,o(this,z,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,r);throw new G(".usage() description must start with $0 if being used as alias for .command()")}else return o(this,D,"f").usage(t),this}usageConfiguration(t){return A("<object>",[t],arguments.length),S(this,wn,t,"f"),this}version(t,e,n){let r="version";if(A("[boolean|string] [string] [string]",[t,e,n],arguments.length),o(this,Nt,"f")&&(this[bs](o(this,Nt,"f")),o(this,D,"f").version(void 0),S(this,Nt,null,"f")),arguments.length===0)n=this[yi](),t=r;else if(arguments.length===1){if(t===!1)return this;n=t,t=r}else arguments.length===2&&(n=e,e=void 0);return S(this,Nt,typeof t=="string"?t:r,"f"),e=e||o(this,D,"f").deferY18nLookup("Show version number"),o(this,D,"f").version(n||void 0),this.boolean(o(this,Nt,"f")),this.describe(o(this,Nt,"f"),e),this}wrap(t){return A("<number|null|undefined>",[t],arguments.length),o(this,D,"f").wrap(t),this}[(it=new WeakMap,ne=new WeakMap,Le=new WeakMap,Ct=new WeakMap,wt=new WeakMap,hn=new WeakMap,Gt=new WeakMap,se=new WeakMap,un=new WeakMap,At=new WeakMap,dn=new WeakMap,St=new WeakMap,Tt=new WeakMap,yt=new WeakMap,jt=new WeakMap,pn=new WeakMap,Ae=new WeakMap,lt=new WeakMap,M=new WeakMap,mn=new WeakMap,gn=new WeakMap,xt=new WeakMap,re=new WeakMap,Se=new WeakMap,ie=new WeakMap,Kt=new WeakMap,bn=new WeakMap,z=new WeakMap,oe=new WeakMap,ae=new WeakMap,ce=new WeakMap,D=new WeakMap,wn=new WeakMap,Nt=new WeakMap,st=new WeakMap,di)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[pi](){return{log:(...t)=>{this[yn]()||console.log(...t),S(this,yt,!0,"f"),o(this,lt,"f").length&&S(this,lt,o(this,lt,"f")+`
|
|
65
|
+
`,"f"),S(this,lt,o(this,lt,"f")+t.join(" "),"f")},error:(...t)=>{this[yn]()||console.error(...t),S(this,yt,!0,"f"),o(this,lt,"f").length&&S(this,lt,o(this,lt,"f")+`
|
|
66
|
+
`,"f"),S(this,lt,o(this,lt,"f")+t.join(" "),"f")}}}[bs](t){_e(o(this,M,"f")).forEach(e=>{if((r=>r==="configObjects")(e))return;let n=o(this,M,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete o(this,D,"f").getDescriptions()[t]}[mi](t,e,n){o(this,un,"f")[n]||(o(this,z,"f").process.emitWarning(t,e),o(this,un,"f")[n]=!0)}[gi](){o(this,dn,"f").push({options:o(this,M,"f"),configObjects:o(this,M,"f").configObjects.slice(0),exitProcess:o(this,At,"f"),groups:o(this,Tt,"f"),strict:o(this,oe,"f"),strictCommands:o(this,ae,"f"),strictOptions:o(this,ce,"f"),completionCommand:o(this,wt,"f"),output:o(this,lt,"f"),exitError:o(this,Gt,"f"),hasOutput:o(this,yt,"f"),parsed:this.parsed,parseFn:o(this,xt,"f"),parseContext:o(this,re,"f")}),o(this,D,"f").freeze(),o(this,st,"f").freeze(),o(this,it,"f").freeze(),o(this,St,"f").freeze()}[bi](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(o(this,z,"f").process.argv()[0])?e=o(this,z,"f").process.argv().slice(1,2):e=o(this,z,"f").process.argv().slice(0,1),t=e.map(n=>{let r=this[Mi](o(this,ne,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&r.length<n.length?r:n}).join(" ").trim(),o(this,z,"f").getEnv("_")&&o(this,z,"f").getProcessArgvBin()===o(this,z,"f").getEnv("_")&&(t=o(this,z,"f").getEnv("_").replace(`${o(this,z,"f").path.dirname(o(this,z,"f").process.execPath())}/`,"")),t}[le](){return o(this,gn,"f")}[wi](){return o(this,wn,"f")}[ws](){if(!o(this,se,"f"))return;let t=o(this,z,"f").getEnv("LC_ALL")||o(this,z,"f").getEnv("LC_MESSAGES")||o(this,z,"f").getEnv("LANG")||o(this,z,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[yi](){return this[ys]().version||"unknown"}[xi](t){let e=t["--"]?t["--"]:t._;for(let n=0,r;(r=e[n])!==void 0;n++)o(this,z,"f").Parser.looksLikeNumber(r)&&Number.isSafeInteger(Math.floor(parseFloat(`${r}`)))&&(e[n]=Number(r));return t}[ys](t){let e=t||"*";if(o(this,Se,"f")[e])return o(this,Se,"f")[e];let n={};try{let r=t||o(this,z,"f").mainFilename;!t&&o(this,z,"f").path.extname(r)&&(r=o(this,z,"f").path.dirname(r));let i=o(this,z,"f").findUp(r,(a,c)=>{if(c.includes("package.json"))return"package.json"});dt(i,void 0,o(this,z,"f")),n=JSON.parse(o(this,z,"f").readFileSync(i,"utf8"))}catch{}return o(this,Se,"f")[e]=n||{},o(this,Se,"f")[e]}[Jt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Es](n),o(this,M,"f")[t].push(n)})}[je](t,e,n,r){this[Os](t,e,n,r,(i,a,c)=>{o(this,M,"f")[i][a]=c})}[xs](t,e,n,r){this[Os](t,e,n,r,(i,a,c)=>{o(this,M,"f")[i][a]=(o(this,M,"f")[i][a]||[]).concat(c)})}[Os](t,e,n,r,i){if(Array.isArray(n))n.forEach(a=>{t(a,r)});else if((a=>typeof a=="object")(n))for(let a of _e(n))t(a,n[a]);else i(e,this[Es](n),r)}[Es](t){return t==="__proto__"?"___proto___":t}[_s](t,e){return this[je](this[_s].bind(this),"key",t,e),this}[Cs](){var t,e,n,r,i,a,c,m,w,p,u,g;let y=o(this,dn,"f").pop();dt(y,void 0,o(this,z,"f"));let x;t=this,e=this,n=this,r=this,i=this,a=this,c=this,m=this,w=this,p=this,u=this,g=this,{options:{set value(O){S(t,M,O,"f")}}.value,configObjects:x,exitProcess:{set value(O){S(e,At,O,"f")}}.value,groups:{set value(O){S(n,Tt,O,"f")}}.value,output:{set value(O){S(r,lt,O,"f")}}.value,exitError:{set value(O){S(i,Gt,O,"f")}}.value,hasOutput:{set value(O){S(a,yt,O,"f")}}.value,parsed:this.parsed,strict:{set value(O){S(c,oe,O,"f")}}.value,strictCommands:{set value(O){S(m,ae,O,"f")}}.value,strictOptions:{set value(O){S(w,ce,O,"f")}}.value,completionCommand:{set value(O){S(p,wt,O,"f")}}.value,parseFn:{set value(O){S(u,xt,O,"f")}}.value,parseContext:{set value(O){S(g,re,O,"f")}}.value}=y,o(this,M,"f").configObjects=x,o(this,D,"f").unfreeze(),o(this,st,"f").unfreeze(),o(this,it,"f").unfreeze(),o(this,St,"f").unfreeze()}[Oi](t,e){return ee(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Ei].bind(this),getContext:this[_i].bind(this),getHasOutput:this[Ci].bind(this),getLoggerInstance:this[Ai].bind(this),getParseContext:this[Si].bind(this),getParserConfiguration:this[le].bind(this),getUsageConfiguration:this[wi].bind(this),getUsageInstance:this[ji].bind(this),getValidationInstance:this[vi].bind(this),hasParseCallback:this[yn].bind(this),isGlobalContext:this[Pi].bind(this),postProcess:this[fe].bind(this),reset:this[As].bind(this),runValidation:this[Ss].bind(this),runYargsParserAndExecuteCommands:this[Be].bind(this),setHasOutput:this[Ii].bind(this)}}[Ei](){return o(this,it,"f")}[_i](){return o(this,Le,"f")}[Ci](){return o(this,yt,"f")}[Ai](){return o(this,Ae,"f")}[Si](){return o(this,re,"f")||{}}[ji](){return o(this,D,"f")}[vi](){return o(this,st,"f")}[yn](){return!!o(this,xt,"f")}[Pi](){return o(this,pn,"f")}[fe](t,e,n,r){return n||K(t)||(e||(t=this[di](t)),(this[le]()["parse-positional-numbers"]||this[le]()["parse-positional-numbers"]===void 0)&&(t=this[xi](t)),r&&(t=te(t,this,o(this,St,"f").getMiddleware(),!1))),t}[As](t={}){S(this,M,o(this,M,"f")||{},"f");let e={};e.local=o(this,M,"f").local||[],e.configObjects=o(this,M,"f").configObjects||[];let n={};e.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(c=>{n[c]=!0})}),Object.assign(o(this,ie,"f"),Object.keys(o(this,Tt,"f")).reduce((a,c)=>{let m=o(this,Tt,"f")[c].filter(w=>!(w in n));return m.length>0&&(a[c]=m),a},{})),S(this,Tt,{},"f");let r=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],i=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return r.forEach(a=>{e[a]=(o(this,M,"f")[a]||[]).filter(c=>!n[c])}),i.forEach(a=>{e[a]=Ht(o(this,M,"f")[a],c=>!n[c])}),e.envPrefix=o(this,M,"f").envPrefix,S(this,M,e,"f"),S(this,D,o(this,D,"f")?o(this,D,"f").reset(n):ii(this,o(this,z,"f")),"f"),S(this,st,o(this,st,"f")?o(this,st,"f").reset(n):hi(this,o(this,D,"f"),o(this,z,"f")),"f"),S(this,it,o(this,it,"f")?o(this,it,"f").reset():ni(o(this,D,"f"),o(this,st,"f"),o(this,St,"f"),o(this,z,"f")),"f"),o(this,Ct,"f")||S(this,Ct,ci(this,o(this,D,"f"),o(this,it,"f"),o(this,z,"f")),"f"),o(this,St,"f").reset(),S(this,wt,null,"f"),S(this,lt,"","f"),S(this,Gt,null,"f"),S(this,yt,!1,"f"),this.parsed=!1,this}[Mi](t,e){return o(this,z,"f").path.relative(t,e)}[Be](t,e,n,r=0,i=!1){let a=!!n||i;t=t||o(this,Kt,"f"),o(this,M,"f").__=o(this,z,"f").y18n.__,o(this,M,"f").configuration=this[le]();let c=!!o(this,M,"f").configuration["populate--"],m=Object.assign({},o(this,M,"f").configuration,{"populate--":!0}),w=o(this,z,"f").Parser.detailed(t,Object.assign({},o(this,M,"f"),{configuration:{"parse-positional-numbers":!1,...m}})),p=Object.assign(w.argv,o(this,re,"f")),u,g=w.aliases,y=!1,x=!1;Object.keys(p).forEach(O=>{O===o(this,jt,"f")&&p[O]?y=!0:O===o(this,Nt,"f")&&p[O]&&(x=!0)}),p.$0=this.$0,this.parsed=w,r===0&&o(this,D,"f").clearCachedHelpMessage();try{if(this[ws](),e)return this[fe](p,c,!!n,!1);o(this,jt,"f")&&[o(this,jt,"f")].concat(g[o(this,jt,"f")]||[]).filter(B=>B.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),y=!0),S(this,pn,!1,"f");let O=o(this,it,"f").getCommands(),d=o(this,Ct,"f").completionKey in p,T=y||d||i;if(p._.length){if(O.length){let F;for(let B=r||0,U;p._[B]!==void 0;B++)if(U=String(p._[B]),O.includes(U)&&U!==o(this,wt,"f")){let W=o(this,it,"f").runCommand(U,this,w,B+1,i,y||x||i);return this[fe](W,c,!!n,!1)}else if(!F&&U!==o(this,wt,"f")){F=U;break}!o(this,it,"f").hasDefaultCommand()&&o(this,bn,"f")&&F&&!T&&o(this,st,"f").recommendCommands(F,O)}o(this,wt,"f")&&p._.includes(o(this,wt,"f"))&&!d&&(o(this,At,"f")&&Yt(!0),this.showCompletionScript(),this.exit(0))}if(o(this,it,"f").hasDefaultCommand()&&!T){let F=o(this,it,"f").runCommand(null,this,w,0,i,y||x||i);return this[fe](F,c,!!n,!1)}if(d){o(this,At,"f")&&Yt(!0),t=[].concat(t);let F=t.slice(t.indexOf(`--${o(this,Ct,"f").completionKey}`)+1);return o(this,Ct,"f").getCompletion(F,(B,U)=>{if(B)throw new G(B.message);(U||[]).forEach(W=>{o(this,Ae,"f").log(W)}),this.exit(0)}),this[fe](p,!c,!!n,!1)}if(o(this,yt,"f")||(y?(o(this,At,"f")&&Yt(!0),a=!0,this.showHelp("log"),this.exit(0)):x&&(o(this,At,"f")&&Yt(!0),a=!0,o(this,D,"f").showVersion("log"),this.exit(0))),!a&&o(this,M,"f").skipValidation.length>0&&(a=Object.keys(p).some(F=>o(this,M,"f").skipValidation.indexOf(F)>=0&&p[F]===!0)),!a){if(w.error)throw new G(w.error.message);if(!d){let F=this[Ss](g,{},w.error);n||(u=te(p,this,o(this,St,"f").getMiddleware(),!0)),u=this[Oi](F,u??p),K(u)&&!n&&(u=u.then(()=>te(p,this,o(this,St,"f").getMiddleware(),!1)))}}}catch(O){if(O instanceof G)o(this,D,"f").fail(O.message,O);else throw O}return this[fe](u??p,c,!!n,!0)}[Ss](t,e,n,r){let i={...this.getDemandedOptions()};return a=>{if(n)throw new G(n.message);o(this,st,"f").nonOptionCount(a),o(this,st,"f").requiredArguments(a,i);let c=!1;o(this,ae,"f")&&(c=o(this,st,"f").unknownCommands(a)),o(this,oe,"f")&&!c?o(this,st,"f").unknownArguments(a,t,e,!!r):o(this,ce,"f")&&o(this,st,"f").unknownArguments(a,t,{},!1,!1),o(this,st,"f").limitedChoices(a),o(this,st,"f").implications(a),o(this,st,"f").conflicting(a)}}[Ii](){S(this,yt,!0,"f")}[he](t){if(typeof t=="string")o(this,M,"f").key[t]=!0;else for(let e of t)o(this,M,"f").key[e]=!0}};function si(s){return!!s&&typeof s.getInternalMethods=="function"}var dc=$i(Zr),Ti=dc;var Li=Wt(zi(),1);var Ms=Wt(H("path"),1),Ps=Wt(H("process"),1),Ui=H("module"),Fi=H("url");function pc(s){let t=Ms.default.extname(s);return t?s.slice(0,-t.length):s}function Is(s){if(!s||!Ps.default.argv[1])return!1;let e=(0,Ui.createRequire)(s.url).resolve(Ps.default.argv[1]),n=(0,Fi.fileURLToPath)(s.url);return Ms.default.extname(e)?n===e:pc(n)===e}var bc={},mc=process.argv.slice(2),Di=new Li.default(Ti),$s=console.log;async function Ts(s){Di.yargs.option("listen",{desc:"daemon control listen multiaddr",type:"string",default:"/unix/tmp/p2pd.sock"}).option("quiet",{alias:"q",desc:"be quiet",type:"boolean",default:!1}).option("id",{desc:"peer identity; private key file",type:"string",default:""}).option("hostAddrs",{desc:"Comma separated list of multiaddrs the host should listen on",type:"string",default:""}).option("announceAddrs",{desc:"Comma separated list of multiaddrs the host should announce to the network",type:"string",default:""}).option("bootstrap",{alias:"b",desc:"Connects to bootstrap peers and bootstraps the dht if enabled",type:"boolean",default:!1}).option("bootstrapPeers",{desc:"Comma separated list of bootstrap peers; defaults to the IPFS DHT peers",type:"string",default:""}).option("dht",{desc:"Enables the DHT in full node mode",type:"boolean",default:!1}).option("dhtClient",{desc:"(Not yet supported) Enables the DHT in client mode",type:"boolean",default:!1}).option("nat",{desc:"Enables UPnP NAT hole punching",type:"boolean",default:!1}).option("connMgr",{desc:"(Not yet supported) Enables the Connection Manager",type:"boolean",default:!1}).option("connMgrLo",{desc:"Number identifying the number of peers below which this node will not activate preemptive disconnections",type:"number"}).option("connMgrHi",{desc:"Number identifying the maximum number of peers the current peer is willing to be connected to before is starts disconnecting",type:"number"}).option("pubsub",{desc:"Enables pubsub",type:"boolean",default:!1}).option("pubsubRouter",{desc:"Specifies the pubsub router implementation",type:"string",default:"gossipsub"}).fail((r,i,a)=>{if(i!=null)throw i;mc.length>0&&$s(r),a.showHelp()});let{data:t,argv:e}=await Di.parse(s);t!=null&&($s(t),process.exit(0)),await(await Bi(jr(e.listen),e)).start(),e.quiet!==!0&&$s("daemon has started")}async function Bi(s,t){throw new Error("Not implemented yet")}Is(bc)&&Ts(process.argv).catch(s=>{console.error(s),process.exit(1)});return Yi(gc);})();
|
|
67
|
+
/*! Bundled license information:
|
|
68
|
+
|
|
69
|
+
yargs-parser/build/lib/string-utils.js:
|
|
70
|
+
(**
|
|
71
|
+
* @license
|
|
72
|
+
* Copyright (c) 2016, Contributors
|
|
73
|
+
* SPDX-License-Identifier: ISC
|
|
74
|
+
*)
|
|
75
|
+
|
|
76
|
+
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
77
|
+
(**
|
|
78
|
+
* @license
|
|
79
|
+
* Copyright (c) 2016, Contributors
|
|
80
|
+
* SPDX-License-Identifier: ISC
|
|
81
|
+
*)
|
|
82
|
+
|
|
83
|
+
yargs-parser/build/lib/yargs-parser-types.js:
|
|
84
|
+
(**
|
|
85
|
+
* @license
|
|
86
|
+
* Copyright (c) 2016, Contributors
|
|
87
|
+
* SPDX-License-Identifier: ISC
|
|
88
|
+
*)
|
|
89
|
+
|
|
90
|
+
yargs-parser/build/lib/yargs-parser.js:
|
|
91
|
+
(**
|
|
92
|
+
* @license
|
|
93
|
+
* Copyright (c) 2016, Contributors
|
|
94
|
+
* SPDX-License-Identifier: ISC
|
|
95
|
+
*)
|
|
96
|
+
|
|
97
|
+
yargs-parser/build/lib/index.js:
|
|
98
|
+
(**
|
|
99
|
+
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
100
|
+
* CJS and ESM environments.
|
|
101
|
+
*
|
|
102
|
+
* @license
|
|
103
|
+
* Copyright (c) 2016, Contributors
|
|
104
|
+
* SPDX-License-Identifier: ISC
|
|
105
|
+
*)
|
|
106
|
+
*/
|
|
107
|
+
return Libp2PDaemon}));
|
package/dist/src/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/daemon",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "libp2p-daemon JavaScript implementation",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p-daemon/tree/master/packages/libp2p-daemon#readme",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"types": "./dist/src/index.d.ts",
|
|
26
26
|
"files": [
|
|
27
27
|
"src",
|
|
28
|
-
"dist
|
|
28
|
+
"dist",
|
|
29
29
|
"!dist/test",
|
|
30
30
|
"!**/*.tsbuildinfo"
|
|
31
31
|
],
|
|
@@ -136,14 +136,14 @@
|
|
|
136
136
|
"release": "aegir release"
|
|
137
137
|
},
|
|
138
138
|
"dependencies": {
|
|
139
|
-
"@libp2p/daemon-server": "^
|
|
139
|
+
"@libp2p/daemon-server": "^4.0.0",
|
|
140
140
|
"@multiformats/multiaddr": "^11.0.0",
|
|
141
141
|
"es-main": "^1.0.2",
|
|
142
142
|
"yargs": "^17.3.1",
|
|
143
143
|
"yargs-promise": "^1.1.0"
|
|
144
144
|
},
|
|
145
145
|
"devDependencies": {
|
|
146
|
-
"aegir": "^37.
|
|
147
|
-
"sinon": "^
|
|
146
|
+
"aegir": "^37.9.1",
|
|
147
|
+
"sinon": "^15.0.1"
|
|
148
148
|
}
|
|
149
149
|
}
|