UNPKG

mdat

Version:

CLI tool and TypeScript library implementing the Markdown Autophagic Template (MDAT) system. MDAT lets you use comments as dynamic content templates in Markdown files, making it easy to generate and update readme boilerplate.

9 lines 502 kB
#!/usr/bin/env node var _w=Object.create;var Xl=Object.defineProperty;var Sw=Object.getOwnPropertyDescriptor;var vw=Object.getOwnPropertyNames;var Iw=Object.getPrototypeOf,Ow=Object.prototype.hasOwnProperty;var Er=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var sa=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dw=(t,e)=>{for(var r in e)Xl(t,r,{get:e[r],enumerable:!0})},Rw=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vw(e))!Ow.call(t,i)&&i!==r&&Xl(t,i,{get:()=>e[i],enumerable:!(n=Sw(e,i))||n.enumerable});return t};var ts=(t,e,r)=>(r=t!=null?_w(Iw(t)):{},Rw(e||!t||!t.__esModule?Xl(r,"default",{value:t,enumerable:!0}):r,t));var la=sa((HL,Jl)=>{"use strict";var ua=process||{},Rd=ua.argv||[],aa=ua.env||{},Fw=!(aa.NO_COLOR||Rd.includes("--no-color"))&&(!!aa.FORCE_COLOR||Rd.includes("--color")||ua.platform==="win32"||(ua.stdout||{}).isTTY&&aa.TERM!=="dumb"||!!aa.CI),Nw=(t,e,r=t)=>n=>{let i=""+n,o=i.indexOf(e,t.length);return~o?t+Pw(i,e,r,o)+e:t+i+e},Pw=(t,e,r,n)=>{let i="",o=0;do i+=t.substring(o,n)+r,o=n+e.length,n=t.indexOf(e,o);while(~n);return i+t.substring(o)},Fd=(t=Fw)=>{let e=t?Nw:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Jl.exports=Fd();Jl.exports.createColors=Fd});var jh=sa((sj,UC)=>{UC.exports={addendum:"addenda",aircraft:"aircraft",alga:"algae",alumna:"alumnae",alumnus:"alumni",alveolus:"alveoli",amoeba:"amoebae",analysis:"analyses",antenna:"antennae",antithesis:"antitheses",apex:"apices",appendix:"appendices",automaton:"automata",axis:"axes",bacillus:"bacilli",bacterium:"bacteria",baculum:"bacula",barracks:"barracks",basis:"bases",beau:"beaux",bison:"bison",buffalo:"buffalo",bureau:"bureaus",cactus:"cacti",calf:"calves",carcinoma:"carcinomata",carp:"carp",census:"censuses",chassis:"chassis",cherub:"cherubim",child:"children",ch\u00E2teau:"ch\xE2teaus",cloaca:"cloacae",cod:"cod",codex:"codices",concerto:"concerti",consortium:"consortia",corpus:"corpora",crisis:"crises",criterion:"criteria",curriculum:"curricula",cystoma:"cystomata",datum:"data",deer:"deer",diagnosis:"diagnoses",die:"dice",dwarf:"dwarfs",echo:"echoes",elf:"elves",elk:"elk",ellipsis:"ellipses",embargo:"embargoes",emphasis:"emphases",erratum:"errata","faux pas":"faux pas",fez:"fezes",firmware:"firmware",fish:"fish",focus:"foci",foot:"feet",formula:"formulae",fungus:"fungi",gallows:"gallows",genus:"genera",glomerulus:"glomeruli",goose:"geese",graffito:"graffiti",grouse:"grouse",half:"halves",hamulus:"hamuli",hero:"heroes",hippopotamus:"hippopotami",hoof:"hooves",hovercraft:"hovercraft",hypothesis:"hypotheses",iliac:"ilia",incubus:"incubi",index:"indices",interstitium:"interstitia",kakapo:"kakapo",knife:"knives",larva:"larvae",leaf:"leaves",libretto:"libretti",life:"lives",loaf:"loaves",loculus:"loculi",locus:"loci",louse:"lice",man:"men",matrix:"matrices",means:"means",measles:"measles",media:"media",medium:"media",memorandum:"memoranda",millennium:"millennia",minutia:"minutiae",moose:"moose",mouse:"mice",nebula:"nebulae",nemesis:"nemeses",neurosis:"neuroses",news:"news",nucleolus:"nucleoli",nucleus:"nuclei",oasis:"oases",occiput:"occipita",offspring:"offspring",omphalos:"omphaloi",opus:"opera",ovum:"ova",ox:"oxen",paralysis:"paralyses",parenthesis:"parentheses",person:"people",phenomenon:"phenomena",phylum:"phyla",pike:"pike",polyhedron:"polyhedra",potato:"potatoes",primus:"primi",prognosis:"prognoses",quiz:"quizzes",radius:"radii",referendum:"referenda",salmon:"salmon",scarf:"scarves",scrotum:"scrota",self:"selves",seminoma:"seminomata",series:"series",sheep:"sheep",shelf:"shelves",shrimp:"shrimp",simulacrum:"simulacra",soliloquy:"soliloquies",spacecraft:"spacecraft",species:"species",spectrum:"spectra",squid:"squid",stimulus:"stimuli",stratum:"strata",swine:"swine",syconium:"syconia",syllabus:"syllabi",symposium:"symposia",synopsis:"synopses",synthesis:"syntheses",tableau:"tableaus",testis:"testes",that:"those",thesis:"theses",thief:"thieves",this:"these",thrombus:"thrombi",tomato:"tomatoes",tooth:"teeth",torus:"tori",trout:"trout",tuna:"tuna",umbilicus:"umbilici",uterus:"uteri",vertebra:"vertebrae",vertex:"vertices",veto:"vetoes",vita:"vitae",vortex:"vortices",watercraft:"watercraft",wharf:"wharves",wife:"wives",wolf:"wolves",woman:"women"}});var zh=sa((aj,Uh)=>{"use strict";var zC=jh();Uh.exports=new Map(Object.entries(zC))});var Sg=sa((Z9,_g)=>{"use strict";var ou=Object.prototype.hasOwnProperty,Tg=Object.prototype.toString,bg=Object.defineProperty,Eg=Object.getOwnPropertyDescriptor,Ag=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Tg.call(e)==="[object Array]"},wg=function(e){if(!e||Tg.call(e)!=="[object Object]")return!1;var r=ou.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&ou.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||ou.call(e,i)},Cg=function(e,r){bg&&r.name==="__proto__"?bg(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},kg=function(e,r){if(r==="__proto__")if(ou.call(e,r)){if(Eg)return Eg(e,r).value}else return;return e[r]};_g.exports=function t(){var e,r,n,i,o,s,a=arguments[0],u=1,l=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<l;++u)if(e=arguments[u],e!=null)for(r in e)n=kg(a,r),i=kg(e,r),a!==i&&(c&&i&&(wg(i)||(o=Ag(i)))?(o?(o=!1,s=n&&Ag(n)?n:[]):s=n&&wg(n)?n:{},Cg(a,{name:r,newValue:t(c,s,i)})):typeof i<"u"&&Cg(a,{name:r,newValue:i}));return a}});var Jo=ts(la(),1);var Nd=t=>Number.isFinite(t)?t:0;function Lw(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(Nd(t*1e3)%1e3),nanoseconds:Math.trunc(Nd(t*1e6)%1e3)}}function Mw(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function Ql(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Lw(t);break}case"bigint":return Mw(t)}throw new TypeError("Expected a finite number or bigint")}var Bw=t=>t===0||t===0n,jw=(t,e)=>e===1||e===1n?t:`${t}s`,Uw=1e-7,zw=24n*60n*60n*1000n;function Vr(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(c,f)=>{let p=Math.floor(c*10**f+Uw);return(Math.round(p)/10**f).toFixed(f)},s=(c,f,p,d)=>{if(!((i.length===0||!e.colonNotation)&&Bw(c)&&!(e.colonNotation&&p==="m"))){if(d??=String(c),e.colonNotation){let m=d.includes(".")?d.split(".")[0].length:d.length,y=i.length>0?2:1;d="0".repeat(Math.max(0,y-m))+d}else d+=e.verbose?" "+jw(f,c):p;i.push(d)}},a=Ql(t),u=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(u)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(u,"day","d"):(s(u/365n,"year","y"),s(u%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3){let c=Number(a.seconds),f=Number(a.milliseconds),p=Number(a.microseconds),d=Number(a.nanoseconds);if(s(c,"second","s"),e.formatSubMilliseconds)s(f,"millisecond","ms"),s(p,"microsecond","\xB5s"),s(d,"nanosecond","ns");else{let m=f+p/1e3+d/1e6,y=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=y?m.toFixed(y):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let c=(r?Number(t%zw):t)/1e3%60,f=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,p=o(c,f),d=e.keepDecimalsOnWholeSeconds?p:p.replace(/\.0+$/,"");s(Number.parseFloat(d),"second","s",d)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}import{getMdatReports as GL,log as ht,reporterMdat as Yo}from"remark-mdat";import Pd from"node:fs";import Ld from"node:path";import{VFile as $w}from"vfile";function ec(t,e,r){let n=tc(t);if(!r&&typeof e=="function"&&(r=e,e=void 0),!r)return new Promise(o);o(i,r);function i(s){r(void 0,s)}function o(s,a){let u;try{u=Ld.resolve(n.cwd,n.path)}catch(c){return a(c)}Pd.readFile(u,e,l);function l(c,f){c?a(c):(n.value=f,s(n))}}}function tc(t){return typeof t=="string"||t instanceof URL?t={path:t}:Vw(t)&&(t={path:new TextDecoder().decode(t)}),qw(t)?t:new $w(t)}function un(t,e,r){let n=tc(t);if(!r&&typeof e=="function"&&(r=e,e=void 0),!r)return new Promise(o);o(i,r);function i(s){r(void 0,s)}function o(s,a){let u;try{u=Ld.resolve(n.cwd,n.path)}catch(c){return a(c)}Pd.writeFile(u,n.value||"",e||void 0,l);function l(c){c?a(c):s(n)}}}function qw(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Vw(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}import{notStrictEqual as mC,strictEqual as gC}from"assert";var Gw={right:Zw,center:Xw},Ww=0,ca=1,Hw=2,fa=3,rc=class{constructor(e){var r;this.width=e.width,this.wrap=(r=e.wrap)!==null&&r!==void 0?r:!0,this.rows=[]}span(...e){let r=this.div(...e);r.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let r=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(r),r}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let r=e.split(` `).map(i=>i.split(" ")),n=0;return r.forEach(i=>{i.length>1&&Ht.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),Ht.stringWidth(i[0])))}),r.forEach(i=>{this.div(...i.map((o,s)=>({text:o.trim(),padding:this.measurePadding(o),width:s===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let r=Ht.stripAnsi(e);return[0,r.match(/\s*$/)[0].length,0,r.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(r=>{this.rowToString(r,e)}),e.filter(r=>!r.hidden).map(r=>r.text).join(` `)}rowToString(e,r){return this.rasterize(e).forEach((n,i)=>{let o="";n.forEach((s,a)=>{let{width:u}=e[a],l=this.negatePadding(e[a]),c=s;if(l>Ht.stringWidth(s)&&(c+=" ".repeat(l-Ht.stringWidth(s))),e[a].align&&e[a].align!=="left"&&this.wrap){let p=Gw[e[a].align];c=p(c,l),Ht.stringWidth(c)<l&&(c+=" ".repeat((u||0)-Ht.stringWidth(c)-1))}let f=e[a].padding||[0,0,0,0];f[fa]&&(o+=" ".repeat(f[fa])),o+=Md(e[a],c,"| "),o+=c,o+=Md(e[a],c," |"),f[ca]&&(o+=" ".repeat(f[ca])),i===0&&r.length>0&&(o=this.renderInline(o,r[r.length-1]))}),r.push({text:o.replace(/ +$/,""),span:e.span})}),r}renderInline(e,r){let n=e.match(/^ */),i=n?n[0].length:0,o=r.text,s=Ht.stringWidth(o.trimRight());return r.span?this.wrap?i<s?e:(r.hidden=!0,o.trimRight()+" ".repeat(i-s)+e.trimLeft()):(r.hidden=!0,o+e):e}rasterize(e){let r=[],n=this.columnWidths(e),i;return e.forEach((o,s)=>{o.width=n[s],this.wrap?i=Ht.wrap(o.text,this.negatePadding(o),{hard:!0}).split(` `):i=o.text.split(` `),o.border&&(i.unshift("."+"-".repeat(this.negatePadding(o)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(o)+2)+"'")),o.padding&&(i.unshift(...new Array(o.padding[Ww]||0).fill("")),i.push(...new Array(o.padding[Hw]||0).fill(""))),i.forEach((a,u)=>{r[u]||r.push([]);let l=r[u];for(let c=0;c<s;c++)l[c]===void 0&&l.push("");l.push(a)})}),r}negatePadding(e){let r=e.width||0;return e.padding&&(r-=(e.padding[fa]||0)+(e.padding[ca]||0)),e.border&&(r-=4),r}columnWidths(e){if(!this.wrap)return e.map(s=>s.width||Ht.stringWidth(s.text));let r=e.length,n=this.width,i=e.map(s=>{if(s.width)return r--,n-=s.width,s.width}),o=r?Math.floor(n/r):0;return i.map((s,a)=>s===void 0?Math.max(o,Kw(e[a])):s)}};function Md(t,e,r){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?r:" ":""}function Kw(t){let e=t.padding||[],r=1+(e[fa]||0)+(e[ca]||0);return t.border?r+4:r}function Yw(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Zw(t,e){t=t.trim();let r=Ht.stringWidth(t);return r<e?" ".repeat(e-r)+t:t}function Xw(t,e){t=t.trim();let r=Ht.stringWidth(t);return r>=e?t:" ".repeat(e-r>>1)+t}var Ht;function Bd(t,e){return Ht=e,new rc({width:t?.width||Yw(),wrap:t?.wrap})}var jd=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function nc(t){return t.replace(jd,"")}function Ud(t,e){let[r,n]=t.match(jd)||["",""];t=nc(t);let i="";for(let o=0;o<t.length;o++)o!==0&&o%e===0&&(i+=` `),i+=t.charAt(o);return r&&n&&(i=`${r}${i}${n}`),i}function ic(t){return Bd(t,{stringWidth:e=>[...e].length,stripAnsi:nc,wrap:Ud})}import{dirname as zd,resolve as $d}from"path";import{readdirSync as Jw,statSync as Qw}from"fs";function qd(t,e){let r=$d(".",t),n;for(Qw(r).isDirectory()||(r=zd(r));;){if(n=e(r,Jw(r)),n)return $d(r,n);if(r=zd(n=r),n===r)break}}import{inspect as xC}from"util";import{readFileSync as yC}from"fs";import{fileURLToPath as bC}from"url";import{format as rC}from"util";import{normalize as nC,resolve as iC}from"path";function $n(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let r="",n=!1,i=t.match(/^-+/);for(let o=i?i[0].length:0;o<t.length;o++){let s=t.charAt(o);n&&(n=!1,s=s.toUpperCase()),o!==0&&(s==="-"||s==="_")?n=!0:s!=="-"&&s!=="_"&&(r+=s)}return r}}function pa(t,e){let r=t.toLowerCase();e=e||"-";let n="";for(let i=0;i<t.length;i++){let o=r.charAt(i),s=t.charAt(i);o!==s&&i>0?n+=`${e}${r.charAt(i)}`:n+=s}return n}function da(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function Vd(t){if(Array.isArray(t))return t.map(s=>typeof s!="string"?s+"":s);t=t.trim();let e=0,r=null,n=null,i=null,o=[];for(let s=0;s<t.length;s++){if(r=n,n=t.charAt(s),n===" "&&!i){r!==" "&&e++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),o[e]||(o[e]=""),o[e]+=n}return o}var rr;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(rr||(rr={}));var Gr,ha=class{constructor(e){Gr=e}parse(e,r){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},r),i=Vd(e),o=typeof e=="string",s=eC(Object.assign(Object.create(null),n.alias)),a=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),u=Object.assign(Object.create(null),n.default),l=n.configObjects||[],c=n.envPrefix,f=a["populate--"],p=f?"--":"_",d=Object.create(null),m=Object.create(null),y=n.__||Gr.format,g={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:[]},b=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,C=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(A){let k=typeof A=="object"?A.key:A,M=Object.keys(A).map(function(I){return{boolean:"bools",string:"strings",number:"numbers"}[I]}).filter(Boolean).pop();M&&(g[M][k]=!0),g.arrays[k]=!0,g.keys.push(k)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(A){g.bools[A]=!0,g.keys.push(A)}),[].concat(n.string||[]).filter(Boolean).forEach(function(A){g.strings[A]=!0,g.keys.push(A)}),[].concat(n.number||[]).filter(Boolean).forEach(function(A){g.numbers[A]=!0,g.keys.push(A)}),[].concat(n.count||[]).filter(Boolean).forEach(function(A){g.counts[A]=!0,g.keys.push(A)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(A){g.normalize[A]=!0,g.keys.push(A)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([A,k])=>{typeof k=="number"&&(g.nargs[A]=k,g.keys.push(A))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([A,k])=>{typeof k=="function"&&(g.coercions[A]=k,g.keys.push(A))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(A){g.configs[A]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([A,k])=>{(typeof k=="boolean"||typeof k=="function")&&(g.configs[A]=k)})),E(n.key,s,n.default,g.arrays),Object.keys(u).forEach(function(A){(g.aliases[A]||[]).forEach(function(k){u[k]=u[A]})});let w=null;Ut();let D=[],R=Object.assign(Object.create(null),{_:[]}),S={};for(let A=0;A<i.length;A++){let k=i[A],M=k.replace(/^-{3,}/,"---"),I,T,K,$,te,lt;if(k!=="--"&&/^-/.test(k)&&oe(k))de(k);else if(M.match(/^---+(=|$)/)){de(k);continue}else if(k.match(/^--.+=/)||!a["short-option-groups"]&&k.match(/^-.+=/))$=k.match(/^--?([^=]+)=([\s\S]*)$/),$!==null&&Array.isArray($)&&$.length>=3&&(W($[1],g.arrays)?A=be(A,$[1],i,$[2]):W($[1],g.nargs)!==!1?A=ye(A,$[1],i,$[2]):_($[1],$[2],!0));else if(k.match(C)&&a["boolean-negation"])$=k.match(C),$!==null&&Array.isArray($)&&$.length>=2&&(T=$[1],_(T,W(T,g.arrays)?[!1]:!1));else if(k.match(/^--.+/)||!a["short-option-groups"]&&k.match(/^-[^-]+/))$=k.match(/^--?(.+)/),$!==null&&Array.isArray($)&&$.length>=2&&(T=$[1],W(T,g.arrays)?A=be(A,T,i):W(T,g.nargs)!==!1?A=ye(A,T,i):(te=i[A+1],te!==void 0&&(!te.match(/^-/)||te.match(b))&&!W(T,g.bools)&&!W(T,g.counts)||/^(true|false)$/.test(te)?(_(T,te),A++):_(T,me(T))));else if(k.match(/^-.\..+=/))$=k.match(/^-([^=]+)=([\s\S]*)$/),$!==null&&Array.isArray($)&&$.length>=3&&_($[1],$[2]);else if(k.match(/^-.\..+/)&&!k.match(b))te=i[A+1],$=k.match(/^-(.\..+)/),$!==null&&Array.isArray($)&&$.length>=2&&(T=$[1],te!==void 0&&!te.match(/^-/)&&!W(T,g.bools)&&!W(T,g.counts)?(_(T,te),A++):_(T,me(T)));else if(k.match(/^-[^-]+/)&&!k.match(b)){K=k.slice(1,-1).split(""),I=!1;for(let Ct=0;Ct<K.length;Ct++){if(te=k.slice(Ct+2),K[Ct+1]&&K[Ct+1]==="="){lt=k.slice(Ct+3),T=K[Ct],W(T,g.arrays)?A=be(A,T,i,lt):W(T,g.nargs)!==!1?A=ye(A,T,i,lt):_(T,lt),I=!0;break}if(te==="-"){_(K[Ct],te);continue}if(/[A-Za-z]/.test(K[Ct])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(te)&&W(te,g.bools)===!1){_(K[Ct],te),I=!0;break}if(K[Ct+1]&&K[Ct+1].match(/\W/)){_(K[Ct],te),I=!0;break}else _(K[Ct],me(K[Ct]))}T=k.slice(-1)[0],!I&&T!=="-"&&(W(T,g.arrays)?A=be(A,T,i):W(T,g.nargs)!==!1?A=ye(A,T,i):(te=i[A+1],te!==void 0&&(!/^(-|--)[^-]/.test(te)||te.match(b))&&!W(T,g.bools)&&!W(T,g.counts)||/^(true|false)$/.test(te)?(_(T,te),A++):_(T,me(T))))}else if(k.match(/^-[0-9]$/)&&k.match(b)&&W(k.slice(1),g.bools))T=k.slice(1),_(T,me(T));else if(k==="--"){D=i.slice(A+1);break}else if(a["halt-at-non-option"]){D=i.slice(A);break}else de(k)}ee(R,!0),ee(R,!1),P(R),ae(),x(R,g.aliases,u,!0),_e(R),a["set-placeholder-key"]&&rt(R),Object.keys(g.counts).forEach(function(A){Ue(R,A.split("."))||_(A,0)}),f&&D.length&&(R[p]=[]),D.forEach(function(A){R[p].push(A)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(R).filter(A=>A!=="--"&&A.includes("-")).forEach(A=>{delete R[A]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(A=>s[A])).forEach(A=>{a["camel-case-expansion"]&&A.includes("-")&&delete R[A.split(".").map(k=>$n(k)).join(".")],delete R[A]});function de(A){let k=v("_",A);(typeof k=="string"||typeof k=="number")&&R._.push(k)}function ye(A,k,M,I){let T,K=W(k,g.nargs);if(K=typeof K!="number"||isNaN(K)?1:K,K===0)return ze(I)||(w=Error(y("Argument unexpected for: %s",k))),_(k,me(k)),A;let $=ze(I)?0:1;if(a["nargs-eats-options"])M.length-(A+1)+$<K&&(w=Error(y("Not enough arguments following: %s",k))),$=K;else{for(T=A+1;T<M.length&&(!M[T].match(/^-[^0-9]/)||M[T].match(b)||oe(M[T]));T++)$++;$<K&&(w=Error(y("Not enough arguments following: %s",k)))}let te=Math.min($,K);for(!ze(I)&&te>0&&(_(k,I),te--),T=A+1;T<te+A+1;T++)_(k,M[T]);return A+te}function be(A,k,M,I){let T=[],K=I||M[A+1],$=W(k,g.nargs);if(W(k,g.bools)&&!/^(true|false)$/.test(K))T.push(!0);else if(ze(K)||ze(I)&&/^-/.test(K)&&!b.test(K)&&!oe(K)){if(u[k]!==void 0){let te=u[k];T=Array.isArray(te)?te:[te]}}else{ze(I)||T.push(F(k,I,!0));for(let te=A+1;te<M.length&&!(!a["greedy-arrays"]&&T.length>0||$&&typeof $=="number"&&T.length>=$||(K=M[te],/^-/.test(K)&&!b.test(K)&&!oe(K)));te++)A=te,T.push(F(k,K,o))}return typeof $=="number"&&($&&T.length<$||isNaN($)&&T.length===0)&&(w=Error(y("Not enough arguments following: %s",k))),_(k,T),A}function _(A,k,M=o){if(/-/.test(A)&&a["camel-case-expansion"]){let K=A.split(".").map(function($){return $n($)}).join(".");L(A,K)}let I=F(A,k,M),T=A.split(".");Je(R,T,I),g.aliases[A]&&g.aliases[A].forEach(function(K){let $=K.split(".");Je(R,$,I)}),T.length>1&&a["dot-notation"]&&(g.aliases[T[0]]||[]).forEach(function(K){let $=K.split("."),te=[].concat(T);te.shift(),$=$.concat(te),(g.aliases[A]||[]).includes($.join("."))||Je(R,$,I)}),W(A,g.normalize)&&!W(A,g.arrays)&&[A].concat(g.aliases[A]||[]).forEach(function($){Object.defineProperty(S,$,{enumerable:!0,get(){return k},set(te){k=typeof te=="string"?Gr.normalize(te):te}})})}function L(A,k){g.aliases[A]&&g.aliases[A].length||(g.aliases[A]=[k],d[k]=!0),g.aliases[k]&&g.aliases[k].length||L(k,A)}function F(A,k,M){M&&(k=tC(k)),(W(A,g.bools)||W(A,g.counts))&&typeof k=="string"&&(k=k==="true");let I=Array.isArray(k)?k.map(function(T){return v(A,T)}):v(A,k);return W(A,g.counts)&&(ze(I)||typeof I=="boolean")&&(I=oc()),W(A,g.normalize)&&W(A,g.arrays)&&(Array.isArray(k)?I=k.map(T=>Gr.normalize(T)):I=Gr.normalize(k)),I}function v(A,k){return!a["parse-positional-numbers"]&&A==="_"||!W(A,g.strings)&&!W(A,g.bools)&&!Array.isArray(k)&&(da(k)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${k}`)))||!ze(k)&&W(A,g.numbers))&&(k=Number(k)),k}function P(A){let k=Object.create(null);x(k,g.aliases,u),Object.keys(g.configs).forEach(function(M){let I=A[M]||k[M];if(I)try{let T=null,K=Gr.resolve(Gr.cwd(),I),$=g.configs[M];if(typeof $=="function"){try{T=$(K)}catch(te){T=te}if(T instanceof Error){w=T;return}}else T=Gr.require(K);j(T)}catch(T){T.name==="PermissionDenied"?w=T:A[M]&&(w=Error(y("Invalid JSON config file: %s",I)))}})}function j(A,k){Object.keys(A).forEach(function(M){let I=A[M],T=k?k+"."+M:M;typeof I=="object"&&I!==null&&!Array.isArray(I)&&a["dot-notation"]?j(I,T):(!Ue(R,T.split("."))||W(T,g.arrays)&&a["combine-arrays"])&&_(T,I)})}function ae(){typeof l<"u"&&l.forEach(function(A){j(A)})}function ee(A,k){if(typeof c>"u")return;let M=typeof c=="string"?c:"",I=Gr.env();Object.keys(I).forEach(function(T){if(M===""||T.lastIndexOf(M,0)===0){let K=T.split("__").map(function($,te){return te===0&&($=$.substring(M.length)),$n($)});(k&&g.configs[K.join(".")]||!k)&&!Ue(A,K)&&_(K.join("."),I[T])}})}function _e(A){let k,M=new Set;Object.keys(A).forEach(function(I){if(!M.has(I)&&(k=W(I,g.coercions),typeof k=="function"))try{let T=v(I,k(A[I]));[].concat(g.aliases[I]||[],I).forEach(K=>{M.add(K),A[K]=T})}catch(T){w=T}})}function rt(A){return g.keys.forEach(k=>{~k.indexOf(".")||typeof A[k]>"u"&&(A[k]=void 0)}),A}function x(A,k,M,I=!1){Object.keys(M).forEach(function(T){Ue(A,T.split("."))||(Je(A,T.split("."),M[T]),I&&(m[T]=!0),(k[T]||[]).forEach(function(K){Ue(A,K.split("."))||Je(A,K.split("."),M[T])}))})}function Ue(A,k){let M=A;a["dot-notation"]||(k=[k.join(".")]),k.slice(0,-1).forEach(function(T){M=M[T]||{}});let I=k[k.length-1];return typeof M!="object"?!1:I in M}function Je(A,k,M){let I=A;a["dot-notation"]||(k=[k.join(".")]),k.slice(0,-1).forEach(function(lt){lt=Gd(lt),typeof I=="object"&&I[lt]===void 0&&(I[lt]={}),typeof I[lt]!="object"||Array.isArray(I[lt])?(Array.isArray(I[lt])?I[lt].push({}):I[lt]=[I[lt],{}],I=I[lt][I[lt].length-1]):I=I[lt]});let T=Gd(k[k.length-1]),K=W(k.join("."),g.arrays),$=Array.isArray(M),te=a["duplicate-arguments-array"];!te&&W(T,g.nargs)&&(te=!0,(!ze(I[T])&&g.nargs[T]===1||Array.isArray(I[T])&&I[T].length===g.nargs[T])&&(I[T]=void 0)),M===oc()?I[T]=oc(I[T]):Array.isArray(I[T])?te&&K&&$?I[T]=a["flatten-duplicate-arrays"]?I[T].concat(M):(Array.isArray(I[T][0])?I[T]:[I[T]]).concat([M]):!te&&!!K==!!$?I[T]=M:I[T]=I[T].concat([M]):I[T]===void 0&&K?I[T]=$?M:[M]:te&&!(I[T]===void 0||W(T,g.counts)||W(T,g.bools))?I[T]=[I[T],M]:I[T]=M}function E(...A){A.forEach(function(k){Object.keys(k||{}).forEach(function(M){g.aliases[M]||(g.aliases[M]=[].concat(s[M]||[]),g.aliases[M].concat(M).forEach(function(I){if(/-/.test(I)&&a["camel-case-expansion"]){let T=$n(I);T!==M&&g.aliases[M].indexOf(T)===-1&&(g.aliases[M].push(T),d[T]=!0)}}),g.aliases[M].concat(M).forEach(function(I){if(I.length>1&&/[A-Z]/.test(I)&&a["camel-case-expansion"]){let T=pa(I,"-");T!==M&&g.aliases[M].indexOf(T)===-1&&(g.aliases[M].push(T),d[T]=!0)}}),g.aliases[M].forEach(function(I){g.aliases[I]=[M].concat(g.aliases[M].filter(function(T){return I!==T}))}))})})}function W(A,k){let M=[].concat(g.aliases[A]||[],A),I=Object.keys(k),T=M.find(K=>I.includes(K));return T?k[T]:!1}function Ke(A){let k=Object.keys(g);return[].concat(k.map(I=>g[I])).some(function(I){return Array.isArray(I)?I.includes(A):I[A]})}function ne(A,...k){return[].concat(...k).some(function(I){let T=A.match(I);return T&&Ke(T[1])})}function he(A){if(A.match(b)||!A.match(/^-[^-]+/))return!1;let k=!0,M,I=A.slice(1).split("");for(let T=0;T<I.length;T++){if(M=A.slice(T+2),!Ke(I[T])){k=!1;break}if(I[T+1]&&I[T+1]==="="||M==="-"||/[A-Za-z]/.test(I[T])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(M)||I[T+1]&&I[T+1].match(/\W/))break}return k}function oe(A){return a["unknown-options-as-args"]&&ce(A)}function ce(A){return A=A.replace(/^-{3,}/,"--"),A.match(b)||he(A)?!1:!ne(A,/^-+([^=]+?)=[\s\S]*$/,C,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function me(A){return!W(A,g.bools)&&!W(A,g.counts)&&`${A}`in u?u[A]:Ce(Fe(A))}function Ce(A){return{[rr.BOOLEAN]:!0,[rr.STRING]:"",[rr.NUMBER]:void 0,[rr.ARRAY]:[]}[A]}function Fe(A){let k=rr.BOOLEAN;return W(A,g.strings)?k=rr.STRING:W(A,g.numbers)?k=rr.NUMBER:W(A,g.bools)?k=rr.BOOLEAN:W(A,g.arrays)&&(k=rr.ARRAY),k}function ze(A){return A===void 0}function Ut(){Object.keys(g.counts).find(A=>W(A,g.arrays)?(w=Error(y("Invalid configuration: %s, opts.count excludes opts.array.",A)),!0):W(A,g.nargs)?(w=Error(y("Invalid configuration: %s, opts.count excludes opts.narg.",A)),!0):!1)}return{aliases:Object.assign({},g.aliases),argv:Object.assign(S,R),configuration:a,defaulted:Object.assign({},m),error:w,newAliases:Object.assign({},d)}}};function eC(t){let e=[],r=Object.create(null),n=!0;for(Object.keys(t).forEach(function(i){e.push([].concat(t[i],i))});n;){n=!1;for(let i=0;i<e.length;i++)for(let o=i+1;o<e.length;o++)if(e[i].filter(function(a){return e[o].indexOf(a)!==-1}).length){e[i]=e[i].concat(e[o]),e.splice(o,1),n=!0;break}}return e.forEach(function(i){i=i.filter(function(s,a,u){return u.indexOf(s)===a});let o=i.pop();o!==void 0&&typeof o=="string"&&(r[o]=i)}),r}function oc(t){return t!==void 0?t+1:1}function Gd(t){return t==="__proto__"?"___proto___":t}function tC(t){return typeof t=="string"&&(t[0]==="'"||t[0]==='"')&&t[t.length-1]===t[0]?t.substring(1,t.length-1):t}import{readFileSync as oC}from"fs";var sc,ac,uc,Wd=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Hd=(ac=(sc=process==null?void 0:process.versions)===null||sc===void 0?void 0:sc.node)!==null&&ac!==void 0?ac:(uc=process==null?void 0:process.version)===null||uc===void 0?void 0:uc.slice(1);if(Hd&&Number(Hd.match(/^([^.]+)/)[1])<Wd)throw Error(`yargs parser supports a minimum Node.js version of ${Wd}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var sC=process?process.env:{},Kd=new ha({cwd:process.cwd,env:()=>sC,format:rC,normalize:nC,resolve:iC,require:t=>{if(typeof Er<"u")return Er(t);if(t.match(/\.json$/))return JSON.parse(oC(t,"utf8"));throw Error("only .json config files are supported in ESM")}}),rs=function(e,r){return Kd.parse(e.slice(),r).argv};rs.detailed=function(t,e){return Kd.parse(t.slice(),e)};rs.camelCase=$n;rs.decamelize=pa;rs.looksLikeNumber=da;var lc=rs;import{basename as EC,dirname as AC,extname as wC,relative as CC,resolve as eh}from"path";function Yd(){return aC()?0:1}function aC(){return uC()&&!process.defaultApp}function uC(){return!!process.versions.electron}function cc(t){return t.slice(Yd()+1)}function Zd(){return process.argv[Yd()]}var $e=class t extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}};import{readFileSync as lC,statSync as cC,writeFile as fC}from"fs";import{format as pC}from"util";import{resolve as dC}from"path";var Xd={fs:{readFileSync:lC,writeFile:fC},format:pC,resolve:dC,exists:t=>{try{return cC(t).isFile()}catch{return!1}}};var hr,fc=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),hr.format.apply(hr.format,[this.cache[this.locale][r]||r].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),r=e.shift(),n=e.shift(),i=e.shift(),o=function(){};typeof e[e.length-1]=="function"&&(o=e.pop()),this.cache[this.locale]||this._readLocaleFile();let s=i===1?r:n;this.cache[this.locale][r]&&(s=this.cache[this.locale][r][i===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();let a=[s];return~s.indexOf("%d")&&a.push(i),hr.format.apply(hr.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.cache[this.locale][r]=e[r])}_taggedLiteral(e,...r){let n="";return e.forEach(function(i,o){let s=r[o+1];n+=i,typeof s<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,r=this.writeQueue[0],n=r.directory,i=r.locale,o=r.cb,s=this._resolveLocaleFile(n,i),a=JSON.stringify(this.cache[i],null,2);hr.fs.writeFile(s,a,"utf-8",function(u){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),o(u)})}_readLocaleFile(){let e={},r=this._resolveLocaleFile(this.directory,this.locale);try{hr.fs.readFileSync&&(e=JSON.parse(hr.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,r){let n=hr.resolve(e,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){let i=hr.resolve(e,"./",r.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(e){return hr.exists(e)}};function Jd(t,e){hr=e;let r=new fc(t);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var hC=t=>Jd(t,Xd),Qd=hC;var kC="require is not supported by ESM",th="loading a directory of commands is not supported yet for ESM",ns;try{ns=bC(import.meta.url)}catch{ns=process.cwd()}var TC=ns.substring(0,ns.lastIndexOf("node_modules")),pc={assert:{notStrictEqual:mC,strictEqual:gC},cliui:ic,findUp:qd,getEnv:t=>process.env[t],inspect:xC,getCallerFile:()=>{throw new $e(th)},getProcessArgvBin:Zd,mainFilename:TC||process.cwd(),Parser:lc,path:{basename:EC,dirname:AC,extname:wC,relative:CC,resolve:eh},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:yC,require:()=>{throw new $e(kC)},requireDirectory:()=>{throw new $e(th)},stringWidth:t=>[...t].length,y18n:Qd({directory:eh(ns,"../../../locales"),updateFiles:!1})};function Dt(t,e,r,n){r.assert.notStrictEqual(t,e,n)}function dc(t,e){e.assert.strictEqual(typeof t,"string")}function $i(t){return Object.keys(t)}function qe(t){return!!t&&!!t.then&&typeof t.then=="function"}function ln(t){let r=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=r.shift();if(!i)throw new Error(`No command found in: ${t}`);let o={cmd:i.replace(n,""),demanded:[],optional:[]};return r.forEach((s,a)=>{let u=!1;s=s.replace(/\s/g,""),/\.+[\]>]/.test(s)&&a===r.length-1&&(u=!0),/^\[/.test(s)?o.optional.push({cmd:s.replace(n,"").split("|"),variadic:u}):o.demanded.push({cmd:s.replace(n,"").split("|"),variadic:u})}),o}var _C=["first","second","third","fourth","fifth","sixth"];function H(t,e,r){function n(){return typeof t=="object"?[{demanded:[],optional:[]},t,e]:[ln(`cmd ${t}`),e,r]}try{let i=0,[o,s,a]=n(),u=[].slice.call(s);for(;u.length&&u[u.length-1]===void 0;)u.pop();let l=a||u.length;if(l<o.demanded.length)throw new $e(`Not enough arguments provided. Expected ${o.demanded.length} but received ${u.length}.`);let c=o.demanded.length+o.optional.length;if(l>c)throw new $e(`Too many arguments provided. Expected max ${c} but received ${l}.`);o.demanded.forEach(f=>{let p=u.shift(),d=rh(p);f.cmd.filter(y=>y===d||y==="*").length===0&&nh(d,f.cmd,i),i+=1}),o.optional.forEach(f=>{if(u.length===0)return;let p=u.shift(),d=rh(p);f.cmd.filter(y=>y===d||y==="*").length===0&&nh(d,f.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function rh(t){return Array.isArray(t)?"array":t===null?"null":typeof t}function nh(t,e,r){throw new $e(`Invalid ${_C[r]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}var ma=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,r,n=!0,i=!1){if(H("<array|function> [boolean] [boolean] [boolean]",[e,r,n],arguments.length),Array.isArray(e)){for(let o=0;o<e.length;o++){if(typeof e[o]!="function")throw Error("middleware must be a function");let s=e[o];s.applyBeforeValidation=r,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let o=e;o.applyBeforeValidation=r,o.global=n,o.mutates=i,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,r){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let o=[...n[r]||[],r];return i.option?!o.includes(i.option):!0}),e.option=r,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function ih(t){return t?t.map(e=>(e.applyBeforeValidation=!1,e)):[]}function qn(t,e,r,n){return r.reduce((i,o)=>{if(o.applyBeforeValidation!==n)return i;if(o.mutates){if(o.applied)return i;o.applied=!0}if(qe(i))return i.then(s=>Promise.all([s,o(s,e)])).then(([s,a])=>Object.assign(s,a));{let s=o(i,e);return qe(s)?s.then(a=>Object.assign(i,a)):Object.assign(i,s)}},t)}function Vn(t,e,r=n=>{throw n}){try{let n=SC(t)?t():t;return qe(n)?n.then(i=>e(i)):e(n)}catch(n){return r(n)}}function SC(t){return typeof t=="function"}function hc(t){if(typeof Er>"u")return null;for(let e=0,r=Object.keys(Er.cache),n;e<r.length;e++)if(n=Er.cache[r[e]],n.exports===t)return n;return null}var qi=/(^\*)|(^\$0)/,mc=class{constructor(e,r,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=e,this.globalMiddleware=n,this.validation=r}addDirectory(e,r,n,i){i=i||{},typeof i.recurse!="boolean"&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);let o=typeof i.visit=="function"?i.visit:s=>s;i.visit=(s,a,u)=>{let l=o(s,a,u);if(l){if(this.requireCache.has(a))return l;this.requireCache.add(a),this.addHandler(l)}return l},this.shim.requireDirectory({require:r,filename:n},e,i)}addHandler(e,r,n,i,o,s){let a=[],u=ih(o);if(i=i||(()=>{}),Array.isArray(e))if(vC(e))[e,...a]=e;else for(let l of e)this.addHandler(l);else if(OC(e)){let l=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(l=[].concat(l).concat(e.aliases)),this.addHandler(l,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(oh(n)){this.addHandler([e].concat(a),r,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let l=ln(e);a=a.map(p=>ln(p).cmd);let c=!1,f=[l.cmd].concat(a).filter(p=>qi.test(p)?(c=!0,!1):!0);f.length===0&&c&&f.push("$0"),c&&(l.cmd=f[0],a=f.slice(1),e=e.replace(qi,l.cmd)),a.forEach(p=>{this.aliasMap[p]=l.cmd}),r!==!1&&this.usage.command(e,r,c,a,s),this.handlers[l.cmd]={original:e,description:r,handler:i,builder:n||{},middlewares:u,deprecated:s,demanded:l.demanded,optional:l.optional},c&&(this.defaultCommand=this.handlers[l.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,r,n,i,o,s){let a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,u=r.getInternalMethods().getContext(),l=u.commands.slice(),c=!e;e&&(u.commands.push(e),u.fullCommands.push(a.original));let f=this.applyBuilderUpdateUsageAndParse(c,a,r,n.aliases,l,i,o,s);return qe(f)?f.then(p=>this.applyMiddlewareAndGetResult(c,a,p.innerArgv,u,o,p.aliases,r)):this.applyMiddlewareAndGetResult(c,a,f.innerArgv,u,o,f.aliases,r)}applyBuilderUpdateUsageAndParse(e,r,n,i,o,s,a,u){let l=r.builder,c=n;if(ga(l)){n.getInternalMethods().getUsageInstance().freeze();let f=l(n.getInternalMethods().reset(i),u);if(qe(f))return f.then(p=>(c=ah(p)?p:n,this.parseAndUpdateUsage(e,r,c,o,s,a)))}else IC(l)&&(n.getInternalMethods().getUsageInstance().freeze(),c=n.getInternalMethods().reset(i),Object.keys(r.builder).forEach(f=>{c.option(f,l[f])}));return this.parseAndUpdateUsage(e,r,c,o,s,a)}parseAndUpdateUsage(e,r,n,i,o,s){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,r),r.description);let a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,o,s);return qe(a)?a.then(u=>({aliases:n.parsed.aliases,innerArgv:u})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,r){let n=qi.test(r.original)?r.original.replace(qi,"").trim():r.original,i=e.filter(o=>!qi.test(o));return i.push(n),`$0 ${i.join(" ")}`}handleValidationAndGetResult(e,r,n,i,o,s,a,u){if(!s.getInternalMethods().getHasOutput()){let l=s.getInternalMethods().runValidation(o,u,s.parsed.error,e);n=Vn(n,c=>(l(c),c))}if(r.handler&&!s.getInternalMethods().getHasOutput()){s.getInternalMethods().setHasOutput();let l=!!s.getOptions().configuration["populate--"];s.getInternalMethods().postProcess(n,l,!1,!1),n=qn(n,s,a,!1),n=Vn(n,c=>{let f=r.handler(c);return qe(f)?f.then(()=>c):c}),e||s.getInternalMethods().getUsageInstance().cacheHelpMessage(),qe(n)&&!s.getInternalMethods().hasParseCallback()&&n.catch(c=>{try{s.getInternalMethods().getUsageInstance().fail(null,c)}catch{}})}return e||(i.commands.pop(),i.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,r,n,i,o,s,a){let u={};if(o)return n;a.getInternalMethods().getHasOutput()||(u=this.populatePositionals(r,n,i,a));let l=this.globalMiddleware.getMiddleware().slice(0).concat(r.middlewares),c=qn(n,a,l,!0);return qe(c)?c.then(f=>this.handleValidationAndGetResult(e,r,f,i,s,a,l,u)):this.handleValidationAndGetResult(e,r,c,i,s,a,l,u)}populatePositionals(e,r,n,i){r._=r._.slice(n.commands.length);let o=e.demanded.slice(0),s=e.optional.slice(0),a={};for(this.validation.positionalCount(o.length,r._.length);o.length;){let u=o.shift();this.populatePositional(u,r,a)}for(;s.length;){let u=s.shift();this.populatePositional(u,r,a)}return r._=n.commands.concat(r._.map(u=>""+u)),this.postProcessPositionals(r,a,this.cmdToParseOptions(e.original),i),a}populatePositional(e,r,n){let i=e.cmd[0];e.variadic?n[i]=r._.splice(0).map(String):r._.length&&(n[i]=[String(r._.shift())])}cmdToParseOptions(e){let r={array:[],default:{},alias:{},demand:{}},n=ln(e);return n.demanded.forEach(i=>{let[o,...s]=i.cmd;i.variadic&&(r.array.push(o),r.default[o]=[]),r.alias[o]=s,r.demand[o]=!0}),n.optional.forEach(i=>{let[o,...s]=i.cmd;i.variadic&&(r.array.push(o),r.default[o]=[]),r.alias[o]=s}),r}postProcessPositionals(e,r,n,i){let o=Object.assign({},i.getOptions());o.default=Object.assign(n.default,o.default);for(let l of Object.keys(n.alias))o.alias[l]=(o.alias[l]||[]).concat(n.alias[l]);o.array=o.array.concat(n.array),o.config={};let s=[];if(Object.keys(r).forEach(l=>{r[l].map(c=>{o.configuration["unknown-options-as-args"]&&(o.key[l]=!0),s.push(`--${l}`),s.push(c)})}),!s.length)return;let a=Object.assign({},o.configuration,{"populate--":!1}),u=this.shim.Parser.detailed(s,Object.assign({},o,{configuration:a}));if(u.error)i.getInternalMethods().getUsageInstance().fail(u.error.message,u.error);else{let l=Object.keys(r);Object.keys(r).forEach(c=>{l.push(...u.aliases[c])}),Object.keys(u.argv).forEach(c=>{l.includes(c)&&(r[c]||(r[c]=u.argv[c]),!this.isInConfigs(i,c)&&!this.isDefaulted(i,c)&&Object.prototype.hasOwnProperty.call(e,c)&&Object.prototype.hasOwnProperty.call(u.argv,c)&&(Array.isArray(e[c])||Array.isArray(u.argv[c]))?e[c]=[].concat(e[c],u.argv[c]):e[c]=u.argv[c])})}}isDefaulted(e,r){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,r)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(r))}isInConfigs(e,r){let{configObjects:n}=e.getOptions();return n.some(i=>Object.prototype.hasOwnProperty.call(i,r))||n.some(i=>Object.prototype.hasOwnProperty.call(i,this.shim.Parser.camelCase(r)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=qi.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let r=this.defaultCommand.builder;if(ga(r))return r(e,!0);oh(r)||Object.keys(r).forEach(n=>{e.option(n,r[n])})}moduleName(e){let r=hc(e);if(!r)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(r.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:r,desc:n}){for(let i of[e,r,n]){if(typeof i=="string"||i===!1)return i;Dt(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();Dt(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function sh(t,e,r,n){return new mc(t,e,r,n)}function oh(t){return typeof t=="object"&&!!t.builder&&typeof t.handler=="function"}function vC(t){return t.every(e=>typeof e=="string")}function ga(t){return typeof t=="function"}function IC(t){return typeof t=="object"}function OC(t){return typeof t=="object"&&!Array.isArray(t)}function cn(t={},e=()=>!0){let r={};return $i(t).forEach(n=>{e(n,t[n])&&(r[n]=t[n])}),r}function fn(t){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let r=e;r._handle&&r.isTTY&&typeof r._handle.setBlocking=="function"&&r._handle.setBlocking(t)})}function DC(t){return typeof t=="boolean"}function lh(t,e){let r=e.y18n.__,n={},i=[];n.failFn=function(F){i.push(F)};let o=null,s=null,a=!0;n.showHelpOnFail=function(F=!0,v){let[P,j]=typeof F=="string"?[!0,F]:[F,v];return t.getInternalMethods().isGlobalContext()&&(s=j),o=j,a=P,n};let u=!1;n.fail=function(F,v){let P=t.getInternalMethods().getLoggerInstance();if(i.length)for(let j=i.length-1;j>=0;--j){let ae=i[j];if(DC(ae)){if(v)throw v;if(F)throw Error(F)}else ae(F,v,n)}else{if(t.getExitProcess()&&fn(!0),!u){u=!0,a&&(t.showHelp("error"),P.error()),(F||v)&&P.error(F||v);let j=o||s;j&&((F||v)&&P.error(""),P.error(j))}if(v=v||new $e(F),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,v);throw v}};let l=[],c=!1;n.usage=(L,F)=>L===null?(c=!0,l=[],n):(c=!1,l.push([L,F||""]),n),n.getUsage=()=>l,n.getUsageDisabled=()=>c,n.getPositionalGroupName=()=>r("Positionals:");let f=[];n.example=(L,F)=>{f.push([L,F||""])};let p=[];n.command=function(F,v,P,j,ae=!1){P&&(p=p.map(ee=>(ee[2]=!1,ee))),p.push([F,v||"",P,j,ae])},n.getCommands=()=>p;let d={};n.describe=function(F,v){Array.isArray(F)?F.forEach(P=>{n.describe(P,v)}):typeof F=="object"?Object.keys(F).forEach(P=>{n.describe(P,F[P])}):d[F]=v},n.getDescriptions=()=>d;let m=[];n.epilog=L=>{m.push(L)};let y=!1,g;n.wrap=L=>{y=!0,g=L},n.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(y||(g=ye(),y=!0),g);let b="__yargsString__:";n.deferY18nLookup=L=>b+L,n.help=function(){if(D)return D;w();let F=t.customScriptName?t.$0:e.path.basename(t.$0),v=t.getDemandedOptions(),P=t.getDemandedCommands(),j=t.getDeprecatedOptions(),ae=t.getGroups(),ee=t.getOptions(),_e=[];_e=_e.concat(Object.keys(d)),_e=_e.concat(Object.keys(v)),_e=_e.concat(Object.keys(P)),_e=_e.concat(Object.keys(ee.default)),_e=_e.filter(S),_e=Object.keys(_e.reduce((ne,he)=>(he!=="_"&&(ne[he]=!0),ne),{}));let rt=n.getWrap(),x=e.cliui({width:rt,wrap:!!rt});if(!c){if(l.length)l.forEach(ne=>{x.div({text:`${ne[0].replace(/\$0/g,F)}`}),ne[1]&&x.div({text:`${ne[1]}`,padding:[1,0,0,0]})}),x.div();else if(p.length){let ne=null;P._?ne=`${F} <${r("command")}> `:ne=`${F} [${r("command")}] `,x.div(`${ne}`)}}if(p.length>1||p.length===1&&!p[0][2]){x.div(r("Commands:"));let ne=t.getInternalMethods().getContext(),he=ne.commands.length?`${ne.commands.join(" ")} `:"";t.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(p=p.sort((ce,me)=>ce[0].localeCompare(me[0])));let oe=F?`${F} `:"";p.forEach(ce=>{let me=`${oe}${he}${ce[0].replace(/^\$0 ?/,"")}`;x.span({text:me,padding:[0,2,0,2],width:C(p,rt,`${F}${he}`)+4},{text:ce[1]});let Ce=[];ce[2]&&Ce.push(`[${r("default")}]`),ce[3]&&ce[3].length&&Ce.push(`[${r("aliases:")} ${ce[3].join(", ")}]`),ce[4]&&(typeof ce[4]=="string"?Ce.push(`[${r("deprecated: %s",ce[4])}]`):Ce.push(`[${r("deprecated")}]`)),Ce.length?x.div({text:Ce.join(" "),padding:[0,0,0,2],align:"right"}):x.div()}),x.div()}let Ue=(Object.keys(ee.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);_e=_e.filter(ne=>!t.parsed.newAliases[ne]&&Ue.every(he=>(ee.alias[he]||[]).indexOf(ne)===-1));let Je=r("Options:");ae[Je]||(ae[Je]=[]),R(_e,ee.alias,ae,Je);let E=ne=>/^--/.test(xa(ne)),W=Object.keys(ae).filter(ne=>ae[ne].length>0).map(ne=>{let he=ae[ne].filter(S).map(oe=>{if(Ue.includes(oe))return oe;for(let ce=0,me;(me=Ue[ce])!==void 0;ce++)if((ee.alias[me]||[]).includes(oe))return me;return oe});return{groupName:ne,normalizedKeys:he}}).filter(({normalizedKeys:ne})=>ne.length>0).map(({groupName:ne,normalizedKeys:he})=>{let oe=he.reduce((ce,me)=>(ce[me]=[me].concat(ee.alias[me]||[]).map(Ce=>ne===n.getPositionalGroupName()?Ce:(/^[0-9]$/.test(Ce)?ee.boolean.includes(me)?"-":"--":Ce.length>1?"--":"-")+Ce).sort((Ce,Fe)=>E(Ce)===E(Fe)?0:E(Ce)?1:-1).join(", "),ce),{});return{groupName:ne,normalizedKeys:he,switches:oe}});if(W.filter(({groupName:ne})=